page-agent-sdk 4.9.3 → 4.11.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 +3 -0
- package/README.zh-CN.md +3 -0
- package/dist/page-agent-sdk.headless.js +694 -470
- package/dist/page-agent-sdk.iife.js +170 -170
- package/dist/page-agent-sdk.js +2332 -1942
- package/dist/page-agent-sdk.legacy.js +15734 -15307
- package/dist/page-agent-sdk.umd.cjs +50 -50
- package/dist/style.css +1 -1
- package/package.json +2 -1
- package/style.css +1 -1
- package/types/headless.d.ts +69 -0
- package/types/index.d.ts +107 -0
|
@@ -514,12 +514,12 @@ function ye(e) {
|
|
|
514
514
|
return t;
|
|
515
515
|
} else if (de(e) || R(e)) return e;
|
|
516
516
|
}
|
|
517
|
-
var
|
|
517
|
+
var be = /;(?![^(]*\))/g, U = /:([^]+)/, xe = /\/\*[^]*?\*\//g;
|
|
518
518
|
function Se(e) {
|
|
519
519
|
let t = {};
|
|
520
|
-
return e.replace(xe, "").split(
|
|
520
|
+
return e.replace(xe, "").split(be).forEach((e) => {
|
|
521
521
|
if (e) {
|
|
522
|
-
let n = e.split(
|
|
522
|
+
let n = e.split(U);
|
|
523
523
|
n.length > 1 && (t[n[0].trim()] = n[1].trim());
|
|
524
524
|
}
|
|
525
525
|
}), t;
|
|
@@ -536,16 +536,16 @@ function Ce(e) {
|
|
|
536
536
|
}
|
|
537
537
|
//#endregion
|
|
538
538
|
//#region node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
|
|
539
|
-
function
|
|
539
|
+
function we(e, ...t) {
|
|
540
540
|
console.warn(`[Vue warn] ${e}`, ...t);
|
|
541
541
|
}
|
|
542
|
-
var
|
|
542
|
+
var W;
|
|
543
543
|
function Te() {
|
|
544
|
-
return
|
|
544
|
+
return W;
|
|
545
545
|
}
|
|
546
546
|
var G, Ee = /* @__PURE__ */ new WeakSet(), De = class {
|
|
547
547
|
constructor(e) {
|
|
548
|
-
this.fn = e, this.deps = void 0, this.depsTail = void 0, this.flags = 5, this.next = void 0, this.cleanup = void 0, this.scheduler = void 0,
|
|
548
|
+
this.fn = e, this.deps = void 0, this.depsTail = void 0, this.flags = 5, this.next = void 0, this.cleanup = void 0, this.scheduler = void 0, W && (W.active ? W.effects.push(this) : this.flags &= -2);
|
|
549
549
|
}
|
|
550
550
|
pause() {
|
|
551
551
|
this.flags |= 64;
|
|
@@ -559,12 +559,12 @@ var G, Ee = /* @__PURE__ */ new WeakSet(), De = class {
|
|
|
559
559
|
run() {
|
|
560
560
|
if (!(this.flags & 1)) return this.fn();
|
|
561
561
|
this.flags |= 2, Ue(this), Pe(this);
|
|
562
|
-
let e = G, t =
|
|
563
|
-
G = this,
|
|
562
|
+
let e = G, t = K;
|
|
563
|
+
G = this, K = !0;
|
|
564
564
|
try {
|
|
565
565
|
return this.fn();
|
|
566
566
|
} finally {
|
|
567
|
-
process.env.NODE_ENV !== "production" && G !== this &&
|
|
567
|
+
process.env.NODE_ENV !== "production" && G !== this && we("Active effect was not restored correctly - this is likely a Vue internal bug."), Fe(this), G = e, K = t, this.flags &= -3;
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
570
|
stop() {
|
|
@@ -624,7 +624,7 @@ function Fe(e) {
|
|
|
624
624
|
let t, n = e.depsTail, r = n;
|
|
625
625
|
for (; r;) {
|
|
626
626
|
let e = r.prevDep;
|
|
627
|
-
r.version === -1 ? (r === n && (n = e), Re(r),
|
|
627
|
+
r.version === -1 ? (r === n && (n = e), Re(r), ze(r)) : t = r, r.dep.activeLink = r.prevActiveLink, r.prevActiveLink = void 0, r = e;
|
|
628
628
|
}
|
|
629
629
|
e.deps = t, e.depsTail = n;
|
|
630
630
|
}
|
|
@@ -635,8 +635,8 @@ function Ie(e) {
|
|
|
635
635
|
function Le(e) {
|
|
636
636
|
if (e.flags & 4 && !(e.flags & 16) || (e.flags &= -17, e.globalVersion === We) || (e.globalVersion = We, !e.isSSR && e.flags & 128 && (!e.deps && !e._dirty || !Ie(e)))) return;
|
|
637
637
|
e.flags |= 2;
|
|
638
|
-
let t = e.dep, n = G, r =
|
|
639
|
-
G = e,
|
|
638
|
+
let t = e.dep, n = G, r = K;
|
|
639
|
+
G = e, K = !0;
|
|
640
640
|
try {
|
|
641
641
|
Pe(e);
|
|
642
642
|
let n = e.fn(e._value);
|
|
@@ -644,7 +644,7 @@ function Le(e) {
|
|
|
644
644
|
} catch (e) {
|
|
645
645
|
throw t.version++, e;
|
|
646
646
|
} finally {
|
|
647
|
-
G = n,
|
|
647
|
+
G = n, K = r, Fe(e), e.flags &= -3;
|
|
648
648
|
}
|
|
649
649
|
}
|
|
650
650
|
function Re(e, t = !1) {
|
|
@@ -655,17 +655,17 @@ function Re(e, t = !1) {
|
|
|
655
655
|
}
|
|
656
656
|
!t && !--n.sc && n.map && n.map.delete(n.key);
|
|
657
657
|
}
|
|
658
|
-
function
|
|
658
|
+
function ze(e) {
|
|
659
659
|
let { prevDep: t, nextDep: n } = e;
|
|
660
660
|
t && (t.nextDep = n, e.prevDep = void 0), n && (n.prevDep = t, e.nextDep = void 0);
|
|
661
661
|
}
|
|
662
|
-
var
|
|
662
|
+
var K = !0, Be = [];
|
|
663
663
|
function Ve() {
|
|
664
|
-
Be.push(
|
|
664
|
+
Be.push(K), K = !1;
|
|
665
665
|
}
|
|
666
666
|
function He() {
|
|
667
667
|
let e = Be.pop();
|
|
668
|
-
|
|
668
|
+
K = e === void 0 || e;
|
|
669
669
|
}
|
|
670
670
|
function Ue(e) {
|
|
671
671
|
let { cleanup: t } = e;
|
|
@@ -688,7 +688,7 @@ var We = 0, Ge = class {
|
|
|
688
688
|
this.computed = e, this.version = 0, this.activeLink = void 0, this.subs = void 0, this.map = void 0, this.key = void 0, this.sc = 0, this.__v_skip = !0, process.env.NODE_ENV !== "production" && (this.subsHead = void 0);
|
|
689
689
|
}
|
|
690
690
|
track(e) {
|
|
691
|
-
if (!G || !
|
|
691
|
+
if (!G || !K || G === this.computed) return;
|
|
692
692
|
let t = this.activeLink;
|
|
693
693
|
if (t === void 0 || t.sub !== G) t = this.activeLink = new Ge(G, this), G.deps ? (t.prevDep = G.depsTail, G.depsTail.nextDep = t, G.depsTail = t) : G.deps = G.depsTail = t, qe(t);
|
|
694
694
|
else if (t.version === -1 && (t.version = this.version, t.nextDep)) {
|
|
@@ -723,7 +723,7 @@ function qe(e) {
|
|
|
723
723
|
}
|
|
724
724
|
var Je = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ Symbol(process.env.NODE_ENV === "production" ? "" : "Object iterate"), Xe = /* @__PURE__ */ Symbol(process.env.NODE_ENV === "production" ? "" : "Map keys iterate"), Ze = /* @__PURE__ */ Symbol(process.env.NODE_ENV === "production" ? "" : "Array iterate");
|
|
725
725
|
function Qe(e, t, n) {
|
|
726
|
-
if (
|
|
726
|
+
if (K && G) {
|
|
727
727
|
let r = Je.get(e);
|
|
728
728
|
r || Je.set(e, r = /* @__PURE__ */ new Map());
|
|
729
729
|
let i = r.get(n);
|
|
@@ -774,81 +774,81 @@ function $e(e, t, n, r, i, a) {
|
|
|
774
774
|
}
|
|
775
775
|
function et(e) {
|
|
776
776
|
let t = /* @__PURE__ */ Y(e);
|
|
777
|
-
return t === e ? t : (Qe(t, "iterate", Ze), /* @__PURE__ */
|
|
777
|
+
return t === e ? t : (Qe(t, "iterate", Ze), /* @__PURE__ */ Rt(e) ? t : t.map(Vt));
|
|
778
778
|
}
|
|
779
779
|
function tt(e) {
|
|
780
780
|
return Qe(e = /* @__PURE__ */ Y(e), "iterate", Ze), e;
|
|
781
781
|
}
|
|
782
|
-
function
|
|
783
|
-
return /* @__PURE__ */
|
|
782
|
+
function q(e, t) {
|
|
783
|
+
return /* @__PURE__ */ Lt(e) ? Ht(/* @__PURE__ */ It(e) ? Vt(t) : t) : Vt(t);
|
|
784
784
|
}
|
|
785
|
-
var
|
|
785
|
+
var nt = {
|
|
786
786
|
__proto__: null,
|
|
787
787
|
[Symbol.iterator]() {
|
|
788
|
-
return
|
|
788
|
+
return rt(this, Symbol.iterator, (e) => q(this, e));
|
|
789
789
|
},
|
|
790
790
|
concat(...e) {
|
|
791
791
|
return et(this).concat(...e.map((e) => F(e) ? et(e) : e));
|
|
792
792
|
},
|
|
793
793
|
entries() {
|
|
794
|
-
return
|
|
794
|
+
return rt(this, "entries", (e) => (e[1] = q(this, e[1]), e));
|
|
795
795
|
},
|
|
796
796
|
every(e, t) {
|
|
797
|
-
return
|
|
797
|
+
return at(this, "every", e, t, void 0, arguments);
|
|
798
798
|
},
|
|
799
799
|
filter(e, t) {
|
|
800
|
-
return
|
|
800
|
+
return at(this, "filter", e, t, (e) => e.map((e) => q(this, e)), arguments);
|
|
801
801
|
},
|
|
802
802
|
find(e, t) {
|
|
803
|
-
return
|
|
803
|
+
return at(this, "find", e, t, (e) => q(this, e), arguments);
|
|
804
804
|
},
|
|
805
805
|
findIndex(e, t) {
|
|
806
|
-
return
|
|
806
|
+
return at(this, "findIndex", e, t, void 0, arguments);
|
|
807
807
|
},
|
|
808
808
|
findLast(e, t) {
|
|
809
|
-
return
|
|
809
|
+
return at(this, "findLast", e, t, (e) => q(this, e), arguments);
|
|
810
810
|
},
|
|
811
811
|
findLastIndex(e, t) {
|
|
812
|
-
return
|
|
812
|
+
return at(this, "findLastIndex", e, t, void 0, arguments);
|
|
813
813
|
},
|
|
814
814
|
forEach(e, t) {
|
|
815
|
-
return
|
|
815
|
+
return at(this, "forEach", e, t, void 0, arguments);
|
|
816
816
|
},
|
|
817
817
|
includes(...e) {
|
|
818
|
-
return
|
|
818
|
+
return st(this, "includes", e);
|
|
819
819
|
},
|
|
820
820
|
indexOf(...e) {
|
|
821
|
-
return
|
|
821
|
+
return st(this, "indexOf", e);
|
|
822
822
|
},
|
|
823
823
|
join(e) {
|
|
824
824
|
return et(this).join(e);
|
|
825
825
|
},
|
|
826
826
|
lastIndexOf(...e) {
|
|
827
|
-
return
|
|
827
|
+
return st(this, "lastIndexOf", e);
|
|
828
828
|
},
|
|
829
829
|
map(e, t) {
|
|
830
|
-
return
|
|
830
|
+
return at(this, "map", e, t, void 0, arguments);
|
|
831
831
|
},
|
|
832
832
|
pop() {
|
|
833
|
-
return
|
|
833
|
+
return ct(this, "pop");
|
|
834
834
|
},
|
|
835
835
|
push(...e) {
|
|
836
|
-
return
|
|
836
|
+
return ct(this, "push", e);
|
|
837
837
|
},
|
|
838
838
|
reduce(e, ...t) {
|
|
839
|
-
return
|
|
839
|
+
return ot(this, "reduce", e, t);
|
|
840
840
|
},
|
|
841
841
|
reduceRight(e, ...t) {
|
|
842
|
-
return
|
|
842
|
+
return ot(this, "reduceRight", e, t);
|
|
843
843
|
},
|
|
844
844
|
shift() {
|
|
845
|
-
return
|
|
845
|
+
return ct(this, "shift");
|
|
846
846
|
},
|
|
847
847
|
some(e, t) {
|
|
848
|
-
return
|
|
848
|
+
return at(this, "some", e, t, void 0, arguments);
|
|
849
849
|
},
|
|
850
850
|
splice(...e) {
|
|
851
|
-
return
|
|
851
|
+
return ct(this, "splice", e);
|
|
852
852
|
},
|
|
853
853
|
toReversed() {
|
|
854
854
|
return et(this).toReversed();
|
|
@@ -860,63 +860,63 @@ var rt = {
|
|
|
860
860
|
return et(this).toSpliced(...e);
|
|
861
861
|
},
|
|
862
862
|
unshift(...e) {
|
|
863
|
-
return
|
|
863
|
+
return ct(this, "unshift", e);
|
|
864
864
|
},
|
|
865
865
|
values() {
|
|
866
|
-
return
|
|
866
|
+
return rt(this, "values", (e) => q(this, e));
|
|
867
867
|
}
|
|
868
868
|
};
|
|
869
|
-
function
|
|
869
|
+
function rt(e, t, n) {
|
|
870
870
|
let r = tt(e), i = r[t]();
|
|
871
|
-
return r !== e && !/* @__PURE__ */
|
|
871
|
+
return r !== e && !/* @__PURE__ */ Rt(e) && (i._next = i.next, i.next = () => {
|
|
872
872
|
let e = i._next();
|
|
873
873
|
return e.done || (e.value = n(e.value)), e;
|
|
874
874
|
}), i;
|
|
875
875
|
}
|
|
876
|
-
var
|
|
877
|
-
function
|
|
878
|
-
let o = tt(e), s = o !== e && !/* @__PURE__ */
|
|
879
|
-
if (c !==
|
|
876
|
+
var it = Array.prototype;
|
|
877
|
+
function at(e, t, n, r, i, a) {
|
|
878
|
+
let o = tt(e), s = o !== e && !/* @__PURE__ */ Rt(e), c = o[t];
|
|
879
|
+
if (c !== it[t]) {
|
|
880
880
|
let t = c.apply(e, a);
|
|
881
881
|
return s ? Vt(t) : t;
|
|
882
882
|
}
|
|
883
883
|
let l = n;
|
|
884
884
|
o !== e && (s ? l = function(t, r) {
|
|
885
|
-
return n.call(this,
|
|
885
|
+
return n.call(this, q(e, t), r, e);
|
|
886
886
|
} : n.length > 2 && (l = function(t, r) {
|
|
887
887
|
return n.call(this, t, r, e);
|
|
888
888
|
}));
|
|
889
889
|
let u = c.call(o, l, r);
|
|
890
890
|
return s && i ? i(u) : u;
|
|
891
891
|
}
|
|
892
|
-
function
|
|
893
|
-
let i = tt(e), a = i !== e && !/* @__PURE__ */
|
|
892
|
+
function ot(e, t, n, r) {
|
|
893
|
+
let i = tt(e), a = i !== e && !/* @__PURE__ */ Rt(e), o = n, s = !1;
|
|
894
894
|
i !== e && (a ? (s = r.length === 0, o = function(t, r, i) {
|
|
895
|
-
return s && (s = !1, t =
|
|
895
|
+
return s && (s = !1, t = q(e, t)), n.call(this, t, q(e, r), i, e);
|
|
896
896
|
}) : n.length > 3 && (o = function(t, r, i) {
|
|
897
897
|
return n.call(this, t, r, i, e);
|
|
898
898
|
}));
|
|
899
899
|
let c = i[t](o, ...r);
|
|
900
|
-
return s ?
|
|
900
|
+
return s ? q(e, c) : c;
|
|
901
901
|
}
|
|
902
|
-
function
|
|
902
|
+
function st(e, t, n) {
|
|
903
903
|
let r = /* @__PURE__ */ Y(e);
|
|
904
904
|
Qe(r, "iterate", Ze);
|
|
905
905
|
let i = r[t](...n);
|
|
906
|
-
return (i === -1 || i === !1) && /* @__PURE__ */
|
|
906
|
+
return (i === -1 || i === !1) && /* @__PURE__ */ zt(n[0]) ? (n[0] = /* @__PURE__ */ Y(n[0]), r[t](...n)) : i;
|
|
907
907
|
}
|
|
908
|
-
function
|
|
908
|
+
function ct(e, t, n = []) {
|
|
909
909
|
Ve(), Me();
|
|
910
910
|
let r = (/* @__PURE__ */ Y(e))[t].apply(e, n);
|
|
911
911
|
return Ne(), He(), r;
|
|
912
912
|
}
|
|
913
|
-
var
|
|
914
|
-
function
|
|
913
|
+
var lt = /* @__PURE__ */ k("__proto__,__v_isRef,__isVue"), ut = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((e) => e !== "arguments" && e !== "caller").map((e) => Symbol[e]).filter(L));
|
|
914
|
+
function dt(e) {
|
|
915
915
|
L(e) || (e = String(e));
|
|
916
916
|
let t = /* @__PURE__ */ Y(this);
|
|
917
917
|
return Qe(t, "has", e), t.hasOwnProperty(e);
|
|
918
918
|
}
|
|
919
|
-
var
|
|
919
|
+
var ft = class {
|
|
920
920
|
constructor(e = !1, t = !1) {
|
|
921
921
|
this._isReadonly = e, this._isShallow = t;
|
|
922
922
|
}
|
|
@@ -926,30 +926,30 @@ var pt = class {
|
|
|
926
926
|
if (t === "__v_isReactive") return !r;
|
|
927
927
|
if (t === "__v_isReadonly") return r;
|
|
928
928
|
if (t === "__v_isShallow") return i;
|
|
929
|
-
if (t === "__v_raw") return n === (r ? i ?
|
|
929
|
+
if (t === "__v_raw") return n === (r ? i ? At : kt : i ? Ot : Dt).get(e) || Object.getPrototypeOf(e) === Object.getPrototypeOf(n) ? e : void 0;
|
|
930
930
|
let a = F(e);
|
|
931
931
|
if (!r) {
|
|
932
932
|
let e;
|
|
933
|
-
if (a && (e =
|
|
934
|
-
if (t === "hasOwnProperty") return
|
|
933
|
+
if (a && (e = nt[t])) return e;
|
|
934
|
+
if (t === "hasOwnProperty") return dt;
|
|
935
935
|
}
|
|
936
936
|
let o = Reflect.get(e, t, /* @__PURE__ */ Ut(e) ? e : n);
|
|
937
|
-
if ((L(t) ?
|
|
937
|
+
if ((L(t) ? ut.has(t) : lt(t)) || (r || Qe(e, "get", t), i)) return o;
|
|
938
938
|
if (/* @__PURE__ */ Ut(o)) {
|
|
939
939
|
let e = a && V(t) ? o : o.value;
|
|
940
|
-
return r && R(e) ? /* @__PURE__ */
|
|
940
|
+
return r && R(e) ? /* @__PURE__ */ Nt(e) : e;
|
|
941
941
|
}
|
|
942
|
-
return R(o) ? r ? /* @__PURE__ */
|
|
942
|
+
return R(o) ? r ? /* @__PURE__ */ Nt(o) : /* @__PURE__ */ Mt(o) : o;
|
|
943
943
|
}
|
|
944
|
-
},
|
|
944
|
+
}, pt = class extends ft {
|
|
945
945
|
constructor(e = !1) {
|
|
946
946
|
super(!1, e);
|
|
947
947
|
}
|
|
948
948
|
set(e, t, n, r) {
|
|
949
949
|
let i = e[t], a = F(e) && V(t);
|
|
950
950
|
if (!this._isShallow) {
|
|
951
|
-
let r = /* @__PURE__ */
|
|
952
|
-
if (!/* @__PURE__ */
|
|
951
|
+
let r = /* @__PURE__ */ Lt(i);
|
|
952
|
+
if (!/* @__PURE__ */ Rt(n) && !/* @__PURE__ */ Lt(n) && (i = /* @__PURE__ */ Y(i), n = /* @__PURE__ */ Y(n)), !a && /* @__PURE__ */ Ut(i) && !/* @__PURE__ */ Ut(n)) return r ? (process.env.NODE_ENV !== "production" && we(`Set operation on key "${String(t)}" failed: target is readonly.`, e[t]), !0) : (i.value = n, !0);
|
|
953
953
|
}
|
|
954
954
|
let o = a ? Number(t) < e.length : P(e, t), s = Reflect.set(e, t, n, /* @__PURE__ */ Ut(e) ? e : r);
|
|
955
955
|
return e === /* @__PURE__ */ Y(r) && s && (o ? ge(n, i) && $e(e, "set", t, n, i) : $e(e, "add", t, n)), s;
|
|
@@ -960,25 +960,25 @@ var pt = class {
|
|
|
960
960
|
}
|
|
961
961
|
has(e, t) {
|
|
962
962
|
let n = Reflect.has(e, t);
|
|
963
|
-
return (!L(t) || !
|
|
963
|
+
return (!L(t) || !ut.has(t)) && Qe(e, "has", t), n;
|
|
964
964
|
}
|
|
965
965
|
ownKeys(e) {
|
|
966
966
|
return Qe(e, "iterate", F(e) ? "length" : Ye), Reflect.ownKeys(e);
|
|
967
967
|
}
|
|
968
|
-
},
|
|
968
|
+
}, mt = class extends ft {
|
|
969
969
|
constructor(e = !1) {
|
|
970
970
|
super(!0, e);
|
|
971
971
|
}
|
|
972
972
|
set(e, t) {
|
|
973
|
-
return process.env.NODE_ENV !== "production" &&
|
|
973
|
+
return process.env.NODE_ENV !== "production" && we(`Set operation on key "${String(t)}" failed: target is readonly.`, e), !0;
|
|
974
974
|
}
|
|
975
975
|
deleteProperty(e, t) {
|
|
976
|
-
return process.env.NODE_ENV !== "production" &&
|
|
976
|
+
return process.env.NODE_ENV !== "production" && we(`Delete operation on key "${String(t)}" failed: target is readonly.`, e), !0;
|
|
977
977
|
}
|
|
978
|
-
},
|
|
979
|
-
function
|
|
978
|
+
}, ht = /* @__PURE__ */ new pt(), gt = /* @__PURE__ */ new mt(), _t = /* @__PURE__ */ new mt(!0), vt = (e) => e, yt = (e) => Reflect.getPrototypeOf(e);
|
|
979
|
+
function bt(e, t, n) {
|
|
980
980
|
return function(...r) {
|
|
981
|
-
let i = this.__v_raw, a = /* @__PURE__ */ Y(i), o = le(a), s = e === "entries" || e === Symbol.iterator && o, c = e === "keys" && o, l = i[e](...r), u = n ?
|
|
981
|
+
let i = this.__v_raw, a = /* @__PURE__ */ Y(i), o = le(a), s = e === "entries" || e === Symbol.iterator && o, c = e === "keys" && o, l = i[e](...r), u = n ? vt : t ? Ht : Vt;
|
|
982
982
|
return !t && Qe(a, "iterate", c ? Xe : Ye), M(Object.create(l), { next() {
|
|
983
983
|
let { value: e, done: t } = l.next();
|
|
984
984
|
return t ? {
|
|
@@ -991,21 +991,21 @@ function xt(e, t, n) {
|
|
|
991
991
|
} });
|
|
992
992
|
};
|
|
993
993
|
}
|
|
994
|
-
function
|
|
994
|
+
function xt(e) {
|
|
995
995
|
return function(...t) {
|
|
996
996
|
if (process.env.NODE_ENV !== "production") {
|
|
997
997
|
let n = t[0] ? `on key "${t[0]}" ` : "";
|
|
998
|
-
|
|
998
|
+
we(`${he(e)} operation ${n}failed: target is readonly.`, /* @__PURE__ */ Y(this));
|
|
999
999
|
}
|
|
1000
1000
|
return e === "delete" ? !1 : e === "clear" ? void 0 : this;
|
|
1001
1001
|
};
|
|
1002
1002
|
}
|
|
1003
|
-
function
|
|
1003
|
+
function J(e, t) {
|
|
1004
1004
|
let n = {
|
|
1005
1005
|
get(n) {
|
|
1006
1006
|
let r = this.__v_raw, i = /* @__PURE__ */ Y(r), a = /* @__PURE__ */ Y(n);
|
|
1007
1007
|
e || (ge(n, a) && Qe(i, "get", n), Qe(i, "get", a));
|
|
1008
|
-
let { has: o } =
|
|
1008
|
+
let { has: o } = yt(i), s = t ? vt : e ? Ht : Vt;
|
|
1009
1009
|
if (o.call(i, n)) return s(r.get(n));
|
|
1010
1010
|
if (o.call(i, a)) return s(r.get(a));
|
|
1011
1011
|
r !== i && r.get(n);
|
|
@@ -1019,30 +1019,30 @@ function St(e, t) {
|
|
|
1019
1019
|
return e || (ge(t, i) && Qe(r, "has", t), Qe(r, "has", i)), t === i ? n.has(t) : n.has(t) || n.has(i);
|
|
1020
1020
|
},
|
|
1021
1021
|
forEach(n, r) {
|
|
1022
|
-
let i = this, a = i.__v_raw, o = /* @__PURE__ */ Y(a), s = t ?
|
|
1022
|
+
let i = this, a = i.__v_raw, o = /* @__PURE__ */ Y(a), s = t ? vt : e ? Ht : Vt;
|
|
1023
1023
|
return !e && Qe(o, "iterate", Ye), a.forEach((e, t) => n.call(r, s(e), s(t), i));
|
|
1024
1024
|
}
|
|
1025
1025
|
};
|
|
1026
1026
|
return M(n, e ? {
|
|
1027
|
-
add:
|
|
1028
|
-
set:
|
|
1029
|
-
delete:
|
|
1030
|
-
clear:
|
|
1027
|
+
add: xt("add"),
|
|
1028
|
+
set: xt("set"),
|
|
1029
|
+
delete: xt("delete"),
|
|
1030
|
+
clear: xt("clear")
|
|
1031
1031
|
} : {
|
|
1032
1032
|
add(e) {
|
|
1033
|
-
let n = /* @__PURE__ */ Y(this), r =
|
|
1033
|
+
let n = /* @__PURE__ */ Y(this), r = yt(n), i = /* @__PURE__ */ Y(e), a = !t && !/* @__PURE__ */ Rt(e) && !/* @__PURE__ */ Lt(e) ? i : e;
|
|
1034
1034
|
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;
|
|
1035
1035
|
},
|
|
1036
1036
|
set(e, n) {
|
|
1037
|
-
!t && !/* @__PURE__ */
|
|
1038
|
-
let r = /* @__PURE__ */ Y(this), { has: i, get: a } =
|
|
1039
|
-
o ? process.env.NODE_ENV !== "production" &&
|
|
1037
|
+
!t && !/* @__PURE__ */ Rt(n) && !/* @__PURE__ */ Lt(n) && (n = /* @__PURE__ */ Y(n));
|
|
1038
|
+
let r = /* @__PURE__ */ Y(this), { has: i, get: a } = yt(r), o = i.call(r, e);
|
|
1039
|
+
o ? process.env.NODE_ENV !== "production" && Et(r, i, e) : (e = /* @__PURE__ */ Y(e), o = i.call(r, e));
|
|
1040
1040
|
let s = a.call(r, e);
|
|
1041
1041
|
return r.set(e, n), o ? ge(n, s) && $e(r, "set", e, n, s) : $e(r, "add", e, n), this;
|
|
1042
1042
|
},
|
|
1043
1043
|
delete(e) {
|
|
1044
|
-
let t = /* @__PURE__ */ Y(this), { has: n, get: r } =
|
|
1045
|
-
i ? process.env.NODE_ENV !== "production" &&
|
|
1044
|
+
let t = /* @__PURE__ */ Y(this), { has: n, get: r } = yt(t), i = n.call(t, e);
|
|
1045
|
+
i ? process.env.NODE_ENV !== "production" && Et(t, n, e) : (e = /* @__PURE__ */ Y(e), i = n.call(t, e));
|
|
1046
1046
|
let a = r ? r.call(t, e) : void 0, o = t.delete(e);
|
|
1047
1047
|
return i && $e(t, "delete", e, void 0, a), o;
|
|
1048
1048
|
},
|
|
@@ -1056,23 +1056,23 @@ function St(e, t) {
|
|
|
1056
1056
|
"entries",
|
|
1057
1057
|
Symbol.iterator
|
|
1058
1058
|
].forEach((r) => {
|
|
1059
|
-
n[r] =
|
|
1059
|
+
n[r] = bt(r, e, t);
|
|
1060
1060
|
}), n;
|
|
1061
1061
|
}
|
|
1062
|
-
function
|
|
1063
|
-
let n =
|
|
1062
|
+
function St(e, t) {
|
|
1063
|
+
let n = J(e, t);
|
|
1064
1064
|
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);
|
|
1065
1065
|
}
|
|
1066
|
-
var
|
|
1067
|
-
function
|
|
1066
|
+
var Ct = { get: /* @__PURE__ */ St(!1, !1) }, wt = { get: /* @__PURE__ */ St(!0, !1) }, Tt = { get: /* @__PURE__ */ St(!0, !0) };
|
|
1067
|
+
function Et(e, t, n) {
|
|
1068
1068
|
let r = /* @__PURE__ */ Y(n);
|
|
1069
1069
|
if (r !== n && t.call(e, r)) {
|
|
1070
1070
|
let t = B(e);
|
|
1071
|
-
|
|
1071
|
+
we(`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.`);
|
|
1072
1072
|
}
|
|
1073
1073
|
}
|
|
1074
|
-
var
|
|
1075
|
-
function
|
|
1074
|
+
var Dt = /* @__PURE__ */ new WeakMap(), Ot = /* @__PURE__ */ new WeakMap(), kt = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new WeakMap();
|
|
1075
|
+
function jt(e) {
|
|
1076
1076
|
switch (e) {
|
|
1077
1077
|
case "Object":
|
|
1078
1078
|
case "Array": return 1;
|
|
@@ -1084,41 +1084,41 @@ function Mt(e) {
|
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
1086
1086
|
// @__NO_SIDE_EFFECTS__
|
|
1087
|
-
function
|
|
1088
|
-
return /* @__PURE__ */
|
|
1087
|
+
function Mt(e) {
|
|
1088
|
+
return /* @__PURE__ */ Lt(e) ? e : Ft(e, !1, ht, Ct, Dt);
|
|
1089
1089
|
}
|
|
1090
1090
|
// @__NO_SIDE_EFFECTS__
|
|
1091
|
-
function
|
|
1092
|
-
return
|
|
1091
|
+
function Nt(e) {
|
|
1092
|
+
return Ft(e, !0, gt, wt, kt);
|
|
1093
1093
|
}
|
|
1094
1094
|
// @__NO_SIDE_EFFECTS__
|
|
1095
|
-
function
|
|
1096
|
-
return
|
|
1095
|
+
function Pt(e) {
|
|
1096
|
+
return Ft(e, !0, _t, Tt, At);
|
|
1097
1097
|
}
|
|
1098
|
-
function
|
|
1099
|
-
if (!R(e)) return process.env.NODE_ENV !== "production" &&
|
|
1098
|
+
function Ft(e, t, n, r, i) {
|
|
1099
|
+
if (!R(e)) return process.env.NODE_ENV !== "production" && we(`value cannot be made ${t ? "readonly" : "reactive"}: ${String(e)}`), e;
|
|
1100
1100
|
if (e.__v_raw && !(t && e.__v_isReactive) || e.__v_skip || !Object.isExtensible(e)) return e;
|
|
1101
1101
|
let a = i.get(e);
|
|
1102
1102
|
if (a) return a;
|
|
1103
|
-
let o =
|
|
1103
|
+
let o = jt(B(e));
|
|
1104
1104
|
if (o === 0) return e;
|
|
1105
1105
|
let s = new Proxy(e, o === 2 ? r : n);
|
|
1106
1106
|
return i.set(e, s), s;
|
|
1107
1107
|
}
|
|
1108
1108
|
// @__NO_SIDE_EFFECTS__
|
|
1109
|
-
function
|
|
1110
|
-
return /* @__PURE__ */
|
|
1109
|
+
function It(e) {
|
|
1110
|
+
return /* @__PURE__ */ Lt(e) ? /* @__PURE__ */ It(e.__v_raw) : !!(e && e.__v_isReactive);
|
|
1111
1111
|
}
|
|
1112
1112
|
// @__NO_SIDE_EFFECTS__
|
|
1113
|
-
function
|
|
1113
|
+
function Lt(e) {
|
|
1114
1114
|
return !!(e && e.__v_isReadonly);
|
|
1115
1115
|
}
|
|
1116
1116
|
// @__NO_SIDE_EFFECTS__
|
|
1117
|
-
function
|
|
1117
|
+
function Rt(e) {
|
|
1118
1118
|
return !!(e && e.__v_isShallow);
|
|
1119
1119
|
}
|
|
1120
1120
|
// @__NO_SIDE_EFFECTS__
|
|
1121
|
-
function
|
|
1121
|
+
function zt(e) {
|
|
1122
1122
|
return e ? !!e.__v_raw : !1;
|
|
1123
1123
|
}
|
|
1124
1124
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -1129,7 +1129,7 @@ function Y(e) {
|
|
|
1129
1129
|
function Bt(e) {
|
|
1130
1130
|
return !P(e, "__v_skip") && Object.isExtensible(e) && _e(e, "__v_skip", !0), e;
|
|
1131
1131
|
}
|
|
1132
|
-
var Vt = (e) => R(e) ? /* @__PURE__ */
|
|
1132
|
+
var Vt = (e) => R(e) ? /* @__PURE__ */ Mt(e) : e, Ht = (e) => R(e) ? /* @__PURE__ */ Nt(e) : e;
|
|
1133
1133
|
// @__NO_SIDE_EFFECTS__
|
|
1134
1134
|
function Ut(e) {
|
|
1135
1135
|
return e ? e.__v_isRef === !0 : !1;
|
|
@@ -1157,7 +1157,7 @@ var qt = class {
|
|
|
1157
1157
|
}), this._value;
|
|
1158
1158
|
}
|
|
1159
1159
|
set value(e) {
|
|
1160
|
-
let t = this._rawValue, n = this.__v_isShallow || /* @__PURE__ */
|
|
1160
|
+
let t = this._rawValue, n = this.__v_isShallow || /* @__PURE__ */ Rt(e) || /* @__PURE__ */ Lt(e);
|
|
1161
1161
|
e = n ? e : /* @__PURE__ */ Y(e), ge(e, t) && (this._rawValue = e, this._value = n ? e : Vt(e), process.env.NODE_ENV === "production" ? this.dep.trigger() : this.dep.trigger({
|
|
1162
1162
|
target: this,
|
|
1163
1163
|
type: "set",
|
|
@@ -1186,7 +1186,7 @@ var Xt = {
|
|
|
1186
1186
|
}
|
|
1187
1187
|
};
|
|
1188
1188
|
function Zt(e) {
|
|
1189
|
-
return /* @__PURE__ */
|
|
1189
|
+
return /* @__PURE__ */ It(e) ? e : new Proxy(e, Xt);
|
|
1190
1190
|
}
|
|
1191
1191
|
var Qt = class {
|
|
1192
1192
|
constructor(e, t, n) {
|
|
@@ -1205,7 +1205,7 @@ var Qt = class {
|
|
|
1205
1205
|
return Le(this), e && (e.version = this.dep.version), this._value;
|
|
1206
1206
|
}
|
|
1207
1207
|
set value(e) {
|
|
1208
|
-
this.setter ? this.setter(e) : process.env.NODE_ENV !== "production" &&
|
|
1208
|
+
this.setter ? this.setter(e) : process.env.NODE_ENV !== "production" && we("Write operation failed: computed value is readonly");
|
|
1209
1209
|
}
|
|
1210
1210
|
};
|
|
1211
1211
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -1220,15 +1220,15 @@ function rn(e, t = !1, n = nn) {
|
|
|
1220
1220
|
if (n) {
|
|
1221
1221
|
let t = tn.get(n);
|
|
1222
1222
|
t || tn.set(n, t = []), t.push(e);
|
|
1223
|
-
} else process.env.NODE_ENV !== "production" && !t &&
|
|
1223
|
+
} else process.env.NODE_ENV !== "production" && !t && we("onWatcherCleanup() was called when there was no active watcher to associate with.");
|
|
1224
1224
|
}
|
|
1225
1225
|
function an(e, t, n = A) {
|
|
1226
1226
|
let { immediate: r, deep: i, once: a, scheduler: o, augmentJob: s, call: c } = n, l = (e) => {
|
|
1227
|
-
(n.onWarn ||
|
|
1228
|
-
}, u = (e) => i ? e : /* @__PURE__ */
|
|
1229
|
-
if (/* @__PURE__ */ Ut(e) ? (f = () => e.value, h = /* @__PURE__ */
|
|
1227
|
+
(n.onWarn || we)("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.");
|
|
1228
|
+
}, u = (e) => i ? e : /* @__PURE__ */ Rt(e) || i === !1 || i === 0 ? on(e, 1) : on(e), d, f, p, m, h = !1, g = !1;
|
|
1229
|
+
if (/* @__PURE__ */ Ut(e) ? (f = () => e.value, h = /* @__PURE__ */ Rt(e)) : /* @__PURE__ */ It(e) ? (f = () => u(e), h = !0) : F(e) ? (g = !0, h = e.some((e) => /* @__PURE__ */ It(e) || /* @__PURE__ */ Rt(e)), f = () => e.map((e) => {
|
|
1230
1230
|
if (/* @__PURE__ */ Ut(e)) return e.value;
|
|
1231
|
-
if (/* @__PURE__ */
|
|
1231
|
+
if (/* @__PURE__ */ It(e)) return u(e);
|
|
1232
1232
|
if (I(e)) return c ? c(e, 2) : e();
|
|
1233
1233
|
process.env.NODE_ENV !== "production" && l(e);
|
|
1234
1234
|
})) : I(e) ? f = t ? c ? () => c(e, 2) : e : () => {
|
|
@@ -1646,10 +1646,10 @@ var or = /* @__PURE__ */ Symbol.for("v-ndc"), sr = (e) => e ? Xr(e) ? Qr(e) : sr
|
|
|
1646
1646
|
$: (e) => e,
|
|
1647
1647
|
$el: (e) => e.vnode.el,
|
|
1648
1648
|
$data: (e) => e.data,
|
|
1649
|
-
$props: (e) => process.env.NODE_ENV === "production" ? e.props : /* @__PURE__ */
|
|
1650
|
-
$attrs: (e) => process.env.NODE_ENV === "production" ? e.attrs : /* @__PURE__ */
|
|
1651
|
-
$slots: (e) => process.env.NODE_ENV === "production" ? e.slots : /* @__PURE__ */
|
|
1652
|
-
$refs: (e) => process.env.NODE_ENV === "production" ? e.refs : /* @__PURE__ */
|
|
1649
|
+
$props: (e) => process.env.NODE_ENV === "production" ? e.props : /* @__PURE__ */ Pt(e.props),
|
|
1650
|
+
$attrs: (e) => process.env.NODE_ENV === "production" ? e.attrs : /* @__PURE__ */ Pt(e.attrs),
|
|
1651
|
+
$slots: (e) => process.env.NODE_ENV === "production" ? e.slots : /* @__PURE__ */ Pt(e.slots),
|
|
1652
|
+
$refs: (e) => process.env.NODE_ENV === "production" ? e.refs : /* @__PURE__ */ Pt(e.refs),
|
|
1653
1653
|
$parent: (e) => sr(e.parent),
|
|
1654
1654
|
$root: (e) => sr(e.root),
|
|
1655
1655
|
$host: (e) => e.ce,
|
|
@@ -1834,13 +1834,13 @@ function zr(e, t = null, n = null, r = 0, i = null, a = !1) {
|
|
|
1834
1834
|
if (ri(e) && (e = e.__vccOpts), t) {
|
|
1835
1835
|
t = Br(t);
|
|
1836
1836
|
let { class: e, style: n } = t;
|
|
1837
|
-
e && !de(e) && (t.class = Ce(e)), R(n) && (/* @__PURE__ */
|
|
1837
|
+
e && !de(e) && (t.class = Ce(e)), R(n) && (/* @__PURE__ */ zt(n) && !F(n) && (n = M({}, n)), t.style = ye(n));
|
|
1838
1838
|
}
|
|
1839
1839
|
let o = de(e) ? 1 : Dr(e) ? 128 : ir(e) ? 64 : R(e) ? 4 : I(e) ? 2 : 0;
|
|
1840
|
-
return process.env.NODE_ENV !== "production" && o & 4 && /* @__PURE__ */
|
|
1840
|
+
return process.env.NODE_ENV !== "production" && o & 4 && /* @__PURE__ */ zt(e) && (e = /* @__PURE__ */ Y(e), dn("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.", "\nComponent that was made reactive: ", e)), Lr(e, t, n, r, i, o, a, !0);
|
|
1841
1841
|
}
|
|
1842
1842
|
function Br(e) {
|
|
1843
|
-
return e ? /* @__PURE__ */
|
|
1843
|
+
return e ? /* @__PURE__ */ zt(e) || Tr(e) ? M({}, e) : e : null;
|
|
1844
1844
|
}
|
|
1845
1845
|
function Vr(e, t, n = !1, r = !1) {
|
|
1846
1846
|
let { props: i, ref: a, patchFlag: o, children: s, transition: c } = e, l = t ? Gr(i || {}, t) : i, u = {
|
|
@@ -2004,25 +2004,25 @@ function ai() {
|
|
|
2004
2004
|
s(n),
|
|
2005
2005
|
">"
|
|
2006
2006
|
];
|
|
2007
|
-
} else if (/* @__PURE__ */
|
|
2007
|
+
} else if (/* @__PURE__ */ It(t)) return [
|
|
2008
2008
|
"div",
|
|
2009
2009
|
{},
|
|
2010
2010
|
[
|
|
2011
2011
|
"span",
|
|
2012
2012
|
e,
|
|
2013
|
-
/* @__PURE__ */
|
|
2013
|
+
/* @__PURE__ */ Rt(t) ? "ShallowReactive" : "Reactive"
|
|
2014
2014
|
],
|
|
2015
2015
|
"<",
|
|
2016
2016
|
s(t),
|
|
2017
|
-
`>${/* @__PURE__ */
|
|
2017
|
+
`>${/* @__PURE__ */ Lt(t) ? " (readonly)" : ""}`
|
|
2018
2018
|
];
|
|
2019
|
-
else if (/* @__PURE__ */
|
|
2019
|
+
else if (/* @__PURE__ */ Lt(t)) return [
|
|
2020
2020
|
"div",
|
|
2021
2021
|
{},
|
|
2022
2022
|
[
|
|
2023
2023
|
"span",
|
|
2024
2024
|
e,
|
|
2025
|
-
/* @__PURE__ */
|
|
2025
|
+
/* @__PURE__ */ Rt(t) ? "ShallowReadonly" : "Readonly"
|
|
2026
2026
|
],
|
|
2027
2027
|
"<",
|
|
2028
2028
|
s(t),
|
|
@@ -2114,7 +2114,7 @@ function ai() {
|
|
|
2114
2114
|
if (F(r) && r.includes(t) || R(r) && t in r || e.extends && l(e.extends, t, n) || e.mixins && e.mixins.some((e) => l(e, t, n))) return !0;
|
|
2115
2115
|
}
|
|
2116
2116
|
function u(e) {
|
|
2117
|
-
return /* @__PURE__ */
|
|
2117
|
+
return /* @__PURE__ */ Rt(e) ? "ShallowRef" : e.effect ? "ComputedRef" : "Ref";
|
|
2118
2118
|
}
|
|
2119
2119
|
window.devtoolsFormatters ? window.devtoolsFormatters.push(i) : window.devtoolsFormatters = [i];
|
|
2120
2120
|
}
|
|
@@ -3723,7 +3723,7 @@ function Jo(e) {
|
|
|
3723
3723
|
return t;
|
|
3724
3724
|
}
|
|
3725
3725
|
function H(e, t) {
|
|
3726
|
-
let n = e[0] &&
|
|
3726
|
+
let n = e[0] && U(e[0]) === "system" ? e.slice(1) : e.slice(), r = _e();
|
|
3727
3727
|
return [new a(t ? `${r}\n\n${t}` : r), ...n];
|
|
3728
3728
|
}
|
|
3729
3729
|
async function ye(e, t, n, i) {
|
|
@@ -3854,7 +3854,7 @@ function Jo(e) {
|
|
|
3854
3854
|
content: u
|
|
3855
3855
|
};
|
|
3856
3856
|
}
|
|
3857
|
-
async function
|
|
3857
|
+
async function be(e) {
|
|
3858
3858
|
let t = fe.find((t) => t.name === e.name);
|
|
3859
3859
|
if (!t) {
|
|
3860
3860
|
let t = fe.map((e) => e.name).filter((e) => !e.startsWith("__"));
|
|
@@ -3901,7 +3901,7 @@ function Jo(e) {
|
|
|
3901
3901
|
};
|
|
3902
3902
|
}
|
|
3903
3903
|
}
|
|
3904
|
-
function
|
|
3904
|
+
function U(e) {
|
|
3905
3905
|
return e instanceof i ? "human" : e instanceof r ? "ai" : e instanceof a ? "system" : e instanceof o ? "tool" : "unknown";
|
|
3906
3906
|
}
|
|
3907
3907
|
function xe(e, t) {
|
|
@@ -3909,7 +3909,7 @@ function Jo(e) {
|
|
|
3909
3909
|
}
|
|
3910
3910
|
function Se(e) {
|
|
3911
3911
|
return !se && !k ? [] : e.map((e) => {
|
|
3912
|
-
let t =
|
|
3912
|
+
let t = U(e), n = { role: t === "human" ? "user" : t === "ai" ? "assistant" : t }, r = typeof e.content == "string" ? e.content : JSON.stringify(e.content);
|
|
3913
3913
|
r && (n.content = r.length > Ho ? r.slice(0, Ho) + `…(截断 ${r.length - Ho} 字符)` : r);
|
|
3914
3914
|
let i = e.tool_calls;
|
|
3915
3915
|
Array.isArray(i) && i.length && (n.tool_calls = i.map((e) => ({
|
|
@@ -3955,7 +3955,7 @@ function Jo(e) {
|
|
|
3955
3955
|
tools: fe.map((e) => e.name),
|
|
3956
3956
|
middleware: h.map((e) => e.name)
|
|
3957
3957
|
});
|
|
3958
|
-
let l = Mo(h, (e) => ye(e, n, r)), u = No(h,
|
|
3958
|
+
let l = Mo(h, (e) => ye(e, n, r)), u = No(h, be), d = {
|
|
3959
3959
|
rounds: 0,
|
|
3960
3960
|
maxToolRounds: M,
|
|
3961
3961
|
invokeUsage: {
|
|
@@ -4303,8 +4303,8 @@ function Jo(e) {
|
|
|
4303
4303
|
}), e;
|
|
4304
4304
|
}
|
|
4305
4305
|
let p = c[c.length - 1];
|
|
4306
|
-
if (p &&
|
|
4307
|
-
let e = c[0] &&
|
|
4306
|
+
if (p && U(p) === "tool") {
|
|
4307
|
+
let e = c[0] && U(c[0]) === "system" ? c.slice(1) : c.slice(), i = [new a(_e() + "\n\n工具调用次数已达上限,请基于已有工具结果直接给出最终回答,不要再调用工具。"), ...e];
|
|
4308
4308
|
L("llm_request", {
|
|
4309
4309
|
round: "wrap_up",
|
|
4310
4310
|
model: B(),
|
|
@@ -4357,20 +4357,20 @@ function Jo(e) {
|
|
|
4357
4357
|
}
|
|
4358
4358
|
}
|
|
4359
4359
|
}
|
|
4360
|
-
async function
|
|
4360
|
+
async function we(e, t, n) {
|
|
4361
4361
|
let r = "";
|
|
4362
4362
|
return await Ce(e, (e) => {
|
|
4363
4363
|
e.type === "done" && (r = e.content), n?.(e);
|
|
4364
4364
|
}, t), r;
|
|
4365
4365
|
}
|
|
4366
|
-
function
|
|
4366
|
+
function W(e) {
|
|
4367
4367
|
fe = [...h.flatMap((e) => e.tools || []), ...e], me();
|
|
4368
4368
|
}
|
|
4369
4369
|
function Te(e) {
|
|
4370
4370
|
z = e, me(), A?.(e);
|
|
4371
4371
|
}
|
|
4372
4372
|
return {
|
|
4373
|
-
invoke:
|
|
4373
|
+
invoke: we,
|
|
4374
4374
|
stream: Ce,
|
|
4375
4375
|
getState: () => V,
|
|
4376
4376
|
get allTools() {
|
|
@@ -4380,7 +4380,7 @@ function Jo(e) {
|
|
|
4380
4380
|
resetStaleReadsInvalidated: () => {
|
|
4381
4381
|
I = 0;
|
|
4382
4382
|
},
|
|
4383
|
-
setTools:
|
|
4383
|
+
setTools: W,
|
|
4384
4384
|
setLlm: Te,
|
|
4385
4385
|
setModelCaps: le,
|
|
4386
4386
|
debugLogs: ue,
|
|
@@ -6648,12 +6648,19 @@ function Fl(e = {}) {
|
|
|
6648
6648
|
r = !0, clearTimeout(c);
|
|
6649
6649
|
};
|
|
6650
6650
|
}
|
|
6651
|
+
let c;
|
|
6652
|
+
if (e.previewWrite) try {
|
|
6653
|
+
c = e.previewWrite(n.name, n.args) ?? void 0;
|
|
6654
|
+
} catch {
|
|
6655
|
+
c = void 0;
|
|
6656
|
+
}
|
|
6651
6657
|
n.emit?.({
|
|
6652
6658
|
type: "approval_request",
|
|
6653
6659
|
toolName: n.name,
|
|
6654
6660
|
args: n.args,
|
|
6655
6661
|
resolve: o,
|
|
6656
|
-
hold: s
|
|
6662
|
+
hold: s,
|
|
6663
|
+
...c ? { preview: c } : {}
|
|
6657
6664
|
}), n.logSink?.({
|
|
6658
6665
|
type: "middleware",
|
|
6659
6666
|
data: {
|
|
@@ -9774,11 +9781,110 @@ function Sd(e, n = {}) {
|
|
|
9774
9781
|
...z,
|
|
9775
9782
|
...pe
|
|
9776
9783
|
];
|
|
9784
|
+
function me(e) {
|
|
9785
|
+
let t = e, n = (e) => {
|
|
9786
|
+
if (e === void 0) return "undefined";
|
|
9787
|
+
let t = $(e, 200);
|
|
9788
|
+
return t === void 0 ? String(e) : t;
|
|
9789
|
+
}, r = (e) => typeof e == "string" ? e : String(e?.content ?? "校验失败");
|
|
9790
|
+
if (t.del) {
|
|
9791
|
+
let e = String(t.patch?.jsonPath ?? "");
|
|
9792
|
+
return {
|
|
9793
|
+
ok: !0,
|
|
9794
|
+
intent: "delete",
|
|
9795
|
+
items: [{
|
|
9796
|
+
op: "delete",
|
|
9797
|
+
jsonPath: e,
|
|
9798
|
+
oldSummary: n(Z(c, e)),
|
|
9799
|
+
newSummary: "(删除)"
|
|
9800
|
+
}]
|
|
9801
|
+
};
|
|
9802
|
+
}
|
|
9803
|
+
if (t.patches?.length || t.patch) {
|
|
9804
|
+
let e = t.patches?.length ? t.patches : [{
|
|
9805
|
+
op: t.patch?.op ?? "set",
|
|
9806
|
+
jsonPath: t.patch?.jsonPath ?? "",
|
|
9807
|
+
value: t.patch?.value
|
|
9808
|
+
}], i = dd({
|
|
9809
|
+
bindRef: c,
|
|
9810
|
+
patches: e,
|
|
9811
|
+
schema: o,
|
|
9812
|
+
allowKeys: u,
|
|
9813
|
+
snapshots: h,
|
|
9814
|
+
maxSnapshots: g,
|
|
9815
|
+
markDataDirty: () => {},
|
|
9816
|
+
schemaErrorMode: "zod",
|
|
9817
|
+
dryRun: !0,
|
|
9818
|
+
protectedCtx: m
|
|
9819
|
+
});
|
|
9820
|
+
return i.ok ? {
|
|
9821
|
+
ok: !0,
|
|
9822
|
+
intent: "edit",
|
|
9823
|
+
items: e.map((e) => ({
|
|
9824
|
+
op: String(e.op ?? "set"),
|
|
9825
|
+
jsonPath: String(e.jsonPath ?? ""),
|
|
9826
|
+
oldSummary: n(Z(c, String(e.jsonPath ?? ""))),
|
|
9827
|
+
newSummary: n(e.value)
|
|
9828
|
+
}))
|
|
9829
|
+
} : {
|
|
9830
|
+
ok: !1,
|
|
9831
|
+
intent: "edit",
|
|
9832
|
+
items: [],
|
|
9833
|
+
error: r(i.error)
|
|
9834
|
+
};
|
|
9835
|
+
}
|
|
9836
|
+
let i = Gs(t.value);
|
|
9837
|
+
if (i.parseError) return {
|
|
9838
|
+
ok: !1,
|
|
9839
|
+
intent: "set",
|
|
9840
|
+
items: [],
|
|
9841
|
+
error: `JSON 解析失败:${i.parseError}`
|
|
9842
|
+
};
|
|
9843
|
+
let a = ud({
|
|
9844
|
+
bindRef: c,
|
|
9845
|
+
value: i.parsed,
|
|
9846
|
+
schema: o,
|
|
9847
|
+
allowKeys: u,
|
|
9848
|
+
snapshots: h,
|
|
9849
|
+
maxSnapshots: g,
|
|
9850
|
+
audit: () => {},
|
|
9851
|
+
dryRun: !0,
|
|
9852
|
+
protectedCtx: m,
|
|
9853
|
+
hashFn: O
|
|
9854
|
+
});
|
|
9855
|
+
if (!a.ok) return {
|
|
9856
|
+
ok: !1,
|
|
9857
|
+
intent: "set",
|
|
9858
|
+
items: [],
|
|
9859
|
+
error: r(a.error)
|
|
9860
|
+
};
|
|
9861
|
+
let s = c ?? {}, l = a.data ?? {}, d = (u ?? []).filter((e) => JSON.stringify(s[e]) !== JSON.stringify(l[e]));
|
|
9862
|
+
return {
|
|
9863
|
+
ok: !0,
|
|
9864
|
+
intent: "set",
|
|
9865
|
+
items: d.length ? d.map((e) => ({
|
|
9866
|
+
op: "set",
|
|
9867
|
+
jsonPath: e,
|
|
9868
|
+
oldSummary: n(s[e]),
|
|
9869
|
+
newSummary: n(l[e])
|
|
9870
|
+
})) : [{
|
|
9871
|
+
op: "set",
|
|
9872
|
+
jsonPath: "",
|
|
9873
|
+
oldSummary: n(c),
|
|
9874
|
+
newSummary: n(a.data)
|
|
9875
|
+
}]
|
|
9876
|
+
};
|
|
9877
|
+
}
|
|
9777
9878
|
Object.defineProperty(B, "controller", {
|
|
9778
9879
|
value: oe,
|
|
9779
9880
|
enumerable: !1,
|
|
9780
9881
|
configurable: !1,
|
|
9781
9882
|
writable: !1
|
|
9883
|
+
}), Object.defineProperty(B, "previewWrite", {
|
|
9884
|
+
value: me,
|
|
9885
|
+
enumerable: !1,
|
|
9886
|
+
configurable: !1,
|
|
9887
|
+
writable: !1
|
|
9782
9888
|
});
|
|
9783
9889
|
for (let e of B) Object.defineProperty(e, "__dataOpsScoped", {
|
|
9784
9890
|
value: !0,
|
|
@@ -12106,6 +12212,7 @@ function Lp(e, t) {
|
|
|
12106
12212
|
return c(e, n);
|
|
12107
12213
|
}
|
|
12108
12214
|
var Rp = s(({ selector: e, depth: t, attrs: n, includeText: r }) => {
|
|
12215
|
+
if (typeof document > "u") return "ERROR: get_dom 仅在浏览器环境可用(当前运行在 node/服务端,无 DOM)。请改用数据工具(read/schema_data)排查结构。";
|
|
12109
12216
|
let i = e ? document.querySelector(e) : document.body;
|
|
12110
12217
|
if (!i) return `未找到匹配元素:selector="${e}"`;
|
|
12111
12218
|
let a = Lp(i, {
|
|
@@ -12661,24 +12768,24 @@ function Tm() {
|
|
|
12661
12768
|
}
|
|
12662
12769
|
//#endregion
|
|
12663
12770
|
//#region src/core/sdk/createChatSdk.ts
|
|
12664
|
-
var Em = 30, Dm = /* @__PURE__ */ new Map();
|
|
12665
|
-
function
|
|
12771
|
+
var Em = 30, Dm = 1, Om = 6 * 1024 * 1024, km = /* @__PURE__ */ new Map();
|
|
12772
|
+
function Am(e, t) {
|
|
12666
12773
|
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;
|
|
12667
12774
|
}
|
|
12668
|
-
function
|
|
12775
|
+
function jm(e) {
|
|
12669
12776
|
return e === "spawn_agent" || e === "spawn_agents" || e.startsWith("use_");
|
|
12670
12777
|
}
|
|
12671
|
-
function
|
|
12778
|
+
function Mm(e, t, n, r) {
|
|
12672
12779
|
let i = 0;
|
|
12673
12780
|
return {
|
|
12674
12781
|
name: "sdk-events",
|
|
12675
12782
|
wrapToolCall: async (t, r) => {
|
|
12676
|
-
let i = await r(t), a =
|
|
12783
|
+
let i = await r(t), a = Am(t.name, t.args), o = typeof i.content == "string" && i.content.startsWith("ERROR:");
|
|
12677
12784
|
return a && !o ? e({
|
|
12678
12785
|
type: "data_change",
|
|
12679
12786
|
operation: a,
|
|
12680
12787
|
value: n()?.bind
|
|
12681
|
-
}) : i.status === "done" && !o &&
|
|
12788
|
+
}) : i.status === "done" && !o && jm(t.name) && e({
|
|
12682
12789
|
type: "data_change",
|
|
12683
12790
|
operation: "edit",
|
|
12684
12791
|
value: n()?.bind
|
|
@@ -12706,7 +12813,7 @@ function Am(e, t, n, r) {
|
|
|
12706
12813
|
}
|
|
12707
12814
|
};
|
|
12708
12815
|
}
|
|
12709
|
-
function
|
|
12816
|
+
function Nm(e, t, n, r, i) {
|
|
12710
12817
|
if (!n) return i && console.warn(`[page-agent-sdk][focus] capabilities.focus 关闭,${t} 忽略`), {
|
|
12711
12818
|
ok: !1,
|
|
12712
12819
|
error: "capabilities.focus 关闭"
|
|
@@ -12724,14 +12831,14 @@ function jm(e, t, n, r, i) {
|
|
|
12724
12831
|
error: "当前无主数据 schema,无法聚焦"
|
|
12725
12832
|
});
|
|
12726
12833
|
}
|
|
12727
|
-
function
|
|
12834
|
+
function Pm(e, n) {
|
|
12728
12835
|
let r = {
|
|
12729
12836
|
prompt_tokens: 0,
|
|
12730
12837
|
completion_tokens: 0,
|
|
12731
12838
|
total_tokens: 0
|
|
12732
|
-
}, i = qf(() =>
|
|
12839
|
+
}, i = qf(() => J, () => e.conflictPolicy ?? "ask"), a = /* @__PURE__ */ Wt(0), o = Sp(e.storage);
|
|
12733
12840
|
o && (e.debug && o.onEvent((e) => console.log("[page-agent-sdk][storage]", e)), o.onEvent((e) => {
|
|
12734
|
-
e.type === "quota" &&
|
|
12841
|
+
e.type === "quota" && Y.agent?.debugLogs?.value?.push({
|
|
12735
12842
|
timestamp: Date.now(),
|
|
12736
12843
|
type: "middleware",
|
|
12737
12844
|
data: {
|
|
@@ -12749,14 +12856,14 @@ function Mm(e, n) {
|
|
|
12749
12856
|
}
|
|
12750
12857
|
let m = kp(e, f.contextWindow), g = m.enableLLMSummary !== !1, y = (e.contextOptions && e.contextOptions.preserveLastToolResults) ?? Op[e.contextPreset ?? "auto"], b = new Set(y), x = e.llm;
|
|
12751
12858
|
e.debug && !l && console.warn("[page-agent-sdk][summarization] 未构造 llmInvoke(apiKey 缺失?),摘要回退零成本索引摘要");
|
|
12752
|
-
let S = /* @__PURE__ */
|
|
12859
|
+
let S = /* @__PURE__ */ Mt([]), C = Ou(e.vfs?.initialFiles, {
|
|
12753
12860
|
persist: o ? { save: (e) => {
|
|
12754
|
-
|
|
12861
|
+
Xt({ vfs: e });
|
|
12755
12862
|
} } : void 0,
|
|
12756
12863
|
maxBytes: e.vfs?.maxBytes,
|
|
12757
12864
|
poolBytes: e.vfs?.poolBytes
|
|
12758
12865
|
}), w = uo([], { maxPlanRevisions: e.maxPlanRevisions }), T = Is(), D = _o((e) => {
|
|
12759
|
-
|
|
12866
|
+
Y.agent?.debugLogs?.value?.push({
|
|
12760
12867
|
timestamp: Date.now(),
|
|
12761
12868
|
type: "middleware",
|
|
12762
12869
|
data: {
|
|
@@ -12765,13 +12872,13 @@ function Mm(e, n) {
|
|
|
12765
12872
|
}
|
|
12766
12873
|
});
|
|
12767
12874
|
}), O = Rs(() => {
|
|
12768
|
-
|
|
12875
|
+
Y.agent?.debugLogs?.value?.push({
|
|
12769
12876
|
timestamp: Date.now(),
|
|
12770
12877
|
type: "middleware",
|
|
12771
12878
|
data: { stage: "resume_notice" }
|
|
12772
12879
|
});
|
|
12773
12880
|
}), te, ne = e.approval?.timeoutMs, re = ne !== void 0 && Number.isFinite(ne) && ne > 0 ? ne : ne !== void 0 && (!Number.isFinite(ne) || ne < 0) ? 0 : 3e4, ie = (e) => {
|
|
12774
|
-
|
|
12881
|
+
J({
|
|
12775
12882
|
type: "error",
|
|
12776
12883
|
message: `确认请求(${e.toolName})${Math.round(e.waitedMs / 1e3)}s 无响应已自动拒绝 —— 当前路径无 UI 响应方;可传 approval.timeoutMs 调整(Infinity = 无限等)`,
|
|
12777
12884
|
severity: "observable",
|
|
@@ -12779,7 +12886,7 @@ function Mm(e, n) {
|
|
|
12779
12886
|
context: e
|
|
12780
12887
|
});
|
|
12781
12888
|
}, ae = zl((e) => {
|
|
12782
|
-
te = e,
|
|
12889
|
+
te = e, Xt({ planConfirmation: e }), Y.agent?.debugLogs?.value?.push({
|
|
12783
12890
|
timestamp: Date.now(),
|
|
12784
12891
|
type: "middleware",
|
|
12785
12892
|
data: {
|
|
@@ -12794,7 +12901,7 @@ function Mm(e, n) {
|
|
|
12794
12901
|
}), k = fc({
|
|
12795
12902
|
getSchema: () => U()?.schema,
|
|
12796
12903
|
getBind: () => U()?.bind,
|
|
12797
|
-
onChange: (e) =>
|
|
12904
|
+
onChange: (e) => J({
|
|
12798
12905
|
type: "focus_change",
|
|
12799
12906
|
focuses: e
|
|
12800
12907
|
})
|
|
@@ -12843,14 +12950,14 @@ function Mm(e, n) {
|
|
|
12843
12950
|
vfsStore: V || M?.resources?.length ? C : void 0,
|
|
12844
12951
|
...de.length ? { pgIdPaths: de } : {},
|
|
12845
12952
|
...L.length ? { largeTextPaths: L } : {}
|
|
12846
|
-
}) : [], ve = me ? _e : [], H = me && M ? _e.controller ?? null : null, ye = me && M?.resources?.length && H?.getResourcesSnapshot ? gm({ getResourcesSnapshot: () => H?.getResourcesSnapshot?.() ?? [] }) : void 0, U = () => H?.get() ?? M,
|
|
12953
|
+
}) : [], ve = me ? _e : [], H = me && M ? _e.controller ?? null : null, ye = me && M ? _e.previewWrite : void 0, be = me && M?.resources?.length && H?.getResourcesSnapshot ? gm({ getResourcesSnapshot: () => H?.getResourcesSnapshot?.() ?? [] }) : void 0, U = () => H?.get() ?? M, xe = new Set(_e.map((e) => e.name)), Se = e.conflictWatchFields ?? [], Ce = !Se.includes("*") && Se.length ? new Set(Se) : void 0, we = H ? tf({
|
|
12847
12954
|
getBind: () => U()?.bind,
|
|
12848
12955
|
recomputeAll: () => H.recomputeAllBaselines?.(),
|
|
12849
12956
|
hasBaselines: () => H.hasBaselines?.() ?? !1,
|
|
12850
|
-
isManaged: (e) =>
|
|
12851
|
-
hash: (e) =>
|
|
12957
|
+
isManaged: (e) => xe.has(e),
|
|
12958
|
+
hash: (e) => Ce ? Xs(e, Ce) : Ys(e),
|
|
12852
12959
|
log: (e, t) => {
|
|
12853
|
-
let n =
|
|
12960
|
+
let n = Y.agent?.debugLogs;
|
|
12854
12961
|
n && (n.value.push({
|
|
12855
12962
|
timestamp: Date.now(),
|
|
12856
12963
|
type: "middleware",
|
|
@@ -12860,19 +12967,19 @@ function Mm(e, n) {
|
|
|
12860
12967
|
}
|
|
12861
12968
|
}), Jt(n));
|
|
12862
12969
|
}
|
|
12863
|
-
}) : void 0, W = /* @__PURE__ */ new Map(),
|
|
12970
|
+
}) : void 0, W = /* @__PURE__ */ new Map(), Te = fm(B, ve, Np, B.domInspect && !B.skills ? [
|
|
12864
12971
|
...zp,
|
|
12865
12972
|
Yp,
|
|
12866
12973
|
Xp
|
|
12867
12974
|
] : zp, im);
|
|
12868
|
-
|
|
12869
|
-
let
|
|
12870
|
-
|
|
12871
|
-
let
|
|
12872
|
-
|
|
12873
|
-
let
|
|
12874
|
-
|
|
12875
|
-
let
|
|
12975
|
+
Te.forEach((e) => W.set(e.name, "builtin"));
|
|
12976
|
+
let G = [...e.tools || []];
|
|
12977
|
+
G.forEach((e) => W.set(e.name, "user"));
|
|
12978
|
+
let Ee = sm(e.actions ?? {});
|
|
12979
|
+
Ee.forEach((e) => W.set(e.name, "action"));
|
|
12980
|
+
let De = [], Oe = !1, ke = e.humanConfirm !== !1 && (!e.approval || e.approval.humanConfirmTool !== !1), Ae = ke ? Rl() : null;
|
|
12981
|
+
Ae && W.set(Il, "builtin");
|
|
12982
|
+
let je = fe && z ? [s(async () => {
|
|
12876
12983
|
let e = z.list();
|
|
12877
12984
|
return e.length ? z.restore() ? `已回退到最近一次正常状态(checkpoint #${e[e.length - 1].id})。对话历史、主数据、vfs、todos 已整体还原。请基于回退后的状态重新判断并继续。` : "回退失败:无可用 checkpoint。" : "无可用 checkpoint,无法回退。";
|
|
12878
12985
|
}, {
|
|
@@ -12887,8 +12994,8 @@ function Mm(e, n) {
|
|
|
12887
12994
|
description: "列出可用会话 checkpoint(回退点)。",
|
|
12888
12995
|
schema: t.object({}).optional()
|
|
12889
12996
|
})] : [];
|
|
12890
|
-
|
|
12891
|
-
let
|
|
12997
|
+
je.forEach((e) => W.set(e.name, "builtin"));
|
|
12998
|
+
let Me = B.focus, Ne = s(async ({ path: e, label: t }) => {
|
|
12892
12999
|
let n = U()?.schema;
|
|
12893
13000
|
return n ? Qo(n, e) ? (k.setFocus(A({
|
|
12894
13001
|
path: e,
|
|
@@ -12901,11 +13008,11 @@ function Mm(e, n) {
|
|
|
12901
13008
|
path: t.string().describe("要聚焦的组件 jsonPath,如 components.3"),
|
|
12902
13009
|
label: t.string().optional().describe("人类可读标签,如「导航栏」")
|
|
12903
13010
|
})
|
|
12904
|
-
}),
|
|
13011
|
+
}), Pe = s(async () => (k.clearFocus("agent"), "已清除聚焦,恢复全量可操作范围(可读写所有组件)。"), {
|
|
12905
13012
|
name: "clear_focus",
|
|
12906
13013
|
description: "清除当前聚焦,退出精修模式,恢复对全部组件的读写权限。",
|
|
12907
13014
|
schema: t.object({}).optional()
|
|
12908
|
-
}),
|
|
13015
|
+
}), Fe = s(async ({ path: e, label: t }) => {
|
|
12909
13016
|
let n = U()?.schema;
|
|
12910
13017
|
if (!n) return "聚焦失败:当前无主数据 schema,无法聚焦。";
|
|
12911
13018
|
if (!Qo(n, e)) return `PATH_DENIED · 聚焦失败:path "${e}" 不在 schema 内。请先用 read 查看可操作路径再聚焦。`;
|
|
@@ -12922,7 +13029,7 @@ function Mm(e, n) {
|
|
|
12922
13029
|
path: t.string().describe("要追加聚焦的组件 jsonPath,如 components.3"),
|
|
12923
13030
|
label: t.string().optional().describe("人类可读标签")
|
|
12924
13031
|
})
|
|
12925
|
-
}),
|
|
13032
|
+
}), Ie = s(async ({ path: e }) => {
|
|
12926
13033
|
let t = k.getFocuses().length;
|
|
12927
13034
|
k.removeFocus(e, "agent");
|
|
12928
13035
|
let n = k.getFocuses();
|
|
@@ -12931,91 +13038,92 @@ function Mm(e, n) {
|
|
|
12931
13038
|
name: "remove_focus",
|
|
12932
13039
|
description: "移除单个聚焦焦点(by path),保留其他焦点。移除最后一个等价退出精修。全部退出用 clear_focus。",
|
|
12933
13040
|
schema: t.object({ path: t.string().describe("要移除的焦点 jsonPath") })
|
|
12934
|
-
}),
|
|
12935
|
-
Me,
|
|
13041
|
+
}), Le = Me ? [
|
|
12936
13042
|
Ne,
|
|
12937
13043
|
Pe,
|
|
12938
|
-
Fe
|
|
13044
|
+
Fe,
|
|
13045
|
+
Ie
|
|
12939
13046
|
] : [];
|
|
12940
|
-
|
|
12941
|
-
let
|
|
12942
|
-
function
|
|
12943
|
-
Ii(
|
|
13047
|
+
Le.forEach((e) => W.set(e.name, "builtin"));
|
|
13048
|
+
let Re = [], ze = /* @__PURE__ */ new Map(), K = Be();
|
|
13049
|
+
function Be() {
|
|
13050
|
+
Ii(G), Ii(Ee), Ii(Re);
|
|
12944
13051
|
let { tools: e, collisions: t } = pm([
|
|
12945
13052
|
{
|
|
12946
13053
|
label: "builtin",
|
|
12947
|
-
tools:
|
|
13054
|
+
tools: Te
|
|
12948
13055
|
},
|
|
12949
13056
|
{
|
|
12950
13057
|
label: "user",
|
|
12951
|
-
tools:
|
|
13058
|
+
tools: G
|
|
12952
13059
|
},
|
|
12953
13060
|
{
|
|
12954
13061
|
label: "action",
|
|
12955
|
-
tools:
|
|
13062
|
+
tools: Ee
|
|
12956
13063
|
},
|
|
12957
13064
|
{
|
|
12958
13065
|
label: "humanConfirm",
|
|
12959
|
-
tools:
|
|
13066
|
+
tools: Ae ? [Ae] : []
|
|
12960
13067
|
},
|
|
12961
13068
|
{
|
|
12962
13069
|
label: "checkpoint",
|
|
12963
|
-
tools:
|
|
13070
|
+
tools: je
|
|
12964
13071
|
},
|
|
12965
13072
|
{
|
|
12966
13073
|
label: "focus",
|
|
12967
|
-
tools:
|
|
13074
|
+
tools: Le
|
|
12968
13075
|
},
|
|
12969
13076
|
{
|
|
12970
13077
|
label: "mcp",
|
|
12971
|
-
tools:
|
|
13078
|
+
tools: De
|
|
12972
13079
|
},
|
|
12973
13080
|
{
|
|
12974
13081
|
label: "skill",
|
|
12975
|
-
tools:
|
|
13082
|
+
tools: Re
|
|
12976
13083
|
}
|
|
12977
13084
|
]);
|
|
12978
13085
|
return t.length && console.warn("[page-agent-sdk] 工具重名,后注册覆盖先注册:", t.map((e) => `${e.name}(${e.loser}→${e.winner})`).join(", ")), e;
|
|
12979
13086
|
}
|
|
12980
|
-
let
|
|
12981
|
-
if (
|
|
12982
|
-
if (
|
|
12983
|
-
let
|
|
13087
|
+
let Ve = B.planning, He = B.missionAnchor, Ue = B.workingMemory, We = B.skills, Ge = B.vfs || I;
|
|
13088
|
+
if (Ge) for (let e of Fu) W.set(e, "builtin");
|
|
13089
|
+
if (Ve) for (let e of w.tools ?? []) W.set(e.name, "builtin");
|
|
13090
|
+
let Ke = B.summarization, qe = B.agentCompression && !!d;
|
|
12984
13091
|
e.debug && B.agentCompression && !d && console.warn("[page-agent-sdk][agentCompression] agentCompression 开启但 summaryLlm 不可用(或缺 apiKey / 模型不支持工具),压缩决策不启用,回退静态压缩");
|
|
12985
|
-
let
|
|
12986
|
-
|
|
12987
|
-
let
|
|
13092
|
+
let Je = B.memory, Ye = B.subagent, Xe = Ye ? $c() : void 0, Ze = e.verify?.maxAttempts ?? 2, Qe = !!(e.verify?.check || e.verify?.maxAttempts || e.verify?.adversarial), $e = e.capabilities?.verify === !1, et = (B.verify || Qe && !$e) && e.verify?.enabled !== !1 && Ze > 0, tt = B.contextInspector;
|
|
13093
|
+
Qe && !et && e.verify?.enabled !== !1 && console.warn("[page-agent-sdk][verify] 检测到 verify 配置(check/maxAttempts/adversarial)但未装载(capabilities.verify:false 显式关闭 或 maxAttempts≤0)");
|
|
13094
|
+
let q = e.subagent, nt = q?.allowedTools ?? [], rt = e.permissions?.length ? Pl(e.permissions) : void 0, it = e.approval && (e.approval.tools !== void 0 || e.approval.confirm) ? Fl({
|
|
12988
13095
|
...e.approval,
|
|
12989
13096
|
timeoutMs: e.approval.timeoutMs ?? re,
|
|
12990
|
-
onAutoReject: ie
|
|
13097
|
+
onAutoReject: ie,
|
|
13098
|
+
previewWrite: e.approval.preview === !0 && ye ? (e, t) => e === "write" ? ye(t) : null : void 0
|
|
12991
13099
|
}) : void 0, at = [
|
|
12992
13100
|
...rt ? [rt] : [],
|
|
12993
13101
|
...it ? [it] : [],
|
|
12994
|
-
...
|
|
12995
|
-
], ot = !
|
|
12996
|
-
llm:
|
|
12997
|
-
allTools: () =>
|
|
13102
|
+
...we ? [we] : []
|
|
13103
|
+
], ot = !Ye || q?.enabled === !1 ? void 0 : yl({
|
|
13104
|
+
llm: q?.llm ?? e.llm,
|
|
13105
|
+
allTools: () => Y.agent?.allTools ?? K,
|
|
12998
13106
|
allowedTools: nt.length ? nt : void 0,
|
|
12999
13107
|
...e.staleReadInvalidation === void 0 ? {} : { staleReadInvalidation: e.staleReadInvalidation },
|
|
13000
|
-
systemPrompt:
|
|
13001
|
-
temperature:
|
|
13002
|
-
maxTokens:
|
|
13003
|
-
skills:
|
|
13004
|
-
maxDepth:
|
|
13005
|
-
maxParallel:
|
|
13006
|
-
thinkingMode:
|
|
13108
|
+
systemPrompt: q?.systemPrompt,
|
|
13109
|
+
temperature: q?.temperature,
|
|
13110
|
+
maxTokens: q?.maxTokens,
|
|
13111
|
+
skills: q?.skills,
|
|
13112
|
+
maxDepth: q?.maxDepth,
|
|
13113
|
+
maxParallel: q?.maxParallel,
|
|
13114
|
+
thinkingMode: q?.thinkingMode,
|
|
13007
13115
|
debug: e.debug,
|
|
13008
13116
|
getFocuses: () => k.getActiveFocuses(),
|
|
13009
13117
|
getSchema: () => U()?.schema ?? null,
|
|
13010
|
-
tracker:
|
|
13118
|
+
tracker: Xe,
|
|
13011
13119
|
guardMiddleware: at.length ? at : void 0,
|
|
13012
|
-
getVfsFiles:
|
|
13120
|
+
getVfsFiles: Ge ? () => C.files : void 0,
|
|
13013
13121
|
enterDataScope: H?.enterScope ? (e) => H.enterScope(e) : void 0,
|
|
13014
13122
|
exitDataScope: H?.exitScope ? (e) => H.exitScope(e) : void 0,
|
|
13015
13123
|
onUsage: (e) => {
|
|
13016
13124
|
r.prompt_tokens = (r.prompt_tokens ?? 0) + (e.prompt_tokens ?? 0), r.completion_tokens = (r.completion_tokens ?? 0) + (e.completion_tokens ?? 0), r.total_tokens = (r.total_tokens ?? 0) + (e.total_tokens ?? 0), e.reasoning_tokens && (r.reasoning_tokens = (r.reasoning_tokens ?? 0) + e.reasoning_tokens);
|
|
13017
13125
|
},
|
|
13018
|
-
timeoutMs:
|
|
13126
|
+
timeoutMs: q?.timeoutMs
|
|
13019
13127
|
}), st = ue?.map((e) => {
|
|
13020
13128
|
if (!e._codeAsset) return e;
|
|
13021
13129
|
let t = e._codeAsset, n = Bd({
|
|
@@ -13033,7 +13141,7 @@ function Mm(e, n) {
|
|
|
13033
13141
|
...e,
|
|
13034
13142
|
middleware: r
|
|
13035
13143
|
};
|
|
13036
|
-
}), ct = I &&
|
|
13144
|
+
}), ct = I && Ye ? Vd() : void 0, lt = ct ? Jd({
|
|
13037
13145
|
getBind: () => U()?.bind,
|
|
13038
13146
|
writablePaths: de,
|
|
13039
13147
|
getLocked: () => ct.locked(),
|
|
@@ -13045,18 +13153,18 @@ function Mm(e, n) {
|
|
|
13045
13153
|
}) : void 0, ut = H?.getSummarizedPaths && H.clearSummarizedPaths ? Zd({
|
|
13046
13154
|
getSummarizedPaths: () => H.getSummarizedPaths(),
|
|
13047
13155
|
clearSummarizedPaths: () => H.clearSummarizedPaths()
|
|
13048
|
-
}) : void 0, dt =
|
|
13156
|
+
}) : void 0, dt = Ye && st !== void 0 ? Sl(st, {
|
|
13049
13157
|
llm: e.llm,
|
|
13050
13158
|
thinkingModeDefault: e.subagent?.thinkingMode,
|
|
13051
13159
|
staleReadInvalidation: e.staleReadInvalidation,
|
|
13052
|
-
allTools: () =>
|
|
13160
|
+
allTools: () => Y.agent?.allTools ?? K,
|
|
13053
13161
|
debug: e.debug,
|
|
13054
13162
|
getFocuses: () => k.getActiveFocuses(),
|
|
13055
13163
|
getSchema: () => U()?.schema ?? null,
|
|
13056
13164
|
getBind: () => U()?.bind,
|
|
13057
|
-
tracker:
|
|
13165
|
+
tracker: Xe,
|
|
13058
13166
|
guardMiddleware: at.length ? at : void 0,
|
|
13059
|
-
getVfsFiles:
|
|
13167
|
+
getVfsFiles: Ge ? () => C.files : void 0,
|
|
13060
13168
|
enterDataScope: H?.enterScope ? (e) => H.enterScope(e) : void 0,
|
|
13061
13169
|
exitDataScope: H?.exitScope ? (e) => H.exitScope(e) : void 0,
|
|
13062
13170
|
onUsage: (e) => {
|
|
@@ -13074,7 +13182,7 @@ function Mm(e, n) {
|
|
|
13074
13182
|
...n ? { thinkingMode: n } : {},
|
|
13075
13183
|
thinkingApplied: r
|
|
13076
13184
|
};
|
|
13077
|
-
}, mt = ["read", "fetch_document"], ht = K.filter((e) => mt.includes(e.name)), gt =
|
|
13185
|
+
}, mt = ["read", "fetch_document"], ht = K.filter((e) => mt.includes(e.name)), gt = et ? Yl({
|
|
13078
13186
|
check: e.verify.check ?? tu({
|
|
13079
13187
|
schemas: () => U() ? { "": U().schema } : {},
|
|
13080
13188
|
root: () => U()?.bind
|
|
@@ -13083,12 +13191,12 @@ function Mm(e, n) {
|
|
|
13083
13191
|
llm: e.llm,
|
|
13084
13192
|
tools: ht
|
|
13085
13193
|
} : void 0
|
|
13086
|
-
}) : void 0, _t =
|
|
13194
|
+
}) : void 0, _t = tt ? hu({
|
|
13087
13195
|
contextWindow: f.contextWindow,
|
|
13088
13196
|
thresholdRatio: kp(e, f.contextWindow).summaryThresholdRatio
|
|
13089
13197
|
}) : void 0, vt = hm({
|
|
13090
13198
|
...B,
|
|
13091
|
-
humanConfirm:
|
|
13199
|
+
humanConfirm: ke,
|
|
13092
13200
|
subagents: ue?.map(pt)
|
|
13093
13201
|
}, me && !!M, { promptSoftCap: Jc(f.contextWindow, m.promptSoftCapTokens) }), yt = M ? {
|
|
13094
13202
|
name: "dataHint",
|
|
@@ -13106,7 +13214,7 @@ function Mm(e, n) {
|
|
|
13106
13214
|
return;
|
|
13107
13215
|
}
|
|
13108
13216
|
}
|
|
13109
|
-
} : null, xt = Ep(e.onEvent),
|
|
13217
|
+
} : null, xt = Ep(e.onEvent), J = xt.emit, St, Ct = [], wt = (e) => ({
|
|
13110
13218
|
name: e.name,
|
|
13111
13219
|
description: e.description,
|
|
13112
13220
|
content: typeof e.getContent == "function" ? e.getContent() : ""
|
|
@@ -13123,7 +13231,7 @@ function Mm(e, n) {
|
|
|
13123
13231
|
let n = (e.skills || []).filter((e) => !Ct.some((t) => t.name === e.name));
|
|
13124
13232
|
t.set([...n, ...Ct]);
|
|
13125
13233
|
}
|
|
13126
|
-
|
|
13234
|
+
Y.infoTick.value++;
|
|
13127
13235
|
}, Ot = async () => {
|
|
13128
13236
|
if (Et) try {
|
|
13129
13237
|
let t = await Et.list();
|
|
@@ -13134,54 +13242,54 @@ function Mm(e, n) {
|
|
|
13134
13242
|
let t = (e.skills || []).filter((e) => !Ct.some((t) => t.name === e.name));
|
|
13135
13243
|
n.set([...t, ...Ct]);
|
|
13136
13244
|
}
|
|
13137
|
-
|
|
13245
|
+
Y.infoTick.value++;
|
|
13138
13246
|
}
|
|
13139
13247
|
} catch {}
|
|
13140
|
-
}, kt =
|
|
13248
|
+
}, kt = Ke ? Qc({
|
|
13141
13249
|
...m,
|
|
13142
13250
|
llmInvoke: l,
|
|
13143
13251
|
getRegisteredData: () => U() ? [{ description: U().description ?? "主数据对象" }] : [],
|
|
13144
13252
|
preserveLastToolResults: y,
|
|
13145
|
-
...
|
|
13253
|
+
...qe ? {
|
|
13146
13254
|
decideInvoke: d,
|
|
13147
13255
|
getSnapshot: () => _t?.getSnapshot()
|
|
13148
13256
|
} : {}
|
|
13149
13257
|
}) : void 0, At = jp([
|
|
13150
13258
|
...yt ? [yt] : [],
|
|
13151
13259
|
vt,
|
|
13152
|
-
...
|
|
13260
|
+
...He ? [T] : [],
|
|
13153
13261
|
D,
|
|
13154
13262
|
O,
|
|
13155
|
-
...
|
|
13156
|
-
...
|
|
13157
|
-
readVfs:
|
|
13263
|
+
...Ve ? [w] : [],
|
|
13264
|
+
...We ? [St = Dc([...B.domInspect && !(e.skills || []).some((e) => e.name === Zp.name) ? [Zp] : [], ...e.skills || []], {
|
|
13265
|
+
readVfs: Ge ? (e) => C.files[e]?.content : void 0,
|
|
13158
13266
|
onToolsReady: (e, t) => {
|
|
13159
13267
|
for (let n of t) {
|
|
13160
|
-
let t =
|
|
13161
|
-
t >= 0 &&
|
|
13268
|
+
let t = Re.findIndex((e) => e.name === n.name);
|
|
13269
|
+
t >= 0 && Re.splice(t, 1), Re.push(n), ze.set(n.name, e), W.set(n.name, `skill:${e}`);
|
|
13162
13270
|
}
|
|
13163
|
-
K =
|
|
13271
|
+
K = Be(), Y.agent && Y.agent.setTools(K), Y.infoTick.value++;
|
|
13164
13272
|
}
|
|
13165
13273
|
})] : [],
|
|
13166
|
-
...
|
|
13274
|
+
...Ge ? [Lu(C)] : [],
|
|
13167
13275
|
...kt ? [kt] : [],
|
|
13168
|
-
...
|
|
13169
|
-
...
|
|
13170
|
-
...
|
|
13171
|
-
...
|
|
13276
|
+
...Ue ? [j] : [],
|
|
13277
|
+
...Me ? [k] : [],
|
|
13278
|
+
...be ? [be] : [],
|
|
13279
|
+
...Je ? [oe] : [],
|
|
13172
13280
|
...rt ? [rt] : [],
|
|
13173
13281
|
...fe && pe && z ? [ql(z)] : [],
|
|
13174
|
-
...
|
|
13282
|
+
...ke ? [ae] : [],
|
|
13175
13283
|
...it ? [it] : [],
|
|
13176
|
-
...
|
|
13284
|
+
...we ? [we] : [],
|
|
13177
13285
|
...gt ? [gt] : [],
|
|
13178
13286
|
...ot ? [ot] : [],
|
|
13179
13287
|
...dt ? [dt] : [],
|
|
13180
13288
|
...lt ? [lt] : [],
|
|
13181
13289
|
...ut ? [ut] : [],
|
|
13182
|
-
...H &&
|
|
13290
|
+
...H && Ye ? [ef({
|
|
13183
13291
|
getBind: () => U()?.bind,
|
|
13184
|
-
getTools: () =>
|
|
13292
|
+
getTools: () => Y.agent?.allTools ?? K
|
|
13185
13293
|
})] : [],
|
|
13186
13294
|
...bt ? [bt] : [],
|
|
13187
13295
|
..._t ? [_t] : [],
|
|
@@ -13189,12 +13297,12 @@ function Mm(e, n) {
|
|
|
13189
13297
|
...he ? [am(r, {
|
|
13190
13298
|
tokenBudget: e.tokenBudget,
|
|
13191
13299
|
timeBudgetMs: e.timeBudgetMs
|
|
13192
|
-
},
|
|
13193
|
-
|
|
13300
|
+
}, J)] : [],
|
|
13301
|
+
Mm(J, S, U, r)
|
|
13194
13302
|
]), jt = e.maxMemoryRounds ?? Em;
|
|
13195
|
-
function
|
|
13303
|
+
function Nt(e) {
|
|
13196
13304
|
return (e) => {
|
|
13197
|
-
e.type !== "approval_request" &&
|
|
13305
|
+
e.type !== "approval_request" && J(e);
|
|
13198
13306
|
};
|
|
13199
13307
|
}
|
|
13200
13308
|
let Pt = /* @__PURE__ */ Wt([]);
|
|
@@ -13219,7 +13327,7 @@ function Mm(e, n) {
|
|
|
13219
13327
|
for (let e of Lt) e.abort();
|
|
13220
13328
|
Lt.clear();
|
|
13221
13329
|
}
|
|
13222
|
-
let
|
|
13330
|
+
let Y = {
|
|
13223
13331
|
agentId: n,
|
|
13224
13332
|
store: o,
|
|
13225
13333
|
messages: S,
|
|
@@ -13246,23 +13354,23 @@ function Mm(e, n) {
|
|
|
13246
13354
|
refreshSessions: Ft,
|
|
13247
13355
|
liveData: U,
|
|
13248
13356
|
usage: r,
|
|
13249
|
-
emit:
|
|
13357
|
+
emit: J,
|
|
13250
13358
|
runSerial: It,
|
|
13251
13359
|
trackActive: Rt,
|
|
13252
13360
|
abortAllActive: zt,
|
|
13253
13361
|
unloadSkillTools(e) {
|
|
13254
13362
|
if (e) {
|
|
13255
|
-
let t =
|
|
13256
|
-
if (
|
|
13363
|
+
let t = Re.length;
|
|
13364
|
+
if (Re = Re.filter((t) => ze.get(t.name) === e ? (W.delete(t.name), ze.delete(t.name), !1) : !0), Re.length === t) return;
|
|
13257
13365
|
} else {
|
|
13258
|
-
if (!
|
|
13259
|
-
for (let e of
|
|
13260
|
-
|
|
13366
|
+
if (!Re.length) return;
|
|
13367
|
+
for (let e of Re) W.delete(e.name), ze.delete(e.name);
|
|
13368
|
+
Re = [];
|
|
13261
13369
|
}
|
|
13262
|
-
K =
|
|
13370
|
+
K = Be(), Y.agent && Y.agent.setTools(K);
|
|
13263
13371
|
},
|
|
13264
13372
|
applySnapshot(t) {
|
|
13265
|
-
if (t.vfs && C.hydrate && C.hydrate(t.vfs), t.messages?.length && (S.push(...wi(t.messages, (e) => (e ?
|
|
13373
|
+
if (t.vfs && C.hydrate && C.hydrate(t.vfs), t.messages?.length && (S.push(...wi(t.messages, (e) => (e ? Y.vfsStore?.files?.[e]?.content : void 0) || void 0)), O.markResumed()), t.todos?.length && w.reset(t.todos), t.memory && !e.memory && oe.reset(t.memory), t.checkpoints?.length && z && z.importStack(t.checkpoints), t.usage && Object.assign(r, t.usage), t.mission && He && T.setMission(t.mission), t.workingMemory && Ue && j.restore(t.workingMemory), t.planConfirmation && (te = t.planConfirmation), Me) {
|
|
13266
13374
|
let n = t.focus, r = n ? Array.isArray(n) ? n : [n] : [];
|
|
13267
13375
|
if (r.length) {
|
|
13268
13376
|
let t = U()?.schema, n = t ? r.filter((e) => Qo(t, e.path)) : [];
|
|
@@ -13272,7 +13380,7 @@ function Mm(e, n) {
|
|
|
13272
13380
|
}
|
|
13273
13381
|
}
|
|
13274
13382
|
}
|
|
13275
|
-
|
|
13383
|
+
Ut();
|
|
13276
13384
|
},
|
|
13277
13385
|
addSkill(e) {
|
|
13278
13386
|
let t = Ct.findIndex((t) => t.name === e.name);
|
|
@@ -13294,20 +13402,20 @@ function Mm(e, n) {
|
|
|
13294
13402
|
};
|
|
13295
13403
|
},
|
|
13296
13404
|
afterRound() {
|
|
13297
|
-
|
|
13405
|
+
Gt(), en();
|
|
13298
13406
|
},
|
|
13299
13407
|
clearCodeReuse() {
|
|
13300
13408
|
let e = C;
|
|
13301
13409
|
e.__pgPendingRetry?.clear(), e.__pgLastCheckout?.clear();
|
|
13302
13410
|
},
|
|
13303
13411
|
async send(e, t) {
|
|
13304
|
-
if (await
|
|
13305
|
-
t ??= {}, t?.mission &&
|
|
13412
|
+
if (await Y.initDone, Y.refCount <= 0) throw Error("page-agent-sdk: agent 已释放(unmount),拒绝排队中的 send");
|
|
13413
|
+
t ??= {}, t?.mission && He && T.setMission(t.mission);
|
|
13306
13414
|
let n = e, r = (t.images ?? []).filter((e) => e && (e.dataUri || e.vfsRef || e.url));
|
|
13307
13415
|
if (r.length > 4) throw Error(`[page-agent-sdk] 单轮最多 4 张图片(收到 ${r.length})`);
|
|
13308
|
-
if (r.length && (await
|
|
13416
|
+
if (r.length && (await Qt(r), await $t(r, n)), r.length && !f.vision && !r.every((e) => e.description)) {
|
|
13309
13417
|
let e = "当前主模型不支持图片输入(modelCaps.vision=false)。请换多模态模型(gpt-4o/claude/qwen-vl)或 LLMConfig 声明 vision:true;或配置 images.describe 绑定识图转述(集成方识图子 agent / 自有 vision API)";
|
|
13310
|
-
throw
|
|
13418
|
+
throw J({
|
|
13311
13419
|
type: "error",
|
|
13312
13420
|
message: e,
|
|
13313
13421
|
severity: "recoverable",
|
|
@@ -13315,12 +13423,12 @@ function Mm(e, n) {
|
|
|
13315
13423
|
}), Error(`[page-agent-sdk] ${e}`);
|
|
13316
13424
|
}
|
|
13317
13425
|
C?.setProtectedRefs?.(Cm(S));
|
|
13318
|
-
let a = he ? t.maxAutoRetries ?? 1 : 0, s = 0, c = !1, l =
|
|
13426
|
+
let a = he ? t.maxAutoRetries ?? 1 : 0, s = 0, c = !1, l = Nt(t.signal);
|
|
13319
13427
|
if (t.signal) {
|
|
13320
13428
|
let e = () => i.resolve("keep_external");
|
|
13321
13429
|
t.signal.aborted ? e() : t.signal.addEventListener("abort", e, { once: !0 });
|
|
13322
13430
|
}
|
|
13323
|
-
let u =
|
|
13431
|
+
let u = Y.sessionId;
|
|
13324
13432
|
for (;;) {
|
|
13325
13433
|
c ||= (S.push({
|
|
13326
13434
|
role: "user",
|
|
@@ -13329,25 +13437,25 @@ function Mm(e, n) {
|
|
|
13329
13437
|
...r.length ? { images: r } : {}
|
|
13330
13438
|
}), !0);
|
|
13331
13439
|
try {
|
|
13332
|
-
let e = await
|
|
13333
|
-
if (t.signal?.aborted ||
|
|
13440
|
+
let e = await Y.agent.invoke(S, t.signal, l);
|
|
13441
|
+
if (t.signal?.aborted || Y.sessionId !== u || Y.refCount <= 0) return Y.agent?.debugLogs?.value?.push({
|
|
13334
13442
|
timestamp: Date.now(),
|
|
13335
13443
|
type: "middleware",
|
|
13336
13444
|
data: {
|
|
13337
13445
|
stage: "orphan_round_dropped",
|
|
13338
13446
|
fromSession: u,
|
|
13339
13447
|
aborted: !!t.signal?.aborted,
|
|
13340
|
-
sessionChanged:
|
|
13448
|
+
sessionChanged: Y.sessionId !== u
|
|
13341
13449
|
}
|
|
13342
13450
|
}), e;
|
|
13343
13451
|
if (S.push({
|
|
13344
13452
|
role: "assistant",
|
|
13345
13453
|
content: e,
|
|
13346
13454
|
timestamp: Date.now()
|
|
13347
|
-
}),
|
|
13455
|
+
}), Y.afterRound(), o) try {
|
|
13348
13456
|
await o.flush();
|
|
13349
13457
|
} catch (e) {
|
|
13350
|
-
|
|
13458
|
+
J({
|
|
13351
13459
|
type: "error",
|
|
13352
13460
|
message: `落盘失败(不影响本轮回复):${e instanceof Error ? e.message : String(e)}`,
|
|
13353
13461
|
severity: "observable",
|
|
@@ -13363,7 +13471,7 @@ function Mm(e, n) {
|
|
|
13363
13471
|
code: "MODEL_UNAVAILABLE",
|
|
13364
13472
|
message: e instanceof Error ? e.message : n.message
|
|
13365
13473
|
}), s < a && z?.canRestore()) {
|
|
13366
|
-
s += 1, z.restore(), c = !0,
|
|
13474
|
+
s += 1, z.restore(), c = !0, J({
|
|
13367
13475
|
type: "error",
|
|
13368
13476
|
message: `致命错误自动恢复(${s}/${a}):${n.message},已回退 checkpoint 重试`,
|
|
13369
13477
|
severity: "observable",
|
|
@@ -13375,7 +13483,7 @@ function Mm(e, n) {
|
|
|
13375
13483
|
});
|
|
13376
13484
|
continue;
|
|
13377
13485
|
}
|
|
13378
|
-
throw
|
|
13486
|
+
throw J({
|
|
13379
13487
|
type: "error",
|
|
13380
13488
|
message: n.message,
|
|
13381
13489
|
severity: n.severity,
|
|
@@ -13386,9 +13494,9 @@ function Mm(e, n) {
|
|
|
13386
13494
|
}
|
|
13387
13495
|
},
|
|
13388
13496
|
async batch(e, t, n) {
|
|
13389
|
-
if (await
|
|
13390
|
-
if (
|
|
13391
|
-
let r = [], a =
|
|
13497
|
+
if (await Y.initDone, !e.length) return [];
|
|
13498
|
+
if (Y.refCount <= 0) throw Error("page-agent-sdk: agent 已释放(unmount),拒绝排队中的 batch");
|
|
13499
|
+
let r = [], a = Nt(n);
|
|
13392
13500
|
if (C?.setProtectedRefs?.(Cm(S)), n) {
|
|
13393
13501
|
let e = () => i.resolve("keep_external");
|
|
13394
13502
|
n.aborted ? e() : n.addEventListener("abort", e, { once: !0 });
|
|
@@ -13412,15 +13520,15 @@ function Mm(e, n) {
|
|
|
13412
13520
|
content: s,
|
|
13413
13521
|
timestamp: Date.now()
|
|
13414
13522
|
});
|
|
13415
|
-
let c = await
|
|
13523
|
+
let c = await Y.agent.invoke(S, n, a);
|
|
13416
13524
|
if (S.push({
|
|
13417
13525
|
role: "assistant",
|
|
13418
13526
|
content: c,
|
|
13419
13527
|
timestamp: Date.now()
|
|
13420
|
-
}),
|
|
13528
|
+
}), Y.afterRound(), o) try {
|
|
13421
13529
|
await o.flush();
|
|
13422
13530
|
} catch (e) {
|
|
13423
|
-
|
|
13531
|
+
J({
|
|
13424
13532
|
type: "error",
|
|
13425
13533
|
message: `落盘失败(不影响本任务结果):${e instanceof Error ? e.message : String(e)}`,
|
|
13426
13534
|
severity: "observable",
|
|
@@ -13456,7 +13564,7 @@ function Mm(e, n) {
|
|
|
13456
13564
|
}
|
|
13457
13565
|
ea(a);
|
|
13458
13566
|
let o = di(a, "fatal");
|
|
13459
|
-
|
|
13567
|
+
J({
|
|
13460
13568
|
type: "error",
|
|
13461
13569
|
message: `批量任务 ${i + 1}/${e.length} 失败:${o.message}`,
|
|
13462
13570
|
severity: "observable",
|
|
@@ -13481,27 +13589,27 @@ function Mm(e, n) {
|
|
|
13481
13589
|
return r;
|
|
13482
13590
|
},
|
|
13483
13591
|
async switchSession(t) {
|
|
13484
|
-
if (await
|
|
13485
|
-
if (i.resolve("keep_external"),
|
|
13486
|
-
if (
|
|
13592
|
+
if (await Y.initDone, !o) throw Error("page-agent-sdk: storage 未开启,无法切换会话(请传 storage 选项)");
|
|
13593
|
+
if (i.resolve("keep_external"), Y.sessionId && o) {
|
|
13594
|
+
if (He) {
|
|
13487
13595
|
let e = T.getMission();
|
|
13488
|
-
e &&
|
|
13596
|
+
e && Xt({ mission: e });
|
|
13489
13597
|
}
|
|
13490
|
-
if (
|
|
13598
|
+
if (Ue) {
|
|
13491
13599
|
let e = j.getWorkingMemory();
|
|
13492
|
-
e &&
|
|
13600
|
+
e && Xt({ workingMemory: e });
|
|
13493
13601
|
}
|
|
13494
|
-
if (
|
|
13602
|
+
if (Me) {
|
|
13495
13603
|
let e = k.getFocuses();
|
|
13496
|
-
|
|
13604
|
+
Xt({ focus: e.length ? e : null });
|
|
13497
13605
|
}
|
|
13498
13606
|
}
|
|
13499
13607
|
C.flush?.(), await o.flush();
|
|
13500
13608
|
let r = t ?? "", a;
|
|
13501
|
-
if (r ? (a = await o.load(n, r), a || await o.createSession(n, e.session?.title, r)) : r = await o.createSession(n, e.session?.title),
|
|
13609
|
+
if (r ? (a = await o.load(n, r), a || await o.createSession(n, e.session?.title, r)) : r = await o.createSession(n, e.session?.title), Y.sessionId = r, S.splice(0, S.length), C.clear?.(), w.reset([]), e.memory || oe.reset(""), T.reset(), j.reset(), k.reset(), kt?.reset(), O.reset(), te = void 0, z && z.importStack([]), Y.agent.debugLogs.value = [], Y.agent.resetStaleReadsInvalidated?.(), !a) try {
|
|
13502
13610
|
a = await o.load(n, r);
|
|
13503
13611
|
} catch (e) {
|
|
13504
|
-
|
|
13612
|
+
J({
|
|
13505
13613
|
type: "error",
|
|
13506
13614
|
message: `会话快照载入失败,已降级空会话:${e instanceof Error ? e.message : String(e)}`,
|
|
13507
13615
|
severity: "observable",
|
|
@@ -13509,27 +13617,58 @@ function Mm(e, n) {
|
|
|
13509
13617
|
context: { sessionId: r }
|
|
13510
13618
|
});
|
|
13511
13619
|
}
|
|
13512
|
-
return a && (
|
|
13620
|
+
return a && (Y.applySnapshot(a), J({
|
|
13513
13621
|
type: "session_restored",
|
|
13514
13622
|
sessionId: r,
|
|
13515
13623
|
rounds: a.messages?.length ?? 0
|
|
13516
|
-
})), e.memory &&
|
|
13624
|
+
})), e.memory && Xt({ memory: oe.get() || (typeof e.memory == "string" ? e.memory : "") }), Ft(), Kt = void 0, qt = !1, Y.infoTick.value++, r;
|
|
13625
|
+
},
|
|
13626
|
+
async exportSession(e) {
|
|
13627
|
+
if (!o) throw Error("page-agent-sdk: storage 未开启,无法导出会话(请传 storage 选项)");
|
|
13628
|
+
let t = e || Y.sessionId;
|
|
13629
|
+
if (!t) throw Error("page-agent-sdk: 无可导出的会话");
|
|
13630
|
+
t === Y.sessionId && (en(), C.flush?.(), await o.flush());
|
|
13631
|
+
let r = await o.load(n, t);
|
|
13632
|
+
if (!r) throw Error(`page-agent-sdk: 会话 ${t} 不存在或无可导出内容`);
|
|
13633
|
+
return {
|
|
13634
|
+
formatVersion: Dm,
|
|
13635
|
+
exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13636
|
+
sessionId: t,
|
|
13637
|
+
snapshot: r
|
|
13638
|
+
};
|
|
13639
|
+
},
|
|
13640
|
+
async importSession(t) {
|
|
13641
|
+
if (!o) throw Error("page-agent-sdk: storage 未开启,无法导入会话(请传 storage 选项)");
|
|
13642
|
+
let r = t, i = typeof t == "string" ? t.length : 0;
|
|
13643
|
+
if (typeof t == "string") try {
|
|
13644
|
+
r = JSON.parse(t);
|
|
13645
|
+
} catch {
|
|
13646
|
+
throw Error("page-agent-sdk: 导入内容不是合法 JSON");
|
|
13647
|
+
}
|
|
13648
|
+
let a = r ?? {};
|
|
13649
|
+
if (typeof r != "object" || !r || a.formatVersion !== Dm) throw Error(`page-agent-sdk: 未知会话导出格式(期望 formatVersion=${Dm};请用 sdk.exportSession 的产物)`);
|
|
13650
|
+
let s = a.snapshot;
|
|
13651
|
+
if (!s || typeof s != "object" || !Array.isArray(s.messages)) throw Error("page-agent-sdk: 导入内容缺 snapshot.messages(非会话导出文件)");
|
|
13652
|
+
let c = i || JSON.stringify(a).length;
|
|
13653
|
+
if (c > Om) throw Error(`page-agent-sdk: 导入会话超过 ${Math.floor(Om / 1024 / 1024)}MB 上限(${(c / 1024 / 1024).toFixed(1)}MB)`);
|
|
13654
|
+
let l = await o.createSession(n, e.session?.title);
|
|
13655
|
+
return await o.save(n, l, s), Ft(), { sessionId: l };
|
|
13517
13656
|
},
|
|
13518
13657
|
resetSession: () => {
|
|
13519
|
-
zt(), i.resolve("keep_external"),
|
|
13658
|
+
zt(), i.resolve("keep_external"), Y.sessionId = Jf(), S.splice(0, S.length), C.clear?.(), w.reset([]), e.memory || oe.reset(""), T.reset(), j.reset(), k.reset(), kt?.reset(), O.reset(), te = void 0, z && z.importStack([]), Y.agent && (Y.agent.debugLogs.value = [], Y.agent.resetStaleReadsInvalidated?.()), o && o.createSession(Y.agentId, e.session?.title, Y.sessionId).catch((t) => {
|
|
13520
13659
|
e.debug && console.warn("[page-agent-sdk][persist] createSession 失败(已吞):", t);
|
|
13521
|
-
}),
|
|
13660
|
+
}), J({
|
|
13522
13661
|
type: "session_restored",
|
|
13523
|
-
sessionId:
|
|
13662
|
+
sessionId: Y.sessionId,
|
|
13524
13663
|
rounds: 0
|
|
13525
|
-
}),
|
|
13664
|
+
}), Y.infoTick.value++, Ft(), Kt = void 0, qt = !1;
|
|
13526
13665
|
},
|
|
13527
13666
|
stream: async (e, t, n) => {
|
|
13528
|
-
if (!
|
|
13667
|
+
if (!Y.agent) throw Error("page-agent-sdk: agent 尚未初始化完成,请先 await mount()");
|
|
13529
13668
|
let r = [...e].reverse().find((e) => e.role === "user" && e.images?.length);
|
|
13530
|
-
if (r?.images?.length && (await
|
|
13669
|
+
if (r?.images?.length && (await Qt(r.images), await $t(r.images, r.content), !f.vision && !r.images.every((e) => e.description))) {
|
|
13531
13670
|
let e = "当前主模型不支持图片输入(modelCaps.vision=false)。请换多模态模型(gpt-4o/claude/qwen-vl)或 LLMConfig 声明 vision:true;或配置 images.describe 绑定识图转述";
|
|
13532
|
-
throw
|
|
13671
|
+
throw J({
|
|
13533
13672
|
type: "error",
|
|
13534
13673
|
message: e,
|
|
13535
13674
|
severity: "recoverable",
|
|
@@ -13538,36 +13677,36 @@ function Mm(e, n) {
|
|
|
13538
13677
|
}
|
|
13539
13678
|
C?.setProtectedRefs?.(Cm(e));
|
|
13540
13679
|
let a = (e) => {
|
|
13541
|
-
t?.(e),
|
|
13680
|
+
t?.(e), J(e), e.type === "subagent" && (e.kind === "tool_call" || e.kind === "tool_result") && Y.infoTick.value++;
|
|
13542
13681
|
};
|
|
13543
13682
|
if (n) {
|
|
13544
13683
|
let e = () => i.resolve("keep_external");
|
|
13545
13684
|
n.aborted ? e() : n.addEventListener("abort", e, { once: !0 });
|
|
13546
13685
|
}
|
|
13547
13686
|
let { controller: o, untrack: s } = Rt(n);
|
|
13548
|
-
return
|
|
13687
|
+
return Y.agent.stream(e, a, o.signal).finally(s);
|
|
13549
13688
|
},
|
|
13550
13689
|
release() {
|
|
13551
|
-
if (
|
|
13552
|
-
zt(),
|
|
13553
|
-
let e =
|
|
13554
|
-
e.length && Promise.allSettled(e.map((e) => e())),
|
|
13690
|
+
if (Y.refCount--, Y.refCount <= 0) {
|
|
13691
|
+
zt(), Oe = !0, o && (C.flush?.(), o.flush(), o.dispose()), Et && Et.dispose();
|
|
13692
|
+
let e = Y.mcpClosers.splice(0);
|
|
13693
|
+
e.length && Promise.allSettled(e.map((e) => e())), km.delete(n);
|
|
13555
13694
|
}
|
|
13556
13695
|
},
|
|
13557
13696
|
resolveConflict: i.resolve,
|
|
13558
13697
|
setTools(e) {
|
|
13559
|
-
|
|
13560
|
-
|
|
13561
|
-
}), K =
|
|
13698
|
+
G.length = 0, e.forEach((e) => {
|
|
13699
|
+
G.push(e), W.set(e.name, "user");
|
|
13700
|
+
}), K = Be(), Y.agent && Y.agent.setTools(K), Y.infoTick.value++;
|
|
13562
13701
|
},
|
|
13563
13702
|
addTool(e) {
|
|
13564
13703
|
K.some((t) => t.name === e.name) && console.warn(`[page-agent-sdk] 工具 "${e.name}" 已存在,新工具覆盖(后注册覆盖先注册)`);
|
|
13565
|
-
for (let t =
|
|
13566
|
-
|
|
13704
|
+
for (let t = G.length - 1; t >= 0; t--) G[t].name === e.name && G.splice(t, 1);
|
|
13705
|
+
G.push(e), W.set(e.name, "user"), K = Be(), Y.agent && Y.agent.setTools(K), Y.infoTick.value++;
|
|
13567
13706
|
},
|
|
13568
13707
|
removeTool(e) {
|
|
13569
|
-
let t =
|
|
13570
|
-
return t < 0 ? !1 : (
|
|
13708
|
+
let t = G.findIndex((t) => t.name === e);
|
|
13709
|
+
return t < 0 ? !1 : (G.splice(t, 1), W.delete(e), K = Be(), Y.agent && Y.agent.setTools(K), Y.infoTick.value++, !0);
|
|
13571
13710
|
},
|
|
13572
13711
|
setLlm(t) {
|
|
13573
13712
|
let n;
|
|
@@ -13585,10 +13724,10 @@ function Mm(e, n) {
|
|
|
13585
13724
|
maxOutputTokens: e.maxOutputTokens ?? r?.maxOutputTokens,
|
|
13586
13725
|
vision: r?.vision ?? t.vision
|
|
13587
13726
|
}), f.contextWindow < 2e5) throw Error(`[page-agent-sdk][setLlm] 新模型上下文窗口 ${f.contextWindow} 小于最小支持 ${p}(需 ≥200K 窗口模型)`);
|
|
13588
|
-
|
|
13727
|
+
Y.agent && (Y.agent.setLlm(n), Y.agent.setModelCaps?.(f)), kt?.setContextWindow?.(f.contextWindow), _t?.setContextWindow?.(f.contextWindow), Y.infoTick.value++, e.debug && console.log("[page-agent-sdk][setLlm] 重解析 modelCaps + 回灌:", f);
|
|
13589
13728
|
},
|
|
13590
13729
|
setMemory(e) {
|
|
13591
|
-
oe.reset(e), typeof e == "function" && oe.refresh(),
|
|
13730
|
+
oe.reset(e), typeof e == "function" && oe.refresh(), Y.infoTick.value++;
|
|
13592
13731
|
},
|
|
13593
13732
|
refreshMemory() {
|
|
13594
13733
|
return oe.refresh();
|
|
@@ -13598,33 +13737,33 @@ function Mm(e, n) {
|
|
|
13598
13737
|
e.debug && console.warn("[page-agent-sdk][setSubagents] 未配 subagents:[] 或 capabilities.subagent 关闭,忽略");
|
|
13599
13738
|
return;
|
|
13600
13739
|
}
|
|
13601
|
-
ft.set(t),
|
|
13740
|
+
ft.set(t), Y.infoTick.value++;
|
|
13602
13741
|
},
|
|
13603
13742
|
addSubagent(t) {
|
|
13604
13743
|
if (!ft) {
|
|
13605
13744
|
e.debug && console.warn("[page-agent-sdk][addSubagent] 未配 subagents:[] 或 capabilities.subagent 关闭,忽略");
|
|
13606
13745
|
return;
|
|
13607
13746
|
}
|
|
13608
|
-
ft.add(t),
|
|
13747
|
+
ft.add(t), Y.infoTick.value++;
|
|
13609
13748
|
},
|
|
13610
13749
|
removeSubagent(t) {
|
|
13611
13750
|
if (!ft) return e.debug && console.warn("[page-agent-sdk][removeSubagent] 未配 subagents:[] 或 capabilities.subagent 关闭,忽略"), !1;
|
|
13612
13751
|
let n = ft.remove(t);
|
|
13613
|
-
return n &&
|
|
13752
|
+
return n && Y.infoTick.value++, n;
|
|
13614
13753
|
},
|
|
13615
13754
|
getActiveSubagents() {
|
|
13616
|
-
return
|
|
13755
|
+
return Xe?.getActive() ?? [];
|
|
13617
13756
|
},
|
|
13618
13757
|
get subagentHistory() {
|
|
13619
|
-
return
|
|
13758
|
+
return Xe?.getHistory() ?? [];
|
|
13620
13759
|
},
|
|
13621
13760
|
getInfo() {
|
|
13622
13761
|
return {
|
|
13623
13762
|
id: n,
|
|
13624
|
-
sessionId:
|
|
13763
|
+
sessionId: Y.sessionId,
|
|
13625
13764
|
model: Lf(x) ? x.model ?? x.modelName : x.model,
|
|
13626
|
-
systemPrompt:
|
|
13627
|
-
tools: (
|
|
13765
|
+
systemPrompt: Y.agent?.getEffectiveSystemPrompt?.() ?? ge + Cu(U(), e.schemaHint),
|
|
13766
|
+
tools: (Y.agent?.allTools ?? K).map((e) => ({
|
|
13628
13767
|
name: e.name,
|
|
13629
13768
|
description: e.description,
|
|
13630
13769
|
schema: e.schema,
|
|
@@ -13645,9 +13784,9 @@ function Mm(e, n) {
|
|
|
13645
13784
|
promptSoftCap: Jc(f.contextWindow, m.promptSoftCapTokens)
|
|
13646
13785
|
},
|
|
13647
13786
|
memory: oe.get(),
|
|
13648
|
-
staleReadsInvalidated:
|
|
13787
|
+
staleReadsInvalidated: Y.agent?.getStaleReadsInvalidated?.() ?? 0,
|
|
13649
13788
|
middleware: At.map((e) => e.name),
|
|
13650
|
-
todos: (
|
|
13789
|
+
todos: (Y.agent?.getState?.()?.todos ?? []).map((e) => ({
|
|
13651
13790
|
id: e.id,
|
|
13652
13791
|
content: e.content,
|
|
13653
13792
|
status: e.status,
|
|
@@ -13657,11 +13796,11 @@ function Mm(e, n) {
|
|
|
13657
13796
|
...e.evidence === void 0 ? {} : { evidence: e.evidence }
|
|
13658
13797
|
})),
|
|
13659
13798
|
planPhase: w.getPlanPhase(),
|
|
13660
|
-
mission:
|
|
13799
|
+
mission: He ? T.getMission() : void 0,
|
|
13661
13800
|
planConfirmation: te,
|
|
13662
|
-
workingMemory:
|
|
13663
|
-
focus:
|
|
13664
|
-
focuses:
|
|
13801
|
+
workingMemory: Ue ? j.getWorkingMemory() : void 0,
|
|
13802
|
+
focus: Me ? k.getFocus() : void 0,
|
|
13803
|
+
focuses: Me ? k.getFocuses() : [],
|
|
13665
13804
|
actions: cm(e.actions ?? {}),
|
|
13666
13805
|
subagent: {
|
|
13667
13806
|
enabled: !!ot,
|
|
@@ -13670,28 +13809,28 @@ function Mm(e, n) {
|
|
|
13670
13809
|
timeoutMs: e.subagent?.timeoutMs === void 0 ? 18e5 : e.subagent.timeoutMs > 0 ? e.subagent.timeoutMs : 0,
|
|
13671
13810
|
allowedTools: e.subagent?.allowedTools ?? [],
|
|
13672
13811
|
subagents: (ft?.get() ?? []).map(pt),
|
|
13673
|
-
active:
|
|
13674
|
-
history:
|
|
13812
|
+
active: Xe?.getActive() ?? [],
|
|
13813
|
+
history: Xe?.getHistory() ?? [],
|
|
13675
13814
|
lockedComponents: ct?.locked() ?? {}
|
|
13676
13815
|
},
|
|
13677
13816
|
verify: {
|
|
13678
13817
|
enabled: !!gt,
|
|
13679
|
-
maxAttempts:
|
|
13680
|
-
adversarial:
|
|
13818
|
+
maxAttempts: et ? Ze : 0,
|
|
13819
|
+
adversarial: et && !!e.verify?.adversarial
|
|
13681
13820
|
},
|
|
13682
13821
|
context: (() => {
|
|
13683
13822
|
let e = _t?.getSnapshot();
|
|
13684
13823
|
if (e) {
|
|
13685
|
-
let t =
|
|
13824
|
+
let t = Y.agent?.getState?.()?.lastCompression;
|
|
13686
13825
|
t && (e.compression = t);
|
|
13687
13826
|
}
|
|
13688
13827
|
return e;
|
|
13689
13828
|
})(),
|
|
13690
13829
|
mcp: {
|
|
13691
|
-
servers:
|
|
13692
|
-
...
|
|
13830
|
+
servers: Y.mcpServers,
|
|
13831
|
+
...Y.mcpFailed.length ? { failed: Y.mcpFailed } : {}
|
|
13693
13832
|
},
|
|
13694
|
-
lastCompression:
|
|
13833
|
+
lastCompression: Y.agent?.getState?.()?.lastCompression,
|
|
13695
13834
|
checkpoints: z ? {
|
|
13696
13835
|
enabled: !0,
|
|
13697
13836
|
auto: pe,
|
|
@@ -13700,14 +13839,14 @@ function Mm(e, n) {
|
|
|
13700
13839
|
};
|
|
13701
13840
|
},
|
|
13702
13841
|
exportDiagnostics() {
|
|
13703
|
-
let e =
|
|
13842
|
+
let e = Y.getInfo(), t = {
|
|
13704
13843
|
...e,
|
|
13705
13844
|
tools: e.tools.map(({ schema: e, ...t }) => t),
|
|
13706
13845
|
data: e.data ? {
|
|
13707
13846
|
description: e.data.description,
|
|
13708
13847
|
schemaTopKeys: Yo(e.data.schema) ?? []
|
|
13709
13848
|
} : void 0
|
|
13710
|
-
}, n =
|
|
13849
|
+
}, n = Y.liveData(), r = null;
|
|
13711
13850
|
if (n) {
|
|
13712
13851
|
let e = -1, t = [];
|
|
13713
13852
|
try {
|
|
@@ -13723,56 +13862,56 @@ function Mm(e, n) {
|
|
|
13723
13862
|
};
|
|
13724
13863
|
}
|
|
13725
13864
|
return cf(sf({
|
|
13726
|
-
debugLogs:
|
|
13727
|
-
messages:
|
|
13865
|
+
debugLogs: Y.agent?.debugLogs?.value ?? [],
|
|
13866
|
+
messages: Y.messages,
|
|
13728
13867
|
info: t,
|
|
13729
|
-
usage: { ...
|
|
13730
|
-
pendingConflict:
|
|
13731
|
-
sessionId:
|
|
13868
|
+
usage: { ...Y.usage },
|
|
13869
|
+
pendingConflict: Y.pendingConflict?.value ?? null,
|
|
13870
|
+
sessionId: Y.sessionId,
|
|
13732
13871
|
dataSummary: r
|
|
13733
13872
|
}));
|
|
13734
13873
|
},
|
|
13735
13874
|
getMission() {
|
|
13736
|
-
return
|
|
13875
|
+
return He ? T.getMission() : void 0;
|
|
13737
13876
|
},
|
|
13738
13877
|
setMission(t) {
|
|
13739
|
-
if (!
|
|
13878
|
+
if (!He) {
|
|
13740
13879
|
e.debug && console.warn("[page-agent-sdk][mission] capabilities.missionAnchor 关闭,setMission 忽略");
|
|
13741
13880
|
return;
|
|
13742
13881
|
}
|
|
13743
|
-
T.setMission(t),
|
|
13882
|
+
T.setMission(t), Y.infoTick.value++;
|
|
13744
13883
|
},
|
|
13745
13884
|
getFocus() {
|
|
13746
|
-
return
|
|
13885
|
+
return Me ? k.getFocus() : void 0;
|
|
13747
13886
|
},
|
|
13748
13887
|
getFocuses() {
|
|
13749
|
-
return
|
|
13888
|
+
return Me ? k.getFocuses() : [];
|
|
13750
13889
|
},
|
|
13751
13890
|
setFocus(t) {
|
|
13752
|
-
let n =
|
|
13753
|
-
return n.ok ? (k.setFocus(A(t)), e.debug && k.isInvokeActive() && console.info("[page-agent-sdk][focus] 在途流程进行中,聚焦将在下一次输入生效(当前流程不受影响)"),
|
|
13891
|
+
let n = Nm(t, "setFocus", Me, () => U()?.schema, e.debug);
|
|
13892
|
+
return n.ok ? (k.setFocus(A(t)), e.debug && k.isInvokeActive() && console.info("[page-agent-sdk][focus] 在途流程进行中,聚焦将在下一次输入生效(当前流程不受影响)"), Y.infoTick.value++, { ok: !0 }) : n;
|
|
13754
13893
|
},
|
|
13755
13894
|
addFocus(t) {
|
|
13756
|
-
let n =
|
|
13895
|
+
let n = Nm(t, "addFocus", Me, () => U()?.schema, e.debug);
|
|
13757
13896
|
return n.ok ? k.getFocuses().length >= 8 ? (e.debug && console.warn("[page-agent-sdk][focus] addFocus 拒绝:焦点数已达上限 8(augmentPrompt 注入每焦点子树 schema,过多致 system prompt 超预算)"), {
|
|
13758
13897
|
ok: !1,
|
|
13759
13898
|
error: "焦点数上限 8(避免 system prompt 撑爆)"
|
|
13760
|
-
}) : (k.addFocus(A(t)), e.debug && k.isInvokeActive() && console.info("[page-agent-sdk][focus] 在途流程进行中,聚焦将在下一次输入生效(当前流程不受影响)"),
|
|
13899
|
+
}) : (k.addFocus(A(t)), e.debug && k.isInvokeActive() && console.info("[page-agent-sdk][focus] 在途流程进行中,聚焦将在下一次输入生效(当前流程不受影响)"), Y.infoTick.value++, { ok: !0 }) : n;
|
|
13761
13900
|
},
|
|
13762
13901
|
removeFocus(e) {
|
|
13763
|
-
|
|
13902
|
+
Me && (k.removeFocus(e), Y.infoTick.value++);
|
|
13764
13903
|
},
|
|
13765
13904
|
clearFocus() {
|
|
13766
|
-
|
|
13905
|
+
Me && (k.clearFocus(), Y.infoTick.value++);
|
|
13767
13906
|
}
|
|
13768
13907
|
};
|
|
13769
|
-
async function
|
|
13908
|
+
async function Bt() {
|
|
13770
13909
|
if (!o) return;
|
|
13771
13910
|
let t = async (e) => {
|
|
13772
13911
|
try {
|
|
13773
13912
|
return await o.load(n, e);
|
|
13774
13913
|
} catch (t) {
|
|
13775
|
-
|
|
13914
|
+
J({
|
|
13776
13915
|
type: "error",
|
|
13777
13916
|
message: `会话快照读取失败,已降级空会话:${t instanceof Error ? t.message : String(t)}`,
|
|
13778
13917
|
severity: "observable",
|
|
@@ -13785,7 +13924,7 @@ function Mm(e, n) {
|
|
|
13785
13924
|
try {
|
|
13786
13925
|
return await o.listSessions(n);
|
|
13787
13926
|
} catch (e) {
|
|
13788
|
-
return
|
|
13927
|
+
return J({
|
|
13789
13928
|
type: "error",
|
|
13790
13929
|
message: `会话列表读取失败,已降级新建会话:${e instanceof Error ? e.message : String(e)}`,
|
|
13791
13930
|
severity: "observable",
|
|
@@ -13793,7 +13932,7 @@ function Mm(e, n) {
|
|
|
13793
13932
|
}), [];
|
|
13794
13933
|
}
|
|
13795
13934
|
}, i = Symbol("storage-ready-timeout");
|
|
13796
|
-
await Promise.race([o.ready.then(() => "ready"), new Promise((e) => setTimeout(() => e(i), 5e3))]) === i && (console.warn("[page-agent-sdk][persist] 存储初始化 5s 未就绪(可能被其他标签页锁住),已放行;持久化暂降级内存,就绪后自动恢复"),
|
|
13935
|
+
await Promise.race([o.ready.then(() => "ready"), new Promise((e) => setTimeout(() => e(i), 5e3))]) === i && (console.warn("[page-agent-sdk][persist] 存储初始化 5s 未就绪(可能被其他标签页锁住),已放行;持久化暂降级内存,就绪后自动恢复"), J({
|
|
13797
13936
|
type: "error",
|
|
13798
13937
|
message: "存储初始化 5s 未就绪(IDB blocked?),已放行降级运行",
|
|
13799
13938
|
severity: "observable",
|
|
@@ -13801,31 +13940,31 @@ function Mm(e, n) {
|
|
|
13801
13940
|
}));
|
|
13802
13941
|
let a = e.session || {};
|
|
13803
13942
|
if (a.id) {
|
|
13804
|
-
|
|
13805
|
-
let e = await t(
|
|
13806
|
-
e ? (
|
|
13943
|
+
Y.sessionId = a.id;
|
|
13944
|
+
let e = await t(Y.sessionId);
|
|
13945
|
+
e ? (Y.applySnapshot(e), J({
|
|
13807
13946
|
type: "session_restored",
|
|
13808
|
-
sessionId:
|
|
13947
|
+
sessionId: Y.sessionId,
|
|
13809
13948
|
rounds: e.messages?.length ?? 0
|
|
13810
|
-
})) : await o.createSession(n, a.title,
|
|
13949
|
+
})) : await o.createSession(n, a.title, Y.sessionId);
|
|
13811
13950
|
} else if (a.autoResume !== !1) {
|
|
13812
13951
|
let i = await r();
|
|
13813
13952
|
if (e.debug && console.log("[page-agent-sdk][restore] listSessions", n, i.length, i.map((e) => e.sessionId)), i.length) {
|
|
13814
|
-
|
|
13815
|
-
let n = await t(
|
|
13816
|
-
n ? (
|
|
13953
|
+
Y.sessionId = i[0].sessionId;
|
|
13954
|
+
let n = await t(Y.sessionId);
|
|
13955
|
+
n ? (Y.applySnapshot(n), J({
|
|
13817
13956
|
type: "session_restored",
|
|
13818
|
-
sessionId:
|
|
13957
|
+
sessionId: Y.sessionId,
|
|
13819
13958
|
rounds: n.messages?.length ?? 0
|
|
13820
|
-
}), e.debug && console.log("[page-agent-sdk][restore] 恢复会话",
|
|
13821
|
-
} else
|
|
13822
|
-
} else
|
|
13823
|
-
e.memory &&
|
|
13959
|
+
}), 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);
|
|
13960
|
+
} else Y.sessionId = await o.createSession(n, a.title), e.debug && console.log("[page-agent-sdk][restore] 新建会话(无历史)", Y.sessionId);
|
|
13961
|
+
} else Y.sessionId = await o.createSession(n, a.title);
|
|
13962
|
+
e.memory && Xt({ memory: oe.get() || (typeof e.memory == "string" ? e.memory : "") }), Ft();
|
|
13824
13963
|
}
|
|
13825
|
-
async function
|
|
13964
|
+
async function Vt() {
|
|
13826
13965
|
await Ot();
|
|
13827
13966
|
}
|
|
13828
|
-
function
|
|
13967
|
+
function Ht(e) {
|
|
13829
13968
|
let t = {};
|
|
13830
13969
|
for (let n of Cm(e)) {
|
|
13831
13970
|
let e = C.files[n];
|
|
@@ -13833,15 +13972,15 @@ function Mm(e, n) {
|
|
|
13833
13972
|
}
|
|
13834
13973
|
return t;
|
|
13835
13974
|
}
|
|
13836
|
-
function
|
|
13975
|
+
function Ut() {
|
|
13837
13976
|
let e = wm(C.files, Cm(S));
|
|
13838
13977
|
for (let t of e) delete C.files[t];
|
|
13839
13978
|
}
|
|
13840
|
-
function
|
|
13979
|
+
function Gt() {
|
|
13841
13980
|
let e = Ic(S, jt);
|
|
13842
13981
|
if (!e.trimmed) return;
|
|
13843
13982
|
let { older: t, summary: n } = e;
|
|
13844
|
-
if (
|
|
13983
|
+
if (J({
|
|
13845
13984
|
type: "context_trimmed",
|
|
13846
13985
|
dropped: t.map((e) => ({
|
|
13847
13986
|
round: e.round,
|
|
@@ -13849,24 +13988,24 @@ function Mm(e, n) {
|
|
|
13849
13988
|
assistant: e.assistantMsgs.map((e) => e.content),
|
|
13850
13989
|
steps: e.assistantMsgs.flatMap((e) => e.steps ?? [])
|
|
13851
13990
|
})),
|
|
13852
|
-
vfsResults:
|
|
13991
|
+
vfsResults: Ht(t.flatMap((e) => [e.userMsg, ...e.assistantMsgs])),
|
|
13853
13992
|
summary: n.content,
|
|
13854
13993
|
reason: "max_memory_rounds"
|
|
13855
|
-
}), S.splice(e.deleteFrom, e.deleteCount, n),
|
|
13994
|
+
}), S.splice(e.deleteFrom, e.deleteCount, n), Ut(), g && l) {
|
|
13856
13995
|
let n = e.summary, { prevSeg: r } = e;
|
|
13857
13996
|
(async () => {
|
|
13858
13997
|
try {
|
|
13859
13998
|
let e = await l(Uc(t, b)), i = S.indexOf(n);
|
|
13860
13999
|
if (i < 0) return;
|
|
13861
|
-
S[i].content = Fc(t, r, e),
|
|
14000
|
+
S[i].content = Fc(t, r, e), en();
|
|
13862
14001
|
} catch {}
|
|
13863
14002
|
})();
|
|
13864
14003
|
}
|
|
13865
14004
|
}
|
|
13866
|
-
let
|
|
13867
|
-
function
|
|
14005
|
+
let Kt, qt = !1;
|
|
14006
|
+
function Yt(t, n) {
|
|
13868
14007
|
e.debug && console.warn(`[page-agent-sdk][persist] ${t} 失败(已吞):`, n);
|
|
13869
|
-
let r =
|
|
14008
|
+
let r = Y.agent?.debugLogs;
|
|
13870
14009
|
r && r.value.push({
|
|
13871
14010
|
timestamp: Date.now(),
|
|
13872
14011
|
type: "middleware",
|
|
@@ -13877,33 +14016,33 @@ function Mm(e, n) {
|
|
|
13877
14016
|
}
|
|
13878
14017
|
});
|
|
13879
14018
|
}
|
|
13880
|
-
function
|
|
13881
|
-
!
|
|
14019
|
+
function Xt(e) {
|
|
14020
|
+
!Y.sessionId || !o || o.save(n, Y.sessionId, e).catch((e) => Yt("save", e));
|
|
13882
14021
|
}
|
|
13883
|
-
function
|
|
13884
|
-
o && o.updateTitle(n, e, t).catch((e) =>
|
|
14022
|
+
function Zt(e, t) {
|
|
14023
|
+
o && o.updateTitle(n, e, t).catch((e) => Yt("updateTitle", e));
|
|
13885
14024
|
}
|
|
13886
|
-
async function
|
|
14025
|
+
async function Qt(t) {
|
|
13887
14026
|
let n = e.images?.upload;
|
|
13888
14027
|
for (let e of t) {
|
|
13889
14028
|
try {
|
|
13890
14029
|
e.dataUri && !e.thumb && (e.thumb = await ki(e.dataUri));
|
|
13891
14030
|
} catch (e) {
|
|
13892
|
-
|
|
14031
|
+
Yt("imageThumb", e);
|
|
13893
14032
|
}
|
|
13894
14033
|
if (n && e.dataUri && !e.url) try {
|
|
13895
14034
|
let t = await n(e.dataUri, e);
|
|
13896
|
-
t && (e.url = t, e.dataUri = void 0, e.vfsRef &&
|
|
14035
|
+
t && (e.url = t, e.dataUri = void 0, e.vfsRef && Y.vfsStore && delete Y.vfsStore.files[e.vfsRef]);
|
|
13897
14036
|
} catch (e) {
|
|
13898
14037
|
console.warn("[page-agent-sdk][images] upload 失败,回退 dataURI 内联直发:", e?.message ?? e);
|
|
13899
14038
|
}
|
|
13900
|
-
e.dataUri && !e.vfsRef &&
|
|
14039
|
+
e.dataUri && !e.vfsRef && Y.vfsStore && (e.vfsRef = `userImages/${e.id}`, Y.vfsStore.files[e.vfsRef] = {
|
|
13901
14040
|
content: e.dataUri,
|
|
13902
14041
|
updatedAt: Date.now()
|
|
13903
14042
|
});
|
|
13904
14043
|
}
|
|
13905
14044
|
}
|
|
13906
|
-
async function
|
|
14045
|
+
async function $t(t, n) {
|
|
13907
14046
|
let r = e.images?.describe;
|
|
13908
14047
|
if (f.vision || !r) return;
|
|
13909
14048
|
let i = e.images?.describeTimeoutMs ?? 15e3;
|
|
@@ -13915,7 +14054,7 @@ function Mm(e, n) {
|
|
|
13915
14054
|
clearTimeout(a);
|
|
13916
14055
|
}
|
|
13917
14056
|
} catch (t) {
|
|
13918
|
-
e.description = "[图片描述不可用]",
|
|
14057
|
+
e.description = "[图片描述不可用]", J({
|
|
13919
14058
|
type: "error",
|
|
13920
14059
|
message: `识图转述失败:${t?.message ?? String(t)}`,
|
|
13921
14060
|
severity: "observable",
|
|
@@ -13923,43 +14062,43 @@ function Mm(e, n) {
|
|
|
13923
14062
|
});
|
|
13924
14063
|
}
|
|
13925
14064
|
}
|
|
13926
|
-
function
|
|
13927
|
-
if (!
|
|
13928
|
-
if (
|
|
14065
|
+
function en() {
|
|
14066
|
+
if (!Y.sessionId || !o) return;
|
|
14067
|
+
if (Xt({ messages: Ci(JSON.parse(JSON.stringify(S))) }), Xt({ todos: Y.agent?.getState?.()?.todos ?? [] }), Xt({ planConfirmation: te }), He) {
|
|
13929
14068
|
let e = T.getMission();
|
|
13930
|
-
e &&
|
|
14069
|
+
e && Xt({ mission: e });
|
|
13931
14070
|
}
|
|
13932
|
-
if (
|
|
14071
|
+
if (Ue) {
|
|
13933
14072
|
let e = j.getWorkingMemory();
|
|
13934
|
-
e &&
|
|
14073
|
+
e && Xt({ workingMemory: e });
|
|
13935
14074
|
}
|
|
13936
|
-
if (
|
|
14075
|
+
if (Me) {
|
|
13937
14076
|
let e = k.getFocuses();
|
|
13938
|
-
|
|
14077
|
+
Xt({ focus: e.length ? e : null });
|
|
13939
14078
|
}
|
|
13940
|
-
he && z && (
|
|
14079
|
+
he && z && (Xt({ checkpoints: z.exportStack() }), Xt({ usage: r }));
|
|
13941
14080
|
let t = Ff(S);
|
|
13942
|
-
if (t && t !==
|
|
13943
|
-
|
|
13944
|
-
let e =
|
|
14081
|
+
if (t && t !== Kt && (Kt = t, Zt(Y.sessionId, t)), e.autoTitle !== !1 && u && !qt && S.some((e) => e.role === "user") && S.some((e) => e.role === "assistant")) {
|
|
14082
|
+
qt = !0;
|
|
14083
|
+
let e = Y.sessionId;
|
|
13945
14084
|
(async () => {
|
|
13946
14085
|
try {
|
|
13947
14086
|
let t = await u(S);
|
|
13948
|
-
if (t &&
|
|
14087
|
+
if (t && Y.refCount > 0 && Y.sessionId === e) {
|
|
13949
14088
|
try {
|
|
13950
14089
|
await o.updateTitle(n, e, t);
|
|
13951
14090
|
} catch (e) {
|
|
13952
|
-
|
|
14091
|
+
Yt("updateTitle", e);
|
|
13953
14092
|
}
|
|
13954
14093
|
await Ft();
|
|
13955
14094
|
}
|
|
13956
14095
|
} catch {}
|
|
13957
14096
|
})();
|
|
13958
14097
|
}
|
|
13959
|
-
e.debug && console.log("[page-agent-sdk][persist] save",
|
|
14098
|
+
e.debug && console.log("[page-agent-sdk][persist] save", Y.sessionId, `${S.length} msgs`);
|
|
13960
14099
|
}
|
|
13961
|
-
return
|
|
13962
|
-
await
|
|
14100
|
+
return Y.initDone = (async () => {
|
|
14101
|
+
await Bt(), await Vt(), e.mcp?.length && (async () => {
|
|
13963
14102
|
let t = async (e) => {
|
|
13964
14103
|
let t;
|
|
13965
14104
|
for (let n = 0; n < 3; n++) try {
|
|
@@ -13978,11 +14117,11 @@ function Mm(e, n) {
|
|
|
13978
14117
|
let o = a.name ?? a.url, s = !1;
|
|
13979
14118
|
try {
|
|
13980
14119
|
let e = await t(a);
|
|
13981
|
-
if (
|
|
14120
|
+
if (Oe) {
|
|
13982
14121
|
e.close();
|
|
13983
14122
|
return;
|
|
13984
14123
|
}
|
|
13985
|
-
|
|
14124
|
+
Y.mcpClosers.push(e.close), Y.mcpServers.push({
|
|
13986
14125
|
name: o,
|
|
13987
14126
|
url: a.url,
|
|
13988
14127
|
toolCount: e.tools.length
|
|
@@ -13991,17 +14130,17 @@ function Mm(e, n) {
|
|
|
13991
14130
|
console.warn(`[page-agent-sdk][mcp] 工具 "${e.name}" 与内置工具重名,已拒绝注入(安全保留字保护)`);
|
|
13992
14131
|
return;
|
|
13993
14132
|
}
|
|
13994
|
-
W.set(e.name, `mcp:${o}`),
|
|
13995
|
-
}), s && (K =
|
|
14133
|
+
W.set(e.name, `mcp:${o}`), De.push(e), s = !0;
|
|
14134
|
+
}), s && (K = Be(), Y.agent && Y.agent.setTools(K), Y.infoTick.value++);
|
|
13996
14135
|
} catch (e) {
|
|
13997
|
-
if (
|
|
14136
|
+
if (Oe) return;
|
|
13998
14137
|
console.warn(`[page-agent-sdk][mcp] server ${o} 连接失败:`, e);
|
|
13999
14138
|
let t = String(e?.message ?? e ?? "").slice(0, 200);
|
|
14000
|
-
|
|
14139
|
+
Y.mcpFailed.push({
|
|
14001
14140
|
name: o,
|
|
14002
14141
|
url: a.url,
|
|
14003
14142
|
error: t
|
|
14004
|
-
}),
|
|
14143
|
+
}), J({
|
|
14005
14144
|
type: "error",
|
|
14006
14145
|
message: `MCP server「${o}」连接失败,其工具不可用:${t}`,
|
|
14007
14146
|
severity: "observable",
|
|
@@ -14012,18 +14151,18 @@ function Mm(e, n) {
|
|
|
14012
14151
|
}
|
|
14013
14152
|
});
|
|
14014
14153
|
} finally {
|
|
14015
|
-
r++, r === i && e.debug && console.log(`[page-agent-sdk][mcp] 注入 ${
|
|
14154
|
+
r++, r === i && e.debug && console.log(`[page-agent-sdk][mcp] 注入 ${De.length} 个工具,${Y.mcpServers.length} 个 server`);
|
|
14016
14155
|
}
|
|
14017
14156
|
}));
|
|
14018
14157
|
})();
|
|
14019
14158
|
let t = Lf(e.llm) ? e.llm : await ee(e.llm);
|
|
14020
|
-
|
|
14159
|
+
Y.agent = Jo({
|
|
14021
14160
|
llm: t,
|
|
14022
14161
|
systemPrompt: ge,
|
|
14023
14162
|
tools: K,
|
|
14024
14163
|
middleware: At,
|
|
14025
14164
|
maxToolRounds: e.maxToolRounds,
|
|
14026
|
-
hasSubagent:
|
|
14165
|
+
hasSubagent: Ye,
|
|
14027
14166
|
maxRetries: e.maxRetries,
|
|
14028
14167
|
stallMs: e.streamStallMs ?? 9e4,
|
|
14029
14168
|
streamMaxMs: e.streamMaxDurationMs ?? 18e5,
|
|
@@ -14033,23 +14172,23 @@ function Mm(e, n) {
|
|
|
14033
14172
|
maxOutputTokens: f.maxOutputTokens,
|
|
14034
14173
|
vision: f.vision,
|
|
14035
14174
|
imageContentFormat: !Lf(e.llm) && (e.llm.provider ?? "openai") === "anthropic" ? "anthropic" : "openai",
|
|
14036
|
-
maxVerifyAttempts:
|
|
14175
|
+
maxVerifyAttempts: et ? Ze : 0,
|
|
14037
14176
|
roundTokenBudget: e.roundTokenBudget ?? 0,
|
|
14038
14177
|
staleReadInvalidation: e.staleReadInvalidation,
|
|
14039
14178
|
onLlmChange: (e) => {
|
|
14040
14179
|
x = e;
|
|
14041
14180
|
},
|
|
14042
14181
|
debug: e.debug
|
|
14043
|
-
}), se.current =
|
|
14044
|
-
|
|
14182
|
+
}), se.current = Y.agent, dt && dt.setReconfigureHook && dt.setReconfigureHook(() => {
|
|
14183
|
+
Y.agent && Y.agent.setTools(Be());
|
|
14045
14184
|
});
|
|
14046
|
-
})(),
|
|
14185
|
+
})(), Y;
|
|
14047
14186
|
}
|
|
14048
|
-
function
|
|
14187
|
+
function Fm(e, t) {
|
|
14049
14188
|
let n = e.id ?? Jf();
|
|
14050
14189
|
e.id || console.warn(`[page-agent-sdk] 未传 options.id,已生成随机 id "${n}"。刷新后持久化数据无法恢复,请传稳定 id。`);
|
|
14051
|
-
let r = e.streaming ?? !0, i = e.ui ?? "default", a, o = e.shareContext ?
|
|
14052
|
-
o ? a = o : (a =
|
|
14190
|
+
let r = e.streaming ?? !0, i = e.ui ?? "default", a, o = e.shareContext ? km.get(n) : void 0;
|
|
14191
|
+
o ? a = o : (a = Pm(e, n), e.shareContext && km.set(n, a)), a.refCount++;
|
|
14053
14192
|
let s = null, c = Cp(e), l = null, u = null;
|
|
14054
14193
|
async function d(n) {
|
|
14055
14194
|
if (await a.initDone, s) {
|
|
@@ -14118,6 +14257,12 @@ function Nm(e, t) {
|
|
|
14118
14257
|
}
|
|
14119
14258
|
}),
|
|
14120
14259
|
switchSession: (...e) => a.runSerial(async () => (a.abortAllActive(), a.switchSession(...e))),
|
|
14260
|
+
async exportSession(e) {
|
|
14261
|
+
return a.runSerial(() => a.exportSession(e));
|
|
14262
|
+
},
|
|
14263
|
+
async importSession(e) {
|
|
14264
|
+
return a.runSerial(() => a.importSession(e));
|
|
14265
|
+
},
|
|
14121
14266
|
resetSession: () => a.resetSession(),
|
|
14122
14267
|
sessions: a.sessions,
|
|
14123
14268
|
async listSessions() {
|
|
@@ -14273,7 +14418,7 @@ function Nm(e, t) {
|
|
|
14273
14418
|
}
|
|
14274
14419
|
//#endregion
|
|
14275
14420
|
//#region src/core/sdk/ragSubagent.ts
|
|
14276
|
-
function
|
|
14421
|
+
function Im(e, t, n, r, i) {
|
|
14277
14422
|
let a = [];
|
|
14278
14423
|
e && a.push("vfs_grep + vfs_read(搜预注入文档)"), t && a.push(`${r}(语义检索)`), n && a.push(`${i}(按 source 加载)`), a.push("fetch_document(公网 URL)");
|
|
14279
14424
|
let o = [];
|
|
@@ -14288,7 +14433,7 @@ function Pm(e, t, n, r, i) {
|
|
|
14288
14433
|
|
|
14289
14434
|
你是只读检索角色,不要尝试修改任何数据。不要尝试上面未列出的工具。`;
|
|
14290
14435
|
}
|
|
14291
|
-
function
|
|
14436
|
+
function Lm(e, t, n, r, i) {
|
|
14292
14437
|
let a = [], o = [];
|
|
14293
14438
|
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)
|
|
14294
14439
|
|
|
@@ -14305,12 +14450,12 @@ ${a.join("\n")}
|
|
|
14305
14450
|
## 何时用何源
|
|
14306
14451
|
${o.join("\n")}`;
|
|
14307
14452
|
}
|
|
14308
|
-
var
|
|
14453
|
+
var Rm = {
|
|
14309
14454
|
name: "rag-search",
|
|
14310
14455
|
description: "多源知识检索策略:vfs 预注入文档 → 语义检索 → 指定文档加载 → 公网;综合结构化结论 + 溯源",
|
|
14311
|
-
getContent: () =>
|
|
14456
|
+
getContent: () => Lm(!0, !0, !0, "search_docs", "load_doc")
|
|
14312
14457
|
};
|
|
14313
|
-
function
|
|
14458
|
+
function zm(e, n, r) {
|
|
14314
14459
|
let i = s(async ({ query: e, topK: t }) => {
|
|
14315
14460
|
try {
|
|
14316
14461
|
let i = await n(e, { topK: t ?? r });
|
|
@@ -14328,7 +14473,7 @@ function Lm(e, n, r) {
|
|
|
14328
14473
|
});
|
|
14329
14474
|
return Ii([i]), i;
|
|
14330
14475
|
}
|
|
14331
|
-
function
|
|
14476
|
+
function Bm(e, n) {
|
|
14332
14477
|
let r = s(async ({ source: e }) => {
|
|
14333
14478
|
try {
|
|
14334
14479
|
let t = await n(e), r = Array.isArray(t) ? t : [t];
|
|
@@ -14343,19 +14488,19 @@ function Rm(e, n) {
|
|
|
14343
14488
|
});
|
|
14344
14489
|
return Ii([r]), r;
|
|
14345
14490
|
}
|
|
14346
|
-
function
|
|
14491
|
+
function Vm(e) {
|
|
14347
14492
|
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;
|
|
14348
14493
|
if (!t && !n && r === !1) throw Error("[page-agent-sdk][createRagSubagent] 至少配一种知识源:retriever / loader / useVfs(true)");
|
|
14349
14494
|
let p = [];
|
|
14350
|
-
t && p.push(
|
|
14495
|
+
t && p.push(zm(s, t, o)), n && p.push(Bm(c, n)), f && p.push(...f);
|
|
14351
14496
|
let m = r ? [
|
|
14352
14497
|
"vfs_grep",
|
|
14353
14498
|
"vfs_read",
|
|
14354
14499
|
"vfs_json_read"
|
|
14355
|
-
] : void 0, h =
|
|
14500
|
+
] : void 0, h = Im(r, !!t, !!n, s, c), g = {
|
|
14356
14501
|
name: "rag-search",
|
|
14357
|
-
description:
|
|
14358
|
-
getContent: () =>
|
|
14502
|
+
description: Rm.description,
|
|
14503
|
+
getContent: () => Lm(r, !!t, !!n, s, c)
|
|
14359
14504
|
};
|
|
14360
14505
|
return {
|
|
14361
14506
|
id: i,
|
|
@@ -14369,8 +14514,82 @@ function zm(e) {
|
|
|
14369
14514
|
};
|
|
14370
14515
|
}
|
|
14371
14516
|
//#endregion
|
|
14517
|
+
//#region src/core/sdk/evalToolkit.ts
|
|
14518
|
+
function Hm(e = {}) {
|
|
14519
|
+
let t = e.quietMs ?? 9e4, n = e.confirmSamples ?? 3, r = e.baselineMessageCount ?? 0, i = 0;
|
|
14520
|
+
return {
|
|
14521
|
+
push(e) {
|
|
14522
|
+
return e.quietMs > 0xe8d4a51000 ? (i = 0, "reset") : (i = e.messageCount > r && e.hasResponse && e.activeSubagents === 0 && e.quietMs > t ? i + 1 : 0, i >= n ? "done" : "pending");
|
|
14523
|
+
},
|
|
14524
|
+
reset() {
|
|
14525
|
+
i = 0;
|
|
14526
|
+
}
|
|
14527
|
+
};
|
|
14528
|
+
}
|
|
14529
|
+
var Um = /* @__PURE__ */ new Set(["elapsedSec"]);
|
|
14530
|
+
function Wm(e, t, n = {}) {
|
|
14531
|
+
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 ?? {})]);
|
|
14532
|
+
for (let n of u) {
|
|
14533
|
+
let u = Number(e?.[n] ?? 0), d = Number(t?.[n] ?? 0), f = u - d, p = d > 0 ? Math.round(f / d * 100) : 0, m = "";
|
|
14534
|
+
Um.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({
|
|
14535
|
+
key: n,
|
|
14536
|
+
prev: d,
|
|
14537
|
+
cur: u,
|
|
14538
|
+
delta: f,
|
|
14539
|
+
pct: p,
|
|
14540
|
+
flag: m
|
|
14541
|
+
});
|
|
14542
|
+
}
|
|
14543
|
+
return {
|
|
14544
|
+
status: c > 0 ? "worse" : l > 0 ? "better" : "ok",
|
|
14545
|
+
regressions: s,
|
|
14546
|
+
fields: o
|
|
14547
|
+
};
|
|
14548
|
+
}
|
|
14549
|
+
function Gm(e) {
|
|
14550
|
+
let { sdk: t } = e, n = () => {
|
|
14551
|
+
let e = t.debugLogs.value ?? [], n = e.length ? e[e.length - 1].timestamp : 0;
|
|
14552
|
+
return {
|
|
14553
|
+
messageCount: t.messages?.length ?? 0,
|
|
14554
|
+
quietMs: n ? Date.now() - n : 2 ** 53 - 1,
|
|
14555
|
+
hasResponse: e.some((e) => e.type === "llm_response"),
|
|
14556
|
+
activeSubagents: t.inspect?.().subagent?.active?.length ?? 0,
|
|
14557
|
+
logCount: e.length
|
|
14558
|
+
};
|
|
14559
|
+
};
|
|
14560
|
+
return {
|
|
14561
|
+
async waitForIdle(e = {}) {
|
|
14562
|
+
let { timeoutMs: r = 6e5, sampleMs: i = 2500, onSample: a, ...o } = e, s = Hm(o), c = Date.now();
|
|
14563
|
+
for (;;) {
|
|
14564
|
+
let e = n(), o = s.push(e);
|
|
14565
|
+
if (a?.(e), o === "done") return e;
|
|
14566
|
+
if (o === "reset") throw Error(`eval: 等待 idle 期间日志被清空(会话切换/重置;logCount=${e.logCount})—— 采样口径已失效`);
|
|
14567
|
+
if (Date.now() - c > r) {
|
|
14568
|
+
let n = t.debugLogs.value ?? [], i = [...n].reverse().find((e) => e.type === "tool_result"), a = [...n].reverse().find((e) => e.type === "llm_request"), o = t.inspect?.().subagent?.active ?? [];
|
|
14569
|
+
throw Error(`eval: 等待 agent idle 超时(${Math.round(r / 1e3)}s)。诊断:msgs=${e.messageCount} logs=${e.logCount} lastRound=${String(a?.data?.round ?? "-")} lastTool=${i ? `${String(i.data?.name)}@${String(i.data?.round)}` : "-"} activeSubagents=${o.length}${o.length ? `(${o.map((e) => String(e.label ?? "?")).join(",")})` : ""}`);
|
|
14570
|
+
}
|
|
14571
|
+
await new Promise((e) => setTimeout(e, i));
|
|
14572
|
+
}
|
|
14573
|
+
},
|
|
14574
|
+
collectReport() {
|
|
14575
|
+
let e = t.debugLogs.value ?? [], n = t.usage;
|
|
14576
|
+
return {
|
|
14577
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14578
|
+
messageCount: t.messages?.length ?? 0,
|
|
14579
|
+
toolCount: e.filter((e) => e.type === "tool_result").length,
|
|
14580
|
+
usage: {
|
|
14581
|
+
prompt: n?.prompt ?? 0,
|
|
14582
|
+
completion: n?.completion ?? 0,
|
|
14583
|
+
...n?.cacheRead ? { cacheRead: n.cacheRead } : {},
|
|
14584
|
+
...n?.cacheCreate ? { cacheCreate: n.cacheCreate } : {}
|
|
14585
|
+
}
|
|
14586
|
+
};
|
|
14587
|
+
}
|
|
14588
|
+
};
|
|
14589
|
+
}
|
|
14590
|
+
//#endregion
|
|
14372
14591
|
//#region src/core/utils/clipboard.ts
|
|
14373
|
-
async function
|
|
14592
|
+
async function Km(e) {
|
|
14374
14593
|
try {
|
|
14375
14594
|
let t = globalThis.navigator?.clipboard;
|
|
14376
14595
|
if (t && typeof t.writeText == "function") return await t.writeText(e), !0;
|
|
@@ -14388,9 +14607,9 @@ async function Bm(e) {
|
|
|
14388
14607
|
}
|
|
14389
14608
|
//#endregion
|
|
14390
14609
|
//#region src/core/composables/useChat.ts
|
|
14391
|
-
var
|
|
14392
|
-
function
|
|
14393
|
-
let { fetchResponse: t, fetchStream: n, onPersist: r, onClear: i, onQueuedCleared: a, onBeforeRegenerate: o } = e, s = /* @__PURE__ */
|
|
14610
|
+
var qm = 4e3;
|
|
14611
|
+
function Jm(e = {}) {
|
|
14612
|
+
let { fetchResponse: t, fetchStream: n, onPersist: r, onClear: i, onQueuedCleared: a, onBeforeRegenerate: o } = e, s = /* @__PURE__ */ Mt({
|
|
14394
14613
|
messages: e.messages ?? [],
|
|
14395
14614
|
loading: !1,
|
|
14396
14615
|
error: null
|
|
@@ -14417,7 +14636,7 @@ function Hm(e = {}) {
|
|
|
14417
14636
|
}
|
|
14418
14637
|
async function _(e) {
|
|
14419
14638
|
if (l.value = !0, n) {
|
|
14420
|
-
let t = /* @__PURE__ */
|
|
14639
|
+
let t = /* @__PURE__ */ Mt({
|
|
14421
14640
|
role: "assistant",
|
|
14422
14641
|
content: "",
|
|
14423
14642
|
timestamp: Date.now(),
|
|
@@ -14469,7 +14688,7 @@ function Hm(e = {}) {
|
|
|
14469
14688
|
let t = e.delta || "";
|
|
14470
14689
|
n.subReasonFull = (n.subReasonFull || "") + t;
|
|
14471
14690
|
let r = (n.subReason || "") + t;
|
|
14472
|
-
n.subReason = r.length >
|
|
14691
|
+
n.subReason = r.length > qm ? r.slice(-4e3) : r;
|
|
14473
14692
|
break;
|
|
14474
14693
|
}
|
|
14475
14694
|
n.children ||= [];
|
|
@@ -14489,7 +14708,8 @@ function Hm(e = {}) {
|
|
|
14489
14708
|
e.hold?.(), f.value = {
|
|
14490
14709
|
toolName: e.toolName,
|
|
14491
14710
|
args: e.args,
|
|
14492
|
-
resolve: e.resolve
|
|
14711
|
+
resolve: e.resolve,
|
|
14712
|
+
...e.preview ? { preview: e.preview } : {}
|
|
14493
14713
|
};
|
|
14494
14714
|
break;
|
|
14495
14715
|
}
|
|
@@ -14599,7 +14819,7 @@ function Hm(e = {}) {
|
|
|
14599
14819
|
}
|
|
14600
14820
|
//#endregion
|
|
14601
14821
|
//#region src/core/components/icons.ts
|
|
14602
|
-
var
|
|
14822
|
+
var Ym = {
|
|
14603
14823
|
header: "🤖",
|
|
14604
14824
|
subagent: "🤖",
|
|
14605
14825
|
subagentProgress: "🧬",
|
|
@@ -14610,10 +14830,10 @@ var Um = {
|
|
|
14610
14830
|
recommend: "💡",
|
|
14611
14831
|
conflict: "⚠️"
|
|
14612
14832
|
};
|
|
14613
|
-
function
|
|
14614
|
-
let t = { ...
|
|
14833
|
+
function Xm(e) {
|
|
14834
|
+
let t = { ...Ym };
|
|
14615
14835
|
if (!e) return t;
|
|
14616
|
-
let n = Object.keys(
|
|
14836
|
+
let n = Object.keys(Ym);
|
|
14617
14837
|
for (let r of n) {
|
|
14618
14838
|
let n = e[r];
|
|
14619
14839
|
typeof n == "string" && (t[r] = n);
|
|
@@ -14622,12 +14842,14 @@ function Wm(e) {
|
|
|
14622
14842
|
}
|
|
14623
14843
|
//#endregion
|
|
14624
14844
|
//#region src/core/components/messages.ts
|
|
14625
|
-
var
|
|
14845
|
+
var Zm = {
|
|
14626
14846
|
defaultTitle: "AI 助手",
|
|
14627
14847
|
inputPlaceholder: "输入消息,Enter 发送...",
|
|
14628
14848
|
newSession: "新建会话",
|
|
14629
14849
|
history: "历史记录",
|
|
14630
14850
|
more: "更多",
|
|
14851
|
+
exportSession: "导出会话",
|
|
14852
|
+
importSession: "导入会话…",
|
|
14631
14853
|
close: "关闭",
|
|
14632
14854
|
debugMenu: "调试 / 日志",
|
|
14633
14855
|
debugMenuTitle: "日志 / 执行流程 / Agent 信息",
|
|
@@ -14847,14 +15069,16 @@ var Gm = {
|
|
|
14847
15069
|
codeDemoText: "这是一段示例文字,用于展示 CSS 效果。",
|
|
14848
15070
|
codeDemoButton: "按钮",
|
|
14849
15071
|
codeDemoInput: "输入框"
|
|
14850
|
-
},
|
|
14851
|
-
"zh-CN":
|
|
15072
|
+
}, Qm = {
|
|
15073
|
+
"zh-CN": Zm,
|
|
14852
15074
|
"en-US": {
|
|
14853
15075
|
defaultTitle: "AI Assistant",
|
|
14854
15076
|
inputPlaceholder: "Type a message, Enter to send...",
|
|
14855
15077
|
newSession: "New chat",
|
|
14856
15078
|
history: "History",
|
|
14857
15079
|
more: "More",
|
|
15080
|
+
exportSession: "Export chat",
|
|
15081
|
+
importSession: "Import chat…",
|
|
14858
15082
|
close: "Close",
|
|
14859
15083
|
debugMenu: "Debug / Logs",
|
|
14860
15084
|
debugMenuTitle: "Logs / execution flow / agent info",
|
|
@@ -15076,10 +15300,10 @@ var Gm = {
|
|
|
15076
15300
|
codeDemoInput: "Input"
|
|
15077
15301
|
}
|
|
15078
15302
|
};
|
|
15079
|
-
function
|
|
15303
|
+
function $m(e = "zh-CN", t) {
|
|
15080
15304
|
let n = {
|
|
15081
|
-
...
|
|
15082
|
-
...
|
|
15305
|
+
...Zm,
|
|
15306
|
+
...Qm[e]
|
|
15083
15307
|
};
|
|
15084
15308
|
if (!t) return n;
|
|
15085
15309
|
let r = { ...n };
|
|
@@ -15091,9 +15315,9 @@ function qm(e = "zh-CN", t) {
|
|
|
15091
15315
|
}
|
|
15092
15316
|
//#endregion
|
|
15093
15317
|
//#region src/core/composables/chatContext.ts
|
|
15094
|
-
var
|
|
15095
|
-
function
|
|
15096
|
-
let t =
|
|
15318
|
+
var eh = Symbol("chatContext");
|
|
15319
|
+
function th(e = {}) {
|
|
15320
|
+
let t = Jm({
|
|
15097
15321
|
fetchResponse: e.fetchResponse,
|
|
15098
15322
|
fetchStream: e.fetchStream,
|
|
15099
15323
|
messages: e.messages,
|
|
@@ -15115,7 +15339,7 @@ function Ym(e = {}) {
|
|
|
15115
15339
|
}, h = /* @__PURE__ */ Wt({}), g = (e) => h.value[e] === !0, _ = (e) => {
|
|
15116
15340
|
h.value[e] = !g(e);
|
|
15117
15341
|
}, v = /* @__PURE__ */ Wt(!1), y = (e) => {
|
|
15118
|
-
|
|
15342
|
+
Km(e).then((e) => {
|
|
15119
15343
|
e && (v.value = !0, setTimeout(() => {
|
|
15120
15344
|
v.value = !1;
|
|
15121
15345
|
}, 1500));
|
|
@@ -15177,7 +15401,7 @@ function Ym(e = {}) {
|
|
|
15177
15401
|
e.onClearFocus?.();
|
|
15178
15402
|
}, M = (t) => {
|
|
15179
15403
|
e.onFocusChipClick?.(t);
|
|
15180
|
-
}, N =
|
|
15404
|
+
}, N = Xm(e.icons), ce = e.locale ?? "zh-CN", P = $m(ce, e.dialogMessages);
|
|
15181
15405
|
return {
|
|
15182
15406
|
chat: t,
|
|
15183
15407
|
inputText: o,
|
|
@@ -15219,15 +15443,15 @@ function Ym(e = {}) {
|
|
|
15219
15443
|
toolStepView: e.toolStepView
|
|
15220
15444
|
};
|
|
15221
15445
|
}
|
|
15222
|
-
function
|
|
15223
|
-
let e = Qn(
|
|
15446
|
+
function nh() {
|
|
15447
|
+
let e = Qn(eh);
|
|
15224
15448
|
if (!e) throw Error("useChatContext 必须在 provide(chatContextKey) 的组件子树内调用");
|
|
15225
15449
|
return e;
|
|
15226
15450
|
}
|
|
15227
15451
|
//#endregion
|
|
15228
15452
|
//#region src/core/index.headless.ts
|
|
15229
|
-
function
|
|
15230
|
-
return
|
|
15453
|
+
function rh(e) {
|
|
15454
|
+
return Fm(e);
|
|
15231
15455
|
}
|
|
15232
15456
|
//#endregion
|
|
15233
|
-
export { wp as CAPABILITIES, Dp as CONTEXT_PRESETS, Pf as CompressDecisionSchema, Bp as DEFAULT_COMPUTED_STYLES, Kc as DEFAULT_PROMPT_SOFT_CAP, xu as DEFAULT_SYSTEM_PROMPT, Cd as HTML_VOID_TAGS, Il as HUMAN_CONFIRM_TOOL_NAME, gi as ImageInputError, g as LOW_CAPS_HINT_BASELINE, p as MIN_CONTEXT_WINDOW, $i as MODEL_UNAVAILABLE_GUIDANCE, Gc as SOFT_CAP_MIN_WINDOW, Lc as STOP_WORDS, zs as UNSAFE_KEYS, cm as actionsToInspectInfo, sm as actionsToTools, fi as agentError, mu as analyzeContext, Zs as applyPatchToClone, ec as applyPatchToLive, dd as applyPatchesToBind, is as arrayMinLength, di as asAgentError, hf as buildCollectorJs, Gp as buildCssPath, Cu as buildDataPrompt, sf as buildDiagnosticsReport, gf as buildSandboxSrcdoc, wu as buildSystemPrompt,
|
|
15457
|
+
export { wp as CAPABILITIES, Dp as CONTEXT_PRESETS, Pf as CompressDecisionSchema, Bp as DEFAULT_COMPUTED_STYLES, Kc as DEFAULT_PROMPT_SOFT_CAP, xu as DEFAULT_SYSTEM_PROMPT, Cd as HTML_VOID_TAGS, Il as HUMAN_CONFIRM_TOOL_NAME, gi as ImageInputError, g as LOW_CAPS_HINT_BASELINE, p as MIN_CONTEXT_WINDOW, $i as MODEL_UNAVAILABLE_GUIDANCE, Gc as SOFT_CAP_MIN_WINDOW, Lc as STOP_WORDS, zs as UNSAFE_KEYS, cm as actionsToInspectInfo, sm as actionsToTools, fi as agentError, mu as analyzeContext, Zs as applyPatchToClone, ec as applyPatchToLive, dd as applyPatchesToBind, is as arrayMinLength, di as asAgentError, hf as buildCollectorJs, Gp as buildCssPath, Cu as buildDataPrompt, sf as buildDiagnosticsReport, gf as buildSandboxSrcdoc, wu as buildSystemPrompt, eh as chatContextKey, ud as commitSetToBind, Sf as composeStructureThenRender, Di as compressImage, bu as connectMcp, ee as constructLlmFromConfig, E as constructOpenLlmSync, Km as copyText, Jo as createAgent, Fl as createApprovalMiddleware, th as createChatContext, rh as createChatSdk, Kl as createCheckpointManager, ql as createCheckpointMiddleware, qf as createConflictManager, hu as createContextInspectorMiddleware, Of as createCraftNoteCheck, Sd as createDataOps, Gm as createEvalHarness, Ef as createHtmlFormatCheck, xf as createHtmlRenderCheck, Af as createHtmlSubagent, zl as createHumanConfirmMiddleware, Rl as createHumanConfirmTool, Hm as createIdleDetector, hp as createMemoryBackend, Ol as createMemoryMiddleware, u as createProxyLlm, Vm as createRagSubagent, aa as createSandboxRunner, Ep as createSdkEvents, Tm as createSerialRunner, yp as createSessionStore, bp as createSessionStoreWithBackend, xm as createSkillStore, yl as createSubagentMiddleware, $c as createSubagentTracker, Sl as createSubagentsMiddleware, hm as createUsageHintsMiddleware, Yl as createVerifyMiddleware, Ou as createVfs, _p as createWebStorageBackend, tu as createWriteBackCheck, ea as decorateModelUnavailable, Q as deepClone, dm as defineDataToolset, pc as defineSkill, jf as defineTool, Us as deleteByPath, Ff as deriveTitle, vs as describeSchemaNode, Po as detectGarbledToolCall, ic as diffObjects, Wm as diffReport, Xp as domInfoTool, Zp as domInspectSkill, Yp as domSearchTool, Lp as domToStructure, zp as domTools, um as domToolsStatic, as as elementSchemaCandidates, Up as ensureDomListenerRecorder, zc as estimateMessageTokens, Hc as estimateRoundTokens, y as estimateTokens, ne as extractReasoningDelta, js as extractSchemaHint, gu as extractText, te as extractTextDelta, re as extractUsage, Np as fetchDocTools, lm as fetchTools, rc as findStrippedKeys, ys as formatConstraints, si as formatZodIssues, Z as getByPath, Rp as getDomTool, Jp as getElementInfo, em as getEnvSummary, Wp as getRecordedListeners, yf as getSandboxLifecycle, Qo as getSchemaAtPath, Yo as getSchemaTopKeys, Ys as hashValue, Es as htmlOrchestratorPrompt, Uc as indexSummarize, rm as inspectEnvTool, im as inspectTools, Lf as isChatModel, Zi as isContextLengthError, Qi as isModelUnavailableError, Xo as isPathAllowed, sp as isQuotaError, Bs as isUnsafePath, ha as jpEval, li as jsonParseError, qs as limitDepth, _ as lowCapsHint, af as maskUrlCredentials, Gs as maybeParseValue, Qd as measureWriteScale, mf as normalizeRenderResult, ae as normalizeUsage, x as offloadPassThroughChars, b as offloadThresholdChars, Ts as presets, fs as projectBySchema, ds as projectBySchemaDeep, Ks as projectFields, Wc as recallRounds, bf as renderInSandbox, bs as renderSchemaHint, xs as renderSchemaOverview, ws as renderSchemaShallow, Tp as resolveCapabilities, kp as resolveContextOptions, Cp as resolveDialogConfig, Kf as resolveLlm, v as resolveModelCaps, Jc as resolvePromptSoftCap, ts as resolveSchemaPath, Sp as resolveStorage, nc as restoreInPlace, tc as restoreLive, ui as routeError, ya as runSandboxedScript, Vs as safeMerge, $p as safeSerialize, $ as safeStringify, rs as schemaHasRefinement, Kp as searchDom, _a as searchJson, fm as selectBuiltinTools, Hs as setByPath, Yc as shouldTriggerCompression, cf as stringifyDiagnosticsReport, Ds as systemPromptHelpers, h as tableMaxOutputTokens, Rc as tokenize, X as toolError, Zo as unwrapSchema, Jm as useChat, nh as useChatContext, ns as validateAtPath, Td as validateHtmlFormat, cd as validateRootValueLocally, ld as validateWriteLocally, Xs as watchFieldsHash, e as z, ci as zodError };
|