page-agent-sdk 1.3.13 → 1.4.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 -0
- package/README.zh-CN.md +1 -0
- package/dist/page-agent-sdk.css +1 -1
- package/dist/page-agent-sdk.iife.js +120 -118
- package/dist/page-agent-sdk.js +1030 -927
- package/dist/page-agent-sdk.umd.cjs +45 -43
- package/package.json +1 -1
- package/types/index.d.ts +35 -0
package/dist/page-agent-sdk.js
CHANGED
|
@@ -24,19 +24,19 @@ function _(e) {
|
|
|
24
24
|
var v = process.env.NODE_ENV === "production" ? {} : Object.freeze({}), y = process.env.NODE_ENV === "production" ? [] : Object.freeze([]), b = () => {}, x = () => !1, S = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && (e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97), C = (e) => e.startsWith("onUpdate:"), w = Object.assign, T = (e, t) => {
|
|
25
25
|
let n = e.indexOf(t);
|
|
26
26
|
n > -1 && e.splice(n, 1);
|
|
27
|
-
}, E = Object.prototype.hasOwnProperty, D = (e, t) => E.call(e, t), O = Array.isArray, k = (e) =>
|
|
27
|
+
}, E = Object.prototype.hasOwnProperty, D = (e, t) => E.call(e, t), O = Array.isArray, k = (e) => ee(e) === "[object Map]", A = (e) => ee(e) === "[object Set]", j = (e) => ee(e) === "[object Date]", M = (e) => typeof e == "function", N = (e) => typeof e == "string", P = (e) => typeof e == "symbol", F = (e) => typeof e == "object" && !!e, I = (e) => (F(e) || M(e)) && M(e.then) && M(e.catch), L = Object.prototype.toString, ee = (e) => L.call(e), R = (e) => ee(e).slice(8, -1), te = (e) => ee(e) === "[object Object]", ne = (e) => N(e) && e !== "NaN" && e[0] !== "-" && "" + parseInt(e, 10) === e, re = /* @__PURE__ */ _(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"), ie = /* @__PURE__ */ _("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"), ae = (e) => {
|
|
28
28
|
let t = /* @__PURE__ */ Object.create(null);
|
|
29
29
|
return ((n) => t[n] || (t[n] = e(n)));
|
|
30
|
-
},
|
|
30
|
+
}, oe = /-\w/g, se = ae((e) => e.replace(oe, (e) => e.slice(1).toUpperCase())), ce = /\B([A-Z])/g, le = ae((e) => e.replace(ce, "-$1").toLowerCase()), ue = ae((e) => e.charAt(0).toUpperCase() + e.slice(1)), de = ae((e) => e ? `on${ue(e)}` : ""), z = (e, t) => !Object.is(e, t), fe = (e, ...t) => {
|
|
31
31
|
for (let n = 0; n < e.length; n++) e[n](...t);
|
|
32
|
-
},
|
|
32
|
+
}, pe = (e, t, n, r = !1) => {
|
|
33
33
|
Object.defineProperty(e, t, {
|
|
34
34
|
configurable: !0,
|
|
35
35
|
enumerable: !1,
|
|
36
36
|
writable: r,
|
|
37
37
|
value: n
|
|
38
38
|
});
|
|
39
|
-
},
|
|
39
|
+
}, B = (e) => {
|
|
40
40
|
let t = parseFloat(e);
|
|
41
41
|
return isNaN(t) ? e : t;
|
|
42
42
|
}, me = (e) => {
|
|
@@ -99,7 +99,7 @@ function Ne(e, t) {
|
|
|
99
99
|
}
|
|
100
100
|
return String(e) === String(t);
|
|
101
101
|
}
|
|
102
|
-
var Pe = (e) => !!(e && e.__v_isRef === !0), V = (e) => N(e) ? e : e == null ? "" : O(e) || F(e) && (e.toString === L || !M(e.toString)) ? Pe(e) ? V(e.value) : JSON.stringify(e, Fe, 2) : String(e), Fe = (e, t) => Pe(t) ? Fe(e, t.value) : k(t) ? { [`Map(${t.size})`]: [...t.entries()].reduce((e, [t, n], r) => (e[Ie(t, r) + " =>"] = n, e), {}) } : A(t) ? { [`Set(${t.size})`]: [...t.values()].map((e) => Ie(e)) } : P(t) ? Ie(t) : F(t) && !O(t) && !
|
|
102
|
+
var Pe = (e) => !!(e && e.__v_isRef === !0), V = (e) => N(e) ? e : e == null ? "" : O(e) || F(e) && (e.toString === L || !M(e.toString)) ? Pe(e) ? V(e.value) : JSON.stringify(e, Fe, 2) : String(e), Fe = (e, t) => Pe(t) ? Fe(e, t.value) : k(t) ? { [`Map(${t.size})`]: [...t.entries()].reduce((e, [t, n], r) => (e[Ie(t, r) + " =>"] = n, e), {}) } : A(t) ? { [`Set(${t.size})`]: [...t.values()].map((e) => Ie(e)) } : P(t) ? Ie(t) : F(t) && !O(t) && !te(t) ? String(t) : t, Ie = (e, t = "") => P(e) ? `Symbol(${e.description ?? t})` : e;
|
|
103
103
|
//#endregion
|
|
104
104
|
//#region node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
|
|
105
105
|
function Le(e, ...t) {
|
|
@@ -275,7 +275,7 @@ function Qe(e) {
|
|
|
275
275
|
try {
|
|
276
276
|
Ye(e);
|
|
277
277
|
let n = e.fn(e._value);
|
|
278
|
-
(t.version === 0 ||
|
|
278
|
+
(t.version === 0 || z(n, e._value)) && (e.flags |= 128, e._value = n, t.version++);
|
|
279
279
|
} catch (e) {
|
|
280
280
|
throw t.version++, e;
|
|
281
281
|
} finally {
|
|
@@ -387,7 +387,7 @@ function ht(e, t, n, r, i, a) {
|
|
|
387
387
|
};
|
|
388
388
|
if (qe(), t === "clear") o.forEach(s);
|
|
389
389
|
else {
|
|
390
|
-
let i = O(e), a = i &&
|
|
390
|
+
let i = O(e), a = i && ne(n);
|
|
391
391
|
if (i && n === "length") {
|
|
392
392
|
let e = Number(r);
|
|
393
393
|
o.forEach((t, n) => {
|
|
@@ -571,7 +571,7 @@ var kt = class {
|
|
|
571
571
|
let o = Reflect.get(e, t, /* @__PURE__ */ dn(e) ? e : n);
|
|
572
572
|
if ((P(t) ? Dt.has(t) : Et(t)) || (r || mt(e, "get", t), i)) return o;
|
|
573
573
|
if (/* @__PURE__ */ dn(o)) {
|
|
574
|
-
let e = a &&
|
|
574
|
+
let e = a && ne(t) ? o : o.value;
|
|
575
575
|
return r && F(e) ? /* @__PURE__ */ en(e) : e;
|
|
576
576
|
}
|
|
577
577
|
return F(o) ? r ? /* @__PURE__ */ en(o) : /* @__PURE__ */ Qt(o) : o;
|
|
@@ -581,13 +581,13 @@ var kt = class {
|
|
|
581
581
|
super(!1, e);
|
|
582
582
|
}
|
|
583
583
|
set(e, t, n, r) {
|
|
584
|
-
let i = e[t], a = O(e) &&
|
|
584
|
+
let i = e[t], a = O(e) && ne(t);
|
|
585
585
|
if (!this._isShallow) {
|
|
586
586
|
let r = /* @__PURE__ */ an(i);
|
|
587
587
|
if (!/* @__PURE__ */ on(n) && !/* @__PURE__ */ an(n) && (i = /* @__PURE__ */ U(i), n = /* @__PURE__ */ U(n)), !a && /* @__PURE__ */ dn(i) && !/* @__PURE__ */ dn(n)) return r ? (process.env.NODE_ENV !== "production" && Le(`Set operation on key "${String(t)}" failed: target is readonly.`, e[t]), !0) : (i.value = n, !0);
|
|
588
588
|
}
|
|
589
589
|
let o = a ? Number(t) < e.length : D(e, t), s = Reflect.set(e, t, n, /* @__PURE__ */ dn(e) ? e : r);
|
|
590
|
-
return e === /* @__PURE__ */ U(r) && s && (o ?
|
|
590
|
+
return e === /* @__PURE__ */ U(r) && s && (o ? z(n, i) && ht(e, "set", t, n, i) : ht(e, "add", t, n)), s;
|
|
591
591
|
}
|
|
592
592
|
deleteProperty(e, t) {
|
|
593
593
|
let n = D(e, t), r = e[t], i = Reflect.deleteProperty(e, t);
|
|
@@ -630,7 +630,7 @@ function zt(e) {
|
|
|
630
630
|
return function(...t) {
|
|
631
631
|
if (process.env.NODE_ENV !== "production") {
|
|
632
632
|
let n = t[0] ? `on key "${t[0]}" ` : "";
|
|
633
|
-
Le(`${
|
|
633
|
+
Le(`${ue(e)} operation ${n}failed: target is readonly.`, /* @__PURE__ */ U(this));
|
|
634
634
|
}
|
|
635
635
|
return e === "delete" ? !1 : e === "clear" ? void 0 : this;
|
|
636
636
|
};
|
|
@@ -639,7 +639,7 @@ function Bt(e, t) {
|
|
|
639
639
|
let n = {
|
|
640
640
|
get(n) {
|
|
641
641
|
let r = this.__v_raw, i = /* @__PURE__ */ U(r), a = /* @__PURE__ */ U(n);
|
|
642
|
-
e || (
|
|
642
|
+
e || (z(n, a) && mt(i, "get", n), mt(i, "get", a));
|
|
643
643
|
let { has: o } = Lt(i), s = t ? It : e ? un : ln;
|
|
644
644
|
if (o.call(i, n)) return s(r.get(n));
|
|
645
645
|
if (o.call(i, a)) return s(r.get(a));
|
|
@@ -651,7 +651,7 @@ function Bt(e, t) {
|
|
|
651
651
|
},
|
|
652
652
|
has(t) {
|
|
653
653
|
let n = this.__v_raw, r = /* @__PURE__ */ U(n), i = /* @__PURE__ */ U(t);
|
|
654
|
-
return e || (
|
|
654
|
+
return e || (z(t, i) && mt(r, "has", t), mt(r, "has", i)), t === i ? n.has(t) : n.has(t) || n.has(i);
|
|
655
655
|
},
|
|
656
656
|
forEach(n, r) {
|
|
657
657
|
let i = this, a = i.__v_raw, o = /* @__PURE__ */ U(a), s = t ? It : e ? un : ln;
|
|
@@ -666,14 +666,14 @@ function Bt(e, t) {
|
|
|
666
666
|
} : {
|
|
667
667
|
add(e) {
|
|
668
668
|
let n = /* @__PURE__ */ U(this), r = Lt(n), i = /* @__PURE__ */ U(e), a = !t && !/* @__PURE__ */ on(e) && !/* @__PURE__ */ an(e) ? i : e;
|
|
669
|
-
return r.has.call(n, a) ||
|
|
669
|
+
return r.has.call(n, a) || z(e, a) && r.has.call(n, e) || z(i, a) && r.has.call(n, i) || (n.add(a), ht(n, "add", a, a)), this;
|
|
670
670
|
},
|
|
671
671
|
set(e, n) {
|
|
672
672
|
!t && !/* @__PURE__ */ on(n) && !/* @__PURE__ */ an(n) && (n = /* @__PURE__ */ U(n));
|
|
673
673
|
let r = /* @__PURE__ */ U(this), { has: i, get: a } = Lt(r), o = i.call(r, e);
|
|
674
674
|
o ? process.env.NODE_ENV !== "production" && Kt(r, i, e) : (e = /* @__PURE__ */ U(e), o = i.call(r, e));
|
|
675
675
|
let s = a.call(r, e);
|
|
676
|
-
return r.set(e, n), o ?
|
|
676
|
+
return r.set(e, n), o ? z(n, s) && ht(r, "set", e, n, s) : ht(r, "add", e, n), this;
|
|
677
677
|
},
|
|
678
678
|
delete(e) {
|
|
679
679
|
let t = /* @__PURE__ */ U(this), { has: n, get: r } = Lt(t), i = n.call(t, e);
|
|
@@ -702,7 +702,7 @@ var Ht = { get: /* @__PURE__ */ Vt(!1, !1) }, Ut = { get: /* @__PURE__ */ Vt(!1,
|
|
|
702
702
|
function Kt(e, t, n) {
|
|
703
703
|
let r = /* @__PURE__ */ U(n);
|
|
704
704
|
if (r !== n && t.call(e, r)) {
|
|
705
|
-
let t =
|
|
705
|
+
let t = R(e);
|
|
706
706
|
Le(`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.`);
|
|
707
707
|
}
|
|
708
708
|
}
|
|
@@ -739,7 +739,7 @@ function nn(e, t, n, r, i) {
|
|
|
739
739
|
if (e.__v_raw && !(t && e.__v_isReactive) || e.__v_skip || !Object.isExtensible(e)) return e;
|
|
740
740
|
let a = i.get(e);
|
|
741
741
|
if (a) return a;
|
|
742
|
-
let o = Zt(
|
|
742
|
+
let o = Zt(R(e));
|
|
743
743
|
if (o === 0) return e;
|
|
744
744
|
let s = new Proxy(e, o === 2 ? r : n);
|
|
745
745
|
return i.set(e, s), s;
|
|
@@ -766,7 +766,7 @@ function U(e) {
|
|
|
766
766
|
return t ? /* @__PURE__ */ U(t) : e;
|
|
767
767
|
}
|
|
768
768
|
function cn(e) {
|
|
769
|
-
return !D(e, "__v_skip") && Object.isExtensible(e) &&
|
|
769
|
+
return !D(e, "__v_skip") && Object.isExtensible(e) && pe(e, "__v_skip", !0), e;
|
|
770
770
|
}
|
|
771
771
|
var ln = (e) => F(e) ? /* @__PURE__ */ Qt(e) : e, un = (e) => F(e) ? /* @__PURE__ */ en(e) : e;
|
|
772
772
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -797,7 +797,7 @@ var hn = class {
|
|
|
797
797
|
}
|
|
798
798
|
set value(e) {
|
|
799
799
|
let t = this._rawValue, n = this.__v_isShallow || /* @__PURE__ */ on(e) || /* @__PURE__ */ an(e);
|
|
800
|
-
e = n ? e : /* @__PURE__ */ U(e),
|
|
800
|
+
e = n ? e : /* @__PURE__ */ U(e), z(e, t) && (this._rawValue = e, this._value = n ? e : ln(e), process.env.NODE_ENV === "production" ? this.dep.trigger() : this.dep.trigger({
|
|
801
801
|
target: this,
|
|
802
802
|
type: "set",
|
|
803
803
|
key: "value",
|
|
@@ -903,7 +903,7 @@ function Tn(e, t, n = v) {
|
|
|
903
903
|
let x = g ? Array(e.length).fill(xn) : xn, S = (e) => {
|
|
904
904
|
if (!(!(d.flags & 1) || !d.dirty && !e)) if (t) {
|
|
905
905
|
let n = d.run();
|
|
906
|
-
if (e || i || h || (g ? n.some((e, t) =>
|
|
906
|
+
if (e || i || h || (g ? n.some((e, t) => z(e, x[t])) : z(n, x))) {
|
|
907
907
|
p && p();
|
|
908
908
|
let e = Cn;
|
|
909
909
|
Cn = d;
|
|
@@ -936,7 +936,7 @@ function En(e, t = Infinity, n) {
|
|
|
936
936
|
else if (A(e) || k(e)) e.forEach((e) => {
|
|
937
937
|
En(e, t, n);
|
|
938
938
|
});
|
|
939
|
-
else if (
|
|
939
|
+
else if (te(e)) {
|
|
940
940
|
for (let r in e) En(e[r], t, n);
|
|
941
941
|
for (let r of Object.getOwnPropertySymbols(e)) Object.prototype.propertyIsEnumerable.call(e, r) && En(e[r], t, n);
|
|
942
942
|
}
|
|
@@ -1298,7 +1298,7 @@ function Lr(e, t = Pr, n) {
|
|
|
1298
1298
|
return r._n = !0, r._c = !0, r._d = !0, r;
|
|
1299
1299
|
}
|
|
1300
1300
|
function Rr(e) {
|
|
1301
|
-
|
|
1301
|
+
ie(e) && G("Do not use built-in directive ids as custom directive id: " + e);
|
|
1302
1302
|
}
|
|
1303
1303
|
function zr(e, t) {
|
|
1304
1304
|
if (Pr === null) return process.env.NODE_ENV !== "production" && G("withDirectives can only be used inside render functions."), e;
|
|
@@ -1772,7 +1772,7 @@ function Li(e, t, n = ps, r = !1) {
|
|
|
1772
1772
|
return i(), it(), a;
|
|
1773
1773
|
};
|
|
1774
1774
|
return r ? i.unshift(a) : i.push(a), a;
|
|
1775
|
-
} else process.env.NODE_ENV !== "production" && G(`${
|
|
1775
|
+
} else process.env.NODE_ENV !== "production" && G(`${de(Ln[e].replace(/ hook$/, ""))} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`);
|
|
1776
1776
|
}
|
|
1777
1777
|
var Ri = (e) => (t, n = ps) => {
|
|
1778
1778
|
(!Ss || e === "sp") && Li(e, (...e) => t(...e), n);
|
|
@@ -2169,25 +2169,25 @@ function wa(e, t) {
|
|
|
2169
2169
|
return c;
|
|
2170
2170
|
};
|
|
2171
2171
|
}
|
|
2172
|
-
var Ta = null, Ea = (e, t) => t === "modelValue" || t === "model-value" ? e.modelModifiers : e[`${t}Modifiers`] || e[`${
|
|
2172
|
+
var Ta = null, Ea = (e, t) => t === "modelValue" || t === "model-value" ? e.modelModifiers : e[`${t}Modifiers`] || e[`${se(t)}Modifiers`] || e[`${le(t)}Modifiers`];
|
|
2173
2173
|
function Da(e, t, ...n) {
|
|
2174
2174
|
if (e.isUnmounted) return;
|
|
2175
2175
|
let r = e.vnode.props || v;
|
|
2176
2176
|
if (process.env.NODE_ENV !== "production") {
|
|
2177
2177
|
let { emitsOptions: r, propsOptions: [i] } = e;
|
|
2178
|
-
if (r) if (!(t in r)) (!i || !(
|
|
2178
|
+
if (r) if (!(t in r)) (!i || !(de(se(t)) in i)) && G(`Component emitted event "${t}" but it is neither declared in the emits option nor as an "${de(se(t))}" prop.`);
|
|
2179
2179
|
else {
|
|
2180
2180
|
let e = r[t];
|
|
2181
2181
|
M(e) && (e(...n) || G(`Invalid event arguments: event validation failed for event "${t}".`));
|
|
2182
2182
|
}
|
|
2183
2183
|
}
|
|
2184
2184
|
let i = n, a = t.startsWith("update:"), o = a && Ea(r, t.slice(7));
|
|
2185
|
-
if (o && (o.trim && (i = n.map((e) => N(e) ? e.trim() : e)), o.number && (i = n.map(
|
|
2185
|
+
if (o && (o.trim && (i = n.map((e) => N(e) ? e.trim() : e)), o.number && (i = n.map(B))), process.env.NODE_ENV !== "production" && Nr(e, t, i), process.env.NODE_ENV !== "production") {
|
|
2186
2186
|
let n = t.toLowerCase();
|
|
2187
|
-
n !== t && r[
|
|
2187
|
+
n !== t && r[de(n)] && G(`Event "${n}" is emitted in component ${Ls(e, e.type)} but the handler is registered for "${t}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${le(t)}" instead of "${t}".`);
|
|
2188
2188
|
}
|
|
2189
|
-
let s, c = r[s =
|
|
2190
|
-
!c && a && (c = r[s =
|
|
2189
|
+
let s, c = r[s = de(t)] || r[s = de(se(t))];
|
|
2190
|
+
!c && a && (c = r[s = de(le(t))]), c && zn(c, e, 6, i);
|
|
2191
2191
|
let l = r[s + "Once"];
|
|
2192
2192
|
if (l) {
|
|
2193
2193
|
if (!e.emitted) e.emitted = {};
|
|
@@ -2210,7 +2210,7 @@ function ka(e, t, n = !1) {
|
|
|
2210
2210
|
return !a && !s ? (F(e) && r.set(e, null), null) : (O(a) ? a.forEach((e) => o[e] = null) : w(o, a), F(e) && r.set(e, o), o);
|
|
2211
2211
|
}
|
|
2212
2212
|
function Aa(e, t) {
|
|
2213
|
-
return !e || !S(t) ? !1 : (t = t.slice(2), t = t === "Once" ? t : t.replace(/Once$/, ""), D(e, t[0].toLowerCase() + t.slice(1)) || D(e,
|
|
2213
|
+
return !e || !S(t) ? !1 : (t = t.slice(2), t = t === "Once" ? t : t.replace(/Once$/, ""), D(e, t[0].toLowerCase() + t.slice(1)) || D(e, le(t)) || D(e, t));
|
|
2214
2214
|
}
|
|
2215
2215
|
var ja = !1;
|
|
2216
2216
|
function Ma() {
|
|
@@ -2351,7 +2351,7 @@ function Ja(e, t, n, r) {
|
|
|
2351
2351
|
let u = t[o];
|
|
2352
2352
|
if (c) if (D(a, o)) u !== a[o] && (a[o] = u, l = !0);
|
|
2353
2353
|
else {
|
|
2354
|
-
let t =
|
|
2354
|
+
let t = se(o);
|
|
2355
2355
|
i[t] = Xa(c, s, t, u, e, !1);
|
|
2356
2356
|
}
|
|
2357
2357
|
else u !== a[o] && (a[o] = u, l = !0);
|
|
@@ -2360,7 +2360,7 @@ function Ja(e, t, n, r) {
|
|
|
2360
2360
|
} else {
|
|
2361
2361
|
Ya(e, t, i, a) && (l = !0);
|
|
2362
2362
|
let r;
|
|
2363
|
-
for (let a in s) (!t || !D(t, a) && ((r =
|
|
2363
|
+
for (let a in s) (!t || !D(t, a) && ((r = le(a)) === a || !D(t, r))) && (c ? n && (n[a] !== void 0 || n[r] !== void 0) && (i[a] = Xa(c, s, a, void 0, e, !0)) : delete i[a]);
|
|
2364
2364
|
if (a !== s) for (let e in a) (!t || !D(t, e)) && (delete a[e], l = !0);
|
|
2365
2365
|
}
|
|
2366
2366
|
l && ht(e.attrs, "set", ""), process.env.NODE_ENV !== "production" && to(t || {}, i, e);
|
|
@@ -2368,9 +2368,9 @@ function Ja(e, t, n, r) {
|
|
|
2368
2368
|
function Ya(e, t, n, r) {
|
|
2369
2369
|
let [i, a] = e.propsOptions, o = !1, s;
|
|
2370
2370
|
if (t) for (let c in t) {
|
|
2371
|
-
if (
|
|
2371
|
+
if (re(c)) continue;
|
|
2372
2372
|
let l = t[c], u;
|
|
2373
|
-
i && D(i, u =
|
|
2373
|
+
i && D(i, u = se(c)) ? !a || !a.includes(u) ? n[u] = l : (s ||= {})[u] = l : Aa(e.emitsOptions, c) || (!(c in r) || l !== r[c]) && (r[c] = l, o = !0);
|
|
2374
2374
|
}
|
|
2375
2375
|
if (a) {
|
|
2376
2376
|
let t = /* @__PURE__ */ U(n), r = s || v;
|
|
@@ -2397,7 +2397,7 @@ function Xa(e, t, n, r, i, a) {
|
|
|
2397
2397
|
} else r = e;
|
|
2398
2398
|
i.ce && i.ce._setProp(n, r);
|
|
2399
2399
|
}
|
|
2400
|
-
o[0] && (a && !e ? r = !1 : o[1] && (r === "" || r ===
|
|
2400
|
+
o[0] && (a && !e ? r = !1 : o[1] && (r === "" || r === le(n)) && (r = !0));
|
|
2401
2401
|
}
|
|
2402
2402
|
return r;
|
|
2403
2403
|
}
|
|
@@ -2417,13 +2417,13 @@ function Qa(e, t, n = !1) {
|
|
|
2417
2417
|
if (!a && !c) return F(e) && r.set(e, y), y;
|
|
2418
2418
|
if (O(a)) for (let e = 0; e < a.length; e++) {
|
|
2419
2419
|
process.env.NODE_ENV !== "production" && !N(a[e]) && G("props must be strings when using array syntax.", a[e]);
|
|
2420
|
-
let t =
|
|
2420
|
+
let t = se(a[e]);
|
|
2421
2421
|
$a(t) && (o[t] = v);
|
|
2422
2422
|
}
|
|
2423
2423
|
else if (a) {
|
|
2424
2424
|
process.env.NODE_ENV !== "production" && !F(a) && G("invalid props options", a);
|
|
2425
2425
|
for (let e in a) {
|
|
2426
|
-
let t =
|
|
2426
|
+
let t = se(e);
|
|
2427
2427
|
if ($a(t)) {
|
|
2428
2428
|
let n = a[e], r = o[t] = O(n) || M(n) ? { type: n } : w({}, n), i = r.type, c = !1, l = !0;
|
|
2429
2429
|
if (O(i)) for (let e = 0; e < i.length; ++e) {
|
|
@@ -2442,13 +2442,13 @@ function Qa(e, t, n = !1) {
|
|
|
2442
2442
|
return F(e) && r.set(e, l), l;
|
|
2443
2443
|
}
|
|
2444
2444
|
function $a(e) {
|
|
2445
|
-
return e[0] !== "$" && !
|
|
2445
|
+
return e[0] !== "$" && !re(e) ? !0 : (process.env.NODE_ENV !== "production" && G(`Invalid prop name: "${e}" is a reserved property.`), !1);
|
|
2446
2446
|
}
|
|
2447
2447
|
function eo(e) {
|
|
2448
2448
|
return e === null ? "null" : typeof e == "function" ? e.name || "" : typeof e == "object" && e.constructor && e.constructor.name || "";
|
|
2449
2449
|
}
|
|
2450
2450
|
function to(e, t, n) {
|
|
2451
|
-
let r = /* @__PURE__ */ U(t), i = n.propsOptions[0], a = Object.keys(e).map((e) =>
|
|
2451
|
+
let r = /* @__PURE__ */ U(t), i = n.propsOptions[0], a = Object.keys(e).map((e) => se(e));
|
|
2452
2452
|
for (let e in i) {
|
|
2453
2453
|
let t = i[e];
|
|
2454
2454
|
t != null && no(e, r[e], t, process.env.NODE_ENV === "production" ? r : /* @__PURE__ */ tn(r), !a.includes(e));
|
|
@@ -2490,7 +2490,7 @@ function io(e, t) {
|
|
|
2490
2490
|
}
|
|
2491
2491
|
function ao(e, t, n) {
|
|
2492
2492
|
if (n.length === 0) return `Prop type [] for prop "${e}" won't match anything. Did you mean to use type Array instead?`;
|
|
2493
|
-
let r = `Invalid prop: type check failed for prop "${e}". Expected ${n.map(
|
|
2493
|
+
let r = `Invalid prop: type check failed for prop "${e}". Expected ${n.map(ue).join(" | ")}`, i = n[0], a = R(t), o = oo(t, i), s = oo(t, a);
|
|
2494
2494
|
return n.length === 1 && so(i) && co(i, a) && (r += ` with value ${o}`), r += `, got ${a} `, so(a) && (r += `with value ${s}.`), r;
|
|
2495
2495
|
}
|
|
2496
2496
|
function oo(e, t) {
|
|
@@ -2535,7 +2535,7 @@ var lo = (e) => e === "_" || e === "_ctx" || e === "$stable", uo = (e) => O(e) ?
|
|
|
2535
2535
|
let r = e.slots = Wa();
|
|
2536
2536
|
if (e.vnode.shapeFlag & 32) {
|
|
2537
2537
|
let e = t._;
|
|
2538
|
-
e ? (ho(r, t, n), n &&
|
|
2538
|
+
e ? (ho(r, t, n), n && pe(r, "_", e, !0)) : po(t, r);
|
|
2539
2539
|
} else t && mo(e, t);
|
|
2540
2540
|
}, _o = (e, t, n) => {
|
|
2541
2541
|
let { vnode: r, slots: i } = e, a = !0, o = v;
|
|
@@ -2577,7 +2577,7 @@ function Eo(e, t) {
|
|
|
2577
2577
|
n.__VUE__ = !0, process.env.NODE_ENV !== "production" && Sr(n.__VUE_DEVTOOLS_GLOBAL_HOOK__, n);
|
|
2578
2578
|
let { insert: r, remove: i, patchProp: a, createElement: o, createText: s, createComment: c, setText: l, setElementText: u, parentNode: d, nextSibling: f, setScopeId: p = b, insertStaticContent: m } = e, h = (e, t, n, r = null, i = null, a = null, o = void 0, s = null, c = process.env.NODE_ENV !== "production" && or ? !1 : !!t.dynamicChildren) => {
|
|
2579
2579
|
if (e === t) return;
|
|
2580
|
-
e && !Jo(e, t) && (r =
|
|
2580
|
+
e && !Jo(e, t) && (r = le(e), ie(e, i, a, !0), e = null), t.patchFlag === -2 && (c = !1, t.dynamicChildren = null);
|
|
2581
2581
|
let { type: l, ref: u, shapeFlag: d } = t;
|
|
2582
2582
|
switch (l) {
|
|
2583
2583
|
case Lo:
|
|
@@ -2592,7 +2592,7 @@ function Eo(e, t) {
|
|
|
2592
2592
|
case K:
|
|
2593
2593
|
M(e, t, n, r, i, a, o, s, c);
|
|
2594
2594
|
break;
|
|
2595
|
-
default: d & 1 ? T(e, t, n, r, i, a, o, s, c) : d & 6 ? N(e, t, n, r, i, a, o, s, c) : d & 64 || d & 128 ? l.process(e, t, n, r, i, a, o, s, c,
|
|
2595
|
+
default: d & 1 ? T(e, t, n, r, i, a, o, s, c) : d & 6 ? N(e, t, n, r, i, a, o, s, c) : d & 64 || d & 128 ? l.process(e, t, n, r, i, a, o, s, c, z) : process.env.NODE_ENV !== "production" && G("Invalid VNode type:", l, `(${typeof l})`);
|
|
2596
2596
|
}
|
|
2597
2597
|
u != null && i ? ki(u, e && e.ref, a, t || e, !t) : u == null && e && e.ref != null && ki(e.ref, null, a, e, !0);
|
|
2598
2598
|
}, g = (e, t, n, i) => {
|
|
@@ -2631,10 +2631,10 @@ function Eo(e, t) {
|
|
|
2631
2631
|
}, E = (e, t, n, i, s, c, l, d) => {
|
|
2632
2632
|
let f, p, { props: m, shapeFlag: h, transition: g, dirs: _ } = e;
|
|
2633
2633
|
if (f = e.el = o(e.type, c, m && m.is, m), h & 8 ? u(f, e.children) : h & 16 && O(e.children, f, null, i, s, Do(e, c), l, d), _ && Br(e, null, i, "created"), D(f, e, e.scopeId, l, i), m) {
|
|
2634
|
-
for (let e in m) e !== "value" && !
|
|
2634
|
+
for (let e in m) e !== "value" && !re(e) && a(f, e, null, m[e], c, i);
|
|
2635
2635
|
"value" in m && a(f, "value", null, m.value, c), (p = m.onVnodeBeforeMount) && ls(p, i, e);
|
|
2636
2636
|
}
|
|
2637
|
-
process.env.NODE_ENV !== "production" && (
|
|
2637
|
+
process.env.NODE_ENV !== "production" && (pe(f, "__vnode", e, !0), pe(f, "__vueParentComponent", i, !0)), _ && Br(e, null, i, "beforeMount");
|
|
2638
2638
|
let v = ko(s, g);
|
|
2639
2639
|
if (v && g.beforeEnter(f), r(f, t, n), (p = m && m.onVnodeMounted) || v || _) {
|
|
2640
2640
|
let t = process.env.NODE_ENV !== "production" && or;
|
|
@@ -2668,7 +2668,7 @@ function Eo(e, t) {
|
|
|
2668
2668
|
let { patchFlag: l, dynamicChildren: d, dirs: f } = t;
|
|
2669
2669
|
l |= e.patchFlag & 16;
|
|
2670
2670
|
let p = e.props || v, m = t.props || v, h;
|
|
2671
|
-
if (n && Oo(n, !1), (h = m.onVnodeBeforeUpdate) && ls(h, n, t, e), f && Br(t, e, n, "beforeUpdate"), n && Oo(n, !0), (process.env.NODE_ENV !== "production" && or || d && (!e.dynamicChildren || e.dynamicChildren.length !== d.length)) && (l = 0, s = !1, d = null), (p.innerHTML && m.innerHTML == null || p.textContent && m.textContent == null) && u(c, ""), d ? (A(e.dynamicChildren, d, c, n, r, Do(t, i), o), process.env.NODE_ENV !== "production" && Ao(e, t)) : s ||
|
|
2671
|
+
if (n && Oo(n, !1), (h = m.onVnodeBeforeUpdate) && ls(h, n, t, e), f && Br(t, e, n, "beforeUpdate"), n && Oo(n, !0), (process.env.NODE_ENV !== "production" && or || d && (!e.dynamicChildren || e.dynamicChildren.length !== d.length)) && (l = 0, s = !1, d = null), (p.innerHTML && m.innerHTML == null || p.textContent && m.textContent == null) && u(c, ""), d ? (A(e.dynamicChildren, d, c, n, r, Do(t, i), o), process.env.NODE_ENV !== "production" && Ao(e, t)) : s || ee(e, t, c, null, n, r, Do(t, i), o, !1), l > 0) {
|
|
2672
2672
|
if (l & 16) j(c, p, m, n, i);
|
|
2673
2673
|
else if (l & 2 && p.class !== m.class && a(c, "class", null, m.class, i), l & 4 && a(c, "style", p.style, m.style, i), l & 8) {
|
|
2674
2674
|
let e = t.dynamicProps;
|
|
@@ -2689,9 +2689,9 @@ function Eo(e, t) {
|
|
|
2689
2689
|
}
|
|
2690
2690
|
}, j = (e, t, n, r, i) => {
|
|
2691
2691
|
if (t !== n) {
|
|
2692
|
-
if (t !== v) for (let o in t) !
|
|
2692
|
+
if (t !== v) for (let o in t) !re(o) && !(o in n) && a(e, o, t[o], null, i, r);
|
|
2693
2693
|
for (let o in n) {
|
|
2694
|
-
if (
|
|
2694
|
+
if (re(o)) continue;
|
|
2695
2695
|
let s = n[o], c = t[o];
|
|
2696
2696
|
s !== c && o !== "value" && a(e, o, c, s, i, r);
|
|
2697
2697
|
}
|
|
@@ -2699,12 +2699,12 @@ function Eo(e, t) {
|
|
|
2699
2699
|
}
|
|
2700
2700
|
}, M = (e, t, n, i, a, o, c, l, u) => {
|
|
2701
2701
|
let d = t.el = e ? e.el : s(""), f = t.anchor = e ? e.anchor : s(""), { patchFlag: p, dynamicChildren: m, slotScopeIds: h } = t;
|
|
2702
|
-
process.env.NODE_ENV !== "production" && (or || p & 2048) && (p = 0, u = !1, m = null), h && (l = l ? l.concat(h) : h), e == null ? (r(d, n, i), r(f, n, i), O(t.children || [], n, f, a, o, c, l, u)) : p > 0 && p & 64 && m && e.dynamicChildren && e.dynamicChildren.length === m.length ? (A(e.dynamicChildren, m, n, a, o, c, l), process.env.NODE_ENV === "production" ? (t.key != null || a && t === a.subTree) && Ao(e, t, !0) : Ao(e, t)) :
|
|
2702
|
+
process.env.NODE_ENV !== "production" && (or || p & 2048) && (p = 0, u = !1, m = null), h && (l = l ? l.concat(h) : h), e == null ? (r(d, n, i), r(f, n, i), O(t.children || [], n, f, a, o, c, l, u)) : p > 0 && p & 64 && m && e.dynamicChildren && e.dynamicChildren.length === m.length ? (A(e.dynamicChildren, m, n, a, o, c, l), process.env.NODE_ENV === "production" ? (t.key != null || a && t === a.subTree) && Ao(e, t, !0) : Ao(e, t)) : ee(e, t, n, f, a, o, c, l, u);
|
|
2703
2703
|
}, N = (e, t, n, r, i, a, o, s, c) => {
|
|
2704
2704
|
t.slotScopeIds = s, e == null ? t.shapeFlag & 512 ? i.ctx.activate(t, n, r, o, c) : P(t, n, r, i, a, o, c) : F(e, t, c);
|
|
2705
2705
|
}, P = (e, t, n, r, i, a, o) => {
|
|
2706
2706
|
let s = e.component = fs(e, r, i);
|
|
2707
|
-
if (process.env.NODE_ENV !== "production" && s.type.__hmrId && ur(s), process.env.NODE_ENV !== "production" && (On(e), bo(s, "mount")), Mi(e) && (s.ctx.renderer =
|
|
2707
|
+
if (process.env.NODE_ENV !== "production" && s.type.__hmrId && ur(s), process.env.NODE_ENV !== "production" && (On(e), bo(s, "mount")), Mi(e) && (s.ctx.renderer = z), process.env.NODE_ENV !== "production" && bo(s, "init"), Cs(s, !1, o), process.env.NODE_ENV !== "production" && xo(s, "init"), process.env.NODE_ENV !== "production" && or && (e.el = null), s.asyncDep) {
|
|
2708
2708
|
if (i && i.registerDep(s, I, o), !e.el) {
|
|
2709
2709
|
let r = s.subTree = $o(Ro);
|
|
2710
2710
|
_(null, r, t, n), e.placeholder = r.el;
|
|
@@ -2734,14 +2734,14 @@ function Eo(e, t) {
|
|
|
2734
2734
|
}
|
|
2735
2735
|
}
|
|
2736
2736
|
let u = t, f;
|
|
2737
|
-
process.env.NODE_ENV !== "production" && On(t || e.vnode), Oo(e, !1), t ? (t.el = c.el, L(e, t, o)) : t = c, n &&
|
|
2737
|
+
process.env.NODE_ENV !== "production" && On(t || e.vnode), Oo(e, !1), t ? (t.el = c.el, L(e, t, o)) : t = c, n && fe(n), (f = t.props && t.props.onVnodeBeforeUpdate) && ls(f, s, t, c), Oo(e, !0), process.env.NODE_ENV !== "production" && bo(e, "render");
|
|
2738
2738
|
let p = Na(e);
|
|
2739
2739
|
process.env.NODE_ENV !== "production" && xo(e, "render");
|
|
2740
2740
|
let m = e.subTree;
|
|
2741
|
-
e.subTree = p, process.env.NODE_ENV !== "production" && bo(e, "patch"), h(m, p, d(m.el),
|
|
2741
|
+
e.subTree = p, process.env.NODE_ENV !== "production" && bo(e, "patch"), h(m, p, d(m.el), le(m), e, i, a), process.env.NODE_ENV !== "production" && xo(e, "patch"), t.el = p.el, u === null && Ha(e, p.el), r && wo(r, i), (f = t.props && t.props.onVnodeUpdated) && wo(() => ls(f, s, t, c), i), process.env.NODE_ENV !== "production" && Er(e), process.env.NODE_ENV !== "production" && kn();
|
|
2742
2742
|
} else {
|
|
2743
2743
|
let o, { el: s, props: c } = t, { bm: l, m: u, parent: d, root: f, type: p } = e, m = ji(t);
|
|
2744
|
-
if (Oo(e, !1), l &&
|
|
2744
|
+
if (Oo(e, !1), l && fe(l), !m && (o = c && c.onVnodeBeforeMount) && ls(o, d, t), Oo(e, !0), s && me) {
|
|
2745
2745
|
let t = () => {
|
|
2746
2746
|
process.env.NODE_ENV !== "production" && bo(e, "render"), e.subTree = Na(e), process.env.NODE_ENV !== "production" && xo(e, "render"), process.env.NODE_ENV !== "production" && bo(e, "hydrate"), me(s, e.subTree, e, i, null), process.env.NODE_ENV !== "production" && xo(e, "hydrate");
|
|
2747
2747
|
};
|
|
@@ -2762,32 +2762,32 @@ function Eo(e, t) {
|
|
|
2762
2762
|
let c = e.effect = new He(s);
|
|
2763
2763
|
e.scope.off();
|
|
2764
2764
|
let l = e.update = c.run.bind(c), u = e.job = c.runIfDirty.bind(c);
|
|
2765
|
-
u.i = e, u.id = e.uid, c.scheduler = () => Qn(u), Oo(e, !0), process.env.NODE_ENV !== "production" && (c.onTrack = e.rtc ? (t) =>
|
|
2765
|
+
u.i = e, u.id = e.uid, c.scheduler = () => Qn(u), Oo(e, !0), process.env.NODE_ENV !== "production" && (c.onTrack = e.rtc ? (t) => fe(e.rtc, t) : void 0, c.onTrigger = e.rtg ? (t) => fe(e.rtg, t) : void 0), l();
|
|
2766
2766
|
}, L = (e, t, n) => {
|
|
2767
2767
|
t.component = e;
|
|
2768
2768
|
let r = e.vnode.props;
|
|
2769
2769
|
e.vnode = t, e.next = null, Ja(e, t.props, r, n), _o(e, t.children, n), rt(), tr(e), it();
|
|
2770
|
-
},
|
|
2770
|
+
}, ee = (e, t, n, r, i, a, o, s, c = !1) => {
|
|
2771
2771
|
let l = e && e.children, d = e ? e.shapeFlag : 0, f = t.children, { patchFlag: p, shapeFlag: m } = t;
|
|
2772
2772
|
if (p > 0) {
|
|
2773
2773
|
if (p & 128) {
|
|
2774
|
-
|
|
2774
|
+
te(l, f, n, r, i, a, o, s, c);
|
|
2775
2775
|
return;
|
|
2776
2776
|
} else if (p & 256) {
|
|
2777
|
-
|
|
2777
|
+
R(l, f, n, r, i, a, o, s, c);
|
|
2778
2778
|
return;
|
|
2779
2779
|
}
|
|
2780
2780
|
}
|
|
2781
|
-
m & 8 ? (d & 16 &&
|
|
2782
|
-
},
|
|
2781
|
+
m & 8 ? (d & 16 && ce(l, i, a), f !== l && u(n, f)) : d & 16 ? m & 16 ? te(l, f, n, r, i, a, o, s, c) : ce(l, i, a, !0) : (d & 8 && u(n, ""), m & 16 && O(f, n, r, i, a, o, s, c));
|
|
2782
|
+
}, R = (e, t, n, r, i, a, o, s, c) => {
|
|
2783
2783
|
e ||= y, t ||= y;
|
|
2784
2784
|
let l = e.length, u = t.length, d = Math.min(l, u), f;
|
|
2785
2785
|
for (f = 0; f < d; f++) {
|
|
2786
2786
|
let r = t[f] = c ? os(t[f]) : as(t[f]);
|
|
2787
2787
|
h(e[f], r, n, null, i, a, o, s, c);
|
|
2788
2788
|
}
|
|
2789
|
-
l > u ?
|
|
2790
|
-
},
|
|
2789
|
+
l > u ? ce(e, i, a, !0, !1, d) : O(t, n, r, i, a, o, s, c, d);
|
|
2790
|
+
}, te = (e, t, n, r, i, a, o, s, c) => {
|
|
2791
2791
|
let l = 0, u = t.length, d = e.length - 1, f = u - 1;
|
|
2792
2792
|
for (; l <= d && l <= f;) {
|
|
2793
2793
|
let r = e[l], u = t[l] = c ? os(t[l]) : as(t[l]);
|
|
@@ -2806,7 +2806,7 @@ function Eo(e, t) {
|
|
|
2806
2806
|
let e = f + 1, d = e < u ? t[e].el : r;
|
|
2807
2807
|
for (; l <= f;) h(null, t[l] = c ? os(t[l]) : as(t[l]), n, d, i, a, o, s, c), l++;
|
|
2808
2808
|
}
|
|
2809
|
-
} else if (l > f) for (; l <= d;)
|
|
2809
|
+
} else if (l > f) for (; l <= d;) ie(e[l], i, a, !0), l++;
|
|
2810
2810
|
else {
|
|
2811
2811
|
let p = l, m = l, g = /* @__PURE__ */ new Map();
|
|
2812
2812
|
for (l = m; l <= f; l++) {
|
|
@@ -2818,7 +2818,7 @@ function Eo(e, t) {
|
|
|
2818
2818
|
for (l = p; l <= d; l++) {
|
|
2819
2819
|
let r = e[l];
|
|
2820
2820
|
if (v >= b) {
|
|
2821
|
-
|
|
2821
|
+
ie(r, i, a, !0);
|
|
2822
2822
|
continue;
|
|
2823
2823
|
}
|
|
2824
2824
|
let u;
|
|
@@ -2827,18 +2827,18 @@ function Eo(e, t) {
|
|
|
2827
2827
|
u = _;
|
|
2828
2828
|
break;
|
|
2829
2829
|
}
|
|
2830
|
-
u === void 0 ?
|
|
2830
|
+
u === void 0 ? ie(r, i, a, !0) : (C[u - m] = l + 1, u >= S ? S = u : x = !0, h(r, t[u], n, null, i, a, o, s, c), v++);
|
|
2831
2831
|
}
|
|
2832
2832
|
let w = x ? jo(C) : y;
|
|
2833
2833
|
for (_ = w.length - 1, l = b - 1; l >= 0; l--) {
|
|
2834
2834
|
let e = m + l, d = t[e], f = t[e + 1], p = e + 1 < u ? f.el || Po(f) : r;
|
|
2835
|
-
C[l] === 0 ? h(null, d, n, p, i, a, o, s, c) : x && (_ < 0 || l !== w[_] ?
|
|
2835
|
+
C[l] === 0 ? h(null, d, n, p, i, a, o, s, c) : x && (_ < 0 || l !== w[_] ? ne(d, n, p, 2) : _--);
|
|
2836
2836
|
}
|
|
2837
2837
|
}
|
|
2838
|
-
},
|
|
2838
|
+
}, ne = (e, t, n, a, o = null) => {
|
|
2839
2839
|
let { el: s, type: c, transition: l, children: u, shapeFlag: d } = e;
|
|
2840
2840
|
if (d & 6) {
|
|
2841
|
-
|
|
2841
|
+
ne(e.component.subTree, t, n, a);
|
|
2842
2842
|
return;
|
|
2843
2843
|
}
|
|
2844
2844
|
if (d & 128) {
|
|
@@ -2846,12 +2846,12 @@ function Eo(e, t) {
|
|
|
2846
2846
|
return;
|
|
2847
2847
|
}
|
|
2848
2848
|
if (d & 64) {
|
|
2849
|
-
c.move(e, t, n,
|
|
2849
|
+
c.move(e, t, n, z);
|
|
2850
2850
|
return;
|
|
2851
2851
|
}
|
|
2852
2852
|
if (c === K) {
|
|
2853
2853
|
r(s, t, n);
|
|
2854
|
-
for (let e = 0; e < u.length; e++)
|
|
2854
|
+
for (let e = 0; e < u.length; e++) ne(u[e], t, n, a);
|
|
2855
2855
|
r(e.anchor, t, n);
|
|
2856
2856
|
return;
|
|
2857
2857
|
}
|
|
@@ -2872,31 +2872,31 @@ function Eo(e, t) {
|
|
|
2872
2872
|
o ? o(s, u, d) : d();
|
|
2873
2873
|
}
|
|
2874
2874
|
else r(s, t, n);
|
|
2875
|
-
},
|
|
2875
|
+
}, ie = (e, t, n, r = !1, i = !1) => {
|
|
2876
2876
|
let { type: a, props: o, ref: s, children: c, dynamicChildren: l, shapeFlag: u, patchFlag: d, dirs: f, cacheIndex: p, memo: m } = e;
|
|
2877
2877
|
if (d === -2 && (i = !1), s != null && (rt(), ki(s, null, n, e, !0), it()), p != null && (t.renderCache[p] = void 0), u & 256) {
|
|
2878
2878
|
t.ctx.deactivate(e);
|
|
2879
2879
|
return;
|
|
2880
2880
|
}
|
|
2881
2881
|
let h = u & 1 && f, g = !ji(e), _;
|
|
2882
|
-
if (g && (_ = o && o.onVnodeBeforeUnmount) && ls(_, t, e), u & 6)
|
|
2882
|
+
if (g && (_ = o && o.onVnodeBeforeUnmount) && ls(_, t, e), u & 6) se(e.component, n, r);
|
|
2883
2883
|
else {
|
|
2884
2884
|
if (u & 128) {
|
|
2885
2885
|
e.suspense.unmount(n, r);
|
|
2886
2886
|
return;
|
|
2887
2887
|
}
|
|
2888
|
-
h && Br(e, null, t, "beforeUnmount"), u & 64 ? e.type.remove(e, t, n,
|
|
2888
|
+
h && Br(e, null, t, "beforeUnmount"), u & 64 ? e.type.remove(e, t, n, z, r) : l && !l.hasOnce && (a !== K || d > 0 && d & 64) ? ce(l, t, n, !1, !0) : (a === K && d & 384 || !i && u & 16) && ce(c, t, n), r && ae(e);
|
|
2889
2889
|
}
|
|
2890
2890
|
let v = m != null && p == null;
|
|
2891
2891
|
(g && (_ = o && o.onVnodeUnmounted) || h || v) && wo(() => {
|
|
2892
2892
|
_ && ls(_, t, e), h && Br(e, null, t, "unmounted"), v && (e.el = null);
|
|
2893
2893
|
}, n);
|
|
2894
|
-
},
|
|
2894
|
+
}, ae = (e) => {
|
|
2895
2895
|
let { type: t, el: n, anchor: r, transition: a } = e;
|
|
2896
2896
|
if (t === K) {
|
|
2897
2897
|
process.env.NODE_ENV !== "production" && e.patchFlag > 0 && e.patchFlag & 2048 && a && !a.persisted ? e.children.forEach((e) => {
|
|
2898
|
-
e.type === Ro ? i(e.el) :
|
|
2899
|
-
}) :
|
|
2898
|
+
e.type === Ro ? i(e.el) : ae(e);
|
|
2899
|
+
}) : oe(n, r);
|
|
2900
2900
|
return;
|
|
2901
2901
|
}
|
|
2902
2902
|
if (t === zo) {
|
|
@@ -2910,42 +2910,42 @@ function Eo(e, t) {
|
|
|
2910
2910
|
let { leave: t, delayLeave: r } = a, i = () => t(n, o);
|
|
2911
2911
|
r ? r(e.el, o, i) : i();
|
|
2912
2912
|
} else o();
|
|
2913
|
-
},
|
|
2913
|
+
}, oe = (e, t) => {
|
|
2914
2914
|
let n;
|
|
2915
2915
|
for (; e !== t;) n = f(e), i(e), e = n;
|
|
2916
2916
|
i(t);
|
|
2917
|
-
},
|
|
2917
|
+
}, se = (e, t, n) => {
|
|
2918
2918
|
process.env.NODE_ENV !== "production" && e.type.__hmrId && dr(e);
|
|
2919
2919
|
let { bum: r, scope: i, job: a, subTree: o, um: s, m: c, a: l } = e;
|
|
2920
|
-
No(c), No(l), r &&
|
|
2920
|
+
No(c), No(l), r && fe(r), i.stop(), a && (a.flags |= 8, ie(o, e, t, n)), s && wo(s, t), wo(() => {
|
|
2921
2921
|
e.isUnmounted = !0;
|
|
2922
2922
|
}, t), process.env.NODE_ENV !== "production" && Or(e);
|
|
2923
|
-
},
|
|
2924
|
-
for (let o = a; o < e.length; o++)
|
|
2925
|
-
},
|
|
2926
|
-
if (e.shapeFlag & 6) return
|
|
2923
|
+
}, ce = (e, t, n, r = !1, i = !1, a = 0) => {
|
|
2924
|
+
for (let o = a; o < e.length; o++) ie(e[o], t, n, r, i);
|
|
2925
|
+
}, le = (e) => {
|
|
2926
|
+
if (e.shapeFlag & 6) return le(e.component.subTree);
|
|
2927
2927
|
if (e.shapeFlag & 128) return e.suspense.next();
|
|
2928
2928
|
let t = f(e.anchor || e.el), n = t && t[Xr];
|
|
2929
2929
|
return n ? f(n) : t;
|
|
2930
|
-
},
|
|
2930
|
+
}, ue = !1, de = (e, t, n) => {
|
|
2931
2931
|
let r;
|
|
2932
|
-
e == null ? t._vnode && (
|
|
2933
|
-
},
|
|
2932
|
+
e == null ? t._vnode && (ie(t._vnode, null, null, !0), r = t._vnode.component) : h(t._vnode || null, e, t, null, null, null, n), t._vnode = e, ue ||= (ue = !0, tr(r), nr(), !1);
|
|
2933
|
+
}, z = {
|
|
2934
2934
|
p: h,
|
|
2935
|
-
um:
|
|
2936
|
-
m:
|
|
2937
|
-
r:
|
|
2935
|
+
um: ie,
|
|
2936
|
+
m: ne,
|
|
2937
|
+
r: ae,
|
|
2938
2938
|
mt: P,
|
|
2939
2939
|
mc: O,
|
|
2940
|
-
pc:
|
|
2940
|
+
pc: ee,
|
|
2941
2941
|
pbc: A,
|
|
2942
|
-
n:
|
|
2942
|
+
n: le,
|
|
2943
2943
|
o: e
|
|
2944
|
-
},
|
|
2945
|
-
return t && ([
|
|
2946
|
-
render:
|
|
2947
|
-
hydrate:
|
|
2948
|
-
createApp: wa(
|
|
2944
|
+
}, B, me;
|
|
2945
|
+
return t && ([B, me] = t(z)), {
|
|
2946
|
+
render: de,
|
|
2947
|
+
hydrate: B,
|
|
2948
|
+
createApp: wa(de, B)
|
|
2949
2949
|
};
|
|
2950
2950
|
}
|
|
2951
2951
|
function Do({ type: e, props: t }, n) {
|
|
@@ -3798,7 +3798,7 @@ function Oc(e, t, n) {
|
|
|
3798
3798
|
else if (n ??= "", process.env.NODE_ENV !== "production" && Ec.test(n) && Us(`Unexpected semicolon at the end of '${t}' style value: '${n}'`), t.startsWith("--")) e.setProperty(t, n);
|
|
3799
3799
|
else {
|
|
3800
3800
|
let r = jc(e, t);
|
|
3801
|
-
Dc.test(n) ? e.setProperty(
|
|
3801
|
+
Dc.test(n) ? e.setProperty(le(r), n.replace(Dc, ""), "important") : e[r] = n;
|
|
3802
3802
|
}
|
|
3803
3803
|
}
|
|
3804
3804
|
var kc = [
|
|
@@ -3809,9 +3809,9 @@ var kc = [
|
|
|
3809
3809
|
function jc(e, t) {
|
|
3810
3810
|
let n = Ac[t];
|
|
3811
3811
|
if (n) return n;
|
|
3812
|
-
let r =
|
|
3812
|
+
let r = se(t);
|
|
3813
3813
|
if (r !== "filter" && r in e) return Ac[t] = r;
|
|
3814
|
-
r =
|
|
3814
|
+
r = ue(r);
|
|
3815
3815
|
for (let n = 0; n < kc.length; n++) {
|
|
3816
3816
|
let i = kc[n] + r;
|
|
3817
3817
|
if (i in e) return Ac[t] = i;
|
|
@@ -3867,7 +3867,7 @@ var Bc = /(Once|Passive|Capture)$/, Vc = /^on:?(?:Once|Passive|Capture)$/;
|
|
|
3867
3867
|
function Hc(e) {
|
|
3868
3868
|
let t, n;
|
|
3869
3869
|
for (; (n = e.match(Bc)) && !Vc.test(e);) t ||= {}, e = e.slice(0, e.length - n[1].length), t[n[1].toLowerCase()] = !0;
|
|
3870
|
-
return [e[2] === ":" ? e.slice(3) :
|
|
3870
|
+
return [e[2] === ":" ? e.slice(3) : le(e.slice(2)), t];
|
|
3871
3871
|
}
|
|
3872
3872
|
var Uc = 0, Wc = /* @__PURE__ */ Promise.resolve(), Gc = () => Uc ||= (Wc.then(() => Uc = 0), Date.now());
|
|
3873
3873
|
function Kc(e, t) {
|
|
@@ -3895,7 +3895,7 @@ Expected function or array of functions, received type ${typeof e}.`), b);
|
|
|
3895
3895
|
}
|
|
3896
3896
|
var Jc = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && e.charCodeAt(2) > 96 && e.charCodeAt(2) < 123, Yc = (e, t, n, r, i, a) => {
|
|
3897
3897
|
let o = i === "svg";
|
|
3898
|
-
t === "class" ? vc(e, r, o) : t === "style" ? Tc(e, n, r) : S(t) ? C(t) || zc(e, t, n, r, a) : (t[0] === "." ? (t = t.slice(1), !0) : t[0] === "^" ? (t = t.slice(1), !1) : Xc(e, t, r, o)) ? (Fc(e, t, r), !e.tagName.includes("-") && (t === "value" || t === "checked" || t === "selected") && Pc(e, t, r, o, a, t !== "value")) : e._isVueCE && (Zc(e, t) || e._def.__asyncLoader && (/[A-Z]/.test(t) || !N(r))) ? Fc(e,
|
|
3898
|
+
t === "class" ? vc(e, r, o) : t === "style" ? Tc(e, n, r) : S(t) ? C(t) || zc(e, t, n, r, a) : (t[0] === "." ? (t = t.slice(1), !0) : t[0] === "^" ? (t = t.slice(1), !1) : Xc(e, t, r, o)) ? (Fc(e, t, r), !e.tagName.includes("-") && (t === "value" || t === "checked" || t === "selected") && Pc(e, t, r, o, a, t !== "value")) : e._isVueCE && (Zc(e, t) || e._def.__asyncLoader && (/[A-Z]/.test(t) || !N(r))) ? Fc(e, se(t), r, a, t) : (t === "true-value" ? e._trueValue = r : t === "false-value" && (e._falseValue = r), Pc(e, t, r, o));
|
|
3899
3899
|
};
|
|
3900
3900
|
function Xc(e, t, n, r) {
|
|
3901
3901
|
if (r) return !!(t === "innerHTML" || t === "textContent" || t in e && Jc(t) && M(n));
|
|
@@ -3909,12 +3909,12 @@ function Xc(e, t, n, r) {
|
|
|
3909
3909
|
function Zc(e, t) {
|
|
3910
3910
|
let n = e._def.props;
|
|
3911
3911
|
if (!n) return !1;
|
|
3912
|
-
let r =
|
|
3913
|
-
return Array.isArray(n) ? n.some((e) =>
|
|
3912
|
+
let r = se(t);
|
|
3913
|
+
return Array.isArray(n) ? n.some((e) => se(e) === r) : Object.keys(n).some((e) => se(e) === r);
|
|
3914
3914
|
}
|
|
3915
3915
|
var Qc = (e) => {
|
|
3916
3916
|
let t = e.props["onUpdate:modelValue"] || !1;
|
|
3917
|
-
return O(t) ? (e) =>
|
|
3917
|
+
return O(t) ? (e) => fe(t, e) : t;
|
|
3918
3918
|
};
|
|
3919
3919
|
function $c(e) {
|
|
3920
3920
|
e.target.composing = !0;
|
|
@@ -3925,7 +3925,7 @@ function el(e) {
|
|
|
3925
3925
|
}
|
|
3926
3926
|
var tl = /* @__PURE__ */ Symbol("_assign");
|
|
3927
3927
|
function nl(e, t, n) {
|
|
3928
|
-
return t && (e = e.trim()), n && (e =
|
|
3928
|
+
return t && (e = e.trim()), n && (e = B(e)), e;
|
|
3929
3929
|
}
|
|
3930
3930
|
var rl = {
|
|
3931
3931
|
created(e, { modifiers: { lazy: t, trim: n, number: r } }, i) {
|
|
@@ -3942,7 +3942,7 @@ var rl = {
|
|
|
3942
3942
|
},
|
|
3943
3943
|
beforeUpdate(e, { value: t, oldValue: n, modifiers: { lazy: r, trim: i, number: a } }, o) {
|
|
3944
3944
|
if (e[tl] = Qc(o), e.composing) return;
|
|
3945
|
-
let s = (a || e.type === "number") && !/^0\d/.test(e.value) ?
|
|
3945
|
+
let s = (a || e.type === "number") && !/^0\d/.test(e.value) ? B(e.value) : e.value, c = t ?? "";
|
|
3946
3946
|
if (s === c) return;
|
|
3947
3947
|
let l = e.getRootNode();
|
|
3948
3948
|
(l instanceof Document || l instanceof ShadowRoot) && l.activeElement === e && e.type !== "range" && (r && t === n || i && e.value.trim() === c) || (e.value = c);
|
|
@@ -5899,7 +5899,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
5899
5899
|
});
|
|
5900
5900
|
let i = y("I", "a", "is", "so", "us", "to", "at", "if", "in", "it", "on", /[A-Za-z]+['](d|ve|re|ll|t|s|n)/, /[A-Za-z]+[-][a-z]+/, /[A-Za-z][a-z]{2,}/);
|
|
5901
5901
|
return r.contains.push({ begin: _(/[ ]+/, "(", i, /[.]?[:]?([.][ ]|[ ])/, "){3}") }), r;
|
|
5902
|
-
}, L = I("//", "$"),
|
|
5902
|
+
}, L = I("//", "$"), ee = I("/\\*", "\\*/"), R = I("#", "$"), te = /*#__PURE__*/ Object.freeze({
|
|
5903
5903
|
__proto__: null,
|
|
5904
5904
|
APOS_STRING_MODE: N,
|
|
5905
5905
|
BACKSLASH_ESCAPE: M,
|
|
@@ -5910,7 +5910,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
5910
5910
|
},
|
|
5911
5911
|
BINARY_NUMBER_RE: k,
|
|
5912
5912
|
COMMENT: I,
|
|
5913
|
-
C_BLOCK_COMMENT_MODE:
|
|
5913
|
+
C_BLOCK_COMMENT_MODE: ee,
|
|
5914
5914
|
C_LINE_COMMENT_MODE: L,
|
|
5915
5915
|
C_NUMBER_MODE: {
|
|
5916
5916
|
scope: "number",
|
|
@@ -5928,7 +5928,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
5928
5928
|
}
|
|
5929
5929
|
});
|
|
5930
5930
|
},
|
|
5931
|
-
HASH_COMMENT_MODE:
|
|
5931
|
+
HASH_COMMENT_MODE: R,
|
|
5932
5932
|
IDENT_RE: T,
|
|
5933
5933
|
MATCH_NOTHING_RE: w,
|
|
5934
5934
|
METHOD_GUARD: {
|
|
@@ -5968,28 +5968,28 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
5968
5968
|
relevance: 0
|
|
5969
5969
|
}
|
|
5970
5970
|
});
|
|
5971
|
-
function te(e, t) {
|
|
5972
|
-
e.input[e.index - 1] === "." && t.ignoreMatch();
|
|
5973
|
-
}
|
|
5974
5971
|
function ne(e, t) {
|
|
5975
|
-
e.
|
|
5972
|
+
e.input[e.index - 1] === "." && t.ignoreMatch();
|
|
5976
5973
|
}
|
|
5977
5974
|
function re(e, t) {
|
|
5978
|
-
|
|
5975
|
+
e.className !== void 0 && (e.scope = e.className, delete e.className);
|
|
5979
5976
|
}
|
|
5980
5977
|
function ie(e, t) {
|
|
5981
|
-
|
|
5978
|
+
t && e.beginKeywords && (e.begin = "\\b(" + e.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", e.__beforeBegin = ne, e.keywords = e.keywords || e.beginKeywords, delete e.beginKeywords, e.relevance === void 0 && (e.relevance = 0));
|
|
5982
5979
|
}
|
|
5983
5980
|
function ae(e, t) {
|
|
5981
|
+
Array.isArray(e.illegal) && (e.illegal = y(...e.illegal));
|
|
5982
|
+
}
|
|
5983
|
+
function oe(e, t) {
|
|
5984
5984
|
if (e.match) {
|
|
5985
5985
|
if (e.begin || e.end) throw Error("begin & end are not supported with match");
|
|
5986
5986
|
e.begin = e.match, delete e.match;
|
|
5987
5987
|
}
|
|
5988
5988
|
}
|
|
5989
|
-
function
|
|
5989
|
+
function se(e, t) {
|
|
5990
5990
|
e.relevance === void 0 && (e.relevance = 1);
|
|
5991
5991
|
}
|
|
5992
|
-
var
|
|
5992
|
+
var ce = (e, t) => {
|
|
5993
5993
|
if (!e.beforeMatch) return;
|
|
5994
5994
|
if (e.starts) throw Error("beforeMatch cannot be used with starts");
|
|
5995
5995
|
let n = Object.assign({}, e);
|
|
@@ -5999,7 +5999,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
5999
5999
|
relevance: 0,
|
|
6000
6000
|
contains: [Object.assign(n, { endsParent: !0 })]
|
|
6001
6001
|
}, e.relevance = 0, delete n.beforeMatch;
|
|
6002
|
-
},
|
|
6002
|
+
}, le = [
|
|
6003
6003
|
"of",
|
|
6004
6004
|
"and",
|
|
6005
6005
|
"for",
|
|
@@ -6011,31 +6011,31 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
6011
6011
|
"parent",
|
|
6012
6012
|
"list",
|
|
6013
6013
|
"value"
|
|
6014
|
-
],
|
|
6015
|
-
function
|
|
6014
|
+
], ue = "keyword";
|
|
6015
|
+
function de(e, t, n = ue) {
|
|
6016
6016
|
let r = Object.create(null);
|
|
6017
6017
|
return typeof e == "string" ? i(n, e.split(" ")) : Array.isArray(e) ? i(n, e) : Object.keys(e).forEach(function(n) {
|
|
6018
|
-
Object.assign(r,
|
|
6018
|
+
Object.assign(r, de(e[n], t, n));
|
|
6019
6019
|
}), r;
|
|
6020
6020
|
function i(e, n) {
|
|
6021
6021
|
t && (n = n.map((e) => e.toLowerCase())), n.forEach(function(t) {
|
|
6022
6022
|
let n = t.split("|");
|
|
6023
|
-
r[n[0]] = [e,
|
|
6023
|
+
r[n[0]] = [e, z(n[0], n[1])];
|
|
6024
6024
|
});
|
|
6025
6025
|
}
|
|
6026
6026
|
}
|
|
6027
|
-
function
|
|
6028
|
-
return t ? Number(t) : +!
|
|
6027
|
+
function z(e, t) {
|
|
6028
|
+
return t ? Number(t) : +!fe(e);
|
|
6029
6029
|
}
|
|
6030
|
-
function
|
|
6031
|
-
return
|
|
6030
|
+
function fe(e) {
|
|
6031
|
+
return le.includes(e.toLowerCase());
|
|
6032
6032
|
}
|
|
6033
|
-
var
|
|
6033
|
+
var pe = {}, B = (e) => {
|
|
6034
6034
|
console.error(e);
|
|
6035
6035
|
}, me = (e, ...t) => {
|
|
6036
6036
|
console.log(`WARN: ${e}`, ...t);
|
|
6037
6037
|
}, he = (e, t) => {
|
|
6038
|
-
|
|
6038
|
+
pe[`${e}/${t}`] || (console.log(`Deprecated as of ${e}. ${t}`), pe[`${e}/${t}`] = !0);
|
|
6039
6039
|
}, ge = /* @__PURE__ */ Error();
|
|
6040
6040
|
function _e(e, t, { key: n }) {
|
|
6041
6041
|
let r = 0, i = e[n], a = {}, o = {};
|
|
@@ -6044,15 +6044,15 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
6044
6044
|
}
|
|
6045
6045
|
function ve(e) {
|
|
6046
6046
|
if (Array.isArray(e.begin)) {
|
|
6047
|
-
if (e.skip || e.excludeBegin || e.returnBegin) throw
|
|
6048
|
-
if (typeof e.beginScope != "object" || e.beginScope === null) throw
|
|
6047
|
+
if (e.skip || e.excludeBegin || e.returnBegin) throw B("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), ge;
|
|
6048
|
+
if (typeof e.beginScope != "object" || e.beginScope === null) throw B("beginScope must be object"), ge;
|
|
6049
6049
|
_e(e, e.begin, { key: "beginScope" }), e.begin = C(e.begin, { joinWith: "" });
|
|
6050
6050
|
}
|
|
6051
6051
|
}
|
|
6052
6052
|
function ye(e) {
|
|
6053
6053
|
if (Array.isArray(e.end)) {
|
|
6054
|
-
if (e.skip || e.excludeEnd || e.returnEnd) throw
|
|
6055
|
-
if (typeof e.endScope != "object" || e.endScope === null) throw
|
|
6054
|
+
if (e.skip || e.excludeEnd || e.returnEnd) throw B("skip, excludeEnd, returnEnd not compatible with endScope: {}"), ge;
|
|
6055
|
+
if (typeof e.endScope != "object" || e.endScope === null) throw B("endScope must be object"), ge;
|
|
6056
6056
|
_e(e, e.end, { key: "endScope" }), e.end = C(e.end, { joinWith: "" });
|
|
6057
6057
|
}
|
|
6058
6058
|
}
|
|
@@ -6126,17 +6126,17 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
6126
6126
|
let a = n;
|
|
6127
6127
|
if (n.isCompiled) return a;
|
|
6128
6128
|
[
|
|
6129
|
-
|
|
6130
|
-
|
|
6129
|
+
re,
|
|
6130
|
+
oe,
|
|
6131
6131
|
xe,
|
|
6132
|
-
|
|
6132
|
+
ce
|
|
6133
6133
|
].forEach((e) => e(n, r)), e.compilerExtensions.forEach((e) => e(n, r)), n.__beforeBegin = null, [
|
|
6134
|
-
re,
|
|
6135
6134
|
ie,
|
|
6136
|
-
|
|
6135
|
+
ae,
|
|
6136
|
+
se
|
|
6137
6137
|
].forEach((e) => e(n, r)), n.isCompiled = !0;
|
|
6138
6138
|
let s = null;
|
|
6139
|
-
return typeof n.keywords == "object" && n.keywords.$pattern && (n.keywords = Object.assign({}, n.keywords), s = n.keywords.$pattern, delete n.keywords.$pattern), s ||= /\w+/, n.keywords &&=
|
|
6139
|
+
return typeof n.keywords == "object" && n.keywords.$pattern && (n.keywords = Object.assign({}, n.keywords), s = n.keywords.$pattern, delete n.keywords.$pattern), s ||= /\w+/, n.keywords &&= de(n.keywords, e.case_insensitive), a.keywordPatternRe = t(s, !0), r && (n.begin ||= /\B|\b/, a.beginRe = t(a.begin), !n.end && !n.endsWithParent && (n.end = /\B|\b/), n.end && (a.endRe = t(a.end)), a.terminatorEnd = p(a.end) || "", n.endsWithParent && r.terminatorEnd && (a.terminatorEnd += (n.end ? "|" : "") + r.terminatorEnd)), n.illegal && (a.illegalRe = t(n.illegal)), n.contains ||= [], n.contains = [].concat(...n.contains.map(function(e) {
|
|
6140
6140
|
return we(e === "self" ? n : e);
|
|
6141
6141
|
})), n.contains.forEach(function(e) {
|
|
6142
6142
|
o(e, a);
|
|
@@ -6192,9 +6192,9 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
6192
6192
|
code: r,
|
|
6193
6193
|
language: i
|
|
6194
6194
|
};
|
|
6195
|
-
|
|
6195
|
+
R("before:highlight", a);
|
|
6196
6196
|
let o = a.result ? a.result : v(a.language, a.code, n);
|
|
6197
|
-
return o.code = a.code,
|
|
6197
|
+
return o.code = a.code, R("after:highlight", o), o;
|
|
6198
6198
|
}
|
|
6199
6199
|
function v(e, n, i, a) {
|
|
6200
6200
|
let c = Object.create(null);
|
|
@@ -6271,7 +6271,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
6271
6271
|
if (e.endsWithParent) return _(e.parent, t, n);
|
|
6272
6272
|
}
|
|
6273
6273
|
function y(e) {
|
|
6274
|
-
return A.matcher.regexIndex === 0 ? (P += e[0], 1) : (
|
|
6274
|
+
return A.matcher.regexIndex === 0 ? (P += e[0], 1) : (ee = !0, 0);
|
|
6275
6275
|
}
|
|
6276
6276
|
function b(e) {
|
|
6277
6277
|
let t = e[0], n = e.rule, i = new r(n), a = [n.__beforeBegin, n["on:begin"]];
|
|
@@ -6317,15 +6317,15 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
6317
6317
|
return P += a, a.length;
|
|
6318
6318
|
}
|
|
6319
6319
|
let D = N(e);
|
|
6320
|
-
if (!D) throw
|
|
6320
|
+
if (!D) throw B(s.replace("{}", e)), Error("Unknown language: \"" + e + "\"");
|
|
6321
6321
|
let O = Se(D), k = "", A = a || O, j = {}, M = new l.__emitter(l);
|
|
6322
6322
|
w();
|
|
6323
|
-
let P = "", F = 0, I = 0, L = 0,
|
|
6323
|
+
let P = "", F = 0, I = 0, L = 0, ee = !1;
|
|
6324
6324
|
try {
|
|
6325
6325
|
if (D.__emitTokens) D.__emitTokens(n, M);
|
|
6326
6326
|
else {
|
|
6327
6327
|
for (A.matcher.considerAll();;) {
|
|
6328
|
-
L++,
|
|
6328
|
+
L++, ee ? ee = !1 : A.matcher.considerAll(), A.matcher.lastIndex = I;
|
|
6329
6329
|
let e = A.matcher.exec(n);
|
|
6330
6330
|
if (!e) break;
|
|
6331
6331
|
let t = E(n.substring(I, e.index), e);
|
|
@@ -6399,7 +6399,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
6399
6399
|
function w(e) {
|
|
6400
6400
|
let t = null, n = d(e);
|
|
6401
6401
|
if (u(n)) return;
|
|
6402
|
-
if (
|
|
6402
|
+
if (R("before:highlightElement", {
|
|
6403
6403
|
el: e,
|
|
6404
6404
|
language: n
|
|
6405
6405
|
}), e.dataset.highlighted) {
|
|
@@ -6419,7 +6419,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
6419
6419
|
}, i.secondBest && (e.secondBest = {
|
|
6420
6420
|
language: i.secondBest.language,
|
|
6421
6421
|
relevance: i.secondBest.relevance
|
|
6422
|
-
}),
|
|
6422
|
+
}), R("after:highlightElement", {
|
|
6423
6423
|
el: e,
|
|
6424
6424
|
result: i,
|
|
6425
6425
|
text: r
|
|
@@ -6450,7 +6450,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
6450
6450
|
try {
|
|
6451
6451
|
i = r(e);
|
|
6452
6452
|
} catch (e) {
|
|
6453
|
-
if (
|
|
6453
|
+
if (B("Language definition for '{}' could not be registered.".replace("{}", n)), o) B(e);
|
|
6454
6454
|
else throw e;
|
|
6455
6455
|
i = c;
|
|
6456
6456
|
}
|
|
@@ -6485,17 +6485,17 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
6485
6485
|
function L(e) {
|
|
6486
6486
|
I(e), a.push(e);
|
|
6487
6487
|
}
|
|
6488
|
-
function
|
|
6488
|
+
function ee(e) {
|
|
6489
6489
|
let t = a.indexOf(e);
|
|
6490
6490
|
t !== -1 && a.splice(t, 1);
|
|
6491
6491
|
}
|
|
6492
|
-
function
|
|
6492
|
+
function R(e, t) {
|
|
6493
6493
|
let n = e;
|
|
6494
6494
|
a.forEach(function(e) {
|
|
6495
6495
|
e[n] && e[n](t);
|
|
6496
6496
|
});
|
|
6497
6497
|
}
|
|
6498
|
-
function
|
|
6498
|
+
function ne(e) {
|
|
6499
6499
|
return he("10.7.0", "highlightBlock will be removed entirely in v12.0"), he("10.7.0", "Please use highlightElement now."), w(e);
|
|
6500
6500
|
}
|
|
6501
6501
|
Object.assign(e, {
|
|
@@ -6503,7 +6503,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
6503
6503
|
highlightAuto: S,
|
|
6504
6504
|
highlightAll: k,
|
|
6505
6505
|
highlightElement: w,
|
|
6506
|
-
highlightBlock:
|
|
6506
|
+
highlightBlock: ne,
|
|
6507
6507
|
configure: T,
|
|
6508
6508
|
initHighlighting: E,
|
|
6509
6509
|
initHighlightingOnLoad: D,
|
|
@@ -6515,7 +6515,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
6515
6515
|
autoDetection: F,
|
|
6516
6516
|
inherit: Oe,
|
|
6517
6517
|
addPlugin: L,
|
|
6518
|
-
removePlugin:
|
|
6518
|
+
removePlugin: ee
|
|
6519
6519
|
}), e.debugMode = function() {
|
|
6520
6520
|
o = !1;
|
|
6521
6521
|
}, e.safeMode = function() {
|
|
@@ -6527,8 +6527,8 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
6527
6527
|
optional: g,
|
|
6528
6528
|
anyNumberOfTimes: h
|
|
6529
6529
|
};
|
|
6530
|
-
for (let e in
|
|
6531
|
-
return Object.assign(e,
|
|
6530
|
+
for (let e in te) typeof te[e] == "object" && n(te[e]);
|
|
6531
|
+
return Object.assign(e, te), e;
|
|
6532
6532
|
}, Me = je({});
|
|
6533
6533
|
Me.newInstance = () => je({}), t.exports = Me, Me.HighlightJS = Me, Me.default = Me;
|
|
6534
6534
|
})), td = /* @__PURE__ */ m(((e, t) => {
|
|
@@ -8869,7 +8869,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
8869
8869
|
keywords: "prototype",
|
|
8870
8870
|
className: "property",
|
|
8871
8871
|
relevance: 0
|
|
8872
|
-
},
|
|
8872
|
+
}, ee = {
|
|
8873
8873
|
match: [
|
|
8874
8874
|
/get|set/,
|
|
8875
8875
|
/\s+/,
|
|
@@ -8881,7 +8881,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
8881
8881
|
3: "title.function"
|
|
8882
8882
|
},
|
|
8883
8883
|
contains: [{ begin: /\(\)/ }, k]
|
|
8884
|
-
},
|
|
8884
|
+
}, R = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + e.UNDERSCORE_IDENT_RE + ")\\s*=>", te = {
|
|
8885
8885
|
match: [
|
|
8886
8886
|
/const|var|let/,
|
|
8887
8887
|
/\s+/,
|
|
@@ -8889,7 +8889,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
8889
8889
|
/\s*/,
|
|
8890
8890
|
/=\s*/,
|
|
8891
8891
|
/(async\s*)?/,
|
|
8892
|
-
t.lookahead(
|
|
8892
|
+
t.lookahead(R)
|
|
8893
8893
|
],
|
|
8894
8894
|
keywords: "async",
|
|
8895
8895
|
className: {
|
|
@@ -8934,7 +8934,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
8934
8934
|
match: d + t.lookahead(":"),
|
|
8935
8935
|
relevance: 0
|
|
8936
8936
|
},
|
|
8937
|
-
|
|
8937
|
+
te,
|
|
8938
8938
|
{
|
|
8939
8939
|
begin: "(" + e.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*",
|
|
8940
8940
|
keywords: "return throw case",
|
|
@@ -8944,7 +8944,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
8944
8944
|
e.REGEXP_MODE,
|
|
8945
8945
|
{
|
|
8946
8946
|
className: "function",
|
|
8947
|
-
begin:
|
|
8947
|
+
begin: R,
|
|
8948
8948
|
returnBegin: !0,
|
|
8949
8949
|
end: "\\s*=>",
|
|
8950
8950
|
contains: [{
|
|
@@ -9029,7 +9029,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
9029
9029
|
I,
|
|
9030
9030
|
P,
|
|
9031
9031
|
A,
|
|
9032
|
-
|
|
9032
|
+
ee,
|
|
9033
9033
|
{ match: /\$[(.]/ }
|
|
9034
9034
|
]
|
|
9035
9035
|
};
|
|
@@ -11303,7 +11303,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
11303
11303
|
label: "interpol",
|
|
11304
11304
|
begin: i(/\\/, e, /\(/),
|
|
11305
11305
|
end: /\)/
|
|
11306
|
-
}),
|
|
11306
|
+
}), ee = (e = "") => ({
|
|
11307
11307
|
begin: i(e, /"""/),
|
|
11308
11308
|
end: i(/"""/, e),
|
|
11309
11309
|
contains: [
|
|
@@ -11311,52 +11311,52 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
11311
11311
|
I(e),
|
|
11312
11312
|
L(e)
|
|
11313
11313
|
]
|
|
11314
|
-
}),
|
|
11314
|
+
}), R = (e = "") => ({
|
|
11315
11315
|
begin: i(e, /"/),
|
|
11316
11316
|
end: i(/"/, e),
|
|
11317
11317
|
contains: [F(e), L(e)]
|
|
11318
|
-
}),
|
|
11318
|
+
}), te = {
|
|
11319
11319
|
className: "string",
|
|
11320
11320
|
variants: [
|
|
11321
|
+
ee(),
|
|
11322
|
+
ee("#"),
|
|
11323
|
+
ee("##"),
|
|
11324
|
+
ee("###"),
|
|
11321
11325
|
R(),
|
|
11322
11326
|
R("#"),
|
|
11323
11327
|
R("##"),
|
|
11324
|
-
R("###")
|
|
11325
|
-
z(),
|
|
11326
|
-
z("#"),
|
|
11327
|
-
z("##"),
|
|
11328
|
-
z("###")
|
|
11328
|
+
R("###")
|
|
11329
11329
|
]
|
|
11330
|
-
},
|
|
11330
|
+
}, ne = [e.BACKSLASH_ESCAPE, {
|
|
11331
11331
|
begin: /\[/,
|
|
11332
11332
|
end: /\]/,
|
|
11333
11333
|
relevance: 0,
|
|
11334
11334
|
contains: [e.BACKSLASH_ESCAPE]
|
|
11335
|
-
}],
|
|
11335
|
+
}], re = {
|
|
11336
11336
|
begin: /\/[^\s](?=[^/\n]*\/)/,
|
|
11337
11337
|
end: /\//,
|
|
11338
|
-
contains:
|
|
11339
|
-
},
|
|
11338
|
+
contains: ne
|
|
11339
|
+
}, ie = (e) => {
|
|
11340
11340
|
let t = i(e, /\//), n = i(/\//, e);
|
|
11341
11341
|
return {
|
|
11342
11342
|
begin: t,
|
|
11343
11343
|
end: n,
|
|
11344
|
-
contains: [...
|
|
11344
|
+
contains: [...ne, {
|
|
11345
11345
|
scope: "comment",
|
|
11346
11346
|
begin: `#(?!.*${n})`,
|
|
11347
11347
|
end: /$/
|
|
11348
11348
|
}]
|
|
11349
11349
|
};
|
|
11350
|
-
},
|
|
11350
|
+
}, ae = {
|
|
11351
11351
|
scope: "regexp",
|
|
11352
11352
|
variants: [
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
|
|
11353
|
+
ie("###"),
|
|
11354
|
+
ie("##"),
|
|
11355
|
+
ie("#"),
|
|
11356
|
+
re
|
|
11357
11357
|
]
|
|
11358
|
-
},
|
|
11359
|
-
|
|
11358
|
+
}, oe = { match: i(/`/, x, /`/) }, se = [
|
|
11359
|
+
oe,
|
|
11360
11360
|
{
|
|
11361
11361
|
className: "variable",
|
|
11362
11362
|
match: /\$\d+/
|
|
@@ -11365,7 +11365,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
11365
11365
|
className: "variable",
|
|
11366
11366
|
match: `\\$${b}+`
|
|
11367
11367
|
}
|
|
11368
|
-
],
|
|
11368
|
+
], ce = [
|
|
11369
11369
|
{
|
|
11370
11370
|
match: /(@|#(un)?)available/,
|
|
11371
11371
|
scope: "keyword",
|
|
@@ -11376,7 +11376,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
11376
11376
|
contains: [
|
|
11377
11377
|
...j,
|
|
11378
11378
|
P,
|
|
11379
|
-
|
|
11379
|
+
te
|
|
11380
11380
|
]
|
|
11381
11381
|
}] }
|
|
11382
11382
|
},
|
|
@@ -11388,7 +11388,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
11388
11388
|
scope: "meta",
|
|
11389
11389
|
match: i(/@/, x)
|
|
11390
11390
|
}
|
|
11391
|
-
],
|
|
11391
|
+
], le = {
|
|
11392
11392
|
match: r(/\b[A-Z]/),
|
|
11393
11393
|
relevance: 0,
|
|
11394
11394
|
contains: [
|
|
@@ -11414,20 +11414,20 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
11414
11414
|
relevance: 0
|
|
11415
11415
|
}
|
|
11416
11416
|
]
|
|
11417
|
-
},
|
|
11417
|
+
}, ue = {
|
|
11418
11418
|
begin: /</,
|
|
11419
11419
|
end: />/,
|
|
11420
11420
|
keywords: D,
|
|
11421
11421
|
contains: [
|
|
11422
11422
|
...a,
|
|
11423
11423
|
...O,
|
|
11424
|
-
...
|
|
11424
|
+
...ce,
|
|
11425
11425
|
A,
|
|
11426
|
-
|
|
11426
|
+
le
|
|
11427
11427
|
]
|
|
11428
11428
|
};
|
|
11429
|
-
|
|
11430
|
-
let
|
|
11429
|
+
le.contains.push(ue);
|
|
11430
|
+
let de = {
|
|
11431
11431
|
begin: /\(/,
|
|
11432
11432
|
end: /\)/,
|
|
11433
11433
|
relevance: 0,
|
|
@@ -11440,22 +11440,22 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
11440
11440
|
relevance: 0
|
|
11441
11441
|
},
|
|
11442
11442
|
...a,
|
|
11443
|
-
|
|
11443
|
+
ae,
|
|
11444
11444
|
...O,
|
|
11445
11445
|
...k,
|
|
11446
11446
|
...j,
|
|
11447
11447
|
P,
|
|
11448
|
-
|
|
11449
|
-
...oe,
|
|
11448
|
+
te,
|
|
11450
11449
|
...se,
|
|
11451
|
-
ce
|
|
11450
|
+
...ce,
|
|
11451
|
+
le
|
|
11452
11452
|
]
|
|
11453
|
-
},
|
|
11453
|
+
}, z = {
|
|
11454
11454
|
begin: /</,
|
|
11455
11455
|
end: />/,
|
|
11456
11456
|
keywords: "repeat each",
|
|
11457
|
-
contains: [...a,
|
|
11458
|
-
},
|
|
11457
|
+
contains: [...a, le]
|
|
11458
|
+
}, fe = {
|
|
11459
11459
|
begin: /\(/,
|
|
11460
11460
|
end: /\)/,
|
|
11461
11461
|
keywords: D,
|
|
@@ -11476,35 +11476,35 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
11476
11476
|
...O,
|
|
11477
11477
|
...j,
|
|
11478
11478
|
P,
|
|
11479
|
-
|
|
11480
|
-
...
|
|
11481
|
-
|
|
11482
|
-
|
|
11479
|
+
te,
|
|
11480
|
+
...ce,
|
|
11481
|
+
le,
|
|
11482
|
+
de
|
|
11483
11483
|
],
|
|
11484
11484
|
endsParent: !0,
|
|
11485
11485
|
illegal: /["']/
|
|
11486
|
-
},
|
|
11486
|
+
}, pe = {
|
|
11487
11487
|
match: [
|
|
11488
11488
|
/(func|macro)/,
|
|
11489
11489
|
/\s+/,
|
|
11490
|
-
o(
|
|
11490
|
+
o(oe.match, x, v)
|
|
11491
11491
|
],
|
|
11492
11492
|
className: {
|
|
11493
11493
|
1: "keyword",
|
|
11494
11494
|
3: "title.function"
|
|
11495
11495
|
},
|
|
11496
11496
|
contains: [
|
|
11497
|
-
|
|
11498
|
-
|
|
11497
|
+
z,
|
|
11498
|
+
fe,
|
|
11499
11499
|
t
|
|
11500
11500
|
],
|
|
11501
11501
|
illegal: [/\[/, /%/]
|
|
11502
|
-
},
|
|
11502
|
+
}, B = {
|
|
11503
11503
|
match: [/\b(?:subscript|init[?!]?)/, /\s*(?=[<(])/],
|
|
11504
11504
|
className: { 1: "keyword" },
|
|
11505
11505
|
contains: [
|
|
11506
|
-
|
|
11507
|
-
|
|
11506
|
+
z,
|
|
11507
|
+
fe,
|
|
11508
11508
|
t
|
|
11509
11509
|
],
|
|
11510
11510
|
illegal: /\[|%/
|
|
@@ -11528,7 +11528,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
11528
11528
|
1: "keyword",
|
|
11529
11529
|
3: "title"
|
|
11530
11530
|
},
|
|
11531
|
-
contains: [
|
|
11531
|
+
contains: [le],
|
|
11532
11532
|
keywords: [...p, ...f],
|
|
11533
11533
|
end: /}/
|
|
11534
11534
|
}, ge = {
|
|
@@ -11567,7 +11567,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
11567
11567
|
},
|
|
11568
11568
|
keywords: D,
|
|
11569
11569
|
contains: [
|
|
11570
|
-
|
|
11570
|
+
z,
|
|
11571
11571
|
...O,
|
|
11572
11572
|
{
|
|
11573
11573
|
begin: /:/,
|
|
@@ -11581,7 +11581,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
11581
11581
|
}
|
|
11582
11582
|
]
|
|
11583
11583
|
};
|
|
11584
|
-
for (let e of
|
|
11584
|
+
for (let e of te.variants) {
|
|
11585
11585
|
let t = e.contains.find((e) => e.label === "interpol");
|
|
11586
11586
|
t.keywords = D;
|
|
11587
11587
|
let n = [
|
|
@@ -11589,8 +11589,8 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
11589
11589
|
...k,
|
|
11590
11590
|
...j,
|
|
11591
11591
|
P,
|
|
11592
|
-
|
|
11593
|
-
...
|
|
11592
|
+
te,
|
|
11593
|
+
...se
|
|
11594
11594
|
];
|
|
11595
11595
|
t.contains = [...n, {
|
|
11596
11596
|
begin: /\(/,
|
|
@@ -11603,8 +11603,8 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
11603
11603
|
keywords: D,
|
|
11604
11604
|
contains: [
|
|
11605
11605
|
...a,
|
|
11606
|
-
fe,
|
|
11607
11606
|
pe,
|
|
11607
|
+
B,
|
|
11608
11608
|
ge,
|
|
11609
11609
|
_e,
|
|
11610
11610
|
ve,
|
|
@@ -11616,16 +11616,16 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
11616
11616
|
contains: [...a],
|
|
11617
11617
|
relevance: 0
|
|
11618
11618
|
},
|
|
11619
|
-
|
|
11619
|
+
ae,
|
|
11620
11620
|
...O,
|
|
11621
11621
|
...k,
|
|
11622
11622
|
...j,
|
|
11623
11623
|
P,
|
|
11624
|
-
|
|
11625
|
-
...oe,
|
|
11624
|
+
te,
|
|
11626
11625
|
...se,
|
|
11627
|
-
ce,
|
|
11628
|
-
|
|
11626
|
+
...ce,
|
|
11627
|
+
le,
|
|
11628
|
+
de
|
|
11629
11629
|
]
|
|
11630
11630
|
};
|
|
11631
11631
|
}
|
|
@@ -12042,7 +12042,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
12042
12042
|
keywords: "prototype",
|
|
12043
12043
|
className: "property",
|
|
12044
12044
|
relevance: 0
|
|
12045
|
-
},
|
|
12045
|
+
}, ee = {
|
|
12046
12046
|
match: [
|
|
12047
12047
|
/get|set/,
|
|
12048
12048
|
/\s+/,
|
|
@@ -12054,7 +12054,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
12054
12054
|
3: "title.function"
|
|
12055
12055
|
},
|
|
12056
12056
|
contains: [{ begin: /\(\)/ }, k]
|
|
12057
|
-
},
|
|
12057
|
+
}, R = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + e.UNDERSCORE_IDENT_RE + ")\\s*=>", te = {
|
|
12058
12058
|
match: [
|
|
12059
12059
|
/const|var|let/,
|
|
12060
12060
|
/\s+/,
|
|
@@ -12062,7 +12062,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
12062
12062
|
/\s*/,
|
|
12063
12063
|
/=\s*/,
|
|
12064
12064
|
/(async\s*)?/,
|
|
12065
|
-
t.lookahead(
|
|
12065
|
+
t.lookahead(R)
|
|
12066
12066
|
],
|
|
12067
12067
|
keywords: "async",
|
|
12068
12068
|
className: {
|
|
@@ -12107,7 +12107,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
12107
12107
|
match: d + t.lookahead(":"),
|
|
12108
12108
|
relevance: 0
|
|
12109
12109
|
},
|
|
12110
|
-
|
|
12110
|
+
te,
|
|
12111
12111
|
{
|
|
12112
12112
|
begin: "(" + e.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*",
|
|
12113
12113
|
keywords: "return throw case",
|
|
@@ -12117,7 +12117,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
12117
12117
|
e.REGEXP_MODE,
|
|
12118
12118
|
{
|
|
12119
12119
|
className: "function",
|
|
12120
|
-
begin:
|
|
12120
|
+
begin: R,
|
|
12121
12121
|
returnBegin: !0,
|
|
12122
12122
|
end: "\\s*=>",
|
|
12123
12123
|
contains: [{
|
|
@@ -12202,7 +12202,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
|
|
|
12202
12202
|
I,
|
|
12203
12203
|
P,
|
|
12204
12204
|
A,
|
|
12205
|
-
|
|
12205
|
+
ee,
|
|
12206
12206
|
{ match: /\$[(.]/ }
|
|
12207
12207
|
]
|
|
12208
12208
|
};
|
|
@@ -13186,17 +13186,23 @@ app.mount('#app');
|
|
|
13186
13186
|
}, Eh = { class: "approval-actions" }, Dh = ["onClick"], Oh = { class: "approval-head" }, kh = { class: "approval-title" }, Ah = {
|
|
13187
13187
|
key: 0,
|
|
13188
13188
|
class: "approval-args"
|
|
13189
|
-
}, jh = { class: "approval-actions" }, Mh = {
|
|
13189
|
+
}, jh = { class: "approval-actions" }, Mh = {
|
|
13190
|
+
key: 1,
|
|
13191
|
+
class: "conflict-bar"
|
|
13192
|
+
}, Nh = { class: "conflict-head" }, Ph = { class: "conflict-title" }, Fh = { class: "conflict-detail" }, Ih = {
|
|
13193
|
+
key: 0,
|
|
13194
|
+
class: "conflict-diff"
|
|
13195
|
+
}, Lh = { class: "conflict-diff-col" }, Rh = { class: "conflict-diff-pre" }, zh = { class: "conflict-diff-col" }, Bh = { class: "conflict-diff-pre" }, Vh = { class: "conflict-actions" }, Hh = { class: "chat-footer" }, Uh = {
|
|
13190
13196
|
key: 0,
|
|
13191
13197
|
class: "cap-badge",
|
|
13192
13198
|
title: "能力概览(MCP / 工具数)"
|
|
13193
|
-
},
|
|
13199
|
+
}, Wh = ["placeholder"], Gh = ["disabled", "title"], Kh = {
|
|
13194
13200
|
key: 0,
|
|
13195
13201
|
width: "16",
|
|
13196
13202
|
height: "16",
|
|
13197
13203
|
viewBox: "0 0 24 24",
|
|
13198
13204
|
fill: "currentColor"
|
|
13199
|
-
},
|
|
13205
|
+
}, qh = {
|
|
13200
13206
|
key: 1,
|
|
13201
13207
|
width: "18",
|
|
13202
13208
|
height: "18",
|
|
@@ -13204,7 +13210,7 @@ app.mount('#app');
|
|
|
13204
13210
|
fill: "none",
|
|
13205
13211
|
stroke: "currentColor",
|
|
13206
13212
|
"stroke-width": "2"
|
|
13207
|
-
},
|
|
13213
|
+
}, Jh = /*#__PURE__*/ Zd(/* @__PURE__ */ wi({
|
|
13208
13214
|
__name: "ChatDialog",
|
|
13209
13215
|
props: {
|
|
13210
13216
|
fetchResponse: {},
|
|
@@ -13225,7 +13231,9 @@ app.mount('#app');
|
|
|
13225
13231
|
showTyping: {
|
|
13226
13232
|
type: Boolean,
|
|
13227
13233
|
default: !0
|
|
13228
|
-
}
|
|
13234
|
+
},
|
|
13235
|
+
pendingConflict: {},
|
|
13236
|
+
onResolveConflict: {}
|
|
13229
13237
|
},
|
|
13230
13238
|
setup(e) {
|
|
13231
13239
|
let t = e, { state: n, scrollContainer: r, pendingApproval: i, sendMessage: a, clearMessages: o, stop: s, retry: c, regenerate: l, resolveApproval: u, onScroll: d, onWheel: f } = xl({
|
|
@@ -13243,25 +13251,47 @@ app.mount('#app');
|
|
|
13243
13251
|
} catch {
|
|
13244
13252
|
return String(e);
|
|
13245
13253
|
}
|
|
13246
|
-
}), m = zs(() =>
|
|
13254
|
+
}), m = zs(() => {
|
|
13255
|
+
let e = t.pendingConflict?.agentValue;
|
|
13256
|
+
if (e === void 0) return "";
|
|
13257
|
+
try {
|
|
13258
|
+
let t = JSON.stringify(e, null, 2);
|
|
13259
|
+
return t.length > 400 ? t.slice(0, 400) + "\n…(已截断)" : t;
|
|
13260
|
+
} catch {
|
|
13261
|
+
return String(e);
|
|
13262
|
+
}
|
|
13263
|
+
}), h = zs(() => {
|
|
13264
|
+
let e = t.pendingConflict?.currentValue;
|
|
13265
|
+
if (e == null) return "";
|
|
13266
|
+
try {
|
|
13267
|
+
let t = JSON.stringify(e, null, 2);
|
|
13268
|
+
return t.length > 400 ? t.slice(0, 400) + "\n…(已截断)" : t;
|
|
13269
|
+
} catch {
|
|
13270
|
+
return String(e);
|
|
13271
|
+
}
|
|
13272
|
+
}), g = /* @__PURE__ */ fn(!1);
|
|
13273
|
+
Gr(() => t.pendingConflict, () => {
|
|
13274
|
+
g.value = !1;
|
|
13275
|
+
});
|
|
13276
|
+
let _ = zs(() => i.value?.toolName === "request_human_confirmation"), v = zs(() => {
|
|
13247
13277
|
let e = i.value?.args?.options;
|
|
13248
13278
|
return Array.isArray(e) ? e.map(String) : [];
|
|
13249
|
-
}),
|
|
13279
|
+
}), y = /* @__PURE__ */ fn(!1);
|
|
13250
13280
|
Gr(i, () => {
|
|
13251
|
-
|
|
13281
|
+
y.value = !1;
|
|
13252
13282
|
});
|
|
13253
|
-
let
|
|
13254
|
-
function
|
|
13283
|
+
let b = zs(() => typeof t.canUndo == "function" && !!t.canUndo());
|
|
13284
|
+
function x() {
|
|
13255
13285
|
t.onUndo?.() && (n.error = null);
|
|
13256
13286
|
}
|
|
13257
|
-
let
|
|
13258
|
-
function
|
|
13259
|
-
|
|
13287
|
+
let S = /* @__PURE__ */ fn(""), C = /* @__PURE__ */ fn(!0), w = /* @__PURE__ */ fn(!1), T = /* @__PURE__ */ fn({}), E = zs(() => n.messages.length > 0), D = zs(() => n.messages.some((e) => e.role === "user")), O = zs(() => (t.debugLogs?.length ?? 0) > 0);
|
|
13288
|
+
function k(e) {
|
|
13289
|
+
T.value[e] = !T.value[e];
|
|
13260
13290
|
}
|
|
13261
|
-
function
|
|
13291
|
+
function A(e) {
|
|
13262
13292
|
return e.status === "running" ? "⏳" : e.status === "error" ? "❌" : "✅";
|
|
13263
13293
|
}
|
|
13264
|
-
function
|
|
13294
|
+
function j(e) {
|
|
13265
13295
|
let t = [];
|
|
13266
13296
|
for (let n of e) {
|
|
13267
13297
|
let e = t.length ? t[t.length - 1] : null;
|
|
@@ -13280,46 +13310,46 @@ app.mount('#app');
|
|
|
13280
13310
|
children: e.children
|
|
13281
13311
|
}));
|
|
13282
13312
|
}
|
|
13283
|
-
function
|
|
13313
|
+
function M(e) {
|
|
13284
13314
|
return e === "running" ? "⏳" : e === "error" ? "❌" : "✅";
|
|
13285
13315
|
}
|
|
13286
|
-
function
|
|
13316
|
+
function N(e) {
|
|
13287
13317
|
let t = n.messages[e];
|
|
13288
13318
|
return !!t && t.role === "assistant" && n.loading && e === n.messages.length - 1 && !t.content && !t.reasoning;
|
|
13289
13319
|
}
|
|
13290
|
-
function
|
|
13291
|
-
|
|
13320
|
+
function P() {
|
|
13321
|
+
S.value.trim() && (a(S.value), S.value = "");
|
|
13292
13322
|
}
|
|
13293
|
-
function
|
|
13294
|
-
e.key === "Enter" && !e.shiftKey && (e.preventDefault(),
|
|
13323
|
+
function F(e) {
|
|
13324
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), P());
|
|
13295
13325
|
}
|
|
13296
|
-
function
|
|
13326
|
+
function I(e) {
|
|
13297
13327
|
return new Date(e).toLocaleTimeString("zh-CN", {
|
|
13298
13328
|
hour: "2-digit",
|
|
13299
13329
|
minute: "2-digit"
|
|
13300
13330
|
});
|
|
13301
13331
|
}
|
|
13302
|
-
let
|
|
13332
|
+
let L = zs(() => {
|
|
13303
13333
|
let e = t.getInfo?.();
|
|
13304
13334
|
return {
|
|
13305
13335
|
mcp: e?.mcp?.servers?.length ?? 0,
|
|
13306
13336
|
tools: e?.tools?.length ?? 0
|
|
13307
13337
|
};
|
|
13308
13338
|
});
|
|
13309
|
-
function
|
|
13339
|
+
function ee(e) {
|
|
13310
13340
|
navigator.clipboard.writeText(e);
|
|
13311
13341
|
}
|
|
13312
|
-
return (a,
|
|
13342
|
+
return (a, R) => (q(), J("div", { class: Se(["chat-dialog", { collapsed: !C.value }]) }, [
|
|
13313
13343
|
Y("div", Lm, [Y("div", Rm, [
|
|
13314
|
-
|
|
13344
|
+
R[19] ||= Y("span", { class: "header-icon" }, "🤖", -1),
|
|
13315
13345
|
Y("span", zm, V(e.title), 1),
|
|
13316
13346
|
W(n).loading ? (q(), J("span", Bm)) : X("", !0)
|
|
13317
13347
|
]), Y("div", Vm, [
|
|
13318
13348
|
Y("button", {
|
|
13319
|
-
class: Se(["action-btn debug-btn", { active:
|
|
13349
|
+
class: Se(["action-btn debug-btn", { active: w.value }]),
|
|
13320
13350
|
title: "日志 / 执行流程 / Agent 信息",
|
|
13321
|
-
onClick:
|
|
13322
|
-
}, [
|
|
13351
|
+
onClick: R[0] ||= (e) => w.value = !0
|
|
13352
|
+
}, [R[20] ||= Y("svg", {
|
|
13323
13353
|
width: "16",
|
|
13324
13354
|
height: "16",
|
|
13325
13355
|
viewBox: "0 0 24 24",
|
|
@@ -13330,13 +13360,13 @@ app.mount('#app');
|
|
|
13330
13360
|
Y("path", { d: "M9 2v8l-3 3v2h12v-2l-3-3V2" }),
|
|
13331
13361
|
Y("path", { d: "M9 2h6" }),
|
|
13332
13362
|
Y("path", { d: "M9 18h6" })
|
|
13333
|
-
], -1),
|
|
13363
|
+
], -1), O.value ? (q(), J("span", Hm, V(e.debugLogs?.length), 1)) : X("", !0)], 2),
|
|
13334
13364
|
Y("button", {
|
|
13335
13365
|
class: "action-btn",
|
|
13336
13366
|
title: "清空对话",
|
|
13337
|
-
onClick:
|
|
13338
|
-
disabled: !
|
|
13339
|
-
}, [...
|
|
13367
|
+
onClick: R[1] ||= (...e) => W(o) && W(o)(...e),
|
|
13368
|
+
disabled: !E.value
|
|
13369
|
+
}, [...R[21] ||= [Y("svg", {
|
|
13340
13370
|
width: "16",
|
|
13341
13371
|
height: "16",
|
|
13342
13372
|
viewBox: "0 0 24 24",
|
|
@@ -13346,17 +13376,17 @@ app.mount('#app');
|
|
|
13346
13376
|
}, [Y("polyline", { points: "3 6 5 6 21 6" }), Y("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })], -1)]], 8, Um),
|
|
13347
13377
|
Y("button", {
|
|
13348
13378
|
class: "action-btn",
|
|
13349
|
-
onClick:
|
|
13350
|
-
}, [(q(), J("svg", Wm, [
|
|
13379
|
+
onClick: R[2] ||= (e) => C.value = !C.value
|
|
13380
|
+
}, [(q(), J("svg", Wm, [C.value ? (q(), J("path", Gm)) : (q(), J("path", Km))]))])
|
|
13351
13381
|
])]),
|
|
13352
13382
|
zr(Y("div", {
|
|
13353
13383
|
class: "chat-body",
|
|
13354
13384
|
ref_key: "scrollContainer",
|
|
13355
13385
|
ref: r,
|
|
13356
|
-
onScroll:
|
|
13357
|
-
onWheel:
|
|
13386
|
+
onScroll: R[5] ||= (...e) => W(d) && W(d)(...e),
|
|
13387
|
+
onWheel: R[6] ||= (...e) => W(f) && W(f)(...e)
|
|
13358
13388
|
}, [
|
|
13359
|
-
|
|
13389
|
+
E.value ? X("", !0) : (q(), J("div", qm, [...R[22] ||= [Y("div", { class: "empty-icon" }, "💬", -1), Y("p", null, "有什么可以帮你的?", -1)]])),
|
|
13360
13390
|
(q(!0), J(K, null, Xi(W(n).messages, (t, r) => (q(), J("div", {
|
|
13361
13391
|
key: r,
|
|
13362
13392
|
class: Se(["message-row", t.role]),
|
|
@@ -13364,143 +13394,173 @@ app.mount('#app');
|
|
|
13364
13394
|
}, [e.showAvatar ? (q(), J("div", Ym, V(t.role === "user" ? "👤" : "🤖"), 1)) : X("", !0), Y("div", Xm, [
|
|
13365
13395
|
t.role === "assistant" && t.reasoning ? (q(), J("div", {
|
|
13366
13396
|
key: 0,
|
|
13367
|
-
class: Se(["reasoning-block", { expanded:
|
|
13397
|
+
class: Se(["reasoning-block", { expanded: T.value[r] }])
|
|
13368
13398
|
}, [Y("div", {
|
|
13369
13399
|
class: "reasoning-header",
|
|
13370
|
-
onClick: (e) =>
|
|
13400
|
+
onClick: (e) => k(r)
|
|
13371
13401
|
}, [
|
|
13372
|
-
|
|
13373
|
-
|
|
13374
|
-
Y("span", Qm, V(
|
|
13375
|
-
], 8, Zm),
|
|
13376
|
-
t.role === "assistant" && t.steps && t.steps.length ? (q(), J("div", eh, [(q(!0), J(K, null, Xi(
|
|
13402
|
+
R[23] ||= Y("span", { class: "reasoning-icon" }, "🧠", -1),
|
|
13403
|
+
R[24] ||= Y("span", { class: "reasoning-title" }, "思考过程", -1),
|
|
13404
|
+
Y("span", Qm, V(T.value[r] ? "▾" : "▸"), 1)
|
|
13405
|
+
], 8, Zm), T.value[r] ? (q(), J("div", $m, V(t.reasoning), 1)) : X("", !0)], 2)) : X("", !0),
|
|
13406
|
+
t.role === "assistant" && t.steps && t.steps.length ? (q(), J("div", eh, [(q(!0), J(K, null, Xi(j(t.steps), (e, t) => (q(), J("div", {
|
|
13377
13407
|
key: t,
|
|
13378
13408
|
class: "step-item"
|
|
13379
13409
|
}, [Y("div", th, [
|
|
13380
|
-
Y("span", nh, V(
|
|
13410
|
+
Y("span", nh, V(M(e.status)), 1),
|
|
13381
13411
|
Y("span", rh, V(e.name), 1),
|
|
13382
13412
|
e.count > 1 ? (q(), J("span", ih, "×" + V(e.count), 1)) : X("", !0),
|
|
13383
13413
|
e.status === "running" ? (q(), J("span", ah, "执行中…")) : X("", !0)
|
|
13384
|
-
]), e.children && e.children.length ? (q(), J("div", oh, [
|
|
13414
|
+
]), e.children && e.children.length ? (q(), J("div", oh, [R[25] ||= Y("div", { class: "step-children-label" }, "🧬 子 agent 进度", -1), (q(!0), J(K, null, Xi(e.children, (e, t) => (q(), J("div", {
|
|
13385
13415
|
key: t,
|
|
13386
13416
|
class: "step-child"
|
|
13387
13417
|
}, [
|
|
13388
|
-
Y("span", sh, V(
|
|
13418
|
+
Y("span", sh, V(A(e)), 1),
|
|
13389
13419
|
Y("span", ch, V(e.name), 1),
|
|
13390
13420
|
e.status === "running" ? (q(), J("span", lh, "…")) : X("", !0)
|
|
13391
13421
|
]))), 128))])) : X("", !0)]))), 128))])) : X("", !0),
|
|
13392
|
-
Y("div", { class: Se(["message-bubble", { typing:
|
|
13393
|
-
|
|
13394
|
-
|
|
13395
|
-
|
|
13422
|
+
Y("div", { class: Se(["message-bubble", { typing: N(r) }]) }, [N(r) ? (q(), J(K, { key: 0 }, [e.showTyping ? (q(), J(K, { key: 0 }, [
|
|
13423
|
+
R[26] ||= Y("span", { class: "dot" }, null, -1),
|
|
13424
|
+
R[27] ||= Y("span", { class: "dot" }, null, -1),
|
|
13425
|
+
R[28] ||= Y("span", { class: "dot" }, null, -1)
|
|
13396
13426
|
], 64)) : (q(), J("span", uh, "思考中…"))], 64)) : (q(), J(K, { key: 1 }, [t.role === "assistant" ? (q(), Ko(ef, {
|
|
13397
13427
|
key: 0,
|
|
13398
13428
|
content: t.content
|
|
13399
13429
|
}, null, 8, ["content"])) : (q(), J(K, { key: 1 }, [is(V(t.content), 1)], 64))], 64))], 2),
|
|
13400
13430
|
t.role === "assistant" && W(n).loading && r === W(n).messages.length - 1 && t.content ? (q(), J("span", dh)) : X("", !0),
|
|
13401
|
-
Y("div", fh, V(
|
|
13431
|
+
Y("div", fh, V(I(t.timestamp)), 1),
|
|
13402
13432
|
t.role === "assistant" && t.content && !W(n).loading && r === W(n).messages.length - 1 ? (q(), J("div", ph, [Y("button", {
|
|
13403
13433
|
class: "msg-action-btn",
|
|
13404
13434
|
title: "复制",
|
|
13405
|
-
onClick: (e) =>
|
|
13435
|
+
onClick: (e) => ee(t.content)
|
|
13406
13436
|
}, "📋 复制", 8, mh), Y("button", {
|
|
13407
13437
|
class: "msg-action-btn",
|
|
13408
13438
|
title: "重新生成",
|
|
13409
|
-
onClick:
|
|
13439
|
+
onClick: R[3] ||= (...e) => W(l) && W(l)(...e)
|
|
13410
13440
|
}, "🔄 重新生成")])) : X("", !0)
|
|
13411
13441
|
])], 10, Jm))), 128)),
|
|
13412
13442
|
W(n).loading && W(n).messages[W(n).messages.length - 1]?.role !== "assistant" ? (q(), J("div", hh, [e.showAvatar ? (q(), J("div", gh, "🤖")) : X("", !0), Y("div", _h, [Y("div", vh, [e.showTyping ? (q(), J(K, { key: 0 }, [
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
|
|
13443
|
+
R[29] ||= Y("span", { class: "dot" }, null, -1),
|
|
13444
|
+
R[30] ||= Y("span", { class: "dot" }, null, -1),
|
|
13445
|
+
R[31] ||= Y("span", { class: "dot" }, null, -1)
|
|
13416
13446
|
], 64)) : (q(), J("span", yh, "思考中…"))])])])) : X("", !0),
|
|
13417
13447
|
W(n).error ? (q(), J("div", bh, [
|
|
13418
13448
|
Y("span", xh, V(W(n).error), 1),
|
|
13419
|
-
|
|
13449
|
+
D.value ? (q(), J("button", {
|
|
13420
13450
|
key: 0,
|
|
13421
13451
|
class: "retry-btn",
|
|
13422
|
-
onClick:
|
|
13452
|
+
onClick: R[4] ||= (...e) => W(c) && W(c)(...e)
|
|
13423
13453
|
}, "重试")) : X("", !0),
|
|
13424
|
-
|
|
13454
|
+
b.value ? (q(), J("button", {
|
|
13425
13455
|
key: 1,
|
|
13426
13456
|
class: "undo-btn",
|
|
13427
13457
|
title: "回退到上次正常状态(还原对话历史 + 页面属性 + 工作区)",
|
|
13428
|
-
onClick:
|
|
13458
|
+
onClick: x
|
|
13429
13459
|
}, "↩ 回退")) : X("", !0)
|
|
13430
13460
|
])) : X("", !0)
|
|
13431
|
-
], 544), [[xc,
|
|
13432
|
-
W(i) ? (q(), J("div", Sh, [
|
|
13433
|
-
|
|
13461
|
+
], 544), [[xc, C.value]]),
|
|
13462
|
+
W(i) ? (q(), J("div", Sh, [_.value ? (q(), J(K, { key: 0 }, [
|
|
13463
|
+
R[32] ||= Y("div", { class: "approval-head" }, [Y("span", { class: "approval-icon" }, "❓"), Y("span", { class: "approval-title" }, "AI 需要你确认")], -1),
|
|
13434
13464
|
W(i).args?.question ? (q(), J("div", Ch, V(W(i).args.question), 1)) : X("", !0),
|
|
13435
13465
|
W(i).args?.context ? (q(), J("div", wh, V(W(i).args.context), 1)) : X("", !0),
|
|
13436
13466
|
W(i).args?.recommendation ? (q(), J("div", Th, "💡 推荐:" + V(W(i).args.recommendation), 1)) : X("", !0),
|
|
13437
13467
|
Y("div", Eh, [Y("button", {
|
|
13438
13468
|
class: "approval-deny",
|
|
13439
|
-
onClick:
|
|
13440
|
-
}, "拒绝"),
|
|
13469
|
+
onClick: R[7] ||= (e) => W(u)(!1)
|
|
13470
|
+
}, "拒绝"), v.value.length ? (q(!0), J(K, { key: 0 }, Xi(v.value, (e) => (q(), J("button", {
|
|
13441
13471
|
key: e,
|
|
13442
13472
|
class: "approval-opt",
|
|
13443
13473
|
onClick: (t) => W(u)(e)
|
|
13444
13474
|
}, V(e), 9, Dh))), 128)) : (q(), J("button", {
|
|
13445
13475
|
key: 1,
|
|
13446
13476
|
class: "approval-allow",
|
|
13447
|
-
onClick:
|
|
13477
|
+
onClick: R[8] ||= (e) => W(u)(!0)
|
|
13448
13478
|
}, "允许"))])
|
|
13449
13479
|
], 64)) : (q(), J(K, { key: 1 }, [
|
|
13450
13480
|
Y("div", Oh, [
|
|
13451
|
-
|
|
13452
|
-
Y("span", kh, [
|
|
13481
|
+
R[34] ||= Y("span", { class: "approval-icon" }, "✋", -1),
|
|
13482
|
+
Y("span", kh, [R[33] ||= is("需确认工具调用:", -1), Y("code", null, V(W(i).toolName), 1)]),
|
|
13453
13483
|
p.value ? (q(), J("button", {
|
|
13454
13484
|
key: 0,
|
|
13455
13485
|
class: "approval-toggle",
|
|
13456
|
-
onClick:
|
|
13457
|
-
}, V(
|
|
13486
|
+
onClick: R[9] ||= (e) => y.value = !y.value
|
|
13487
|
+
}, V(y.value ? "收起参数" : "查看参数") + V(y.value ? " ▴" : " ▾"), 1)) : X("", !0)
|
|
13458
13488
|
]),
|
|
13459
|
-
p.value &&
|
|
13489
|
+
p.value && y.value ? (q(), J("pre", Ah, V(p.value), 1)) : X("", !0),
|
|
13460
13490
|
Y("div", jh, [Y("button", {
|
|
13461
13491
|
class: "approval-deny",
|
|
13462
|
-
onClick:
|
|
13492
|
+
onClick: R[10] ||= (e) => W(u)(!1)
|
|
13463
13493
|
}, "拒绝"), Y("button", {
|
|
13464
13494
|
class: "approval-allow",
|
|
13465
|
-
onClick:
|
|
13495
|
+
onClick: R[11] ||= (e) => W(u)(!0)
|
|
13466
13496
|
}, "允许")])
|
|
13467
13497
|
], 64))])) : X("", !0),
|
|
13468
|
-
|
|
13469
|
-
|
|
13470
|
-
|
|
13498
|
+
t.pendingConflict ? (q(), J("div", Mh, [
|
|
13499
|
+
Y("div", Nh, [R[37] ||= Y("span", { class: "conflict-icon" }, "⚠️", -1), Y("span", Ph, [
|
|
13500
|
+
R[35] ||= is("写入冲突:", -1),
|
|
13501
|
+
Y("code", null, V(t.pendingConflict.path), 1),
|
|
13502
|
+
R[36] ||= is(" 已被外部修改", -1)
|
|
13503
|
+
])]),
|
|
13504
|
+
Y("div", Fh, " AI 基于「读取时的旧值」准备" + V(t.pendingConflict.op === "delete" ? "删除" : "写入") + ",但该属性在你读取之后被外部代码/其他 agent/手动改过。 ", 1),
|
|
13505
|
+
Y("button", {
|
|
13506
|
+
class: "conflict-toggle",
|
|
13507
|
+
onClick: R[12] ||= (e) => g.value = !g.value
|
|
13508
|
+
}, V(g.value ? "收起对比" : "查看值对比") + V(g.value ? " ▴" : " ▾"), 1),
|
|
13509
|
+
g.value ? (q(), J("div", Ih, [Y("div", Lh, [R[38] ||= Y("div", { class: "conflict-diff-label" }, "AI 想写的值", -1), Y("pre", Rh, V(m.value || "(delete 操作无值)"), 1)]), Y("div", zh, [R[39] ||= Y("div", { class: "conflict-diff-label" }, "外部改后的当前值", -1), Y("pre", Bh, V(h.value), 1)])])) : X("", !0),
|
|
13510
|
+
Y("div", Vh, [
|
|
13511
|
+
Y("button", {
|
|
13512
|
+
class: "conflict-keep",
|
|
13513
|
+
onClick: R[13] ||= (e) => t.onResolveConflict?.("keep_external"),
|
|
13514
|
+
title: "不写入,保留外部修改后的值,AI 重新读取再改"
|
|
13515
|
+
}, "保留外部"),
|
|
13516
|
+
Y("button", {
|
|
13517
|
+
class: "conflict-overwrite",
|
|
13518
|
+
onClick: R[14] ||= (e) => t.onResolveConflict?.("overwrite"),
|
|
13519
|
+
title: "用 AI 的值覆盖外部修改"
|
|
13520
|
+
}, "强制覆盖"),
|
|
13521
|
+
Y("button", {
|
|
13522
|
+
class: "conflict-restore",
|
|
13523
|
+
onClick: R[15] ||= (e) => t.onResolveConflict?.("restore"),
|
|
13524
|
+
title: "回退到最近一次历史快照(agent 之前操作的检查点),撤销外部修改 + AI 不写入"
|
|
13525
|
+
}, "回退")
|
|
13526
|
+
])
|
|
13527
|
+
])) : X("", !0),
|
|
13528
|
+
zr(Y("div", Hh, [
|
|
13529
|
+
t.getInfo ? (q(), J("span", Uh, " 🔌" + V(L.value.mcp) + " · 🔧" + V(L.value.tools), 1)) : X("", !0),
|
|
13530
|
+
b.value ? (q(), J("button", {
|
|
13471
13531
|
key: 1,
|
|
13472
13532
|
class: "undo-foot-btn",
|
|
13473
13533
|
title: "回退到上次正常状态(还原对话历史 + 页面属性 + 工作区)",
|
|
13474
|
-
onClick:
|
|
13534
|
+
onClick: x
|
|
13475
13535
|
}, "↩ 回退")) : X("", !0),
|
|
13476
13536
|
zr(Y("textarea", {
|
|
13477
|
-
"onUpdate:modelValue":
|
|
13537
|
+
"onUpdate:modelValue": R[16] ||= (e) => S.value = e,
|
|
13478
13538
|
class: "chat-input",
|
|
13479
13539
|
placeholder: e.placeholder,
|
|
13480
13540
|
rows: "1",
|
|
13481
|
-
onKeydown:
|
|
13482
|
-
}, null, 40,
|
|
13541
|
+
onKeydown: F
|
|
13542
|
+
}, null, 40, Wh), [[rl, S.value]]),
|
|
13483
13543
|
Y("button", {
|
|
13484
13544
|
class: Se(["send-btn", { "stop-btn": W(n).loading }]),
|
|
13485
|
-
disabled: !W(n).loading && !
|
|
13545
|
+
disabled: !W(n).loading && !S.value.trim(),
|
|
13486
13546
|
title: W(n).loading ? "停止生成" : "发送",
|
|
13487
|
-
onClick:
|
|
13488
|
-
}, [W(n).loading ? (q(), J("svg",
|
|
13547
|
+
onClick: R[17] ||= (e) => W(n).loading ? W(s)() : P()
|
|
13548
|
+
}, [W(n).loading ? (q(), J("svg", Kh, [...R[40] ||= [Y("rect", {
|
|
13489
13549
|
x: "6",
|
|
13490
13550
|
y: "6",
|
|
13491
13551
|
width: "12",
|
|
13492
13552
|
height: "12",
|
|
13493
13553
|
rx: "2"
|
|
13494
|
-
}, null, -1)]])) : (q(), J("svg",
|
|
13554
|
+
}, null, -1)]])) : (q(), J("svg", qh, [...R[41] ||= [Y("line", {
|
|
13495
13555
|
x1: "22",
|
|
13496
13556
|
y1: "2",
|
|
13497
13557
|
x2: "11",
|
|
13498
13558
|
y2: "13"
|
|
13499
|
-
}, null, -1), Y("polygon", { points: "22 2 15 22 11 13 2 9 22 2" }, null, -1)]]))], 10,
|
|
13500
|
-
], 512), [[xc,
|
|
13559
|
+
}, null, -1), Y("polygon", { points: "22 2 15 22 11 13 2 9 22 2" }, null, -1)]]))], 10, Gh)
|
|
13560
|
+
], 512), [[xc, C.value]]),
|
|
13501
13561
|
$o(Im, {
|
|
13502
|
-
visible:
|
|
13503
|
-
"onUpdate:visible":
|
|
13562
|
+
visible: w.value,
|
|
13563
|
+
"onUpdate:visible": R[18] ||= (e) => w.value = e,
|
|
13504
13564
|
logs: e.debugLogs,
|
|
13505
13565
|
"get-info": t.getInfo
|
|
13506
13566
|
}, null, 8, [
|
|
@@ -13510,15 +13570,15 @@ app.mount('#app');
|
|
|
13510
13570
|
])
|
|
13511
13571
|
], 2));
|
|
13512
13572
|
}
|
|
13513
|
-
}), [["__scopeId", "data-v-
|
|
13514
|
-
function
|
|
13573
|
+
}), [["__scopeId", "data-v-fef90945"]]);
|
|
13574
|
+
function Yh(e) {
|
|
13515
13575
|
return e.replace(/^\/+/, "").replace(/\/+/g, "/");
|
|
13516
13576
|
}
|
|
13517
|
-
function
|
|
13577
|
+
function Xh(e, t) {
|
|
13518
13578
|
let n = t.threshold ?? 6e3;
|
|
13519
13579
|
if (e.length <= n) return e;
|
|
13520
13580
|
if (t.vfsAvailable && t.files) {
|
|
13521
|
-
let n = Math.random().toString(36).slice(2, 10), r = `large_results/${t.toolName}-${n}.txt`, i =
|
|
13581
|
+
let n = Math.random().toString(36).slice(2, 10), r = `large_results/${t.toolName}-${n}.txt`, i = Yh(r);
|
|
13522
13582
|
return t.files[i] = {
|
|
13523
13583
|
content: e,
|
|
13524
13584
|
updatedAt: Date.now()
|
|
@@ -13533,7 +13593,7 @@ function Bh(e, t) {
|
|
|
13533
13593
|
}
|
|
13534
13594
|
//#endregion
|
|
13535
13595
|
//#region src/core/utils/pool.ts
|
|
13536
|
-
async function
|
|
13596
|
+
async function Zh(e, t, n, r) {
|
|
13537
13597
|
let i = Array(e.length), a = Math.max(1, t);
|
|
13538
13598
|
if (a === 1) {
|
|
13539
13599
|
for (let t = 0; t < e.length && !r?.aborted; t++) i[t] = await n(e[t], t);
|
|
@@ -13550,7 +13610,7 @@ async function Vh(e, t, n, r) {
|
|
|
13550
13610
|
}
|
|
13551
13611
|
//#endregion
|
|
13552
13612
|
//#region src/core/utils/modelCaps.ts
|
|
13553
|
-
var
|
|
13613
|
+
var Qh = [
|
|
13554
13614
|
{
|
|
13555
13615
|
pattern: /deepseek-v4/i,
|
|
13556
13616
|
caps: {
|
|
@@ -13712,34 +13772,34 @@ var Hh = [
|
|
|
13712
13772
|
maxOutputTokens: 4096
|
|
13713
13773
|
}
|
|
13714
13774
|
}
|
|
13715
|
-
],
|
|
13775
|
+
], $h = {
|
|
13716
13776
|
contextWindow: 32768,
|
|
13717
13777
|
maxOutputTokens: 4096
|
|
13718
13778
|
};
|
|
13719
|
-
function
|
|
13779
|
+
function eg(e = {}) {
|
|
13720
13780
|
let t = (() => {
|
|
13721
|
-
if (e.model) return
|
|
13781
|
+
if (e.model) return Qh.find((t) => t.pattern.test(e.model))?.caps;
|
|
13722
13782
|
})();
|
|
13723
13783
|
return {
|
|
13724
|
-
contextWindow: e.contextWindow ?? t?.contextWindow ??
|
|
13725
|
-
maxOutputTokens: e.maxOutputTokens ?? t?.maxOutputTokens ??
|
|
13784
|
+
contextWindow: e.contextWindow ?? t?.contextWindow ?? $h.contextWindow,
|
|
13785
|
+
maxOutputTokens: e.maxOutputTokens ?? t?.maxOutputTokens ?? $h.maxOutputTokens
|
|
13726
13786
|
};
|
|
13727
13787
|
}
|
|
13728
|
-
function
|
|
13788
|
+
function tg(e) {
|
|
13729
13789
|
if (!e) return 0;
|
|
13730
13790
|
let t = (e.match(/[\u4e00-\u9fff]/g) || []).length, n = e.length - t;
|
|
13731
13791
|
return Math.ceil(t * 1.5 + n * .25);
|
|
13732
13792
|
}
|
|
13733
|
-
function
|
|
13793
|
+
function ng(e) {
|
|
13734
13794
|
return Math.max(2e3, Math.min(2e4, Math.round(e * .035)));
|
|
13735
13795
|
}
|
|
13736
|
-
function
|
|
13737
|
-
let t =
|
|
13796
|
+
function rg(e) {
|
|
13797
|
+
let t = ng(e);
|
|
13738
13798
|
return Math.min(2e5, Math.max(t, Math.round(e * .7)));
|
|
13739
13799
|
}
|
|
13740
13800
|
//#endregion
|
|
13741
13801
|
//#region src/core/harness/state.ts
|
|
13742
|
-
function
|
|
13802
|
+
function ig() {
|
|
13743
13803
|
return {
|
|
13744
13804
|
messages: [],
|
|
13745
13805
|
todos: [],
|
|
@@ -13752,42 +13812,42 @@ function Jh() {
|
|
|
13752
13812
|
}
|
|
13753
13813
|
//#endregion
|
|
13754
13814
|
//#region src/core/harness/middleware.ts
|
|
13755
|
-
function
|
|
13815
|
+
function ag(e, t) {
|
|
13756
13816
|
return t ? {
|
|
13757
13817
|
...e,
|
|
13758
13818
|
...t
|
|
13759
13819
|
} : e;
|
|
13760
13820
|
}
|
|
13761
|
-
async function
|
|
13821
|
+
async function og(e, t) {
|
|
13762
13822
|
let n = t;
|
|
13763
|
-
for (let t of e) t.beforeAgent && (n =
|
|
13823
|
+
for (let t of e) t.beforeAgent && (n = ag(n, await t.beforeAgent(n)));
|
|
13764
13824
|
return n;
|
|
13765
13825
|
}
|
|
13766
|
-
function
|
|
13826
|
+
function sg(e, t) {
|
|
13767
13827
|
let n = t.state;
|
|
13768
|
-
for (let r of e) r.beforeModel && (n =
|
|
13828
|
+
for (let r of e) r.beforeModel && (n = ag(n, r.beforeModel({
|
|
13769
13829
|
messages: t.messages,
|
|
13770
13830
|
state: n
|
|
13771
13831
|
})));
|
|
13772
13832
|
return n;
|
|
13773
13833
|
}
|
|
13774
|
-
function
|
|
13834
|
+
function cg(e, t, n) {
|
|
13775
13835
|
let r = n;
|
|
13776
13836
|
for (let n = e.length - 1; n >= 0; n--) {
|
|
13777
13837
|
let i = e[n];
|
|
13778
|
-
i.afterModel && (r =
|
|
13838
|
+
i.afterModel && (r = ag(r, i.afterModel(t, r)));
|
|
13779
13839
|
}
|
|
13780
13840
|
return r;
|
|
13781
13841
|
}
|
|
13782
|
-
async function
|
|
13842
|
+
async function lg(e, t) {
|
|
13783
13843
|
let n = t;
|
|
13784
13844
|
for (let t = e.length - 1; t >= 0; t--) {
|
|
13785
13845
|
let r = e[t];
|
|
13786
|
-
r.afterAgent && (n =
|
|
13846
|
+
r.afterAgent && (n = ag(n, await r.afterAgent(n)));
|
|
13787
13847
|
}
|
|
13788
13848
|
return n;
|
|
13789
13849
|
}
|
|
13790
|
-
async function
|
|
13850
|
+
async function ug(e, t) {
|
|
13791
13851
|
let n = [];
|
|
13792
13852
|
for (let r of e) {
|
|
13793
13853
|
if (!r.beforeReturn) continue;
|
|
@@ -13796,19 +13856,19 @@ async function eg(e, t) {
|
|
|
13796
13856
|
}
|
|
13797
13857
|
return n.length ? n.join("\n\n") : null;
|
|
13798
13858
|
}
|
|
13799
|
-
function
|
|
13859
|
+
function dg(e, t) {
|
|
13800
13860
|
return e.reduceRight((e, t) => (n) => t.wrapModelCall ? t.wrapModelCall(n, e) : e(n), t);
|
|
13801
13861
|
}
|
|
13802
|
-
function
|
|
13862
|
+
function fg(e, t) {
|
|
13803
13863
|
return e.reduceRight((e, t) => (n) => t.wrapToolCall ? t.wrapToolCall(n, e) : e(n), t);
|
|
13804
13864
|
}
|
|
13805
13865
|
//#endregion
|
|
13806
13866
|
//#region src/core/harness/createAgent.ts
|
|
13807
|
-
function
|
|
13867
|
+
function pg(e) {
|
|
13808
13868
|
return e ? /<|tool_calls|>|<||[^>]*tool_call|<invoke\s+name=|<\/?tool_call>|<function_call>/i.test(e) : !1;
|
|
13809
13869
|
}
|
|
13810
|
-
var
|
|
13811
|
-
function
|
|
13870
|
+
var mg = 10, hg = 300, gg = 6e3;
|
|
13871
|
+
function _g(e, t) {
|
|
13812
13872
|
let n = e.reduce((e, t) => e + (typeof t.content == "string" ? t.content.length : JSON.stringify(t.content).length), 0);
|
|
13813
13873
|
if (n <= t) return e;
|
|
13814
13874
|
let r = 0, i = n - t, a = Math.max(100, Math.min(400, Math.round(t / 500)));
|
|
@@ -13823,29 +13883,29 @@ function sg(e, t) {
|
|
|
13823
13883
|
});
|
|
13824
13884
|
});
|
|
13825
13885
|
}
|
|
13826
|
-
function
|
|
13827
|
-
let { apiKey: t, baseUrl: n, model: c = "gpt-3.5-turbo", temperature: l = .7, maxTokens: u, systemPrompt: d, tools: f = [], middleware: p = [], maxToolRounds: m =
|
|
13886
|
+
function vg(e) {
|
|
13887
|
+
let { apiKey: t, baseUrl: n, model: c = "gpt-3.5-turbo", temperature: l = .7, maxTokens: u, systemPrompt: d, tools: f = [], middleware: p = [], maxToolRounds: m = mg, maxRetries: h = 2, retryDelayMs: g = 500, maxParallelTools: _ = 1, maxVerifyAttempts: v = 0, onLog: y, debug: b = !1 } = e, x = eg({
|
|
13828
13888
|
model: c,
|
|
13829
13889
|
contextWindow: e.contextWindow,
|
|
13830
13890
|
maxOutputTokens: e.maxOutputTokens
|
|
13831
|
-
}), S = u ?? x.maxOutputTokens, C =
|
|
13891
|
+
}), S = u ?? x.maxOutputTokens, C = ng(x.contextWindow), w = rg(x.contextWindow), T = /* @__PURE__ */ pn([]);
|
|
13832
13892
|
function E(e, t) {
|
|
13833
13893
|
let n = {
|
|
13834
13894
|
timestamp: Date.now(),
|
|
13835
13895
|
type: e,
|
|
13836
13896
|
data: t
|
|
13837
13897
|
};
|
|
13838
|
-
T.value.push(n), T.value.length >
|
|
13898
|
+
T.value.push(n), T.value.length > hg && T.value.splice(0, T.value.length - hg), gn(T), y?.(n), b && console.log(`%c[Agent] ${e}`, "color:#667eea;font-weight:bold", t);
|
|
13839
13899
|
}
|
|
13840
13900
|
let D = (e) => {
|
|
13841
|
-
T.value.push(e), T.value.length >
|
|
13901
|
+
T.value.push(e), T.value.length > hg && T.value.splice(0, T.value.length - hg), gn(T);
|
|
13842
13902
|
}, O = [...p.flatMap((e) => e.tools || []), ...f], k = e.llm ?? new s({
|
|
13843
13903
|
apiKey: t,
|
|
13844
13904
|
model: c,
|
|
13845
13905
|
temperature: l,
|
|
13846
13906
|
maxTokens: S,
|
|
13847
13907
|
configuration: n ? { baseURL: n } : void 0
|
|
13848
|
-
}), A = O.length > 0 ? k.bindTools?.(O) ?? k : k, j =
|
|
13908
|
+
}), A = O.length > 0 ? k.bindTools?.(O) ?? k : k, j = ig();
|
|
13849
13909
|
function M() {
|
|
13850
13910
|
let e = [d || "你是一个智能助手。"];
|
|
13851
13911
|
for (let t of p) if (t.augmentPrompt) {
|
|
@@ -13920,7 +13980,7 @@ function cg(e) {
|
|
|
13920
13980
|
};
|
|
13921
13981
|
try {
|
|
13922
13982
|
let n = await t.invoke(e.args), r = typeof n == "string" ? n : JSON.stringify(n);
|
|
13923
|
-
return r =
|
|
13983
|
+
return r = Xh(r, {
|
|
13924
13984
|
files: e.state.files,
|
|
13925
13985
|
vfsAvailable: O.some((e) => e.name === "vfs_read"),
|
|
13926
13986
|
toolName: e.name,
|
|
@@ -13940,13 +14000,13 @@ function cg(e) {
|
|
|
13940
14000
|
function L(e) {
|
|
13941
14001
|
return e instanceof i ? "human" : e instanceof r ? "ai" : e instanceof a ? "system" : e instanceof o ? "tool" : "unknown";
|
|
13942
14002
|
}
|
|
13943
|
-
function
|
|
13944
|
-
return
|
|
14003
|
+
function ee(e, t) {
|
|
14004
|
+
return _g(e, t);
|
|
13945
14005
|
}
|
|
13946
|
-
function
|
|
14006
|
+
function R(e) {
|
|
13947
14007
|
return e.map((e) => {
|
|
13948
14008
|
let t = L(e), n = { role: t === "human" ? "user" : t === "ai" ? "assistant" : t }, r = typeof e.content == "string" ? e.content : JSON.stringify(e.content);
|
|
13949
|
-
r && (n.content = r.length >
|
|
14009
|
+
r && (n.content = r.length > gg ? r.slice(0, gg) + `…(截断 ${r.length - gg} 字符)` : r);
|
|
13950
14010
|
let i = e.tool_calls;
|
|
13951
14011
|
Array.isArray(i) && i.length && (n.tool_calls = i.map((e) => ({
|
|
13952
14012
|
id: e.id,
|
|
@@ -13960,8 +14020,8 @@ function cg(e) {
|
|
|
13960
14020
|
return a && (n.tool_call_id = a), n;
|
|
13961
14021
|
});
|
|
13962
14022
|
}
|
|
13963
|
-
async function
|
|
13964
|
-
T.value = [], j =
|
|
14023
|
+
async function te(e, t, n) {
|
|
14024
|
+
T.value = [], j = ig(), j.messages = e, j = await og(p, j);
|
|
13965
14025
|
let r = e;
|
|
13966
14026
|
for (let e of p) if (e.compressInput) {
|
|
13967
14027
|
let t = await e.compressInput(r);
|
|
@@ -13976,20 +14036,20 @@ function cg(e) {
|
|
|
13976
14036
|
tools: O.map((e) => e.name),
|
|
13977
14037
|
middleware: p.map((e) => e.name)
|
|
13978
14038
|
});
|
|
13979
|
-
let l =
|
|
14039
|
+
let l = dg(p, (e) => F(e, t, n)), u = fg(p, I), d = 0, f = null, h = 0;
|
|
13980
14040
|
try {
|
|
13981
14041
|
for (; d < m && !n?.aborted;) {
|
|
13982
14042
|
t({
|
|
13983
14043
|
type: "round_start",
|
|
13984
14044
|
round: d + 1
|
|
13985
|
-
}), j =
|
|
14045
|
+
}), j = sg(p, {
|
|
13986
14046
|
messages: s,
|
|
13987
14047
|
state: j
|
|
13988
|
-
}), s = P(s), s =
|
|
14048
|
+
}), s = P(s), s = ee(s, w), E("llm_request", {
|
|
13989
14049
|
round: d + 1,
|
|
13990
14050
|
model: c,
|
|
13991
14051
|
tools: O.map((e) => e.name),
|
|
13992
|
-
messages:
|
|
14052
|
+
messages: R(s)
|
|
13993
14053
|
});
|
|
13994
14054
|
let e = await l({
|
|
13995
14055
|
messages: s,
|
|
@@ -13999,12 +14059,12 @@ function cg(e) {
|
|
|
13999
14059
|
round: d + 1,
|
|
14000
14060
|
content: e.content,
|
|
14001
14061
|
toolCalls: e.toolCalls
|
|
14002
|
-
}), j =
|
|
14062
|
+
}), j = cg(p, e, j), e.aborted) return t({
|
|
14003
14063
|
type: "done",
|
|
14004
14064
|
content: e.content
|
|
14005
14065
|
}), e.content;
|
|
14006
14066
|
if (!e.toolCalls.length) {
|
|
14007
|
-
if (h < 2 &&
|
|
14067
|
+
if (h < 2 && pg(e.content)) {
|
|
14008
14068
|
h += 1, E("middleware", {
|
|
14009
14069
|
stage: "format_retry",
|
|
14010
14070
|
attempt: h,
|
|
@@ -14013,7 +14073,7 @@ function cg(e) {
|
|
|
14013
14073
|
continue;
|
|
14014
14074
|
}
|
|
14015
14075
|
if (v > 0 && j.verifyAttempts < v) {
|
|
14016
|
-
let t = await
|
|
14076
|
+
let t = await ug(p, {
|
|
14017
14077
|
messages: s,
|
|
14018
14078
|
state: j,
|
|
14019
14079
|
response: e,
|
|
@@ -14048,7 +14108,7 @@ function cg(e) {
|
|
|
14048
14108
|
logSink: D
|
|
14049
14109
|
}
|
|
14050
14110
|
};
|
|
14051
|
-
}), a = await
|
|
14111
|
+
}), a = await Zh(r, _, async (e) => {
|
|
14052
14112
|
if (n?.aborted) return;
|
|
14053
14113
|
t({
|
|
14054
14114
|
type: "tool_call",
|
|
@@ -14098,7 +14158,7 @@ function cg(e) {
|
|
|
14098
14158
|
round: "wrap_up",
|
|
14099
14159
|
model: c,
|
|
14100
14160
|
tools: [],
|
|
14101
|
-
messages:
|
|
14161
|
+
messages: R(r)
|
|
14102
14162
|
});
|
|
14103
14163
|
let i = await F({
|
|
14104
14164
|
messages: r,
|
|
@@ -14119,21 +14179,21 @@ function cg(e) {
|
|
|
14119
14179
|
}), r;
|
|
14120
14180
|
} finally {
|
|
14121
14181
|
try {
|
|
14122
|
-
await
|
|
14182
|
+
await lg(p, j);
|
|
14123
14183
|
} catch (e) {
|
|
14124
14184
|
console.warn("[Agent] afterAgent 清理出错(已忽略):", e);
|
|
14125
14185
|
}
|
|
14126
14186
|
}
|
|
14127
14187
|
}
|
|
14128
|
-
async function
|
|
14188
|
+
async function ne(e, t) {
|
|
14129
14189
|
let n = "";
|
|
14130
|
-
return await
|
|
14190
|
+
return await te(e, (e) => {
|
|
14131
14191
|
e.type === "done" && (n = e.content);
|
|
14132
14192
|
}, t), n;
|
|
14133
14193
|
}
|
|
14134
14194
|
return {
|
|
14135
|
-
invoke:
|
|
14136
|
-
stream:
|
|
14195
|
+
invoke: ne,
|
|
14196
|
+
stream: te,
|
|
14137
14197
|
getState: () => j,
|
|
14138
14198
|
allTools: O,
|
|
14139
14199
|
debugLogs: T
|
|
@@ -14141,14 +14201,14 @@ function cg(e) {
|
|
|
14141
14201
|
}
|
|
14142
14202
|
//#endregion
|
|
14143
14203
|
//#region src/core/harness/todos.ts
|
|
14144
|
-
function
|
|
14204
|
+
function yg(e) {
|
|
14145
14205
|
if (e.length) return [
|
|
14146
14206
|
"## 当前任务清单(用 write_todos 工具管理)",
|
|
14147
14207
|
e.map((e, t) => `${t + 1}. [${e.status}] ${e.content}`).join("\n"),
|
|
14148
14208
|
"规则:开始前用 write_todos 拆解;首个任务标 in_progress;完成一个立即标 completed(不批量);保持至少一个 in_progress 直到全部完成。"
|
|
14149
14209
|
].join("\n");
|
|
14150
14210
|
}
|
|
14151
|
-
function
|
|
14211
|
+
function bg(e = []) {
|
|
14152
14212
|
let r = e.map((e) => ({ ...e })), i = 0;
|
|
14153
14213
|
return {
|
|
14154
14214
|
name: "todos",
|
|
@@ -14166,7 +14226,7 @@ function ug(e = []) {
|
|
|
14166
14226
|
})],
|
|
14167
14227
|
beforeAgent: () => ({ todos: r }),
|
|
14168
14228
|
beforeModel: () => (i = 0, { todos: r }),
|
|
14169
|
-
augmentPrompt: () =>
|
|
14229
|
+
augmentPrompt: () => yg(r),
|
|
14170
14230
|
wrapToolCall: async (e, t) => e.name === "write_todos" && (i++, i > 1) ? {
|
|
14171
14231
|
content: "错误:write_todos 不应在一轮中并行多次调用(整表替换语义)。请串行使用。",
|
|
14172
14232
|
status: "error"
|
|
@@ -14178,18 +14238,18 @@ function ug(e = []) {
|
|
|
14178
14238
|
}
|
|
14179
14239
|
//#endregion
|
|
14180
14240
|
//#region src/core/harness/skills.ts
|
|
14181
|
-
function
|
|
14241
|
+
function xg(e) {
|
|
14182
14242
|
return e;
|
|
14183
14243
|
}
|
|
14184
|
-
var
|
|
14185
|
-
function
|
|
14186
|
-
return
|
|
14244
|
+
var Sg = /^https?:\/\//i;
|
|
14245
|
+
function Cg(e) {
|
|
14246
|
+
return Sg.test(e) || e.startsWith("//") ? "http" : "vfs";
|
|
14187
14247
|
}
|
|
14188
|
-
function
|
|
14248
|
+
function wg(e) {
|
|
14189
14249
|
return e.replace(/^vfs:\/\//, "").replace(/^\/+/, "").replace(/\/+/g, "/");
|
|
14190
14250
|
}
|
|
14191
|
-
async function
|
|
14192
|
-
if (
|
|
14251
|
+
async function Tg(e, t) {
|
|
14252
|
+
if (Cg(e) === "http") try {
|
|
14193
14253
|
let t = await fetch(e);
|
|
14194
14254
|
return t.ok ? {
|
|
14195
14255
|
ok: !0,
|
|
@@ -14212,7 +14272,7 @@ async function hg(e, t) {
|
|
|
14212
14272
|
ok: !1,
|
|
14213
14273
|
error: `skill 文档 ${e} 是 vfs 路径,但 vfs 未启用`
|
|
14214
14274
|
};
|
|
14215
|
-
let n = t(
|
|
14275
|
+
let n = t(wg(e));
|
|
14216
14276
|
return n == null ? {
|
|
14217
14277
|
ok: !1,
|
|
14218
14278
|
error: `未找到 vfs 文档 ${e}(可用 vfs_ls 查看)`
|
|
@@ -14221,14 +14281,14 @@ async function hg(e, t) {
|
|
|
14221
14281
|
content: n
|
|
14222
14282
|
};
|
|
14223
14283
|
}
|
|
14224
|
-
function
|
|
14284
|
+
function Eg(e) {
|
|
14225
14285
|
if (e.length) return [
|
|
14226
14286
|
"## 可用 Skills(渐进式披露)",
|
|
14227
14287
|
e.map((e) => `- ${e.name}: ${e.description}`).join("\n"),
|
|
14228
14288
|
"当某 skill 适用时,先调用 load_skill(name) 加载其完整指令,再按指令执行。不要凭记忆猜测 skill 内容。"
|
|
14229
14289
|
].join("\n");
|
|
14230
14290
|
}
|
|
14231
|
-
function
|
|
14291
|
+
function Dg(e, r) {
|
|
14232
14292
|
let i = new Map(e.map((e) => [e.name, e])), a = /* @__PURE__ */ new Set();
|
|
14233
14293
|
return {
|
|
14234
14294
|
name: "skills",
|
|
@@ -14238,7 +14298,7 @@ function _g(e, r) {
|
|
|
14238
14298
|
if (a.has(e)) return `skill "${e}" 已在本轮加载,无需重复。`;
|
|
14239
14299
|
let n;
|
|
14240
14300
|
if (t.doc) {
|
|
14241
|
-
let i = await
|
|
14301
|
+
let i = await Tg(t.doc, r?.readVfs);
|
|
14242
14302
|
if (!i.ok) return `加载 skill "${e}" 文档失败:${i.error}`;
|
|
14243
14303
|
n = i.content;
|
|
14244
14304
|
} else if (t.getContent) n = await t.getContent();
|
|
@@ -14256,13 +14316,13 @@ function _g(e, r) {
|
|
|
14256
14316
|
})),
|
|
14257
14317
|
skillsLoaded: []
|
|
14258
14318
|
}),
|
|
14259
|
-
augmentPrompt: () =>
|
|
14319
|
+
augmentPrompt: () => Eg(e),
|
|
14260
14320
|
afterModel: () => ({ skillsLoaded: [...a] })
|
|
14261
14321
|
};
|
|
14262
14322
|
}
|
|
14263
14323
|
//#endregion
|
|
14264
14324
|
//#region src/core/harness/memory.ts
|
|
14265
|
-
function
|
|
14325
|
+
function Og(e = "") {
|
|
14266
14326
|
let t = e;
|
|
14267
14327
|
return {
|
|
14268
14328
|
name: "memory",
|
|
@@ -14275,12 +14335,12 @@ function vg(e = "") {
|
|
|
14275
14335
|
}
|
|
14276
14336
|
//#endregion
|
|
14277
14337
|
//#region src/core/harness/permissions.ts
|
|
14278
|
-
var
|
|
14338
|
+
var kg = /* @__PURE__ */ new Set([
|
|
14279
14339
|
"set_window_prop",
|
|
14280
14340
|
"delete_window_prop",
|
|
14281
14341
|
"vfs_write",
|
|
14282
14342
|
"vfs_edit"
|
|
14283
|
-
]),
|
|
14343
|
+
]), Ag = /* @__PURE__ */ new Set([
|
|
14284
14344
|
"get_window_prop",
|
|
14285
14345
|
"describe_window_prop",
|
|
14286
14346
|
"list_window_props",
|
|
@@ -14289,7 +14349,7 @@ var yg = /* @__PURE__ */ new Set([
|
|
|
14289
14349
|
"vfs_glob",
|
|
14290
14350
|
"vfs_grep"
|
|
14291
14351
|
]);
|
|
14292
|
-
function
|
|
14352
|
+
function jg(e) {
|
|
14293
14353
|
let t = "";
|
|
14294
14354
|
for (let n = 0; n < e.length; n++) {
|
|
14295
14355
|
let r = e[n];
|
|
@@ -14297,16 +14357,16 @@ function xg(e) {
|
|
|
14297
14357
|
}
|
|
14298
14358
|
return RegExp("^" + t + "$");
|
|
14299
14359
|
}
|
|
14300
|
-
function
|
|
14301
|
-
for (let r of e) if (r.operations.includes(t) && r.scopes.some((e) =>
|
|
14360
|
+
function Mg(e, t, n) {
|
|
14361
|
+
for (let r of e) if (r.operations.includes(t) && r.scopes.some((e) => jg(e).test(n))) return r.mode;
|
|
14302
14362
|
return "allow";
|
|
14303
14363
|
}
|
|
14304
|
-
function
|
|
14364
|
+
function Ng(e) {
|
|
14305
14365
|
return {
|
|
14306
14366
|
name: "permissions",
|
|
14307
14367
|
wrapToolCall: async (t, n) => {
|
|
14308
|
-
let r =
|
|
14309
|
-
return r && i &&
|
|
14368
|
+
let r = kg.has(t.name) ? "write" : Ag.has(t.name) ? "read" : null, i = t.args?.path || "";
|
|
14369
|
+
return r && i && Mg(e, r, i) === "deny" ? {
|
|
14310
14370
|
content: `权限拒绝:${r} 操作 "${i}" 被 permissions 规则禁止。`,
|
|
14311
14371
|
status: "error"
|
|
14312
14372
|
} : n(t);
|
|
@@ -14315,7 +14375,7 @@ function Cg(e) {
|
|
|
14315
14375
|
}
|
|
14316
14376
|
//#endregion
|
|
14317
14377
|
//#region src/core/harness/approval.ts
|
|
14318
|
-
function
|
|
14378
|
+
function Pg(e = {}) {
|
|
14319
14379
|
let t = (t, n) => e.confirm ? !!e.confirm(t, n) : e.tools === void 0 || e.tools.includes(t);
|
|
14320
14380
|
return {
|
|
14321
14381
|
name: "approval",
|
|
@@ -14349,15 +14409,15 @@ function wg(e = {}) {
|
|
|
14349
14409
|
}
|
|
14350
14410
|
//#endregion
|
|
14351
14411
|
//#region src/core/harness/humanConfirm.ts
|
|
14352
|
-
var
|
|
14412
|
+
var Fg = "request_human_confirmation", Ig = t.object({
|
|
14353
14413
|
question: t.string().describe("要征询用户的问题/方案描述。清晰具体:说明当前情况、为什么需要确认、确认什么。"),
|
|
14354
14414
|
options: t.array(t.string()).optional().describe("可选方案列表(2-4 个)。用户从中选一个。不传则用户只回答允许/拒绝。"),
|
|
14355
14415
|
recommendation: t.string().optional().describe("你推荐的方案(优先在 options 中选一个)及推荐理由,帮用户快速决策。"),
|
|
14356
14416
|
context: t.string().optional().describe("补充上下文:已做了什么、约束、影响范围等,帮用户判断。")
|
|
14357
14417
|
});
|
|
14358
|
-
function
|
|
14418
|
+
function Lg() {
|
|
14359
14419
|
return n(async () => "人工确认中间件未装载,无法征询用户。请直接向用户说明情况并等待回复。", {
|
|
14360
|
-
name:
|
|
14420
|
+
name: Fg,
|
|
14361
14421
|
description: [
|
|
14362
14422
|
"当遇到以下情况时,主动调用本工具征询用户确认后再继续(不要默默猜测后直接执行高风险动作):",
|
|
14363
14423
|
"1) 不确定用户意图、需求有歧义;",
|
|
@@ -14367,10 +14427,10 @@ function Dg() {
|
|
|
14367
14427
|
"入参:question=问题/方案描述;options=可选方案列表(多方案时给);recommendation=你推荐的方案及理由。",
|
|
14368
14428
|
"用户选择后,据其回答继续;若用户拒绝,停止当前操作并询问如何调整。"
|
|
14369
14429
|
].join(""),
|
|
14370
|
-
schema:
|
|
14430
|
+
schema: Ig
|
|
14371
14431
|
});
|
|
14372
14432
|
}
|
|
14373
|
-
function
|
|
14433
|
+
function Rg() {
|
|
14374
14434
|
return {
|
|
14375
14435
|
name: "humanConfirm",
|
|
14376
14436
|
wrapToolCall: async (e, t) => e.name === "request_human_confirmation" ? new Promise((t) => {
|
|
@@ -14402,14 +14462,14 @@ function Og() {
|
|
|
14402
14462
|
}
|
|
14403
14463
|
//#endregion
|
|
14404
14464
|
//#region src/core/harness/checkpoint.ts
|
|
14405
|
-
function
|
|
14465
|
+
function zg(e) {
|
|
14406
14466
|
if (typeof e != "object" || !e) return e;
|
|
14407
14467
|
if (typeof structuredClone == "function") try {
|
|
14408
14468
|
return structuredClone(e);
|
|
14409
14469
|
} catch {}
|
|
14410
14470
|
return JSON.parse(JSON.stringify(e));
|
|
14411
14471
|
}
|
|
14412
|
-
function
|
|
14472
|
+
function Bg(e, t) {
|
|
14413
14473
|
let n = t.split("."), r = e;
|
|
14414
14474
|
for (let e of n) {
|
|
14415
14475
|
if (r == null) return;
|
|
@@ -14417,12 +14477,12 @@ function Ag(e, t) {
|
|
|
14417
14477
|
}
|
|
14418
14478
|
return r;
|
|
14419
14479
|
}
|
|
14420
|
-
function
|
|
14480
|
+
function Vg(e, t, n) {
|
|
14421
14481
|
let r = t.split("."), i = e;
|
|
14422
14482
|
for (let e = 0; e < r.length - 1; e++) i[r[e]] ?? (i[r[e]] = {}), i = i[r[e]];
|
|
14423
14483
|
i[r[r.length - 1]] = n;
|
|
14424
14484
|
}
|
|
14425
|
-
function
|
|
14485
|
+
function Hg(e, t) {
|
|
14426
14486
|
if (Array.isArray(e)) {
|
|
14427
14487
|
e.length = 0, Array.isArray(t) && e.push(...t);
|
|
14428
14488
|
return;
|
|
@@ -14431,11 +14491,11 @@ function Mg(e, t) {
|
|
|
14431
14491
|
for (let t of Object.keys(e)) t in n || delete e[t];
|
|
14432
14492
|
for (let t of Object.keys(n)) e[t] = n[t];
|
|
14433
14493
|
}
|
|
14434
|
-
function
|
|
14435
|
-
let n =
|
|
14436
|
-
typeof n == "object" && n ?
|
|
14494
|
+
function Ug(e, t) {
|
|
14495
|
+
let n = Bg(window, e);
|
|
14496
|
+
typeof n == "object" && n ? Hg(n, t) : Vg(window, e, t);
|
|
14437
14497
|
}
|
|
14438
|
-
function
|
|
14498
|
+
function Wg(e) {
|
|
14439
14499
|
let t = e.slice();
|
|
14440
14500
|
for (; t.length;) {
|
|
14441
14501
|
let e = t[t.length - 1];
|
|
@@ -14444,20 +14504,20 @@ function Pg(e) {
|
|
|
14444
14504
|
}
|
|
14445
14505
|
return t;
|
|
14446
14506
|
}
|
|
14447
|
-
function
|
|
14507
|
+
function Gg(e) {
|
|
14448
14508
|
let t = [], n = e.maxCheckpoints ?? 5, r = 1;
|
|
14449
14509
|
return {
|
|
14450
14510
|
save(i) {
|
|
14451
|
-
let a =
|
|
14452
|
-
for (let t of e.windowPaths) o[t] =
|
|
14511
|
+
let a = Wg(e.messages), o = {};
|
|
14512
|
+
for (let t of e.windowPaths) o[t] = zg(Bg(window, t));
|
|
14453
14513
|
let s = {
|
|
14454
14514
|
id: r++,
|
|
14455
14515
|
label: i,
|
|
14456
14516
|
timestamp: Date.now(),
|
|
14457
|
-
messages:
|
|
14517
|
+
messages: zg(a),
|
|
14458
14518
|
windowVals: o,
|
|
14459
|
-
vfs:
|
|
14460
|
-
todos:
|
|
14519
|
+
vfs: zg(e.vfsStore.files),
|
|
14520
|
+
todos: zg(e.getTodos()),
|
|
14461
14521
|
messageCount: a.length
|
|
14462
14522
|
};
|
|
14463
14523
|
for (t.push(s); t.length > n;) t.shift();
|
|
@@ -14477,15 +14537,15 @@ function Fg(e) {
|
|
|
14477
14537
|
restore(n) {
|
|
14478
14538
|
let r = n == null ? t[t.length - 1] : t.find((e) => e.id === n);
|
|
14479
14539
|
if (!r) return !1;
|
|
14480
|
-
e.messages.splice(0, e.messages.length, ...
|
|
14481
|
-
for (let [e, t] of Object.entries(r.windowVals))
|
|
14540
|
+
e.messages.splice(0, e.messages.length, ...zg(r.messages));
|
|
14541
|
+
for (let [e, t] of Object.entries(r.windowVals)) Ug(e, zg(t));
|
|
14482
14542
|
let i = e.vfsStore.files;
|
|
14483
14543
|
for (let e of Object.keys(i)) delete i[e];
|
|
14484
|
-
return Object.assign(i,
|
|
14544
|
+
return Object.assign(i, zg(r.vfs)), e.todosMw.reset(zg(r.todos)), !0;
|
|
14485
14545
|
}
|
|
14486
14546
|
};
|
|
14487
14547
|
}
|
|
14488
|
-
function
|
|
14548
|
+
function Kg(e) {
|
|
14489
14549
|
let t = !1;
|
|
14490
14550
|
return {
|
|
14491
14551
|
name: "checkpoint",
|
|
@@ -14499,22 +14559,22 @@ function Ig(e) {
|
|
|
14499
14559
|
}
|
|
14500
14560
|
//#endregion
|
|
14501
14561
|
//#region src/core/harness/subagent.ts
|
|
14502
|
-
function
|
|
14562
|
+
function qg(e) {
|
|
14503
14563
|
return !!e && typeof e == "object" && typeof e.invoke == "function" && typeof e.stream == "function";
|
|
14504
14564
|
}
|
|
14505
|
-
var
|
|
14565
|
+
var Jg = [
|
|
14506
14566
|
"get_window_prop",
|
|
14507
14567
|
"get_window_paths",
|
|
14508
14568
|
"list_window_props",
|
|
14509
14569
|
"describe_window_prop",
|
|
14510
14570
|
"fetch_document"
|
|
14511
|
-
],
|
|
14512
|
-
async function
|
|
14513
|
-
let a = t.depth ?? 0, o = t.maxDepth ??
|
|
14571
|
+
], Yg = 1, Xg = 4, Zg = 6, Qg = ["spawn_agent", "spawn_agents"];
|
|
14572
|
+
async function $g(e, t, n, r, i) {
|
|
14573
|
+
let a = t.depth ?? 0, o = t.maxDepth ?? Yg, s = /* @__PURE__ */ new Set([...Jg, ...t.allowedTools ?? []]), c = [...t.allTools.filter((e) => s.has(e.name) && !Qg.includes(e.name)), ...t.extraTools ?? []], l = a + 1 < o ? [e_({
|
|
14514
14574
|
...t,
|
|
14515
14575
|
depth: a + 1
|
|
14516
|
-
})] : [], u =
|
|
14517
|
-
...
|
|
14576
|
+
})] : [], u = vg({
|
|
14577
|
+
...qg(t.llm) ? { llm: t.llm } : {
|
|
14518
14578
|
apiKey: t.llm.apiKey,
|
|
14519
14579
|
baseUrl: t.llm.baseUrl,
|
|
14520
14580
|
model: e.model ?? t.llm.model,
|
|
@@ -14523,8 +14583,8 @@ async function Ug(e, t, n, r, i) {
|
|
|
14523
14583
|
},
|
|
14524
14584
|
systemPrompt: e.role?.trim() || t.systemPrompt || "你是一个专注的子任务执行者。你只有只读工具(读 window / 抓文档),用它们完成给定任务,给出简洁结论,不要展开多余解释。",
|
|
14525
14585
|
tools: c,
|
|
14526
|
-
middleware: [...t.skills?.length ? [
|
|
14527
|
-
maxToolRounds: t.maxToolRounds ??
|
|
14586
|
+
middleware: [...t.skills?.length ? [Dg(t.skills)] : [], ...l],
|
|
14587
|
+
maxToolRounds: t.maxToolRounds ?? Zg,
|
|
14528
14588
|
onLog: i,
|
|
14529
14589
|
debug: t.debug
|
|
14530
14590
|
});
|
|
@@ -14536,8 +14596,8 @@ async function Ug(e, t, n, r, i) {
|
|
|
14536
14596
|
r && (e.type === "tool_call" || e.type === "tool_result") && r(e);
|
|
14537
14597
|
}, n);
|
|
14538
14598
|
}
|
|
14539
|
-
function
|
|
14540
|
-
let r = e.maxParallel ??
|
|
14599
|
+
function e_(e) {
|
|
14600
|
+
let r = e.maxParallel ?? Xg, i, a, o, s = (e, t) => (n) => {
|
|
14541
14601
|
a && a({
|
|
14542
14602
|
type: "subagent",
|
|
14543
14603
|
taskId: e,
|
|
@@ -14556,7 +14616,7 @@ function Wg(e) {
|
|
|
14556
14616
|
...e,
|
|
14557
14617
|
allowedTools: r
|
|
14558
14618
|
} : e, l = `sub-${Math.random().toString(36).slice(2, 8)}`, u = n?.trim() || "子任务";
|
|
14559
|
-
return await
|
|
14619
|
+
return await $g({
|
|
14560
14620
|
prompt: t,
|
|
14561
14621
|
role: n,
|
|
14562
14622
|
model: a
|
|
@@ -14573,9 +14633,9 @@ function Wg(e) {
|
|
|
14573
14633
|
tools: t.array(t.string()).optional().describe("子 agent 可用工具名白名单(默认只读 window + fetch)"),
|
|
14574
14634
|
model: t.string().optional().describe("覆盖模型(默认同主)")
|
|
14575
14635
|
})
|
|
14576
|
-
}), n(async ({ tasks: t }) => (await
|
|
14636
|
+
}), n(async ({ tasks: t }) => (await Zh(t, r, async (t, n) => {
|
|
14577
14637
|
let r = `sub-${n}-${Math.random().toString(36).slice(2, 6)}`, a = t.role?.trim() || `子任务${n + 1}`;
|
|
14578
|
-
return
|
|
14638
|
+
return $g(t, e, i, s(r, a), (e) => o?.({
|
|
14579
14639
|
...e,
|
|
14580
14640
|
source: `子:${a}`
|
|
14581
14641
|
}));
|
|
@@ -14590,8 +14650,8 @@ function Wg(e) {
|
|
|
14590
14650
|
wrapToolCall: async (e, t) => (e.signal && (i = e.signal), e.emit && (a = e.emit), e.logSink && (o = e.logSink), t(e))
|
|
14591
14651
|
};
|
|
14592
14652
|
}
|
|
14593
|
-
var
|
|
14594
|
-
function
|
|
14653
|
+
var t_ = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
14654
|
+
function n_(e, t) {
|
|
14595
14655
|
let n = e.tools ?? [];
|
|
14596
14656
|
return {
|
|
14597
14657
|
llm: e.llm ?? t.llm,
|
|
@@ -14605,9 +14665,9 @@ function Kg(e, t) {
|
|
|
14605
14665
|
debug: t.debug
|
|
14606
14666
|
};
|
|
14607
14667
|
}
|
|
14608
|
-
function
|
|
14668
|
+
function r_(e, r) {
|
|
14609
14669
|
let i = /* @__PURE__ */ new Set(), a = e.filter((e) => {
|
|
14610
|
-
if (!
|
|
14670
|
+
if (!t_.test(e.id)) return console.warn(`[subagents] id "${e.id}" 非合法工具名(须 [a-zA-Z_][a-zA-Z0-9_]*),已跳过`), !1;
|
|
14611
14671
|
let t = `use_${e.id}`;
|
|
14612
14672
|
return i.has(t) ? (console.warn(`[subagents] id "${e.id}" 重复,已跳过`), !1) : (i.add(t), !0);
|
|
14613
14673
|
}), o, s, c, l = (e, t) => (n) => {
|
|
@@ -14625,8 +14685,8 @@ function qg(e, r) {
|
|
|
14625
14685
|
return {
|
|
14626
14686
|
name: "subagents",
|
|
14627
14687
|
tools: a.map((e) => n(async ({ task: t }) => {
|
|
14628
|
-
let n =
|
|
14629
|
-
return
|
|
14688
|
+
let n = n_(e, r);
|
|
14689
|
+
return $g({ prompt: t }, n, o, l(`use_${e.id}`, e.id), (t) => c?.({
|
|
14630
14690
|
...t,
|
|
14631
14691
|
source: `子:${e.id}`
|
|
14632
14692
|
}));
|
|
@@ -14645,7 +14705,7 @@ function qg(e, r) {
|
|
|
14645
14705
|
}
|
|
14646
14706
|
//#endregion
|
|
14647
14707
|
//#region src/core/harness/verify.ts
|
|
14648
|
-
function
|
|
14708
|
+
function i_(e) {
|
|
14649
14709
|
return {
|
|
14650
14710
|
name: "verify",
|
|
14651
14711
|
async beforeReturn({ messages: t, state: n, log: r }) {
|
|
@@ -14657,10 +14717,10 @@ function Jg(e) {
|
|
|
14657
14717
|
if (e.adversarial) {
|
|
14658
14718
|
r?.("middleware", {
|
|
14659
14719
|
stage: "adversarial_start",
|
|
14660
|
-
model:
|
|
14720
|
+
model: f_(e.adversarial.llm),
|
|
14661
14721
|
tools: (e.adversarial.tools ?? []).length
|
|
14662
14722
|
});
|
|
14663
|
-
let n = await
|
|
14723
|
+
let n = await g_(t, e.adversarial.llm, r, e.adversarial.tools);
|
|
14664
14724
|
if (r?.("middleware", {
|
|
14665
14725
|
stage: "adversarial_done",
|
|
14666
14726
|
clean: n === null,
|
|
@@ -14671,16 +14731,16 @@ function Jg(e) {
|
|
|
14671
14731
|
}
|
|
14672
14732
|
};
|
|
14673
14733
|
}
|
|
14674
|
-
var
|
|
14734
|
+
var a_ = /* @__PURE__ */ new Set([
|
|
14675
14735
|
"set_window_prop",
|
|
14676
14736
|
"edit_window_prop",
|
|
14677
14737
|
"delete_window_prop"
|
|
14678
|
-
]),
|
|
14679
|
-
function
|
|
14738
|
+
]), o_ = /校验失败|未在注册表中声明|未注册|不存在|仅支持|必须是/;
|
|
14739
|
+
function s_(e) {
|
|
14680
14740
|
let t = /* @__PURE__ */ new Map();
|
|
14681
14741
|
for (let n of e) {
|
|
14682
14742
|
let e = n?.tool_calls;
|
|
14683
|
-
if (Array.isArray(e)) for (let n of e)
|
|
14743
|
+
if (Array.isArray(e)) for (let n of e) a_.has(n.name) && typeof n?.args?.path == "string" && t.set(n.args.path, {
|
|
14684
14744
|
path: n.args.path,
|
|
14685
14745
|
op: n.name,
|
|
14686
14746
|
callId: n.id
|
|
@@ -14688,7 +14748,7 @@ function Zg(e) {
|
|
|
14688
14748
|
}
|
|
14689
14749
|
return [...t.values()];
|
|
14690
14750
|
}
|
|
14691
|
-
function
|
|
14751
|
+
function c_(e) {
|
|
14692
14752
|
let t = /* @__PURE__ */ new Map();
|
|
14693
14753
|
for (let n of e) {
|
|
14694
14754
|
let e = n?.tool_call_id, r = n?.content;
|
|
@@ -14696,7 +14756,7 @@ function Qg(e) {
|
|
|
14696
14756
|
}
|
|
14697
14757
|
return t;
|
|
14698
14758
|
}
|
|
14699
|
-
function
|
|
14759
|
+
function l_(e, t) {
|
|
14700
14760
|
if (e == null) return;
|
|
14701
14761
|
let n = e;
|
|
14702
14762
|
for (let e of t.split(".")) {
|
|
@@ -14705,16 +14765,16 @@ function $g(e, t) {
|
|
|
14705
14765
|
}
|
|
14706
14766
|
return n;
|
|
14707
14767
|
}
|
|
14708
|
-
function
|
|
14768
|
+
function u_(e = {}) {
|
|
14709
14769
|
let t = e.window ?? globalThis.window, n = typeof e.schemas == "function" ? e.schemas : () => e.schemas ?? {};
|
|
14710
14770
|
return async ({ messages: e }) => {
|
|
14711
|
-
let r =
|
|
14771
|
+
let r = s_(e);
|
|
14712
14772
|
if (!r.length) return { ok: !0 };
|
|
14713
|
-
let i =
|
|
14773
|
+
let i = c_(e), a = n(), o = [];
|
|
14714
14774
|
for (let { path: e, op: n, callId: s } of r) {
|
|
14715
14775
|
let r = s ? i.get(s) : void 0;
|
|
14716
|
-
if (r &&
|
|
14717
|
-
let c =
|
|
14776
|
+
if (r && o_.test(r)) continue;
|
|
14777
|
+
let c = l_(t, e);
|
|
14718
14778
|
if (n === "delete_window_prop") c !== void 0 && o.push(`${e} 删除后读回仍有值,疑似未生效`);
|
|
14719
14779
|
else if (c == null) o.push(`写入 ${e} 后读回为空,疑似未生效`);
|
|
14720
14780
|
else if (a[e]) {
|
|
@@ -14728,17 +14788,17 @@ function e_(e = {}) {
|
|
|
14728
14788
|
} : { ok: !0 };
|
|
14729
14789
|
};
|
|
14730
14790
|
}
|
|
14731
|
-
function
|
|
14791
|
+
function d_(e) {
|
|
14732
14792
|
return !!e && typeof e == "object" && typeof e.invoke == "function" && typeof e.stream == "function";
|
|
14733
14793
|
}
|
|
14734
|
-
function
|
|
14735
|
-
return
|
|
14794
|
+
function f_(e) {
|
|
14795
|
+
return d_(e) ? e.model ?? e.modelName ?? "<实例>" : e.model ?? "<配置>";
|
|
14736
14796
|
}
|
|
14737
|
-
var
|
|
14738
|
-
function
|
|
14739
|
-
return
|
|
14797
|
+
var p_ = /无问题|没有问题|未发现问题|没有发现|没问题|未发现/;
|
|
14798
|
+
function m_(e) {
|
|
14799
|
+
return p_.test(e);
|
|
14740
14800
|
}
|
|
14741
|
-
function
|
|
14801
|
+
function h_(e) {
|
|
14742
14802
|
let t = "", n = "";
|
|
14743
14803
|
for (let a of e) a instanceof i ? t = typeof a.content == "string" ? a.content : "" : a instanceof r && !(a.tool_calls?.length > 0) && (n = typeof a.content == "string" ? a.content : "");
|
|
14744
14804
|
return {
|
|
@@ -14746,8 +14806,8 @@ function a_(e) {
|
|
|
14746
14806
|
lastReply: n
|
|
14747
14807
|
};
|
|
14748
14808
|
}
|
|
14749
|
-
async function
|
|
14750
|
-
let { lastUser: i, lastReply: a } =
|
|
14809
|
+
async function g_(e, t, n, r) {
|
|
14810
|
+
let { lastUser: i, lastReply: a } = h_(e);
|
|
14751
14811
|
if (!a) return null;
|
|
14752
14812
|
let o = Array.isArray(r) && r.length > 0, s = [
|
|
14753
14813
|
"你是严格的对抗式审查者,目标是找出以下 AI 助手回复的错误并证明它有问题(事实错误 / 遗漏 / 逻辑矛盾 / 与需求不符)。",
|
|
@@ -14758,7 +14818,7 @@ async function o_(e, t, n, r) {
|
|
|
14758
14818
|
].join("\n"), c = "你是严格的对抗式审查者,只找问题不赞美。目标是反驳,不是改进。", l = n ? (e) => n(e.type, {
|
|
14759
14819
|
...e.data,
|
|
14760
14820
|
source: "adversarial"
|
|
14761
|
-
}) : void 0, u = await
|
|
14821
|
+
}) : void 0, u = await vg(d_(t) ? {
|
|
14762
14822
|
llm: t,
|
|
14763
14823
|
tools: r,
|
|
14764
14824
|
maxToolRounds: o ? 4 : 1,
|
|
@@ -14783,17 +14843,17 @@ async function o_(e, t, n, r) {
|
|
|
14783
14843
|
stage: "adversarial_verdict",
|
|
14784
14844
|
verdict: u,
|
|
14785
14845
|
source: "adversarial"
|
|
14786
|
-
}),
|
|
14846
|
+
}), m_(u) ? null : u.trim();
|
|
14787
14847
|
}
|
|
14788
14848
|
//#endregion
|
|
14789
14849
|
//#region src/core/mcp/client.ts
|
|
14790
|
-
function
|
|
14850
|
+
function __(e) {
|
|
14791
14851
|
let t = e?.content;
|
|
14792
14852
|
if (!Array.isArray(t) || !t.length) return "";
|
|
14793
14853
|
let n = t.map((e) => e.type === "text" && e.text ? e.text : e.type === "image" && e.data ? `[image:${String(e.data).slice(0, 32)}…]` : e.type === "audio" && e.data ? "[audio]" : e.type === "resource" && e.resource ? e.resource.text ?? e.resource.blob ?? "" : "").filter(Boolean).join("\n");
|
|
14794
14854
|
return e?.isError ? `工具错误:${n}` : n;
|
|
14795
14855
|
}
|
|
14796
|
-
async function
|
|
14856
|
+
async function v_(e) {
|
|
14797
14857
|
let t = new URL(e.url), n = e.requestInit;
|
|
14798
14858
|
if (e.transport === "http") {
|
|
14799
14859
|
let { StreamableHTTPClientTransport: e } = await import("@modelcontextprotocol/sdk/client/streamableHttp.js");
|
|
@@ -14806,8 +14866,8 @@ async function c_(e) {
|
|
|
14806
14866
|
let { WebSocketClientTransport: r } = await import("@modelcontextprotocol/sdk/client/websocket.js");
|
|
14807
14867
|
return new r(t);
|
|
14808
14868
|
}
|
|
14809
|
-
function
|
|
14810
|
-
return n(async (n) =>
|
|
14869
|
+
function y_(e, t) {
|
|
14870
|
+
return n(async (n) => __(await t.callTool({
|
|
14811
14871
|
name: e.name,
|
|
14812
14872
|
arguments: n
|
|
14813
14873
|
})), {
|
|
@@ -14816,21 +14876,21 @@ function l_(e, t) {
|
|
|
14816
14876
|
schema: e.inputSchema
|
|
14817
14877
|
});
|
|
14818
14878
|
}
|
|
14819
|
-
async function
|
|
14820
|
-
let { Client: t } = await import("@modelcontextprotocol/sdk/client"), n = await
|
|
14879
|
+
async function b_(e) {
|
|
14880
|
+
let { Client: t } = await import("@modelcontextprotocol/sdk/client"), n = await v_(e), r = new t({
|
|
14821
14881
|
name: "page-agent-sdk",
|
|
14822
14882
|
version: "1.0"
|
|
14823
14883
|
}, { capabilities: {} });
|
|
14824
14884
|
await r.connect(n);
|
|
14825
14885
|
let { tools: i } = await r.listTools();
|
|
14826
14886
|
return {
|
|
14827
|
-
tools: i.map((e) =>
|
|
14887
|
+
tools: i.map((e) => y_(e, r)),
|
|
14828
14888
|
close: () => r.close()
|
|
14829
14889
|
};
|
|
14830
14890
|
}
|
|
14831
14891
|
//#endregion
|
|
14832
14892
|
//#region src/core/utils/rounds.ts
|
|
14833
|
-
function
|
|
14893
|
+
function x_(e) {
|
|
14834
14894
|
let t = [], n = null, r = 0;
|
|
14835
14895
|
for (let i = 0; i < e.length; i++) {
|
|
14836
14896
|
let a = e[i];
|
|
@@ -14844,14 +14904,14 @@ function d_(e) {
|
|
|
14844
14904
|
}
|
|
14845
14905
|
return n && t.push(n), t;
|
|
14846
14906
|
}
|
|
14847
|
-
function
|
|
14907
|
+
function S_(e, t) {
|
|
14848
14908
|
let n = (e || "").replace(/```[\s\S]*?```/g, "[代码]").replace(/`([^`]+)`/g, "$1").replace(/[#*_>\-]\s?/g, "").replace(/\[(代码)\]/g, "「代码」").replace(/\s+/g, " ").trim();
|
|
14849
14909
|
return n.length > t ? n.slice(0, t) + "…" : n;
|
|
14850
14910
|
}
|
|
14851
|
-
var
|
|
14852
|
-
function
|
|
14911
|
+
var C_ = "【更早对话摘要";
|
|
14912
|
+
function w_(e, t) {
|
|
14853
14913
|
if (t <= 0) return { trimmed: !1 };
|
|
14854
|
-
let n =
|
|
14914
|
+
let n = x_(e);
|
|
14855
14915
|
if (n.length <= t) return { trimmed: !1 };
|
|
14856
14916
|
let r = n[n.length - t].startIdx, i = n.slice(0, n.length - t), a = n[0].startIdx, o = "";
|
|
14857
14917
|
for (let t = 0; t < a; t++) {
|
|
@@ -14862,7 +14922,7 @@ function m_(e, t) {
|
|
|
14862
14922
|
}
|
|
14863
14923
|
}
|
|
14864
14924
|
let s = i.map((e) => {
|
|
14865
|
-
let t =
|
|
14925
|
+
let t = S_(e.userMsg.content, 60) || "(空)", n = e.assistantMsgs[0] ? S_(e.assistantMsgs[0].content, 80) : "(无回复)";
|
|
14866
14926
|
return `- 第${e.round}轮:${t} → ${n}`;
|
|
14867
14927
|
}).join("\n"), c = o ? o.replace(/^【[^】]*】\n?/, "") : "";
|
|
14868
14928
|
return {
|
|
@@ -14871,47 +14931,47 @@ function m_(e, t) {
|
|
|
14871
14931
|
deleteCount: r,
|
|
14872
14932
|
summary: {
|
|
14873
14933
|
role: "system",
|
|
14874
|
-
content: c ? `${
|
|
14934
|
+
content: c ? `${C_}(${i.length} 轮,含累积)】\n${c}\n【续】\n${s}` : `${C_}(${i.length} 轮)】\n${s}`,
|
|
14875
14935
|
timestamp: i[0].userMsg.timestamp
|
|
14876
14936
|
}
|
|
14877
14937
|
};
|
|
14878
14938
|
}
|
|
14879
14939
|
//#endregion
|
|
14880
14940
|
//#region src/core/composables/useContextManager.ts
|
|
14881
|
-
var
|
|
14941
|
+
var T_ = {
|
|
14882
14942
|
windowRounds: 6,
|
|
14883
14943
|
summaryThresholdRounds: 8,
|
|
14884
14944
|
toolResultMaxChars: 800,
|
|
14885
14945
|
enableRecall: !0,
|
|
14886
14946
|
recallTopK: 3,
|
|
14887
14947
|
enableLLMSummary: !1
|
|
14888
|
-
},
|
|
14889
|
-
function
|
|
14890
|
-
return e.toLowerCase().split(/[^a-z0-9\u4e00-\u9fa5]+/i).map((e) => e.trim()).filter((e) => e.length >= 2 && !
|
|
14948
|
+
}, E_ = /* @__PURE__ */ new Set(/* @__PURE__ */ "的.了.是.在.我.你.他.她.它.这.那.和.与.及.或.一个.什么.怎么.如何.为什么.可以.能.请.帮.一下.需要.想要.the.a.an.is.are.of.to.in.on".split("."));
|
|
14949
|
+
function D_(e) {
|
|
14950
|
+
return e.toLowerCase().split(/[^a-z0-9\u4e00-\u9fa5]+/i).map((e) => e.trim()).filter((e) => e.length >= 2 && !E_.has(e));
|
|
14891
14951
|
}
|
|
14892
|
-
function
|
|
14952
|
+
function O_(e) {
|
|
14893
14953
|
let t = typeof e.content == "string" ? e.content : "";
|
|
14894
14954
|
if (e.reasoning && (t += e.reasoning), e.steps) for (let n of e.steps) t += " " + (n.name || ""), n.args != null && (t += " " + (typeof n.args == "string" ? n.args : JSON.stringify(n.args))), n.result && (t += " " + n.result);
|
|
14895
|
-
return
|
|
14955
|
+
return tg(t);
|
|
14896
14956
|
}
|
|
14897
|
-
function
|
|
14898
|
-
let t =
|
|
14899
|
-
for (let n of e.assistantMsgs) t +=
|
|
14957
|
+
function k_(e) {
|
|
14958
|
+
let t = O_(e.userMsg);
|
|
14959
|
+
for (let n of e.assistantMsgs) t += O_(n);
|
|
14900
14960
|
return t;
|
|
14901
14961
|
}
|
|
14902
|
-
function
|
|
14962
|
+
function A_(e, t) {
|
|
14903
14963
|
return e.map((e) => {
|
|
14904
|
-
let n =
|
|
14964
|
+
let n = S_(e.userMsg.content, 60) || "(空)", r = e.assistantMsgs[0] ? S_(e.assistantMsgs[0].content, 80) : "(无回复)", i = e.assistantMsgs.flatMap((e) => (e.steps || []).map((e) => e.name)), a = i.length ? ` [工具: ${i.join(", ")}]` : "", o = "";
|
|
14905
14965
|
if (t && t.size) {
|
|
14906
14966
|
let n = [];
|
|
14907
|
-
for (let r of e.assistantMsgs) for (let e of r.steps || []) e.name && t.has(e.name) && e.result && n.push(`${e.name}: ${
|
|
14967
|
+
for (let r of e.assistantMsgs) for (let e of r.steps || []) e.name && t.has(e.name) && e.result && n.push(`${e.name}: ${S_(e.result, 120)}`);
|
|
14908
14968
|
n.length && (o = `\n 字段提示: ${n.join(" | ")}`);
|
|
14909
14969
|
}
|
|
14910
14970
|
return `- 第${e.round}轮:${n} → ${r}${a}${o}`;
|
|
14911
14971
|
}).join("\n");
|
|
14912
14972
|
}
|
|
14913
|
-
function
|
|
14914
|
-
let r =
|
|
14973
|
+
function j_(e, t, n) {
|
|
14974
|
+
let r = D_(t);
|
|
14915
14975
|
return r.length === 0 ? [] : e.map((e) => {
|
|
14916
14976
|
let t = (e.userMsg.content + " " + e.assistantMsgs.map((e) => e.content).join(" ")).toLowerCase(), n = 0;
|
|
14917
14977
|
for (let e of r) t.includes(e) && n++;
|
|
@@ -14921,13 +14981,13 @@ function x_(e, t, n) {
|
|
|
14921
14981
|
};
|
|
14922
14982
|
}).filter((e) => e.score > 0).sort((e, t) => t.score - e.score).slice(0, n).map((e) => e.r);
|
|
14923
14983
|
}
|
|
14924
|
-
function
|
|
14984
|
+
function M_(e = {}) {
|
|
14925
14985
|
let t = {
|
|
14926
|
-
...
|
|
14986
|
+
...T_,
|
|
14927
14987
|
...e
|
|
14928
14988
|
};
|
|
14929
14989
|
async function n(e) {
|
|
14930
|
-
let n =
|
|
14990
|
+
let n = x_(e), r = e.length, i = (t) => ({
|
|
14931
14991
|
messages: e,
|
|
14932
14992
|
stats: {
|
|
14933
14993
|
triggered: !1,
|
|
@@ -14940,9 +15000,9 @@ function S_(e = {}) {
|
|
|
14940
15000
|
}
|
|
14941
15001
|
}), a, o, s;
|
|
14942
15002
|
if (t.contextWindow && t.contextWindow > 0) {
|
|
14943
|
-
if (n.reduce((e, t) => e +
|
|
15003
|
+
if (n.reduce((e, t) => e + k_(t), 0) <= t.contextWindow * (t.summaryThresholdRatio ?? .5)) return i("none");
|
|
14944
15004
|
let e = t.contextWindow * (t.windowRatio ?? .4), r = 0, c = 0;
|
|
14945
|
-
for (let t = n.length - 1; t >= 0; t--) if (r +=
|
|
15005
|
+
for (let t = n.length - 1; t >= 0; t--) if (r += k_(n[t]), r >= e) {
|
|
14946
15006
|
c = t + 1;
|
|
14947
15007
|
break;
|
|
14948
15008
|
}
|
|
@@ -14955,12 +15015,12 @@ function S_(e = {}) {
|
|
|
14955
15015
|
}
|
|
14956
15016
|
let c = [...e].reverse().find((e) => e.role === "user")?.content || "", l = t.preserveLastToolResults?.length ? new Set(t.preserveLastToolResults) : void 0, u, d;
|
|
14957
15017
|
if (t.enableLLMSummary && t.llmInvoke) try {
|
|
14958
|
-
u = await t.llmInvoke(
|
|
15018
|
+
u = await t.llmInvoke(A_(o, l)), d = s + "llm_summary";
|
|
14959
15019
|
} catch {
|
|
14960
|
-
u =
|
|
15020
|
+
u = A_(o, l), d = s + "index_summary(llm_fallback)";
|
|
14961
15021
|
}
|
|
14962
|
-
else u =
|
|
14963
|
-
let f = t.enableRecall ?
|
|
15022
|
+
else u = A_(o, l), d = s + "index_summary";
|
|
15023
|
+
let f = t.enableRecall ? j_(o, c, t.recallTopK) : [], p = f.length ? f.map((e) => `- 第${e.round}轮:${S_(e.userMsg.content, 60)} → ${e.assistantMsgs[0] ? S_(e.assistantMsgs[0].content, 80) : ""}`).join("\n") : "", m = [`【对话历史摘要】以下是之前 ${o.length} 轮对话的要点(最新 ${a.length} 轮已完整保留):`, u];
|
|
14964
15024
|
if (p && m.push("\n【与当前问题可能相关的早期对话】", p), t.getRegisteredProps) try {
|
|
14965
15025
|
let e = t.getRegisteredProps();
|
|
14966
15026
|
if (e.length) {
|
|
@@ -14991,10 +15051,10 @@ function S_(e = {}) {
|
|
|
14991
15051
|
return {
|
|
14992
15052
|
compress: n,
|
|
14993
15053
|
config: t,
|
|
14994
|
-
trimToolResults:
|
|
15054
|
+
trimToolResults: N_
|
|
14995
15055
|
};
|
|
14996
15056
|
}
|
|
14997
|
-
function
|
|
15057
|
+
function N_(e, t) {
|
|
14998
15058
|
let n = [];
|
|
14999
15059
|
if (e.forEach((e, t) => {
|
|
15000
15060
|
e instanceof o && n.push(t);
|
|
@@ -15013,8 +15073,8 @@ function C_(e, t) {
|
|
|
15013
15073
|
}
|
|
15014
15074
|
//#endregion
|
|
15015
15075
|
//#region src/core/harness/summarization.ts
|
|
15016
|
-
function
|
|
15017
|
-
let t =
|
|
15076
|
+
function P_(e = {}) {
|
|
15077
|
+
let t = M_(e);
|
|
15018
15078
|
return {
|
|
15019
15079
|
name: "summarization",
|
|
15020
15080
|
compressInput: async (e) => {
|
|
@@ -15028,7 +15088,7 @@ function w_(e = {}) {
|
|
|
15028
15088
|
}
|
|
15029
15089
|
//#endregion
|
|
15030
15090
|
//#region src/core/presets.ts
|
|
15031
|
-
var
|
|
15091
|
+
var F_ = {
|
|
15032
15092
|
pageBuilder: { systemPrompt: "你是页面构建助手。流程:get_window_prop 读取当前页面结构 → set_window_prop / edit_window_prop 修改属性 → 页面实时更新。多步任务先用 write_todos 拆解,逐步推进。" },
|
|
15033
15093
|
researcher: {
|
|
15034
15094
|
systemPrompt: "你是调研助手。多路调研用 spawn_agents 并行委派子 agent(各负责一个方向);单份资料用 fetch_document 抓取;最后结构化汇总,给出结论与依据。",
|
|
@@ -15042,14 +15102,14 @@ var T_ = {
|
|
|
15042
15102
|
memory: !1,
|
|
15043
15103
|
subagent: !1
|
|
15044
15104
|
} }
|
|
15045
|
-
},
|
|
15105
|
+
}, I_ = { reliableWriteRules: [
|
|
15046
15106
|
"【可靠写入规则】",
|
|
15047
15107
|
"1. 改任何属性前,先用 get_window_prop 读其当前真实值,基于真实值改,不要凭记忆;",
|
|
15048
15108
|
"2. 若不确定可操作哪些属性,先 list_window_props 查看当前注册项(动态组件场景下注册表会增删,以工具返回为准,勿凭旧记忆);",
|
|
15049
15109
|
"3. 不确定某属性字段结构时,先 describe_window_prop 看其说明,字段以 describe 返回为准;",
|
|
15050
15110
|
"4. 写入若被 schema 校验拒绝(返回结构化错误含字段名与期望类型),按错误修正后重试,不要放弃;",
|
|
15051
15111
|
"5. 优先用 edit_window_prop 增量 patch(只发改动),避免 set 整体重传大 JSON 被截断。"
|
|
15052
|
-
].join("\n") },
|
|
15112
|
+
].join("\n") }, L_ = {
|
|
15053
15113
|
auto: {
|
|
15054
15114
|
summaryThresholdRatio: .5,
|
|
15055
15115
|
windowRatio: .4,
|
|
@@ -15071,8 +15131,8 @@ var T_ = {
|
|
|
15071
15131
|
enableLLMSummary: !0
|
|
15072
15132
|
}
|
|
15073
15133
|
};
|
|
15074
|
-
function
|
|
15075
|
-
let n =
|
|
15134
|
+
function R_(e, t) {
|
|
15135
|
+
let n = L_[e.contextPreset ?? "auto"] ?? {}, r = e.contextOptions === !1 ? {} : e.contextOptions ?? {};
|
|
15076
15136
|
return {
|
|
15077
15137
|
...n,
|
|
15078
15138
|
...r,
|
|
@@ -15089,7 +15149,7 @@ function $(e) {
|
|
|
15089
15149
|
};
|
|
15090
15150
|
return e.path !== void 0 && (t.path = e.path), e.hint && (t.hint = e.hint), e.details !== void 0 && (t.details = e.details), `ERROR: ${JSON.stringify(t)}`;
|
|
15091
15151
|
}
|
|
15092
|
-
function
|
|
15152
|
+
function z_(e) {
|
|
15093
15153
|
return e.slice(0, 10).map((e) => {
|
|
15094
15154
|
let t = e, n = {
|
|
15095
15155
|
path: (Array.isArray(t.path) ? t.path.join(".") : String(t.path ?? "")) || "(root)",
|
|
@@ -15098,16 +15158,16 @@ function k_(e) {
|
|
|
15098
15158
|
return t.expected !== void 0 && (n.expected = t.expected), t.received !== void 0 && (n.received = t.received), t.code !== void 0 && (n.code = t.code), n;
|
|
15099
15159
|
});
|
|
15100
15160
|
}
|
|
15101
|
-
function
|
|
15161
|
+
function B_(e, t) {
|
|
15102
15162
|
return $({
|
|
15103
15163
|
code: "SCHEMA_INVALID",
|
|
15104
15164
|
path: e,
|
|
15105
15165
|
message: `值不符合 "${e}" 的 schema(${t.length} 处问题)`,
|
|
15106
15166
|
hint: `按 describe_window_prop("${e}") 查看格式,修正后重试;改大对象优先用 edit_window_prop 增量 patch(只发改动部分)`,
|
|
15107
|
-
details:
|
|
15167
|
+
details: z_(t)
|
|
15108
15168
|
});
|
|
15109
15169
|
}
|
|
15110
|
-
function
|
|
15170
|
+
function V_(e, t, n) {
|
|
15111
15171
|
let r = n?.message || String(n);
|
|
15112
15172
|
return $({
|
|
15113
15173
|
code: "JSON_PARSE",
|
|
@@ -15116,18 +15176,18 @@ function j_(e, t, n) {
|
|
|
15116
15176
|
hint: `检查引号/逗号/括号是否闭合;字符串值需双引号包裹(如 '"dark"' 表示字符串 dark,数字直接写如 5);预览前 80 字符:${t.slice(0, 80)}`
|
|
15117
15177
|
});
|
|
15118
15178
|
}
|
|
15119
|
-
var
|
|
15120
|
-
function
|
|
15179
|
+
var H_ = .9;
|
|
15180
|
+
function U_(e, t = {}) {
|
|
15121
15181
|
let n = Object.create(null);
|
|
15122
|
-
if (e) for (let [t, r] of Object.entries(e)) n[
|
|
15182
|
+
if (e) for (let [t, r] of Object.entries(e)) n[K_(t)] = {
|
|
15123
15183
|
content: r,
|
|
15124
|
-
updatedAt:
|
|
15184
|
+
updatedAt: J_()
|
|
15125
15185
|
};
|
|
15126
15186
|
let { persist: r } = t, i = t.maxBytes ?? 4194304;
|
|
15127
15187
|
function a() {
|
|
15128
|
-
if (
|
|
15129
|
-
let e = i *
|
|
15130
|
-
for (let [r] of t) if (delete n[r],
|
|
15188
|
+
if (G_(n) <= i) return;
|
|
15189
|
+
let e = i * H_, t = Object.entries(n).sort((e, t) => e[1].updatedAt - t[1].updatedAt);
|
|
15190
|
+
for (let [r] of t) if (delete n[r], G_(n) <= e) break;
|
|
15131
15191
|
}
|
|
15132
15192
|
let o = null;
|
|
15133
15193
|
function s() {
|
|
@@ -15152,7 +15212,7 @@ function N_(e, t = {}) {
|
|
|
15152
15212
|
}
|
|
15153
15213
|
}) };
|
|
15154
15214
|
return r && (l.hydrate = (e) => {
|
|
15155
|
-
for (let [t, r] of Object.entries(e)) n[
|
|
15215
|
+
for (let [t, r] of Object.entries(e)) n[K_(t)] = r;
|
|
15156
15216
|
a();
|
|
15157
15217
|
}, l.flush = () => {
|
|
15158
15218
|
o &&= (clearTimeout(o), null), s();
|
|
@@ -15161,17 +15221,17 @@ function N_(e, t = {}) {
|
|
|
15161
15221
|
c();
|
|
15162
15222
|
}), l;
|
|
15163
15223
|
}
|
|
15164
|
-
var
|
|
15165
|
-
function
|
|
15166
|
-
|
|
15224
|
+
var W_ = null;
|
|
15225
|
+
function G_(e) {
|
|
15226
|
+
W_ ||= new TextEncoder();
|
|
15167
15227
|
let t = 0;
|
|
15168
|
-
for (let n of Object.values(e)) t +=
|
|
15228
|
+
for (let n of Object.values(e)) t += W_.encode(n.content).length;
|
|
15169
15229
|
return t;
|
|
15170
15230
|
}
|
|
15171
|
-
function
|
|
15231
|
+
function K_(e) {
|
|
15172
15232
|
return e.replace(/^\/+/, "").replace(/\/+/g, "/");
|
|
15173
15233
|
}
|
|
15174
|
-
function
|
|
15234
|
+
function q_(e) {
|
|
15175
15235
|
let t = "";
|
|
15176
15236
|
for (let n = 0; n < e.length; n++) {
|
|
15177
15237
|
let r = e[n];
|
|
@@ -15179,13 +15239,13 @@ function L_(e) {
|
|
|
15179
15239
|
}
|
|
15180
15240
|
return RegExp("^" + t + "$");
|
|
15181
15241
|
}
|
|
15182
|
-
function
|
|
15242
|
+
function J_() {
|
|
15183
15243
|
return Date.now();
|
|
15184
15244
|
}
|
|
15185
|
-
function
|
|
15245
|
+
function Y_(e) {
|
|
15186
15246
|
return [
|
|
15187
15247
|
n(async ({ path: t, offset: n, limit: r }) => {
|
|
15188
|
-
let i = e.files[
|
|
15248
|
+
let i = e.files[K_(t)];
|
|
15189
15249
|
if (!i) return $({
|
|
15190
15250
|
code: "NOT_FOUND",
|
|
15191
15251
|
path: t,
|
|
@@ -15203,9 +15263,9 @@ function z_(e) {
|
|
|
15203
15263
|
limit: t.number().int().min(1).default(2e3).describe("读取行数")
|
|
15204
15264
|
})
|
|
15205
15265
|
}),
|
|
15206
|
-
n(async ({ path: t, content: n }) => (e.files[
|
|
15266
|
+
n(async ({ path: t, content: n }) => (e.files[K_(t)] = {
|
|
15207
15267
|
content: n,
|
|
15208
|
-
updatedAt:
|
|
15268
|
+
updatedAt: J_()
|
|
15209
15269
|
}, `已写入 ${t}(${n.length} 字符)`), {
|
|
15210
15270
|
name: "vfs_write",
|
|
15211
15271
|
description: "写入/覆盖虚拟工作区文件,作为中间工作记忆。",
|
|
@@ -15215,7 +15275,7 @@ function z_(e) {
|
|
|
15215
15275
|
})
|
|
15216
15276
|
}),
|
|
15217
15277
|
n(async ({ path: t, oldString: n, newString: r }) => {
|
|
15218
|
-
let i =
|
|
15278
|
+
let i = K_(t), a = e.files[i];
|
|
15219
15279
|
if (!a) return $({
|
|
15220
15280
|
code: "NOT_FOUND",
|
|
15221
15281
|
path: t,
|
|
@@ -15245,7 +15305,7 @@ function z_(e) {
|
|
|
15245
15305
|
}
|
|
15246
15306
|
return e.files[i] = {
|
|
15247
15307
|
content: a.content.replace(n, r),
|
|
15248
|
-
updatedAt:
|
|
15308
|
+
updatedAt: J_()
|
|
15249
15309
|
}, `已替换 ${t} 中 1 处。`;
|
|
15250
15310
|
}, {
|
|
15251
15311
|
name: "vfs_edit",
|
|
@@ -15267,7 +15327,7 @@ function z_(e) {
|
|
|
15267
15327
|
n(async ({ pattern: t }) => {
|
|
15268
15328
|
let n;
|
|
15269
15329
|
try {
|
|
15270
|
-
n =
|
|
15330
|
+
n = q_(t);
|
|
15271
15331
|
} catch (e) {
|
|
15272
15332
|
return $({
|
|
15273
15333
|
code: "GLOB_INVALID",
|
|
@@ -15296,7 +15356,7 @@ function z_(e) {
|
|
|
15296
15356
|
details: { pattern: t }
|
|
15297
15357
|
});
|
|
15298
15358
|
}
|
|
15299
|
-
let i = n ? [
|
|
15359
|
+
let i = n ? [K_(n)] : Object.keys(e.files), a = [];
|
|
15300
15360
|
for (let t of i) {
|
|
15301
15361
|
let n = e.files[t];
|
|
15302
15362
|
n && n.content.split("\n").forEach((e, n) => {
|
|
@@ -15314,17 +15374,17 @@ function z_(e) {
|
|
|
15314
15374
|
})
|
|
15315
15375
|
];
|
|
15316
15376
|
}
|
|
15317
|
-
function
|
|
15377
|
+
function X_(e) {
|
|
15318
15378
|
return {
|
|
15319
15379
|
name: "vfs",
|
|
15320
|
-
tools:
|
|
15380
|
+
tools: Y_(e),
|
|
15321
15381
|
beforeAgent: () => ({ files: e.files })
|
|
15322
15382
|
};
|
|
15323
15383
|
}
|
|
15324
15384
|
//#endregion
|
|
15325
15385
|
//#region src/core/tools/windowQuery.ts
|
|
15326
|
-
var
|
|
15327
|
-
function
|
|
15386
|
+
var Z_ = /[\w$-]/;
|
|
15387
|
+
function Q_(e) {
|
|
15328
15388
|
let t = [], n = e.trim(), r = +(n[0] === "$");
|
|
15329
15389
|
for (; r < n.length;) {
|
|
15330
15390
|
let e = n[r];
|
|
@@ -15335,7 +15395,7 @@ function H_(e) {
|
|
|
15335
15395
|
continue;
|
|
15336
15396
|
}
|
|
15337
15397
|
let e = "";
|
|
15338
|
-
for (; r < n.length &&
|
|
15398
|
+
for (; r < n.length && Z_.test(n[r]);) e += n[r++];
|
|
15339
15399
|
if (!e) throw Error("JSONPath: .. 后缺属性名");
|
|
15340
15400
|
t.push({
|
|
15341
15401
|
type: "descendKey",
|
|
@@ -15348,7 +15408,7 @@ function H_(e) {
|
|
|
15348
15408
|
continue;
|
|
15349
15409
|
}
|
|
15350
15410
|
let e = "";
|
|
15351
|
-
for (; r < n.length &&
|
|
15411
|
+
for (; r < n.length && Z_.test(n[r]);) e += n[r++];
|
|
15352
15412
|
if (!e) throw Error("JSONPath: . 后缺属性名");
|
|
15353
15413
|
t.push({
|
|
15354
15414
|
type: "key",
|
|
@@ -15404,7 +15464,7 @@ function H_(e) {
|
|
|
15404
15464
|
}
|
|
15405
15465
|
return t;
|
|
15406
15466
|
}
|
|
15407
|
-
function
|
|
15467
|
+
function $_(e) {
|
|
15408
15468
|
let t = [], n = 0, r = e.trim();
|
|
15409
15469
|
for (; n < r.length;) {
|
|
15410
15470
|
let e = r[n];
|
|
@@ -15449,7 +15509,7 @@ function U_(e) {
|
|
|
15449
15509
|
}
|
|
15450
15510
|
return t;
|
|
15451
15511
|
}
|
|
15452
|
-
var
|
|
15512
|
+
var ev = class {
|
|
15453
15513
|
toks;
|
|
15454
15514
|
item;
|
|
15455
15515
|
pos = 0;
|
|
@@ -15485,12 +15545,12 @@ var W_ = class {
|
|
|
15485
15545
|
return this.next(), e;
|
|
15486
15546
|
}
|
|
15487
15547
|
let e = this.operand(), t = this.peek();
|
|
15488
|
-
return t === "==" || t === "!=" || t === "<" || t === "<=" || t === ">" || t === ">=" ? (this.next(),
|
|
15548
|
+
return t === "==" || t === "!=" || t === "<" || t === "<=" || t === ">" || t === ">=" ? (this.next(), rv(t, e, this.operand())) : tv(e);
|
|
15489
15549
|
}
|
|
15490
15550
|
operand() {
|
|
15491
15551
|
let e = this.next();
|
|
15492
15552
|
if (e === void 0) throw Error("过滤表达式:缺操作数");
|
|
15493
|
-
if (e.startsWith("@")) return
|
|
15553
|
+
if (e.startsWith("@")) return nv(e, this.item);
|
|
15494
15554
|
if (e[0] === "'" || e[0] === "\"") return e.slice(1, -1);
|
|
15495
15555
|
if (e === "true") return !0;
|
|
15496
15556
|
if (e === "false") return !1;
|
|
@@ -15500,10 +15560,10 @@ var W_ = class {
|
|
|
15500
15560
|
throw Error(`过滤表达式:未知操作数 '${e}'`);
|
|
15501
15561
|
}
|
|
15502
15562
|
};
|
|
15503
|
-
function
|
|
15563
|
+
function tv(e) {
|
|
15504
15564
|
return !!e && e !== 0 && e !== "" && e !== null;
|
|
15505
15565
|
}
|
|
15506
|
-
function
|
|
15566
|
+
function nv(e, t) {
|
|
15507
15567
|
let n = e.split(".").filter((e) => e && e !== "@"), r = t;
|
|
15508
15568
|
for (let e of n) {
|
|
15509
15569
|
if (typeof r != "object" || !r) return;
|
|
@@ -15511,7 +15571,7 @@ function K_(e, t) {
|
|
|
15511
15571
|
}
|
|
15512
15572
|
return r;
|
|
15513
15573
|
}
|
|
15514
|
-
function
|
|
15574
|
+
function rv(e, t, n) {
|
|
15515
15575
|
switch (e) {
|
|
15516
15576
|
case "==": return t === n;
|
|
15517
15577
|
case "!=": return t !== n;
|
|
@@ -15522,47 +15582,47 @@ function q_(e, t, n) {
|
|
|
15522
15582
|
default: return !1;
|
|
15523
15583
|
}
|
|
15524
15584
|
}
|
|
15525
|
-
function
|
|
15526
|
-
return new
|
|
15585
|
+
function iv(e, t) {
|
|
15586
|
+
return new ev($_(e), t).parse();
|
|
15527
15587
|
}
|
|
15528
|
-
function
|
|
15588
|
+
function av(e, t) {
|
|
15529
15589
|
return e ? `${e}.${t}` : String(t);
|
|
15530
15590
|
}
|
|
15531
|
-
function
|
|
15591
|
+
function ov(e, t) {
|
|
15532
15592
|
let n = [{
|
|
15533
15593
|
path: "",
|
|
15534
15594
|
value: e
|
|
15535
15595
|
}];
|
|
15536
|
-
for (let e of
|
|
15596
|
+
for (let e of Q_(t)) {
|
|
15537
15597
|
let t = [];
|
|
15538
15598
|
if (e.type === "key") for (let r of n) r.value != null && typeof r.value == "object" && e.key in r.value && t.push({
|
|
15539
|
-
path:
|
|
15599
|
+
path: av(r.path, e.key),
|
|
15540
15600
|
value: r.value[e.key]
|
|
15541
15601
|
});
|
|
15542
15602
|
else if (e.type === "index") {
|
|
15543
15603
|
for (let r of n) if (Array.isArray(r.value)) {
|
|
15544
15604
|
let n = r.value[e.index];
|
|
15545
15605
|
e.index >= 0 && e.index < r.value.length && t.push({
|
|
15546
|
-
path:
|
|
15606
|
+
path: av(r.path, e.index),
|
|
15547
15607
|
value: n,
|
|
15548
15608
|
index: e.index
|
|
15549
15609
|
});
|
|
15550
15610
|
}
|
|
15551
15611
|
} else if (e.type === "wildcard") {
|
|
15552
15612
|
for (let e of n) if (Array.isArray(e.value)) e.value.forEach((n, r) => t.push({
|
|
15553
|
-
path:
|
|
15613
|
+
path: av(e.path, r),
|
|
15554
15614
|
value: n,
|
|
15555
15615
|
index: r
|
|
15556
15616
|
}));
|
|
15557
15617
|
else if (e.value != null && typeof e.value == "object") for (let n of Object.keys(e.value)) t.push({
|
|
15558
|
-
path:
|
|
15618
|
+
path: av(e.path, n),
|
|
15559
15619
|
value: e.value[n]
|
|
15560
15620
|
});
|
|
15561
15621
|
} else if (e.type === "descendKey") {
|
|
15562
15622
|
let r = e.key, i = (e) => {
|
|
15563
15623
|
if (!(e.value == null || typeof e.value != "object")) for (let n of Object.keys(e.value)) {
|
|
15564
15624
|
let a = {
|
|
15565
|
-
path:
|
|
15625
|
+
path: av(e.path, n),
|
|
15566
15626
|
value: e.value[n]
|
|
15567
15627
|
};
|
|
15568
15628
|
n === r && t.push(a), i(a);
|
|
@@ -15573,7 +15633,7 @@ function X_(e, t) {
|
|
|
15573
15633
|
let e = (n) => {
|
|
15574
15634
|
if (!(n.value == null || typeof n.value != "object")) for (let r of Object.keys(n.value)) {
|
|
15575
15635
|
let i = {
|
|
15576
|
-
path:
|
|
15636
|
+
path: av(n.path, r),
|
|
15577
15637
|
value: n.value[r]
|
|
15578
15638
|
};
|
|
15579
15639
|
t.push(i), e(i);
|
|
@@ -15582,16 +15642,16 @@ function X_(e, t) {
|
|
|
15582
15642
|
for (let t of n) e(t);
|
|
15583
15643
|
} else if (e.type === "filter") {
|
|
15584
15644
|
for (let r of n) if (Array.isArray(r.value)) r.value.forEach((n, i) => {
|
|
15585
|
-
|
|
15586
|
-
path:
|
|
15645
|
+
iv(e.filter, n) && t.push({
|
|
15646
|
+
path: av(r.path, i),
|
|
15587
15647
|
value: n,
|
|
15588
15648
|
index: i
|
|
15589
15649
|
});
|
|
15590
15650
|
});
|
|
15591
15651
|
else if (r.value != null && typeof r.value == "object") for (let n of Object.keys(r.value)) {
|
|
15592
15652
|
let i = r.value[n];
|
|
15593
|
-
|
|
15594
|
-
path:
|
|
15653
|
+
iv(e.filter, i) && t.push({
|
|
15654
|
+
path: av(r.path, n),
|
|
15595
15655
|
value: i
|
|
15596
15656
|
});
|
|
15597
15657
|
}
|
|
@@ -15600,7 +15660,7 @@ function X_(e, t) {
|
|
|
15600
15660
|
}
|
|
15601
15661
|
return n;
|
|
15602
15662
|
}
|
|
15603
|
-
function
|
|
15663
|
+
function sv(e, t) {
|
|
15604
15664
|
let n = e.length, r = t.length;
|
|
15605
15665
|
if (!n) return r;
|
|
15606
15666
|
if (!r) return n;
|
|
@@ -15616,7 +15676,7 @@ function Z_(e, t) {
|
|
|
15616
15676
|
}
|
|
15617
15677
|
return i[r];
|
|
15618
15678
|
}
|
|
15619
|
-
function
|
|
15679
|
+
function cv(e, t, n = {}) {
|
|
15620
15680
|
let r = n.mode || "substring", i = n.limit ?? 50, a = n.matchKey !== !1, o = [], s = null;
|
|
15621
15681
|
if (r === "regex") try {
|
|
15622
15682
|
s = new RegExp(t, "i");
|
|
@@ -15626,11 +15686,11 @@ function Q_(e, t, n = {}) {
|
|
|
15626
15686
|
let c = (e, l, u) => {
|
|
15627
15687
|
if (o.length >= i || e == null) return;
|
|
15628
15688
|
if (typeof e == "object") {
|
|
15629
|
-
if (Array.isArray(e)) e.forEach((e, t) => c(e,
|
|
15630
|
-
else for (let t of Object.keys(e)) c(e[t],
|
|
15689
|
+
if (Array.isArray(e)) e.forEach((e, t) => c(e, av(l, t), String(t)));
|
|
15690
|
+
else for (let t of Object.keys(e)) c(e[t], av(l, t), t);
|
|
15631
15691
|
return;
|
|
15632
15692
|
}
|
|
15633
|
-
let d = String(e), f =
|
|
15693
|
+
let d = String(e), f = lv(d, t, r, n.fuzzyThreshold ?? 2, s);
|
|
15634
15694
|
if (f) {
|
|
15635
15695
|
o.push({
|
|
15636
15696
|
path: l,
|
|
@@ -15641,7 +15701,7 @@ function Q_(e, t, n = {}) {
|
|
|
15641
15701
|
return;
|
|
15642
15702
|
}
|
|
15643
15703
|
if (a && u) {
|
|
15644
|
-
let e =
|
|
15704
|
+
let e = lv(u, t, r, n.fuzzyThreshold ?? 2, s);
|
|
15645
15705
|
e && o.push({
|
|
15646
15706
|
path: l,
|
|
15647
15707
|
key: u,
|
|
@@ -15652,18 +15712,18 @@ function Q_(e, t, n = {}) {
|
|
|
15652
15712
|
};
|
|
15653
15713
|
return c(e, ""), o;
|
|
15654
15714
|
}
|
|
15655
|
-
function
|
|
15715
|
+
function lv(e, t, n, r, i) {
|
|
15656
15716
|
let a = e.toLowerCase(), o = t.toLowerCase();
|
|
15657
15717
|
if (n === "substring") return a.includes(o) ? 1 : null;
|
|
15658
15718
|
if (n === "regex") return i && i.test(e) ? 1 : null;
|
|
15659
15719
|
if (n === "fuzzy") {
|
|
15660
15720
|
if (a.includes(o)) return 2;
|
|
15661
|
-
let e =
|
|
15721
|
+
let e = sv(a, o);
|
|
15662
15722
|
return e <= r ? r - e + 1 : null;
|
|
15663
15723
|
}
|
|
15664
15724
|
return null;
|
|
15665
15725
|
}
|
|
15666
|
-
var
|
|
15726
|
+
var uv = [
|
|
15667
15727
|
"self.fetch = () => { throw new Error('fetch 已被沙箱禁用') }",
|
|
15668
15728
|
"self.XMLHttpRequest = function(){ throw new Error('XMLHttpRequest 已被沙箱禁用') }",
|
|
15669
15729
|
"self.importScripts = () => { throw new Error('importScripts 已被沙箱禁用') }",
|
|
@@ -15676,7 +15736,7 @@ var ev = [
|
|
|
15676
15736
|
"try { self.BroadcastChannel = undefined } catch {}",
|
|
15677
15737
|
"if (self.navigator && self.navigator.sendBeacon) self.navigator.sendBeacon = () => { throw new Error('sendBeacon 已被沙箱禁用') }"
|
|
15678
15738
|
].join("\n");
|
|
15679
|
-
function
|
|
15739
|
+
function dv(e, t, n = 3e3) {
|
|
15680
15740
|
return new Promise((r) => {
|
|
15681
15741
|
let i = Date.now(), a = !1, o = (e) => {
|
|
15682
15742
|
if (!a) {
|
|
@@ -15689,7 +15749,7 @@ function tv(e, t, n = 3e3) {
|
|
|
15689
15749
|
elapsedMs: Date.now() - i
|
|
15690
15750
|
});
|
|
15691
15751
|
}
|
|
15692
|
-
}, s =
|
|
15752
|
+
}, s = uv + "\nself.onmessage = async (e) => {\n try {\n const fn = new Function(\"data\", e.data.script);\n let result = fn(e.data.data);\n if (result && typeof result.then === \"function\") result = await result;\n self.postMessage({ ok: true, result });\n } catch (err) {\n self.postMessage({ ok: false, error: String((err && err.message) || err) });\n }\n};", c, l;
|
|
15693
15753
|
try {
|
|
15694
15754
|
let e = new Blob([s], { type: "application/javascript" });
|
|
15695
15755
|
c = URL.createObjectURL(e), l = new Worker(c);
|
|
@@ -15724,19 +15784,19 @@ function tv(e, t, n = 3e3) {
|
|
|
15724
15784
|
}
|
|
15725
15785
|
//#endregion
|
|
15726
15786
|
//#region src/core/tools/windowOps.ts
|
|
15727
|
-
var
|
|
15787
|
+
var fv = /* @__PURE__ */ new Set([
|
|
15728
15788
|
"__proto__",
|
|
15729
15789
|
"constructor",
|
|
15730
15790
|
"prototype"
|
|
15731
15791
|
]);
|
|
15732
|
-
function
|
|
15733
|
-
return e.split(".").some((e) =>
|
|
15792
|
+
function pv(e) {
|
|
15793
|
+
return e.split(".").some((e) => fv.has(e));
|
|
15734
15794
|
}
|
|
15735
|
-
function
|
|
15736
|
-
if (!(!t || typeof t != "object" || Array.isArray(t))) for (let n of Object.keys(t))
|
|
15795
|
+
function mv(e, t) {
|
|
15796
|
+
if (!(!t || typeof t != "object" || Array.isArray(t))) for (let n of Object.keys(t)) fv.has(n) || (e[n] = t[n]);
|
|
15737
15797
|
}
|
|
15738
|
-
function
|
|
15739
|
-
if (
|
|
15798
|
+
function hv(e, t) {
|
|
15799
|
+
if (pv(t)) return;
|
|
15740
15800
|
let n = t.split("."), r = e;
|
|
15741
15801
|
for (let e of n) {
|
|
15742
15802
|
if (r == null) return;
|
|
@@ -15744,8 +15804,8 @@ function av(e, t) {
|
|
|
15744
15804
|
}
|
|
15745
15805
|
return r;
|
|
15746
15806
|
}
|
|
15747
|
-
function
|
|
15748
|
-
if (
|
|
15807
|
+
function gv(e, t, n) {
|
|
15808
|
+
if (pv(t)) return;
|
|
15749
15809
|
let r = t.split("."), i = e;
|
|
15750
15810
|
for (let e = 0; e < r.length - 1; e++) {
|
|
15751
15811
|
let t = r[e];
|
|
@@ -15753,8 +15813,8 @@ function ov(e, t, n) {
|
|
|
15753
15813
|
}
|
|
15754
15814
|
i[r[r.length - 1]] = n;
|
|
15755
15815
|
}
|
|
15756
|
-
function
|
|
15757
|
-
if (
|
|
15816
|
+
function _v(e, t) {
|
|
15817
|
+
if (pv(t)) return !1;
|
|
15758
15818
|
let n = t.split("."), r = e;
|
|
15759
15819
|
for (let e = 0; e < n.length - 1; e++) {
|
|
15760
15820
|
if (r == null) return !1;
|
|
@@ -15763,10 +15823,10 @@ function sv(e, t) {
|
|
|
15763
15823
|
let i = n[n.length - 1];
|
|
15764
15824
|
return r == null || !(i in r) ? !1 : (delete r[i], !0);
|
|
15765
15825
|
}
|
|
15766
|
-
function
|
|
15826
|
+
function vv(e) {
|
|
15767
15827
|
return e === void 0 ? void 0 : JSON.parse(JSON.stringify(e));
|
|
15768
15828
|
}
|
|
15769
|
-
function
|
|
15829
|
+
function yv(e, t = Infinity) {
|
|
15770
15830
|
let n = /* @__PURE__ */ new WeakSet(), r;
|
|
15771
15831
|
try {
|
|
15772
15832
|
r = JSON.stringify(e, (e, t) => {
|
|
@@ -15785,35 +15845,35 @@ function lv(e, t = Infinity) {
|
|
|
15785
15845
|
}
|
|
15786
15846
|
return r.length > t && (r = r.slice(0, t) + `\n…[已截断,原长度 ${r.length}]`), r;
|
|
15787
15847
|
}
|
|
15788
|
-
function
|
|
15789
|
-
let t =
|
|
15848
|
+
function bv(e) {
|
|
15849
|
+
let t = yv(e), n = 5381;
|
|
15790
15850
|
for (let e = 0; e < t.length; e++) n = (n << 5) + n + t.charCodeAt(e) >>> 0;
|
|
15791
15851
|
return n.toString(36);
|
|
15792
15852
|
}
|
|
15793
|
-
function
|
|
15794
|
-
if (t === "set") return n ? (
|
|
15795
|
-
if (t === "remove") return n ? (
|
|
15853
|
+
function xv(e, t, n, r) {
|
|
15854
|
+
if (t === "set") return n ? (gv(e, n, r), null) : "set 操作需要 jsonPath(整体替换请用 set_window_prop)";
|
|
15855
|
+
if (t === "remove") return n ? (_v(e, n), null) : "remove 操作需要 jsonPath";
|
|
15796
15856
|
if (t === "merge") {
|
|
15797
|
-
let t = n ?
|
|
15798
|
-
return typeof t != "object" || !t || Array.isArray(t) ? `merge 目标${n ? `(${n})` : "(根)"}不是对象` : (
|
|
15857
|
+
let t = n ? hv(e, n) : e;
|
|
15858
|
+
return typeof t != "object" || !t || Array.isArray(t) ? `merge 目标${n ? `(${n})` : "(根)"}不是对象` : (mv(t, r), null);
|
|
15799
15859
|
}
|
|
15800
|
-
let i = n ?
|
|
15860
|
+
let i = n ? hv(e, n) : e;
|
|
15801
15861
|
return Array.isArray(i) ? (Array.isArray(r) ? i.push(...r) : i.push(r), null) : `append 目标${n ? `(${n})` : "(根)"}不是数组`;
|
|
15802
15862
|
}
|
|
15803
|
-
function
|
|
15804
|
-
if (t === "set")
|
|
15805
|
-
else if (t === "remove")
|
|
15806
|
-
else if (t === "merge")
|
|
15863
|
+
function Sv(e, t, n, r) {
|
|
15864
|
+
if (t === "set") gv(window, `${e}.${n}`, r);
|
|
15865
|
+
else if (t === "remove") _v(window, `${e}.${n}`);
|
|
15866
|
+
else if (t === "merge") mv(n ? hv(window, `${e}.${n}`) : hv(window, e), r);
|
|
15807
15867
|
else {
|
|
15808
|
-
let t = n ?
|
|
15868
|
+
let t = n ? hv(window, `${e}.${n}`) : hv(window, e);
|
|
15809
15869
|
Array.isArray(r) ? t.push(...r) : t.push(r);
|
|
15810
15870
|
}
|
|
15811
15871
|
}
|
|
15812
|
-
function
|
|
15813
|
-
let n =
|
|
15814
|
-
typeof n == "object" && n ?
|
|
15872
|
+
function Cv(e, t) {
|
|
15873
|
+
let n = hv(window, e);
|
|
15874
|
+
typeof n == "object" && n ? wv(n, t) : gv(window, e, t);
|
|
15815
15875
|
}
|
|
15816
|
-
function
|
|
15876
|
+
function wv(e, t) {
|
|
15817
15877
|
if (Array.isArray(e)) {
|
|
15818
15878
|
e.length = 0, Array.isArray(t) && e.push(...t);
|
|
15819
15879
|
return;
|
|
@@ -15822,7 +15882,7 @@ function mv(e, t) {
|
|
|
15822
15882
|
for (let t of Object.keys(e)) t in n || delete e[t];
|
|
15823
15883
|
for (let t of Object.keys(n)) e[t] = n[t];
|
|
15824
15884
|
}
|
|
15825
|
-
function
|
|
15885
|
+
function Tv(e, r = {}) {
|
|
15826
15886
|
let i = /* @__PURE__ */ new Map();
|
|
15827
15887
|
for (let t of e) i.set(t.path, t);
|
|
15828
15888
|
let a = /* @__PURE__ */ new Map(), o = r.maxSnapshots ?? 20, s = {
|
|
@@ -15849,7 +15909,7 @@ function hv(e, r = {}) {
|
|
|
15849
15909
|
return r.allowRawRead ? !0 : [...i.keys()].some((t) => e === t || e.startsWith(t + ".") || u && t.startsWith(e + "."));
|
|
15850
15910
|
}
|
|
15851
15911
|
function f(e, t, n) {
|
|
15852
|
-
let r =
|
|
15912
|
+
let r = vv(hv(window, e)), i = a.get(e) || [], s = i.length ? i[i.length - 1].id + 1 : 1;
|
|
15853
15913
|
for (i.push({
|
|
15854
15914
|
id: s,
|
|
15855
15915
|
ts: Date.now(),
|
|
@@ -15859,7 +15919,37 @@ function hv(e, r = {}) {
|
|
|
15859
15919
|
}); i.length > o;) i.shift();
|
|
15860
15920
|
return a.set(e, i), s;
|
|
15861
15921
|
}
|
|
15862
|
-
|
|
15922
|
+
async function p(e, t, n, i) {
|
|
15923
|
+
if (!n || n === "") return null;
|
|
15924
|
+
let o = hv(window, e), s = bv(o);
|
|
15925
|
+
if (s === n) return null;
|
|
15926
|
+
if (!r.onConflict) return $({
|
|
15927
|
+
code: "VERSION_CONFLICT",
|
|
15928
|
+
path: e,
|
|
15929
|
+
message: `乐观锁冲突:expectedHash=${n} 但当前 hash=${s}。属性 "${e}" 在你 get 之后已被修改(外部代码/其他 agent/用户手动改)。`,
|
|
15930
|
+
hint: `重新 get_window_prop("${e}") 拿最新值与 hash,基于最新值修改后再写入(传新的 expectedHash)。当前值:${yv(o, 400)}`
|
|
15931
|
+
});
|
|
15932
|
+
let c = await r.onConflict({
|
|
15933
|
+
path: e,
|
|
15934
|
+
op: t,
|
|
15935
|
+
agentValue: i,
|
|
15936
|
+
currentValue: o,
|
|
15937
|
+
currentHash: s,
|
|
15938
|
+
expectedHash: n,
|
|
15939
|
+
snapshotId: 0
|
|
15940
|
+
});
|
|
15941
|
+
if (c.action === "keep_external") return `已保留外部修改(未写入)。当前值:${yv(o, 400)} (hash=${s})。请重新 get_window_prop("${e}") 拿最新值与 hash 再改。`;
|
|
15942
|
+
if (c.action === "restore") {
|
|
15943
|
+
let t = a.get(e) || [];
|
|
15944
|
+
if (!t.length) return `无历史快照可回退(本次为首次操作)。当前值:${yv(o, 400)} (hash=${s})。请重新 get 再改或选「强制覆盖」。`;
|
|
15945
|
+
let n = t[t.length - 1];
|
|
15946
|
+
Cv(e, vv(n.value));
|
|
15947
|
+
let r = hv(window, e);
|
|
15948
|
+
return `已回退 ${e} 到历史快照 #${n.id}[${n.op}]。当前值:${yv(r, 400)} (hash=${bv(r)})。请基于回退后的值重写或停止。`;
|
|
15949
|
+
}
|
|
15950
|
+
return null;
|
|
15951
|
+
}
|
|
15952
|
+
let m = n(async () => {
|
|
15863
15953
|
if (!i.size) return "当前没有已注册的可操作 window 属性。";
|
|
15864
15954
|
let e = [...i.values()].map((e) => `- ${e.path}: ${e.description}`);
|
|
15865
15955
|
return `可操作的 window 属性(共 ${i.size} 项):\n${e.join("\n")}`;
|
|
@@ -15867,7 +15957,7 @@ function hv(e, r = {}) {
|
|
|
15867
15957
|
name: "list_window_props",
|
|
15868
15958
|
description: "列出所有已注册、可操作的 window 属性(path + 说明)。操作 window 前先调用此工具了解可用范围。",
|
|
15869
15959
|
schema: t.object({})
|
|
15870
|
-
}),
|
|
15960
|
+
}), h = n(async ({ path: e }) => {
|
|
15871
15961
|
let t = i.get(e);
|
|
15872
15962
|
return t ? [
|
|
15873
15963
|
`路径: ${t.path}`,
|
|
@@ -15883,20 +15973,20 @@ function hv(e, r = {}) {
|
|
|
15883
15973
|
name: "describe_window_prop",
|
|
15884
15974
|
description: "获取单个已注册 window 属性的说明与格式要求。",
|
|
15885
15975
|
schema: t.object({ path: t.string().describe("属性路径,如 app.theme") })
|
|
15886
|
-
}),
|
|
15976
|
+
}), g = n(async ({ path: e }) => {
|
|
15887
15977
|
if (!d(e)) return $({
|
|
15888
15978
|
code: "NOT_REGISTERED",
|
|
15889
15979
|
path: e,
|
|
15890
15980
|
message: `属性 "${e}" 不可读取(未注册,且非已注册路径的后代)`,
|
|
15891
15981
|
hint: "用 list_window_props 查看可操作字段;字段白名单读模式下未注册的祖先(整体大 JSON)不暴露,需读其声明子路径"
|
|
15892
15982
|
});
|
|
15893
|
-
let t =
|
|
15894
|
-
return t === void 0 ? `${e} = (undefined)` : `${e} = ${
|
|
15983
|
+
let t = hv(window, e);
|
|
15984
|
+
return t === void 0 ? `${e} = (undefined)` : `${e} = ${yv(t)} (hash=${bv(t)})`;
|
|
15895
15985
|
}, {
|
|
15896
15986
|
name: "get_window_prop",
|
|
15897
15987
|
description: "读取一个已注册 window 属性的当前值(安全序列化:函数/DOM/循环引用做摘要;大结果由系统自动外存,提示用 vfs_read 回读)。返回含 hash(乐观锁):改属性前先 get 拿 hash,写入时(set/edit/delete)传 expectedHash 回传,系统对比当前 hash 防\"基于过期值覆盖\"(外部代码/其他 agent/用户手动改过会 CONFLICT,需重新 get 再改)。字段白名单读模式(默认)下仅可读注册 path 自身/后代;未注册祖先(整体大 JSON)不可读,避免大 JSON 拉进上下文。",
|
|
15898
15988
|
schema: t.object({ path: t.string().describe("已注册的属性路径或其后代") })
|
|
15899
|
-
}),
|
|
15989
|
+
}), _ = n(async ({ path: e, value: t, expectedHash: n }) => {
|
|
15900
15990
|
let r = i.get(e);
|
|
15901
15991
|
if (!r) return $({
|
|
15902
15992
|
code: "NOT_REGISTERED",
|
|
@@ -15904,31 +15994,24 @@ function hv(e, r = {}) {
|
|
|
15904
15994
|
message: `属性 "${e}" 未在注册表中声明,不可写`,
|
|
15905
15995
|
hint: "用 list_window_props 查看可用属性;集成方需先在 windowProps 声明该 path"
|
|
15906
15996
|
});
|
|
15907
|
-
|
|
15908
|
-
|
|
15909
|
-
|
|
15910
|
-
code: "VERSION_CONFLICT",
|
|
15911
|
-
path: e,
|
|
15912
|
-
message: `乐观锁冲突:expectedHash=${n} 但当前 hash=${r},属性 "${e}" 在你 get 之后已被修改(外部代码/其他 agent/用户手动改)`,
|
|
15913
|
-
hint: `重新 get_window_prop("${e}") 拿最新值与 hash,基于最新值修改后再写入(传新的 expectedHash)。当前值:${lv(t, 400)}`
|
|
15914
|
-
});
|
|
15915
|
-
}
|
|
15916
|
-
let a;
|
|
15997
|
+
let a = await p(e, "set", n);
|
|
15998
|
+
if (a !== null) return a;
|
|
15999
|
+
let o;
|
|
15917
16000
|
try {
|
|
15918
|
-
|
|
16001
|
+
o = JSON.parse(t);
|
|
15919
16002
|
} catch (n) {
|
|
15920
|
-
return
|
|
16003
|
+
return V_(e, t, n);
|
|
15921
16004
|
}
|
|
15922
|
-
let
|
|
15923
|
-
if (!
|
|
16005
|
+
let s = r.schema.safeParse(o);
|
|
16006
|
+
if (!s.success) return B_(e, s.error.issues);
|
|
15924
16007
|
f(e, "set");
|
|
15925
|
-
let
|
|
15926
|
-
return typeof
|
|
16008
|
+
let u = hv(window, e);
|
|
16009
|
+
return typeof u == "object" && u && s.data !== null && typeof s.data == "object" ? wv(u, s.data) : gv(window, e, s.data), c({
|
|
15927
16010
|
op: "set",
|
|
15928
16011
|
path: e,
|
|
15929
|
-
value:
|
|
16012
|
+
value: s.data,
|
|
15930
16013
|
timestamp: Date.now()
|
|
15931
|
-
}), `已设置 ${e} = ${
|
|
16014
|
+
}), `已设置 ${e} = ${yv(s.data, 600)} (新 hash=${bv(hv(window, e))})${l()}`;
|
|
15932
16015
|
}, {
|
|
15933
16016
|
name: "set_window_prop",
|
|
15934
16017
|
description: "设置一个已注册 window 属性的值(整体替换)。仅能操作注册表内声明的属性;value 为 JSON 字符串,需通过该属性声明的 schema 校验。校验失败会返回错误而非写入。expectedHash(可选):改前 get_window_prop 返回的 hash,传入则启用乐观锁——若属性已被改过(外部代码/其他 agent/用户手动)则返回 VERSION_CONFLICT 不写入,需重新 get 再改,防\"基于过期值覆盖\"。大对象/数组强烈建议改用 edit_window_prop 增量 patch。",
|
|
@@ -15937,7 +16020,7 @@ function hv(e, r = {}) {
|
|
|
15937
16020
|
value: t.string().describe("JSON 字符串形式的值,需符合该属性 schema"),
|
|
15938
16021
|
expectedHash: t.string().optional().describe("乐观锁:改前 get_window_prop 返回的 hash;传入则校验,不一致拒绝写入防覆盖")
|
|
15939
16022
|
})
|
|
15940
|
-
}),
|
|
16023
|
+
}), v = n(async ({ path: e, op: t, jsonPath: n, value: r, expectedHash: a }) => {
|
|
15941
16024
|
let o = i.get(e);
|
|
15942
16025
|
if (!o) return $({
|
|
15943
16026
|
code: "NOT_REGISTERED",
|
|
@@ -15946,29 +16029,21 @@ function hv(e, r = {}) {
|
|
|
15946
16029
|
hint: "用 list_window_props 查看可用属性"
|
|
15947
16030
|
});
|
|
15948
16031
|
let s = n || "";
|
|
15949
|
-
if (
|
|
16032
|
+
if (pv(s)) return $({
|
|
15950
16033
|
code: "PATH_UNSAFE",
|
|
15951
16034
|
path: e,
|
|
15952
16035
|
message: `jsonPath "${s}" 含非法段(__proto__/constructor/prototype)`,
|
|
15953
16036
|
hint: "使用正常的属性路径,如 components.0.text(数组索引用数字)"
|
|
15954
16037
|
});
|
|
15955
|
-
let u =
|
|
15956
|
-
if (
|
|
15957
|
-
let t = uv(u);
|
|
15958
|
-
if (t !== a) return $({
|
|
15959
|
-
code: "VERSION_CONFLICT",
|
|
15960
|
-
path: e,
|
|
15961
|
-
message: `乐观锁冲突:expectedHash=${a} 但当前 hash=${t},属性 "${e}" 在你 get 之后已被修改(外部代码/其他 agent/用户手动改)`,
|
|
15962
|
-
hint: `重新 get_window_prop("${e}") 拿最新值与 hash,基于最新值修改后再 edit(传新的 expectedHash)。当前值:${lv(u, 400)}`
|
|
15963
|
-
});
|
|
15964
|
-
}
|
|
16038
|
+
let u = hv(window, e), d = await p(e, "edit", a);
|
|
16039
|
+
if (d !== null) return d;
|
|
15965
16040
|
if (typeof u != "object" || !u) return $({
|
|
15966
16041
|
code: "NOT_OBJECT",
|
|
15967
16042
|
path: e,
|
|
15968
16043
|
message: `edit 仅适用于对象/数组属性,"${e}" 当前是 ${u === void 0 ? "undefined" : typeof u}`,
|
|
15969
16044
|
hint: "叶子属性(原始类型)请用 set_window_prop 整体设置"
|
|
15970
16045
|
});
|
|
15971
|
-
let
|
|
16046
|
+
let m;
|
|
15972
16047
|
if (t !== "remove") {
|
|
15973
16048
|
if (r === void 0 || r === "") return $({
|
|
15974
16049
|
code: "MISSING_VALUE",
|
|
@@ -15977,26 +16052,26 @@ function hv(e, r = {}) {
|
|
|
15977
16052
|
hint: `op 为 ${t} 时 value 必填;若想删除请用 op:'remove'`
|
|
15978
16053
|
});
|
|
15979
16054
|
try {
|
|
15980
|
-
|
|
16055
|
+
m = JSON.parse(r);
|
|
15981
16056
|
} catch (t) {
|
|
15982
|
-
return
|
|
16057
|
+
return V_(e, r, t);
|
|
15983
16058
|
}
|
|
15984
16059
|
}
|
|
15985
|
-
let
|
|
15986
|
-
if (
|
|
16060
|
+
let h = vv(u), g = xv(h, t, s, m);
|
|
16061
|
+
if (g) return $({
|
|
15987
16062
|
code: "PATCH_FAILED",
|
|
15988
16063
|
path: e,
|
|
15989
|
-
message:
|
|
16064
|
+
message: g,
|
|
15990
16065
|
hint: "检查 op 与目标类型:merge 需目标为对象,append 需目标为数组;jsonPath 指向需存在"
|
|
15991
16066
|
});
|
|
15992
|
-
let
|
|
15993
|
-
return
|
|
16067
|
+
let _ = o.schema.safeParse(h);
|
|
16068
|
+
return _.success ? (f(e, "edit"), Sv(e, t, s, m), c({
|
|
15994
16069
|
op: "edit",
|
|
15995
16070
|
path: e,
|
|
15996
16071
|
detail: `${t}${s ? "@" + s : ""}`,
|
|
15997
|
-
value:
|
|
16072
|
+
value: m,
|
|
15998
16073
|
timestamp: Date.now()
|
|
15999
|
-
}), `已 edit ${e}(${t}${s ? " @ " + s : ""})。当前值:${
|
|
16074
|
+
}), `已 edit ${e}(${t}${s ? " @ " + s : ""})。当前值:${yv(hv(window, e), 600)} (新 hash=${bv(hv(window, e))})${l()}`) : B_(e, _.error.issues);
|
|
16000
16075
|
}, {
|
|
16001
16076
|
name: "edit_window_prop",
|
|
16002
16077
|
description: "增量编辑一个已注册的「对象/数组」window 属性,只发改动的 patch,无需重传整个大对象。op:set(在 jsonPath 设值)、remove(删 jsonPath)、merge(把 value 合并到 jsonPath 指向的对象,默认根)、append(把 value 追加到 jsonPath 指向的数组,默认根)。jsonPath 为相对属性根的点号路径(数组索引用数字,如 components.0.text);value 为 JSON 字符串。整体仍经 schema 校验,失败不写入。expectedHash(可选):改前 get_window_prop 返回的 hash,传入启用乐观锁防\"基于过期值覆盖\"。",
|
|
@@ -16012,29 +16087,22 @@ function hv(e, r = {}) {
|
|
|
16012
16087
|
value: t.string().optional().describe("JSON 字符串(set/merge/append 必填)"),
|
|
16013
16088
|
expectedHash: t.string().optional().describe("乐观锁:改前 get_window_prop 返回的 hash;传入则校验,不一致拒绝写入防覆盖")
|
|
16014
16089
|
})
|
|
16015
|
-
}),
|
|
16090
|
+
}), y = n(async ({ path: e, expectedHash: t }) => {
|
|
16016
16091
|
if (!i.has(e)) return $({
|
|
16017
16092
|
code: "NOT_REGISTERED",
|
|
16018
16093
|
path: e,
|
|
16019
16094
|
message: `属性 "${e}" 未在注册表中声明,不可删除`,
|
|
16020
16095
|
hint: "用 list_window_props 查看可用属性"
|
|
16021
16096
|
});
|
|
16022
|
-
|
|
16023
|
-
|
|
16024
|
-
if (r !== t) return $({
|
|
16025
|
-
code: "VERSION_CONFLICT",
|
|
16026
|
-
path: e,
|
|
16027
|
-
message: `乐观锁冲突:expectedHash=${t} 但当前 hash=${r},属性 "${e}" 在你 get 之后已被修改`,
|
|
16028
|
-
hint: `重新 get_window_prop("${e}") 拿最新值与 hash 再决定是否删除。当前值:${lv(n, 400)}`
|
|
16029
|
-
});
|
|
16030
|
-
}
|
|
16097
|
+
let n = await p(e, "delete", t);
|
|
16098
|
+
if (n !== null) return n;
|
|
16031
16099
|
f(e, "delete");
|
|
16032
|
-
let
|
|
16100
|
+
let r = _v(window, e);
|
|
16033
16101
|
return c({
|
|
16034
16102
|
op: "delete",
|
|
16035
16103
|
path: e,
|
|
16036
16104
|
timestamp: Date.now()
|
|
16037
|
-
}),
|
|
16105
|
+
}), r ? `已删除 ${e}${l()}` : `${e} 不存在(无需删除)${l()}`;
|
|
16038
16106
|
}, {
|
|
16039
16107
|
name: "delete_window_prop",
|
|
16040
16108
|
description: "删除一个已注册 window 属性。expectedHash(可选):改前 get_window_prop 返回的 hash,传入启用乐观锁防\"基于过期值删除\"。",
|
|
@@ -16042,7 +16110,7 @@ function hv(e, r = {}) {
|
|
|
16042
16110
|
path: t.string().describe("已注册的属性路径"),
|
|
16043
16111
|
expectedHash: t.string().optional().describe("乐观锁:改前 get_window_prop 返回的 hash;传入则校验,不一致拒绝删除防覆盖")
|
|
16044
16112
|
})
|
|
16045
|
-
}),
|
|
16113
|
+
}), b = n(async ({ path: e, label: t }) => i.has(e) ? `已为 ${e} 创建快照 #${f(e, "manual", t)}${t ? `(${t})` : ""}。可用 list_window_snapshots 查看、restore_window_snapshot 回退。` : $({
|
|
16046
16114
|
code: "NOT_REGISTERED",
|
|
16047
16115
|
path: e,
|
|
16048
16116
|
message: `属性 "${e}" 未注册,无法打快照`,
|
|
@@ -16054,7 +16122,7 @@ function hv(e, r = {}) {
|
|
|
16054
16122
|
path: t.string().describe("已注册的属性路径"),
|
|
16055
16123
|
label: t.string().optional().describe("可选的快照标签,便于识别")
|
|
16056
16124
|
})
|
|
16057
|
-
}),
|
|
16125
|
+
}), x = n(async ({ path: e }) => {
|
|
16058
16126
|
let t = e ? [e] : [...i.keys()];
|
|
16059
16127
|
if (e && !i.has(e)) return $({
|
|
16060
16128
|
code: "NOT_REGISTERED",
|
|
@@ -16080,7 +16148,7 @@ function hv(e, r = {}) {
|
|
|
16080
16148
|
name: "list_window_snapshots",
|
|
16081
16149
|
description: "列出 window 属性的快照时间线(序号、操作类型、标签、大小)。不传 path 列出所有属性。",
|
|
16082
16150
|
schema: t.object({ path: t.string().optional().describe("限定单个属性,不传则列出全部") })
|
|
16083
|
-
}),
|
|
16151
|
+
}), S = n(async ({ path: e, id: t }) => {
|
|
16084
16152
|
let n = i.get(e);
|
|
16085
16153
|
if (!n) return $({
|
|
16086
16154
|
code: "NOT_REGISTERED",
|
|
@@ -16103,7 +16171,7 @@ function hv(e, r = {}) {
|
|
|
16103
16171
|
hint: "用 list_window_snapshots 查看可用快照序号"
|
|
16104
16172
|
});
|
|
16105
16173
|
let s = n.schema.safeParse(o.value);
|
|
16106
|
-
return s.success ? (
|
|
16174
|
+
return s.success ? (Cv(e, vv(o.value)), c({
|
|
16107
16175
|
op: "restore",
|
|
16108
16176
|
path: e,
|
|
16109
16177
|
detail: `#${o.id}`,
|
|
@@ -16113,7 +16181,7 @@ function hv(e, r = {}) {
|
|
|
16113
16181
|
path: e,
|
|
16114
16182
|
message: `快照 #${o.id} 的值不符合当前 schema,无法回退`,
|
|
16115
16183
|
hint: "schema 可能已变更;该快照已过期,选其他快照或重新设置",
|
|
16116
|
-
details:
|
|
16184
|
+
details: z_(s.error.issues)
|
|
16117
16185
|
});
|
|
16118
16186
|
}, {
|
|
16119
16187
|
name: "restore_window_snapshot",
|
|
@@ -16122,10 +16190,10 @@ function hv(e, r = {}) {
|
|
|
16122
16190
|
path: t.string().describe("已注册的属性路径"),
|
|
16123
16191
|
id: t.number().int().optional().describe("指定快照序号;不传则回退最近一次")
|
|
16124
16192
|
})
|
|
16125
|
-
}),
|
|
16126
|
-
p,
|
|
16193
|
+
}), C = [
|
|
16127
16194
|
m,
|
|
16128
16195
|
h,
|
|
16196
|
+
g,
|
|
16129
16197
|
n(async ({ paths: e }) => {
|
|
16130
16198
|
let t = [];
|
|
16131
16199
|
for (let n of e) {
|
|
@@ -16138,8 +16206,8 @@ function hv(e, r = {}) {
|
|
|
16138
16206
|
})}`);
|
|
16139
16207
|
continue;
|
|
16140
16208
|
}
|
|
16141
|
-
let e =
|
|
16142
|
-
t.push(`- ${n} = ${e === void 0 ? "(undefined)" :
|
|
16209
|
+
let e = hv(window, n);
|
|
16210
|
+
t.push(`- ${n} = ${e === void 0 ? "(undefined)" : yv(e)}`);
|
|
16143
16211
|
}
|
|
16144
16212
|
return t.join("\n");
|
|
16145
16213
|
}, {
|
|
@@ -16147,12 +16215,12 @@ function hv(e, r = {}) {
|
|
|
16147
16215
|
description: "批量按路径读取 window 属性的局部或多个字段(避免对大 JSON 整体读取)。paths 支持注册属性的任意后代路径(如 page.components.0.text)、自身。字段白名单读模式(默认)下未注册祖先不可读。逐行返回 path = value;单个值过大仍由系统自动外存 vfs。",
|
|
16148
16216
|
schema: t.object({ paths: t.array(t.string().describe("路径,如 page.components.0.text")).min(1).max(20) })
|
|
16149
16217
|
}),
|
|
16150
|
-
g,
|
|
16151
16218
|
_,
|
|
16152
16219
|
v,
|
|
16153
16220
|
y,
|
|
16154
16221
|
b,
|
|
16155
16222
|
x,
|
|
16223
|
+
S,
|
|
16156
16224
|
n(async ({ path: e, expr: t, limit: n }) => {
|
|
16157
16225
|
if (!i.get(e)) return $({
|
|
16158
16226
|
code: "NOT_REGISTERED",
|
|
@@ -16160,7 +16228,7 @@ function hv(e, r = {}) {
|
|
|
16160
16228
|
message: `属性 "${e}" 未注册`,
|
|
16161
16229
|
hint: "用 list_window_props 查看可用属性"
|
|
16162
16230
|
});
|
|
16163
|
-
let r =
|
|
16231
|
+
let r = hv(window, e);
|
|
16164
16232
|
if (typeof r != "object" || !r) return $({
|
|
16165
16233
|
code: "NOT_OBJECT",
|
|
16166
16234
|
path: e,
|
|
@@ -16169,7 +16237,7 @@ function hv(e, r = {}) {
|
|
|
16169
16237
|
});
|
|
16170
16238
|
let a;
|
|
16171
16239
|
try {
|
|
16172
|
-
a =
|
|
16240
|
+
a = ov(r, t);
|
|
16173
16241
|
} catch (n) {
|
|
16174
16242
|
return $({
|
|
16175
16243
|
code: "JSONPATH_SYNTAX",
|
|
@@ -16179,7 +16247,7 @@ function hv(e, r = {}) {
|
|
|
16179
16247
|
details: { expr: t }
|
|
16180
16248
|
});
|
|
16181
16249
|
}
|
|
16182
|
-
let o = n ?? 50, s = a.slice(0, o), c = s.map((e) => `{"path":${JSON.stringify(e.path)},"index":${e.index === void 0 ? "null" : e.index},"value":${
|
|
16250
|
+
let o = n ?? 50, s = a.slice(0, o), c = s.map((e) => `{"path":${JSON.stringify(e.path)},"index":${e.index === void 0 ? "null" : e.index},"value":${yv(e.value)}}`);
|
|
16183
16251
|
return `{"matched":${a.length},"returned":${s.length},"truncated":${a.length > o},"results":[${c.join(",")}]}`;
|
|
16184
16252
|
}, {
|
|
16185
16253
|
name: "query_window_prop",
|
|
@@ -16197,20 +16265,20 @@ function hv(e, r = {}) {
|
|
|
16197
16265
|
message: `属性 "${e}" 未注册`,
|
|
16198
16266
|
hint: "用 list_window_props 查看可用属性"
|
|
16199
16267
|
});
|
|
16200
|
-
let s =
|
|
16268
|
+
let s = hv(window, e);
|
|
16201
16269
|
if (s == null) return $({
|
|
16202
16270
|
code: "EMPTY",
|
|
16203
16271
|
path: e,
|
|
16204
16272
|
message: `"${e}" 为空,无可搜索内容`
|
|
16205
16273
|
});
|
|
16206
16274
|
try {
|
|
16207
|
-
let e =
|
|
16275
|
+
let e = cv(s, t, {
|
|
16208
16276
|
mode: n,
|
|
16209
16277
|
fuzzyThreshold: r,
|
|
16210
16278
|
matchKey: a,
|
|
16211
16279
|
limit: o ?? 50
|
|
16212
16280
|
});
|
|
16213
|
-
return
|
|
16281
|
+
return yv({
|
|
16214
16282
|
matched: e.length,
|
|
16215
16283
|
results: e
|
|
16216
16284
|
});
|
|
@@ -16253,7 +16321,7 @@ function hv(e, r = {}) {
|
|
|
16253
16321
|
message: `脚本过长(${t.length} 字符,上限 8000)`,
|
|
16254
16322
|
hint: "精简脚本;复杂逻辑可分步(先 query 探查再 transform 改),或拆成多次 eval"
|
|
16255
16323
|
});
|
|
16256
|
-
let a = await
|
|
16324
|
+
let a = await dv(vv(hv(window, e)), t, 3e3);
|
|
16257
16325
|
if (!a.ok) {
|
|
16258
16326
|
let n = /超时/.test(a.error || "");
|
|
16259
16327
|
return $({
|
|
@@ -16274,18 +16342,18 @@ function hv(e, r = {}) {
|
|
|
16274
16342
|
path: e,
|
|
16275
16343
|
message: "脚本返回值校验失败,未写入(transform 模式要求返回该属性的完整新值且符合 schema)",
|
|
16276
16344
|
hint: `确认脚本 return 了完整新值(非部分);按 describe_window_prop("${e}") 查看格式`,
|
|
16277
|
-
details:
|
|
16345
|
+
details: z_(t.error.issues)
|
|
16278
16346
|
});
|
|
16279
16347
|
f(e, "edit", "eval_transform");
|
|
16280
|
-
let n =
|
|
16281
|
-
return typeof n == "object" && n && t.data !== null && typeof t.data == "object" ?
|
|
16348
|
+
let n = hv(window, e);
|
|
16349
|
+
return typeof n == "object" && n && t.data !== null && typeof t.data == "object" ? wv(n, t.data) : gv(window, e, t.data), c({
|
|
16282
16350
|
op: "edit",
|
|
16283
16351
|
path: e,
|
|
16284
16352
|
detail: "eval_transform",
|
|
16285
16353
|
timestamp: Date.now()
|
|
16286
|
-
}), `已通过脚本 transform 更新 ${e}(耗时 ${a.elapsedMs}ms)。当前值: ${
|
|
16354
|
+
}), `已通过脚本 transform 更新 ${e}(耗时 ${a.elapsedMs}ms)。当前值: ${yv(hv(window, e), 600)}`;
|
|
16287
16355
|
}
|
|
16288
|
-
return
|
|
16356
|
+
return yv({
|
|
16289
16357
|
ok: !0,
|
|
16290
16358
|
result: a.result,
|
|
16291
16359
|
elapsedMs: a.elapsedMs
|
|
@@ -16300,17 +16368,17 @@ function hv(e, r = {}) {
|
|
|
16300
16368
|
})
|
|
16301
16369
|
})
|
|
16302
16370
|
];
|
|
16303
|
-
return Object.defineProperty(
|
|
16371
|
+
return Object.defineProperty(C, "controller", {
|
|
16304
16372
|
value: s,
|
|
16305
16373
|
enumerable: !1,
|
|
16306
16374
|
configurable: !1,
|
|
16307
16375
|
writable: !1
|
|
16308
|
-
}),
|
|
16376
|
+
}), C;
|
|
16309
16377
|
}
|
|
16310
16378
|
//#endregion
|
|
16311
16379
|
//#region src/core/tools/fetchDoc.ts
|
|
16312
|
-
var
|
|
16313
|
-
let n = new AbortController(), r = setTimeout(() => n.abort(),
|
|
16380
|
+
var Ev = 3e4, Dv = [n(async ({ url: e, as: t }) => {
|
|
16381
|
+
let n = new AbortController(), r = setTimeout(() => n.abort(), Ev);
|
|
16314
16382
|
try {
|
|
16315
16383
|
let r = await fetch(e, {
|
|
16316
16384
|
method: "GET",
|
|
@@ -16327,7 +16395,7 @@ var gv = 3e4, _v = [n(async ({ url: e, as: t }) => {
|
|
|
16327
16395
|
].join("\n");
|
|
16328
16396
|
} catch (t) {
|
|
16329
16397
|
let r = t?.message || String(t);
|
|
16330
|
-
return n.signal.aborted ? `获取失败:请求超时(${
|
|
16398
|
+
return n.signal.aborted ? `获取失败:请求超时(${Ev}ms,${e})。` : /Failed to fetch|NetworkError|CORS|blocked/i.test(r) ? `获取失败:可能是 CORS 跨域拦截或网络错误(${r})。浏览器仅能 GET 同源或服务端已配置 CORS 的资源;跨域抓取需后端代理。` : `获取失败:${r}`;
|
|
16331
16399
|
} finally {
|
|
16332
16400
|
clearTimeout(r);
|
|
16333
16401
|
}
|
|
@@ -16338,24 +16406,24 @@ var gv = 3e4, _v = [n(async ({ url: e, as: t }) => {
|
|
|
16338
16406
|
url: t.string().describe("要抓取的 URL(同源或已配 CORS)"),
|
|
16339
16407
|
as: t.enum(["text", "markdown"]).optional().describe("返回格式标签,默认 text")
|
|
16340
16408
|
})
|
|
16341
|
-
})],
|
|
16342
|
-
function
|
|
16343
|
-
return
|
|
16409
|
+
})], Ov = Dv;
|
|
16410
|
+
function kv(e, t) {
|
|
16411
|
+
return Tv(e, t);
|
|
16344
16412
|
}
|
|
16345
|
-
function
|
|
16413
|
+
function Av(e, t, n) {
|
|
16346
16414
|
let r = e?.windowOps !== !1, i = e?.fetch !== !1;
|
|
16347
16415
|
return [...r ? t : [], ...i ? n : []];
|
|
16348
16416
|
}
|
|
16349
16417
|
//#endregion
|
|
16350
16418
|
//#region src/core/harness/usageHints.ts
|
|
16351
|
-
var
|
|
16352
|
-
function
|
|
16419
|
+
var jv = .7;
|
|
16420
|
+
function Mv(e, t) {
|
|
16353
16421
|
return {
|
|
16354
16422
|
name: "usageHints",
|
|
16355
16423
|
augmentPrompt: () => {
|
|
16356
16424
|
let n = [];
|
|
16357
|
-
if (e?.planning !== !1 && n.push("多步任务建议先 write_todos 拆解为步骤并逐步推进。"), t && (n.push("改属性前先 get_window_prop(path) 读其当前真实值与 hash(返回末尾 hash=xxx),基于真实值改,不要凭记忆。写入(set/edit/delete)时回传 expectedHash=该 hash 启用乐观锁——若属性在你 get 之后被外部代码/其他 agent
|
|
16358
|
-
let t = e.subagents.filter((e) => (e.temperature ?? 0) >=
|
|
16425
|
+
if (e?.planning !== !1 && n.push("多步任务建议先 write_todos 拆解为步骤并逐步推进。"), t && (n.push("改属性前先 get_window_prop(path) 读其当前真实值与 hash(返回末尾 hash=xxx),基于真实值改,不要凭记忆。写入(set/edit/delete)时回传 expectedHash=该 hash 启用乐观锁——若属性在你 get 之后被外部代码/其他 agent/用户手动改过,会触发冲突:集成方若开启人工介入,工具会挂起等用户决定(保留外部/强制覆盖/回退),你应等待工具返回后按结果继续(保留外部→重新 get 再改;强制覆盖→已写入,继续;回退→已回退到历史快照,基于回退值重写);未开启人工介入时返回 VERSION_CONFLICT 不写入,重新 get 拿最新值与 hash 再改。"), n.push("不确定可操作哪些属性时用 list_window_props 查看(动态组件场景下注册表会增删,以工具返回为准,勿凭旧记忆);不确定某属性字段结构时用 describe_window_prop。"), n.push("修改大对象/数组属性优先用 edit_window_prop 增量 patch(只发改动部分),避免 set 整体重传被 max_tokens 截断导致 JSON 不完整、校验失败。"), n.push("修改属性出错时可用 restore_window_snapshot(path) 回退最近一次。"), n.push("在大数组里按条件筛选元素用 query_window_prop(JSONPath,如 $[?(@.type==\"card\" && @.price<100)]),返回匹配元素的 path/index;定位后再 edit_window_prop 改。"), n.push("找名字记不清的元素用 search_window_prop(支持 substring/regex/fuzzy 模糊搜索)。"), n.push("需要过滤/映射/聚合/批量重写大数组时用 eval_window_script(沙箱脚本,入参 data);只读探查用 mode=query,批量重写用 mode=transform(返回值经校验后落地)。")), e?.subagent !== !1 && n.push("独立子任务可 spawn_agent 委派(只读工具,过程不占主上下文)。"), e?.subagents?.length) {
|
|
16426
|
+
let t = e.subagents.filter((e) => (e.temperature ?? 0) >= jv || /规划|创意|设计|方案|brainstorm|plan/i.test(e.description)), r = e.subagents.filter((e) => (e.temperature ?? 0) < jv && /反思|审查|挑刺|校验|review|critique|reflect/i.test(e.description));
|
|
16359
16427
|
n.push("【规划-反思-执行·路由】按任务性质选模式,不要对简单任务过度编排:"), t.length && (n.push(` · 创作/设计/开放性需求(如"设计主题风格""换个感觉")→ 先调 ${t.map((e) => "use_" + e.id).join("/")} 出 2-3 套方案(高温创意),`), n.push(" 不要自己拍板;拿到方案后,若需用户拍板用 request_human_confirmation 弹选项。")), r.length && n.push(` · 严谨/易错/校验类 → 可先调 ${r.map((e) => "use_" + e.id).join("/")} 反思挑刺(低温审查),据反馈修订。`), n.push(" · 方案定稿后,由你(主 agent)用 edit_window_prop 落地成 JSON(低温度执行 + schema 校验 + 写前确认)。"), n.push(" · 简单/明确任务(如\"标题改红色\")直接执行,不必走规划-反思。");
|
|
16360
16428
|
}
|
|
16361
16429
|
return e?.humanConfirm && (n.push("【人工确认·必读】以下情形必须先调 request_human_confirmation 征询用户、拿到答复后再继续,不要自行拍板:"), n.push(" 1) 用户让你「给方案/列选项/我来选/挑一个」时:把每个方案作为一个 option,调 request_human_confirmation(question=简述, options=[方案A,方案B,...], recommendation=你推荐的)。不要只回文字罗列方案让用户自己回复——要用工具把选项做成可点选按钮。"), n.push(" 2) 需求有歧义/不确定时:调工具问清楚(options 不传则用户答同意或拒绝)。"), n.push(" 3) 即将执行高风险不可逆操作(删除/覆盖/批量改动)前:调工具确认。"), n.push("用户在选项里选了哪个,就按那个方案继续;选「拒绝」则停止并询问如何调整。")), n.length && n.unshift("调用工具务必用标准 function calling(工具调用)格式发起,不要在回复正文里输出伪 XML/标签(如 deepseek 的 tool_calls 标签、invoke、function_call、tool_call 等)或 JSON 文本——那不会被识别为工具调用,会被当普通文字,工具不执行。"), n.length ? "## 能力使用提示\n" + n.join("\n") : void 0;
|
|
@@ -16364,7 +16432,7 @@ function Sv(e, t) {
|
|
|
16364
16432
|
}
|
|
16365
16433
|
//#endregion
|
|
16366
16434
|
//#region src/core/utils/id.ts
|
|
16367
|
-
function
|
|
16435
|
+
function Nv() {
|
|
16368
16436
|
try {
|
|
16369
16437
|
if (typeof crypto < "u" && typeof crypto.randomUUID == "function") return crypto.randomUUID();
|
|
16370
16438
|
} catch {}
|
|
@@ -16372,57 +16440,57 @@ function Cv() {
|
|
|
16372
16440
|
}
|
|
16373
16441
|
//#endregion
|
|
16374
16442
|
//#region src/core/backends/storage.ts
|
|
16375
|
-
var
|
|
16443
|
+
var Pv = "chat-sdk", Fv = 50 * 1024 * 1024, Iv = 4 * 1024 * 1024, Lv = 10 * 1024 * 1024, Rv = .9, zv = 500, Bv = 300, Vv = "__meta__", Hv = "v:1", Uv = [
|
|
16376
16444
|
"messages",
|
|
16377
16445
|
"vfs",
|
|
16378
16446
|
"todos",
|
|
16379
16447
|
"memory"
|
|
16380
16448
|
];
|
|
16381
|
-
function
|
|
16382
|
-
return e === "local" || e === "session" ?
|
|
16449
|
+
function Wv(e) {
|
|
16450
|
+
return e === "local" || e === "session" ? Iv : Fv;
|
|
16383
16451
|
}
|
|
16384
|
-
function
|
|
16452
|
+
function Gv(e) {
|
|
16385
16453
|
if (typeof e != "object" || !e) return !1;
|
|
16386
16454
|
let t = e;
|
|
16387
16455
|
return t.name === "QuotaExceededError" || t.name === "NS_ERROR_DOM_QUOTA_REACHED" || t.code === 22 || t.code === 1014;
|
|
16388
16456
|
}
|
|
16389
|
-
function
|
|
16457
|
+
function Kv(e, t, n, r) {
|
|
16390
16458
|
return [
|
|
16391
|
-
|
|
16459
|
+
Hv,
|
|
16392
16460
|
e,
|
|
16393
16461
|
t,
|
|
16394
16462
|
n,
|
|
16395
16463
|
r
|
|
16396
16464
|
].join("::");
|
|
16397
16465
|
}
|
|
16398
|
-
function
|
|
16466
|
+
function qv(e, t, n) {
|
|
16399
16467
|
return [
|
|
16400
|
-
|
|
16468
|
+
Hv,
|
|
16401
16469
|
e,
|
|
16402
16470
|
t,
|
|
16403
16471
|
n
|
|
16404
16472
|
].join("::") + "::";
|
|
16405
16473
|
}
|
|
16406
|
-
function
|
|
16474
|
+
function Jv(e, t) {
|
|
16407
16475
|
return [
|
|
16408
|
-
|
|
16476
|
+
Hv,
|
|
16409
16477
|
e,
|
|
16410
16478
|
t
|
|
16411
16479
|
].join("::") + "::";
|
|
16412
16480
|
}
|
|
16413
|
-
function
|
|
16414
|
-
return [
|
|
16481
|
+
function Yv(e) {
|
|
16482
|
+
return [Hv, e].join("::") + "::";
|
|
16415
16483
|
}
|
|
16416
|
-
var
|
|
16417
|
-
function
|
|
16418
|
-
|
|
16484
|
+
var Xv = null;
|
|
16485
|
+
function Zv(e) {
|
|
16486
|
+
Xv ||= new TextEncoder();
|
|
16419
16487
|
try {
|
|
16420
|
-
return
|
|
16488
|
+
return Xv.encode(JSON.stringify(e)).length;
|
|
16421
16489
|
} catch {
|
|
16422
16490
|
return 0;
|
|
16423
16491
|
}
|
|
16424
16492
|
}
|
|
16425
|
-
function
|
|
16493
|
+
function Qv(e, t, n) {
|
|
16426
16494
|
let r = e.reduce((e, t) => e + t.bytes, 0);
|
|
16427
16495
|
if (r <= t) return [];
|
|
16428
16496
|
let i = t * n, a = [...e].sort((e, t) => e.lastAccessed - t.lastAccessed), o = [];
|
|
@@ -16432,7 +16500,7 @@ function Hv(e, t, n) {
|
|
|
16432
16500
|
}
|
|
16433
16501
|
return o;
|
|
16434
16502
|
}
|
|
16435
|
-
function
|
|
16503
|
+
function $v() {
|
|
16436
16504
|
let e = /* @__PURE__ */ new Map();
|
|
16437
16505
|
return {
|
|
16438
16506
|
async get(t) {
|
|
@@ -16452,7 +16520,7 @@ function Uv() {
|
|
|
16452
16520
|
}
|
|
16453
16521
|
};
|
|
16454
16522
|
}
|
|
16455
|
-
function
|
|
16523
|
+
function ey(e) {
|
|
16456
16524
|
return new Promise((t, n) => {
|
|
16457
16525
|
if (typeof indexedDB > "u") {
|
|
16458
16526
|
n(/* @__PURE__ */ Error("indexedDB 不可用"));
|
|
@@ -16513,7 +16581,7 @@ function Wv(e) {
|
|
|
16513
16581
|
}, r.onerror = () => n(r.error);
|
|
16514
16582
|
});
|
|
16515
16583
|
}
|
|
16516
|
-
function
|
|
16584
|
+
function ty(e) {
|
|
16517
16585
|
return {
|
|
16518
16586
|
async get(t) {
|
|
16519
16587
|
let n = e.getItem(t);
|
|
@@ -16547,12 +16615,12 @@ function Gv(e) {
|
|
|
16547
16615
|
}
|
|
16548
16616
|
};
|
|
16549
16617
|
}
|
|
16550
|
-
function
|
|
16618
|
+
function ny(e, t, n) {
|
|
16551
16619
|
let r = (e.get(t) ?? Promise.resolve()).then(n, n);
|
|
16552
16620
|
return e.set(t, r.then(() => void 0, () => void 0)), r;
|
|
16553
16621
|
}
|
|
16554
|
-
function
|
|
16555
|
-
let t = e.dbName ??
|
|
16622
|
+
function ry(e = {}) {
|
|
16623
|
+
let t = e.dbName ?? Pv, n = e.backend ?? "indexed", r = e.maxBytes ?? Wv(n), i = e.maxBytesPerSession ?? Lv, a = e.evictionWatermark ?? Rv, o = e.debounceMs ?? zv, s = /* @__PURE__ */ new Set();
|
|
16556
16624
|
function c(e) {
|
|
16557
16625
|
for (let t of s) try {
|
|
16558
16626
|
t(e);
|
|
@@ -16565,16 +16633,16 @@ function qv(e = {}) {
|
|
|
16565
16633
|
try {
|
|
16566
16634
|
if (n === "indexed") {
|
|
16567
16635
|
if (typeof indexedDB > "u") throw Error("indexedDB 不可用");
|
|
16568
|
-
l = await
|
|
16636
|
+
l = await ey(t), d(!0);
|
|
16569
16637
|
} else if (n === "session") {
|
|
16570
16638
|
if (typeof sessionStorage > "u") throw Error("sessionStorage 不可用");
|
|
16571
|
-
l =
|
|
16639
|
+
l = ty(sessionStorage), d(!0);
|
|
16572
16640
|
} else if (n === "local") {
|
|
16573
16641
|
if (typeof localStorage > "u") throw Error("localStorage 不可用");
|
|
16574
|
-
l =
|
|
16575
|
-
} else l =
|
|
16642
|
+
l = ty(localStorage), d(!0);
|
|
16643
|
+
} else l = $v(), d(!1);
|
|
16576
16644
|
} catch (e) {
|
|
16577
|
-
l =
|
|
16645
|
+
l = $v();
|
|
16578
16646
|
let t = e instanceof Error ? e.message : String(e);
|
|
16579
16647
|
d(!1), Promise.resolve().then(() => c({
|
|
16580
16648
|
type: "degraded",
|
|
@@ -16584,10 +16652,10 @@ function qv(e = {}) {
|
|
|
16584
16652
|
})();
|
|
16585
16653
|
let p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
|
|
16586
16654
|
function g(e, n, r, a) {
|
|
16587
|
-
let o =
|
|
16588
|
-
return
|
|
16655
|
+
let o = Kv(t, r, a, Vv);
|
|
16656
|
+
return ny(h, o, async () => {
|
|
16589
16657
|
let t = async () => {
|
|
16590
|
-
let t = await l.get(o), s = await l.get(e), u = s == null ? 0 :
|
|
16658
|
+
let t = await l.get(o), s = await l.get(e), u = s == null ? 0 : Zv(s), d = Zv(n), f = (t?.bytes ?? 0) + (d - u);
|
|
16591
16659
|
if (f > i) {
|
|
16592
16660
|
c({
|
|
16593
16661
|
type: "quota",
|
|
@@ -16609,12 +16677,12 @@ function qv(e = {}) {
|
|
|
16609
16677
|
try {
|
|
16610
16678
|
await t();
|
|
16611
16679
|
} catch (e) {
|
|
16612
|
-
if (
|
|
16680
|
+
if (Gv(e) && !u) {
|
|
16613
16681
|
u = !0;
|
|
16614
16682
|
try {
|
|
16615
16683
|
await b();
|
|
16616
16684
|
} catch {}
|
|
16617
|
-
l =
|
|
16685
|
+
l = $v(), Promise.resolve().then(() => c({
|
|
16618
16686
|
type: "degraded",
|
|
16619
16687
|
reason: "存储配额超限(QuotaExceededError),已淘汰最旧会话并降级内存"
|
|
16620
16688
|
}));
|
|
@@ -16626,7 +16694,7 @@ function qv(e = {}) {
|
|
|
16626
16694
|
});
|
|
16627
16695
|
}
|
|
16628
16696
|
function _(e, n, r, i) {
|
|
16629
|
-
let a =
|
|
16697
|
+
let a = Kv(t, e, n, r), s = p.get(a);
|
|
16630
16698
|
s && s.resolve();
|
|
16631
16699
|
let c = m.get(a);
|
|
16632
16700
|
return c && clearTimeout(c), new Promise((t) => {
|
|
@@ -16653,15 +16721,15 @@ function qv(e = {}) {
|
|
|
16653
16721
|
function y() {
|
|
16654
16722
|
v ||= setTimeout(() => {
|
|
16655
16723
|
v = null, b();
|
|
16656
|
-
},
|
|
16724
|
+
}, Bv);
|
|
16657
16725
|
}
|
|
16658
16726
|
async function b() {
|
|
16659
16727
|
let e = [];
|
|
16660
|
-
await l.scan(
|
|
16728
|
+
await l.scan(Yv(t), (t, n) => {
|
|
16661
16729
|
t.endsWith("::__meta__") && e.push(n);
|
|
16662
16730
|
});
|
|
16663
|
-
let n =
|
|
16664
|
-
for (let e of n) await l.clearPrefix(
|
|
16731
|
+
let n = Qv(e, r, a);
|
|
16732
|
+
for (let e of n) await l.clearPrefix(qv(t, e.agentId, e.sessionId)), c({
|
|
16665
16733
|
type: "evicted",
|
|
16666
16734
|
agentId: e.agentId,
|
|
16667
16735
|
sessionId: e.sessionId,
|
|
@@ -16672,13 +16740,13 @@ function qv(e = {}) {
|
|
|
16672
16740
|
ready: f,
|
|
16673
16741
|
async listSessions(e) {
|
|
16674
16742
|
let n = [];
|
|
16675
|
-
return await l.scan(
|
|
16743
|
+
return await l.scan(Jv(t, e), (e, t) => {
|
|
16676
16744
|
e.endsWith("::__meta__") && n.push(t);
|
|
16677
16745
|
}), n.sort((e, t) => t.lastAccessed - e.lastAccessed);
|
|
16678
16746
|
},
|
|
16679
16747
|
async load(e, n) {
|
|
16680
|
-
let r =
|
|
16681
|
-
return await
|
|
16748
|
+
let r = Kv(t, e, n, Vv);
|
|
16749
|
+
return await ny(h, r, async () => {
|
|
16682
16750
|
let i = await l.get(r);
|
|
16683
16751
|
if (!i) return;
|
|
16684
16752
|
let a = {
|
|
@@ -16687,8 +16755,8 @@ function qv(e = {}) {
|
|
|
16687
16755
|
todos: [],
|
|
16688
16756
|
memory: ""
|
|
16689
16757
|
};
|
|
16690
|
-
for (let r of
|
|
16691
|
-
let i = await l.get(
|
|
16758
|
+
for (let r of Uv) {
|
|
16759
|
+
let i = await l.get(Kv(t, e, n, r));
|
|
16692
16760
|
i != null && (a[r] = i);
|
|
16693
16761
|
}
|
|
16694
16762
|
return i.lastAccessed = Date.now(), await l.set(r, i), a;
|
|
@@ -16696,7 +16764,7 @@ function qv(e = {}) {
|
|
|
16696
16764
|
},
|
|
16697
16765
|
async save(e, t, n) {
|
|
16698
16766
|
let r = [];
|
|
16699
|
-
for (let i of
|
|
16767
|
+
for (let i of Uv) n[i] !== void 0 && r.push(_(e, t, i, n[i]));
|
|
16700
16768
|
await Promise.all(r);
|
|
16701
16769
|
},
|
|
16702
16770
|
async flush() {
|
|
@@ -16710,10 +16778,10 @@ function qv(e = {}) {
|
|
|
16710
16778
|
})), c({ type: "flush" }), await b();
|
|
16711
16779
|
},
|
|
16712
16780
|
async deleteSession(e, n) {
|
|
16713
|
-
await l.clearPrefix(
|
|
16781
|
+
await l.clearPrefix(qv(t, e, n));
|
|
16714
16782
|
},
|
|
16715
16783
|
async createSession(e, n, r) {
|
|
16716
|
-
let i = r ??
|
|
16784
|
+
let i = r ?? Nv(), a = Date.now(), o = {
|
|
16717
16785
|
agentId: e,
|
|
16718
16786
|
sessionId: i,
|
|
16719
16787
|
createdAt: a,
|
|
@@ -16721,7 +16789,7 @@ function qv(e = {}) {
|
|
|
16721
16789
|
bytes: 0,
|
|
16722
16790
|
title: n
|
|
16723
16791
|
};
|
|
16724
|
-
return await l.set(
|
|
16792
|
+
return await l.set(Kv(t, e, i, Vv), o), i;
|
|
16725
16793
|
},
|
|
16726
16794
|
onEvent(e) {
|
|
16727
16795
|
s.add(e);
|
|
@@ -16736,28 +16804,28 @@ function qv(e = {}) {
|
|
|
16736
16804
|
}
|
|
16737
16805
|
//#endregion
|
|
16738
16806
|
//#region src/core/sdk/createChatSdk.ts
|
|
16739
|
-
var
|
|
16807
|
+
var iy = [
|
|
16740
16808
|
"你是一个页面操作助手。宿主页面在 window 对象上注册了可操作的属性,你通过专用工具安全地读写这些属性来操作页面。",
|
|
16741
16809
|
"所有写操作都经范围控制(仅注册表内)与 schema 校验(不合法会返回结构化错误而非写入),并自动留快照可回退。",
|
|
16742
16810
|
"大对象/数组优先用增量 patch(只发改动)而非整体重传,避免输出被截断。",
|
|
16743
|
-
|
|
16744
|
-
].join("\n\n"),
|
|
16745
|
-
function
|
|
16746
|
-
return e === void 0 || e === !1 ? null : typeof e == "string" ?
|
|
16811
|
+
I_.reliableWriteRules
|
|
16812
|
+
].join("\n\n"), ay = 50;
|
|
16813
|
+
function oy(e) {
|
|
16814
|
+
return e === void 0 || e === !1 ? null : typeof e == "string" ? ry({ backend: e }) : e.enabled === !1 ? null : ry(e);
|
|
16747
16815
|
}
|
|
16748
|
-
function
|
|
16816
|
+
function sy(e) {
|
|
16749
16817
|
return !!e && typeof e == "object" && typeof e.invoke == "function" && typeof e.stream == "function";
|
|
16750
16818
|
}
|
|
16751
|
-
var
|
|
16752
|
-
function
|
|
16819
|
+
var cy = /* @__PURE__ */ new Map();
|
|
16820
|
+
function ly(e) {
|
|
16753
16821
|
let t = e.content;
|
|
16754
16822
|
return typeof t == "string" ? t : Array.isArray(t) ? t.map((e) => typeof e == "string" ? e : e?.text ?? "").join("") : String(t ?? "");
|
|
16755
16823
|
}
|
|
16756
|
-
function
|
|
16824
|
+
function uy(e) {
|
|
16757
16825
|
let t = e.summaryLlm ?? e.llm;
|
|
16758
16826
|
if (!t) return;
|
|
16759
16827
|
let n = e.summaryTemperature ?? .3, r = e.summaryMaxTokens ?? 1024, o = e.summaryTimeoutMs ?? 15e3, c;
|
|
16760
|
-
if (
|
|
16828
|
+
if (sy(t)) c = t;
|
|
16761
16829
|
else {
|
|
16762
16830
|
let i = t;
|
|
16763
16831
|
if (!i.apiKey) {
|
|
@@ -16775,16 +16843,16 @@ function ey(e) {
|
|
|
16775
16843
|
return async (e) => {
|
|
16776
16844
|
let t = new AbortController(), n = setTimeout(() => t.abort(), o);
|
|
16777
16845
|
try {
|
|
16778
|
-
return
|
|
16846
|
+
return ly(await c.invoke([new a("你是对话历史压缩助手。把下面按轮次索引的对话要点,改写成一段连贯、紧凑的中文摘要,保留关键事实、用户意图与已用工具,不要编造。直接输出摘要正文。"), new i(e)], { signal: t.signal })).trim();
|
|
16779
16847
|
} finally {
|
|
16780
16848
|
clearTimeout(n);
|
|
16781
16849
|
}
|
|
16782
16850
|
};
|
|
16783
16851
|
}
|
|
16784
|
-
function
|
|
16852
|
+
function dy(e) {
|
|
16785
16853
|
return e === "set_window_prop" ? "set" : e === "edit_window_prop" ? "edit" : e === "delete_window_prop" ? "delete" : e === "restore_window_snapshot" ? "restore" : null;
|
|
16786
16854
|
}
|
|
16787
|
-
function
|
|
16855
|
+
function fy(e) {
|
|
16788
16856
|
let t = e.split("."), n = globalThis.window;
|
|
16789
16857
|
for (let e of t) {
|
|
16790
16858
|
if (n == null) return;
|
|
@@ -16792,18 +16860,18 @@ function ny(e) {
|
|
|
16792
16860
|
}
|
|
16793
16861
|
return n;
|
|
16794
16862
|
}
|
|
16795
|
-
function
|
|
16863
|
+
function py(e, t) {
|
|
16796
16864
|
return {
|
|
16797
16865
|
name: "sdk-events",
|
|
16798
16866
|
wrapToolCall: async (t, n) => {
|
|
16799
|
-
let r = await n(t), i =
|
|
16867
|
+
let r = await n(t), i = dy(t.name);
|
|
16800
16868
|
if (i) {
|
|
16801
16869
|
let n = String(t.args?.path ?? "");
|
|
16802
16870
|
e({
|
|
16803
16871
|
type: "window_prop_change",
|
|
16804
16872
|
path: n,
|
|
16805
16873
|
operation: i,
|
|
16806
|
-
value: n ?
|
|
16874
|
+
value: n ? fy(n) : void 0
|
|
16807
16875
|
});
|
|
16808
16876
|
}
|
|
16809
16877
|
return r;
|
|
@@ -16816,271 +16884,296 @@ function ry(e, t) {
|
|
|
16816
16884
|
}
|
|
16817
16885
|
};
|
|
16818
16886
|
}
|
|
16819
|
-
function
|
|
16820
|
-
let i =
|
|
16821
|
-
|
|
16822
|
-
|
|
16823
|
-
|
|
16824
|
-
|
|
16825
|
-
|
|
16887
|
+
function my(e, r) {
|
|
16888
|
+
let i = /* @__PURE__ */ fn(null), a = 0;
|
|
16889
|
+
function o(e) {
|
|
16890
|
+
return new Promise((t) => {
|
|
16891
|
+
let n = {
|
|
16892
|
+
...e,
|
|
16893
|
+
id: ++a,
|
|
16894
|
+
resolve: t
|
|
16895
|
+
};
|
|
16896
|
+
i.value = n, z({
|
|
16897
|
+
type: "conflict",
|
|
16898
|
+
conflict: n
|
|
16899
|
+
});
|
|
16900
|
+
});
|
|
16901
|
+
}
|
|
16902
|
+
function s(e) {
|
|
16903
|
+
let t = i.value;
|
|
16904
|
+
t && (i.value = null, t.resolve({ action: e }));
|
|
16905
|
+
}
|
|
16906
|
+
let c = oy(e.storage);
|
|
16907
|
+
e.debug && c && c.onEvent((e) => console.log("[page-agent-sdk][storage]", e));
|
|
16908
|
+
let l = sy(e.llm) ? void 0 : e.llm, u = eg({
|
|
16909
|
+
model: l?.model,
|
|
16910
|
+
contextWindow: e.contextWindow ?? l?.contextWindow,
|
|
16911
|
+
maxOutputTokens: e.maxOutputTokens ?? l?.maxOutputTokens
|
|
16826
16912
|
});
|
|
16827
|
-
e.debug && console.log("[page-agent-sdk][modelCaps]",
|
|
16828
|
-
let
|
|
16829
|
-
e.debug && !
|
|
16830
|
-
let
|
|
16831
|
-
persist:
|
|
16832
|
-
B.sessionId &&
|
|
16913
|
+
e.debug && console.log("[page-agent-sdk][modelCaps]", u);
|
|
16914
|
+
let d = uy(e);
|
|
16915
|
+
e.debug && !d && console.warn("[page-agent-sdk][summarization] 未构造 llmInvoke(apiKey 缺失?),摘要回退零成本索引摘要");
|
|
16916
|
+
let f = /* @__PURE__ */ Qt([]), p = U_(e.vfs?.initialFiles, {
|
|
16917
|
+
persist: c ? { save: (e) => {
|
|
16918
|
+
B.sessionId && c && c.save(r, B.sessionId, { vfs: e });
|
|
16833
16919
|
} } : void 0,
|
|
16834
16920
|
maxBytes: e.vfs?.maxBytes
|
|
16835
|
-
}),
|
|
16921
|
+
}), m = bg(), h = Og(e.memory || ""), g = { current: null }, _ = e.checkpoint, v = _ !== void 0 && _ !== !1, y = v ? Gg({
|
|
16836
16922
|
windowPaths: (e.windowProps ?? []).map((e) => e.path),
|
|
16837
|
-
vfsStore:
|
|
16838
|
-
todosMw:
|
|
16839
|
-
getTodos: () =>
|
|
16840
|
-
messages:
|
|
16841
|
-
maxCheckpoints:
|
|
16842
|
-
}) : null,
|
|
16923
|
+
vfsStore: p,
|
|
16924
|
+
todosMw: m,
|
|
16925
|
+
getTodos: () => g.current?.getState?.()?.todos ?? [],
|
|
16926
|
+
messages: f,
|
|
16927
|
+
maxCheckpoints: _ && typeof _ == "object" ? _.maxCheckpoints : void 0
|
|
16928
|
+
}) : null, b = !_ || typeof _ != "object" || _.auto !== !1, x = e.capabilities, S = x?.windowOps !== !1, C = S ? Tv(e.windowProps || [], {
|
|
16843
16929
|
onAudit: e.debug ? (e) => console.log("[page-agent-sdk][window audit]", e) : void 0,
|
|
16844
|
-
maxSnapshots: e.maxSnapshots
|
|
16845
|
-
|
|
16846
|
-
C.
|
|
16847
|
-
|
|
16848
|
-
|
|
16849
|
-
|
|
16850
|
-
|
|
16851
|
-
|
|
16852
|
-
|
|
16853
|
-
|
|
16930
|
+
maxSnapshots: e.maxSnapshots,
|
|
16931
|
+
onConflict: o
|
|
16932
|
+
}) : [], w = S ? C.controller ?? null : null, T = () => w?.list() ?? e.windowProps ?? [], E = /* @__PURE__ */ new Map(), D = Av(x, C, Dv);
|
|
16933
|
+
D.forEach((e) => E.set(e.name, "builtin"));
|
|
16934
|
+
let O = [...e.tools || []];
|
|
16935
|
+
O.forEach((e) => E.set(e.name, "user"));
|
|
16936
|
+
let k = e.humanConfirm !== !1 && (!e.approval || e.approval.humanConfirmTool !== !1), A = k ? Lg() : null;
|
|
16937
|
+
A && E.set(Fg, "builtin");
|
|
16938
|
+
let j = v && y ? [n(async () => {
|
|
16939
|
+
let e = y.list();
|
|
16940
|
+
return e.length ? y.restore() ? `已回退到最近一次正常状态(checkpoint #${e[e.length - 1].id})。对话历史、window 注册属性、vfs、todos 已整体还原。请基于回退后的状态重新判断并继续。` : "回退失败:无可用 checkpoint。" : "无可用 checkpoint,无法回退。";
|
|
16854
16941
|
}, {
|
|
16855
16942
|
name: "restore_last_checkpoint",
|
|
16856
16943
|
description: "回退到最近一次正常状态(整体还原对话历史 + window 注册属性 + vfs + todos)。当本轮操作出错、页面被改坏、或走偏时调用,回到本轮起点重新来过。不传参数即回退最近一次。",
|
|
16857
16944
|
schema: t.object({}).optional()
|
|
16858
16945
|
}), n(async () => {
|
|
16859
|
-
let e =
|
|
16946
|
+
let e = y.list();
|
|
16860
16947
|
return e.length ? "可用 checkpoint:\n" + e.map((e) => `#${e.id} [${e.label ?? "auto"}] 消息数=${e.messageCount} 时间=${new Date(e.timestamp).toLocaleTimeString()}`).join("\n") : "无可用 checkpoint。";
|
|
16861
16948
|
}, {
|
|
16862
16949
|
name: "list_checkpoints",
|
|
16863
16950
|
description: "列出可用会话 checkpoint(回退点)。",
|
|
16864
16951
|
schema: t.object({}).optional()
|
|
16865
16952
|
})] : [];
|
|
16866
|
-
|
|
16867
|
-
let
|
|
16868
|
-
...
|
|
16869
|
-
...
|
|
16870
|
-
...
|
|
16871
|
-
...
|
|
16872
|
-
],
|
|
16873
|
-
e.verify?.check &&
|
|
16874
|
-
let
|
|
16875
|
-
llm:
|
|
16876
|
-
allTools:
|
|
16877
|
-
allowedTools:
|
|
16878
|
-
systemPrompt:
|
|
16879
|
-
temperature:
|
|
16880
|
-
maxTokens:
|
|
16881
|
-
skills:
|
|
16882
|
-
maxDepth:
|
|
16883
|
-
maxParallel:
|
|
16953
|
+
j.forEach((e) => E.set(e.name, "builtin"));
|
|
16954
|
+
let M = [
|
|
16955
|
+
...D,
|
|
16956
|
+
...O,
|
|
16957
|
+
...A ? [A] : [],
|
|
16958
|
+
...j
|
|
16959
|
+
], N = x?.planning !== !1, P = x?.skills !== !1, F = x?.vfs !== !1, I = x?.summarization !== !1, L = x?.memory !== !1, ee = x?.subagent !== !1, R = e.verify?.maxAttempts ?? 2, te = x?.verify === !0 && e.verify?.enabled !== !1 && R > 0;
|
|
16960
|
+
e.verify?.check && x?.verify !== !0 && console.warn("[page-agent-sdk][verify] 检测到 verify.check 但 capabilities.verify 未开启,verify 未装载");
|
|
16961
|
+
let ne = e.subagent, re = ne?.allowedTools ?? [], ie = !ee || ne?.enabled === !1 ? void 0 : e_({
|
|
16962
|
+
llm: ne?.llm ?? e.llm,
|
|
16963
|
+
allTools: M,
|
|
16964
|
+
allowedTools: re.length ? re : void 0,
|
|
16965
|
+
systemPrompt: ne?.systemPrompt,
|
|
16966
|
+
temperature: ne?.temperature,
|
|
16967
|
+
maxTokens: ne?.maxTokens,
|
|
16968
|
+
skills: ne?.skills,
|
|
16969
|
+
maxDepth: ne?.maxDepth,
|
|
16970
|
+
maxParallel: ne?.maxParallel,
|
|
16884
16971
|
debug: e.debug
|
|
16885
|
-
}),
|
|
16972
|
+
}), ae = e.subagents?.length ? r_(e.subagents, {
|
|
16886
16973
|
llm: e.llm,
|
|
16887
|
-
allTools:
|
|
16974
|
+
allTools: M,
|
|
16888
16975
|
debug: e.debug
|
|
16889
|
-
}) : void 0,
|
|
16976
|
+
}) : void 0, oe = [
|
|
16890
16977
|
"get_window_prop",
|
|
16891
16978
|
"get_window_paths",
|
|
16892
16979
|
"list_window_props",
|
|
16893
16980
|
"describe_window_prop",
|
|
16894
16981
|
"fetch_document"
|
|
16895
|
-
],
|
|
16896
|
-
check: e.verify.check ??
|
|
16982
|
+
], se = M.filter((e) => oe.includes(e.name)), ce = te ? i_({
|
|
16983
|
+
check: e.verify.check ?? u_({ schemas: () => Object.fromEntries(T().map((e) => [e.path, e.schema])) }),
|
|
16897
16984
|
adversarial: e.verify?.adversarial ? {
|
|
16898
16985
|
llm: e.llm,
|
|
16899
|
-
tools:
|
|
16986
|
+
tools: se
|
|
16900
16987
|
} : void 0
|
|
16901
|
-
}) : void 0,
|
|
16902
|
-
...
|
|
16903
|
-
humanConfirm:
|
|
16988
|
+
}) : void 0, le = Mv({
|
|
16989
|
+
...x,
|
|
16990
|
+
humanConfirm: k,
|
|
16904
16991
|
subagents: e.subagents?.map((e) => ({
|
|
16905
16992
|
id: e.id,
|
|
16906
16993
|
description: e.description,
|
|
16907
16994
|
temperature: e.temperature
|
|
16908
16995
|
}))
|
|
16909
|
-
},
|
|
16996
|
+
}, S && !!e.windowProps?.length), ue = e.onEvent, de = /* @__PURE__ */ new Set(), z = (e) => {
|
|
16910
16997
|
if (e.type !== "approval_request") {
|
|
16911
|
-
if (
|
|
16912
|
-
|
|
16998
|
+
if (ue) try {
|
|
16999
|
+
ue(e);
|
|
16913
17000
|
} catch {}
|
|
16914
|
-
for (let t of
|
|
17001
|
+
for (let t of de) try {
|
|
16915
17002
|
t(e);
|
|
16916
17003
|
} catch {}
|
|
16917
17004
|
}
|
|
16918
|
-
},
|
|
16919
|
-
|
|
16920
|
-
...
|
|
16921
|
-
...
|
|
16922
|
-
...
|
|
16923
|
-
...
|
|
16924
|
-
...
|
|
16925
|
-
llmInvoke:
|
|
16926
|
-
getRegisteredProps: () =>
|
|
17005
|
+
}, fe = [
|
|
17006
|
+
le,
|
|
17007
|
+
...N ? [m] : [],
|
|
17008
|
+
...P ? [Dg(e.skills || [], { readVfs: F ? (e) => p.files[e]?.content : void 0 })] : [],
|
|
17009
|
+
...F ? [X_(p)] : [],
|
|
17010
|
+
...I ? [P_({
|
|
17011
|
+
...R_(e, u.contextWindow),
|
|
17012
|
+
llmInvoke: d,
|
|
17013
|
+
getRegisteredProps: () => T().map((e) => ({
|
|
16927
17014
|
path: e.path,
|
|
16928
17015
|
description: e.description
|
|
16929
17016
|
})),
|
|
16930
17017
|
preserveLastToolResults: (e.contextOptions && e.contextOptions.preserveLastToolResults) ?? ["describe_window_prop", "list_window_props"]
|
|
16931
17018
|
})] : [],
|
|
16932
|
-
...
|
|
16933
|
-
...e.permissions?.length ? [
|
|
16934
|
-
...
|
|
16935
|
-
...
|
|
16936
|
-
...e.approval && (e.approval.tools !== void 0 || e.approval.confirm) ? [
|
|
16937
|
-
...
|
|
16938
|
-
...
|
|
16939
|
-
...
|
|
17019
|
+
...L ? [h] : [],
|
|
17020
|
+
...e.permissions?.length ? [Ng(e.permissions)] : [],
|
|
17021
|
+
...v && b && y ? [Kg(y)] : [],
|
|
17022
|
+
...k ? [Rg()] : [],
|
|
17023
|
+
...e.approval && (e.approval.tools !== void 0 || e.approval.confirm) ? [Pg(e.approval)] : [],
|
|
17024
|
+
...ce ? [ce] : [],
|
|
17025
|
+
...ie ? [ie] : [],
|
|
17026
|
+
...ae ? [ae] : [],
|
|
16940
17027
|
...e.middleware || [],
|
|
16941
|
-
|
|
16942
|
-
],
|
|
17028
|
+
py(z, f)
|
|
17029
|
+
], pe = e.maxMemoryRounds ?? ay, B = {
|
|
16943
17030
|
agentId: r,
|
|
16944
|
-
store:
|
|
16945
|
-
messages:
|
|
16946
|
-
vfsStore:
|
|
16947
|
-
listeners:
|
|
16948
|
-
todosMw:
|
|
16949
|
-
memoryMw:
|
|
17031
|
+
store: c,
|
|
17032
|
+
messages: f,
|
|
17033
|
+
vfsStore: p,
|
|
17034
|
+
listeners: de,
|
|
17035
|
+
todosMw: m,
|
|
17036
|
+
memoryMw: h,
|
|
16950
17037
|
agent: null,
|
|
16951
17038
|
initDone: Promise.resolve(),
|
|
16952
17039
|
sessionId: "",
|
|
16953
17040
|
refCount: 0,
|
|
16954
17041
|
mcpClosers: [],
|
|
16955
17042
|
mcpServers: [],
|
|
16956
|
-
checkpoint:
|
|
16957
|
-
windowOpsController:
|
|
16958
|
-
|
|
17043
|
+
checkpoint: y,
|
|
17044
|
+
windowOpsController: w,
|
|
17045
|
+
pendingConflict: i,
|
|
17046
|
+
liveWindowProps: T,
|
|
16959
17047
|
applySnapshot(t) {
|
|
16960
|
-
t.messages?.length &&
|
|
17048
|
+
t.messages?.length && f.push(...t.messages), t.vfs && p.hydrate && p.hydrate(t.vfs), t.todos?.length && m.reset(t.todos), t.memory && !e.memory && h.reset(t.memory);
|
|
16961
17049
|
},
|
|
16962
17050
|
afterRound() {
|
|
16963
|
-
|
|
17051
|
+
he(), ge();
|
|
16964
17052
|
},
|
|
16965
17053
|
async send(e) {
|
|
16966
|
-
await B.initDone,
|
|
17054
|
+
await B.initDone, f.push({
|
|
16967
17055
|
role: "user",
|
|
16968
17056
|
content: e,
|
|
16969
17057
|
timestamp: Date.now()
|
|
16970
17058
|
});
|
|
16971
17059
|
try {
|
|
16972
|
-
let e = await B.agent.invoke(
|
|
16973
|
-
return
|
|
17060
|
+
let e = await B.agent.invoke(f);
|
|
17061
|
+
return f.push({
|
|
16974
17062
|
role: "assistant",
|
|
16975
17063
|
content: e,
|
|
16976
17064
|
timestamp: Date.now()
|
|
16977
|
-
}), B.afterRound(),
|
|
17065
|
+
}), B.afterRound(), c && await c.flush(), e;
|
|
16978
17066
|
} catch (e) {
|
|
16979
|
-
throw
|
|
17067
|
+
throw z({
|
|
16980
17068
|
type: "error",
|
|
16981
17069
|
message: e?.message || String(e)
|
|
16982
17070
|
}), e;
|
|
16983
17071
|
}
|
|
16984
17072
|
},
|
|
16985
17073
|
async switchSession(t) {
|
|
16986
|
-
if (await B.initDone, !
|
|
16987
|
-
|
|
16988
|
-
let n = t ?? "",
|
|
16989
|
-
return n ? (
|
|
17074
|
+
if (await B.initDone, !c) throw Error("page-agent-sdk: storage 未开启,无法切换会话(请传 storage 选项)");
|
|
17075
|
+
s("keep_external"), p.flush?.(), await c.flush();
|
|
17076
|
+
let n = t ?? "", i;
|
|
17077
|
+
return n ? (i = await c.load(r, n), i || await c.createSession(r, e.session?.title, n)) : n = await c.createSession(r, e.session?.title), B.sessionId = n, f.splice(0, f.length), p.clear?.(), m.reset([]), e.memory || h.reset(""), B.agent.debugLogs.value = [], i ||= await c.load(r, n), i && B.applySnapshot(i), e.memory && c.save(r, B.sessionId, { memory: e.memory }), n;
|
|
16990
17078
|
},
|
|
16991
17079
|
stream: (e, t, n) => {
|
|
16992
17080
|
if (!B.agent) throw Error("page-agent-sdk: agent 尚未初始化完成,请先 await mount()");
|
|
16993
|
-
let r =
|
|
16994
|
-
t?.(e),
|
|
17081
|
+
let r = ue ? (e) => {
|
|
17082
|
+
t?.(e), z(e);
|
|
16995
17083
|
} : t;
|
|
17084
|
+
if (n) {
|
|
17085
|
+
let e = () => s("keep_external");
|
|
17086
|
+
n.aborted ? e() : n.addEventListener("abort", e, { once: !0 });
|
|
17087
|
+
}
|
|
16996
17088
|
return B.agent.stream(e, r, n);
|
|
16997
17089
|
},
|
|
16998
17090
|
release() {
|
|
16999
17091
|
if (B.refCount--, B.refCount <= 0) {
|
|
17000
|
-
|
|
17092
|
+
c && (p.flush?.(), c.flush(), c.dispose());
|
|
17001
17093
|
let e = B.mcpClosers.splice(0);
|
|
17002
|
-
e.length && Promise.allSettled(e.map((e) => e())),
|
|
17094
|
+
e.length && Promise.allSettled(e.map((e) => e())), cy.delete(r);
|
|
17003
17095
|
}
|
|
17004
17096
|
},
|
|
17097
|
+
resolveConflict: s,
|
|
17005
17098
|
getInfo() {
|
|
17006
17099
|
return {
|
|
17007
17100
|
id: r,
|
|
17008
|
-
model:
|
|
17009
|
-
systemPrompt: e.systemPrompt ??
|
|
17010
|
-
tools:
|
|
17101
|
+
model: sy(e.llm) ? e.llm.model ?? e.llm.modelName : e.llm.model,
|
|
17102
|
+
systemPrompt: e.systemPrompt ?? iy,
|
|
17103
|
+
tools: M.map((e) => ({
|
|
17011
17104
|
name: e.name,
|
|
17012
17105
|
description: e.description,
|
|
17013
17106
|
schema: e.schema,
|
|
17014
|
-
source:
|
|
17107
|
+
source: E.get(e.name) || "user"
|
|
17015
17108
|
})),
|
|
17016
17109
|
skills: (e.skills ?? []).map((e) => ({
|
|
17017
17110
|
name: e.name,
|
|
17018
17111
|
description: e.description
|
|
17019
17112
|
})),
|
|
17020
|
-
windowProps:
|
|
17113
|
+
windowProps: T().map((e) => ({
|
|
17021
17114
|
path: e.path,
|
|
17022
17115
|
description: e.description,
|
|
17023
17116
|
schema: e.schema
|
|
17024
17117
|
})),
|
|
17025
17118
|
memory: e.memory ?? "",
|
|
17026
|
-
middleware:
|
|
17119
|
+
middleware: fe.map((e) => e.name),
|
|
17027
17120
|
todos: (B.agent?.getState?.()?.todos ?? []).map((e) => ({
|
|
17028
17121
|
content: e.content,
|
|
17029
17122
|
status: e.status
|
|
17030
17123
|
})),
|
|
17031
17124
|
subagent: {
|
|
17032
|
-
enabled: !!
|
|
17125
|
+
enabled: !!ie,
|
|
17033
17126
|
maxDepth: e.subagent?.maxDepth ?? 1,
|
|
17034
17127
|
maxParallel: e.subagent?.maxParallel ?? 4,
|
|
17035
17128
|
allowedTools: e.subagent?.allowedTools ?? []
|
|
17036
17129
|
},
|
|
17037
17130
|
verify: {
|
|
17038
|
-
enabled: !!
|
|
17039
|
-
maxAttempts:
|
|
17040
|
-
adversarial:
|
|
17131
|
+
enabled: !!ce,
|
|
17132
|
+
maxAttempts: te ? R : 0,
|
|
17133
|
+
adversarial: te && !!e.verify?.adversarial
|
|
17041
17134
|
},
|
|
17042
17135
|
mcp: { servers: B.mcpServers },
|
|
17043
17136
|
lastCompression: B.agent?.getState?.()?.lastCompression,
|
|
17044
|
-
checkpoints:
|
|
17137
|
+
checkpoints: y ? {
|
|
17045
17138
|
enabled: !0,
|
|
17046
|
-
auto:
|
|
17047
|
-
list:
|
|
17139
|
+
auto: b,
|
|
17140
|
+
list: y.list()
|
|
17048
17141
|
} : void 0
|
|
17049
17142
|
};
|
|
17050
17143
|
}
|
|
17051
17144
|
};
|
|
17052
|
-
async function
|
|
17053
|
-
if (!
|
|
17054
|
-
await
|
|
17145
|
+
async function me() {
|
|
17146
|
+
if (!c) return;
|
|
17147
|
+
await c.ready;
|
|
17055
17148
|
let t = e.session || {};
|
|
17056
17149
|
if (t.id) {
|
|
17057
17150
|
B.sessionId = t.id;
|
|
17058
|
-
let e = await
|
|
17059
|
-
e ? B.applySnapshot(e) : await
|
|
17151
|
+
let e = await c.load(r, B.sessionId);
|
|
17152
|
+
e ? B.applySnapshot(e) : await c.createSession(r, t.title, B.sessionId);
|
|
17060
17153
|
} else if (t.autoResume !== !1) {
|
|
17061
|
-
let n = await
|
|
17154
|
+
let n = await c.listSessions(r);
|
|
17062
17155
|
if (e.debug && console.log("[page-agent-sdk][restore] listSessions", r, n.length, n.map((e) => e.sessionId)), n.length) {
|
|
17063
17156
|
B.sessionId = n[0].sessionId;
|
|
17064
|
-
let t = await
|
|
17157
|
+
let t = await c.load(r, B.sessionId);
|
|
17065
17158
|
t ? (B.applySnapshot(t), e.debug && console.log("[page-agent-sdk][restore] 恢复会话", B.sessionId, `${t.messages?.length ?? 0} msgs`)) : e.debug && console.log("[page-agent-sdk][restore] 会话 meta 存在但快照为空", B.sessionId);
|
|
17066
|
-
} else B.sessionId = await
|
|
17067
|
-
} else B.sessionId = await
|
|
17068
|
-
e.memory &&
|
|
17069
|
-
}
|
|
17070
|
-
function
|
|
17071
|
-
let e =
|
|
17072
|
-
e.trimmed &&
|
|
17073
|
-
}
|
|
17074
|
-
function
|
|
17075
|
-
if (!B.sessionId || !
|
|
17076
|
-
let t = JSON.parse(JSON.stringify(
|
|
17077
|
-
|
|
17159
|
+
} else B.sessionId = await c.createSession(r, t.title), e.debug && console.log("[page-agent-sdk][restore] 新建会话(无历史)", B.sessionId);
|
|
17160
|
+
} else B.sessionId = await c.createSession(r, t.title);
|
|
17161
|
+
e.memory && c.save(r, B.sessionId, { memory: e.memory });
|
|
17162
|
+
}
|
|
17163
|
+
function he() {
|
|
17164
|
+
let e = w_(f, pe);
|
|
17165
|
+
e.trimmed && f.splice(e.deleteFrom, e.deleteCount, e.summary);
|
|
17166
|
+
}
|
|
17167
|
+
function ge() {
|
|
17168
|
+
if (!B.sessionId || !c) return;
|
|
17169
|
+
let t = JSON.parse(JSON.stringify(f));
|
|
17170
|
+
c.save(r, B.sessionId, { messages: t });
|
|
17078
17171
|
let n = B.agent?.getState?.()?.todos ?? [];
|
|
17079
|
-
|
|
17172
|
+
c.save(r, B.sessionId, { todos: n }), e.debug && console.log("[page-agent-sdk][persist] save", B.sessionId, `${f.length} msgs`);
|
|
17080
17173
|
}
|
|
17081
17174
|
return B.initDone = (async () => {
|
|
17082
|
-
if (await
|
|
17083
|
-
let t = await Promise.allSettled(e.mcp.map((e) =>
|
|
17175
|
+
if (await me(), e.mcp?.length) {
|
|
17176
|
+
let t = await Promise.allSettled(e.mcp.map((e) => b_(e)));
|
|
17084
17177
|
B.mcpClosers = t.flatMap((e) => e.status === "fulfilled" ? [e.value.close] : []), B.mcpServers = [];
|
|
17085
17178
|
let n = [];
|
|
17086
17179
|
t.forEach((t, r) => {
|
|
@@ -17089,35 +17182,35 @@ function iy(e, r) {
|
|
|
17089
17182
|
name: a,
|
|
17090
17183
|
url: i.url,
|
|
17091
17184
|
toolCount: t.value.tools.length
|
|
17092
|
-
}), t.value.tools.forEach((e) =>
|
|
17093
|
-
}),
|
|
17185
|
+
}), t.value.tools.forEach((e) => E.set(e.name, `mcp:${a}`)), n.push(...t.value.tools)) : console.warn(`[page-agent-sdk][mcp] server ${a} 连接失败:`, t.reason);
|
|
17186
|
+
}), M.push(...n), e.debug && console.log(`[page-agent-sdk][mcp] 注入 ${n.length} 个工具,${B.mcpServers.length} 个 server`);
|
|
17094
17187
|
}
|
|
17095
|
-
B.agent =
|
|
17096
|
-
...
|
|
17188
|
+
B.agent = vg({
|
|
17189
|
+
...sy(e.llm) ? { llm: e.llm } : {
|
|
17097
17190
|
apiKey: e.llm.apiKey,
|
|
17098
17191
|
baseUrl: e.llm.baseUrl,
|
|
17099
17192
|
model: e.llm.model,
|
|
17100
17193
|
temperature: e.llm.temperature,
|
|
17101
17194
|
maxTokens: e.llm.maxTokens
|
|
17102
17195
|
},
|
|
17103
|
-
systemPrompt: e.systemPrompt ??
|
|
17104
|
-
tools:
|
|
17105
|
-
middleware:
|
|
17196
|
+
systemPrompt: e.systemPrompt ?? iy,
|
|
17197
|
+
tools: M,
|
|
17198
|
+
middleware: fe,
|
|
17106
17199
|
maxToolRounds: e.maxToolRounds,
|
|
17107
17200
|
maxRetries: e.maxRetries,
|
|
17108
17201
|
maxParallelTools: e.maxParallelTools,
|
|
17109
|
-
contextWindow:
|
|
17110
|
-
maxOutputTokens:
|
|
17111
|
-
maxVerifyAttempts:
|
|
17202
|
+
contextWindow: u.contextWindow,
|
|
17203
|
+
maxOutputTokens: u.maxOutputTokens,
|
|
17204
|
+
maxVerifyAttempts: te ? R : 0,
|
|
17112
17205
|
debug: e.debug
|
|
17113
|
-
}),
|
|
17206
|
+
}), g.current = B.agent;
|
|
17114
17207
|
})(), B;
|
|
17115
17208
|
}
|
|
17116
|
-
function
|
|
17117
|
-
let t = e.id ??
|
|
17209
|
+
function hy(e) {
|
|
17210
|
+
let t = e.id ?? Nv();
|
|
17118
17211
|
e.id || console.warn(`[page-agent-sdk] 未传 options.id,已生成随机 id "${t}"。刷新后持久化数据无法恢复,请传稳定 id。`);
|
|
17119
|
-
let n = e.streaming ?? !0, r = e.ui ?? "default", i, a = e.shareContext ?
|
|
17120
|
-
a ? i = a : (i =
|
|
17212
|
+
let n = e.streaming ?? !0, r = e.ui ?? "default", i, a = e.shareContext ? cy.get(t) : void 0;
|
|
17213
|
+
a ? i = a : (i = my(e, t), e.shareContext && cy.set(t, i)), i.refCount++;
|
|
17121
17214
|
let o = null, s = null, c = null;
|
|
17122
17215
|
async function l() {
|
|
17123
17216
|
if (await i.initDone, r === !1) {
|
|
@@ -17132,9 +17225,15 @@ function ay(e) {
|
|
|
17132
17225
|
if (!t) throw Error(`createChatSdk: 挂载点未找到(${e.container})`);
|
|
17133
17226
|
let a = i.agent.debugLogs;
|
|
17134
17227
|
o = ul(/* @__PURE__ */ wi({ setup() {
|
|
17135
|
-
return () => Bs(
|
|
17228
|
+
return () => Bs(Jh, {
|
|
17136
17229
|
fetchStream: n ? i.agent.stream : void 0,
|
|
17137
|
-
fetchResponse: n ? void 0 : (e, t) =>
|
|
17230
|
+
fetchResponse: n ? void 0 : (e, t) => {
|
|
17231
|
+
if (t) {
|
|
17232
|
+
let e = () => i.resolveConflict("keep_external");
|
|
17233
|
+
t.aborted ? e() : t.addEventListener("abort", e, { once: !0 });
|
|
17234
|
+
}
|
|
17235
|
+
return i.agent.invoke(e, t);
|
|
17236
|
+
},
|
|
17138
17237
|
title: e.title,
|
|
17139
17238
|
placeholder: e.placeholder,
|
|
17140
17239
|
debugLogs: a.value,
|
|
@@ -17146,8 +17245,10 @@ function ay(e) {
|
|
|
17146
17245
|
i.afterRound(), i.store && await i.store.flush();
|
|
17147
17246
|
},
|
|
17148
17247
|
onClear: () => {
|
|
17149
|
-
i.store && (i.sessionId =
|
|
17150
|
-
}
|
|
17248
|
+
i.store && (i.sessionId = Nv(), i.vfsStore.clear?.(), i.todosMw.reset([]), e.memory || i.memoryMw.reset(""), i.agent.debugLogs.value = [], i.store.createSession(i.agentId, e.session?.title, i.sessionId));
|
|
17249
|
+
},
|
|
17250
|
+
pendingConflict: i.pendingConflict.value,
|
|
17251
|
+
onResolveConflict: (e) => i.resolveConflict(e)
|
|
17151
17252
|
});
|
|
17152
17253
|
} })), o.mount(t), i.store && (s = () => {
|
|
17153
17254
|
i.vfsStore.flush?.(), i.store.flush();
|
|
@@ -17156,7 +17257,7 @@ function ay(e) {
|
|
|
17156
17257
|
}, typeof window < "u" && window.addEventListener("pagehide", s), typeof document < "u" && document.addEventListener("visibilitychange", c));
|
|
17157
17258
|
}
|
|
17158
17259
|
function u() {
|
|
17159
|
-
s && typeof window < "u" && window.removeEventListener("pagehide", s), c && typeof document < "u" && document.removeEventListener("visibilitychange", c), s = null, c = null, o?.unmount(), o = null, i.release();
|
|
17260
|
+
i.resolveConflict("keep_external"), s && typeof window < "u" && window.removeEventListener("pagehide", s), c && typeof document < "u" && document.removeEventListener("visibilitychange", c), s = null, c = null, o?.unmount(), o = null, i.release();
|
|
17160
17261
|
}
|
|
17161
17262
|
return {
|
|
17162
17263
|
mount: l,
|
|
@@ -17177,12 +17278,14 @@ function ay(e) {
|
|
|
17177
17278
|
i.windowOpsController.add(e);
|
|
17178
17279
|
},
|
|
17179
17280
|
removeWindowProp: (e) => i.windowOpsController ? i.windowOpsController.remove(e) : !1,
|
|
17180
|
-
listWindowProps: () => i.liveWindowProps()
|
|
17281
|
+
listWindowProps: () => i.liveWindowProps(),
|
|
17282
|
+
pendingConflict: i.pendingConflict,
|
|
17283
|
+
resolveConflict: (e) => i.resolveConflict(e)
|
|
17181
17284
|
};
|
|
17182
17285
|
}
|
|
17183
17286
|
//#endregion
|
|
17184
17287
|
//#region src/core/sdk/defineTool.ts
|
|
17185
|
-
function
|
|
17288
|
+
function gy(e) {
|
|
17186
17289
|
return n(async (t) => {
|
|
17187
17290
|
let n = await e.handler(t);
|
|
17188
17291
|
return typeof n == "string" ? n : JSON.stringify(n);
|
|
@@ -17193,4 +17296,4 @@ function oy(e) {
|
|
|
17193
17296
|
});
|
|
17194
17297
|
}
|
|
17195
17298
|
//#endregion
|
|
17196
|
-
export {
|
|
17299
|
+
export { L_ as CONTEXT_PRESETS, Jh as ChatDialog, Qd as CodePreview, Fg as HUMAN_CONFIRM_TOOL_NAME, ef as MessageContent, b_ as connectMcp, vg as createAgent, Pg as createApprovalMiddleware, hy as createChatSdk, Gg as createCheckpointManager, Kg as createCheckpointMiddleware, Rg as createHumanConfirmMiddleware, Lg as createHumanConfirmTool, $v as createMemoryBackend, ry as createSessionStore, e_ as createSubagentMiddleware, r_ as createSubagentsMiddleware, Mv as createUsageHintsMiddleware, i_ as createVerifyMiddleware, U_ as createVfs, ty as createWebStorageBackend, Tv as createWindowOps, u_ as createWriteBackCheck, xg as defineSkill, gy as defineTool, kv as defineWindowToolset, pg as detectGarbledToolCall, tg as estimateTokens, __ as extractText, Dv as fetchDocTools, Ov as fetchTools, z_ as formatZodIssues, Gv as isQuotaError, ov as jpEval, V_ as jsonParseError, rg as offloadPassThroughChars, ng as offloadThresholdChars, F_ as presets, R_ as resolveContextOptions, eg as resolveModelCaps, dv as runSandboxedScript, cv as searchJson, Av as selectBuiltinTools, I_ as systemPromptHelpers, $ as toolError, xl as useChat, e as z, B_ as zodError };
|