page-agent-sdk 4.23.3 → 4.24.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 +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/page-agent-sdk.headless.js +263 -233
- package/dist/page-agent-sdk.iife.js +5 -3
- package/dist/page-agent-sdk.js +33 -3
- package/dist/page-agent-sdk.legacy.js +33 -3
- package/dist/page-agent-sdk.umd.cjs +5 -3
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/style.css +1 -1
- package/types/headless.d.ts +4 -0
- package/types/index.d.ts +4 -0
|
@@ -503,10 +503,10 @@ function ae(e) {
|
|
|
503
503
|
}
|
|
504
504
|
var oe = process.env.NODE_ENV === "production" ? {} : Object.freeze({});
|
|
505
505
|
process.env.NODE_ENV === "production" || Object.freeze([]);
|
|
506
|
-
var A = () => {}, j = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && (e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97), se = (e) => e.startsWith("onUpdate:"), M = Object.assign,
|
|
506
|
+
var A = () => {}, j = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && (e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97), se = (e) => e.startsWith("onUpdate:"), M = Object.assign, ce = (e, t) => {
|
|
507
507
|
let n = e.indexOf(t);
|
|
508
508
|
n > -1 && e.splice(n, 1);
|
|
509
|
-
},
|
|
509
|
+
}, N = Object.prototype.hasOwnProperty, P = (e, t) => N.call(e, t), F = Array.isArray, le = (e) => he(e) === "[object Map]", I = (e) => he(e) === "[object Set]", L = (e) => typeof e == "function", ue = (e) => typeof e == "string", de = (e) => typeof e == "symbol", fe = (e) => typeof e == "object" && !!e, pe = (e) => (fe(e) || L(e)) && L(e.then) && L(e.catch), me = Object.prototype.toString, he = (e) => me.call(e), R = (e) => he(e).slice(8, -1), z = (e) => he(e) === "[object Object]", B = (e) => ue(e) && e !== "NaN" && e[0] !== "-" && "" + parseInt(e, 10) === e, ge = ((e) => {
|
|
510
510
|
let t = /* @__PURE__ */ Object.create(null);
|
|
511
511
|
return ((n) => t[n] || (t[n] = e(n)));
|
|
512
512
|
})((e) => e.charAt(0).toUpperCase() + e.slice(1)), _e = (e, t) => !Object.is(e, t), ve = (e, t, n, r = !1) => {
|
|
@@ -518,14 +518,14 @@ var A = () => {}, j = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110
|
|
|
518
518
|
});
|
|
519
519
|
}, ye, be = () => ye ||= typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {};
|
|
520
520
|
function V(e) {
|
|
521
|
-
if (
|
|
521
|
+
if (F(e)) {
|
|
522
522
|
let t = {};
|
|
523
523
|
for (let n = 0; n < e.length; n++) {
|
|
524
|
-
let r = e[n], i =
|
|
524
|
+
let r = e[n], i = ue(r) ? Ce(r) : V(r);
|
|
525
525
|
if (i) for (let e in i) t[e] = i[e];
|
|
526
526
|
}
|
|
527
527
|
return t;
|
|
528
|
-
} else if (
|
|
528
|
+
} else if (ue(e) || fe(e)) return e;
|
|
529
529
|
}
|
|
530
530
|
var xe = /;(?![^(]*\))/g, H = /:([^]+)/, Se = /\/\*[^]*?\*\//g;
|
|
531
531
|
function Ce(e) {
|
|
@@ -539,12 +539,12 @@ function Ce(e) {
|
|
|
539
539
|
}
|
|
540
540
|
function U(e) {
|
|
541
541
|
let t = "";
|
|
542
|
-
if (
|
|
543
|
-
else if (
|
|
542
|
+
if (ue(e)) t = e;
|
|
543
|
+
else if (F(e)) for (let n = 0; n < e.length; n++) {
|
|
544
544
|
let r = U(e[n]);
|
|
545
545
|
r && (t += r + " ");
|
|
546
546
|
}
|
|
547
|
-
else if (
|
|
547
|
+
else if (fe(e)) for (let n in e) e[n] && (t += n + " ");
|
|
548
548
|
return t.trim();
|
|
549
549
|
}
|
|
550
550
|
//#endregion
|
|
@@ -765,21 +765,21 @@ function tt(e, t, n, r, i, a) {
|
|
|
765
765
|
};
|
|
766
766
|
if (Ne(), t === "clear") o.forEach(s);
|
|
767
767
|
else {
|
|
768
|
-
let i =
|
|
768
|
+
let i = F(e), a = i && B(n);
|
|
769
769
|
if (i && n === "length") {
|
|
770
770
|
let e = Number(r);
|
|
771
771
|
o.forEach((t, n) => {
|
|
772
|
-
(n === "length" || n === $e || !
|
|
772
|
+
(n === "length" || n === $e || !de(n) && n >= e) && s(t);
|
|
773
773
|
});
|
|
774
774
|
} else switch ((n !== void 0 || o.has(void 0)) && s(o.get(n)), a && s(o.get($e)), t) {
|
|
775
775
|
case "add":
|
|
776
|
-
i ? a && s(o.get("length")) : (s(o.get(Ze)),
|
|
776
|
+
i ? a && s(o.get("length")) : (s(o.get(Ze)), le(e) && s(o.get(Qe)));
|
|
777
777
|
break;
|
|
778
778
|
case "delete":
|
|
779
|
-
i || (s(o.get(Ze)),
|
|
779
|
+
i || (s(o.get(Ze)), le(e) && s(o.get(Qe)));
|
|
780
780
|
break;
|
|
781
781
|
case "set":
|
|
782
|
-
|
|
782
|
+
le(e) && s(o.get(Ze));
|
|
783
783
|
break;
|
|
784
784
|
}
|
|
785
785
|
}
|
|
@@ -801,7 +801,7 @@ var it = {
|
|
|
801
801
|
return at(this, Symbol.iterator, (e) => G(this, e));
|
|
802
802
|
},
|
|
803
803
|
concat(...e) {
|
|
804
|
-
return nt(this).concat(...e.map((e) =>
|
|
804
|
+
return nt(this).concat(...e.map((e) => F(e) ? nt(e) : e));
|
|
805
805
|
},
|
|
806
806
|
entries() {
|
|
807
807
|
return at(this, "entries", (e) => (e[1] = G(this, e[1]), e));
|
|
@@ -923,9 +923,9 @@ function ut(e, t, n = []) {
|
|
|
923
923
|
let r = (/* @__PURE__ */ q(e))[t].apply(e, n);
|
|
924
924
|
return Pe(), We(), r;
|
|
925
925
|
}
|
|
926
|
-
var dt = /* @__PURE__ */ ae("__proto__,__v_isRef,__isVue"), ft = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((e) => e !== "arguments" && e !== "caller").map((e) => Symbol[e]).filter(
|
|
926
|
+
var dt = /* @__PURE__ */ ae("__proto__,__v_isRef,__isVue"), ft = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((e) => e !== "arguments" && e !== "caller").map((e) => Symbol[e]).filter(de));
|
|
927
927
|
function pt(e) {
|
|
928
|
-
|
|
928
|
+
de(e) || (e = String(e));
|
|
929
929
|
let t = /* @__PURE__ */ q(this);
|
|
930
930
|
return et(t, "has", e), t.hasOwnProperty(e);
|
|
931
931
|
}
|
|
@@ -940,43 +940,43 @@ var mt = class {
|
|
|
940
940
|
if (t === "__v_isReadonly") return r;
|
|
941
941
|
if (t === "__v_isShallow") return i;
|
|
942
942
|
if (t === "__v_raw") return n === (r ? i ? Nt : Mt : i ? jt : At).get(e) || Object.getPrototypeOf(e) === Object.getPrototypeOf(n) ? e : void 0;
|
|
943
|
-
let a =
|
|
943
|
+
let a = F(e);
|
|
944
944
|
if (!r) {
|
|
945
945
|
let e;
|
|
946
946
|
if (a && (e = it[t])) return e;
|
|
947
947
|
if (t === "hasOwnProperty") return pt;
|
|
948
948
|
}
|
|
949
949
|
let o = Reflect.get(e, t, /* @__PURE__ */ Y(e) ? e : n);
|
|
950
|
-
if ((
|
|
950
|
+
if ((de(t) ? ft.has(t) : dt(t)) || (r || et(e, "get", t), i)) return o;
|
|
951
951
|
if (/* @__PURE__ */ Y(o)) {
|
|
952
952
|
let e = a && B(t) ? o : o.value;
|
|
953
|
-
return r &&
|
|
953
|
+
return r && fe(e) ? /* @__PURE__ */ It(e) : e;
|
|
954
954
|
}
|
|
955
|
-
return
|
|
955
|
+
return fe(o) ? r ? /* @__PURE__ */ It(o) : /* @__PURE__ */ Ft(o) : o;
|
|
956
956
|
}
|
|
957
957
|
}, ht = class extends mt {
|
|
958
958
|
constructor(e = !1) {
|
|
959
959
|
super(!1, e);
|
|
960
960
|
}
|
|
961
961
|
set(e, t, n, r) {
|
|
962
|
-
let i = e[t], a =
|
|
962
|
+
let i = e[t], a = F(e) && B(t);
|
|
963
963
|
if (!this._isShallow) {
|
|
964
964
|
let r = /* @__PURE__ */ zt(i);
|
|
965
965
|
if (!/* @__PURE__ */ Bt(n) && !/* @__PURE__ */ zt(n) && (i = /* @__PURE__ */ q(i), n = /* @__PURE__ */ q(n)), !a && /* @__PURE__ */ Y(i) && !/* @__PURE__ */ Y(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);
|
|
966
966
|
}
|
|
967
|
-
let o = a ? Number(t) < e.length :
|
|
967
|
+
let o = a ? Number(t) < e.length : P(e, t), s = Reflect.set(e, t, n, /* @__PURE__ */ Y(e) ? e : r);
|
|
968
968
|
return e === /* @__PURE__ */ q(r) && s && (o ? _e(n, i) && tt(e, "set", t, n, i) : tt(e, "add", t, n)), s;
|
|
969
969
|
}
|
|
970
970
|
deleteProperty(e, t) {
|
|
971
|
-
let n =
|
|
971
|
+
let n = P(e, t), r = e[t], i = Reflect.deleteProperty(e, t);
|
|
972
972
|
return i && n && tt(e, "delete", t, void 0, r), i;
|
|
973
973
|
}
|
|
974
974
|
has(e, t) {
|
|
975
975
|
let n = Reflect.has(e, t);
|
|
976
|
-
return (!
|
|
976
|
+
return (!de(t) || !ft.has(t)) && et(e, "has", t), n;
|
|
977
977
|
}
|
|
978
978
|
ownKeys(e) {
|
|
979
|
-
return et(e, "iterate",
|
|
979
|
+
return et(e, "iterate", F(e) ? "length" : Ze), Reflect.ownKeys(e);
|
|
980
980
|
}
|
|
981
981
|
}, gt = class extends mt {
|
|
982
982
|
constructor(e = !1) {
|
|
@@ -991,7 +991,7 @@ var mt = class {
|
|
|
991
991
|
}, _t = /* @__PURE__ */ new ht(), vt = /* @__PURE__ */ new gt(), yt = /* @__PURE__ */ new gt(!0), bt = (e) => e, xt = (e) => Reflect.getPrototypeOf(e);
|
|
992
992
|
function St(e, t, n) {
|
|
993
993
|
return function(...r) {
|
|
994
|
-
let i = this.__v_raw, a = /* @__PURE__ */ q(i), o =
|
|
994
|
+
let i = this.__v_raw, a = /* @__PURE__ */ q(i), o = le(a), s = e === "entries" || e === Symbol.iterator && o, c = e === "keys" && o, l = i[e](...r), u = n ? bt : t ? J : Ut;
|
|
995
995
|
return !t && et(a, "iterate", c ? Qe : Ze), M(Object.create(l), { next() {
|
|
996
996
|
let { value: e, done: t } = l.next();
|
|
997
997
|
return t ? {
|
|
@@ -1060,7 +1060,7 @@ function wt(e, t) {
|
|
|
1060
1060
|
return i && tt(t, "delete", e, void 0, a), o;
|
|
1061
1061
|
},
|
|
1062
1062
|
clear() {
|
|
1063
|
-
let e = /* @__PURE__ */ q(this), t = e.size !== 0, n = process.env.NODE_ENV === "production" ? void 0 :
|
|
1063
|
+
let e = /* @__PURE__ */ q(this), t = e.size !== 0, n = process.env.NODE_ENV === "production" ? void 0 : le(e) ? new Map(e) : new Set(e), r = e.clear();
|
|
1064
1064
|
return t && tt(e, "clear", void 0, void 0, n), r;
|
|
1065
1065
|
}
|
|
1066
1066
|
}), [
|
|
@@ -1074,13 +1074,13 @@ function wt(e, t) {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
function Tt(e, t) {
|
|
1076
1076
|
let n = wt(e, t);
|
|
1077
|
-
return (t, r, i) => r === "__v_isReactive" ? !e : r === "__v_isReadonly" ? e : r === "__v_raw" ? t : Reflect.get(
|
|
1077
|
+
return (t, r, i) => r === "__v_isReactive" ? !e : r === "__v_isReadonly" ? e : r === "__v_raw" ? t : Reflect.get(P(n, r) && r in t ? n : t, r, i);
|
|
1078
1078
|
}
|
|
1079
1079
|
var Et = { get: /* @__PURE__ */ Tt(!1, !1) }, Dt = { get: /* @__PURE__ */ Tt(!0, !1) }, Ot = { get: /* @__PURE__ */ Tt(!0, !0) };
|
|
1080
1080
|
function kt(e, t, n) {
|
|
1081
1081
|
let r = /* @__PURE__ */ q(n);
|
|
1082
1082
|
if (r !== n && t.call(e, r)) {
|
|
1083
|
-
let t =
|
|
1083
|
+
let t = R(e);
|
|
1084
1084
|
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.`);
|
|
1085
1085
|
}
|
|
1086
1086
|
}
|
|
@@ -1109,11 +1109,11 @@ function Lt(e) {
|
|
|
1109
1109
|
return Rt(e, !0, yt, Ot, Nt);
|
|
1110
1110
|
}
|
|
1111
1111
|
function Rt(e, t, n, r, i) {
|
|
1112
|
-
if (!
|
|
1112
|
+
if (!fe(e)) return process.env.NODE_ENV !== "production" && we(`value cannot be made ${t ? "readonly" : "reactive"}: ${String(e)}`), e;
|
|
1113
1113
|
if (e.__v_raw && !(t && e.__v_isReactive) || e.__v_skip || !Object.isExtensible(e)) return e;
|
|
1114
1114
|
let a = i.get(e);
|
|
1115
1115
|
if (a) return a;
|
|
1116
|
-
let o = Pt(
|
|
1116
|
+
let o = Pt(R(e));
|
|
1117
1117
|
if (o === 0) return e;
|
|
1118
1118
|
let s = new Proxy(e, o === 2 ? r : n);
|
|
1119
1119
|
return i.set(e, s), s;
|
|
@@ -1140,9 +1140,9 @@ function q(e) {
|
|
|
1140
1140
|
return t ? /* @__PURE__ */ q(t) : e;
|
|
1141
1141
|
}
|
|
1142
1142
|
function Ht(e) {
|
|
1143
|
-
return !
|
|
1143
|
+
return !P(e, "__v_skip") && Object.isExtensible(e) && ve(e, "__v_skip", !0), e;
|
|
1144
1144
|
}
|
|
1145
|
-
var Ut = (e) =>
|
|
1145
|
+
var Ut = (e) => fe(e) ? /* @__PURE__ */ Ft(e) : e, J = (e) => fe(e) ? /* @__PURE__ */ It(e) : e;
|
|
1146
1146
|
// @__NO_SIDE_EFFECTS__
|
|
1147
1147
|
function Y(e) {
|
|
1148
1148
|
return e ? e.__v_isRef === !0 : !1;
|
|
@@ -1224,7 +1224,7 @@ var Qt = class {
|
|
|
1224
1224
|
// @__NO_SIDE_EFFECTS__
|
|
1225
1225
|
function $t(e, t, n = !1) {
|
|
1226
1226
|
let r, i;
|
|
1227
|
-
|
|
1227
|
+
L(e) ? r = e : (r = e.get, i = e.set);
|
|
1228
1228
|
let a = new Qt(r, i, n);
|
|
1229
1229
|
return process.env.NODE_ENV !== "production" && t && !n && (a.onTrack = t.onTrack, a.onTrigger = t.onTrigger), a;
|
|
1230
1230
|
}
|
|
@@ -1239,12 +1239,12 @@ function an(e, t, n = oe) {
|
|
|
1239
1239
|
let { immediate: r, deep: i, once: a, scheduler: o, augmentJob: s, call: c } = n, l = (e) => {
|
|
1240
1240
|
(n.onWarn || 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.");
|
|
1241
1241
|
}, u = (e) => i ? e : /* @__PURE__ */ Bt(e) || i === !1 || i === 0 ? on(e, 1) : on(e), d, f, p, m, h = !1, g = !1;
|
|
1242
|
-
if (/* @__PURE__ */ Y(e) ? (f = () => e.value, h = /* @__PURE__ */ Bt(e)) : /* @__PURE__ */ K(e) ? (f = () => u(e), h = !0) :
|
|
1242
|
+
if (/* @__PURE__ */ Y(e) ? (f = () => e.value, h = /* @__PURE__ */ Bt(e)) : /* @__PURE__ */ K(e) ? (f = () => u(e), h = !0) : F(e) ? (g = !0, h = e.some((e) => /* @__PURE__ */ K(e) || /* @__PURE__ */ Bt(e)), f = () => e.map((e) => {
|
|
1243
1243
|
if (/* @__PURE__ */ Y(e)) return e.value;
|
|
1244
1244
|
if (/* @__PURE__ */ K(e)) return u(e);
|
|
1245
|
-
if (
|
|
1245
|
+
if (L(e)) return c ? c(e, 2) : e();
|
|
1246
1246
|
process.env.NODE_ENV !== "production" && l(e);
|
|
1247
|
-
})) :
|
|
1247
|
+
})) : L(e) ? f = t ? c ? () => c(e, 2) : e : () => {
|
|
1248
1248
|
if (p) {
|
|
1249
1249
|
Ue();
|
|
1250
1250
|
try {
|
|
@@ -1265,7 +1265,7 @@ function an(e, t, n = oe) {
|
|
|
1265
1265
|
f = () => on(e(), t);
|
|
1266
1266
|
}
|
|
1267
1267
|
let _ = Ee(), v = () => {
|
|
1268
|
-
d.stop(), _ && _.active &&
|
|
1268
|
+
d.stop(), _ && _.active && ce(_.effects, d);
|
|
1269
1269
|
};
|
|
1270
1270
|
if (a && t) {
|
|
1271
1271
|
let e = t;
|
|
@@ -1304,10 +1304,10 @@ function an(e, t, n = oe) {
|
|
|
1304
1304
|
}, process.env.NODE_ENV !== "production" && (d.onTrack = n.onTrack, d.onTrigger = n.onTrigger), t ? r ? b(!0) : y = d.run() : o ? o(b.bind(null, !0), !0) : d.run(), v.pause = d.pause.bind(d), v.resume = d.resume.bind(d), v.stop = v, v;
|
|
1305
1305
|
}
|
|
1306
1306
|
function on(e, t = Infinity, n) {
|
|
1307
|
-
if (t <= 0 || !
|
|
1307
|
+
if (t <= 0 || !fe(e) || e.__v_skip || (n ||= /* @__PURE__ */ new Map(), (n.get(e) || 0) >= t)) return e;
|
|
1308
1308
|
if (n.set(e, t), t--, /* @__PURE__ */ Y(e)) on(e.value, t, n);
|
|
1309
|
-
else if (
|
|
1310
|
-
else if (
|
|
1309
|
+
else if (F(e)) for (let r = 0; r < e.length; r++) on(e[r], t, n);
|
|
1310
|
+
else if (I(e) || le(e)) e.forEach((e) => {
|
|
1311
1311
|
on(e, t, n);
|
|
1312
1312
|
});
|
|
1313
1313
|
else if (z(e)) {
|
|
@@ -1378,11 +1378,11 @@ function mn(e) {
|
|
|
1378
1378
|
}), n.length > 3 && t.push(" ..."), t;
|
|
1379
1379
|
}
|
|
1380
1380
|
function hn(e, t, n) {
|
|
1381
|
-
return
|
|
1381
|
+
return ue(t) ? (t = JSON.stringify(t), n ? t : [`${e}=${t}`]) : typeof t == "number" || typeof t == "boolean" || t == null ? n ? t : [`${e}=${t}`] : /* @__PURE__ */ Y(t) ? (t = hn(e, /* @__PURE__ */ q(t.value), !0), n ? t : [
|
|
1382
1382
|
`${e}=Ref<`,
|
|
1383
1383
|
t,
|
|
1384
1384
|
">"
|
|
1385
|
-
]) :
|
|
1385
|
+
]) : L(t) ? [`${e}=fn${t.name ? `<${t.name}>` : ""}`] : (t = /* @__PURE__ */ q(t), n ? t : [`${e}=`, t]);
|
|
1386
1386
|
}
|
|
1387
1387
|
var gn = {
|
|
1388
1388
|
sp: "serverPrefetch hook",
|
|
@@ -1425,13 +1425,13 @@ function _n(e, t, n, r) {
|
|
|
1425
1425
|
}
|
|
1426
1426
|
}
|
|
1427
1427
|
function vn(e, t, n, r) {
|
|
1428
|
-
if (
|
|
1428
|
+
if (L(e)) {
|
|
1429
1429
|
let i = _n(e, t, n, r);
|
|
1430
|
-
return i &&
|
|
1430
|
+
return i && pe(i) && i.catch((e) => {
|
|
1431
1431
|
yn(e, t, n);
|
|
1432
1432
|
}), i;
|
|
1433
1433
|
}
|
|
1434
|
-
if (
|
|
1434
|
+
if (F(e)) {
|
|
1435
1435
|
let i = [];
|
|
1436
1436
|
for (let a = 0; a < e.length; a++) i.push(vn(e[a], t, n, r));
|
|
1437
1437
|
return i;
|
|
@@ -1490,7 +1490,7 @@ function Mn() {
|
|
|
1490
1490
|
Dn ||= En.then(In);
|
|
1491
1491
|
}
|
|
1492
1492
|
function Nn(e) {
|
|
1493
|
-
|
|
1493
|
+
F(e) ? Cn.push(...e) : wn && e.id === -1 ? wn.splice(Tn + 1, 0, e) : e.flags & 1 || (Cn.push(e), e.flags |= 1), Mn();
|
|
1494
1494
|
}
|
|
1495
1495
|
function Pn(e) {
|
|
1496
1496
|
if (Cn.length) {
|
|
@@ -1598,7 +1598,7 @@ function Zn(e, t, n = !1) {
|
|
|
1598
1598
|
if (r || Sr) {
|
|
1599
1599
|
let i = Sr ? Sr._context.provides : r ? r.parent == null || r.ce ? r.vnode.appContext && r.vnode.appContext.provides : r.parent.provides : void 0;
|
|
1600
1600
|
if (i && e in i) return i[e];
|
|
1601
|
-
if (arguments.length > 1) return n &&
|
|
1601
|
+
if (arguments.length > 1) return n && L(t) ? t.call(r && r.proxy) : t;
|
|
1602
1602
|
process.env.NODE_ENV !== "production" && un(`injection "${String(e)}" not found.`);
|
|
1603
1603
|
} else process.env.NODE_ENV !== "production" && un("inject() can only be used inside setup() or functional components.");
|
|
1604
1604
|
}
|
|
@@ -1637,8 +1637,8 @@ function er(e, t, n = oe) {
|
|
|
1637
1637
|
return Xr && (l ? l.push(f) : c && f()), f;
|
|
1638
1638
|
}
|
|
1639
1639
|
function tr(e, t, n) {
|
|
1640
|
-
let r = this.proxy, i =
|
|
1641
|
-
|
|
1640
|
+
let r = this.proxy, i = ue(e) ? e.includes(".") ? nr(r, e) : () => r[e] : e.bind(r, r), a;
|
|
1641
|
+
L(t) ? a = t : (a = t.handler, n = t);
|
|
1642
1642
|
let o = Jr(this), s = er(i, a.bind(r), n);
|
|
1643
1643
|
return o(), s;
|
|
1644
1644
|
}
|
|
@@ -1673,7 +1673,7 @@ var ar = /* @__PURE__ */ Symbol.for("v-ndc"), or = (e) => e ? Yr(e) ? Zr(e) : or
|
|
|
1673
1673
|
},
|
|
1674
1674
|
$nextTick: (e) => e.n ||= kn.bind(e.proxy),
|
|
1675
1675
|
$watch: (e) => tr.bind(e)
|
|
1676
|
-
}), cr = (e, t) => e !== oe && !e.__isScriptSetup &&
|
|
1676
|
+
}), cr = (e, t) => e !== oe && !e.__isScriptSetup && P(e, t), lr = {
|
|
1677
1677
|
get({ _: e }, t) {
|
|
1678
1678
|
if (t === "__v_skip") return !0;
|
|
1679
1679
|
let { ctx: n, setupState: r, data: i, props: a, accessCache: o, type: s, appContext: c } = e;
|
|
@@ -1687,21 +1687,21 @@ var ar = /* @__PURE__ */ Symbol.for("v-ndc"), or = (e) => e ? Yr(e) ? Zr(e) : or
|
|
|
1687
1687
|
case 3: return a[t];
|
|
1688
1688
|
}
|
|
1689
1689
|
else if (cr(r, t)) return o[t] = 1, r[t];
|
|
1690
|
-
else if (i !== oe &&
|
|
1691
|
-
else if (
|
|
1692
|
-
else if (n !== oe &&
|
|
1690
|
+
else if (i !== oe && P(i, t)) return o[t] = 2, i[t];
|
|
1691
|
+
else if (P(a, t)) return o[t] = 3, a[t];
|
|
1692
|
+
else if (n !== oe && P(n, t)) return o[t] = 4, n[t];
|
|
1693
1693
|
else dr && (o[t] = 0);
|
|
1694
1694
|
}
|
|
1695
1695
|
let l = sr[t], u, d;
|
|
1696
1696
|
if (l) return t === "$attrs" ? (et(e.attrs, "get", ""), process.env.NODE_ENV) : process.env.NODE_ENV !== "production" && t === "$slots" && et(e, "get", t), l(e);
|
|
1697
1697
|
if ((u = s.__cssModules) && (u = u[t])) return u;
|
|
1698
|
-
if (n !== oe &&
|
|
1699
|
-
if (d = c.config.globalProperties,
|
|
1698
|
+
if (n !== oe && P(n, t)) return o[t] = 4, n[t];
|
|
1699
|
+
if (d = c.config.globalProperties, P(d, t)) return d[t];
|
|
1700
1700
|
process.env.NODE_ENV;
|
|
1701
1701
|
},
|
|
1702
1702
|
set({ _: e }, t, n) {
|
|
1703
1703
|
let { data: r, setupState: i, ctx: a } = e;
|
|
1704
|
-
return cr(i, t) ? (i[t] = n, !0) : process.env.NODE_ENV !== "production" && i.__isScriptSetup &&
|
|
1704
|
+
return cr(i, t) ? (i[t] = n, !0) : process.env.NODE_ENV !== "production" && i.__isScriptSetup && P(i, t) ? (un(`Cannot mutate <script setup> binding "${t}" from Options API.`), !1) : r !== oe && P(r, t) ? (r[t] = n, !0) : P(e.props, t) ? (process.env.NODE_ENV !== "production" && un(`Attempting to mutate prop "${t}". Props are readonly.`), !1) : t[0] === "$" && t.slice(1) in e ? (process.env.NODE_ENV !== "production" && un(`Attempting to mutate public property "${t}". Properties starting with $ are reserved and readonly.`), !1) : (process.env.NODE_ENV !== "production" && t in e.appContext.config.globalProperties ? Object.defineProperty(a, t, {
|
|
1705
1705
|
enumerable: !0,
|
|
1706
1706
|
configurable: !0,
|
|
1707
1707
|
value: n
|
|
@@ -1709,20 +1709,20 @@ var ar = /* @__PURE__ */ Symbol.for("v-ndc"), or = (e) => e ? Yr(e) ? Zr(e) : or
|
|
|
1709
1709
|
},
|
|
1710
1710
|
has({ _: { data: e, setupState: t, accessCache: n, ctx: r, appContext: i, props: a, type: o } }, s) {
|
|
1711
1711
|
let c;
|
|
1712
|
-
return !!(n[s] || e !== oe && s[0] !== "$" &&
|
|
1712
|
+
return !!(n[s] || e !== oe && s[0] !== "$" && P(e, s) || cr(t, s) || P(a, s) || P(r, s) || P(sr, s) || P(i.config.globalProperties, s) || (c = o.__cssModules) && c[s]);
|
|
1713
1713
|
},
|
|
1714
1714
|
defineProperty(e, t, n) {
|
|
1715
|
-
return n.get == null ?
|
|
1715
|
+
return n.get == null ? P(n, "value") && this.set(e, t, n.value, null) : e._.accessCache[t] = 0, Reflect.defineProperty(e, t, n);
|
|
1716
1716
|
}
|
|
1717
1717
|
};
|
|
1718
1718
|
process.env.NODE_ENV !== "production" && (lr.ownKeys = (e) => (un("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."), Reflect.ownKeys(e)));
|
|
1719
1719
|
function ur(e) {
|
|
1720
|
-
return
|
|
1720
|
+
return F(e) ? e.reduce((e, t) => (e[t] = null, e), {}) : e;
|
|
1721
1721
|
}
|
|
1722
1722
|
var dr = !0;
|
|
1723
1723
|
function fr(e) {
|
|
1724
1724
|
let t = e.type, { mixins: n, extends: r } = t, { mixins: i, optionsCache: a, config: { optionMergeStrategies: o } } = e.appContext, s = a.get(t), c;
|
|
1725
|
-
return s ? c = s : !i.length && !n && !r ? c = t : (c = {}, i.length && i.forEach((e) => pr(c, e, o, !0)), pr(c, t, o)),
|
|
1725
|
+
return s ? c = s : !i.length && !n && !r ? c = t : (c = {}, i.length && i.forEach((e) => pr(c, e, o, !0)), pr(c, t, o)), fe(t) && a.set(t, c), c;
|
|
1726
1726
|
}
|
|
1727
1727
|
function pr(e, t, n, r = !1) {
|
|
1728
1728
|
let { mixins: i, extends: a } = t;
|
|
@@ -1762,14 +1762,14 @@ var mr = {
|
|
|
1762
1762
|
};
|
|
1763
1763
|
function hr(e, t) {
|
|
1764
1764
|
return t ? e ? function() {
|
|
1765
|
-
return M(
|
|
1765
|
+
return M(L(e) ? e.call(this, this) : e, L(t) ? t.call(this, this) : t);
|
|
1766
1766
|
} : t : e;
|
|
1767
1767
|
}
|
|
1768
1768
|
function gr(e, t) {
|
|
1769
1769
|
return yr(_r(e), _r(t));
|
|
1770
1770
|
}
|
|
1771
1771
|
function _r(e) {
|
|
1772
|
-
if (
|
|
1772
|
+
if (F(e)) {
|
|
1773
1773
|
let t = {};
|
|
1774
1774
|
for (let n = 0; n < e.length; n++) t[e[n]] = e[n];
|
|
1775
1775
|
return t;
|
|
@@ -1783,7 +1783,7 @@ function yr(e, t) {
|
|
|
1783
1783
|
return e ? M(/* @__PURE__ */ Object.create(null), e, t) : t;
|
|
1784
1784
|
}
|
|
1785
1785
|
function br(e, t) {
|
|
1786
|
-
return e ?
|
|
1786
|
+
return e ? F(e) && F(t) ? [.../* @__PURE__ */ new Set([...e, ...t])] : M(/* @__PURE__ */ Object.create(null), ur(e), ur(t ?? {})) : t;
|
|
1787
1787
|
}
|
|
1788
1788
|
function xr(e, t) {
|
|
1789
1789
|
if (!e) return t;
|
|
@@ -1794,13 +1794,13 @@ function xr(e, t) {
|
|
|
1794
1794
|
}
|
|
1795
1795
|
var Sr = null, Cr = {}, wr = (e) => Object.getPrototypeOf(e) === Cr, Tr = Dr, Er = (e) => e.__isSuspense;
|
|
1796
1796
|
function Dr(e, t) {
|
|
1797
|
-
t && t.pendingBranch ?
|
|
1797
|
+
t && t.pendingBranch ? F(e) ? t.effects.push(...e) : t.effects.push(e) : Nn(e);
|
|
1798
1798
|
}
|
|
1799
1799
|
var Or = /* @__PURE__ */ Symbol.for("v-fgt"), kr = /* @__PURE__ */ Symbol.for("v-txt"), Ar = /* @__PURE__ */ Symbol.for("v-cmt");
|
|
1800
1800
|
function jr(e) {
|
|
1801
1801
|
return e ? e.__v_isVNode === !0 : !1;
|
|
1802
1802
|
}
|
|
1803
|
-
var Mr, Nr = (...e) => Rr(...Mr ? Mr(e, Yn) : e), Pr = ({ key: e }) => e ?? null, Fr = ({ ref: e, ref_key: t, ref_for: n }) => (typeof e == "number" && (e = "" + e), e == null ? null :
|
|
1803
|
+
var Mr, Nr = (...e) => Rr(...Mr ? Mr(e, Yn) : e), Pr = ({ key: e }) => e ?? null, Fr = ({ ref: e, ref_key: t, ref_for: n }) => (typeof e == "number" && (e = "" + e), e == null ? null : ue(e) || /* @__PURE__ */ Y(e) || L(e) ? {
|
|
1804
1804
|
i: Yn,
|
|
1805
1805
|
r: e,
|
|
1806
1806
|
k: t,
|
|
@@ -1836,7 +1836,7 @@ function Ir(e, t = null, n = null, r = 0, i = null, a = e === Or ? 0 : 1, o = !1
|
|
|
1836
1836
|
appContext: null,
|
|
1837
1837
|
ctx: Yn
|
|
1838
1838
|
};
|
|
1839
|
-
return s ? (Ur(c, n), a & 128 && e.normalize(c)) : n && (c.shapeFlag |=
|
|
1839
|
+
return s ? (Ur(c, n), a & 128 && e.normalize(c)) : n && (c.shapeFlag |= ue(n) ? 8 : 16), process.env.NODE_ENV !== "production" && c.key !== c.key && un("VNode created with invalid key (NaN). VNode type:", c.type), c;
|
|
1840
1840
|
}
|
|
1841
1841
|
var Lr = process.env.NODE_ENV === "production" ? Rr : Nr;
|
|
1842
1842
|
function Rr(e, t = null, n = null, r = 0, i = null, a = !1) {
|
|
@@ -1847,9 +1847,9 @@ function Rr(e, t = null, n = null, r = 0, i = null, a = !1) {
|
|
|
1847
1847
|
if (ni(e) && (e = e.__vccOpts), t) {
|
|
1848
1848
|
t = zr(t);
|
|
1849
1849
|
let { class: e, style: n } = t;
|
|
1850
|
-
e && !
|
|
1850
|
+
e && !ue(e) && (t.class = U(e)), fe(n) && (/* @__PURE__ */ Vt(n) && !F(n) && (n = M({}, n)), t.style = V(n));
|
|
1851
1851
|
}
|
|
1852
|
-
let o =
|
|
1852
|
+
let o = ue(e) ? 1 : Er(e) ? 128 : rr(e) ? 64 : fe(e) ? 4 : L(e) ? 2 : 0;
|
|
1853
1853
|
return process.env.NODE_ENV !== "production" && o & 4 && /* @__PURE__ */ Vt(e) && (e = /* @__PURE__ */ q(e), un("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.", "\nComponent that was made reactive: ", e)), Ir(e, t, n, r, i, o, a, !0);
|
|
1854
1854
|
}
|
|
1855
1855
|
function zr(e) {
|
|
@@ -1862,10 +1862,10 @@ function Br(e, t, n = !1, r = !1) {
|
|
|
1862
1862
|
type: e.type,
|
|
1863
1863
|
props: l,
|
|
1864
1864
|
key: l && Pr(l),
|
|
1865
|
-
ref: t && t.ref ? n && a ?
|
|
1865
|
+
ref: t && t.ref ? n && a ? F(a) ? a.concat(Fr(t)) : [a, Fr(t)] : Fr(t) : a,
|
|
1866
1866
|
scopeId: e.scopeId,
|
|
1867
1867
|
slotScopeIds: e.slotScopeIds,
|
|
1868
|
-
children: process.env.NODE_ENV !== "production" && o === -1 &&
|
|
1868
|
+
children: process.env.NODE_ENV !== "production" && o === -1 && F(s) ? s.map(Vr) : s,
|
|
1869
1869
|
target: e.target,
|
|
1870
1870
|
targetStart: e.targetStart,
|
|
1871
1871
|
targetAnchor: e.targetAnchor,
|
|
@@ -1891,7 +1891,7 @@ function Br(e, t, n = !1, r = !1) {
|
|
|
1891
1891
|
}
|
|
1892
1892
|
function Vr(e) {
|
|
1893
1893
|
let t = Br(e);
|
|
1894
|
-
return
|
|
1894
|
+
return F(e.children) && (t.children = e.children.map(Vr)), t;
|
|
1895
1895
|
}
|
|
1896
1896
|
function Hr(e = " ", t = 0) {
|
|
1897
1897
|
return Lr(kr, null, e, t);
|
|
@@ -1899,13 +1899,13 @@ function Hr(e = " ", t = 0) {
|
|
|
1899
1899
|
function Ur(e, t) {
|
|
1900
1900
|
let n = 0, { shapeFlag: r } = e;
|
|
1901
1901
|
if (t == null) t = null;
|
|
1902
|
-
else if (
|
|
1902
|
+
else if (F(t)) n = 16;
|
|
1903
1903
|
else if (typeof t == "object") if (r & 65) {
|
|
1904
1904
|
let n = t.default;
|
|
1905
1905
|
n && (n._c && (n._d = !1), Ur(e, n()), n._c && (n._d = !0));
|
|
1906
1906
|
return;
|
|
1907
1907
|
} else n = 32, !t._ && !wr(t) && (t._ctx = Yn);
|
|
1908
|
-
else if (
|
|
1908
|
+
else if (L(t)) {
|
|
1909
1909
|
if (r & 65) {
|
|
1910
1910
|
Ur(e, { default: t });
|
|
1911
1911
|
return;
|
|
@@ -1925,7 +1925,7 @@ function Wr(...e) {
|
|
|
1925
1925
|
else if (e === "style") t.style = V([t.style, r.style]);
|
|
1926
1926
|
else if (j(e)) {
|
|
1927
1927
|
let n = t[e], i = r[e];
|
|
1928
|
-
i && n !== i && !(
|
|
1928
|
+
i && n !== i && !(F(n) && n.includes(i)) ? t[e] = n ? [].concat(n, i) : i : i == null && n == null && !se(e) && (t[e] = i);
|
|
1929
1929
|
} else e !== "" && (t[e] = r[e]);
|
|
1930
1930
|
}
|
|
1931
1931
|
return t;
|
|
@@ -1964,7 +1964,7 @@ function Zr(e) {
|
|
|
1964
1964
|
}
|
|
1965
1965
|
var Qr = /(?:^|[-_])\w/g, $r = (e) => e.replace(Qr, (e) => e.toUpperCase()).replace(/[-_]/g, "");
|
|
1966
1966
|
function ei(e, t = !0) {
|
|
1967
|
-
return
|
|
1967
|
+
return L(e) ? e.displayName || e.name : e.name || t && e.__name;
|
|
1968
1968
|
}
|
|
1969
1969
|
function ti(e, t, n = !1) {
|
|
1970
1970
|
let r = ei(t);
|
|
@@ -1981,7 +1981,7 @@ function ti(e, t, n = !1) {
|
|
|
1981
1981
|
return r ? $r(r) : n ? "App" : "Anonymous";
|
|
1982
1982
|
}
|
|
1983
1983
|
function ni(e) {
|
|
1984
|
-
return
|
|
1984
|
+
return L(e) && "__vccOpts" in e;
|
|
1985
1985
|
}
|
|
1986
1986
|
var ri = (e, t) => {
|
|
1987
1987
|
let n = /* @__PURE__ */ $t(e, t, Xr);
|
|
@@ -1996,7 +1996,7 @@ function ii() {
|
|
|
1996
1996
|
let e = { style: "color:#3ba776" }, t = { style: "color:#1677ff" }, n = { style: "color:#f5222d" }, r = { style: "color:#eb2f96" }, i = {
|
|
1997
1997
|
__vue_custom_formatter: !0,
|
|
1998
1998
|
header(t) {
|
|
1999
|
-
if (!
|
|
1999
|
+
if (!fe(t)) return null;
|
|
2000
2000
|
if (t.__isVue) return [
|
|
2001
2001
|
"div",
|
|
2002
2002
|
e,
|
|
@@ -2109,7 +2109,7 @@ function ii() {
|
|
|
2109
2109
|
"span",
|
|
2110
2110
|
r,
|
|
2111
2111
|
e
|
|
2112
|
-
] :
|
|
2112
|
+
] : fe(e) ? ["object", { object: i ? /* @__PURE__ */ q(e) : e }] : [
|
|
2113
2113
|
"span",
|
|
2114
2114
|
n,
|
|
2115
2115
|
String(e)
|
|
@@ -2117,14 +2117,14 @@ function ii() {
|
|
|
2117
2117
|
}
|
|
2118
2118
|
function c(e, t) {
|
|
2119
2119
|
let n = e.type;
|
|
2120
|
-
if (
|
|
2120
|
+
if (L(n)) return;
|
|
2121
2121
|
let r = {};
|
|
2122
2122
|
for (let i in e.ctx) l(n, i, t) && (r[i] = e.ctx[i]);
|
|
2123
2123
|
return r;
|
|
2124
2124
|
}
|
|
2125
2125
|
function l(e, t, n) {
|
|
2126
2126
|
let r = e[n];
|
|
2127
|
-
if (
|
|
2127
|
+
if (F(r) && r.includes(t) || fe(r) && t in r || e.extends && l(e.extends, t, n) || e.mixins && e.mixins.some((e) => l(e, t, n))) return !0;
|
|
2128
2128
|
}
|
|
2129
2129
|
function u(e) {
|
|
2130
2130
|
return /* @__PURE__ */ Bt(e) ? "ShallowRef" : e.effect ? "ComputedRef" : "Ref";
|
|
@@ -3998,50 +3998,50 @@ function js(e) {
|
|
|
3998
3998
|
function Ms(e) {
|
|
3999
3999
|
let { apiKey: t, baseUrl: s, model: c = "deepseek-v4-flash", temperature: l = .7, maxTokens: u, extraBody: d, extraConfig: f, systemPrompt: p, tools: m = [], middleware: h = [], maxToolRounds: g, maxIterations: _, maxRetries: S = 2, retryDelayMs: C = 500, stallMs: E = fa, streamMaxMs: D = ma, toolTimeoutMs: O, maxParallelTools: k = 1, maxVerifyAttempts: ne = 0, roundTokenBudget: re = 0, onLog: ae, onLlmChange: oe, imageContentFormat: A = "openai", staleReadInvalidation: j = !0, debug: se = !1 } = e, M = g ?? xs;
|
|
4000
4000
|
(!Number.isFinite(M) || M < 1) && (console.warn(`[page-agent-sdk] maxToolRounds=${M} 非法(须 ≥1 正整数),已 clamp 到 1(0/负数致主循环 while 不进 → agent 不调 LLM 静默返回兜底文案)`), M = 1);
|
|
4001
|
-
let
|
|
4001
|
+
let ce = v({
|
|
4002
4002
|
model: c,
|
|
4003
4003
|
contextWindow: e.contextWindow,
|
|
4004
4004
|
maxOutputTokens: e.maxOutputTokens,
|
|
4005
4005
|
vision: e.vision
|
|
4006
|
-
}),
|
|
4007
|
-
function
|
|
4008
|
-
|
|
4006
|
+
}), N = u ?? ce.maxOutputTokens, P = b(ce.contextWindow), F = x(ce.contextWindow);
|
|
4007
|
+
function le(e) {
|
|
4008
|
+
ce = e, P = b(ce.contextWindow), F = x(ce.contextWindow);
|
|
4009
4009
|
}
|
|
4010
|
-
let
|
|
4010
|
+
let I = /* @__PURE__ */ Gt([]), L = 0, ue = () => ({
|
|
4011
4011
|
retries: 0,
|
|
4012
4012
|
exhausted: 0
|
|
4013
|
-
}),
|
|
4014
|
-
transitional_retry:
|
|
4015
|
-
completion_gate:
|
|
4016
|
-
evidence_audit_gate:
|
|
4017
|
-
zero_tool_gate:
|
|
4018
|
-
status_query_gate:
|
|
4019
|
-
...e.pageAssertionGate === !0 ? { page_assertion_gate:
|
|
4020
|
-
},
|
|
4013
|
+
}), de = {
|
|
4014
|
+
transitional_retry: ue(),
|
|
4015
|
+
completion_gate: ue(),
|
|
4016
|
+
evidence_audit_gate: ue(),
|
|
4017
|
+
zero_tool_gate: ue(),
|
|
4018
|
+
status_query_gate: ue(),
|
|
4019
|
+
...e.pageAssertionGate === !0 ? { page_assertion_gate: ue() } : {}
|
|
4020
|
+
}, fe = {
|
|
4021
4021
|
ZERO_TOOL_GATE_EXHAUSTED: "zero_tool_gate",
|
|
4022
4022
|
AUDIT_GATE_EXHAUSTED: "evidence_audit_gate",
|
|
4023
4023
|
COMPLETION_GATE_EXHAUSTED: "completion_gate",
|
|
4024
4024
|
PAGE_ASSERTION_GATE_EXHAUSTED: "page_assertion_gate"
|
|
4025
|
-
},
|
|
4025
|
+
}, pe = [], me = 0, he = 0, R = /* @__PURE__ */ new Set();
|
|
4026
4026
|
function z(e, t) {
|
|
4027
4027
|
let n = {
|
|
4028
4028
|
timestamp: Date.now(),
|
|
4029
4029
|
type: e,
|
|
4030
4030
|
data: Es(t)
|
|
4031
4031
|
};
|
|
4032
|
-
|
|
4032
|
+
I.value.push(n), I.value.length > Ss && I.value.splice(0, I.value.length - Ss), Jt(I), ae?.(n), se && console.log(`%c[Agent] ${e}`, "color:#667eea;font-weight:bold", t);
|
|
4033
4033
|
}
|
|
4034
4034
|
let B = (e) => {
|
|
4035
|
-
|
|
4035
|
+
I.value.push({
|
|
4036
4036
|
...e,
|
|
4037
4037
|
timestamp: typeof e.timestamp == "number" ? e.timestamp : Date.now(),
|
|
4038
4038
|
data: Es(e.data)
|
|
4039
|
-
}),
|
|
4039
|
+
}), I.value.length > Ss && I.value.splice(0, I.value.length - Ss), Jt(I);
|
|
4040
4040
|
}, ge = [...h.flatMap((e) => e.tools || []), ...m], _e = e.llm ?? new n({
|
|
4041
4041
|
apiKey: t,
|
|
4042
4042
|
model: c,
|
|
4043
4043
|
temperature: l,
|
|
4044
|
-
maxTokens:
|
|
4044
|
+
maxTokens: N,
|
|
4045
4045
|
maxRetries: 0,
|
|
4046
4046
|
configuration: {
|
|
4047
4047
|
...s ? { baseURL: T(s) } : {},
|
|
@@ -4078,16 +4078,16 @@ function Ms(e) {
|
|
|
4078
4078
|
pin: H.has(e.name)
|
|
4079
4079
|
});
|
|
4080
4080
|
}
|
|
4081
|
-
let n = Math.max(2e3, Math.round(
|
|
4081
|
+
let n = Math.max(2e3, Math.round(ce.contextWindow * xe)), r = y(e) + t.reduce((e, t) => e + t.tokens, 0), i = /* @__PURE__ */ new Set();
|
|
4082
4082
|
if (r > n) {
|
|
4083
4083
|
let e = r, a = [];
|
|
4084
4084
|
for (let e of t.filter((e) => !e.pin).sort((e, t) => t.tokens - e.tokens)) {
|
|
4085
4085
|
if (r <= n) break;
|
|
4086
4086
|
a.push(`${e.name}(${e.tokens})`), i.add(e.name), r -= e.tokens, e.text = "";
|
|
4087
4087
|
}
|
|
4088
|
-
a.length && console.warn(`[page-agent-sdk] 系统段超预算(${e} > ${n} tokens,窗口 ${
|
|
4088
|
+
a.length && console.warn(`[page-agent-sdk] 系统段超预算(${e} > ${n} tokens,窗口 ${ce.contextWindow} 的 ${xe * 100}%),drop 非核心段:${a.join(", ")}(保 base/mission/workingMemory)`);
|
|
4089
4089
|
}
|
|
4090
|
-
return
|
|
4090
|
+
return pe = t.map((e) => ({
|
|
4091
4091
|
name: e.name,
|
|
4092
4092
|
tokens: e.tokens,
|
|
4093
4093
|
dropped: i.has(e.name)
|
|
@@ -4096,7 +4096,7 @@ function Ms(e) {
|
|
|
4096
4096
|
function Ce(e) {
|
|
4097
4097
|
let t = [new a(Se())];
|
|
4098
4098
|
for (let n of e) if (n.role === "user") {
|
|
4099
|
-
let e = n.quote ? Pi(n.content, n.quote) : n.content, r =
|
|
4099
|
+
let e = n.quote ? Pi(n.content, n.quote) : n.content, r = ce.vision && n.images?.length ? yi(e, n.images, A) : null;
|
|
4100
4100
|
r ? t.push(new i({ content: r })) : n.images?.some((e) => e.description) ? t.push(new i(bi(e, n.images))) : t.push(new i(e));
|
|
4101
4101
|
} else n.role === "assistant" ? t.push(new r(n.content)) : n.role === "system" && t.push(new a(n.content));
|
|
4102
4102
|
return t;
|
|
@@ -4112,7 +4112,7 @@ function Ms(e) {
|
|
|
4112
4112
|
baseDelayMs: C,
|
|
4113
4113
|
onRetry: ({ attempt: e, error: t, waitMs: n }) => {
|
|
4114
4114
|
let r = t?.message ?? String(t);
|
|
4115
|
-
|
|
4115
|
+
me += 1, z("error", {
|
|
4116
4116
|
stage: "model_retry",
|
|
4117
4117
|
at: "launch",
|
|
4118
4118
|
attempt: e,
|
|
@@ -4145,23 +4145,23 @@ function Ms(e) {
|
|
|
4145
4145
|
};
|
|
4146
4146
|
if (ga(a) && !e._ctxRetry) {
|
|
4147
4147
|
e._ctxRetry = !0;
|
|
4148
|
-
let r = (e) => y(typeof e.content == "string" ? e.content : JSON.stringify(e.content)), a = e.messages.reduce((e, t) => e + r(t), 0), o = W(e.messages, Math.round(
|
|
4148
|
+
let r = (e) => y(typeof e.content == "string" ? e.content : JSON.stringify(e.content)), a = e.messages.reduce((e, t) => e + r(t), 0), o = W(e.messages, Math.round(ce.contextWindow * .3)), s = o.reduce((e, t) => e + r(t), 0);
|
|
4149
4149
|
return z("error", {
|
|
4150
4150
|
stage: "context_overflow_retry",
|
|
4151
4151
|
at: "launch",
|
|
4152
4152
|
beforeTokens: a,
|
|
4153
4153
|
afterTokens: s,
|
|
4154
|
-
window:
|
|
4154
|
+
window: ce.contextWindow
|
|
4155
4155
|
}), console.warn(`[page-agent-sdk] 上下文超限(启动)→ 激进 trim 重试:${a} → ${s} tokens`), we({
|
|
4156
4156
|
...e,
|
|
4157
4157
|
messages: o
|
|
4158
4158
|
}, t, n, i);
|
|
4159
4159
|
}
|
|
4160
|
-
throw ya(a) ? (
|
|
4160
|
+
throw ya(a) ? (he += 1, z("error", {
|
|
4161
4161
|
stage: "model_unavailable",
|
|
4162
4162
|
at: "launch",
|
|
4163
4163
|
status: a?.status
|
|
4164
|
-
})) : (
|
|
4164
|
+
})) : (he += 1, z("error", {
|
|
4165
4165
|
stage: "model_call_failed",
|
|
4166
4166
|
at: "launch",
|
|
4167
4167
|
retries: S,
|
|
@@ -4190,7 +4190,7 @@ function Ms(e) {
|
|
|
4190
4190
|
});
|
|
4191
4191
|
}
|
|
4192
4192
|
} catch (a) {
|
|
4193
|
-
if (a instanceof ua) throw s.abort(),
|
|
4193
|
+
if (a instanceof ua) throw s.abort(), he += 1, z("error", {
|
|
4194
4194
|
stage: a instanceof da ? "stream_max_duration" : "stream_stalled",
|
|
4195
4195
|
waitedMs: a.waitedMs,
|
|
4196
4196
|
stallMs: E,
|
|
@@ -4204,20 +4204,20 @@ function Ms(e) {
|
|
|
4204
4204
|
};
|
|
4205
4205
|
if (ga(a) && l === null && u === "" && !e._ctxRetry) {
|
|
4206
4206
|
e._ctxRetry = !0;
|
|
4207
|
-
let r = (e) => y(typeof e.content == "string" ? e.content : JSON.stringify(e.content)), a = e.messages.reduce((e, t) => e + r(t), 0), o = W(e.messages, Math.round(
|
|
4207
|
+
let r = (e) => y(typeof e.content == "string" ? e.content : JSON.stringify(e.content)), a = e.messages.reduce((e, t) => e + r(t), 0), o = W(e.messages, Math.round(ce.contextWindow * .3)), s = o.reduce((e, t) => e + r(t), 0);
|
|
4208
4208
|
return z("error", {
|
|
4209
4209
|
stage: "context_overflow_retry",
|
|
4210
4210
|
beforeTokens: a,
|
|
4211
4211
|
afterTokens: s,
|
|
4212
|
-
window:
|
|
4213
|
-
}), console.warn(`[page-agent-sdk] 上下文超限 → 激进 trim 重试:${a} → ${s} tokens(窗口 ${
|
|
4212
|
+
window: ce.contextWindow
|
|
4213
|
+
}), console.warn(`[page-agent-sdk] 上下文超限 → 激进 trim 重试:${a} → ${s} tokens(窗口 ${ce.contextWindow})`), we({
|
|
4214
4214
|
...e,
|
|
4215
4215
|
messages: o
|
|
4216
4216
|
}, t, n, i);
|
|
4217
4217
|
}
|
|
4218
4218
|
let o = (e._iterRetries ?? 0) + 1;
|
|
4219
4219
|
if (l === null && u === "" && o <= S && oa(a, n)) {
|
|
4220
|
-
e._iterRetries = o,
|
|
4220
|
+
e._iterRetries = o, me += 1;
|
|
4221
4221
|
let s = C * 2 ** (o - 1);
|
|
4222
4222
|
if (z("error", {
|
|
4223
4223
|
stage: "model_retry",
|
|
@@ -4249,11 +4249,11 @@ function Ms(e) {
|
|
|
4249
4249
|
}
|
|
4250
4250
|
return we(e, t, n, i);
|
|
4251
4251
|
}
|
|
4252
|
-
throw ya(a) ? (
|
|
4252
|
+
throw ya(a) ? (he += 1, z("error", {
|
|
4253
4253
|
stage: "model_unavailable",
|
|
4254
4254
|
at: "iterate",
|
|
4255
4255
|
status: a?.status
|
|
4256
|
-
})) : (
|
|
4256
|
+
})) : (he += 1, z("error", {
|
|
4257
4257
|
stage: "model_call_failed",
|
|
4258
4258
|
at: "iterate",
|
|
4259
4259
|
emitted: l !== null || u !== "",
|
|
@@ -4269,7 +4269,7 @@ function Ms(e) {
|
|
|
4269
4269
|
stage: "empty_llm_response",
|
|
4270
4270
|
retried: !0,
|
|
4271
4271
|
hint: "重试后仍零 chunk,抛 EmptyLLMResponseError 显式报错"
|
|
4272
|
-
}),
|
|
4272
|
+
}), he += 1, new pa();
|
|
4273
4273
|
}
|
|
4274
4274
|
let d = l;
|
|
4275
4275
|
return {
|
|
@@ -4312,8 +4312,8 @@ function Ms(e) {
|
|
|
4312
4312
|
files: e.state.files,
|
|
4313
4313
|
vfsAvailable: !!e.state.files && o,
|
|
4314
4314
|
toolName: e.name,
|
|
4315
|
-
threshold:
|
|
4316
|
-
passThroughChars:
|
|
4315
|
+
threshold: P,
|
|
4316
|
+
passThroughChars: F
|
|
4317
4317
|
}).content, {
|
|
4318
4318
|
content: a,
|
|
4319
4319
|
status: "done"
|
|
@@ -4360,9 +4360,9 @@ function Ms(e) {
|
|
|
4360
4360
|
});
|
|
4361
4361
|
}
|
|
4362
4362
|
{
|
|
4363
|
-
let e = y(p || "你是一个智能助手。"), t = Math.max(2e3, Math.round(
|
|
4363
|
+
let e = y(p || "你是一个智能助手。"), t = Math.max(2e3, Math.round(ce.contextWindow * xe));
|
|
4364
4364
|
if (e > t) {
|
|
4365
|
-
let r = `[page-agent-sdk] systemPrompt 本身(${e} tokens)超过系统段预算(${t} tokens,窗口 ${
|
|
4365
|
+
let r = `[page-agent-sdk] systemPrompt 本身(${e} tokens)超过系统段预算(${t} tokens,窗口 ${ce.contextWindow} 的 ${xe * 100}%);请缩减 systemPrompt 或换更大窗口模型`;
|
|
4366
4366
|
return console.error(r), n({
|
|
4367
4367
|
type: "error",
|
|
4368
4368
|
message: r,
|
|
@@ -4430,7 +4430,7 @@ function Ms(e) {
|
|
|
4430
4430
|
}), V = ls(h, {
|
|
4431
4431
|
messages: c,
|
|
4432
4432
|
state: V
|
|
4433
|
-
}), c = U(c, ks(S, M, e.hasSubagent)), c = W(c, Math.round(
|
|
4433
|
+
}), c = U(c, ks(S, M, e.hasSubagent)), c = W(c, Math.round(ce.contextWindow * .6)), z("llm_request", {
|
|
4434
4434
|
round: S + 1,
|
|
4435
4435
|
model: ye(),
|
|
4436
4436
|
tools: ge.map((e) => e.name),
|
|
@@ -4509,7 +4509,7 @@ function Ms(e) {
|
|
|
4509
4509
|
turnUsage: f,
|
|
4510
4510
|
isWriteToolByName: x,
|
|
4511
4511
|
messages: c,
|
|
4512
|
-
sessionWritePaths:
|
|
4512
|
+
sessionWritePaths: R,
|
|
4513
4513
|
todosStatusAtStart: g,
|
|
4514
4514
|
pageGate: e.pageAssertionGate === !0,
|
|
4515
4515
|
pageReadTools: e.pageReadTools,
|
|
@@ -4517,7 +4517,7 @@ function Ms(e) {
|
|
|
4517
4517
|
});
|
|
4518
4518
|
if (a?.kind === "feedback") {
|
|
4519
4519
|
O = !0;
|
|
4520
|
-
let e =
|
|
4520
|
+
let e = de[a.gate.stage];
|
|
4521
4521
|
e && (e.retries += 1), z("middleware", {
|
|
4522
4522
|
stage: a.gate.stage,
|
|
4523
4523
|
attempt: a.gate.attempt,
|
|
@@ -4527,8 +4527,8 @@ function Ms(e) {
|
|
|
4527
4527
|
continue;
|
|
4528
4528
|
}
|
|
4529
4529
|
if (a?.kind === "observable") {
|
|
4530
|
-
let e =
|
|
4531
|
-
e &&
|
|
4530
|
+
let e = fe[a.obs.code];
|
|
4531
|
+
e && de[e] && (de[e].exhausted += 1), z("error", {
|
|
4532
4532
|
stage: a.obs.code,
|
|
4533
4533
|
...a.obs.context,
|
|
4534
4534
|
content: t.content.slice(0, 160)
|
|
@@ -4675,7 +4675,7 @@ function Ms(e) {
|
|
|
4675
4675
|
args: p[e].call.args,
|
|
4676
4676
|
callIndex: e
|
|
4677
4677
|
});
|
|
4678
|
-
if (r) for (let e of r.paths)
|
|
4678
|
+
if (r) for (let e of r.paths) R.add(e);
|
|
4679
4679
|
}
|
|
4680
4680
|
}
|
|
4681
4681
|
if (j && y.length) {
|
|
@@ -4683,7 +4683,7 @@ function Ms(e) {
|
|
|
4683
4683
|
round: S + 1,
|
|
4684
4684
|
maxParallelTools: k
|
|
4685
4685
|
});
|
|
4686
|
-
e.invalidatedCount > 0 && (c = e.messages,
|
|
4686
|
+
e.invalidatedCount > 0 && (c = e.messages, L += e.invalidatedCount, z("middleware", {
|
|
4687
4687
|
stage: "stale_read_invalidated",
|
|
4688
4688
|
round: S + 1,
|
|
4689
4689
|
writtenPaths: y.map((e) => js(e.args) || "(整体)"),
|
|
@@ -4716,9 +4716,9 @@ function Ms(e) {
|
|
|
4716
4716
|
maxIterations: w
|
|
4717
4717
|
}
|
|
4718
4718
|
});
|
|
4719
|
-
let te = is(V.todos ?? [], g,
|
|
4719
|
+
let te = is(V.todos ?? [], g, R);
|
|
4720
4720
|
if (te.length) {
|
|
4721
|
-
|
|
4721
|
+
de.evidence_audit_gate.exhausted += 1;
|
|
4722
4722
|
let e = te.map((e) => ({
|
|
4723
4723
|
id: e.id,
|
|
4724
4724
|
evidence: e.evidence
|
|
@@ -4815,19 +4815,19 @@ function Ms(e) {
|
|
|
4815
4815
|
get allTools() {
|
|
4816
4816
|
return ge;
|
|
4817
4817
|
},
|
|
4818
|
-
getStaleReadsInvalidated: () =>
|
|
4819
|
-
getLlmRetries: () =>
|
|
4820
|
-
getLlmCallFailures: () =>
|
|
4821
|
-
getGateStats: () =>
|
|
4822
|
-
getLastSystemSegments: () =>
|
|
4818
|
+
getStaleReadsInvalidated: () => L,
|
|
4819
|
+
getLlmRetries: () => me,
|
|
4820
|
+
getLlmCallFailures: () => he,
|
|
4821
|
+
getGateStats: () => de,
|
|
4822
|
+
getLastSystemSegments: () => pe,
|
|
4823
4823
|
resetSessionCounters: () => {
|
|
4824
|
-
|
|
4825
|
-
for (let e of Object.keys(
|
|
4824
|
+
L = 0, me = 0, he = 0;
|
|
4825
|
+
for (let e of Object.keys(de)) de[e] = ue();
|
|
4826
4826
|
},
|
|
4827
4827
|
setTools: Ae,
|
|
4828
4828
|
setLlm: je,
|
|
4829
|
-
setModelCaps:
|
|
4830
|
-
debugLogs:
|
|
4829
|
+
setModelCaps: le,
|
|
4830
|
+
debugLogs: I,
|
|
4831
4831
|
getEffectiveSystemPrompt: () => Se()
|
|
4832
4832
|
};
|
|
4833
4833
|
}
|
|
@@ -5309,6 +5309,36 @@ var dc = {
|
|
|
5309
5309
|
"5. Prefer incremental write patches (send only the change, e.g. write({ value, patch:{ op, jsonPath } })) over resending the whole large JSON, which risks truncation;",
|
|
5310
5310
|
"6. If a write hits an optimistic-lock conflict (VERSION_CONFLICT returned, or the tool suspends awaiting the user decision): after the tool returns, follow its instruction (keep external → re-read then edit; overwritten/restored → continue from the result); do not abandon the task."
|
|
5311
5311
|
].join("\n"),
|
|
5312
|
+
answerLanes: [
|
|
5313
|
+
"【作答车道:先判问题形态,再选纪律】",
|
|
5314
|
+
"用户的问题分三类,判错车道是最大的答非所问:",
|
|
5315
|
+
"A. 问页面内容(「这页写了什么 / 哪里提到 / 原文是什么 / 这段在说什么」)",
|
|
5316
|
+
" → 以页面实料为准并点明出处;页面内容与你的先验知识冲突时以页面为准;页面没写就说没写,一句话即可,不列举查过哪些节。",
|
|
5317
|
+
"B. 问概念术语(「X 是什么 / 啥意思 / X 和 Y 什么区别」)",
|
|
5318
|
+
" → 页面有语境就先按页面语境讲;页面没有也必须直接用自己的知识解释,",
|
|
5319
|
+
" 开头一句「本页未提及,以下是通用解释:」即可 —— 不许把「页面上没有」当答案。",
|
|
5320
|
+
"C. 求观点经验(「你觉得呢 / 按你的经验 / 是不是很难 / 该怎么选」)",
|
|
5321
|
+
" → 直接给判断和理由;笔记口径与个人观点分开说(「本页的立场是…;我的看法是…」)。",
|
|
5322
|
+
" 页面没写不构成不答的理由。",
|
|
5323
|
+
"",
|
|
5324
|
+
"出处密度:只有「对页面内容的断言」才标出处(句末括注即可);概念解释、个人观点、",
|
|
5325
|
+
"过渡句一律不标。「没找到」的说明压成一句,不报检索过程。"
|
|
5326
|
+
].join("\n"),
|
|
5327
|
+
answerLanesEn: [
|
|
5328
|
+
"[Answer lanes: classify the question first, then pick the discipline]",
|
|
5329
|
+
"User questions fall into three categories; picking the wrong lane is the biggest way to miss the point:",
|
|
5330
|
+
"A. Asking about page content (\"what does this page say / where is it mentioned / what is the original text / what does this passage mean\")",
|
|
5331
|
+
" → Ground answers in what the page actually says and cite where it came from; when the page conflicts with your prior knowledge, the page wins; if the page does not say it, say so in one sentence — do not enumerate which sections you searched.",
|
|
5332
|
+
"B. Asking about a concept or term (\"what is X / what does it mean / how do X and Y differ\")",
|
|
5333
|
+
" → If the page has context for it, explain in that context first; if the page does not, you MUST still explain it directly from your own knowledge,",
|
|
5334
|
+
" opening with one line like \"Not covered on this page — general explanation:\" — never treat \"it is not on the page\" as the answer.",
|
|
5335
|
+
"C. Asking for your opinion or experience (\"what do you think / in your experience / is it hard to match / which should I choose\")",
|
|
5336
|
+
" → Give your judgment and reasoning directly; keep the notes' stance and your own view separate (\"this page's position is ...; my take is ...\").",
|
|
5337
|
+
" The page not covering it is never a reason to refuse.",
|
|
5338
|
+
"",
|
|
5339
|
+
"Citation density: only claims about page content get a citation (a short parenthetical); concept explanations,",
|
|
5340
|
+
"personal opinions, and transitions get none. Compress \"not found\" statements to one sentence; never narrate the search process."
|
|
5341
|
+
].join("\n"),
|
|
5312
5342
|
htmlPageOrchestrator: uc("html"),
|
|
5313
5343
|
htmlPageProposeFirst: ["【新建/创意类请求】先用简短文字给出 2~3 套方案(每套一两句风格/配色/结构要点),询问用户选哪套;选定前不要委派生成代码、不要写 components。", "【方案切换】已生成某套方案后改选另一套:不重新罗列,直接依据之前描述重新委派生成并覆盖相应组件(委派工具见编排段 use_<id>)。"].join("\n"),
|
|
5314
5344
|
htmlDirectWriteFallback: [
|
|
@@ -7827,14 +7857,14 @@ var cd = [
|
|
|
7827
7857
|
"你是一个页面内容助手,帮助用户理解、查找与排查其当前所在的网页。",
|
|
7828
7858
|
"你可以经专用工具探查页面:read_page 读页面正文(长文按 hasMore 分页续读)、get_dom 读渲染后结构、dom_search / dom_info 定位元素与查属性" + (e ? "、take_screenshot 截图查看实际渲染效果(视觉问题优先截图,结构推断不能代替)" : "") + ";一切以工具读到的页面实料为准。",
|
|
7829
7859
|
"用户消息可能带 [引用原文] 块(其在页面上选中的文字):优先围绕引用内容作答,需要更多上下文再向外探索(所在小节 → 整页)。",
|
|
7830
|
-
|
|
7860
|
+
dc.answerLanes,
|
|
7831
7861
|
"输出从简:直接说内容,不写过程 —— 不要「我先读一下页面」这类旁白、不要「先给结论/依据是」这类包装、不要解释结论是怎么推出来的、不要「下面分三点/综上」这类套话;出处用句末括注(如「(§小节名)」)带过即可。",
|
|
7832
7862
|
ud
|
|
7833
7863
|
].join("\n"), pd = (e) => [
|
|
7834
7864
|
"You are a page content assistant that helps users understand, locate, and troubleshoot the web page they are on.",
|
|
7835
7865
|
"You can inspect the page through dedicated tools: read_page for page text (paginate via hasMore on long documents), get_dom for the rendered structure, dom_search / dom_info to locate elements and read attributes" + (e ? ", and take_screenshot to see the actual rendered appearance (prefer a screenshot for visual questions; structural inference is no substitute)" : "") + "; the page as read by tools is the source of truth.",
|
|
7836
7866
|
"User messages may carry a [quoted text] block (text they selected on the page): answer around the quote first, then explore outward (its section → the whole page) if more context is needed.",
|
|
7837
|
-
|
|
7867
|
+
dc.answerLanesEn,
|
|
7838
7868
|
"Be terse: state the content directly, never narrate process — no \"let me first read the page\" asides, no \"in summary / the evidence is\" packaging, no explaining how you derived the conclusion, no \"here are three points\" preambles; cite sources inline as a short parenthetical such as \"(§ section name)\".",
|
|
7839
7869
|
dd,
|
|
7840
7870
|
"Respond in English."
|
|
@@ -9448,7 +9478,7 @@ function hf(e, n = {}) {
|
|
|
9448
9478
|
}, M = (e) => {
|
|
9449
9479
|
n.onAudit?.(e);
|
|
9450
9480
|
};
|
|
9451
|
-
function
|
|
9481
|
+
function ce(e, t) {
|
|
9452
9482
|
let n = Oc(l()), r = g.length ? g[g.length - 1].id + 1 : 1;
|
|
9453
9483
|
for (g.push({
|
|
9454
9484
|
id: r,
|
|
@@ -9459,7 +9489,7 @@ function hf(e, n = {}) {
|
|
|
9459
9489
|
}); g.length > _;) g.shift();
|
|
9460
9490
|
return r;
|
|
9461
9491
|
}
|
|
9462
|
-
async function
|
|
9492
|
+
async function N(e, t, r, i, a) {
|
|
9463
9493
|
if (!t || t === "") return null;
|
|
9464
9494
|
let o = k();
|
|
9465
9495
|
if (o === t) return null;
|
|
@@ -9513,9 +9543,9 @@ function hf(e, n = {}) {
|
|
|
9513
9543
|
hint: "重新 read 拿最新值与 hash,基于最新值修改后再写入(单次校验,不再二次挂起)。"
|
|
9514
9544
|
}));
|
|
9515
9545
|
}
|
|
9516
|
-
let
|
|
9546
|
+
let P = (e, t = !0) => {
|
|
9517
9547
|
e.writeCapable = t;
|
|
9518
|
-
},
|
|
9548
|
+
}, F = s(async ({ id: e }, t) => {
|
|
9519
9549
|
let n = b(t), r = await re();
|
|
9520
9550
|
try {
|
|
9521
9551
|
if (!g.length) return Z({
|
|
@@ -9591,8 +9621,8 @@ function hf(e, n = {}) {
|
|
|
9591
9621
|
description: "把主数据回退到某个快照(不传 id 回退最近一次)。快照列表用 history_data({list:true})。",
|
|
9592
9622
|
schema: t.object({ id: t.number().int().optional().describe("快照序号;不传回退最近一次") })
|
|
9593
9623
|
});
|
|
9594
|
-
F
|
|
9595
|
-
let
|
|
9624
|
+
P(F);
|
|
9625
|
+
let le = s(async ({ id: e, jsonPath: t, list: n }) => {
|
|
9596
9626
|
if (n) {
|
|
9597
9627
|
if (!g.length) return "无快照。set/edit/delete 会自动存快照。";
|
|
9598
9628
|
let e = g.map((e) => {
|
|
@@ -9637,7 +9667,7 @@ function hf(e, n = {}) {
|
|
|
9637
9667
|
jsonPath: t.string().optional().describe("只看快照的某子路径"),
|
|
9638
9668
|
list: t.boolean().optional().describe("true 列出快照时间线(序号/操作/标签/时间/大小)")
|
|
9639
9669
|
})
|
|
9640
|
-
}),
|
|
9670
|
+
}), I = s(async ({ expr: e, queries: t, limit: n }, r) => {
|
|
9641
9671
|
let i = b(r);
|
|
9642
9672
|
if (typeof c != "object" || !c) return Z({
|
|
9643
9673
|
code: "NOT_OBJECT",
|
|
@@ -9680,7 +9710,7 @@ function hf(e, n = {}) {
|
|
|
9680
9710
|
queries: t.array(t.string()).min(2).max(10).optional().describe("批量模式:2-10 条 JSONPath 一次取回(与 expr 同传按 queries);逐条独立返回,单条失败该项标 error 不整批"),
|
|
9681
9711
|
limit: t.number().int().min(1).max(200).optional().describe("返回结果上限(批量时逐条适用),默认 50")
|
|
9682
9712
|
})
|
|
9683
|
-
}),
|
|
9713
|
+
}), L = s(async ({ query: e, mode: t, fuzzyThreshold: n, matchKey: r, limit: i }) => {
|
|
9684
9714
|
if (c == null) return Z({
|
|
9685
9715
|
code: "EMPTY",
|
|
9686
9716
|
message: "主数据为空,无可搜索内容"
|
|
@@ -9718,7 +9748,7 @@ function hf(e, n = {}) {
|
|
|
9718
9748
|
matchKey: t.boolean().optional().describe("是否同时匹配 key 名,默认 true"),
|
|
9719
9749
|
limit: t.number().int().min(1).max(200).optional().describe("返回上限,默认 50")
|
|
9720
9750
|
})
|
|
9721
|
-
}),
|
|
9751
|
+
}), ue = s(async ({ script: e, mode: t, jsonPath: n }, r) => {
|
|
9722
9752
|
let s = b(r);
|
|
9723
9753
|
if (e.length > 8e3) return Z({
|
|
9724
9754
|
code: "SCRIPT_TOO_LARGE",
|
|
@@ -9761,7 +9791,7 @@ function hf(e, n = {}) {
|
|
|
9761
9791
|
if (u) {
|
|
9762
9792
|
let e = await re();
|
|
9763
9793
|
try {
|
|
9764
|
-
let n = await
|
|
9794
|
+
let n = await N("edit", O ? w(s) : void 0, void 0, e, s);
|
|
9765
9795
|
if (n !== null) return n;
|
|
9766
9796
|
let r = rf({
|
|
9767
9797
|
bindRef: c,
|
|
@@ -9797,7 +9827,7 @@ function hf(e, n = {}) {
|
|
|
9797
9827
|
});
|
|
9798
9828
|
let e = await re();
|
|
9799
9829
|
try {
|
|
9800
|
-
let n = await
|
|
9830
|
+
let n = await N("edit", O ? w(s) : void 0, void 0, e, s);
|
|
9801
9831
|
if (n !== null) return n;
|
|
9802
9832
|
let r = rf({
|
|
9803
9833
|
bindRef: c,
|
|
@@ -9838,7 +9868,7 @@ function hf(e, n = {}) {
|
|
|
9838
9868
|
});
|
|
9839
9869
|
let i = await re();
|
|
9840
9870
|
try {
|
|
9841
|
-
let e = await
|
|
9871
|
+
let e = await N("set", O ? w(s) : void 0, n, i, s);
|
|
9842
9872
|
if (e !== null) return e;
|
|
9843
9873
|
let t = a ? Oc(l()) : null, r = ef({
|
|
9844
9874
|
schema: o,
|
|
@@ -9846,7 +9876,7 @@ function hf(e, n = {}) {
|
|
|
9846
9876
|
value: n,
|
|
9847
9877
|
bindRef: c
|
|
9848
9878
|
});
|
|
9849
|
-
return r.ok ? (
|
|
9879
|
+
return r.ok ? (ce("edit", "eval_transform"), r.wholeParsed ? Vc(c, r.assembly) : r.assembly !== null && typeof r.assembly == "object" && Tc(c, r.assembly), j(), a && (a(c, t), j()), M({
|
|
9850
9880
|
op: "edit",
|
|
9851
9881
|
detail: "eval_transform",
|
|
9852
9882
|
timestamp: Date.now()
|
|
@@ -9874,8 +9904,8 @@ function hf(e, n = {}) {
|
|
|
9874
9904
|
jsonPath: t.string().optional().describe("子树模式:仅对该子树执行;transform 返回值作为子树新值")
|
|
9875
9905
|
})
|
|
9876
9906
|
});
|
|
9877
|
-
|
|
9878
|
-
let
|
|
9907
|
+
P(ue, (e) => e?.mode === "transform");
|
|
9908
|
+
let de = s(async ({ jsonPath: e, jsonPaths: t, fields: n, depth: r, offset: i, limit: a }, s) => {
|
|
9879
9909
|
let c = b(s), f = x(s), p = l(), m, g = () => m ??= k();
|
|
9880
9910
|
if (t && t.length) {
|
|
9881
9911
|
let e = !1, i = t.map((t) => {
|
|
@@ -9965,7 +9995,7 @@ function hf(e, n = {}) {
|
|
|
9965
9995
|
offset: t.number().int().min(0).optional().describe("数组分页起始偏移(仅数组目标,默认 0)"),
|
|
9966
9996
|
limit: t.number().int().min(1).max(200).optional().describe("数组分页每页条数(默认 50,上限 200),返回切片+total/hasMore")
|
|
9967
9997
|
})
|
|
9968
|
-
}),
|
|
9998
|
+
}), fe = s(async ({ value: e, patch: t, patches: n, del: i, dryRun: s }, u) => {
|
|
9969
9999
|
let f = b(u), p = "set";
|
|
9970
10000
|
i ? p = "delete" : (n && n.length || t) && (p = "edit");
|
|
9971
10001
|
let m = t?.value === void 0 ? e : t.value, v = await re();
|
|
@@ -10003,13 +10033,13 @@ function hf(e, n = {}) {
|
|
|
10003
10033
|
hint: e.spec.mode === "freeze" ? "冻结字段不可删" : "verbatim 字段不可直接删;先 resource_delete 释放"
|
|
10004
10034
|
});
|
|
10005
10035
|
}
|
|
10006
|
-
let n = await
|
|
10036
|
+
let n = await N("delete", e, void 0, v, f);
|
|
10007
10037
|
if (n !== null) return n;
|
|
10008
10038
|
if (s) {
|
|
10009
10039
|
let e = Oc(l());
|
|
10010
10040
|
return Dc(e, t.jsonPath) ? `dryRun(delete): 将删除 @ ${t.jsonPath}。预览剩余:${$(e, 600)}。未实际写入、未入快照。` : `dryRun(delete): @ ${t.jsonPath} 不存在(无需删除)。未实际写入。`;
|
|
10011
10041
|
}
|
|
10012
|
-
|
|
10042
|
+
ce("delete");
|
|
10013
10043
|
let r = Dc(c, t.jsonPath);
|
|
10014
10044
|
return j(), M({
|
|
10015
10045
|
op: "delete",
|
|
@@ -10023,7 +10053,7 @@ function hf(e, n = {}) {
|
|
|
10023
10053
|
message: `edit 仅适用于对象/数组主数据,当前是 ${c === void 0 ? "undefined" : typeof c}`,
|
|
10024
10054
|
hint: "叶子用 write(value) 整体设置"
|
|
10025
10055
|
});
|
|
10026
|
-
let r = await
|
|
10056
|
+
let r = await N("edit", e, void 0, v, f);
|
|
10027
10057
|
if (r !== null) return r;
|
|
10028
10058
|
let i = n && n.length ? n : [{
|
|
10029
10059
|
op: t.op ?? "set",
|
|
@@ -10055,7 +10085,7 @@ function hf(e, n = {}) {
|
|
|
10055
10085
|
}
|
|
10056
10086
|
let i = Ac(m);
|
|
10057
10087
|
if (i.parseError) return ci("", m, i.parseError);
|
|
10058
|
-
let u = await
|
|
10088
|
+
let u = await N("set", e, m, v, f);
|
|
10059
10089
|
if (u !== null) return u;
|
|
10060
10090
|
let y = nf({
|
|
10061
10091
|
bindRef: c,
|
|
@@ -10111,8 +10141,8 @@ function hf(e, n = {}) {
|
|
|
10111
10141
|
dryRun: t.boolean().optional().describe("预检:走完整校验链但不落盘不入快照;冲突返回 VERSION_CONFLICT 不挂起")
|
|
10112
10142
|
})
|
|
10113
10143
|
});
|
|
10114
|
-
|
|
10115
|
-
let
|
|
10144
|
+
P(fe);
|
|
10145
|
+
let pe = s(async ({ jsonPath: e }) => {
|
|
10116
10146
|
let t = e || "", n = t ? Is(o, t) : o;
|
|
10117
10147
|
return n ? `schema${t ? ` @ ${t}` : ""} = ${$(nc(n))}` : Z({
|
|
10118
10148
|
code: "PATH_DENIED",
|
|
@@ -10123,7 +10153,7 @@ function hf(e, n = {}) {
|
|
|
10123
10153
|
name: "schema_data",
|
|
10124
10154
|
description: "查看主数据(或子路径)的字段约束:类型/min/max/enum/必填/默认值/嵌套 shape。写前查约束,避免写错重试。不传 jsonPath 查根;传子路径(如 components.0)查该位置约束。",
|
|
10125
10155
|
schema: t.object({ jsonPath: t.string().optional().describe("要查约束的子路径;不传查根 schema") })
|
|
10126
|
-
}),
|
|
10156
|
+
}), me = s(async ({ snapshotId: e, against: t }) => {
|
|
10127
10157
|
let n = t != null, r, i;
|
|
10128
10158
|
if (n) {
|
|
10129
10159
|
let e = t;
|
|
@@ -10155,7 +10185,7 @@ function hf(e, n = {}) {
|
|
|
10155
10185
|
snapshotId: t.number().int().optional().describe("对比的快照序号;不传则最近一次"),
|
|
10156
10186
|
against: t.unknown().optional().describe("对比的一段 JSON 值(与 snapshotId 互斥;传则忽略快照)")
|
|
10157
10187
|
})
|
|
10158
|
-
}),
|
|
10188
|
+
}), he = [];
|
|
10159
10189
|
if (n.vfsStore) {
|
|
10160
10190
|
let e = n.vfsStore, r = (e) => `drafts/${e}.json`, i = s(({ draftId: t, chunk: n, mode: i }) => {
|
|
10161
10191
|
let a = r(t), o = e.files[a], s = i === "append" && o, c = s ? o.content + n : n;
|
|
@@ -10198,7 +10228,7 @@ function hf(e, n = {}) {
|
|
|
10198
10228
|
}
|
|
10199
10229
|
let f = await re();
|
|
10200
10230
|
try {
|
|
10201
|
-
let n = await
|
|
10231
|
+
let n = await N("set", O ? w(i) : void 0, u, f, i);
|
|
10202
10232
|
if (n !== null) return n;
|
|
10203
10233
|
let r = nf({
|
|
10204
10234
|
bindRef: c,
|
|
@@ -10223,9 +10253,9 @@ function hf(e, n = {}) {
|
|
|
10223
10253
|
description: "把 draft_write 累积的草稿合并 + JSON.parse + 乐观锁 + schema 校验,原子提交主数据(任一步失败不写,草稿保留可修后重试;成功清草稿 + 自动快照可回退)。仅大 JSON 从零生成用;小改用 write。",
|
|
10224
10254
|
schema: t.object({ draftId: t.string().describe("要提交的草稿标识(对应 draft_write 的 draftId)") })
|
|
10225
10255
|
});
|
|
10226
|
-
|
|
10256
|
+
P(l), he.push(i, l);
|
|
10227
10257
|
}
|
|
10228
|
-
let
|
|
10258
|
+
let R = [];
|
|
10229
10259
|
if (e.resources?.length && p) {
|
|
10230
10260
|
let e = s(async ({ path: e, handle: t }) => {
|
|
10231
10261
|
let n = e;
|
|
@@ -10311,7 +10341,7 @@ function hf(e, n = {}) {
|
|
|
10311
10341
|
value: t.unknown().describe("新值(需符合字段 schema 类型)")
|
|
10312
10342
|
})
|
|
10313
10343
|
});
|
|
10314
|
-
|
|
10344
|
+
P(n);
|
|
10315
10345
|
let r = s(async () => {
|
|
10316
10346
|
let e = p.list();
|
|
10317
10347
|
if (!e.length) {
|
|
@@ -10342,20 +10372,20 @@ function hf(e, n = {}) {
|
|
|
10342
10372
|
handle: t.string().optional().describe("占位符句柄(与 path 二选一)")
|
|
10343
10373
|
})
|
|
10344
10374
|
});
|
|
10345
|
-
|
|
10375
|
+
P(i), R.push(e, n, r, i);
|
|
10346
10376
|
}
|
|
10347
10377
|
let z = [
|
|
10378
|
+
F,
|
|
10379
|
+
le,
|
|
10348
10380
|
I,
|
|
10349
|
-
ce,
|
|
10350
10381
|
L,
|
|
10351
|
-
R,
|
|
10352
|
-
le,
|
|
10353
10382
|
ue,
|
|
10354
10383
|
de,
|
|
10355
10384
|
fe,
|
|
10356
10385
|
pe,
|
|
10357
|
-
|
|
10358
|
-
...he
|
|
10386
|
+
me,
|
|
10387
|
+
...he,
|
|
10388
|
+
...R
|
|
10359
10389
|
];
|
|
10360
10390
|
function B(e) {
|
|
10361
10391
|
let t = e, n = (e) => {
|
|
@@ -15183,47 +15213,47 @@ function X_(e, n, r) {
|
|
|
15183
15213
|
} : e;
|
|
15184
15214
|
}, se = fu(), M = pu(e.memory || "");
|
|
15185
15215
|
typeof e.memory == "function" && M.refresh();
|
|
15186
|
-
let
|
|
15216
|
+
let ce = { current: null }, N = e.data ? {
|
|
15187
15217
|
...e.data,
|
|
15188
15218
|
description: e.data.description ?? "主数据对象"
|
|
15189
|
-
} : void 0,
|
|
15190
|
-
|
|
15191
|
-
let
|
|
15192
|
-
for (let e of
|
|
15219
|
+
} : void 0, P = !(e.subagents ?? []).some((e) => e._codeAsset) && bm(e.capabilities).subagent, F = e.subagents;
|
|
15220
|
+
P && N?.schema && Js(N.schema).length && (F = [...e.subagents ?? [], Cp()], console.info("[page-agent-sdk] 检测到 schema 含代码组件数组(如 components[].code),已自动装配 HTML 代码子 agent(委派编排 + vfs 工作副本 + 格式校验 + 增量 commit)。需定制(codeField/formatCheck/craftNotes 等)请显式传 createHtmlSubagent(...)"));
|
|
15221
|
+
let le = (F ?? []).filter((e) => !!e._codeAsset), I = /* @__PURE__ */ new Set();
|
|
15222
|
+
for (let e of le) {
|
|
15193
15223
|
if (e._codeAsset.writablePaths.length) continue;
|
|
15194
|
-
let t = Js(
|
|
15195
|
-
t.length ? (e._codeAsset.writablePaths = t, Array.isArray(e.writablePaths) && (e.writablePaths = t), e._rebuildCodeAssetPaths?.(t[0]), console.info(`[page-agent-sdk][createHtmlSubagent] 未传 writablePaths,已从 schema 推断: [${t.map((e) => `'${e}'`).join(", ")}]`)) : (console.warn("[page-agent-sdk][createHtmlSubagent] 未能从 schema 推断 writablePaths(开放 schema(z.any()/z.record())/嵌套容器(如 sections[].children[])/点路径 codeField(如 props.html_code)不支持自动推断),已跳过该 html 子 agent(整体不受影响);如确需代码资产机制(vfs + 格式校验 + 增量 commit),请显式传 writablePaths(代码组件 data 区,如 ['components'])"),
|
|
15224
|
+
let t = Js(N?.schema, e._codeAsset.codeField);
|
|
15225
|
+
t.length ? (e._codeAsset.writablePaths = t, Array.isArray(e.writablePaths) && (e.writablePaths = t), e._rebuildCodeAssetPaths?.(t[0]), console.info(`[page-agent-sdk][createHtmlSubagent] 未传 writablePaths,已从 schema 推断: [${t.map((e) => `'${e}'`).join(", ")}]`)) : (console.warn("[page-agent-sdk][createHtmlSubagent] 未能从 schema 推断 writablePaths(开放 schema(z.any()/z.record())/嵌套容器(如 sections[].children[])/点路径 codeField(如 props.html_code)不支持自动推断),已跳过该 html 子 agent(整体不受影响);如确需代码资产机制(vfs + 格式校验 + 增量 commit),请显式传 writablePaths(代码组件 data 区,如 ['components'])"), I.add(e));
|
|
15196
15226
|
}
|
|
15197
|
-
let
|
|
15227
|
+
let L = I.size ? le.filter((e) => !I.has(e)) : le, ue = I.size ? (F ?? []).filter((e) => !I.has(e)) : F, de = L.length > 0, fe = L.flatMap((e) => e._codeAsset.writablePaths), pe = L.flatMap((e) => e._codeAsset.writablePaths.map((t) => `${t}.${e._codeAsset.codeField}`)), me = e.checkpoint, he = me !== void 0 && me !== !1, R = he ? Mu({
|
|
15198
15228
|
getData: () => U()?.bind,
|
|
15199
15229
|
consumeDataDirty: () => H?.consumeDataDirty?.() ?? !0,
|
|
15200
|
-
slotPaths:
|
|
15230
|
+
slotPaths: N ? [""] : [],
|
|
15201
15231
|
vfsStore: T,
|
|
15202
15232
|
todosMw: D,
|
|
15203
|
-
getTodos: () =>
|
|
15233
|
+
getTodos: () => ce.current?.getState?.()?.todos ?? [],
|
|
15204
15234
|
messages: w,
|
|
15205
|
-
maxCheckpoints:
|
|
15206
|
-
}) : null, z = !
|
|
15235
|
+
maxCheckpoints: me && typeof me == "object" ? me.maxCheckpoints : void 0
|
|
15236
|
+
}) : null, z = !me || typeof me != "object" || me.auto !== !1, B = bm(e.capabilities), ge = B.dataOps, _e = B.draftWrite, ve = B.automation, ye = B.domInspect && (g.vision === !0 || typeof e.images?.describe == "function"), be = _d({
|
|
15207
15237
|
...e,
|
|
15208
15238
|
locale: e.i18n?.locale,
|
|
15209
|
-
dataOps: ge && !!
|
|
15239
|
+
dataOps: ge && !!N,
|
|
15210
15240
|
domInspect: B.domInspect === !0,
|
|
15211
15241
|
screenshot: ye
|
|
15212
15242
|
});
|
|
15213
|
-
if (
|
|
15214
|
-
let e =
|
|
15243
|
+
if (de) {
|
|
15244
|
+
let e = L.map((e) => e._codeAsset.orchestratorPrompt).filter(Boolean).join("\n\n");
|
|
15215
15245
|
e && (be += "\n\n" + e);
|
|
15216
|
-
} else
|
|
15217
|
-
let V = ge &&
|
|
15246
|
+
} else N?.schema && qs(N.schema) && (be += "\n\n" + dc.htmlDirectWriteFallback, console.warn("[page-agent-sdk] 检测到 schema 含 code 字段但未注册 html 子 agent:已自动注入「主 agent 自己写 HTML」编排(code 作普通字段直接 write,无 vfs 工作副本 / 无格式校验门禁)。如需代码资产机制(vfs + 格式校验 + 增量 commit + 主上下文 code 摘要),注册 createHtmlSubagent;若确为降级意图可忽略。"));
|
|
15247
|
+
let V = ge && N ? hf(N, {
|
|
15218
15248
|
onAudit: e.onAudit ?? (e.debug ? (e) => console.log("[page-agent-sdk][data audit]", e) : void 0),
|
|
15219
15249
|
maxSnapshots: e.maxSnapshots,
|
|
15220
15250
|
onConflict: o.set,
|
|
15221
15251
|
conflictWatchFields: e.conflictWatchFields,
|
|
15222
15252
|
maxParallelTools: e.maxParallelTools,
|
|
15223
|
-
vfsStore: _e ||
|
|
15224
|
-
...
|
|
15225
|
-
...
|
|
15226
|
-
}) : [], xe = ge ? V : [], H = ge &&
|
|
15253
|
+
vfsStore: _e || N?.resources?.length ? T : void 0,
|
|
15254
|
+
...fe.length ? { pgIdPaths: fe } : {},
|
|
15255
|
+
...pe.length ? { largeTextPaths: pe } : {}
|
|
15256
|
+
}) : [], xe = ge ? V : [], H = ge && N ? V.controller ?? null : null, Se = ge && N ? V.previewWrite : void 0, Ce = ge && N?.resources?.length && H?.getResourcesSnapshot ? P_({ getResourcesSnapshot: () => H?.getResourcesSnapshot?.() ?? [] }) : void 0, U = () => H?.get() ?? N, we = new Set(V.map((e) => e.name)), Te = e.conflictWatchFields ?? [], Ee = !Te.includes("*") && Te.length ? new Set(Te) : void 0, W = H ? Jf({
|
|
15227
15257
|
getBind: () => U()?.bind,
|
|
15228
15258
|
recomputeAll: () => H.recomputeAllBaselines?.(),
|
|
15229
15259
|
hasBaselines: () => H.hasBaselines?.() ?? !1,
|
|
@@ -15341,15 +15371,15 @@ function X_(e, n, r) {
|
|
|
15341
15371
|
ze.forEach((e) => De.set(e.name, "action"));
|
|
15342
15372
|
let Be = Le ? e.proposals?.readToolName || "read_content" : null, Ve = Le ? e.proposals?.toolName || "propose_content" : null, He = /* @__PURE__ */ new Set([...Object.entries(e.actions ?? {}).filter(([, e]) => e?.readsHostState === !0).map(([e]) => e), ...Be ? [Be] : []]), Ue = /* @__PURE__ */ new Set([...Object.entries(e.actions ?? {}).filter(([, e]) => e?.deferredWrite === !0).map(([e]) => e), ...Ve ? [Ve] : []]), We = [], Ge = !1, Ke = e.humanConfirm !== !1 && (!e.approval || e.approval.humanConfirmTool !== !1), qe = Ke ? Cu() : null;
|
|
15343
15373
|
qe && De.set(xu, "builtin");
|
|
15344
|
-
let Je =
|
|
15345
|
-
let e =
|
|
15346
|
-
return e.length ?
|
|
15374
|
+
let Je = he && R ? [s(async () => {
|
|
15375
|
+
let e = R.list();
|
|
15376
|
+
return e.length ? R.restore() ? `已回退到最近一次正常状态(checkpoint #${e[e.length - 1].id})。对话历史、主数据、vfs、todos 已整体还原。请基于回退后的状态重新判断并继续。` : "回退失败:无可用 checkpoint。" : "无可用 checkpoint,无法回退。";
|
|
15347
15377
|
}, {
|
|
15348
15378
|
name: "restore_last_checkpoint",
|
|
15349
15379
|
description: "回退到最近一次正常状态(整体还原对话历史 + 主数据 + vfs + todos)。当本轮操作出错、页面被改坏、或走偏时调用,回到本轮起点重新来过。不传参数即回退最近一次。",
|
|
15350
15380
|
schema: t.object({}).optional()
|
|
15351
15381
|
}), s(async () => {
|
|
15352
|
-
let e =
|
|
15382
|
+
let e = R.list();
|
|
15353
15383
|
return e.length ? "可用 checkpoint:\n" + e.map((e) => `#${e.id} [${e.label ?? "auto"}] 消息数=${e.messageCount} 时间=${new Date(e.timestamp).toLocaleTimeString()}`).join("\n") : "无可用 checkpoint。";
|
|
15354
15384
|
}, {
|
|
15355
15385
|
name: "list_checkpoints",
|
|
@@ -15416,7 +15446,7 @@ function X_(e, n, r) {
|
|
|
15416
15446
|
focusTools: () => et,
|
|
15417
15447
|
mcpTools: () => We,
|
|
15418
15448
|
loadedSkillTools: () => tt
|
|
15419
|
-
}), G = rt(), it = B.planning, at = B.missionAnchor, ot = B.workingMemory, st = B.skills, ct = B.vfs ||
|
|
15449
|
+
}), G = rt(), it = B.planning, at = B.missionAnchor, ot = B.workingMemory, st = B.skills, ct = B.vfs || de;
|
|
15420
15450
|
if (ct) for (let e of Dd) De.set(e, "builtin");
|
|
15421
15451
|
if (it) for (let e of D.tools ?? []) De.set(e.name, "builtin");
|
|
15422
15452
|
let lt = B.summarization, ut = B.agentCompression && !!m;
|
|
@@ -15456,7 +15486,7 @@ function X_(e, n, r) {
|
|
|
15456
15486
|
a.prompt_tokens = (a.prompt_tokens ?? 0) + (e.prompt_tokens ?? 0), a.completion_tokens = (a.completion_tokens ?? 0) + (e.completion_tokens ?? 0), a.total_tokens = (a.total_tokens ?? 0) + (e.total_tokens ?? 0), e.reasoning_tokens && (a.reasoning_tokens = (a.reasoning_tokens ?? 0) + e.reasoning_tokens);
|
|
15457
15487
|
},
|
|
15458
15488
|
timeoutMs: yt?.timeoutMs
|
|
15459
|
-
}), Tt =
|
|
15489
|
+
}), Tt = ue?.map((e) => {
|
|
15460
15490
|
if (!e._codeAsset) return e;
|
|
15461
15491
|
let t = e._codeAsset, n = Nf({
|
|
15462
15492
|
writablePaths: t.writablePaths,
|
|
@@ -15473,12 +15503,12 @@ function X_(e, n, r) {
|
|
|
15473
15503
|
...e,
|
|
15474
15504
|
middleware: r
|
|
15475
15505
|
};
|
|
15476
|
-
}), Et =
|
|
15506
|
+
}), Et = de && ft ? Pf() : void 0, Dt = Et ? Vf({
|
|
15477
15507
|
getBind: () => U()?.bind,
|
|
15478
|
-
writablePaths:
|
|
15508
|
+
writablePaths: fe,
|
|
15479
15509
|
getLocked: () => Et.locked(),
|
|
15480
15510
|
tools: G,
|
|
15481
|
-
getCodeFieldPaths: () => zf(U()?.bind,
|
|
15511
|
+
getCodeFieldPaths: () => zf(U()?.bind, L.map((e) => ({
|
|
15482
15512
|
writablePaths: e._codeAsset.writablePaths,
|
|
15483
15513
|
codeField: e._codeAsset.codeField
|
|
15484
15514
|
})))
|
|
@@ -15505,7 +15535,7 @@ function X_(e, n, r) {
|
|
|
15505
15535
|
timeoutMs: e.subagent?.timeoutMs,
|
|
15506
15536
|
...Et ? {
|
|
15507
15537
|
componentLock: Et,
|
|
15508
|
-
resolveComponents: (e) => Ff(e, kf(U()?.bind,
|
|
15538
|
+
resolveComponents: (e) => Ff(e, kf(U()?.bind, fe))
|
|
15509
15539
|
} : {}
|
|
15510
15540
|
}) : void 0, At = kt ? kt.controller : null, jt = (t) => {
|
|
15511
15541
|
let n = t.thinkingMode ?? e.subagent?.thinkingMode, r = n ? Ap(t.llm ?? e.llm) ? "instance-noop" : "applied" : "inherited";
|
|
@@ -15534,8 +15564,8 @@ function X_(e, n, r) {
|
|
|
15534
15564
|
hasActions: !!e.actions && Object.keys(e.actions).length > 0,
|
|
15535
15565
|
hasProposals: !!e.proposals,
|
|
15536
15566
|
viewImage: !!Ae,
|
|
15537
|
-
subagents:
|
|
15538
|
-
}, ge && !!
|
|
15567
|
+
subagents: ue?.map(jt)
|
|
15568
|
+
}, ge && !!N, { promptSoftCap: Nl(g.contextWindow, y.promptSoftCapTokens) }), Rt = B.pageContext ? N_({
|
|
15539
15569
|
getPageInfo: () => typeof document < "u" && typeof location < "u" ? {
|
|
15540
15570
|
title: document.title || "",
|
|
15541
15571
|
url: location.href
|
|
@@ -15599,7 +15629,7 @@ function X_(e, n, r) {
|
|
|
15599
15629
|
afterAgent: () => {
|
|
15600
15630
|
Le.state.notices.length = 0;
|
|
15601
15631
|
}
|
|
15602
|
-
} : null, q =
|
|
15632
|
+
} : null, q = N ? {
|
|
15603
15633
|
name: "dataHint",
|
|
15604
15634
|
augmentPrompt: () => gd(U(), e.schemaHint) || void 0
|
|
15605
15635
|
} : null, Ht = e.augmentSystem ? {
|
|
@@ -15659,7 +15689,7 @@ function X_(e, n, r) {
|
|
|
15659
15689
|
...B.domInspect && !(e.skills || []).some((e) => e.name === "dom-inspect") ? [c_({
|
|
15660
15690
|
withScreenshot: !!je,
|
|
15661
15691
|
withDomEdit: B.domEdit,
|
|
15662
|
-
withDataOps: ge && !!
|
|
15692
|
+
withDataOps: ge && !!N
|
|
15663
15693
|
})] : [],
|
|
15664
15694
|
...B.domInspect && !(e.skills || []).some((e) => e.name === "page-analysis") ? [u_({
|
|
15665
15695
|
withScreenshot: !!je,
|
|
@@ -15696,7 +15726,7 @@ function X_(e, n, r) {
|
|
|
15696
15726
|
...Ce ? [Ce] : [],
|
|
15697
15727
|
...dt ? [M] : [],
|
|
15698
15728
|
...xt ? [xt] : [],
|
|
15699
|
-
...
|
|
15729
|
+
...he && z && R ? [Nu(R)] : [],
|
|
15700
15730
|
...Ke ? [oe] : [],
|
|
15701
15731
|
...St ? [St] : [],
|
|
15702
15732
|
...W ? [W] : [],
|
|
@@ -15756,7 +15786,7 @@ function X_(e, n, r) {
|
|
|
15756
15786
|
mcpClosers: [],
|
|
15757
15787
|
mcpServers: [],
|
|
15758
15788
|
mcpFailed: [],
|
|
15759
|
-
checkpoint:
|
|
15789
|
+
checkpoint: R,
|
|
15760
15790
|
dataOpsController: H,
|
|
15761
15791
|
skillsController: Y ? Y.controller : null,
|
|
15762
15792
|
infoTick: c,
|
|
@@ -15782,7 +15812,7 @@ function X_(e, n, r) {
|
|
|
15782
15812
|
G = rt(), X.agent && X.agent.setTools(G);
|
|
15783
15813
|
},
|
|
15784
15814
|
applySnapshot(t) {
|
|
15785
|
-
if (t.vfs && T.hydrate && T.hydrate(t.vfs), t.messages?.length && (w.push(...Ci(t.messages, (e) => (e ? X.vfsStore?.files?.[e]?.content : void 0) || void 0)), te.markResumed()), t.todos?.length && D.reset(t.todos), t.memory && !e.memory && M.reset(t.memory), t.checkpoints?.length &&
|
|
15815
|
+
if (t.vfs && T.hydrate && T.hydrate(t.vfs), t.messages?.length && (w.push(...Ci(t.messages, (e) => (e ? X.vfsStore?.files?.[e]?.content : void 0) || void 0)), te.markResumed()), t.todos?.length && D.reset(t.todos), t.memory && !e.memory && M.reset(t.memory), t.checkpoints?.length && R && R.importStack(t.checkpoints), t.usage && Object.assign(a, t.usage), t.mission && at && O.setMission(t.mission), t.workingMemory && ot && se.restore(t.workingMemory), t.planConfirmation && (ne.lastPlanConfirmation = t.planConfirmation), Ye) {
|
|
15786
15816
|
let n = t.focus, r = n ? Array.isArray(n) ? n : [n] : [];
|
|
15787
15817
|
if (r.length) {
|
|
15788
15818
|
let t = U()?.schema, n = t ? r.filter((e) => Is(t, e.path)) : [];
|
|
@@ -15895,8 +15925,8 @@ function X_(e, n, r) {
|
|
|
15895
15925
|
...n,
|
|
15896
15926
|
code: "MODEL_UNAVAILABLE",
|
|
15897
15927
|
message: e instanceof Error ? e.message : n.message
|
|
15898
|
-
}), a < i &&
|
|
15899
|
-
a += 1,
|
|
15928
|
+
}), a < i && R?.canRestore()) {
|
|
15929
|
+
a += 1, R.restore(), s = !0, J({
|
|
15900
15930
|
type: "error",
|
|
15901
15931
|
message: `致命错误自动恢复(${a}/${i}):${n.message},已回退 checkpoint 重试`,
|
|
15902
15932
|
severity: "observable",
|
|
@@ -15937,7 +15967,7 @@ function X_(e, n, r) {
|
|
|
15937
15967
|
break;
|
|
15938
15968
|
}
|
|
15939
15969
|
let o = e[a];
|
|
15940
|
-
|
|
15970
|
+
R && R.save(`batch:${a}`);
|
|
15941
15971
|
let s = w.length;
|
|
15942
15972
|
try {
|
|
15943
15973
|
w.push({
|
|
@@ -16192,10 +16222,10 @@ function X_(e, n, r) {
|
|
|
16192
16222
|
...X.mcpFailed.length ? { failed: X.mcpFailed } : {}
|
|
16193
16223
|
},
|
|
16194
16224
|
lastCompression: X.agent?.getState?.()?.lastCompression,
|
|
16195
|
-
checkpoints:
|
|
16225
|
+
checkpoints: R ? {
|
|
16196
16226
|
enabled: !0,
|
|
16197
16227
|
auto: z,
|
|
16198
|
-
list:
|
|
16228
|
+
list: R.list()
|
|
16199
16229
|
} : void 0
|
|
16200
16230
|
};
|
|
16201
16231
|
},
|
|
@@ -16423,7 +16453,7 @@ function X_(e, n, r) {
|
|
|
16423
16453
|
useAutomation: ve
|
|
16424
16454
|
},
|
|
16425
16455
|
vfsStore: T,
|
|
16426
|
-
checkpointMgr:
|
|
16456
|
+
checkpointMgr: R,
|
|
16427
16457
|
conflictResolve: (e) => o.resolve(e),
|
|
16428
16458
|
abortAllActive: cn,
|
|
16429
16459
|
titleLlmInvoke: f
|
|
@@ -16480,7 +16510,7 @@ function X_(e, n, r) {
|
|
|
16480
16510
|
C = e;
|
|
16481
16511
|
},
|
|
16482
16512
|
debug: e.debug
|
|
16483
|
-
}),
|
|
16513
|
+
}), ce.current = X.agent, kt && kt.setReconfigureHook(() => {
|
|
16484
16514
|
X.agent && X.agent.setTools(rt());
|
|
16485
16515
|
});
|
|
16486
16516
|
})(), X;
|
|
@@ -17700,7 +17730,7 @@ function _v(e = {}) {
|
|
|
17700
17730
|
};
|
|
17701
17731
|
}), x = ri(() => (n.messages.length, typeof e.canUndo == "function" && !!e.canUndo())), S = () => {
|
|
17702
17732
|
e.onUndo?.() && (n.error = null);
|
|
17703
|
-
}, C = (e) => new Date(e).toLocaleTimeString(
|
|
17733
|
+
}, C = (e) => new Date(e).toLocaleTimeString(le, {
|
|
17704
17734
|
hour: "2-digit",
|
|
17705
17735
|
minute: "2-digit"
|
|
17706
17736
|
}), w = () => {
|
|
@@ -17715,16 +17745,16 @@ function _v(e = {}) {
|
|
|
17715
17745
|
if (!t.length) return;
|
|
17716
17746
|
let n = 4 - T.value.length;
|
|
17717
17747
|
if (n <= 0) {
|
|
17718
|
-
k(`${
|
|
17748
|
+
k(`${I.imageCountLimitPrefix}4${I.imageCountLimitSuffix}`);
|
|
17719
17749
|
return;
|
|
17720
17750
|
}
|
|
17721
|
-
t.length > n && k(`${
|
|
17751
|
+
t.length > n && k(`${I.imageCountLimitPrefix}4${I.imageCountLimitSuffix}`), D.value = !0;
|
|
17722
17752
|
try {
|
|
17723
17753
|
for (let e of t.slice(0, n)) try {
|
|
17724
17754
|
let t = await Ei(e, { name: e.name });
|
|
17725
17755
|
T.value.push(t);
|
|
17726
17756
|
} catch (e) {
|
|
17727
|
-
k(e instanceof hi ? `${e.message}` :
|
|
17757
|
+
k(e instanceof hi ? `${e.message}` : I.imageInvalid);
|
|
17728
17758
|
}
|
|
17729
17759
|
} finally {
|
|
17730
17760
|
D.value = !1;
|
|
@@ -17747,13 +17777,13 @@ function _v(e = {}) {
|
|
|
17747
17777
|
}, j = ri(() => (e.infoTick?.value, e.getFocuses?.() ?? [])), se = ri(() => (e.infoTick?.value, e.getInfo?.()?.planConfirmation)), M = (t) => e.onAddFocus ? e.onAddFocus(t) : {
|
|
17748
17778
|
ok: !1,
|
|
17749
17779
|
error: "focus 未启用"
|
|
17750
|
-
},
|
|
17780
|
+
}, ce = (t) => {
|
|
17751
17781
|
e.onRemoveFocus?.(t);
|
|
17752
|
-
},
|
|
17782
|
+
}, N = () => {
|
|
17753
17783
|
e.onClearFocus?.();
|
|
17754
|
-
},
|
|
17784
|
+
}, P = (t) => {
|
|
17755
17785
|
e.onFocusChipClick?.(t);
|
|
17756
|
-
},
|
|
17786
|
+
}, F = fv(e.icons), le = e.locale ?? "zh-CN", I = hv(le, e.dialogMessages);
|
|
17757
17787
|
return {
|
|
17758
17788
|
chat: t,
|
|
17759
17789
|
inputText: o,
|
|
@@ -17789,12 +17819,12 @@ function _v(e = {}) {
|
|
|
17789
17819
|
focuses: j,
|
|
17790
17820
|
planConfirmation: se,
|
|
17791
17821
|
addFocus: M,
|
|
17792
|
-
removeFocus:
|
|
17793
|
-
clearFocus:
|
|
17794
|
-
focusChipClick:
|
|
17795
|
-
icons:
|
|
17796
|
-
locale:
|
|
17797
|
-
messages:
|
|
17822
|
+
removeFocus: ce,
|
|
17823
|
+
clearFocus: N,
|
|
17824
|
+
focusChipClick: P,
|
|
17825
|
+
icons: F,
|
|
17826
|
+
locale: le,
|
|
17827
|
+
messages: I,
|
|
17798
17828
|
toolStepView: e.toolStepView
|
|
17799
17829
|
};
|
|
17800
17830
|
}
|