page-agent-sdk 4.25.4 → 4.26.0
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 +2 -2
- package/README.zh-CN.md +2 -2
- package/dist/page-agent-sdk.headless.js +836 -802
- package/dist/page-agent-sdk.iife.js +16 -16
- package/dist/page-agent-sdk.js +575 -527
- package/dist/page-agent-sdk.legacy.js +15386 -15331
- package/dist/page-agent-sdk.umd.cjs +16 -16
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/style.css +1 -1
- package/types/headless.d.ts +17 -2
- package/types/index.d.ts +22 -4
|
@@ -462,9 +462,9 @@ function ne(e) {
|
|
|
462
462
|
t?.response_metadata?.token_usage,
|
|
463
463
|
t?.response_metadata?.tokenUsage
|
|
464
464
|
];
|
|
465
|
-
for (let e of n) if (e && typeof e == "object" &&
|
|
465
|
+
for (let e of n) if (e && typeof e == "object" && A(e)) return e;
|
|
466
466
|
}
|
|
467
|
-
function
|
|
467
|
+
function A(e) {
|
|
468
468
|
return [
|
|
469
469
|
"prompt_tokens",
|
|
470
470
|
"completion_tokens",
|
|
@@ -478,7 +478,7 @@ function re(e) {
|
|
|
478
478
|
"outputTokens"
|
|
479
479
|
].some((t) => typeof e[t] == "number" && e[t] > 0);
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function re(e) {
|
|
482
482
|
let t = ne(e);
|
|
483
483
|
if (!t || typeof t != "object") return null;
|
|
484
484
|
let n = t, r = Number(n.prompt_tokens ?? n.promptTokens ?? n.input_tokens ?? n.inputTokens ?? 0) || 0, i = Number(n.completion_tokens ?? n.completionTokens ?? n.output_tokens ?? n.outputTokens ?? 0) || 0, a = Number(n.total_tokens ?? n.totalTokens ?? r + i) || 0;
|
|
@@ -496,17 +496,17 @@ function ie(e) {
|
|
|
496
496
|
//#endregion
|
|
497
497
|
//#region node_modules/@vue/shared/dist/shared.esm-bundler.js
|
|
498
498
|
// @__NO_SIDE_EFFECTS__
|
|
499
|
-
function
|
|
499
|
+
function ie(e) {
|
|
500
500
|
let t = /* @__PURE__ */ Object.create(null);
|
|
501
501
|
for (let n of e.split(",")) t[n] = 1;
|
|
502
502
|
return (e) => e in t;
|
|
503
503
|
}
|
|
504
|
-
var
|
|
504
|
+
var ae = process.env.NODE_ENV === "production" ? {} : Object.freeze({});
|
|
505
505
|
process.env.NODE_ENV === "production" || Object.freeze([]);
|
|
506
|
-
var
|
|
506
|
+
var j = () => {}, M = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && (e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97), oe = (e) => e.startsWith("onUpdate:"), N = Object.assign, se = (e, t) => {
|
|
507
507
|
let n = e.indexOf(t);
|
|
508
508
|
n > -1 && e.splice(n, 1);
|
|
509
|
-
}, P = Object.prototype.hasOwnProperty, F = (e, t) => P.call(e, t), I = Array.isArray, ce = (e) => me(e) === "[object Map]", le = (e) => me(e) === "[object Set]", L = (e) => typeof e == "function", ue = (e) => typeof e == "string", de = (e) => typeof e == "symbol", R = (e) => typeof e == "object" && !!e, fe = (e) => (R(e) || L(e)) && L(e.then) && L(e.catch), pe = Object.prototype.toString, me = (e) => pe.call(e),
|
|
509
|
+
}, P = Object.prototype.hasOwnProperty, F = (e, t) => P.call(e, t), I = Array.isArray, ce = (e) => me(e) === "[object Map]", le = (e) => me(e) === "[object Set]", L = (e) => typeof e == "function", ue = (e) => typeof e == "string", de = (e) => typeof e == "symbol", R = (e) => typeof e == "object" && !!e, fe = (e) => (R(e) || L(e)) && L(e.then) && L(e.catch), pe = Object.prototype.toString, me = (e) => pe.call(e), he = (e) => me(e).slice(8, -1), z = (e) => me(e) === "[object Object]", B = (e) => ue(e) && e !== "NaN" && e[0] !== "-" && "" + parseInt(e, 10) === e, V = ((e) => {
|
|
510
510
|
let t = /* @__PURE__ */ Object.create(null);
|
|
511
511
|
return ((n) => t[n] || (t[n] = e(n)));
|
|
512
512
|
})((e) => e.charAt(0).toUpperCase() + e.slice(1)), ge = (e, t) => !Object.is(e, t), _e = (e, t, n, r = !1) => {
|
|
@@ -556,7 +556,7 @@ var we;
|
|
|
556
556
|
function Te() {
|
|
557
557
|
return we;
|
|
558
558
|
}
|
|
559
|
-
var G,
|
|
559
|
+
var G, K = /* @__PURE__ */ new WeakSet(), Ee = class {
|
|
560
560
|
constructor(e) {
|
|
561
561
|
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, we && (we.active ? we.effects.push(this) : this.flags &= -2);
|
|
562
562
|
}
|
|
@@ -564,61 +564,61 @@ var G, Ee = /* @__PURE__ */ new WeakSet(), De = class {
|
|
|
564
564
|
this.flags |= 64;
|
|
565
565
|
}
|
|
566
566
|
resume() {
|
|
567
|
-
this.flags & 64 && (this.flags &= -65,
|
|
567
|
+
this.flags & 64 && (this.flags &= -65, K.has(this) && (K.delete(this), this.trigger()));
|
|
568
568
|
}
|
|
569
569
|
notify() {
|
|
570
|
-
this.flags & 2 && !(this.flags & 32) || this.flags & 8 ||
|
|
570
|
+
this.flags & 2 && !(this.flags & 32) || this.flags & 8 || Ae(this);
|
|
571
571
|
}
|
|
572
572
|
run() {
|
|
573
573
|
if (!(this.flags & 1)) return this.fn();
|
|
574
|
-
this.flags |= 2,
|
|
575
|
-
let e = G, t =
|
|
576
|
-
G = this,
|
|
574
|
+
this.flags |= 2, Ue(this), Ne(this);
|
|
575
|
+
let e = G, t = ze;
|
|
576
|
+
G = this, ze = !0;
|
|
577
577
|
try {
|
|
578
578
|
return this.fn();
|
|
579
579
|
} finally {
|
|
580
|
-
process.env.NODE_ENV !== "production" && G !== this && Ce("Active effect was not restored correctly - this is likely a Vue internal bug."),
|
|
580
|
+
process.env.NODE_ENV !== "production" && G !== this && Ce("Active effect was not restored correctly - this is likely a Vue internal bug."), Pe(this), G = e, ze = t, this.flags &= -3;
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
stop() {
|
|
584
584
|
if (this.flags & 1) {
|
|
585
|
-
for (let e = this.deps; e; e = e.nextDep)
|
|
586
|
-
this.deps = this.depsTail = void 0,
|
|
585
|
+
for (let e = this.deps; e; e = e.nextDep) Le(e);
|
|
586
|
+
this.deps = this.depsTail = void 0, Ue(this), this.onStop && this.onStop(), this.flags &= -2;
|
|
587
587
|
}
|
|
588
588
|
}
|
|
589
589
|
trigger() {
|
|
590
|
-
this.flags & 64 ?
|
|
590
|
+
this.flags & 64 ? K.add(this) : this.scheduler ? this.scheduler() : this.runIfDirty();
|
|
591
591
|
}
|
|
592
592
|
runIfDirty() {
|
|
593
|
-
|
|
593
|
+
Fe(this) && this.run();
|
|
594
594
|
}
|
|
595
595
|
get dirty() {
|
|
596
|
-
return
|
|
596
|
+
return Fe(this);
|
|
597
597
|
}
|
|
598
|
-
},
|
|
599
|
-
function
|
|
598
|
+
}, De = 0, Oe, ke;
|
|
599
|
+
function Ae(e, t = !1) {
|
|
600
600
|
if (e.flags |= 8, t) {
|
|
601
|
-
e.next =
|
|
601
|
+
e.next = ke, ke = e;
|
|
602
602
|
return;
|
|
603
603
|
}
|
|
604
|
-
e.next =
|
|
604
|
+
e.next = Oe, Oe = e;
|
|
605
605
|
}
|
|
606
|
-
function
|
|
607
|
-
|
|
606
|
+
function je() {
|
|
607
|
+
De++;
|
|
608
608
|
}
|
|
609
|
-
function
|
|
610
|
-
if (--
|
|
611
|
-
if (
|
|
612
|
-
let e =
|
|
613
|
-
for (
|
|
609
|
+
function Me() {
|
|
610
|
+
if (--De > 0) return;
|
|
611
|
+
if (ke) {
|
|
612
|
+
let e = ke;
|
|
613
|
+
for (ke = void 0; e;) {
|
|
614
614
|
let t = e.next;
|
|
615
615
|
e.next = void 0, e.flags &= -9, e = t;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
let e;
|
|
619
|
-
for (;
|
|
620
|
-
let t =
|
|
621
|
-
for (
|
|
619
|
+
for (; Oe;) {
|
|
620
|
+
let t = Oe;
|
|
621
|
+
for (Oe = void 0; t;) {
|
|
622
622
|
let n = t.next;
|
|
623
623
|
if (t.next = void 0, t.flags &= -9, t.flags & 1) try {
|
|
624
624
|
t.trigger();
|
|
@@ -630,57 +630,57 @@ function Ne() {
|
|
|
630
630
|
}
|
|
631
631
|
if (e) throw e;
|
|
632
632
|
}
|
|
633
|
-
function
|
|
633
|
+
function Ne(e) {
|
|
634
634
|
for (let t = e.deps; t; t = t.nextDep) t.version = -1, t.prevActiveLink = t.dep.activeLink, t.dep.activeLink = t;
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function Pe(e) {
|
|
637
637
|
let t, n = e.depsTail, r = n;
|
|
638
638
|
for (; r;) {
|
|
639
639
|
let e = r.prevDep;
|
|
640
|
-
r.version === -1 ? (r === n && (n = e),
|
|
640
|
+
r.version === -1 ? (r === n && (n = e), Le(r), Re(r)) : t = r, r.dep.activeLink = r.prevActiveLink, r.prevActiveLink = void 0, r = e;
|
|
641
641
|
}
|
|
642
642
|
e.deps = t, e.depsTail = n;
|
|
643
643
|
}
|
|
644
|
-
function
|
|
645
|
-
for (let t = e.deps; t; t = t.nextDep) if (t.dep.version !== t.version || t.dep.computed && (
|
|
644
|
+
function Fe(e) {
|
|
645
|
+
for (let t = e.deps; t; t = t.nextDep) if (t.dep.version !== t.version || t.dep.computed && (Ie(t.dep.computed) || t.dep.version !== t.version)) return !0;
|
|
646
646
|
return !!e._dirty;
|
|
647
647
|
}
|
|
648
|
-
function
|
|
649
|
-
if (e.flags & 4 && !(e.flags & 16) || (e.flags &= -17, e.globalVersion ===
|
|
648
|
+
function Ie(e) {
|
|
649
|
+
if (e.flags & 4 && !(e.flags & 16) || (e.flags &= -17, e.globalVersion === We) || (e.globalVersion = We, !e.isSSR && e.flags & 128 && (!e.deps && !e._dirty || !Fe(e)))) return;
|
|
650
650
|
e.flags |= 2;
|
|
651
|
-
let t = e.dep, n = G, r =
|
|
652
|
-
G = e,
|
|
651
|
+
let t = e.dep, n = G, r = ze;
|
|
652
|
+
G = e, ze = !0;
|
|
653
653
|
try {
|
|
654
|
-
|
|
654
|
+
Ne(e);
|
|
655
655
|
let n = e.fn(e._value);
|
|
656
656
|
(t.version === 0 || ge(n, e._value)) && (e.flags |= 128, e._value = n, t.version++);
|
|
657
657
|
} catch (e) {
|
|
658
658
|
throw t.version++, e;
|
|
659
659
|
} finally {
|
|
660
|
-
G = n,
|
|
660
|
+
G = n, ze = r, Pe(e), e.flags &= -3;
|
|
661
661
|
}
|
|
662
662
|
}
|
|
663
|
-
function
|
|
663
|
+
function Le(e, t = !1) {
|
|
664
664
|
let { dep: n, prevSub: r, nextSub: i } = e;
|
|
665
665
|
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)) {
|
|
666
666
|
n.computed.flags &= -5;
|
|
667
|
-
for (let e = n.computed.deps; e; e = e.nextDep)
|
|
667
|
+
for (let e = n.computed.deps; e; e = e.nextDep) Le(e, !0);
|
|
668
668
|
}
|
|
669
669
|
!t && !--n.sc && n.map && n.map.delete(n.key);
|
|
670
670
|
}
|
|
671
|
-
function
|
|
671
|
+
function Re(e) {
|
|
672
672
|
let { prevDep: t, nextDep: n } = e;
|
|
673
673
|
t && (t.nextDep = n, e.prevDep = void 0), n && (n.prevDep = t, e.nextDep = void 0);
|
|
674
674
|
}
|
|
675
|
-
var
|
|
676
|
-
function
|
|
677
|
-
|
|
675
|
+
var ze = !0, Be = [];
|
|
676
|
+
function Ve() {
|
|
677
|
+
Be.push(ze), ze = !1;
|
|
678
678
|
}
|
|
679
|
-
function
|
|
680
|
-
let e =
|
|
681
|
-
|
|
679
|
+
function He() {
|
|
680
|
+
let e = Be.pop();
|
|
681
|
+
ze = e === void 0 || e;
|
|
682
682
|
}
|
|
683
|
-
function
|
|
683
|
+
function Ue(e) {
|
|
684
684
|
let { cleanup: t } = e;
|
|
685
685
|
if (e.cleanup = void 0, t) {
|
|
686
686
|
let e = G;
|
|
@@ -692,65 +692,65 @@ function We(e) {
|
|
|
692
692
|
}
|
|
693
693
|
}
|
|
694
694
|
}
|
|
695
|
-
var
|
|
695
|
+
var We = 0, Ge = class {
|
|
696
696
|
constructor(e, t) {
|
|
697
697
|
this.sub = e, this.dep = t, this.version = t.version, this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
|
|
698
698
|
}
|
|
699
|
-
},
|
|
699
|
+
}, Ke = class {
|
|
700
700
|
constructor(e) {
|
|
701
701
|
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);
|
|
702
702
|
}
|
|
703
703
|
track(e) {
|
|
704
|
-
if (!G || !
|
|
704
|
+
if (!G || !ze || G === this.computed) return;
|
|
705
705
|
let t = this.activeLink;
|
|
706
|
-
if (t === void 0 || t.sub !== G) t = this.activeLink = new
|
|
706
|
+
if (t === void 0 || t.sub !== G) t = this.activeLink = new Ge(G, this), G.deps ? (t.prevDep = G.depsTail, G.depsTail.nextDep = t, G.depsTail = t) : G.deps = G.depsTail = t, qe(t);
|
|
707
707
|
else if (t.version === -1 && (t.version = this.version, t.nextDep)) {
|
|
708
708
|
let e = t.nextDep;
|
|
709
709
|
e.prevDep = t.prevDep, t.prevDep && (t.prevDep.nextDep = e), t.prevDep = G.depsTail, t.nextDep = void 0, G.depsTail.nextDep = t, G.depsTail = t, G.deps === t && (G.deps = e);
|
|
710
710
|
}
|
|
711
|
-
return process.env.NODE_ENV !== "production" && G.onTrack && G.onTrack(
|
|
711
|
+
return process.env.NODE_ENV !== "production" && G.onTrack && G.onTrack(N({ effect: G }, e)), t;
|
|
712
712
|
}
|
|
713
713
|
trigger(e) {
|
|
714
|
-
this.version++,
|
|
714
|
+
this.version++, We++, this.notify(e);
|
|
715
715
|
}
|
|
716
716
|
notify(e) {
|
|
717
|
-
|
|
717
|
+
je();
|
|
718
718
|
try {
|
|
719
|
-
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(
|
|
719
|
+
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(N({ effect: t.sub }, e));
|
|
720
720
|
for (let e = this.subs; e; e = e.prevSub) e.sub.notify() && e.sub.dep.notify();
|
|
721
721
|
} finally {
|
|
722
|
-
|
|
722
|
+
Me();
|
|
723
723
|
}
|
|
724
724
|
}
|
|
725
725
|
};
|
|
726
|
-
function
|
|
726
|
+
function qe(e) {
|
|
727
727
|
if (e.dep.sc++, e.sub.flags & 4) {
|
|
728
728
|
let t = e.dep.computed;
|
|
729
729
|
if (t && !e.dep.subs) {
|
|
730
730
|
t.flags |= 20;
|
|
731
|
-
for (let e = t.deps; e; e = e.nextDep)
|
|
731
|
+
for (let e = t.deps; e; e = e.nextDep) qe(e);
|
|
732
732
|
}
|
|
733
733
|
let n = e.dep.subs;
|
|
734
734
|
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;
|
|
735
735
|
}
|
|
736
736
|
}
|
|
737
|
-
var
|
|
738
|
-
function
|
|
739
|
-
if (
|
|
740
|
-
let r =
|
|
741
|
-
r ||
|
|
737
|
+
var Je = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ Symbol(process.env.NODE_ENV === "production" ? "" : "Object iterate"), Xe = /* @__PURE__ */ Symbol(process.env.NODE_ENV === "production" ? "" : "Map keys iterate"), Ze = /* @__PURE__ */ Symbol(process.env.NODE_ENV === "production" ? "" : "Array iterate");
|
|
738
|
+
function Qe(e, t, n) {
|
|
739
|
+
if (ze && G) {
|
|
740
|
+
let r = Je.get(e);
|
|
741
|
+
r || Je.set(e, r = /* @__PURE__ */ new Map());
|
|
742
742
|
let i = r.get(n);
|
|
743
|
-
i || (r.set(n, i = new
|
|
743
|
+
i || (r.set(n, i = new Ke()), i.map = r, i.key = n), process.env.NODE_ENV === "production" ? i.track() : i.track({
|
|
744
744
|
target: e,
|
|
745
745
|
type: t,
|
|
746
746
|
key: n
|
|
747
747
|
});
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
|
-
function
|
|
751
|
-
let o =
|
|
750
|
+
function $e(e, t, n, r, i, a) {
|
|
751
|
+
let o = Je.get(e);
|
|
752
752
|
if (!o) {
|
|
753
|
-
|
|
753
|
+
We++;
|
|
754
754
|
return;
|
|
755
755
|
}
|
|
756
756
|
let s = (o) => {
|
|
@@ -763,173 +763,173 @@ function et(e, t, n, r, i, a) {
|
|
|
763
763
|
oldTarget: a
|
|
764
764
|
}));
|
|
765
765
|
};
|
|
766
|
-
if (
|
|
766
|
+
if (je(), t === "clear") o.forEach(s);
|
|
767
767
|
else {
|
|
768
|
-
let i = I(e), a = i &&
|
|
768
|
+
let i = I(e), a = i && B(n);
|
|
769
769
|
if (i && n === "length") {
|
|
770
770
|
let e = Number(r);
|
|
771
771
|
o.forEach((t, n) => {
|
|
772
|
-
(n === "length" || n ===
|
|
772
|
+
(n === "length" || n === Ze || !de(n) && n >= e) && s(t);
|
|
773
773
|
});
|
|
774
|
-
} else switch ((n !== void 0 || o.has(void 0)) && s(o.get(n)), a && s(o.get(
|
|
774
|
+
} else switch ((n !== void 0 || o.has(void 0)) && s(o.get(n)), a && s(o.get(Ze)), t) {
|
|
775
775
|
case "add":
|
|
776
|
-
i ? a && s(o.get("length")) : (s(o.get(
|
|
776
|
+
i ? a && s(o.get("length")) : (s(o.get(Ye)), ce(e) && s(o.get(Xe)));
|
|
777
777
|
break;
|
|
778
778
|
case "delete":
|
|
779
|
-
i || (s(o.get(
|
|
779
|
+
i || (s(o.get(Ye)), ce(e) && s(o.get(Xe)));
|
|
780
780
|
break;
|
|
781
781
|
case "set":
|
|
782
|
-
ce(e) && s(o.get(
|
|
782
|
+
ce(e) && s(o.get(Ye));
|
|
783
783
|
break;
|
|
784
784
|
}
|
|
785
785
|
}
|
|
786
|
-
|
|
786
|
+
Me();
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function et(e) {
|
|
789
789
|
let t = /* @__PURE__ */ J(e);
|
|
790
|
-
return t === e ? t : (
|
|
790
|
+
return t === e ? t : (Qe(t, "iterate", Ze), /* @__PURE__ */ zt(e) ? t : t.map(Ht));
|
|
791
791
|
}
|
|
792
|
-
function
|
|
793
|
-
return
|
|
792
|
+
function tt(e) {
|
|
793
|
+
return Qe(e = /* @__PURE__ */ J(e), "iterate", Ze), e;
|
|
794
794
|
}
|
|
795
|
-
function
|
|
796
|
-
return /* @__PURE__ */
|
|
795
|
+
function q(e, t) {
|
|
796
|
+
return /* @__PURE__ */ Rt(e) ? Ut(/* @__PURE__ */ Lt(e) ? Ht(t) : t) : Ht(t);
|
|
797
797
|
}
|
|
798
|
-
var
|
|
798
|
+
var nt = {
|
|
799
799
|
__proto__: null,
|
|
800
800
|
[Symbol.iterator]() {
|
|
801
|
-
return
|
|
801
|
+
return rt(this, Symbol.iterator, (e) => q(this, e));
|
|
802
802
|
},
|
|
803
803
|
concat(...e) {
|
|
804
|
-
return
|
|
804
|
+
return et(this).concat(...e.map((e) => I(e) ? et(e) : e));
|
|
805
805
|
},
|
|
806
806
|
entries() {
|
|
807
|
-
return
|
|
807
|
+
return rt(this, "entries", (e) => (e[1] = q(this, e[1]), e));
|
|
808
808
|
},
|
|
809
809
|
every(e, t) {
|
|
810
|
-
return
|
|
810
|
+
return at(this, "every", e, t, void 0, arguments);
|
|
811
811
|
},
|
|
812
812
|
filter(e, t) {
|
|
813
|
-
return
|
|
813
|
+
return at(this, "filter", e, t, (e) => e.map((e) => q(this, e)), arguments);
|
|
814
814
|
},
|
|
815
815
|
find(e, t) {
|
|
816
|
-
return
|
|
816
|
+
return at(this, "find", e, t, (e) => q(this, e), arguments);
|
|
817
817
|
},
|
|
818
818
|
findIndex(e, t) {
|
|
819
|
-
return
|
|
819
|
+
return at(this, "findIndex", e, t, void 0, arguments);
|
|
820
820
|
},
|
|
821
821
|
findLast(e, t) {
|
|
822
|
-
return
|
|
822
|
+
return at(this, "findLast", e, t, (e) => q(this, e), arguments);
|
|
823
823
|
},
|
|
824
824
|
findLastIndex(e, t) {
|
|
825
|
-
return
|
|
825
|
+
return at(this, "findLastIndex", e, t, void 0, arguments);
|
|
826
826
|
},
|
|
827
827
|
forEach(e, t) {
|
|
828
|
-
return
|
|
828
|
+
return at(this, "forEach", e, t, void 0, arguments);
|
|
829
829
|
},
|
|
830
830
|
includes(...e) {
|
|
831
|
-
return
|
|
831
|
+
return st(this, "includes", e);
|
|
832
832
|
},
|
|
833
833
|
indexOf(...e) {
|
|
834
|
-
return
|
|
834
|
+
return st(this, "indexOf", e);
|
|
835
835
|
},
|
|
836
836
|
join(e) {
|
|
837
|
-
return
|
|
837
|
+
return et(this).join(e);
|
|
838
838
|
},
|
|
839
839
|
lastIndexOf(...e) {
|
|
840
|
-
return
|
|
840
|
+
return st(this, "lastIndexOf", e);
|
|
841
841
|
},
|
|
842
842
|
map(e, t) {
|
|
843
|
-
return
|
|
843
|
+
return at(this, "map", e, t, void 0, arguments);
|
|
844
844
|
},
|
|
845
845
|
pop() {
|
|
846
|
-
return
|
|
846
|
+
return ct(this, "pop");
|
|
847
847
|
},
|
|
848
848
|
push(...e) {
|
|
849
|
-
return
|
|
849
|
+
return ct(this, "push", e);
|
|
850
850
|
},
|
|
851
851
|
reduce(e, ...t) {
|
|
852
|
-
return
|
|
852
|
+
return ot(this, "reduce", e, t);
|
|
853
853
|
},
|
|
854
854
|
reduceRight(e, ...t) {
|
|
855
|
-
return
|
|
855
|
+
return ot(this, "reduceRight", e, t);
|
|
856
856
|
},
|
|
857
857
|
shift() {
|
|
858
|
-
return
|
|
858
|
+
return ct(this, "shift");
|
|
859
859
|
},
|
|
860
860
|
some(e, t) {
|
|
861
|
-
return
|
|
861
|
+
return at(this, "some", e, t, void 0, arguments);
|
|
862
862
|
},
|
|
863
863
|
splice(...e) {
|
|
864
|
-
return
|
|
864
|
+
return ct(this, "splice", e);
|
|
865
865
|
},
|
|
866
866
|
toReversed() {
|
|
867
|
-
return
|
|
867
|
+
return et(this).toReversed();
|
|
868
868
|
},
|
|
869
869
|
toSorted(e) {
|
|
870
|
-
return
|
|
870
|
+
return et(this).toSorted(e);
|
|
871
871
|
},
|
|
872
872
|
toSpliced(...e) {
|
|
873
|
-
return
|
|
873
|
+
return et(this).toSpliced(...e);
|
|
874
874
|
},
|
|
875
875
|
unshift(...e) {
|
|
876
|
-
return
|
|
876
|
+
return ct(this, "unshift", e);
|
|
877
877
|
},
|
|
878
878
|
values() {
|
|
879
|
-
return
|
|
879
|
+
return rt(this, "values", (e) => q(this, e));
|
|
880
880
|
}
|
|
881
881
|
};
|
|
882
|
-
function
|
|
883
|
-
let r =
|
|
884
|
-
return r !== e && !/* @__PURE__ */
|
|
882
|
+
function rt(e, t, n) {
|
|
883
|
+
let r = tt(e), i = r[t]();
|
|
884
|
+
return r !== e && !/* @__PURE__ */ zt(e) && (i._next = i.next, i.next = () => {
|
|
885
885
|
let e = i._next();
|
|
886
886
|
return e.done || (e.value = n(e.value)), e;
|
|
887
887
|
}), i;
|
|
888
888
|
}
|
|
889
|
-
var
|
|
890
|
-
function
|
|
891
|
-
let o =
|
|
892
|
-
if (c !==
|
|
889
|
+
var it = Array.prototype;
|
|
890
|
+
function at(e, t, n, r, i, a) {
|
|
891
|
+
let o = tt(e), s = o !== e && !/* @__PURE__ */ zt(e), c = o[t];
|
|
892
|
+
if (c !== it[t]) {
|
|
893
893
|
let t = c.apply(e, a);
|
|
894
894
|
return s ? Ht(t) : t;
|
|
895
895
|
}
|
|
896
896
|
let l = n;
|
|
897
897
|
o !== e && (s ? l = function(t, r) {
|
|
898
|
-
return n.call(this,
|
|
898
|
+
return n.call(this, q(e, t), r, e);
|
|
899
899
|
} : n.length > 2 && (l = function(t, r) {
|
|
900
900
|
return n.call(this, t, r, e);
|
|
901
901
|
}));
|
|
902
902
|
let u = c.call(o, l, r);
|
|
903
903
|
return s && i ? i(u) : u;
|
|
904
904
|
}
|
|
905
|
-
function
|
|
906
|
-
let i =
|
|
905
|
+
function ot(e, t, n, r) {
|
|
906
|
+
let i = tt(e), a = i !== e && !/* @__PURE__ */ zt(e), o = n, s = !1;
|
|
907
907
|
i !== e && (a ? (s = r.length === 0, o = function(t, r, i) {
|
|
908
|
-
return s && (s = !1, t =
|
|
908
|
+
return s && (s = !1, t = q(e, t)), n.call(this, t, q(e, r), i, e);
|
|
909
909
|
}) : n.length > 3 && (o = function(t, r, i) {
|
|
910
910
|
return n.call(this, t, r, i, e);
|
|
911
911
|
}));
|
|
912
912
|
let c = i[t](o, ...r);
|
|
913
|
-
return s ?
|
|
913
|
+
return s ? q(e, c) : c;
|
|
914
914
|
}
|
|
915
|
-
function
|
|
915
|
+
function st(e, t, n) {
|
|
916
916
|
let r = /* @__PURE__ */ J(e);
|
|
917
|
-
|
|
917
|
+
Qe(r, "iterate", Ze);
|
|
918
918
|
let i = r[t](...n);
|
|
919
919
|
return (i === -1 || i === !1) && /* @__PURE__ */ Bt(n[0]) ? (n[0] = /* @__PURE__ */ J(n[0]), r[t](...n)) : i;
|
|
920
920
|
}
|
|
921
|
-
function
|
|
922
|
-
|
|
921
|
+
function ct(e, t, n = []) {
|
|
922
|
+
Ve(), je();
|
|
923
923
|
let r = (/* @__PURE__ */ J(e))[t].apply(e, n);
|
|
924
|
-
return
|
|
924
|
+
return Me(), He(), r;
|
|
925
925
|
}
|
|
926
|
-
var
|
|
927
|
-
function
|
|
926
|
+
var lt = /* @__PURE__ */ ie("__proto__,__v_isRef,__isVue"), ut = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((e) => e !== "arguments" && e !== "caller").map((e) => Symbol[e]).filter(de));
|
|
927
|
+
function dt(e) {
|
|
928
928
|
de(e) || (e = String(e));
|
|
929
929
|
let t = /* @__PURE__ */ J(this);
|
|
930
|
-
return
|
|
930
|
+
return Qe(t, "has", e), t.hasOwnProperty(e);
|
|
931
931
|
}
|
|
932
|
-
var
|
|
932
|
+
var ft = class {
|
|
933
933
|
constructor(e = !1, t = !1) {
|
|
934
934
|
this._isReadonly = e, this._isShallow = t;
|
|
935
935
|
}
|
|
@@ -939,46 +939,46 @@ var pt = class {
|
|
|
939
939
|
if (t === "__v_isReactive") return !r;
|
|
940
940
|
if (t === "__v_isReadonly") return r;
|
|
941
941
|
if (t === "__v_isShallow") return i;
|
|
942
|
-
if (t === "__v_raw") return n === (r ? i ?
|
|
942
|
+
if (t === "__v_raw") return n === (r ? i ? jt : At : i ? kt : Ot).get(e) || Object.getPrototypeOf(e) === Object.getPrototypeOf(n) ? e : void 0;
|
|
943
943
|
let a = I(e);
|
|
944
944
|
if (!r) {
|
|
945
945
|
let e;
|
|
946
|
-
if (a && (e =
|
|
947
|
-
if (t === "hasOwnProperty") return
|
|
946
|
+
if (a && (e = nt[t])) return e;
|
|
947
|
+
if (t === "hasOwnProperty") return dt;
|
|
948
948
|
}
|
|
949
949
|
let o = Reflect.get(e, t, /* @__PURE__ */ Wt(e) ? e : n);
|
|
950
|
-
if ((de(t) ?
|
|
950
|
+
if ((de(t) ? ut.has(t) : lt(t)) || (r || Qe(e, "get", t), i)) return o;
|
|
951
951
|
if (/* @__PURE__ */ Wt(o)) {
|
|
952
|
-
let e = a &&
|
|
953
|
-
return r && R(e) ? /* @__PURE__ */
|
|
952
|
+
let e = a && B(t) ? o : o.value;
|
|
953
|
+
return r && R(e) ? /* @__PURE__ */ Pt(e) : e;
|
|
954
954
|
}
|
|
955
|
-
return R(o) ? r ? /* @__PURE__ */
|
|
955
|
+
return R(o) ? r ? /* @__PURE__ */ Pt(o) : /* @__PURE__ */ Nt(o) : o;
|
|
956
956
|
}
|
|
957
|
-
},
|
|
957
|
+
}, pt = class extends ft {
|
|
958
958
|
constructor(e = !1) {
|
|
959
959
|
super(!1, e);
|
|
960
960
|
}
|
|
961
961
|
set(e, t, n, r) {
|
|
962
|
-
let i = e[t], a = I(e) &&
|
|
962
|
+
let i = e[t], a = I(e) && B(t);
|
|
963
963
|
if (!this._isShallow) {
|
|
964
|
-
let r = /* @__PURE__ */
|
|
965
|
-
if (!/* @__PURE__ */
|
|
964
|
+
let r = /* @__PURE__ */ Rt(i);
|
|
965
|
+
if (!/* @__PURE__ */ zt(n) && !/* @__PURE__ */ Rt(n) && (i = /* @__PURE__ */ J(i), n = /* @__PURE__ */ J(n)), !a && /* @__PURE__ */ Wt(i) && !/* @__PURE__ */ Wt(n)) return r ? (process.env.NODE_ENV !== "production" && Ce(`Set operation on key "${String(t)}" failed: target is readonly.`, e[t]), !0) : (i.value = n, !0);
|
|
966
966
|
}
|
|
967
967
|
let o = a ? Number(t) < e.length : F(e, t), s = Reflect.set(e, t, n, /* @__PURE__ */ Wt(e) ? e : r);
|
|
968
|
-
return e === /* @__PURE__ */ J(r) && s && (o ? ge(n, i) &&
|
|
968
|
+
return e === /* @__PURE__ */ J(r) && s && (o ? ge(n, i) && $e(e, "set", t, n, i) : $e(e, "add", t, n)), s;
|
|
969
969
|
}
|
|
970
970
|
deleteProperty(e, t) {
|
|
971
971
|
let n = F(e, t), r = e[t], i = Reflect.deleteProperty(e, t);
|
|
972
|
-
return i && n &&
|
|
972
|
+
return i && n && $e(e, "delete", t, void 0, r), i;
|
|
973
973
|
}
|
|
974
974
|
has(e, t) {
|
|
975
975
|
let n = Reflect.has(e, t);
|
|
976
|
-
return (!de(t) || !
|
|
976
|
+
return (!de(t) || !ut.has(t)) && Qe(e, "has", t), n;
|
|
977
977
|
}
|
|
978
978
|
ownKeys(e) {
|
|
979
|
-
return
|
|
979
|
+
return Qe(e, "iterate", I(e) ? "length" : Ye), Reflect.ownKeys(e);
|
|
980
980
|
}
|
|
981
|
-
},
|
|
981
|
+
}, mt = class extends ft {
|
|
982
982
|
constructor(e = !1) {
|
|
983
983
|
super(!0, e);
|
|
984
984
|
}
|
|
@@ -988,11 +988,11 @@ var pt = class {
|
|
|
988
988
|
deleteProperty(e, t) {
|
|
989
989
|
return process.env.NODE_ENV !== "production" && Ce(`Delete operation on key "${String(t)}" failed: target is readonly.`, e), !0;
|
|
990
990
|
}
|
|
991
|
-
},
|
|
992
|
-
function
|
|
991
|
+
}, ht = /* @__PURE__ */ new pt(), gt = /* @__PURE__ */ new mt(), _t = /* @__PURE__ */ new mt(!0), vt = (e) => e, yt = (e) => Reflect.getPrototypeOf(e);
|
|
992
|
+
function bt(e, t, n) {
|
|
993
993
|
return function(...r) {
|
|
994
|
-
let i = this.__v_raw, a = /* @__PURE__ */ J(i), o = ce(a), s = e === "entries" || e === Symbol.iterator && o, c = e === "keys" && o, l = i[e](...r), u = n ?
|
|
995
|
-
return !t &&
|
|
994
|
+
let i = this.__v_raw, a = /* @__PURE__ */ J(i), o = ce(a), s = e === "entries" || e === Symbol.iterator && o, c = e === "keys" && o, l = i[e](...r), u = n ? vt : t ? Ut : Ht;
|
|
995
|
+
return !t && Qe(a, "iterate", c ? Xe : Ye), N(Object.create(l), { next() {
|
|
996
996
|
let { value: e, done: t } = l.next();
|
|
997
997
|
return t ? {
|
|
998
998
|
value: e,
|
|
@@ -1004,64 +1004,64 @@ function xt(e, t, n) {
|
|
|
1004
1004
|
} });
|
|
1005
1005
|
};
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1007
|
+
function xt(e) {
|
|
1008
1008
|
return function(...t) {
|
|
1009
1009
|
if (process.env.NODE_ENV !== "production") {
|
|
1010
1010
|
let n = t[0] ? `on key "${t[0]}" ` : "";
|
|
1011
|
-
Ce(`${
|
|
1011
|
+
Ce(`${V(e)} operation ${n}failed: target is readonly.`, /* @__PURE__ */ J(this));
|
|
1012
1012
|
}
|
|
1013
1013
|
return e === "delete" ? !1 : e === "clear" ? void 0 : this;
|
|
1014
1014
|
};
|
|
1015
1015
|
}
|
|
1016
|
-
function
|
|
1016
|
+
function St(e, t) {
|
|
1017
1017
|
let n = {
|
|
1018
1018
|
get(n) {
|
|
1019
1019
|
let r = this.__v_raw, i = /* @__PURE__ */ J(r), a = /* @__PURE__ */ J(n);
|
|
1020
|
-
e || (ge(n, a) &&
|
|
1021
|
-
let { has: o } =
|
|
1020
|
+
e || (ge(n, a) && Qe(i, "get", n), Qe(i, "get", a));
|
|
1021
|
+
let { has: o } = yt(i), s = t ? vt : e ? Ut : Ht;
|
|
1022
1022
|
if (o.call(i, n)) return s(r.get(n));
|
|
1023
1023
|
if (o.call(i, a)) return s(r.get(a));
|
|
1024
1024
|
r !== i && r.get(n);
|
|
1025
1025
|
},
|
|
1026
1026
|
get size() {
|
|
1027
1027
|
let t = this.__v_raw;
|
|
1028
|
-
return !e &&
|
|
1028
|
+
return !e && Qe(/* @__PURE__ */ J(t), "iterate", Ye), t.size;
|
|
1029
1029
|
},
|
|
1030
1030
|
has(t) {
|
|
1031
1031
|
let n = this.__v_raw, r = /* @__PURE__ */ J(n), i = /* @__PURE__ */ J(t);
|
|
1032
|
-
return e || (ge(t, i) &&
|
|
1032
|
+
return e || (ge(t, i) && Qe(r, "has", t), Qe(r, "has", i)), t === i ? n.has(t) : n.has(t) || n.has(i);
|
|
1033
1033
|
},
|
|
1034
1034
|
forEach(n, r) {
|
|
1035
|
-
let i = this, a = i.__v_raw, o = /* @__PURE__ */ J(a), s = t ?
|
|
1036
|
-
return !e &&
|
|
1035
|
+
let i = this, a = i.__v_raw, o = /* @__PURE__ */ J(a), s = t ? vt : e ? Ut : Ht;
|
|
1036
|
+
return !e && Qe(o, "iterate", Ye), a.forEach((e, t) => n.call(r, s(e), s(t), i));
|
|
1037
1037
|
}
|
|
1038
1038
|
};
|
|
1039
|
-
return
|
|
1040
|
-
add:
|
|
1041
|
-
set:
|
|
1042
|
-
delete:
|
|
1043
|
-
clear:
|
|
1039
|
+
return N(n, e ? {
|
|
1040
|
+
add: xt("add"),
|
|
1041
|
+
set: xt("set"),
|
|
1042
|
+
delete: xt("delete"),
|
|
1043
|
+
clear: xt("clear")
|
|
1044
1044
|
} : {
|
|
1045
1045
|
add(e) {
|
|
1046
|
-
let n = /* @__PURE__ */ J(this), r =
|
|
1047
|
-
return r.has.call(n, a) || ge(e, a) && r.has.call(n, e) || ge(i, a) && r.has.call(n, i) || (n.add(a),
|
|
1046
|
+
let n = /* @__PURE__ */ J(this), r = yt(n), i = /* @__PURE__ */ J(e), a = !t && !/* @__PURE__ */ zt(e) && !/* @__PURE__ */ Rt(e) ? i : e;
|
|
1047
|
+
return r.has.call(n, a) || ge(e, a) && r.has.call(n, e) || ge(i, a) && r.has.call(n, i) || (n.add(a), $e(n, "add", a, a)), this;
|
|
1048
1048
|
},
|
|
1049
1049
|
set(e, n) {
|
|
1050
|
-
!t && !/* @__PURE__ */
|
|
1051
|
-
let r = /* @__PURE__ */ J(this), { has: i, get: a } =
|
|
1052
|
-
o ? process.env.NODE_ENV !== "production" &&
|
|
1050
|
+
!t && !/* @__PURE__ */ zt(n) && !/* @__PURE__ */ Rt(n) && (n = /* @__PURE__ */ J(n));
|
|
1051
|
+
let r = /* @__PURE__ */ J(this), { has: i, get: a } = yt(r), o = i.call(r, e);
|
|
1052
|
+
o ? process.env.NODE_ENV !== "production" && Dt(r, i, e) : (e = /* @__PURE__ */ J(e), o = i.call(r, e));
|
|
1053
1053
|
let s = a.call(r, e);
|
|
1054
|
-
return r.set(e, n), o ? ge(n, s) &&
|
|
1054
|
+
return r.set(e, n), o ? ge(n, s) && $e(r, "set", e, n, s) : $e(r, "add", e, n), this;
|
|
1055
1055
|
},
|
|
1056
1056
|
delete(e) {
|
|
1057
|
-
let t = /* @__PURE__ */ J(this), { has: n, get: r } =
|
|
1058
|
-
i ? process.env.NODE_ENV !== "production" &&
|
|
1057
|
+
let t = /* @__PURE__ */ J(this), { has: n, get: r } = yt(t), i = n.call(t, e);
|
|
1058
|
+
i ? process.env.NODE_ENV !== "production" && Dt(t, n, e) : (e = /* @__PURE__ */ J(e), i = n.call(t, e));
|
|
1059
1059
|
let a = r ? r.call(t, e) : void 0, o = t.delete(e);
|
|
1060
|
-
return i &&
|
|
1060
|
+
return i && $e(t, "delete", e, void 0, a), o;
|
|
1061
1061
|
},
|
|
1062
1062
|
clear() {
|
|
1063
1063
|
let e = /* @__PURE__ */ J(this), t = e.size !== 0, n = process.env.NODE_ENV === "production" ? void 0 : ce(e) ? new Map(e) : new Set(e), r = e.clear();
|
|
1064
|
-
return t &&
|
|
1064
|
+
return t && $e(e, "clear", void 0, void 0, n), r;
|
|
1065
1065
|
}
|
|
1066
1066
|
}), [
|
|
1067
1067
|
"keys",
|
|
@@ -1069,23 +1069,23 @@ function Ct(e, t) {
|
|
|
1069
1069
|
"entries",
|
|
1070
1070
|
Symbol.iterator
|
|
1071
1071
|
].forEach((r) => {
|
|
1072
|
-
n[r] =
|
|
1072
|
+
n[r] = bt(r, e, t);
|
|
1073
1073
|
}), n;
|
|
1074
1074
|
}
|
|
1075
|
-
function
|
|
1076
|
-
let n =
|
|
1075
|
+
function Ct(e, t) {
|
|
1076
|
+
let n = St(e, t);
|
|
1077
1077
|
return (t, r, i) => r === "__v_isReactive" ? !e : r === "__v_isReadonly" ? e : r === "__v_raw" ? t : Reflect.get(F(n, r) && r in t ? n : t, r, i);
|
|
1078
1078
|
}
|
|
1079
|
-
var
|
|
1080
|
-
function
|
|
1079
|
+
var wt = { get: /* @__PURE__ */ Ct(!1, !1) }, Tt = { get: /* @__PURE__ */ Ct(!0, !1) }, Et = { get: /* @__PURE__ */ Ct(!0, !0) };
|
|
1080
|
+
function Dt(e, t, n) {
|
|
1081
1081
|
let r = /* @__PURE__ */ J(n);
|
|
1082
1082
|
if (r !== n && t.call(e, r)) {
|
|
1083
|
-
let t =
|
|
1083
|
+
let t = he(e);
|
|
1084
1084
|
Ce(`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.`);
|
|
1085
1085
|
}
|
|
1086
1086
|
}
|
|
1087
|
-
var
|
|
1088
|
-
function
|
|
1087
|
+
var Ot = /* @__PURE__ */ new WeakMap(), kt = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new WeakMap(), jt = /* @__PURE__ */ new WeakMap();
|
|
1088
|
+
function Mt(e) {
|
|
1089
1089
|
switch (e) {
|
|
1090
1090
|
case "Object":
|
|
1091
1091
|
case "Array": return 1;
|
|
@@ -1097,37 +1097,37 @@ function Nt(e) {
|
|
|
1097
1097
|
}
|
|
1098
1098
|
}
|
|
1099
1099
|
// @__NO_SIDE_EFFECTS__
|
|
1100
|
-
function
|
|
1101
|
-
return /* @__PURE__ */
|
|
1100
|
+
function Nt(e) {
|
|
1101
|
+
return /* @__PURE__ */ Rt(e) ? e : It(e, !1, ht, wt, Ot);
|
|
1102
1102
|
}
|
|
1103
1103
|
// @__NO_SIDE_EFFECTS__
|
|
1104
|
-
function
|
|
1105
|
-
return
|
|
1104
|
+
function Pt(e) {
|
|
1105
|
+
return It(e, !0, gt, Tt, At);
|
|
1106
1106
|
}
|
|
1107
1107
|
// @__NO_SIDE_EFFECTS__
|
|
1108
|
-
function
|
|
1109
|
-
return
|
|
1108
|
+
function Ft(e) {
|
|
1109
|
+
return It(e, !0, _t, Et, jt);
|
|
1110
1110
|
}
|
|
1111
|
-
function
|
|
1111
|
+
function It(e, t, n, r, i) {
|
|
1112
1112
|
if (!R(e)) return process.env.NODE_ENV !== "production" && Ce(`value cannot be made ${t ? "readonly" : "reactive"}: ${String(e)}`), e;
|
|
1113
1113
|
if (e.__v_raw && !(t && e.__v_isReactive) || e.__v_skip || !Object.isExtensible(e)) return e;
|
|
1114
1114
|
let a = i.get(e);
|
|
1115
1115
|
if (a) return a;
|
|
1116
|
-
let o =
|
|
1116
|
+
let o = Mt(he(e));
|
|
1117
1117
|
if (o === 0) return e;
|
|
1118
1118
|
let s = new Proxy(e, o === 2 ? r : n);
|
|
1119
1119
|
return i.set(e, s), s;
|
|
1120
1120
|
}
|
|
1121
1121
|
// @__NO_SIDE_EFFECTS__
|
|
1122
|
-
function
|
|
1123
|
-
return /* @__PURE__ */
|
|
1122
|
+
function Lt(e) {
|
|
1123
|
+
return /* @__PURE__ */ Rt(e) ? /* @__PURE__ */ Lt(e.__v_raw) : !!(e && e.__v_isReactive);
|
|
1124
1124
|
}
|
|
1125
1125
|
// @__NO_SIDE_EFFECTS__
|
|
1126
|
-
function
|
|
1126
|
+
function Rt(e) {
|
|
1127
1127
|
return !!(e && e.__v_isReadonly);
|
|
1128
1128
|
}
|
|
1129
1129
|
// @__NO_SIDE_EFFECTS__
|
|
1130
|
-
function
|
|
1130
|
+
function zt(e) {
|
|
1131
1131
|
return !!(e && e.__v_isShallow);
|
|
1132
1132
|
}
|
|
1133
1133
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -1142,25 +1142,25 @@ function J(e) {
|
|
|
1142
1142
|
function Vt(e) {
|
|
1143
1143
|
return !F(e, "__v_skip") && Object.isExtensible(e) && _e(e, "__v_skip", !0), e;
|
|
1144
1144
|
}
|
|
1145
|
-
var Ht = (e) => R(e) ? /* @__PURE__ */
|
|
1145
|
+
var Ht = (e) => R(e) ? /* @__PURE__ */ Nt(e) : e, Ut = (e) => R(e) ? /* @__PURE__ */ Pt(e) : e;
|
|
1146
1146
|
// @__NO_SIDE_EFFECTS__
|
|
1147
1147
|
function Wt(e) {
|
|
1148
1148
|
return e ? e.__v_isRef === !0 : !1;
|
|
1149
1149
|
}
|
|
1150
1150
|
// @__NO_SIDE_EFFECTS__
|
|
1151
1151
|
function Gt(e) {
|
|
1152
|
-
return
|
|
1152
|
+
return Y(e, !1);
|
|
1153
1153
|
}
|
|
1154
1154
|
// @__NO_SIDE_EFFECTS__
|
|
1155
|
-
function
|
|
1156
|
-
return
|
|
1155
|
+
function Kt(e) {
|
|
1156
|
+
return Y(e, !0);
|
|
1157
1157
|
}
|
|
1158
|
-
function
|
|
1158
|
+
function Y(e, t) {
|
|
1159
1159
|
return /* @__PURE__ */ Wt(e) ? e : new qt(e, t);
|
|
1160
1160
|
}
|
|
1161
1161
|
var qt = class {
|
|
1162
1162
|
constructor(e, t) {
|
|
1163
|
-
this.dep = new
|
|
1163
|
+
this.dep = new Ke(), this.__v_isRef = !0, this.__v_isShallow = !1, this._rawValue = t ? e : /* @__PURE__ */ J(e), this._value = t ? e : Ht(e), this.__v_isShallow = t;
|
|
1164
1164
|
}
|
|
1165
1165
|
get value() {
|
|
1166
1166
|
return process.env.NODE_ENV === "production" ? this.dep.track() : this.dep.track({
|
|
@@ -1170,7 +1170,7 @@ var qt = class {
|
|
|
1170
1170
|
}), this._value;
|
|
1171
1171
|
}
|
|
1172
1172
|
set value(e) {
|
|
1173
|
-
let t = this._rawValue, n = this.__v_isShallow || /* @__PURE__ */
|
|
1173
|
+
let t = this._rawValue, n = this.__v_isShallow || /* @__PURE__ */ zt(e) || /* @__PURE__ */ Rt(e);
|
|
1174
1174
|
e = n ? e : /* @__PURE__ */ J(e), ge(e, t) && (this._rawValue = e, this._value = n ? e : Ht(e), process.env.NODE_ENV === "production" ? this.dep.trigger() : this.dep.trigger({
|
|
1175
1175
|
target: this,
|
|
1176
1176
|
type: "set",
|
|
@@ -1199,14 +1199,14 @@ var Xt = {
|
|
|
1199
1199
|
}
|
|
1200
1200
|
};
|
|
1201
1201
|
function Zt(e) {
|
|
1202
|
-
return /* @__PURE__ */
|
|
1202
|
+
return /* @__PURE__ */ Lt(e) ? e : new Proxy(e, Xt);
|
|
1203
1203
|
}
|
|
1204
1204
|
var Qt = class {
|
|
1205
1205
|
constructor(e, t, n) {
|
|
1206
|
-
this.fn = e, this.setter = t, this._value = void 0, this.dep = new
|
|
1206
|
+
this.fn = e, this.setter = t, this._value = void 0, this.dep = new Ke(this), this.__v_isRef = !0, this.deps = void 0, this.depsTail = void 0, this.flags = 16, this.globalVersion = We - 1, this.next = void 0, this.effect = this, this.__v_isReadonly = !t, this.isSSR = n;
|
|
1207
1207
|
}
|
|
1208
1208
|
notify() {
|
|
1209
|
-
if (this.flags |= 16, !(this.flags & 8) && G !== this) return
|
|
1209
|
+
if (this.flags |= 16, !(this.flags & 8) && G !== this) return Ae(this, !0), !0;
|
|
1210
1210
|
process.env.NODE_ENV;
|
|
1211
1211
|
}
|
|
1212
1212
|
get value() {
|
|
@@ -1215,7 +1215,7 @@ var Qt = class {
|
|
|
1215
1215
|
type: "get",
|
|
1216
1216
|
key: "value"
|
|
1217
1217
|
});
|
|
1218
|
-
return
|
|
1218
|
+
return Ie(this), e && (e.version = this.dep.version), this._value;
|
|
1219
1219
|
}
|
|
1220
1220
|
set value(e) {
|
|
1221
1221
|
this.setter ? this.setter(e) : process.env.NODE_ENV !== "production" && Ce("Write operation failed: computed value is readonly");
|
|
@@ -1235,22 +1235,22 @@ function rn(e, t = !1, n = nn) {
|
|
|
1235
1235
|
t || tn.set(n, t = []), t.push(e);
|
|
1236
1236
|
} else process.env.NODE_ENV !== "production" && !t && Ce("onWatcherCleanup() was called when there was no active watcher to associate with.");
|
|
1237
1237
|
}
|
|
1238
|
-
function an(e, t, n =
|
|
1238
|
+
function an(e, t, n = ae) {
|
|
1239
1239
|
let { immediate: r, deep: i, once: a, scheduler: o, augmentJob: s, call: c } = n, l = (e) => {
|
|
1240
1240
|
(n.onWarn || Ce)("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.");
|
|
1241
|
-
}, u = (e) => i ? e : /* @__PURE__ */
|
|
1242
|
-
if (/* @__PURE__ */ Wt(e) ? (f = () => e.value, h = /* @__PURE__ */
|
|
1241
|
+
}, u = (e) => i ? e : /* @__PURE__ */ zt(e) || i === !1 || i === 0 ? on(e, 1) : on(e), d, f, p, m, h = !1, g = !1;
|
|
1242
|
+
if (/* @__PURE__ */ Wt(e) ? (f = () => e.value, h = /* @__PURE__ */ zt(e)) : /* @__PURE__ */ Lt(e) ? (f = () => u(e), h = !0) : I(e) ? (g = !0, h = e.some((e) => /* @__PURE__ */ Lt(e) || /* @__PURE__ */ zt(e)), f = () => e.map((e) => {
|
|
1243
1243
|
if (/* @__PURE__ */ Wt(e)) return e.value;
|
|
1244
|
-
if (/* @__PURE__ */
|
|
1244
|
+
if (/* @__PURE__ */ Lt(e)) return u(e);
|
|
1245
1245
|
if (L(e)) return c ? c(e, 2) : e();
|
|
1246
1246
|
process.env.NODE_ENV !== "production" && l(e);
|
|
1247
1247
|
})) : L(e) ? f = t ? c ? () => c(e, 2) : e : () => {
|
|
1248
1248
|
if (p) {
|
|
1249
|
-
|
|
1249
|
+
Ve();
|
|
1250
1250
|
try {
|
|
1251
1251
|
p();
|
|
1252
1252
|
} finally {
|
|
1253
|
-
|
|
1253
|
+
He();
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
1256
|
let t = nn;
|
|
@@ -1260,12 +1260,12 @@ function an(e, t, n = oe) {
|
|
|
1260
1260
|
} finally {
|
|
1261
1261
|
nn = t;
|
|
1262
1262
|
}
|
|
1263
|
-
} : (f =
|
|
1263
|
+
} : (f = j, process.env.NODE_ENV !== "production" && l(e)), t && i) {
|
|
1264
1264
|
let e = f, t = i === !0 ? Infinity : i;
|
|
1265
1265
|
f = () => on(e(), t);
|
|
1266
1266
|
}
|
|
1267
1267
|
let _ = Te(), v = () => {
|
|
1268
|
-
d.stop(), _ && _.active &&
|
|
1268
|
+
d.stop(), _ && _.active && se(_.effects, d);
|
|
1269
1269
|
};
|
|
1270
1270
|
if (a && t) {
|
|
1271
1271
|
let e = t;
|
|
@@ -1294,7 +1294,7 @@ function an(e, t, n = oe) {
|
|
|
1294
1294
|
}
|
|
1295
1295
|
} else d.run();
|
|
1296
1296
|
};
|
|
1297
|
-
return s && s(b), d = new
|
|
1297
|
+
return s && s(b), d = new Ee(f), d.scheduler = o ? () => o(b, !1) : b, m = (e) => rn(e, !1, d), p = d.onStop = () => {
|
|
1298
1298
|
let e = tn.get(d);
|
|
1299
1299
|
if (e) {
|
|
1300
1300
|
if (c) c(e, 4);
|
|
@@ -1310,7 +1310,7 @@ function on(e, t = Infinity, n) {
|
|
|
1310
1310
|
else if (le(e) || ce(e)) e.forEach((e) => {
|
|
1311
1311
|
on(e, t, n);
|
|
1312
1312
|
});
|
|
1313
|
-
else if (
|
|
1313
|
+
else if (z(e)) {
|
|
1314
1314
|
for (let r in e) on(e[r], t, n);
|
|
1315
1315
|
for (let r of Object.getOwnPropertySymbols(e)) Object.prototype.propertyIsEnumerable.call(e, r) && on(e[r], t, n);
|
|
1316
1316
|
}
|
|
@@ -1328,8 +1328,8 @@ function ln() {
|
|
|
1328
1328
|
var un = !1;
|
|
1329
1329
|
function dn(e, ...t) {
|
|
1330
1330
|
if (un) return;
|
|
1331
|
-
un = !0,
|
|
1332
|
-
let n = sn.length ? sn[sn.length - 1].component : null, r = n && n.appContext.config.warnHandler, i =
|
|
1331
|
+
un = !0, Ve();
|
|
1332
|
+
let n = sn.length ? sn[sn.length - 1].component : null, r = n && n.appContext.config.warnHandler, i = fn();
|
|
1333
1333
|
if (r) _n(r, n, 11, [
|
|
1334
1334
|
e + t.map((e) => e.toString?.call(e) ?? JSON.stringify(e)).join(""),
|
|
1335
1335
|
n && n.proxy,
|
|
@@ -1338,11 +1338,11 @@ function dn(e, ...t) {
|
|
|
1338
1338
|
]);
|
|
1339
1339
|
else {
|
|
1340
1340
|
let n = [`[Vue warn]: ${e}`, ...t];
|
|
1341
|
-
i.length && n.push("\n", ...
|
|
1341
|
+
i.length && n.push("\n", ...X(i)), console.warn(...n);
|
|
1342
1342
|
}
|
|
1343
|
-
|
|
1343
|
+
He(), un = !1;
|
|
1344
1344
|
}
|
|
1345
|
-
function
|
|
1345
|
+
function fn() {
|
|
1346
1346
|
let e = sn[sn.length - 1];
|
|
1347
1347
|
if (!e) return [];
|
|
1348
1348
|
let t = [];
|
|
@@ -1357,7 +1357,7 @@ function X() {
|
|
|
1357
1357
|
}
|
|
1358
1358
|
return t;
|
|
1359
1359
|
}
|
|
1360
|
-
function
|
|
1360
|
+
function X(e) {
|
|
1361
1361
|
let t = [];
|
|
1362
1362
|
return e.forEach((e, n) => {
|
|
1363
1363
|
t.push(...n === 0 ? [] : ["\n"], ...pn(e));
|
|
@@ -1438,7 +1438,7 @@ function vn(e, t, n, r) {
|
|
|
1438
1438
|
} else process.env.NODE_ENV !== "production" && dn(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof e}`);
|
|
1439
1439
|
}
|
|
1440
1440
|
function yn(e, t, n, r = !0) {
|
|
1441
|
-
let i = t ? t.vnode : null, { errorHandler: a, throwUnhandledErrorInProduction: o } = t && t.appContext.config ||
|
|
1441
|
+
let i = t ? t.vnode : null, { errorHandler: a, throwUnhandledErrorInProduction: o } = t && t.appContext.config || ae;
|
|
1442
1442
|
if (t) {
|
|
1443
1443
|
let r = t.parent, i = t.proxy, o = process.env.NODE_ENV === "production" ? `https://vuejs.org/error-reference/#runtime-${n}` : gn[n];
|
|
1444
1444
|
for (; r;) {
|
|
@@ -1449,11 +1449,11 @@ function yn(e, t, n, r = !0) {
|
|
|
1449
1449
|
r = r.parent;
|
|
1450
1450
|
}
|
|
1451
1451
|
if (a) {
|
|
1452
|
-
|
|
1452
|
+
Ve(), _n(a, null, 10, [
|
|
1453
1453
|
e,
|
|
1454
1454
|
i,
|
|
1455
1455
|
o
|
|
1456
|
-
]),
|
|
1456
|
+
]), He();
|
|
1457
1457
|
return;
|
|
1458
1458
|
}
|
|
1459
1459
|
}
|
|
@@ -1509,7 +1509,7 @@ function Pn(e) {
|
|
|
1509
1509
|
var Fn = (e) => e.id == null ? e.flags & 2 ? -1 : Infinity : e.id;
|
|
1510
1510
|
function In(e) {
|
|
1511
1511
|
process.env.NODE_ENV !== "production" && (e ||= /* @__PURE__ */ new Map());
|
|
1512
|
-
let t = process.env.NODE_ENV === "production" ?
|
|
1512
|
+
let t = process.env.NODE_ENV === "production" ? j : (t) => Ln(e, t);
|
|
1513
1513
|
try {
|
|
1514
1514
|
for (Sn = 0; Sn < xn.length; Sn++) {
|
|
1515
1515
|
let e = xn[Sn];
|
|
@@ -1572,7 +1572,7 @@ function Un(e, t) {
|
|
|
1572
1572
|
});
|
|
1573
1573
|
}
|
|
1574
1574
|
function Wn(e, t) {
|
|
1575
|
-
|
|
1575
|
+
N(e, t);
|
|
1576
1576
|
for (let n in e) n !== "__file" && !(n in t) && delete e[n];
|
|
1577
1577
|
}
|
|
1578
1578
|
function Gn(e) {
|
|
@@ -1608,10 +1608,10 @@ var Qn = /* @__PURE__ */ Symbol.for("v-scx"), $n = () => {
|
|
|
1608
1608
|
return e || process.env.NODE_ENV !== "production" && dn("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."), e;
|
|
1609
1609
|
}
|
|
1610
1610
|
};
|
|
1611
|
-
function er(e, t, n =
|
|
1611
|
+
function er(e, t, n = ae) {
|
|
1612
1612
|
let { immediate: r, deep: i, flush: a, once: o } = n;
|
|
1613
1613
|
process.env.NODE_ENV !== "production" && !t && (r !== void 0 && dn("watch() \"immediate\" option is only respected when using the watch(source, callback, options?) signature."), i !== void 0 && dn("watch() \"deep\" option is only respected when using the watch(source, callback, options?) signature."), o !== void 0 && dn("watch() \"once\" option is only respected when using the watch(source, callback, options?) signature."));
|
|
1614
|
-
let s =
|
|
1614
|
+
let s = N({}, n);
|
|
1615
1615
|
process.env.NODE_ENV !== "production" && (s.onWarn = dn);
|
|
1616
1616
|
let c = t && r || !t && a !== "post", l;
|
|
1617
1617
|
if (Xr) {
|
|
@@ -1620,7 +1620,7 @@ function er(e, t, n = oe) {
|
|
|
1620
1620
|
l = e.__watcherHandles ||= [];
|
|
1621
1621
|
} else if (!c) {
|
|
1622
1622
|
let e = () => {};
|
|
1623
|
-
return e.stop =
|
|
1623
|
+
return e.stop = j, e.resume = j, e.pause = j, e;
|
|
1624
1624
|
}
|
|
1625
1625
|
}
|
|
1626
1626
|
let u = Gr;
|
|
@@ -1655,14 +1655,14 @@ function ir(e, t) {
|
|
|
1655
1655
|
e.shapeFlag & 6 && e.component ? (e.transition = t, ir(e.component.subTree, t)) : e.shapeFlag & 128 ? (e.ssContent.transition = t.clone(e.ssContent), e.ssFallback.transition = t.clone(e.ssFallback)) : e.transition = t;
|
|
1656
1656
|
}
|
|
1657
1657
|
ye().requestIdleCallback, ye().cancelIdleCallback;
|
|
1658
|
-
var ar = /* @__PURE__ */ Symbol.for("v-ndc"), or = (e) => e ? Yr(e) ? Zr(e) : or(e.parent) : null, sr = /* @__PURE__ */
|
|
1658
|
+
var ar = /* @__PURE__ */ Symbol.for("v-ndc"), or = (e) => e ? Yr(e) ? Zr(e) : or(e.parent) : null, sr = /* @__PURE__ */ N(/* @__PURE__ */ Object.create(null), {
|
|
1659
1659
|
$: (e) => e,
|
|
1660
1660
|
$el: (e) => e.vnode.el,
|
|
1661
1661
|
$data: (e) => e.data,
|
|
1662
|
-
$props: (e) => process.env.NODE_ENV === "production" ? e.props : /* @__PURE__ */
|
|
1663
|
-
$attrs: (e) => process.env.NODE_ENV === "production" ? e.attrs : /* @__PURE__ */
|
|
1664
|
-
$slots: (e) => process.env.NODE_ENV === "production" ? e.slots : /* @__PURE__ */
|
|
1665
|
-
$refs: (e) => process.env.NODE_ENV === "production" ? e.refs : /* @__PURE__ */
|
|
1662
|
+
$props: (e) => process.env.NODE_ENV === "production" ? e.props : /* @__PURE__ */ Ft(e.props),
|
|
1663
|
+
$attrs: (e) => process.env.NODE_ENV === "production" ? e.attrs : /* @__PURE__ */ Ft(e.attrs),
|
|
1664
|
+
$slots: (e) => process.env.NODE_ENV === "production" ? e.slots : /* @__PURE__ */ Ft(e.slots),
|
|
1665
|
+
$refs: (e) => process.env.NODE_ENV === "production" ? e.refs : /* @__PURE__ */ Ft(e.refs),
|
|
1666
1666
|
$parent: (e) => or(e.parent),
|
|
1667
1667
|
$root: (e) => or(e.root),
|
|
1668
1668
|
$host: (e) => e.ce,
|
|
@@ -1673,7 +1673,7 @@ var ar = /* @__PURE__ */ Symbol.for("v-ndc"), or = (e) => e ? Yr(e) ? Zr(e) : or
|
|
|
1673
1673
|
},
|
|
1674
1674
|
$nextTick: (e) => e.n ||= kn.bind(e.proxy),
|
|
1675
1675
|
$watch: (e) => tr.bind(e)
|
|
1676
|
-
}), cr = (e, t) => e !==
|
|
1676
|
+
}), cr = (e, t) => e !== ae && !e.__isScriptSetup && F(e, t), lr = {
|
|
1677
1677
|
get({ _: e }, t) {
|
|
1678
1678
|
if (t === "__v_skip") return !0;
|
|
1679
1679
|
let { ctx: n, setupState: r, data: i, props: a, accessCache: o, type: s, appContext: c } = e;
|
|
@@ -1687,21 +1687,21 @@ var ar = /* @__PURE__ */ Symbol.for("v-ndc"), or = (e) => e ? Yr(e) ? Zr(e) : or
|
|
|
1687
1687
|
case 3: return a[t];
|
|
1688
1688
|
}
|
|
1689
1689
|
else if (cr(r, t)) return o[t] = 1, r[t];
|
|
1690
|
-
else if (i !==
|
|
1690
|
+
else if (i !== ae && F(i, t)) return o[t] = 2, i[t];
|
|
1691
1691
|
else if (F(a, t)) return o[t] = 3, a[t];
|
|
1692
|
-
else if (n !==
|
|
1692
|
+
else if (n !== ae && F(n, t)) return o[t] = 4, n[t];
|
|
1693
1693
|
else dr && (o[t] = 0);
|
|
1694
1694
|
}
|
|
1695
1695
|
let l = sr[t], u, d;
|
|
1696
|
-
if (l) return t === "$attrs" ? (
|
|
1696
|
+
if (l) return t === "$attrs" ? (Qe(e.attrs, "get", ""), process.env.NODE_ENV) : process.env.NODE_ENV !== "production" && t === "$slots" && Qe(e, "get", t), l(e);
|
|
1697
1697
|
if ((u = s.__cssModules) && (u = u[t])) return u;
|
|
1698
|
-
if (n !==
|
|
1698
|
+
if (n !== ae && F(n, t)) return o[t] = 4, n[t];
|
|
1699
1699
|
if (d = c.config.globalProperties, F(d, t)) return d[t];
|
|
1700
1700
|
process.env.NODE_ENV;
|
|
1701
1701
|
},
|
|
1702
1702
|
set({ _: e }, t, n) {
|
|
1703
1703
|
let { data: r, setupState: i, ctx: a } = e;
|
|
1704
|
-
return cr(i, t) ? (i[t] = n, !0) : process.env.NODE_ENV !== "production" && i.__isScriptSetup && F(i, t) ? (dn(`Cannot mutate <script setup> binding "${t}" from Options API.`), !1) : r !==
|
|
1704
|
+
return cr(i, t) ? (i[t] = n, !0) : process.env.NODE_ENV !== "production" && i.__isScriptSetup && F(i, t) ? (dn(`Cannot mutate <script setup> binding "${t}" from Options API.`), !1) : r !== ae && F(r, t) ? (r[t] = n, !0) : F(e.props, t) ? (process.env.NODE_ENV !== "production" && dn(`Attempting to mutate prop "${t}". Props are readonly.`), !1) : t[0] === "$" && t.slice(1) in e ? (process.env.NODE_ENV !== "production" && dn(`Attempting to mutate public property "${t}". Properties starting with $ are reserved and readonly.`), !1) : (process.env.NODE_ENV !== "production" && t in e.appContext.config.globalProperties ? Object.defineProperty(a, t, {
|
|
1705
1705
|
enumerable: !0,
|
|
1706
1706
|
configurable: !0,
|
|
1707
1707
|
value: n
|
|
@@ -1709,7 +1709,7 @@ var ar = /* @__PURE__ */ Symbol.for("v-ndc"), or = (e) => e ? Yr(e) ? Zr(e) : or
|
|
|
1709
1709
|
},
|
|
1710
1710
|
has({ _: { data: e, setupState: t, accessCache: n, ctx: r, appContext: i, props: a, type: o } }, s) {
|
|
1711
1711
|
let c;
|
|
1712
|
-
return !!(n[s] || e !==
|
|
1712
|
+
return !!(n[s] || e !== ae && s[0] !== "$" && F(e, s) || cr(t, s) || F(a, s) || F(r, s) || F(sr, s) || F(i.config.globalProperties, s) || (c = o.__cssModules) && c[s]);
|
|
1713
1713
|
},
|
|
1714
1714
|
defineProperty(e, t, n) {
|
|
1715
1715
|
return n.get == null ? F(n, "value") && this.set(e, t, n.value, null) : e._.accessCache[t] = 0, Reflect.defineProperty(e, t, n);
|
|
@@ -1762,7 +1762,7 @@ var mr = {
|
|
|
1762
1762
|
};
|
|
1763
1763
|
function hr(e, t) {
|
|
1764
1764
|
return t ? e ? function() {
|
|
1765
|
-
return
|
|
1765
|
+
return N(L(e) ? e.call(this, this) : e, L(t) ? t.call(this, this) : t);
|
|
1766
1766
|
} : t : e;
|
|
1767
1767
|
}
|
|
1768
1768
|
function gr(e, t) {
|
|
@@ -1780,15 +1780,15 @@ function vr(e, t) {
|
|
|
1780
1780
|
return e ? [...new Set([].concat(e, t))] : t;
|
|
1781
1781
|
}
|
|
1782
1782
|
function yr(e, t) {
|
|
1783
|
-
return e ?
|
|
1783
|
+
return e ? N(/* @__PURE__ */ Object.create(null), e, t) : t;
|
|
1784
1784
|
}
|
|
1785
1785
|
function br(e, t) {
|
|
1786
|
-
return e ? I(e) && I(t) ? [.../* @__PURE__ */ new Set([...e, ...t])] :
|
|
1786
|
+
return e ? I(e) && I(t) ? [.../* @__PURE__ */ new Set([...e, ...t])] : N(/* @__PURE__ */ Object.create(null), ur(e), ur(t ?? {})) : t;
|
|
1787
1787
|
}
|
|
1788
1788
|
function xr(e, t) {
|
|
1789
1789
|
if (!e) return t;
|
|
1790
1790
|
if (!t) return e;
|
|
1791
|
-
let n =
|
|
1791
|
+
let n = N(/* @__PURE__ */ Object.create(null), e);
|
|
1792
1792
|
for (let r in t) n[r] = vr(e[r], t[r]);
|
|
1793
1793
|
return n;
|
|
1794
1794
|
}
|
|
@@ -1847,13 +1847,13 @@ function Rr(e, t = null, n = null, r = 0, i = null, a = !1) {
|
|
|
1847
1847
|
if (ni(e) && (e = e.__vccOpts), t) {
|
|
1848
1848
|
t = zr(t);
|
|
1849
1849
|
let { class: e, style: n } = t;
|
|
1850
|
-
e && !ue(e) && (t.class = W(e)), R(n) && (/* @__PURE__ */ Bt(n) && !I(n) && (n =
|
|
1850
|
+
e && !ue(e) && (t.class = W(e)), R(n) && (/* @__PURE__ */ Bt(n) && !I(n) && (n = N({}, n)), t.style = H(n));
|
|
1851
1851
|
}
|
|
1852
1852
|
let o = ue(e) ? 1 : Er(e) ? 128 : rr(e) ? 64 : R(e) ? 4 : L(e) ? 2 : 0;
|
|
1853
1853
|
return process.env.NODE_ENV !== "production" && o & 4 && /* @__PURE__ */ Bt(e) && (e = /* @__PURE__ */ J(e), dn("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)), Ir(e, t, n, r, i, o, a, !0);
|
|
1854
1854
|
}
|
|
1855
1855
|
function zr(e) {
|
|
1856
|
-
return e ? /* @__PURE__ */ Bt(e) || wr(e) ?
|
|
1856
|
+
return e ? /* @__PURE__ */ Bt(e) || wr(e) ? N({}, e) : e : null;
|
|
1857
1857
|
}
|
|
1858
1858
|
function Br(e, t, n = !1, r = !1) {
|
|
1859
1859
|
let { props: i, ref: a, patchFlag: o, children: s, transition: c } = e, l = t ? Wr(i || {}, t) : i, u = {
|
|
@@ -1923,9 +1923,9 @@ function Wr(...e) {
|
|
|
1923
1923
|
let r = e[n];
|
|
1924
1924
|
for (let e in r) if (e === "class") t.class !== r.class && (t.class = W([t.class, r.class]));
|
|
1925
1925
|
else if (e === "style") t.style = H([t.style, r.style]);
|
|
1926
|
-
else if (
|
|
1926
|
+
else if (M(e)) {
|
|
1927
1927
|
let n = t[e], i = r[e];
|
|
1928
|
-
i && n !== i && !(I(n) && n.includes(i)) ? t[e] = n ? [].concat(n, i) : i : i == null && n == null && !
|
|
1928
|
+
i && n !== i && !(I(n) && n.includes(i)) ? t[e] = n ? [].concat(n, i) : i : i == null && n == null && !oe(e) && (t[e] = i);
|
|
1929
1929
|
} else e !== "" && (t[e] = r[e]);
|
|
1930
1930
|
}
|
|
1931
1931
|
return t;
|
|
@@ -2003,9 +2003,9 @@ function ii() {
|
|
|
2003
2003
|
"VueInstance"
|
|
2004
2004
|
];
|
|
2005
2005
|
if (/* @__PURE__ */ Wt(t)) {
|
|
2006
|
-
|
|
2006
|
+
Ve();
|
|
2007
2007
|
let n = t.value;
|
|
2008
|
-
return
|
|
2008
|
+
return He(), [
|
|
2009
2009
|
"div",
|
|
2010
2010
|
{},
|
|
2011
2011
|
[
|
|
@@ -2017,25 +2017,25 @@ function ii() {
|
|
|
2017
2017
|
s(n),
|
|
2018
2018
|
">"
|
|
2019
2019
|
];
|
|
2020
|
-
} else if (/* @__PURE__ */
|
|
2020
|
+
} else if (/* @__PURE__ */ Lt(t)) return [
|
|
2021
2021
|
"div",
|
|
2022
2022
|
{},
|
|
2023
2023
|
[
|
|
2024
2024
|
"span",
|
|
2025
2025
|
e,
|
|
2026
|
-
/* @__PURE__ */
|
|
2026
|
+
/* @__PURE__ */ zt(t) ? "ShallowReactive" : "Reactive"
|
|
2027
2027
|
],
|
|
2028
2028
|
"<",
|
|
2029
2029
|
s(t),
|
|
2030
|
-
`>${/* @__PURE__ */
|
|
2030
|
+
`>${/* @__PURE__ */ Rt(t) ? " (readonly)" : ""}`
|
|
2031
2031
|
];
|
|
2032
|
-
else if (/* @__PURE__ */
|
|
2032
|
+
else if (/* @__PURE__ */ Rt(t)) return [
|
|
2033
2033
|
"div",
|
|
2034
2034
|
{},
|
|
2035
2035
|
[
|
|
2036
2036
|
"span",
|
|
2037
2037
|
e,
|
|
2038
|
-
/* @__PURE__ */
|
|
2038
|
+
/* @__PURE__ */ zt(t) ? "ShallowReadonly" : "Readonly"
|
|
2039
2039
|
],
|
|
2040
2040
|
"<",
|
|
2041
2041
|
s(t),
|
|
@@ -2056,7 +2056,7 @@ function ii() {
|
|
|
2056
2056
|
};
|
|
2057
2057
|
function a(e) {
|
|
2058
2058
|
let t = [];
|
|
2059
|
-
e.type.props && e.props && t.push(o("props", /* @__PURE__ */ J(e.props))), e.setupState !==
|
|
2059
|
+
e.type.props && e.props && t.push(o("props", /* @__PURE__ */ J(e.props))), e.setupState !== ae && t.push(o("setup", e.setupState)), e.data !== ae && t.push(o("data", /* @__PURE__ */ J(e.data)));
|
|
2060
2060
|
let n = c(e, "computed");
|
|
2061
2061
|
n && t.push(o("computed", n));
|
|
2062
2062
|
let i = c(e, "inject");
|
|
@@ -2072,7 +2072,7 @@ function ii() {
|
|
|
2072
2072
|
]), t;
|
|
2073
2073
|
}
|
|
2074
2074
|
function o(e, t) {
|
|
2075
|
-
return t =
|
|
2075
|
+
return t = N({}, t), Object.keys(t).length ? [
|
|
2076
2076
|
"div",
|
|
2077
2077
|
{ style: "line-height:1.25em;margin-bottom:0.6em" },
|
|
2078
2078
|
[
|
|
@@ -2127,7 +2127,7 @@ function ii() {
|
|
|
2127
2127
|
if (I(r) && r.includes(t) || R(r) && t in r || e.extends && l(e.extends, t, n) || e.mixins && e.mixins.some((e) => l(e, t, n))) return !0;
|
|
2128
2128
|
}
|
|
2129
2129
|
function u(e) {
|
|
2130
|
-
return /* @__PURE__ */
|
|
2130
|
+
return /* @__PURE__ */ zt(e) ? "ShallowRef" : e.effect ? "ComputedRef" : "Ref";
|
|
2131
2131
|
}
|
|
2132
2132
|
window.devtoolsFormatters ? window.devtoolsFormatters.push(i) : window.devtoolsFormatters = [i];
|
|
2133
2133
|
}
|
|
@@ -4005,18 +4005,18 @@ function Fs(e) {
|
|
|
4005
4005
|
return Array.isArray(r) && r.length && r[0] && typeof r[0].jsonPath == "string" ? r[0].jsonPath : "";
|
|
4006
4006
|
}
|
|
4007
4007
|
function Is(e) {
|
|
4008
|
-
let { apiKey: t, baseUrl: s, model: c = "deepseek-v4-flash", temperature: l = .7, maxTokens: u, extraBody: d, extraConfig: f, systemPrompt: p, tools: m = [], middleware: h = [], maxToolRounds: g, maxIterations: _, maxRetries: S = 2, retryDelayMs: C = 500, stallMs: E = pa, streamMaxMs: D = ha, toolTimeoutMs: O, maxParallelTools: k = 1, maxVerifyAttempts: ne = 0, roundTokenBudget:
|
|
4009
|
-
(!Number.isFinite(
|
|
4010
|
-
let
|
|
4008
|
+
let { apiKey: t, baseUrl: s, model: c = "deepseek-v4-flash", temperature: l = .7, maxTokens: u, extraBody: d, extraConfig: f, systemPrompt: p, tools: m = [], middleware: h = [], maxToolRounds: g, maxIterations: _, maxRetries: S = 2, retryDelayMs: C = 500, stallMs: E = pa, streamMaxMs: D = ha, toolTimeoutMs: O, maxParallelTools: k = 1, maxVerifyAttempts: ne = 0, roundTokenBudget: A = 0, onLog: ie, onLlmChange: ae, imageContentFormat: j = "openai", staleReadInvalidation: M = !0, debug: oe = !1 } = e, N = g ?? Ts;
|
|
4009
|
+
(!Number.isFinite(N) || N < 1) && (console.warn(`[page-agent-sdk] maxToolRounds=${N} 非法(须 ≥1 正整数),已 clamp 到 1(0/负数致主循环 while 不进 → agent 不调 LLM 静默返回兜底文案)`), N = 1);
|
|
4010
|
+
let se = v({
|
|
4011
4011
|
model: c,
|
|
4012
4012
|
contextWindow: e.contextWindow,
|
|
4013
4013
|
maxOutputTokens: e.maxOutputTokens,
|
|
4014
4014
|
vision: e.vision
|
|
4015
|
-
}), P = u ??
|
|
4015
|
+
}), P = u ?? se.maxOutputTokens, F = b(se.contextWindow), I = x(se.contextWindow);
|
|
4016
4016
|
function ce(e) {
|
|
4017
|
-
|
|
4017
|
+
se = e, F = b(se.contextWindow), I = x(se.contextWindow);
|
|
4018
4018
|
}
|
|
4019
|
-
let le = /* @__PURE__ */
|
|
4019
|
+
let le = /* @__PURE__ */ Kt([]), L = 0, ue = () => ({
|
|
4020
4020
|
retries: 0,
|
|
4021
4021
|
exhausted: 0
|
|
4022
4022
|
}), de = {
|
|
@@ -4031,22 +4031,22 @@ function Is(e) {
|
|
|
4031
4031
|
AUDIT_GATE_EXHAUSTED: "evidence_audit_gate",
|
|
4032
4032
|
COMPLETION_GATE_EXHAUSTED: "completion_gate",
|
|
4033
4033
|
PAGE_ASSERTION_GATE_EXHAUSTED: "page_assertion_gate"
|
|
4034
|
-
}, fe = [], pe = 0, me = 0,
|
|
4035
|
-
function
|
|
4034
|
+
}, fe = [], pe = 0, me = 0, he = /* @__PURE__ */ new Set();
|
|
4035
|
+
function z(e, t) {
|
|
4036
4036
|
let n = {
|
|
4037
4037
|
timestamp: Date.now(),
|
|
4038
4038
|
type: e,
|
|
4039
4039
|
data: As(t)
|
|
4040
4040
|
};
|
|
4041
|
-
le.value.push(n), le.value.length > Es && le.value.splice(0, le.value.length - Es), Jt(le),
|
|
4041
|
+
le.value.push(n), le.value.length > Es && le.value.splice(0, le.value.length - Es), Jt(le), ie?.(n), oe && console.log(`%c[Agent] ${e}`, "color:#667eea;font-weight:bold", t);
|
|
4042
4042
|
}
|
|
4043
|
-
let
|
|
4043
|
+
let B = (e) => {
|
|
4044
4044
|
le.value.push({
|
|
4045
4045
|
...e,
|
|
4046
4046
|
timestamp: typeof e.timestamp == "number" ? e.timestamp : Date.now(),
|
|
4047
4047
|
data: As(e.data)
|
|
4048
4048
|
}), le.value.length > Es && le.value.splice(0, le.value.length - Es), Jt(le);
|
|
4049
|
-
},
|
|
4049
|
+
}, V = [...h.flatMap((e) => e.tools || []), ...m], ge = e.llm ?? new n({
|
|
4050
4050
|
apiKey: t,
|
|
4051
4051
|
model: c,
|
|
4052
4052
|
temperature: l,
|
|
@@ -4058,12 +4058,12 @@ function Is(e) {
|
|
|
4058
4058
|
...f
|
|
4059
4059
|
},
|
|
4060
4060
|
...d ? { modelKwargs: d } : {}
|
|
4061
|
-
}), _e =
|
|
4061
|
+
}), _e = V.length > 0 ? ge.bindTools?.(V) ?? ge : ge, ve = () => {
|
|
4062
4062
|
let e = ge;
|
|
4063
4063
|
return (typeof e.model == "string" && e.model ? e.model : typeof e.modelName == "string" && e.modelName ? e.modelName : "") || c;
|
|
4064
4064
|
};
|
|
4065
4065
|
function ye() {
|
|
4066
|
-
_e =
|
|
4066
|
+
_e = V.length > 0 ? ge.bindTools?.(V) ?? ge : ge;
|
|
4067
4067
|
}
|
|
4068
4068
|
let H = aa();
|
|
4069
4069
|
e.__pgIsSubagent && (H.__pgIsSubagent = !0);
|
|
@@ -4087,14 +4087,14 @@ function Is(e) {
|
|
|
4087
4087
|
pin: U.has(e.name)
|
|
4088
4088
|
});
|
|
4089
4089
|
}
|
|
4090
|
-
let n = Math.max(2e3, Math.round(
|
|
4090
|
+
let n = Math.max(2e3, Math.round(se.contextWindow * be)), r = y(e) + t.reduce((e, t) => e + t.tokens, 0), i = /* @__PURE__ */ new Set();
|
|
4091
4091
|
if (r > n) {
|
|
4092
4092
|
let e = r, a = [];
|
|
4093
4093
|
for (let e of t.filter((e) => !e.pin).sort((e, t) => t.tokens - e.tokens)) {
|
|
4094
4094
|
if (r <= n) break;
|
|
4095
4095
|
a.push(`${e.name}(${e.tokens})`), i.add(e.name), r -= e.tokens, e.text = "";
|
|
4096
4096
|
}
|
|
4097
|
-
a.length && console.warn(`[page-agent-sdk] 系统段超预算(${e} > ${n} tokens,窗口 ${
|
|
4097
|
+
a.length && console.warn(`[page-agent-sdk] 系统段超预算(${e} > ${n} tokens,窗口 ${se.contextWindow} 的 ${be * 100}%),drop 非核心段:${a.join(", ")}(保 base/mission/workingMemory)`);
|
|
4098
4098
|
}
|
|
4099
4099
|
return fe = t.map((e) => ({
|
|
4100
4100
|
name: e.name,
|
|
@@ -4105,7 +4105,7 @@ function Is(e) {
|
|
|
4105
4105
|
function Se(e) {
|
|
4106
4106
|
let t = [new a(xe())];
|
|
4107
4107
|
for (let n of e) if (n.role === "user") {
|
|
4108
|
-
let e = n.quote ? Pi(n.content, n.quote) : n.content, r =
|
|
4108
|
+
let e = n.quote ? Pi(n.content, n.quote) : n.content, r = se.vision && n.images?.length ? yi(e, n.images, j) : null;
|
|
4109
4109
|
r ? t.push(new i({ content: r })) : n.images?.some((e) => e.description) ? t.push(new i(bi(e, n.images))) : t.push(new i(e));
|
|
4110
4110
|
} else n.role === "assistant" ? t.push(new r(n.content)) : n.role === "system" && t.push(new a(n.content));
|
|
4111
4111
|
return t;
|
|
@@ -4121,7 +4121,7 @@ function Is(e) {
|
|
|
4121
4121
|
baseDelayMs: C,
|
|
4122
4122
|
onRetry: ({ attempt: e, error: t, waitMs: n }) => {
|
|
4123
4123
|
let r = t?.message ?? String(t);
|
|
4124
|
-
pe += 1,
|
|
4124
|
+
pe += 1, z("error", {
|
|
4125
4125
|
stage: "model_retry",
|
|
4126
4126
|
at: "launch",
|
|
4127
4127
|
attempt: e,
|
|
@@ -4154,23 +4154,23 @@ function Is(e) {
|
|
|
4154
4154
|
};
|
|
4155
4155
|
if (_a(a) && !e._ctxRetry) {
|
|
4156
4156
|
e._ctxRetry = !0;
|
|
4157
|
-
let r = (e) => y(typeof e.content == "string" ? e.content : JSON.stringify(e.content)), a = e.messages.reduce((e, t) => e + r(t), 0), o = G(e.messages, Math.round(
|
|
4158
|
-
return
|
|
4157
|
+
let r = (e) => y(typeof e.content == "string" ? e.content : JSON.stringify(e.content)), a = e.messages.reduce((e, t) => e + r(t), 0), o = G(e.messages, Math.round(se.contextWindow * .3)), s = o.reduce((e, t) => e + r(t), 0);
|
|
4158
|
+
return z("error", {
|
|
4159
4159
|
stage: "context_overflow_retry",
|
|
4160
4160
|
at: "launch",
|
|
4161
4161
|
beforeTokens: a,
|
|
4162
4162
|
afterTokens: s,
|
|
4163
|
-
window:
|
|
4163
|
+
window: se.contextWindow
|
|
4164
4164
|
}), console.warn(`[page-agent-sdk] 上下文超限(启动)→ 激进 trim 重试:${a} → ${s} tokens`), Ce({
|
|
4165
4165
|
...e,
|
|
4166
4166
|
messages: o
|
|
4167
4167
|
}, t, n, i);
|
|
4168
4168
|
}
|
|
4169
|
-
throw ba(a) ? (me += 1,
|
|
4169
|
+
throw ba(a) ? (me += 1, z("error", {
|
|
4170
4170
|
stage: "model_unavailable",
|
|
4171
4171
|
at: "launch",
|
|
4172
4172
|
status: a?.status
|
|
4173
|
-
})) : (me += 1,
|
|
4173
|
+
})) : (me += 1, z("error", {
|
|
4174
4174
|
stage: "model_call_failed",
|
|
4175
4175
|
at: "launch",
|
|
4176
4176
|
retries: S,
|
|
@@ -4199,7 +4199,7 @@ function Is(e) {
|
|
|
4199
4199
|
});
|
|
4200
4200
|
}
|
|
4201
4201
|
} catch (a) {
|
|
4202
|
-
if (a instanceof da) throw s.abort(), me += 1,
|
|
4202
|
+
if (a instanceof da) throw s.abort(), me += 1, z("error", {
|
|
4203
4203
|
stage: a instanceof fa ? "stream_max_duration" : "stream_stalled",
|
|
4204
4204
|
waitedMs: a.waitedMs,
|
|
4205
4205
|
stallMs: E,
|
|
@@ -4213,13 +4213,13 @@ function Is(e) {
|
|
|
4213
4213
|
};
|
|
4214
4214
|
if (_a(a) && l === null && u === "" && !e._ctxRetry) {
|
|
4215
4215
|
e._ctxRetry = !0;
|
|
4216
|
-
let r = (e) => y(typeof e.content == "string" ? e.content : JSON.stringify(e.content)), a = e.messages.reduce((e, t) => e + r(t), 0), o = G(e.messages, Math.round(
|
|
4217
|
-
return
|
|
4216
|
+
let r = (e) => y(typeof e.content == "string" ? e.content : JSON.stringify(e.content)), a = e.messages.reduce((e, t) => e + r(t), 0), o = G(e.messages, Math.round(se.contextWindow * .3)), s = o.reduce((e, t) => e + r(t), 0);
|
|
4217
|
+
return z("error", {
|
|
4218
4218
|
stage: "context_overflow_retry",
|
|
4219
4219
|
beforeTokens: a,
|
|
4220
4220
|
afterTokens: s,
|
|
4221
|
-
window:
|
|
4222
|
-
}), console.warn(`[page-agent-sdk] 上下文超限 → 激进 trim 重试:${a} → ${s} tokens(窗口 ${
|
|
4221
|
+
window: se.contextWindow
|
|
4222
|
+
}), console.warn(`[page-agent-sdk] 上下文超限 → 激进 trim 重试:${a} → ${s} tokens(窗口 ${se.contextWindow})`), Ce({
|
|
4223
4223
|
...e,
|
|
4224
4224
|
messages: o
|
|
4225
4225
|
}, t, n, i);
|
|
@@ -4228,7 +4228,7 @@ function Is(e) {
|
|
|
4228
4228
|
if (l === null && u === "" && o <= S && sa(a, n)) {
|
|
4229
4229
|
e._iterRetries = o, pe += 1;
|
|
4230
4230
|
let s = C * 2 ** (o - 1);
|
|
4231
|
-
if (
|
|
4231
|
+
if (z("error", {
|
|
4232
4232
|
stage: "model_retry",
|
|
4233
4233
|
at: "iterate",
|
|
4234
4234
|
attempt: o,
|
|
@@ -4258,11 +4258,11 @@ function Is(e) {
|
|
|
4258
4258
|
}
|
|
4259
4259
|
return Ce(e, t, n, i);
|
|
4260
4260
|
}
|
|
4261
|
-
throw ba(a) ? (me += 1,
|
|
4261
|
+
throw ba(a) ? (me += 1, z("error", {
|
|
4262
4262
|
stage: "model_unavailable",
|
|
4263
4263
|
at: "iterate",
|
|
4264
4264
|
status: a?.status
|
|
4265
|
-
})) : (me += 1,
|
|
4265
|
+
})) : (me += 1, z("error", {
|
|
4266
4266
|
stage: "model_call_failed",
|
|
4267
4267
|
at: "iterate",
|
|
4268
4268
|
emitted: l !== null || u !== "",
|
|
@@ -4270,11 +4270,11 @@ function Is(e) {
|
|
|
4270
4270
|
})), a;
|
|
4271
4271
|
}
|
|
4272
4272
|
if (l === null) {
|
|
4273
|
-
if (!e._emptyRetry) return e._emptyRetry = !0,
|
|
4273
|
+
if (!e._emptyRetry) return e._emptyRetry = !0, z("error", {
|
|
4274
4274
|
stage: "empty_llm_response_retry",
|
|
4275
4275
|
hint: "流正常结束但零 chunk(网关 200+错误体形态),自动重试 1 次"
|
|
4276
4276
|
}), Ce(e, t, n, i);
|
|
4277
|
-
throw
|
|
4277
|
+
throw z("error", {
|
|
4278
4278
|
stage: "empty_llm_response",
|
|
4279
4279
|
retried: !0,
|
|
4280
4280
|
hint: "重试后仍零 chunk,抛 EmptyLLMResponseError 显式报错"
|
|
@@ -4288,9 +4288,9 @@ function Is(e) {
|
|
|
4288
4288
|
};
|
|
4289
4289
|
}
|
|
4290
4290
|
async function we(e) {
|
|
4291
|
-
let t =
|
|
4291
|
+
let t = V.find((t) => t.name === e.name);
|
|
4292
4292
|
if (!t) {
|
|
4293
|
-
let t =
|
|
4293
|
+
let t = V.map((e) => e.name).filter((e) => !e.startsWith("__"));
|
|
4294
4294
|
return {
|
|
4295
4295
|
content: `工具 "${e.name}" 不存在(当前上下文可用工具:${t.join(", ")})`,
|
|
4296
4296
|
status: "error"
|
|
@@ -4304,7 +4304,7 @@ function Is(e) {
|
|
|
4304
4304
|
if (r > 0) try {
|
|
4305
4305
|
i = await ia(Promise.resolve().then(() => t.invoke(e.args, { configurable: n })), r);
|
|
4306
4306
|
} catch (t) {
|
|
4307
|
-
if (t instanceof ta) return
|
|
4307
|
+
if (t instanceof ta) return z("error", {
|
|
4308
4308
|
stage: "tool_timeout",
|
|
4309
4309
|
name: e.name,
|
|
4310
4310
|
timeoutMs: r,
|
|
@@ -4316,7 +4316,7 @@ function Is(e) {
|
|
|
4316
4316
|
throw t;
|
|
4317
4317
|
}
|
|
4318
4318
|
else i = await t.invoke(e.args, { configurable: n });
|
|
4319
|
-
let a = typeof i == "string" ? i : JSON.stringify(i), o =
|
|
4319
|
+
let a = typeof i == "string" ? i : JSON.stringify(i), o = V.some((e) => e.name === "vfs_read");
|
|
4320
4320
|
return a = Qi(a, {
|
|
4321
4321
|
files: e.state.files,
|
|
4322
4322
|
vfsAvailable: !!e.state.files && o,
|
|
@@ -4340,8 +4340,8 @@ function Is(e) {
|
|
|
4340
4340
|
function G(e, t) {
|
|
4341
4341
|
return js(e, t);
|
|
4342
4342
|
}
|
|
4343
|
-
function
|
|
4344
|
-
return !
|
|
4343
|
+
function K(e) {
|
|
4344
|
+
return !oe && !ie ? [] : e.map((e) => {
|
|
4345
4345
|
let t = Te(e), n = { role: t === "human" ? "user" : t === "ai" ? "assistant" : t }, r = typeof e.content == "string" ? e.content : JSON.stringify(e.content);
|
|
4346
4346
|
r && (n.content = r.length > Ds ? r.slice(0, Ds) + `…(截断 ${r.length - Ds} 字符)` : r);
|
|
4347
4347
|
let i = e.tool_calls;
|
|
@@ -4357,7 +4357,7 @@ function Is(e) {
|
|
|
4357
4357
|
return a && (n.tool_call_id = a), n;
|
|
4358
4358
|
});
|
|
4359
4359
|
}
|
|
4360
|
-
async function
|
|
4360
|
+
async function Ee(t, n, r) {
|
|
4361
4361
|
H = aa(), e.__pgIsSubagent && (H.__pgIsSubagent = !0), H.messages = t, H = await fs(h, H);
|
|
4362
4362
|
try {
|
|
4363
4363
|
let s = t;
|
|
@@ -4369,9 +4369,9 @@ function Is(e) {
|
|
|
4369
4369
|
});
|
|
4370
4370
|
}
|
|
4371
4371
|
{
|
|
4372
|
-
let e = y(p || "你是一个智能助手。"), t = Math.max(2e3, Math.round(
|
|
4372
|
+
let e = y(p || "你是一个智能助手。"), t = Math.max(2e3, Math.round(se.contextWindow * be));
|
|
4373
4373
|
if (e > t) {
|
|
4374
|
-
let r = `[page-agent-sdk] systemPrompt 本身(${e} tokens)超过系统段预算(${t} tokens,窗口 ${
|
|
4374
|
+
let r = `[page-agent-sdk] systemPrompt 本身(${e} tokens)超过系统段预算(${t} tokens,窗口 ${se.contextWindow} 的 ${be * 100}%);请缩减 systemPrompt 或换更大窗口模型`;
|
|
4375
4375
|
return console.error(r), n({
|
|
4376
4376
|
type: "error",
|
|
4377
4377
|
message: r,
|
|
@@ -4384,14 +4384,14 @@ function Is(e) {
|
|
|
4384
4384
|
}
|
|
4385
4385
|
}
|
|
4386
4386
|
let c = Se(s);
|
|
4387
|
-
|
|
4387
|
+
z("context", {
|
|
4388
4388
|
model: ve(),
|
|
4389
|
-
tools:
|
|
4389
|
+
tools: V.map((e) => e.name),
|
|
4390
4390
|
middleware: h.map((e) => e.name)
|
|
4391
4391
|
});
|
|
4392
4392
|
let l = _s(h, (e) => Ce(e, n, r)), u = vs(h, we), d = {
|
|
4393
4393
|
rounds: 0,
|
|
4394
|
-
maxToolRounds:
|
|
4394
|
+
maxToolRounds: N,
|
|
4395
4395
|
invokeUsage: {
|
|
4396
4396
|
prompt_tokens: 0,
|
|
4397
4397
|
completion_tokens: 0,
|
|
@@ -4408,16 +4408,16 @@ function Is(e) {
|
|
|
4408
4408
|
status: e.status,
|
|
4409
4409
|
content: e.content
|
|
4410
4410
|
}])), v = /* @__PURE__ */ new Map(), b = 0, x = (e) => {
|
|
4411
|
-
let t =
|
|
4411
|
+
let t = V.find((t) => t.name === e);
|
|
4412
4412
|
return t && "writeCapable" in t ? typeof t.writeCapable == "function" || t.writeCapable === !0 : Ps.has(e);
|
|
4413
|
-
}, S = 0, C = 0, w = Ms(
|
|
4414
|
-
for (; (S <
|
|
4415
|
-
if (
|
|
4416
|
-
let e = `本轮 token 预算(约 ${
|
|
4417
|
-
return
|
|
4413
|
+
}, S = 0, C = 0, w = Ms(N, _), T = null, E = 0, D = !1, O = !1, ee = !1;
|
|
4414
|
+
for (; (S < N || ee) && C < w && (C++, !r?.aborted);) {
|
|
4415
|
+
if (A > 0 && d.invokeUsage.total_tokens > A) {
|
|
4416
|
+
let e = `本轮 token 预算(约 ${A})已用尽:任务在 ${S} 轮工具调用后中断,已完成的部分均保留。可继续对话,指定下一步(如「继续完成」/「只改 X」/「提高预算重试」)。`;
|
|
4417
|
+
return z("error", {
|
|
4418
4418
|
stage: "round_token_budget_exceeded",
|
|
4419
4419
|
used: d.invokeUsage.total_tokens,
|
|
4420
|
-
budget:
|
|
4420
|
+
budget: A,
|
|
4421
4421
|
rounds: S
|
|
4422
4422
|
}), n({
|
|
4423
4423
|
type: "error",
|
|
@@ -4426,7 +4426,7 @@ function Is(e) {
|
|
|
4426
4426
|
code: "ROUND_TOKEN_BUDGET_EXCEEDED",
|
|
4427
4427
|
context: {
|
|
4428
4428
|
used: d.invokeUsage.total_tokens,
|
|
4429
|
-
budget:
|
|
4429
|
+
budget: A
|
|
4430
4430
|
}
|
|
4431
4431
|
}), n({
|
|
4432
4432
|
type: "done",
|
|
@@ -4439,19 +4439,19 @@ function Is(e) {
|
|
|
4439
4439
|
}), H = ps(h, {
|
|
4440
4440
|
messages: c,
|
|
4441
4441
|
state: H
|
|
4442
|
-
}), c = W(c, Ns(S,
|
|
4442
|
+
}), c = W(c, Ns(S, N, e.hasSubagent)), c = G(c, Math.round(se.contextWindow * .6)), z("llm_request", {
|
|
4443
4443
|
round: S + 1,
|
|
4444
4444
|
model: ve(),
|
|
4445
|
-
tools:
|
|
4446
|
-
messages:
|
|
4445
|
+
tools: V.map((e) => e.name),
|
|
4446
|
+
messages: K(c)
|
|
4447
4447
|
});
|
|
4448
4448
|
let t = await l({
|
|
4449
4449
|
messages: c,
|
|
4450
4450
|
state: H
|
|
4451
4451
|
});
|
|
4452
4452
|
c.push(t.message);
|
|
4453
|
-
let a =
|
|
4454
|
-
if (
|
|
4453
|
+
let a = re(t.message);
|
|
4454
|
+
if (z("llm_response", {
|
|
4455
4455
|
round: S + 1,
|
|
4456
4456
|
content: t.content,
|
|
4457
4457
|
toolCalls: t.toolCalls,
|
|
@@ -4462,9 +4462,9 @@ function Is(e) {
|
|
|
4462
4462
|
}), t.content;
|
|
4463
4463
|
if (!t.toolCalls.length) {
|
|
4464
4464
|
{
|
|
4465
|
-
let e = t.message?.response_metadata ?? t.message?.responseMetadata, n = e?.stop_reason ?? e?.finish_reason, r =
|
|
4465
|
+
let e = t.message?.response_metadata ?? t.message?.responseMetadata, n = e?.stop_reason ?? e?.finish_reason, r = re(t.message);
|
|
4466
4466
|
if ((n === "length" || !t.content && (r?.completion_tokens ?? 0) >= 4e3) && !D) {
|
|
4467
|
-
D = !0, ee = !0,
|
|
4467
|
+
D = !0, ee = !0, z("error", {
|
|
4468
4468
|
stage: "completion_truncated_retry",
|
|
4469
4469
|
completionTokens: r?.completion_tokens,
|
|
4470
4470
|
stopReason: n ?? null,
|
|
@@ -4474,7 +4474,7 @@ function Is(e) {
|
|
|
4474
4474
|
continue;
|
|
4475
4475
|
}
|
|
4476
4476
|
if (!t.content && (r?.reasoning_tokens ?? 0) > 0 && !O) {
|
|
4477
|
-
O = !0, ee = !0,
|
|
4477
|
+
O = !0, ee = !0, z("error", {
|
|
4478
4478
|
stage: "reasoning_exhausted_retry",
|
|
4479
4479
|
completionTokens: r?.completion_tokens ?? null,
|
|
4480
4480
|
reasoningTokens: r?.reasoning_tokens ?? null,
|
|
@@ -4492,21 +4492,21 @@ function Is(e) {
|
|
|
4492
4492
|
name: e.name,
|
|
4493
4493
|
args: e.args,
|
|
4494
4494
|
type: "tool_call"
|
|
4495
|
-
}))),
|
|
4495
|
+
}))), z("middleware", {
|
|
4496
4496
|
stage: "dsml_parsed",
|
|
4497
4497
|
count: a.length,
|
|
4498
4498
|
names: a.map((e) => e.name)
|
|
4499
4499
|
});
|
|
4500
4500
|
} else {
|
|
4501
4501
|
if (r && E < 2) {
|
|
4502
|
-
E += 1, ee = !0,
|
|
4502
|
+
E += 1, ee = !0, z("middleware", {
|
|
4503
4503
|
stage: "format_retry",
|
|
4504
4504
|
attempt: E,
|
|
4505
4505
|
content: t.content.slice(0, 200)
|
|
4506
4506
|
}), c.push(new i("⚠️ 你刚才把工具调用写成了文本(伪 XML/标签/DSML 标记,如 <|tool_calls|>、<||DSML||>、<invoke name=...>),未被系统识别为工具调用,因此未执行,页面无变化。请直接用标准 function calling(工具调用)格式重新发起工具调用,不要在回复正文里输出这些标签或 JSON 文本。"));
|
|
4507
4507
|
continue;
|
|
4508
4508
|
}
|
|
4509
|
-
r && (
|
|
4509
|
+
r && (z("error", {
|
|
4510
4510
|
stage: "garbled_exhausted",
|
|
4511
4511
|
retries: E,
|
|
4512
4512
|
content: t.content.slice(0, 200)
|
|
@@ -4527,7 +4527,7 @@ function Is(e) {
|
|
|
4527
4527
|
turnUsage: f,
|
|
4528
4528
|
isWriteToolByName: x,
|
|
4529
4529
|
messages: c,
|
|
4530
|
-
sessionWritePaths:
|
|
4530
|
+
sessionWritePaths: he,
|
|
4531
4531
|
todosStatusAtStart: g,
|
|
4532
4532
|
pageGate: e.pageAssertionGate === !0,
|
|
4533
4533
|
pageReadTools: e.pageReadTools,
|
|
@@ -4536,7 +4536,7 @@ function Is(e) {
|
|
|
4536
4536
|
if (a?.kind === "feedback") {
|
|
4537
4537
|
ee = !0;
|
|
4538
4538
|
let e = de[a.gate.stage];
|
|
4539
|
-
e && (e.retries += 1),
|
|
4539
|
+
e && (e.retries += 1), z("middleware", {
|
|
4540
4540
|
stage: a.gate.stage,
|
|
4541
4541
|
attempt: a.gate.attempt,
|
|
4542
4542
|
...a.gate.logData ?? {},
|
|
@@ -4546,7 +4546,7 @@ function Is(e) {
|
|
|
4546
4546
|
}
|
|
4547
4547
|
if (a?.kind === "observable") {
|
|
4548
4548
|
let e = R[a.obs.code];
|
|
4549
|
-
e && de[e] && (de[e].exhausted += 1),
|
|
4549
|
+
e && de[e] && (de[e].exhausted += 1), z("error", {
|
|
4550
4550
|
stage: a.obs.code,
|
|
4551
4551
|
...a.obs.context,
|
|
4552
4552
|
content: t.content.slice(0, 160)
|
|
@@ -4563,10 +4563,10 @@ function Is(e) {
|
|
|
4563
4563
|
messages: c,
|
|
4564
4564
|
state: H,
|
|
4565
4565
|
response: t,
|
|
4566
|
-
log: (e, t) =>
|
|
4566
|
+
log: (e, t) => z(e, t)
|
|
4567
4567
|
});
|
|
4568
4568
|
if (e) {
|
|
4569
|
-
T = t.content, H.verifyAttempts += 1, c.push(new i(`⚠️ 验证未通过,请修正:${e}`)),
|
|
4569
|
+
T = t.content, H.verifyAttempts += 1, c.push(new i(`⚠️ 验证未通过,请修正:${e}`)), z("middleware", {
|
|
4570
4570
|
stage: "verify_retry",
|
|
4571
4571
|
attempt: H.verifyAttempts,
|
|
4572
4572
|
feedback: e
|
|
@@ -4599,7 +4599,7 @@ function Is(e) {
|
|
|
4599
4599
|
state: H,
|
|
4600
4600
|
signal: r,
|
|
4601
4601
|
emit: n,
|
|
4602
|
-
logSink:
|
|
4602
|
+
logSink: B
|
|
4603
4603
|
}
|
|
4604
4604
|
};
|
|
4605
4605
|
});
|
|
@@ -4619,7 +4619,7 @@ function Is(e) {
|
|
|
4619
4619
|
name: e.call.name,
|
|
4620
4620
|
args: e.call.args,
|
|
4621
4621
|
id: e.id
|
|
4622
|
-
}),
|
|
4622
|
+
}), z("tool_call", {
|
|
4623
4623
|
round: S + 1,
|
|
4624
4624
|
name: e.call.name,
|
|
4625
4625
|
args: e.call.args,
|
|
@@ -4643,7 +4643,7 @@ function Is(e) {
|
|
|
4643
4643
|
status: i.status,
|
|
4644
4644
|
durationMs: a,
|
|
4645
4645
|
id: e.id
|
|
4646
|
-
}),
|
|
4646
|
+
}), z("tool_result", {
|
|
4647
4647
|
round: S + 1,
|
|
4648
4648
|
name: e.call.name,
|
|
4649
4649
|
result: i.content,
|
|
@@ -4681,7 +4681,7 @@ function Is(e) {
|
|
|
4681
4681
|
let t = _[e];
|
|
4682
4682
|
if (!t) continue;
|
|
4683
4683
|
let n = p[e].call.name;
|
|
4684
|
-
if (f.counts[n] = (f.counts[n] ?? 0) + 1, t.status === "error" && (f.failures += 1), so.test(n) && String(t.content || "").startsWith("ERROR:") && (f.rejectedDelegations = f.rejectedDelegations ?? {}, f.rejectedDelegations[n] = (f.rejectedDelegations[n] ?? 0) + 1), Ho(
|
|
4684
|
+
if (f.counts[n] = (f.counts[n] ?? 0) + 1, t.status === "error" && (f.failures += 1), so.test(n) && String(t.content || "").startsWith("ERROR:") && (f.rejectedDelegations = f.rejectedDelegations ?? {}, f.rejectedDelegations[n] = (f.rejectedDelegations[n] ?? 0) + 1), Ho(V.find((e) => e.name === n), p[e].call.args, t)) {
|
|
4685
4685
|
let t = Fs(p[e].call.args);
|
|
4686
4686
|
f.writePaths.push(t || "(整体)"), y.push({
|
|
4687
4687
|
name: n,
|
|
@@ -4693,15 +4693,15 @@ function Is(e) {
|
|
|
4693
4693
|
args: p[e].call.args,
|
|
4694
4694
|
callIndex: e
|
|
4695
4695
|
});
|
|
4696
|
-
if (r) for (let e of r.paths)
|
|
4696
|
+
if (r) for (let e of r.paths) he.add(e);
|
|
4697
4697
|
}
|
|
4698
4698
|
}
|
|
4699
|
-
if (
|
|
4699
|
+
if (M && y.length) {
|
|
4700
4700
|
let e = no(c, y, {
|
|
4701
4701
|
round: S + 1,
|
|
4702
4702
|
maxParallelTools: k
|
|
4703
4703
|
});
|
|
4704
|
-
e.invalidatedCount > 0 && (c = e.messages, L += e.invalidatedCount,
|
|
4704
|
+
e.invalidatedCount > 0 && (c = e.messages, L += e.invalidatedCount, z("middleware", {
|
|
4705
4705
|
stage: "stale_read_invalidated",
|
|
4706
4706
|
round: S + 1,
|
|
4707
4707
|
writtenPaths: y.map((e) => Fs(e.args) || "(整体)"),
|
|
@@ -4715,38 +4715,38 @@ function Is(e) {
|
|
|
4715
4715
|
type: "done",
|
|
4716
4716
|
content: ""
|
|
4717
4717
|
}), "";
|
|
4718
|
-
let te = `\n\n(提示:工具调用次数已达上限(${
|
|
4719
|
-
|
|
4718
|
+
let te = `\n\n(提示:工具调用次数已达上限(${N} 轮 / ${w} 次迭代),以上为基于已完成操作的阶段性结果,任务可能未完成。回复「继续」或告诉我下一步重点,即可接着做。)`;
|
|
4719
|
+
z("error", {
|
|
4720
4720
|
stage: "react_call_limit_exceeded",
|
|
4721
4721
|
rounds: S,
|
|
4722
|
-
maxToolRounds:
|
|
4722
|
+
maxToolRounds: N,
|
|
4723
4723
|
iterations: C,
|
|
4724
4724
|
maxIterations: w
|
|
4725
4725
|
}), n({
|
|
4726
4726
|
type: "error",
|
|
4727
|
-
message: `ReAct 循环达到调用上限(rounds=${S}/${
|
|
4727
|
+
message: `ReAct 循环达到调用上限(rounds=${S}/${N},iterations=${C}/${w}),已强制收口,可回复「继续」。`,
|
|
4728
4728
|
severity: "observable",
|
|
4729
4729
|
code: "REACT_CALL_LIMIT_EXCEEDED",
|
|
4730
4730
|
context: {
|
|
4731
4731
|
rounds: S,
|
|
4732
|
-
maxToolRounds:
|
|
4732
|
+
maxToolRounds: N,
|
|
4733
4733
|
iterations: C,
|
|
4734
4734
|
maxIterations: w
|
|
4735
4735
|
}
|
|
4736
4736
|
});
|
|
4737
|
-
let
|
|
4738
|
-
if (
|
|
4737
|
+
let ie = cs(H.todos ?? [], g, he);
|
|
4738
|
+
if (ie.length) {
|
|
4739
4739
|
de.evidence_audit_gate.exhausted += 1;
|
|
4740
|
-
let e =
|
|
4740
|
+
let e = ie.map((e) => ({
|
|
4741
4741
|
id: e.id,
|
|
4742
4742
|
evidence: e.evidence
|
|
4743
4743
|
}));
|
|
4744
|
-
|
|
4744
|
+
z("middleware", {
|
|
4745
4745
|
stage: "evidence_audit_flagged",
|
|
4746
4746
|
offenders: e
|
|
4747
4747
|
}), n({
|
|
4748
4748
|
type: "error",
|
|
4749
|
-
message: `轮次耗尽收口:${
|
|
4749
|
+
message: `轮次耗尽收口:${ie.length} 项已完成任务的 evidence 路径与写入记录不符,最终回复中的完成声明可能不实`,
|
|
4750
4750
|
severity: "observable",
|
|
4751
4751
|
code: "AUDIT_EVIDENCE_SUSPECT",
|
|
4752
4752
|
context: { offenders: e }
|
|
@@ -4759,20 +4759,20 @@ function Is(e) {
|
|
|
4759
4759
|
content: e
|
|
4760
4760
|
}), e;
|
|
4761
4761
|
}
|
|
4762
|
-
let
|
|
4763
|
-
if (
|
|
4762
|
+
let ae = c[c.length - 1];
|
|
4763
|
+
if (ae && Te(ae) === "tool") {
|
|
4764
4764
|
let e = c[0] && Te(c[0]) === "system" ? c.slice(1) : c.slice(), t = [new a(xe() + "\n\n工具调用次数已达上限,请基于已有工具结果直接给出最终回答,不要再调用工具。"), ...e];
|
|
4765
|
-
|
|
4765
|
+
z("llm_request", {
|
|
4766
4766
|
round: "wrap_up",
|
|
4767
4767
|
model: ve(),
|
|
4768
4768
|
tools: [],
|
|
4769
|
-
messages:
|
|
4769
|
+
messages: K(t)
|
|
4770
4770
|
});
|
|
4771
4771
|
let i = await _s(h, (e) => Ce(e, n, r, ge))({
|
|
4772
4772
|
messages: t,
|
|
4773
4773
|
state: H
|
|
4774
4774
|
});
|
|
4775
|
-
if (H = ms(h, i, H),
|
|
4775
|
+
if (H = ms(h, i, H), z("llm_response", {
|
|
4776
4776
|
round: "wrap_up",
|
|
4777
4777
|
content: i.content
|
|
4778
4778
|
}), i.aborted) return n({
|
|
@@ -4783,7 +4783,7 @@ function Is(e) {
|
|
|
4783
4783
|
let e = i.content;
|
|
4784
4784
|
if (ys(e)) {
|
|
4785
4785
|
let t = bs(e);
|
|
4786
|
-
|
|
4786
|
+
z("error", {
|
|
4787
4787
|
stage: "garbled_wrapup",
|
|
4788
4788
|
content: e.slice(0, 200)
|
|
4789
4789
|
}), n({
|
|
@@ -4800,11 +4800,11 @@ function Is(e) {
|
|
|
4800
4800
|
}), e + te;
|
|
4801
4801
|
}
|
|
4802
4802
|
}
|
|
4803
|
-
let
|
|
4803
|
+
let j = "我已完成本轮能做的操作,但未能综合出最终结论。请基于上方已完成的工具操作结果继续,或告诉我下一步重点。";
|
|
4804
4804
|
return n({
|
|
4805
4805
|
type: "done",
|
|
4806
|
-
content:
|
|
4807
|
-
}),
|
|
4806
|
+
content: j + te
|
|
4807
|
+
}), j + te;
|
|
4808
4808
|
} finally {
|
|
4809
4809
|
try {
|
|
4810
4810
|
await hs(h, H);
|
|
@@ -4814,24 +4814,24 @@ function Is(e) {
|
|
|
4814
4814
|
}
|
|
4815
4815
|
}
|
|
4816
4816
|
}
|
|
4817
|
-
async function
|
|
4817
|
+
async function De(e, t, n) {
|
|
4818
4818
|
let r = "";
|
|
4819
|
-
return await
|
|
4819
|
+
return await Ee(e, (e) => {
|
|
4820
4820
|
e.type === "done" && (r = e.content), n?.(e);
|
|
4821
4821
|
}, t), r;
|
|
4822
4822
|
}
|
|
4823
|
-
function
|
|
4824
|
-
|
|
4823
|
+
function Oe(e) {
|
|
4824
|
+
V = [...h.flatMap((e) => e.tools || []), ...e], ye();
|
|
4825
4825
|
}
|
|
4826
|
-
function
|
|
4827
|
-
ge = e, ye(),
|
|
4826
|
+
function ke(e) {
|
|
4827
|
+
ge = e, ye(), ae?.(e);
|
|
4828
4828
|
}
|
|
4829
4829
|
return {
|
|
4830
|
-
invoke:
|
|
4831
|
-
stream:
|
|
4830
|
+
invoke: De,
|
|
4831
|
+
stream: Ee,
|
|
4832
4832
|
getState: () => H,
|
|
4833
4833
|
get allTools() {
|
|
4834
|
-
return
|
|
4834
|
+
return V;
|
|
4835
4835
|
},
|
|
4836
4836
|
getStaleReadsInvalidated: () => L,
|
|
4837
4837
|
getLlmRetries: () => pe,
|
|
@@ -4842,8 +4842,8 @@ function Is(e) {
|
|
|
4842
4842
|
L = 0, pe = 0, me = 0;
|
|
4843
4843
|
for (let e of Object.keys(de)) de[e] = ue();
|
|
4844
4844
|
},
|
|
4845
|
-
setTools:
|
|
4846
|
-
setLlm:
|
|
4845
|
+
setTools: Oe,
|
|
4846
|
+
setLlm: ke,
|
|
4847
4847
|
setModelCaps: ce,
|
|
4848
4848
|
debugLogs: le,
|
|
4849
4849
|
getEffectiveSystemPrompt: () => xe()
|
|
@@ -6570,7 +6570,7 @@ async function lu(e, t, n, r, i, a) {
|
|
|
6570
6570
|
} : { contextWindow: y.contextWindow }), x = t.onUsage ? {
|
|
6571
6571
|
name: "sub-usage",
|
|
6572
6572
|
afterModel: (e) => {
|
|
6573
|
-
let n =
|
|
6573
|
+
let n = re(e.message);
|
|
6574
6574
|
n && t.onUsage(n);
|
|
6575
6575
|
}
|
|
6576
6576
|
} : void 0;
|
|
@@ -6656,16 +6656,16 @@ async function lu(e, t, n, r, i, a) {
|
|
|
6656
6656
|
} finally {
|
|
6657
6657
|
ee();
|
|
6658
6658
|
}
|
|
6659
|
-
let
|
|
6660
|
-
|
|
6659
|
+
let A, ie = new Promise((e, t) => {
|
|
6660
|
+
A = setTimeout(() => {
|
|
6661
6661
|
D.abort(), t(/* @__PURE__ */ Error(`子 agent 执行超时(${ne}ms),已中止。可简化子任务或拆更小的子任务重试,或经 subagent.timeoutMs 调整(0=不限制)`));
|
|
6662
6662
|
}, ne);
|
|
6663
6663
|
});
|
|
6664
6664
|
te.catch(() => {});
|
|
6665
6665
|
try {
|
|
6666
|
-
return cu(await Promise.race([te,
|
|
6666
|
+
return cu(await Promise.race([te, ie]), E.getState());
|
|
6667
6667
|
} finally {
|
|
6668
|
-
clearTimeout(
|
|
6668
|
+
clearTimeout(A), ee();
|
|
6669
6669
|
}
|
|
6670
6670
|
}
|
|
6671
6671
|
function uu(e) {
|
|
@@ -7128,26 +7128,37 @@ function Eu(e = {}) {
|
|
|
7128
7128
|
let t = (t, n) => e.confirm ? !!e.confirm(t, n) : e.tools === void 0 || e.tools.includes(t);
|
|
7129
7129
|
return {
|
|
7130
7130
|
name: "approval",
|
|
7131
|
-
wrapToolCall: async (n, r) =>
|
|
7132
|
-
|
|
7133
|
-
|
|
7131
|
+
wrapToolCall: async (n, r) => e.remember && e.grants?.has(n.name) ? (n.logSink?.({
|
|
7132
|
+
timestamp: Date.now(),
|
|
7133
|
+
type: "middleware",
|
|
7134
|
+
data: {
|
|
7135
|
+
stage: "approval_auto_allowed",
|
|
7136
|
+
toolName: n.name
|
|
7137
|
+
}
|
|
7138
|
+
}), r(n)) : t(n.name, n.args) ? new Promise((t) => {
|
|
7139
|
+
let i = !1, a = [], o = (o) => {
|
|
7140
|
+
if (i) return;
|
|
7141
|
+
i = !0, a.forEach((e) => e());
|
|
7142
|
+
let s = typeof o == "object" && o ? o : null, c = s ? s.approved === !0 : o !== !1, l = !!s?.remember && c;
|
|
7143
|
+
if (l && e.grants?.add(n.name), n.logSink?.({
|
|
7134
7144
|
timestamp: Date.now(),
|
|
7135
7145
|
type: "middleware",
|
|
7136
7146
|
data: {
|
|
7137
7147
|
stage: "approval_resolved",
|
|
7138
7148
|
toolName: n.name,
|
|
7139
|
-
approved:
|
|
7149
|
+
approved: c ? l ? "granted" : String(o).slice(0, 60) : !1
|
|
7140
7150
|
}
|
|
7141
|
-
}),
|
|
7151
|
+
}), c) r(n).then(t, (e) => t({
|
|
7152
|
+
content: `工具执行失败:${e?.message ?? e}`,
|
|
7153
|
+
status: "error"
|
|
7154
|
+
}));
|
|
7155
|
+
else {
|
|
7142
7156
|
let e = n.args ?? {}, r = e.path || e.jsonPath || e.patch?.jsonPath || (Array.isArray(e.patches) ? e.patches.map((e) => e?.jsonPath).filter(Boolean).join(",") : "") || "";
|
|
7143
7157
|
t({
|
|
7144
7158
|
content: `用户拒绝了 ${n.name} 调用${r ? `(path=${r})` : ""}。请改用只读工具、调整路径或换方案后再试。`,
|
|
7145
7159
|
status: "error"
|
|
7146
7160
|
});
|
|
7147
|
-
}
|
|
7148
|
-
content: `工具执行失败:${e?.message ?? e}`,
|
|
7149
|
-
status: "error"
|
|
7150
|
-
}));
|
|
7161
|
+
}
|
|
7151
7162
|
};
|
|
7152
7163
|
if (n.signal) {
|
|
7153
7164
|
if (n.signal.aborted) return o(!1);
|
|
@@ -7180,7 +7191,8 @@ function Eu(e = {}) {
|
|
|
7180
7191
|
args: n.args,
|
|
7181
7192
|
resolve: o,
|
|
7182
7193
|
hold: s,
|
|
7183
|
-
...c ? { preview: c } : {}
|
|
7194
|
+
...c ? { preview: c } : {},
|
|
7195
|
+
...e.remember ? { remember: !0 } : {}
|
|
7184
7196
|
}), n.logSink?.({
|
|
7185
7197
|
timestamp: Date.now(),
|
|
7186
7198
|
type: "middleware",
|
|
@@ -7272,7 +7284,7 @@ function Au(e, t = {}) {
|
|
|
7272
7284
|
type: "approval_request",
|
|
7273
7285
|
toolName: n.name,
|
|
7274
7286
|
args: n.args,
|
|
7275
|
-
resolve: o,
|
|
7287
|
+
resolve: (e) => o(typeof e == "object" && e ? e.approved : e),
|
|
7276
7288
|
hold: s
|
|
7277
7289
|
}), n.logSink?.({
|
|
7278
7290
|
timestamp: Date.now(),
|
|
@@ -9435,7 +9447,7 @@ function xf(e, n = {}) {
|
|
|
9435
9447
|
let n = t ?? y;
|
|
9436
9448
|
e === void 0 ? v.delete(n) : v.set(n, e);
|
|
9437
9449
|
}, E = n.conflictWatchFields ?? [], D = !E.includes("*") && E.length ? new Set(E) : void 0, O = E.length > 0, k = () => D ? Vc(l(), D) : Bc(l()), ee = (n.maxParallelTools ?? 1) > 1 && O, te = !1, ne = [];
|
|
9438
|
-
async function
|
|
9450
|
+
async function A() {
|
|
9439
9451
|
if (!ee) return {
|
|
9440
9452
|
release: () => {},
|
|
9441
9453
|
reacquire: async () => {}
|
|
@@ -9455,35 +9467,35 @@ function xf(e, n = {}) {
|
|
|
9455
9467
|
};
|
|
9456
9468
|
}
|
|
9457
9469
|
(n.maxParallelTools ?? 1) > 1 && !O && console.warn("[page-agent-sdk] maxParallelTools>1 且未声明 conflictWatchFields:并发写不互锁(后写覆盖前写,既有明文语义);声明 conflictWatchFields 后自动启用写互锁与乐观锁校验");
|
|
9458
|
-
let
|
|
9470
|
+
let re = (e) => {
|
|
9459
9471
|
let t = k();
|
|
9460
9472
|
return T(t, e), t;
|
|
9461
|
-
},
|
|
9473
|
+
}, ie = n.largeTextThreshold ?? 200, ae = (n.largeTextPaths ?? []).map((e) => {
|
|
9462
9474
|
let t = e.lastIndexOf(".");
|
|
9463
9475
|
return t > 0 ? {
|
|
9464
9476
|
arrayPath: e.slice(0, t),
|
|
9465
9477
|
field: e.slice(t + 1)
|
|
9466
9478
|
} : null;
|
|
9467
|
-
}).filter((e) => e !== null),
|
|
9468
|
-
function
|
|
9469
|
-
|
|
9479
|
+
}).filter((e) => e !== null), j = !0;
|
|
9480
|
+
function M() {
|
|
9481
|
+
j = !0;
|
|
9470
9482
|
}
|
|
9471
|
-
let
|
|
9483
|
+
let oe = {
|
|
9472
9484
|
get: () => ({
|
|
9473
9485
|
schema: o,
|
|
9474
9486
|
bind: c,
|
|
9475
9487
|
description: u
|
|
9476
9488
|
}),
|
|
9477
9489
|
set: (e) => {
|
|
9478
|
-
o = r.length ? pc(e.schema, r).schema : e.schema, c = e.bind, u = e.description ?? "主数据对象", d = Ls(o), g.length = 0, v.clear(), m(e.resources), p?.clear(),
|
|
9490
|
+
o = r.length ? pc(e.schema, r).schema : e.schema, c = e.bind, u = e.description ?? "主数据对象", d = Ls(o), g.length = 0, v.clear(), m(e.resources), p?.clear(), M();
|
|
9479
9491
|
},
|
|
9480
9492
|
update: (e) => {
|
|
9481
|
-
c = e, g.length = 0, v.clear(),
|
|
9493
|
+
c = e, g.length = 0, v.clear(), M();
|
|
9482
9494
|
},
|
|
9483
|
-
markDataDirty:
|
|
9495
|
+
markDataDirty: M,
|
|
9484
9496
|
consumeDataDirty: () => {
|
|
9485
|
-
let e =
|
|
9486
|
-
return
|
|
9497
|
+
let e = j;
|
|
9498
|
+
return j = !1, e;
|
|
9487
9499
|
},
|
|
9488
9500
|
enterScope: (e) => {
|
|
9489
9501
|
let t = y;
|
|
@@ -9537,14 +9549,14 @@ function xf(e, n = {}) {
|
|
|
9537
9549
|
} : void 0,
|
|
9538
9550
|
updateResource: p ? (e, t) => {
|
|
9539
9551
|
let n = Hd(e);
|
|
9540
|
-
p.update(n, t), Mc(c, n, t),
|
|
9552
|
+
p.update(n, t), Mc(c, n, t), M(), T(k(), "");
|
|
9541
9553
|
} : void 0,
|
|
9542
9554
|
deleteResource: p ? (e) => p.delete(e) : void 0,
|
|
9543
9555
|
listResources: p ? () => p.list() : void 0
|
|
9544
|
-
},
|
|
9556
|
+
}, N = (e) => {
|
|
9545
9557
|
n.onAudit?.(e);
|
|
9546
9558
|
};
|
|
9547
|
-
function
|
|
9559
|
+
function se(e, t) {
|
|
9548
9560
|
let n = Pc(l()), r = g.length ? g[g.length - 1].id + 1 : 1;
|
|
9549
9561
|
for (g.push({
|
|
9550
9562
|
id: r,
|
|
@@ -9577,7 +9589,7 @@ function xf(e, n = {}) {
|
|
|
9577
9589
|
if (u.action === "restore") {
|
|
9578
9590
|
await i?.reacquire();
|
|
9579
9591
|
let e = k();
|
|
9580
|
-
if (e !== o) return
|
|
9592
|
+
if (e !== o) return N({
|
|
9581
9593
|
op: "conflict_recheck",
|
|
9582
9594
|
detail: `restore 裁决基于 ${o} 恢复时 ${e}(ask 窗口新修改落地,回退被拦)`,
|
|
9583
9595
|
timestamp: Date.now()
|
|
@@ -9593,13 +9605,13 @@ function xf(e, n = {}) {
|
|
|
9593
9605
|
message: `restore 裁决所锚定的快照 #${s} 已不在快照栈(可能被 maxSnapshots 淘汰)`,
|
|
9594
9606
|
hint: "重新 read 拿最新值,或用 restore_data 显式指定快照 id 回退"
|
|
9595
9607
|
});
|
|
9596
|
-
Kc(c, Pc(t.value)),
|
|
9608
|
+
Kc(c, Pc(t.value)), M();
|
|
9597
9609
|
let n = k();
|
|
9598
9610
|
return T(n, a), `已回退主数据到历史快照 #${t.id}[${t.op}]。当前值:${$(l(), 400)} (hash=${n})。请基于回退后的值重写或停止。`;
|
|
9599
9611
|
}
|
|
9600
9612
|
await i?.reacquire();
|
|
9601
9613
|
let d = k();
|
|
9602
|
-
return d === o ? (T(d, a), null) : (
|
|
9614
|
+
return d === o ? (T(d, a), null) : (N({
|
|
9603
9615
|
op: "conflict_recheck",
|
|
9604
9616
|
detail: `裁决基于 ${o} 恢复时 ${d}(ask 窗口新修改落地,overwrite 被拦)`,
|
|
9605
9617
|
timestamp: Date.now()
|
|
@@ -9612,7 +9624,7 @@ function xf(e, n = {}) {
|
|
|
9612
9624
|
let F = (e, t = !0) => {
|
|
9613
9625
|
e.writeCapable = t;
|
|
9614
9626
|
}, I = s(async ({ id: e }, t) => {
|
|
9615
|
-
let n = b(t), r = await
|
|
9627
|
+
let n = b(t), r = await A();
|
|
9616
9628
|
try {
|
|
9617
9629
|
if (!g.length) return Z({
|
|
9618
9630
|
code: "NO_SNAPSHOT",
|
|
@@ -9626,7 +9638,7 @@ function xf(e, n = {}) {
|
|
|
9626
9638
|
hint: "用 history_data({list:true}) 查看可用快照序号"
|
|
9627
9639
|
});
|
|
9628
9640
|
let r = o.safeParse(t.value);
|
|
9629
|
-
r.success ||
|
|
9641
|
+
r.success || N({
|
|
9630
9642
|
op: "restore",
|
|
9631
9643
|
detail: `#${t.id} 快照含当前 schema 违例 ${r.error.issues.length} 处(历史既有数据非本次写入,放行回退)`,
|
|
9632
9644
|
timestamp: Date.now()
|
|
@@ -9639,7 +9651,7 @@ function xf(e, n = {}) {
|
|
|
9639
9651
|
cur: n
|
|
9640
9652
|
});
|
|
9641
9653
|
}
|
|
9642
|
-
if (!i.length) return Kc(c, Pc(t.value)),
|
|
9654
|
+
if (!i.length) return Kc(c, Pc(t.value)), M(), N({
|
|
9643
9655
|
op: "restore",
|
|
9644
9656
|
detail: `#${t.id}`,
|
|
9645
9657
|
timestamp: Date.now()
|
|
@@ -9672,7 +9684,7 @@ function xf(e, n = {}) {
|
|
|
9672
9684
|
}
|
|
9673
9685
|
e.val === void 0 ? l.push(e.p) : Mc(c, n, e.val), s.push(e.p);
|
|
9674
9686
|
}
|
|
9675
|
-
|
|
9687
|
+
M(), N({
|
|
9676
9688
|
op: "restore",
|
|
9677
9689
|
detail: `#${t.id}(保护字段保留 ${s.length}${l.length ? `,未能回填 ${l.length}` : ""})`,
|
|
9678
9690
|
timestamp: Date.now()
|
|
@@ -9752,7 +9764,7 @@ function xf(e, n = {}) {
|
|
|
9752
9764
|
details: { expr: e }
|
|
9753
9765
|
});
|
|
9754
9766
|
}
|
|
9755
|
-
let r = n ?? 50, o = t.slice(0, r), c = o.map((e) => `{"path":${JSON.stringify(e.path)},"index":${e.index === void 0 ? "null" : e.index},"value":${$(gf(e.value, i === "",
|
|
9767
|
+
let r = n ?? 50, o = t.slice(0, r), c = o.map((e) => `{"path":${JSON.stringify(e.path)},"index":${e.index === void 0 ? "null" : e.index},"value":${$(gf(e.value, i === "", ae, ie, {
|
|
9756
9768
|
rootExempt: !1,
|
|
9757
9769
|
rootPath: String(e.path ?? ""),
|
|
9758
9770
|
fullTextPrefixes: s,
|
|
@@ -9855,7 +9867,7 @@ function xf(e, n = {}) {
|
|
|
9855
9867
|
details: { scriptLen: e.length }
|
|
9856
9868
|
});
|
|
9857
9869
|
if (u) {
|
|
9858
|
-
let e = await
|
|
9870
|
+
let e = await A();
|
|
9859
9871
|
try {
|
|
9860
9872
|
let n = await P("edit", O ? w(s) : void 0, void 0, e, s);
|
|
9861
9873
|
if (n !== null) return n;
|
|
@@ -9870,13 +9882,13 @@ function xf(e, n = {}) {
|
|
|
9870
9882
|
allowKeys: d,
|
|
9871
9883
|
snapshots: g,
|
|
9872
9884
|
maxSnapshots: _,
|
|
9873
|
-
markDataDirty:
|
|
9885
|
+
markDataDirty: M,
|
|
9874
9886
|
schemaErrorMode: "schema_invalid",
|
|
9875
9887
|
snapshotLabel: "eval_transform_subtree",
|
|
9876
9888
|
internalAfterWrite: a,
|
|
9877
9889
|
protectedCtx: h
|
|
9878
9890
|
});
|
|
9879
|
-
return r.ok ? (
|
|
9891
|
+
return r.ok ? (N({
|
|
9880
9892
|
op: "edit",
|
|
9881
9893
|
detail: `eval_transform_subtree @ ${u}`,
|
|
9882
9894
|
timestamp: Date.now()
|
|
@@ -9891,7 +9903,7 @@ function xf(e, n = {}) {
|
|
|
9891
9903
|
message: `主数据 bind 为原始类型(${c === null ? "null" : typeof c}),eval transform(patches) 无法就地替换`,
|
|
9892
9904
|
hint: "主数据 bind 必须为对象/数组;叶子值请用对象包裹或集成方通过 sdk.setData 替换 bind"
|
|
9893
9905
|
});
|
|
9894
|
-
let e = await
|
|
9906
|
+
let e = await A();
|
|
9895
9907
|
try {
|
|
9896
9908
|
let n = await P("edit", O ? w(s) : void 0, void 0, e, s);
|
|
9897
9909
|
if (n !== null) return n;
|
|
@@ -9902,13 +9914,13 @@ function xf(e, n = {}) {
|
|
|
9902
9914
|
allowKeys: d,
|
|
9903
9915
|
snapshots: g,
|
|
9904
9916
|
maxSnapshots: _,
|
|
9905
|
-
markDataDirty:
|
|
9917
|
+
markDataDirty: M,
|
|
9906
9918
|
schemaErrorMode: "schema_invalid",
|
|
9907
9919
|
snapshotLabel: "eval_transform",
|
|
9908
9920
|
internalAfterWrite: a,
|
|
9909
9921
|
protectedCtx: h
|
|
9910
9922
|
});
|
|
9911
|
-
return r.ok ? (
|
|
9923
|
+
return r.ok ? (N({
|
|
9912
9924
|
op: "edit",
|
|
9913
9925
|
detail: `eval_transform(${r.applied.length} patches)`,
|
|
9914
9926
|
timestamp: Date.now()
|
|
@@ -9932,7 +9944,7 @@ function xf(e, n = {}) {
|
|
|
9932
9944
|
message: `主数据 bind 为原始类型(${c === null ? "null" : typeof c}),eval transform 无法就地替换外部持有的值引用`,
|
|
9933
9945
|
hint: "主数据 bind 必须为对象/数组;叶子值请用对象包裹或集成方通过 sdk.setData 替换 bind"
|
|
9934
9946
|
});
|
|
9935
|
-
let i = await
|
|
9947
|
+
let i = await A();
|
|
9936
9948
|
try {
|
|
9937
9949
|
let e = await P("set", O ? w(s) : void 0, n, i, s);
|
|
9938
9950
|
if (e !== null) return e;
|
|
@@ -9942,7 +9954,7 @@ function xf(e, n = {}) {
|
|
|
9942
9954
|
value: n,
|
|
9943
9955
|
bindRef: c
|
|
9944
9956
|
});
|
|
9945
|
-
return r.ok ? (
|
|
9957
|
+
return r.ok ? (se("edit", "eval_transform"), r.wholeParsed ? qc(c, r.assembly) : r.assembly !== null && typeof r.assembly == "object" && jc(c, r.assembly), M(), a && (a(c, t), M()), N({
|
|
9946
9958
|
op: "edit",
|
|
9947
9959
|
detail: "eval_transform",
|
|
9948
9960
|
timestamp: Date.now()
|
|
@@ -9990,7 +10002,7 @@ function xf(e, n = {}) {
|
|
|
9990
10002
|
resolved: s,
|
|
9991
10003
|
resourcesByPath: h.resourcesByPath,
|
|
9992
10004
|
resourceStore: h.resourceStore
|
|
9993
|
-
})), n && n.length && (s = Lc(s, n)), r != null && (s = Rc(s, r)), s = gf(s, c === "",
|
|
10005
|
+
})), n && n.length && (s = Lc(s, n)), r != null && (s = Rc(s, r)), s = gf(s, c === "", ae, ie, {
|
|
9994
10006
|
rootExempt: !0,
|
|
9995
10007
|
rootPath: i,
|
|
9996
10008
|
fullTextPrefixes: f,
|
|
@@ -10038,7 +10050,7 @@ function xf(e, n = {}) {
|
|
|
10038
10050
|
resolved: S,
|
|
10039
10051
|
resourcesByPath: h.resourcesByPath,
|
|
10040
10052
|
resourceStore: h.resourceStore
|
|
10041
|
-
})), T(g(), c), n && n.length && (S = Lc(S, n)), r != null && (S = Rc(S, r)), S = gf(S, c === "",
|
|
10053
|
+
})), T(g(), c), n && n.length && (S = Lc(S, n)), r != null && (S = Rc(S, r)), S = gf(S, c === "", ae, ie, {
|
|
10042
10054
|
rootExempt: !0,
|
|
10043
10055
|
rootPath: _,
|
|
10044
10056
|
fullTextPrefixes: f,
|
|
@@ -10064,7 +10076,7 @@ function xf(e, n = {}) {
|
|
|
10064
10076
|
}), R = s(async ({ value: e, patch: t, patches: n, del: i, dryRun: s }, u) => {
|
|
10065
10077
|
let f = b(u), p = "set";
|
|
10066
10078
|
i ? p = "delete" : (n && n.length || t) && (p = "edit");
|
|
10067
|
-
let m = t?.value === void 0 ? e : t.value, v = await
|
|
10079
|
+
let m = t?.value === void 0 ? e : t.value, v = await A();
|
|
10068
10080
|
try {
|
|
10069
10081
|
let e = O ? w(f) : void 0;
|
|
10070
10082
|
if (s && e !== void 0) {
|
|
@@ -10105,13 +10117,13 @@ function xf(e, n = {}) {
|
|
|
10105
10117
|
let e = Pc(l());
|
|
10106
10118
|
return Nc(e, t.jsonPath) ? `dryRun(delete): 将删除 @ ${t.jsonPath}。预览剩余:${$(e, 600)}。未实际写入、未入快照。` : `dryRun(delete): @ ${t.jsonPath} 不存在(无需删除)。未实际写入。`;
|
|
10107
10119
|
}
|
|
10108
|
-
|
|
10120
|
+
se("delete");
|
|
10109
10121
|
let r = Nc(c, t.jsonPath);
|
|
10110
|
-
return
|
|
10122
|
+
return M(), N({
|
|
10111
10123
|
op: "delete",
|
|
10112
10124
|
detail: t.jsonPath,
|
|
10113
10125
|
timestamp: Date.now()
|
|
10114
|
-
}), a && (a(c, null),
|
|
10126
|
+
}), a && (a(c, null), M()), T(k(), f), r ? `已删除主数据 @ ${t.jsonPath}` : `主数据 @ ${t.jsonPath} 不存在(无需删除)`;
|
|
10115
10127
|
}
|
|
10116
10128
|
if (p === "edit") {
|
|
10117
10129
|
if (typeof c != "object" || !c) return Z({
|
|
@@ -10132,7 +10144,7 @@ function xf(e, n = {}) {
|
|
|
10132
10144
|
allowKeys: d,
|
|
10133
10145
|
snapshots: g,
|
|
10134
10146
|
maxSnapshots: _,
|
|
10135
|
-
markDataDirty:
|
|
10147
|
+
markDataDirty: M,
|
|
10136
10148
|
schemaErrorMode: "zod",
|
|
10137
10149
|
dryRun: s,
|
|
10138
10150
|
internalAfterWrite: a,
|
|
@@ -10140,13 +10152,13 @@ function xf(e, n = {}) {
|
|
|
10140
10152
|
});
|
|
10141
10153
|
if (!l.ok) return l.error;
|
|
10142
10154
|
if (s) return `dryRun(edit): ${l.applied.length} 个 patch 预检通过(schema 校验 OK)。预览结果:${$(l.clone, 600)}。未实际写入、未入快照。`;
|
|
10143
|
-
|
|
10155
|
+
N({
|
|
10144
10156
|
op: "edit",
|
|
10145
10157
|
detail: `${l.applied.length} 个 patch${l.applied.length > 1 ? "(批量)" : ""}`,
|
|
10146
10158
|
value: l.applied.map((e) => `${e.op}@${e.jp}`),
|
|
10147
10159
|
timestamp: Date.now()
|
|
10148
10160
|
});
|
|
10149
|
-
let u =
|
|
10161
|
+
let u = re(f);
|
|
10150
10162
|
return bf(l.clone), `已 write(edit) 主数据(${l.applied.length} 个 patch)。当前值:${$(l.clone, 600)} (新 hash=${u})`;
|
|
10151
10163
|
}
|
|
10152
10164
|
let i = Ic(m);
|
|
@@ -10160,9 +10172,9 @@ function xf(e, n = {}) {
|
|
|
10160
10172
|
allowKeys: d,
|
|
10161
10173
|
snapshots: g,
|
|
10162
10174
|
maxSnapshots: _,
|
|
10163
|
-
audit:
|
|
10175
|
+
audit: N,
|
|
10164
10176
|
dryRun: s,
|
|
10165
|
-
onWrite:
|
|
10177
|
+
onWrite: M,
|
|
10166
10178
|
internalAfterWrite: a,
|
|
10167
10179
|
protectedCtx: h,
|
|
10168
10180
|
hashFn: k
|
|
@@ -10292,7 +10304,7 @@ function xf(e, n = {}) {
|
|
|
10292
10304
|
}
|
|
10293
10305
|
});
|
|
10294
10306
|
}
|
|
10295
|
-
let f = await
|
|
10307
|
+
let f = await A();
|
|
10296
10308
|
try {
|
|
10297
10309
|
let n = await P("set", O ? w(i) : void 0, u, f, i);
|
|
10298
10310
|
if (n !== null) return n;
|
|
@@ -10303,9 +10315,9 @@ function xf(e, n = {}) {
|
|
|
10303
10315
|
allowKeys: d,
|
|
10304
10316
|
snapshots: g,
|
|
10305
10317
|
maxSnapshots: _,
|
|
10306
|
-
audit:
|
|
10318
|
+
audit: N,
|
|
10307
10319
|
op: "draft_commit",
|
|
10308
|
-
onWrite:
|
|
10320
|
+
onWrite: M,
|
|
10309
10321
|
internalAfterWrite: a,
|
|
10310
10322
|
protectedCtx: h,
|
|
10311
10323
|
hashFn: k
|
|
@@ -10321,7 +10333,7 @@ function xf(e, n = {}) {
|
|
|
10321
10333
|
});
|
|
10322
10334
|
F(l), me.push(i, l);
|
|
10323
10335
|
}
|
|
10324
|
-
let
|
|
10336
|
+
let he = [];
|
|
10325
10337
|
if (e.resources?.length && p) {
|
|
10326
10338
|
let e = s(async ({ path: e, handle: t }) => {
|
|
10327
10339
|
let n = e;
|
|
@@ -10391,9 +10403,9 @@ function xf(e, n = {}) {
|
|
|
10391
10403
|
details: oi(n.error.issues)
|
|
10392
10404
|
});
|
|
10393
10405
|
}
|
|
10394
|
-
let l = await
|
|
10406
|
+
let l = await A();
|
|
10395
10407
|
try {
|
|
10396
|
-
p.update(i, t), Mc(c, i, t), T(k(), r),
|
|
10408
|
+
p.update(i, t), Mc(c, i, t), T(k(), r), M();
|
|
10397
10409
|
} finally {
|
|
10398
10410
|
l.release();
|
|
10399
10411
|
}
|
|
@@ -10438,9 +10450,9 @@ function xf(e, n = {}) {
|
|
|
10438
10450
|
handle: t.string().optional().describe("占位符句柄(与 path 二选一)")
|
|
10439
10451
|
})
|
|
10440
10452
|
});
|
|
10441
|
-
F(i),
|
|
10453
|
+
F(i), he.push(e, n, r, i);
|
|
10442
10454
|
}
|
|
10443
|
-
let
|
|
10455
|
+
let z = [
|
|
10444
10456
|
I,
|
|
10445
10457
|
ce,
|
|
10446
10458
|
le,
|
|
@@ -10451,9 +10463,9 @@ function xf(e, n = {}) {
|
|
|
10451
10463
|
fe,
|
|
10452
10464
|
pe,
|
|
10453
10465
|
...me,
|
|
10454
|
-
...
|
|
10466
|
+
...he
|
|
10455
10467
|
];
|
|
10456
|
-
function
|
|
10468
|
+
function B(e) {
|
|
10457
10469
|
let t = e, n = (e) => {
|
|
10458
10470
|
if (e === void 0) return "undefined";
|
|
10459
10471
|
let t = $(e, 200);
|
|
@@ -10547,23 +10559,23 @@ function xf(e, n = {}) {
|
|
|
10547
10559
|
}]
|
|
10548
10560
|
};
|
|
10549
10561
|
}
|
|
10550
|
-
Object.defineProperty(
|
|
10551
|
-
value:
|
|
10562
|
+
Object.defineProperty(z, "controller", {
|
|
10563
|
+
value: oe,
|
|
10552
10564
|
enumerable: !1,
|
|
10553
10565
|
configurable: !1,
|
|
10554
10566
|
writable: !1
|
|
10555
|
-
}), Object.defineProperty(
|
|
10556
|
-
value:
|
|
10567
|
+
}), Object.defineProperty(z, "previewWrite", {
|
|
10568
|
+
value: B,
|
|
10557
10569
|
enumerable: !1,
|
|
10558
10570
|
configurable: !1,
|
|
10559
10571
|
writable: !1
|
|
10560
10572
|
});
|
|
10561
|
-
for (let e of
|
|
10573
|
+
for (let e of z) Object.defineProperty(e, "__dataOpsScoped", {
|
|
10562
10574
|
value: !0,
|
|
10563
10575
|
enumerable: !1,
|
|
10564
10576
|
configurable: !1
|
|
10565
10577
|
});
|
|
10566
|
-
return
|
|
10578
|
+
return z;
|
|
10567
10579
|
}
|
|
10568
10580
|
//#endregion
|
|
10569
10581
|
//#region src/core/tools/htmlValidate.ts
|
|
@@ -15169,7 +15181,7 @@ function tv(e, t, n, r) {
|
|
|
15169
15181
|
}), i;
|
|
15170
15182
|
},
|
|
15171
15183
|
afterModel: (t) => {
|
|
15172
|
-
let n =
|
|
15184
|
+
let n = re(t.message);
|
|
15173
15185
|
n && (r.prompt_tokens = (r.prompt_tokens ?? 0) + (n.prompt_tokens ?? 0), r.completion_tokens = (r.completion_tokens ?? 0) + (n.completion_tokens ?? 0), r.total_tokens = (r.total_tokens ?? 0) + (n.total_tokens ?? 0), n.reasoning_tokens && (r.reasoning_tokens = (r.reasoning_tokens ?? 0) + n.reasoning_tokens), i++, e({
|
|
15174
15186
|
type: "usage",
|
|
15175
15187
|
round: i,
|
|
@@ -15233,9 +15245,9 @@ function rv(e, n, r) {
|
|
|
15233
15245
|
}
|
|
15234
15246
|
let y = Am(e, g.contextWindow), b = y.enableLLMSummary !== !1, x = (e.contextOptions && e.contextOptions.preserveLastToolResults) ?? km[e.contextPreset ?? "auto"], S = new Set(x), C = e.llm;
|
|
15235
15247
|
e.debug && !d && console.warn("[page-agent-sdk][summarization] 未构造 llmInvoke(apiKey 缺失?),摘要回退零成本索引摘要");
|
|
15236
|
-
let w = /* @__PURE__ */
|
|
15248
|
+
let w = /* @__PURE__ */ Nt([]), T = Dd(e.vfs?.initialFiles, {
|
|
15237
15249
|
persist: l ? { save: (e) => {
|
|
15238
|
-
|
|
15250
|
+
yn.persistSave({ vfs: e });
|
|
15239
15251
|
} } : void 0,
|
|
15240
15252
|
maxBytes: e.vfs?.maxBytes,
|
|
15241
15253
|
poolBytes: e.vfs?.poolBytes
|
|
@@ -15254,7 +15266,7 @@ function rv(e, n, r) {
|
|
|
15254
15266
|
type: "middleware",
|
|
15255
15267
|
data: { stage: "resume_notice" }
|
|
15256
15268
|
});
|
|
15257
|
-
}), ne = Nm(),
|
|
15269
|
+
}), ne = Nm(), A = e.approval?.timeoutMs, re = A !== void 0 && Number.isFinite(A) && A > 0 ? A : A !== void 0 && (!Number.isFinite(A) || A < 0) ? 0 : 3e4, ie = (e) => {
|
|
15258
15270
|
Y({
|
|
15259
15271
|
type: "error",
|
|
15260
15272
|
message: `确认请求(${e.toolName})${Math.round(e.waitedMs / 1e3)}s 无响应已自动拒绝 —— 当前路径无 UI 响应方;可传 approval.timeoutMs 调整(Infinity = 无限等)`,
|
|
@@ -15262,8 +15274,8 @@ function rv(e, n, r) {
|
|
|
15262
15274
|
code: "APPROVAL_AUTO_REJECTED",
|
|
15263
15275
|
context: e
|
|
15264
15276
|
});
|
|
15265
|
-
},
|
|
15266
|
-
ne.lastPlanConfirmation = e,
|
|
15277
|
+
}, ae = Au((e) => {
|
|
15278
|
+
ne.lastPlanConfirmation = e, yn.persistSave({ planConfirmation: e }), X.agent?.debugLogs?.value?.push({
|
|
15267
15279
|
timestamp: Date.now(),
|
|
15268
15280
|
type: "middleware",
|
|
15269
15281
|
data: {
|
|
@@ -15273,24 +15285,24 @@ function rv(e, n, r) {
|
|
|
15273
15285
|
}
|
|
15274
15286
|
});
|
|
15275
15287
|
}, {
|
|
15276
|
-
timeoutMs:
|
|
15277
|
-
onAutoReject:
|
|
15278
|
-
}),
|
|
15288
|
+
timeoutMs: re,
|
|
15289
|
+
onAutoReject: ie
|
|
15290
|
+
}), j = rl({
|
|
15279
15291
|
getSchema: () => W()?.schema,
|
|
15280
15292
|
getBind: () => W()?.bind,
|
|
15281
15293
|
onChange: (e) => Y({
|
|
15282
15294
|
type: "focus_change",
|
|
15283
15295
|
focuses: e
|
|
15284
15296
|
})
|
|
15285
|
-
}),
|
|
15297
|
+
}), M = (e) => {
|
|
15286
15298
|
let t = tl(W()?.bind, e.path);
|
|
15287
15299
|
return t ? {
|
|
15288
15300
|
...e,
|
|
15289
15301
|
pgId: t
|
|
15290
15302
|
} : e;
|
|
15291
|
-
},
|
|
15292
|
-
typeof e.memory == "function" &&
|
|
15293
|
-
let
|
|
15303
|
+
}, oe = vu(), N = yu(e.memory || "");
|
|
15304
|
+
typeof e.memory == "function" && N.refresh();
|
|
15305
|
+
let se = { current: null }, P = e.data ? {
|
|
15294
15306
|
...e.data,
|
|
15295
15307
|
description: e.data.description ?? "主数据对象"
|
|
15296
15308
|
} : void 0, F = !(e.subagents ?? []).some((e) => e._codeAsset) && Em(e.capabilities).subagent, I = e.subagents;
|
|
@@ -15301,27 +15313,27 @@ function rv(e, n, r) {
|
|
|
15301
15313
|
let t = ec(P?.schema, e._codeAsset.codeField);
|
|
15302
15314
|
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'])"), le.add(e));
|
|
15303
15315
|
}
|
|
15304
|
-
let L = le.size ? ce.filter((e) => !le.has(e)) : ce, ue = le.size ? (I ?? []).filter((e) => !le.has(e)) : I, de = L.length > 0, R = L.flatMap((e) => e._codeAsset.writablePaths), fe = L.flatMap((e) => e._codeAsset.writablePaths.map((t) => `${t}.${e._codeAsset.codeField}`)), pe = e.checkpoint, me = pe !== void 0 && pe !== !1,
|
|
15316
|
+
let L = le.size ? ce.filter((e) => !le.has(e)) : ce, ue = le.size ? (I ?? []).filter((e) => !le.has(e)) : I, de = L.length > 0, R = L.flatMap((e) => e._codeAsset.writablePaths), fe = L.flatMap((e) => e._codeAsset.writablePaths.map((t) => `${t}.${e._codeAsset.codeField}`)), pe = e.checkpoint, me = pe !== void 0 && pe !== !1, he = me ? Ru({
|
|
15305
15317
|
getData: () => W()?.bind,
|
|
15306
15318
|
consumeDataDirty: () => U?.consumeDataDirty?.() ?? !0,
|
|
15307
15319
|
slotPaths: P ? [""] : [],
|
|
15308
15320
|
vfsStore: T,
|
|
15309
15321
|
todosMw: D,
|
|
15310
|
-
getTodos: () =>
|
|
15322
|
+
getTodos: () => se.current?.getState?.()?.todos ?? [],
|
|
15311
15323
|
messages: w,
|
|
15312
15324
|
maxCheckpoints: pe && typeof pe == "object" ? pe.maxCheckpoints : void 0
|
|
15313
|
-
}) : null,
|
|
15325
|
+
}) : null, z = !pe || typeof pe != "object" || pe.auto !== !1, B = Em(e.capabilities), V = B.dataOps, ge = B.draftWrite, _e = B.automation, ve = B.domInspect && (g.vision === !0 || typeof e.images?.describe == "function"), ye = Cd({
|
|
15314
15326
|
...e,
|
|
15315
15327
|
locale: e.i18n?.locale,
|
|
15316
|
-
dataOps:
|
|
15317
|
-
domInspect:
|
|
15328
|
+
dataOps: V && !!P,
|
|
15329
|
+
domInspect: B.domInspect === !0,
|
|
15318
15330
|
screenshot: ve
|
|
15319
15331
|
});
|
|
15320
15332
|
if (de) {
|
|
15321
15333
|
let e = L.map((e) => e._codeAsset.orchestratorPrompt).filter(Boolean).join("\n\n");
|
|
15322
15334
|
e && (ye += "\n\n" + e);
|
|
15323
15335
|
} else P?.schema && $s(P.schema) && (ye += "\n\n" + _c.htmlDirectWriteFallback, console.warn("[page-agent-sdk] 检测到 schema 含 code 字段但未注册 html 子 agent:已自动注入「主 agent 自己写 HTML」编排(code 作普通字段直接 write,无 vfs 工作副本 / 无格式校验门禁)。如需代码资产机制(vfs + 格式校验 + 增量 commit + 主上下文 code 摘要),注册 createHtmlSubagent;若确为降级意图可忽略。"));
|
|
15324
|
-
let H =
|
|
15336
|
+
let H = V && P ? xf(P, {
|
|
15325
15337
|
onAudit: e.onAudit ?? (e.debug ? (e) => console.log("[page-agent-sdk][data audit]", e) : void 0),
|
|
15326
15338
|
maxSnapshots: e.maxSnapshots,
|
|
15327
15339
|
onConflict: o.set,
|
|
@@ -15330,7 +15342,7 @@ function rv(e, n, r) {
|
|
|
15330
15342
|
vfsStore: ge || P?.resources?.length ? T : void 0,
|
|
15331
15343
|
...R.length ? { pgIdPaths: R } : {},
|
|
15332
15344
|
...fe.length ? { largeTextPaths: fe } : {}
|
|
15333
|
-
}) : [], be =
|
|
15345
|
+
}) : [], be = V ? H : [], U = V && P ? H.controller ?? null : null, xe = V && P ? H.previewWrite : void 0, Se = V && P?.resources?.length && U?.getResourcesSnapshot ? V_({ getResourcesSnapshot: () => U?.getResourcesSnapshot?.() ?? [] }) : void 0, W = () => U?.get() ?? P, Ce = new Set(H.map((e) => e.name)), we = e.conflictWatchFields ?? [], Te = !we.includes("*") && we.length ? new Set(we) : void 0, G = U ? ep({
|
|
15334
15346
|
getBind: () => W()?.bind,
|
|
15335
15347
|
recomputeAll: () => U.recomputeAllBaselines?.(),
|
|
15336
15348
|
hasBaselines: () => U.hasBaselines?.() ?? !1,
|
|
@@ -15347,27 +15359,27 @@ function rv(e, n, r) {
|
|
|
15347
15359
|
}
|
|
15348
15360
|
}), Jt(n));
|
|
15349
15361
|
}
|
|
15350
|
-
}) : void 0,
|
|
15351
|
-
|
|
15352
|
-
let
|
|
15362
|
+
}) : void 0, K = /* @__PURE__ */ new Map();
|
|
15363
|
+
B.domInspect && !ve && console.warn("[page-agent-sdk][take_screenshot] domInspect 已开启但主模型不支持图片(vision=false)且未配 images.describe,截图工具未装载(视觉验证退回 get_dom/dom_info 结构推断;换多模态模型 / llm.vision:true / 配 images.describe 后重建 SDK 生效)");
|
|
15364
|
+
let Ee = [], De = (e) => {
|
|
15353
15365
|
if (e.type === "tool_result" && e.name === "take_screenshot") {
|
|
15354
|
-
let t =
|
|
15366
|
+
let t = Ee.find((e) => !e.eventConsumed);
|
|
15355
15367
|
if (t) return t.eventConsumed = !0, Object.assign(e, { image: {
|
|
15356
15368
|
dataUri: t.image.dataUri,
|
|
15357
15369
|
vfsRef: t.meta.vfsRef
|
|
15358
15370
|
} });
|
|
15359
15371
|
}
|
|
15360
15372
|
return e;
|
|
15361
|
-
},
|
|
15373
|
+
}, Oe = g.vision === !0 || typeof e.images?.describe == "function" ? pg({
|
|
15362
15374
|
getVision: () => g.vision === !0,
|
|
15363
15375
|
describe: e.images?.describe,
|
|
15364
15376
|
onShot: (e, t) => {
|
|
15365
|
-
|
|
15377
|
+
Ee.push({
|
|
15366
15378
|
image: e,
|
|
15367
15379
|
meta: t
|
|
15368
15380
|
});
|
|
15369
15381
|
}
|
|
15370
|
-
}) : void 0,
|
|
15382
|
+
}) : void 0, ke = ve ? dg({
|
|
15371
15383
|
render: e.screenshot?.renderer,
|
|
15372
15384
|
getActiveFocus: () => X.getFocus(),
|
|
15373
15385
|
focusSelector: e.screenshot?.focusSelector,
|
|
@@ -15385,24 +15397,24 @@ function rv(e, n, r) {
|
|
|
15385
15397
|
getVision: () => g.vision === !0,
|
|
15386
15398
|
describe: e.images?.describe,
|
|
15387
15399
|
onShot: (e, t) => {
|
|
15388
|
-
|
|
15400
|
+
Ee.push({
|
|
15389
15401
|
image: e,
|
|
15390
15402
|
meta: t
|
|
15391
15403
|
});
|
|
15392
15404
|
}
|
|
15393
|
-
}) : void 0,
|
|
15405
|
+
}) : void 0, Ae = !Ip(e.llm) && (e.llm.provider ?? "openai") === "anthropic" ? "anthropic" : "openai", je = ke || Oe ? {
|
|
15394
15406
|
name: "screenshotChannel",
|
|
15395
15407
|
wrapModelCall: async (e, t) => {
|
|
15396
|
-
if (
|
|
15397
|
-
let t =
|
|
15408
|
+
if (Ee.length) {
|
|
15409
|
+
let t = Ee.splice(0), n = yi(t.map((e, t) => e.meta.mode === "url" ? `[图片 ${t + 1}] 原图直投 ${e.image.url ?? ""}(view_image,全分辨率非渲染态)` : `[截图 ${t + 1}] ${e.meta.mode}${e.meta.selector ? ` selector="${e.meta.selector}"` : ""}${e.meta.vfsRef ? `(原图 vfs:${e.meta.vfsRef})` : ""}`).join("\n") + "\n(视觉内容如上,请结合图片回答/继续)", t.map((e) => ({
|
|
15398
15410
|
dataUri: e.image.dataUri,
|
|
15399
15411
|
url: e.image.url
|
|
15400
|
-
})),
|
|
15412
|
+
})), Ae);
|
|
15401
15413
|
n && e.messages.push(new i({ content: n }));
|
|
15402
15414
|
}
|
|
15403
15415
|
return t(e);
|
|
15404
15416
|
}
|
|
15405
|
-
} : null,
|
|
15417
|
+
} : null, Me = !1, Ne = B.domEdit ? Eg({
|
|
15406
15418
|
onEdit: (e) => {
|
|
15407
15419
|
X.agent?.debugLogs?.value?.push({
|
|
15408
15420
|
timestamp: Date.now(),
|
|
@@ -15413,19 +15425,19 @@ function rv(e, n, r) {
|
|
|
15413
15425
|
applied: e.applied,
|
|
15414
15426
|
dryRun: e.dryRun
|
|
15415
15427
|
}
|
|
15416
|
-
}), !e.dryRun && e.applied > 0 && (
|
|
15428
|
+
}), !e.dryRun && e.applied > 0 && (Me = !0);
|
|
15417
15429
|
},
|
|
15418
15430
|
onRestore: (e) => {
|
|
15419
|
-
e.restored > 0 && (
|
|
15431
|
+
e.restored > 0 && (Me = !0);
|
|
15420
15432
|
}
|
|
15421
|
-
}) : [],
|
|
15433
|
+
}) : [], Pe = [...N_(B, be, Ug, B.domInspect ? [
|
|
15422
15434
|
...n_,
|
|
15423
|
-
...
|
|
15424
|
-
...
|
|
15425
|
-
...
|
|
15426
|
-
] : [], T_), ...
|
|
15427
|
-
|
|
15428
|
-
let
|
|
15435
|
+
...Ne,
|
|
15436
|
+
...ke ? [ke] : [],
|
|
15437
|
+
...B.skills ? [] : [f_, p_]
|
|
15438
|
+
] : [], T_), ...Oe ? [Oe] : []];
|
|
15439
|
+
Oe && K.set("view_image", "builtin"), Pe.forEach((e) => K.set(e.name, "builtin"));
|
|
15440
|
+
let Fe = e.proposals ? Vg(e.proposals, {
|
|
15429
15441
|
emit: (e) => {
|
|
15430
15442
|
try {
|
|
15431
15443
|
Y(e);
|
|
@@ -15442,31 +15454,31 @@ function rv(e, n, r) {
|
|
|
15442
15454
|
}
|
|
15443
15455
|
});
|
|
15444
15456
|
}
|
|
15445
|
-
}) : null,
|
|
15446
|
-
|
|
15447
|
-
let
|
|
15448
|
-
|
|
15449
|
-
let
|
|
15450
|
-
|
|
15451
|
-
let
|
|
15452
|
-
let e =
|
|
15453
|
-
return e.length ?
|
|
15457
|
+
}) : null, Ie = [...e.tools || [], ...Fe?.tools ?? []];
|
|
15458
|
+
Ie.forEach((e) => K.set(e.name, "user"));
|
|
15459
|
+
let Le = O_(e.actions ?? {});
|
|
15460
|
+
Le.forEach((e) => K.set(e.name, "action"));
|
|
15461
|
+
let Re = Fe ? e.proposals?.readToolName || "read_content" : null, ze = Fe ? e.proposals?.toolName || "propose_content" : null, Be = /* @__PURE__ */ new Set([...Object.entries(e.actions ?? {}).filter(([, e]) => e?.readsHostState === !0).map(([e]) => e), ...Re ? [Re] : []]), Ve = /* @__PURE__ */ new Set([...Object.entries(e.actions ?? {}).filter(([, e]) => e?.deferredWrite === !0).map(([e]) => e), ...ze ? [ze] : []]), He = [], Ue = !1, We = e.humanConfirm !== !1 && (!e.approval || e.approval.humanConfirmTool !== !1), Ge = We ? ku() : null;
|
|
15462
|
+
Ge && K.set(Du, "builtin");
|
|
15463
|
+
let Ke = me && he ? [s(async () => {
|
|
15464
|
+
let e = he.list();
|
|
15465
|
+
return e.length ? he.restore() ? `已回退到最近一次正常状态(checkpoint #${e[e.length - 1].id})。对话历史、主数据、vfs、todos 已整体还原。请基于回退后的状态重新判断并继续。` : "回退失败:无可用 checkpoint。" : "无可用 checkpoint,无法回退。";
|
|
15454
15466
|
}, {
|
|
15455
15467
|
name: "restore_last_checkpoint",
|
|
15456
15468
|
description: "回退到最近一次正常状态(整体还原对话历史 + 主数据 + vfs + todos)。当本轮操作出错、页面被改坏、或走偏时调用,回到本轮起点重新来过。不传参数即回退最近一次。",
|
|
15457
15469
|
schema: t.object({}).optional()
|
|
15458
15470
|
}), s(async () => {
|
|
15459
|
-
let e =
|
|
15471
|
+
let e = he.list();
|
|
15460
15472
|
return e.length ? "可用 checkpoint:\n" + e.map((e) => `#${e.id} [${e.label ?? "auto"}] 消息数=${e.messageCount} 时间=${new Date(e.timestamp).toLocaleTimeString()}`).join("\n") : "无可用 checkpoint。";
|
|
15461
15473
|
}, {
|
|
15462
15474
|
name: "list_checkpoints",
|
|
15463
15475
|
description: "列出可用会话 checkpoint(回退点)。",
|
|
15464
15476
|
schema: t.object({}).optional()
|
|
15465
15477
|
})] : [];
|
|
15466
|
-
|
|
15467
|
-
let
|
|
15478
|
+
Ke.forEach((e) => K.set(e.name, "builtin"));
|
|
15479
|
+
let qe = B.focus && V, Je = s(async ({ path: e, label: t }) => {
|
|
15468
15480
|
let n = W()?.schema;
|
|
15469
|
-
return n ? Bs(n, e) ? (
|
|
15481
|
+
return n ? Bs(n, e) ? (j.setFocus(M({
|
|
15470
15482
|
path: e,
|
|
15471
15483
|
...t ? { label: t } : {}
|
|
15472
15484
|
}), "agent"), `已聚焦到 ${e}${t ? `(${t})` : ""}。后续仅可写该子树(越界被拒),每轮只看到该组件结构。完成精修后调 clear_focus 退出。`) : `PATH_DENIED · 聚焦失败:path "${e}" 不在 schema 内。请先用 read 查看可操作路径再聚焦。` : "聚焦失败:当前无主数据 schema,无法聚焦。";
|
|
@@ -15477,19 +15489,19 @@ function rv(e, n, r) {
|
|
|
15477
15489
|
path: t.string().describe("要聚焦的组件 jsonPath,如 components.3"),
|
|
15478
15490
|
label: t.string().optional().describe("人类可读标签,如「导航栏」")
|
|
15479
15491
|
})
|
|
15480
|
-
}),
|
|
15492
|
+
}), Ye = s(async () => (j.clearFocus("agent"), "已清除聚焦,恢复全量可操作范围(可读写所有组件)。"), {
|
|
15481
15493
|
name: "clear_focus",
|
|
15482
15494
|
description: "清除当前聚焦,退出精修模式,恢复对全部组件的读写权限。",
|
|
15483
15495
|
schema: t.object({}).optional()
|
|
15484
|
-
}),
|
|
15496
|
+
}), Xe = s(async ({ path: e, label: t }) => {
|
|
15485
15497
|
let n = W()?.schema;
|
|
15486
15498
|
if (!n) return "聚焦失败:当前无主数据 schema,无法聚焦。";
|
|
15487
15499
|
if (!Bs(n, e)) return `PATH_DENIED · 聚焦失败:path "${e}" 不在 schema 内。请先用 read 查看可操作路径再聚焦。`;
|
|
15488
|
-
|
|
15500
|
+
j.addFocus(M({
|
|
15489
15501
|
path: e,
|
|
15490
15502
|
...t ? { label: t } : {}
|
|
15491
15503
|
}), "agent");
|
|
15492
|
-
let r =
|
|
15504
|
+
let r = j.getFocuses();
|
|
15493
15505
|
return `已聚焦 ${e}${t ? `(${t})` : ""}(当前共 ${r.length} 个焦点:${r.map((e) => e.path).join(", ")})。后续仅可写这些子树之一(越界被拒)。`;
|
|
15494
15506
|
}, {
|
|
15495
15507
|
name: "add_focus",
|
|
@@ -15498,71 +15510,73 @@ function rv(e, n, r) {
|
|
|
15498
15510
|
path: t.string().describe("要追加聚焦的组件 jsonPath,如 components.3"),
|
|
15499
15511
|
label: t.string().optional().describe("人类可读标签")
|
|
15500
15512
|
})
|
|
15501
|
-
}),
|
|
15502
|
-
let t =
|
|
15503
|
-
|
|
15504
|
-
let n =
|
|
15513
|
+
}), Ze = s(async ({ path: e }) => {
|
|
15514
|
+
let t = j.getFocuses().length;
|
|
15515
|
+
j.removeFocus(e, "agent");
|
|
15516
|
+
let n = j.getFocuses();
|
|
15505
15517
|
return n.length === t ? `path "${e}" 不在当前焦点列表中(当前:${n.map((e) => e.path).join(", ") || "无"})。` : n.length ? `已移除焦点 ${e}(剩余 ${n.length} 个:${n.map((e) => e.path).join(", ")})。` : `已移除焦点 ${e},聚焦已清空,恢复全量操作范围。`;
|
|
15506
15518
|
}, {
|
|
15507
15519
|
name: "remove_focus",
|
|
15508
15520
|
description: "移除单个聚焦焦点(by path),保留其他焦点。移除最后一个等价退出精修。全部退出用 clear_focus。",
|
|
15509
15521
|
schema: t.object({ path: t.string().describe("要移除的焦点 jsonPath") })
|
|
15510
|
-
}),
|
|
15522
|
+
}), Qe = qe ? [
|
|
15523
|
+
Je,
|
|
15511
15524
|
Ye,
|
|
15512
15525
|
Xe,
|
|
15513
|
-
Ze
|
|
15514
|
-
Qe
|
|
15526
|
+
Ze
|
|
15515
15527
|
] : [];
|
|
15516
|
-
|
|
15517
|
-
let
|
|
15518
|
-
builtinTools: () =>
|
|
15519
|
-
userTools: () =>
|
|
15520
|
-
actionTools: () =>
|
|
15521
|
-
humanConfirmTool: () =>
|
|
15522
|
-
checkpointTools: () =>
|
|
15523
|
-
focusTools: () =>
|
|
15524
|
-
mcpTools: () =>
|
|
15525
|
-
loadedSkillTools: () =>
|
|
15526
|
-
}),
|
|
15527
|
-
if (
|
|
15528
|
-
if (
|
|
15529
|
-
let
|
|
15530
|
-
e.debug &&
|
|
15531
|
-
let
|
|
15532
|
-
|
|
15533
|
-
let
|
|
15528
|
+
Qe.forEach((e) => K.set(e.name, "builtin"));
|
|
15529
|
+
let $e = [], et = /* @__PURE__ */ new Map(), tt = Lm({
|
|
15530
|
+
builtinTools: () => Pe,
|
|
15531
|
+
userTools: () => Ie,
|
|
15532
|
+
actionTools: () => Le,
|
|
15533
|
+
humanConfirmTool: () => Ge,
|
|
15534
|
+
checkpointTools: () => Ke,
|
|
15535
|
+
focusTools: () => Qe,
|
|
15536
|
+
mcpTools: () => He,
|
|
15537
|
+
loadedSkillTools: () => $e
|
|
15538
|
+
}), q = tt(), nt = B.planning, rt = B.missionAnchor, it = B.workingMemory, at = B.skills, ot = B.vfs || de;
|
|
15539
|
+
if (ot) for (let e of Nd) K.set(e, "builtin");
|
|
15540
|
+
if (nt) for (let e of D.tools ?? []) K.set(e.name, "builtin");
|
|
15541
|
+
let st = B.summarization, ct = B.agentCompression && !!m;
|
|
15542
|
+
e.debug && B.agentCompression && !m && console.warn("[page-agent-sdk][agentCompression] agentCompression 开启但 summaryLlm 不可用(或缺 apiKey / 模型不支持工具),压缩决策不启用,回退静态压缩");
|
|
15543
|
+
let lt = B.memory, ut = B.subagent, dt = ut ? Wl() : void 0, ft = e.verify?.maxAttempts ?? 2, pt = !!(e.verify?.check || e.verify?.maxAttempts || e.verify?.adversarial), mt = e.capabilities?.verify === !1, ht = (B.verify || pt && !mt) && e.verify?.enabled !== !1 && ft > 0, gt = B.contextInspector;
|
|
15544
|
+
pt && !ht && e.verify?.enabled !== !1 && console.warn("[page-agent-sdk][verify] 检测到 verify 配置(check/maxAttempts/adversarial)但未装载(capabilities.verify:false 显式关闭 或 maxAttempts≤0)");
|
|
15545
|
+
let _t = e.subagent, vt = _t?.allowedTools ?? [], yt = e.permissions?.length ? Tu(e.permissions) : void 0, bt = e.approval?.preview === !0 && xe ? (e, t) => e === "write" ? xe(t) : null : void 0, xt = e.approval?.previewWrite || bt ? (t, n) => e.approval?.previewWrite?.(t, n) ?? bt?.(t, n) ?? null : void 0, St = /* @__PURE__ */ new Set(), Ct = e.approval && (e.approval.tools !== void 0 || e.approval.confirm || e.approval.remember === !0) ? Eu({
|
|
15534
15546
|
...e.approval,
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
|
|
15547
|
+
remember: e.approval.remember === !0,
|
|
15548
|
+
grants: St,
|
|
15549
|
+
timeoutMs: e.approval.timeoutMs ?? re,
|
|
15550
|
+
onAutoReject: ie,
|
|
15551
|
+
previewWrite: xt
|
|
15538
15552
|
}) : void 0, wt = [
|
|
15539
|
-
...
|
|
15553
|
+
...yt ? [yt] : [],
|
|
15540
15554
|
...Ct ? [Ct] : [],
|
|
15541
15555
|
...G ? [G] : []
|
|
15542
|
-
], Tt = !
|
|
15543
|
-
llm:
|
|
15544
|
-
allTools: () => X.agent?.allTools ??
|
|
15545
|
-
allowedTools:
|
|
15556
|
+
], Tt = !ut || _t?.enabled === !1 ? void 0 : uu({
|
|
15557
|
+
llm: _t?.llm ?? e.llm,
|
|
15558
|
+
allTools: () => X.agent?.allTools ?? q,
|
|
15559
|
+
allowedTools: vt.length ? vt : void 0,
|
|
15546
15560
|
...e.staleReadInvalidation === void 0 ? {} : { staleReadInvalidation: e.staleReadInvalidation },
|
|
15547
|
-
systemPrompt:
|
|
15548
|
-
temperature:
|
|
15549
|
-
maxTokens:
|
|
15550
|
-
skills:
|
|
15551
|
-
maxDepth:
|
|
15552
|
-
maxParallel:
|
|
15553
|
-
thinkingMode:
|
|
15561
|
+
systemPrompt: _t?.systemPrompt,
|
|
15562
|
+
temperature: _t?.temperature,
|
|
15563
|
+
maxTokens: _t?.maxTokens,
|
|
15564
|
+
skills: _t?.skills,
|
|
15565
|
+
maxDepth: _t?.maxDepth,
|
|
15566
|
+
maxParallel: _t?.maxParallel,
|
|
15567
|
+
thinkingMode: _t?.thinkingMode,
|
|
15554
15568
|
debug: e.debug,
|
|
15555
|
-
getFocuses: () =>
|
|
15569
|
+
getFocuses: () => j.getActiveFocuses(),
|
|
15556
15570
|
getSchema: () => W()?.schema ?? null,
|
|
15557
|
-
tracker:
|
|
15571
|
+
tracker: dt,
|
|
15558
15572
|
guardMiddleware: wt.length ? wt : void 0,
|
|
15559
|
-
getVfsFiles:
|
|
15573
|
+
getVfsFiles: ot ? () => T.files : void 0,
|
|
15560
15574
|
enterDataScope: U?.enterScope ? (e) => U.enterScope(e) : void 0,
|
|
15561
15575
|
exitDataScope: U?.exitScope ? (e) => U.exitScope(e) : void 0,
|
|
15562
15576
|
onUsage: (e) => {
|
|
15563
15577
|
a.prompt_tokens = (a.prompt_tokens ?? 0) + (e.prompt_tokens ?? 0), a.completion_tokens = (a.completion_tokens ?? 0) + (e.completion_tokens ?? 0), a.total_tokens = (a.total_tokens ?? 0) + (e.total_tokens ?? 0), e.reasoning_tokens && (a.reasoning_tokens = (a.reasoning_tokens ?? 0) + e.reasoning_tokens);
|
|
15564
15578
|
},
|
|
15565
|
-
timeoutMs:
|
|
15579
|
+
timeoutMs: _t?.timeoutMs
|
|
15566
15580
|
}), Et = ue?.map((e) => {
|
|
15567
15581
|
if (!e._codeAsset) return e;
|
|
15568
15582
|
let t = e._codeAsset, n = zf({
|
|
@@ -15580,11 +15594,11 @@ function rv(e, n, r) {
|
|
|
15580
15594
|
...e,
|
|
15581
15595
|
middleware: r
|
|
15582
15596
|
};
|
|
15583
|
-
}), Dt = de &&
|
|
15597
|
+
}), Dt = de && ut ? Bf() : void 0, Ot = Dt ? qf({
|
|
15584
15598
|
getBind: () => W()?.bind,
|
|
15585
15599
|
writablePaths: R,
|
|
15586
15600
|
getLocked: () => Dt.locked(),
|
|
15587
|
-
tools:
|
|
15601
|
+
tools: q,
|
|
15588
15602
|
getCodeFieldPaths: () => Gf(W()?.bind, L.map((e) => ({
|
|
15589
15603
|
writablePaths: e._codeAsset.writablePaths,
|
|
15590
15604
|
codeField: e._codeAsset.codeField
|
|
@@ -15592,18 +15606,18 @@ function rv(e, n, r) {
|
|
|
15592
15606
|
}) : void 0, kt = U?.getSummarizedPaths && U.clearSummarizedPaths ? Xf({
|
|
15593
15607
|
getSummarizedPaths: () => U.getSummarizedPaths(),
|
|
15594
15608
|
clearSummarizedPaths: () => U.clearSummarizedPaths()
|
|
15595
|
-
}) : void 0, At =
|
|
15609
|
+
}) : void 0, At = ut && Et !== void 0 ? pu(Et, {
|
|
15596
15610
|
llm: e.llm,
|
|
15597
15611
|
thinkingModeDefault: e.subagent?.thinkingMode,
|
|
15598
15612
|
staleReadInvalidation: e.staleReadInvalidation,
|
|
15599
|
-
allTools: () => X.agent?.allTools ??
|
|
15613
|
+
allTools: () => X.agent?.allTools ?? q,
|
|
15600
15614
|
debug: e.debug,
|
|
15601
|
-
getFocuses: () =>
|
|
15615
|
+
getFocuses: () => j.getActiveFocuses(),
|
|
15602
15616
|
getSchema: () => W()?.schema ?? null,
|
|
15603
15617
|
getBind: () => W()?.bind,
|
|
15604
|
-
tracker:
|
|
15618
|
+
tracker: dt,
|
|
15605
15619
|
guardMiddleware: wt.length ? wt : void 0,
|
|
15606
|
-
getVfsFiles:
|
|
15620
|
+
getVfsFiles: ot ? () => T.files : void 0,
|
|
15607
15621
|
enterDataScope: U?.enterScope ? (e) => U.enterScope(e) : void 0,
|
|
15608
15622
|
exitDataScope: U?.exitScope ? (e) => U.exitScope(e) : void 0,
|
|
15609
15623
|
onUsage: (e) => {
|
|
@@ -15621,7 +15635,7 @@ function rv(e, n, r) {
|
|
|
15621
15635
|
...n ? { thinkingMode: n } : {},
|
|
15622
15636
|
thinkingApplied: r
|
|
15623
15637
|
};
|
|
15624
|
-
},
|
|
15638
|
+
}, Pt = ["read", "fetch_document"], Ft = q.filter((e) => Pt.includes(e.name)), It = ht ? Vu({
|
|
15625
15639
|
check: e.verify.check ?? qu({
|
|
15626
15640
|
schemas: () => W() ? { "": W().schema } : {},
|
|
15627
15641
|
root: () => W()?.bind
|
|
@@ -15630,37 +15644,37 @@ function rv(e, n, r) {
|
|
|
15630
15644
|
llm: e.llm,
|
|
15631
15645
|
tools: Ft
|
|
15632
15646
|
} : void 0
|
|
15633
|
-
}) : void 0, Lt =
|
|
15647
|
+
}) : void 0, Lt = gt ? sd({
|
|
15634
15648
|
contextWindow: g.contextWindow,
|
|
15635
15649
|
thresholdRatio: Am(e, g.contextWindow).summaryThresholdRatio
|
|
15636
15650
|
}) : void 0, Rt = R_({
|
|
15637
|
-
...
|
|
15638
|
-
humanConfirm:
|
|
15639
|
-
screenshot: !!
|
|
15640
|
-
domEdit:
|
|
15651
|
+
...B,
|
|
15652
|
+
humanConfirm: We,
|
|
15653
|
+
screenshot: !!ke,
|
|
15654
|
+
domEdit: B.domEdit,
|
|
15641
15655
|
hasActions: !!e.actions && Object.keys(e.actions).length > 0,
|
|
15642
15656
|
hasProposals: !!e.proposals,
|
|
15643
|
-
viewImage: !!
|
|
15657
|
+
viewImage: !!Oe,
|
|
15644
15658
|
subagents: ue?.map(Mt)
|
|
15645
|
-
},
|
|
15659
|
+
}, V && !!P, { promptSoftCap: zl(g.contextWindow, y.promptSoftCapTokens) }), zt = B.pageContext ? B_({
|
|
15646
15660
|
getPageInfo: () => typeof document < "u" && typeof location < "u" ? {
|
|
15647
15661
|
title: document.title || "",
|
|
15648
15662
|
url: location.href
|
|
15649
15663
|
} : null,
|
|
15650
|
-
canReadPage:
|
|
15651
|
-
}) : void 0,
|
|
15664
|
+
canReadPage: B.domInspect === !0
|
|
15665
|
+
}) : void 0, Bt = {
|
|
15652
15666
|
epoch: 0,
|
|
15653
15667
|
notices: [],
|
|
15654
15668
|
readsInvalidated: 0
|
|
15655
|
-
},
|
|
15669
|
+
}, J = 0, Vt = {
|
|
15656
15670
|
name: "hostNotice",
|
|
15657
15671
|
beforeAgent: () => {
|
|
15658
|
-
|
|
15672
|
+
J = Bt.epoch;
|
|
15659
15673
|
},
|
|
15660
15674
|
wrapModelCall: async (e, t) => {
|
|
15661
|
-
if (
|
|
15662
|
-
|
|
15663
|
-
let t = to(e.messages, "agent 已通过 dom_edit 修改页面,此前读取为改前状态",
|
|
15675
|
+
if (Me) {
|
|
15676
|
+
Me = !1;
|
|
15677
|
+
let t = to(e.messages, "agent 已通过 dom_edit 修改页面,此前读取为改前状态", Be);
|
|
15664
15678
|
if (t.invalidatedCount > 0) {
|
|
15665
15679
|
for (let n = 0; n < t.messages.length; n++) e.messages[n] = t.messages[n];
|
|
15666
15680
|
X.agent?.debugLogs?.value?.push({
|
|
@@ -15673,18 +15687,18 @@ function rv(e, n, r) {
|
|
|
15673
15687
|
});
|
|
15674
15688
|
}
|
|
15675
15689
|
}
|
|
15676
|
-
if (
|
|
15677
|
-
|
|
15678
|
-
let t =
|
|
15690
|
+
if (Bt.epoch > J) {
|
|
15691
|
+
J = Bt.epoch;
|
|
15692
|
+
let t = Bt.notices[Bt.notices.length - 1] ?? "", n = to(e.messages, t || void 0, Be);
|
|
15679
15693
|
if (n.invalidatedCount > 0) {
|
|
15680
15694
|
for (let t = 0; t < n.messages.length; t++) e.messages[t] = n.messages[t];
|
|
15681
|
-
|
|
15695
|
+
Bt.readsInvalidated += n.invalidatedCount, X.agent?.debugLogs?.value?.push({
|
|
15682
15696
|
timestamp: Date.now(),
|
|
15683
15697
|
type: "middleware",
|
|
15684
15698
|
data: {
|
|
15685
15699
|
stage: "host_read_invalidated",
|
|
15686
15700
|
count: n.invalidatedCount,
|
|
15687
|
-
epoch:
|
|
15701
|
+
epoch: Bt.epoch,
|
|
15688
15702
|
reason: t || void 0
|
|
15689
15703
|
}
|
|
15690
15704
|
});
|
|
@@ -15692,24 +15706,24 @@ function rv(e, n, r) {
|
|
|
15692
15706
|
}
|
|
15693
15707
|
return t(e);
|
|
15694
15708
|
},
|
|
15695
|
-
augmentPrompt: () =>
|
|
15709
|
+
augmentPrompt: () => Bt.notices.length ? [
|
|
15696
15710
|
"【宿主页面已变更】",
|
|
15697
|
-
...
|
|
15698
|
-
|
|
15711
|
+
...Bt.notices.filter(Boolean).map((e) => `· ${e}`),
|
|
15712
|
+
B.domInspect === !0 ? "此前的页面读取/截图结果已过期,回答任何关于当前页面的问题前必须重新 read_page / get_dom 读取当前页面;不要凭此前的读取结果或记忆作答。" : "页面内容可能已变化,断言页面前先核实当前状态;不要凭此前的印象作答。"
|
|
15699
15713
|
].join("\n") : void 0,
|
|
15700
15714
|
afterAgent: () => {
|
|
15701
|
-
|
|
15715
|
+
Bt.notices.length = 0;
|
|
15702
15716
|
}
|
|
15703
|
-
},
|
|
15717
|
+
}, Ht = Fe ? {
|
|
15704
15718
|
name: "proposalNotice",
|
|
15705
|
-
augmentPrompt: () =>
|
|
15719
|
+
augmentPrompt: () => Fe.state.notices.length ? ["【内容提案裁决结果】(以此为准,不要凭提案前状态作答)", ...Fe.state.notices].join("\n") : void 0,
|
|
15706
15720
|
afterAgent: () => {
|
|
15707
|
-
|
|
15721
|
+
Fe.state.notices.length = 0;
|
|
15708
15722
|
}
|
|
15709
|
-
} : null,
|
|
15723
|
+
} : null, Ut = P ? {
|
|
15710
15724
|
name: "dataHint",
|
|
15711
15725
|
augmentPrompt: () => Sd(W(), e.schemaHint) || void 0
|
|
15712
|
-
} : null,
|
|
15726
|
+
} : null, Wt = e.augmentSystem ? {
|
|
15713
15727
|
name: "augmentSystem",
|
|
15714
15728
|
augmentPrompt: (t) => {
|
|
15715
15729
|
try {
|
|
@@ -15722,89 +15736,89 @@ function rv(e, n, r) {
|
|
|
15722
15736
|
return;
|
|
15723
15737
|
}
|
|
15724
15738
|
}
|
|
15725
|
-
} : null,
|
|
15739
|
+
} : null, Kt = Dm(e.onEvent), Y = Kt.emit, qt, Yt = [], Xt = (e) => ({
|
|
15726
15740
|
name: e.name,
|
|
15727
15741
|
description: e.description,
|
|
15728
15742
|
content: typeof e.getContent == "function" ? e.getContent() : ""
|
|
15729
|
-
}),
|
|
15743
|
+
}), Zt = (e) => ({
|
|
15730
15744
|
name: e.name,
|
|
15731
15745
|
description: e.description,
|
|
15732
15746
|
getContent: () => e.content
|
|
15733
|
-
}),
|
|
15747
|
+
}), Qt = e.skillStorage === !1 ? null : K_({
|
|
15734
15748
|
...typeof e.skillStorage == "object" ? e.skillStorage : {},
|
|
15735
15749
|
id: e.skillStorage && typeof e.skillStorage == "object" && e.skillStorage.id ? e.skillStorage.id : `agent::${n}`
|
|
15736
|
-
}),
|
|
15737
|
-
let t =
|
|
15750
|
+
}), $t = () => {
|
|
15751
|
+
let t = qt ? qt.controller : null;
|
|
15738
15752
|
if (t) {
|
|
15739
|
-
let n = (e.skills || []).filter((e) => !
|
|
15740
|
-
t.set([...n, ...
|
|
15753
|
+
let n = (e.skills || []).filter((e) => !Yt.some((t) => t.name === e.name));
|
|
15754
|
+
t.set([...n, ...Yt]);
|
|
15741
15755
|
}
|
|
15742
15756
|
X.infoTick.value++;
|
|
15743
|
-
},
|
|
15744
|
-
if (
|
|
15745
|
-
let t = await
|
|
15757
|
+
}, en = async () => {
|
|
15758
|
+
if (Qt) try {
|
|
15759
|
+
let t = await Qt.list();
|
|
15746
15760
|
if (t.length) {
|
|
15747
|
-
|
|
15748
|
-
let n =
|
|
15761
|
+
Yt = t.map(Zt);
|
|
15762
|
+
let n = qt ? qt.controller : null;
|
|
15749
15763
|
if (n) {
|
|
15750
|
-
let t = (e.skills || []).filter((e) => !
|
|
15751
|
-
n.set([...t, ...
|
|
15764
|
+
let t = (e.skills || []).filter((e) => !Yt.some((t) => t.name === e.name));
|
|
15765
|
+
n.set([...t, ...Yt]);
|
|
15752
15766
|
}
|
|
15753
15767
|
X.infoTick.value++;
|
|
15754
15768
|
}
|
|
15755
15769
|
} catch {}
|
|
15756
|
-
},
|
|
15770
|
+
}, tn = st ? Ul({
|
|
15757
15771
|
...y,
|
|
15758
15772
|
llmInvoke: d,
|
|
15759
15773
|
getRegisteredData: () => W() ? [{ description: W().description ?? "主数据对象" }] : [],
|
|
15760
15774
|
preserveLastToolResults: x,
|
|
15761
|
-
...
|
|
15775
|
+
...ct ? {
|
|
15762
15776
|
decideInvoke: m,
|
|
15763
15777
|
getSnapshot: () => Lt?.getSnapshot()
|
|
15764
15778
|
} : {}
|
|
15765
|
-
}) : void 0,
|
|
15766
|
-
...
|
|
15767
|
-
withScreenshot: !!
|
|
15768
|
-
withDomEdit:
|
|
15769
|
-
withDataOps:
|
|
15779
|
+
}) : void 0, nn = at ? vl([
|
|
15780
|
+
...B.domInspect && !(e.skills || []).some((e) => e.name === "dom-inspect") ? [h_({
|
|
15781
|
+
withScreenshot: !!ke,
|
|
15782
|
+
withDomEdit: B.domEdit,
|
|
15783
|
+
withDataOps: V && !!P
|
|
15770
15784
|
})] : [],
|
|
15771
|
-
...
|
|
15772
|
-
withScreenshot: !!
|
|
15773
|
-
withDomEdit:
|
|
15774
|
-
withVfs:
|
|
15785
|
+
...B.domInspect && !(e.skills || []).some((e) => e.name === "page-analysis") ? [__({
|
|
15786
|
+
withScreenshot: !!ke,
|
|
15787
|
+
withDomEdit: B.domEdit,
|
|
15788
|
+
withVfs: ot
|
|
15775
15789
|
})] : [],
|
|
15776
15790
|
...e.skills || []
|
|
15777
15791
|
], {
|
|
15778
|
-
readVfs:
|
|
15792
|
+
readVfs: ot ? (e) => T.files[e]?.content : void 0,
|
|
15779
15793
|
onToolsReady: (e, t) => {
|
|
15780
15794
|
for (let n of t) {
|
|
15781
|
-
let t =
|
|
15782
|
-
t >= 0 &&
|
|
15795
|
+
let t = $e.findIndex((e) => e.name === n.name);
|
|
15796
|
+
t >= 0 && $e.splice(t, 1), $e.push(n), et.set(n.name, e), K.set(n.name, `skill:${e}`);
|
|
15783
15797
|
}
|
|
15784
|
-
|
|
15798
|
+
q = tt(), X.agent && X.agent.setTools(q), X.infoTick.value++;
|
|
15785
15799
|
}
|
|
15786
15800
|
}) : void 0;
|
|
15787
|
-
|
|
15788
|
-
let
|
|
15789
|
-
...
|
|
15801
|
+
qt = nn;
|
|
15802
|
+
let rn = Mm([
|
|
15803
|
+
...Ut ? [Ut] : [],
|
|
15790
15804
|
Rt,
|
|
15791
15805
|
...zt ? [zt] : [],
|
|
15792
|
-
|
|
15793
|
-
...
|
|
15794
|
-
...
|
|
15806
|
+
Vt,
|
|
15807
|
+
...Ht ? [Ht] : [],
|
|
15808
|
+
...rt ? [O] : [],
|
|
15795
15809
|
ee,
|
|
15796
15810
|
te,
|
|
15797
|
-
...
|
|
15811
|
+
...nt ? [D] : [],
|
|
15812
|
+
...nn ? [nn] : [],
|
|
15813
|
+
...ot ? [Fd(T)] : [],
|
|
15798
15814
|
...tn ? [tn] : [],
|
|
15799
|
-
...
|
|
15800
|
-
...
|
|
15801
|
-
...at ? [se] : [],
|
|
15802
|
-
...Je ? [A] : [],
|
|
15815
|
+
...it ? [oe] : [],
|
|
15816
|
+
...qe ? [j] : [],
|
|
15803
15817
|
...Se ? [Se] : [],
|
|
15804
|
-
...
|
|
15805
|
-
...
|
|
15806
|
-
...me &&
|
|
15807
|
-
...
|
|
15818
|
+
...lt ? [N] : [],
|
|
15819
|
+
...yt ? [yt] : [],
|
|
15820
|
+
...me && z && he ? [zu(he)] : [],
|
|
15821
|
+
...We ? [ae] : [],
|
|
15808
15822
|
...Ct ? [Ct] : [],
|
|
15809
15823
|
...G ? [G] : [],
|
|
15810
15824
|
...It ? [It] : [],
|
|
@@ -15812,50 +15826,50 @@ function rv(e, n, r) {
|
|
|
15812
15826
|
...At ? [At] : [],
|
|
15813
15827
|
...Ot ? [Ot] : [],
|
|
15814
15828
|
...kt ? [kt] : [],
|
|
15815
|
-
...U &&
|
|
15829
|
+
...U && ut ? [$f({
|
|
15816
15830
|
getBind: () => W()?.bind,
|
|
15817
|
-
getTools: () => X.agent?.allTools ??
|
|
15831
|
+
getTools: () => X.agent?.allTools ?? q
|
|
15818
15832
|
})] : [],
|
|
15819
|
-
...
|
|
15833
|
+
...Wt ? [Wt] : [],
|
|
15820
15834
|
...Lt ? [Lt] : [],
|
|
15821
|
-
...
|
|
15835
|
+
...je ? [je] : [],
|
|
15822
15836
|
...e.middleware || [],
|
|
15823
15837
|
..._e ? [E_(a, {
|
|
15824
15838
|
tokenBudget: e.tokenBudget,
|
|
15825
15839
|
timeBudgetMs: e.timeBudgetMs
|
|
15826
15840
|
}, Y)] : [],
|
|
15827
15841
|
tv(Y, w, W, a)
|
|
15828
|
-
]),
|
|
15829
|
-
function
|
|
15842
|
+
]), an = e.maxMemoryRounds ?? Z_;
|
|
15843
|
+
function on(e) {
|
|
15830
15844
|
return (e) => {
|
|
15831
|
-
e.type !== "approval_request" && Y(
|
|
15845
|
+
e.type !== "approval_request" && Y(De(e));
|
|
15832
15846
|
};
|
|
15833
15847
|
}
|
|
15834
|
-
let
|
|
15835
|
-
function
|
|
15848
|
+
let sn = /* @__PURE__ */ Gt([]), cn = X_(), ln = /* @__PURE__ */ new Set();
|
|
15849
|
+
function un(e) {
|
|
15836
15850
|
let t = new AbortController(), n = () => t.abort();
|
|
15837
|
-
return e && (e.aborted ? t.abort() : e.addEventListener("abort", n, { once: !0 })),
|
|
15851
|
+
return e && (e.aborted ? t.abort() : e.addEventListener("abort", n, { once: !0 })), ln.add(t), {
|
|
15838
15852
|
controller: t,
|
|
15839
15853
|
untrack: () => {
|
|
15840
|
-
|
|
15854
|
+
ln.delete(t), e?.removeEventListener("abort", n);
|
|
15841
15855
|
}
|
|
15842
15856
|
};
|
|
15843
15857
|
}
|
|
15844
|
-
function
|
|
15845
|
-
for (let e of
|
|
15846
|
-
|
|
15858
|
+
function dn() {
|
|
15859
|
+
for (let e of ln) e.abort();
|
|
15860
|
+
ln.clear();
|
|
15847
15861
|
}
|
|
15848
|
-
let
|
|
15862
|
+
let fn = /* @__PURE__ */ Gt(null), X = {
|
|
15849
15863
|
agentId: n,
|
|
15850
15864
|
store: l,
|
|
15851
15865
|
messages: w,
|
|
15852
15866
|
vfsStore: T,
|
|
15853
|
-
listeners:
|
|
15867
|
+
listeners: Kt.listeners,
|
|
15854
15868
|
todosMw: D,
|
|
15855
|
-
memoryMw:
|
|
15869
|
+
memoryMw: N,
|
|
15856
15870
|
missionMw: O,
|
|
15857
|
-
workingMemoryMw:
|
|
15858
|
-
focusMw:
|
|
15871
|
+
workingMemoryMw: oe,
|
|
15872
|
+
focusMw: j,
|
|
15859
15873
|
agent: null,
|
|
15860
15874
|
initDone: Promise.resolve(),
|
|
15861
15875
|
sessionId: "",
|
|
@@ -15863,57 +15877,57 @@ function rv(e, n, r) {
|
|
|
15863
15877
|
mcpClosers: [],
|
|
15864
15878
|
mcpServers: [],
|
|
15865
15879
|
mcpFailed: [],
|
|
15866
|
-
checkpoint:
|
|
15880
|
+
checkpoint: he,
|
|
15867
15881
|
dataOpsController: U,
|
|
15868
|
-
skillsController:
|
|
15882
|
+
skillsController: qt ? qt.controller : null,
|
|
15869
15883
|
infoTick: c,
|
|
15870
15884
|
pendingConflict: o.pendingConflict,
|
|
15871
|
-
pendingQuote:
|
|
15872
|
-
sessions:
|
|
15873
|
-
refreshSessions: () =>
|
|
15885
|
+
pendingQuote: fn,
|
|
15886
|
+
sessions: sn,
|
|
15887
|
+
refreshSessions: () => yn.refreshSessions(),
|
|
15874
15888
|
liveData: W,
|
|
15875
15889
|
usage: a,
|
|
15876
15890
|
emit: Y,
|
|
15877
|
-
runSerial:
|
|
15878
|
-
trackActive:
|
|
15879
|
-
abortAllActive:
|
|
15891
|
+
runSerial: cn,
|
|
15892
|
+
trackActive: un,
|
|
15893
|
+
abortAllActive: dn,
|
|
15880
15894
|
unloadSkillTools(e) {
|
|
15881
15895
|
if (e) {
|
|
15882
|
-
let t =
|
|
15883
|
-
if (
|
|
15896
|
+
let t = $e.length;
|
|
15897
|
+
if ($e = $e.filter((t) => et.get(t.name) === e ? (K.delete(t.name), et.delete(t.name), !1) : !0), $e.length === t) return;
|
|
15884
15898
|
} else {
|
|
15885
|
-
if (
|
|
15886
|
-
for (let e of
|
|
15887
|
-
|
|
15899
|
+
if (!$e.length) return;
|
|
15900
|
+
for (let e of $e) K.delete(e.name), et.delete(e.name);
|
|
15901
|
+
$e = [];
|
|
15888
15902
|
}
|
|
15889
|
-
|
|
15903
|
+
q = tt(), X.agent && X.agent.setTools(q);
|
|
15890
15904
|
},
|
|
15891
15905
|
applySnapshot(t) {
|
|
15892
|
-
if (t.vfs && T.hydrate && T.hydrate(t.vfs), t.messages?.length && (w.push(...Ci(t.messages, (e) => (e ? X.vfsStore?.files?.[e]?.content : void 0) || void 0)), te.markResumed()), t.todos?.length && D.reset(t.todos), t.memory && !e.memory &&
|
|
15906
|
+
if (t.vfs && T.hydrate && T.hydrate(t.vfs), t.messages?.length && (w.push(...Ci(t.messages, (e) => (e ? X.vfsStore?.files?.[e]?.content : void 0) || void 0)), te.markResumed()), t.todos?.length && D.reset(t.todos), t.memory && !e.memory && N.reset(t.memory), t.checkpoints?.length && he && he.importStack(t.checkpoints), t.usage && Object.assign(a, t.usage), t.mission && rt && O.setMission(t.mission), t.workingMemory && it && oe.restore(t.workingMemory), t.planConfirmation && (ne.lastPlanConfirmation = t.planConfirmation), qe) {
|
|
15893
15907
|
let n = t.focus, r = n ? Array.isArray(n) ? n : [n] : [];
|
|
15894
15908
|
if (r.length) {
|
|
15895
15909
|
let t = W()?.schema, n = t ? r.filter((e) => Bs(t, e.path)) : [];
|
|
15896
|
-
if (n.length && (
|
|
15910
|
+
if (n.length && (j.setFocus(null), n.forEach((e) => j.addFocus(M(e)))), e.debug && n.length < r.length) {
|
|
15897
15911
|
let e = r.filter((e) => !n.includes(e)).map((e) => e.path);
|
|
15898
15912
|
console.warn("[page-agent-sdk][focus] 恢复的焦点部分 path 已失效(schema 变化/无 schema),剔除:", e);
|
|
15899
15913
|
}
|
|
15900
15914
|
}
|
|
15901
15915
|
}
|
|
15902
|
-
|
|
15916
|
+
gn();
|
|
15903
15917
|
},
|
|
15904
15918
|
addSkill(e) {
|
|
15905
|
-
let t =
|
|
15906
|
-
t >= 0 ?
|
|
15919
|
+
let t = Yt.findIndex((t) => t.name === e.name);
|
|
15920
|
+
t >= 0 ? Yt[t] = e : Yt.push(e), $t(), Qt && Qt.put(Xt(e));
|
|
15907
15921
|
},
|
|
15908
15922
|
removeSkill(e) {
|
|
15909
|
-
let t =
|
|
15910
|
-
return t < 0 ? !1 : (
|
|
15923
|
+
let t = Yt.findIndex((t) => t.name === e);
|
|
15924
|
+
return t < 0 ? !1 : (Yt.splice(t, 1), $t(), Qt && Qt.remove(e), !0);
|
|
15911
15925
|
},
|
|
15912
15926
|
listUserSkills() {
|
|
15913
|
-
return
|
|
15927
|
+
return Yt.map((e) => e.name);
|
|
15914
15928
|
},
|
|
15915
15929
|
getUserSkill(e) {
|
|
15916
|
-
let t =
|
|
15930
|
+
let t = Yt.find((t) => t.name === e);
|
|
15917
15931
|
if (t) return {
|
|
15918
15932
|
name: t.name,
|
|
15919
15933
|
description: t.description,
|
|
@@ -15921,7 +15935,7 @@ function rv(e, n, r) {
|
|
|
15921
15935
|
};
|
|
15922
15936
|
},
|
|
15923
15937
|
afterRound() {
|
|
15924
|
-
|
|
15938
|
+
_n(), yn.persistRuntime();
|
|
15925
15939
|
},
|
|
15926
15940
|
clearCodeReuse() {
|
|
15927
15941
|
let e = T;
|
|
@@ -15929,10 +15943,10 @@ function rv(e, n, r) {
|
|
|
15929
15943
|
},
|
|
15930
15944
|
async send(e, t) {
|
|
15931
15945
|
if (await X.initDone, X.refCount <= 0) throw Error("page-agent-sdk: agent 已释放(unmount),拒绝排队中的 send");
|
|
15932
|
-
t ??= {}, t?.mission &&
|
|
15946
|
+
t ??= {}, t?.mission && rt && O.setMission(t.mission);
|
|
15933
15947
|
let n = e, r = (t.images ?? []).filter((e) => e && (e.dataUri || e.vfsRef || e.url));
|
|
15934
15948
|
if (r.length > 4) throw Error(`[page-agent-sdk] 单轮最多 4 张图片(收到 ${r.length})`);
|
|
15935
|
-
if (r.length && (await
|
|
15949
|
+
if (r.length && (await vn.stowImages(r), await vn.describeIfNeeded(r, n)), r.length && !g.vision && !r.every((e) => e.description)) {
|
|
15936
15950
|
let e = "当前主模型不支持图片输入(modelCaps.vision=false)。请换多模态模型(gpt-4o/claude/qwen-vl)或 LLMConfig 声明 vision:true;或配置 images.describe 绑定识图转述(集成方识图子 agent / 自有 vision API)";
|
|
15937
15951
|
throw Y({
|
|
15938
15952
|
type: "error",
|
|
@@ -15942,7 +15956,7 @@ function rv(e, n, r) {
|
|
|
15942
15956
|
}), Error(`[page-agent-sdk] ${e}`);
|
|
15943
15957
|
}
|
|
15944
15958
|
T?.setProtectedRefs?.(J_(w));
|
|
15945
|
-
let i = _e ? t.maxAutoRetries ?? 1 : 0, a = 0, s = !1, c =
|
|
15959
|
+
let i = _e ? t.maxAutoRetries ?? 1 : 0, a = 0, s = !1, c = on(t.signal);
|
|
15946
15960
|
if (t.signal) {
|
|
15947
15961
|
let e = () => o.resolve("keep_external");
|
|
15948
15962
|
t.signal.aborted ? e() : t.signal.addEventListener("abort", e, { once: !0 });
|
|
@@ -15959,14 +15973,14 @@ function rv(e, n, r) {
|
|
|
15959
15973
|
...n ? { anchor: n } : {}
|
|
15960
15974
|
};
|
|
15961
15975
|
}
|
|
15962
|
-
let i = e ??
|
|
15976
|
+
let i = e ?? fn.value ?? void 0;
|
|
15963
15977
|
w.push({
|
|
15964
15978
|
role: "user",
|
|
15965
15979
|
content: n,
|
|
15966
15980
|
timestamp: Date.now(),
|
|
15967
15981
|
...r.length ? { images: r } : {},
|
|
15968
15982
|
...i ? { quote: i } : {}
|
|
15969
|
-
}), s = !0, !e &&
|
|
15983
|
+
}), s = !0, !e && fn.value && (fn.value = null);
|
|
15970
15984
|
}
|
|
15971
15985
|
try {
|
|
15972
15986
|
let e = await X.agent.invoke(w, t.signal, c);
|
|
@@ -16002,8 +16016,8 @@ function rv(e, n, r) {
|
|
|
16002
16016
|
...n,
|
|
16003
16017
|
code: "MODEL_UNAVAILABLE",
|
|
16004
16018
|
message: e instanceof Error ? e.message : n.message
|
|
16005
|
-
}), a < i &&
|
|
16006
|
-
a += 1,
|
|
16019
|
+
}), a < i && he?.canRestore()) {
|
|
16020
|
+
a += 1, he.restore(), s = !0, Y({
|
|
16007
16021
|
type: "error",
|
|
16008
16022
|
message: `致命错误自动恢复(${a}/${i}):${n.message},已回退 checkpoint 重试`,
|
|
16009
16023
|
severity: "observable",
|
|
@@ -16028,7 +16042,7 @@ function rv(e, n, r) {
|
|
|
16028
16042
|
async batch(e, t, n) {
|
|
16029
16043
|
if (await X.initDone, !e.length) return [];
|
|
16030
16044
|
if (X.refCount <= 0) throw Error("page-agent-sdk: agent 已释放(unmount),拒绝排队中的 batch");
|
|
16031
|
-
let r = [], i =
|
|
16045
|
+
let r = [], i = on(n);
|
|
16032
16046
|
if (T?.setProtectedRefs?.(J_(w)), n) {
|
|
16033
16047
|
let e = () => o.resolve("keep_external");
|
|
16034
16048
|
n.aborted ? e() : n.addEventListener("abort", e, { once: !0 });
|
|
@@ -16044,7 +16058,7 @@ function rv(e, n, r) {
|
|
|
16044
16058
|
break;
|
|
16045
16059
|
}
|
|
16046
16060
|
let o = e[a];
|
|
16047
|
-
|
|
16061
|
+
he && he.save(`batch:${a}`);
|
|
16048
16062
|
let s = w.length;
|
|
16049
16063
|
try {
|
|
16050
16064
|
w.push({
|
|
@@ -16120,14 +16134,16 @@ function rv(e, n, r) {
|
|
|
16120
16134
|
}
|
|
16121
16135
|
return r;
|
|
16122
16136
|
},
|
|
16123
|
-
switchSession: (e) =>
|
|
16124
|
-
exportSession: (e) =>
|
|
16125
|
-
importSession: (e) =>
|
|
16126
|
-
resetSession: () =>
|
|
16137
|
+
switchSession: (e) => (St.clear(), yn.switchSession(e)),
|
|
16138
|
+
exportSession: (e) => yn.exportSession(e),
|
|
16139
|
+
importSession: (e) => yn.importSession(e),
|
|
16140
|
+
resetSession: () => {
|
|
16141
|
+
St.clear(), yn.resetSession();
|
|
16142
|
+
},
|
|
16127
16143
|
stream: async (e, t, n) => {
|
|
16128
16144
|
if (!X.agent) throw Error("page-agent-sdk: agent 尚未初始化完成,请先 await mount()");
|
|
16129
16145
|
let r = [...e].reverse().find((e) => e.role === "user" && e.images?.length);
|
|
16130
|
-
if (r?.images?.length && (await
|
|
16146
|
+
if (r?.images?.length && (await vn.stowImages(r.images), await vn.describeIfNeeded(r.images, r.content), !g.vision && !r.images.every((e) => e.description))) {
|
|
16131
16147
|
let e = "当前主模型不支持图片输入(modelCaps.vision=false)。请换多模态模型(gpt-4o/claude/qwen-vl)或 LLMConfig 声明 vision:true;或配置 images.describe 绑定识图转述";
|
|
16132
16148
|
throw Y({
|
|
16133
16149
|
type: "error",
|
|
@@ -16138,36 +16154,36 @@ function rv(e, n, r) {
|
|
|
16138
16154
|
}
|
|
16139
16155
|
T?.setProtectedRefs?.(J_(e));
|
|
16140
16156
|
let i = (e) => {
|
|
16141
|
-
t?.(
|
|
16157
|
+
t?.(De(e)), Y(De(e)), e.type === "subagent" && (e.kind === "tool_call" || e.kind === "tool_result") && X.infoTick.value++;
|
|
16142
16158
|
};
|
|
16143
16159
|
if (n) {
|
|
16144
16160
|
let e = () => o.resolve("keep_external");
|
|
16145
16161
|
n.aborted ? e() : n.addEventListener("abort", e, { once: !0 });
|
|
16146
16162
|
}
|
|
16147
|
-
let { controller: a, untrack: s } =
|
|
16163
|
+
let { controller: a, untrack: s } = un(n);
|
|
16148
16164
|
return X.agent.stream(e, i, a.signal).finally(s);
|
|
16149
16165
|
},
|
|
16150
16166
|
release() {
|
|
16151
16167
|
if (X.refCount--, X.refCount <= 0) {
|
|
16152
|
-
|
|
16168
|
+
dn(), Ue = !0, l && (T.flush?.(), l.flush(), l.dispose()), Qt && Qt.dispose();
|
|
16153
16169
|
let e = X.mcpClosers.splice(0);
|
|
16154
16170
|
e.length && Promise.allSettled(e.map((e) => e())), Q_.delete(n);
|
|
16155
16171
|
}
|
|
16156
16172
|
},
|
|
16157
16173
|
resolveConflict: o.resolve,
|
|
16158
16174
|
setTools(e) {
|
|
16159
|
-
|
|
16160
|
-
|
|
16161
|
-
}),
|
|
16175
|
+
Ie.length = 0, e.forEach((e) => {
|
|
16176
|
+
Ie.push(e), K.set(e.name, "user");
|
|
16177
|
+
}), q = tt(), X.agent && X.agent.setTools(q), X.infoTick.value++;
|
|
16162
16178
|
},
|
|
16163
16179
|
addTool(e) {
|
|
16164
|
-
|
|
16165
|
-
for (let t =
|
|
16166
|
-
|
|
16180
|
+
q.some((t) => t.name === e.name) && console.warn(`[page-agent-sdk] 工具 "${e.name}" 已存在,新工具覆盖(后注册覆盖先注册)`);
|
|
16181
|
+
for (let t = Ie.length - 1; t >= 0; t--) Ie[t].name === e.name && Ie.splice(t, 1);
|
|
16182
|
+
Ie.push(e), K.set(e.name, "user"), q = tt(), X.agent && X.agent.setTools(q), X.infoTick.value++;
|
|
16167
16183
|
},
|
|
16168
16184
|
removeTool(e) {
|
|
16169
|
-
let t =
|
|
16170
|
-
return t < 0 ? !1 : (
|
|
16185
|
+
let t = Ie.findIndex((t) => t.name === e);
|
|
16186
|
+
return t < 0 ? !1 : (Ie.splice(t, 1), K.delete(e), q = tt(), X.agent && X.agent.setTools(q), X.infoTick.value++, !0);
|
|
16171
16187
|
},
|
|
16172
16188
|
setLlm(t) {
|
|
16173
16189
|
let n;
|
|
@@ -16185,13 +16201,13 @@ function rv(e, n, r) {
|
|
|
16185
16201
|
maxOutputTokens: e.maxOutputTokens ?? r?.maxOutputTokens,
|
|
16186
16202
|
vision: r?.vision ?? t.vision
|
|
16187
16203
|
}), g.contextWindow < 2e5) throw Error(`[page-agent-sdk][setLlm] 新模型上下文窗口 ${g.contextWindow} 小于最小支持 ${p}(需 ≥200K 窗口模型)`);
|
|
16188
|
-
X.agent && (X.agent.setLlm(n), X.agent.setModelCaps?.(g)),
|
|
16204
|
+
X.agent && (X.agent.setLlm(n), X.agent.setModelCaps?.(g)), tn?.setContextWindow?.(g.contextWindow), Lt?.setContextWindow?.(g.contextWindow), X.infoTick.value++, e.debug && console.log("[page-agent-sdk][setLlm] 重解析 modelCaps + 回灌:", g);
|
|
16189
16205
|
},
|
|
16190
16206
|
setMemory(e) {
|
|
16191
|
-
|
|
16207
|
+
N.reset(e), typeof e == "function" && N.refresh(), X.infoTick.value++;
|
|
16192
16208
|
},
|
|
16193
16209
|
refreshMemory() {
|
|
16194
|
-
return
|
|
16210
|
+
return N.refresh();
|
|
16195
16211
|
},
|
|
16196
16212
|
setSubagents(t) {
|
|
16197
16213
|
if (!jt) {
|
|
@@ -16213,10 +16229,10 @@ function rv(e, n, r) {
|
|
|
16213
16229
|
return n && X.infoTick.value++, n;
|
|
16214
16230
|
},
|
|
16215
16231
|
getActiveSubagents() {
|
|
16216
|
-
return
|
|
16232
|
+
return dt?.getActive() ?? [];
|
|
16217
16233
|
},
|
|
16218
16234
|
get subagentHistory() {
|
|
16219
|
-
return
|
|
16235
|
+
return dt?.getHistory() ?? [];
|
|
16220
16236
|
},
|
|
16221
16237
|
getInfo() {
|
|
16222
16238
|
return {
|
|
@@ -16224,13 +16240,13 @@ function rv(e, n, r) {
|
|
|
16224
16240
|
sessionId: X.sessionId,
|
|
16225
16241
|
model: Ip(C) ? C.model ?? C.modelName : C.model,
|
|
16226
16242
|
systemPrompt: X.agent?.getEffectiveSystemPrompt?.() ?? ye + Sd(W(), e.schemaHint),
|
|
16227
|
-
tools: (X.agent?.allTools ??
|
|
16243
|
+
tools: (X.agent?.allTools ?? q).map((e) => ({
|
|
16228
16244
|
name: e.name,
|
|
16229
16245
|
description: e.description,
|
|
16230
16246
|
schema: e.schema,
|
|
16231
|
-
source:
|
|
16247
|
+
source: K.get(e.name) || "user"
|
|
16232
16248
|
})),
|
|
16233
|
-
skills: (
|
|
16249
|
+
skills: (qt ? qt.controller.get() : e.skills ?? []).map((e) => ({
|
|
16234
16250
|
name: e.name,
|
|
16235
16251
|
description: e.description
|
|
16236
16252
|
})),
|
|
@@ -16244,16 +16260,20 @@ function rv(e, n, r) {
|
|
|
16244
16260
|
summaryThresholdRatio: y.summaryThresholdRatio ?? .5,
|
|
16245
16261
|
promptSoftCap: zl(g.contextWindow, y.promptSoftCapTokens)
|
|
16246
16262
|
},
|
|
16247
|
-
memory:
|
|
16263
|
+
memory: N.get(),
|
|
16248
16264
|
staleReadsInvalidated: X.agent?.getStaleReadsInvalidated?.() ?? 0,
|
|
16249
|
-
hostReadsInvalidated:
|
|
16250
|
-
...
|
|
16265
|
+
hostReadsInvalidated: Bt.readsInvalidated,
|
|
16266
|
+
...Fe ? { proposals: Fe.snapshot() } : {},
|
|
16251
16267
|
...r ? { hostWatch: { ...r } } : {},
|
|
16268
|
+
...e.approval ? { approvals: {
|
|
16269
|
+
remember: e.approval.remember === !0,
|
|
16270
|
+
grantedTools: [...St]
|
|
16271
|
+
} } : {},
|
|
16252
16272
|
llmRetries: X.agent?.getLlmRetries?.() ?? 0,
|
|
16253
16273
|
llmCallFailures: X.agent?.getLlmCallFailures?.() ?? 0,
|
|
16254
16274
|
gates: X.agent?.getGateStats?.(),
|
|
16255
16275
|
systemSegments: X.agent?.getLastSystemSegments?.() ?? [],
|
|
16256
|
-
middleware:
|
|
16276
|
+
middleware: rn.map((e) => e.name),
|
|
16257
16277
|
todos: (X.agent?.getState?.()?.todos ?? []).map((e) => ({
|
|
16258
16278
|
id: e.id,
|
|
16259
16279
|
content: e.content,
|
|
@@ -16264,11 +16284,11 @@ function rv(e, n, r) {
|
|
|
16264
16284
|
...e.evidence === void 0 ? {} : { evidence: e.evidence }
|
|
16265
16285
|
})),
|
|
16266
16286
|
planPhase: D.getPlanPhase(),
|
|
16267
|
-
mission:
|
|
16287
|
+
mission: rt ? O.getMission() : void 0,
|
|
16268
16288
|
planConfirmation: ne.lastPlanConfirmation,
|
|
16269
|
-
workingMemory:
|
|
16270
|
-
focus:
|
|
16271
|
-
focuses:
|
|
16289
|
+
workingMemory: it ? oe.getWorkingMemory() : void 0,
|
|
16290
|
+
focus: qe ? j.getFocus() : void 0,
|
|
16291
|
+
focuses: qe ? j.getFocuses() : [],
|
|
16272
16292
|
actions: k_(e.actions ?? {}),
|
|
16273
16293
|
subagent: {
|
|
16274
16294
|
enabled: !!Tt,
|
|
@@ -16277,14 +16297,14 @@ function rv(e, n, r) {
|
|
|
16277
16297
|
timeoutMs: e.subagent?.timeoutMs === void 0 ? 18e5 : e.subagent.timeoutMs > 0 ? e.subagent.timeoutMs : 0,
|
|
16278
16298
|
allowedTools: e.subagent?.allowedTools ?? [],
|
|
16279
16299
|
subagents: (jt?.get() ?? []).map(Mt),
|
|
16280
|
-
active:
|
|
16281
|
-
history:
|
|
16300
|
+
active: dt?.getActive() ?? [],
|
|
16301
|
+
history: dt?.getHistory() ?? [],
|
|
16282
16302
|
lockedComponents: Dt?.locked() ?? {}
|
|
16283
16303
|
},
|
|
16284
16304
|
verify: {
|
|
16285
16305
|
enabled: !!It,
|
|
16286
|
-
maxAttempts:
|
|
16287
|
-
adversarial:
|
|
16306
|
+
maxAttempts: ht ? ft : 0,
|
|
16307
|
+
adversarial: ht && !!e.verify?.adversarial
|
|
16288
16308
|
},
|
|
16289
16309
|
context: (() => {
|
|
16290
16310
|
let e = Lt?.getSnapshot();
|
|
@@ -16299,10 +16319,10 @@ function rv(e, n, r) {
|
|
|
16299
16319
|
...X.mcpFailed.length ? { failed: X.mcpFailed } : {}
|
|
16300
16320
|
},
|
|
16301
16321
|
lastCompression: X.agent?.getState?.()?.lastCompression,
|
|
16302
|
-
checkpoints:
|
|
16322
|
+
checkpoints: he ? {
|
|
16303
16323
|
enabled: !0,
|
|
16304
|
-
auto:
|
|
16305
|
-
list:
|
|
16324
|
+
auto: z,
|
|
16325
|
+
list: he.list()
|
|
16306
16326
|
} : void 0
|
|
16307
16327
|
};
|
|
16308
16328
|
},
|
|
@@ -16340,41 +16360,41 @@ function rv(e, n, r) {
|
|
|
16340
16360
|
}));
|
|
16341
16361
|
},
|
|
16342
16362
|
getMission() {
|
|
16343
|
-
return
|
|
16363
|
+
return rt ? O.getMission() : void 0;
|
|
16344
16364
|
},
|
|
16345
16365
|
setMission(t) {
|
|
16346
|
-
if (!
|
|
16366
|
+
if (!rt) {
|
|
16347
16367
|
e.debug && console.warn("[page-agent-sdk][mission] capabilities.missionAnchor 关闭,setMission 忽略");
|
|
16348
16368
|
return;
|
|
16349
16369
|
}
|
|
16350
16370
|
O.setMission(t), X.infoTick.value++;
|
|
16351
16371
|
},
|
|
16352
16372
|
getFocus() {
|
|
16353
|
-
return
|
|
16373
|
+
return qe ? j.getFocus() : void 0;
|
|
16354
16374
|
},
|
|
16355
16375
|
getFocuses() {
|
|
16356
|
-
return
|
|
16376
|
+
return qe ? j.getFocuses() : [];
|
|
16357
16377
|
},
|
|
16358
16378
|
setFocus(t) {
|
|
16359
|
-
let n = nv(t, "setFocus",
|
|
16360
|
-
return n.ok ? (
|
|
16379
|
+
let n = nv(t, "setFocus", qe, () => W()?.schema, e.debug);
|
|
16380
|
+
return n.ok ? (j.setFocus(M(t)), e.debug && j.isInvokeActive() && console.info("[page-agent-sdk][focus] 在途流程进行中,聚焦将在下一次输入生效(当前流程不受影响)"), X.infoTick.value++, { ok: !0 }) : n;
|
|
16361
16381
|
},
|
|
16362
16382
|
addFocus(t) {
|
|
16363
|
-
let n = nv(t, "addFocus",
|
|
16364
|
-
return n.ok ?
|
|
16383
|
+
let n = nv(t, "addFocus", qe, () => W()?.schema, e.debug);
|
|
16384
|
+
return n.ok ? j.getFocuses().length >= 8 ? (e.debug && console.warn("[page-agent-sdk][focus] addFocus 拒绝:焦点数已达上限 8(augmentPrompt 注入每焦点子树 schema,过多致 system prompt 超预算)"), {
|
|
16365
16385
|
ok: !1,
|
|
16366
16386
|
error: "焦点数上限 8(避免 system prompt 撑爆)"
|
|
16367
|
-
}) : (
|
|
16387
|
+
}) : (j.addFocus(M(t)), e.debug && j.isInvokeActive() && console.info("[page-agent-sdk][focus] 在途流程进行中,聚焦将在下一次输入生效(当前流程不受影响)"), X.infoTick.value++, { ok: !0 }) : n;
|
|
16368
16388
|
},
|
|
16369
16389
|
removeFocus(e) {
|
|
16370
|
-
|
|
16390
|
+
qe && (j.removeFocus(e), X.infoTick.value++);
|
|
16371
16391
|
},
|
|
16372
16392
|
clearFocus() {
|
|
16373
|
-
|
|
16393
|
+
qe && (j.clearFocus(), X.infoTick.value++);
|
|
16374
16394
|
},
|
|
16375
16395
|
setQuote(e, t, n) {
|
|
16376
16396
|
let r = Ni(e ?? ""), i = qi(n);
|
|
16377
|
-
|
|
16397
|
+
fn.value = r ? {
|
|
16378
16398
|
text: r,
|
|
16379
16399
|
...t ? { source: t } : {},
|
|
16380
16400
|
...i ? { anchor: i } : {}
|
|
@@ -16382,28 +16402,36 @@ function rv(e, n, r) {
|
|
|
16382
16402
|
},
|
|
16383
16403
|
notifyHostChange(e) {
|
|
16384
16404
|
let t = typeof e?.reason == "string" ? e.reason.trim().slice(0, 200) : "";
|
|
16385
|
-
|
|
16405
|
+
Bt.epoch += 1, t && !Bt.notices.includes(t) ? Bt.notices.push(t) : t || Bt.notices.push(""), Bt.notices.length > 5 && Bt.notices.splice(0, Bt.notices.length - 5), X.agent?.debugLogs?.value?.push({
|
|
16386
16406
|
timestamp: Date.now(),
|
|
16387
16407
|
type: "middleware",
|
|
16388
16408
|
data: {
|
|
16389
16409
|
stage: "host_change_notified",
|
|
16390
|
-
epoch:
|
|
16410
|
+
epoch: Bt.epoch,
|
|
16391
16411
|
reason: t || void 0
|
|
16392
16412
|
}
|
|
16393
16413
|
}), X.infoTick.value++;
|
|
16394
16414
|
},
|
|
16395
16415
|
clearQuote() {
|
|
16396
|
-
|
|
16416
|
+
fn.value = null;
|
|
16417
|
+
},
|
|
16418
|
+
revokeApprovalGrants() {
|
|
16419
|
+
let e = St.size > 0;
|
|
16420
|
+
St.clear(), e && (X.agent?.debugLogs?.value?.push({
|
|
16421
|
+
timestamp: Date.now(),
|
|
16422
|
+
type: "middleware",
|
|
16423
|
+
data: { stage: "approval_grants_revoked" }
|
|
16424
|
+
}), X.infoTick.value++);
|
|
16397
16425
|
},
|
|
16398
16426
|
resolveProposal(e, t, n) {
|
|
16399
|
-
let r =
|
|
16427
|
+
let r = Fe ? Fe.resolve(e, t, n) : !1;
|
|
16400
16428
|
return r && X.infoTick.value++, r;
|
|
16401
16429
|
},
|
|
16402
16430
|
getProposals() {
|
|
16403
|
-
return
|
|
16431
|
+
return Fe ? Fe.snapshot() : null;
|
|
16404
16432
|
}
|
|
16405
16433
|
};
|
|
16406
|
-
async function
|
|
16434
|
+
async function pn() {
|
|
16407
16435
|
if (!l) return;
|
|
16408
16436
|
let t = async (e) => {
|
|
16409
16437
|
try {
|
|
@@ -16457,12 +16485,12 @@ function rv(e, n, r) {
|
|
|
16457
16485
|
}), e.debug && console.log("[page-agent-sdk][restore] 恢复会话", X.sessionId, `${n.messages?.length ?? 0} msgs`)) : e.debug && console.log("[page-agent-sdk][restore] 会话 meta 存在但快照为空", X.sessionId);
|
|
16458
16486
|
} else X.sessionId = await l.createSession(n, a.title), e.debug && console.log("[page-agent-sdk][restore] 新建会话(无历史)", X.sessionId);
|
|
16459
16487
|
} else X.sessionId = await l.createSession(n, a.title);
|
|
16460
|
-
e.memory &&
|
|
16488
|
+
e.memory && yn.persistSave({ memory: N.get() || (typeof e.memory == "string" ? e.memory : "") }), yn.refreshSessions();
|
|
16461
16489
|
}
|
|
16462
|
-
async function
|
|
16463
|
-
await
|
|
16490
|
+
async function mn() {
|
|
16491
|
+
await en();
|
|
16464
16492
|
}
|
|
16465
|
-
function
|
|
16493
|
+
function hn(e) {
|
|
16466
16494
|
let t = {};
|
|
16467
16495
|
for (let n of J_(e)) {
|
|
16468
16496
|
let e = T.files[n];
|
|
@@ -16470,12 +16498,12 @@ function rv(e, n, r) {
|
|
|
16470
16498
|
}
|
|
16471
16499
|
return t;
|
|
16472
16500
|
}
|
|
16473
|
-
function
|
|
16501
|
+
function gn() {
|
|
16474
16502
|
let e = Y_(T.files, J_(w));
|
|
16475
16503
|
for (let t of e) delete T.files[t];
|
|
16476
16504
|
}
|
|
16477
|
-
function
|
|
16478
|
-
let e = Dl(w,
|
|
16505
|
+
function _n() {
|
|
16506
|
+
let e = Dl(w, an);
|
|
16479
16507
|
if (!e.trimmed) return;
|
|
16480
16508
|
let { older: t, summary: n } = e;
|
|
16481
16509
|
if (Y({
|
|
@@ -16486,60 +16514,60 @@ function rv(e, n, r) {
|
|
|
16486
16514
|
assistant: e.assistantMsgs.map((e) => e.content),
|
|
16487
16515
|
steps: e.assistantMsgs.flatMap((e) => e.steps ?? [])
|
|
16488
16516
|
})),
|
|
16489
|
-
vfsResults:
|
|
16517
|
+
vfsResults: hn(t.flatMap((e) => [e.userMsg, ...e.assistantMsgs])),
|
|
16490
16518
|
summary: n.content,
|
|
16491
16519
|
reason: "max_memory_rounds"
|
|
16492
|
-
}), w.splice(e.deleteFrom, e.deleteCount, n),
|
|
16520
|
+
}), w.splice(e.deleteFrom, e.deleteCount, n), gn(), b && d) {
|
|
16493
16521
|
let n = e.summary, { prevSeg: r } = e;
|
|
16494
16522
|
(async () => {
|
|
16495
16523
|
try {
|
|
16496
16524
|
let e = await d(Pl(t, S)), i = w.indexOf(n);
|
|
16497
16525
|
if (i < 0) return;
|
|
16498
|
-
w[i].content = El(t, r, e),
|
|
16526
|
+
w[i].content = El(t, r, e), yn.persistRuntime();
|
|
16499
16527
|
} catch {}
|
|
16500
16528
|
})();
|
|
16501
16529
|
}
|
|
16502
16530
|
}
|
|
16503
|
-
let
|
|
16531
|
+
let vn = ki({
|
|
16504
16532
|
getConfig: () => e.images,
|
|
16505
16533
|
getVision: () => g.vision === !0,
|
|
16506
16534
|
emit: Y,
|
|
16507
16535
|
getVfsStore: () => X.vfsStore,
|
|
16508
|
-
noteFailure: (e, t) =>
|
|
16509
|
-
}),
|
|
16536
|
+
noteFailure: (e, t) => yn.notePersistFailure(e, t)
|
|
16537
|
+
}), yn = Fm({
|
|
16510
16538
|
agentId: n,
|
|
16511
16539
|
options: e,
|
|
16512
16540
|
emit: Y,
|
|
16513
16541
|
getStore: () => l,
|
|
16514
16542
|
core: X,
|
|
16515
|
-
sessionsRef:
|
|
16543
|
+
sessionsRef: sn,
|
|
16516
16544
|
sessionVars: ne,
|
|
16517
16545
|
messages: w,
|
|
16518
16546
|
getUsage: () => a,
|
|
16519
16547
|
mw: {
|
|
16520
16548
|
todosMw: D,
|
|
16521
|
-
memoryMw:
|
|
16549
|
+
memoryMw: N,
|
|
16522
16550
|
missionMw: O,
|
|
16523
|
-
workingMemoryMw:
|
|
16524
|
-
focusMw:
|
|
16525
|
-
summarizationMw:
|
|
16551
|
+
workingMemoryMw: oe,
|
|
16552
|
+
focusMw: j,
|
|
16553
|
+
summarizationMw: tn,
|
|
16526
16554
|
resumeNoticeMw: te,
|
|
16527
|
-
useMission:
|
|
16528
|
-
useWorkingMemory:
|
|
16529
|
-
useFocus:
|
|
16555
|
+
useMission: rt,
|
|
16556
|
+
useWorkingMemory: it,
|
|
16557
|
+
useFocus: qe,
|
|
16530
16558
|
useAutomation: _e
|
|
16531
16559
|
},
|
|
16532
16560
|
vfsStore: T,
|
|
16533
|
-
checkpointMgr:
|
|
16561
|
+
checkpointMgr: he,
|
|
16534
16562
|
conflictResolve: (e) => o.resolve(e),
|
|
16535
|
-
abortAllActive:
|
|
16563
|
+
abortAllActive: dn,
|
|
16536
16564
|
titleLlmInvoke: f
|
|
16537
16565
|
});
|
|
16538
16566
|
return X.initDone = (async () => {
|
|
16539
|
-
await
|
|
16567
|
+
await pn(), await mn(), e.mcp?.length && pd({
|
|
16540
16568
|
servers: e.mcp,
|
|
16541
16569
|
emit: Y,
|
|
16542
|
-
isReleased: () =>
|
|
16570
|
+
isReleased: () => Ue,
|
|
16543
16571
|
core: {
|
|
16544
16572
|
mcpClosers: X.mcpClosers,
|
|
16545
16573
|
mcpServers: X.mcpServers,
|
|
@@ -16548,15 +16576,15 @@ function rv(e, n, r) {
|
|
|
16548
16576
|
},
|
|
16549
16577
|
reservedNames: () => {
|
|
16550
16578
|
let e = /* @__PURE__ */ new Set();
|
|
16551
|
-
for (let t of
|
|
16552
|
-
let n =
|
|
16579
|
+
for (let t of q) {
|
|
16580
|
+
let n = K.get(t.name);
|
|
16553
16581
|
n && !n.startsWith("mcp:") && e.add(t.name);
|
|
16554
16582
|
}
|
|
16555
16583
|
return e;
|
|
16556
16584
|
},
|
|
16557
|
-
pushTool: (e, t) => (
|
|
16585
|
+
pushTool: (e, t) => (K.set(e.name, `mcp:${t}`), He.push(e), !0),
|
|
16558
16586
|
rebind: () => {
|
|
16559
|
-
|
|
16587
|
+
q = tt(), X.agent && X.agent.setTools(q), X.infoTick.value++;
|
|
16560
16588
|
},
|
|
16561
16589
|
debug: e.debug
|
|
16562
16590
|
});
|
|
@@ -16564,13 +16592,13 @@ function rv(e, n, r) {
|
|
|
16564
16592
|
Rp(t, { emit: Y }), X.agent = Is({
|
|
16565
16593
|
llm: t,
|
|
16566
16594
|
systemPrompt: ye,
|
|
16567
|
-
tools:
|
|
16568
|
-
middleware:
|
|
16595
|
+
tools: q,
|
|
16596
|
+
middleware: rn,
|
|
16569
16597
|
maxToolRounds: e.maxToolRounds,
|
|
16570
|
-
hasSubagent:
|
|
16571
|
-
pageAssertionGate:
|
|
16572
|
-
pageReadTools:
|
|
16573
|
-
deferredWriteTools:
|
|
16598
|
+
hasSubagent: ut,
|
|
16599
|
+
pageAssertionGate: B.domInspect === !0,
|
|
16600
|
+
pageReadTools: Be.size ? Be : void 0,
|
|
16601
|
+
deferredWriteTools: Ve.size ? Ve : void 0,
|
|
16574
16602
|
maxRetries: e.maxRetries,
|
|
16575
16603
|
stallMs: e.streamStallMs ?? 9e4,
|
|
16576
16604
|
streamMaxMs: e.streamMaxDurationMs ?? 18e5,
|
|
@@ -16579,16 +16607,16 @@ function rv(e, n, r) {
|
|
|
16579
16607
|
contextWindow: g.contextWindow,
|
|
16580
16608
|
maxOutputTokens: g.maxOutputTokens,
|
|
16581
16609
|
vision: g.vision,
|
|
16582
|
-
imageContentFormat:
|
|
16583
|
-
maxVerifyAttempts:
|
|
16610
|
+
imageContentFormat: Ae,
|
|
16611
|
+
maxVerifyAttempts: ht ? ft : 0,
|
|
16584
16612
|
roundTokenBudget: e.roundTokenBudget ?? 0,
|
|
16585
16613
|
staleReadInvalidation: e.staleReadInvalidation,
|
|
16586
16614
|
onLlmChange: (e) => {
|
|
16587
16615
|
C = e;
|
|
16588
16616
|
},
|
|
16589
16617
|
debug: e.debug
|
|
16590
|
-
}),
|
|
16591
|
-
X.agent && X.agent.setTools(
|
|
16618
|
+
}), se.current = X.agent, At && At.setReconfigureHook(() => {
|
|
16619
|
+
X.agent && X.agent.setTools(tt());
|
|
16592
16620
|
});
|
|
16593
16621
|
})(), X;
|
|
16594
16622
|
}
|
|
@@ -16738,6 +16766,7 @@ function iv(e, t) {
|
|
|
16738
16766
|
setQuote: c.setQuote,
|
|
16739
16767
|
clearQuote: c.clearQuote,
|
|
16740
16768
|
notifyHostChange: c.notifyHostChange,
|
|
16769
|
+
revokeApprovalGrants: c.revokeApprovalGrants,
|
|
16741
16770
|
resolveProposal: c.resolveProposal,
|
|
16742
16771
|
get proposals() {
|
|
16743
16772
|
return c.getProposals();
|
|
@@ -17053,7 +17082,7 @@ async function hv(e) {
|
|
|
17053
17082
|
//#region src/core/composables/useChat.ts
|
|
17054
17083
|
var gv = 4e3;
|
|
17055
17084
|
function _v(e = {}) {
|
|
17056
|
-
let { fetchResponse: t, fetchStream: n, onPersist: r, onClear: i, onQueuedCleared: a, onBeforeRegenerate: o } = e, s = /* @__PURE__ */
|
|
17085
|
+
let { fetchResponse: t, fetchStream: n, onPersist: r, onClear: i, onQueuedCleared: a, onBeforeRegenerate: o } = e, s = /* @__PURE__ */ Nt({
|
|
17057
17086
|
messages: e.messages ?? [],
|
|
17058
17087
|
loading: !1,
|
|
17059
17088
|
error: null
|
|
@@ -17082,7 +17111,7 @@ function _v(e = {}) {
|
|
|
17082
17111
|
async function v(e) {
|
|
17083
17112
|
let r = ++d;
|
|
17084
17113
|
if (l.value = !0, n) {
|
|
17085
|
-
let t = /* @__PURE__ */
|
|
17114
|
+
let t = /* @__PURE__ */ Nt({
|
|
17086
17115
|
role: "assistant",
|
|
17087
17116
|
content: "",
|
|
17088
17117
|
timestamp: Date.now(),
|
|
@@ -17155,7 +17184,8 @@ function _v(e = {}) {
|
|
|
17155
17184
|
toolName: e.toolName,
|
|
17156
17185
|
args: e.args,
|
|
17157
17186
|
resolve: e.resolve,
|
|
17158
|
-
...e.preview ? { preview: e.preview } : {}
|
|
17187
|
+
...e.preview ? { preview: e.preview } : {},
|
|
17188
|
+
...e.remember ? { remember: !0 } : {}
|
|
17159
17189
|
};
|
|
17160
17190
|
break;
|
|
17161
17191
|
}
|
|
@@ -17380,6 +17410,8 @@ var bv = {
|
|
|
17380
17410
|
recommendPrefix: " 推荐:",
|
|
17381
17411
|
approve: "允许",
|
|
17382
17412
|
deny: "拒绝",
|
|
17413
|
+
approveRemember: "允许并不再询问",
|
|
17414
|
+
approveRememberHint: "允许本次,且本会话内不再询问此工具的调用(切换会话或重置后恢复询问)",
|
|
17383
17415
|
toolConfirmPrefix: "需确认工具调用:",
|
|
17384
17416
|
viewArgs: "查看参数",
|
|
17385
17417
|
collapseArgs: "收起参数",
|
|
@@ -17618,6 +17650,8 @@ var bv = {
|
|
|
17618
17650
|
recommendPrefix: " Recommend:",
|
|
17619
17651
|
approve: "Allow",
|
|
17620
17652
|
deny: "Deny",
|
|
17653
|
+
approveRemember: "Allow & don't ask again",
|
|
17654
|
+
approveRememberHint: "Allow now and skip confirmation for this tool until the session ends (switch/reset restores asking)",
|
|
17621
17655
|
toolConfirmPrefix: "Confirm tool call:",
|
|
17622
17656
|
viewArgs: "View args",
|
|
17623
17657
|
collapseArgs: "Collapse args",
|
|
@@ -17837,7 +17871,7 @@ function wv(e = {}) {
|
|
|
17837
17871
|
minute: "2-digit"
|
|
17838
17872
|
}), w = () => {
|
|
17839
17873
|
let e = T.value, t = ne.value;
|
|
17840
|
-
!o.value.trim() && !e.length || (r(o.value, P.value, e.length ? [...e] : void 0, t ?? void 0), o.value = "", T.value = [], t &&
|
|
17874
|
+
!o.value.trim() && !e.length || (r(o.value, P.value, e.length ? [...e] : void 0, t ?? void 0), o.value = "", T.value = [], t && re());
|
|
17841
17875
|
}, T = /* @__PURE__ */ Gt([]), E = /* @__PURE__ */ Gt(""), D = /* @__PURE__ */ Gt(!1), O, k = (e) => {
|
|
17842
17876
|
E.value = e, clearTimeout(O), O = setTimeout(() => {
|
|
17843
17877
|
E.value = "";
|
|
@@ -17863,24 +17897,24 @@ function wv(e = {}) {
|
|
|
17863
17897
|
}
|
|
17864
17898
|
}, te = (e) => {
|
|
17865
17899
|
T.value = T.value.filter((t) => t.id !== e);
|
|
17866
|
-
}, ne = ri(() => e.pendingQuote?.value ?? null),
|
|
17900
|
+
}, ne = ri(() => e.pendingQuote?.value ?? null), A = (t) => {
|
|
17867
17901
|
e.onSetQuote?.(t);
|
|
17868
|
-
},
|
|
17902
|
+
}, re = () => {
|
|
17869
17903
|
e.onClearQuote?.();
|
|
17870
|
-
},
|
|
17904
|
+
}, ie = (e) => {
|
|
17871
17905
|
e.isComposing || e.keyCode === 229 || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), w());
|
|
17872
|
-
},
|
|
17906
|
+
}, ae = (e) => {
|
|
17873
17907
|
o.value = a.value[e] || "", i(e);
|
|
17874
|
-
},
|
|
17875
|
-
e.role === "user" && (n.loading && t.stop(),
|
|
17876
|
-
},
|
|
17877
|
-
|
|
17878
|
-
},
|
|
17879
|
-
let r =
|
|
17880
|
-
if (
|
|
17908
|
+
}, j = /* @__PURE__ */ Gt(null), M = (e) => {
|
|
17909
|
+
e.role === "user" && (n.loading && t.stop(), j.value = e);
|
|
17910
|
+
}, oe = () => {
|
|
17911
|
+
j.value = null;
|
|
17912
|
+
}, N = (e) => {
|
|
17913
|
+
let r = j.value;
|
|
17914
|
+
if (j.value = null, !r) return;
|
|
17881
17915
|
let i = n.messages.indexOf(r);
|
|
17882
17916
|
i < 0 || t.editAndResend(i, e);
|
|
17883
|
-
},
|
|
17917
|
+
}, se = (e) => {
|
|
17884
17918
|
let t = n.messages, r = t[e];
|
|
17885
17919
|
if (!r || r.role !== "assistant") return !1;
|
|
17886
17920
|
let i = "reasoning" in r ? r.reasoning : void 0, a = "steps" in r ? r.steps : void 0;
|
|
@@ -17916,21 +17950,21 @@ function wv(e = {}) {
|
|
|
17916
17950
|
undo: S,
|
|
17917
17951
|
formatTime: C,
|
|
17918
17952
|
send: w,
|
|
17919
|
-
keydown:
|
|
17953
|
+
keydown: ie,
|
|
17920
17954
|
pendingImages: T,
|
|
17921
17955
|
addImageFiles: ee,
|
|
17922
17956
|
removePendingImage: te,
|
|
17923
17957
|
imageInputError: E,
|
|
17924
17958
|
compressingImages: D,
|
|
17925
17959
|
quote: ne,
|
|
17926
|
-
setQuote:
|
|
17927
|
-
clearQuote:
|
|
17928
|
-
editQueued:
|
|
17929
|
-
editingMessage:
|
|
17930
|
-
startEdit:
|
|
17931
|
-
cancelEdit:
|
|
17932
|
-
submitEdit:
|
|
17933
|
-
isPendingAssistant:
|
|
17960
|
+
setQuote: A,
|
|
17961
|
+
clearQuote: re,
|
|
17962
|
+
editQueued: ae,
|
|
17963
|
+
editingMessage: j,
|
|
17964
|
+
startEdit: M,
|
|
17965
|
+
cancelEdit: oe,
|
|
17966
|
+
submitEdit: N,
|
|
17967
|
+
isPendingAssistant: se,
|
|
17934
17968
|
focuses: P,
|
|
17935
17969
|
planConfirmation: F,
|
|
17936
17970
|
addFocus: I,
|
|
@@ -17954,4 +17988,4 @@ function Ev(e) {
|
|
|
17954
17988
|
return iv(e);
|
|
17955
17989
|
}
|
|
17956
17990
|
//#endregion
|
|
17957
|
-
export { Tm as CAPABILITIES, Om as CONTEXT_PRESETS, Np as CompressDecisionSchema, r_ as DEFAULT_COMPUTED_STYLES, Ll as DEFAULT_PROMPT_SOFT_CAP, md as DEFAULT_SYSTEM_PROMPT, hd as DEFAULT_SYSTEM_PROMPT_EN, Sf as HTML_VOID_TAGS, Du as HUMAN_CONFIRM_TOOL_NAME, hi as ImageInputError, g as LOW_CAPS_HINT_BASELINE, p as MIN_CONTEXT_WINDOW, ya as MODEL_UNAVAILABLE_GUIDANCE, Il as SOFT_CAP_MIN_WINDOW, Ol as STOP_WORDS, kc as UNSAFE_KEYS, k_ as actionsToInspectInfo, O_ as actionsToTools, di as agentError, od as analyzeContext, Hc as applyPatchToClone, Gc as applyPatchToLive, uf as applyPatchesToBind, Ig as applyProposalOps, Js as arrayMinLength, ui as asAgentError, pp as buildCollectorJs, c_ as buildCssPath, Sd as buildDataPrompt, ap as buildDiagnosticsReport, Cp as buildHtmlFragmentSkill, mp as buildSandboxSrcdoc, Cd as buildSystemPrompt, Yi as captureSelectionQuote, Cv as chatContextKey, lf as commitSetToBind, bp as composeStructureThenRender, Ei as compressImage, fd as connectMcp, k as constructLlmFromConfig, E as constructOpenLlmSync, hv as copyText, Fg as countOccurrences, Is as createAgent, Eu as createApprovalMiddleware, wv as createChatContext, Ev as createChatSdk, Ru as createCheckpointManager, zu as createCheckpointMiddleware, Jp as createConflictManager, sd as createContextInspectorMiddleware, Dp as createCraftNoteCheck, xf as createDataOps, mv as createEvalHarness, Tp as createHtmlFormatCheck, yp as createHtmlRenderCheck, kp as createHtmlSubagent, Au as createHumanConfirmMiddleware, ku as createHumanConfirmTool, dv as createIdleDetector, gm as createMemoryBackend, yu as createMemoryMiddleware, u as createProxyLlm, uv as createRagSubagent, Ta as createSandboxRunner, Dm as createSdkEvents, X_ as createSerialRunner, bm as createSessionStore, xm as createSessionStoreWithBackend, K_ as createSkillStore, uu as createSubagentMiddleware, Wl as createSubagentTracker, pu as createSubagentsMiddleware, R_ as createUsageHintsMiddleware, Vu as createVerifyMiddleware, Dd as createVfs, vm as createWebStorageBackend, qu as createWriteBackCheck, ba as decorateModelUnavailable, Pc as deepClone, M_ as defineDataToolset, il as defineSkill, Ap as defineTool, Nc as deleteByPath, Pp as deriveTitle, cc as describeSchemaNode, ys as detectGarbledToolCall, ko as detectTransitionalReply, Yc as diffObjects, pv as diffReport, p_ as domInfoTool, v_ as domInspectSkill, f_ as domSearchTool, qg as domToStructure, n_ as domTools, j_ as domToolsStatic, Ys as elementSchemaCandidates, o_ as ensureDomListenerRecorder, Al as estimateMessageTokens, Nl as estimateRoundTokens, y as estimateTokens, te as extractReasoningDelta, xc as extractSchemaHint, cd as extractText, ee as extractTextDelta, ne as extractUsage, Ug as fetchDocTools, A_ as fetchTools, Jc as findStrippedKeys, lc as formatConstraints, oi as formatZodIssues, Q as getByPath, Jg as getDomTool, d_ as getElementInfo, x_ as getEnvSummary, s_ as getRecordedListeners, _p as getSandboxLifecycle, Bs as getSchemaAtPath, Ls as getSchemaTopKeys, Lg as hashContent, Bc as hashValue, wp as htmlFragmentSkill, gc as htmlOrchestratorPrompt, Pl as indexSummarize, w_ as inspectEnvTool, T_ as inspectTools, Ip as isChatModel, _a as isContextLengthError, va as isModelUnavailableError, Rs as isPathAllowed, cm as isQuotaError, Ac as isUnsafePath, Fa as jpEval, ci as jsonParseError, Rc as limitDepth, Ng as lineDiff, _ as lowCapsHint, rp as maskUrlCredentials, Ic as maybeParseValue, Zf as measureWriteScale, Wc as moveByPath, T as normalizeBaseUrl, fp as normalizeRenderResult,
|
|
17991
|
+
export { Tm as CAPABILITIES, Om as CONTEXT_PRESETS, Np as CompressDecisionSchema, r_ as DEFAULT_COMPUTED_STYLES, Ll as DEFAULT_PROMPT_SOFT_CAP, md as DEFAULT_SYSTEM_PROMPT, hd as DEFAULT_SYSTEM_PROMPT_EN, Sf as HTML_VOID_TAGS, Du as HUMAN_CONFIRM_TOOL_NAME, hi as ImageInputError, g as LOW_CAPS_HINT_BASELINE, p as MIN_CONTEXT_WINDOW, ya as MODEL_UNAVAILABLE_GUIDANCE, Il as SOFT_CAP_MIN_WINDOW, Ol as STOP_WORDS, kc as UNSAFE_KEYS, k_ as actionsToInspectInfo, O_ as actionsToTools, di as agentError, od as analyzeContext, Hc as applyPatchToClone, Gc as applyPatchToLive, uf as applyPatchesToBind, Ig as applyProposalOps, Js as arrayMinLength, ui as asAgentError, pp as buildCollectorJs, c_ as buildCssPath, Sd as buildDataPrompt, ap as buildDiagnosticsReport, Cp as buildHtmlFragmentSkill, mp as buildSandboxSrcdoc, Cd as buildSystemPrompt, Yi as captureSelectionQuote, Cv as chatContextKey, lf as commitSetToBind, bp as composeStructureThenRender, Ei as compressImage, fd as connectMcp, k as constructLlmFromConfig, E as constructOpenLlmSync, hv as copyText, Fg as countOccurrences, Is as createAgent, Eu as createApprovalMiddleware, wv as createChatContext, Ev as createChatSdk, Ru as createCheckpointManager, zu as createCheckpointMiddleware, Jp as createConflictManager, sd as createContextInspectorMiddleware, Dp as createCraftNoteCheck, xf as createDataOps, mv as createEvalHarness, Tp as createHtmlFormatCheck, yp as createHtmlRenderCheck, kp as createHtmlSubagent, Au as createHumanConfirmMiddleware, ku as createHumanConfirmTool, dv as createIdleDetector, gm as createMemoryBackend, yu as createMemoryMiddleware, u as createProxyLlm, uv as createRagSubagent, Ta as createSandboxRunner, Dm as createSdkEvents, X_ as createSerialRunner, bm as createSessionStore, xm as createSessionStoreWithBackend, K_ as createSkillStore, uu as createSubagentMiddleware, Wl as createSubagentTracker, pu as createSubagentsMiddleware, R_ as createUsageHintsMiddleware, Vu as createVerifyMiddleware, Dd as createVfs, vm as createWebStorageBackend, qu as createWriteBackCheck, ba as decorateModelUnavailable, Pc as deepClone, M_ as defineDataToolset, il as defineSkill, Ap as defineTool, Nc as deleteByPath, Pp as deriveTitle, cc as describeSchemaNode, ys as detectGarbledToolCall, ko as detectTransitionalReply, Yc as diffObjects, pv as diffReport, p_ as domInfoTool, v_ as domInspectSkill, f_ as domSearchTool, qg as domToStructure, n_ as domTools, j_ as domToolsStatic, Ys as elementSchemaCandidates, o_ as ensureDomListenerRecorder, Al as estimateMessageTokens, Nl as estimateRoundTokens, y as estimateTokens, te as extractReasoningDelta, xc as extractSchemaHint, cd as extractText, ee as extractTextDelta, ne as extractUsage, Ug as fetchDocTools, A_ as fetchTools, Jc as findStrippedKeys, lc as formatConstraints, oi as formatZodIssues, Q as getByPath, Jg as getDomTool, d_ as getElementInfo, x_ as getEnvSummary, s_ as getRecordedListeners, _p as getSandboxLifecycle, Bs as getSchemaAtPath, Ls as getSchemaTopKeys, Lg as hashContent, Bc as hashValue, wp as htmlFragmentSkill, gc as htmlOrchestratorPrompt, Pl as indexSummarize, w_ as inspectEnvTool, T_ as inspectTools, Ip as isChatModel, _a as isContextLengthError, va as isModelUnavailableError, Rs as isPathAllowed, cm as isQuotaError, Ac as isUnsafePath, Fa as jpEval, ci as jsonParseError, Rc as limitDepth, Ng as lineDiff, _ as lowCapsHint, rp as maskUrlCredentials, Ic as maybeParseValue, Zf as measureWriteScale, Wc as moveByPath, T as normalizeBaseUrl, fp as normalizeRenderResult, re as normalizeUsage, x as offloadPassThroughChars, b as offloadThresholdChars, hc as presets, nc as projectBySchema, tc as projectBySchemaDeep, Lc as projectFields, Fl as recallRounds, vp as renderInSandbox, uc as renderSchemaHint, dc as renderSchemaOverview, mc as renderSchemaShallow, Em as resolveCapabilities, Am as resolveContextOptions, wm as resolveDialogConfig, qp as resolveLlm, v as resolveModelCaps, zl as resolvePromptSoftCap, Gs as resolveSchemaPath, Cm as resolveStorage, qc as restoreInPlace, Kc as restoreLive, li as routeError, za as runSandboxedScript, jc as safeMerge, b_ as safeSerialize, $ as safeStringify, bs as sanitizeGarbledContent, qs as schemaHasRefinement, l_ as searchDom, La as searchJson, N_ as selectBuiltinTools, Mc as setByPath, Bl as shouldTriggerCompression, op as stringifyDiagnosticsReport, w as stripStainlessFetch, _c as systemPromptHelpers, h as tableMaxOutputTokens, kl as tokenize, Z as toolError, zs as unwrapSchema, _v as useChat, Tv as useChatContext, Ks as validateAtPath, wf as validateHtmlFormat, sf as validateRootValueLocally, cf as validateWriteLocally, Vc as watchFieldsHash, e as z, si as zodError };
|