page-agent-sdk 4.25.4 → 4.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/README.zh-CN.md +3 -3
- package/dist/page-agent-sdk.headless.js +878 -834
- package/dist/page-agent-sdk.iife.js +17 -17
- package/dist/page-agent-sdk.js +617 -559
- package/dist/page-agent-sdk.legacy.js +15406 -15347
- package/dist/page-agent-sdk.umd.cjs +17 -17
- 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
|
|
@@ -14285,9 +14297,19 @@ function Vg(e, n) {
|
|
|
14285
14297
|
outcome: t,
|
|
14286
14298
|
summary: o.summary
|
|
14287
14299
|
}), !0;
|
|
14288
|
-
}, c =
|
|
14300
|
+
}, c = (e, t, r) => {
|
|
14301
|
+
let i = String(r ?? "未知错误");
|
|
14302
|
+
return n.log("read_failed", {
|
|
14303
|
+
tool: e,
|
|
14304
|
+
message: i.slice(0, 300)
|
|
14305
|
+
}), Z({
|
|
14306
|
+
code: "CONTENT_READ_FAILED",
|
|
14307
|
+
message: `${t}:${i}`,
|
|
14308
|
+
hint: "这是宿主读取通道故障(内容源不可达 / 宿主服务未运行等),不是内容本身的问题 —— 原样重试不会成功;请如实告知用户并说明稍后可重试,不要编造内容。"
|
|
14309
|
+
});
|
|
14310
|
+
}, l = s(async () => {
|
|
14289
14311
|
let e = await zg(r);
|
|
14290
|
-
if (e && typeof e == "object" && "__err" in e) return
|
|
14312
|
+
if (e && typeof e == "object" && "__err" in e) return c("read", `读取当前${r.contentKind}失败`, e.__err);
|
|
14291
14313
|
let t = e;
|
|
14292
14314
|
if (!t || typeof t.content != "string") return "当前没有可编辑的内容对象(宿主 read 返回空)。请如实告知用户,不要编造内容。";
|
|
14293
14315
|
let i = Lg(t.content);
|
|
@@ -14299,7 +14321,7 @@ function Vg(e, n) {
|
|
|
14299
14321
|
name: r.readToolName,
|
|
14300
14322
|
description: `读取当前${r.contentKind}的原文(修改前必须先调它拿真实基底与 hash)。返回首行是 hash(提案时作 baseHash 原样带回),分隔线后是全文。`,
|
|
14301
14323
|
schema: t.object({})
|
|
14302
|
-
}),
|
|
14324
|
+
}), u = t.object({
|
|
14303
14325
|
summary: t.string().describe("一句话修改说明(展示在评审面板):改了什么、为什么"),
|
|
14304
14326
|
baseHash: t.string().describe("read_content 返回的 hash(基底锚定;基底已变会被拒,须重读)"),
|
|
14305
14327
|
ops: t.array(Bg).min(1).max(50).optional().describe("增量操作(顺序应用,原子;推荐 —— token 只花在改动上,勿全量重发)"),
|
|
@@ -14309,21 +14331,21 @@ function Vg(e, n) {
|
|
|
14309
14331
|
code: t.ZodIssueCode.custom,
|
|
14310
14332
|
message: "ops 与 content 必须二选一(且只给一个)"
|
|
14311
14333
|
});
|
|
14312
|
-
}),
|
|
14334
|
+
}), d = [l, s(async (e) => {
|
|
14313
14335
|
let t = await zg(r);
|
|
14314
|
-
if (t && typeof t == "object" && "__err" in t) return
|
|
14336
|
+
if (t && typeof t == "object" && "__err" in t) return c("propose", `提案被拒:读取当前${r.contentKind}失败`, t.__err);
|
|
14315
14337
|
let a = t;
|
|
14316
14338
|
if (!a || typeof a.content != "string") return "提案被拒:当前没有可编辑的内容对象。";
|
|
14317
|
-
let o = a.content, s = typeof a.label == "string" ? a.label : void 0,
|
|
14318
|
-
if (e.baseHash !==
|
|
14319
|
-
let
|
|
14339
|
+
let o = a.content, s = typeof a.label == "string" ? a.label : void 0, l = Lg(o);
|
|
14340
|
+
if (e.baseHash !== l) return n.log("rejected", { reason: "base_hash_mismatch" }), `提案被拒:基底已变(read_content 之后内容被修改,hash 不匹配)。请重新 ${r.readToolName} 取当前原文与 hash 后基于新基底重提 —— 不要在旧印象上猜测改动。`;
|
|
14341
|
+
let u = Array.isArray(e.ops) && e.ops.length > 0 ? Ig(o, e.ops) : {
|
|
14320
14342
|
ok: !0,
|
|
14321
14343
|
content: String(e.content ?? "")
|
|
14322
14344
|
};
|
|
14323
|
-
if (!
|
|
14324
|
-
let
|
|
14325
|
-
if (
|
|
14326
|
-
if (i.pending.some((e) => e.baseHash ===
|
|
14345
|
+
if (!u.ok) return n.log("rejected", { reason: "ops_error" }), `提案被拒:${u.error}`;
|
|
14346
|
+
let d = u.content;
|
|
14347
|
+
if (d === o) return n.log("rejected", { reason: "identical_to_base" }), "提案内容与当前源文完全相同,未打开评审面板。";
|
|
14348
|
+
if (i.pending.some((e) => e.baseHash === l && e.content === d)) return n.log("rejected", { reason: "identical_pending" }), "提案与在审提案内容完全相同(在审面板仍有效,未被替换)。";
|
|
14327
14349
|
for (; i.pending.length >= r.maxPending;) {
|
|
14328
14350
|
let e = i.pending.shift();
|
|
14329
14351
|
e && n.log("replaced", {
|
|
@@ -14332,43 +14354,43 @@ function Vg(e, n) {
|
|
|
14332
14354
|
});
|
|
14333
14355
|
}
|
|
14334
14356
|
i.seq += 1;
|
|
14335
|
-
let
|
|
14357
|
+
let f = {
|
|
14336
14358
|
id: `prop-${i.seq}-${Date.now().toString(36)}`,
|
|
14337
14359
|
summary: String(e.summary || "(无说明)"),
|
|
14338
14360
|
...s ? { label: s } : {},
|
|
14339
|
-
baseHash:
|
|
14361
|
+
baseHash: l,
|
|
14340
14362
|
baseContent: o,
|
|
14341
|
-
content:
|
|
14342
|
-
diff: Ng(o,
|
|
14363
|
+
content: d,
|
|
14364
|
+
diff: Ng(o, d),
|
|
14343
14365
|
createdAt: Date.now()
|
|
14344
14366
|
};
|
|
14345
|
-
i.pending.push(
|
|
14346
|
-
id:
|
|
14347
|
-
summary:
|
|
14348
|
-
added:
|
|
14349
|
-
removed:
|
|
14367
|
+
i.pending.push(f), n.log("pending", {
|
|
14368
|
+
id: f.id,
|
|
14369
|
+
summary: f.summary.slice(0, 80),
|
|
14370
|
+
added: f.diff.stats.added,
|
|
14371
|
+
removed: f.diff.stats.removed
|
|
14350
14372
|
}), n.emit({
|
|
14351
14373
|
type: "proposal_pending",
|
|
14352
|
-
id:
|
|
14353
|
-
summary:
|
|
14354
|
-
added:
|
|
14355
|
-
removed:
|
|
14374
|
+
id: f.id,
|
|
14375
|
+
summary: f.summary,
|
|
14376
|
+
added: f.diff.stats.added,
|
|
14377
|
+
removed: f.diff.stats.removed
|
|
14356
14378
|
});
|
|
14357
|
-
let
|
|
14379
|
+
let p = "";
|
|
14358
14380
|
try {
|
|
14359
|
-
|
|
14381
|
+
p = await r.onProposal(f);
|
|
14360
14382
|
} catch (e) {
|
|
14361
14383
|
return n.log("on_proposal_error", { message: String(e?.message ?? e).slice(0, 160) }), `提案已送达,但打开评审面板时出错(${String(e?.message ?? e)})。请如实告知用户。`;
|
|
14362
14384
|
}
|
|
14363
|
-
let
|
|
14364
|
-
return typeof
|
|
14385
|
+
let m = `(diff 统计:+${f.diff.stats.added} / -${f.diff.stats.removed} 行;提案待用户在评审面板确认,点「应用」才会写回 —— 请如实告知用户当前是待确认状态。)`;
|
|
14386
|
+
return typeof p == "string" && p.trim() ? `${p}\n${m}` : `提案已送达,评审面板已打开。${m}`;
|
|
14365
14387
|
}, {
|
|
14366
14388
|
name: r.toolName,
|
|
14367
14389
|
description: `提交${r.contentKind}修改提案(仅送达,用户确认才生效)。先 ${r.readToolName} 取基底与 hash,再带 baseHash 提案;优先用 ops 增量操作(token 只花在改动上),锚点用原文字面片段且须唯一命中。`,
|
|
14368
|
-
schema:
|
|
14390
|
+
schema: u
|
|
14369
14391
|
})];
|
|
14370
|
-
return na(
|
|
14371
|
-
tools:
|
|
14392
|
+
return na(d), {
|
|
14393
|
+
tools: d,
|
|
14372
14394
|
state: i,
|
|
14373
14395
|
resolve: o,
|
|
14374
14396
|
snapshot: a
|
|
@@ -15169,7 +15191,7 @@ function tv(e, t, n, r) {
|
|
|
15169
15191
|
}), i;
|
|
15170
15192
|
},
|
|
15171
15193
|
afterModel: (t) => {
|
|
15172
|
-
let n =
|
|
15194
|
+
let n = re(t.message);
|
|
15173
15195
|
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
15196
|
type: "usage",
|
|
15175
15197
|
round: i,
|
|
@@ -15233,9 +15255,9 @@ function rv(e, n, r) {
|
|
|
15233
15255
|
}
|
|
15234
15256
|
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
15257
|
e.debug && !d && console.warn("[page-agent-sdk][summarization] 未构造 llmInvoke(apiKey 缺失?),摘要回退零成本索引摘要");
|
|
15236
|
-
let w = /* @__PURE__ */
|
|
15258
|
+
let w = /* @__PURE__ */ Nt([]), T = Dd(e.vfs?.initialFiles, {
|
|
15237
15259
|
persist: l ? { save: (e) => {
|
|
15238
|
-
|
|
15260
|
+
yn.persistSave({ vfs: e });
|
|
15239
15261
|
} } : void 0,
|
|
15240
15262
|
maxBytes: e.vfs?.maxBytes,
|
|
15241
15263
|
poolBytes: e.vfs?.poolBytes
|
|
@@ -15254,7 +15276,7 @@ function rv(e, n, r) {
|
|
|
15254
15276
|
type: "middleware",
|
|
15255
15277
|
data: { stage: "resume_notice" }
|
|
15256
15278
|
});
|
|
15257
|
-
}), ne = Nm(),
|
|
15279
|
+
}), 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
15280
|
Y({
|
|
15259
15281
|
type: "error",
|
|
15260
15282
|
message: `确认请求(${e.toolName})${Math.round(e.waitedMs / 1e3)}s 无响应已自动拒绝 —— 当前路径无 UI 响应方;可传 approval.timeoutMs 调整(Infinity = 无限等)`,
|
|
@@ -15262,8 +15284,8 @@ function rv(e, n, r) {
|
|
|
15262
15284
|
code: "APPROVAL_AUTO_REJECTED",
|
|
15263
15285
|
context: e
|
|
15264
15286
|
});
|
|
15265
|
-
},
|
|
15266
|
-
ne.lastPlanConfirmation = e,
|
|
15287
|
+
}, ae = Au((e) => {
|
|
15288
|
+
ne.lastPlanConfirmation = e, yn.persistSave({ planConfirmation: e }), X.agent?.debugLogs?.value?.push({
|
|
15267
15289
|
timestamp: Date.now(),
|
|
15268
15290
|
type: "middleware",
|
|
15269
15291
|
data: {
|
|
@@ -15273,24 +15295,24 @@ function rv(e, n, r) {
|
|
|
15273
15295
|
}
|
|
15274
15296
|
});
|
|
15275
15297
|
}, {
|
|
15276
|
-
timeoutMs:
|
|
15277
|
-
onAutoReject:
|
|
15278
|
-
}),
|
|
15298
|
+
timeoutMs: re,
|
|
15299
|
+
onAutoReject: ie
|
|
15300
|
+
}), j = rl({
|
|
15279
15301
|
getSchema: () => W()?.schema,
|
|
15280
15302
|
getBind: () => W()?.bind,
|
|
15281
15303
|
onChange: (e) => Y({
|
|
15282
15304
|
type: "focus_change",
|
|
15283
15305
|
focuses: e
|
|
15284
15306
|
})
|
|
15285
|
-
}),
|
|
15307
|
+
}), M = (e) => {
|
|
15286
15308
|
let t = tl(W()?.bind, e.path);
|
|
15287
15309
|
return t ? {
|
|
15288
15310
|
...e,
|
|
15289
15311
|
pgId: t
|
|
15290
15312
|
} : e;
|
|
15291
|
-
},
|
|
15292
|
-
typeof e.memory == "function" &&
|
|
15293
|
-
let
|
|
15313
|
+
}, oe = vu(), N = yu(e.memory || "");
|
|
15314
|
+
typeof e.memory == "function" && N.refresh();
|
|
15315
|
+
let se = { current: null }, P = e.data ? {
|
|
15294
15316
|
...e.data,
|
|
15295
15317
|
description: e.data.description ?? "主数据对象"
|
|
15296
15318
|
} : void 0, F = !(e.subagents ?? []).some((e) => e._codeAsset) && Em(e.capabilities).subagent, I = e.subagents;
|
|
@@ -15301,27 +15323,27 @@ function rv(e, n, r) {
|
|
|
15301
15323
|
let t = ec(P?.schema, e._codeAsset.codeField);
|
|
15302
15324
|
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
15325
|
}
|
|
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,
|
|
15326
|
+
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
15327
|
getData: () => W()?.bind,
|
|
15306
15328
|
consumeDataDirty: () => U?.consumeDataDirty?.() ?? !0,
|
|
15307
15329
|
slotPaths: P ? [""] : [],
|
|
15308
15330
|
vfsStore: T,
|
|
15309
15331
|
todosMw: D,
|
|
15310
|
-
getTodos: () =>
|
|
15332
|
+
getTodos: () => se.current?.getState?.()?.todos ?? [],
|
|
15311
15333
|
messages: w,
|
|
15312
15334
|
maxCheckpoints: pe && typeof pe == "object" ? pe.maxCheckpoints : void 0
|
|
15313
|
-
}) : null,
|
|
15335
|
+
}) : 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
15336
|
...e,
|
|
15315
15337
|
locale: e.i18n?.locale,
|
|
15316
|
-
dataOps:
|
|
15317
|
-
domInspect:
|
|
15338
|
+
dataOps: V && !!P,
|
|
15339
|
+
domInspect: B.domInspect === !0,
|
|
15318
15340
|
screenshot: ve
|
|
15319
15341
|
});
|
|
15320
15342
|
if (de) {
|
|
15321
15343
|
let e = L.map((e) => e._codeAsset.orchestratorPrompt).filter(Boolean).join("\n\n");
|
|
15322
15344
|
e && (ye += "\n\n" + e);
|
|
15323
15345
|
} 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 =
|
|
15346
|
+
let H = V && P ? xf(P, {
|
|
15325
15347
|
onAudit: e.onAudit ?? (e.debug ? (e) => console.log("[page-agent-sdk][data audit]", e) : void 0),
|
|
15326
15348
|
maxSnapshots: e.maxSnapshots,
|
|
15327
15349
|
onConflict: o.set,
|
|
@@ -15330,7 +15352,7 @@ function rv(e, n, r) {
|
|
|
15330
15352
|
vfsStore: ge || P?.resources?.length ? T : void 0,
|
|
15331
15353
|
...R.length ? { pgIdPaths: R } : {},
|
|
15332
15354
|
...fe.length ? { largeTextPaths: fe } : {}
|
|
15333
|
-
}) : [], be =
|
|
15355
|
+
}) : [], 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
15356
|
getBind: () => W()?.bind,
|
|
15335
15357
|
recomputeAll: () => U.recomputeAllBaselines?.(),
|
|
15336
15358
|
hasBaselines: () => U.hasBaselines?.() ?? !1,
|
|
@@ -15347,27 +15369,27 @@ function rv(e, n, r) {
|
|
|
15347
15369
|
}
|
|
15348
15370
|
}), Jt(n));
|
|
15349
15371
|
}
|
|
15350
|
-
}) : void 0,
|
|
15351
|
-
|
|
15352
|
-
let
|
|
15372
|
+
}) : void 0, K = /* @__PURE__ */ new Map();
|
|
15373
|
+
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 生效)");
|
|
15374
|
+
let Ee = [], De = (e) => {
|
|
15353
15375
|
if (e.type === "tool_result" && e.name === "take_screenshot") {
|
|
15354
|
-
let t =
|
|
15376
|
+
let t = Ee.find((e) => !e.eventConsumed);
|
|
15355
15377
|
if (t) return t.eventConsumed = !0, Object.assign(e, { image: {
|
|
15356
15378
|
dataUri: t.image.dataUri,
|
|
15357
15379
|
vfsRef: t.meta.vfsRef
|
|
15358
15380
|
} });
|
|
15359
15381
|
}
|
|
15360
15382
|
return e;
|
|
15361
|
-
},
|
|
15383
|
+
}, Oe = g.vision === !0 || typeof e.images?.describe == "function" ? pg({
|
|
15362
15384
|
getVision: () => g.vision === !0,
|
|
15363
15385
|
describe: e.images?.describe,
|
|
15364
15386
|
onShot: (e, t) => {
|
|
15365
|
-
|
|
15387
|
+
Ee.push({
|
|
15366
15388
|
image: e,
|
|
15367
15389
|
meta: t
|
|
15368
15390
|
});
|
|
15369
15391
|
}
|
|
15370
|
-
}) : void 0,
|
|
15392
|
+
}) : void 0, ke = ve ? dg({
|
|
15371
15393
|
render: e.screenshot?.renderer,
|
|
15372
15394
|
getActiveFocus: () => X.getFocus(),
|
|
15373
15395
|
focusSelector: e.screenshot?.focusSelector,
|
|
@@ -15385,24 +15407,24 @@ function rv(e, n, r) {
|
|
|
15385
15407
|
getVision: () => g.vision === !0,
|
|
15386
15408
|
describe: e.images?.describe,
|
|
15387
15409
|
onShot: (e, t) => {
|
|
15388
|
-
|
|
15410
|
+
Ee.push({
|
|
15389
15411
|
image: e,
|
|
15390
15412
|
meta: t
|
|
15391
15413
|
});
|
|
15392
15414
|
}
|
|
15393
|
-
}) : void 0,
|
|
15415
|
+
}) : void 0, Ae = !Ip(e.llm) && (e.llm.provider ?? "openai") === "anthropic" ? "anthropic" : "openai", je = ke || Oe ? {
|
|
15394
15416
|
name: "screenshotChannel",
|
|
15395
15417
|
wrapModelCall: async (e, t) => {
|
|
15396
|
-
if (
|
|
15397
|
-
let t =
|
|
15418
|
+
if (Ee.length) {
|
|
15419
|
+
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
15420
|
dataUri: e.image.dataUri,
|
|
15399
15421
|
url: e.image.url
|
|
15400
|
-
})),
|
|
15422
|
+
})), Ae);
|
|
15401
15423
|
n && e.messages.push(new i({ content: n }));
|
|
15402
15424
|
}
|
|
15403
15425
|
return t(e);
|
|
15404
15426
|
}
|
|
15405
|
-
} : null,
|
|
15427
|
+
} : null, Me = !1, Ne = B.domEdit ? Eg({
|
|
15406
15428
|
onEdit: (e) => {
|
|
15407
15429
|
X.agent?.debugLogs?.value?.push({
|
|
15408
15430
|
timestamp: Date.now(),
|
|
@@ -15413,19 +15435,19 @@ function rv(e, n, r) {
|
|
|
15413
15435
|
applied: e.applied,
|
|
15414
15436
|
dryRun: e.dryRun
|
|
15415
15437
|
}
|
|
15416
|
-
}), !e.dryRun && e.applied > 0 && (
|
|
15438
|
+
}), !e.dryRun && e.applied > 0 && (Me = !0);
|
|
15417
15439
|
},
|
|
15418
15440
|
onRestore: (e) => {
|
|
15419
|
-
e.restored > 0 && (
|
|
15441
|
+
e.restored > 0 && (Me = !0);
|
|
15420
15442
|
}
|
|
15421
|
-
}) : [],
|
|
15443
|
+
}) : [], Pe = [...N_(B, be, Ug, B.domInspect ? [
|
|
15422
15444
|
...n_,
|
|
15423
|
-
...
|
|
15424
|
-
...
|
|
15425
|
-
...
|
|
15426
|
-
] : [], T_), ...
|
|
15427
|
-
|
|
15428
|
-
let
|
|
15445
|
+
...Ne,
|
|
15446
|
+
...ke ? [ke] : [],
|
|
15447
|
+
...B.skills ? [] : [f_, p_]
|
|
15448
|
+
] : [], T_), ...Oe ? [Oe] : []];
|
|
15449
|
+
Oe && K.set("view_image", "builtin"), Pe.forEach((e) => K.set(e.name, "builtin"));
|
|
15450
|
+
let Fe = e.proposals ? Vg(e.proposals, {
|
|
15429
15451
|
emit: (e) => {
|
|
15430
15452
|
try {
|
|
15431
15453
|
Y(e);
|
|
@@ -15442,31 +15464,31 @@ function rv(e, n, r) {
|
|
|
15442
15464
|
}
|
|
15443
15465
|
});
|
|
15444
15466
|
}
|
|
15445
|
-
}) : null,
|
|
15446
|
-
|
|
15447
|
-
let
|
|
15448
|
-
|
|
15449
|
-
let
|
|
15450
|
-
|
|
15451
|
-
let
|
|
15452
|
-
let e =
|
|
15453
|
-
return e.length ?
|
|
15467
|
+
}) : null, Ie = [...e.tools || [], ...Fe?.tools ?? []];
|
|
15468
|
+
Ie.forEach((e) => K.set(e.name, "user"));
|
|
15469
|
+
let Le = O_(e.actions ?? {});
|
|
15470
|
+
Le.forEach((e) => K.set(e.name, "action"));
|
|
15471
|
+
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;
|
|
15472
|
+
Ge && K.set(Du, "builtin");
|
|
15473
|
+
let Ke = me && he ? [s(async () => {
|
|
15474
|
+
let e = he.list();
|
|
15475
|
+
return e.length ? he.restore() ? `已回退到最近一次正常状态(checkpoint #${e[e.length - 1].id})。对话历史、主数据、vfs、todos 已整体还原。请基于回退后的状态重新判断并继续。` : "回退失败:无可用 checkpoint。" : "无可用 checkpoint,无法回退。";
|
|
15454
15476
|
}, {
|
|
15455
15477
|
name: "restore_last_checkpoint",
|
|
15456
15478
|
description: "回退到最近一次正常状态(整体还原对话历史 + 主数据 + vfs + todos)。当本轮操作出错、页面被改坏、或走偏时调用,回到本轮起点重新来过。不传参数即回退最近一次。",
|
|
15457
15479
|
schema: t.object({}).optional()
|
|
15458
15480
|
}), s(async () => {
|
|
15459
|
-
let e =
|
|
15481
|
+
let e = he.list();
|
|
15460
15482
|
return e.length ? "可用 checkpoint:\n" + e.map((e) => `#${e.id} [${e.label ?? "auto"}] 消息数=${e.messageCount} 时间=${new Date(e.timestamp).toLocaleTimeString()}`).join("\n") : "无可用 checkpoint。";
|
|
15461
15483
|
}, {
|
|
15462
15484
|
name: "list_checkpoints",
|
|
15463
15485
|
description: "列出可用会话 checkpoint(回退点)。",
|
|
15464
15486
|
schema: t.object({}).optional()
|
|
15465
15487
|
})] : [];
|
|
15466
|
-
|
|
15467
|
-
let
|
|
15488
|
+
Ke.forEach((e) => K.set(e.name, "builtin"));
|
|
15489
|
+
let qe = B.focus && V, Je = s(async ({ path: e, label: t }) => {
|
|
15468
15490
|
let n = W()?.schema;
|
|
15469
|
-
return n ? Bs(n, e) ? (
|
|
15491
|
+
return n ? Bs(n, e) ? (j.setFocus(M({
|
|
15470
15492
|
path: e,
|
|
15471
15493
|
...t ? { label: t } : {}
|
|
15472
15494
|
}), "agent"), `已聚焦到 ${e}${t ? `(${t})` : ""}。后续仅可写该子树(越界被拒),每轮只看到该组件结构。完成精修后调 clear_focus 退出。`) : `PATH_DENIED · 聚焦失败:path "${e}" 不在 schema 内。请先用 read 查看可操作路径再聚焦。` : "聚焦失败:当前无主数据 schema,无法聚焦。";
|
|
@@ -15477,19 +15499,19 @@ function rv(e, n, r) {
|
|
|
15477
15499
|
path: t.string().describe("要聚焦的组件 jsonPath,如 components.3"),
|
|
15478
15500
|
label: t.string().optional().describe("人类可读标签,如「导航栏」")
|
|
15479
15501
|
})
|
|
15480
|
-
}),
|
|
15502
|
+
}), Ye = s(async () => (j.clearFocus("agent"), "已清除聚焦,恢复全量可操作范围(可读写所有组件)。"), {
|
|
15481
15503
|
name: "clear_focus",
|
|
15482
15504
|
description: "清除当前聚焦,退出精修模式,恢复对全部组件的读写权限。",
|
|
15483
15505
|
schema: t.object({}).optional()
|
|
15484
|
-
}),
|
|
15506
|
+
}), Xe = s(async ({ path: e, label: t }) => {
|
|
15485
15507
|
let n = W()?.schema;
|
|
15486
15508
|
if (!n) return "聚焦失败:当前无主数据 schema,无法聚焦。";
|
|
15487
15509
|
if (!Bs(n, e)) return `PATH_DENIED · 聚焦失败:path "${e}" 不在 schema 内。请先用 read 查看可操作路径再聚焦。`;
|
|
15488
|
-
|
|
15510
|
+
j.addFocus(M({
|
|
15489
15511
|
path: e,
|
|
15490
15512
|
...t ? { label: t } : {}
|
|
15491
15513
|
}), "agent");
|
|
15492
|
-
let r =
|
|
15514
|
+
let r = j.getFocuses();
|
|
15493
15515
|
return `已聚焦 ${e}${t ? `(${t})` : ""}(当前共 ${r.length} 个焦点:${r.map((e) => e.path).join(", ")})。后续仅可写这些子树之一(越界被拒)。`;
|
|
15494
15516
|
}, {
|
|
15495
15517
|
name: "add_focus",
|
|
@@ -15498,71 +15520,73 @@ function rv(e, n, r) {
|
|
|
15498
15520
|
path: t.string().describe("要追加聚焦的组件 jsonPath,如 components.3"),
|
|
15499
15521
|
label: t.string().optional().describe("人类可读标签")
|
|
15500
15522
|
})
|
|
15501
|
-
}),
|
|
15502
|
-
let t =
|
|
15503
|
-
|
|
15504
|
-
let n =
|
|
15523
|
+
}), Ze = s(async ({ path: e }) => {
|
|
15524
|
+
let t = j.getFocuses().length;
|
|
15525
|
+
j.removeFocus(e, "agent");
|
|
15526
|
+
let n = j.getFocuses();
|
|
15505
15527
|
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
15528
|
}, {
|
|
15507
15529
|
name: "remove_focus",
|
|
15508
15530
|
description: "移除单个聚焦焦点(by path),保留其他焦点。移除最后一个等价退出精修。全部退出用 clear_focus。",
|
|
15509
15531
|
schema: t.object({ path: t.string().describe("要移除的焦点 jsonPath") })
|
|
15510
|
-
}),
|
|
15532
|
+
}), Qe = qe ? [
|
|
15533
|
+
Je,
|
|
15511
15534
|
Ye,
|
|
15512
15535
|
Xe,
|
|
15513
|
-
Ze
|
|
15514
|
-
Qe
|
|
15536
|
+
Ze
|
|
15515
15537
|
] : [];
|
|
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
|
|
15538
|
+
Qe.forEach((e) => K.set(e.name, "builtin"));
|
|
15539
|
+
let $e = [], et = /* @__PURE__ */ new Map(), tt = Lm({
|
|
15540
|
+
builtinTools: () => Pe,
|
|
15541
|
+
userTools: () => Ie,
|
|
15542
|
+
actionTools: () => Le,
|
|
15543
|
+
humanConfirmTool: () => Ge,
|
|
15544
|
+
checkpointTools: () => Ke,
|
|
15545
|
+
focusTools: () => Qe,
|
|
15546
|
+
mcpTools: () => He,
|
|
15547
|
+
loadedSkillTools: () => $e
|
|
15548
|
+
}), q = tt(), nt = B.planning, rt = B.missionAnchor, it = B.workingMemory, at = B.skills, ot = B.vfs || de;
|
|
15549
|
+
if (ot) for (let e of Nd) K.set(e, "builtin");
|
|
15550
|
+
if (nt) for (let e of D.tools ?? []) K.set(e.name, "builtin");
|
|
15551
|
+
let st = B.summarization, ct = B.agentCompression && !!m;
|
|
15552
|
+
e.debug && B.agentCompression && !m && console.warn("[page-agent-sdk][agentCompression] agentCompression 开启但 summaryLlm 不可用(或缺 apiKey / 模型不支持工具),压缩决策不启用,回退静态压缩");
|
|
15553
|
+
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;
|
|
15554
|
+
pt && !ht && e.verify?.enabled !== !1 && console.warn("[page-agent-sdk][verify] 检测到 verify 配置(check/maxAttempts/adversarial)但未装载(capabilities.verify:false 显式关闭 或 maxAttempts≤0)");
|
|
15555
|
+
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
15556
|
...e.approval,
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
|
|
15557
|
+
remember: e.approval.remember === !0,
|
|
15558
|
+
grants: St,
|
|
15559
|
+
timeoutMs: e.approval.timeoutMs ?? re,
|
|
15560
|
+
onAutoReject: ie,
|
|
15561
|
+
previewWrite: xt
|
|
15538
15562
|
}) : void 0, wt = [
|
|
15539
|
-
...
|
|
15563
|
+
...yt ? [yt] : [],
|
|
15540
15564
|
...Ct ? [Ct] : [],
|
|
15541
15565
|
...G ? [G] : []
|
|
15542
|
-
], Tt = !
|
|
15543
|
-
llm:
|
|
15544
|
-
allTools: () => X.agent?.allTools ??
|
|
15545
|
-
allowedTools:
|
|
15566
|
+
], Tt = !ut || _t?.enabled === !1 ? void 0 : uu({
|
|
15567
|
+
llm: _t?.llm ?? e.llm,
|
|
15568
|
+
allTools: () => X.agent?.allTools ?? q,
|
|
15569
|
+
allowedTools: vt.length ? vt : void 0,
|
|
15546
15570
|
...e.staleReadInvalidation === void 0 ? {} : { staleReadInvalidation: e.staleReadInvalidation },
|
|
15547
|
-
systemPrompt:
|
|
15548
|
-
temperature:
|
|
15549
|
-
maxTokens:
|
|
15550
|
-
skills:
|
|
15551
|
-
maxDepth:
|
|
15552
|
-
maxParallel:
|
|
15553
|
-
thinkingMode:
|
|
15571
|
+
systemPrompt: _t?.systemPrompt,
|
|
15572
|
+
temperature: _t?.temperature,
|
|
15573
|
+
maxTokens: _t?.maxTokens,
|
|
15574
|
+
skills: _t?.skills,
|
|
15575
|
+
maxDepth: _t?.maxDepth,
|
|
15576
|
+
maxParallel: _t?.maxParallel,
|
|
15577
|
+
thinkingMode: _t?.thinkingMode,
|
|
15554
15578
|
debug: e.debug,
|
|
15555
|
-
getFocuses: () =>
|
|
15579
|
+
getFocuses: () => j.getActiveFocuses(),
|
|
15556
15580
|
getSchema: () => W()?.schema ?? null,
|
|
15557
|
-
tracker:
|
|
15581
|
+
tracker: dt,
|
|
15558
15582
|
guardMiddleware: wt.length ? wt : void 0,
|
|
15559
|
-
getVfsFiles:
|
|
15583
|
+
getVfsFiles: ot ? () => T.files : void 0,
|
|
15560
15584
|
enterDataScope: U?.enterScope ? (e) => U.enterScope(e) : void 0,
|
|
15561
15585
|
exitDataScope: U?.exitScope ? (e) => U.exitScope(e) : void 0,
|
|
15562
15586
|
onUsage: (e) => {
|
|
15563
15587
|
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
15588
|
},
|
|
15565
|
-
timeoutMs:
|
|
15589
|
+
timeoutMs: _t?.timeoutMs
|
|
15566
15590
|
}), Et = ue?.map((e) => {
|
|
15567
15591
|
if (!e._codeAsset) return e;
|
|
15568
15592
|
let t = e._codeAsset, n = zf({
|
|
@@ -15580,11 +15604,11 @@ function rv(e, n, r) {
|
|
|
15580
15604
|
...e,
|
|
15581
15605
|
middleware: r
|
|
15582
15606
|
};
|
|
15583
|
-
}), Dt = de &&
|
|
15607
|
+
}), Dt = de && ut ? Bf() : void 0, Ot = Dt ? qf({
|
|
15584
15608
|
getBind: () => W()?.bind,
|
|
15585
15609
|
writablePaths: R,
|
|
15586
15610
|
getLocked: () => Dt.locked(),
|
|
15587
|
-
tools:
|
|
15611
|
+
tools: q,
|
|
15588
15612
|
getCodeFieldPaths: () => Gf(W()?.bind, L.map((e) => ({
|
|
15589
15613
|
writablePaths: e._codeAsset.writablePaths,
|
|
15590
15614
|
codeField: e._codeAsset.codeField
|
|
@@ -15592,18 +15616,18 @@ function rv(e, n, r) {
|
|
|
15592
15616
|
}) : void 0, kt = U?.getSummarizedPaths && U.clearSummarizedPaths ? Xf({
|
|
15593
15617
|
getSummarizedPaths: () => U.getSummarizedPaths(),
|
|
15594
15618
|
clearSummarizedPaths: () => U.clearSummarizedPaths()
|
|
15595
|
-
}) : void 0, At =
|
|
15619
|
+
}) : void 0, At = ut && Et !== void 0 ? pu(Et, {
|
|
15596
15620
|
llm: e.llm,
|
|
15597
15621
|
thinkingModeDefault: e.subagent?.thinkingMode,
|
|
15598
15622
|
staleReadInvalidation: e.staleReadInvalidation,
|
|
15599
|
-
allTools: () => X.agent?.allTools ??
|
|
15623
|
+
allTools: () => X.agent?.allTools ?? q,
|
|
15600
15624
|
debug: e.debug,
|
|
15601
|
-
getFocuses: () =>
|
|
15625
|
+
getFocuses: () => j.getActiveFocuses(),
|
|
15602
15626
|
getSchema: () => W()?.schema ?? null,
|
|
15603
15627
|
getBind: () => W()?.bind,
|
|
15604
|
-
tracker:
|
|
15628
|
+
tracker: dt,
|
|
15605
15629
|
guardMiddleware: wt.length ? wt : void 0,
|
|
15606
|
-
getVfsFiles:
|
|
15630
|
+
getVfsFiles: ot ? () => T.files : void 0,
|
|
15607
15631
|
enterDataScope: U?.enterScope ? (e) => U.enterScope(e) : void 0,
|
|
15608
15632
|
exitDataScope: U?.exitScope ? (e) => U.exitScope(e) : void 0,
|
|
15609
15633
|
onUsage: (e) => {
|
|
@@ -15621,7 +15645,7 @@ function rv(e, n, r) {
|
|
|
15621
15645
|
...n ? { thinkingMode: n } : {},
|
|
15622
15646
|
thinkingApplied: r
|
|
15623
15647
|
};
|
|
15624
|
-
},
|
|
15648
|
+
}, Pt = ["read", "fetch_document"], Ft = q.filter((e) => Pt.includes(e.name)), It = ht ? Vu({
|
|
15625
15649
|
check: e.verify.check ?? qu({
|
|
15626
15650
|
schemas: () => W() ? { "": W().schema } : {},
|
|
15627
15651
|
root: () => W()?.bind
|
|
@@ -15630,37 +15654,37 @@ function rv(e, n, r) {
|
|
|
15630
15654
|
llm: e.llm,
|
|
15631
15655
|
tools: Ft
|
|
15632
15656
|
} : void 0
|
|
15633
|
-
}) : void 0, Lt =
|
|
15657
|
+
}) : void 0, Lt = gt ? sd({
|
|
15634
15658
|
contextWindow: g.contextWindow,
|
|
15635
15659
|
thresholdRatio: Am(e, g.contextWindow).summaryThresholdRatio
|
|
15636
15660
|
}) : void 0, Rt = R_({
|
|
15637
|
-
...
|
|
15638
|
-
humanConfirm:
|
|
15639
|
-
screenshot: !!
|
|
15640
|
-
domEdit:
|
|
15661
|
+
...B,
|
|
15662
|
+
humanConfirm: We,
|
|
15663
|
+
screenshot: !!ke,
|
|
15664
|
+
domEdit: B.domEdit,
|
|
15641
15665
|
hasActions: !!e.actions && Object.keys(e.actions).length > 0,
|
|
15642
15666
|
hasProposals: !!e.proposals,
|
|
15643
|
-
viewImage: !!
|
|
15667
|
+
viewImage: !!Oe,
|
|
15644
15668
|
subagents: ue?.map(Mt)
|
|
15645
|
-
},
|
|
15669
|
+
}, V && !!P, { promptSoftCap: zl(g.contextWindow, y.promptSoftCapTokens) }), zt = B.pageContext ? B_({
|
|
15646
15670
|
getPageInfo: () => typeof document < "u" && typeof location < "u" ? {
|
|
15647
15671
|
title: document.title || "",
|
|
15648
15672
|
url: location.href
|
|
15649
15673
|
} : null,
|
|
15650
|
-
canReadPage:
|
|
15651
|
-
}) : void 0,
|
|
15674
|
+
canReadPage: B.domInspect === !0
|
|
15675
|
+
}) : void 0, Bt = {
|
|
15652
15676
|
epoch: 0,
|
|
15653
15677
|
notices: [],
|
|
15654
15678
|
readsInvalidated: 0
|
|
15655
|
-
},
|
|
15679
|
+
}, J = 0, Vt = {
|
|
15656
15680
|
name: "hostNotice",
|
|
15657
15681
|
beforeAgent: () => {
|
|
15658
|
-
|
|
15682
|
+
J = Bt.epoch;
|
|
15659
15683
|
},
|
|
15660
15684
|
wrapModelCall: async (e, t) => {
|
|
15661
|
-
if (
|
|
15662
|
-
|
|
15663
|
-
let t = to(e.messages, "agent 已通过 dom_edit 修改页面,此前读取为改前状态",
|
|
15685
|
+
if (Me) {
|
|
15686
|
+
Me = !1;
|
|
15687
|
+
let t = to(e.messages, "agent 已通过 dom_edit 修改页面,此前读取为改前状态", Be);
|
|
15664
15688
|
if (t.invalidatedCount > 0) {
|
|
15665
15689
|
for (let n = 0; n < t.messages.length; n++) e.messages[n] = t.messages[n];
|
|
15666
15690
|
X.agent?.debugLogs?.value?.push({
|
|
@@ -15673,18 +15697,18 @@ function rv(e, n, r) {
|
|
|
15673
15697
|
});
|
|
15674
15698
|
}
|
|
15675
15699
|
}
|
|
15676
|
-
if (
|
|
15677
|
-
|
|
15678
|
-
let t =
|
|
15700
|
+
if (Bt.epoch > J) {
|
|
15701
|
+
J = Bt.epoch;
|
|
15702
|
+
let t = Bt.notices[Bt.notices.length - 1] ?? "", n = to(e.messages, t || void 0, Be);
|
|
15679
15703
|
if (n.invalidatedCount > 0) {
|
|
15680
15704
|
for (let t = 0; t < n.messages.length; t++) e.messages[t] = n.messages[t];
|
|
15681
|
-
|
|
15705
|
+
Bt.readsInvalidated += n.invalidatedCount, X.agent?.debugLogs?.value?.push({
|
|
15682
15706
|
timestamp: Date.now(),
|
|
15683
15707
|
type: "middleware",
|
|
15684
15708
|
data: {
|
|
15685
15709
|
stage: "host_read_invalidated",
|
|
15686
15710
|
count: n.invalidatedCount,
|
|
15687
|
-
epoch:
|
|
15711
|
+
epoch: Bt.epoch,
|
|
15688
15712
|
reason: t || void 0
|
|
15689
15713
|
}
|
|
15690
15714
|
});
|
|
@@ -15692,24 +15716,24 @@ function rv(e, n, r) {
|
|
|
15692
15716
|
}
|
|
15693
15717
|
return t(e);
|
|
15694
15718
|
},
|
|
15695
|
-
augmentPrompt: () =>
|
|
15719
|
+
augmentPrompt: () => Bt.notices.length ? [
|
|
15696
15720
|
"【宿主页面已变更】",
|
|
15697
|
-
...
|
|
15698
|
-
|
|
15721
|
+
...Bt.notices.filter(Boolean).map((e) => `· ${e}`),
|
|
15722
|
+
B.domInspect === !0 ? "此前的页面读取/截图结果已过期,回答任何关于当前页面的问题前必须重新 read_page / get_dom 读取当前页面;不要凭此前的读取结果或记忆作答。" : "页面内容可能已变化,断言页面前先核实当前状态;不要凭此前的印象作答。"
|
|
15699
15723
|
].join("\n") : void 0,
|
|
15700
15724
|
afterAgent: () => {
|
|
15701
|
-
|
|
15725
|
+
Bt.notices.length = 0;
|
|
15702
15726
|
}
|
|
15703
|
-
},
|
|
15727
|
+
}, Ht = Fe ? {
|
|
15704
15728
|
name: "proposalNotice",
|
|
15705
|
-
augmentPrompt: () =>
|
|
15729
|
+
augmentPrompt: () => Fe.state.notices.length ? ["【内容提案裁决结果】(以此为准,不要凭提案前状态作答)", ...Fe.state.notices].join("\n") : void 0,
|
|
15706
15730
|
afterAgent: () => {
|
|
15707
|
-
|
|
15731
|
+
Fe.state.notices.length = 0;
|
|
15708
15732
|
}
|
|
15709
|
-
} : null,
|
|
15733
|
+
} : null, Ut = P ? {
|
|
15710
15734
|
name: "dataHint",
|
|
15711
15735
|
augmentPrompt: () => Sd(W(), e.schemaHint) || void 0
|
|
15712
|
-
} : null,
|
|
15736
|
+
} : null, Wt = e.augmentSystem ? {
|
|
15713
15737
|
name: "augmentSystem",
|
|
15714
15738
|
augmentPrompt: (t) => {
|
|
15715
15739
|
try {
|
|
@@ -15722,89 +15746,89 @@ function rv(e, n, r) {
|
|
|
15722
15746
|
return;
|
|
15723
15747
|
}
|
|
15724
15748
|
}
|
|
15725
|
-
} : null,
|
|
15749
|
+
} : null, Kt = Dm(e.onEvent), Y = Kt.emit, qt, Yt = [], Xt = (e) => ({
|
|
15726
15750
|
name: e.name,
|
|
15727
15751
|
description: e.description,
|
|
15728
15752
|
content: typeof e.getContent == "function" ? e.getContent() : ""
|
|
15729
|
-
}),
|
|
15753
|
+
}), Zt = (e) => ({
|
|
15730
15754
|
name: e.name,
|
|
15731
15755
|
description: e.description,
|
|
15732
15756
|
getContent: () => e.content
|
|
15733
|
-
}),
|
|
15757
|
+
}), Qt = e.skillStorage === !1 ? null : K_({
|
|
15734
15758
|
...typeof e.skillStorage == "object" ? e.skillStorage : {},
|
|
15735
15759
|
id: e.skillStorage && typeof e.skillStorage == "object" && e.skillStorage.id ? e.skillStorage.id : `agent::${n}`
|
|
15736
|
-
}),
|
|
15737
|
-
let t =
|
|
15760
|
+
}), $t = () => {
|
|
15761
|
+
let t = qt ? qt.controller : null;
|
|
15738
15762
|
if (t) {
|
|
15739
|
-
let n = (e.skills || []).filter((e) => !
|
|
15740
|
-
t.set([...n, ...
|
|
15763
|
+
let n = (e.skills || []).filter((e) => !Yt.some((t) => t.name === e.name));
|
|
15764
|
+
t.set([...n, ...Yt]);
|
|
15741
15765
|
}
|
|
15742
15766
|
X.infoTick.value++;
|
|
15743
|
-
},
|
|
15744
|
-
if (
|
|
15745
|
-
let t = await
|
|
15767
|
+
}, en = async () => {
|
|
15768
|
+
if (Qt) try {
|
|
15769
|
+
let t = await Qt.list();
|
|
15746
15770
|
if (t.length) {
|
|
15747
|
-
|
|
15748
|
-
let n =
|
|
15771
|
+
Yt = t.map(Zt);
|
|
15772
|
+
let n = qt ? qt.controller : null;
|
|
15749
15773
|
if (n) {
|
|
15750
|
-
let t = (e.skills || []).filter((e) => !
|
|
15751
|
-
n.set([...t, ...
|
|
15774
|
+
let t = (e.skills || []).filter((e) => !Yt.some((t) => t.name === e.name));
|
|
15775
|
+
n.set([...t, ...Yt]);
|
|
15752
15776
|
}
|
|
15753
15777
|
X.infoTick.value++;
|
|
15754
15778
|
}
|
|
15755
15779
|
} catch {}
|
|
15756
|
-
},
|
|
15780
|
+
}, tn = st ? Ul({
|
|
15757
15781
|
...y,
|
|
15758
15782
|
llmInvoke: d,
|
|
15759
15783
|
getRegisteredData: () => W() ? [{ description: W().description ?? "主数据对象" }] : [],
|
|
15760
15784
|
preserveLastToolResults: x,
|
|
15761
|
-
...
|
|
15785
|
+
...ct ? {
|
|
15762
15786
|
decideInvoke: m,
|
|
15763
15787
|
getSnapshot: () => Lt?.getSnapshot()
|
|
15764
15788
|
} : {}
|
|
15765
|
-
}) : void 0,
|
|
15766
|
-
...
|
|
15767
|
-
withScreenshot: !!
|
|
15768
|
-
withDomEdit:
|
|
15769
|
-
withDataOps:
|
|
15789
|
+
}) : void 0, nn = at ? vl([
|
|
15790
|
+
...B.domInspect && !(e.skills || []).some((e) => e.name === "dom-inspect") ? [h_({
|
|
15791
|
+
withScreenshot: !!ke,
|
|
15792
|
+
withDomEdit: B.domEdit,
|
|
15793
|
+
withDataOps: V && !!P
|
|
15770
15794
|
})] : [],
|
|
15771
|
-
...
|
|
15772
|
-
withScreenshot: !!
|
|
15773
|
-
withDomEdit:
|
|
15774
|
-
withVfs:
|
|
15795
|
+
...B.domInspect && !(e.skills || []).some((e) => e.name === "page-analysis") ? [__({
|
|
15796
|
+
withScreenshot: !!ke,
|
|
15797
|
+
withDomEdit: B.domEdit,
|
|
15798
|
+
withVfs: ot
|
|
15775
15799
|
})] : [],
|
|
15776
15800
|
...e.skills || []
|
|
15777
15801
|
], {
|
|
15778
|
-
readVfs:
|
|
15802
|
+
readVfs: ot ? (e) => T.files[e]?.content : void 0,
|
|
15779
15803
|
onToolsReady: (e, t) => {
|
|
15780
15804
|
for (let n of t) {
|
|
15781
|
-
let t =
|
|
15782
|
-
t >= 0 &&
|
|
15805
|
+
let t = $e.findIndex((e) => e.name === n.name);
|
|
15806
|
+
t >= 0 && $e.splice(t, 1), $e.push(n), et.set(n.name, e), K.set(n.name, `skill:${e}`);
|
|
15783
15807
|
}
|
|
15784
|
-
|
|
15808
|
+
q = tt(), X.agent && X.agent.setTools(q), X.infoTick.value++;
|
|
15785
15809
|
}
|
|
15786
15810
|
}) : void 0;
|
|
15787
|
-
|
|
15788
|
-
let
|
|
15789
|
-
...
|
|
15811
|
+
qt = nn;
|
|
15812
|
+
let rn = Mm([
|
|
15813
|
+
...Ut ? [Ut] : [],
|
|
15790
15814
|
Rt,
|
|
15791
15815
|
...zt ? [zt] : [],
|
|
15792
|
-
|
|
15793
|
-
...
|
|
15794
|
-
...
|
|
15816
|
+
Vt,
|
|
15817
|
+
...Ht ? [Ht] : [],
|
|
15818
|
+
...rt ? [O] : [],
|
|
15795
15819
|
ee,
|
|
15796
15820
|
te,
|
|
15797
|
-
...
|
|
15821
|
+
...nt ? [D] : [],
|
|
15822
|
+
...nn ? [nn] : [],
|
|
15823
|
+
...ot ? [Fd(T)] : [],
|
|
15798
15824
|
...tn ? [tn] : [],
|
|
15799
|
-
...
|
|
15800
|
-
...
|
|
15801
|
-
...at ? [se] : [],
|
|
15802
|
-
...Je ? [A] : [],
|
|
15825
|
+
...it ? [oe] : [],
|
|
15826
|
+
...qe ? [j] : [],
|
|
15803
15827
|
...Se ? [Se] : [],
|
|
15804
|
-
...
|
|
15805
|
-
...
|
|
15806
|
-
...me &&
|
|
15807
|
-
...
|
|
15828
|
+
...lt ? [N] : [],
|
|
15829
|
+
...yt ? [yt] : [],
|
|
15830
|
+
...me && z && he ? [zu(he)] : [],
|
|
15831
|
+
...We ? [ae] : [],
|
|
15808
15832
|
...Ct ? [Ct] : [],
|
|
15809
15833
|
...G ? [G] : [],
|
|
15810
15834
|
...It ? [It] : [],
|
|
@@ -15812,50 +15836,50 @@ function rv(e, n, r) {
|
|
|
15812
15836
|
...At ? [At] : [],
|
|
15813
15837
|
...Ot ? [Ot] : [],
|
|
15814
15838
|
...kt ? [kt] : [],
|
|
15815
|
-
...U &&
|
|
15839
|
+
...U && ut ? [$f({
|
|
15816
15840
|
getBind: () => W()?.bind,
|
|
15817
|
-
getTools: () => X.agent?.allTools ??
|
|
15841
|
+
getTools: () => X.agent?.allTools ?? q
|
|
15818
15842
|
})] : [],
|
|
15819
|
-
...
|
|
15843
|
+
...Wt ? [Wt] : [],
|
|
15820
15844
|
...Lt ? [Lt] : [],
|
|
15821
|
-
...
|
|
15845
|
+
...je ? [je] : [],
|
|
15822
15846
|
...e.middleware || [],
|
|
15823
15847
|
..._e ? [E_(a, {
|
|
15824
15848
|
tokenBudget: e.tokenBudget,
|
|
15825
15849
|
timeBudgetMs: e.timeBudgetMs
|
|
15826
15850
|
}, Y)] : [],
|
|
15827
15851
|
tv(Y, w, W, a)
|
|
15828
|
-
]),
|
|
15829
|
-
function
|
|
15852
|
+
]), an = e.maxMemoryRounds ?? Z_;
|
|
15853
|
+
function on(e) {
|
|
15830
15854
|
return (e) => {
|
|
15831
|
-
e.type !== "approval_request" && Y(
|
|
15855
|
+
e.type !== "approval_request" && Y(De(e));
|
|
15832
15856
|
};
|
|
15833
15857
|
}
|
|
15834
|
-
let
|
|
15835
|
-
function
|
|
15858
|
+
let sn = /* @__PURE__ */ Gt([]), cn = X_(), ln = /* @__PURE__ */ new Set();
|
|
15859
|
+
function un(e) {
|
|
15836
15860
|
let t = new AbortController(), n = () => t.abort();
|
|
15837
|
-
return e && (e.aborted ? t.abort() : e.addEventListener("abort", n, { once: !0 })),
|
|
15861
|
+
return e && (e.aborted ? t.abort() : e.addEventListener("abort", n, { once: !0 })), ln.add(t), {
|
|
15838
15862
|
controller: t,
|
|
15839
15863
|
untrack: () => {
|
|
15840
|
-
|
|
15864
|
+
ln.delete(t), e?.removeEventListener("abort", n);
|
|
15841
15865
|
}
|
|
15842
15866
|
};
|
|
15843
15867
|
}
|
|
15844
|
-
function
|
|
15845
|
-
for (let e of
|
|
15846
|
-
|
|
15868
|
+
function dn() {
|
|
15869
|
+
for (let e of ln) e.abort();
|
|
15870
|
+
ln.clear();
|
|
15847
15871
|
}
|
|
15848
|
-
let
|
|
15872
|
+
let fn = /* @__PURE__ */ Gt(null), X = {
|
|
15849
15873
|
agentId: n,
|
|
15850
15874
|
store: l,
|
|
15851
15875
|
messages: w,
|
|
15852
15876
|
vfsStore: T,
|
|
15853
|
-
listeners:
|
|
15877
|
+
listeners: Kt.listeners,
|
|
15854
15878
|
todosMw: D,
|
|
15855
|
-
memoryMw:
|
|
15879
|
+
memoryMw: N,
|
|
15856
15880
|
missionMw: O,
|
|
15857
|
-
workingMemoryMw:
|
|
15858
|
-
focusMw:
|
|
15881
|
+
workingMemoryMw: oe,
|
|
15882
|
+
focusMw: j,
|
|
15859
15883
|
agent: null,
|
|
15860
15884
|
initDone: Promise.resolve(),
|
|
15861
15885
|
sessionId: "",
|
|
@@ -15863,57 +15887,57 @@ function rv(e, n, r) {
|
|
|
15863
15887
|
mcpClosers: [],
|
|
15864
15888
|
mcpServers: [],
|
|
15865
15889
|
mcpFailed: [],
|
|
15866
|
-
checkpoint:
|
|
15890
|
+
checkpoint: he,
|
|
15867
15891
|
dataOpsController: U,
|
|
15868
|
-
skillsController:
|
|
15892
|
+
skillsController: qt ? qt.controller : null,
|
|
15869
15893
|
infoTick: c,
|
|
15870
15894
|
pendingConflict: o.pendingConflict,
|
|
15871
|
-
pendingQuote:
|
|
15872
|
-
sessions:
|
|
15873
|
-
refreshSessions: () =>
|
|
15895
|
+
pendingQuote: fn,
|
|
15896
|
+
sessions: sn,
|
|
15897
|
+
refreshSessions: () => yn.refreshSessions(),
|
|
15874
15898
|
liveData: W,
|
|
15875
15899
|
usage: a,
|
|
15876
15900
|
emit: Y,
|
|
15877
|
-
runSerial:
|
|
15878
|
-
trackActive:
|
|
15879
|
-
abortAllActive:
|
|
15901
|
+
runSerial: cn,
|
|
15902
|
+
trackActive: un,
|
|
15903
|
+
abortAllActive: dn,
|
|
15880
15904
|
unloadSkillTools(e) {
|
|
15881
15905
|
if (e) {
|
|
15882
|
-
let t =
|
|
15883
|
-
if (
|
|
15906
|
+
let t = $e.length;
|
|
15907
|
+
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
15908
|
} else {
|
|
15885
|
-
if (
|
|
15886
|
-
for (let e of
|
|
15887
|
-
|
|
15909
|
+
if (!$e.length) return;
|
|
15910
|
+
for (let e of $e) K.delete(e.name), et.delete(e.name);
|
|
15911
|
+
$e = [];
|
|
15888
15912
|
}
|
|
15889
|
-
|
|
15913
|
+
q = tt(), X.agent && X.agent.setTools(q);
|
|
15890
15914
|
},
|
|
15891
15915
|
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 &&
|
|
15916
|
+
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
15917
|
let n = t.focus, r = n ? Array.isArray(n) ? n : [n] : [];
|
|
15894
15918
|
if (r.length) {
|
|
15895
15919
|
let t = W()?.schema, n = t ? r.filter((e) => Bs(t, e.path)) : [];
|
|
15896
|
-
if (n.length && (
|
|
15920
|
+
if (n.length && (j.setFocus(null), n.forEach((e) => j.addFocus(M(e)))), e.debug && n.length < r.length) {
|
|
15897
15921
|
let e = r.filter((e) => !n.includes(e)).map((e) => e.path);
|
|
15898
15922
|
console.warn("[page-agent-sdk][focus] 恢复的焦点部分 path 已失效(schema 变化/无 schema),剔除:", e);
|
|
15899
15923
|
}
|
|
15900
15924
|
}
|
|
15901
15925
|
}
|
|
15902
|
-
|
|
15926
|
+
gn();
|
|
15903
15927
|
},
|
|
15904
15928
|
addSkill(e) {
|
|
15905
|
-
let t =
|
|
15906
|
-
t >= 0 ?
|
|
15929
|
+
let t = Yt.findIndex((t) => t.name === e.name);
|
|
15930
|
+
t >= 0 ? Yt[t] = e : Yt.push(e), $t(), Qt && Qt.put(Xt(e));
|
|
15907
15931
|
},
|
|
15908
15932
|
removeSkill(e) {
|
|
15909
|
-
let t =
|
|
15910
|
-
return t < 0 ? !1 : (
|
|
15933
|
+
let t = Yt.findIndex((t) => t.name === e);
|
|
15934
|
+
return t < 0 ? !1 : (Yt.splice(t, 1), $t(), Qt && Qt.remove(e), !0);
|
|
15911
15935
|
},
|
|
15912
15936
|
listUserSkills() {
|
|
15913
|
-
return
|
|
15937
|
+
return Yt.map((e) => e.name);
|
|
15914
15938
|
},
|
|
15915
15939
|
getUserSkill(e) {
|
|
15916
|
-
let t =
|
|
15940
|
+
let t = Yt.find((t) => t.name === e);
|
|
15917
15941
|
if (t) return {
|
|
15918
15942
|
name: t.name,
|
|
15919
15943
|
description: t.description,
|
|
@@ -15921,7 +15945,7 @@ function rv(e, n, r) {
|
|
|
15921
15945
|
};
|
|
15922
15946
|
},
|
|
15923
15947
|
afterRound() {
|
|
15924
|
-
|
|
15948
|
+
_n(), yn.persistRuntime();
|
|
15925
15949
|
},
|
|
15926
15950
|
clearCodeReuse() {
|
|
15927
15951
|
let e = T;
|
|
@@ -15929,10 +15953,10 @@ function rv(e, n, r) {
|
|
|
15929
15953
|
},
|
|
15930
15954
|
async send(e, t) {
|
|
15931
15955
|
if (await X.initDone, X.refCount <= 0) throw Error("page-agent-sdk: agent 已释放(unmount),拒绝排队中的 send");
|
|
15932
|
-
t ??= {}, t?.mission &&
|
|
15956
|
+
t ??= {}, t?.mission && rt && O.setMission(t.mission);
|
|
15933
15957
|
let n = e, r = (t.images ?? []).filter((e) => e && (e.dataUri || e.vfsRef || e.url));
|
|
15934
15958
|
if (r.length > 4) throw Error(`[page-agent-sdk] 单轮最多 4 张图片(收到 ${r.length})`);
|
|
15935
|
-
if (r.length && (await
|
|
15959
|
+
if (r.length && (await vn.stowImages(r), await vn.describeIfNeeded(r, n)), r.length && !g.vision && !r.every((e) => e.description)) {
|
|
15936
15960
|
let e = "当前主模型不支持图片输入(modelCaps.vision=false)。请换多模态模型(gpt-4o/claude/qwen-vl)或 LLMConfig 声明 vision:true;或配置 images.describe 绑定识图转述(集成方识图子 agent / 自有 vision API)";
|
|
15937
15961
|
throw Y({
|
|
15938
15962
|
type: "error",
|
|
@@ -15942,7 +15966,7 @@ function rv(e, n, r) {
|
|
|
15942
15966
|
}), Error(`[page-agent-sdk] ${e}`);
|
|
15943
15967
|
}
|
|
15944
15968
|
T?.setProtectedRefs?.(J_(w));
|
|
15945
|
-
let i = _e ? t.maxAutoRetries ?? 1 : 0, a = 0, s = !1, c =
|
|
15969
|
+
let i = _e ? t.maxAutoRetries ?? 1 : 0, a = 0, s = !1, c = on(t.signal);
|
|
15946
15970
|
if (t.signal) {
|
|
15947
15971
|
let e = () => o.resolve("keep_external");
|
|
15948
15972
|
t.signal.aborted ? e() : t.signal.addEventListener("abort", e, { once: !0 });
|
|
@@ -15959,14 +15983,14 @@ function rv(e, n, r) {
|
|
|
15959
15983
|
...n ? { anchor: n } : {}
|
|
15960
15984
|
};
|
|
15961
15985
|
}
|
|
15962
|
-
let i = e ??
|
|
15986
|
+
let i = e ?? fn.value ?? void 0;
|
|
15963
15987
|
w.push({
|
|
15964
15988
|
role: "user",
|
|
15965
15989
|
content: n,
|
|
15966
15990
|
timestamp: Date.now(),
|
|
15967
15991
|
...r.length ? { images: r } : {},
|
|
15968
15992
|
...i ? { quote: i } : {}
|
|
15969
|
-
}), s = !0, !e &&
|
|
15993
|
+
}), s = !0, !e && fn.value && (fn.value = null);
|
|
15970
15994
|
}
|
|
15971
15995
|
try {
|
|
15972
15996
|
let e = await X.agent.invoke(w, t.signal, c);
|
|
@@ -16002,8 +16026,8 @@ function rv(e, n, r) {
|
|
|
16002
16026
|
...n,
|
|
16003
16027
|
code: "MODEL_UNAVAILABLE",
|
|
16004
16028
|
message: e instanceof Error ? e.message : n.message
|
|
16005
|
-
}), a < i &&
|
|
16006
|
-
a += 1,
|
|
16029
|
+
}), a < i && he?.canRestore()) {
|
|
16030
|
+
a += 1, he.restore(), s = !0, Y({
|
|
16007
16031
|
type: "error",
|
|
16008
16032
|
message: `致命错误自动恢复(${a}/${i}):${n.message},已回退 checkpoint 重试`,
|
|
16009
16033
|
severity: "observable",
|
|
@@ -16028,7 +16052,7 @@ function rv(e, n, r) {
|
|
|
16028
16052
|
async batch(e, t, n) {
|
|
16029
16053
|
if (await X.initDone, !e.length) return [];
|
|
16030
16054
|
if (X.refCount <= 0) throw Error("page-agent-sdk: agent 已释放(unmount),拒绝排队中的 batch");
|
|
16031
|
-
let r = [], i =
|
|
16055
|
+
let r = [], i = on(n);
|
|
16032
16056
|
if (T?.setProtectedRefs?.(J_(w)), n) {
|
|
16033
16057
|
let e = () => o.resolve("keep_external");
|
|
16034
16058
|
n.aborted ? e() : n.addEventListener("abort", e, { once: !0 });
|
|
@@ -16044,7 +16068,7 @@ function rv(e, n, r) {
|
|
|
16044
16068
|
break;
|
|
16045
16069
|
}
|
|
16046
16070
|
let o = e[a];
|
|
16047
|
-
|
|
16071
|
+
he && he.save(`batch:${a}`);
|
|
16048
16072
|
let s = w.length;
|
|
16049
16073
|
try {
|
|
16050
16074
|
w.push({
|
|
@@ -16120,14 +16144,16 @@ function rv(e, n, r) {
|
|
|
16120
16144
|
}
|
|
16121
16145
|
return r;
|
|
16122
16146
|
},
|
|
16123
|
-
switchSession: (e) =>
|
|
16124
|
-
exportSession: (e) =>
|
|
16125
|
-
importSession: (e) =>
|
|
16126
|
-
resetSession: () =>
|
|
16147
|
+
switchSession: (e) => (St.clear(), yn.switchSession(e)),
|
|
16148
|
+
exportSession: (e) => yn.exportSession(e),
|
|
16149
|
+
importSession: (e) => yn.importSession(e),
|
|
16150
|
+
resetSession: () => {
|
|
16151
|
+
St.clear(), yn.resetSession();
|
|
16152
|
+
},
|
|
16127
16153
|
stream: async (e, t, n) => {
|
|
16128
16154
|
if (!X.agent) throw Error("page-agent-sdk: agent 尚未初始化完成,请先 await mount()");
|
|
16129
16155
|
let r = [...e].reverse().find((e) => e.role === "user" && e.images?.length);
|
|
16130
|
-
if (r?.images?.length && (await
|
|
16156
|
+
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
16157
|
let e = "当前主模型不支持图片输入(modelCaps.vision=false)。请换多模态模型(gpt-4o/claude/qwen-vl)或 LLMConfig 声明 vision:true;或配置 images.describe 绑定识图转述";
|
|
16132
16158
|
throw Y({
|
|
16133
16159
|
type: "error",
|
|
@@ -16138,36 +16164,36 @@ function rv(e, n, r) {
|
|
|
16138
16164
|
}
|
|
16139
16165
|
T?.setProtectedRefs?.(J_(e));
|
|
16140
16166
|
let i = (e) => {
|
|
16141
|
-
t?.(
|
|
16167
|
+
t?.(De(e)), Y(De(e)), e.type === "subagent" && (e.kind === "tool_call" || e.kind === "tool_result") && X.infoTick.value++;
|
|
16142
16168
|
};
|
|
16143
16169
|
if (n) {
|
|
16144
16170
|
let e = () => o.resolve("keep_external");
|
|
16145
16171
|
n.aborted ? e() : n.addEventListener("abort", e, { once: !0 });
|
|
16146
16172
|
}
|
|
16147
|
-
let { controller: a, untrack: s } =
|
|
16173
|
+
let { controller: a, untrack: s } = un(n);
|
|
16148
16174
|
return X.agent.stream(e, i, a.signal).finally(s);
|
|
16149
16175
|
},
|
|
16150
16176
|
release() {
|
|
16151
16177
|
if (X.refCount--, X.refCount <= 0) {
|
|
16152
|
-
|
|
16178
|
+
dn(), Ue = !0, l && (T.flush?.(), l.flush(), l.dispose()), Qt && Qt.dispose();
|
|
16153
16179
|
let e = X.mcpClosers.splice(0);
|
|
16154
16180
|
e.length && Promise.allSettled(e.map((e) => e())), Q_.delete(n);
|
|
16155
16181
|
}
|
|
16156
16182
|
},
|
|
16157
16183
|
resolveConflict: o.resolve,
|
|
16158
16184
|
setTools(e) {
|
|
16159
|
-
|
|
16160
|
-
|
|
16161
|
-
}),
|
|
16185
|
+
Ie.length = 0, e.forEach((e) => {
|
|
16186
|
+
Ie.push(e), K.set(e.name, "user");
|
|
16187
|
+
}), q = tt(), X.agent && X.agent.setTools(q), X.infoTick.value++;
|
|
16162
16188
|
},
|
|
16163
16189
|
addTool(e) {
|
|
16164
|
-
|
|
16165
|
-
for (let t =
|
|
16166
|
-
|
|
16190
|
+
q.some((t) => t.name === e.name) && console.warn(`[page-agent-sdk] 工具 "${e.name}" 已存在,新工具覆盖(后注册覆盖先注册)`);
|
|
16191
|
+
for (let t = Ie.length - 1; t >= 0; t--) Ie[t].name === e.name && Ie.splice(t, 1);
|
|
16192
|
+
Ie.push(e), K.set(e.name, "user"), q = tt(), X.agent && X.agent.setTools(q), X.infoTick.value++;
|
|
16167
16193
|
},
|
|
16168
16194
|
removeTool(e) {
|
|
16169
|
-
let t =
|
|
16170
|
-
return t < 0 ? !1 : (
|
|
16195
|
+
let t = Ie.findIndex((t) => t.name === e);
|
|
16196
|
+
return t < 0 ? !1 : (Ie.splice(t, 1), K.delete(e), q = tt(), X.agent && X.agent.setTools(q), X.infoTick.value++, !0);
|
|
16171
16197
|
},
|
|
16172
16198
|
setLlm(t) {
|
|
16173
16199
|
let n;
|
|
@@ -16185,13 +16211,13 @@ function rv(e, n, r) {
|
|
|
16185
16211
|
maxOutputTokens: e.maxOutputTokens ?? r?.maxOutputTokens,
|
|
16186
16212
|
vision: r?.vision ?? t.vision
|
|
16187
16213
|
}), g.contextWindow < 2e5) throw Error(`[page-agent-sdk][setLlm] 新模型上下文窗口 ${g.contextWindow} 小于最小支持 ${p}(需 ≥200K 窗口模型)`);
|
|
16188
|
-
X.agent && (X.agent.setLlm(n), X.agent.setModelCaps?.(g)),
|
|
16214
|
+
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
16215
|
},
|
|
16190
16216
|
setMemory(e) {
|
|
16191
|
-
|
|
16217
|
+
N.reset(e), typeof e == "function" && N.refresh(), X.infoTick.value++;
|
|
16192
16218
|
},
|
|
16193
16219
|
refreshMemory() {
|
|
16194
|
-
return
|
|
16220
|
+
return N.refresh();
|
|
16195
16221
|
},
|
|
16196
16222
|
setSubagents(t) {
|
|
16197
16223
|
if (!jt) {
|
|
@@ -16213,10 +16239,10 @@ function rv(e, n, r) {
|
|
|
16213
16239
|
return n && X.infoTick.value++, n;
|
|
16214
16240
|
},
|
|
16215
16241
|
getActiveSubagents() {
|
|
16216
|
-
return
|
|
16242
|
+
return dt?.getActive() ?? [];
|
|
16217
16243
|
},
|
|
16218
16244
|
get subagentHistory() {
|
|
16219
|
-
return
|
|
16245
|
+
return dt?.getHistory() ?? [];
|
|
16220
16246
|
},
|
|
16221
16247
|
getInfo() {
|
|
16222
16248
|
return {
|
|
@@ -16224,13 +16250,13 @@ function rv(e, n, r) {
|
|
|
16224
16250
|
sessionId: X.sessionId,
|
|
16225
16251
|
model: Ip(C) ? C.model ?? C.modelName : C.model,
|
|
16226
16252
|
systemPrompt: X.agent?.getEffectiveSystemPrompt?.() ?? ye + Sd(W(), e.schemaHint),
|
|
16227
|
-
tools: (X.agent?.allTools ??
|
|
16253
|
+
tools: (X.agent?.allTools ?? q).map((e) => ({
|
|
16228
16254
|
name: e.name,
|
|
16229
16255
|
description: e.description,
|
|
16230
16256
|
schema: e.schema,
|
|
16231
|
-
source:
|
|
16257
|
+
source: K.get(e.name) || "user"
|
|
16232
16258
|
})),
|
|
16233
|
-
skills: (
|
|
16259
|
+
skills: (qt ? qt.controller.get() : e.skills ?? []).map((e) => ({
|
|
16234
16260
|
name: e.name,
|
|
16235
16261
|
description: e.description
|
|
16236
16262
|
})),
|
|
@@ -16244,16 +16270,20 @@ function rv(e, n, r) {
|
|
|
16244
16270
|
summaryThresholdRatio: y.summaryThresholdRatio ?? .5,
|
|
16245
16271
|
promptSoftCap: zl(g.contextWindow, y.promptSoftCapTokens)
|
|
16246
16272
|
},
|
|
16247
|
-
memory:
|
|
16273
|
+
memory: N.get(),
|
|
16248
16274
|
staleReadsInvalidated: X.agent?.getStaleReadsInvalidated?.() ?? 0,
|
|
16249
|
-
hostReadsInvalidated:
|
|
16250
|
-
...
|
|
16275
|
+
hostReadsInvalidated: Bt.readsInvalidated,
|
|
16276
|
+
...Fe ? { proposals: Fe.snapshot() } : {},
|
|
16251
16277
|
...r ? { hostWatch: { ...r } } : {},
|
|
16278
|
+
...e.approval ? { approvals: {
|
|
16279
|
+
remember: e.approval.remember === !0,
|
|
16280
|
+
grantedTools: [...St]
|
|
16281
|
+
} } : {},
|
|
16252
16282
|
llmRetries: X.agent?.getLlmRetries?.() ?? 0,
|
|
16253
16283
|
llmCallFailures: X.agent?.getLlmCallFailures?.() ?? 0,
|
|
16254
16284
|
gates: X.agent?.getGateStats?.(),
|
|
16255
16285
|
systemSegments: X.agent?.getLastSystemSegments?.() ?? [],
|
|
16256
|
-
middleware:
|
|
16286
|
+
middleware: rn.map((e) => e.name),
|
|
16257
16287
|
todos: (X.agent?.getState?.()?.todos ?? []).map((e) => ({
|
|
16258
16288
|
id: e.id,
|
|
16259
16289
|
content: e.content,
|
|
@@ -16264,11 +16294,11 @@ function rv(e, n, r) {
|
|
|
16264
16294
|
...e.evidence === void 0 ? {} : { evidence: e.evidence }
|
|
16265
16295
|
})),
|
|
16266
16296
|
planPhase: D.getPlanPhase(),
|
|
16267
|
-
mission:
|
|
16297
|
+
mission: rt ? O.getMission() : void 0,
|
|
16268
16298
|
planConfirmation: ne.lastPlanConfirmation,
|
|
16269
|
-
workingMemory:
|
|
16270
|
-
focus:
|
|
16271
|
-
focuses:
|
|
16299
|
+
workingMemory: it ? oe.getWorkingMemory() : void 0,
|
|
16300
|
+
focus: qe ? j.getFocus() : void 0,
|
|
16301
|
+
focuses: qe ? j.getFocuses() : [],
|
|
16272
16302
|
actions: k_(e.actions ?? {}),
|
|
16273
16303
|
subagent: {
|
|
16274
16304
|
enabled: !!Tt,
|
|
@@ -16277,14 +16307,14 @@ function rv(e, n, r) {
|
|
|
16277
16307
|
timeoutMs: e.subagent?.timeoutMs === void 0 ? 18e5 : e.subagent.timeoutMs > 0 ? e.subagent.timeoutMs : 0,
|
|
16278
16308
|
allowedTools: e.subagent?.allowedTools ?? [],
|
|
16279
16309
|
subagents: (jt?.get() ?? []).map(Mt),
|
|
16280
|
-
active:
|
|
16281
|
-
history:
|
|
16310
|
+
active: dt?.getActive() ?? [],
|
|
16311
|
+
history: dt?.getHistory() ?? [],
|
|
16282
16312
|
lockedComponents: Dt?.locked() ?? {}
|
|
16283
16313
|
},
|
|
16284
16314
|
verify: {
|
|
16285
16315
|
enabled: !!It,
|
|
16286
|
-
maxAttempts:
|
|
16287
|
-
adversarial:
|
|
16316
|
+
maxAttempts: ht ? ft : 0,
|
|
16317
|
+
adversarial: ht && !!e.verify?.adversarial
|
|
16288
16318
|
},
|
|
16289
16319
|
context: (() => {
|
|
16290
16320
|
let e = Lt?.getSnapshot();
|
|
@@ -16299,10 +16329,10 @@ function rv(e, n, r) {
|
|
|
16299
16329
|
...X.mcpFailed.length ? { failed: X.mcpFailed } : {}
|
|
16300
16330
|
},
|
|
16301
16331
|
lastCompression: X.agent?.getState?.()?.lastCompression,
|
|
16302
|
-
checkpoints:
|
|
16332
|
+
checkpoints: he ? {
|
|
16303
16333
|
enabled: !0,
|
|
16304
|
-
auto:
|
|
16305
|
-
list:
|
|
16334
|
+
auto: z,
|
|
16335
|
+
list: he.list()
|
|
16306
16336
|
} : void 0
|
|
16307
16337
|
};
|
|
16308
16338
|
},
|
|
@@ -16340,41 +16370,41 @@ function rv(e, n, r) {
|
|
|
16340
16370
|
}));
|
|
16341
16371
|
},
|
|
16342
16372
|
getMission() {
|
|
16343
|
-
return
|
|
16373
|
+
return rt ? O.getMission() : void 0;
|
|
16344
16374
|
},
|
|
16345
16375
|
setMission(t) {
|
|
16346
|
-
if (!
|
|
16376
|
+
if (!rt) {
|
|
16347
16377
|
e.debug && console.warn("[page-agent-sdk][mission] capabilities.missionAnchor 关闭,setMission 忽略");
|
|
16348
16378
|
return;
|
|
16349
16379
|
}
|
|
16350
16380
|
O.setMission(t), X.infoTick.value++;
|
|
16351
16381
|
},
|
|
16352
16382
|
getFocus() {
|
|
16353
|
-
return
|
|
16383
|
+
return qe ? j.getFocus() : void 0;
|
|
16354
16384
|
},
|
|
16355
16385
|
getFocuses() {
|
|
16356
|
-
return
|
|
16386
|
+
return qe ? j.getFocuses() : [];
|
|
16357
16387
|
},
|
|
16358
16388
|
setFocus(t) {
|
|
16359
|
-
let n = nv(t, "setFocus",
|
|
16360
|
-
return n.ok ? (
|
|
16389
|
+
let n = nv(t, "setFocus", qe, () => W()?.schema, e.debug);
|
|
16390
|
+
return n.ok ? (j.setFocus(M(t)), e.debug && j.isInvokeActive() && console.info("[page-agent-sdk][focus] 在途流程进行中,聚焦将在下一次输入生效(当前流程不受影响)"), X.infoTick.value++, { ok: !0 }) : n;
|
|
16361
16391
|
},
|
|
16362
16392
|
addFocus(t) {
|
|
16363
|
-
let n = nv(t, "addFocus",
|
|
16364
|
-
return n.ok ?
|
|
16393
|
+
let n = nv(t, "addFocus", qe, () => W()?.schema, e.debug);
|
|
16394
|
+
return n.ok ? j.getFocuses().length >= 8 ? (e.debug && console.warn("[page-agent-sdk][focus] addFocus 拒绝:焦点数已达上限 8(augmentPrompt 注入每焦点子树 schema,过多致 system prompt 超预算)"), {
|
|
16365
16395
|
ok: !1,
|
|
16366
16396
|
error: "焦点数上限 8(避免 system prompt 撑爆)"
|
|
16367
|
-
}) : (
|
|
16397
|
+
}) : (j.addFocus(M(t)), e.debug && j.isInvokeActive() && console.info("[page-agent-sdk][focus] 在途流程进行中,聚焦将在下一次输入生效(当前流程不受影响)"), X.infoTick.value++, { ok: !0 }) : n;
|
|
16368
16398
|
},
|
|
16369
16399
|
removeFocus(e) {
|
|
16370
|
-
|
|
16400
|
+
qe && (j.removeFocus(e), X.infoTick.value++);
|
|
16371
16401
|
},
|
|
16372
16402
|
clearFocus() {
|
|
16373
|
-
|
|
16403
|
+
qe && (j.clearFocus(), X.infoTick.value++);
|
|
16374
16404
|
},
|
|
16375
16405
|
setQuote(e, t, n) {
|
|
16376
16406
|
let r = Ni(e ?? ""), i = qi(n);
|
|
16377
|
-
|
|
16407
|
+
fn.value = r ? {
|
|
16378
16408
|
text: r,
|
|
16379
16409
|
...t ? { source: t } : {},
|
|
16380
16410
|
...i ? { anchor: i } : {}
|
|
@@ -16382,28 +16412,36 @@ function rv(e, n, r) {
|
|
|
16382
16412
|
},
|
|
16383
16413
|
notifyHostChange(e) {
|
|
16384
16414
|
let t = typeof e?.reason == "string" ? e.reason.trim().slice(0, 200) : "";
|
|
16385
|
-
|
|
16415
|
+
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
16416
|
timestamp: Date.now(),
|
|
16387
16417
|
type: "middleware",
|
|
16388
16418
|
data: {
|
|
16389
16419
|
stage: "host_change_notified",
|
|
16390
|
-
epoch:
|
|
16420
|
+
epoch: Bt.epoch,
|
|
16391
16421
|
reason: t || void 0
|
|
16392
16422
|
}
|
|
16393
16423
|
}), X.infoTick.value++;
|
|
16394
16424
|
},
|
|
16395
16425
|
clearQuote() {
|
|
16396
|
-
|
|
16426
|
+
fn.value = null;
|
|
16427
|
+
},
|
|
16428
|
+
revokeApprovalGrants() {
|
|
16429
|
+
let e = St.size > 0;
|
|
16430
|
+
St.clear(), e && (X.agent?.debugLogs?.value?.push({
|
|
16431
|
+
timestamp: Date.now(),
|
|
16432
|
+
type: "middleware",
|
|
16433
|
+
data: { stage: "approval_grants_revoked" }
|
|
16434
|
+
}), X.infoTick.value++);
|
|
16397
16435
|
},
|
|
16398
16436
|
resolveProposal(e, t, n) {
|
|
16399
|
-
let r =
|
|
16437
|
+
let r = Fe ? Fe.resolve(e, t, n) : !1;
|
|
16400
16438
|
return r && X.infoTick.value++, r;
|
|
16401
16439
|
},
|
|
16402
16440
|
getProposals() {
|
|
16403
|
-
return
|
|
16441
|
+
return Fe ? Fe.snapshot() : null;
|
|
16404
16442
|
}
|
|
16405
16443
|
};
|
|
16406
|
-
async function
|
|
16444
|
+
async function pn() {
|
|
16407
16445
|
if (!l) return;
|
|
16408
16446
|
let t = async (e) => {
|
|
16409
16447
|
try {
|
|
@@ -16457,12 +16495,12 @@ function rv(e, n, r) {
|
|
|
16457
16495
|
}), 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
16496
|
} else X.sessionId = await l.createSession(n, a.title), e.debug && console.log("[page-agent-sdk][restore] 新建会话(无历史)", X.sessionId);
|
|
16459
16497
|
} else X.sessionId = await l.createSession(n, a.title);
|
|
16460
|
-
e.memory &&
|
|
16498
|
+
e.memory && yn.persistSave({ memory: N.get() || (typeof e.memory == "string" ? e.memory : "") }), yn.refreshSessions();
|
|
16461
16499
|
}
|
|
16462
|
-
async function
|
|
16463
|
-
await
|
|
16500
|
+
async function mn() {
|
|
16501
|
+
await en();
|
|
16464
16502
|
}
|
|
16465
|
-
function
|
|
16503
|
+
function hn(e) {
|
|
16466
16504
|
let t = {};
|
|
16467
16505
|
for (let n of J_(e)) {
|
|
16468
16506
|
let e = T.files[n];
|
|
@@ -16470,12 +16508,12 @@ function rv(e, n, r) {
|
|
|
16470
16508
|
}
|
|
16471
16509
|
return t;
|
|
16472
16510
|
}
|
|
16473
|
-
function
|
|
16511
|
+
function gn() {
|
|
16474
16512
|
let e = Y_(T.files, J_(w));
|
|
16475
16513
|
for (let t of e) delete T.files[t];
|
|
16476
16514
|
}
|
|
16477
|
-
function
|
|
16478
|
-
let e = Dl(w,
|
|
16515
|
+
function _n() {
|
|
16516
|
+
let e = Dl(w, an);
|
|
16479
16517
|
if (!e.trimmed) return;
|
|
16480
16518
|
let { older: t, summary: n } = e;
|
|
16481
16519
|
if (Y({
|
|
@@ -16486,60 +16524,60 @@ function rv(e, n, r) {
|
|
|
16486
16524
|
assistant: e.assistantMsgs.map((e) => e.content),
|
|
16487
16525
|
steps: e.assistantMsgs.flatMap((e) => e.steps ?? [])
|
|
16488
16526
|
})),
|
|
16489
|
-
vfsResults:
|
|
16527
|
+
vfsResults: hn(t.flatMap((e) => [e.userMsg, ...e.assistantMsgs])),
|
|
16490
16528
|
summary: n.content,
|
|
16491
16529
|
reason: "max_memory_rounds"
|
|
16492
|
-
}), w.splice(e.deleteFrom, e.deleteCount, n),
|
|
16530
|
+
}), w.splice(e.deleteFrom, e.deleteCount, n), gn(), b && d) {
|
|
16493
16531
|
let n = e.summary, { prevSeg: r } = e;
|
|
16494
16532
|
(async () => {
|
|
16495
16533
|
try {
|
|
16496
16534
|
let e = await d(Pl(t, S)), i = w.indexOf(n);
|
|
16497
16535
|
if (i < 0) return;
|
|
16498
|
-
w[i].content = El(t, r, e),
|
|
16536
|
+
w[i].content = El(t, r, e), yn.persistRuntime();
|
|
16499
16537
|
} catch {}
|
|
16500
16538
|
})();
|
|
16501
16539
|
}
|
|
16502
16540
|
}
|
|
16503
|
-
let
|
|
16541
|
+
let vn = ki({
|
|
16504
16542
|
getConfig: () => e.images,
|
|
16505
16543
|
getVision: () => g.vision === !0,
|
|
16506
16544
|
emit: Y,
|
|
16507
16545
|
getVfsStore: () => X.vfsStore,
|
|
16508
|
-
noteFailure: (e, t) =>
|
|
16509
|
-
}),
|
|
16546
|
+
noteFailure: (e, t) => yn.notePersistFailure(e, t)
|
|
16547
|
+
}), yn = Fm({
|
|
16510
16548
|
agentId: n,
|
|
16511
16549
|
options: e,
|
|
16512
16550
|
emit: Y,
|
|
16513
16551
|
getStore: () => l,
|
|
16514
16552
|
core: X,
|
|
16515
|
-
sessionsRef:
|
|
16553
|
+
sessionsRef: sn,
|
|
16516
16554
|
sessionVars: ne,
|
|
16517
16555
|
messages: w,
|
|
16518
16556
|
getUsage: () => a,
|
|
16519
16557
|
mw: {
|
|
16520
16558
|
todosMw: D,
|
|
16521
|
-
memoryMw:
|
|
16559
|
+
memoryMw: N,
|
|
16522
16560
|
missionMw: O,
|
|
16523
|
-
workingMemoryMw:
|
|
16524
|
-
focusMw:
|
|
16525
|
-
summarizationMw:
|
|
16561
|
+
workingMemoryMw: oe,
|
|
16562
|
+
focusMw: j,
|
|
16563
|
+
summarizationMw: tn,
|
|
16526
16564
|
resumeNoticeMw: te,
|
|
16527
|
-
useMission:
|
|
16528
|
-
useWorkingMemory:
|
|
16529
|
-
useFocus:
|
|
16565
|
+
useMission: rt,
|
|
16566
|
+
useWorkingMemory: it,
|
|
16567
|
+
useFocus: qe,
|
|
16530
16568
|
useAutomation: _e
|
|
16531
16569
|
},
|
|
16532
16570
|
vfsStore: T,
|
|
16533
|
-
checkpointMgr:
|
|
16571
|
+
checkpointMgr: he,
|
|
16534
16572
|
conflictResolve: (e) => o.resolve(e),
|
|
16535
|
-
abortAllActive:
|
|
16573
|
+
abortAllActive: dn,
|
|
16536
16574
|
titleLlmInvoke: f
|
|
16537
16575
|
});
|
|
16538
16576
|
return X.initDone = (async () => {
|
|
16539
|
-
await
|
|
16577
|
+
await pn(), await mn(), e.mcp?.length && pd({
|
|
16540
16578
|
servers: e.mcp,
|
|
16541
16579
|
emit: Y,
|
|
16542
|
-
isReleased: () =>
|
|
16580
|
+
isReleased: () => Ue,
|
|
16543
16581
|
core: {
|
|
16544
16582
|
mcpClosers: X.mcpClosers,
|
|
16545
16583
|
mcpServers: X.mcpServers,
|
|
@@ -16548,15 +16586,15 @@ function rv(e, n, r) {
|
|
|
16548
16586
|
},
|
|
16549
16587
|
reservedNames: () => {
|
|
16550
16588
|
let e = /* @__PURE__ */ new Set();
|
|
16551
|
-
for (let t of
|
|
16552
|
-
let n =
|
|
16589
|
+
for (let t of q) {
|
|
16590
|
+
let n = K.get(t.name);
|
|
16553
16591
|
n && !n.startsWith("mcp:") && e.add(t.name);
|
|
16554
16592
|
}
|
|
16555
16593
|
return e;
|
|
16556
16594
|
},
|
|
16557
|
-
pushTool: (e, t) => (
|
|
16595
|
+
pushTool: (e, t) => (K.set(e.name, `mcp:${t}`), He.push(e), !0),
|
|
16558
16596
|
rebind: () => {
|
|
16559
|
-
|
|
16597
|
+
q = tt(), X.agent && X.agent.setTools(q), X.infoTick.value++;
|
|
16560
16598
|
},
|
|
16561
16599
|
debug: e.debug
|
|
16562
16600
|
});
|
|
@@ -16564,13 +16602,13 @@ function rv(e, n, r) {
|
|
|
16564
16602
|
Rp(t, { emit: Y }), X.agent = Is({
|
|
16565
16603
|
llm: t,
|
|
16566
16604
|
systemPrompt: ye,
|
|
16567
|
-
tools:
|
|
16568
|
-
middleware:
|
|
16605
|
+
tools: q,
|
|
16606
|
+
middleware: rn,
|
|
16569
16607
|
maxToolRounds: e.maxToolRounds,
|
|
16570
|
-
hasSubagent:
|
|
16571
|
-
pageAssertionGate:
|
|
16572
|
-
pageReadTools:
|
|
16573
|
-
deferredWriteTools:
|
|
16608
|
+
hasSubagent: ut,
|
|
16609
|
+
pageAssertionGate: B.domInspect === !0,
|
|
16610
|
+
pageReadTools: Be.size ? Be : void 0,
|
|
16611
|
+
deferredWriteTools: Ve.size ? Ve : void 0,
|
|
16574
16612
|
maxRetries: e.maxRetries,
|
|
16575
16613
|
stallMs: e.streamStallMs ?? 9e4,
|
|
16576
16614
|
streamMaxMs: e.streamMaxDurationMs ?? 18e5,
|
|
@@ -16579,16 +16617,16 @@ function rv(e, n, r) {
|
|
|
16579
16617
|
contextWindow: g.contextWindow,
|
|
16580
16618
|
maxOutputTokens: g.maxOutputTokens,
|
|
16581
16619
|
vision: g.vision,
|
|
16582
|
-
imageContentFormat:
|
|
16583
|
-
maxVerifyAttempts:
|
|
16620
|
+
imageContentFormat: Ae,
|
|
16621
|
+
maxVerifyAttempts: ht ? ft : 0,
|
|
16584
16622
|
roundTokenBudget: e.roundTokenBudget ?? 0,
|
|
16585
16623
|
staleReadInvalidation: e.staleReadInvalidation,
|
|
16586
16624
|
onLlmChange: (e) => {
|
|
16587
16625
|
C = e;
|
|
16588
16626
|
},
|
|
16589
16627
|
debug: e.debug
|
|
16590
|
-
}),
|
|
16591
|
-
X.agent && X.agent.setTools(
|
|
16628
|
+
}), se.current = X.agent, At && At.setReconfigureHook(() => {
|
|
16629
|
+
X.agent && X.agent.setTools(tt());
|
|
16592
16630
|
});
|
|
16593
16631
|
})(), X;
|
|
16594
16632
|
}
|
|
@@ -16738,6 +16776,7 @@ function iv(e, t) {
|
|
|
16738
16776
|
setQuote: c.setQuote,
|
|
16739
16777
|
clearQuote: c.clearQuote,
|
|
16740
16778
|
notifyHostChange: c.notifyHostChange,
|
|
16779
|
+
revokeApprovalGrants: c.revokeApprovalGrants,
|
|
16741
16780
|
resolveProposal: c.resolveProposal,
|
|
16742
16781
|
get proposals() {
|
|
16743
16782
|
return c.getProposals();
|
|
@@ -17053,7 +17092,7 @@ async function hv(e) {
|
|
|
17053
17092
|
//#region src/core/composables/useChat.ts
|
|
17054
17093
|
var gv = 4e3;
|
|
17055
17094
|
function _v(e = {}) {
|
|
17056
|
-
let { fetchResponse: t, fetchStream: n, onPersist: r, onClear: i, onQueuedCleared: a, onBeforeRegenerate: o } = e, s = /* @__PURE__ */
|
|
17095
|
+
let { fetchResponse: t, fetchStream: n, onPersist: r, onClear: i, onQueuedCleared: a, onBeforeRegenerate: o } = e, s = /* @__PURE__ */ Nt({
|
|
17057
17096
|
messages: e.messages ?? [],
|
|
17058
17097
|
loading: !1,
|
|
17059
17098
|
error: null
|
|
@@ -17082,7 +17121,7 @@ function _v(e = {}) {
|
|
|
17082
17121
|
async function v(e) {
|
|
17083
17122
|
let r = ++d;
|
|
17084
17123
|
if (l.value = !0, n) {
|
|
17085
|
-
let t = /* @__PURE__ */
|
|
17124
|
+
let t = /* @__PURE__ */ Nt({
|
|
17086
17125
|
role: "assistant",
|
|
17087
17126
|
content: "",
|
|
17088
17127
|
timestamp: Date.now(),
|
|
@@ -17155,7 +17194,8 @@ function _v(e = {}) {
|
|
|
17155
17194
|
toolName: e.toolName,
|
|
17156
17195
|
args: e.args,
|
|
17157
17196
|
resolve: e.resolve,
|
|
17158
|
-
...e.preview ? { preview: e.preview } : {}
|
|
17197
|
+
...e.preview ? { preview: e.preview } : {},
|
|
17198
|
+
...e.remember ? { remember: !0 } : {}
|
|
17159
17199
|
};
|
|
17160
17200
|
break;
|
|
17161
17201
|
}
|
|
@@ -17380,6 +17420,8 @@ var bv = {
|
|
|
17380
17420
|
recommendPrefix: " 推荐:",
|
|
17381
17421
|
approve: "允许",
|
|
17382
17422
|
deny: "拒绝",
|
|
17423
|
+
approveRemember: "允许并不再询问",
|
|
17424
|
+
approveRememberHint: "允许本次,且本会话内不再询问此工具的调用(切换会话或重置后恢复询问)",
|
|
17383
17425
|
toolConfirmPrefix: "需确认工具调用:",
|
|
17384
17426
|
viewArgs: "查看参数",
|
|
17385
17427
|
collapseArgs: "收起参数",
|
|
@@ -17618,6 +17660,8 @@ var bv = {
|
|
|
17618
17660
|
recommendPrefix: " Recommend:",
|
|
17619
17661
|
approve: "Allow",
|
|
17620
17662
|
deny: "Deny",
|
|
17663
|
+
approveRemember: "Allow & don't ask again",
|
|
17664
|
+
approveRememberHint: "Allow now and skip confirmation for this tool until the session ends (switch/reset restores asking)",
|
|
17621
17665
|
toolConfirmPrefix: "Confirm tool call:",
|
|
17622
17666
|
viewArgs: "View args",
|
|
17623
17667
|
collapseArgs: "Collapse args",
|
|
@@ -17837,7 +17881,7 @@ function wv(e = {}) {
|
|
|
17837
17881
|
minute: "2-digit"
|
|
17838
17882
|
}), w = () => {
|
|
17839
17883
|
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 &&
|
|
17884
|
+
!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
17885
|
}, T = /* @__PURE__ */ Gt([]), E = /* @__PURE__ */ Gt(""), D = /* @__PURE__ */ Gt(!1), O, k = (e) => {
|
|
17842
17886
|
E.value = e, clearTimeout(O), O = setTimeout(() => {
|
|
17843
17887
|
E.value = "";
|
|
@@ -17863,24 +17907,24 @@ function wv(e = {}) {
|
|
|
17863
17907
|
}
|
|
17864
17908
|
}, te = (e) => {
|
|
17865
17909
|
T.value = T.value.filter((t) => t.id !== e);
|
|
17866
|
-
}, ne = ri(() => e.pendingQuote?.value ?? null),
|
|
17910
|
+
}, ne = ri(() => e.pendingQuote?.value ?? null), A = (t) => {
|
|
17867
17911
|
e.onSetQuote?.(t);
|
|
17868
|
-
},
|
|
17912
|
+
}, re = () => {
|
|
17869
17913
|
e.onClearQuote?.();
|
|
17870
|
-
},
|
|
17914
|
+
}, ie = (e) => {
|
|
17871
17915
|
e.isComposing || e.keyCode === 229 || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), w());
|
|
17872
|
-
},
|
|
17916
|
+
}, ae = (e) => {
|
|
17873
17917
|
o.value = a.value[e] || "", i(e);
|
|
17874
|
-
},
|
|
17875
|
-
e.role === "user" && (n.loading && t.stop(),
|
|
17876
|
-
},
|
|
17877
|
-
|
|
17878
|
-
},
|
|
17879
|
-
let r =
|
|
17880
|
-
if (
|
|
17918
|
+
}, j = /* @__PURE__ */ Gt(null), M = (e) => {
|
|
17919
|
+
e.role === "user" && (n.loading && t.stop(), j.value = e);
|
|
17920
|
+
}, oe = () => {
|
|
17921
|
+
j.value = null;
|
|
17922
|
+
}, N = (e) => {
|
|
17923
|
+
let r = j.value;
|
|
17924
|
+
if (j.value = null, !r) return;
|
|
17881
17925
|
let i = n.messages.indexOf(r);
|
|
17882
17926
|
i < 0 || t.editAndResend(i, e);
|
|
17883
|
-
},
|
|
17927
|
+
}, se = (e) => {
|
|
17884
17928
|
let t = n.messages, r = t[e];
|
|
17885
17929
|
if (!r || r.role !== "assistant") return !1;
|
|
17886
17930
|
let i = "reasoning" in r ? r.reasoning : void 0, a = "steps" in r ? r.steps : void 0;
|
|
@@ -17916,21 +17960,21 @@ function wv(e = {}) {
|
|
|
17916
17960
|
undo: S,
|
|
17917
17961
|
formatTime: C,
|
|
17918
17962
|
send: w,
|
|
17919
|
-
keydown:
|
|
17963
|
+
keydown: ie,
|
|
17920
17964
|
pendingImages: T,
|
|
17921
17965
|
addImageFiles: ee,
|
|
17922
17966
|
removePendingImage: te,
|
|
17923
17967
|
imageInputError: E,
|
|
17924
17968
|
compressingImages: D,
|
|
17925
17969
|
quote: ne,
|
|
17926
|
-
setQuote:
|
|
17927
|
-
clearQuote:
|
|
17928
|
-
editQueued:
|
|
17929
|
-
editingMessage:
|
|
17930
|
-
startEdit:
|
|
17931
|
-
cancelEdit:
|
|
17932
|
-
submitEdit:
|
|
17933
|
-
isPendingAssistant:
|
|
17970
|
+
setQuote: A,
|
|
17971
|
+
clearQuote: re,
|
|
17972
|
+
editQueued: ae,
|
|
17973
|
+
editingMessage: j,
|
|
17974
|
+
startEdit: M,
|
|
17975
|
+
cancelEdit: oe,
|
|
17976
|
+
submitEdit: N,
|
|
17977
|
+
isPendingAssistant: se,
|
|
17934
17978
|
focuses: P,
|
|
17935
17979
|
planConfirmation: F,
|
|
17936
17980
|
addFocus: I,
|
|
@@ -17954,4 +17998,4 @@ function Ev(e) {
|
|
|
17954
17998
|
return iv(e);
|
|
17955
17999
|
}
|
|
17956
18000
|
//#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,
|
|
18001
|
+
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 };
|