page-agent-sdk 4.26.1 → 4.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/dist/page-agent-sdk.headless.js +1147 -1064
- package/dist/page-agent-sdk.iife.js +30 -29
- package/dist/page-agent-sdk.js +1921 -1838
- package/dist/page-agent-sdk.legacy.js +8936 -8851
- package/dist/page-agent-sdk.umd.cjs +42 -41
- package/package.json +1 -1
- package/types/headless.d.ts +8 -1
- package/types/index.d.ts +8 -1
|
@@ -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" && re(e)) return e;
|
|
466
466
|
}
|
|
467
|
-
function
|
|
467
|
+
function re(e) {
|
|
468
468
|
return [
|
|
469
469
|
"prompt_tokens",
|
|
470
470
|
"completion_tokens",
|
|
@@ -478,7 +478,7 @@ function A(e) {
|
|
|
478
478
|
"outputTokens"
|
|
479
479
|
].some((t) => typeof e[t] == "number" && e[t] > 0);
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function ie(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 re(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 ae(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 oe = process.env.NODE_ENV === "production" ? {} : Object.freeze({});
|
|
505
505
|
process.env.NODE_ENV === "production" || Object.freeze([]);
|
|
506
|
-
var
|
|
506
|
+
var A = () => {}, j = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && (e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97), se = (e) => e.startsWith("onUpdate:"), M = Object.assign, ce = (e, t) => {
|
|
507
507
|
let n = e.indexOf(t);
|
|
508
508
|
n > -1 && e.splice(n, 1);
|
|
509
|
-
},
|
|
509
|
+
}, N = Object.prototype.hasOwnProperty, P = (e, t) => N.call(e, t), F = Array.isArray, le = (e) => he(e) === "[object Map]", ue = (e) => he(e) === "[object Set]", I = (e) => typeof e == "function", de = (e) => typeof e == "string", fe = (e) => typeof e == "symbol", L = (e) => typeof e == "object" && !!e, pe = (e) => (L(e) || I(e)) && I(e.then) && I(e.catch), me = Object.prototype.toString, he = (e) => me.call(e), R = (e) => he(e).slice(8, -1), z = (e) => he(e) === "[object Object]", B = (e) => de(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) => {
|
|
@@ -518,14 +518,14 @@ var j = () => {}, M = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110
|
|
|
518
518
|
});
|
|
519
519
|
}, ve, ye = () => ve ||= typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {};
|
|
520
520
|
function H(e) {
|
|
521
|
-
if (
|
|
521
|
+
if (F(e)) {
|
|
522
522
|
let t = {};
|
|
523
523
|
for (let n = 0; n < e.length; n++) {
|
|
524
|
-
let r = e[n], i =
|
|
524
|
+
let r = e[n], i = de(r) ? Se(r) : H(r);
|
|
525
525
|
if (i) for (let e in i) t[e] = i[e];
|
|
526
526
|
}
|
|
527
527
|
return t;
|
|
528
|
-
} else if (
|
|
528
|
+
} else if (de(e) || L(e)) return e;
|
|
529
529
|
}
|
|
530
530
|
var be = /;(?![^(]*\))/g, U = /:([^]+)/, xe = /\/\*[^]*?\*\//g;
|
|
531
531
|
function Se(e) {
|
|
@@ -539,12 +539,12 @@ function Se(e) {
|
|
|
539
539
|
}
|
|
540
540
|
function W(e) {
|
|
541
541
|
let t = "";
|
|
542
|
-
if (
|
|
543
|
-
else if (
|
|
542
|
+
if (de(e)) t = e;
|
|
543
|
+
else if (F(e)) for (let n = 0; n < e.length; n++) {
|
|
544
544
|
let r = W(e[n]);
|
|
545
545
|
r && (t += r + " ");
|
|
546
546
|
}
|
|
547
|
-
else if (
|
|
547
|
+
else if (L(e)) for (let n in e) e[n] && (t += n + " ");
|
|
548
548
|
return t.trim();
|
|
549
549
|
}
|
|
550
550
|
//#endregion
|
|
@@ -708,7 +708,7 @@ var We = 0, Ge = class {
|
|
|
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(M({ effect: G }, e)), t;
|
|
712
712
|
}
|
|
713
713
|
trigger(e) {
|
|
714
714
|
this.version++, We++, this.notify(e);
|
|
@@ -716,7 +716,7 @@ var We = 0, Ge = class {
|
|
|
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(M({ 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();
|
|
@@ -765,103 +765,103 @@ function $e(e, t, n, r, i, a) {
|
|
|
765
765
|
};
|
|
766
766
|
if (je(), t === "clear") o.forEach(s);
|
|
767
767
|
else {
|
|
768
|
-
let i =
|
|
768
|
+
let i = F(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 === Ze || !
|
|
772
|
+
(n === "length" || n === Ze || !fe(n) && n >= e) && s(t);
|
|
773
773
|
});
|
|
774
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(Ye)),
|
|
776
|
+
i ? a && s(o.get("length")) : (s(o.get(Ye)), le(e) && s(o.get(Xe)));
|
|
777
777
|
break;
|
|
778
778
|
case "delete":
|
|
779
|
-
i || (s(o.get(Ye)),
|
|
779
|
+
i || (s(o.get(Ye)), le(e) && s(o.get(Xe)));
|
|
780
780
|
break;
|
|
781
781
|
case "set":
|
|
782
|
-
|
|
782
|
+
le(e) && s(o.get(Ye));
|
|
783
783
|
break;
|
|
784
784
|
}
|
|
785
785
|
}
|
|
786
786
|
Me();
|
|
787
787
|
}
|
|
788
788
|
function et(e) {
|
|
789
|
-
let t = /* @__PURE__ */
|
|
790
|
-
return t === e ? t : (Qe(t, "iterate", Ze), /* @__PURE__ */
|
|
789
|
+
let t = /* @__PURE__ */ q(e);
|
|
790
|
+
return t === e ? t : (Qe(t, "iterate", Ze), /* @__PURE__ */ Bt(e) ? t : t.map(Ut));
|
|
791
791
|
}
|
|
792
792
|
function tt(e) {
|
|
793
|
-
return Qe(e = /* @__PURE__ */
|
|
793
|
+
return Qe(e = /* @__PURE__ */ q(e), "iterate", Ze), e;
|
|
794
794
|
}
|
|
795
|
-
function
|
|
796
|
-
return /* @__PURE__ */
|
|
795
|
+
function nt(e, t) {
|
|
796
|
+
return /* @__PURE__ */ zt(e) ? Wt(/* @__PURE__ */ Rt(e) ? Ut(t) : t) : Ut(t);
|
|
797
797
|
}
|
|
798
|
-
var
|
|
798
|
+
var rt = {
|
|
799
799
|
__proto__: null,
|
|
800
800
|
[Symbol.iterator]() {
|
|
801
|
-
return
|
|
801
|
+
return it(this, Symbol.iterator, (e) => nt(this, e));
|
|
802
802
|
},
|
|
803
803
|
concat(...e) {
|
|
804
|
-
return et(this).concat(...e.map((e) =>
|
|
804
|
+
return et(this).concat(...e.map((e) => F(e) ? et(e) : e));
|
|
805
805
|
},
|
|
806
806
|
entries() {
|
|
807
|
-
return
|
|
807
|
+
return it(this, "entries", (e) => (e[1] = nt(this, e[1]), e));
|
|
808
808
|
},
|
|
809
809
|
every(e, t) {
|
|
810
|
-
return
|
|
810
|
+
return ot(this, "every", e, t, void 0, arguments);
|
|
811
811
|
},
|
|
812
812
|
filter(e, t) {
|
|
813
|
-
return
|
|
813
|
+
return ot(this, "filter", e, t, (e) => e.map((e) => nt(this, e)), arguments);
|
|
814
814
|
},
|
|
815
815
|
find(e, t) {
|
|
816
|
-
return
|
|
816
|
+
return ot(this, "find", e, t, (e) => nt(this, e), arguments);
|
|
817
817
|
},
|
|
818
818
|
findIndex(e, t) {
|
|
819
|
-
return
|
|
819
|
+
return ot(this, "findIndex", e, t, void 0, arguments);
|
|
820
820
|
},
|
|
821
821
|
findLast(e, t) {
|
|
822
|
-
return
|
|
822
|
+
return ot(this, "findLast", e, t, (e) => nt(this, e), arguments);
|
|
823
823
|
},
|
|
824
824
|
findLastIndex(e, t) {
|
|
825
|
-
return
|
|
825
|
+
return ot(this, "findLastIndex", e, t, void 0, arguments);
|
|
826
826
|
},
|
|
827
827
|
forEach(e, t) {
|
|
828
|
-
return
|
|
828
|
+
return ot(this, "forEach", e, t, void 0, arguments);
|
|
829
829
|
},
|
|
830
830
|
includes(...e) {
|
|
831
|
-
return
|
|
831
|
+
return ct(this, "includes", e);
|
|
832
832
|
},
|
|
833
833
|
indexOf(...e) {
|
|
834
|
-
return
|
|
834
|
+
return ct(this, "indexOf", e);
|
|
835
835
|
},
|
|
836
836
|
join(e) {
|
|
837
837
|
return et(this).join(e);
|
|
838
838
|
},
|
|
839
839
|
lastIndexOf(...e) {
|
|
840
|
-
return
|
|
840
|
+
return ct(this, "lastIndexOf", e);
|
|
841
841
|
},
|
|
842
842
|
map(e, t) {
|
|
843
|
-
return
|
|
843
|
+
return ot(this, "map", e, t, void 0, arguments);
|
|
844
844
|
},
|
|
845
845
|
pop() {
|
|
846
|
-
return
|
|
846
|
+
return lt(this, "pop");
|
|
847
847
|
},
|
|
848
848
|
push(...e) {
|
|
849
|
-
return
|
|
849
|
+
return lt(this, "push", e);
|
|
850
850
|
},
|
|
851
851
|
reduce(e, ...t) {
|
|
852
|
-
return
|
|
852
|
+
return st(this, "reduce", e, t);
|
|
853
853
|
},
|
|
854
854
|
reduceRight(e, ...t) {
|
|
855
|
-
return
|
|
855
|
+
return st(this, "reduceRight", e, t);
|
|
856
856
|
},
|
|
857
857
|
shift() {
|
|
858
|
-
return
|
|
858
|
+
return lt(this, "shift");
|
|
859
859
|
},
|
|
860
860
|
some(e, t) {
|
|
861
|
-
return
|
|
861
|
+
return ot(this, "some", e, t, void 0, arguments);
|
|
862
862
|
},
|
|
863
863
|
splice(...e) {
|
|
864
|
-
return
|
|
864
|
+
return lt(this, "splice", e);
|
|
865
865
|
},
|
|
866
866
|
toReversed() {
|
|
867
867
|
return et(this).toReversed();
|
|
@@ -873,63 +873,63 @@ var nt = {
|
|
|
873
873
|
return et(this).toSpliced(...e);
|
|
874
874
|
},
|
|
875
875
|
unshift(...e) {
|
|
876
|
-
return
|
|
876
|
+
return lt(this, "unshift", e);
|
|
877
877
|
},
|
|
878
878
|
values() {
|
|
879
|
-
return
|
|
879
|
+
return it(this, "values", (e) => nt(this, e));
|
|
880
880
|
}
|
|
881
881
|
};
|
|
882
|
-
function
|
|
882
|
+
function it(e, t, n) {
|
|
883
883
|
let r = tt(e), i = r[t]();
|
|
884
|
-
return r !== e && !/* @__PURE__ */
|
|
884
|
+
return r !== e && !/* @__PURE__ */ Bt(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 = tt(e), s = o !== e && !/* @__PURE__ */
|
|
892
|
-
if (c !==
|
|
889
|
+
var at = Array.prototype;
|
|
890
|
+
function ot(e, t, n, r, i, a) {
|
|
891
|
+
let o = tt(e), s = o !== e && !/* @__PURE__ */ Bt(e), c = o[t];
|
|
892
|
+
if (c !== at[t]) {
|
|
893
893
|
let t = c.apply(e, a);
|
|
894
|
-
return s ?
|
|
894
|
+
return s ? Ut(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, nt(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 = tt(e), a = i !== e && !/* @__PURE__ */
|
|
905
|
+
function st(e, t, n, r) {
|
|
906
|
+
let i = tt(e), a = i !== e && !/* @__PURE__ */ Bt(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 = nt(e, t)), n.call(this, t, nt(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 ? nt(e, c) : c;
|
|
914
914
|
}
|
|
915
|
-
function
|
|
916
|
-
let r = /* @__PURE__ */
|
|
915
|
+
function ct(e, t, n) {
|
|
916
|
+
let r = /* @__PURE__ */ q(e);
|
|
917
917
|
Qe(r, "iterate", Ze);
|
|
918
918
|
let i = r[t](...n);
|
|
919
|
-
return (i === -1 || i === !1) && /* @__PURE__ */
|
|
919
|
+
return (i === -1 || i === !1) && /* @__PURE__ */ Vt(n[0]) ? (n[0] = /* @__PURE__ */ q(n[0]), r[t](...n)) : i;
|
|
920
920
|
}
|
|
921
|
-
function
|
|
921
|
+
function lt(e, t, n = []) {
|
|
922
922
|
Ve(), je();
|
|
923
|
-
let r = (/* @__PURE__ */
|
|
923
|
+
let r = (/* @__PURE__ */ q(e))[t].apply(e, n);
|
|
924
924
|
return Me(), He(), r;
|
|
925
925
|
}
|
|
926
|
-
var
|
|
927
|
-
function
|
|
928
|
-
|
|
929
|
-
let t = /* @__PURE__ */
|
|
926
|
+
var ut = /* @__PURE__ */ ae("__proto__,__v_isRef,__isVue"), dt = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((e) => e !== "arguments" && e !== "caller").map((e) => Symbol[e]).filter(fe));
|
|
927
|
+
function ft(e) {
|
|
928
|
+
fe(e) || (e = String(e));
|
|
929
|
+
let t = /* @__PURE__ */ q(this);
|
|
930
930
|
return Qe(t, "has", e), t.hasOwnProperty(e);
|
|
931
931
|
}
|
|
932
|
-
var
|
|
932
|
+
var pt = class {
|
|
933
933
|
constructor(e = !1, t = !1) {
|
|
934
934
|
this._isReadonly = e, this._isShallow = t;
|
|
935
935
|
}
|
|
@@ -939,46 +939,46 @@ var ft = 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 ?
|
|
943
|
-
let a =
|
|
942
|
+
if (t === "__v_raw") return n === (r ? i ? Mt : jt : i ? At : kt).get(e) || Object.getPrototypeOf(e) === Object.getPrototypeOf(n) ? e : void 0;
|
|
943
|
+
let a = F(e);
|
|
944
944
|
if (!r) {
|
|
945
945
|
let e;
|
|
946
|
-
if (a && (e =
|
|
947
|
-
if (t === "hasOwnProperty") return
|
|
946
|
+
if (a && (e = rt[t])) return e;
|
|
947
|
+
if (t === "hasOwnProperty") return ft;
|
|
948
948
|
}
|
|
949
|
-
let o = Reflect.get(e, t, /* @__PURE__ */
|
|
950
|
-
if ((
|
|
951
|
-
if (/* @__PURE__ */
|
|
949
|
+
let o = Reflect.get(e, t, /* @__PURE__ */ Gt(e) ? e : n);
|
|
950
|
+
if ((fe(t) ? dt.has(t) : ut(t)) || (r || Qe(e, "get", t), i)) return o;
|
|
951
|
+
if (/* @__PURE__ */ Gt(o)) {
|
|
952
952
|
let e = a && B(t) ? o : o.value;
|
|
953
|
-
return r &&
|
|
953
|
+
return r && L(e) ? /* @__PURE__ */ Ft(e) : e;
|
|
954
954
|
}
|
|
955
|
-
return
|
|
955
|
+
return L(o) ? r ? /* @__PURE__ */ Ft(o) : /* @__PURE__ */ Pt(o) : o;
|
|
956
956
|
}
|
|
957
|
-
},
|
|
957
|
+
}, mt = class extends pt {
|
|
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 =
|
|
962
|
+
let i = e[t], a = F(e) && B(t);
|
|
963
963
|
if (!this._isShallow) {
|
|
964
|
-
let r = /* @__PURE__ */
|
|
965
|
-
if (!/* @__PURE__ */
|
|
964
|
+
let r = /* @__PURE__ */ zt(i);
|
|
965
|
+
if (!/* @__PURE__ */ Bt(n) && !/* @__PURE__ */ zt(n) && (i = /* @__PURE__ */ q(i), n = /* @__PURE__ */ q(n)), !a && /* @__PURE__ */ Gt(i) && !/* @__PURE__ */ Gt(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
|
-
let o = a ? Number(t) < e.length :
|
|
968
|
-
return e === /* @__PURE__ */
|
|
967
|
+
let o = a ? Number(t) < e.length : P(e, t), s = Reflect.set(e, t, n, /* @__PURE__ */ Gt(e) ? e : r);
|
|
968
|
+
return e === /* @__PURE__ */ q(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
|
-
let n =
|
|
971
|
+
let n = P(e, t), r = e[t], i = Reflect.deleteProperty(e, t);
|
|
972
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 (!
|
|
976
|
+
return (!fe(t) || !dt.has(t)) && Qe(e, "has", t), n;
|
|
977
977
|
}
|
|
978
978
|
ownKeys(e) {
|
|
979
|
-
return Qe(e, "iterate",
|
|
979
|
+
return Qe(e, "iterate", F(e) ? "length" : Ye), Reflect.ownKeys(e);
|
|
980
980
|
}
|
|
981
|
-
},
|
|
981
|
+
}, ht = class extends pt {
|
|
982
982
|
constructor(e = !1) {
|
|
983
983
|
super(!0, e);
|
|
984
984
|
}
|
|
@@ -988,11 +988,11 @@ var ft = 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
|
+
}, gt = /* @__PURE__ */ new mt(), _t = /* @__PURE__ */ new ht(), vt = /* @__PURE__ */ new ht(!0), yt = (e) => e, bt = (e) => Reflect.getPrototypeOf(e);
|
|
992
|
+
function xt(e, t, n) {
|
|
993
993
|
return function(...r) {
|
|
994
|
-
let i = this.__v_raw, a = /* @__PURE__ */
|
|
995
|
-
return !t && Qe(a, "iterate", c ? Xe : Ye),
|
|
994
|
+
let i = this.__v_raw, a = /* @__PURE__ */ q(i), o = le(a), s = e === "entries" || e === Symbol.iterator && o, c = e === "keys" && o, l = i[e](...r), u = n ? yt : t ? Wt : Ut;
|
|
995
|
+
return !t && Qe(a, "iterate", c ? Xe : Ye), M(Object.create(l), { next() {
|
|
996
996
|
let { value: e, done: t } = l.next();
|
|
997
997
|
return t ? {
|
|
998
998
|
value: e,
|
|
@@ -1004,63 +1004,63 @@ function bt(e, t, n) {
|
|
|
1004
1004
|
} });
|
|
1005
1005
|
};
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1007
|
+
function St(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(`${V(e)} operation ${n}failed: target is readonly.`, /* @__PURE__ */
|
|
1011
|
+
Ce(`${V(e)} operation ${n}failed: target is readonly.`, /* @__PURE__ */ q(this));
|
|
1012
1012
|
}
|
|
1013
1013
|
return e === "delete" ? !1 : e === "clear" ? void 0 : this;
|
|
1014
1014
|
};
|
|
1015
1015
|
}
|
|
1016
|
-
function
|
|
1016
|
+
function Ct(e, t) {
|
|
1017
1017
|
let n = {
|
|
1018
1018
|
get(n) {
|
|
1019
|
-
let r = this.__v_raw, i = /* @__PURE__ */
|
|
1019
|
+
let r = this.__v_raw, i = /* @__PURE__ */ q(r), a = /* @__PURE__ */ q(n);
|
|
1020
1020
|
e || (ge(n, a) && Qe(i, "get", n), Qe(i, "get", a));
|
|
1021
|
-
let { has: o } =
|
|
1021
|
+
let { has: o } = bt(i), s = t ? yt : e ? Wt : Ut;
|
|
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 && Qe(/* @__PURE__ */
|
|
1028
|
+
return !e && Qe(/* @__PURE__ */ q(t), "iterate", Ye), t.size;
|
|
1029
1029
|
},
|
|
1030
1030
|
has(t) {
|
|
1031
|
-
let n = this.__v_raw, r = /* @__PURE__ */
|
|
1031
|
+
let n = this.__v_raw, r = /* @__PURE__ */ q(n), i = /* @__PURE__ */ q(t);
|
|
1032
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__ */
|
|
1035
|
+
let i = this, a = i.__v_raw, o = /* @__PURE__ */ q(a), s = t ? yt : e ? Wt : Ut;
|
|
1036
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 M(n, e ? {
|
|
1040
|
+
add: St("add"),
|
|
1041
|
+
set: St("set"),
|
|
1042
|
+
delete: St("delete"),
|
|
1043
|
+
clear: St("clear")
|
|
1044
1044
|
} : {
|
|
1045
1045
|
add(e) {
|
|
1046
|
-
let n = /* @__PURE__ */
|
|
1046
|
+
let n = /* @__PURE__ */ q(this), r = bt(n), i = /* @__PURE__ */ q(e), a = !t && !/* @__PURE__ */ Bt(e) && !/* @__PURE__ */ zt(e) ? i : e;
|
|
1047
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__ */
|
|
1052
|
-
o ? process.env.NODE_ENV !== "production" &&
|
|
1050
|
+
!t && !/* @__PURE__ */ Bt(n) && !/* @__PURE__ */ zt(n) && (n = /* @__PURE__ */ q(n));
|
|
1051
|
+
let r = /* @__PURE__ */ q(this), { has: i, get: a } = bt(r), o = i.call(r, e);
|
|
1052
|
+
o ? process.env.NODE_ENV !== "production" && Ot(r, i, e) : (e = /* @__PURE__ */ q(e), o = i.call(r, e));
|
|
1053
1053
|
let s = a.call(r, e);
|
|
1054
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__ */
|
|
1058
|
-
i ? process.env.NODE_ENV !== "production" &&
|
|
1057
|
+
let t = /* @__PURE__ */ q(this), { has: n, get: r } = bt(t), i = n.call(t, e);
|
|
1058
|
+
i ? process.env.NODE_ENV !== "production" && Ot(t, n, e) : (e = /* @__PURE__ */ q(e), i = n.call(t, e));
|
|
1059
1059
|
let a = r ? r.call(t, e) : void 0, o = t.delete(e);
|
|
1060
1060
|
return i && $e(t, "delete", e, void 0, a), o;
|
|
1061
1061
|
},
|
|
1062
1062
|
clear() {
|
|
1063
|
-
let e = /* @__PURE__ */
|
|
1063
|
+
let e = /* @__PURE__ */ q(this), t = e.size !== 0, n = process.env.NODE_ENV === "production" ? void 0 : le(e) ? new Map(e) : new Set(e), r = e.clear();
|
|
1064
1064
|
return t && $e(e, "clear", void 0, void 0, n), r;
|
|
1065
1065
|
}
|
|
1066
1066
|
}), [
|
|
@@ -1069,23 +1069,23 @@ function St(e, t) {
|
|
|
1069
1069
|
"entries",
|
|
1070
1070
|
Symbol.iterator
|
|
1071
1071
|
].forEach((r) => {
|
|
1072
|
-
n[r] =
|
|
1072
|
+
n[r] = xt(r, e, t);
|
|
1073
1073
|
}), n;
|
|
1074
1074
|
}
|
|
1075
|
-
function
|
|
1076
|
-
let n =
|
|
1077
|
-
return (t, r, i) => r === "__v_isReactive" ? !e : r === "__v_isReadonly" ? e : r === "__v_raw" ? t : Reflect.get(
|
|
1075
|
+
function wt(e, t) {
|
|
1076
|
+
let n = Ct(e, t);
|
|
1077
|
+
return (t, r, i) => r === "__v_isReactive" ? !e : r === "__v_isReadonly" ? e : r === "__v_raw" ? t : Reflect.get(P(n, r) && r in t ? n : t, r, i);
|
|
1078
1078
|
}
|
|
1079
|
-
var
|
|
1080
|
-
function
|
|
1081
|
-
let r = /* @__PURE__ */
|
|
1079
|
+
var Tt = { get: /* @__PURE__ */ wt(!1, !1) }, Et = { get: /* @__PURE__ */ wt(!0, !1) }, Dt = { get: /* @__PURE__ */ wt(!0, !0) };
|
|
1080
|
+
function Ot(e, t, n) {
|
|
1081
|
+
let r = /* @__PURE__ */ q(n);
|
|
1082
1082
|
if (r !== n && t.call(e, r)) {
|
|
1083
|
-
let t =
|
|
1083
|
+
let t = R(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 kt = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new WeakMap(), jt = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap();
|
|
1088
|
+
function Nt(e) {
|
|
1089
1089
|
switch (e) {
|
|
1090
1090
|
case "Object":
|
|
1091
1091
|
case "Array": return 1;
|
|
@@ -1097,70 +1097,70 @@ function Mt(e) {
|
|
|
1097
1097
|
}
|
|
1098
1098
|
}
|
|
1099
1099
|
// @__NO_SIDE_EFFECTS__
|
|
1100
|
-
function Nt(e) {
|
|
1101
|
-
return /* @__PURE__ */ Rt(e) ? e : It(e, !1, ht, wt, Ot);
|
|
1102
|
-
}
|
|
1103
|
-
// @__NO_SIDE_EFFECTS__
|
|
1104
1100
|
function Pt(e) {
|
|
1105
|
-
return
|
|
1101
|
+
return /* @__PURE__ */ zt(e) ? e : Lt(e, !1, gt, Tt, kt);
|
|
1106
1102
|
}
|
|
1107
1103
|
// @__NO_SIDE_EFFECTS__
|
|
1108
1104
|
function Ft(e) {
|
|
1109
|
-
return
|
|
1105
|
+
return Lt(e, !0, _t, Et, jt);
|
|
1110
1106
|
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1107
|
+
// @__NO_SIDE_EFFECTS__
|
|
1108
|
+
function It(e) {
|
|
1109
|
+
return Lt(e, !0, vt, Dt, Mt);
|
|
1110
|
+
}
|
|
1111
|
+
function Lt(e, t, n, r, i) {
|
|
1112
|
+
if (!L(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 = Nt(R(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 Rt(e) {
|
|
1123
|
+
return /* @__PURE__ */ zt(e) ? /* @__PURE__ */ Rt(e.__v_raw) : !!(e && e.__v_isReactive);
|
|
1124
1124
|
}
|
|
1125
1125
|
// @__NO_SIDE_EFFECTS__
|
|
1126
|
-
function
|
|
1126
|
+
function zt(e) {
|
|
1127
1127
|
return !!(e && e.__v_isReadonly);
|
|
1128
1128
|
}
|
|
1129
1129
|
// @__NO_SIDE_EFFECTS__
|
|
1130
|
-
function
|
|
1130
|
+
function Bt(e) {
|
|
1131
1131
|
return !!(e && e.__v_isShallow);
|
|
1132
1132
|
}
|
|
1133
1133
|
// @__NO_SIDE_EFFECTS__
|
|
1134
|
-
function
|
|
1134
|
+
function Vt(e) {
|
|
1135
1135
|
return e ? !!e.__v_raw : !1;
|
|
1136
1136
|
}
|
|
1137
1137
|
// @__NO_SIDE_EFFECTS__
|
|
1138
|
-
function
|
|
1138
|
+
function q(e) {
|
|
1139
1139
|
let t = e && e.__v_raw;
|
|
1140
|
-
return t ? /* @__PURE__ */
|
|
1140
|
+
return t ? /* @__PURE__ */ q(t) : e;
|
|
1141
1141
|
}
|
|
1142
|
-
function
|
|
1143
|
-
return !
|
|
1142
|
+
function Ht(e) {
|
|
1143
|
+
return !P(e, "__v_skip") && Object.isExtensible(e) && _e(e, "__v_skip", !0), e;
|
|
1144
1144
|
}
|
|
1145
|
-
var
|
|
1145
|
+
var Ut = (e) => L(e) ? /* @__PURE__ */ Pt(e) : e, Wt = (e) => L(e) ? /* @__PURE__ */ Ft(e) : e;
|
|
1146
1146
|
// @__NO_SIDE_EFFECTS__
|
|
1147
|
-
function
|
|
1147
|
+
function Gt(e) {
|
|
1148
1148
|
return e ? e.__v_isRef === !0 : !1;
|
|
1149
1149
|
}
|
|
1150
1150
|
// @__NO_SIDE_EFFECTS__
|
|
1151
|
-
function
|
|
1152
|
-
return
|
|
1151
|
+
function Kt(e) {
|
|
1152
|
+
return Jt(e, !1);
|
|
1153
1153
|
}
|
|
1154
1154
|
// @__NO_SIDE_EFFECTS__
|
|
1155
|
-
function
|
|
1156
|
-
return
|
|
1155
|
+
function qt(e) {
|
|
1156
|
+
return Jt(e, !0);
|
|
1157
1157
|
}
|
|
1158
|
-
function
|
|
1159
|
-
return /* @__PURE__ */
|
|
1158
|
+
function Jt(e, t) {
|
|
1159
|
+
return /* @__PURE__ */ Gt(e) ? e : new Yt(e, t);
|
|
1160
1160
|
}
|
|
1161
|
-
var
|
|
1161
|
+
var Yt = class {
|
|
1162
1162
|
constructor(e, t) {
|
|
1163
|
-
this.dep = new Ke(), this.__v_isRef = !0, this.__v_isShallow = !1, this._rawValue = t ? e : /* @__PURE__ */
|
|
1163
|
+
this.dep = new Ke(), this.__v_isRef = !0, this.__v_isShallow = !1, this._rawValue = t ? e : /* @__PURE__ */ q(e), this._value = t ? e : Ut(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,8 +1170,8 @@ var qt = class {
|
|
|
1170
1170
|
}), this._value;
|
|
1171
1171
|
}
|
|
1172
1172
|
set value(e) {
|
|
1173
|
-
let t = this._rawValue, n = this.__v_isShallow || /* @__PURE__ */
|
|
1174
|
-
e = n ? e : /* @__PURE__ */
|
|
1173
|
+
let t = this._rawValue, n = this.__v_isShallow || /* @__PURE__ */ Bt(e) || /* @__PURE__ */ zt(e);
|
|
1174
|
+
e = n ? e : /* @__PURE__ */ q(e), ge(e, t) && (this._rawValue = e, this._value = n ? e : Ut(e), process.env.NODE_ENV === "production" ? this.dep.trigger() : this.dep.trigger({
|
|
1175
1175
|
target: this,
|
|
1176
1176
|
type: "set",
|
|
1177
1177
|
key: "value",
|
|
@@ -1180,7 +1180,7 @@ var qt = class {
|
|
|
1180
1180
|
}));
|
|
1181
1181
|
}
|
|
1182
1182
|
};
|
|
1183
|
-
function
|
|
1183
|
+
function Xt(e) {
|
|
1184
1184
|
e.dep && (process.env.NODE_ENV === "production" ? e.dep.trigger() : e.dep.trigger({
|
|
1185
1185
|
target: e,
|
|
1186
1186
|
type: "set",
|
|
@@ -1188,20 +1188,20 @@ function Jt(e) {
|
|
|
1188
1188
|
newValue: e._value
|
|
1189
1189
|
}));
|
|
1190
1190
|
}
|
|
1191
|
-
function
|
|
1192
|
-
return /* @__PURE__ */
|
|
1191
|
+
function J(e) {
|
|
1192
|
+
return /* @__PURE__ */ Gt(e) ? e.value : e;
|
|
1193
1193
|
}
|
|
1194
|
-
var
|
|
1195
|
-
get: (e, t, n) => t === "__v_raw" ? e :
|
|
1194
|
+
var Zt = {
|
|
1195
|
+
get: (e, t, n) => t === "__v_raw" ? e : J(Reflect.get(e, t, n)),
|
|
1196
1196
|
set: (e, t, n, r) => {
|
|
1197
1197
|
let i = e[t];
|
|
1198
|
-
return /* @__PURE__ */
|
|
1198
|
+
return /* @__PURE__ */ Gt(i) && !/* @__PURE__ */ Gt(n) ? (i.value = n, !0) : Reflect.set(e, t, n, r);
|
|
1199
1199
|
}
|
|
1200
1200
|
};
|
|
1201
|
-
function
|
|
1202
|
-
return /* @__PURE__ */
|
|
1201
|
+
function Qt(e) {
|
|
1202
|
+
return /* @__PURE__ */ Rt(e) ? e : new Proxy(e, Zt);
|
|
1203
1203
|
}
|
|
1204
|
-
var
|
|
1204
|
+
var $t = class {
|
|
1205
1205
|
constructor(e, t, n) {
|
|
1206
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
|
}
|
|
@@ -1222,29 +1222,29 @@ var Qt = class {
|
|
|
1222
1222
|
}
|
|
1223
1223
|
};
|
|
1224
1224
|
// @__NO_SIDE_EFFECTS__
|
|
1225
|
-
function
|
|
1225
|
+
function en(e, t, n = !1) {
|
|
1226
1226
|
let r, i;
|
|
1227
|
-
|
|
1228
|
-
let a = new
|
|
1227
|
+
I(e) ? r = e : (r = e.get, i = e.set);
|
|
1228
|
+
let a = new $t(r, i, n);
|
|
1229
1229
|
return process.env.NODE_ENV !== "production" && t && !n && (a.onTrack = t.onTrack, a.onTrigger = t.onTrigger), a;
|
|
1230
1230
|
}
|
|
1231
|
-
var
|
|
1232
|
-
function
|
|
1231
|
+
var tn = {}, nn = /* @__PURE__ */ new WeakMap(), rn = void 0;
|
|
1232
|
+
function an(e, t = !1, n = rn) {
|
|
1233
1233
|
if (n) {
|
|
1234
|
-
let t =
|
|
1235
|
-
t ||
|
|
1234
|
+
let t = nn.get(n);
|
|
1235
|
+
t || nn.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
|
|
1238
|
+
function on(e, t, n = oe) {
|
|
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__ */
|
|
1243
|
-
if (/* @__PURE__ */
|
|
1244
|
-
if (/* @__PURE__ */
|
|
1245
|
-
if (
|
|
1241
|
+
}, u = (e) => i ? e : /* @__PURE__ */ Bt(e) || i === !1 || i === 0 ? sn(e, 1) : sn(e), d, f, p, m, h = !1, g = !1;
|
|
1242
|
+
if (/* @__PURE__ */ Gt(e) ? (f = () => e.value, h = /* @__PURE__ */ Bt(e)) : /* @__PURE__ */ Rt(e) ? (f = () => u(e), h = !0) : F(e) ? (g = !0, h = e.some((e) => /* @__PURE__ */ Rt(e) || /* @__PURE__ */ Bt(e)), f = () => e.map((e) => {
|
|
1243
|
+
if (/* @__PURE__ */ Gt(e)) return e.value;
|
|
1244
|
+
if (/* @__PURE__ */ Rt(e)) return u(e);
|
|
1245
|
+
if (I(e)) return c ? c(e, 2) : e();
|
|
1246
1246
|
process.env.NODE_ENV !== "production" && l(e);
|
|
1247
|
-
})) :
|
|
1247
|
+
})) : I(e) ? f = t ? c ? () => c(e, 2) : e : () => {
|
|
1248
1248
|
if (p) {
|
|
1249
1249
|
Ve();
|
|
1250
1250
|
try {
|
|
@@ -1253,19 +1253,19 @@ function an(e, t, n = ae) {
|
|
|
1253
1253
|
He();
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
|
-
let t =
|
|
1257
|
-
|
|
1256
|
+
let t = rn;
|
|
1257
|
+
rn = d;
|
|
1258
1258
|
try {
|
|
1259
1259
|
return c ? c(e, 3, [m]) : e(m);
|
|
1260
1260
|
} finally {
|
|
1261
|
-
|
|
1261
|
+
rn = t;
|
|
1262
1262
|
}
|
|
1263
|
-
} : (f =
|
|
1263
|
+
} : (f = A, process.env.NODE_ENV !== "production" && l(e)), t && i) {
|
|
1264
1264
|
let e = f, t = i === !0 ? Infinity : i;
|
|
1265
|
-
f = () =>
|
|
1265
|
+
f = () => sn(e(), t);
|
|
1266
1266
|
}
|
|
1267
1267
|
let _ = Te(), v = () => {
|
|
1268
|
-
d.stop(), _ && _.active &&
|
|
1268
|
+
d.stop(), _ && _.active && ce(_.effects, d);
|
|
1269
1269
|
};
|
|
1270
1270
|
if (a && t) {
|
|
1271
1271
|
let e = t;
|
|
@@ -1274,63 +1274,63 @@ function an(e, t, n = ae) {
|
|
|
1274
1274
|
return v(), n;
|
|
1275
1275
|
};
|
|
1276
1276
|
}
|
|
1277
|
-
let y = g ? Array(e.length).fill(
|
|
1277
|
+
let y = g ? Array(e.length).fill(tn) : tn, b = (e) => {
|
|
1278
1278
|
if (!(!(d.flags & 1) || !d.dirty && !e)) if (t) {
|
|
1279
1279
|
let n = d.run();
|
|
1280
1280
|
if (e || i || h || (g ? n.some((e, t) => ge(e, y[t])) : ge(n, y))) {
|
|
1281
1281
|
p && p();
|
|
1282
|
-
let e =
|
|
1283
|
-
|
|
1282
|
+
let e = rn;
|
|
1283
|
+
rn = d;
|
|
1284
1284
|
try {
|
|
1285
1285
|
let e = [
|
|
1286
1286
|
n,
|
|
1287
|
-
y ===
|
|
1287
|
+
y === tn ? void 0 : g && y[0] === tn ? [] : y,
|
|
1288
1288
|
m
|
|
1289
1289
|
];
|
|
1290
1290
|
y = n, c ? c(t, 3, e) : t(...e);
|
|
1291
1291
|
} finally {
|
|
1292
|
-
|
|
1292
|
+
rn = e;
|
|
1293
1293
|
}
|
|
1294
1294
|
}
|
|
1295
1295
|
} else d.run();
|
|
1296
1296
|
};
|
|
1297
|
-
return s && s(b), d = new Ee(f), d.scheduler = o ? () => o(b, !1) : b, m = (e) =>
|
|
1298
|
-
let e =
|
|
1297
|
+
return s && s(b), d = new Ee(f), d.scheduler = o ? () => o(b, !1) : b, m = (e) => an(e, !1, d), p = d.onStop = () => {
|
|
1298
|
+
let e = nn.get(d);
|
|
1299
1299
|
if (e) {
|
|
1300
1300
|
if (c) c(e, 4);
|
|
1301
1301
|
else for (let t of e) t();
|
|
1302
|
-
|
|
1302
|
+
nn.delete(d);
|
|
1303
1303
|
}
|
|
1304
1304
|
}, process.env.NODE_ENV !== "production" && (d.onTrack = n.onTrack, d.onTrigger = n.onTrigger), t ? r ? b(!0) : y = d.run() : o ? o(b.bind(null, !0), !0) : d.run(), v.pause = d.pause.bind(d), v.resume = d.resume.bind(d), v.stop = v, v;
|
|
1305
1305
|
}
|
|
1306
|
-
function
|
|
1307
|
-
if (t <= 0 || !
|
|
1308
|
-
if (n.set(e, t), t--, /* @__PURE__ */
|
|
1309
|
-
else if (
|
|
1310
|
-
else if (
|
|
1311
|
-
|
|
1306
|
+
function sn(e, t = Infinity, n) {
|
|
1307
|
+
if (t <= 0 || !L(e) || e.__v_skip || (n ||= /* @__PURE__ */ new Map(), (n.get(e) || 0) >= t)) return e;
|
|
1308
|
+
if (n.set(e, t), t--, /* @__PURE__ */ Gt(e)) sn(e.value, t, n);
|
|
1309
|
+
else if (F(e)) for (let r = 0; r < e.length; r++) sn(e[r], t, n);
|
|
1310
|
+
else if (ue(e) || le(e)) e.forEach((e) => {
|
|
1311
|
+
sn(e, t, n);
|
|
1312
1312
|
});
|
|
1313
1313
|
else if (z(e)) {
|
|
1314
|
-
for (let r in e)
|
|
1315
|
-
for (let r of Object.getOwnPropertySymbols(e)) Object.prototype.propertyIsEnumerable.call(e, r) &&
|
|
1314
|
+
for (let r in e) sn(e[r], t, n);
|
|
1315
|
+
for (let r of Object.getOwnPropertySymbols(e)) Object.prototype.propertyIsEnumerable.call(e, r) && sn(e[r], t, n);
|
|
1316
1316
|
}
|
|
1317
1317
|
return e;
|
|
1318
1318
|
}
|
|
1319
1319
|
//#endregion
|
|
1320
1320
|
//#region node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
|
|
1321
|
-
var
|
|
1322
|
-
function
|
|
1323
|
-
|
|
1324
|
-
}
|
|
1325
|
-
function
|
|
1326
|
-
|
|
1327
|
-
}
|
|
1328
|
-
var
|
|
1329
|
-
function
|
|
1330
|
-
if (
|
|
1331
|
-
|
|
1332
|
-
let n =
|
|
1333
|
-
if (r)
|
|
1321
|
+
var cn = [];
|
|
1322
|
+
function ln(e) {
|
|
1323
|
+
cn.push(e);
|
|
1324
|
+
}
|
|
1325
|
+
function un() {
|
|
1326
|
+
cn.pop();
|
|
1327
|
+
}
|
|
1328
|
+
var dn = !1;
|
|
1329
|
+
function fn(e, ...t) {
|
|
1330
|
+
if (dn) return;
|
|
1331
|
+
dn = !0, Ve();
|
|
1332
|
+
let n = cn.length ? cn[cn.length - 1].component : null, r = n && n.appContext.config.warnHandler, i = pn();
|
|
1333
|
+
if (r) vn(r, n, 11, [
|
|
1334
1334
|
e + t.map((e) => e.toString?.call(e) ?? JSON.stringify(e)).join(""),
|
|
1335
1335
|
n && n.proxy,
|
|
1336
1336
|
i.map(({ vnode: e }) => `at <${ti(n, e.type)}>`).join("\n"),
|
|
@@ -1338,12 +1338,12 @@ 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", ...mn(i)), console.warn(...n);
|
|
1342
1342
|
}
|
|
1343
|
-
He(),
|
|
1343
|
+
He(), dn = !1;
|
|
1344
1344
|
}
|
|
1345
|
-
function
|
|
1346
|
-
let e =
|
|
1345
|
+
function pn() {
|
|
1346
|
+
let e = cn[cn.length - 1];
|
|
1347
1347
|
if (!e) return [];
|
|
1348
1348
|
let t = [];
|
|
1349
1349
|
for (; e;) {
|
|
@@ -1357,34 +1357,34 @@ function fn() {
|
|
|
1357
1357
|
}
|
|
1358
1358
|
return t;
|
|
1359
1359
|
}
|
|
1360
|
-
function
|
|
1360
|
+
function mn(e) {
|
|
1361
1361
|
let t = [];
|
|
1362
1362
|
return e.forEach((e, n) => {
|
|
1363
|
-
t.push(...n === 0 ? [] : ["\n"], ...
|
|
1363
|
+
t.push(...n === 0 ? [] : ["\n"], ...hn(e));
|
|
1364
1364
|
}), t;
|
|
1365
1365
|
}
|
|
1366
|
-
function
|
|
1366
|
+
function hn({ vnode: e, recurseCount: t }) {
|
|
1367
1367
|
let n = t > 0 ? `... (${t} recursive calls)` : "", r = e.component ? e.component.parent == null : !1, i = ` at <${ti(e.component, e.type, r)}`, a = ">" + n;
|
|
1368
1368
|
return e.props ? [
|
|
1369
1369
|
i,
|
|
1370
|
-
...
|
|
1370
|
+
...Y(e.props),
|
|
1371
1371
|
a
|
|
1372
1372
|
] : [i + a];
|
|
1373
1373
|
}
|
|
1374
|
-
function
|
|
1374
|
+
function Y(e) {
|
|
1375
1375
|
let t = [], n = Object.keys(e);
|
|
1376
1376
|
return n.slice(0, 3).forEach((n) => {
|
|
1377
|
-
t.push(...
|
|
1377
|
+
t.push(...gn(n, e[n]));
|
|
1378
1378
|
}), n.length > 3 && t.push(" ..."), t;
|
|
1379
1379
|
}
|
|
1380
|
-
function
|
|
1381
|
-
return
|
|
1380
|
+
function gn(e, t, n) {
|
|
1381
|
+
return de(t) ? (t = JSON.stringify(t), n ? t : [`${e}=${t}`]) : typeof t == "number" || typeof t == "boolean" || t == null ? n ? t : [`${e}=${t}`] : /* @__PURE__ */ Gt(t) ? (t = gn(e, /* @__PURE__ */ q(t.value), !0), n ? t : [
|
|
1382
1382
|
`${e}=Ref<`,
|
|
1383
1383
|
t,
|
|
1384
1384
|
">"
|
|
1385
|
-
]) :
|
|
1385
|
+
]) : I(t) ? [`${e}=fn${t.name ? `<${t.name}>` : ""}`] : (t = /* @__PURE__ */ q(t), n ? t : [`${e}=`, t]);
|
|
1386
1386
|
}
|
|
1387
|
-
var
|
|
1387
|
+
var _n = {
|
|
1388
1388
|
sp: "serverPrefetch hook",
|
|
1389
1389
|
bc: "beforeCreate hook",
|
|
1390
1390
|
c: "created hook",
|
|
@@ -1417,30 +1417,30 @@ var gn = {
|
|
|
1417
1417
|
15: "component update",
|
|
1418
1418
|
16: "app unmount cleanup function"
|
|
1419
1419
|
};
|
|
1420
|
-
function
|
|
1420
|
+
function vn(e, t, n, r) {
|
|
1421
1421
|
try {
|
|
1422
1422
|
return r ? e(...r) : e();
|
|
1423
1423
|
} catch (e) {
|
|
1424
|
-
|
|
1424
|
+
bn(e, t, n);
|
|
1425
1425
|
}
|
|
1426
1426
|
}
|
|
1427
|
-
function
|
|
1428
|
-
if (
|
|
1429
|
-
let i =
|
|
1430
|
-
return i &&
|
|
1431
|
-
|
|
1427
|
+
function yn(e, t, n, r) {
|
|
1428
|
+
if (I(e)) {
|
|
1429
|
+
let i = vn(e, t, n, r);
|
|
1430
|
+
return i && pe(i) && i.catch((e) => {
|
|
1431
|
+
bn(e, t, n);
|
|
1432
1432
|
}), i;
|
|
1433
1433
|
}
|
|
1434
|
-
if (
|
|
1434
|
+
if (F(e)) {
|
|
1435
1435
|
let i = [];
|
|
1436
|
-
for (let a = 0; a < e.length; a++) i.push(
|
|
1436
|
+
for (let a = 0; a < e.length; a++) i.push(yn(e[a], t, n, r));
|
|
1437
1437
|
return i;
|
|
1438
|
-
} else process.env.NODE_ENV !== "production" &&
|
|
1438
|
+
} else process.env.NODE_ENV !== "production" && fn(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof e}`);
|
|
1439
1439
|
}
|
|
1440
|
-
function
|
|
1441
|
-
let i = t ? t.vnode : null, { errorHandler: a, throwUnhandledErrorInProduction: o } = t && t.appContext.config ||
|
|
1440
|
+
function bn(e, t, n, r = !0) {
|
|
1441
|
+
let i = t ? t.vnode : null, { errorHandler: a, throwUnhandledErrorInProduction: o } = t && t.appContext.config || oe;
|
|
1442
1442
|
if (t) {
|
|
1443
|
-
let r = t.parent, i = t.proxy, o = process.env.NODE_ENV === "production" ? `https://vuejs.org/error-reference/#runtime-${n}` :
|
|
1443
|
+
let r = t.parent, i = t.proxy, o = process.env.NODE_ENV === "production" ? `https://vuejs.org/error-reference/#runtime-${n}` : _n[n];
|
|
1444
1444
|
for (; r;) {
|
|
1445
1445
|
let t = r.ec;
|
|
1446
1446
|
if (t) {
|
|
@@ -1449,7 +1449,7 @@ function yn(e, t, n, r = !0) {
|
|
|
1449
1449
|
r = r.parent;
|
|
1450
1450
|
}
|
|
1451
1451
|
if (a) {
|
|
1452
|
-
Ve(),
|
|
1452
|
+
Ve(), vn(a, null, 10, [
|
|
1453
1453
|
e,
|
|
1454
1454
|
i,
|
|
1455
1455
|
o
|
|
@@ -1457,40 +1457,40 @@ function yn(e, t, n, r = !0) {
|
|
|
1457
1457
|
return;
|
|
1458
1458
|
}
|
|
1459
1459
|
}
|
|
1460
|
-
|
|
1460
|
+
xn(e, n, i, r, o);
|
|
1461
1461
|
}
|
|
1462
|
-
function
|
|
1462
|
+
function xn(e, t, n, r = !0, i = !1) {
|
|
1463
1463
|
if (process.env.NODE_ENV !== "production") {
|
|
1464
|
-
let i =
|
|
1465
|
-
if (n &&
|
|
1464
|
+
let i = _n[t];
|
|
1465
|
+
if (n && ln(n), fn(`Unhandled error${i ? ` during execution of ${i}` : ""}`), n && un(), r) throw e;
|
|
1466
1466
|
console.error(e);
|
|
1467
1467
|
} else if (i) throw e;
|
|
1468
1468
|
else console.error(e);
|
|
1469
1469
|
}
|
|
1470
|
-
var
|
|
1470
|
+
var X = [], Sn = -1, Cn = [], wn = null, Tn = 0, En = /* @__PURE__ */ Promise.resolve(), Dn = null, On = 100;
|
|
1471
1471
|
function kn(e) {
|
|
1472
1472
|
let t = Dn || En;
|
|
1473
1473
|
return e ? t.then(this ? e.bind(this) : e) : t;
|
|
1474
1474
|
}
|
|
1475
1475
|
function An(e) {
|
|
1476
|
-
let t = Sn + 1, n =
|
|
1476
|
+
let t = Sn + 1, n = X.length;
|
|
1477
1477
|
for (; t < n;) {
|
|
1478
|
-
let r = t + n >>> 1, i =
|
|
1478
|
+
let r = t + n >>> 1, i = X[r], a = Fn(i);
|
|
1479
1479
|
a < e || a === e && i.flags & 2 ? t = r + 1 : n = r;
|
|
1480
1480
|
}
|
|
1481
1481
|
return t;
|
|
1482
1482
|
}
|
|
1483
1483
|
function jn(e) {
|
|
1484
1484
|
if (!(e.flags & 1)) {
|
|
1485
|
-
let t = Fn(e), n =
|
|
1486
|
-
!n || !(e.flags & 2) && t >= Fn(n) ?
|
|
1485
|
+
let t = Fn(e), n = X[X.length - 1];
|
|
1486
|
+
!n || !(e.flags & 2) && t >= Fn(n) ? X.push(e) : X.splice(An(t), 0, e), e.flags |= 1, Mn();
|
|
1487
1487
|
}
|
|
1488
1488
|
}
|
|
1489
1489
|
function Mn() {
|
|
1490
1490
|
Dn ||= En.then(In);
|
|
1491
1491
|
}
|
|
1492
1492
|
function Nn(e) {
|
|
1493
|
-
|
|
1493
|
+
F(e) ? Cn.push(...e) : wn && e.id === -1 ? wn.splice(Tn + 1, 0, e) : e.flags & 1 || (Cn.push(e), e.flags |= 1), Mn();
|
|
1494
1494
|
}
|
|
1495
1495
|
function Pn(e) {
|
|
1496
1496
|
if (Cn.length) {
|
|
@@ -1509,28 +1509,28 @@ 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" ? A : (t) => Ln(e, t);
|
|
1513
1513
|
try {
|
|
1514
|
-
for (Sn = 0; Sn <
|
|
1515
|
-
let e =
|
|
1514
|
+
for (Sn = 0; Sn < X.length; Sn++) {
|
|
1515
|
+
let e = X[Sn];
|
|
1516
1516
|
if (e && !(e.flags & 8)) {
|
|
1517
1517
|
if (process.env.NODE_ENV !== "production" && t(e)) continue;
|
|
1518
|
-
e.flags & 4 && (e.flags &= -2),
|
|
1518
|
+
e.flags & 4 && (e.flags &= -2), vn(e, e.i, e.i ? 15 : 14), e.flags & 4 || (e.flags &= -2);
|
|
1519
1519
|
}
|
|
1520
1520
|
}
|
|
1521
1521
|
} finally {
|
|
1522
|
-
for (; Sn <
|
|
1523
|
-
let e =
|
|
1522
|
+
for (; Sn < X.length; Sn++) {
|
|
1523
|
+
let e = X[Sn];
|
|
1524
1524
|
e && (e.flags &= -2);
|
|
1525
1525
|
}
|
|
1526
|
-
Sn = -1,
|
|
1526
|
+
Sn = -1, X.length = 0, Pn(e), Dn = null, (X.length || Cn.length) && In(e);
|
|
1527
1527
|
}
|
|
1528
1528
|
}
|
|
1529
1529
|
function Ln(e, t) {
|
|
1530
1530
|
let n = e.get(t) || 0;
|
|
1531
1531
|
if (n > On) {
|
|
1532
1532
|
let e = t.i, n = e && ei(e.type);
|
|
1533
|
-
return
|
|
1533
|
+
return bn(`Maximum recursive updates exceeded${n ? ` in component <${n}>` : ""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`, null, 10), !0;
|
|
1534
1534
|
}
|
|
1535
1535
|
return e.set(t, n + 1), !1;
|
|
1536
1536
|
}
|
|
@@ -1572,7 +1572,7 @@ function Un(e, t) {
|
|
|
1572
1572
|
});
|
|
1573
1573
|
}
|
|
1574
1574
|
function Wn(e, t) {
|
|
1575
|
-
|
|
1575
|
+
M(e, t);
|
|
1576
1576
|
for (let n in e) n !== "__file" && !(n in t) && delete e[n];
|
|
1577
1577
|
}
|
|
1578
1578
|
function Gn(e) {
|
|
@@ -1598,21 +1598,21 @@ function Zn(e, t, n = !1) {
|
|
|
1598
1598
|
if (r || Sr) {
|
|
1599
1599
|
let i = Sr ? Sr._context.provides : r ? r.parent == null || r.ce ? r.vnode.appContext && r.vnode.appContext.provides : r.parent.provides : void 0;
|
|
1600
1600
|
if (i && e in i) return i[e];
|
|
1601
|
-
if (arguments.length > 1) return n &&
|
|
1602
|
-
process.env.NODE_ENV !== "production" &&
|
|
1603
|
-
} else process.env.NODE_ENV !== "production" &&
|
|
1601
|
+
if (arguments.length > 1) return n && I(t) ? t.call(r && r.proxy) : t;
|
|
1602
|
+
process.env.NODE_ENV !== "production" && fn(`injection "${String(e)}" not found.`);
|
|
1603
|
+
} else process.env.NODE_ENV !== "production" && fn("inject() can only be used inside setup() or functional components.");
|
|
1604
1604
|
}
|
|
1605
1605
|
var Qn = /* @__PURE__ */ Symbol.for("v-scx"), $n = () => {
|
|
1606
1606
|
{
|
|
1607
1607
|
let e = Zn(Qn);
|
|
1608
|
-
return e || process.env.NODE_ENV !== "production" &&
|
|
1608
|
+
return e || process.env.NODE_ENV !== "production" && fn("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 = oe) {
|
|
1612
1612
|
let { immediate: r, deep: i, flush: a, once: o } = n;
|
|
1613
|
-
process.env.NODE_ENV !== "production" && !t && (r !== void 0 &&
|
|
1614
|
-
let s =
|
|
1615
|
-
process.env.NODE_ENV !== "production" && (s.onWarn =
|
|
1613
|
+
process.env.NODE_ENV !== "production" && !t && (r !== void 0 && fn("watch() \"immediate\" option is only respected when using the watch(source, callback, options?) signature."), i !== void 0 && fn("watch() \"deep\" option is only respected when using the watch(source, callback, options?) signature."), o !== void 0 && fn("watch() \"once\" option is only respected when using the watch(source, callback, options?) signature."));
|
|
1614
|
+
let s = M({}, n);
|
|
1615
|
+
process.env.NODE_ENV !== "production" && (s.onWarn = fn);
|
|
1616
1616
|
let c = t && r || !t && a !== "post", l;
|
|
1617
1617
|
if (Xr) {
|
|
1618
1618
|
if (a === "sync") {
|
|
@@ -1620,11 +1620,11 @@ function er(e, t, n = ae) {
|
|
|
1620
1620
|
l = e.__watcherHandles ||= [];
|
|
1621
1621
|
} else if (!c) {
|
|
1622
1622
|
let e = () => {};
|
|
1623
|
-
return e.stop =
|
|
1623
|
+
return e.stop = A, e.resume = A, e.pause = A, e;
|
|
1624
1624
|
}
|
|
1625
1625
|
}
|
|
1626
1626
|
let u = Gr;
|
|
1627
|
-
s.call = (e, t, n) =>
|
|
1627
|
+
s.call = (e, t, n) => yn(e, u, t, n);
|
|
1628
1628
|
let d = !1;
|
|
1629
1629
|
a === "post" ? s.scheduler = (e) => {
|
|
1630
1630
|
Tr(e, u && u.suspense);
|
|
@@ -1633,12 +1633,12 @@ function er(e, t, n = ae) {
|
|
|
1633
1633
|
}), s.augmentJob = (e) => {
|
|
1634
1634
|
t && (e.flags |= 4), d && (e.flags |= 2, u && (e.id = u.uid, e.i = u));
|
|
1635
1635
|
};
|
|
1636
|
-
let f =
|
|
1636
|
+
let f = on(e, t, s);
|
|
1637
1637
|
return Xr && (l ? l.push(f) : c && f()), f;
|
|
1638
1638
|
}
|
|
1639
1639
|
function tr(e, t, n) {
|
|
1640
|
-
let r = this.proxy, i =
|
|
1641
|
-
|
|
1640
|
+
let r = this.proxy, i = de(e) ? e.includes(".") ? nr(r, e) : () => r[e] : e.bind(r, r), a;
|
|
1641
|
+
I(t) ? a = t : (a = t.handler, n = t);
|
|
1642
1642
|
let o = Jr(this), s = er(i, a.bind(r), n);
|
|
1643
1643
|
return o(), s;
|
|
1644
1644
|
}
|
|
@@ -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__ */ M(/* @__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__ */ It(e.props),
|
|
1663
|
+
$attrs: (e) => process.env.NODE_ENV === "production" ? e.attrs : /* @__PURE__ */ It(e.attrs),
|
|
1664
|
+
$slots: (e) => process.env.NODE_ENV === "production" ? e.slots : /* @__PURE__ */ It(e.slots),
|
|
1665
|
+
$refs: (e) => process.env.NODE_ENV === "production" ? e.refs : /* @__PURE__ */ It(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 !== oe && !e.__isScriptSetup && P(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 !==
|
|
1691
|
-
else if (
|
|
1692
|
-
else if (n !==
|
|
1690
|
+
else if (i !== oe && P(i, t)) return o[t] = 2, i[t];
|
|
1691
|
+
else if (P(a, t)) return o[t] = 3, a[t];
|
|
1692
|
+
else if (n !== oe && P(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
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 !==
|
|
1699
|
-
if (d = c.config.globalProperties,
|
|
1698
|
+
if (n !== oe && P(n, t)) return o[t] = 4, n[t];
|
|
1699
|
+
if (d = c.config.globalProperties, P(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 &&
|
|
1704
|
+
return cr(i, t) ? (i[t] = n, !0) : process.env.NODE_ENV !== "production" && i.__isScriptSetup && P(i, t) ? (fn(`Cannot mutate <script setup> binding "${t}" from Options API.`), !1) : r !== oe && P(r, t) ? (r[t] = n, !0) : P(e.props, t) ? (process.env.NODE_ENV !== "production" && fn(`Attempting to mutate prop "${t}". Props are readonly.`), !1) : t[0] === "$" && t.slice(1) in e ? (process.env.NODE_ENV !== "production" && fn(`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,25 +1709,25 @@ 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 !== oe && s[0] !== "$" && P(e, s) || cr(t, s) || P(a, s) || P(r, s) || P(sr, s) || P(i.config.globalProperties, s) || (c = o.__cssModules) && c[s]);
|
|
1713
1713
|
},
|
|
1714
1714
|
defineProperty(e, t, n) {
|
|
1715
|
-
return n.get == null ?
|
|
1715
|
+
return n.get == null ? P(n, "value") && this.set(e, t, n.value, null) : e._.accessCache[t] = 0, Reflect.defineProperty(e, t, n);
|
|
1716
1716
|
}
|
|
1717
1717
|
};
|
|
1718
|
-
process.env.NODE_ENV !== "production" && (lr.ownKeys = (e) => (
|
|
1718
|
+
process.env.NODE_ENV !== "production" && (lr.ownKeys = (e) => (fn("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."), Reflect.ownKeys(e)));
|
|
1719
1719
|
function ur(e) {
|
|
1720
|
-
return
|
|
1720
|
+
return F(e) ? e.reduce((e, t) => (e[t] = null, e), {}) : e;
|
|
1721
1721
|
}
|
|
1722
1722
|
var dr = !0;
|
|
1723
1723
|
function fr(e) {
|
|
1724
1724
|
let t = e.type, { mixins: n, extends: r } = t, { mixins: i, optionsCache: a, config: { optionMergeStrategies: o } } = e.appContext, s = a.get(t), c;
|
|
1725
|
-
return s ? c = s : !i.length && !n && !r ? c = t : (c = {}, i.length && i.forEach((e) => pr(c, e, o, !0)), pr(c, t, o)),
|
|
1725
|
+
return s ? c = s : !i.length && !n && !r ? c = t : (c = {}, i.length && i.forEach((e) => pr(c, e, o, !0)), pr(c, t, o)), L(t) && a.set(t, c), c;
|
|
1726
1726
|
}
|
|
1727
1727
|
function pr(e, t, n, r = !1) {
|
|
1728
1728
|
let { mixins: i, extends: a } = t;
|
|
1729
1729
|
a && pr(e, a, n, !0), i && i.forEach((t) => pr(e, t, n, !0));
|
|
1730
|
-
for (let i in t) if (r && i === "expose") process.env.NODE_ENV !== "production" &&
|
|
1730
|
+
for (let i in t) if (r && i === "expose") process.env.NODE_ENV !== "production" && fn("\"expose\" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.");
|
|
1731
1731
|
else {
|
|
1732
1732
|
let r = mr[i] || n && n[i];
|
|
1733
1733
|
e[i] = r ? r(e[i], t[i]) : t[i];
|
|
@@ -1762,14 +1762,14 @@ var mr = {
|
|
|
1762
1762
|
};
|
|
1763
1763
|
function hr(e, t) {
|
|
1764
1764
|
return t ? e ? function() {
|
|
1765
|
-
return
|
|
1765
|
+
return M(I(e) ? e.call(this, this) : e, I(t) ? t.call(this, this) : t);
|
|
1766
1766
|
} : t : e;
|
|
1767
1767
|
}
|
|
1768
1768
|
function gr(e, t) {
|
|
1769
1769
|
return yr(_r(e), _r(t));
|
|
1770
1770
|
}
|
|
1771
1771
|
function _r(e) {
|
|
1772
|
-
if (
|
|
1772
|
+
if (F(e)) {
|
|
1773
1773
|
let t = {};
|
|
1774
1774
|
for (let n = 0; n < e.length; n++) t[e[n]] = e[n];
|
|
1775
1775
|
return t;
|
|
@@ -1780,27 +1780,27 @@ 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 ? M(/* @__PURE__ */ Object.create(null), e, t) : t;
|
|
1784
1784
|
}
|
|
1785
1785
|
function br(e, t) {
|
|
1786
|
-
return e ?
|
|
1786
|
+
return e ? F(e) && F(t) ? [.../* @__PURE__ */ new Set([...e, ...t])] : M(/* @__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 = M(/* @__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
|
}
|
|
1795
1795
|
var Sr = null, Cr = {}, wr = (e) => Object.getPrototypeOf(e) === Cr, Tr = Dr, Er = (e) => e.__isSuspense;
|
|
1796
1796
|
function Dr(e, t) {
|
|
1797
|
-
t && t.pendingBranch ?
|
|
1797
|
+
t && t.pendingBranch ? F(e) ? t.effects.push(...e) : t.effects.push(e) : Nn(e);
|
|
1798
1798
|
}
|
|
1799
1799
|
var Or = /* @__PURE__ */ Symbol.for("v-fgt"), kr = /* @__PURE__ */ Symbol.for("v-txt"), Ar = /* @__PURE__ */ Symbol.for("v-cmt");
|
|
1800
1800
|
function jr(e) {
|
|
1801
1801
|
return e ? e.__v_isVNode === !0 : !1;
|
|
1802
1802
|
}
|
|
1803
|
-
var Mr, Nr = (...e) => Rr(...Mr ? Mr(e, Yn) : e), Pr = ({ key: e }) => e ?? null, Fr = ({ ref: e, ref_key: t, ref_for: n }) => (typeof e == "number" && (e = "" + e), e == null ? null :
|
|
1803
|
+
var Mr, Nr = (...e) => Rr(...Mr ? Mr(e, Yn) : e), Pr = ({ key: e }) => e ?? null, Fr = ({ ref: e, ref_key: t, ref_for: n }) => (typeof e == "number" && (e = "" + e), e == null ? null : de(e) || /* @__PURE__ */ Gt(e) || I(e) ? {
|
|
1804
1804
|
i: Yn,
|
|
1805
1805
|
r: e,
|
|
1806
1806
|
k: t,
|
|
@@ -1836,24 +1836,24 @@ function Ir(e, t = null, n = null, r = 0, i = null, a = e === Or ? 0 : 1, o = !1
|
|
|
1836
1836
|
appContext: null,
|
|
1837
1837
|
ctx: Yn
|
|
1838
1838
|
};
|
|
1839
|
-
return s ? (Ur(c, n), a & 128 && e.normalize(c)) : n && (c.shapeFlag |=
|
|
1839
|
+
return s ? (Ur(c, n), a & 128 && e.normalize(c)) : n && (c.shapeFlag |= de(n) ? 8 : 16), process.env.NODE_ENV !== "production" && c.key !== c.key && fn("VNode created with invalid key (NaN). VNode type:", c.type), c;
|
|
1840
1840
|
}
|
|
1841
1841
|
var Lr = process.env.NODE_ENV === "production" ? Rr : Nr;
|
|
1842
1842
|
function Rr(e, t = null, n = null, r = 0, i = null, a = !1) {
|
|
1843
|
-
if ((!e || e === ar) && (process.env.NODE_ENV !== "production" && !e &&
|
|
1843
|
+
if ((!e || e === ar) && (process.env.NODE_ENV !== "production" && !e && fn(`Invalid vnode type when creating vnode: ${e}.`), e = Ar), jr(e)) {
|
|
1844
1844
|
let r = Br(e, t, !0);
|
|
1845
1845
|
return n && Ur(r, n), r.patchFlag = -2, r;
|
|
1846
1846
|
}
|
|
1847
1847
|
if (ni(e) && (e = e.__vccOpts), t) {
|
|
1848
1848
|
t = zr(t);
|
|
1849
1849
|
let { class: e, style: n } = t;
|
|
1850
|
-
e && !
|
|
1850
|
+
e && !de(e) && (t.class = W(e)), L(n) && (/* @__PURE__ */ Vt(n) && !F(n) && (n = M({}, n)), t.style = H(n));
|
|
1851
1851
|
}
|
|
1852
|
-
let o =
|
|
1853
|
-
return process.env.NODE_ENV !== "production" && o & 4 && /* @__PURE__ */
|
|
1852
|
+
let o = de(e) ? 1 : Er(e) ? 128 : rr(e) ? 64 : L(e) ? 4 : I(e) ? 2 : 0;
|
|
1853
|
+
return process.env.NODE_ENV !== "production" && o & 4 && /* @__PURE__ */ Vt(e) && (e = /* @__PURE__ */ q(e), fn("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__ */
|
|
1856
|
+
return e ? /* @__PURE__ */ Vt(e) || wr(e) ? M({}, 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 = {
|
|
@@ -1862,10 +1862,10 @@ function Br(e, t, n = !1, r = !1) {
|
|
|
1862
1862
|
type: e.type,
|
|
1863
1863
|
props: l,
|
|
1864
1864
|
key: l && Pr(l),
|
|
1865
|
-
ref: t && t.ref ? n && a ?
|
|
1865
|
+
ref: t && t.ref ? n && a ? F(a) ? a.concat(Fr(t)) : [a, Fr(t)] : Fr(t) : a,
|
|
1866
1866
|
scopeId: e.scopeId,
|
|
1867
1867
|
slotScopeIds: e.slotScopeIds,
|
|
1868
|
-
children: process.env.NODE_ENV !== "production" && o === -1 &&
|
|
1868
|
+
children: process.env.NODE_ENV !== "production" && o === -1 && F(s) ? s.map(Vr) : s,
|
|
1869
1869
|
target: e.target,
|
|
1870
1870
|
targetStart: e.targetStart,
|
|
1871
1871
|
targetAnchor: e.targetAnchor,
|
|
@@ -1891,7 +1891,7 @@ function Br(e, t, n = !1, r = !1) {
|
|
|
1891
1891
|
}
|
|
1892
1892
|
function Vr(e) {
|
|
1893
1893
|
let t = Br(e);
|
|
1894
|
-
return
|
|
1894
|
+
return F(e.children) && (t.children = e.children.map(Vr)), t;
|
|
1895
1895
|
}
|
|
1896
1896
|
function Hr(e = " ", t = 0) {
|
|
1897
1897
|
return Lr(kr, null, e, t);
|
|
@@ -1899,13 +1899,13 @@ function Hr(e = " ", t = 0) {
|
|
|
1899
1899
|
function Ur(e, t) {
|
|
1900
1900
|
let n = 0, { shapeFlag: r } = e;
|
|
1901
1901
|
if (t == null) t = null;
|
|
1902
|
-
else if (
|
|
1902
|
+
else if (F(t)) n = 16;
|
|
1903
1903
|
else if (typeof t == "object") if (r & 65) {
|
|
1904
1904
|
let n = t.default;
|
|
1905
1905
|
n && (n._c && (n._d = !1), Ur(e, n()), n._c && (n._d = !0));
|
|
1906
1906
|
return;
|
|
1907
1907
|
} else n = 32, !t._ && !wr(t) && (t._ctx = Yn);
|
|
1908
|
-
else if (
|
|
1908
|
+
else if (I(t)) {
|
|
1909
1909
|
if (r & 65) {
|
|
1910
1910
|
Ur(e, { default: t });
|
|
1911
1911
|
return;
|
|
@@ -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 (j(e)) {
|
|
1927
1927
|
let n = t[e], i = r[e];
|
|
1928
|
-
i && n !== i && !(
|
|
1928
|
+
i && n !== i && !(F(n) && n.includes(i)) ? t[e] = n ? [].concat(n, i) : i : i == null && n == null && !se(e) && (t[e] = i);
|
|
1929
1929
|
} else e !== "" && (t[e] = r[e]);
|
|
1930
1930
|
}
|
|
1931
1931
|
return t;
|
|
@@ -1952,7 +1952,7 @@ function Yr(e) {
|
|
|
1952
1952
|
var Xr = !1;
|
|
1953
1953
|
process.env.NODE_ENV;
|
|
1954
1954
|
function Zr(e) {
|
|
1955
|
-
return e.exposed ? e.exposeProxy ||= new Proxy(
|
|
1955
|
+
return e.exposed ? e.exposeProxy ||= new Proxy(Qt(Ht(e.exposed)), {
|
|
1956
1956
|
get(t, n) {
|
|
1957
1957
|
if (n in t) return t[n];
|
|
1958
1958
|
if (n in sr) return sr[n](e);
|
|
@@ -1964,7 +1964,7 @@ function Zr(e) {
|
|
|
1964
1964
|
}
|
|
1965
1965
|
var Qr = /(?:^|[-_])\w/g, $r = (e) => e.replace(Qr, (e) => e.toUpperCase()).replace(/[-_]/g, "");
|
|
1966
1966
|
function ei(e, t = !0) {
|
|
1967
|
-
return
|
|
1967
|
+
return I(e) ? e.displayName || e.name : e.name || t && e.__name;
|
|
1968
1968
|
}
|
|
1969
1969
|
function ti(e, t, n = !1) {
|
|
1970
1970
|
let r = ei(t);
|
|
@@ -1981,10 +1981,10 @@ function ti(e, t, n = !1) {
|
|
|
1981
1981
|
return r ? $r(r) : n ? "App" : "Anonymous";
|
|
1982
1982
|
}
|
|
1983
1983
|
function ni(e) {
|
|
1984
|
-
return
|
|
1984
|
+
return I(e) && "__vccOpts" in e;
|
|
1985
1985
|
}
|
|
1986
1986
|
var ri = (e, t) => {
|
|
1987
|
-
let n = /* @__PURE__ */
|
|
1987
|
+
let n = /* @__PURE__ */ en(e, t, Xr);
|
|
1988
1988
|
if (process.env.NODE_ENV !== "production") {
|
|
1989
1989
|
let e = Kr();
|
|
1990
1990
|
e && e.appContext.config.warnRecursiveComputed && (n._warnRecursive = !0);
|
|
@@ -1996,13 +1996,13 @@ function ii() {
|
|
|
1996
1996
|
let e = { style: "color:#3ba776" }, t = { style: "color:#1677ff" }, n = { style: "color:#f5222d" }, r = { style: "color:#eb2f96" }, i = {
|
|
1997
1997
|
__vue_custom_formatter: !0,
|
|
1998
1998
|
header(t) {
|
|
1999
|
-
if (!
|
|
1999
|
+
if (!L(t)) return null;
|
|
2000
2000
|
if (t.__isVue) return [
|
|
2001
2001
|
"div",
|
|
2002
2002
|
e,
|
|
2003
2003
|
"VueInstance"
|
|
2004
2004
|
];
|
|
2005
|
-
if (/* @__PURE__ */
|
|
2005
|
+
if (/* @__PURE__ */ Gt(t)) {
|
|
2006
2006
|
Ve();
|
|
2007
2007
|
let n = t.value;
|
|
2008
2008
|
return He(), [
|
|
@@ -2017,25 +2017,25 @@ function ii() {
|
|
|
2017
2017
|
s(n),
|
|
2018
2018
|
">"
|
|
2019
2019
|
];
|
|
2020
|
-
} else if (/* @__PURE__ */
|
|
2020
|
+
} else if (/* @__PURE__ */ Rt(t)) return [
|
|
2021
2021
|
"div",
|
|
2022
2022
|
{},
|
|
2023
2023
|
[
|
|
2024
2024
|
"span",
|
|
2025
2025
|
e,
|
|
2026
|
-
/* @__PURE__ */
|
|
2026
|
+
/* @__PURE__ */ Bt(t) ? "ShallowReactive" : "Reactive"
|
|
2027
2027
|
],
|
|
2028
2028
|
"<",
|
|
2029
2029
|
s(t),
|
|
2030
|
-
`>${/* @__PURE__ */
|
|
2030
|
+
`>${/* @__PURE__ */ zt(t) ? " (readonly)" : ""}`
|
|
2031
2031
|
];
|
|
2032
|
-
else if (/* @__PURE__ */
|
|
2032
|
+
else if (/* @__PURE__ */ zt(t)) return [
|
|
2033
2033
|
"div",
|
|
2034
2034
|
{},
|
|
2035
2035
|
[
|
|
2036
2036
|
"span",
|
|
2037
2037
|
e,
|
|
2038
|
-
/* @__PURE__ */
|
|
2038
|
+
/* @__PURE__ */ Bt(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__ */
|
|
2059
|
+
e.type.props && e.props && t.push(o("props", /* @__PURE__ */ q(e.props))), e.setupState !== oe && t.push(o("setup", e.setupState)), e.data !== oe && t.push(o("data", /* @__PURE__ */ q(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 = M({}, t), Object.keys(t).length ? [
|
|
2076
2076
|
"div",
|
|
2077
2077
|
{ style: "line-height:1.25em;margin-bottom:0.6em" },
|
|
2078
2078
|
[
|
|
@@ -2109,7 +2109,7 @@ function ii() {
|
|
|
2109
2109
|
"span",
|
|
2110
2110
|
r,
|
|
2111
2111
|
e
|
|
2112
|
-
] :
|
|
2112
|
+
] : L(e) ? ["object", { object: i ? /* @__PURE__ */ q(e) : e }] : [
|
|
2113
2113
|
"span",
|
|
2114
2114
|
n,
|
|
2115
2115
|
String(e)
|
|
@@ -2117,17 +2117,17 @@ function ii() {
|
|
|
2117
2117
|
}
|
|
2118
2118
|
function c(e, t) {
|
|
2119
2119
|
let n = e.type;
|
|
2120
|
-
if (
|
|
2120
|
+
if (I(n)) return;
|
|
2121
2121
|
let r = {};
|
|
2122
2122
|
for (let i in e.ctx) l(n, i, t) && (r[i] = e.ctx[i]);
|
|
2123
2123
|
return r;
|
|
2124
2124
|
}
|
|
2125
2125
|
function l(e, t, n) {
|
|
2126
2126
|
let r = e[n];
|
|
2127
|
-
if (
|
|
2127
|
+
if (F(r) && r.includes(t) || L(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__ */ Bt(e) ? "ShallowRef" : e.effect ? "ComputedRef" : "Ref";
|
|
2131
2131
|
}
|
|
2132
2132
|
window.devtoolsFormatters ? window.devtoolsFormatters.push(i) : window.devtoolsFormatters = [i];
|
|
2133
2133
|
}
|
|
@@ -4005,52 +4005,52 @@ 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: re = 0, onLog: ae, onLlmChange: oe, imageContentFormat: A = "openai", staleReadInvalidation: j = !0, debug: se = !1 } = e, M = g ?? Ts;
|
|
4009
|
+
(!Number.isFinite(M) || M < 1) && (console.warn(`[page-agent-sdk] maxToolRounds=${M} 非法(须 ≥1 正整数),已 clamp 到 1(0/负数致主循环 while 不进 → agent 不调 LLM 静默返回兜底文案)`), M = 1);
|
|
4010
|
+
let ce = v({
|
|
4011
4011
|
model: c,
|
|
4012
4012
|
contextWindow: e.contextWindow,
|
|
4013
4013
|
maxOutputTokens: e.maxOutputTokens,
|
|
4014
4014
|
vision: e.vision
|
|
4015
|
-
}),
|
|
4016
|
-
function
|
|
4017
|
-
|
|
4015
|
+
}), N = u ?? ce.maxOutputTokens, P = b(ce.contextWindow), F = x(ce.contextWindow);
|
|
4016
|
+
function le(e) {
|
|
4017
|
+
ce = e, P = b(ce.contextWindow), F = x(ce.contextWindow);
|
|
4018
4018
|
}
|
|
4019
|
-
let
|
|
4019
|
+
let ue = /* @__PURE__ */ qt([]), I = 0, de = () => ({
|
|
4020
4020
|
retries: 0,
|
|
4021
4021
|
exhausted: 0
|
|
4022
|
-
}),
|
|
4023
|
-
transitional_retry:
|
|
4024
|
-
completion_gate:
|
|
4025
|
-
evidence_audit_gate:
|
|
4026
|
-
zero_tool_gate:
|
|
4027
|
-
status_query_gate:
|
|
4028
|
-
...e.pageAssertionGate === !0 ? { page_assertion_gate:
|
|
4029
|
-
},
|
|
4022
|
+
}), fe = {
|
|
4023
|
+
transitional_retry: de(),
|
|
4024
|
+
completion_gate: de(),
|
|
4025
|
+
evidence_audit_gate: de(),
|
|
4026
|
+
zero_tool_gate: de(),
|
|
4027
|
+
status_query_gate: de(),
|
|
4028
|
+
...e.pageAssertionGate === !0 ? { page_assertion_gate: de() } : {}
|
|
4029
|
+
}, L = {
|
|
4030
4030
|
ZERO_TOOL_GATE_EXHAUSTED: "zero_tool_gate",
|
|
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
|
-
},
|
|
4034
|
+
}, pe = [], me = 0, he = 0, R = /* @__PURE__ */ new Set();
|
|
4035
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
|
-
|
|
4041
|
+
ue.value.push(n), ue.value.length > Es && ue.value.splice(0, ue.value.length - Es), Xt(ue), ae?.(n), se && console.log(`%c[Agent] ${e}`, "color:#667eea;font-weight:bold", t);
|
|
4042
4042
|
}
|
|
4043
4043
|
let B = (e) => {
|
|
4044
|
-
|
|
4044
|
+
ue.value.push({
|
|
4045
4045
|
...e,
|
|
4046
4046
|
timestamp: typeof e.timestamp == "number" ? e.timestamp : Date.now(),
|
|
4047
4047
|
data: As(e.data)
|
|
4048
|
-
}),
|
|
4048
|
+
}), ue.value.length > Es && ue.value.splice(0, ue.value.length - Es), Xt(ue);
|
|
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,
|
|
4053
|
-
maxTokens:
|
|
4053
|
+
maxTokens: N,
|
|
4054
4054
|
maxRetries: 0,
|
|
4055
4055
|
configuration: {
|
|
4056
4056
|
...s ? { baseURL: T(s) } : {},
|
|
@@ -4087,16 +4087,16 @@ 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(ce.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,窗口 ${ce.contextWindow} 的 ${be * 100}%),drop 非核心段:${a.join(", ")}(保 base/mission/workingMemory)`);
|
|
4098
4098
|
}
|
|
4099
|
-
return
|
|
4099
|
+
return pe = t.map((e) => ({
|
|
4100
4100
|
name: e.name,
|
|
4101
4101
|
tokens: e.tokens,
|
|
4102
4102
|
dropped: i.has(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 = ce.vision && n.images?.length ? yi(e, n.images, A) : 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
|
-
|
|
4124
|
+
me += 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(
|
|
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(ce.contextWindow * .3)), s = o.reduce((e, t) => e + r(t), 0);
|
|
4158
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: ce.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) ? (
|
|
4169
|
+
throw ba(a) ? (he += 1, z("error", {
|
|
4170
4170
|
stage: "model_unavailable",
|
|
4171
4171
|
at: "launch",
|
|
4172
4172
|
status: a?.status
|
|
4173
|
-
})) : (
|
|
4173
|
+
})) : (he += 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(),
|
|
4202
|
+
if (a instanceof da) throw s.abort(), he += 1, z("error", {
|
|
4203
4203
|
stage: a instanceof fa ? "stream_max_duration" : "stream_stalled",
|
|
4204
4204
|
waitedMs: a.waitedMs,
|
|
4205
4205
|
stallMs: E,
|
|
@@ -4213,20 +4213,20 @@ 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(
|
|
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(ce.contextWindow * .3)), s = o.reduce((e, t) => e + r(t), 0);
|
|
4217
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: ce.contextWindow
|
|
4222
|
+
}), console.warn(`[page-agent-sdk] 上下文超限 → 激进 trim 重试:${a} → ${s} tokens(窗口 ${ce.contextWindow})`), Ce({
|
|
4223
4223
|
...e,
|
|
4224
4224
|
messages: o
|
|
4225
4225
|
}, t, n, i);
|
|
4226
4226
|
}
|
|
4227
4227
|
let o = (e._iterRetries ?? 0) + 1;
|
|
4228
4228
|
if (l === null && u === "" && o <= S && sa(a, n)) {
|
|
4229
|
-
e._iterRetries = o,
|
|
4229
|
+
e._iterRetries = o, me += 1;
|
|
4230
4230
|
let s = C * 2 ** (o - 1);
|
|
4231
4231
|
if (z("error", {
|
|
4232
4232
|
stage: "model_retry",
|
|
@@ -4258,11 +4258,11 @@ function Is(e) {
|
|
|
4258
4258
|
}
|
|
4259
4259
|
return Ce(e, t, n, i);
|
|
4260
4260
|
}
|
|
4261
|
-
throw ba(a) ? (
|
|
4261
|
+
throw ba(a) ? (he += 1, z("error", {
|
|
4262
4262
|
stage: "model_unavailable",
|
|
4263
4263
|
at: "iterate",
|
|
4264
4264
|
status: a?.status
|
|
4265
|
-
})) : (
|
|
4265
|
+
})) : (he += 1, z("error", {
|
|
4266
4266
|
stage: "model_call_failed",
|
|
4267
4267
|
at: "iterate",
|
|
4268
4268
|
emitted: l !== null || u !== "",
|
|
@@ -4278,7 +4278,7 @@ function Is(e) {
|
|
|
4278
4278
|
stage: "empty_llm_response",
|
|
4279
4279
|
retried: !0,
|
|
4280
4280
|
hint: "重试后仍零 chunk,抛 EmptyLLMResponseError 显式报错"
|
|
4281
|
-
}),
|
|
4281
|
+
}), he += 1, new ma();
|
|
4282
4282
|
}
|
|
4283
4283
|
let d = l;
|
|
4284
4284
|
return {
|
|
@@ -4321,8 +4321,8 @@ function Is(e) {
|
|
|
4321
4321
|
files: e.state.files,
|
|
4322
4322
|
vfsAvailable: !!e.state.files && o,
|
|
4323
4323
|
toolName: e.name,
|
|
4324
|
-
threshold:
|
|
4325
|
-
passThroughChars:
|
|
4324
|
+
threshold: P,
|
|
4325
|
+
passThroughChars: F
|
|
4326
4326
|
}).content, {
|
|
4327
4327
|
content: a,
|
|
4328
4328
|
status: "done"
|
|
@@ -4341,7 +4341,7 @@ function Is(e) {
|
|
|
4341
4341
|
return js(e, t);
|
|
4342
4342
|
}
|
|
4343
4343
|
function K(e) {
|
|
4344
|
-
return !
|
|
4344
|
+
return !se && !ae ? [] : 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;
|
|
@@ -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(ce.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,窗口 ${ce.contextWindow} 的 ${be * 100}%);请缩减 systemPrompt 或换更大窗口模型`;
|
|
4375
4375
|
return console.error(r), n({
|
|
4376
4376
|
type: "error",
|
|
4377
4377
|
message: r,
|
|
@@ -4391,7 +4391,7 @@ function Is(e) {
|
|
|
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: M,
|
|
4395
4395
|
invokeUsage: {
|
|
4396
4396
|
prompt_tokens: 0,
|
|
4397
4397
|
completion_tokens: 0,
|
|
@@ -4410,14 +4410,14 @@ function Is(e) {
|
|
|
4410
4410
|
}])), v = /* @__PURE__ */ new Map(), b = 0, x = (e) => {
|
|
4411
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 预算(约 ${
|
|
4413
|
+
}, S = 0, C = 0, w = Ms(M, _), T = null, E = 0, D = !1, O = !1, ee = !1;
|
|
4414
|
+
for (; (S < M || ee) && C < w && (C++, !r?.aborted);) {
|
|
4415
|
+
if (re > 0 && d.invokeUsage.total_tokens > re) {
|
|
4416
|
+
let e = `本轮 token 预算(约 ${re})已用尽:任务在 ${S} 轮工具调用后中断,已完成的部分均保留。可继续对话,指定下一步(如「继续完成」/「只改 X」/「提高预算重试」)。`;
|
|
4417
4417
|
return z("error", {
|
|
4418
4418
|
stage: "round_token_budget_exceeded",
|
|
4419
4419
|
used: d.invokeUsage.total_tokens,
|
|
4420
|
-
budget:
|
|
4420
|
+
budget: re,
|
|
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: re
|
|
4430
4430
|
}
|
|
4431
4431
|
}), n({
|
|
4432
4432
|
type: "done",
|
|
@@ -4439,7 +4439,7 @@ 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, M, e.hasSubagent)), c = G(c, Math.round(ce.contextWindow * .6)), z("llm_request", {
|
|
4443
4443
|
round: S + 1,
|
|
4444
4444
|
model: ve(),
|
|
4445
4445
|
tools: V.map((e) => e.name),
|
|
@@ -4450,7 +4450,7 @@ function Is(e) {
|
|
|
4450
4450
|
state: H
|
|
4451
4451
|
});
|
|
4452
4452
|
c.push(t.message);
|
|
4453
|
-
let a =
|
|
4453
|
+
let a = ie(t.message);
|
|
4454
4454
|
if (z("llm_response", {
|
|
4455
4455
|
round: S + 1,
|
|
4456
4456
|
content: t.content,
|
|
@@ -4462,7 +4462,7 @@ 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 = ie(t.message);
|
|
4466
4466
|
if ((n === "length" || !t.content && (r?.completion_tokens ?? 0) >= 4e3) && !D) {
|
|
4467
4467
|
D = !0, ee = !0, z("error", {
|
|
4468
4468
|
stage: "completion_truncated_retry",
|
|
@@ -4527,7 +4527,7 @@ function Is(e) {
|
|
|
4527
4527
|
turnUsage: f,
|
|
4528
4528
|
isWriteToolByName: x,
|
|
4529
4529
|
messages: c,
|
|
4530
|
-
sessionWritePaths:
|
|
4530
|
+
sessionWritePaths: R,
|
|
4531
4531
|
todosStatusAtStart: g,
|
|
4532
4532
|
pageGate: e.pageAssertionGate === !0,
|
|
4533
4533
|
pageReadTools: e.pageReadTools,
|
|
@@ -4535,7 +4535,7 @@ function Is(e) {
|
|
|
4535
4535
|
});
|
|
4536
4536
|
if (a?.kind === "feedback") {
|
|
4537
4537
|
ee = !0;
|
|
4538
|
-
let e =
|
|
4538
|
+
let e = fe[a.gate.stage];
|
|
4539
4539
|
e && (e.retries += 1), z("middleware", {
|
|
4540
4540
|
stage: a.gate.stage,
|
|
4541
4541
|
attempt: a.gate.attempt,
|
|
@@ -4545,8 +4545,8 @@ function Is(e) {
|
|
|
4545
4545
|
continue;
|
|
4546
4546
|
}
|
|
4547
4547
|
if (a?.kind === "observable") {
|
|
4548
|
-
let e =
|
|
4549
|
-
e &&
|
|
4548
|
+
let e = L[a.obs.code];
|
|
4549
|
+
e && fe[e] && (fe[e].exhausted += 1), z("error", {
|
|
4550
4550
|
stage: a.obs.code,
|
|
4551
4551
|
...a.obs.context,
|
|
4552
4552
|
content: t.content.slice(0, 160)
|
|
@@ -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) R.add(e);
|
|
4697
4697
|
}
|
|
4698
4698
|
}
|
|
4699
|
-
if (
|
|
4699
|
+
if (j && 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,
|
|
4704
|
+
e.invalidatedCount > 0 && (c = e.messages, I += 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,29 +4715,29 @@ function Is(e) {
|
|
|
4715
4715
|
type: "done",
|
|
4716
4716
|
content: ""
|
|
4717
4717
|
}), "";
|
|
4718
|
-
let te = `\n\n(提示:工具调用次数已达上限(${
|
|
4718
|
+
let te = `\n\n(提示:工具调用次数已达上限(${M} 轮 / ${w} 次迭代),以上为基于已完成操作的阶段性结果,任务可能未完成。回复「继续」或告诉我下一步重点,即可接着做。)`;
|
|
4719
4719
|
z("error", {
|
|
4720
4720
|
stage: "react_call_limit_exceeded",
|
|
4721
4721
|
rounds: S,
|
|
4722
|
-
maxToolRounds:
|
|
4722
|
+
maxToolRounds: M,
|
|
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}/${M},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: M,
|
|
4733
4733
|
iterations: C,
|
|
4734
4734
|
maxIterations: w
|
|
4735
4735
|
}
|
|
4736
4736
|
});
|
|
4737
|
-
let
|
|
4738
|
-
if (
|
|
4739
|
-
|
|
4740
|
-
let e =
|
|
4737
|
+
let ae = cs(H.todos ?? [], g, R);
|
|
4738
|
+
if (ae.length) {
|
|
4739
|
+
fe.evidence_audit_gate.exhausted += 1;
|
|
4740
|
+
let e = ae.map((e) => ({
|
|
4741
4741
|
id: e.id,
|
|
4742
4742
|
evidence: e.evidence
|
|
4743
4743
|
}));
|
|
@@ -4746,7 +4746,7 @@ function Is(e) {
|
|
|
4746
4746
|
offenders: e
|
|
4747
4747
|
}), n({
|
|
4748
4748
|
type: "error",
|
|
4749
|
-
message: `轮次耗尽收口:${
|
|
4749
|
+
message: `轮次耗尽收口:${ae.length} 项已完成任务的 evidence 路径与写入记录不符,最终回复中的完成声明可能不实`,
|
|
4750
4750
|
severity: "observable",
|
|
4751
4751
|
code: "AUDIT_EVIDENCE_SUSPECT",
|
|
4752
4752
|
context: { offenders: e }
|
|
@@ -4759,8 +4759,8 @@ function Is(e) {
|
|
|
4759
4759
|
content: e
|
|
4760
4760
|
}), e;
|
|
4761
4761
|
}
|
|
4762
|
-
let
|
|
4763
|
-
if (
|
|
4762
|
+
let oe = c[c.length - 1];
|
|
4763
|
+
if (oe && Te(oe) === "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",
|
|
@@ -4800,11 +4800,11 @@ function Is(e) {
|
|
|
4800
4800
|
}), e + te;
|
|
4801
4801
|
}
|
|
4802
4802
|
}
|
|
4803
|
-
let
|
|
4803
|
+
let A = "我已完成本轮能做的操作,但未能综合出最终结论。请基于上方已完成的工具操作结果继续,或告诉我下一步重点。";
|
|
4804
4804
|
return n({
|
|
4805
4805
|
type: "done",
|
|
4806
|
-
content:
|
|
4807
|
-
}),
|
|
4806
|
+
content: A + te
|
|
4807
|
+
}), A + te;
|
|
4808
4808
|
} finally {
|
|
4809
4809
|
try {
|
|
4810
4810
|
await hs(h, H);
|
|
@@ -4824,7 +4824,7 @@ function Is(e) {
|
|
|
4824
4824
|
V = [...h.flatMap((e) => e.tools || []), ...e], ye();
|
|
4825
4825
|
}
|
|
4826
4826
|
function ke(e) {
|
|
4827
|
-
ge = e, ye(),
|
|
4827
|
+
ge = e, ye(), oe?.(e);
|
|
4828
4828
|
}
|
|
4829
4829
|
return {
|
|
4830
4830
|
invoke: De,
|
|
@@ -4833,19 +4833,19 @@ function Is(e) {
|
|
|
4833
4833
|
get allTools() {
|
|
4834
4834
|
return V;
|
|
4835
4835
|
},
|
|
4836
|
-
getStaleReadsInvalidated: () =>
|
|
4837
|
-
getLlmRetries: () =>
|
|
4838
|
-
getLlmCallFailures: () =>
|
|
4839
|
-
getGateStats: () =>
|
|
4840
|
-
getLastSystemSegments: () =>
|
|
4836
|
+
getStaleReadsInvalidated: () => I,
|
|
4837
|
+
getLlmRetries: () => me,
|
|
4838
|
+
getLlmCallFailures: () => he,
|
|
4839
|
+
getGateStats: () => fe,
|
|
4840
|
+
getLastSystemSegments: () => pe,
|
|
4841
4841
|
resetSessionCounters: () => {
|
|
4842
|
-
|
|
4843
|
-
for (let e of Object.keys(
|
|
4842
|
+
I = 0, me = 0, he = 0;
|
|
4843
|
+
for (let e of Object.keys(fe)) fe[e] = de();
|
|
4844
4844
|
},
|
|
4845
4845
|
setTools: Oe,
|
|
4846
4846
|
setLlm: ke,
|
|
4847
|
-
setModelCaps:
|
|
4848
|
-
debugLogs:
|
|
4847
|
+
setModelCaps: le,
|
|
4848
|
+
debugLogs: ue,
|
|
4849
4849
|
getEffectiveSystemPrompt: () => xe()
|
|
4850
4850
|
};
|
|
4851
4851
|
}
|
|
@@ -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 = ie(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 re, ae = new Promise((e, t) => {
|
|
6660
|
+
re = 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, ae]), E.getState());
|
|
6667
6667
|
} finally {
|
|
6668
|
-
clearTimeout(
|
|
6668
|
+
clearTimeout(re), ee();
|
|
6669
6669
|
}
|
|
6670
6670
|
}
|
|
6671
6671
|
function uu(e) {
|
|
@@ -7300,7 +7300,7 @@ function Au(e, t = {}) {
|
|
|
7300
7300
|
//#endregion
|
|
7301
7301
|
//#region src/core/utils/rawRead.ts
|
|
7302
7302
|
function ju(e) {
|
|
7303
|
-
return /* @__PURE__ */
|
|
7303
|
+
return /* @__PURE__ */ q(e);
|
|
7304
7304
|
}
|
|
7305
7305
|
//#endregion
|
|
7306
7306
|
//#region src/core/harness/checkpoint.ts
|
|
@@ -9447,7 +9447,7 @@ function xf(e, n = {}) {
|
|
|
9447
9447
|
let n = t ?? y;
|
|
9448
9448
|
e === void 0 ? v.delete(n) : v.set(n, e);
|
|
9449
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 = [];
|
|
9450
|
-
async function
|
|
9450
|
+
async function re() {
|
|
9451
9451
|
if (!ee) return {
|
|
9452
9452
|
release: () => {},
|
|
9453
9453
|
reacquire: async () => {}
|
|
@@ -9467,35 +9467,35 @@ function xf(e, n = {}) {
|
|
|
9467
9467
|
};
|
|
9468
9468
|
}
|
|
9469
9469
|
(n.maxParallelTools ?? 1) > 1 && !O && console.warn("[page-agent-sdk] maxParallelTools>1 且未声明 conflictWatchFields:并发写不互锁(后写覆盖前写,既有明文语义);声明 conflictWatchFields 后自动启用写互锁与乐观锁校验");
|
|
9470
|
-
let
|
|
9470
|
+
let ie = (e) => {
|
|
9471
9471
|
let t = k();
|
|
9472
9472
|
return T(t, e), t;
|
|
9473
|
-
},
|
|
9473
|
+
}, ae = n.largeTextThreshold ?? 200, oe = (n.largeTextPaths ?? []).map((e) => {
|
|
9474
9474
|
let t = e.lastIndexOf(".");
|
|
9475
9475
|
return t > 0 ? {
|
|
9476
9476
|
arrayPath: e.slice(0, t),
|
|
9477
9477
|
field: e.slice(t + 1)
|
|
9478
9478
|
} : null;
|
|
9479
|
-
}).filter((e) => e !== null),
|
|
9480
|
-
function
|
|
9481
|
-
|
|
9479
|
+
}).filter((e) => e !== null), A = !0;
|
|
9480
|
+
function j() {
|
|
9481
|
+
A = !0;
|
|
9482
9482
|
}
|
|
9483
|
-
let
|
|
9483
|
+
let se = {
|
|
9484
9484
|
get: () => ({
|
|
9485
9485
|
schema: o,
|
|
9486
9486
|
bind: c,
|
|
9487
9487
|
description: u
|
|
9488
9488
|
}),
|
|
9489
9489
|
set: (e) => {
|
|
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(),
|
|
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(), j();
|
|
9491
9491
|
},
|
|
9492
9492
|
update: (e) => {
|
|
9493
|
-
c = e, g.length = 0, v.clear(),
|
|
9493
|
+
c = e, g.length = 0, v.clear(), j();
|
|
9494
9494
|
},
|
|
9495
|
-
markDataDirty:
|
|
9495
|
+
markDataDirty: j,
|
|
9496
9496
|
consumeDataDirty: () => {
|
|
9497
|
-
let e =
|
|
9498
|
-
return
|
|
9497
|
+
let e = A;
|
|
9498
|
+
return A = !1, e;
|
|
9499
9499
|
},
|
|
9500
9500
|
enterScope: (e) => {
|
|
9501
9501
|
let t = y;
|
|
@@ -9549,14 +9549,14 @@ function xf(e, n = {}) {
|
|
|
9549
9549
|
} : void 0,
|
|
9550
9550
|
updateResource: p ? (e, t) => {
|
|
9551
9551
|
let n = Hd(e);
|
|
9552
|
-
p.update(n, t), Mc(c, n, t),
|
|
9552
|
+
p.update(n, t), Mc(c, n, t), j(), T(k(), "");
|
|
9553
9553
|
} : void 0,
|
|
9554
9554
|
deleteResource: p ? (e) => p.delete(e) : void 0,
|
|
9555
9555
|
listResources: p ? () => p.list() : void 0
|
|
9556
|
-
},
|
|
9556
|
+
}, M = (e) => {
|
|
9557
9557
|
n.onAudit?.(e);
|
|
9558
9558
|
};
|
|
9559
|
-
function
|
|
9559
|
+
function ce(e, t) {
|
|
9560
9560
|
let n = Pc(l()), r = g.length ? g[g.length - 1].id + 1 : 1;
|
|
9561
9561
|
for (g.push({
|
|
9562
9562
|
id: r,
|
|
@@ -9567,7 +9567,7 @@ function xf(e, n = {}) {
|
|
|
9567
9567
|
}); g.length > _;) g.shift();
|
|
9568
9568
|
return r;
|
|
9569
9569
|
}
|
|
9570
|
-
async function
|
|
9570
|
+
async function N(e, t, r, i, a) {
|
|
9571
9571
|
if (!t || t === "") return null;
|
|
9572
9572
|
let o = k();
|
|
9573
9573
|
if (o === t) return null;
|
|
@@ -9589,7 +9589,7 @@ function xf(e, n = {}) {
|
|
|
9589
9589
|
if (u.action === "restore") {
|
|
9590
9590
|
await i?.reacquire();
|
|
9591
9591
|
let e = k();
|
|
9592
|
-
if (e !== o) return
|
|
9592
|
+
if (e !== o) return M({
|
|
9593
9593
|
op: "conflict_recheck",
|
|
9594
9594
|
detail: `restore 裁决基于 ${o} 恢复时 ${e}(ask 窗口新修改落地,回退被拦)`,
|
|
9595
9595
|
timestamp: Date.now()
|
|
@@ -9605,13 +9605,13 @@ function xf(e, n = {}) {
|
|
|
9605
9605
|
message: `restore 裁决所锚定的快照 #${s} 已不在快照栈(可能被 maxSnapshots 淘汰)`,
|
|
9606
9606
|
hint: "重新 read 拿最新值,或用 restore_data 显式指定快照 id 回退"
|
|
9607
9607
|
});
|
|
9608
|
-
Kc(c, Pc(t.value)),
|
|
9608
|
+
Kc(c, Pc(t.value)), j();
|
|
9609
9609
|
let n = k();
|
|
9610
9610
|
return T(n, a), `已回退主数据到历史快照 #${t.id}[${t.op}]。当前值:${$(l(), 400)} (hash=${n})。请基于回退后的值重写或停止。`;
|
|
9611
9611
|
}
|
|
9612
9612
|
await i?.reacquire();
|
|
9613
9613
|
let d = k();
|
|
9614
|
-
return d === o ? (T(d, a), null) : (
|
|
9614
|
+
return d === o ? (T(d, a), null) : (M({
|
|
9615
9615
|
op: "conflict_recheck",
|
|
9616
9616
|
detail: `裁决基于 ${o} 恢复时 ${d}(ask 窗口新修改落地,overwrite 被拦)`,
|
|
9617
9617
|
timestamp: Date.now()
|
|
@@ -9621,10 +9621,10 @@ function xf(e, n = {}) {
|
|
|
9621
9621
|
hint: "重新 read 拿最新值与 hash,基于最新值修改后再写入(单次校验,不再二次挂起)。"
|
|
9622
9622
|
}));
|
|
9623
9623
|
}
|
|
9624
|
-
let
|
|
9624
|
+
let P = (e, t = !0) => {
|
|
9625
9625
|
e.writeCapable = t;
|
|
9626
|
-
},
|
|
9627
|
-
let n = b(t), r = await
|
|
9626
|
+
}, F = s(async ({ id: e }, t) => {
|
|
9627
|
+
let n = b(t), r = await re();
|
|
9628
9628
|
try {
|
|
9629
9629
|
if (!g.length) return Z({
|
|
9630
9630
|
code: "NO_SNAPSHOT",
|
|
@@ -9638,7 +9638,7 @@ function xf(e, n = {}) {
|
|
|
9638
9638
|
hint: "用 history_data({list:true}) 查看可用快照序号"
|
|
9639
9639
|
});
|
|
9640
9640
|
let r = o.safeParse(t.value);
|
|
9641
|
-
r.success ||
|
|
9641
|
+
r.success || M({
|
|
9642
9642
|
op: "restore",
|
|
9643
9643
|
detail: `#${t.id} 快照含当前 schema 违例 ${r.error.issues.length} 处(历史既有数据非本次写入,放行回退)`,
|
|
9644
9644
|
timestamp: Date.now()
|
|
@@ -9651,7 +9651,7 @@ function xf(e, n = {}) {
|
|
|
9651
9651
|
cur: n
|
|
9652
9652
|
});
|
|
9653
9653
|
}
|
|
9654
|
-
if (!i.length) return Kc(c, Pc(t.value)),
|
|
9654
|
+
if (!i.length) return Kc(c, Pc(t.value)), j(), M({
|
|
9655
9655
|
op: "restore",
|
|
9656
9656
|
detail: `#${t.id}`,
|
|
9657
9657
|
timestamp: Date.now()
|
|
@@ -9684,7 +9684,7 @@ function xf(e, n = {}) {
|
|
|
9684
9684
|
}
|
|
9685
9685
|
e.val === void 0 ? l.push(e.p) : Mc(c, n, e.val), s.push(e.p);
|
|
9686
9686
|
}
|
|
9687
|
-
|
|
9687
|
+
j(), M({
|
|
9688
9688
|
op: "restore",
|
|
9689
9689
|
detail: `#${t.id}(保护字段保留 ${s.length}${l.length ? `,未能回填 ${l.length}` : ""})`,
|
|
9690
9690
|
timestamp: Date.now()
|
|
@@ -9699,8 +9699,8 @@ function xf(e, n = {}) {
|
|
|
9699
9699
|
description: "把主数据回退到某个快照(不传 id 回退最近一次)。快照列表用 history_data({list:true})。",
|
|
9700
9700
|
schema: t.object({ id: t.number().int().optional().describe("快照序号;不传回退最近一次") })
|
|
9701
9701
|
});
|
|
9702
|
-
F
|
|
9703
|
-
let
|
|
9702
|
+
P(F);
|
|
9703
|
+
let le = s(async ({ id: e, jsonPath: t, list: n }) => {
|
|
9704
9704
|
if (n) {
|
|
9705
9705
|
if (!g.length) return "无快照。set/edit/delete 会自动存快照。";
|
|
9706
9706
|
let e = g.map((e) => {
|
|
@@ -9745,7 +9745,7 @@ function xf(e, n = {}) {
|
|
|
9745
9745
|
jsonPath: t.string().optional().describe("只看快照的某子路径"),
|
|
9746
9746
|
list: t.boolean().optional().describe("true 列出快照时间线(序号/操作/标签/时间/大小)")
|
|
9747
9747
|
})
|
|
9748
|
-
}),
|
|
9748
|
+
}), ue = s(async ({ expr: e, queries: t, limit: n }, r) => {
|
|
9749
9749
|
let i = b(r);
|
|
9750
9750
|
if (typeof c != "object" || !c) return Z({
|
|
9751
9751
|
code: "NOT_OBJECT",
|
|
@@ -9764,7 +9764,7 @@ function xf(e, n = {}) {
|
|
|
9764
9764
|
details: { expr: e }
|
|
9765
9765
|
});
|
|
9766
9766
|
}
|
|
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 === "",
|
|
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 === "", oe, ae, {
|
|
9768
9768
|
rootExempt: !1,
|
|
9769
9769
|
rootPath: String(e.path ?? ""),
|
|
9770
9770
|
fullTextPrefixes: s,
|
|
@@ -9788,7 +9788,7 @@ function xf(e, n = {}) {
|
|
|
9788
9788
|
queries: t.array(t.string()).min(2).max(10).optional().describe("批量模式:2-10 条 JSONPath 一次取回(与 expr 同传按 queries);逐条独立返回,单条失败该项标 error 不整批"),
|
|
9789
9789
|
limit: t.number().int().min(1).max(200).optional().describe("返回结果上限(批量时逐条适用),默认 50")
|
|
9790
9790
|
})
|
|
9791
|
-
}),
|
|
9791
|
+
}), I = s(async ({ query: e, mode: t, fuzzyThreshold: n, matchKey: r, limit: i }) => {
|
|
9792
9792
|
if (c == null) return Z({
|
|
9793
9793
|
code: "EMPTY",
|
|
9794
9794
|
message: "主数据为空,无可搜索内容"
|
|
@@ -9826,7 +9826,7 @@ function xf(e, n = {}) {
|
|
|
9826
9826
|
matchKey: t.boolean().optional().describe("是否同时匹配 key 名,默认 true"),
|
|
9827
9827
|
limit: t.number().int().min(1).max(200).optional().describe("返回上限,默认 50")
|
|
9828
9828
|
})
|
|
9829
|
-
}),
|
|
9829
|
+
}), de = s(async ({ script: e, mode: t, jsonPath: n }, r) => {
|
|
9830
9830
|
let s = b(r);
|
|
9831
9831
|
if (e.length > 8e3) return Z({
|
|
9832
9832
|
code: "SCRIPT_TOO_LARGE",
|
|
@@ -9867,9 +9867,9 @@ function xf(e, n = {}) {
|
|
|
9867
9867
|
details: { scriptLen: e.length }
|
|
9868
9868
|
});
|
|
9869
9869
|
if (u) {
|
|
9870
|
-
let e = await
|
|
9870
|
+
let e = await re();
|
|
9871
9871
|
try {
|
|
9872
|
-
let n = await
|
|
9872
|
+
let n = await N("edit", O ? w(s) : void 0, void 0, e, s);
|
|
9873
9873
|
if (n !== null) return n;
|
|
9874
9874
|
let r = uf({
|
|
9875
9875
|
bindRef: c,
|
|
@@ -9882,13 +9882,13 @@ function xf(e, n = {}) {
|
|
|
9882
9882
|
allowKeys: d,
|
|
9883
9883
|
snapshots: g,
|
|
9884
9884
|
maxSnapshots: _,
|
|
9885
|
-
markDataDirty:
|
|
9885
|
+
markDataDirty: j,
|
|
9886
9886
|
schemaErrorMode: "schema_invalid",
|
|
9887
9887
|
snapshotLabel: "eval_transform_subtree",
|
|
9888
9888
|
internalAfterWrite: a,
|
|
9889
9889
|
protectedCtx: h
|
|
9890
9890
|
});
|
|
9891
|
-
return r.ok ? (
|
|
9891
|
+
return r.ok ? (M({
|
|
9892
9892
|
op: "edit",
|
|
9893
9893
|
detail: `eval_transform_subtree @ ${u}`,
|
|
9894
9894
|
timestamp: Date.now()
|
|
@@ -9903,9 +9903,9 @@ function xf(e, n = {}) {
|
|
|
9903
9903
|
message: `主数据 bind 为原始类型(${c === null ? "null" : typeof c}),eval transform(patches) 无法就地替换`,
|
|
9904
9904
|
hint: "主数据 bind 必须为对象/数组;叶子值请用对象包裹或集成方通过 sdk.setData 替换 bind"
|
|
9905
9905
|
});
|
|
9906
|
-
let e = await
|
|
9906
|
+
let e = await re();
|
|
9907
9907
|
try {
|
|
9908
|
-
let n = await
|
|
9908
|
+
let n = await N("edit", O ? w(s) : void 0, void 0, e, s);
|
|
9909
9909
|
if (n !== null) return n;
|
|
9910
9910
|
let r = uf({
|
|
9911
9911
|
bindRef: c,
|
|
@@ -9914,13 +9914,13 @@ function xf(e, n = {}) {
|
|
|
9914
9914
|
allowKeys: d,
|
|
9915
9915
|
snapshots: g,
|
|
9916
9916
|
maxSnapshots: _,
|
|
9917
|
-
markDataDirty:
|
|
9917
|
+
markDataDirty: j,
|
|
9918
9918
|
schemaErrorMode: "schema_invalid",
|
|
9919
9919
|
snapshotLabel: "eval_transform",
|
|
9920
9920
|
internalAfterWrite: a,
|
|
9921
9921
|
protectedCtx: h
|
|
9922
9922
|
});
|
|
9923
|
-
return r.ok ? (
|
|
9923
|
+
return r.ok ? (M({
|
|
9924
9924
|
op: "edit",
|
|
9925
9925
|
detail: `eval_transform(${r.applied.length} patches)`,
|
|
9926
9926
|
timestamp: Date.now()
|
|
@@ -9944,9 +9944,9 @@ function xf(e, n = {}) {
|
|
|
9944
9944
|
message: `主数据 bind 为原始类型(${c === null ? "null" : typeof c}),eval transform 无法就地替换外部持有的值引用`,
|
|
9945
9945
|
hint: "主数据 bind 必须为对象/数组;叶子值请用对象包裹或集成方通过 sdk.setData 替换 bind"
|
|
9946
9946
|
});
|
|
9947
|
-
let i = await
|
|
9947
|
+
let i = await re();
|
|
9948
9948
|
try {
|
|
9949
|
-
let e = await
|
|
9949
|
+
let e = await N("set", O ? w(s) : void 0, n, i, s);
|
|
9950
9950
|
if (e !== null) return e;
|
|
9951
9951
|
let t = a ? Pc(l()) : null, r = sf({
|
|
9952
9952
|
schema: o,
|
|
@@ -9954,7 +9954,7 @@ function xf(e, n = {}) {
|
|
|
9954
9954
|
value: n,
|
|
9955
9955
|
bindRef: c
|
|
9956
9956
|
});
|
|
9957
|
-
return r.ok ? (
|
|
9957
|
+
return r.ok ? (ce("edit", "eval_transform"), r.wholeParsed ? qc(c, r.assembly) : r.assembly !== null && typeof r.assembly == "object" && jc(c, r.assembly), j(), a && (a(c, t), j()), M({
|
|
9958
9958
|
op: "edit",
|
|
9959
9959
|
detail: "eval_transform",
|
|
9960
9960
|
timestamp: Date.now()
|
|
@@ -9982,8 +9982,8 @@ function xf(e, n = {}) {
|
|
|
9982
9982
|
jsonPath: t.string().optional().describe("子树模式:仅对该子树执行;transform 返回值作为子树新值")
|
|
9983
9983
|
})
|
|
9984
9984
|
});
|
|
9985
|
-
|
|
9986
|
-
let
|
|
9985
|
+
P(de, (e) => e?.mode === "transform");
|
|
9986
|
+
let fe = s(async ({ jsonPath: e, jsonPaths: t, fields: n, depth: r, offset: i, limit: a }, s) => {
|
|
9987
9987
|
let c = b(s), f = x(s), p = l(), m, g = () => m ??= k();
|
|
9988
9988
|
if (t && t.length) {
|
|
9989
9989
|
let e = !1, i = t.map((t) => {
|
|
@@ -10002,7 +10002,7 @@ function xf(e, n = {}) {
|
|
|
10002
10002
|
resolved: s,
|
|
10003
10003
|
resourcesByPath: h.resourcesByPath,
|
|
10004
10004
|
resourceStore: h.resourceStore
|
|
10005
|
-
})), 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 === "", oe, ae, {
|
|
10006
10006
|
rootExempt: !0,
|
|
10007
10007
|
rootPath: i,
|
|
10008
10008
|
fullTextPrefixes: f,
|
|
@@ -10050,7 +10050,7 @@ function xf(e, n = {}) {
|
|
|
10050
10050
|
resolved: S,
|
|
10051
10051
|
resourcesByPath: h.resourcesByPath,
|
|
10052
10052
|
resourceStore: h.resourceStore
|
|
10053
|
-
})), 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 === "", oe, ae, {
|
|
10054
10054
|
rootExempt: !0,
|
|
10055
10055
|
rootPath: _,
|
|
10056
10056
|
fullTextPrefixes: f,
|
|
@@ -10073,10 +10073,10 @@ function xf(e, n = {}) {
|
|
|
10073
10073
|
offset: t.number().int().min(0).optional().describe("数组分页起始偏移(仅数组目标,默认 0)"),
|
|
10074
10074
|
limit: t.number().int().min(1).max(200).optional().describe("数组分页每页条数(默认 50,上限 200),返回切片+total/hasMore")
|
|
10075
10075
|
})
|
|
10076
|
-
}),
|
|
10076
|
+
}), L = s(async ({ value: e, patch: t, patches: n, del: i, dryRun: s }, u) => {
|
|
10077
10077
|
let f = b(u), p = "set";
|
|
10078
10078
|
i ? p = "delete" : (n && n.length || t) && (p = "edit");
|
|
10079
|
-
let m = t?.value === void 0 ? e : t.value, v = await
|
|
10079
|
+
let m = t?.value === void 0 ? e : t.value, v = await re();
|
|
10080
10080
|
try {
|
|
10081
10081
|
let e = O ? w(f) : void 0;
|
|
10082
10082
|
if (s && e !== void 0) {
|
|
@@ -10111,19 +10111,19 @@ function xf(e, n = {}) {
|
|
|
10111
10111
|
hint: e.spec.mode === "freeze" ? "冻结字段不可删" : "verbatim 字段不可直接删;先 resource_delete 释放"
|
|
10112
10112
|
});
|
|
10113
10113
|
}
|
|
10114
|
-
let n = await
|
|
10114
|
+
let n = await N("delete", e, void 0, v, f);
|
|
10115
10115
|
if (n !== null) return n;
|
|
10116
10116
|
if (s) {
|
|
10117
10117
|
let e = Pc(l());
|
|
10118
10118
|
return Nc(e, t.jsonPath) ? `dryRun(delete): 将删除 @ ${t.jsonPath}。预览剩余:${$(e, 600)}。未实际写入、未入快照。` : `dryRun(delete): @ ${t.jsonPath} 不存在(无需删除)。未实际写入。`;
|
|
10119
10119
|
}
|
|
10120
|
-
|
|
10120
|
+
ce("delete");
|
|
10121
10121
|
let r = Nc(c, t.jsonPath);
|
|
10122
|
-
return
|
|
10122
|
+
return j(), M({
|
|
10123
10123
|
op: "delete",
|
|
10124
10124
|
detail: t.jsonPath,
|
|
10125
10125
|
timestamp: Date.now()
|
|
10126
|
-
}), a && (a(c, null),
|
|
10126
|
+
}), a && (a(c, null), j()), T(k(), f), r ? `已删除主数据 @ ${t.jsonPath}` : `主数据 @ ${t.jsonPath} 不存在(无需删除)`;
|
|
10127
10127
|
}
|
|
10128
10128
|
if (p === "edit") {
|
|
10129
10129
|
if (typeof c != "object" || !c) return Z({
|
|
@@ -10131,7 +10131,7 @@ function xf(e, n = {}) {
|
|
|
10131
10131
|
message: `edit 仅适用于对象/数组主数据,当前是 ${c === void 0 ? "undefined" : typeof c}`,
|
|
10132
10132
|
hint: "叶子用 write(value) 整体设置"
|
|
10133
10133
|
});
|
|
10134
|
-
let r = await
|
|
10134
|
+
let r = await N("edit", e, void 0, v, f);
|
|
10135
10135
|
if (r !== null) return r;
|
|
10136
10136
|
let i = n && n.length ? n : [{
|
|
10137
10137
|
op: t.op ?? "set",
|
|
@@ -10144,7 +10144,7 @@ function xf(e, n = {}) {
|
|
|
10144
10144
|
allowKeys: d,
|
|
10145
10145
|
snapshots: g,
|
|
10146
10146
|
maxSnapshots: _,
|
|
10147
|
-
markDataDirty:
|
|
10147
|
+
markDataDirty: j,
|
|
10148
10148
|
schemaErrorMode: "zod",
|
|
10149
10149
|
dryRun: s,
|
|
10150
10150
|
internalAfterWrite: a,
|
|
@@ -10152,18 +10152,18 @@ function xf(e, n = {}) {
|
|
|
10152
10152
|
});
|
|
10153
10153
|
if (!l.ok) return l.error;
|
|
10154
10154
|
if (s) return `dryRun(edit): ${l.applied.length} 个 patch 预检通过(schema 校验 OK)。预览结果:${$(l.clone, 600)}。未实际写入、未入快照。`;
|
|
10155
|
-
|
|
10155
|
+
M({
|
|
10156
10156
|
op: "edit",
|
|
10157
10157
|
detail: `${l.applied.length} 个 patch${l.applied.length > 1 ? "(批量)" : ""}`,
|
|
10158
10158
|
value: l.applied.map((e) => `${e.op}@${e.jp}`),
|
|
10159
10159
|
timestamp: Date.now()
|
|
10160
10160
|
});
|
|
10161
|
-
let u =
|
|
10161
|
+
let u = ie(f);
|
|
10162
10162
|
return bf(l.clone), `已 write(edit) 主数据(${l.applied.length} 个 patch)。当前值:${$(l.clone, 600)} (新 hash=${u})`;
|
|
10163
10163
|
}
|
|
10164
10164
|
let i = Ic(m);
|
|
10165
10165
|
if (i.parseError) return ci("", m, i.parseError);
|
|
10166
|
-
let u = await
|
|
10166
|
+
let u = await N("set", e, m, v, f);
|
|
10167
10167
|
if (u !== null) return u;
|
|
10168
10168
|
let y = lf({
|
|
10169
10169
|
bindRef: c,
|
|
@@ -10172,9 +10172,9 @@ function xf(e, n = {}) {
|
|
|
10172
10172
|
allowKeys: d,
|
|
10173
10173
|
snapshots: g,
|
|
10174
10174
|
maxSnapshots: _,
|
|
10175
|
-
audit:
|
|
10175
|
+
audit: M,
|
|
10176
10176
|
dryRun: s,
|
|
10177
|
-
onWrite:
|
|
10177
|
+
onWrite: j,
|
|
10178
10178
|
internalAfterWrite: a,
|
|
10179
10179
|
protectedCtx: h,
|
|
10180
10180
|
hashFn: k
|
|
@@ -10219,8 +10219,8 @@ function xf(e, n = {}) {
|
|
|
10219
10219
|
dryRun: t.boolean().optional().describe("预检:走完整校验链但不落盘不入快照;冲突返回 VERSION_CONFLICT 不挂起")
|
|
10220
10220
|
})
|
|
10221
10221
|
});
|
|
10222
|
-
|
|
10223
|
-
let
|
|
10222
|
+
P(L);
|
|
10223
|
+
let pe = s(async ({ jsonPath: e }) => {
|
|
10224
10224
|
let t = e || "", n = t ? Bs(o, t) : o;
|
|
10225
10225
|
return n ? `schema${t ? ` @ ${t}` : ""} = ${$(cc(n))}` : Z({
|
|
10226
10226
|
code: "PATH_DENIED",
|
|
@@ -10231,7 +10231,7 @@ function xf(e, n = {}) {
|
|
|
10231
10231
|
name: "schema_data",
|
|
10232
10232
|
description: "查看主数据(或子路径)的字段约束:类型/min/max/enum/必填/默认值/嵌套 shape。写前查约束,避免写错重试。不传 jsonPath 查根;传子路径(如 components.0)查该位置约束。",
|
|
10233
10233
|
schema: t.object({ jsonPath: t.string().optional().describe("要查约束的子路径;不传查根 schema") })
|
|
10234
|
-
}),
|
|
10234
|
+
}), me = s(async ({ snapshotId: e, against: t }) => {
|
|
10235
10235
|
let n = t != null, r, i;
|
|
10236
10236
|
if (n) {
|
|
10237
10237
|
let e = t;
|
|
@@ -10263,7 +10263,7 @@ function xf(e, n = {}) {
|
|
|
10263
10263
|
snapshotId: t.number().int().optional().describe("对比的快照序号;不传则最近一次"),
|
|
10264
10264
|
against: t.unknown().optional().describe("对比的一段 JSON 值(与 snapshotId 互斥;传则忽略快照)")
|
|
10265
10265
|
})
|
|
10266
|
-
}),
|
|
10266
|
+
}), he = [];
|
|
10267
10267
|
if (n.vfsStore) {
|
|
10268
10268
|
let e = n.vfsStore, r = (e) => `drafts/${e}.json`, i = s(({ draftId: t, chunk: n, mode: i }) => {
|
|
10269
10269
|
let a = r(t), o = e.files[a], s = i === "append" && o, c = s ? o.content + n : n;
|
|
@@ -10304,9 +10304,9 @@ function xf(e, n = {}) {
|
|
|
10304
10304
|
}
|
|
10305
10305
|
});
|
|
10306
10306
|
}
|
|
10307
|
-
let f = await
|
|
10307
|
+
let f = await re();
|
|
10308
10308
|
try {
|
|
10309
|
-
let n = await
|
|
10309
|
+
let n = await N("set", O ? w(i) : void 0, u, f, i);
|
|
10310
10310
|
if (n !== null) return n;
|
|
10311
10311
|
let r = lf({
|
|
10312
10312
|
bindRef: c,
|
|
@@ -10315,9 +10315,9 @@ function xf(e, n = {}) {
|
|
|
10315
10315
|
allowKeys: d,
|
|
10316
10316
|
snapshots: g,
|
|
10317
10317
|
maxSnapshots: _,
|
|
10318
|
-
audit:
|
|
10318
|
+
audit: M,
|
|
10319
10319
|
op: "draft_commit",
|
|
10320
|
-
onWrite:
|
|
10320
|
+
onWrite: j,
|
|
10321
10321
|
internalAfterWrite: a,
|
|
10322
10322
|
protectedCtx: h,
|
|
10323
10323
|
hashFn: k
|
|
@@ -10331,9 +10331,9 @@ function xf(e, n = {}) {
|
|
|
10331
10331
|
description: "把 draft_write 累积的草稿合并 + JSON.parse + 乐观锁 + schema 校验,原子提交主数据(任一步失败不写,草稿保留可修后重试;成功清草稿 + 自动快照可回退)。仅大 JSON 从零生成用;小改用 write。",
|
|
10332
10332
|
schema: t.object({ draftId: t.string().describe("要提交的草稿标识(对应 draft_write 的 draftId)") })
|
|
10333
10333
|
});
|
|
10334
|
-
|
|
10334
|
+
P(l), he.push(i, l);
|
|
10335
10335
|
}
|
|
10336
|
-
let
|
|
10336
|
+
let R = [];
|
|
10337
10337
|
if (e.resources?.length && p) {
|
|
10338
10338
|
let e = s(async ({ path: e, handle: t }) => {
|
|
10339
10339
|
let n = e;
|
|
@@ -10403,9 +10403,9 @@ function xf(e, n = {}) {
|
|
|
10403
10403
|
details: oi(n.error.issues)
|
|
10404
10404
|
});
|
|
10405
10405
|
}
|
|
10406
|
-
let l = await
|
|
10406
|
+
let l = await re();
|
|
10407
10407
|
try {
|
|
10408
|
-
p.update(i, t), Mc(c, i, t), T(k(), r),
|
|
10408
|
+
p.update(i, t), Mc(c, i, t), T(k(), r), j();
|
|
10409
10409
|
} finally {
|
|
10410
10410
|
l.release();
|
|
10411
10411
|
}
|
|
@@ -10419,7 +10419,7 @@ function xf(e, n = {}) {
|
|
|
10419
10419
|
value: t.unknown().describe("新值(需符合字段 schema 类型)")
|
|
10420
10420
|
})
|
|
10421
10421
|
});
|
|
10422
|
-
|
|
10422
|
+
P(n);
|
|
10423
10423
|
let r = s(async () => {
|
|
10424
10424
|
let e = p.list();
|
|
10425
10425
|
if (!e.length) {
|
|
@@ -10450,20 +10450,20 @@ function xf(e, n = {}) {
|
|
|
10450
10450
|
handle: t.string().optional().describe("占位符句柄(与 path 二选一)")
|
|
10451
10451
|
})
|
|
10452
10452
|
});
|
|
10453
|
-
|
|
10453
|
+
P(i), R.push(e, n, r, i);
|
|
10454
10454
|
}
|
|
10455
10455
|
let z = [
|
|
10456
|
-
|
|
10457
|
-
ce,
|
|
10456
|
+
F,
|
|
10458
10457
|
le,
|
|
10459
|
-
L,
|
|
10460
10458
|
ue,
|
|
10459
|
+
I,
|
|
10461
10460
|
de,
|
|
10462
|
-
R,
|
|
10463
10461
|
fe,
|
|
10462
|
+
L,
|
|
10464
10463
|
pe,
|
|
10465
|
-
|
|
10466
|
-
...he
|
|
10464
|
+
me,
|
|
10465
|
+
...he,
|
|
10466
|
+
...R
|
|
10467
10467
|
];
|
|
10468
10468
|
function B(e) {
|
|
10469
10469
|
let t = e, n = (e) => {
|
|
@@ -10560,7 +10560,7 @@ function xf(e, n = {}) {
|
|
|
10560
10560
|
};
|
|
10561
10561
|
}
|
|
10562
10562
|
Object.defineProperty(z, "controller", {
|
|
10563
|
-
value:
|
|
10563
|
+
value: se,
|
|
10564
10564
|
enumerable: !1,
|
|
10565
10565
|
configurable: !1,
|
|
10566
10566
|
writable: !1
|
|
@@ -12172,7 +12172,7 @@ function qp(e) {
|
|
|
12172
12172
|
//#endregion
|
|
12173
12173
|
//#region src/core/sdk/conflictManager.ts
|
|
12174
12174
|
function Jp(e, t, n) {
|
|
12175
|
-
let r = /* @__PURE__ */
|
|
12175
|
+
let r = /* @__PURE__ */ Kt(null), i = 0;
|
|
12176
12176
|
function a(a, o) {
|
|
12177
12177
|
let s = t?.() ?? "ask";
|
|
12178
12178
|
if (s !== "ask") {
|
|
@@ -14962,47 +14962,89 @@ function E_(e, t, n) {
|
|
|
14962
14962
|
//#endregion
|
|
14963
14963
|
//#region src/core/sdk/actions.ts
|
|
14964
14964
|
var D_ = /^[a-zA-Z][a-zA-Z0-9_]*$/;
|
|
14965
|
-
function O_(e) {
|
|
14966
|
-
let
|
|
14967
|
-
for (let [
|
|
14968
|
-
if (!D_.test(
|
|
14969
|
-
console.warn(`[page-agent-sdk][actions] 动作名 "${
|
|
14965
|
+
function O_(e, n = {}) {
|
|
14966
|
+
let r = [];
|
|
14967
|
+
for (let [i, a] of Object.entries(e)) {
|
|
14968
|
+
if (!D_.test(i)) {
|
|
14969
|
+
console.warn(`[page-agent-sdk][actions] 动作名 "${i}" 非法(须匹配 ${D_}),已跳过`);
|
|
14970
14970
|
continue;
|
|
14971
14971
|
}
|
|
14972
|
-
let e =
|
|
14973
|
-
|
|
14972
|
+
let e = a.description || `宿主动作 ${i}`;
|
|
14973
|
+
r.push(s(async (e) => {
|
|
14974
14974
|
try {
|
|
14975
|
-
let t = await
|
|
14976
|
-
return t === void 0 ? `动作 ${
|
|
14975
|
+
let t = await a.run(e || {});
|
|
14976
|
+
return t === void 0 ? `动作 ${i} 执行完成。` : typeof t == "string" ? t : JSON.stringify(t);
|
|
14977
14977
|
} catch (e) {
|
|
14978
14978
|
let t = e?.message || String(e);
|
|
14979
|
-
return
|
|
14979
|
+
return n.onError?.({
|
|
14980
|
+
name: i,
|
|
14981
|
+
message: t
|
|
14982
|
+
}), Z({
|
|
14983
|
+
code: "ACTION_FAILED",
|
|
14984
|
+
message: `动作 ${i} 执行失败:${t}`,
|
|
14985
|
+
hint: "检查参数与宿主状态后修正重试;连续失败时换思路或如实告知用户,不要原样重发相同调用。"
|
|
14986
|
+
});
|
|
14980
14987
|
}
|
|
14981
14988
|
}, {
|
|
14982
|
-
name:
|
|
14989
|
+
name: i,
|
|
14983
14990
|
description: e,
|
|
14984
|
-
schema:
|
|
14991
|
+
schema: a.params ?? a.schema ?? t.object({})
|
|
14985
14992
|
}));
|
|
14986
14993
|
}
|
|
14987
|
-
return
|
|
14994
|
+
return r;
|
|
14988
14995
|
}
|
|
14989
14996
|
function k_(e) {
|
|
14990
14997
|
let t = {};
|
|
14991
14998
|
for (let [n, r] of Object.entries(e)) D_.test(n) && (t[n] = {
|
|
14992
14999
|
description: r.description,
|
|
14993
|
-
hasParams: !!r.params,
|
|
15000
|
+
hasParams: !!(r.params || r.schema),
|
|
14994
15001
|
readsHostState: r.readsHostState === !0,
|
|
14995
15002
|
deferredWrite: r.deferredWrite === !0
|
|
14996
15003
|
});
|
|
14997
15004
|
return t;
|
|
14998
15005
|
}
|
|
14999
15006
|
//#endregion
|
|
15007
|
+
//#region src/core/sdk/actionOutcome.ts
|
|
15008
|
+
var A_ = (e, t, n) => `· 动作 ${e} 的结果已被用户${t === "applied" ? "采纳(已生效)" : "放弃(未生效)"}${n ? `:${n}` : ""} —— 已生效的可作事实引用;被放弃的不要当作已完成;不要重复提议已生效的内容。`, j_ = 5;
|
|
15009
|
+
function M_(e) {
|
|
15010
|
+
let t = /* @__PURE__ */ new Map(), n = [], r = () => {
|
|
15011
|
+
n.length = 0;
|
|
15012
|
+
for (let { line: e } of t.values()) n.push(e);
|
|
15013
|
+
};
|
|
15014
|
+
return {
|
|
15015
|
+
resolve(n, i, a) {
|
|
15016
|
+
if (!e.deferredNames.has(n)) return console.warn(`[page-agent-sdk][actionOutcome] resolveAction("${n}") 被拒:该动作未标记 deferredWrite(或未注册)—— 结局回传只罩延迟生效类动作`), !1;
|
|
15017
|
+
if (i !== "applied" && i !== "discarded") return !1;
|
|
15018
|
+
let o = t.get(n);
|
|
15019
|
+
if (o && o.outcome === i) return !1;
|
|
15020
|
+
for (t.delete(n), t.set(n, {
|
|
15021
|
+
outcome: i,
|
|
15022
|
+
line: A_(n, i, a)
|
|
15023
|
+
}); t.size > j_;) {
|
|
15024
|
+
let e = t.keys().next().value;
|
|
15025
|
+
if (e === void 0) break;
|
|
15026
|
+
t.delete(e);
|
|
15027
|
+
}
|
|
15028
|
+
return e.log(n, i, a), e.emit({
|
|
15029
|
+
type: "action_resolved",
|
|
15030
|
+
name: n,
|
|
15031
|
+
outcome: i,
|
|
15032
|
+
...a === void 0 ? {} : { detail: a }
|
|
15033
|
+
}), r(), !0;
|
|
15034
|
+
},
|
|
15035
|
+
notices: n,
|
|
15036
|
+
clear() {
|
|
15037
|
+
t.clear(), r();
|
|
15038
|
+
}
|
|
15039
|
+
};
|
|
15040
|
+
}
|
|
15041
|
+
//#endregion
|
|
15000
15042
|
//#region src/core/toolsets.ts
|
|
15001
|
-
var
|
|
15002
|
-
function
|
|
15043
|
+
var N_ = Ug, P_ = n_;
|
|
15044
|
+
function F_(e, t) {
|
|
15003
15045
|
return xf(e, t);
|
|
15004
15046
|
}
|
|
15005
|
-
function
|
|
15047
|
+
function I_(e, t, n, r, i) {
|
|
15006
15048
|
let a = Em(e);
|
|
15007
15049
|
return [
|
|
15008
15050
|
...a.dataOps ? t : [],
|
|
@@ -15013,13 +15055,13 @@ function N_(e, t, n, r, i) {
|
|
|
15013
15055
|
}
|
|
15014
15056
|
//#endregion
|
|
15015
15057
|
//#region src/core/harness/usageHints.ts
|
|
15016
|
-
var
|
|
15017
|
-
function
|
|
15018
|
-
if (!Number.isFinite(t) || t <= 0 || e <= 0 || e < t *
|
|
15058
|
+
var L_ = .7, R_ = .5, z_ = .85;
|
|
15059
|
+
function B_(e, t) {
|
|
15060
|
+
if (!Number.isFinite(t) || t <= 0 || e <= 0 || e < t * R_) return "";
|
|
15019
15061
|
let n = Math.max(1, Math.round(e / 1e3));
|
|
15020
|
-
return e >= t *
|
|
15062
|
+
return e >= t * z_ ? `⏳ 预算告急:本任务累计约 ${n}K prompt tokens(已达 softCap 上限的 ${Math.round(z_ * 100)}%)。立即停止扩展性操作(新查询/重读/优化),完成手头最关键一步后基于已有工具结果给出结论,并如实汇报剩余未完成项。轮次预算吃紧时系统会另行注入轮次提示段。` : `⏳ 预算提示:本任务累计约 ${n}K prompt tokens(已过 softCap 半程)。若已接近目标请收敛并给出总结;尚未接近请向用户汇报进度与剩余计划,勿默默继续。轮次预算吃紧时系统会另行注入轮次提示段。`;
|
|
15021
15063
|
}
|
|
15022
|
-
function
|
|
15064
|
+
function V_(e, t, n) {
|
|
15023
15065
|
let r = Em(e);
|
|
15024
15066
|
return {
|
|
15025
15067
|
name: "usageHints",
|
|
@@ -15030,13 +15072,13 @@ function R_(e, t, n) {
|
|
|
15030
15072
|
a.push(`回答用户关于当前页面/文档的问题时优先用 read_page({selector?,offset?,limit?}) 读页面正文纯文本(长文按 hasMore 分页续读;自动排除本对话框自身);需要页面结构(检查渲染是否生效/定位元素/辅助 UI 设计问答)再用 get_dom({selector?,depth?}) 读渲染后 DOM(结构化返回 tag/attrs/text/children,depth 控制深度防爆炸,只读)。${n}${r}`);
|
|
15031
15073
|
}
|
|
15032
15074
|
if (e?.screenshot && a.push("视觉验证(看布局/样式/渲染效果像不像、对不对)用 take_screenshot({selector?, fullPage?}) 截图查看:selector 截指定元素、fullPage 截整页、默认当前视口;截图自动压缩投递(多模态直看图/纯文本模型走识图转述)。优先级:视觉问题先截图,结构/属性问题用 dom_info。"), e?.domEdit && a.push("修改宿主页面元素(高亮/改文案/调样式/插删移元素)用 dom_edit({patches:[{op,selector,...}],dryRun?}) 批量原子操作(op:set_text/set_html/set_attr/add_class/remove_class/set_style/insert/remove/move/highlight);selector 必须唯一命中(先 get_dom/dom_search 定位);改前自动快照,dom_restore 回滚最近一批;改动为会话临时态(刷新即失)——数据驱动页面改数据(write)不要改 DOM。"), e?.viewImage && a.push("看「页面数据里的某张图」(轮播第 N 帧/商品图/封面,read 结果里有其 URL)用 view_image({url}) 原图直投 —— 问特定帧时勿截当前渲染帧(自动轮播可能已切帧);要看渲染后的组件(布局/叠加文案)才用 take_screenshot。"), e?.hasProposals && a.push("【内容修改(提案制)】修改当前内容(文章/笔记/文档)只有一条通道:①先 read_content 取真实原文与 hash;②propose_content 带 baseHash 提案 —— 优先 ops 增量操作(replace/insertAfter/insertBefore/append,find/anchor 用原文字面片段且须唯一命中,多带上下文保唯一),勿全量重发整篇(token 只花在改动上);③提案仅送达:评审面板打开、用户点「应用」才会写回 —— 提案后如实告知用户待确认,勿声称已修改;用户裁决结果会在下一轮告知你,以裁决为准作答。"), r.draftWrite && (a.push("生成超大 JSON(如 50+ 组件页面,单次 write 受 max_tokens 限制装不下)用 draft_write 分块构建 → draft_commit 原子提交:draft_write({draftId, chunk, mode}) mode:\"start\" 新建/\"append\" 追加(拼 JSON 片段到 drafts 池);累积完 draft_commit({draftId}) 合并 + schema 校验 + 写主数据(失败草稿保留可修后重试,成功自动清草稿)。小改仍用 write patch,只在大 JSON 从零生成时用 draft。"), a.push("⚠️ 大 JSON 分块构建是典型多轮工具调用(draft_write×N + draft_commit + read 确认 + 调研 read/query),默认 maxToolRounds=30(3.43 起;轮次预算吃紧时 system 会注入预算提示段,按提示优先收口);目标组件数很大时集成方仍可在 createChatSdk 显式上调 maxToolRounds(按 N+10 估算)。draft_commit 提交同样走乐观锁(改前 read 拿 hash,bind 被改过会触发冲突介入,不静默覆盖)。")), r.focus && t && (a.push("【上下文聚焦】判断任务范围,用 set_focus/add_focus/remove_focus/clear_focus 自动收敛工作范围:"), a.push(" · 局部任务(只改某一组件/区域,如「调导航栏」「改 components.3 样式」)→ 先 read 定位 jsonPath,再 set_focus({path:\"该子树路径\"}) 聚焦;聚焦后每轮只看该子树结构,写其他位置会被 PATH_DENIED 拒绝。"), a.push(" · 多个相关组件(如「同时改导航栏和页脚」)→ set_focus 聚焦首个后用 add_focus({path}) 追加其余;聚焦后可写任一焦点子树,越界仍被拒;移除单个用 remove_focus({path})。"), a.push(" · 全局任务(多处/整体结构,如「重排所有组件」「换主题」)→ 不要聚焦,保持全量视野直接写。"), a.push(" · 完成局部精修、要转向其他区域或做整体改动 → 调 clear_focus 退出聚焦(清空全部焦点),恢复全部读写权限。"), a.push(" · set_focus/add_focus 的 path 必须在 schema 内(类型校验);不确定路径先 read 查。")), e?.subagents?.length) {
|
|
15033
|
-
let t = e.subagents.filter((e) => (e.temperature ?? 0) >=
|
|
15075
|
+
let t = e.subagents.filter((e) => (e.temperature ?? 0) >= L_ || /规划|创意|设计|方案|brainstorm|plan/i.test(e.description)), n = e.subagents.filter((e) => (e.temperature ?? 0) < L_ && /反思|审查|挑刺|校验|review|critique|reflect/i.test(e.description));
|
|
15034
15076
|
a.push("【规划-反思-执行·路由】按任务性质选模式,不要对简单任务过度编排:"), t.length && (a.push(` · 创作/设计/开放性需求(如"设计主题风格""换个感觉")→ 先调 ${t.map((e) => "use_" + e.id).join("/")} 出 2-3 套方案(高温创意),`), a.push(e?.humanConfirm ? " 不要自己拍板;拿到方案后,若需用户拍板用 request_human_confirmation 弹选项。" : " 不要自己拍板;拿到方案后以文字列出选项等用户回复(humanConfirm 未开,勿调不存在工具)。")), n.length && a.push(` · 严谨/易错/校验类 → 可先调 ${n.map((e) => "use_" + e.id).join("/")} 反思挑刺(低温审查),据反馈修订。`), a.push(" · 方案定稿后,由你(主 agent)用 write 落地成 JSON(低温度执行 + schema 校验 + 写前确认)。"), a.push(" · 简单/明确任务(如\"标题改红色\")直接执行,不必走规划-反思。");
|
|
15035
15077
|
}
|
|
15036
15078
|
e?.humanConfirm && (a.push("【人工确认·必读】以下情形必须先调 request_human_confirmation 征询用户、拿到答复后再继续,不要自行拍板:"), a.push(" 1) 用户让你「给方案/列选项/我来选/挑一个」时:把每个方案作为一个 option,调 request_human_confirmation(question=简述, options=[方案A,方案B,...], recommendation=你推荐的)。不要只回文字罗列方案让用户自己回复——要用工具把选项做成可点选按钮。"), a.push(" 2) 需求有歧义/不确定时:调工具问清楚(options 不传则用户答同意或拒绝)。"), a.push(" 3) 即将执行高风险不可逆操作(删除/覆盖/批量改动)前:调工具确认。"), a.push(" 4) 规划出多步方案需用户确认时:把整个方案(或关键分步)作为 option 调 request_human_confirmation,确认后再执行。"), a.push("用户在选项里选了哪个,就按那个方案继续;选「拒绝」则停止并询问如何调整。"));
|
|
15037
15079
|
let o = i?.loopProgress;
|
|
15038
15080
|
if (o) {
|
|
15039
|
-
let e =
|
|
15081
|
+
let e = B_(o.invokeUsage.prompt_tokens || o.invokeUsage.total_tokens, n?.promptSoftCap ?? Infinity);
|
|
15040
15082
|
e && a.push(e);
|
|
15041
15083
|
let t = Object.entries(o.writeFailures).filter(([, e]) => e >= 2);
|
|
15042
15084
|
if (t.length) {
|
|
@@ -15050,7 +15092,7 @@ function R_(e, t, n) {
|
|
|
15050
15092
|
}
|
|
15051
15093
|
//#endregion
|
|
15052
15094
|
//#region src/core/harness/pageContext.ts
|
|
15053
|
-
function
|
|
15095
|
+
function H_(e, t) {
|
|
15054
15096
|
let n = [
|
|
15055
15097
|
"[当前页面] 用户正在浏览:",
|
|
15056
15098
|
`- 标题:${e.title}`,
|
|
@@ -15059,18 +15101,18 @@ function z_(e, t) {
|
|
|
15059
15101
|
];
|
|
15060
15102
|
return t && n.push("需要页面正文时用 read_page 读取纯文本(长文按 hasMore 分页续读);读结构用 get_dom。"), n.join("\n");
|
|
15061
15103
|
}
|
|
15062
|
-
function
|
|
15104
|
+
function U_(e) {
|
|
15063
15105
|
return {
|
|
15064
15106
|
name: "pageContext",
|
|
15065
15107
|
augmentPrompt: () => {
|
|
15066
15108
|
let t = e.getPageInfo();
|
|
15067
|
-
if (t) return
|
|
15109
|
+
if (t) return H_(t, e.canReadPage);
|
|
15068
15110
|
}
|
|
15069
15111
|
};
|
|
15070
15112
|
}
|
|
15071
15113
|
//#endregion
|
|
15072
15114
|
//#region src/core/harness/resourcesPin.ts
|
|
15073
|
-
function
|
|
15115
|
+
function W_(e) {
|
|
15074
15116
|
return {
|
|
15075
15117
|
name: "resourcesPin",
|
|
15076
15118
|
augmentPrompt: () => {
|
|
@@ -15084,15 +15126,15 @@ function V_(e) {
|
|
|
15084
15126
|
}
|
|
15085
15127
|
//#endregion
|
|
15086
15128
|
//#region src/core/backends/skillStore.ts
|
|
15087
|
-
var
|
|
15088
|
-
function
|
|
15089
|
-
return `${
|
|
15129
|
+
var G_ = "v:1::skill-store", K_ = "chat-sdk";
|
|
15130
|
+
function q_(e, t, n) {
|
|
15131
|
+
return `${G_}::${e}::${t}::${n}`;
|
|
15090
15132
|
}
|
|
15091
|
-
function
|
|
15092
|
-
return `${
|
|
15133
|
+
function J_(e, t) {
|
|
15134
|
+
return `${G_}::${e}::${t}::`;
|
|
15093
15135
|
}
|
|
15094
|
-
function
|
|
15095
|
-
let t = e.dbName ??
|
|
15136
|
+
function Y_(e = {}) {
|
|
15137
|
+
let t = e.dbName ?? K_, n = e.backend ?? "indexed", r = e.id ?? "", i, a, o = new Promise((e) => {
|
|
15096
15138
|
a = e;
|
|
15097
15139
|
});
|
|
15098
15140
|
return (async () => {
|
|
@@ -15114,36 +15156,36 @@ function K_(e = {}) {
|
|
|
15114
15156
|
ready: o,
|
|
15115
15157
|
async list() {
|
|
15116
15158
|
let e = [];
|
|
15117
|
-
return await i.scan(
|
|
15159
|
+
return await i.scan(J_(t, r), (t, n) => {
|
|
15118
15160
|
e.push(n);
|
|
15119
15161
|
}), e;
|
|
15120
15162
|
},
|
|
15121
15163
|
async get(e) {
|
|
15122
|
-
return await i.get(
|
|
15164
|
+
return await i.get(q_(t, r, e));
|
|
15123
15165
|
},
|
|
15124
15166
|
async put(e) {
|
|
15125
15167
|
try {
|
|
15126
|
-
await i.set(
|
|
15168
|
+
await i.set(q_(t, r, e.name), e);
|
|
15127
15169
|
} catch (e) {
|
|
15128
15170
|
cm(e) && (i = gm());
|
|
15129
15171
|
}
|
|
15130
15172
|
},
|
|
15131
15173
|
async remove(e) {
|
|
15132
|
-
let n =
|
|
15174
|
+
let n = q_(t, r, e);
|
|
15133
15175
|
return await i.get(n) == null ? !1 : (await i.del(n), !0);
|
|
15134
15176
|
},
|
|
15135
15177
|
async clear() {
|
|
15136
|
-
await i.clearPrefix(
|
|
15178
|
+
await i.clearPrefix(J_(t, r));
|
|
15137
15179
|
},
|
|
15138
15180
|
dispose() {}
|
|
15139
15181
|
};
|
|
15140
15182
|
}
|
|
15141
|
-
var
|
|
15142
|
-
function
|
|
15183
|
+
var X_ = /large_results\/[^\s"'`),]+\.txt/g;
|
|
15184
|
+
function Z_(e) {
|
|
15143
15185
|
let t = /* @__PURE__ */ new Set(), n = (e) => {
|
|
15144
15186
|
if (typeof e != "string" || !e) return;
|
|
15145
15187
|
let n;
|
|
15146
|
-
for (
|
|
15188
|
+
for (X_.lastIndex = 0; (n = X_.exec(e)) !== null;) t.add(n[0]);
|
|
15147
15189
|
};
|
|
15148
15190
|
for (let r of e) {
|
|
15149
15191
|
if (n(r.content), r.steps) for (let e of r.steps) n(e.result);
|
|
@@ -15151,14 +15193,14 @@ function J_(e) {
|
|
|
15151
15193
|
}
|
|
15152
15194
|
return t;
|
|
15153
15195
|
}
|
|
15154
|
-
function
|
|
15196
|
+
function Q_(e, t) {
|
|
15155
15197
|
let n = [];
|
|
15156
15198
|
for (let r of Object.keys(e)) r.startsWith("large_results/") && !t.has(r) && n.push(r);
|
|
15157
15199
|
return n;
|
|
15158
15200
|
}
|
|
15159
15201
|
//#endregion
|
|
15160
15202
|
//#region src/core/utils/serialRunner.ts
|
|
15161
|
-
function
|
|
15203
|
+
function $_() {
|
|
15162
15204
|
let e = Promise.resolve();
|
|
15163
15205
|
return function(t) {
|
|
15164
15206
|
let n = e.then(t, t);
|
|
@@ -15167,31 +15209,31 @@ function X_() {
|
|
|
15167
15209
|
}
|
|
15168
15210
|
//#endregion
|
|
15169
15211
|
//#region src/core/sdk/createChatSdk.ts
|
|
15170
|
-
var
|
|
15171
|
-
function
|
|
15212
|
+
var ev = 30, tv = /* @__PURE__ */ new Map();
|
|
15213
|
+
function nv(e, t) {
|
|
15172
15214
|
return e === "restore_data" ? "restore" : e === "write" ? t?.dryRun ? null : t?.del ? "delete" : t?.patch || t?.patches ? "edit" : "set" : e === "eval_script" ? t?.mode === "transform" ? "edit" : null : e === "draft_commit" || e === "resource_update" ? "edit" : null;
|
|
15173
15215
|
}
|
|
15174
|
-
function
|
|
15216
|
+
function rv(e) {
|
|
15175
15217
|
return e === "spawn_agent" || e === "spawn_agents" || e.startsWith("use_");
|
|
15176
15218
|
}
|
|
15177
|
-
function
|
|
15219
|
+
function iv(e, t, n, r) {
|
|
15178
15220
|
let i = 0;
|
|
15179
15221
|
return {
|
|
15180
15222
|
name: "sdk-events",
|
|
15181
15223
|
wrapToolCall: async (t, r) => {
|
|
15182
|
-
let i = await r(t), a =
|
|
15224
|
+
let i = await r(t), a = nv(t.name, t.args), o = typeof i.content == "string" && i.content.startsWith("ERROR:");
|
|
15183
15225
|
return a && !o ? e({
|
|
15184
15226
|
type: "data_change",
|
|
15185
15227
|
operation: a,
|
|
15186
15228
|
value: n()?.bind
|
|
15187
|
-
}) : i.status === "done" && !o &&
|
|
15229
|
+
}) : i.status === "done" && !o && rv(t.name) && e({
|
|
15188
15230
|
type: "data_change",
|
|
15189
15231
|
operation: "edit",
|
|
15190
15232
|
value: n()?.bind
|
|
15191
15233
|
}), i;
|
|
15192
15234
|
},
|
|
15193
15235
|
afterModel: (t) => {
|
|
15194
|
-
let n =
|
|
15236
|
+
let n = ie(t.message);
|
|
15195
15237
|
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({
|
|
15196
15238
|
type: "usage",
|
|
15197
15239
|
round: i,
|
|
@@ -15212,7 +15254,7 @@ function tv(e, t, n, r) {
|
|
|
15212
15254
|
}
|
|
15213
15255
|
};
|
|
15214
15256
|
}
|
|
15215
|
-
function
|
|
15257
|
+
function av(e, t, n, r, i) {
|
|
15216
15258
|
if (!n) return i && console.warn(`[page-agent-sdk][focus] capabilities.focus 关闭,${t} 忽略`), {
|
|
15217
15259
|
ok: !1,
|
|
15218
15260
|
error: "capabilities.focus 关闭"
|
|
@@ -15230,14 +15272,14 @@ function nv(e, t, n, r, i) {
|
|
|
15230
15272
|
error: "当前无主数据 schema,无法聚焦"
|
|
15231
15273
|
});
|
|
15232
15274
|
}
|
|
15233
|
-
function
|
|
15275
|
+
function ov(e, n, r) {
|
|
15234
15276
|
let a = {
|
|
15235
15277
|
prompt_tokens: 0,
|
|
15236
15278
|
completion_tokens: 0,
|
|
15237
15279
|
total_tokens: 0
|
|
15238
|
-
}, o = Jp(() =>
|
|
15280
|
+
}, o = Jp(() => J, () => e.conflictPolicy ?? "ask", () => Y.agent?.debugLogs?.value), c = /* @__PURE__ */ Kt(0), l = Cm(e.storage);
|
|
15239
15281
|
l && (e.debug && l.onEvent((e) => console.log("[page-agent-sdk][storage]", e)), l.onEvent((e) => {
|
|
15240
|
-
e.type === "quota" &&
|
|
15282
|
+
e.type === "quota" && Y.agent?.debugLogs?.value?.push({
|
|
15241
15283
|
timestamp: Date.now(),
|
|
15242
15284
|
type: "middleware",
|
|
15243
15285
|
data: {
|
|
@@ -15255,14 +15297,14 @@ function rv(e, n, r) {
|
|
|
15255
15297
|
}
|
|
15256
15298
|
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;
|
|
15257
15299
|
e.debug && !d && console.warn("[page-agent-sdk][summarization] 未构造 llmInvoke(apiKey 缺失?),摘要回退零成本索引摘要");
|
|
15258
|
-
let w = /* @__PURE__ */
|
|
15300
|
+
let w = /* @__PURE__ */ Pt([]), T = Dd(e.vfs?.initialFiles, {
|
|
15259
15301
|
persist: l ? { save: (e) => {
|
|
15260
|
-
|
|
15302
|
+
X.persistSave({ vfs: e });
|
|
15261
15303
|
} } : void 0,
|
|
15262
15304
|
maxBytes: e.vfs?.maxBytes,
|
|
15263
15305
|
poolBytes: e.vfs?.poolBytes
|
|
15264
15306
|
}), D = Jo([], { maxPlanRevisions: e.maxPlanRevisions }), O = Ec(), ee = es((e) => {
|
|
15265
|
-
|
|
15307
|
+
Y.agent?.debugLogs?.value?.push({
|
|
15266
15308
|
timestamp: Date.now(),
|
|
15267
15309
|
type: "middleware",
|
|
15268
15310
|
data: {
|
|
@@ -15271,21 +15313,21 @@ function rv(e, n, r) {
|
|
|
15271
15313
|
}
|
|
15272
15314
|
});
|
|
15273
15315
|
}), te = Oc(() => {
|
|
15274
|
-
|
|
15316
|
+
Y.agent?.debugLogs?.value?.push({
|
|
15275
15317
|
timestamp: Date.now(),
|
|
15276
15318
|
type: "middleware",
|
|
15277
15319
|
data: { stage: "resume_notice" }
|
|
15278
15320
|
});
|
|
15279
|
-
}), ne = Nm(),
|
|
15280
|
-
|
|
15321
|
+
}), ne = Nm(), re = e.approval?.timeoutMs, ie = re !== void 0 && Number.isFinite(re) && re > 0 ? re : re !== void 0 && (!Number.isFinite(re) || re < 0) ? 0 : 3e4, ae = (e) => {
|
|
15322
|
+
J({
|
|
15281
15323
|
type: "error",
|
|
15282
15324
|
message: `确认请求(${e.toolName})${Math.round(e.waitedMs / 1e3)}s 无响应已自动拒绝 —— 当前路径无 UI 响应方;可传 approval.timeoutMs 调整(Infinity = 无限等)`,
|
|
15283
15325
|
severity: "observable",
|
|
15284
15326
|
code: "APPROVAL_AUTO_REJECTED",
|
|
15285
15327
|
context: e
|
|
15286
15328
|
});
|
|
15287
|
-
},
|
|
15288
|
-
ne.lastPlanConfirmation = e,
|
|
15329
|
+
}, oe = Au((e) => {
|
|
15330
|
+
ne.lastPlanConfirmation = e, X.persistSave({ planConfirmation: e }), Y.agent?.debugLogs?.value?.push({
|
|
15289
15331
|
timestamp: Date.now(),
|
|
15290
15332
|
type: "middleware",
|
|
15291
15333
|
data: {
|
|
@@ -15295,71 +15337,71 @@ function rv(e, n, r) {
|
|
|
15295
15337
|
}
|
|
15296
15338
|
});
|
|
15297
15339
|
}, {
|
|
15298
|
-
timeoutMs:
|
|
15299
|
-
onAutoReject:
|
|
15300
|
-
}),
|
|
15340
|
+
timeoutMs: ie,
|
|
15341
|
+
onAutoReject: ae
|
|
15342
|
+
}), A = rl({
|
|
15301
15343
|
getSchema: () => W()?.schema,
|
|
15302
15344
|
getBind: () => W()?.bind,
|
|
15303
|
-
onChange: (e) =>
|
|
15345
|
+
onChange: (e) => J({
|
|
15304
15346
|
type: "focus_change",
|
|
15305
15347
|
focuses: e
|
|
15306
15348
|
})
|
|
15307
|
-
}),
|
|
15349
|
+
}), j = (e) => {
|
|
15308
15350
|
let t = tl(W()?.bind, e.path);
|
|
15309
15351
|
return t ? {
|
|
15310
15352
|
...e,
|
|
15311
15353
|
pgId: t
|
|
15312
15354
|
} : e;
|
|
15313
|
-
},
|
|
15314
|
-
typeof e.memory == "function" &&
|
|
15315
|
-
let
|
|
15355
|
+
}, se = vu(), M = yu(e.memory || "");
|
|
15356
|
+
typeof e.memory == "function" && M.refresh();
|
|
15357
|
+
let ce = { current: null }, N = e.data ? {
|
|
15316
15358
|
...e.data,
|
|
15317
15359
|
description: e.data.description ?? "主数据对象"
|
|
15318
|
-
} : void 0,
|
|
15319
|
-
|
|
15320
|
-
let
|
|
15321
|
-
for (let e of
|
|
15360
|
+
} : void 0, P = !(e.subagents ?? []).some((e) => e._codeAsset) && Em(e.capabilities).subagent, F = e.subagents;
|
|
15361
|
+
P && N?.schema && ec(N.schema).length && (F = [...e.subagents ?? [], kp()], console.info("[page-agent-sdk] 检测到 schema 含代码组件数组(如 components[].code),已自动装配 HTML 代码子 agent(委派编排 + vfs 工作副本 + 格式校验 + 增量 commit)。需定制(codeField/formatCheck/craftNotes 等)请显式传 createHtmlSubagent(...)"));
|
|
15362
|
+
let le = (F ?? []).filter((e) => !!e._codeAsset), ue = /* @__PURE__ */ new Set();
|
|
15363
|
+
for (let e of le) {
|
|
15322
15364
|
if (e._codeAsset.writablePaths.length) continue;
|
|
15323
|
-
let t = ec(
|
|
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'])"),
|
|
15365
|
+
let t = ec(N?.schema, e._codeAsset.codeField);
|
|
15366
|
+
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'])"), ue.add(e));
|
|
15325
15367
|
}
|
|
15326
|
-
let
|
|
15368
|
+
let I = ue.size ? le.filter((e) => !ue.has(e)) : le, de = ue.size ? (F ?? []).filter((e) => !ue.has(e)) : F, fe = I.length > 0, L = I.flatMap((e) => e._codeAsset.writablePaths), pe = I.flatMap((e) => e._codeAsset.writablePaths.map((t) => `${t}.${e._codeAsset.codeField}`)), me = e.checkpoint, he = me !== void 0 && me !== !1, R = he ? Ru({
|
|
15327
15369
|
getData: () => W()?.bind,
|
|
15328
15370
|
consumeDataDirty: () => U?.consumeDataDirty?.() ?? !0,
|
|
15329
|
-
slotPaths:
|
|
15371
|
+
slotPaths: N ? [""] : [],
|
|
15330
15372
|
vfsStore: T,
|
|
15331
15373
|
todosMw: D,
|
|
15332
|
-
getTodos: () =>
|
|
15374
|
+
getTodos: () => ce.current?.getState?.()?.todos ?? [],
|
|
15333
15375
|
messages: w,
|
|
15334
|
-
maxCheckpoints:
|
|
15335
|
-
}) : null, z = !
|
|
15376
|
+
maxCheckpoints: me && typeof me == "object" ? me.maxCheckpoints : void 0
|
|
15377
|
+
}) : null, z = !me || typeof me != "object" || me.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({
|
|
15336
15378
|
...e,
|
|
15337
15379
|
locale: e.i18n?.locale,
|
|
15338
|
-
dataOps: V && !!
|
|
15380
|
+
dataOps: V && !!N,
|
|
15339
15381
|
domInspect: B.domInspect === !0,
|
|
15340
15382
|
screenshot: ve
|
|
15341
15383
|
});
|
|
15342
|
-
if (
|
|
15343
|
-
let e =
|
|
15384
|
+
if (fe) {
|
|
15385
|
+
let e = I.map((e) => e._codeAsset.orchestratorPrompt).filter(Boolean).join("\n\n");
|
|
15344
15386
|
e && (ye += "\n\n" + e);
|
|
15345
|
-
} else
|
|
15346
|
-
let H = V &&
|
|
15387
|
+
} else N?.schema && $s(N.schema) && (ye += "\n\n" + _c.htmlDirectWriteFallback, console.warn("[page-agent-sdk] 检测到 schema 含 code 字段但未注册 html 子 agent:已自动注入「主 agent 自己写 HTML」编排(code 作普通字段直接 write,无 vfs 工作副本 / 无格式校验门禁)。如需代码资产机制(vfs + 格式校验 + 增量 commit + 主上下文 code 摘要),注册 createHtmlSubagent;若确为降级意图可忽略。"));
|
|
15388
|
+
let H = V && N ? xf(N, {
|
|
15347
15389
|
onAudit: e.onAudit ?? (e.debug ? (e) => console.log("[page-agent-sdk][data audit]", e) : void 0),
|
|
15348
15390
|
maxSnapshots: e.maxSnapshots,
|
|
15349
15391
|
onConflict: o.set,
|
|
15350
15392
|
conflictWatchFields: e.conflictWatchFields,
|
|
15351
15393
|
maxParallelTools: e.maxParallelTools,
|
|
15352
|
-
vfsStore: ge ||
|
|
15353
|
-
...
|
|
15354
|
-
...
|
|
15355
|
-
}) : [], be = V ? H : [], U = V &&
|
|
15394
|
+
vfsStore: ge || N?.resources?.length ? T : void 0,
|
|
15395
|
+
...L.length ? { pgIdPaths: L } : {},
|
|
15396
|
+
...pe.length ? { largeTextPaths: pe } : {}
|
|
15397
|
+
}) : [], be = V ? H : [], U = V && N ? H.controller ?? null : null, xe = V && N ? H.previewWrite : void 0, Se = V && N?.resources?.length && U?.getResourcesSnapshot ? W_({ getResourcesSnapshot: () => U?.getResourcesSnapshot?.() ?? [] }) : void 0, W = () => U?.get() ?? N, Ce = new Set(H.map((e) => e.name)), we = e.conflictWatchFields ?? [], Te = !we.includes("*") && we.length ? new Set(we) : void 0, G = U ? ep({
|
|
15356
15398
|
getBind: () => W()?.bind,
|
|
15357
15399
|
recomputeAll: () => U.recomputeAllBaselines?.(),
|
|
15358
15400
|
hasBaselines: () => U.hasBaselines?.() ?? !1,
|
|
15359
15401
|
isManaged: (e) => Ce.has(e),
|
|
15360
15402
|
hash: (e) => Te ? Vc(ju(e), Te) : Bc(ju(e)),
|
|
15361
15403
|
log: (e, t) => {
|
|
15362
|
-
let n =
|
|
15404
|
+
let n = Y.agent?.debugLogs;
|
|
15363
15405
|
n && (n.value.push({
|
|
15364
15406
|
timestamp: Date.now(),
|
|
15365
15407
|
type: "middleware",
|
|
@@ -15367,7 +15409,7 @@ function rv(e, n, r) {
|
|
|
15367
15409
|
stage: "baseline_guard",
|
|
15368
15410
|
...t
|
|
15369
15411
|
}
|
|
15370
|
-
}),
|
|
15412
|
+
}), Xt(n));
|
|
15371
15413
|
}
|
|
15372
15414
|
}) : void 0, K = /* @__PURE__ */ new Map();
|
|
15373
15415
|
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 生效)");
|
|
@@ -15391,7 +15433,7 @@ function rv(e, n, r) {
|
|
|
15391
15433
|
}
|
|
15392
15434
|
}) : void 0, ke = ve ? dg({
|
|
15393
15435
|
render: e.screenshot?.renderer,
|
|
15394
|
-
getActiveFocus: () =>
|
|
15436
|
+
getActiveFocus: () => Y.getFocus(),
|
|
15395
15437
|
focusSelector: e.screenshot?.focusSelector,
|
|
15396
15438
|
stow: (e) => {
|
|
15397
15439
|
if (e.dataUri) try {
|
|
@@ -15426,7 +15468,7 @@ function rv(e, n, r) {
|
|
|
15426
15468
|
}
|
|
15427
15469
|
} : null, Me = !1, Ne = B.domEdit ? Eg({
|
|
15428
15470
|
onEdit: (e) => {
|
|
15429
|
-
|
|
15471
|
+
Y.agent?.debugLogs?.value?.push({
|
|
15430
15472
|
timestamp: Date.now(),
|
|
15431
15473
|
type: "middleware",
|
|
15432
15474
|
data: {
|
|
@@ -15440,7 +15482,7 @@ function rv(e, n, r) {
|
|
|
15440
15482
|
onRestore: (e) => {
|
|
15441
15483
|
e.restored > 0 && (Me = !0);
|
|
15442
15484
|
}
|
|
15443
|
-
}) : [], Pe = [...
|
|
15485
|
+
}) : [], Pe = [...I_(B, be, Ug, B.domInspect ? [
|
|
15444
15486
|
...n_,
|
|
15445
15487
|
...Ne,
|
|
15446
15488
|
...ke ? [ke] : [],
|
|
@@ -15450,11 +15492,11 @@ function rv(e, n, r) {
|
|
|
15450
15492
|
let Fe = e.proposals ? Vg(e.proposals, {
|
|
15451
15493
|
emit: (e) => {
|
|
15452
15494
|
try {
|
|
15453
|
-
|
|
15495
|
+
J(e);
|
|
15454
15496
|
} catch {}
|
|
15455
15497
|
},
|
|
15456
15498
|
log: (e, t) => {
|
|
15457
|
-
|
|
15499
|
+
Y.agent?.debugLogs?.value?.push({
|
|
15458
15500
|
timestamp: Date.now(),
|
|
15459
15501
|
type: "middleware",
|
|
15460
15502
|
data: {
|
|
@@ -15466,29 +15508,58 @@ function rv(e, n, r) {
|
|
|
15466
15508
|
}
|
|
15467
15509
|
}) : null, Ie = [...e.tools || [], ...Fe?.tools ?? []];
|
|
15468
15510
|
Ie.forEach((e) => K.set(e.name, "user"));
|
|
15469
|
-
let Le = O_(e.actions ?? {})
|
|
15511
|
+
let Le = O_(e.actions ?? {}, { onError: ({ name: e, message: t }) => {
|
|
15512
|
+
Y.agent?.debugLogs?.value?.push({
|
|
15513
|
+
timestamp: Date.now(),
|
|
15514
|
+
type: "middleware",
|
|
15515
|
+
data: {
|
|
15516
|
+
stage: "action_failed",
|
|
15517
|
+
name: e,
|
|
15518
|
+
message: t.slice(0, 300)
|
|
15519
|
+
}
|
|
15520
|
+
});
|
|
15521
|
+
} });
|
|
15470
15522
|
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 =
|
|
15472
|
-
|
|
15473
|
-
|
|
15474
|
-
|
|
15475
|
-
|
|
15523
|
+
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 = M_({
|
|
15524
|
+
deferredNames: Ve,
|
|
15525
|
+
emit: (e) => {
|
|
15526
|
+
try {
|
|
15527
|
+
J(e);
|
|
15528
|
+
} catch {}
|
|
15529
|
+
},
|
|
15530
|
+
log: (e, t, n) => {
|
|
15531
|
+
Y.agent?.debugLogs?.value?.push({
|
|
15532
|
+
timestamp: Date.now(),
|
|
15533
|
+
type: "middleware",
|
|
15534
|
+
data: {
|
|
15535
|
+
stage: "action_resolved",
|
|
15536
|
+
name: e,
|
|
15537
|
+
outcome: t,
|
|
15538
|
+
...n ? { detail: n.slice(0, 200) } : {}
|
|
15539
|
+
}
|
|
15540
|
+
});
|
|
15541
|
+
}
|
|
15542
|
+
}), Ue = [], We = !1, Ge = e.humanConfirm !== !1 && (!e.approval || e.approval.humanConfirmTool !== !1), Ke = Ge ? ku() : null;
|
|
15543
|
+
Ke && K.set(Du, "builtin");
|
|
15544
|
+
let qe = he && R ? [s(async () => {
|
|
15545
|
+
let e = R.list();
|
|
15546
|
+
return e.length ? R.restore() ? `已回退到最近一次正常状态(checkpoint #${e[e.length - 1].id})。对话历史、主数据、vfs、todos 已整体还原。请基于回退后的状态重新判断并继续。` : "回退失败:无可用 checkpoint。" : "无可用 checkpoint,无法回退。";
|
|
15476
15547
|
}, {
|
|
15477
15548
|
name: "restore_last_checkpoint",
|
|
15478
15549
|
description: "回退到最近一次正常状态(整体还原对话历史 + 主数据 + vfs + todos)。当本轮操作出错、页面被改坏、或走偏时调用,回到本轮起点重新来过。不传参数即回退最近一次。",
|
|
15479
15550
|
schema: t.object({}).optional()
|
|
15480
15551
|
}), s(async () => {
|
|
15481
|
-
let e =
|
|
15552
|
+
let e = R.list();
|
|
15482
15553
|
return e.length ? "可用 checkpoint:\n" + e.map((e) => `#${e.id} [${e.label ?? "auto"}] 消息数=${e.messageCount} 时间=${new Date(e.timestamp).toLocaleTimeString()}`).join("\n") : "无可用 checkpoint。";
|
|
15483
15554
|
}, {
|
|
15484
15555
|
name: "list_checkpoints",
|
|
15485
15556
|
description: "列出可用会话 checkpoint(回退点)。",
|
|
15486
15557
|
schema: t.object({}).optional()
|
|
15487
15558
|
})] : [];
|
|
15488
|
-
|
|
15489
|
-
let
|
|
15559
|
+
qe.forEach((e) => K.set(e.name, "builtin"));
|
|
15560
|
+
let Je = B.focus && V, Ye = s(async ({ path: e, label: t }) => {
|
|
15490
15561
|
let n = W()?.schema;
|
|
15491
|
-
return n ? Bs(n, e) ? (
|
|
15562
|
+
return n ? Bs(n, e) ? (A.setFocus(j({
|
|
15492
15563
|
path: e,
|
|
15493
15564
|
...t ? { label: t } : {}
|
|
15494
15565
|
}), "agent"), `已聚焦到 ${e}${t ? `(${t})` : ""}。后续仅可写该子树(越界被拒),每轮只看到该组件结构。完成精修后调 clear_focus 退出。`) : `PATH_DENIED · 聚焦失败:path "${e}" 不在 schema 内。请先用 read 查看可操作路径再聚焦。` : "聚焦失败:当前无主数据 schema,无法聚焦。";
|
|
@@ -15499,19 +15570,19 @@ function rv(e, n, r) {
|
|
|
15499
15570
|
path: t.string().describe("要聚焦的组件 jsonPath,如 components.3"),
|
|
15500
15571
|
label: t.string().optional().describe("人类可读标签,如「导航栏」")
|
|
15501
15572
|
})
|
|
15502
|
-
}),
|
|
15573
|
+
}), Xe = s(async () => (A.clearFocus("agent"), "已清除聚焦,恢复全量可操作范围(可读写所有组件)。"), {
|
|
15503
15574
|
name: "clear_focus",
|
|
15504
15575
|
description: "清除当前聚焦,退出精修模式,恢复对全部组件的读写权限。",
|
|
15505
15576
|
schema: t.object({}).optional()
|
|
15506
|
-
}),
|
|
15577
|
+
}), Ze = s(async ({ path: e, label: t }) => {
|
|
15507
15578
|
let n = W()?.schema;
|
|
15508
15579
|
if (!n) return "聚焦失败:当前无主数据 schema,无法聚焦。";
|
|
15509
15580
|
if (!Bs(n, e)) return `PATH_DENIED · 聚焦失败:path "${e}" 不在 schema 内。请先用 read 查看可操作路径再聚焦。`;
|
|
15510
|
-
|
|
15581
|
+
A.addFocus(j({
|
|
15511
15582
|
path: e,
|
|
15512
15583
|
...t ? { label: t } : {}
|
|
15513
15584
|
}), "agent");
|
|
15514
|
-
let r =
|
|
15585
|
+
let r = A.getFocuses();
|
|
15515
15586
|
return `已聚焦 ${e}${t ? `(${t})` : ""}(当前共 ${r.length} 个焦点:${r.map((e) => e.path).join(", ")})。后续仅可写这些子树之一(越界被拒)。`;
|
|
15516
15587
|
}, {
|
|
15517
15588
|
name: "add_focus",
|
|
@@ -15520,74 +15591,74 @@ function rv(e, n, r) {
|
|
|
15520
15591
|
path: t.string().describe("要追加聚焦的组件 jsonPath,如 components.3"),
|
|
15521
15592
|
label: t.string().optional().describe("人类可读标签")
|
|
15522
15593
|
})
|
|
15523
|
-
}),
|
|
15524
|
-
let t =
|
|
15525
|
-
|
|
15526
|
-
let n =
|
|
15594
|
+
}), Qe = s(async ({ path: e }) => {
|
|
15595
|
+
let t = A.getFocuses().length;
|
|
15596
|
+
A.removeFocus(e, "agent");
|
|
15597
|
+
let n = A.getFocuses();
|
|
15527
15598
|
return n.length === t ? `path "${e}" 不在当前焦点列表中(当前:${n.map((e) => e.path).join(", ") || "无"})。` : n.length ? `已移除焦点 ${e}(剩余 ${n.length} 个:${n.map((e) => e.path).join(", ")})。` : `已移除焦点 ${e},聚焦已清空,恢复全量操作范围。`;
|
|
15528
15599
|
}, {
|
|
15529
15600
|
name: "remove_focus",
|
|
15530
15601
|
description: "移除单个聚焦焦点(by path),保留其他焦点。移除最后一个等价退出精修。全部退出用 clear_focus。",
|
|
15531
15602
|
schema: t.object({ path: t.string().describe("要移除的焦点 jsonPath") })
|
|
15532
|
-
}),
|
|
15533
|
-
Je,
|
|
15603
|
+
}), $e = Je ? [
|
|
15534
15604
|
Ye,
|
|
15535
15605
|
Xe,
|
|
15536
|
-
Ze
|
|
15606
|
+
Ze,
|
|
15607
|
+
Qe
|
|
15537
15608
|
] : [];
|
|
15538
|
-
|
|
15539
|
-
let
|
|
15609
|
+
$e.forEach((e) => K.set(e.name, "builtin"));
|
|
15610
|
+
let et = [], tt = /* @__PURE__ */ new Map(), nt = Lm({
|
|
15540
15611
|
builtinTools: () => Pe,
|
|
15541
15612
|
userTools: () => Ie,
|
|
15542
15613
|
actionTools: () => Le,
|
|
15543
|
-
humanConfirmTool: () =>
|
|
15544
|
-
checkpointTools: () =>
|
|
15545
|
-
focusTools: () =>
|
|
15546
|
-
mcpTools: () =>
|
|
15547
|
-
loadedSkillTools: () =>
|
|
15548
|
-
}),
|
|
15549
|
-
if (
|
|
15550
|
-
if (
|
|
15551
|
-
let
|
|
15614
|
+
humanConfirmTool: () => Ke,
|
|
15615
|
+
checkpointTools: () => qe,
|
|
15616
|
+
focusTools: () => $e,
|
|
15617
|
+
mcpTools: () => Ue,
|
|
15618
|
+
loadedSkillTools: () => et
|
|
15619
|
+
}), rt = nt(), it = B.planning, at = B.missionAnchor, ot = B.workingMemory, st = B.skills, ct = B.vfs || fe;
|
|
15620
|
+
if (ct) for (let e of Nd) K.set(e, "builtin");
|
|
15621
|
+
if (it) for (let e of D.tools ?? []) K.set(e.name, "builtin");
|
|
15622
|
+
let lt = B.summarization, ut = B.agentCompression && !!m;
|
|
15552
15623
|
e.debug && B.agentCompression && !m && console.warn("[page-agent-sdk][agentCompression] agentCompression 开启但 summaryLlm 不可用(或缺 apiKey / 模型不支持工具),压缩决策不启用,回退静态压缩");
|
|
15553
|
-
let
|
|
15554
|
-
|
|
15555
|
-
let
|
|
15624
|
+
let dt = B.memory, ft = B.subagent, pt = ft ? Wl() : void 0, mt = e.verify?.maxAttempts ?? 2, ht = !!(e.verify?.check || e.verify?.maxAttempts || e.verify?.adversarial), gt = e.capabilities?.verify === !1, _t = (B.verify || ht && !gt) && e.verify?.enabled !== !1 && mt > 0, vt = B.contextInspector;
|
|
15625
|
+
ht && !_t && e.verify?.enabled !== !1 && console.warn("[page-agent-sdk][verify] 检测到 verify 配置(check/maxAttempts/adversarial)但未装载(capabilities.verify:false 显式关闭 或 maxAttempts≤0)");
|
|
15626
|
+
let yt = e.subagent, bt = yt?.allowedTools ?? [], xt = e.permissions?.length ? Tu(e.permissions) : void 0, St = e.approval?.preview === !0 && xe ? (e, t) => e === "write" ? xe(t) : null : void 0, Ct = e.approval?.previewWrite || St ? (t, n) => e.approval?.previewWrite?.(t, n) ?? St?.(t, n) ?? null : void 0, wt = /* @__PURE__ */ new Set(), Tt = e.approval && (e.approval.tools !== void 0 || e.approval.confirm || e.approval.remember === !0) ? Eu({
|
|
15556
15627
|
...e.approval,
|
|
15557
15628
|
remember: e.approval.remember === !0,
|
|
15558
|
-
grants:
|
|
15559
|
-
timeoutMs: e.approval.timeoutMs ??
|
|
15560
|
-
onAutoReject:
|
|
15561
|
-
previewWrite:
|
|
15562
|
-
}) : void 0,
|
|
15563
|
-
...
|
|
15564
|
-
...
|
|
15629
|
+
grants: wt,
|
|
15630
|
+
timeoutMs: e.approval.timeoutMs ?? ie,
|
|
15631
|
+
onAutoReject: ae,
|
|
15632
|
+
previewWrite: Ct
|
|
15633
|
+
}) : void 0, Et = [
|
|
15634
|
+
...xt ? [xt] : [],
|
|
15635
|
+
...Tt ? [Tt] : [],
|
|
15565
15636
|
...G ? [G] : []
|
|
15566
|
-
],
|
|
15567
|
-
llm:
|
|
15568
|
-
allTools: () =>
|
|
15569
|
-
allowedTools:
|
|
15637
|
+
], Dt = !ft || yt?.enabled === !1 ? void 0 : uu({
|
|
15638
|
+
llm: yt?.llm ?? e.llm,
|
|
15639
|
+
allTools: () => Y.agent?.allTools ?? rt,
|
|
15640
|
+
allowedTools: bt.length ? bt : void 0,
|
|
15570
15641
|
...e.staleReadInvalidation === void 0 ? {} : { staleReadInvalidation: e.staleReadInvalidation },
|
|
15571
|
-
systemPrompt:
|
|
15572
|
-
temperature:
|
|
15573
|
-
maxTokens:
|
|
15574
|
-
skills:
|
|
15575
|
-
maxDepth:
|
|
15576
|
-
maxParallel:
|
|
15577
|
-
thinkingMode:
|
|
15642
|
+
systemPrompt: yt?.systemPrompt,
|
|
15643
|
+
temperature: yt?.temperature,
|
|
15644
|
+
maxTokens: yt?.maxTokens,
|
|
15645
|
+
skills: yt?.skills,
|
|
15646
|
+
maxDepth: yt?.maxDepth,
|
|
15647
|
+
maxParallel: yt?.maxParallel,
|
|
15648
|
+
thinkingMode: yt?.thinkingMode,
|
|
15578
15649
|
debug: e.debug,
|
|
15579
|
-
getFocuses: () =>
|
|
15650
|
+
getFocuses: () => A.getActiveFocuses(),
|
|
15580
15651
|
getSchema: () => W()?.schema ?? null,
|
|
15581
|
-
tracker:
|
|
15582
|
-
guardMiddleware:
|
|
15583
|
-
getVfsFiles:
|
|
15652
|
+
tracker: pt,
|
|
15653
|
+
guardMiddleware: Et.length ? Et : void 0,
|
|
15654
|
+
getVfsFiles: ct ? () => T.files : void 0,
|
|
15584
15655
|
enterDataScope: U?.enterScope ? (e) => U.enterScope(e) : void 0,
|
|
15585
15656
|
exitDataScope: U?.exitScope ? (e) => U.exitScope(e) : void 0,
|
|
15586
15657
|
onUsage: (e) => {
|
|
15587
15658
|
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);
|
|
15588
15659
|
},
|
|
15589
|
-
timeoutMs:
|
|
15590
|
-
}),
|
|
15660
|
+
timeoutMs: yt?.timeoutMs
|
|
15661
|
+
}), Ot = de?.map((e) => {
|
|
15591
15662
|
if (!e._codeAsset) return e;
|
|
15592
15663
|
let t = e._codeAsset, n = zf({
|
|
15593
15664
|
writablePaths: t.writablePaths,
|
|
@@ -15604,82 +15675,82 @@ function rv(e, n, r) {
|
|
|
15604
15675
|
...e,
|
|
15605
15676
|
middleware: r
|
|
15606
15677
|
};
|
|
15607
|
-
}),
|
|
15678
|
+
}), kt = fe && ft ? Bf() : void 0, At = kt ? qf({
|
|
15608
15679
|
getBind: () => W()?.bind,
|
|
15609
|
-
writablePaths:
|
|
15610
|
-
getLocked: () =>
|
|
15611
|
-
tools:
|
|
15612
|
-
getCodeFieldPaths: () => Gf(W()?.bind,
|
|
15680
|
+
writablePaths: L,
|
|
15681
|
+
getLocked: () => kt.locked(),
|
|
15682
|
+
tools: rt,
|
|
15683
|
+
getCodeFieldPaths: () => Gf(W()?.bind, I.map((e) => ({
|
|
15613
15684
|
writablePaths: e._codeAsset.writablePaths,
|
|
15614
15685
|
codeField: e._codeAsset.codeField
|
|
15615
15686
|
})))
|
|
15616
|
-
}) : void 0,
|
|
15687
|
+
}) : void 0, jt = U?.getSummarizedPaths && U.clearSummarizedPaths ? Xf({
|
|
15617
15688
|
getSummarizedPaths: () => U.getSummarizedPaths(),
|
|
15618
15689
|
clearSummarizedPaths: () => U.clearSummarizedPaths()
|
|
15619
|
-
}) : void 0,
|
|
15690
|
+
}) : void 0, Mt = ft && Ot !== void 0 ? pu(Ot, {
|
|
15620
15691
|
llm: e.llm,
|
|
15621
15692
|
thinkingModeDefault: e.subagent?.thinkingMode,
|
|
15622
15693
|
staleReadInvalidation: e.staleReadInvalidation,
|
|
15623
|
-
allTools: () =>
|
|
15694
|
+
allTools: () => Y.agent?.allTools ?? rt,
|
|
15624
15695
|
debug: e.debug,
|
|
15625
|
-
getFocuses: () =>
|
|
15696
|
+
getFocuses: () => A.getActiveFocuses(),
|
|
15626
15697
|
getSchema: () => W()?.schema ?? null,
|
|
15627
15698
|
getBind: () => W()?.bind,
|
|
15628
|
-
tracker:
|
|
15629
|
-
guardMiddleware:
|
|
15630
|
-
getVfsFiles:
|
|
15699
|
+
tracker: pt,
|
|
15700
|
+
guardMiddleware: Et.length ? Et : void 0,
|
|
15701
|
+
getVfsFiles: ct ? () => T.files : void 0,
|
|
15631
15702
|
enterDataScope: U?.enterScope ? (e) => U.enterScope(e) : void 0,
|
|
15632
15703
|
exitDataScope: U?.exitScope ? (e) => U.exitScope(e) : void 0,
|
|
15633
15704
|
onUsage: (e) => {
|
|
15634
15705
|
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);
|
|
15635
15706
|
},
|
|
15636
15707
|
timeoutMs: e.subagent?.timeoutMs,
|
|
15637
|
-
...
|
|
15638
|
-
componentLock:
|
|
15639
|
-
resolveComponents: (e) => Vf(e, Ff(W()?.bind,
|
|
15708
|
+
...kt ? {
|
|
15709
|
+
componentLock: kt,
|
|
15710
|
+
resolveComponents: (e) => Vf(e, Ff(W()?.bind, L))
|
|
15640
15711
|
} : {}
|
|
15641
|
-
}) : void 0,
|
|
15712
|
+
}) : void 0, Nt = Mt ? Mt.controller : null, Ft = (t) => {
|
|
15642
15713
|
let n = t.thinkingMode ?? e.subagent?.thinkingMode, r = n ? Ip(t.llm ?? e.llm) ? "instance-noop" : "applied" : "inherited";
|
|
15643
15714
|
return {
|
|
15644
15715
|
...t,
|
|
15645
15716
|
...n ? { thinkingMode: n } : {},
|
|
15646
15717
|
thinkingApplied: r
|
|
15647
15718
|
};
|
|
15648
|
-
},
|
|
15719
|
+
}, It = ["read", "fetch_document"], Lt = rt.filter((e) => It.includes(e.name)), Rt = _t ? Vu({
|
|
15649
15720
|
check: e.verify.check ?? qu({
|
|
15650
15721
|
schemas: () => W() ? { "": W().schema } : {},
|
|
15651
15722
|
root: () => W()?.bind
|
|
15652
15723
|
}),
|
|
15653
15724
|
adversarial: e.verify?.adversarial ? {
|
|
15654
15725
|
llm: e.llm,
|
|
15655
|
-
tools:
|
|
15726
|
+
tools: Lt
|
|
15656
15727
|
} : void 0
|
|
15657
|
-
}) : void 0,
|
|
15728
|
+
}) : void 0, zt = vt ? sd({
|
|
15658
15729
|
contextWindow: g.contextWindow,
|
|
15659
15730
|
thresholdRatio: Am(e, g.contextWindow).summaryThresholdRatio
|
|
15660
|
-
}) : void 0,
|
|
15731
|
+
}) : void 0, Bt = V_({
|
|
15661
15732
|
...B,
|
|
15662
|
-
humanConfirm:
|
|
15733
|
+
humanConfirm: Ge,
|
|
15663
15734
|
screenshot: !!ke,
|
|
15664
15735
|
domEdit: B.domEdit,
|
|
15665
15736
|
hasActions: !!e.actions && Object.keys(e.actions).length > 0,
|
|
15666
15737
|
hasProposals: !!e.proposals,
|
|
15667
15738
|
viewImage: !!Oe,
|
|
15668
|
-
subagents:
|
|
15669
|
-
}, V && !!
|
|
15739
|
+
subagents: de?.map(Ft)
|
|
15740
|
+
}, V && !!N, { promptSoftCap: zl(g.contextWindow, y.promptSoftCapTokens) }), Vt = B.pageContext ? U_({
|
|
15670
15741
|
getPageInfo: () => typeof document < "u" && typeof location < "u" ? {
|
|
15671
15742
|
title: document.title || "",
|
|
15672
15743
|
url: location.href
|
|
15673
15744
|
} : null,
|
|
15674
15745
|
canReadPage: B.domInspect === !0
|
|
15675
|
-
}) : void 0,
|
|
15746
|
+
}) : void 0, q = {
|
|
15676
15747
|
epoch: 0,
|
|
15677
15748
|
notices: [],
|
|
15678
15749
|
readsInvalidated: 0
|
|
15679
|
-
},
|
|
15750
|
+
}, Ht = 0, Ut = {
|
|
15680
15751
|
name: "hostNotice",
|
|
15681
15752
|
beforeAgent: () => {
|
|
15682
|
-
|
|
15753
|
+
Ht = q.epoch;
|
|
15683
15754
|
},
|
|
15684
15755
|
wrapModelCall: async (e, t) => {
|
|
15685
15756
|
if (Me) {
|
|
@@ -15687,7 +15758,7 @@ function rv(e, n, r) {
|
|
|
15687
15758
|
let t = to(e.messages, "agent 已通过 dom_edit 修改页面,此前读取为改前状态", Be);
|
|
15688
15759
|
if (t.invalidatedCount > 0) {
|
|
15689
15760
|
for (let n = 0; n < t.messages.length; n++) e.messages[n] = t.messages[n];
|
|
15690
|
-
|
|
15761
|
+
Y.agent?.debugLogs?.value?.push({
|
|
15691
15762
|
timestamp: Date.now(),
|
|
15692
15763
|
type: "middleware",
|
|
15693
15764
|
data: {
|
|
@@ -15697,18 +15768,18 @@ function rv(e, n, r) {
|
|
|
15697
15768
|
});
|
|
15698
15769
|
}
|
|
15699
15770
|
}
|
|
15700
|
-
if (
|
|
15701
|
-
|
|
15702
|
-
let t =
|
|
15771
|
+
if (q.epoch > Ht) {
|
|
15772
|
+
Ht = q.epoch;
|
|
15773
|
+
let t = q.notices[q.notices.length - 1] ?? "", n = to(e.messages, t || void 0, Be);
|
|
15703
15774
|
if (n.invalidatedCount > 0) {
|
|
15704
15775
|
for (let t = 0; t < n.messages.length; t++) e.messages[t] = n.messages[t];
|
|
15705
|
-
|
|
15776
|
+
q.readsInvalidated += n.invalidatedCount, Y.agent?.debugLogs?.value?.push({
|
|
15706
15777
|
timestamp: Date.now(),
|
|
15707
15778
|
type: "middleware",
|
|
15708
15779
|
data: {
|
|
15709
15780
|
stage: "host_read_invalidated",
|
|
15710
15781
|
count: n.invalidatedCount,
|
|
15711
|
-
epoch:
|
|
15782
|
+
epoch: q.epoch,
|
|
15712
15783
|
reason: t || void 0
|
|
15713
15784
|
}
|
|
15714
15785
|
});
|
|
@@ -15716,24 +15787,30 @@ function rv(e, n, r) {
|
|
|
15716
15787
|
}
|
|
15717
15788
|
return t(e);
|
|
15718
15789
|
},
|
|
15719
|
-
augmentPrompt: () =>
|
|
15790
|
+
augmentPrompt: () => q.notices.length ? [
|
|
15720
15791
|
"【宿主页面已变更】",
|
|
15721
|
-
...
|
|
15792
|
+
...q.notices.filter(Boolean).map((e) => `· ${e}`),
|
|
15722
15793
|
B.domInspect === !0 ? "此前的页面读取/截图结果已过期,回答任何关于当前页面的问题前必须重新 read_page / get_dom 读取当前页面;不要凭此前的读取结果或记忆作答。" : "页面内容可能已变化,断言页面前先核实当前状态;不要凭此前的印象作答。"
|
|
15723
15794
|
].join("\n") : void 0,
|
|
15724
15795
|
afterAgent: () => {
|
|
15725
|
-
|
|
15796
|
+
q.notices.length = 0;
|
|
15726
15797
|
}
|
|
15727
|
-
},
|
|
15798
|
+
}, Wt = Fe ? {
|
|
15728
15799
|
name: "proposalNotice",
|
|
15729
15800
|
augmentPrompt: () => Fe.state.notices.length ? ["【内容提案裁决结果】(以此为准,不要凭提案前状态作答)", ...Fe.state.notices].join("\n") : void 0,
|
|
15730
15801
|
afterAgent: () => {
|
|
15731
15802
|
Fe.state.notices.length = 0;
|
|
15732
15803
|
}
|
|
15733
|
-
} : null,
|
|
15804
|
+
} : null, Gt = Ve.size > 0 ? {
|
|
15805
|
+
name: "actionNotice",
|
|
15806
|
+
augmentPrompt: () => He.notices.length ? ["【宿主动作裁决结果】(以此为准;这些动作的效果以本段为准,不要凭调用时的回执猜测)", ...He.notices].join("\n") : void 0,
|
|
15807
|
+
afterAgent: () => {
|
|
15808
|
+
He.clear();
|
|
15809
|
+
}
|
|
15810
|
+
} : null, qt = N ? {
|
|
15734
15811
|
name: "dataHint",
|
|
15735
15812
|
augmentPrompt: () => Sd(W(), e.schemaHint) || void 0
|
|
15736
|
-
} : null,
|
|
15813
|
+
} : null, Jt = e.augmentSystem ? {
|
|
15737
15814
|
name: "augmentSystem",
|
|
15738
15815
|
augmentPrompt: (t) => {
|
|
15739
15816
|
try {
|
|
@@ -15746,140 +15823,141 @@ function rv(e, n, r) {
|
|
|
15746
15823
|
return;
|
|
15747
15824
|
}
|
|
15748
15825
|
}
|
|
15749
|
-
} : null,
|
|
15826
|
+
} : null, Yt = Dm(e.onEvent), J = Yt.emit, Zt, Qt = [], $t = (e) => ({
|
|
15750
15827
|
name: e.name,
|
|
15751
15828
|
description: e.description,
|
|
15752
15829
|
content: typeof e.getContent == "function" ? e.getContent() : ""
|
|
15753
|
-
}),
|
|
15830
|
+
}), en = (e) => ({
|
|
15754
15831
|
name: e.name,
|
|
15755
15832
|
description: e.description,
|
|
15756
15833
|
getContent: () => e.content
|
|
15757
|
-
}),
|
|
15834
|
+
}), tn = e.skillStorage === !1 ? null : Y_({
|
|
15758
15835
|
...typeof e.skillStorage == "object" ? e.skillStorage : {},
|
|
15759
15836
|
id: e.skillStorage && typeof e.skillStorage == "object" && e.skillStorage.id ? e.skillStorage.id : `agent::${n}`
|
|
15760
|
-
}),
|
|
15761
|
-
let t =
|
|
15837
|
+
}), nn = () => {
|
|
15838
|
+
let t = Zt ? Zt.controller : null;
|
|
15762
15839
|
if (t) {
|
|
15763
|
-
let n = (e.skills || []).filter((e) => !
|
|
15764
|
-
t.set([...n, ...
|
|
15840
|
+
let n = (e.skills || []).filter((e) => !Qt.some((t) => t.name === e.name));
|
|
15841
|
+
t.set([...n, ...Qt]);
|
|
15765
15842
|
}
|
|
15766
|
-
|
|
15767
|
-
},
|
|
15768
|
-
if (
|
|
15769
|
-
let t = await
|
|
15843
|
+
Y.infoTick.value++;
|
|
15844
|
+
}, rn = async () => {
|
|
15845
|
+
if (tn) try {
|
|
15846
|
+
let t = await tn.list();
|
|
15770
15847
|
if (t.length) {
|
|
15771
|
-
|
|
15772
|
-
let n =
|
|
15848
|
+
Qt = t.map(en);
|
|
15849
|
+
let n = Zt ? Zt.controller : null;
|
|
15773
15850
|
if (n) {
|
|
15774
|
-
let t = (e.skills || []).filter((e) => !
|
|
15775
|
-
n.set([...t, ...
|
|
15851
|
+
let t = (e.skills || []).filter((e) => !Qt.some((t) => t.name === e.name));
|
|
15852
|
+
n.set([...t, ...Qt]);
|
|
15776
15853
|
}
|
|
15777
|
-
|
|
15854
|
+
Y.infoTick.value++;
|
|
15778
15855
|
}
|
|
15779
15856
|
} catch {}
|
|
15780
|
-
},
|
|
15857
|
+
}, an = lt ? Ul({
|
|
15781
15858
|
...y,
|
|
15782
15859
|
llmInvoke: d,
|
|
15783
15860
|
getRegisteredData: () => W() ? [{ description: W().description ?? "主数据对象" }] : [],
|
|
15784
15861
|
preserveLastToolResults: x,
|
|
15785
|
-
...
|
|
15862
|
+
...ut ? {
|
|
15786
15863
|
decideInvoke: m,
|
|
15787
|
-
getSnapshot: () =>
|
|
15864
|
+
getSnapshot: () => zt?.getSnapshot()
|
|
15788
15865
|
} : {}
|
|
15789
|
-
}) : void 0,
|
|
15866
|
+
}) : void 0, on = st ? vl([
|
|
15790
15867
|
...B.domInspect && !(e.skills || []).some((e) => e.name === "dom-inspect") ? [h_({
|
|
15791
15868
|
withScreenshot: !!ke,
|
|
15792
15869
|
withDomEdit: B.domEdit,
|
|
15793
|
-
withDataOps: V && !!
|
|
15870
|
+
withDataOps: V && !!N
|
|
15794
15871
|
})] : [],
|
|
15795
15872
|
...B.domInspect && !(e.skills || []).some((e) => e.name === "page-analysis") ? [__({
|
|
15796
15873
|
withScreenshot: !!ke,
|
|
15797
15874
|
withDomEdit: B.domEdit,
|
|
15798
|
-
withVfs:
|
|
15875
|
+
withVfs: ct
|
|
15799
15876
|
})] : [],
|
|
15800
15877
|
...e.skills || []
|
|
15801
15878
|
], {
|
|
15802
|
-
readVfs:
|
|
15879
|
+
readVfs: ct ? (e) => T.files[e]?.content : void 0,
|
|
15803
15880
|
onToolsReady: (e, t) => {
|
|
15804
15881
|
for (let n of t) {
|
|
15805
|
-
let t =
|
|
15806
|
-
t >= 0 &&
|
|
15882
|
+
let t = et.findIndex((e) => e.name === n.name);
|
|
15883
|
+
t >= 0 && et.splice(t, 1), et.push(n), tt.set(n.name, e), K.set(n.name, `skill:${e}`);
|
|
15807
15884
|
}
|
|
15808
|
-
|
|
15885
|
+
rt = nt(), Y.agent && Y.agent.setTools(rt), Y.infoTick.value++;
|
|
15809
15886
|
}
|
|
15810
15887
|
}) : void 0;
|
|
15811
|
-
|
|
15812
|
-
let
|
|
15813
|
-
...
|
|
15814
|
-
|
|
15815
|
-
...
|
|
15816
|
-
|
|
15817
|
-
...
|
|
15818
|
-
...
|
|
15888
|
+
Zt = on;
|
|
15889
|
+
let sn = Mm([
|
|
15890
|
+
...qt ? [qt] : [],
|
|
15891
|
+
Bt,
|
|
15892
|
+
...Vt ? [Vt] : [],
|
|
15893
|
+
Ut,
|
|
15894
|
+
...Wt ? [Wt] : [],
|
|
15895
|
+
...Gt ? [Gt] : [],
|
|
15896
|
+
...at ? [O] : [],
|
|
15819
15897
|
ee,
|
|
15820
15898
|
te,
|
|
15821
|
-
...
|
|
15822
|
-
...
|
|
15823
|
-
...
|
|
15824
|
-
...
|
|
15825
|
-
...
|
|
15826
|
-
...
|
|
15899
|
+
...it ? [D] : [],
|
|
15900
|
+
...on ? [on] : [],
|
|
15901
|
+
...ct ? [Fd(T)] : [],
|
|
15902
|
+
...an ? [an] : [],
|
|
15903
|
+
...ot ? [se] : [],
|
|
15904
|
+
...Je ? [A] : [],
|
|
15827
15905
|
...Se ? [Se] : [],
|
|
15828
|
-
...
|
|
15829
|
-
...
|
|
15830
|
-
...
|
|
15831
|
-
...
|
|
15832
|
-
...Ct ? [Ct] : [],
|
|
15833
|
-
...G ? [G] : [],
|
|
15834
|
-
...It ? [It] : [],
|
|
15906
|
+
...dt ? [M] : [],
|
|
15907
|
+
...xt ? [xt] : [],
|
|
15908
|
+
...he && z && R ? [zu(R)] : [],
|
|
15909
|
+
...Ge ? [oe] : [],
|
|
15835
15910
|
...Tt ? [Tt] : [],
|
|
15911
|
+
...G ? [G] : [],
|
|
15912
|
+
...Rt ? [Rt] : [],
|
|
15913
|
+
...Dt ? [Dt] : [],
|
|
15914
|
+
...Mt ? [Mt] : [],
|
|
15836
15915
|
...At ? [At] : [],
|
|
15837
|
-
...
|
|
15838
|
-
...
|
|
15839
|
-
...U && ut ? [$f({
|
|
15916
|
+
...jt ? [jt] : [],
|
|
15917
|
+
...U && ft ? [$f({
|
|
15840
15918
|
getBind: () => W()?.bind,
|
|
15841
|
-
getTools: () =>
|
|
15919
|
+
getTools: () => Y.agent?.allTools ?? rt
|
|
15842
15920
|
})] : [],
|
|
15843
|
-
...
|
|
15844
|
-
...
|
|
15921
|
+
...Jt ? [Jt] : [],
|
|
15922
|
+
...zt ? [zt] : [],
|
|
15845
15923
|
...je ? [je] : [],
|
|
15846
15924
|
...e.middleware || [],
|
|
15847
15925
|
..._e ? [E_(a, {
|
|
15848
15926
|
tokenBudget: e.tokenBudget,
|
|
15849
15927
|
timeBudgetMs: e.timeBudgetMs
|
|
15850
|
-
},
|
|
15851
|
-
|
|
15852
|
-
]),
|
|
15853
|
-
function
|
|
15928
|
+
}, J)] : [],
|
|
15929
|
+
iv(J, w, W, a)
|
|
15930
|
+
]), cn = e.maxMemoryRounds ?? ev;
|
|
15931
|
+
function ln(e) {
|
|
15854
15932
|
return (e) => {
|
|
15855
|
-
e.type !== "approval_request" &&
|
|
15933
|
+
e.type !== "approval_request" && J(De(e));
|
|
15856
15934
|
};
|
|
15857
15935
|
}
|
|
15858
|
-
let
|
|
15859
|
-
function
|
|
15936
|
+
let un = /* @__PURE__ */ Kt([]), dn = $_(), fn = /* @__PURE__ */ new Set();
|
|
15937
|
+
function pn(e) {
|
|
15860
15938
|
let t = new AbortController(), n = () => t.abort();
|
|
15861
|
-
return e && (e.aborted ? t.abort() : e.addEventListener("abort", n, { once: !0 })),
|
|
15939
|
+
return e && (e.aborted ? t.abort() : e.addEventListener("abort", n, { once: !0 })), fn.add(t), {
|
|
15862
15940
|
controller: t,
|
|
15863
15941
|
untrack: () => {
|
|
15864
|
-
|
|
15942
|
+
fn.delete(t), e?.removeEventListener("abort", n);
|
|
15865
15943
|
}
|
|
15866
15944
|
};
|
|
15867
15945
|
}
|
|
15868
|
-
function
|
|
15869
|
-
for (let e of
|
|
15870
|
-
|
|
15946
|
+
function mn() {
|
|
15947
|
+
for (let e of fn) e.abort();
|
|
15948
|
+
fn.clear();
|
|
15871
15949
|
}
|
|
15872
|
-
let
|
|
15950
|
+
let hn = /* @__PURE__ */ Kt(null), Y = {
|
|
15873
15951
|
agentId: n,
|
|
15874
15952
|
store: l,
|
|
15875
15953
|
messages: w,
|
|
15876
15954
|
vfsStore: T,
|
|
15877
|
-
listeners:
|
|
15955
|
+
listeners: Yt.listeners,
|
|
15878
15956
|
todosMw: D,
|
|
15879
|
-
memoryMw:
|
|
15957
|
+
memoryMw: M,
|
|
15880
15958
|
missionMw: O,
|
|
15881
|
-
workingMemoryMw:
|
|
15882
|
-
focusMw:
|
|
15959
|
+
workingMemoryMw: se,
|
|
15960
|
+
focusMw: A,
|
|
15883
15961
|
agent: null,
|
|
15884
15962
|
initDone: Promise.resolve(),
|
|
15885
15963
|
sessionId: "",
|
|
@@ -15887,57 +15965,57 @@ function rv(e, n, r) {
|
|
|
15887
15965
|
mcpClosers: [],
|
|
15888
15966
|
mcpServers: [],
|
|
15889
15967
|
mcpFailed: [],
|
|
15890
|
-
checkpoint:
|
|
15968
|
+
checkpoint: R,
|
|
15891
15969
|
dataOpsController: U,
|
|
15892
|
-
skillsController:
|
|
15970
|
+
skillsController: Zt ? Zt.controller : null,
|
|
15893
15971
|
infoTick: c,
|
|
15894
15972
|
pendingConflict: o.pendingConflict,
|
|
15895
|
-
pendingQuote:
|
|
15896
|
-
sessions:
|
|
15897
|
-
refreshSessions: () =>
|
|
15973
|
+
pendingQuote: hn,
|
|
15974
|
+
sessions: un,
|
|
15975
|
+
refreshSessions: () => X.refreshSessions(),
|
|
15898
15976
|
liveData: W,
|
|
15899
15977
|
usage: a,
|
|
15900
|
-
emit:
|
|
15901
|
-
runSerial:
|
|
15902
|
-
trackActive:
|
|
15903
|
-
abortAllActive:
|
|
15978
|
+
emit: J,
|
|
15979
|
+
runSerial: dn,
|
|
15980
|
+
trackActive: pn,
|
|
15981
|
+
abortAllActive: mn,
|
|
15904
15982
|
unloadSkillTools(e) {
|
|
15905
15983
|
if (e) {
|
|
15906
|
-
let t =
|
|
15907
|
-
if (
|
|
15984
|
+
let t = et.length;
|
|
15985
|
+
if (et = et.filter((t) => tt.get(t.name) === e ? (K.delete(t.name), tt.delete(t.name), !1) : !0), et.length === t) return;
|
|
15908
15986
|
} else {
|
|
15909
|
-
if (
|
|
15910
|
-
for (let e of
|
|
15911
|
-
|
|
15987
|
+
if (!et.length) return;
|
|
15988
|
+
for (let e of et) K.delete(e.name), tt.delete(e.name);
|
|
15989
|
+
et = [];
|
|
15912
15990
|
}
|
|
15913
|
-
|
|
15991
|
+
rt = nt(), Y.agent && Y.agent.setTools(rt);
|
|
15914
15992
|
},
|
|
15915
15993
|
applySnapshot(t) {
|
|
15916
|
-
if (t.vfs && T.hydrate && T.hydrate(t.vfs), t.messages?.length && (w.push(...Ci(t.messages, (e) => (e ?
|
|
15994
|
+
if (t.vfs && T.hydrate && T.hydrate(t.vfs), t.messages?.length && (w.push(...Ci(t.messages, (e) => (e ? Y.vfsStore?.files?.[e]?.content : void 0) || void 0)), te.markResumed()), t.todos?.length && D.reset(t.todos), t.memory && !e.memory && M.reset(t.memory), t.checkpoints?.length && R && R.importStack(t.checkpoints), t.usage && Object.assign(a, t.usage), t.mission && at && O.setMission(t.mission), t.workingMemory && ot && se.restore(t.workingMemory), t.planConfirmation && (ne.lastPlanConfirmation = t.planConfirmation), Je) {
|
|
15917
15995
|
let n = t.focus, r = n ? Array.isArray(n) ? n : [n] : [];
|
|
15918
15996
|
if (r.length) {
|
|
15919
15997
|
let t = W()?.schema, n = t ? r.filter((e) => Bs(t, e.path)) : [];
|
|
15920
|
-
if (n.length && (
|
|
15998
|
+
if (n.length && (A.setFocus(null), n.forEach((e) => A.addFocus(j(e)))), e.debug && n.length < r.length) {
|
|
15921
15999
|
let e = r.filter((e) => !n.includes(e)).map((e) => e.path);
|
|
15922
16000
|
console.warn("[page-agent-sdk][focus] 恢复的焦点部分 path 已失效(schema 变化/无 schema),剔除:", e);
|
|
15923
16001
|
}
|
|
15924
16002
|
}
|
|
15925
16003
|
}
|
|
15926
|
-
|
|
16004
|
+
yn();
|
|
15927
16005
|
},
|
|
15928
16006
|
addSkill(e) {
|
|
15929
|
-
let t =
|
|
15930
|
-
t >= 0 ?
|
|
16007
|
+
let t = Qt.findIndex((t) => t.name === e.name);
|
|
16008
|
+
t >= 0 ? Qt[t] = e : Qt.push(e), nn(), tn && tn.put($t(e));
|
|
15931
16009
|
},
|
|
15932
16010
|
removeSkill(e) {
|
|
15933
|
-
let t =
|
|
15934
|
-
return t < 0 ? !1 : (
|
|
16011
|
+
let t = Qt.findIndex((t) => t.name === e);
|
|
16012
|
+
return t < 0 ? !1 : (Qt.splice(t, 1), nn(), tn && tn.remove(e), !0);
|
|
15935
16013
|
},
|
|
15936
16014
|
listUserSkills() {
|
|
15937
|
-
return
|
|
16015
|
+
return Qt.map((e) => e.name);
|
|
15938
16016
|
},
|
|
15939
16017
|
getUserSkill(e) {
|
|
15940
|
-
let t =
|
|
16018
|
+
let t = Qt.find((t) => t.name === e);
|
|
15941
16019
|
if (t) return {
|
|
15942
16020
|
name: t.name,
|
|
15943
16021
|
description: t.description,
|
|
@@ -15945,33 +16023,33 @@ function rv(e, n, r) {
|
|
|
15945
16023
|
};
|
|
15946
16024
|
},
|
|
15947
16025
|
afterRound() {
|
|
15948
|
-
|
|
16026
|
+
bn(), X.persistRuntime();
|
|
15949
16027
|
},
|
|
15950
16028
|
clearCodeReuse() {
|
|
15951
16029
|
let e = T;
|
|
15952
16030
|
e.__pgPendingRetry?.clear(), e.__pgLastCheckout?.clear();
|
|
15953
16031
|
},
|
|
15954
16032
|
async send(e, t) {
|
|
15955
|
-
if (await
|
|
15956
|
-
t ??= {}, t?.mission &&
|
|
16033
|
+
if (await Y.initDone, Y.refCount <= 0) throw Error("page-agent-sdk: agent 已释放(unmount),拒绝排队中的 send");
|
|
16034
|
+
t ??= {}, t?.mission && at && O.setMission(t.mission);
|
|
15957
16035
|
let n = e, r = (t.images ?? []).filter((e) => e && (e.dataUri || e.vfsRef || e.url));
|
|
15958
16036
|
if (r.length > 4) throw Error(`[page-agent-sdk] 单轮最多 4 张图片(收到 ${r.length})`);
|
|
15959
|
-
if (r.length && (await
|
|
16037
|
+
if (r.length && (await xn.stowImages(r), await xn.describeIfNeeded(r, n)), r.length && !g.vision && !r.every((e) => e.description)) {
|
|
15960
16038
|
let e = "当前主模型不支持图片输入(modelCaps.vision=false)。请换多模态模型(gpt-4o/claude/qwen-vl)或 LLMConfig 声明 vision:true;或配置 images.describe 绑定识图转述(集成方识图子 agent / 自有 vision API)";
|
|
15961
|
-
throw
|
|
16039
|
+
throw J({
|
|
15962
16040
|
type: "error",
|
|
15963
16041
|
message: e,
|
|
15964
16042
|
severity: "recoverable",
|
|
15965
16043
|
code: "IMAGE_UNSUPPORTED_MODEL"
|
|
15966
16044
|
}), Error(`[page-agent-sdk] ${e}`);
|
|
15967
16045
|
}
|
|
15968
|
-
T?.setProtectedRefs?.(
|
|
15969
|
-
let i = _e ? t.maxAutoRetries ?? 1 : 0, a = 0, s = !1, c =
|
|
16046
|
+
T?.setProtectedRefs?.(Z_(w));
|
|
16047
|
+
let i = _e ? t.maxAutoRetries ?? 1 : 0, a = 0, s = !1, c = ln(t.signal);
|
|
15970
16048
|
if (t.signal) {
|
|
15971
16049
|
let e = () => o.resolve("keep_external");
|
|
15972
16050
|
t.signal.aborted ? e() : t.signal.addEventListener("abort", e, { once: !0 });
|
|
15973
16051
|
}
|
|
15974
|
-
let u =
|
|
16052
|
+
let u = Y.sessionId;
|
|
15975
16053
|
for (;;) {
|
|
15976
16054
|
if (!s) {
|
|
15977
16055
|
let e;
|
|
@@ -15983,35 +16061,35 @@ function rv(e, n, r) {
|
|
|
15983
16061
|
...n ? { anchor: n } : {}
|
|
15984
16062
|
};
|
|
15985
16063
|
}
|
|
15986
|
-
let i = e ??
|
|
16064
|
+
let i = e ?? hn.value ?? void 0;
|
|
15987
16065
|
w.push({
|
|
15988
16066
|
role: "user",
|
|
15989
16067
|
content: n,
|
|
15990
16068
|
timestamp: Date.now(),
|
|
15991
16069
|
...r.length ? { images: r } : {},
|
|
15992
16070
|
...i ? { quote: i } : {}
|
|
15993
|
-
}), s = !0, !e &&
|
|
16071
|
+
}), s = !0, !e && hn.value && (hn.value = null);
|
|
15994
16072
|
}
|
|
15995
16073
|
try {
|
|
15996
|
-
let e = await
|
|
15997
|
-
if (t.signal?.aborted ||
|
|
16074
|
+
let e = await Y.agent.invoke(w, t.signal, c);
|
|
16075
|
+
if (t.signal?.aborted || Y.sessionId !== u || Y.refCount <= 0) return Y.agent?.debugLogs?.value?.push({
|
|
15998
16076
|
timestamp: Date.now(),
|
|
15999
16077
|
type: "middleware",
|
|
16000
16078
|
data: {
|
|
16001
16079
|
stage: "orphan_round_dropped",
|
|
16002
16080
|
fromSession: u,
|
|
16003
16081
|
aborted: !!t.signal?.aborted,
|
|
16004
|
-
sessionChanged:
|
|
16082
|
+
sessionChanged: Y.sessionId !== u
|
|
16005
16083
|
}
|
|
16006
16084
|
}), e;
|
|
16007
16085
|
if (w.push({
|
|
16008
16086
|
role: "assistant",
|
|
16009
16087
|
content: e,
|
|
16010
16088
|
timestamp: Date.now()
|
|
16011
|
-
}),
|
|
16089
|
+
}), Y.afterRound(), l) try {
|
|
16012
16090
|
await l.flush();
|
|
16013
16091
|
} catch (e) {
|
|
16014
|
-
|
|
16092
|
+
J({
|
|
16015
16093
|
type: "error",
|
|
16016
16094
|
message: `落盘失败(不影响本轮回复):${e instanceof Error ? e.message : String(e)}`,
|
|
16017
16095
|
severity: "observable",
|
|
@@ -16026,8 +16104,8 @@ function rv(e, n, r) {
|
|
|
16026
16104
|
...n,
|
|
16027
16105
|
code: "MODEL_UNAVAILABLE",
|
|
16028
16106
|
message: e instanceof Error ? e.message : n.message
|
|
16029
|
-
}), a < i &&
|
|
16030
|
-
a += 1,
|
|
16107
|
+
}), a < i && R?.canRestore()) {
|
|
16108
|
+
a += 1, R.restore(), s = !0, J({
|
|
16031
16109
|
type: "error",
|
|
16032
16110
|
message: `致命错误自动恢复(${a}/${i}):${n.message},已回退 checkpoint 重试`,
|
|
16033
16111
|
severity: "observable",
|
|
@@ -16039,7 +16117,7 @@ function rv(e, n, r) {
|
|
|
16039
16117
|
});
|
|
16040
16118
|
continue;
|
|
16041
16119
|
}
|
|
16042
|
-
throw
|
|
16120
|
+
throw J({
|
|
16043
16121
|
type: "error",
|
|
16044
16122
|
message: n.message,
|
|
16045
16123
|
severity: n.severity,
|
|
@@ -16050,10 +16128,10 @@ function rv(e, n, r) {
|
|
|
16050
16128
|
}
|
|
16051
16129
|
},
|
|
16052
16130
|
async batch(e, t, n) {
|
|
16053
|
-
if (await
|
|
16054
|
-
if (
|
|
16055
|
-
let r = [], i =
|
|
16056
|
-
if (T?.setProtectedRefs?.(
|
|
16131
|
+
if (await Y.initDone, !e.length) return [];
|
|
16132
|
+
if (Y.refCount <= 0) throw Error("page-agent-sdk: agent 已释放(unmount),拒绝排队中的 batch");
|
|
16133
|
+
let r = [], i = ln(n);
|
|
16134
|
+
if (T?.setProtectedRefs?.(Z_(w)), n) {
|
|
16057
16135
|
let e = () => o.resolve("keep_external");
|
|
16058
16136
|
n.aborted ? e() : n.addEventListener("abort", e, { once: !0 });
|
|
16059
16137
|
}
|
|
@@ -16068,7 +16146,7 @@ function rv(e, n, r) {
|
|
|
16068
16146
|
break;
|
|
16069
16147
|
}
|
|
16070
16148
|
let o = e[a];
|
|
16071
|
-
|
|
16149
|
+
R && R.save(`batch:${a}`);
|
|
16072
16150
|
let s = w.length;
|
|
16073
16151
|
try {
|
|
16074
16152
|
w.push({
|
|
@@ -16076,15 +16154,15 @@ function rv(e, n, r) {
|
|
|
16076
16154
|
content: o,
|
|
16077
16155
|
timestamp: Date.now()
|
|
16078
16156
|
});
|
|
16079
|
-
let s = await
|
|
16157
|
+
let s = await Y.agent.invoke(w, n, i);
|
|
16080
16158
|
if (w.push({
|
|
16081
16159
|
role: "assistant",
|
|
16082
16160
|
content: s,
|
|
16083
16161
|
timestamp: Date.now()
|
|
16084
|
-
}),
|
|
16162
|
+
}), Y.afterRound(), l) try {
|
|
16085
16163
|
await l.flush();
|
|
16086
16164
|
} catch (e) {
|
|
16087
|
-
|
|
16165
|
+
J({
|
|
16088
16166
|
type: "error",
|
|
16089
16167
|
message: `落盘失败(不影响本任务结果):${e instanceof Error ? e.message : String(e)}`,
|
|
16090
16168
|
severity: "observable",
|
|
@@ -16120,7 +16198,7 @@ function rv(e, n, r) {
|
|
|
16120
16198
|
}
|
|
16121
16199
|
ba(i);
|
|
16122
16200
|
let c = ui(i, "fatal");
|
|
16123
|
-
|
|
16201
|
+
J({
|
|
16124
16202
|
type: "error",
|
|
16125
16203
|
message: `批量任务 ${a + 1}/${e.length} 失败:${c.message}`,
|
|
16126
16204
|
severity: "observable",
|
|
@@ -16144,56 +16222,56 @@ function rv(e, n, r) {
|
|
|
16144
16222
|
}
|
|
16145
16223
|
return r;
|
|
16146
16224
|
},
|
|
16147
|
-
switchSession: (e) => (
|
|
16148
|
-
exportSession: (e) =>
|
|
16149
|
-
importSession: (e) =>
|
|
16225
|
+
switchSession: (e) => (wt.clear(), He.clear(), X.switchSession(e)),
|
|
16226
|
+
exportSession: (e) => X.exportSession(e),
|
|
16227
|
+
importSession: (e) => X.importSession(e),
|
|
16150
16228
|
resetSession: () => {
|
|
16151
|
-
|
|
16229
|
+
wt.clear(), He.clear(), X.resetSession();
|
|
16152
16230
|
},
|
|
16153
16231
|
stream: async (e, t, n) => {
|
|
16154
|
-
if (!
|
|
16232
|
+
if (!Y.agent) throw Error("page-agent-sdk: agent 尚未初始化完成,请先 await mount()");
|
|
16155
16233
|
let r = [...e].reverse().find((e) => e.role === "user" && e.images?.length);
|
|
16156
|
-
if (r?.images?.length && (await
|
|
16234
|
+
if (r?.images?.length && (await xn.stowImages(r.images), await xn.describeIfNeeded(r.images, r.content), !g.vision && !r.images.every((e) => e.description))) {
|
|
16157
16235
|
let e = "当前主模型不支持图片输入(modelCaps.vision=false)。请换多模态模型(gpt-4o/claude/qwen-vl)或 LLMConfig 声明 vision:true;或配置 images.describe 绑定识图转述";
|
|
16158
|
-
throw
|
|
16236
|
+
throw J({
|
|
16159
16237
|
type: "error",
|
|
16160
16238
|
message: e,
|
|
16161
16239
|
severity: "recoverable",
|
|
16162
16240
|
code: "IMAGE_UNSUPPORTED_MODEL"
|
|
16163
16241
|
}), Error(`[page-agent-sdk] ${e}`);
|
|
16164
16242
|
}
|
|
16165
|
-
T?.setProtectedRefs?.(
|
|
16243
|
+
T?.setProtectedRefs?.(Z_(e));
|
|
16166
16244
|
let i = (e) => {
|
|
16167
|
-
t?.(De(e)),
|
|
16245
|
+
t?.(De(e)), J(De(e)), e.type === "subagent" && (e.kind === "tool_call" || e.kind === "tool_result") && Y.infoTick.value++;
|
|
16168
16246
|
};
|
|
16169
16247
|
if (n) {
|
|
16170
16248
|
let e = () => o.resolve("keep_external");
|
|
16171
16249
|
n.aborted ? e() : n.addEventListener("abort", e, { once: !0 });
|
|
16172
16250
|
}
|
|
16173
|
-
let { controller: a, untrack: s } =
|
|
16174
|
-
return
|
|
16251
|
+
let { controller: a, untrack: s } = pn(n);
|
|
16252
|
+
return Y.agent.stream(e, i, a.signal).finally(s);
|
|
16175
16253
|
},
|
|
16176
16254
|
release() {
|
|
16177
|
-
if (
|
|
16178
|
-
|
|
16179
|
-
let e =
|
|
16180
|
-
e.length && Promise.allSettled(e.map((e) => e())),
|
|
16255
|
+
if (Y.refCount--, Y.refCount <= 0) {
|
|
16256
|
+
mn(), We = !0, l && (T.flush?.(), l.flush(), l.dispose()), tn && tn.dispose();
|
|
16257
|
+
let e = Y.mcpClosers.splice(0);
|
|
16258
|
+
e.length && Promise.allSettled(e.map((e) => e())), tv.delete(n);
|
|
16181
16259
|
}
|
|
16182
16260
|
},
|
|
16183
16261
|
resolveConflict: o.resolve,
|
|
16184
16262
|
setTools(e) {
|
|
16185
16263
|
Ie.length = 0, e.forEach((e) => {
|
|
16186
16264
|
Ie.push(e), K.set(e.name, "user");
|
|
16187
|
-
}),
|
|
16265
|
+
}), rt = nt(), Y.agent && Y.agent.setTools(rt), Y.infoTick.value++;
|
|
16188
16266
|
},
|
|
16189
16267
|
addTool(e) {
|
|
16190
|
-
|
|
16268
|
+
rt.some((t) => t.name === e.name) && console.warn(`[page-agent-sdk] 工具 "${e.name}" 已存在,新工具覆盖(后注册覆盖先注册)`);
|
|
16191
16269
|
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"),
|
|
16270
|
+
Ie.push(e), K.set(e.name, "user"), rt = nt(), Y.agent && Y.agent.setTools(rt), Y.infoTick.value++;
|
|
16193
16271
|
},
|
|
16194
16272
|
removeTool(e) {
|
|
16195
16273
|
let t = Ie.findIndex((t) => t.name === e);
|
|
16196
|
-
return t < 0 ? !1 : (Ie.splice(t, 1), K.delete(e),
|
|
16274
|
+
return t < 0 ? !1 : (Ie.splice(t, 1), K.delete(e), rt = nt(), Y.agent && Y.agent.setTools(rt), Y.infoTick.value++, !0);
|
|
16197
16275
|
},
|
|
16198
16276
|
setLlm(t) {
|
|
16199
16277
|
let n;
|
|
@@ -16203,7 +16281,7 @@ function rv(e, n, r) {
|
|
|
16203
16281
|
if ((e.provider ?? "openai") === "anthropic") throw Error("[page-agent-sdk][setLlm] 切换到 Anthropic 需传 BaseChatModel 实例(动态 import 无法同步);请先 const { ChatAnthropic } = await import(\"@langchain/anthropic\") 构造实例后传入");
|
|
16204
16282
|
n = E(e);
|
|
16205
16283
|
}
|
|
16206
|
-
typeof n.bindTools != "function" && e.debug && console.warn("[page-agent-sdk][setLlm] 新模型不支持 bindTools(tool calling 会失效)"), Rp(n, { emit:
|
|
16284
|
+
typeof n.bindTools != "function" && e.debug && console.warn("[page-agent-sdk][setLlm] 新模型不支持 bindTools(tool calling 会失效)"), Rp(n, { emit: J }), C = t;
|
|
16207
16285
|
let r = Ip(t) ? void 0 : t;
|
|
16208
16286
|
if (g = v({
|
|
16209
16287
|
model: r?.model ?? t.model ?? t.modelName,
|
|
@@ -16211,52 +16289,52 @@ function rv(e, n, r) {
|
|
|
16211
16289
|
maxOutputTokens: e.maxOutputTokens ?? r?.maxOutputTokens,
|
|
16212
16290
|
vision: r?.vision ?? t.vision
|
|
16213
16291
|
}), g.contextWindow < 2e5) throw Error(`[page-agent-sdk][setLlm] 新模型上下文窗口 ${g.contextWindow} 小于最小支持 ${p}(需 ≥200K 窗口模型)`);
|
|
16214
|
-
|
|
16292
|
+
Y.agent && (Y.agent.setLlm(n), Y.agent.setModelCaps?.(g)), an?.setContextWindow?.(g.contextWindow), zt?.setContextWindow?.(g.contextWindow), Y.infoTick.value++, e.debug && console.log("[page-agent-sdk][setLlm] 重解析 modelCaps + 回灌:", g);
|
|
16215
16293
|
},
|
|
16216
16294
|
setMemory(e) {
|
|
16217
|
-
|
|
16295
|
+
M.reset(e), typeof e == "function" && M.refresh(), Y.infoTick.value++;
|
|
16218
16296
|
},
|
|
16219
16297
|
refreshMemory() {
|
|
16220
|
-
return
|
|
16298
|
+
return M.refresh();
|
|
16221
16299
|
},
|
|
16222
16300
|
setSubagents(t) {
|
|
16223
|
-
if (!
|
|
16301
|
+
if (!Nt) {
|
|
16224
16302
|
e.debug && console.warn("[page-agent-sdk][setSubagents] 未配 subagents:[] 或 capabilities.subagent 关闭,忽略");
|
|
16225
16303
|
return;
|
|
16226
16304
|
}
|
|
16227
|
-
|
|
16305
|
+
Nt.set(t), Y.infoTick.value++;
|
|
16228
16306
|
},
|
|
16229
16307
|
addSubagent(t) {
|
|
16230
|
-
if (!
|
|
16308
|
+
if (!Nt) {
|
|
16231
16309
|
e.debug && console.warn("[page-agent-sdk][addSubagent] 未配 subagents:[] 或 capabilities.subagent 关闭,忽略");
|
|
16232
16310
|
return;
|
|
16233
16311
|
}
|
|
16234
|
-
|
|
16312
|
+
Nt.add(t), Y.infoTick.value++;
|
|
16235
16313
|
},
|
|
16236
16314
|
removeSubagent(t) {
|
|
16237
|
-
if (!
|
|
16238
|
-
let n =
|
|
16239
|
-
return n &&
|
|
16315
|
+
if (!Nt) return e.debug && console.warn("[page-agent-sdk][removeSubagent] 未配 subagents:[] 或 capabilities.subagent 关闭,忽略"), !1;
|
|
16316
|
+
let n = Nt.remove(t);
|
|
16317
|
+
return n && Y.infoTick.value++, n;
|
|
16240
16318
|
},
|
|
16241
16319
|
getActiveSubagents() {
|
|
16242
|
-
return
|
|
16320
|
+
return pt?.getActive() ?? [];
|
|
16243
16321
|
},
|
|
16244
16322
|
get subagentHistory() {
|
|
16245
|
-
return
|
|
16323
|
+
return pt?.getHistory() ?? [];
|
|
16246
16324
|
},
|
|
16247
16325
|
getInfo() {
|
|
16248
16326
|
return {
|
|
16249
16327
|
id: n,
|
|
16250
|
-
sessionId:
|
|
16328
|
+
sessionId: Y.sessionId,
|
|
16251
16329
|
model: Ip(C) ? C.model ?? C.modelName : C.model,
|
|
16252
|
-
systemPrompt:
|
|
16253
|
-
tools: (
|
|
16330
|
+
systemPrompt: Y.agent?.getEffectiveSystemPrompt?.() ?? ye + Sd(W(), e.schemaHint),
|
|
16331
|
+
tools: (Y.agent?.allTools ?? rt).map((e) => ({
|
|
16254
16332
|
name: e.name,
|
|
16255
16333
|
description: e.description,
|
|
16256
16334
|
schema: e.schema,
|
|
16257
16335
|
source: K.get(e.name) || "user"
|
|
16258
16336
|
})),
|
|
16259
|
-
skills: (
|
|
16337
|
+
skills: (Zt ? Zt.controller.get() : e.skills ?? []).map((e) => ({
|
|
16260
16338
|
name: e.name,
|
|
16261
16339
|
description: e.description
|
|
16262
16340
|
})),
|
|
@@ -16270,21 +16348,21 @@ function rv(e, n, r) {
|
|
|
16270
16348
|
summaryThresholdRatio: y.summaryThresholdRatio ?? .5,
|
|
16271
16349
|
promptSoftCap: zl(g.contextWindow, y.promptSoftCapTokens)
|
|
16272
16350
|
},
|
|
16273
|
-
memory:
|
|
16274
|
-
staleReadsInvalidated:
|
|
16275
|
-
hostReadsInvalidated:
|
|
16351
|
+
memory: M.get(),
|
|
16352
|
+
staleReadsInvalidated: Y.agent?.getStaleReadsInvalidated?.() ?? 0,
|
|
16353
|
+
hostReadsInvalidated: q.readsInvalidated,
|
|
16276
16354
|
...Fe ? { proposals: Fe.snapshot() } : {},
|
|
16277
16355
|
...r ? { hostWatch: { ...r } } : {},
|
|
16278
16356
|
...e.approval ? { approvals: {
|
|
16279
16357
|
remember: e.approval.remember === !0,
|
|
16280
|
-
grantedTools: [...
|
|
16358
|
+
grantedTools: [...wt]
|
|
16281
16359
|
} } : {},
|
|
16282
|
-
llmRetries:
|
|
16283
|
-
llmCallFailures:
|
|
16284
|
-
gates:
|
|
16285
|
-
systemSegments:
|
|
16286
|
-
middleware:
|
|
16287
|
-
todos: (
|
|
16360
|
+
llmRetries: Y.agent?.getLlmRetries?.() ?? 0,
|
|
16361
|
+
llmCallFailures: Y.agent?.getLlmCallFailures?.() ?? 0,
|
|
16362
|
+
gates: Y.agent?.getGateStats?.(),
|
|
16363
|
+
systemSegments: Y.agent?.getLastSystemSegments?.() ?? [],
|
|
16364
|
+
middleware: sn.map((e) => e.name),
|
|
16365
|
+
todos: (Y.agent?.getState?.()?.todos ?? []).map((e) => ({
|
|
16288
16366
|
id: e.id,
|
|
16289
16367
|
content: e.content,
|
|
16290
16368
|
status: e.status,
|
|
@@ -16294,57 +16372,57 @@ function rv(e, n, r) {
|
|
|
16294
16372
|
...e.evidence === void 0 ? {} : { evidence: e.evidence }
|
|
16295
16373
|
})),
|
|
16296
16374
|
planPhase: D.getPlanPhase(),
|
|
16297
|
-
mission:
|
|
16375
|
+
mission: at ? O.getMission() : void 0,
|
|
16298
16376
|
planConfirmation: ne.lastPlanConfirmation,
|
|
16299
|
-
workingMemory:
|
|
16300
|
-
focus:
|
|
16301
|
-
focuses:
|
|
16377
|
+
workingMemory: ot ? se.getWorkingMemory() : void 0,
|
|
16378
|
+
focus: Je ? A.getFocus() : void 0,
|
|
16379
|
+
focuses: Je ? A.getFocuses() : [],
|
|
16302
16380
|
actions: k_(e.actions ?? {}),
|
|
16303
16381
|
subagent: {
|
|
16304
|
-
enabled: !!
|
|
16382
|
+
enabled: !!Dt,
|
|
16305
16383
|
maxDepth: e.subagent?.maxDepth ?? 1,
|
|
16306
16384
|
maxParallel: e.subagent?.maxParallel ?? 4,
|
|
16307
16385
|
timeoutMs: e.subagent?.timeoutMs === void 0 ? 18e5 : e.subagent.timeoutMs > 0 ? e.subagent.timeoutMs : 0,
|
|
16308
16386
|
allowedTools: e.subagent?.allowedTools ?? [],
|
|
16309
|
-
subagents: (
|
|
16310
|
-
active:
|
|
16311
|
-
history:
|
|
16312
|
-
lockedComponents:
|
|
16387
|
+
subagents: (Nt?.get() ?? []).map(Ft),
|
|
16388
|
+
active: pt?.getActive() ?? [],
|
|
16389
|
+
history: pt?.getHistory() ?? [],
|
|
16390
|
+
lockedComponents: kt?.locked() ?? {}
|
|
16313
16391
|
},
|
|
16314
16392
|
verify: {
|
|
16315
|
-
enabled: !!
|
|
16316
|
-
maxAttempts:
|
|
16317
|
-
adversarial:
|
|
16393
|
+
enabled: !!Rt,
|
|
16394
|
+
maxAttempts: _t ? mt : 0,
|
|
16395
|
+
adversarial: _t && !!e.verify?.adversarial
|
|
16318
16396
|
},
|
|
16319
16397
|
context: (() => {
|
|
16320
|
-
let e =
|
|
16398
|
+
let e = zt?.getSnapshot();
|
|
16321
16399
|
if (e) {
|
|
16322
|
-
let t =
|
|
16400
|
+
let t = Y.agent?.getState?.()?.lastCompression;
|
|
16323
16401
|
t && (e.compression = t);
|
|
16324
16402
|
}
|
|
16325
16403
|
return e;
|
|
16326
16404
|
})(),
|
|
16327
16405
|
mcp: {
|
|
16328
|
-
servers:
|
|
16329
|
-
...
|
|
16406
|
+
servers: Y.mcpServers,
|
|
16407
|
+
...Y.mcpFailed.length ? { failed: Y.mcpFailed } : {}
|
|
16330
16408
|
},
|
|
16331
|
-
lastCompression:
|
|
16332
|
-
checkpoints:
|
|
16409
|
+
lastCompression: Y.agent?.getState?.()?.lastCompression,
|
|
16410
|
+
checkpoints: R ? {
|
|
16333
16411
|
enabled: !0,
|
|
16334
16412
|
auto: z,
|
|
16335
|
-
list:
|
|
16413
|
+
list: R.list()
|
|
16336
16414
|
} : void 0
|
|
16337
16415
|
};
|
|
16338
16416
|
},
|
|
16339
16417
|
exportDiagnostics() {
|
|
16340
|
-
let e =
|
|
16418
|
+
let e = Y.getInfo(), t = {
|
|
16341
16419
|
...e,
|
|
16342
16420
|
tools: e.tools.map(({ schema: e, ...t }) => t),
|
|
16343
16421
|
data: e.data ? {
|
|
16344
16422
|
description: e.data.description,
|
|
16345
16423
|
schemaTopKeys: Ls(e.data.schema) ?? []
|
|
16346
16424
|
} : void 0
|
|
16347
|
-
}, n =
|
|
16425
|
+
}, n = Y.liveData(), r = null;
|
|
16348
16426
|
if (n) {
|
|
16349
16427
|
let e = -1, t = [];
|
|
16350
16428
|
try {
|
|
@@ -16360,51 +16438,51 @@ function rv(e, n, r) {
|
|
|
16360
16438
|
};
|
|
16361
16439
|
}
|
|
16362
16440
|
return op(ap({
|
|
16363
|
-
debugLogs:
|
|
16364
|
-
messages:
|
|
16441
|
+
debugLogs: Y.agent?.debugLogs?.value ?? [],
|
|
16442
|
+
messages: Y.messages,
|
|
16365
16443
|
info: t,
|
|
16366
|
-
usage: { ...
|
|
16367
|
-
pendingConflict:
|
|
16368
|
-
sessionId:
|
|
16444
|
+
usage: { ...Y.usage },
|
|
16445
|
+
pendingConflict: Y.pendingConflict?.value ?? null,
|
|
16446
|
+
sessionId: Y.sessionId,
|
|
16369
16447
|
dataSummary: r
|
|
16370
16448
|
}));
|
|
16371
16449
|
},
|
|
16372
16450
|
getMission() {
|
|
16373
|
-
return
|
|
16451
|
+
return at ? O.getMission() : void 0;
|
|
16374
16452
|
},
|
|
16375
16453
|
setMission(t) {
|
|
16376
|
-
if (!
|
|
16454
|
+
if (!at) {
|
|
16377
16455
|
e.debug && console.warn("[page-agent-sdk][mission] capabilities.missionAnchor 关闭,setMission 忽略");
|
|
16378
16456
|
return;
|
|
16379
16457
|
}
|
|
16380
|
-
O.setMission(t),
|
|
16458
|
+
O.setMission(t), Y.infoTick.value++;
|
|
16381
16459
|
},
|
|
16382
16460
|
getFocus() {
|
|
16383
|
-
return
|
|
16461
|
+
return Je ? A.getFocus() : void 0;
|
|
16384
16462
|
},
|
|
16385
16463
|
getFocuses() {
|
|
16386
|
-
return
|
|
16464
|
+
return Je ? A.getFocuses() : [];
|
|
16387
16465
|
},
|
|
16388
16466
|
setFocus(t) {
|
|
16389
|
-
let n =
|
|
16390
|
-
return n.ok ? (
|
|
16467
|
+
let n = av(t, "setFocus", Je, () => W()?.schema, e.debug);
|
|
16468
|
+
return n.ok ? (A.setFocus(j(t)), e.debug && A.isInvokeActive() && console.info("[page-agent-sdk][focus] 在途流程进行中,聚焦将在下一次输入生效(当前流程不受影响)"), Y.infoTick.value++, { ok: !0 }) : n;
|
|
16391
16469
|
},
|
|
16392
16470
|
addFocus(t) {
|
|
16393
|
-
let n =
|
|
16394
|
-
return n.ok ?
|
|
16471
|
+
let n = av(t, "addFocus", Je, () => W()?.schema, e.debug);
|
|
16472
|
+
return n.ok ? A.getFocuses().length >= 8 ? (e.debug && console.warn("[page-agent-sdk][focus] addFocus 拒绝:焦点数已达上限 8(augmentPrompt 注入每焦点子树 schema,过多致 system prompt 超预算)"), {
|
|
16395
16473
|
ok: !1,
|
|
16396
16474
|
error: "焦点数上限 8(避免 system prompt 撑爆)"
|
|
16397
|
-
}) : (
|
|
16475
|
+
}) : (A.addFocus(j(t)), e.debug && A.isInvokeActive() && console.info("[page-agent-sdk][focus] 在途流程进行中,聚焦将在下一次输入生效(当前流程不受影响)"), Y.infoTick.value++, { ok: !0 }) : n;
|
|
16398
16476
|
},
|
|
16399
16477
|
removeFocus(e) {
|
|
16400
|
-
|
|
16478
|
+
Je && (A.removeFocus(e), Y.infoTick.value++);
|
|
16401
16479
|
},
|
|
16402
16480
|
clearFocus() {
|
|
16403
|
-
|
|
16481
|
+
Je && (A.clearFocus(), Y.infoTick.value++);
|
|
16404
16482
|
},
|
|
16405
16483
|
setQuote(e, t, n) {
|
|
16406
16484
|
let r = Ni(e ?? ""), i = qi(n);
|
|
16407
|
-
|
|
16485
|
+
hn.value = r ? {
|
|
16408
16486
|
text: r,
|
|
16409
16487
|
...t ? { source: t } : {},
|
|
16410
16488
|
...i ? { anchor: i } : {}
|
|
@@ -16412,42 +16490,46 @@ function rv(e, n, r) {
|
|
|
16412
16490
|
},
|
|
16413
16491
|
notifyHostChange(e) {
|
|
16414
16492
|
let t = typeof e?.reason == "string" ? e.reason.trim().slice(0, 200) : "";
|
|
16415
|
-
|
|
16493
|
+
q.epoch += 1, t && !q.notices.includes(t) ? q.notices.push(t) : t || q.notices.push(""), q.notices.length > 5 && q.notices.splice(0, q.notices.length - 5), Y.agent?.debugLogs?.value?.push({
|
|
16416
16494
|
timestamp: Date.now(),
|
|
16417
16495
|
type: "middleware",
|
|
16418
16496
|
data: {
|
|
16419
16497
|
stage: "host_change_notified",
|
|
16420
|
-
epoch:
|
|
16498
|
+
epoch: q.epoch,
|
|
16421
16499
|
reason: t || void 0
|
|
16422
16500
|
}
|
|
16423
|
-
}),
|
|
16501
|
+
}), Y.infoTick.value++;
|
|
16424
16502
|
},
|
|
16425
16503
|
clearQuote() {
|
|
16426
|
-
|
|
16504
|
+
hn.value = null;
|
|
16427
16505
|
},
|
|
16428
16506
|
revokeApprovalGrants() {
|
|
16429
|
-
let e =
|
|
16430
|
-
|
|
16507
|
+
let e = wt.size > 0;
|
|
16508
|
+
wt.clear(), e && (Y.agent?.debugLogs?.value?.push({
|
|
16431
16509
|
timestamp: Date.now(),
|
|
16432
16510
|
type: "middleware",
|
|
16433
16511
|
data: { stage: "approval_grants_revoked" }
|
|
16434
|
-
}),
|
|
16512
|
+
}), Y.infoTick.value++);
|
|
16435
16513
|
},
|
|
16436
16514
|
resolveProposal(e, t, n) {
|
|
16437
16515
|
let r = Fe ? Fe.resolve(e, t, n) : !1;
|
|
16438
|
-
return r &&
|
|
16516
|
+
return r && Y.infoTick.value++, r;
|
|
16517
|
+
},
|
|
16518
|
+
resolveAction(e, t, n) {
|
|
16519
|
+
let r = He.resolve(e, t, n);
|
|
16520
|
+
return r && Y.infoTick.value++, r;
|
|
16439
16521
|
},
|
|
16440
16522
|
getProposals() {
|
|
16441
16523
|
return Fe ? Fe.snapshot() : null;
|
|
16442
16524
|
}
|
|
16443
16525
|
};
|
|
16444
|
-
async function
|
|
16526
|
+
async function gn() {
|
|
16445
16527
|
if (!l) return;
|
|
16446
16528
|
let t = async (e) => {
|
|
16447
16529
|
try {
|
|
16448
16530
|
return await l.load(n, e);
|
|
16449
16531
|
} catch (t) {
|
|
16450
|
-
|
|
16532
|
+
J({
|
|
16451
16533
|
type: "error",
|
|
16452
16534
|
message: `会话快照读取失败,已降级空会话:${t instanceof Error ? t.message : String(t)}`,
|
|
16453
16535
|
severity: "observable",
|
|
@@ -16460,7 +16542,7 @@ function rv(e, n, r) {
|
|
|
16460
16542
|
try {
|
|
16461
16543
|
return await l.listSessions(n);
|
|
16462
16544
|
} catch (e) {
|
|
16463
|
-
return
|
|
16545
|
+
return J({
|
|
16464
16546
|
type: "error",
|
|
16465
16547
|
message: `会话列表读取失败,已降级新建会话:${e instanceof Error ? e.message : String(e)}`,
|
|
16466
16548
|
severity: "observable",
|
|
@@ -16468,7 +16550,7 @@ function rv(e, n, r) {
|
|
|
16468
16550
|
}), [];
|
|
16469
16551
|
}
|
|
16470
16552
|
}, i = Symbol("storage-ready-timeout");
|
|
16471
|
-
await Promise.race([l.ready.then(() => "ready"), new Promise((e) => setTimeout(() => e(i), 5e3))]) === i && (console.warn("[page-agent-sdk][persist] 存储初始化 5s 未就绪(可能被其他标签页锁住),已放行;持久化暂降级内存,就绪后自动恢复"),
|
|
16553
|
+
await Promise.race([l.ready.then(() => "ready"), new Promise((e) => setTimeout(() => e(i), 5e3))]) === i && (console.warn("[page-agent-sdk][persist] 存储初始化 5s 未就绪(可能被其他标签页锁住),已放行;持久化暂降级内存,就绪后自动恢复"), J({
|
|
16472
16554
|
type: "error",
|
|
16473
16555
|
message: "存储初始化 5s 未就绪(IDB blocked?),已放行降级运行",
|
|
16474
16556
|
severity: "observable",
|
|
@@ -16476,47 +16558,47 @@ function rv(e, n, r) {
|
|
|
16476
16558
|
}));
|
|
16477
16559
|
let a = e.session || {};
|
|
16478
16560
|
if (a.id) {
|
|
16479
|
-
|
|
16480
|
-
let e = await t(
|
|
16481
|
-
e ? (
|
|
16561
|
+
Y.sessionId = a.id;
|
|
16562
|
+
let e = await t(Y.sessionId);
|
|
16563
|
+
e ? (Y.applySnapshot(e), J({
|
|
16482
16564
|
type: "session_restored",
|
|
16483
|
-
sessionId:
|
|
16565
|
+
sessionId: Y.sessionId,
|
|
16484
16566
|
rounds: e.messages?.length ?? 0
|
|
16485
|
-
})) : await l.createSession(n, a.title,
|
|
16567
|
+
})) : await l.createSession(n, a.title, Y.sessionId);
|
|
16486
16568
|
} else if (a.autoResume !== !1) {
|
|
16487
16569
|
let i = await r();
|
|
16488
16570
|
if (e.debug && console.log("[page-agent-sdk][restore] listSessions", n, i.length, i.map((e) => e.sessionId)), i.length) {
|
|
16489
|
-
|
|
16490
|
-
let n = await t(
|
|
16491
|
-
n ? (
|
|
16571
|
+
Y.sessionId = i[0].sessionId;
|
|
16572
|
+
let n = await t(Y.sessionId);
|
|
16573
|
+
n ? (Y.applySnapshot(n), J({
|
|
16492
16574
|
type: "session_restored",
|
|
16493
|
-
sessionId:
|
|
16575
|
+
sessionId: Y.sessionId,
|
|
16494
16576
|
rounds: n.messages?.length ?? 0
|
|
16495
|
-
}), e.debug && console.log("[page-agent-sdk][restore] 恢复会话",
|
|
16496
|
-
} else
|
|
16497
|
-
} else
|
|
16498
|
-
e.memory &&
|
|
16577
|
+
}), e.debug && console.log("[page-agent-sdk][restore] 恢复会话", Y.sessionId, `${n.messages?.length ?? 0} msgs`)) : e.debug && console.log("[page-agent-sdk][restore] 会话 meta 存在但快照为空", Y.sessionId);
|
|
16578
|
+
} else Y.sessionId = await l.createSession(n, a.title), e.debug && console.log("[page-agent-sdk][restore] 新建会话(无历史)", Y.sessionId);
|
|
16579
|
+
} else Y.sessionId = await l.createSession(n, a.title);
|
|
16580
|
+
e.memory && X.persistSave({ memory: M.get() || (typeof e.memory == "string" ? e.memory : "") }), X.refreshSessions();
|
|
16499
16581
|
}
|
|
16500
|
-
async function
|
|
16501
|
-
await
|
|
16582
|
+
async function _n() {
|
|
16583
|
+
await rn();
|
|
16502
16584
|
}
|
|
16503
|
-
function
|
|
16585
|
+
function vn(e) {
|
|
16504
16586
|
let t = {};
|
|
16505
|
-
for (let n of
|
|
16587
|
+
for (let n of Z_(e)) {
|
|
16506
16588
|
let e = T.files[n];
|
|
16507
16589
|
e && (t[n] = e.content);
|
|
16508
16590
|
}
|
|
16509
16591
|
return t;
|
|
16510
16592
|
}
|
|
16511
|
-
function
|
|
16512
|
-
let e =
|
|
16593
|
+
function yn() {
|
|
16594
|
+
let e = Q_(T.files, Z_(w));
|
|
16513
16595
|
for (let t of e) delete T.files[t];
|
|
16514
16596
|
}
|
|
16515
|
-
function
|
|
16516
|
-
let e = Dl(w,
|
|
16597
|
+
function bn() {
|
|
16598
|
+
let e = Dl(w, cn);
|
|
16517
16599
|
if (!e.trimmed) return;
|
|
16518
16600
|
let { older: t, summary: n } = e;
|
|
16519
|
-
if (
|
|
16601
|
+
if (J({
|
|
16520
16602
|
type: "context_trimmed",
|
|
16521
16603
|
dropped: t.map((e) => ({
|
|
16522
16604
|
round: e.round,
|
|
@@ -16524,88 +16606,88 @@ function rv(e, n, r) {
|
|
|
16524
16606
|
assistant: e.assistantMsgs.map((e) => e.content),
|
|
16525
16607
|
steps: e.assistantMsgs.flatMap((e) => e.steps ?? [])
|
|
16526
16608
|
})),
|
|
16527
|
-
vfsResults:
|
|
16609
|
+
vfsResults: vn(t.flatMap((e) => [e.userMsg, ...e.assistantMsgs])),
|
|
16528
16610
|
summary: n.content,
|
|
16529
16611
|
reason: "max_memory_rounds"
|
|
16530
|
-
}), w.splice(e.deleteFrom, e.deleteCount, n),
|
|
16612
|
+
}), w.splice(e.deleteFrom, e.deleteCount, n), yn(), b && d) {
|
|
16531
16613
|
let n = e.summary, { prevSeg: r } = e;
|
|
16532
16614
|
(async () => {
|
|
16533
16615
|
try {
|
|
16534
16616
|
let e = await d(Pl(t, S)), i = w.indexOf(n);
|
|
16535
16617
|
if (i < 0) return;
|
|
16536
|
-
w[i].content = El(t, r, e),
|
|
16618
|
+
w[i].content = El(t, r, e), X.persistRuntime();
|
|
16537
16619
|
} catch {}
|
|
16538
16620
|
})();
|
|
16539
16621
|
}
|
|
16540
16622
|
}
|
|
16541
|
-
let
|
|
16623
|
+
let xn = ki({
|
|
16542
16624
|
getConfig: () => e.images,
|
|
16543
16625
|
getVision: () => g.vision === !0,
|
|
16544
|
-
emit:
|
|
16545
|
-
getVfsStore: () =>
|
|
16546
|
-
noteFailure: (e, t) =>
|
|
16547
|
-
}),
|
|
16626
|
+
emit: J,
|
|
16627
|
+
getVfsStore: () => Y.vfsStore,
|
|
16628
|
+
noteFailure: (e, t) => X.notePersistFailure(e, t)
|
|
16629
|
+
}), X = Fm({
|
|
16548
16630
|
agentId: n,
|
|
16549
16631
|
options: e,
|
|
16550
|
-
emit:
|
|
16632
|
+
emit: J,
|
|
16551
16633
|
getStore: () => l,
|
|
16552
|
-
core:
|
|
16553
|
-
sessionsRef:
|
|
16634
|
+
core: Y,
|
|
16635
|
+
sessionsRef: un,
|
|
16554
16636
|
sessionVars: ne,
|
|
16555
16637
|
messages: w,
|
|
16556
16638
|
getUsage: () => a,
|
|
16557
16639
|
mw: {
|
|
16558
16640
|
todosMw: D,
|
|
16559
|
-
memoryMw:
|
|
16641
|
+
memoryMw: M,
|
|
16560
16642
|
missionMw: O,
|
|
16561
|
-
workingMemoryMw:
|
|
16562
|
-
focusMw:
|
|
16563
|
-
summarizationMw:
|
|
16643
|
+
workingMemoryMw: se,
|
|
16644
|
+
focusMw: A,
|
|
16645
|
+
summarizationMw: an,
|
|
16564
16646
|
resumeNoticeMw: te,
|
|
16565
|
-
useMission:
|
|
16566
|
-
useWorkingMemory:
|
|
16567
|
-
useFocus:
|
|
16647
|
+
useMission: at,
|
|
16648
|
+
useWorkingMemory: ot,
|
|
16649
|
+
useFocus: Je,
|
|
16568
16650
|
useAutomation: _e
|
|
16569
16651
|
},
|
|
16570
16652
|
vfsStore: T,
|
|
16571
|
-
checkpointMgr:
|
|
16653
|
+
checkpointMgr: R,
|
|
16572
16654
|
conflictResolve: (e) => o.resolve(e),
|
|
16573
|
-
abortAllActive:
|
|
16655
|
+
abortAllActive: mn,
|
|
16574
16656
|
titleLlmInvoke: f
|
|
16575
16657
|
});
|
|
16576
|
-
return
|
|
16577
|
-
await
|
|
16658
|
+
return Y.initDone = (async () => {
|
|
16659
|
+
await gn(), await _n(), e.mcp?.length && pd({
|
|
16578
16660
|
servers: e.mcp,
|
|
16579
|
-
emit:
|
|
16580
|
-
isReleased: () =>
|
|
16661
|
+
emit: J,
|
|
16662
|
+
isReleased: () => We,
|
|
16581
16663
|
core: {
|
|
16582
|
-
mcpClosers:
|
|
16583
|
-
mcpServers:
|
|
16584
|
-
mcpFailed:
|
|
16585
|
-
infoTick:
|
|
16664
|
+
mcpClosers: Y.mcpClosers,
|
|
16665
|
+
mcpServers: Y.mcpServers,
|
|
16666
|
+
mcpFailed: Y.mcpFailed,
|
|
16667
|
+
infoTick: Y.infoTick
|
|
16586
16668
|
},
|
|
16587
16669
|
reservedNames: () => {
|
|
16588
16670
|
let e = /* @__PURE__ */ new Set();
|
|
16589
|
-
for (let t of
|
|
16671
|
+
for (let t of rt) {
|
|
16590
16672
|
let n = K.get(t.name);
|
|
16591
16673
|
n && !n.startsWith("mcp:") && e.add(t.name);
|
|
16592
16674
|
}
|
|
16593
16675
|
return e;
|
|
16594
16676
|
},
|
|
16595
|
-
pushTool: (e, t) => (K.set(e.name, `mcp:${t}`),
|
|
16677
|
+
pushTool: (e, t) => (K.set(e.name, `mcp:${t}`), Ue.push(e), !0),
|
|
16596
16678
|
rebind: () => {
|
|
16597
|
-
|
|
16679
|
+
rt = nt(), Y.agent && Y.agent.setTools(rt), Y.infoTick.value++;
|
|
16598
16680
|
},
|
|
16599
16681
|
debug: e.debug
|
|
16600
16682
|
});
|
|
16601
16683
|
let t = Ip(e.llm) ? e.llm : await k(e.llm);
|
|
16602
|
-
Rp(t, { emit:
|
|
16684
|
+
Rp(t, { emit: J }), Y.agent = Is({
|
|
16603
16685
|
llm: t,
|
|
16604
16686
|
systemPrompt: ye,
|
|
16605
|
-
tools:
|
|
16606
|
-
middleware:
|
|
16687
|
+
tools: rt,
|
|
16688
|
+
middleware: sn,
|
|
16607
16689
|
maxToolRounds: e.maxToolRounds,
|
|
16608
|
-
hasSubagent:
|
|
16690
|
+
hasSubagent: ft,
|
|
16609
16691
|
pageAssertionGate: B.domInspect === !0,
|
|
16610
16692
|
pageReadTools: Be.size ? Be : void 0,
|
|
16611
16693
|
deferredWriteTools: Ve.size ? Ve : void 0,
|
|
@@ -16618,19 +16700,19 @@ function rv(e, n, r) {
|
|
|
16618
16700
|
maxOutputTokens: g.maxOutputTokens,
|
|
16619
16701
|
vision: g.vision,
|
|
16620
16702
|
imageContentFormat: Ae,
|
|
16621
|
-
maxVerifyAttempts:
|
|
16703
|
+
maxVerifyAttempts: _t ? mt : 0,
|
|
16622
16704
|
roundTokenBudget: e.roundTokenBudget ?? 0,
|
|
16623
16705
|
staleReadInvalidation: e.staleReadInvalidation,
|
|
16624
16706
|
onLlmChange: (e) => {
|
|
16625
16707
|
C = e;
|
|
16626
16708
|
},
|
|
16627
16709
|
debug: e.debug
|
|
16628
|
-
}),
|
|
16629
|
-
|
|
16710
|
+
}), ce.current = Y.agent, Mt && Mt.setReconfigureHook(() => {
|
|
16711
|
+
Y.agent && Y.agent.setTools(nt());
|
|
16630
16712
|
});
|
|
16631
|
-
})(),
|
|
16713
|
+
})(), Y;
|
|
16632
16714
|
}
|
|
16633
|
-
function
|
|
16715
|
+
function sv(e, t) {
|
|
16634
16716
|
let n = e.id ?? Yp();
|
|
16635
16717
|
e.id || console.warn(`[page-agent-sdk] 未传 options.id,已生成随机 id "${n}"。刷新后持久化数据无法恢复,请传稳定 id。`);
|
|
16636
16718
|
let r = e.streaming ?? !0, i = e.ui ?? "default", a = e.hostWatch === !0 ? { url: !0 } : e.hostWatch && typeof e.hostWatch == "object" ? e.hostWatch : null, o = {
|
|
@@ -16639,8 +16721,8 @@ function iv(e, t) {
|
|
|
16639
16721
|
pushState: !1,
|
|
16640
16722
|
title: !1,
|
|
16641
16723
|
autoNotified: 0
|
|
16642
|
-
}, s = null, c, l = e.shareContext ?
|
|
16643
|
-
l ? c = l : (c =
|
|
16724
|
+
}, s = null, c, l = e.shareContext ? tv.get(n) : void 0;
|
|
16725
|
+
l ? c = l : (c = ov(e, n, a ? o : void 0), e.shareContext && tv.set(n, c)), c.refCount++;
|
|
16644
16726
|
let u = null, d = wm(e), f = null, p = null;
|
|
16645
16727
|
async function m(n) {
|
|
16646
16728
|
if (await c.initDone, u) {
|
|
@@ -16778,6 +16860,7 @@ function iv(e, t) {
|
|
|
16778
16860
|
notifyHostChange: c.notifyHostChange,
|
|
16779
16861
|
revokeApprovalGrants: c.revokeApprovalGrants,
|
|
16780
16862
|
resolveProposal: c.resolveProposal,
|
|
16863
|
+
resolveAction: c.resolveAction,
|
|
16781
16864
|
get proposals() {
|
|
16782
16865
|
return c.getProposals();
|
|
16783
16866
|
},
|
|
@@ -16901,7 +16984,7 @@ function iv(e, t) {
|
|
|
16901
16984
|
}
|
|
16902
16985
|
//#endregion
|
|
16903
16986
|
//#region src/core/sdk/ragSubagent.ts
|
|
16904
|
-
function
|
|
16987
|
+
function cv(e, t, n, r, i) {
|
|
16905
16988
|
let a = [];
|
|
16906
16989
|
e && a.push("vfs_grep + vfs_read(搜预注入文档)"), t && a.push(`${r}(语义检索)`), n && a.push(`${i}(按 source 加载)`), a.push("fetch_document(公网 URL)");
|
|
16907
16990
|
let o = [];
|
|
@@ -16916,7 +16999,7 @@ function av(e, t, n, r, i) {
|
|
|
16916
16999
|
|
|
16917
17000
|
你是只读检索角色,不要尝试修改任何数据。不要尝试上面未列出的工具。`;
|
|
16918
17001
|
}
|
|
16919
|
-
function
|
|
17002
|
+
function lv(e, t, n, r, i) {
|
|
16920
17003
|
let a = [], o = [];
|
|
16921
17004
|
return e && (a.push("- vfs_grep / vfs_read:搜集成方预注入 vfs 的文档(组件文档 / UI 规范)—— 快、静态,先查"), o.push("- 静态文档(组件库文档 / UI 规范):vfs_grep")), t && (a.push(`- ${r}:语义检索(retriever 向量库)—— 模糊匹配,关键词不确定 / 语义相似时用`), o.push(`- 语义相似(「瀑布流组件」「倒计时」「拼团」):${r}`)), n && (a.push(`- ${i}:按 source 精确加载(已知文档 id / URL / key)—— 精确取特定文档`), o.push(`- 已知文档 id / URL:${i}`)), a.push("- fetch_document:公网 URL —— 查公开资料"), o.push("- 公开 URL(设计规范网站 / 第三方文档):fetch_document"), `# 知识检索策略(RAG)
|
|
16922
17005
|
|
|
@@ -16933,12 +17016,12 @@ ${a.join("\n")}
|
|
|
16933
17016
|
## 何时用何源
|
|
16934
17017
|
${o.join("\n")}`;
|
|
16935
17018
|
}
|
|
16936
|
-
var
|
|
17019
|
+
var uv = {
|
|
16937
17020
|
name: "rag-search",
|
|
16938
17021
|
description: "多源知识检索策略:vfs 预注入文档 → 语义检索 → 指定文档加载 → 公网;综合结构化结论 + 溯源",
|
|
16939
|
-
getContent: () =>
|
|
17022
|
+
getContent: () => lv(!0, !0, !0, "search_docs", "load_doc")
|
|
16940
17023
|
};
|
|
16941
|
-
function
|
|
17024
|
+
function dv(e, n, r) {
|
|
16942
17025
|
let i = s(async ({ query: e, topK: t }) => {
|
|
16943
17026
|
try {
|
|
16944
17027
|
let i = await n(e, { topK: t ?? r });
|
|
@@ -16956,7 +17039,7 @@ function cv(e, n, r) {
|
|
|
16956
17039
|
});
|
|
16957
17040
|
return na([i]), i;
|
|
16958
17041
|
}
|
|
16959
|
-
function
|
|
17042
|
+
function fv(e, n) {
|
|
16960
17043
|
let r = s(async ({ source: e }) => {
|
|
16961
17044
|
try {
|
|
16962
17045
|
let t = await n(e), r = Array.isArray(t) ? t : [t];
|
|
@@ -16971,19 +17054,19 @@ function lv(e, n) {
|
|
|
16971
17054
|
});
|
|
16972
17055
|
return na([r]), r;
|
|
16973
17056
|
}
|
|
16974
|
-
function
|
|
17057
|
+
function pv(e) {
|
|
16975
17058
|
let { retriever: t, loader: n, useVfs: r = !0, id: i = "rag", description: a, topK: o = 5, searchToolName: s = "search_docs", loadToolName: c = "load_doc", maxToolRounds: l = 8, summarization: u, skills: d, extraTools: f } = e;
|
|
16976
17059
|
if (!t && !n && r === !1) throw Error("[page-agent-sdk][createRagSubagent] 至少配一种知识源:retriever / loader / useVfs(true)");
|
|
16977
17060
|
let p = [];
|
|
16978
|
-
t && p.push(
|
|
17061
|
+
t && p.push(dv(s, t, o)), n && p.push(fv(c, n)), f && p.push(...f);
|
|
16979
17062
|
let m = r ? [
|
|
16980
17063
|
"vfs_grep",
|
|
16981
17064
|
"vfs_read",
|
|
16982
17065
|
"vfs_json_read"
|
|
16983
|
-
] : void 0, h =
|
|
17066
|
+
] : void 0, h = cv(r, !!t, !!n, s, c), g = {
|
|
16984
17067
|
name: "rag-search",
|
|
16985
|
-
description:
|
|
16986
|
-
getContent: () =>
|
|
17068
|
+
description: uv.description,
|
|
17069
|
+
getContent: () => lv(r, !!t, !!n, s, c)
|
|
16987
17070
|
};
|
|
16988
17071
|
return {
|
|
16989
17072
|
id: i,
|
|
@@ -16998,7 +17081,7 @@ function uv(e) {
|
|
|
16998
17081
|
}
|
|
16999
17082
|
//#endregion
|
|
17000
17083
|
//#region src/core/sdk/evalToolkit.ts
|
|
17001
|
-
function
|
|
17084
|
+
function mv(e = {}) {
|
|
17002
17085
|
let t = e.quietMs ?? 9e4, n = e.confirmSamples ?? 3, r = e.baselineMessageCount ?? 0, i = 0;
|
|
17003
17086
|
return {
|
|
17004
17087
|
push(e) {
|
|
@@ -17009,12 +17092,12 @@ function dv(e = {}) {
|
|
|
17009
17092
|
}
|
|
17010
17093
|
};
|
|
17011
17094
|
}
|
|
17012
|
-
var
|
|
17013
|
-
function
|
|
17095
|
+
var hv = /* @__PURE__ */ new Set(["elapsedSec"]);
|
|
17096
|
+
function gv(e, t, n = {}) {
|
|
17014
17097
|
let r = n.tokenAbs ?? 2e3, i = n.tokenPct ?? 15, a = n.toolCountAbs ?? 3, o = [], s = 0, c = 0, l = 0, u = /* @__PURE__ */ new Set([...Object.keys(e ?? {}), ...Object.keys(t ?? {})]);
|
|
17015
17098
|
for (let n of u) {
|
|
17016
17099
|
let u = Number(e?.[n] ?? 0), d = Number(t?.[n] ?? 0), f = u - d, p = d > 0 ? Math.round(f / d * 100) : 0, m = "";
|
|
17017
|
-
|
|
17100
|
+
hv.has(n) || (n === "toolCount" ? Math.abs(f) > a : Math.abs(f) > r && Math.abs(p) >= i) && (m = f > 0 ? "up" : "down", m === "up" ? (s++, c++) : l++), o.push({
|
|
17018
17101
|
key: n,
|
|
17019
17102
|
prev: d,
|
|
17020
17103
|
cur: u,
|
|
@@ -17029,7 +17112,7 @@ function pv(e, t, n = {}) {
|
|
|
17029
17112
|
fields: o
|
|
17030
17113
|
};
|
|
17031
17114
|
}
|
|
17032
|
-
function
|
|
17115
|
+
function _v(e) {
|
|
17033
17116
|
let { sdk: t } = e, n = () => {
|
|
17034
17117
|
let e = t.debugLogs.value ?? [], n = e.length ? e[e.length - 1].timestamp : 0;
|
|
17035
17118
|
return {
|
|
@@ -17042,7 +17125,7 @@ function mv(e) {
|
|
|
17042
17125
|
};
|
|
17043
17126
|
return {
|
|
17044
17127
|
async waitForIdle(e = {}) {
|
|
17045
|
-
let { timeoutMs: r = 6e5, sampleMs: i = 2500, onSample: a, ...o } = e, s =
|
|
17128
|
+
let { timeoutMs: r = 6e5, sampleMs: i = 2500, onSample: a, ...o } = e, s = mv(o), c = Date.now();
|
|
17046
17129
|
for (;;) {
|
|
17047
17130
|
let e = n(), o = s.push(e);
|
|
17048
17131
|
if (a?.(e), o === "done") return e;
|
|
@@ -17072,7 +17155,7 @@ function mv(e) {
|
|
|
17072
17155
|
}
|
|
17073
17156
|
//#endregion
|
|
17074
17157
|
//#region src/core/utils/clipboard.ts
|
|
17075
|
-
async function
|
|
17158
|
+
async function vv(e) {
|
|
17076
17159
|
try {
|
|
17077
17160
|
let t = globalThis.navigator?.clipboard;
|
|
17078
17161
|
if (t && typeof t.writeText == "function") return await t.writeText(e), !0;
|
|
@@ -17090,13 +17173,13 @@ async function hv(e) {
|
|
|
17090
17173
|
}
|
|
17091
17174
|
//#endregion
|
|
17092
17175
|
//#region src/core/composables/useChat.ts
|
|
17093
|
-
var
|
|
17094
|
-
function
|
|
17095
|
-
let { fetchResponse: t, fetchStream: n, onPersist: r, onClear: i, onQueuedCleared: a, onBeforeRegenerate: o } = e, s = /* @__PURE__ */
|
|
17176
|
+
var yv = 4e3;
|
|
17177
|
+
function bv(e = {}) {
|
|
17178
|
+
let { fetchResponse: t, fetchStream: n, onPersist: r, onClear: i, onQueuedCleared: a, onBeforeRegenerate: o } = e, s = /* @__PURE__ */ Pt({
|
|
17096
17179
|
messages: e.messages ?? [],
|
|
17097
17180
|
loading: !1,
|
|
17098
17181
|
error: null
|
|
17099
|
-
}), c = /* @__PURE__ */
|
|
17182
|
+
}), c = /* @__PURE__ */ Kt(null), l = /* @__PURE__ */ Kt(!0), u = null, d = 0, f = /* @__PURE__ */ Kt([]), p = /* @__PURE__ */ Kt(null);
|
|
17100
17183
|
function m() {}
|
|
17101
17184
|
function h(e) {
|
|
17102
17185
|
let t = c.value;
|
|
@@ -17121,7 +17204,7 @@ function _v(e = {}) {
|
|
|
17121
17204
|
async function v(e) {
|
|
17122
17205
|
let r = ++d;
|
|
17123
17206
|
if (l.value = !0, n) {
|
|
17124
|
-
let t = /* @__PURE__ */
|
|
17207
|
+
let t = /* @__PURE__ */ Pt({
|
|
17125
17208
|
role: "assistant",
|
|
17126
17209
|
content: "",
|
|
17127
17210
|
timestamp: Date.now(),
|
|
@@ -17173,7 +17256,7 @@ function _v(e = {}) {
|
|
|
17173
17256
|
let t = e.delta || "";
|
|
17174
17257
|
n.subReasonFull = (n.subReasonFull || "") + t;
|
|
17175
17258
|
let r = (n.subReason || "") + t;
|
|
17176
|
-
n.subReason = r.length >
|
|
17259
|
+
n.subReason = r.length > yv ? r.slice(-4e3) : r;
|
|
17177
17260
|
break;
|
|
17178
17261
|
}
|
|
17179
17262
|
n.children ||= [];
|
|
@@ -17321,7 +17404,7 @@ function _v(e = {}) {
|
|
|
17321
17404
|
}
|
|
17322
17405
|
//#endregion
|
|
17323
17406
|
//#region src/core/components/icons.ts
|
|
17324
|
-
var
|
|
17407
|
+
var xv = {
|
|
17325
17408
|
header: "🤖",
|
|
17326
17409
|
subagent: "🤖",
|
|
17327
17410
|
subagentProgress: "🧬",
|
|
@@ -17332,10 +17415,10 @@ var vv = {
|
|
|
17332
17415
|
recommend: "💡",
|
|
17333
17416
|
conflict: "⚠️"
|
|
17334
17417
|
};
|
|
17335
|
-
function
|
|
17336
|
-
let t = { ...
|
|
17418
|
+
function Sv(e) {
|
|
17419
|
+
let t = { ...xv };
|
|
17337
17420
|
if (!e) return t;
|
|
17338
|
-
let n = Object.keys(
|
|
17421
|
+
let n = Object.keys(xv);
|
|
17339
17422
|
for (let r of n) {
|
|
17340
17423
|
let n = e[r];
|
|
17341
17424
|
typeof n == "string" && (t[r] = n);
|
|
@@ -17344,7 +17427,7 @@ function yv(e) {
|
|
|
17344
17427
|
}
|
|
17345
17428
|
//#endregion
|
|
17346
17429
|
//#region src/core/components/messages.ts
|
|
17347
|
-
var
|
|
17430
|
+
var Cv = {
|
|
17348
17431
|
defaultTitle: "AI 助手",
|
|
17349
17432
|
inputPlaceholder: "输入消息,Enter 发送...",
|
|
17350
17433
|
newSession: "新建会话",
|
|
@@ -17582,8 +17665,8 @@ var bv = {
|
|
|
17582
17665
|
codeDemoText: "这是一段示例文字,用于展示 CSS 效果。",
|
|
17583
17666
|
codeDemoButton: "按钮",
|
|
17584
17667
|
codeDemoInput: "输入框"
|
|
17585
|
-
},
|
|
17586
|
-
"zh-CN":
|
|
17668
|
+
}, wv = {
|
|
17669
|
+
"zh-CN": Cv,
|
|
17587
17670
|
"en-US": {
|
|
17588
17671
|
defaultTitle: "AI Assistant",
|
|
17589
17672
|
inputPlaceholder: "Type a message, Enter to send...",
|
|
@@ -17824,10 +17907,10 @@ var bv = {
|
|
|
17824
17907
|
codeDemoInput: "Input"
|
|
17825
17908
|
}
|
|
17826
17909
|
};
|
|
17827
|
-
function
|
|
17910
|
+
function Tv(e = "zh-CN", t) {
|
|
17828
17911
|
let n = {
|
|
17829
|
-
...
|
|
17830
|
-
...
|
|
17912
|
+
...Cv,
|
|
17913
|
+
...wv[e]
|
|
17831
17914
|
};
|
|
17832
17915
|
if (!t) return n;
|
|
17833
17916
|
let r = { ...n };
|
|
@@ -17839,9 +17922,9 @@ function Sv(e = "zh-CN", t) {
|
|
|
17839
17922
|
}
|
|
17840
17923
|
//#endregion
|
|
17841
17924
|
//#region src/core/composables/chatContext.ts
|
|
17842
|
-
var
|
|
17843
|
-
function
|
|
17844
|
-
let t =
|
|
17925
|
+
var Ev = Symbol("chatContext");
|
|
17926
|
+
function Dv(e = {}) {
|
|
17927
|
+
let t = bv({
|
|
17845
17928
|
fetchResponse: e.fetchResponse,
|
|
17846
17929
|
fetchStream: e.fetchStream,
|
|
17847
17930
|
messages: e.messages,
|
|
@@ -17850,20 +17933,20 @@ function wv(e = {}) {
|
|
|
17850
17933
|
onQueuedCleared: e.onQueuedCleared,
|
|
17851
17934
|
onBeforeRegenerate: e.onBeforeRegenerate,
|
|
17852
17935
|
getFocuses: e.getFocuses
|
|
17853
|
-
}), { state: n, sendMessage: r, removeQueuedTask: i, queuedTasks: a } = t, o = /* @__PURE__ */
|
|
17936
|
+
}), { state: n, sendMessage: r, removeQueuedTask: i, queuedTasks: a } = t, o = /* @__PURE__ */ Kt(""), s = /* @__PURE__ */ Kt(!0), c = () => {
|
|
17854
17937
|
s.value = !s.value;
|
|
17855
|
-
}, l = /* @__PURE__ */
|
|
17938
|
+
}, l = /* @__PURE__ */ Kt(!1), u = () => {
|
|
17856
17939
|
l.value = !0;
|
|
17857
17940
|
}, d = () => {
|
|
17858
17941
|
l.value = !1;
|
|
17859
|
-
}, f = /* @__PURE__ */
|
|
17942
|
+
}, f = /* @__PURE__ */ Kt(!1), p = () => {
|
|
17860
17943
|
f.value = !0;
|
|
17861
17944
|
}, m = () => {
|
|
17862
17945
|
f.value = !1;
|
|
17863
|
-
}, h = /* @__PURE__ */
|
|
17946
|
+
}, h = /* @__PURE__ */ Kt({}), g = (e) => h.value[e] === !0, _ = (e) => {
|
|
17864
17947
|
h.value[e] = !g(e);
|
|
17865
|
-
}, v = /* @__PURE__ */
|
|
17866
|
-
|
|
17948
|
+
}, v = /* @__PURE__ */ Kt(!1), y = (e) => {
|
|
17949
|
+
vv(e).then((e) => {
|
|
17867
17950
|
e && (v.value = !0, setTimeout(() => {
|
|
17868
17951
|
v.value = !1;
|
|
17869
17952
|
}, 1500));
|
|
@@ -17876,13 +17959,13 @@ function wv(e = {}) {
|
|
|
17876
17959
|
};
|
|
17877
17960
|
}), x = ri(() => (n.messages.length, typeof e.canUndo == "function" && !!e.canUndo())), S = () => {
|
|
17878
17961
|
e.onUndo?.() && (n.error = null);
|
|
17879
|
-
}, C = (e) => new Date(e).toLocaleTimeString(
|
|
17962
|
+
}, C = (e) => new Date(e).toLocaleTimeString(fe, {
|
|
17880
17963
|
hour: "2-digit",
|
|
17881
17964
|
minute: "2-digit"
|
|
17882
17965
|
}), w = () => {
|
|
17883
17966
|
let e = T.value, t = ne.value;
|
|
17884
|
-
!o.value.trim() && !e.length || (r(o.value,
|
|
17885
|
-
}, T = /* @__PURE__ */
|
|
17967
|
+
!o.value.trim() && !e.length || (r(o.value, N.value, e.length ? [...e] : void 0, t ?? void 0), o.value = "", T.value = [], t && ie());
|
|
17968
|
+
}, T = /* @__PURE__ */ Kt([]), E = /* @__PURE__ */ Kt(""), D = /* @__PURE__ */ Kt(!1), O, k = (e) => {
|
|
17886
17969
|
E.value = e, clearTimeout(O), O = setTimeout(() => {
|
|
17887
17970
|
E.value = "";
|
|
17888
17971
|
}, 4e3);
|
|
@@ -17891,54 +17974,54 @@ function wv(e = {}) {
|
|
|
17891
17974
|
if (!t.length) return;
|
|
17892
17975
|
let n = 4 - T.value.length;
|
|
17893
17976
|
if (n <= 0) {
|
|
17894
|
-
k(`${
|
|
17977
|
+
k(`${L.imageCountLimitPrefix}4${L.imageCountLimitSuffix}`);
|
|
17895
17978
|
return;
|
|
17896
17979
|
}
|
|
17897
|
-
t.length > n && k(`${
|
|
17980
|
+
t.length > n && k(`${L.imageCountLimitPrefix}4${L.imageCountLimitSuffix}`), D.value = !0;
|
|
17898
17981
|
try {
|
|
17899
17982
|
for (let e of t.slice(0, n)) try {
|
|
17900
17983
|
let t = await Ei(e, { name: e.name });
|
|
17901
17984
|
T.value.push(t);
|
|
17902
17985
|
} catch (e) {
|
|
17903
|
-
k(e instanceof hi ? `${e.message}` :
|
|
17986
|
+
k(e instanceof hi ? `${e.message}` : L.imageInvalid);
|
|
17904
17987
|
}
|
|
17905
17988
|
} finally {
|
|
17906
17989
|
D.value = !1;
|
|
17907
17990
|
}
|
|
17908
17991
|
}, te = (e) => {
|
|
17909
17992
|
T.value = T.value.filter((t) => t.id !== e);
|
|
17910
|
-
}, ne = ri(() => e.pendingQuote?.value ?? null),
|
|
17993
|
+
}, ne = ri(() => e.pendingQuote?.value ?? null), re = (t) => {
|
|
17911
17994
|
e.onSetQuote?.(t);
|
|
17912
|
-
},
|
|
17995
|
+
}, ie = () => {
|
|
17913
17996
|
e.onClearQuote?.();
|
|
17914
|
-
}, ie = (e) => {
|
|
17915
|
-
e.isComposing || e.keyCode === 229 || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), w());
|
|
17916
17997
|
}, ae = (e) => {
|
|
17998
|
+
e.isComposing || e.keyCode === 229 || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), w());
|
|
17999
|
+
}, oe = (e) => {
|
|
17917
18000
|
o.value = a.value[e] || "", i(e);
|
|
17918
|
-
},
|
|
17919
|
-
e.role === "user" && (n.loading && t.stop(),
|
|
17920
|
-
},
|
|
17921
|
-
|
|
17922
|
-
},
|
|
17923
|
-
let r =
|
|
17924
|
-
if (
|
|
18001
|
+
}, A = /* @__PURE__ */ Kt(null), j = (e) => {
|
|
18002
|
+
e.role === "user" && (n.loading && t.stop(), A.value = e);
|
|
18003
|
+
}, se = () => {
|
|
18004
|
+
A.value = null;
|
|
18005
|
+
}, M = (e) => {
|
|
18006
|
+
let r = A.value;
|
|
18007
|
+
if (A.value = null, !r) return;
|
|
17925
18008
|
let i = n.messages.indexOf(r);
|
|
17926
18009
|
i < 0 || t.editAndResend(i, e);
|
|
17927
|
-
},
|
|
18010
|
+
}, ce = (e) => {
|
|
17928
18011
|
let t = n.messages, r = t[e];
|
|
17929
18012
|
if (!r || r.role !== "assistant") return !1;
|
|
17930
18013
|
let i = "reasoning" in r ? r.reasoning : void 0, a = "steps" in r ? r.steps : void 0;
|
|
17931
18014
|
return n.loading && e === t.length - 1 && !r.content && !i && !(a && a.length);
|
|
17932
|
-
},
|
|
18015
|
+
}, N = ri(() => (e.infoTick?.value, e.getFocuses?.() ?? [])), P = ri(() => (e.infoTick?.value, e.getInfo?.()?.planConfirmation)), F = (t) => e.onAddFocus ? e.onAddFocus(t) : {
|
|
17933
18016
|
ok: !1,
|
|
17934
18017
|
error: "focus 未启用"
|
|
17935
|
-
},
|
|
18018
|
+
}, le = (t) => {
|
|
17936
18019
|
e.onRemoveFocus?.(t);
|
|
17937
|
-
},
|
|
18020
|
+
}, ue = () => {
|
|
17938
18021
|
e.onClearFocus?.();
|
|
17939
|
-
},
|
|
18022
|
+
}, I = (t) => {
|
|
17940
18023
|
e.onFocusChipClick?.(t);
|
|
17941
|
-
},
|
|
18024
|
+
}, de = Sv(e.icons), fe = e.locale ?? "zh-CN", L = Tv(fe, e.dialogMessages);
|
|
17942
18025
|
return {
|
|
17943
18026
|
chat: t,
|
|
17944
18027
|
inputText: o,
|
|
@@ -17960,42 +18043,42 @@ function wv(e = {}) {
|
|
|
17960
18043
|
undo: S,
|
|
17961
18044
|
formatTime: C,
|
|
17962
18045
|
send: w,
|
|
17963
|
-
keydown:
|
|
18046
|
+
keydown: ae,
|
|
17964
18047
|
pendingImages: T,
|
|
17965
18048
|
addImageFiles: ee,
|
|
17966
18049
|
removePendingImage: te,
|
|
17967
18050
|
imageInputError: E,
|
|
17968
18051
|
compressingImages: D,
|
|
17969
18052
|
quote: ne,
|
|
17970
|
-
setQuote:
|
|
17971
|
-
clearQuote:
|
|
17972
|
-
editQueued:
|
|
17973
|
-
editingMessage:
|
|
17974
|
-
startEdit:
|
|
17975
|
-
cancelEdit:
|
|
17976
|
-
submitEdit:
|
|
17977
|
-
isPendingAssistant:
|
|
17978
|
-
focuses:
|
|
17979
|
-
planConfirmation:
|
|
17980
|
-
addFocus:
|
|
17981
|
-
removeFocus:
|
|
17982
|
-
clearFocus:
|
|
17983
|
-
focusChipClick:
|
|
17984
|
-
icons:
|
|
17985
|
-
locale:
|
|
17986
|
-
messages:
|
|
18053
|
+
setQuote: re,
|
|
18054
|
+
clearQuote: ie,
|
|
18055
|
+
editQueued: oe,
|
|
18056
|
+
editingMessage: A,
|
|
18057
|
+
startEdit: j,
|
|
18058
|
+
cancelEdit: se,
|
|
18059
|
+
submitEdit: M,
|
|
18060
|
+
isPendingAssistant: ce,
|
|
18061
|
+
focuses: N,
|
|
18062
|
+
planConfirmation: P,
|
|
18063
|
+
addFocus: F,
|
|
18064
|
+
removeFocus: le,
|
|
18065
|
+
clearFocus: ue,
|
|
18066
|
+
focusChipClick: I,
|
|
18067
|
+
icons: de,
|
|
18068
|
+
locale: fe,
|
|
18069
|
+
messages: L,
|
|
17987
18070
|
toolStepView: e.toolStepView
|
|
17988
18071
|
};
|
|
17989
18072
|
}
|
|
17990
|
-
function
|
|
17991
|
-
let e = Zn(
|
|
18073
|
+
function Ov() {
|
|
18074
|
+
let e = Zn(Ev);
|
|
17992
18075
|
if (!e) throw Error("useChatContext 必须在 provide(chatContextKey) 的组件子树内调用");
|
|
17993
18076
|
return e;
|
|
17994
18077
|
}
|
|
17995
18078
|
//#endregion
|
|
17996
18079
|
//#region src/core/index.headless.ts
|
|
17997
|
-
function
|
|
17998
|
-
return
|
|
18080
|
+
function kv(e) {
|
|
18081
|
+
return sv(e);
|
|
17999
18082
|
}
|
|
18000
18083
|
//#endregion
|
|
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,
|
|
18084
|
+
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, Ev as chatContextKey, lf as commitSetToBind, bp as composeStructureThenRender, Ei as compressImage, fd as connectMcp, k as constructLlmFromConfig, E as constructOpenLlmSync, vv as copyText, Fg as countOccurrences, Is as createAgent, Eu as createApprovalMiddleware, Dv as createChatContext, kv as createChatSdk, Ru as createCheckpointManager, zu as createCheckpointMiddleware, Jp as createConflictManager, sd as createContextInspectorMiddleware, Dp as createCraftNoteCheck, xf as createDataOps, _v as createEvalHarness, Tp as createHtmlFormatCheck, yp as createHtmlRenderCheck, kp as createHtmlSubagent, Au as createHumanConfirmMiddleware, ku as createHumanConfirmTool, mv as createIdleDetector, gm as createMemoryBackend, yu as createMemoryMiddleware, u as createProxyLlm, pv as createRagSubagent, Ta as createSandboxRunner, Dm as createSdkEvents, $_ as createSerialRunner, bm as createSessionStore, xm as createSessionStoreWithBackend, Y_ as createSkillStore, uu as createSubagentMiddleware, Wl as createSubagentTracker, pu as createSubagentsMiddleware, V_ as createUsageHintsMiddleware, Vu as createVerifyMiddleware, Dd as createVfs, vm as createWebStorageBackend, qu as createWriteBackCheck, ba as decorateModelUnavailable, Pc as deepClone, F_ 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, gv as diffReport, p_ as domInfoTool, v_ as domInspectSkill, f_ as domSearchTool, qg as domToStructure, n_ as domTools, P_ 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, N_ 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, ie 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, I_ 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, bv as useChat, Ov as useChatContext, Ks as validateAtPath, wf as validateHtmlFormat, sf as validateRootValueLocally, cf as validateWriteLocally, Vc as watchFieldsHash, e as z, si as zodError };
|