page-agent-sdk 4.8.3 → 4.9.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.
@@ -407,17 +407,17 @@ function E(e, t = {}) {
407
407
  ...e.extraBody ? { modelKwargs: e.extraBody } : {}
408
408
  });
409
409
  }
410
- function ee(e) {
410
+ function D(e) {
411
411
  return e.some((e, t) => t > 0 && e.getType() === "system") ? e.map((e, t) => t === 0 || e.getType() !== "system" ? e : new i({ content: typeof e.content == "string" ? `〔系统注记〕\n${e.content}` : e.content })) : e;
412
412
  }
413
- function D(e) {
414
- let t = e, n = (e) => Array.isArray(e) ? ee(e) : e, r = t.invoke.bind(e), i = t.stream.bind(e);
413
+ function O(e) {
414
+ let t = e, n = (e) => Array.isArray(e) ? D(e) : e, r = t.invoke.bind(e), i = t.stream.bind(e);
415
415
  return t.invoke = async (e, t) => r(n(e), t), t.stream = async (e, t) => i(n(e), t), e;
416
416
  }
417
- async function te(e, t = {}) {
417
+ async function ee(e, t = {}) {
418
418
  if (e = S(e, C(e, t.thinkingMode, t.thinkingFallback)), (e.provider ?? "openai") === "openai") return E(e, t);
419
419
  let { ChatAnthropic: n } = await import("@langchain/anthropic");
420
- return D(new n({
420
+ return O(new n({
421
421
  apiKey: e.apiKey,
422
422
  model: e.model,
423
423
  temperature: e.thinking ? 1 : t.temperature ?? e.temperature,
@@ -433,15 +433,15 @@ async function te(e, t = {}) {
433
433
  }
434
434
  //#endregion
435
435
  //#region src/core/utils/contentParts.ts
436
- function ne(e) {
436
+ function te(e) {
437
437
  let t = e.content;
438
438
  return typeof t == "string" ? t : Array.isArray(t) ? t.map((e) => typeof e == "string" ? e : e?.type === "text" && typeof e.text == "string" ? e.text : "").join("") : "";
439
439
  }
440
- function re(e) {
440
+ function ne(e) {
441
441
  let t = e.additional_kwargs || {}, n = t.reasoning_content || t.reasoning || "";
442
442
  return !n && Array.isArray(e.content) && (n = e.content.map((e) => e?.type === "thinking" ? e.thinking ?? "" : e?.type === "thinking_delta" ? e.delta ?? e.thinking ?? "" : "").join("")), n;
443
443
  }
444
- function ie(e) {
444
+ function re(e) {
445
445
  let t = e, n = [
446
446
  t?.additional_kwargs?.usage,
447
447
  t?.usage_metadata,
@@ -449,9 +449,9 @@ function ie(e) {
449
449
  t?.response_metadata?.token_usage,
450
450
  t?.response_metadata?.tokenUsage
451
451
  ];
452
- for (let e of n) if (e && typeof e == "object" && ae(e)) return e;
452
+ for (let e of n) if (e && typeof e == "object" && ie(e)) return e;
453
453
  }
454
- function ae(e) {
454
+ function ie(e) {
455
455
  return [
456
456
  "prompt_tokens",
457
457
  "completion_tokens",
@@ -465,8 +465,8 @@ function ae(e) {
465
465
  "outputTokens"
466
466
  ].some((t) => typeof e[t] == "number" && e[t] > 0);
467
467
  }
468
- function oe(e) {
469
- let t = ie(e);
468
+ function ae(e) {
469
+ let t = re(e);
470
470
  if (!t || typeof t != "object") return null;
471
471
  let n = t, r = Number(n.prompt_tokens ?? n.promptTokens ?? n.input_tokens ?? n.inputTokens ?? 0) || 0, i = Number(n.completion_tokens ?? n.completionTokens ?? n.output_tokens ?? n.outputTokens ?? 0) || 0, a = Number(n.total_tokens ?? n.totalTokens ?? r + i) || 0;
472
472
  if (!r && !i && !a) return null;
@@ -483,17 +483,17 @@ function oe(e) {
483
483
  //#endregion
484
484
  //#region node_modules/@vue/shared/dist/shared.esm-bundler.js
485
485
  // @__NO_SIDE_EFFECTS__
486
- function O(e) {
486
+ function k(e) {
487
487
  let t = /* @__PURE__ */ Object.create(null);
488
488
  for (let n of e.split(",")) t[n] = 1;
489
489
  return (e) => e in t;
490
490
  }
491
- var k = process.env.NODE_ENV === "production" ? {} : Object.freeze({});
491
+ var A = process.env.NODE_ENV === "production" ? {} : Object.freeze({});
492
492
  process.env.NODE_ENV === "production" || Object.freeze([]);
493
- var A = () => {}, se = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && (e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97), j = (e) => e.startsWith("onUpdate:"), M = Object.assign, N = (e, t) => {
493
+ var j = () => {}, oe = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && (e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97), M = (e) => e.startsWith("onUpdate:"), N = Object.assign, P = (e, t) => {
494
494
  let n = e.indexOf(t);
495
495
  n > -1 && e.splice(n, 1);
496
- }, ce = Object.prototype.hasOwnProperty, P = (e, t) => ce.call(e, t), F = Array.isArray, le = (e) => B(e) === "[object Map]", ue = (e) => B(e) === "[object Set]", I = (e) => typeof e == "function", de = (e) => typeof e == "string", L = (e) => typeof e == "symbol", R = (e) => typeof e == "object" && !!e, z = (e) => (R(e) || I(e)) && I(e.then) && I(e.catch), fe = Object.prototype.toString, B = (e) => fe.call(e), pe = (e) => B(e).slice(8, -1), me = (e) => B(e) === "[object Object]", V = (e) => de(e) && e !== "NaN" && e[0] !== "-" && "" + parseInt(e, 10) === e, he = ((e) => {
496
+ }, se = Object.prototype.hasOwnProperty, F = (e, t) => se.call(e, t), I = Array.isArray, ce = (e) => B(e) === "[object Map]", le = (e) => B(e) === "[object Set]", L = (e) => typeof e == "function", ue = (e) => typeof e == "string", R = (e) => typeof e == "symbol", de = (e) => typeof e == "object" && !!e, z = (e) => (de(e) || L(e)) && L(e.then) && L(e.catch), fe = Object.prototype.toString, B = (e) => fe.call(e), pe = (e) => B(e).slice(8, -1), me = (e) => B(e) === "[object Object]", V = (e) => ue(e) && e !== "NaN" && e[0] !== "-" && "" + parseInt(e, 10) === e, he = ((e) => {
497
497
  let t = /* @__PURE__ */ Object.create(null);
498
498
  return ((n) => t[n] || (t[n] = e(n)));
499
499
  })((e) => e.charAt(0).toUpperCase() + e.slice(1)), ge = (e, t) => !Object.is(e, t), _e = (e, t, n, r = !1) => {
@@ -505,14 +505,14 @@ var A = () => {}, se = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110
505
505
  });
506
506
  }, H, ve = () => H ||= typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {};
507
507
  function U(e) {
508
- if (F(e)) {
508
+ if (I(e)) {
509
509
  let t = {};
510
510
  for (let n = 0; n < e.length; n++) {
511
- let r = e[n], i = de(r) ? Se(r) : U(r);
511
+ let r = e[n], i = ue(r) ? Se(r) : U(r);
512
512
  if (i) for (let e in i) t[e] = i[e];
513
513
  }
514
514
  return t;
515
- } else if (de(e) || R(e)) return e;
515
+ } else if (ue(e) || de(e)) return e;
516
516
  }
517
517
  var ye = /;(?![^(]*\))/g, be = /:([^]+)/, xe = /\/\*[^]*?\*\//g;
518
518
  function Se(e) {
@@ -526,12 +526,12 @@ function Se(e) {
526
526
  }
527
527
  function W(e) {
528
528
  let t = "";
529
- if (de(e)) t = e;
530
- else if (F(e)) for (let n = 0; n < e.length; n++) {
529
+ if (ue(e)) t = e;
530
+ else if (I(e)) for (let n = 0; n < e.length; n++) {
531
531
  let r = W(e[n]);
532
532
  r && (t += r + " ");
533
533
  }
534
- else if (R(e)) for (let n in e) e[n] && (t += n + " ");
534
+ else if (de(e)) for (let n in e) e[n] && (t += n + " ");
535
535
  return t.trim();
536
536
  }
537
537
  //#endregion
@@ -695,7 +695,7 @@ var We = 0, Ge = class {
695
695
  let e = t.nextDep;
696
696
  e.prevDep = t.prevDep, t.prevDep && (t.prevDep.nextDep = e), t.prevDep = G.depsTail, t.nextDep = void 0, G.depsTail.nextDep = t, G.depsTail = t, G.deps === t && (G.deps = e);
697
697
  }
698
- return process.env.NODE_ENV !== "production" && G.onTrack && G.onTrack(M({ effect: G }, e)), t;
698
+ return process.env.NODE_ENV !== "production" && G.onTrack && G.onTrack(N({ effect: G }, e)), t;
699
699
  }
700
700
  trigger(e) {
701
701
  this.version++, We++, this.notify(e);
@@ -703,7 +703,7 @@ var We = 0, Ge = class {
703
703
  notify(e) {
704
704
  Me();
705
705
  try {
706
- if (process.env.NODE_ENV !== "production") for (let t = this.subsHead; t; t = t.nextSub) t.sub.onTrigger && !(t.sub.flags & 8) && t.sub.onTrigger(M({ effect: t.sub }, e));
706
+ if (process.env.NODE_ENV !== "production") for (let t = this.subsHead; t; t = t.nextSub) t.sub.onTrigger && !(t.sub.flags & 8) && t.sub.onTrigger(N({ effect: t.sub }, e));
707
707
  for (let e = this.subs; e; e = e.prevSub) e.sub.notify() && e.sub.dep.notify();
708
708
  } finally {
709
709
  Ne();
@@ -752,21 +752,21 @@ function Qe(e, t, n, r, i, a) {
752
752
  };
753
753
  if (Me(), t === "clear") o.forEach(s);
754
754
  else {
755
- let i = F(e), a = i && V(n);
755
+ let i = I(e), a = i && V(n);
756
756
  if (i && n === "length") {
757
757
  let e = Number(r);
758
758
  o.forEach((t, n) => {
759
- (n === "length" || n === Ze || !L(n) && n >= e) && s(t);
759
+ (n === "length" || n === Ze || !R(n) && n >= e) && s(t);
760
760
  });
761
761
  } else switch ((n !== void 0 || o.has(void 0)) && s(o.get(n)), a && s(o.get(Ze)), t) {
762
762
  case "add":
763
- i ? a && s(o.get("length")) : (s(o.get(Ye)), le(e) && s(o.get(Xe)));
763
+ i ? a && s(o.get("length")) : (s(o.get(Ye)), ce(e) && s(o.get(Xe)));
764
764
  break;
765
765
  case "delete":
766
- i || (s(o.get(Ye)), le(e) && s(o.get(Xe)));
766
+ i || (s(o.get(Ye)), ce(e) && s(o.get(Xe)));
767
767
  break;
768
768
  case "set":
769
- le(e) && s(o.get(Ye));
769
+ ce(e) && s(o.get(Ye));
770
770
  break;
771
771
  }
772
772
  }
@@ -788,7 +788,7 @@ var nt = {
788
788
  return rt(this, Symbol.iterator, (e) => tt(this, e));
789
789
  },
790
790
  concat(...e) {
791
- return $e(this).concat(...e.map((e) => F(e) ? $e(e) : e));
791
+ return $e(this).concat(...e.map((e) => I(e) ? $e(e) : e));
792
792
  },
793
793
  entries() {
794
794
  return rt(this, "entries", (e) => (e[1] = tt(this, e[1]), e));
@@ -910,9 +910,9 @@ function ct(e, t, n = []) {
910
910
  let r = (/* @__PURE__ */ X(e))[t].apply(e, n);
911
911
  return Ne(), He(), r;
912
912
  }
913
- var lt = /* @__PURE__ */ O("__proto__,__v_isRef,__isVue"), ut = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((e) => e !== "arguments" && e !== "caller").map((e) => Symbol[e]).filter(L));
913
+ var lt = /* @__PURE__ */ k("__proto__,__v_isRef,__isVue"), ut = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((e) => e !== "arguments" && e !== "caller").map((e) => Symbol[e]).filter(R));
914
914
  function dt(e) {
915
- L(e) || (e = String(e));
915
+ R(e) || (e = String(e));
916
916
  let t = /* @__PURE__ */ X(this);
917
917
  return q(t, "has", e), t.hasOwnProperty(e);
918
918
  }
@@ -927,43 +927,43 @@ var ft = class {
927
927
  if (t === "__v_isReadonly") return r;
928
928
  if (t === "__v_isShallow") return i;
929
929
  if (t === "__v_raw") return n === (r ? i ? At : kt : i ? Ot : Dt).get(e) || Object.getPrototypeOf(e) === Object.getPrototypeOf(n) ? e : void 0;
930
- let a = F(e);
930
+ let a = I(e);
931
931
  if (!r) {
932
932
  let e;
933
933
  if (a && (e = nt[t])) return e;
934
934
  if (t === "hasOwnProperty") return dt;
935
935
  }
936
936
  let o = Reflect.get(e, t, /* @__PURE__ */ Ht(e) ? e : n);
937
- if ((L(t) ? ut.has(t) : lt(t)) || (r || q(e, "get", t), i)) return o;
937
+ if ((R(t) ? ut.has(t) : lt(t)) || (r || q(e, "get", t), i)) return o;
938
938
  if (/* @__PURE__ */ Ht(o)) {
939
939
  let e = a && V(t) ? o : o.value;
940
- return r && R(e) ? /* @__PURE__ */ Nt(e) : e;
940
+ return r && de(e) ? /* @__PURE__ */ Nt(e) : e;
941
941
  }
942
- return R(o) ? r ? /* @__PURE__ */ Nt(o) : /* @__PURE__ */ Mt(o) : o;
942
+ return de(o) ? r ? /* @__PURE__ */ Nt(o) : /* @__PURE__ */ Mt(o) : o;
943
943
  }
944
944
  }, pt = class extends ft {
945
945
  constructor(e = !1) {
946
946
  super(!1, e);
947
947
  }
948
948
  set(e, t, n, r) {
949
- let i = e[t], a = F(e) && V(t);
949
+ let i = e[t], a = I(e) && V(t);
950
950
  if (!this._isShallow) {
951
951
  let r = /* @__PURE__ */ Lt(i);
952
952
  if (!/* @__PURE__ */ Y(n) && !/* @__PURE__ */ Lt(n) && (i = /* @__PURE__ */ X(i), n = /* @__PURE__ */ X(n)), !a && /* @__PURE__ */ Ht(i) && !/* @__PURE__ */ Ht(n)) return r ? (process.env.NODE_ENV !== "production" && Ce(`Set operation on key "${String(t)}" failed: target is readonly.`, e[t]), !0) : (i.value = n, !0);
953
953
  }
954
- let o = a ? Number(t) < e.length : P(e, t), s = Reflect.set(e, t, n, /* @__PURE__ */ Ht(e) ? e : r);
954
+ let o = a ? Number(t) < e.length : F(e, t), s = Reflect.set(e, t, n, /* @__PURE__ */ Ht(e) ? e : r);
955
955
  return e === /* @__PURE__ */ X(r) && s && (o ? ge(n, i) && Qe(e, "set", t, n, i) : Qe(e, "add", t, n)), s;
956
956
  }
957
957
  deleteProperty(e, t) {
958
- let n = P(e, t), r = e[t], i = Reflect.deleteProperty(e, t);
958
+ let n = F(e, t), r = e[t], i = Reflect.deleteProperty(e, t);
959
959
  return i && n && Qe(e, "delete", t, void 0, r), i;
960
960
  }
961
961
  has(e, t) {
962
962
  let n = Reflect.has(e, t);
963
- return (!L(t) || !ut.has(t)) && q(e, "has", t), n;
963
+ return (!R(t) || !ut.has(t)) && q(e, "has", t), n;
964
964
  }
965
965
  ownKeys(e) {
966
- return q(e, "iterate", F(e) ? "length" : Ye), Reflect.ownKeys(e);
966
+ return q(e, "iterate", I(e) ? "length" : Ye), Reflect.ownKeys(e);
967
967
  }
968
968
  }, mt = class extends ft {
969
969
  constructor(e = !1) {
@@ -978,8 +978,8 @@ var ft = class {
978
978
  }, ht = /* @__PURE__ */ new pt(), gt = /* @__PURE__ */ new mt(), _t = /* @__PURE__ */ new mt(!0), vt = (e) => e, yt = (e) => Reflect.getPrototypeOf(e);
979
979
  function J(e, t, n) {
980
980
  return function(...r) {
981
- let i = this.__v_raw, a = /* @__PURE__ */ X(i), o = le(a), s = e === "entries" || e === Symbol.iterator && o, c = e === "keys" && o, l = i[e](...r), u = n ? vt : t ? Vt : Bt;
982
- return !t && q(a, "iterate", c ? Xe : Ye), M(Object.create(l), { next() {
981
+ let i = this.__v_raw, a = /* @__PURE__ */ X(i), o = ce(a), s = e === "entries" || e === Symbol.iterator && o, c = e === "keys" && o, l = i[e](...r), u = n ? vt : t ? Vt : Bt;
982
+ return !t && q(a, "iterate", c ? Xe : Ye), N(Object.create(l), { next() {
983
983
  let { value: e, done: t } = l.next();
984
984
  return t ? {
985
985
  value: e,
@@ -1023,7 +1023,7 @@ function xt(e, t) {
1023
1023
  return !e && q(o, "iterate", Ye), a.forEach((e, t) => n.call(r, s(e), s(t), i));
1024
1024
  }
1025
1025
  };
1026
- return M(n, e ? {
1026
+ return N(n, e ? {
1027
1027
  add: bt("add"),
1028
1028
  set: bt("set"),
1029
1029
  delete: bt("delete"),
@@ -1047,7 +1047,7 @@ function xt(e, t) {
1047
1047
  return i && Qe(t, "delete", e, void 0, a), o;
1048
1048
  },
1049
1049
  clear() {
1050
- let e = /* @__PURE__ */ X(this), t = e.size !== 0, n = process.env.NODE_ENV === "production" ? void 0 : le(e) ? new Map(e) : new Set(e), r = e.clear();
1050
+ let e = /* @__PURE__ */ X(this), t = e.size !== 0, n = process.env.NODE_ENV === "production" ? void 0 : ce(e) ? new Map(e) : new Set(e), r = e.clear();
1051
1051
  return t && Qe(e, "clear", void 0, void 0, n), r;
1052
1052
  }
1053
1053
  }), [
@@ -1061,7 +1061,7 @@ function xt(e, t) {
1061
1061
  }
1062
1062
  function St(e, t) {
1063
1063
  let n = xt(e, t);
1064
- return (t, r, i) => r === "__v_isReactive" ? !e : r === "__v_isReadonly" ? e : r === "__v_raw" ? t : Reflect.get(P(n, r) && r in t ? n : t, r, i);
1064
+ return (t, r, i) => r === "__v_isReactive" ? !e : r === "__v_isReadonly" ? e : r === "__v_raw" ? t : Reflect.get(F(n, r) && r in t ? n : t, r, i);
1065
1065
  }
1066
1066
  var Ct = { get: /* @__PURE__ */ St(!1, !1) }, wt = { get: /* @__PURE__ */ St(!0, !1) }, Tt = { get: /* @__PURE__ */ St(!0, !0) };
1067
1067
  function Et(e, t, n) {
@@ -1096,7 +1096,7 @@ function Pt(e) {
1096
1096
  return Ft(e, !0, _t, Tt, At);
1097
1097
  }
1098
1098
  function Ft(e, t, n, r, i) {
1099
- if (!R(e)) return process.env.NODE_ENV !== "production" && Ce(`value cannot be made ${t ? "readonly" : "reactive"}: ${String(e)}`), e;
1099
+ if (!de(e)) return process.env.NODE_ENV !== "production" && Ce(`value cannot be made ${t ? "readonly" : "reactive"}: ${String(e)}`), e;
1100
1100
  if (e.__v_raw && !(t && e.__v_isReactive) || e.__v_skip || !Object.isExtensible(e)) return e;
1101
1101
  let a = i.get(e);
1102
1102
  if (a) return a;
@@ -1127,9 +1127,9 @@ function X(e) {
1127
1127
  return t ? /* @__PURE__ */ X(t) : e;
1128
1128
  }
1129
1129
  function zt(e) {
1130
- return !P(e, "__v_skip") && Object.isExtensible(e) && _e(e, "__v_skip", !0), e;
1130
+ return !F(e, "__v_skip") && Object.isExtensible(e) && _e(e, "__v_skip", !0), e;
1131
1131
  }
1132
- var Bt = (e) => R(e) ? /* @__PURE__ */ Mt(e) : e, Vt = (e) => R(e) ? /* @__PURE__ */ Nt(e) : e;
1132
+ var Bt = (e) => de(e) ? /* @__PURE__ */ Mt(e) : e, Vt = (e) => de(e) ? /* @__PURE__ */ Nt(e) : e;
1133
1133
  // @__NO_SIDE_EFFECTS__
1134
1134
  function Ht(e) {
1135
1135
  return e ? e.__v_isRef === !0 : !1;
@@ -1211,7 +1211,7 @@ var Zt = class {
1211
1211
  // @__NO_SIDE_EFFECTS__
1212
1212
  function Qt(e, t, n = !1) {
1213
1213
  let r, i;
1214
- I(e) ? r = e : (r = e.get, i = e.set);
1214
+ L(e) ? r = e : (r = e.get, i = e.set);
1215
1215
  let a = new Zt(r, i, n);
1216
1216
  return process.env.NODE_ENV !== "production" && t && !n && (a.onTrack = t.onTrack, a.onTrigger = t.onTrigger), a;
1217
1217
  }
@@ -1222,16 +1222,16 @@ function nn(e, t = !1, n = tn) {
1222
1222
  t || en.set(n, t = []), t.push(e);
1223
1223
  } else process.env.NODE_ENV !== "production" && !t && Ce("onWatcherCleanup() was called when there was no active watcher to associate with.");
1224
1224
  }
1225
- function rn(e, t, n = k) {
1225
+ function rn(e, t, n = A) {
1226
1226
  let { immediate: r, deep: i, once: a, scheduler: o, augmentJob: s, call: c } = n, l = (e) => {
1227
1227
  (n.onWarn || Ce)("Invalid watch source: ", e, "A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.");
1228
1228
  }, u = (e) => i ? e : /* @__PURE__ */ Y(e) || i === !1 || i === 0 ? an(e, 1) : an(e), d, f, p, m, h = !1, g = !1;
1229
- if (/* @__PURE__ */ Ht(e) ? (f = () => e.value, h = /* @__PURE__ */ Y(e)) : /* @__PURE__ */ It(e) ? (f = () => u(e), h = !0) : F(e) ? (g = !0, h = e.some((e) => /* @__PURE__ */ It(e) || /* @__PURE__ */ Y(e)), f = () => e.map((e) => {
1229
+ if (/* @__PURE__ */ Ht(e) ? (f = () => e.value, h = /* @__PURE__ */ Y(e)) : /* @__PURE__ */ It(e) ? (f = () => u(e), h = !0) : I(e) ? (g = !0, h = e.some((e) => /* @__PURE__ */ It(e) || /* @__PURE__ */ Y(e)), f = () => e.map((e) => {
1230
1230
  if (/* @__PURE__ */ Ht(e)) return e.value;
1231
1231
  if (/* @__PURE__ */ It(e)) return u(e);
1232
- if (I(e)) return c ? c(e, 2) : e();
1232
+ if (L(e)) return c ? c(e, 2) : e();
1233
1233
  process.env.NODE_ENV !== "production" && l(e);
1234
- })) : I(e) ? f = t ? c ? () => c(e, 2) : e : () => {
1234
+ })) : L(e) ? f = t ? c ? () => c(e, 2) : e : () => {
1235
1235
  if (p) {
1236
1236
  Ve();
1237
1237
  try {
@@ -1247,12 +1247,12 @@ function rn(e, t, n = k) {
1247
1247
  } finally {
1248
1248
  tn = t;
1249
1249
  }
1250
- } : (f = A, process.env.NODE_ENV !== "production" && l(e)), t && i) {
1250
+ } : (f = j, process.env.NODE_ENV !== "production" && l(e)), t && i) {
1251
1251
  let e = f, t = i === !0 ? Infinity : i;
1252
1252
  f = () => an(e(), t);
1253
1253
  }
1254
1254
  let _ = Te(), v = () => {
1255
- d.stop(), _ && _.active && N(_.effects, d);
1255
+ d.stop(), _ && _.active && P(_.effects, d);
1256
1256
  };
1257
1257
  if (a && t) {
1258
1258
  let e = t;
@@ -1291,10 +1291,10 @@ function rn(e, t, n = k) {
1291
1291
  }, process.env.NODE_ENV !== "production" && (d.onTrack = n.onTrack, d.onTrigger = n.onTrigger), t ? r ? b(!0) : y = d.run() : o ? o(b.bind(null, !0), !0) : d.run(), v.pause = d.pause.bind(d), v.resume = d.resume.bind(d), v.stop = v, v;
1292
1292
  }
1293
1293
  function an(e, t = Infinity, n) {
1294
- if (t <= 0 || !R(e) || e.__v_skip || (n ||= /* @__PURE__ */ new Map(), (n.get(e) || 0) >= t)) return e;
1294
+ if (t <= 0 || !de(e) || e.__v_skip || (n ||= /* @__PURE__ */ new Map(), (n.get(e) || 0) >= t)) return e;
1295
1295
  if (n.set(e, t), t--, /* @__PURE__ */ Ht(e)) an(e.value, t, n);
1296
- else if (F(e)) for (let r = 0; r < e.length; r++) an(e[r], t, n);
1297
- else if (ue(e) || le(e)) e.forEach((e) => {
1296
+ else if (I(e)) for (let r = 0; r < e.length; r++) an(e[r], t, n);
1297
+ else if (le(e) || ce(e)) e.forEach((e) => {
1298
1298
  an(e, t, n);
1299
1299
  });
1300
1300
  else if (me(e)) {
@@ -1365,11 +1365,11 @@ function mn(e) {
1365
1365
  }), n.length > 3 && t.push(" ..."), t;
1366
1366
  }
1367
1367
  function hn(e, t, n) {
1368
- return de(t) ? (t = JSON.stringify(t), n ? t : [`${e}=${t}`]) : typeof t == "number" || typeof t == "boolean" || t == null ? n ? t : [`${e}=${t}`] : /* @__PURE__ */ Ht(t) ? (t = hn(e, /* @__PURE__ */ X(t.value), !0), n ? t : [
1368
+ return ue(t) ? (t = JSON.stringify(t), n ? t : [`${e}=${t}`]) : typeof t == "number" || typeof t == "boolean" || t == null ? n ? t : [`${e}=${t}`] : /* @__PURE__ */ Ht(t) ? (t = hn(e, /* @__PURE__ */ X(t.value), !0), n ? t : [
1369
1369
  `${e}=Ref<`,
1370
1370
  t,
1371
1371
  ">"
1372
- ]) : I(t) ? [`${e}=fn${t.name ? `<${t.name}>` : ""}`] : (t = /* @__PURE__ */ X(t), n ? t : [`${e}=`, t]);
1372
+ ]) : L(t) ? [`${e}=fn${t.name ? `<${t.name}>` : ""}`] : (t = /* @__PURE__ */ X(t), n ? t : [`${e}=`, t]);
1373
1373
  }
1374
1374
  var gn = {
1375
1375
  sp: "serverPrefetch hook",
@@ -1412,20 +1412,20 @@ function _n(e, t, n, r) {
1412
1412
  }
1413
1413
  }
1414
1414
  function vn(e, t, n, r) {
1415
- if (I(e)) {
1415
+ if (L(e)) {
1416
1416
  let i = _n(e, t, n, r);
1417
1417
  return i && z(i) && i.catch((e) => {
1418
1418
  yn(e, t, n);
1419
1419
  }), i;
1420
1420
  }
1421
- if (F(e)) {
1421
+ if (I(e)) {
1422
1422
  let i = [];
1423
1423
  for (let a = 0; a < e.length; a++) i.push(vn(e[a], t, n, r));
1424
1424
  return i;
1425
1425
  } else process.env.NODE_ENV !== "production" && un(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof e}`);
1426
1426
  }
1427
1427
  function yn(e, t, n, r = !0) {
1428
- let i = t ? t.vnode : null, { errorHandler: a, throwUnhandledErrorInProduction: o } = t && t.appContext.config || k;
1428
+ let i = t ? t.vnode : null, { errorHandler: a, throwUnhandledErrorInProduction: o } = t && t.appContext.config || A;
1429
1429
  if (t) {
1430
1430
  let r = t.parent, i = t.proxy, o = process.env.NODE_ENV === "production" ? `https://vuejs.org/error-reference/#runtime-${n}` : gn[n];
1431
1431
  for (; r;) {
@@ -1477,7 +1477,7 @@ function Mn() {
1477
1477
  Dn ||= En.then(In);
1478
1478
  }
1479
1479
  function Nn(e) {
1480
- F(e) ? Cn.push(...e) : wn && e.id === -1 ? wn.splice(Tn + 1, 0, e) : e.flags & 1 || (Cn.push(e), e.flags |= 1), Mn();
1480
+ I(e) ? Cn.push(...e) : wn && e.id === -1 ? wn.splice(Tn + 1, 0, e) : e.flags & 1 || (Cn.push(e), e.flags |= 1), Mn();
1481
1481
  }
1482
1482
  function Pn(e) {
1483
1483
  if (Cn.length) {
@@ -1496,7 +1496,7 @@ function Pn(e) {
1496
1496
  var Fn = (e) => e.id == null ? e.flags & 2 ? -1 : Infinity : e.id;
1497
1497
  function In(e) {
1498
1498
  process.env.NODE_ENV !== "production" && (e ||= /* @__PURE__ */ new Map());
1499
- let t = process.env.NODE_ENV === "production" ? A : (t) => Ln(e, t);
1499
+ let t = process.env.NODE_ENV === "production" ? j : (t) => Ln(e, t);
1500
1500
  try {
1501
1501
  for (Sn = 0; Sn < xn.length; Sn++) {
1502
1502
  let e = xn[Sn];
@@ -1559,7 +1559,7 @@ function Un(e, t) {
1559
1559
  });
1560
1560
  }
1561
1561
  function Wn(e, t) {
1562
- M(e, t);
1562
+ N(e, t);
1563
1563
  for (let n in e) n !== "__file" && !(n in t) && delete e[n];
1564
1564
  }
1565
1565
  function Gn(e) {
@@ -1585,7 +1585,7 @@ function Zn(e, t, n = !1) {
1585
1585
  if (r || Sr) {
1586
1586
  let i = Sr ? Sr._context.provides : r ? r.parent == null || r.ce ? r.vnode.appContext && r.vnode.appContext.provides : r.parent.provides : void 0;
1587
1587
  if (i && e in i) return i[e];
1588
- if (arguments.length > 1) return n && I(t) ? t.call(r && r.proxy) : t;
1588
+ if (arguments.length > 1) return n && L(t) ? t.call(r && r.proxy) : t;
1589
1589
  process.env.NODE_ENV !== "production" && un(`injection "${String(e)}" not found.`);
1590
1590
  } else process.env.NODE_ENV !== "production" && un("inject() can only be used inside setup() or functional components.");
1591
1591
  }
@@ -1595,10 +1595,10 @@ var Qn = /* @__PURE__ */ Symbol.for("v-scx"), $n = () => {
1595
1595
  return e || process.env.NODE_ENV !== "production" && un("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."), e;
1596
1596
  }
1597
1597
  };
1598
- function er(e, t, n = k) {
1598
+ function er(e, t, n = A) {
1599
1599
  let { immediate: r, deep: i, flush: a, once: o } = n;
1600
1600
  process.env.NODE_ENV !== "production" && !t && (r !== void 0 && un("watch() \"immediate\" option is only respected when using the watch(source, callback, options?) signature."), i !== void 0 && un("watch() \"deep\" option is only respected when using the watch(source, callback, options?) signature."), o !== void 0 && un("watch() \"once\" option is only respected when using the watch(source, callback, options?) signature."));
1601
- let s = M({}, n);
1601
+ let s = N({}, n);
1602
1602
  process.env.NODE_ENV !== "production" && (s.onWarn = un);
1603
1603
  let c = t && r || !t && a !== "post", l;
1604
1604
  if (Xr) {
@@ -1607,7 +1607,7 @@ function er(e, t, n = k) {
1607
1607
  l = e.__watcherHandles ||= [];
1608
1608
  } else if (!c) {
1609
1609
  let e = () => {};
1610
- return e.stop = A, e.resume = A, e.pause = A, e;
1610
+ return e.stop = j, e.resume = j, e.pause = j, e;
1611
1611
  }
1612
1612
  }
1613
1613
  let u = Gr;
@@ -1624,8 +1624,8 @@ function er(e, t, n = k) {
1624
1624
  return Xr && (l ? l.push(f) : c && f()), f;
1625
1625
  }
1626
1626
  function tr(e, t, n) {
1627
- let r = this.proxy, i = de(e) ? e.includes(".") ? nr(r, e) : () => r[e] : e.bind(r, r), a;
1628
- I(t) ? a = t : (a = t.handler, n = t);
1627
+ let r = this.proxy, i = ue(e) ? e.includes(".") ? nr(r, e) : () => r[e] : e.bind(r, r), a;
1628
+ L(t) ? a = t : (a = t.handler, n = t);
1629
1629
  let o = Jr(this), s = er(i, a.bind(r), n);
1630
1630
  return o(), s;
1631
1631
  }
@@ -1642,7 +1642,7 @@ function ir(e, t) {
1642
1642
  e.shapeFlag & 6 && e.component ? (e.transition = t, ir(e.component.subTree, t)) : e.shapeFlag & 128 ? (e.ssContent.transition = t.clone(e.ssContent), e.ssFallback.transition = t.clone(e.ssFallback)) : e.transition = t;
1643
1643
  }
1644
1644
  ve().requestIdleCallback, ve().cancelIdleCallback;
1645
- var ar = /* @__PURE__ */ Symbol.for("v-ndc"), or = (e) => e ? Yr(e) ? Zr(e) : or(e.parent) : null, sr = /* @__PURE__ */ M(/* @__PURE__ */ Object.create(null), {
1645
+ var ar = /* @__PURE__ */ Symbol.for("v-ndc"), or = (e) => e ? Yr(e) ? Zr(e) : or(e.parent) : null, sr = /* @__PURE__ */ N(/* @__PURE__ */ Object.create(null), {
1646
1646
  $: (e) => e,
1647
1647
  $el: (e) => e.vnode.el,
1648
1648
  $data: (e) => e.data,
@@ -1660,7 +1660,7 @@ var ar = /* @__PURE__ */ Symbol.for("v-ndc"), or = (e) => e ? Yr(e) ? Zr(e) : or
1660
1660
  },
1661
1661
  $nextTick: (e) => e.n ||= kn.bind(e.proxy),
1662
1662
  $watch: (e) => tr.bind(e)
1663
- }), cr = (e, t) => e !== k && !e.__isScriptSetup && P(e, t), lr = {
1663
+ }), cr = (e, t) => e !== A && !e.__isScriptSetup && F(e, t), lr = {
1664
1664
  get({ _: e }, t) {
1665
1665
  if (t === "__v_skip") return !0;
1666
1666
  let { ctx: n, setupState: r, data: i, props: a, accessCache: o, type: s, appContext: c } = e;
@@ -1674,21 +1674,21 @@ var ar = /* @__PURE__ */ Symbol.for("v-ndc"), or = (e) => e ? Yr(e) ? Zr(e) : or
1674
1674
  case 3: return a[t];
1675
1675
  }
1676
1676
  else if (cr(r, t)) return o[t] = 1, r[t];
1677
- else if (i !== k && P(i, t)) return o[t] = 2, i[t];
1678
- else if (P(a, t)) return o[t] = 3, a[t];
1679
- else if (n !== k && P(n, t)) return o[t] = 4, n[t];
1677
+ else if (i !== A && F(i, t)) return o[t] = 2, i[t];
1678
+ else if (F(a, t)) return o[t] = 3, a[t];
1679
+ else if (n !== A && F(n, t)) return o[t] = 4, n[t];
1680
1680
  else dr && (o[t] = 0);
1681
1681
  }
1682
1682
  let l = sr[t], u, d;
1683
1683
  if (l) return t === "$attrs" ? (q(e.attrs, "get", ""), process.env.NODE_ENV) : process.env.NODE_ENV !== "production" && t === "$slots" && q(e, "get", t), l(e);
1684
1684
  if ((u = s.__cssModules) && (u = u[t])) return u;
1685
- if (n !== k && P(n, t)) return o[t] = 4, n[t];
1686
- if (d = c.config.globalProperties, P(d, t)) return d[t];
1685
+ if (n !== A && F(n, t)) return o[t] = 4, n[t];
1686
+ if (d = c.config.globalProperties, F(d, t)) return d[t];
1687
1687
  process.env.NODE_ENV;
1688
1688
  },
1689
1689
  set({ _: e }, t, n) {
1690
1690
  let { data: r, setupState: i, ctx: a } = e;
1691
- return cr(i, t) ? (i[t] = n, !0) : process.env.NODE_ENV !== "production" && i.__isScriptSetup && P(i, t) ? (un(`Cannot mutate <script setup> binding "${t}" from Options API.`), !1) : r !== k && P(r, t) ? (r[t] = n, !0) : P(e.props, t) ? (process.env.NODE_ENV !== "production" && un(`Attempting to mutate prop "${t}". Props are readonly.`), !1) : t[0] === "$" && t.slice(1) in e ? (process.env.NODE_ENV !== "production" && un(`Attempting to mutate public property "${t}". Properties starting with $ are reserved and readonly.`), !1) : (process.env.NODE_ENV !== "production" && t in e.appContext.config.globalProperties ? Object.defineProperty(a, t, {
1691
+ return cr(i, t) ? (i[t] = n, !0) : process.env.NODE_ENV !== "production" && i.__isScriptSetup && F(i, t) ? (un(`Cannot mutate <script setup> binding "${t}" from Options API.`), !1) : r !== A && F(r, t) ? (r[t] = n, !0) : F(e.props, t) ? (process.env.NODE_ENV !== "production" && un(`Attempting to mutate prop "${t}". Props are readonly.`), !1) : t[0] === "$" && t.slice(1) in e ? (process.env.NODE_ENV !== "production" && un(`Attempting to mutate public property "${t}". Properties starting with $ are reserved and readonly.`), !1) : (process.env.NODE_ENV !== "production" && t in e.appContext.config.globalProperties ? Object.defineProperty(a, t, {
1692
1692
  enumerable: !0,
1693
1693
  configurable: !0,
1694
1694
  value: n
@@ -1696,20 +1696,20 @@ var ar = /* @__PURE__ */ Symbol.for("v-ndc"), or = (e) => e ? Yr(e) ? Zr(e) : or
1696
1696
  },
1697
1697
  has({ _: { data: e, setupState: t, accessCache: n, ctx: r, appContext: i, props: a, type: o } }, s) {
1698
1698
  let c;
1699
- return !!(n[s] || e !== k && s[0] !== "$" && P(e, s) || cr(t, s) || P(a, s) || P(r, s) || P(sr, s) || P(i.config.globalProperties, s) || (c = o.__cssModules) && c[s]);
1699
+ return !!(n[s] || e !== A && s[0] !== "$" && F(e, s) || cr(t, s) || F(a, s) || F(r, s) || F(sr, s) || F(i.config.globalProperties, s) || (c = o.__cssModules) && c[s]);
1700
1700
  },
1701
1701
  defineProperty(e, t, n) {
1702
- return n.get == null ? P(n, "value") && this.set(e, t, n.value, null) : e._.accessCache[t] = 0, Reflect.defineProperty(e, t, n);
1702
+ return n.get == null ? F(n, "value") && this.set(e, t, n.value, null) : e._.accessCache[t] = 0, Reflect.defineProperty(e, t, n);
1703
1703
  }
1704
1704
  };
1705
1705
  process.env.NODE_ENV !== "production" && (lr.ownKeys = (e) => (un("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."), Reflect.ownKeys(e)));
1706
1706
  function ur(e) {
1707
- return F(e) ? e.reduce((e, t) => (e[t] = null, e), {}) : e;
1707
+ return I(e) ? e.reduce((e, t) => (e[t] = null, e), {}) : e;
1708
1708
  }
1709
1709
  var dr = !0;
1710
1710
  function fr(e) {
1711
1711
  let t = e.type, { mixins: n, extends: r } = t, { mixins: i, optionsCache: a, config: { optionMergeStrategies: o } } = e.appContext, s = a.get(t), c;
1712
- return s ? c = s : !i.length && !n && !r ? c = t : (c = {}, i.length && i.forEach((e) => pr(c, e, o, !0)), pr(c, t, o)), R(t) && a.set(t, c), c;
1712
+ return s ? c = s : !i.length && !n && !r ? c = t : (c = {}, i.length && i.forEach((e) => pr(c, e, o, !0)), pr(c, t, o)), de(t) && a.set(t, c), c;
1713
1713
  }
1714
1714
  function pr(e, t, n, r = !1) {
1715
1715
  let { mixins: i, extends: a } = t;
@@ -1749,14 +1749,14 @@ var mr = {
1749
1749
  };
1750
1750
  function hr(e, t) {
1751
1751
  return t ? e ? function() {
1752
- return M(I(e) ? e.call(this, this) : e, I(t) ? t.call(this, this) : t);
1752
+ return N(L(e) ? e.call(this, this) : e, L(t) ? t.call(this, this) : t);
1753
1753
  } : t : e;
1754
1754
  }
1755
1755
  function gr(e, t) {
1756
1756
  return yr(_r(e), _r(t));
1757
1757
  }
1758
1758
  function _r(e) {
1759
- if (F(e)) {
1759
+ if (I(e)) {
1760
1760
  let t = {};
1761
1761
  for (let n = 0; n < e.length; n++) t[e[n]] = e[n];
1762
1762
  return t;
@@ -1767,27 +1767,27 @@ function vr(e, t) {
1767
1767
  return e ? [...new Set([].concat(e, t))] : t;
1768
1768
  }
1769
1769
  function yr(e, t) {
1770
- return e ? M(/* @__PURE__ */ Object.create(null), e, t) : t;
1770
+ return e ? N(/* @__PURE__ */ Object.create(null), e, t) : t;
1771
1771
  }
1772
1772
  function br(e, t) {
1773
- return e ? F(e) && F(t) ? [.../* @__PURE__ */ new Set([...e, ...t])] : M(/* @__PURE__ */ Object.create(null), ur(e), ur(t ?? {})) : t;
1773
+ return e ? I(e) && I(t) ? [.../* @__PURE__ */ new Set([...e, ...t])] : N(/* @__PURE__ */ Object.create(null), ur(e), ur(t ?? {})) : t;
1774
1774
  }
1775
1775
  function xr(e, t) {
1776
1776
  if (!e) return t;
1777
1777
  if (!t) return e;
1778
- let n = M(/* @__PURE__ */ Object.create(null), e);
1778
+ let n = N(/* @__PURE__ */ Object.create(null), e);
1779
1779
  for (let r in t) n[r] = vr(e[r], t[r]);
1780
1780
  return n;
1781
1781
  }
1782
1782
  var Sr = null, Cr = {}, wr = (e) => Object.getPrototypeOf(e) === Cr, Tr = Dr, Er = (e) => e.__isSuspense;
1783
1783
  function Dr(e, t) {
1784
- t && t.pendingBranch ? F(e) ? t.effects.push(...e) : t.effects.push(e) : Nn(e);
1784
+ t && t.pendingBranch ? I(e) ? t.effects.push(...e) : t.effects.push(e) : Nn(e);
1785
1785
  }
1786
1786
  var Or = /* @__PURE__ */ Symbol.for("v-fgt"), kr = /* @__PURE__ */ Symbol.for("v-txt"), Ar = /* @__PURE__ */ Symbol.for("v-cmt");
1787
1787
  function jr(e) {
1788
1788
  return e ? e.__v_isVNode === !0 : !1;
1789
1789
  }
1790
- var Mr, Nr = (...e) => Rr(...Mr ? Mr(e, Yn) : e), Pr = ({ key: e }) => e ?? null, Fr = ({ ref: e, ref_key: t, ref_for: n }) => (typeof e == "number" && (e = "" + e), e == null ? null : de(e) || /* @__PURE__ */ Ht(e) || I(e) ? {
1790
+ var Mr, Nr = (...e) => Rr(...Mr ? Mr(e, Yn) : e), Pr = ({ key: e }) => e ?? null, Fr = ({ ref: e, ref_key: t, ref_for: n }) => (typeof e == "number" && (e = "" + e), e == null ? null : ue(e) || /* @__PURE__ */ Ht(e) || L(e) ? {
1791
1791
  i: Yn,
1792
1792
  r: e,
1793
1793
  k: t,
@@ -1823,7 +1823,7 @@ function Ir(e, t = null, n = null, r = 0, i = null, a = e === Or ? 0 : 1, o = !1
1823
1823
  appContext: null,
1824
1824
  ctx: Yn
1825
1825
  };
1826
- return s ? (Ur(c, n), a & 128 && e.normalize(c)) : n && (c.shapeFlag |= de(n) ? 8 : 16), process.env.NODE_ENV !== "production" && c.key !== c.key && un("VNode created with invalid key (NaN). VNode type:", c.type), c;
1826
+ return s ? (Ur(c, n), a & 128 && e.normalize(c)) : n && (c.shapeFlag |= ue(n) ? 8 : 16), process.env.NODE_ENV !== "production" && c.key !== c.key && un("VNode created with invalid key (NaN). VNode type:", c.type), c;
1827
1827
  }
1828
1828
  var Lr = process.env.NODE_ENV === "production" ? Rr : Nr;
1829
1829
  function Rr(e, t = null, n = null, r = 0, i = null, a = !1) {
@@ -1834,13 +1834,13 @@ function Rr(e, t = null, n = null, r = 0, i = null, a = !1) {
1834
1834
  if (ni(e) && (e = e.__vccOpts), t) {
1835
1835
  t = zr(t);
1836
1836
  let { class: e, style: n } = t;
1837
- e && !de(e) && (t.class = W(e)), R(n) && (/* @__PURE__ */ Rt(n) && !F(n) && (n = M({}, n)), t.style = U(n));
1837
+ e && !ue(e) && (t.class = W(e)), de(n) && (/* @__PURE__ */ Rt(n) && !I(n) && (n = N({}, n)), t.style = U(n));
1838
1838
  }
1839
- let o = de(e) ? 1 : Er(e) ? 128 : rr(e) ? 64 : R(e) ? 4 : I(e) ? 2 : 0;
1839
+ let o = ue(e) ? 1 : Er(e) ? 128 : rr(e) ? 64 : de(e) ? 4 : L(e) ? 2 : 0;
1840
1840
  return process.env.NODE_ENV !== "production" && o & 4 && /* @__PURE__ */ Rt(e) && (e = /* @__PURE__ */ X(e), un("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.", "\nComponent that was made reactive: ", e)), Ir(e, t, n, r, i, o, a, !0);
1841
1841
  }
1842
1842
  function zr(e) {
1843
- return e ? /* @__PURE__ */ Rt(e) || wr(e) ? M({}, e) : e : null;
1843
+ return e ? /* @__PURE__ */ Rt(e) || wr(e) ? N({}, e) : e : null;
1844
1844
  }
1845
1845
  function Br(e, t, n = !1, r = !1) {
1846
1846
  let { props: i, ref: a, patchFlag: o, children: s, transition: c } = e, l = t ? Wr(i || {}, t) : i, u = {
@@ -1849,10 +1849,10 @@ function Br(e, t, n = !1, r = !1) {
1849
1849
  type: e.type,
1850
1850
  props: l,
1851
1851
  key: l && Pr(l),
1852
- ref: t && t.ref ? n && a ? F(a) ? a.concat(Fr(t)) : [a, Fr(t)] : Fr(t) : a,
1852
+ ref: t && t.ref ? n && a ? I(a) ? a.concat(Fr(t)) : [a, Fr(t)] : Fr(t) : a,
1853
1853
  scopeId: e.scopeId,
1854
1854
  slotScopeIds: e.slotScopeIds,
1855
- children: process.env.NODE_ENV !== "production" && o === -1 && F(s) ? s.map(Vr) : s,
1855
+ children: process.env.NODE_ENV !== "production" && o === -1 && I(s) ? s.map(Vr) : s,
1856
1856
  target: e.target,
1857
1857
  targetStart: e.targetStart,
1858
1858
  targetAnchor: e.targetAnchor,
@@ -1878,7 +1878,7 @@ function Br(e, t, n = !1, r = !1) {
1878
1878
  }
1879
1879
  function Vr(e) {
1880
1880
  let t = Br(e);
1881
- return F(e.children) && (t.children = e.children.map(Vr)), t;
1881
+ return I(e.children) && (t.children = e.children.map(Vr)), t;
1882
1882
  }
1883
1883
  function Hr(e = " ", t = 0) {
1884
1884
  return Lr(kr, null, e, t);
@@ -1886,13 +1886,13 @@ function Hr(e = " ", t = 0) {
1886
1886
  function Ur(e, t) {
1887
1887
  let n = 0, { shapeFlag: r } = e;
1888
1888
  if (t == null) t = null;
1889
- else if (F(t)) n = 16;
1889
+ else if (I(t)) n = 16;
1890
1890
  else if (typeof t == "object") if (r & 65) {
1891
1891
  let n = t.default;
1892
1892
  n && (n._c && (n._d = !1), Ur(e, n()), n._c && (n._d = !0));
1893
1893
  return;
1894
1894
  } else n = 32, !t._ && !wr(t) && (t._ctx = Yn);
1895
- else if (I(t)) {
1895
+ else if (L(t)) {
1896
1896
  if (r & 65) {
1897
1897
  Ur(e, { default: t });
1898
1898
  return;
@@ -1910,9 +1910,9 @@ function Wr(...e) {
1910
1910
  let r = e[n];
1911
1911
  for (let e in r) if (e === "class") t.class !== r.class && (t.class = W([t.class, r.class]));
1912
1912
  else if (e === "style") t.style = U([t.style, r.style]);
1913
- else if (se(e)) {
1913
+ else if (oe(e)) {
1914
1914
  let n = t[e], i = r[e];
1915
- i && n !== i && !(F(n) && n.includes(i)) ? t[e] = n ? [].concat(n, i) : i : i == null && n == null && !j(e) && (t[e] = i);
1915
+ i && n !== i && !(I(n) && n.includes(i)) ? t[e] = n ? [].concat(n, i) : i : i == null && n == null && !M(e) && (t[e] = i);
1916
1916
  } else e !== "" && (t[e] = r[e]);
1917
1917
  }
1918
1918
  return t;
@@ -1951,7 +1951,7 @@ function Zr(e) {
1951
1951
  }
1952
1952
  var Qr = /(?:^|[-_])\w/g, $r = (e) => e.replace(Qr, (e) => e.toUpperCase()).replace(/[-_]/g, "");
1953
1953
  function ei(e, t = !0) {
1954
- return I(e) ? e.displayName || e.name : e.name || t && e.__name;
1954
+ return L(e) ? e.displayName || e.name : e.name || t && e.__name;
1955
1955
  }
1956
1956
  function ti(e, t, n = !1) {
1957
1957
  let r = ei(t);
@@ -1968,7 +1968,7 @@ function ti(e, t, n = !1) {
1968
1968
  return r ? $r(r) : n ? "App" : "Anonymous";
1969
1969
  }
1970
1970
  function ni(e) {
1971
- return I(e) && "__vccOpts" in e;
1971
+ return L(e) && "__vccOpts" in e;
1972
1972
  }
1973
1973
  var ri = (e, t) => {
1974
1974
  let n = /* @__PURE__ */ Qt(e, t, Xr);
@@ -1983,7 +1983,7 @@ function ii() {
1983
1983
  let e = { style: "color:#3ba776" }, t = { style: "color:#1677ff" }, n = { style: "color:#f5222d" }, r = { style: "color:#eb2f96" }, i = {
1984
1984
  __vue_custom_formatter: !0,
1985
1985
  header(t) {
1986
- if (!R(t)) return null;
1986
+ if (!de(t)) return null;
1987
1987
  if (t.__isVue) return [
1988
1988
  "div",
1989
1989
  e,
@@ -2043,7 +2043,7 @@ function ii() {
2043
2043
  };
2044
2044
  function a(e) {
2045
2045
  let t = [];
2046
- e.type.props && e.props && t.push(o("props", /* @__PURE__ */ X(e.props))), e.setupState !== k && t.push(o("setup", e.setupState)), e.data !== k && t.push(o("data", /* @__PURE__ */ X(e.data)));
2046
+ e.type.props && e.props && t.push(o("props", /* @__PURE__ */ X(e.props))), e.setupState !== A && t.push(o("setup", e.setupState)), e.data !== A && t.push(o("data", /* @__PURE__ */ X(e.data)));
2047
2047
  let n = c(e, "computed");
2048
2048
  n && t.push(o("computed", n));
2049
2049
  let i = c(e, "inject");
@@ -2059,7 +2059,7 @@ function ii() {
2059
2059
  ]), t;
2060
2060
  }
2061
2061
  function o(e, t) {
2062
- return t = M({}, t), Object.keys(t).length ? [
2062
+ return t = N({}, t), Object.keys(t).length ? [
2063
2063
  "div",
2064
2064
  { style: "line-height:1.25em;margin-bottom:0.6em" },
2065
2065
  [
@@ -2096,7 +2096,7 @@ function ii() {
2096
2096
  "span",
2097
2097
  r,
2098
2098
  e
2099
- ] : R(e) ? ["object", { object: i ? /* @__PURE__ */ X(e) : e }] : [
2099
+ ] : de(e) ? ["object", { object: i ? /* @__PURE__ */ X(e) : e }] : [
2100
2100
  "span",
2101
2101
  n,
2102
2102
  String(e)
@@ -2104,14 +2104,14 @@ function ii() {
2104
2104
  }
2105
2105
  function c(e, t) {
2106
2106
  let n = e.type;
2107
- if (I(n)) return;
2107
+ if (L(n)) return;
2108
2108
  let r = {};
2109
2109
  for (let i in e.ctx) l(n, i, t) && (r[i] = e.ctx[i]);
2110
2110
  return r;
2111
2111
  }
2112
2112
  function l(e, t, n) {
2113
2113
  let r = e[n];
2114
- if (F(r) && r.includes(t) || R(r) && t in r || e.extends && l(e.extends, t, n) || e.mixins && e.mixins.some((e) => l(e, t, n))) return !0;
2114
+ if (I(r) && r.includes(t) || de(r) && t in r || e.extends && l(e.extends, t, n) || e.mixins && e.mixins.some((e) => l(e, t, n))) return !0;
2115
2115
  }
2116
2116
  function u(e) {
2117
2117
  return /* @__PURE__ */ Y(e) ? "ShallowRef" : e.effect ? "ComputedRef" : "Ref";
@@ -2148,7 +2148,7 @@ function si(e, t) {
2148
2148
  code: "SCHEMA_INVALID",
2149
2149
  path: e,
2150
2150
  message: `值不符合 "${e}" 的 schema(${t.length} 处问题)`,
2151
- hint: `用 read({jsonPath:"${e}"}) 查看当前值,按 describe_data() 查看主数据 schema,修正后重试;改大对象优先用 write 的 patch 增量(只发改动部分)`,
2151
+ hint: `用 read({jsonPath:"${e}"}) 查看当前值,按 schema_data() 查看主数据 schema,修正后重试;改大对象优先用 write 的 patch 增量(只发改动部分)`,
2152
2152
  details: oi(t)
2153
2153
  });
2154
2154
  }
@@ -2526,17 +2526,8 @@ function $i(e) {
2526
2526
  return !0;
2527
2527
  }
2528
2528
  //#endregion
2529
- //#region src/core/harness/writeGate.ts
2530
- function ea(e, t, n) {
2531
- if (!e || !n || n.status === "error" || t && t.dryRun === !0) return !1;
2532
- let r = "writeCapable" in e ? e.writeCapable : void 0;
2533
- if (!(typeof r == "function" ? r(t ?? {}) : r === !0)) return !1;
2534
- let i = String(n.content || "");
2535
- return !(i.startsWith("ERROR:") || i.includes("未写入") || i.includes("无需删除"));
2536
- }
2537
- //#endregion
2538
2529
  //#region src/core/tools/sandbox.ts
2539
- function ta(e) {
2530
+ function ea(e) {
2540
2531
  let t = (t, n) => {
2541
2532
  try {
2542
2533
  Object.defineProperty(e, t, {
@@ -2564,7 +2555,7 @@ function ta(e) {
2564
2555
  });
2565
2556
  } catch {}
2566
2557
  }
2567
- var na = `(${ta.toString()})(self);`, ra = [
2558
+ var ta = `(${ea.toString()})(self);`, na = [
2568
2559
  {
2569
2560
  re: /\bimport\s*\(/,
2570
2561
  msg: "动态 import() 拉外网模块"
@@ -2610,17 +2601,17 @@ var na = `(${ta.toString()})(self);`, ra = [
2610
2601
  msg: "沙箱脚本不允许反射访问"
2611
2602
  }
2612
2603
  ];
2613
- function ia(e) {
2604
+ function ra(e) {
2614
2605
  return /\breturn\b/.test(e) ? e : `return (${e})`;
2615
2606
  }
2616
- function aa(e, t = 3e3) {
2607
+ function ia(e, t = 3e3) {
2617
2608
  return async (n) => {
2618
- for (let { re: t, msg: n } of ra) if (t.test(e)) return {
2609
+ for (let { re: t, msg: n } of na) if (t.test(e)) return {
2619
2610
  ok: !1,
2620
2611
  error: `沙箱拒绝执行:脚本含禁用模式(${n})`,
2621
2612
  elapsedMs: 0
2622
2613
  };
2623
- let r = ia(e);
2614
+ let r = ra(e);
2624
2615
  return new Promise((e) => {
2625
2616
  let i = Date.now(), a = !1, o = (t) => {
2626
2617
  if (!a) {
@@ -2633,7 +2624,7 @@ function aa(e, t = 3e3) {
2633
2624
  elapsedMs: Date.now() - i
2634
2625
  });
2635
2626
  }
2636
- }, s = na + "\nself.onmessage = async (e) => {\n try {\n const fn = new Function(\"data\", e.data.script);\n try { self.eval = undefined; self.Function = undefined; } catch {}\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;
2627
+ }, s = ta + "\nself.onmessage = async (e) => {\n try {\n const fn = new Function(\"data\", e.data.script);\n try { self.eval = undefined; self.Function = undefined; } catch {}\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;
2637
2628
  try {
2638
2629
  let e = new Blob([s], { type: "application/javascript" });
2639
2630
  c = URL.createObjectURL(e), l = new Worker(c);
@@ -2669,8 +2660,8 @@ function aa(e, t = 3e3) {
2669
2660
  }
2670
2661
  //#endregion
2671
2662
  //#region src/core/tools/dataSlotQuery.ts
2672
- var oa = /[\w$-]/;
2673
- function sa(e) {
2663
+ var aa = /[\w$-]/;
2664
+ function oa(e) {
2674
2665
  let t = [], n = e.trim(), r = +(n[0] === "$");
2675
2666
  for (; r < n.length;) {
2676
2667
  let e = n[r];
@@ -2681,7 +2672,7 @@ function sa(e) {
2681
2672
  continue;
2682
2673
  }
2683
2674
  let e = "";
2684
- for (; r < n.length && oa.test(n[r]);) e += n[r++];
2675
+ for (; r < n.length && aa.test(n[r]);) e += n[r++];
2685
2676
  if (!e) throw Error("JSONPath: .. 后缺属性名");
2686
2677
  t.push({
2687
2678
  type: "descendKey",
@@ -2694,7 +2685,7 @@ function sa(e) {
2694
2685
  continue;
2695
2686
  }
2696
2687
  let e = "";
2697
- for (; r < n.length && oa.test(n[r]);) e += n[r++];
2688
+ for (; r < n.length && aa.test(n[r]);) e += n[r++];
2698
2689
  if (!e) throw Error("JSONPath: . 后缺属性名");
2699
2690
  t.push({
2700
2691
  type: "key",
@@ -2750,7 +2741,7 @@ function sa(e) {
2750
2741
  }
2751
2742
  return t;
2752
2743
  }
2753
- function ca(e) {
2744
+ function sa(e) {
2754
2745
  let t = [], n = 0, r = e.trim();
2755
2746
  for (; n < r.length;) {
2756
2747
  let e = r[n];
@@ -2795,7 +2786,7 @@ function ca(e) {
2795
2786
  }
2796
2787
  return t;
2797
2788
  }
2798
- var la = class {
2789
+ var ca = class {
2799
2790
  toks;
2800
2791
  item;
2801
2792
  pos = 0;
@@ -2831,12 +2822,12 @@ var la = class {
2831
2822
  return this.next(), e;
2832
2823
  }
2833
2824
  let e = this.operand(), t = this.peek();
2834
- return t === "==" || t === "!=" || t === "<" || t === "<=" || t === ">" || t === ">=" ? (this.next(), fa(t, e, this.operand())) : ua(e);
2825
+ return t === "==" || t === "!=" || t === "<" || t === "<=" || t === ">" || t === ">=" ? (this.next(), da(t, e, this.operand())) : la(e);
2835
2826
  }
2836
2827
  operand() {
2837
2828
  let e = this.next();
2838
2829
  if (e === void 0) throw Error("过滤表达式:缺操作数");
2839
- if (e.startsWith("@")) return da(e, this.item);
2830
+ if (e.startsWith("@")) return ua(e, this.item);
2840
2831
  if (e[0] === "'" || e[0] === "\"") return e.slice(1, -1);
2841
2832
  if (e === "true") return !0;
2842
2833
  if (e === "false") return !1;
@@ -2846,10 +2837,10 @@ var la = class {
2846
2837
  throw Error(`过滤表达式:未知操作数 '${e}'`);
2847
2838
  }
2848
2839
  };
2849
- function ua(e) {
2840
+ function la(e) {
2850
2841
  return !!e && e !== 0 && e !== "" && e !== null;
2851
2842
  }
2852
- function da(e, t) {
2843
+ function ua(e, t) {
2853
2844
  let n = e.split(".").filter((e) => e && e !== "@"), r = t;
2854
2845
  for (let e of n) {
2855
2846
  if (typeof r != "object" || !r) return;
@@ -2857,7 +2848,7 @@ function da(e, t) {
2857
2848
  }
2858
2849
  return r;
2859
2850
  }
2860
- function fa(e, t, n) {
2851
+ function da(e, t, n) {
2861
2852
  switch (e) {
2862
2853
  case "==": return t === n;
2863
2854
  case "!=": return t !== n;
@@ -2868,47 +2859,47 @@ function fa(e, t, n) {
2868
2859
  default: return !1;
2869
2860
  }
2870
2861
  }
2871
- function pa(e, t) {
2872
- return new la(ca(e), t).parse();
2862
+ function fa(e, t) {
2863
+ return new ca(sa(e), t).parse();
2873
2864
  }
2874
- function ma(e, t) {
2865
+ function pa(e, t) {
2875
2866
  return e ? `${e}.${t}` : String(t);
2876
2867
  }
2877
- function ha(e, t) {
2868
+ function ma(e, t) {
2878
2869
  let n = [{
2879
2870
  path: "",
2880
2871
  value: e
2881
2872
  }];
2882
- for (let e of sa(t)) {
2873
+ for (let e of oa(t)) {
2883
2874
  let t = [];
2884
2875
  if (e.type === "key") for (let r of n) r.value != null && typeof r.value == "object" && e.key in r.value && t.push({
2885
- path: ma(r.path, e.key),
2876
+ path: pa(r.path, e.key),
2886
2877
  value: r.value[e.key]
2887
2878
  });
2888
2879
  else if (e.type === "index") {
2889
2880
  for (let r of n) if (Array.isArray(r.value)) {
2890
2881
  let n = r.value[e.index];
2891
2882
  e.index >= 0 && e.index < r.value.length && t.push({
2892
- path: ma(r.path, e.index),
2883
+ path: pa(r.path, e.index),
2893
2884
  value: n,
2894
2885
  index: e.index
2895
2886
  });
2896
2887
  }
2897
2888
  } else if (e.type === "wildcard") {
2898
2889
  for (let e of n) if (Array.isArray(e.value)) e.value.forEach((n, r) => t.push({
2899
- path: ma(e.path, r),
2890
+ path: pa(e.path, r),
2900
2891
  value: n,
2901
2892
  index: r
2902
2893
  }));
2903
2894
  else if (e.value != null && typeof e.value == "object") for (let n of Object.keys(e.value)) t.push({
2904
- path: ma(e.path, n),
2895
+ path: pa(e.path, n),
2905
2896
  value: e.value[n]
2906
2897
  });
2907
2898
  } else if (e.type === "descendKey") {
2908
2899
  let r = e.key, i = (e) => {
2909
2900
  if (!(e.value == null || typeof e.value != "object")) for (let n of Object.keys(e.value)) {
2910
2901
  let a = {
2911
- path: ma(e.path, n),
2902
+ path: pa(e.path, n),
2912
2903
  value: e.value[n]
2913
2904
  };
2914
2905
  n === r && t.push(a), i(a);
@@ -2919,7 +2910,7 @@ function ha(e, t) {
2919
2910
  let e = (n) => {
2920
2911
  if (!(n.value == null || typeof n.value != "object")) for (let r of Object.keys(n.value)) {
2921
2912
  let i = {
2922
- path: ma(n.path, r),
2913
+ path: pa(n.path, r),
2923
2914
  value: n.value[r]
2924
2915
  };
2925
2916
  t.push(i), e(i);
@@ -2928,16 +2919,16 @@ function ha(e, t) {
2928
2919
  for (let t of n) e(t);
2929
2920
  } else if (e.type === "filter") {
2930
2921
  for (let r of n) if (Array.isArray(r.value)) r.value.forEach((n, i) => {
2931
- pa(e.filter, n) && t.push({
2932
- path: ma(r.path, i),
2922
+ fa(e.filter, n) && t.push({
2923
+ path: pa(r.path, i),
2933
2924
  value: n,
2934
2925
  index: i
2935
2926
  });
2936
2927
  });
2937
2928
  else if (r.value != null && typeof r.value == "object") for (let n of Object.keys(r.value)) {
2938
2929
  let i = r.value[n];
2939
- pa(e.filter, i) && t.push({
2940
- path: ma(r.path, n),
2930
+ fa(e.filter, i) && t.push({
2931
+ path: pa(r.path, n),
2941
2932
  value: i
2942
2933
  });
2943
2934
  }
@@ -2946,7 +2937,7 @@ function ha(e, t) {
2946
2937
  }
2947
2938
  return n;
2948
2939
  }
2949
- function ga(e, t) {
2940
+ function ha(e, t) {
2950
2941
  let n = e.length, r = t.length;
2951
2942
  if (!n) return r;
2952
2943
  if (!r) return n;
@@ -2962,7 +2953,7 @@ function ga(e, t) {
2962
2953
  }
2963
2954
  return i[r];
2964
2955
  }
2965
- function _a(e, t, n = {}) {
2956
+ function ga(e, t, n = {}) {
2966
2957
  let r = n.mode || "substring", i = n.limit ?? 50, a = n.matchKey !== !1, o = [], s = null;
2967
2958
  if (r === "regex") try {
2968
2959
  s = new RegExp(t, "i");
@@ -2972,11 +2963,11 @@ function _a(e, t, n = {}) {
2972
2963
  let c = (e, l, u) => {
2973
2964
  if (o.length >= i || e == null) return;
2974
2965
  if (typeof e == "object") {
2975
- if (Array.isArray(e)) e.forEach((e, t) => c(e, ma(l, t), String(t)));
2976
- else for (let t of Object.keys(e)) c(e[t], ma(l, t), t);
2966
+ if (Array.isArray(e)) e.forEach((e, t) => c(e, pa(l, t), String(t)));
2967
+ else for (let t of Object.keys(e)) c(e[t], pa(l, t), t);
2977
2968
  return;
2978
2969
  }
2979
- let d = String(e), f = va(d, t, r, n.fuzzyThreshold ?? 2, s);
2970
+ let d = String(e), f = _a(d, t, r, n.fuzzyThreshold ?? 2, s);
2980
2971
  if (f) {
2981
2972
  o.push({
2982
2973
  path: l,
@@ -2987,7 +2978,7 @@ function _a(e, t, n = {}) {
2987
2978
  return;
2988
2979
  }
2989
2980
  if (a && u) {
2990
- let e = va(u, t, r, n.fuzzyThreshold ?? 2, s);
2981
+ let e = _a(u, t, r, n.fuzzyThreshold ?? 2, s);
2991
2982
  e && o.push({
2992
2983
  path: l,
2993
2984
  key: u,
@@ -2998,65 +2989,65 @@ function _a(e, t, n = {}) {
2998
2989
  };
2999
2990
  return c(e, ""), o;
3000
2991
  }
3001
- function va(e, t, n, r, i) {
2992
+ function _a(e, t, n, r, i) {
3002
2993
  let a = e.toLowerCase(), o = t.toLowerCase();
3003
2994
  if (n === "substring") return a.includes(o) ? 1 : null;
3004
2995
  if (n === "regex") return i && i.test(e) ? 1 : null;
3005
2996
  if (n === "fuzzy") {
3006
2997
  if (a.includes(o)) return 2;
3007
- let e = ga(a, o);
2998
+ let e = ha(a, o);
3008
2999
  return e <= r ? r - e + 1 : null;
3009
3000
  }
3010
3001
  return null;
3011
3002
  }
3012
- function ya(e, t, n = 3e3) {
3013
- return aa(t, n)(e);
3003
+ function va(e, t, n = 3e3) {
3004
+ return ia(t, n)(e);
3014
3005
  }
3015
3006
  //#endregion
3016
3007
  //#region src/core/harness/readInvalidation.ts
3017
- var ba = "", xa = "根(整体)", Sa = /* @__PURE__ */ new Set([
3008
+ var ya = "", ba = "根(整体)", xa = /* @__PURE__ */ new Set([
3018
3009
  "read",
3019
3010
  "query_data",
3020
3011
  "search_data"
3021
- ]), Ca = /* @__PURE__ */ new Set(["resource_update", "resource_delete"]), wa = /* @__PURE__ */ new Set(["remove", "move"]);
3022
- function Ta(e) {
3012
+ ]), Sa = /* @__PURE__ */ new Set(["resource_update", "resource_delete"]), Ca = /* @__PURE__ */ new Set(["remove", "move"]);
3013
+ function wa(e) {
3023
3014
  let t = String(e).trim();
3024
- return t === "(root)" || t === "$" ? ba : (t.startsWith("$.") ? t = t.slice(2) : t.startsWith("$") && (t = t.slice(1)), t = t.replace(/\[(\d+)\]/g, ".$1"), t);
3015
+ return t === "(root)" || t === "$" ? ya : (t.startsWith("$.") ? t = t.slice(2) : t.startsWith("$") && (t = t.slice(1)), t = t.replace(/\[(\d+)\]/g, ".$1"), t);
3025
3016
  }
3026
- function Ea(e) {
3027
- let t = Ta(e);
3028
- return t === ba ? xa : t;
3017
+ function Ta(e) {
3018
+ let t = wa(e);
3019
+ return t === ya ? ba : t;
3029
3020
  }
3030
- function Da(e) {
3021
+ function Ea(e) {
3031
3022
  let t = Math.max(e.lastIndexOf("."), e.lastIndexOf("["));
3032
- return t <= 0 ? ba : e.slice(0, t);
3023
+ return t <= 0 ? ya : e.slice(0, t);
3033
3024
  }
3034
- function Oa(e, t) {
3035
- let n = Ta(e), r = Ta(t);
3036
- return n === ba || r === ba || n === r || n.startsWith(r + ".") || n.startsWith(r + "[") || r.startsWith(n + ".") || r.startsWith(n + "[");
3025
+ function Da(e, t) {
3026
+ let n = wa(e), r = wa(t);
3027
+ return n === ya || r === ya || n === r || n.startsWith(r + ".") || n.startsWith(r + "[") || r.startsWith(n + ".") || r.startsWith(n + "[");
3037
3028
  }
3038
- function ka(e) {
3039
- if (!e) return ba;
3029
+ function Oa(e) {
3030
+ if (!e) return ya;
3040
3031
  try {
3041
3032
  let t = [];
3042
- for (let n of sa(e)) if (n.type === "key" && n.key) t.push(n.key);
3033
+ for (let n of oa(e)) if (n.type === "key" && n.key) t.push(n.key);
3043
3034
  else if (n.type === "index" && n.index !== void 0) t.push(String(n.index));
3044
3035
  else break;
3045
- return t.length ? t.join(".") : ba;
3036
+ return t.length ? t.join(".") : ya;
3046
3037
  } catch {
3047
- return ba;
3038
+ return ya;
3048
3039
  }
3049
3040
  }
3050
- function Aa(e, t) {
3041
+ function ka(e, t) {
3051
3042
  let n = t || {};
3052
- if (e === "query_data") return (Array.isArray(n.queries) && n.queries.length ? n.queries.map(String) : [String(n.expr || "")]).map((e) => ka(e));
3053
- if (e === "search_data") return [ba];
3043
+ if (e === "query_data") return (Array.isArray(n.queries) && n.queries.length ? n.queries.map(String) : [String(n.expr || "")]).map((e) => Oa(e));
3044
+ if (e === "search_data") return [ya];
3054
3045
  let r = [];
3055
3046
  if (typeof n.jsonPath == "string" && n.jsonPath && r.push(n.jsonPath), Array.isArray(n.jsonPaths)) for (let e of n.jsonPaths) typeof e == "string" && e && r.push(e);
3056
- return r.length ? r.map(Ta) : [ba];
3047
+ return r.length ? r.map(wa) : [ya];
3057
3048
  }
3058
- function ja(e) {
3059
- if (Ca.has(e.name)) return null;
3049
+ function Aa(e) {
3050
+ if (Sa.has(e.name)) return null;
3060
3051
  let t = e.args || {}, n = t.del === !0, r = [];
3061
3052
  if (n) r.push({
3062
3053
  path: String(t.patch?.jsonPath ?? t.jsonPath ?? ""),
@@ -3078,15 +3069,15 @@ function ja(e) {
3078
3069
  path: t.path,
3079
3070
  op: "set"
3080
3071
  }) : r.push({
3081
- path: ba,
3072
+ path: ya,
3082
3073
  op: "set"
3083
3074
  });
3084
3075
  let i = /* @__PURE__ */ new Set();
3085
3076
  for (let { path: e, op: t, value: n } of r) {
3086
- let r = Ta(e);
3087
- if (i.add(r), wa.has(t) && i.add(Da(r)), t === "move" && typeof n == "string" && n) {
3088
- let e = Ta(n);
3089
- i.add(e), i.add(Da(e));
3077
+ let r = wa(e);
3078
+ if (i.add(r), Ca.has(t) && i.add(Ea(r)), t === "move" && typeof n == "string" && n) {
3079
+ let e = wa(n);
3080
+ i.add(e), i.add(Ea(e));
3090
3081
  }
3091
3082
  }
3092
3083
  return {
@@ -3095,12 +3086,12 @@ function ja(e) {
3095
3086
  callIndex: e.callIndex
3096
3087
  };
3097
3088
  }
3098
- function Ma(e, t, n, r) {
3099
- let i = e.map(Ea).join("、"), a = [...new Set(n.flatMap((e) => e.paths))].map(Ea).join("、"), o = [`⏱[过期快照] 此前读取 ${i} 的结果已失效(${r === void 0 ? `已写入 ${a}` : `第 ${r} 轮写入了 ${a}`})。`];
3089
+ function ja(e, t, n, r) {
3090
+ let i = e.map(Ta).join("、"), a = [...new Set(n.flatMap((e) => e.paths))].map(Ta).join("、"), o = [`⏱[过期快照] 此前读取 ${i} 的结果已失效(${r === void 0 ? `已写入 ${a}` : `第 ${r} 轮写入了 ${a}`})。`];
3100
3091
  return n.some((e) => e.hasPostValue) ? o.push(`该轮写入结果已含 ${a} 最新值与新 hash,直接引用即可;原读取结果整体已过期,未提及路径需引用时按下方指引重读/重跑。`) : o.push("原读取结果整体已过期(含未触及的兄弟路径),需引用时按下方指引重读/重跑。"), t === "query_data" || t === "search_data" ? o.push(`需当前结果时重跑 ${t}(表达式/条件不变即可)。`) : o.push(`需当前精确值时再 read(建议窄读:${i})。`), o.join("\n");
3101
3092
  }
3102
- function Na(e, t, n = {}) {
3103
- let r = n.maxParallelTools ?? 1, i = t.map((e) => ja(e)).filter((e) => e !== null);
3093
+ function Ma(e, t, n = {}) {
3094
+ let r = n.maxParallelTools ?? 1, i = t.map((e) => Aa(e)).filter((e) => e !== null);
3104
3095
  if (!i.length || !e.length) return {
3105
3096
  messages: e,
3106
3097
  invalidatedCount: 0,
@@ -3135,11 +3126,11 @@ function Na(e, t, n = {}) {
3135
3126
  let e = n.name;
3136
3127
  r = e ? l.find((t) => !t.used && t.name === e) : l.find((e) => !e.used);
3137
3128
  }
3138
- r && (r.used = !0, Sa.has(r.name) && c.push({
3129
+ r && (r.used = !0, xa.has(r.name) && c.push({
3139
3130
  aiIndex: u,
3140
3131
  callIndex: r.callIndex,
3141
3132
  name: r.name,
3142
- paths: Aa(r.name, r.args),
3133
+ paths: ka(r.name, r.args),
3143
3134
  msgIndex: t
3144
3135
  }));
3145
3136
  }
@@ -3148,11 +3139,11 @@ function Na(e, t, n = {}) {
3148
3139
  for (let t of c) {
3149
3140
  let a = e[t.msgIndex];
3150
3141
  if (String(a.content ?? "").startsWith("⏱[过期快照]")) continue;
3151
- let c = i.filter((e) => e.paths.some((e) => t.paths.some((t) => Oa(t, e))));
3142
+ let c = i.filter((e) => e.paths.some((e) => t.paths.some((t) => Da(t, e))));
3152
3143
  if (!c.length) continue;
3153
3144
  let l;
3154
3145
  if (l = t.aiIndex !== s || r > 1 || c.some((e) => e.callIndex === void 0 || t.callIndex < e.callIndex), !l) continue;
3155
- let u = Ma(t.paths, t.name, c, n.round);
3146
+ let u = ja(t.paths, t.name, c, n.round);
3156
3147
  d ||= e.slice(), d[t.msgIndex] = new o({
3157
3148
  tool_call_id: a.tool_call_id ?? "",
3158
3149
  name: a.name,
@@ -3170,47 +3161,51 @@ function Na(e, t, n = {}) {
3170
3161
  }
3171
3162
  //#endregion
3172
3163
  //#region src/core/harness/actionGate.ts
3173
- var Pa = /(改|改掉|改成|修改|更新|加|添加|新增|加上|删|删掉|删除|移除|移|移动|换|替换|调|调整|调换|生成|创建|做|做个|做一个|建|搭建|重建|重新|清空|设置|配置|美化|优化|排版|布置|填充|写入|保存|发布|上线|部署)/, Fa = /(看看|看一下|查|查一下|查询|了解|了解下|说说|讲讲|解释|解释下|总结|总结一下|对比|对比一下|确认|确认一下|核对|检查|检查一下|看看有没有|帮我看看|review|Review)/, Ia = /(不用改|不用动|只是问|只是想问|先别动|先不要|不用写入|不要保存|只是确认|告诉我即可|不用执行)/, La = /^(use_|spawn_agent|spawn_agents)/;
3174
- function Ra(e) {
3164
+ var Na = /(改|改掉|改成|修改|更新|加|添加|新增|加上|删|删掉|删除|移除|移|移动|换|替换|调|调整|调换|生成|创建|做|做个|做一个|建|搭建|重建|重新|清空|设置|配置|美化|优化|排版|布置|填充|写入|保存|发布|上线|部署)/, Pa = /(看看|看一下|查|查一下|查询|了解|了解下|说说|讲讲|解释|解释下|总结|总结一下|对比|对比一下|确认|确认一下|核对|检查|检查一下|看看有没有|帮我看看|review|Review)/, Fa = /(不用改|不用动|只是问|只是想问|先别动|先不要|不用写入|不要保存|只是确认|告诉我即可|不用执行)/, Ia = /^(use_|spawn_agent|spawn_agents)/;
3165
+ function La(e) {
3175
3166
  let t = (e || "").trim();
3176
- if (!t || Ia.test(t) || /(吗|呢)[??]?\s*$/.test(t) || /[??]\s*$/.test(t)) return !1;
3167
+ if (!t || Fa.test(t) || /(吗|呢)[??]?\s*$/.test(t) || /[??]\s*$/.test(t)) return !1;
3177
3168
  let n = (t.split(/[。!?;,!?;,\n]/)[0] ?? t).slice(0, 16);
3178
- return !Fa.test(n) && Pa.test(n);
3169
+ return !Pa.test(n) && Na.test(n);
3179
3170
  }
3180
- function za(e, t) {
3181
- for (let [n, r] of Object.entries(e.counts)) if (!(r <= 0) && (t(n) || La.test(n))) return !1;
3171
+ function Ra(e, t) {
3172
+ for (let [n, r] of Object.entries(e.counts)) if (!(r <= 0) && (t(n) || Ia.test(n) && r - (e.rejectedDelegations?.[n] ?? 0) > 0)) return !1;
3182
3173
  return !0;
3183
3174
  }
3184
- function Ba(e, t, n = () => !1) {
3185
- let r = Object.entries(e.counts).filter(([e, t]) => t > 0 || n(e)).map(([e, t]) => `${e}×${t}`);
3175
+ function za(e, t, n = () => !1) {
3176
+ let r = Object.entries(e.counts).filter(([e, t]) => t > 0 || n(e)).map(([t, n]) => {
3177
+ let r = e.rejectedDelegations?.[t] ?? 0;
3178
+ return r > 0 && Ia.test(t) ? `${t}×${n}(其中 ${r} 次被拒未生效,如组件锁 COMPONENT_BUSY)` : `${t}×${n}`;
3179
+ });
3186
3180
  e.counts.write === void 0 && n("write") && r.push("write×0");
3187
3181
  let i = r.length ? r.join(", ") : "无", a = e.writePaths.length ? e.writePaths.slice(0, 5).join(", ") + (e.writePaths.length > 5 ? ` 等 ${e.writePaths.length} 处` : "") : "无", o = t?.length ?? 0, s = t?.filter((e) => e.status === "completed").length ?? 0, c = o ? `${s}/${o} 完成` : "无 todos";
3188
3182
  return `本轮事实:工具调用 ${i};成功写入路径:${a};失败/回灌 ${e.failures};todos:${c}。`;
3189
3183
  }
3190
- var Va = /(components?\.\d+|child(ren)?\.\d+|[a-zA-Z][a-zA-Z0-9_-]{3,}\.\d+|jsonPath|@ ?"[^"]+"|路径)/;
3191
- function Ha(e) {
3184
+ var Ba = /(components?\.\d+|child(ren)?\.\d+|[a-zA-Z][a-zA-Z0-9_-]{3,}\.\d+|jsonPath|@ ?"[^"]+"|路径)/;
3185
+ function Va(e) {
3192
3186
  return [
3193
3187
  "⚠️ 这条指令看起来需要改动数据,但本轮没有任何写入或委派操作。",
3194
3188
  `${e}`,
3195
3189
  "如果确实已完成:请在回复中逐项说明改动位置(jsonPath / 组件 id),与上述事实对账;",
3196
3190
  "如果尚未完成:请继续执行(用 write 增量改 / 委派对应子 agent);",
3191
+ "如果委派被组件锁拒绝(COMPONENT_BUSY/COMPONENT_LOCKED):说明在途委派占用,等其结束后重试,勿谎称已完成;",
3197
3192
  "如果做不到或需要用户决定:请如实说明原因,不要回复「已完成」。"
3198
3193
  ].join("\n");
3199
3194
  }
3200
- function Ua(e) {
3201
- return Va.test(e || "");
3195
+ function Ha(e) {
3196
+ return Ba.test(e || "");
3197
+ }
3198
+ var Ua = /(写到了哪|写到哪|在哪写|什么位置|完成了吗|完成没|做完了吗|做好了|好了吗|搞定了吗|生成了吗|改好了吗|改完了吗|保存了吗|写入了吗|写入了没有|有没有写入|有没有保存|现在的?(页面|数据|状态|内容)|当前(页面|数据|状态)|进度如何|进度怎么样|什么状态)/, Wa = /(已写入|已保存|已添加|已删除|已修改|已更新|已设置|已生成|已创建|已搭建|已删除|已经写入|已经完成|全部完成|全部搞定)/;
3199
+ function Ga(e) {
3200
+ return Ua.test((e || "").trim());
3202
3201
  }
3203
- var Wa = /(写到了哪|写到哪|在哪写|什么位置|完成了吗|完成没|做完了吗|做好了|好了吗|搞定了吗|生成了吗|改好了吗|改完了吗|保存了吗|写入了吗|写入了没有|有没有写入|有没有保存|现在的?(页面|数据|状态|内容)|当前(页面|数据|状态)|进度如何|进度怎么样|什么状态)/, Ga = /(已写入|已保存|已添加|已删除|已修改|已更新|已设置|已生成|已创建|已搭建|已删除|已经写入|已经完成|全部完成|全部搞定)/;
3204
3202
  function Ka(e) {
3205
- return Wa.test((e || "").trim());
3203
+ return Wa.test(e || "");
3206
3204
  }
3207
3205
  function qa(e) {
3208
- return Ga.test(e || "");
3209
- }
3210
- function Ja(e) {
3211
3206
  return Object.values(e.counts).every((e) => e <= 0);
3212
3207
  }
3213
- function Ya(e) {
3208
+ function Ja(e) {
3214
3209
  return [
3215
3210
  "⚠️ 这是关于数据现状的询问,但本轮你没有调用任何工具(含 read)就断言了「已写入/已完成」状态。",
3216
3211
  `${e}`,
@@ -3218,27 +3213,36 @@ function Ya(e) {
3218
3213
  "请先用 read / list 类工具核实实际数据再据实回答;若实际未写入,如实说明并继续完成,不要凭印象回复「已完成」。"
3219
3214
  ].join("\n");
3220
3215
  }
3221
- var Xa = /(我先|让我先|我先看|先看看|先了解|先加载|先查阅|稍后|接下来我|我将先|等我|查完.{0,12}再|看完.{0,12}再|了解.{0,8}再)/, Za = /(已完成|已生成|已修改|已创建|已添加|已删除|已更新|已调整|已处理|已委派|已配置|已切换|成功|完成[。!?]|搞定了|做好了)/;
3222
- function Qa(e) {
3216
+ var Ya = /(我先|让我先|我先看|先看看|先了解|先加载|先查阅|稍后|接下来我|我将先|等我|查完.{0,12}再|看完.{0,12}再|了解.{0,8}再)/, Xa = /(已完成|已生成|已修改|已创建|已添加|已删除|已更新|已调整|已处理|已委派|已配置|已切换|成功|完成[。!?]|搞定了|做好了)/;
3217
+ function Za(e) {
3223
3218
  if (!e) return !1;
3224
3219
  let t = e.trim();
3225
- return t.length > 160 || Za.test(t) ? !1 : Xa.test(t);
3220
+ return t.length > 160 || Xa.test(t) ? !1 : Ya.test(t);
3226
3221
  }
3227
- var $a = /(add_component|delete_component|move_component|list_components|select_component|load_skill|use_[a-z]+|rag_[a-z]+|request_human_confirmation|\bwrite\b|\bread\b)/, eo = /(我来|让我|我先|现在|开始|先加载|先添加|先写|先删|先看看|执行|添加|写入|加载|删除)/;
3228
- function to(e) {
3222
+ var Qa = /(add_component|delete_component|move_component|list_components|select_component|load_skill|use_[a-z]+|rag_[a-z]+|request_human_confirmation|\bwrite\b|\bread\b)/, $a = /(我来|让我|我先|现在|开始|先加载|先添加|先写|先删|先看看|执行|添加|写入|加载|删除)/;
3223
+ function eo(e) {
3229
3224
  if (!e) return !1;
3230
3225
  let t = e.trim();
3231
- return $a.test(t) && eo.test(t);
3226
+ return Qa.test(t) && $a.test(t);
3232
3227
  }
3233
- function no(e) {
3228
+ function to(e) {
3234
3229
  if (!e) return [];
3235
3230
  let t = String(e).replace(/\$\.?/g, " ").replace(/\[(\d+)\]/g, ".$1"), n = [];
3236
3231
  for (let e of t.matchAll(/[A-Za-z_][\w-]*(?:\.[A-Za-z_][\w-]*|\.\d+)+/g)) n.push(e[0]);
3237
3232
  return [...new Set(n)];
3238
3233
  }
3239
- function ro(e, t) {
3234
+ function no(e, t) {
3240
3235
  let n = Array.from(t);
3241
- return n.length ? e.some((e) => n.some((t) => Oa(e, t))) : !1;
3236
+ return n.length ? e.some((e) => n.some((t) => Da(e, t))) : !1;
3237
+ }
3238
+ //#endregion
3239
+ //#region src/core/harness/writeGate.ts
3240
+ function ro(e, t, n) {
3241
+ if (!e || !n || n.status === "error" || t && t.dryRun === !0) return !1;
3242
+ let r = "writeCapable" in e ? e.writeCapable : void 0;
3243
+ if (!(typeof r == "function" ? r(t ?? {}) : r === !0)) return !1;
3244
+ let i = String(n.content || "");
3245
+ return !(i.startsWith("ERROR:") || i.includes("未写入") || i.includes("无需删除"));
3242
3246
  }
3243
3247
  //#endregion
3244
3248
  //#region src/core/harness/todos.ts
@@ -3374,7 +3378,7 @@ var fo = 2, po = 2, mo = 2, ho = 2;
3374
3378
  function go(e) {
3375
3379
  let { state: t, garbled: n, rounds: r } = e, i = e.finalContent;
3376
3380
  if (n) return null;
3377
- let a = !/[??]\s*$/.test(i.trim()) && (r > 0 ? Qa(i) : to(i));
3381
+ let a = !/[??]\s*$/.test(i.trim()) && (r > 0 ? Za(i) : eo(i));
3378
3382
  if (t.transitionalRetries < fo && a) return t.transitionalRetries += 1, {
3379
3383
  kind: "feedback",
3380
3384
  gate: {
@@ -3425,38 +3429,38 @@ function go(e) {
3425
3429
  break;
3426
3430
  }
3427
3431
  }
3428
- if (t.zeroToolRetries < mo && za(e.turnUsage, e.isWriteToolByName) && Ra(s) && !Ua(i) && !/[??]\s*$/.test(i.trim())) {
3432
+ if (t.zeroToolRetries < mo && Ra(e.turnUsage, e.isWriteToolByName) && La(s) && !Ha(i) && !/[??]\s*$/.test(i.trim())) {
3429
3433
  t.zeroToolRetries += 1;
3430
- let n = Ba(e.turnUsage, e.todos, e.isWriteToolByName);
3434
+ let n = za(e.turnUsage, e.todos, e.isWriteToolByName);
3431
3435
  return {
3432
3436
  kind: "feedback",
3433
3437
  gate: {
3434
3438
  stage: "zero_tool_gate",
3435
3439
  attempt: t.zeroToolRetries,
3436
- feedback: Ha(n),
3440
+ feedback: Va(n),
3437
3441
  logData: { factSheet: n }
3438
3442
  }
3439
3443
  };
3440
3444
  }
3441
- if (t.zeroToolRetries < mo && Ja(e.turnUsage) && Ka(s) && qa(i)) {
3445
+ if (t.zeroToolRetries < mo && qa(e.turnUsage) && Ga(s) && Ka(i)) {
3442
3446
  t.zeroToolRetries += 1;
3443
- let n = Ba(e.turnUsage, e.todos, e.isWriteToolByName);
3447
+ let n = za(e.turnUsage, e.todos, e.isWriteToolByName);
3444
3448
  return {
3445
3449
  kind: "feedback",
3446
3450
  gate: {
3447
3451
  stage: "status_query_gate",
3448
3452
  attempt: t.zeroToolRetries,
3449
- feedback: Ya(n),
3453
+ feedback: Ja(n),
3450
3454
  logData: { factSheet: n }
3451
3455
  }
3452
3456
  };
3453
3457
  }
3454
- return t.zeroToolRetries >= mo && za(e.turnUsage, e.isWriteToolByName) && Ra(s) ? {
3458
+ return t.zeroToolRetries >= mo && Ra(e.turnUsage, e.isWriteToolByName) && La(s) ? {
3455
3459
  kind: "observable",
3456
3460
  obs: {
3457
3461
  code: "ZERO_TOOL_GATE_EXHAUSTED",
3458
3462
  message: "操作指令经 2 次回灌后仍以零工具纯文本收尾(疑似谎报完成),已放行;最终回复可能不实",
3459
- context: { factSheet: Ba(e.turnUsage, e.todos, e.isWriteToolByName) }
3463
+ context: { factSheet: za(e.turnUsage, e.todos, e.isWriteToolByName) }
3460
3464
  }
3461
3465
  } : null;
3462
3466
  }
@@ -3466,8 +3470,8 @@ function _o(e, t, n) {
3466
3470
  if (e.status !== "completed") return !1;
3467
3471
  let n = t?.get(e.id);
3468
3472
  if (n && n.status === "completed" && n.content === e.content) return !1;
3469
- let i = no(e.evidence ?? "");
3470
- return i.length ? !ro(i, r) : !1;
3473
+ let i = to(e.evidence ?? "");
3474
+ return i.length ? !no(i, r) : !1;
3471
3475
  });
3472
3476
  }
3473
3477
  function vo(e) {
@@ -3616,33 +3620,33 @@ function Bo(e) {
3616
3620
  return Array.isArray(r) && r.length && r[0] && typeof r[0].jsonPath == "string" ? r[0].jsonPath : "";
3617
3621
  }
3618
3622
  function Vo(e) {
3619
- let { apiKey: t, baseUrl: s, model: c = "deepseek-v4-flash", temperature: l = .7, maxTokens: u, extraBody: d, extraConfig: f, systemPrompt: p, tools: m = [], middleware: h = [], maxToolRounds: g, maxIterations: _, maxRetries: S = 2, retryDelayMs: C = 500, stallMs: E = Ki, streamMaxMs: ee = Ji, toolTimeoutMs: D, maxParallelTools: te = 1, maxVerifyAttempts: ie = 0, roundTokenBudget: ae = 0, onLog: O, onLlmChange: k, imageContentFormat: A = "openai", staleReadInvalidation: se = !0, debug: j = !1 } = e, M = g ?? No;
3620
- (!Number.isFinite(M) || M < 1) && (console.warn(`[page-agent-sdk] maxToolRounds=${M} 非法(须 ≥1 正整数),已 clamp 到 1(0/负数致主循环 while 不进 → agent 不调 LLM 静默返回兜底文案)`), M = 1);
3621
- let N = v({
3623
+ let { apiKey: t, baseUrl: s, model: c = "deepseek-v4-flash", temperature: l = .7, maxTokens: u, extraBody: d, extraConfig: f, systemPrompt: p, tools: m = [], middleware: h = [], maxToolRounds: g, maxIterations: _, maxRetries: S = 2, retryDelayMs: C = 500, stallMs: E = Ki, streamMaxMs: D = Ji, toolTimeoutMs: O, maxParallelTools: ee = 1, maxVerifyAttempts: re = 0, roundTokenBudget: ie = 0, onLog: k, onLlmChange: A, imageContentFormat: j = "openai", staleReadInvalidation: oe = !0, debug: M = !1 } = e, N = g ?? No;
3624
+ (!Number.isFinite(N) || N < 1) && (console.warn(`[page-agent-sdk] maxToolRounds=${N} 非法(须 ≥1 正整数),已 clamp 到 1(0/负数致主循环 while 不进 → agent 不调 LLM 静默返回兜底文案)`), N = 1);
3625
+ let P = v({
3622
3626
  model: c,
3623
3627
  contextWindow: e.contextWindow,
3624
3628
  maxOutputTokens: e.maxOutputTokens,
3625
3629
  vision: e.vision
3626
- }), ce = u ?? N.maxOutputTokens, P = b(N.contextWindow), F = x(N.contextWindow);
3627
- function le(e) {
3628
- N = e, P = b(N.contextWindow), F = x(N.contextWindow);
3630
+ }), se = u ?? P.maxOutputTokens, F = b(P.contextWindow), I = x(P.contextWindow);
3631
+ function ce(e) {
3632
+ P = e, F = b(P.contextWindow), I = x(P.contextWindow);
3629
3633
  }
3630
- let ue = /* @__PURE__ */ Wt([]), I = 0, de = /* @__PURE__ */ new Set();
3631
- function L(e, t) {
3634
+ let le = /* @__PURE__ */ Wt([]), L = 0, ue = /* @__PURE__ */ new Set();
3635
+ function R(e, t) {
3632
3636
  let n = {
3633
3637
  timestamp: Date.now(),
3634
3638
  type: e,
3635
3639
  data: t
3636
3640
  };
3637
- ue.value.push(n), ue.value.length > Po && ue.value.splice(0, ue.value.length - Po), qt(ue), O?.(n), j && console.log(`%c[Agent] ${e}`, "color:#667eea;font-weight:bold", t);
3641
+ le.value.push(n), le.value.length > Po && le.value.splice(0, le.value.length - Po), qt(le), k?.(n), M && console.log(`%c[Agent] ${e}`, "color:#667eea;font-weight:bold", t);
3638
3642
  }
3639
- let R = (e) => {
3640
- ue.value.push(e), ue.value.length > Po && ue.value.splice(0, ue.value.length - Po), qt(ue);
3643
+ let de = (e) => {
3644
+ le.value.push(e), le.value.length > Po && le.value.splice(0, le.value.length - Po), qt(le);
3641
3645
  }, z = [...h.flatMap((e) => e.tools || []), ...m], fe = e.llm ?? new n({
3642
3646
  apiKey: t,
3643
3647
  model: c,
3644
3648
  temperature: l,
3645
- maxTokens: ce,
3649
+ maxTokens: se,
3646
3650
  configuration: {
3647
3651
  ...s ? { baseURL: T(s) } : {},
3648
3652
  fetch: w,
@@ -3675,21 +3679,21 @@ function Vo(e) {
3675
3679
  pin: ge.has(e.name)
3676
3680
  });
3677
3681
  }
3678
- let n = Math.max(2e3, Math.round(N.contextWindow * he)), r = y(e) + t.reduce((e, t) => e + t.tokens, 0);
3682
+ let n = Math.max(2e3, Math.round(P.contextWindow * he)), r = y(e) + t.reduce((e, t) => e + t.tokens, 0);
3679
3683
  if (r > n) {
3680
3684
  let e = r, i = [];
3681
3685
  for (let e of t.filter((e) => !e.pin).sort((e, t) => t.tokens - e.tokens)) {
3682
3686
  if (r <= n) break;
3683
3687
  i.push(`${e.name}(${e.tokens})`), r -= e.tokens, e.text = "";
3684
3688
  }
3685
- i.length && console.warn(`[page-agent-sdk] 系统段超预算(${e} > ${n} tokens,窗口 ${N.contextWindow} 的 ${he * 100}%),drop 非核心段:${i.join(", ")}(保 base/mission/workingMemory)`);
3689
+ i.length && console.warn(`[page-agent-sdk] 系统段超预算(${e} > ${n} tokens,窗口 ${P.contextWindow} 的 ${he * 100}%),drop 非核心段:${i.join(", ")}(保 base/mission/workingMemory)`);
3686
3690
  }
3687
3691
  return [e, ...t.filter((e) => e.text).map((e) => e.text)].join("\n\n");
3688
3692
  }
3689
3693
  function H(e) {
3690
3694
  let t = [new a(_e())];
3691
3695
  for (let n of e) if (n.role === "user") {
3692
- let e = N.vision && n.images?.length ? yi(n.content, n.images, A) : null;
3696
+ let e = P.vision && n.images?.length ? yi(n.content, n.images, j) : null;
3693
3697
  e ? t.push(new i({ content: e })) : n.images?.some((e) => e.description) ? t.push(new i(bi(n.content, n.images))) : t.push(new i(n.content));
3694
3698
  } else n.role === "assistant" ? t.push(new r(n.content)) : n.role === "system" && t.push(new a(n.content));
3695
3699
  return t;
@@ -3705,7 +3709,7 @@ function Vo(e) {
3705
3709
  baseDelayMs: C,
3706
3710
  onRetry: ({ attempt: e, error: t, waitMs: n }) => {
3707
3711
  let r = t?.message ?? String(t);
3708
- L("error", {
3712
+ R("error", {
3709
3713
  stage: "model_retry",
3710
3714
  attempt: e,
3711
3715
  waitMs: n,
@@ -3737,19 +3741,19 @@ function Vo(e) {
3737
3741
  };
3738
3742
  if (Xi(a) && !e._ctxRetry) {
3739
3743
  e._ctxRetry = !0;
3740
- let r = (e) => y(typeof e.content == "string" ? e.content : JSON.stringify(e.content)), a = e.messages.reduce((e, t) => e + r(t), 0), o = xe(e.messages, Math.round(N.contextWindow * .3)), s = o.reduce((e, t) => e + r(t), 0);
3741
- return L("error", {
3744
+ let r = (e) => y(typeof e.content == "string" ? e.content : JSON.stringify(e.content)), a = e.messages.reduce((e, t) => e + r(t), 0), o = xe(e.messages, Math.round(P.contextWindow * .3)), s = o.reduce((e, t) => e + r(t), 0);
3745
+ return R("error", {
3742
3746
  stage: "context_overflow_retry",
3743
3747
  at: "launch",
3744
3748
  beforeTokens: a,
3745
3749
  afterTokens: s,
3746
- window: N.contextWindow
3750
+ window: P.contextWindow
3747
3751
  }), console.warn(`[page-agent-sdk] 上下文超限(启动)→ 激进 trim 重试:${a} → ${s} tokens`), U({
3748
3752
  ...e,
3749
3753
  messages: o
3750
3754
  }, t, n, i);
3751
3755
  }
3752
- throw $i(a) && L("error", {
3756
+ throw $i(a) && R("error", {
3753
3757
  stage: "model_unavailable",
3754
3758
  at: "launch",
3755
3759
  status: a?.status
@@ -3763,25 +3767,25 @@ function Vo(e) {
3763
3767
  };
3764
3768
  let l = null, u = "";
3765
3769
  try {
3766
- for await (let e of Yi(c, E, ee)) {
3770
+ for await (let e of Yi(c, E, D)) {
3767
3771
  l = l ? l.concat(e) : e;
3768
- let n = ne(e);
3772
+ let n = te(e);
3769
3773
  n && t && (u += n, t({
3770
3774
  type: "text",
3771
3775
  delta: n
3772
3776
  }));
3773
- let r = re(e);
3777
+ let r = ne(e);
3774
3778
  r && t && t({
3775
3779
  type: "reasoning",
3776
3780
  delta: r
3777
3781
  });
3778
3782
  }
3779
3783
  } catch (a) {
3780
- if (a instanceof Wi) throw s.abort(), L("error", {
3784
+ if (a instanceof Wi) throw s.abort(), R("error", {
3781
3785
  stage: a instanceof Gi ? "stream_max_duration" : "stream_stalled",
3782
3786
  waitedMs: a.waitedMs,
3783
3787
  stallMs: E,
3784
- streamMaxMs: ee
3788
+ streamMaxMs: D
3785
3789
  }), a;
3786
3790
  if (zi(a, n)) return {
3787
3791
  message: l ?? new r(u),
@@ -3791,29 +3795,29 @@ function Vo(e) {
3791
3795
  };
3792
3796
  if (Xi(a) && l === null && u === "" && !e._ctxRetry) {
3793
3797
  e._ctxRetry = !0;
3794
- let r = (e) => y(typeof e.content == "string" ? e.content : JSON.stringify(e.content)), a = e.messages.reduce((e, t) => e + r(t), 0), o = xe(e.messages, Math.round(N.contextWindow * .3)), s = o.reduce((e, t) => e + r(t), 0);
3795
- return L("error", {
3798
+ let r = (e) => y(typeof e.content == "string" ? e.content : JSON.stringify(e.content)), a = e.messages.reduce((e, t) => e + r(t), 0), o = xe(e.messages, Math.round(P.contextWindow * .3)), s = o.reduce((e, t) => e + r(t), 0);
3799
+ return R("error", {
3796
3800
  stage: "context_overflow_retry",
3797
3801
  beforeTokens: a,
3798
3802
  afterTokens: s,
3799
- window: N.contextWindow
3800
- }), console.warn(`[page-agent-sdk] 上下文超限 → 激进 trim 重试:${a} → ${s} tokens(窗口 ${N.contextWindow})`), U({
3803
+ window: P.contextWindow
3804
+ }), console.warn(`[page-agent-sdk] 上下文超限 → 激进 trim 重试:${a} → ${s} tokens(窗口 ${P.contextWindow})`), U({
3801
3805
  ...e,
3802
3806
  messages: o
3803
3807
  }, t, n, i);
3804
3808
  }
3805
- throw $i(a) && L("error", {
3809
+ throw $i(a) && R("error", {
3806
3810
  stage: "model_unavailable",
3807
3811
  at: "iterate",
3808
3812
  status: a?.status
3809
3813
  }), a;
3810
3814
  }
3811
3815
  if (l === null) {
3812
- if (!e._emptyRetry) return e._emptyRetry = !0, L("error", {
3816
+ if (!e._emptyRetry) return e._emptyRetry = !0, R("error", {
3813
3817
  stage: "empty_llm_response_retry",
3814
3818
  hint: "流正常结束但零 chunk(网关 200+错误体形态),自动重试 1 次"
3815
3819
  }), U(e, t, n, i);
3816
- throw L("error", {
3820
+ throw R("error", {
3817
3821
  stage: "empty_llm_response",
3818
3822
  retried: !0,
3819
3823
  hint: "重试后仍零 chunk,抛 EmptyLLMResponseError 显式报错"
@@ -3839,11 +3843,11 @@ function Vo(e) {
3839
3843
  let n = {
3840
3844
  __pgDataScope: "",
3841
3845
  ...e.callConfig ?? {}
3842
- }, r = Ii(t, D ?? 12e4) ? D ?? 12e4 : 0, i;
3846
+ }, r = Ii(t, O ?? 12e4) ? O ?? 12e4 : 0, i;
3843
3847
  if (r > 0) try {
3844
3848
  i = await Li(Promise.resolve().then(() => t.invoke(e.args, { configurable: n })), r);
3845
3849
  } catch (t) {
3846
- if (t instanceof Pi) return L("error", {
3850
+ if (t instanceof Pi) return R("error", {
3847
3851
  stage: "tool_timeout",
3848
3852
  name: e.name,
3849
3853
  timeoutMs: r,
@@ -3860,8 +3864,8 @@ function Vo(e) {
3860
3864
  files: e.state.files,
3861
3865
  vfsAvailable: !!e.state.files && o,
3862
3866
  toolName: e.name,
3863
- threshold: P,
3864
- passThroughChars: F
3867
+ threshold: F,
3868
+ passThroughChars: I
3865
3869
  }).content, {
3866
3870
  content: a,
3867
3871
  status: "done"
@@ -3880,7 +3884,7 @@ function Vo(e) {
3880
3884
  return Io(e, t);
3881
3885
  }
3882
3886
  function Se(e) {
3883
- return !j && !O ? [] : e.map((e) => {
3887
+ return !M && !k ? [] : e.map((e) => {
3884
3888
  let t = be(e), n = { role: t === "human" ? "user" : t === "ai" ? "assistant" : t }, r = typeof e.content == "string" ? e.content : JSON.stringify(e.content);
3885
3889
  r && (n.content = r.length > Fo ? r.slice(0, Fo) + `…(截断 ${r.length - Fo} 字符)` : r);
3886
3890
  let i = e.tool_calls;
@@ -3907,9 +3911,9 @@ function Vo(e) {
3907
3911
  });
3908
3912
  }
3909
3913
  {
3910
- let e = y(p || "你是一个智能助手。"), t = Math.max(2e3, Math.round(N.contextWindow * he));
3914
+ let e = y(p || "你是一个智能助手。"), t = Math.max(2e3, Math.round(P.contextWindow * he));
3911
3915
  if (e > t) {
3912
- let r = `[page-agent-sdk] systemPrompt 本身(${e} tokens)超过系统段预算(${t} tokens,窗口 ${N.contextWindow} 的 ${he * 100}%);请缩减 systemPrompt 或换更大窗口模型`;
3916
+ let r = `[page-agent-sdk] systemPrompt 本身(${e} tokens)超过系统段预算(${t} tokens,窗口 ${P.contextWindow} 的 ${he * 100}%);请缩减 systemPrompt 或换更大窗口模型`;
3913
3917
  return console.error(r), n({
3914
3918
  type: "error",
3915
3919
  message: r,
@@ -3922,14 +3926,14 @@ function Vo(e) {
3922
3926
  }
3923
3927
  }
3924
3928
  let c = H(s);
3925
- L("context", {
3929
+ R("context", {
3926
3930
  model: pe(),
3927
3931
  tools: z.map((e) => e.name),
3928
3932
  middleware: h.map((e) => e.name)
3929
3933
  });
3930
3934
  let l = To(h, (e) => U(e, n, r)), u = Eo(h, ye), d = {
3931
3935
  rounds: 0,
3932
- maxToolRounds: M,
3936
+ maxToolRounds: N,
3933
3937
  invokeUsage: {
3934
3938
  prompt_tokens: 0,
3935
3939
  completion_tokens: 0,
@@ -3949,15 +3953,15 @@ function Vo(e) {
3949
3953
  }])), v = /* @__PURE__ */ new Map(), b = 0, x = (e) => {
3950
3954
  let t = z.find((t) => t.name === e);
3951
3955
  return t && "writeCapable" in t ? typeof t.writeCapable == "function" || t.writeCapable === !0 : zo.has(e);
3952
- }, S = 0, C = 0, w = Lo(M, _), T = null, E = 0, ee = !1, D = !1;
3956
+ }, S = 0, C = 0, w = Lo(N, _), T = null, E = 0, D = !1, O = !1;
3953
3957
  try {
3954
- for (; (S < M || D) && C < w && (C++, !r?.aborted);) {
3955
- if (ae > 0 && d.invokeUsage.total_tokens > ae) {
3956
- let e = `本轮 token 预算(约 ${ae})已用尽:任务在 ${S} 轮工具调用后中断,已完成的部分均保留。可继续对话,指定下一步(如「继续完成」/「只改 X」/「提高预算重试」)。`;
3957
- return L("error", {
3958
+ for (; (S < N || O) && C < w && (C++, !r?.aborted);) {
3959
+ if (ie > 0 && d.invokeUsage.total_tokens > ie) {
3960
+ let e = `本轮 token 预算(约 ${ie})已用尽:任务在 ${S} 轮工具调用后中断,已完成的部分均保留。可继续对话,指定下一步(如「继续完成」/「只改 X」/「提高预算重试」)。`;
3961
+ return R("error", {
3958
3962
  stage: "round_token_budget_exceeded",
3959
3963
  used: d.invokeUsage.total_tokens,
3960
- budget: ae,
3964
+ budget: ie,
3961
3965
  rounds: S
3962
3966
  }), n({
3963
3967
  type: "error",
@@ -3966,7 +3970,7 @@ function Vo(e) {
3966
3970
  code: "ROUND_TOKEN_BUDGET_EXCEEDED",
3967
3971
  context: {
3968
3972
  used: d.invokeUsage.total_tokens,
3969
- budget: ae
3973
+ budget: ie
3970
3974
  }
3971
3975
  }), n({
3972
3976
  type: "done",
@@ -3979,7 +3983,7 @@ function Vo(e) {
3979
3983
  }), V = xo(h, {
3980
3984
  messages: c,
3981
3985
  state: V
3982
- }), c = ve(c, Ro(S, M, e.hasSubagent)), c = xe(c, Math.round(N.contextWindow * .6)), L("llm_request", {
3986
+ }), c = ve(c, Ro(S, N, e.hasSubagent)), c = xe(c, Math.round(P.contextWindow * .6)), R("llm_request", {
3983
3987
  round: S + 1,
3984
3988
  model: pe(),
3985
3989
  tools: z.map((e) => e.name),
@@ -3990,8 +3994,8 @@ function Vo(e) {
3990
3994
  state: V
3991
3995
  });
3992
3996
  c.push(t.message);
3993
- let a = oe(t.message);
3994
- if (L("llm_response", {
3997
+ let a = ae(t.message);
3998
+ if (R("llm_response", {
3995
3999
  round: S + 1,
3996
4000
  content: t.content,
3997
4001
  toolCalls: t.toolCalls,
@@ -4002,9 +4006,9 @@ function Vo(e) {
4002
4006
  }), t.content;
4003
4007
  if (!t.toolCalls.length) {
4004
4008
  {
4005
- let e = t.message?.response_metadata ?? t.message?.responseMetadata, n = e?.stop_reason ?? e?.finish_reason, r = oe(t.message);
4006
- if ((n === "length" || !t.content && (r?.completion_tokens ?? 0) >= 4e3) && !ee) {
4007
- ee = !0, D = !0, L("error", {
4009
+ let e = t.message?.response_metadata ?? t.message?.responseMetadata, n = e?.stop_reason ?? e?.finish_reason, r = ae(t.message);
4010
+ if ((n === "length" || !t.content && (r?.completion_tokens ?? 0) >= 4e3) && !D) {
4011
+ D = !0, O = !0, R("error", {
4008
4012
  stage: "completion_truncated_retry",
4009
4013
  completionTokens: r?.completion_tokens,
4010
4014
  stopReason: n ?? null,
@@ -4023,21 +4027,21 @@ function Vo(e) {
4023
4027
  name: e.name,
4024
4028
  args: e.args,
4025
4029
  type: "tool_call"
4026
- }))), L("middleware", {
4030
+ }))), R("middleware", {
4027
4031
  stage: "dsml_parsed",
4028
4032
  count: r.length,
4029
4033
  names: r.map((e) => e.name)
4030
4034
  });
4031
4035
  } else {
4032
4036
  if (e && E < 2) {
4033
- E += 1, D = !0, L("middleware", {
4037
+ E += 1, O = !0, R("middleware", {
4034
4038
  stage: "format_retry",
4035
4039
  attempt: E,
4036
4040
  content: t.content.slice(0, 200)
4037
4041
  }), c.push(new i("⚠️ 你刚才把工具调用写成了文本(伪 XML/标签/DSML 标记,如 <|tool_calls|>、<||DSML||>、<invoke name=...>),未被系统识别为工具调用,因此未执行,页面无变化。请直接用标准 function calling(工具调用)格式重新发起工具调用,不要在回复正文里输出这些标签或 JSON 文本。"));
4038
4042
  continue;
4039
4043
  }
4040
- e && (L("error", {
4044
+ e && (R("error", {
4041
4045
  stage: "garbled_exhausted",
4042
4046
  retries: E,
4043
4047
  content: t.content.slice(0, 200)
@@ -4058,11 +4062,11 @@ function Vo(e) {
4058
4062
  turnUsage: f,
4059
4063
  isWriteToolByName: x,
4060
4064
  messages: c,
4061
- sessionWritePaths: de,
4065
+ sessionWritePaths: ue,
4062
4066
  todosStatusAtStart: g
4063
4067
  });
4064
4068
  if (r?.kind === "feedback") {
4065
- D = !0, L("middleware", {
4069
+ O = !0, R("middleware", {
4066
4070
  stage: r.gate.stage,
4067
4071
  attempt: r.gate.attempt,
4068
4072
  ...r.gate.logData ?? {},
@@ -4076,15 +4080,15 @@ function Vo(e) {
4076
4080
  severity: "observable",
4077
4081
  code: r.obs.code,
4078
4082
  context: r.obs.context
4079
- }), !e && ie > 0 && V.verifyAttempts < ie) {
4083
+ }), !e && re > 0 && V.verifyAttempts < re) {
4080
4084
  let e = await wo(h, {
4081
4085
  messages: c,
4082
4086
  state: V,
4083
4087
  response: t,
4084
- log: (e, t) => L(e, t)
4088
+ log: (e, t) => R(e, t)
4085
4089
  });
4086
4090
  if (e) {
4087
- T = t.content, V.verifyAttempts += 1, c.push(new i(`⚠️ 验证未通过,请修正:${e}`)), L("middleware", {
4091
+ T = t.content, V.verifyAttempts += 1, c.push(new i(`⚠️ 验证未通过,请修正:${e}`)), R("middleware", {
4088
4092
  stage: "verify_retry",
4089
4093
  attempt: V.verifyAttempts,
4090
4094
  feedback: e
@@ -4092,7 +4096,7 @@ function Vo(e) {
4092
4096
  continue;
4093
4097
  }
4094
4098
  }
4095
- D = !1;
4099
+ O = !1;
4096
4100
  let a = t.content;
4097
4101
  if (e) {
4098
4102
  let e = Oo(a);
@@ -4104,7 +4108,7 @@ function Vo(e) {
4104
4108
  }), a;
4105
4109
  }
4106
4110
  }
4107
- D = !1;
4111
+ O = !1;
4108
4112
  let s = t.toolCalls, p = s.map((e) => {
4109
4113
  let t = e.id || `call_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
4110
4114
  return {
@@ -4117,7 +4121,7 @@ function Vo(e) {
4117
4121
  state: V,
4118
4122
  signal: r,
4119
4123
  emit: n,
4120
- logSink: R
4124
+ logSink: de
4121
4125
  }
4122
4126
  };
4123
4127
  });
@@ -4129,7 +4133,7 @@ function Vo(e) {
4129
4133
  type: e?.type ?? "tool_call"
4130
4134
  }));
4131
4135
  }
4132
- let _ = await Mi(p, te, async (e) => {
4136
+ let _ = await Mi(p, ee, async (e) => {
4133
4137
  if (r?.aborted) return;
4134
4138
  let t = Date.now();
4135
4139
  n({
@@ -4137,7 +4141,7 @@ function Vo(e) {
4137
4141
  name: e.call.name,
4138
4142
  args: e.call.args,
4139
4143
  id: e.id
4140
- }), L("tool_call", {
4144
+ }), R("tool_call", {
4141
4145
  round: S + 1,
4142
4146
  name: e.call.name,
4143
4147
  args: e.call.args,
@@ -4161,7 +4165,7 @@ function Vo(e) {
4161
4165
  status: i.status,
4162
4166
  durationMs: a,
4163
4167
  id: e.id
4164
- }), L("tool_result", {
4168
+ }), R("tool_result", {
4165
4169
  round: S + 1,
4166
4170
  name: e.call.name,
4167
4171
  result: i.content,
@@ -4197,27 +4201,27 @@ function Vo(e) {
4197
4201
  let t = _[e];
4198
4202
  if (!t) continue;
4199
4203
  let n = p[e].call.name;
4200
- if (f.counts[n] = (f.counts[n] ?? 0) + 1, t.status === "error" && (f.failures += 1), ea(z.find((e) => e.name === n), p[e].call.args, t)) {
4204
+ if (f.counts[n] = (f.counts[n] ?? 0) + 1, t.status === "error" && (f.failures += 1), Ia.test(n) && String(t.content || "").startsWith("ERROR:") && (f.rejectedDelegations = f.rejectedDelegations ?? {}, f.rejectedDelegations[n] = (f.rejectedDelegations[n] ?? 0) + 1), ro(z.find((e) => e.name === n), p[e].call.args, t)) {
4201
4205
  let t = Bo(p[e].call.args);
4202
4206
  f.writePaths.push(t || "(整体)"), y.push({
4203
4207
  name: n,
4204
4208
  args: p[e].call.args,
4205
4209
  callIndex: e
4206
4210
  });
4207
- let r = ja({
4211
+ let r = Aa({
4208
4212
  name: n,
4209
4213
  args: p[e].call.args,
4210
4214
  callIndex: e
4211
4215
  });
4212
- if (r) for (let e of r.paths) de.add(e);
4216
+ if (r) for (let e of r.paths) ue.add(e);
4213
4217
  }
4214
4218
  }
4215
- if (se && y.length) {
4216
- let e = Na(c, y, {
4219
+ if (oe && y.length) {
4220
+ let e = Ma(c, y, {
4217
4221
  round: S + 1,
4218
- maxParallelTools: te
4222
+ maxParallelTools: ee
4219
4223
  });
4220
- e.invalidatedCount > 0 && (c = e.messages, I += e.invalidatedCount, L("middleware", {
4224
+ e.invalidatedCount > 0 && (c = e.messages, L += e.invalidatedCount, R("middleware", {
4221
4225
  stage: "stale_read_invalidated",
4222
4226
  round: S + 1,
4223
4227
  writtenPaths: y.map((e) => Bo(e.args) || "(整体)"),
@@ -4231,32 +4235,32 @@ function Vo(e) {
4231
4235
  type: "done",
4232
4236
  content: ""
4233
4237
  }), "";
4234
- let t = `\n\n(提示:工具调用次数已达上限(${M} 轮 / ${w} 次迭代),以上为基于已完成操作的阶段性结果,任务可能未完成。回复「继续」或告诉我下一步重点,即可接着做。)`;
4235
- L("error", {
4238
+ let t = `\n\n(提示:工具调用次数已达上限(${N} 轮 / ${w} 次迭代),以上为基于已完成操作的阶段性结果,任务可能未完成。回复「继续」或告诉我下一步重点,即可接着做。)`;
4239
+ R("error", {
4236
4240
  stage: "react_call_limit_exceeded",
4237
4241
  rounds: S,
4238
- maxToolRounds: M,
4242
+ maxToolRounds: N,
4239
4243
  iterations: C,
4240
4244
  maxIterations: w
4241
4245
  }), n({
4242
4246
  type: "error",
4243
- message: `ReAct 循环达到调用上限(rounds=${S}/${M},iterations=${C}/${w}),已强制收口,可回复「继续」。`,
4247
+ message: `ReAct 循环达到调用上限(rounds=${S}/${N},iterations=${C}/${w}),已强制收口,可回复「继续」。`,
4244
4248
  severity: "observable",
4245
4249
  code: "REACT_CALL_LIMIT_EXCEEDED",
4246
4250
  context: {
4247
4251
  rounds: S,
4248
- maxToolRounds: M,
4252
+ maxToolRounds: N,
4249
4253
  iterations: C,
4250
4254
  maxIterations: w
4251
4255
  }
4252
4256
  });
4253
- let s = _o(V.todos ?? [], g, de);
4257
+ let s = _o(V.todos ?? [], g, ue);
4254
4258
  if (s.length) {
4255
4259
  let e = s.map((e) => ({
4256
4260
  id: e.id,
4257
4261
  evidence: e.evidence
4258
4262
  }));
4259
- L("middleware", {
4263
+ R("middleware", {
4260
4264
  stage: "evidence_audit_flagged",
4261
4265
  offenders: e
4262
4266
  }), n({
@@ -4277,7 +4281,7 @@ function Vo(e) {
4277
4281
  let p = c[c.length - 1];
4278
4282
  if (p && be(p) === "tool") {
4279
4283
  let e = c[0] && be(c[0]) === "system" ? c.slice(1) : c.slice(), i = [new a(_e() + "\n\n工具调用次数已达上限,请基于已有工具结果直接给出最终回答,不要再调用工具。"), ...e];
4280
- L("llm_request", {
4284
+ R("llm_request", {
4281
4285
  round: "wrap_up",
4282
4286
  model: pe(),
4283
4287
  tools: [],
@@ -4287,7 +4291,7 @@ function Vo(e) {
4287
4291
  messages: i,
4288
4292
  state: V
4289
4293
  });
4290
- if (V = So(h, o, V), L("llm_response", {
4294
+ if (V = So(h, o, V), R("llm_response", {
4291
4295
  round: "wrap_up",
4292
4296
  content: o.content
4293
4297
  }), o.aborted) return n({
@@ -4298,7 +4302,7 @@ function Vo(e) {
4298
4302
  let e = o.content;
4299
4303
  if (Do(e)) {
4300
4304
  let t = Oo(e);
4301
- L("error", {
4305
+ R("error", {
4302
4306
  stage: "garbled_wrapup",
4303
4307
  content: e.slice(0, 200)
4304
4308
  }), n({
@@ -4339,7 +4343,7 @@ function Vo(e) {
4339
4343
  z = [...h.flatMap((e) => e.tools || []), ...e], me();
4340
4344
  }
4341
4345
  function Te(e) {
4342
- fe = e, me(), k?.(e);
4346
+ fe = e, me(), A?.(e);
4343
4347
  }
4344
4348
  return {
4345
4349
  invoke: Ce,
@@ -4348,14 +4352,14 @@ function Vo(e) {
4348
4352
  get allTools() {
4349
4353
  return z;
4350
4354
  },
4351
- getStaleReadsInvalidated: () => I,
4355
+ getStaleReadsInvalidated: () => L,
4352
4356
  resetStaleReadsInvalidated: () => {
4353
- I = 0;
4357
+ L = 0;
4354
4358
  },
4355
4359
  setTools: we,
4356
4360
  setLlm: Te,
4357
- setModelCaps: le,
4358
- debugLogs: ue,
4361
+ setModelCaps: ce,
4362
+ debugLogs: le,
4359
4363
  getEffectiveSystemPrompt: () => _e()
4360
4364
  };
4361
4365
  }
@@ -5450,7 +5454,7 @@ async function xc(e) {
5450
5454
  };
5451
5455
  r = t;
5452
5456
  } else r = e.code;
5453
- let i = await aa(r)(void 0);
5457
+ let i = await ia(r)(void 0);
5454
5458
  return i.ok ? {
5455
5459
  ok: !0,
5456
5460
  text: yc(i.result)
@@ -5775,7 +5779,7 @@ function Kc(e = {}) {
5775
5779
  let e = w();
5776
5780
  if (e.length) {
5777
5781
  let t = e.map((e) => `- ${e.path ? e.path + ": " : ""}${e.description}`).join("\n");
5778
- C.push("\n【当前可操作数据(动态增删后的最新状态,操作前以 describe_data / read 为准)】", t);
5782
+ C.push("\n【当前可操作数据(动态增删后的最新状态,操作前以 read 为准)】", t);
5779
5783
  }
5780
5784
  } catch {}
5781
5785
  let T = {
@@ -5784,16 +5788,16 @@ function Kc(e = {}) {
5784
5788
  timestamp: Date.now()
5785
5789
  }, E = [];
5786
5790
  for (let e of l) E.push(e.userMsg), E.push(...e.assistantMsgs);
5787
- let ee = [T, ...E], D = ee.reduce((e, t) => e + y(typeof t.content == "string" ? t.content : JSON.stringify(t.content)), 0);
5788
- return t.contextWindow && D > t.contextWindow && console.warn(`[page-agent-sdk] compress 后仍超窗口:${D} > ${t.contextWindow} tokens(单条消息超窗口,compress 无法压)`), {
5789
- messages: ee,
5791
+ let D = [T, ...E], O = D.reduce((e, t) => e + y(typeof t.content == "string" ? t.content : JSON.stringify(t.content)), 0);
5792
+ return t.contextWindow && O > t.contextWindow && console.warn(`[page-agent-sdk] compress 后仍超窗口:${O} > ${t.contextWindow} tokens(单条消息超窗口,compress 无法压)`), {
5793
+ messages: D,
5790
5794
  stats: {
5791
5795
  triggered: !0,
5792
5796
  roundsTotal: i.length,
5793
5797
  roundsSummarized: u.length,
5794
5798
  roundsRecalled: b.length,
5795
5799
  originalMessages: a,
5796
- compressedMessages: ee.length,
5800
+ compressedMessages: D.length,
5797
5801
  strategy: _,
5798
5802
  decision: r
5799
5803
  }
@@ -5881,7 +5885,6 @@ function Yc(e) {
5881
5885
  return !!e && typeof e == "object" && typeof e.invoke == "function" && typeof e.stream == "function";
5882
5886
  }
5883
5887
  var Xc = [
5884
- "describe_data",
5885
5888
  "read",
5886
5889
  "query_data",
5887
5890
  "search_data",
@@ -5988,7 +5991,7 @@ async function pl(e, t, n, r, i, a) {
5988
5991
  } : { contextWindow: y.contextWindow }), x = t.onUsage ? {
5989
5992
  name: "sub-usage",
5990
5993
  afterModel: (e) => {
5991
- let n = oe(e.message);
5994
+ let n = ae(e.message);
5992
5995
  n && t.onUsage(n);
5993
5996
  }
5994
5997
  } : void 0;
@@ -6013,7 +6016,7 @@ async function pl(e, t, n, r, i, a) {
6013
6016
  });
6014
6017
  }
6015
6018
  let T;
6016
- !Yc(w) && w.provider === "anthropic" && (T = await te({
6019
+ !Yc(w) && w.provider === "anthropic" && (T = await ee({
6017
6020
  ...w,
6018
6021
  model: e.model ?? w.model
6019
6022
  }, {
@@ -6052,11 +6055,11 @@ async function pl(e, t, n, r, i, a) {
6052
6055
  ...t.staleReadInvalidation === void 0 ? {} : { staleReadInvalidation: t.staleReadInvalidation }
6053
6056
  });
6054
6057
  t.debug && console.log(`[subagent] 启动子 agent(depth=${o},工具 ${u.length} 个)`);
6055
- let ee = new AbortController(), D = () => ee.abort();
6056
- n?.addEventListener("abort", D, { once: !0 });
6057
- let ne = () => {
6058
- n?.removeEventListener("abort", D), t.exitDataScope?.(d);
6059
- }, re = E.stream([{
6058
+ let D = new AbortController(), O = () => D.abort();
6059
+ n?.addEventListener("abort", O, { once: !0 });
6060
+ let te = () => {
6061
+ n?.removeEventListener("abort", O), t.exitDataScope?.(d);
6062
+ }, ne = E.stream([{
6060
6063
  role: "user",
6061
6064
  content: e.prompt,
6062
6065
  timestamp: Date.now()
@@ -6066,24 +6069,24 @@ async function pl(e, t, n, r, i, a) {
6066
6069
  return;
6067
6070
  }
6068
6071
  r && (e.type === "tool_call" || e.type === "tool_result" || e.type === "reasoning") && r(e);
6069
- }, ee.signal);
6070
- re.catch(() => {}).then(() => t.exitDataScope?.(d)), t.onStreamSettled?.(re);
6071
- let ie = t.timeoutMs === void 0 ? $c : t.timeoutMs;
6072
- if (!ie || ie <= 0) try {
6073
- return fl(await re, E.getState());
6072
+ }, D.signal);
6073
+ ne.catch(() => {}).then(() => t.exitDataScope?.(d)), t.onStreamSettled?.(ne);
6074
+ let re = t.timeoutMs === void 0 ? $c : t.timeoutMs;
6075
+ if (!re || re <= 0) try {
6076
+ return fl(await ne, E.getState());
6074
6077
  } finally {
6075
- ne();
6078
+ te();
6076
6079
  }
6077
- let ae, O = new Promise((e, t) => {
6078
- ae = setTimeout(() => {
6079
- ee.abort(), t(/* @__PURE__ */ Error(`子 agent 执行超时(${ie}ms),已中止。可简化子任务或拆更小的子任务重试,或经 subagent.timeoutMs 调整(0=不限制)`));
6080
- }, ie);
6080
+ let ie, k = new Promise((e, t) => {
6081
+ ie = setTimeout(() => {
6082
+ D.abort(), t(/* @__PURE__ */ Error(`子 agent 执行超时(${re}ms),已中止。可简化子任务或拆更小的子任务重试,或经 subagent.timeoutMs 调整(0=不限制)`));
6083
+ }, re);
6081
6084
  });
6082
- re.catch(() => {});
6085
+ ne.catch(() => {});
6083
6086
  try {
6084
- return fl(await Promise.race([re, O]), E.getState());
6087
+ return fl(await Promise.race([ne, k]), E.getState());
6085
6088
  } finally {
6086
- clearTimeout(ae), ne();
6089
+ clearTimeout(ie), te();
6087
6090
  }
6088
6091
  }
6089
6092
  function ml(e) {
@@ -6490,7 +6493,6 @@ var wl = /* @__PURE__ */ new Set([
6490
6493
  "draft_commit",
6491
6494
  "eval_script"
6492
6495
  ]), Tl = /* @__PURE__ */ new Set([
6493
- "describe_data",
6494
6496
  "read",
6495
6497
  "query_data",
6496
6498
  "search_data",
@@ -6914,7 +6916,7 @@ async function nu(e, t, n, r) {
6914
6916
  "你是严格的对抗式审查者,目标是找出以下 AI 助手回复的错误并证明它有问题(事实错误 / 遗漏 / 逻辑矛盾 / 与需求不符)。",
6915
6917
  `用户需求:${i || "(未明确)"}`,
6916
6918
  `助手回复:${a}`,
6917
- o ? "重点检查主数据修改:① jsonPath 是否正确(是否误写不存在的子路径);② 值类型是否符合主数据 schema;③ 语义是否符合字段 description。可用只读工具(read / describe_data 等)读回实际值实证。" : "只报告具体、可验证的问题。",
6919
+ o ? "重点检查主数据修改:① jsonPath 是否正确(是否误写不存在的子路径);② 值类型是否符合主数据 schema;③ 语义是否符合字段 description。可用只读工具(read / schema_data 等)读回实际值实证。" : "只报告具体、可验证的问题。",
6918
6920
  "若确实无问题,只回复\"无问题\"。"
6919
6921
  ].join("\n"), c = "你是严格的对抗式审查者,只找问题不赞美。目标是反驳,不是改进。", l = n ? (e) => n(e.type, {
6920
6922
  ...e.data,
@@ -8044,7 +8046,7 @@ function id(e) {
8044
8046
  code: "SCHEMA_INVALID",
8045
8047
  path: e,
8046
8048
  message: `值不符合 "${e}" 的 schema(${t.length} 处问题)`,
8047
- hint: `用 read({jsonPath:"${e}"}) 查看当前值,按 describe_data() 查看主数据 schema,修正后重试;改大对象优先用 write 的 patch 增量(只发改动部分)${r}`,
8049
+ hint: `用 read({jsonPath:"${e}"}) 查看当前值,按 schema_data() 查看主数据 schema,修正后重试;改大对象优先用 write 的 patch 增量(只发改动部分)${r}`,
8048
8050
  details: oi(t)
8049
8051
  }) : si(e, t);
8050
8052
  }, f = (e) => Z({
@@ -8119,16 +8121,16 @@ function id(e) {
8119
8121
  continue;
8120
8122
  }
8121
8123
  if (i === "append") {
8122
- let e = o[m++]?.elems ?? [], r = Q(n, a);
8123
- if (typeof r == "string" && typeof e[0] == "string") {
8124
- let n = e[0], i = Jo(t, a);
8124
+ let e = o[m++]?.elems ?? [], n = Q(r, a);
8125
+ if (typeof n == "string" && typeof e[0] == "string") {
8126
+ let r = e[0], i = Jo(t, a);
8125
8127
  if (i.kind === "missing") return {
8126
8128
  ok: !1,
8127
8129
  error: f([a]),
8128
8130
  writeBacks: [],
8129
8131
  notices: c
8130
8132
  };
8131
- let o = r + n;
8133
+ let o = n;
8132
8134
  if (i.kind !== "open") {
8133
8135
  let e = i.schemas.map((e) => e.safeParse(o)).find((e) => !e.success);
8134
8136
  if (e) return {
@@ -8141,7 +8143,7 @@ function id(e) {
8141
8143
  p.push({
8142
8144
  op: "appendStr",
8143
8145
  jp: a,
8144
- str: n
8146
+ str: r
8145
8147
  });
8146
8148
  continue;
8147
8149
  }
@@ -8511,18 +8513,21 @@ function od(e) {
8511
8513
  value: f ?? Us(t),
8512
8514
  ...l ? { label: l } : {}
8513
8515
  }); a.length > o;) a.shift();
8514
- for (let e of b.writeBacks) if (e.op === "remove") Hs(t, e.jp);
8515
- else if (e.op === "set") Vs(t, e.jp, e.value);
8516
- else if (e.op === "move") $s(t, e.jp, e.toPath);
8517
- else if (e.op === "mergeKeys") {
8518
- let n = e.jp ? Q(t, e.jp) : t;
8519
- if (n && typeof n == "object" && !Array.isArray(n)) for (let [t, r] of e.entries ?? []) n[t] = r;
8520
- } else if (e.op === "appendElems") {
8521
- let n = e.jp ? Q(t, e.jp) : t;
8522
- Array.isArray(n) && e.elems?.length && n.push(...e.elems);
8523
- } else if (e.op === "appendStr") {
8524
- let n = e.jp ? Q(t, e.jp) : t;
8525
- typeof n == "string" && typeof e.str == "string" && Vs(t, e.jp, n + e.str);
8516
+ let S = new Set(b.writeBacks.filter((e) => e.op === "set").map((e) => e.jp));
8517
+ for (let e of b.writeBacks) if (!((e.op === "appendElems" || e.op === "appendStr") && S.has(e.jp))) {
8518
+ if (e.op === "remove") Hs(t, e.jp);
8519
+ else if (e.op === "set") Vs(t, e.jp, e.value);
8520
+ else if (e.op === "move") $s(t, e.jp, e.toPath);
8521
+ else if (e.op === "mergeKeys") {
8522
+ let n = e.jp ? Q(t, e.jp) : t;
8523
+ if (n && typeof n == "object" && !Array.isArray(n)) for (let [t, r] of e.entries ?? []) n[t] = r;
8524
+ } else if (e.op === "appendElems") {
8525
+ let n = e.jp ? Q(t, e.jp) : t;
8526
+ Array.isArray(n) && e.elems?.length && n.push(...e.elems);
8527
+ } else if (e.op === "appendStr") {
8528
+ let n = e.jp ? Q(t, e.jp) : t;
8529
+ typeof n == "string" && typeof e.str == "string" && Vs(t, e.jp, n + e.str);
8530
+ }
8526
8531
  }
8527
8532
  return e.internalAfterWrite?.(t, f), Wu(d), s?.(), {
8528
8533
  ok: !0,
@@ -8628,7 +8633,7 @@ function gd(e) {
8628
8633
  })(e);
8629
8634
  }
8630
8635
  function _d(e, n = {}) {
8631
- let r = n.pgIdPaths ?? [], i = n.sandboxRunner ?? ya, a = r.length ? (e, t) => {
8636
+ let r = n.pgIdPaths ?? [], i = n.sandboxRunner ?? va, a = r.length ? (e, t) => {
8632
8637
  if (t && typeof t == "object") for (let n of r) {
8633
8638
  let r = Q(t, n), i = Q(e, n);
8634
8639
  if (!Array.isArray(r) || !Array.isArray(i)) continue;
@@ -8683,56 +8688,56 @@ function _d(e, n = {}) {
8683
8688
  }, C = (e) => _.get(e ?? v), w = (e, t) => {
8684
8689
  let n = t ?? v;
8685
8690
  e === void 0 ? _.delete(n) : _.set(n, e);
8686
- }, T = n.conflictWatchFields ?? [], E = !T.includes("*") && T.length ? new Set(T) : void 0, ee = T.length > 0, D = () => E ? Xs(c, E) : Ys(c), te = (n.maxParallelTools ?? 1) > 1 && ee, ne = !1, re = [];
8687
- async function ie() {
8688
- if (!te) return {
8691
+ }, T = n.conflictWatchFields ?? [], E = !T.includes("*") && T.length ? new Set(T) : void 0, D = T.length > 0, O = () => E ? Xs(c, E) : Ys(c), ee = (n.maxParallelTools ?? 1) > 1 && D, te = !1, ne = [];
8692
+ async function re() {
8693
+ if (!ee) return {
8689
8694
  release: () => {},
8690
8695
  reacquire: async () => {}
8691
8696
  };
8692
- ne ? await new Promise((e) => re.push(e)) : ne = !0;
8697
+ te ? await new Promise((e) => ne.push(e)) : te = !0;
8693
8698
  let e = !0;
8694
8699
  return {
8695
8700
  release: () => {
8696
8701
  if (!e) return;
8697
8702
  e = !1;
8698
- let t = re.shift();
8699
- t ? t() : ne = !1;
8703
+ let t = ne.shift();
8704
+ t ? t() : te = !1;
8700
8705
  },
8701
8706
  reacquire: async () => {
8702
- e ||= (ne ? await new Promise((e) => re.push(e)) : ne = !0, !0);
8707
+ e ||= (te ? await new Promise((e) => ne.push(e)) : te = !0, !0);
8703
8708
  }
8704
8709
  };
8705
8710
  }
8706
- (n.maxParallelTools ?? 1) > 1 && !ee && console.warn("[page-agent-sdk] maxParallelTools>1 且未声明 conflictWatchFields:并发写不互锁(后写覆盖前写,既有明文语义);声明 conflictWatchFields 后自动启用写互锁与乐观锁校验");
8707
- let ae = (e) => {
8708
- let t = D();
8711
+ (n.maxParallelTools ?? 1) > 1 && !D && console.warn("[page-agent-sdk] maxParallelTools>1 且未声明 conflictWatchFields:并发写不互锁(后写覆盖前写,既有明文语义);声明 conflictWatchFields 后自动启用写互锁与乐观锁校验");
8712
+ let ie = (e) => {
8713
+ let t = O();
8709
8714
  return w(t, e), t;
8710
- }, oe = n.largeTextThreshold ?? 200, O = (n.largeTextPaths ?? []).map((e) => {
8715
+ }, ae = n.largeTextThreshold ?? 200, k = (n.largeTextPaths ?? []).map((e) => {
8711
8716
  let t = e.lastIndexOf(".");
8712
8717
  return t > 0 ? {
8713
8718
  arrayPath: e.slice(0, t),
8714
8719
  field: e.slice(t + 1)
8715
8720
  } : null;
8716
- }).filter((e) => e !== null), k = !0;
8717
- function A() {
8718
- k = !0;
8721
+ }).filter((e) => e !== null), A = !0;
8722
+ function j() {
8723
+ A = !0;
8719
8724
  }
8720
- let se = {
8725
+ let oe = {
8721
8726
  get: () => ({
8722
8727
  schema: o,
8723
8728
  bind: c,
8724
8729
  description: l
8725
8730
  }),
8726
8731
  set: (e) => {
8727
- o = r.length ? gs(e.schema, r).schema : e.schema, c = e.bind, l = e.description ?? "主数据对象", u = Ho(o), h.length = 0, _.clear(), p(e.resources), f?.clear(), A();
8732
+ o = r.length ? gs(e.schema, r).schema : e.schema, c = e.bind, l = e.description ?? "主数据对象", u = Ho(o), h.length = 0, _.clear(), p(e.resources), f?.clear(), j();
8728
8733
  },
8729
8734
  update: (e) => {
8730
- c = e, h.length = 0, _.clear(), A();
8735
+ c = e, h.length = 0, _.clear(), j();
8731
8736
  },
8732
- markDataDirty: A,
8737
+ markDataDirty: j,
8733
8738
  consumeDataDirty: () => {
8734
- let e = k;
8735
- return k = !1, e;
8739
+ let e = A;
8740
+ return A = !1, e;
8736
8741
  },
8737
8742
  enterScope: (e) => {
8738
8743
  let t = v;
@@ -8744,10 +8749,10 @@ function _d(e, n = {}) {
8744
8749
  _.delete(e);
8745
8750
  },
8746
8751
  recomputeBaseline: (e) => {
8747
- _.set(e ?? "", D());
8752
+ _.set(e ?? "", O());
8748
8753
  },
8749
8754
  recomputeAllBaselines: () => {
8750
- let e = D();
8755
+ let e = O();
8751
8756
  for (let t of _.keys()) _.set(t, e);
8752
8757
  },
8753
8758
  hasBaselines: () => _.size > 0,
@@ -8786,14 +8791,14 @@ function _d(e, n = {}) {
8786
8791
  } : void 0,
8787
8792
  updateResource: f ? (e, t) => {
8788
8793
  let n = zu(e);
8789
- f.update(n, t), Vs(c, n, t), A(), w(D(), "");
8794
+ f.update(n, t), Vs(c, n, t), j(), w(O(), "");
8790
8795
  } : void 0,
8791
8796
  deleteResource: f ? (e) => f.delete(e) : void 0,
8792
8797
  listResources: f ? () => f.list() : void 0
8793
- }, j = (e) => {
8798
+ }, M = (e) => {
8794
8799
  n.onAudit?.(e);
8795
8800
  };
8796
- function M(e, t) {
8801
+ function N(e, t) {
8797
8802
  let n = Us(c), r = h.length ? h[h.length - 1].id + 1 : 1;
8798
8803
  for (h.push({
8799
8804
  id: r,
@@ -8804,9 +8809,9 @@ function _d(e, n = {}) {
8804
8809
  }); h.length > g;) h.shift();
8805
8810
  return r;
8806
8811
  }
8807
- async function N(e, t, r, i) {
8812
+ async function P(e, t, r, i) {
8808
8813
  if (!t || t === "") return null;
8809
- let a = D();
8814
+ let a = O();
8810
8815
  if (a === t) return null;
8811
8816
  if (!n.onConflict) return Z({
8812
8817
  code: "VERSION_CONFLICT",
@@ -8826,11 +8831,11 @@ function _d(e, n = {}) {
8826
8831
  if (o.action === "restore") {
8827
8832
  if (await i?.reacquire(), !h.length) return `无历史快照可回退(本次为首次操作)。当前值:${$(c, 400)} (hash=${a})。请重新 read 再改或选「强制覆盖」。`;
8828
8833
  let e = h[h.length - 1];
8829
- return tc(c, Us(e.value)), A(), w(D()), `已回退主数据到历史快照 #${e.id}[${e.op}]。当前值:${$(c, 400)} (hash=${D()})。请基于回退后的值重写或停止。`;
8834
+ return tc(c, Us(e.value)), j(), w(O()), `已回退主数据到历史快照 #${e.id}[${e.op}]。当前值:${$(c, 400)} (hash=${O()})。请基于回退后的值重写或停止。`;
8830
8835
  }
8831
8836
  await i?.reacquire();
8832
- let s = D();
8833
- return s === a ? (w(D()), null) : (j({
8837
+ let s = O();
8838
+ return s === a ? (w(O()), null) : (M({
8834
8839
  op: "conflict_recheck",
8835
8840
  detail: `裁决基于 ${a} 恢复时 ${s}(ask 窗口新修改落地,overwrite 被拦)`,
8836
8841
  timestamp: Date.now()
@@ -8840,13 +8845,9 @@ function _d(e, n = {}) {
8840
8845
  hint: "重新 read 拿最新值与 hash,基于最新值修改后再写入(单次校验,不再二次挂起)。"
8841
8846
  }));
8842
8847
  }
8843
- let ce = (e, t = !0) => {
8848
+ let se = (e, t = !0) => {
8844
8849
  e.writeCapable = t;
8845
- }, P = s(async () => [`说明: ${l}`, "格式: 写入值需为 JSON,且通过声明的 schema 校验(校验失败时 write 会返回结构化错误,含具体字段与期望类型)。"].join("\n"), {
8846
- name: "describe_data",
8847
- description: "获取主数据的说明与格式要求(等价于 read 不传 jsonPath;优先用 read 单一入口)。",
8848
- schema: t.object({})
8849
- }), F = s(async ({ id: e }, t) => {
8850
+ }, F = s(async ({ id: e }, t) => {
8850
8851
  let n = y(t);
8851
8852
  if (!h.length) return Z({
8852
8853
  code: "NO_SNAPSHOT",
@@ -8860,23 +8861,67 @@ function _d(e, n = {}) {
8860
8861
  hint: "用 history_data({list:true}) 查看可用快照序号"
8861
8862
  });
8862
8863
  let i = o.safeParse(r.value);
8863
- return i.success ? (tc(c, Us(r.value)), A(), j({
8864
- op: "restore",
8865
- detail: `#${r.id}`,
8866
- timestamp: Date.now()
8867
- }), w(D(), n), `已回退主数据到快照 #${r.id}[${r.op}]${r.label ? `(${r.label})` : ""}。`) : Z({
8864
+ if (!i.success) return Z({
8868
8865
  code: "SNAPSHOT_SCHEMA_INVALID",
8869
8866
  message: `快照 #${r.id} 的值不符合当前 schema,无法回退`,
8870
8867
  hint: "schema 可能已变更;该快照已过期,选其他快照或重新设置",
8871
8868
  details: oi(i.error.issues)
8872
8869
  });
8870
+ let a = [];
8871
+ if (m && m.resourcesByPath.size) for (let [e] of m.resourcesByPath) {
8872
+ let t = Q(c, e);
8873
+ Vu(t, Q(r.value, e)) || a.push({
8874
+ p: e,
8875
+ cur: t
8876
+ });
8877
+ }
8878
+ if (!a.length) return tc(c, Us(r.value)), j(), M({
8879
+ op: "restore",
8880
+ detail: `#${r.id}`,
8881
+ timestamp: Date.now()
8882
+ }), w(O(), n), `已回退主数据到快照 #${r.id}[${r.op}]${r.label ? `(${r.label})` : ""}。`;
8883
+ let s = a.map(({ p: e }) => {
8884
+ let t = nd(e), n = t ? Q(c, `${t}.__pgId`) : void 0;
8885
+ return {
8886
+ p: e,
8887
+ parent: t,
8888
+ pgId: typeof n == "string" ? n : void 0
8889
+ };
8890
+ }).map((e) => ({
8891
+ ...e,
8892
+ val: e.p ? Q(c, e.p) : void 0
8893
+ }));
8894
+ tc(c, Us(r.value));
8895
+ let l = [], u = [];
8896
+ for (let e of s) {
8897
+ let t = e.p.slice(e.p.lastIndexOf(".") + 1), n = e.p;
8898
+ if (e.pgId) {
8899
+ let r = nd(e.parent), i = r ? Q(c, r) : c, a = Array.isArray(i) ? i.findIndex((t) => t?.__pgId === e.pgId) : -1;
8900
+ if (a < 0) {
8901
+ u.push(e.p);
8902
+ continue;
8903
+ }
8904
+ n = `${r ? `${r}.${a}` : String(a)}.${t}`;
8905
+ } else if (e.parent && Q(c, e.parent) === void 0) {
8906
+ u.push(e.p);
8907
+ continue;
8908
+ }
8909
+ e.val === void 0 ? u.push(e.p) : Vs(c, n, e.val), l.push(e.p);
8910
+ }
8911
+ j(), M({
8912
+ op: "restore",
8913
+ detail: `#${r.id}(保护字段保留 ${l.length}${u.length ? `,未能回填 ${u.length}` : ""})`,
8914
+ timestamp: Date.now()
8915
+ }), w(O(), n);
8916
+ let d = u.length ? `;⚠ 以下保护字段未能回填当前值(快照窗口内元素已变/已删,保留快照旧值,请由宿主侧核对):${u.join("、")}` : "";
8917
+ return `已回退主数据到快照 #${r.id}[${r.op}]${r.label ? `(${r.label})` : ""}。⚠ 受保护字段保留当前值未回退:${l.join("、")}(freeze/verbatim 由宿主管辖,快照旧值不覆盖;history_data 看到的是快照原值,实际结果以 read 为准)${d}`;
8873
8918
  }, {
8874
8919
  name: "restore_data",
8875
8920
  description: "把主数据回退到某个快照(不传 id 回退最近一次)。快照列表用 history_data({list:true})。",
8876
8921
  schema: t.object({ id: t.number().int().optional().describe("快照序号;不传回退最近一次") })
8877
8922
  });
8878
- ce(F);
8879
- let le = s(async ({ id: e, jsonPath: t, list: n }) => {
8923
+ se(F);
8924
+ let I = s(async ({ id: e, jsonPath: t, list: n }) => {
8880
8925
  if (n) {
8881
8926
  if (!h.length) return "无快照。set/edit/delete 会自动存快照。";
8882
8927
  let e = h.map((e) => {
@@ -8921,7 +8966,7 @@ function _d(e, n = {}) {
8921
8966
  jsonPath: t.string().optional().describe("只看快照的某子路径"),
8922
8967
  list: t.boolean().optional().describe("true 列出快照时间线(序号/操作/标签/时间/大小)")
8923
8968
  })
8924
- }), ue = s(async ({ expr: e, queries: t, limit: n }, r) => {
8969
+ }), ce = s(async ({ expr: e, queries: t, limit: n }, r) => {
8925
8970
  let i = y(r);
8926
8971
  if (typeof c != "object" || !c) return Z({
8927
8972
  code: "NOT_OBJECT",
@@ -8931,7 +8976,7 @@ function _d(e, n = {}) {
8931
8976
  let a = u ? is(c, o) : c, s = b(r), l = (e) => {
8932
8977
  let t;
8933
8978
  try {
8934
- t = ha(a, e);
8979
+ t = ma(a, e);
8935
8980
  } catch (t) {
8936
8981
  return Z({
8937
8982
  code: "JSONPATH_SYNTAX",
@@ -8940,7 +8985,7 @@ function _d(e, n = {}) {
8940
8985
  details: { expr: e }
8941
8986
  });
8942
8987
  }
8943
- let r = n ?? 50, o = t.slice(0, r), c = o.map((e) => `{"path":${JSON.stringify(e.path)},"index":${e.index === void 0 ? "null" : e.index},"value":${$(fd(e.value, i === "", O, oe, {
8988
+ let r = n ?? 50, o = t.slice(0, r), c = o.map((e) => `{"path":${JSON.stringify(e.path)},"index":${e.index === void 0 ? "null" : e.index},"value":${$(fd(e.value, i === "", k, ae, {
8944
8989
  rootExempt: !1,
8945
8990
  rootPath: String(e.path ?? ""),
8946
8991
  fullTextPrefixes: s,
@@ -8964,13 +9009,13 @@ function _d(e, n = {}) {
8964
9009
  queries: t.array(t.string()).min(2).max(10).optional().describe("批量模式:2-10 条 JSONPath 一次取回(与 expr 同传按 queries);逐条独立返回,单条失败该项标 error 不整批"),
8965
9010
  limit: t.number().int().min(1).max(200).optional().describe("返回结果上限(批量时逐条适用),默认 50")
8966
9011
  })
8967
- }), I = s(async ({ query: e, mode: t, fuzzyThreshold: n, matchKey: r, limit: i }) => {
9012
+ }), le = s(async ({ query: e, mode: t, fuzzyThreshold: n, matchKey: r, limit: i }) => {
8968
9013
  if (c == null) return Z({
8969
9014
  code: "EMPTY",
8970
9015
  message: "主数据为空,无可搜索内容"
8971
9016
  });
8972
9017
  try {
8973
- let a = _a(u ? is(c, o) : c, e, {
9018
+ let a = ga(u ? is(c, o) : c, e, {
8974
9019
  mode: t,
8975
9020
  fuzzyThreshold: n,
8976
9021
  matchKey: r,
@@ -9002,7 +9047,7 @@ function _d(e, n = {}) {
9002
9047
  matchKey: t.boolean().optional().describe("是否同时匹配 key 名,默认 true"),
9003
9048
  limit: t.number().int().min(1).max(200).optional().describe("返回上限,默认 50")
9004
9049
  })
9005
- }), de = s(async ({ script: e, mode: t, jsonPath: n }, r) => {
9050
+ }), L = s(async ({ script: e, mode: t, jsonPath: n }, r) => {
9006
9051
  let s = y(r);
9007
9052
  if (e.length > 8e3) return Z({
9008
9053
  code: "SCRIPT_TOO_LARGE",
@@ -9043,9 +9088,11 @@ function _d(e, n = {}) {
9043
9088
  details: { scriptLen: e.length }
9044
9089
  });
9045
9090
  if (l) {
9046
- let e = await ie();
9091
+ let e = await re();
9047
9092
  try {
9048
- let e = od({
9093
+ let n = await P("edit", D ? C(s) : void 0, void 0, e);
9094
+ if (n !== null) return n;
9095
+ let r = od({
9049
9096
  bindRef: c,
9050
9097
  patches: [{
9051
9098
  op: "set",
@@ -9056,17 +9103,17 @@ function _d(e, n = {}) {
9056
9103
  allowKeys: u,
9057
9104
  snapshots: h,
9058
9105
  maxSnapshots: g,
9059
- markDataDirty: A,
9106
+ markDataDirty: j,
9060
9107
  schemaErrorMode: "schema_invalid",
9061
9108
  snapshotLabel: "eval_transform_subtree",
9062
9109
  internalAfterWrite: a,
9063
9110
  protectedCtx: m
9064
9111
  });
9065
- return e.ok ? (j({
9112
+ return r.ok ? (M({
9066
9113
  op: "edit",
9067
9114
  detail: `eval_transform_subtree @ ${l}`,
9068
9115
  timestamp: Date.now()
9069
- }), w(D(), s), `已通过脚本 transform 子树 @ ${l} 更新(耗时 ${_.elapsedMs}ms)。当前值: ${$(c, 600)}`) : e.error;
9116
+ }), w(O(), s), `已通过脚本 transform 子树 @ ${l} 更新(耗时 ${_.elapsedMs}ms)。当前值: ${$(c, 600)}`) : r.error;
9070
9117
  } finally {
9071
9118
  e.release();
9072
9119
  }
@@ -9077,26 +9124,28 @@ function _d(e, n = {}) {
9077
9124
  message: `主数据 bind 为原始类型(${c === null ? "null" : typeof c}),eval transform(patches) 无法就地替换`,
9078
9125
  hint: "主数据 bind 必须为对象/数组;叶子值请用对象包裹或集成方通过 sdk.setData 替换 bind"
9079
9126
  });
9080
- let e = await ie();
9127
+ let e = await re();
9081
9128
  try {
9082
- let e = od({
9129
+ let n = await P("edit", D ? C(s) : void 0, void 0, e);
9130
+ if (n !== null) return n;
9131
+ let r = od({
9083
9132
  bindRef: c,
9084
9133
  patches: t.patches,
9085
9134
  schema: o,
9086
9135
  allowKeys: u,
9087
9136
  snapshots: h,
9088
9137
  maxSnapshots: g,
9089
- markDataDirty: A,
9138
+ markDataDirty: j,
9090
9139
  schemaErrorMode: "schema_invalid",
9091
9140
  snapshotLabel: "eval_transform",
9092
9141
  internalAfterWrite: a,
9093
9142
  protectedCtx: m
9094
9143
  });
9095
- return e.ok ? (j({
9144
+ return r.ok ? (M({
9096
9145
  op: "edit",
9097
- detail: `eval_transform(${e.applied.length} patches)`,
9146
+ detail: `eval_transform(${r.applied.length} patches)`,
9098
9147
  timestamp: Date.now()
9099
- }), w(D(), s), `已通过脚本 transform(patches) 更新主数据(${e.applied.length} 个 patch,耗时 ${_.elapsedMs}ms)。当前值: ${$(c, 600)}`) : e.error;
9148
+ }), w(O(), s), `已通过脚本 transform(patches) 更新主数据(${r.applied.length} 个 patch,耗时 ${_.elapsedMs}ms)。当前值: ${$(c, 600)}`) : r.error;
9100
9149
  } finally {
9101
9150
  e.release();
9102
9151
  }
@@ -9116,23 +9165,25 @@ function _d(e, n = {}) {
9116
9165
  message: `主数据 bind 为原始类型(${c === null ? "null" : typeof c}),eval transform 无法就地替换外部持有的值引用`,
9117
9166
  hint: "主数据 bind 必须为对象/数组;叶子值请用对象包裹或集成方通过 sdk.setData 替换 bind"
9118
9167
  });
9119
- let i = a ? Us(c) : null, d = await ie();
9168
+ let i = a ? Us(c) : null, d = await re();
9120
9169
  try {
9121
- let e = rd({
9170
+ let e = await P("set", D ? C(s) : void 0, n, d);
9171
+ if (e !== null) return e;
9172
+ let t = rd({
9122
9173
  schema: o,
9123
9174
  allowKeys: u,
9124
9175
  value: n,
9125
9176
  bindRef: c
9126
9177
  });
9127
- return e.ok ? (M("edit", "eval_transform"), e.wholeParsed ? nc(c, e.assembly) : e.assembly !== null && typeof e.assembly == "object" && Bs(c, e.assembly), A(), a && (a(c, i), A()), j({
9178
+ return t.ok ? (N("edit", "eval_transform"), t.wholeParsed ? nc(c, t.assembly) : t.assembly !== null && typeof t.assembly == "object" && Bs(c, t.assembly), j(), a && (a(c, i), j()), M({
9128
9179
  op: "edit",
9129
9180
  detail: "eval_transform",
9130
9181
  timestamp: Date.now()
9131
- }), w(D(), s), `已通过脚本 transform 更新主数据(耗时 ${_.elapsedMs}ms)。当前值: ${$(c, 600)}`) : Z({
9182
+ }), w(O(), s), `已通过脚本 transform 更新主数据(耗时 ${_.elapsedMs}ms)。当前值: ${$(c, 600)}`) : Z({
9132
9183
  code: "SCHEMA_INVALID",
9133
9184
  message: "脚本返回值校验失败,未写入(transform 模式要求返回主数据的完整新值或顶层 key 子集)",
9134
- hint: "确认脚本 return 了完整新值(非部分);或返回 {patches:[...]} 走增量模式;按 describe_data() 查看格式",
9135
- details: (e.error.match(/"details":\s*(\[[^\]]*\])/)?.[1] ?? "") || e.error
9185
+ hint: "确认脚本 return 了完整新值(非部分);或返回 {patches:[...]} 走增量模式;按 schema_data() 查看格式",
9186
+ details: (t.error.match(/"details":\s*(\[[^\]]*\])/)?.[1] ?? "") || t.error
9136
9187
  });
9137
9188
  } finally {
9138
9189
  d.release();
@@ -9152,9 +9203,9 @@ function _d(e, n = {}) {
9152
9203
  jsonPath: t.string().optional().describe("子树模式:仅对该子树执行;transform 返回值作为子树新值")
9153
9204
  })
9154
9205
  });
9155
- ce(de, (e) => e?.mode === "transform");
9156
- let L = s(async ({ jsonPath: e, jsonPaths: t, fields: n, depth: r, offset: i, limit: a }, s) => {
9157
- let d = y(s), f = b(s), p = D();
9206
+ se(L, (e) => e?.mode === "transform");
9207
+ let ue = s(async ({ jsonPath: e, jsonPaths: t, fields: n, depth: r, offset: i, limit: a }, s) => {
9208
+ let d = y(s), f = b(s), p = O();
9158
9209
  if (t && t.length) {
9159
9210
  let e = !1, i = t.map((t) => {
9160
9211
  let i = t || "";
@@ -9172,7 +9223,7 @@ function _d(e, n = {}) {
9172
9223
  resolved: s,
9173
9224
  resourcesByPath: m.resourcesByPath,
9174
9225
  resourceStore: m.resourceStore
9175
- })), n && n.length && (s = Ks(s, n)), r != null && (s = qs(s, r)), s = fd(s, d === "", O, oe, {
9226
+ })), n && n.length && (s = Ks(s, n)), r != null && (s = qs(s, r)), s = fd(s, d === "", k, ae, {
9176
9227
  rootExempt: !0,
9177
9228
  rootPath: i,
9178
9229
  fullTextPrefixes: f,
@@ -9220,7 +9271,7 @@ function _d(e, n = {}) {
9220
9271
  resolved: v,
9221
9272
  resourcesByPath: m.resourcesByPath,
9222
9273
  resourceStore: m.resourceStore
9223
- })), w(p, d), n && n.length && (v = Ks(v, n)), r != null && (v = qs(v, r)), v = fd(v, d === "", O, oe, {
9274
+ })), w(p, d), n && n.length && (v = Ks(v, n)), r != null && (v = qs(v, r)), v = fd(v, d === "", k, ae, {
9224
9275
  rootExempt: !0,
9225
9276
  rootPath: h,
9226
9277
  fullTextPrefixes: f,
@@ -9246,11 +9297,11 @@ function _d(e, n = {}) {
9246
9297
  }), R = s(async ({ value: e, patch: t, patches: n, del: i, dryRun: s }, l) => {
9247
9298
  let d = y(l), f = "set";
9248
9299
  i ? f = "delete" : (n && n.length || t) && (f = "edit");
9249
- let p = t?.value === void 0 ? e : t.value, _ = await ie();
9300
+ let p = t?.value === void 0 ? e : t.value, _ = await re();
9250
9301
  try {
9251
- let e = ee ? C(d) : void 0;
9302
+ let e = D ? C(d) : void 0;
9252
9303
  if (s && e !== void 0) {
9253
- let t = D();
9304
+ let t = O();
9254
9305
  if (t !== e) return Z({
9255
9306
  code: "VERSION_CONFLICT",
9256
9307
  message: `dryRun 预检发现乐观锁冲突: expectedHash=${e} 当前 hash=${t}(主数据在你 read 后被改)`,
@@ -9281,19 +9332,19 @@ function _d(e, n = {}) {
9281
9332
  hint: e.spec.mode === "freeze" ? "冻结字段不可删" : "verbatim 字段不可直接删;先 resource_delete 释放"
9282
9333
  });
9283
9334
  }
9284
- let n = await N("delete", e, void 0, _);
9335
+ let n = await P("delete", e, void 0, _);
9285
9336
  if (n !== null) return n;
9286
9337
  if (s) {
9287
9338
  let e = Us(c);
9288
9339
  return Hs(e, t.jsonPath) ? `dryRun(delete): 将删除 @ ${t.jsonPath}。预览剩余:${$(e, 600)}。未实际写入、未入快照。` : `dryRun(delete): @ ${t.jsonPath} 不存在(无需删除)。未实际写入。`;
9289
9340
  }
9290
- M("delete");
9341
+ N("delete");
9291
9342
  let r = Hs(c, t.jsonPath);
9292
- return A(), j({
9343
+ return j(), M({
9293
9344
  op: "delete",
9294
9345
  detail: t.jsonPath,
9295
9346
  timestamp: Date.now()
9296
- }), a && (a(c, null), A()), w(D(), d), r ? `已删除主数据 @ ${t.jsonPath}` : `主数据 @ ${t.jsonPath} 不存在(无需删除)`;
9347
+ }), a && (a(c, null), j()), w(O(), d), r ? `已删除主数据 @ ${t.jsonPath}` : `主数据 @ ${t.jsonPath} 不存在(无需删除)`;
9297
9348
  }
9298
9349
  if (f === "edit") {
9299
9350
  if (typeof c != "object" || !c) return Z({
@@ -9301,7 +9352,7 @@ function _d(e, n = {}) {
9301
9352
  message: `edit 仅适用于对象/数组主数据,当前是 ${c === void 0 ? "undefined" : typeof c}`,
9302
9353
  hint: "叶子用 write(value) 整体设置"
9303
9354
  });
9304
- let r = await N("edit", e, void 0, _);
9355
+ let r = await P("edit", e, void 0, _);
9305
9356
  if (r !== null) return r;
9306
9357
  let i = n && n.length ? n : [{
9307
9358
  op: t.op ?? "set",
@@ -9314,7 +9365,7 @@ function _d(e, n = {}) {
9314
9365
  allowKeys: u,
9315
9366
  snapshots: h,
9316
9367
  maxSnapshots: g,
9317
- markDataDirty: A,
9368
+ markDataDirty: j,
9318
9369
  schemaErrorMode: "zod",
9319
9370
  dryRun: s,
9320
9371
  internalAfterWrite: a,
@@ -9322,18 +9373,18 @@ function _d(e, n = {}) {
9322
9373
  });
9323
9374
  if (!l.ok) return l.error;
9324
9375
  if (s) return `dryRun(edit): ${l.applied.length} 个 patch 预检通过(schema 校验 OK)。预览结果:${$(l.clone, 600)}。未实际写入、未入快照。`;
9325
- j({
9376
+ M({
9326
9377
  op: "edit",
9327
9378
  detail: `${l.applied.length} 个 patch${l.applied.length > 1 ? "(批量)" : ""}`,
9328
9379
  value: l.applied.map((e) => `${e.op}@${e.jp}`),
9329
9380
  timestamp: Date.now()
9330
9381
  });
9331
- let f = ae(d);
9382
+ let f = ie(d);
9332
9383
  return gd(l.clone), `已 write(edit) 主数据(${l.applied.length} 个 patch)。当前值:${$(l.clone, 600)} (新 hash=${f})`;
9333
9384
  }
9334
9385
  let i = Gs(p);
9335
9386
  if (i.parseError) return ci("", p, i.parseError);
9336
- let l = await N("set", e, p, _);
9387
+ let l = await P("set", e, p, _);
9337
9388
  if (l !== null) return l;
9338
9389
  let v = ad({
9339
9390
  bindRef: c,
@@ -9342,16 +9393,16 @@ function _d(e, n = {}) {
9342
9393
  allowKeys: u,
9343
9394
  snapshots: h,
9344
9395
  maxSnapshots: g,
9345
- audit: j,
9396
+ audit: M,
9346
9397
  dryRun: s,
9347
- onWrite: A,
9398
+ onWrite: j,
9348
9399
  internalAfterWrite: a,
9349
9400
  protectedCtx: m,
9350
- hashFn: D
9401
+ hashFn: O
9351
9402
  });
9352
9403
  if (!v.ok) return v.error;
9353
9404
  if (s) return `dryRun(set): schema 校验通过。预览新值:${$(v.data, 600)}。未实际写入、未入快照。`;
9354
- let y = v.hash ?? D();
9405
+ let y = v.hash ?? O();
9355
9406
  w(y, d);
9356
9407
  let b = r.length ? Us(v.data) : v.data;
9357
9408
  return gd(b), `已 write(set) 主数据 = ${$(b, 600)} (新 hash=${y})${u ? "(白名单模式:仅更新 schema 声明字段,未声明字段保留)" : ""}`;
@@ -9389,8 +9440,8 @@ function _d(e, n = {}) {
9389
9440
  dryRun: t.boolean().optional().describe("预检:走完整校验链但不落盘不入快照;冲突返回 VERSION_CONFLICT 不挂起")
9390
9441
  })
9391
9442
  });
9392
- ce(R);
9393
- let z = s(async ({ jsonPath: e }) => {
9443
+ se(R);
9444
+ let de = s(async ({ jsonPath: e }) => {
9394
9445
  let t = e || "", n = t ? Go(o, t) : o;
9395
9446
  return n ? `schema${t ? ` @ ${t}` : ""} = ${$(ds(n))}` : Z({
9396
9447
  code: "PATH_DENIED",
@@ -9401,7 +9452,7 @@ function _d(e, n = {}) {
9401
9452
  name: "schema_data",
9402
9453
  description: "查看主数据(或子路径)的字段约束:类型/min/max/enum/必填/默认值/嵌套 shape。写前查约束,避免写错重试。不传 jsonPath 查根;传子路径(如 components.0)查该位置约束。",
9403
9454
  schema: t.object({ jsonPath: t.string().optional().describe("要查约束的子路径;不传查根 schema") })
9404
- }), fe = s(async ({ snapshotId: e, against: t }) => {
9455
+ }), z = s(async ({ snapshotId: e, against: t }) => {
9405
9456
  let n = t != null, r, i;
9406
9457
  if (n) {
9407
9458
  let e = t;
@@ -9433,7 +9484,7 @@ function _d(e, n = {}) {
9433
9484
  snapshotId: t.number().int().optional().describe("对比的快照序号;不传则最近一次"),
9434
9485
  against: t.unknown().optional().describe("对比的一段 JSON 值(与 snapshotId 互斥;传则忽略快照)")
9435
9486
  })
9436
- }), B = [];
9487
+ }), fe = [];
9437
9488
  if (n.vfsStore) {
9438
9489
  let e = n.vfsStore, r = (e) => `drafts/${e}.json`, i = s(({ draftId: t, chunk: n, mode: i }) => {
9439
9490
  let a = r(t), o = e.files[a], s = i === "append" && o, c = s ? o.content + n : n;
@@ -9474,9 +9525,9 @@ function _d(e, n = {}) {
9474
9525
  }
9475
9526
  });
9476
9527
  }
9477
- let f = await ie();
9528
+ let f = await re();
9478
9529
  try {
9479
- let n = await N("set", ee ? C(i) : void 0, d, f);
9530
+ let n = await P("set", D ? C(i) : void 0, d, f);
9480
9531
  if (n !== null) return n;
9481
9532
  let r = ad({
9482
9533
  bindRef: c,
@@ -9485,12 +9536,12 @@ function _d(e, n = {}) {
9485
9536
  allowKeys: u,
9486
9537
  snapshots: h,
9487
9538
  maxSnapshots: g,
9488
- audit: j,
9539
+ audit: M,
9489
9540
  op: "draft_commit",
9490
- onWrite: A,
9541
+ onWrite: j,
9491
9542
  internalAfterWrite: a,
9492
9543
  protectedCtx: m,
9493
- hashFn: D
9544
+ hashFn: O
9494
9545
  });
9495
9546
  return r.ok ? (w(r.hash, i), delete e.files[s], `已 draft_commit 草稿 "${t}" → 主数据 = ${$(r.data, 600)} (新 hash=${r.hash})${u ? "(白名单模式:仅更新 schema 声明字段)" : ""}。草稿已清理。`) : r.error;
9496
9547
  } finally {
@@ -9501,9 +9552,9 @@ function _d(e, n = {}) {
9501
9552
  description: "把 draft_write 累积的草稿合并 + JSON.parse + 乐观锁 + schema 校验,原子提交主数据(任一步失败不写,草稿保留可修后重试;成功清草稿 + 自动快照可回退)。仅大 JSON 从零生成用;小改用 write。",
9502
9553
  schema: t.object({ draftId: t.string().describe("要提交的草稿标识(对应 draft_write 的 draftId)") })
9503
9554
  });
9504
- ce(l), B.push(i, l);
9555
+ se(l), fe.push(i, l);
9505
9556
  }
9506
- let pe = [];
9557
+ let B = [];
9507
9558
  if (e.resources?.length && f) {
9508
9559
  let e = s(async ({ path: e, handle: t }) => {
9509
9560
  let n = e;
@@ -9573,7 +9624,7 @@ function _d(e, n = {}) {
9573
9624
  details: oi(n.error.issues)
9574
9625
  });
9575
9626
  }
9576
- f.update(i, t), Vs(c, i, t), w(D(), r), A();
9627
+ f.update(i, t), Vs(c, i, t), w(O(), r), j();
9577
9628
  let l = f.get(i)?.handle;
9578
9629
  return `已更新 verbatim 资源 "${e}" = ${$(t, 200)}(handle ${l ?? "(未知)"} 不变)。后续 write 该字段写回句柄 ⟦res:${l}⟧ 或新值`;
9579
9630
  }, {
@@ -9584,7 +9635,7 @@ function _d(e, n = {}) {
9584
9635
  value: t.unknown().describe("新值(需符合字段 schema 类型)")
9585
9636
  })
9586
9637
  });
9587
- ce(n);
9638
+ se(n);
9588
9639
  let r = s(async () => {
9589
9640
  let e = f.list();
9590
9641
  if (!e.length) {
@@ -9615,34 +9666,33 @@ function _d(e, n = {}) {
9615
9666
  handle: t.string().optional().describe("占位符句柄(与 path 二选一)")
9616
9667
  })
9617
9668
  });
9618
- ce(i), pe.push(e, n, r, i);
9669
+ se(i), B.push(e, n, r, i);
9619
9670
  }
9620
- let me = [
9621
- P,
9671
+ let pe = [
9622
9672
  F,
9623
- le,
9624
- ue,
9625
9673
  I,
9626
- de,
9674
+ ce,
9675
+ le,
9627
9676
  L,
9677
+ ue,
9628
9678
  R,
9679
+ de,
9629
9680
  z,
9630
- fe,
9631
- ...B,
9632
- ...pe
9681
+ ...fe,
9682
+ ...B
9633
9683
  ];
9634
- Object.defineProperty(me, "controller", {
9635
- value: se,
9684
+ Object.defineProperty(pe, "controller", {
9685
+ value: oe,
9636
9686
  enumerable: !1,
9637
9687
  configurable: !1,
9638
9688
  writable: !1
9639
9689
  });
9640
- for (let e of me) Object.defineProperty(e, "__dataOpsScoped", {
9690
+ for (let e of pe) Object.defineProperty(e, "__dataOpsScoped", {
9641
9691
  value: !0,
9642
9692
  enumerable: !1,
9643
9693
  configurable: !1
9644
9694
  });
9645
- return me;
9695
+ return pe;
9646
9696
  }
9647
9697
  //#endregion
9648
9698
  //#region src/core/tools/htmlValidate.ts
@@ -10777,7 +10827,7 @@ function vf(e, t, n) {
10777
10827
 
10778
10828
  两条工作路径:
10779
10829
  - **修改已有组件**(改颜色/文案/布局等):必经 vfs —— 上下文有「组件代码文件地图」(name → vfs 路径),按 name 找到对应文件直接 vfs_edit 增量改目标片段 → validate_code 自检;框架自动回写 data.${t}。勿直接 write data.${t} 改已有组件(绕过 vfs/verify,且无增量友好);文件未检出时先 vfs_write 创建
10780
- - **新建组件**:write({ patch:{ op:'set', jsonPath:'${n}.N', value:{...} } }) —— value 按 data schema **全字段写**(含全部必填字段 —— 字段名以样本为准照抄,如类型/名称,外加 ${t} 代码正文;缺必填字段会被 schema 拒)。调研**只看一个样本**:read({jsonPath:'${n}', offset:0, limit:1}) 取首个元素照抄字段名即可(**禁止分页逐个翻完整数组**,大数组翻页纯烧轮次;也不要 describe_data/schema_data 反复查);N = 数组长度(追加到末尾,read 返回的 total/length 即是)。框架自动补 __pgId。**固定流程**:直接 write data → validate_code({jsonPath:'${n}.N.${t}'}) 自检(从 data 读刚写的代码,零重传 content)→ read 确认;**不必手动 vfs_write 建工作副本**(框架下次委派自动 checkout;仅当本次委派内还要继续精修它,才 vfs_write 建副本再 vfs_edit)。**校验方式**:新建组件用 jsonPath(零重传)/ 修改组件用 path(vfs 文件)/ content 仅兜底;**禁止在思考里权衡「content 太长 / 要不要重传 / 先 vfs_write 再 by path」**,选对应方式一次校验即收口(为之纠结反费更多 token,真实复盘子 agent 曾在此循环 10+ 回合致整页超时)。**${t} 字段直接写完整代码字符串,换行/引号照常写,无需手工 JSON 转义**
10830
+ - **新建组件**:write({ patch:{ op:'set', jsonPath:'${n}.N', value:{...} } }) —— value 按 data schema **全字段写**(含全部必填字段 —— 字段名以样本为准照抄,如类型/名称,外加 ${t} 代码正文;缺必填字段会被 schema 拒)。调研**只看一个样本**:read({jsonPath:'${n}', offset:0, limit:1}) 取首个元素照抄字段名即可(**禁止分页逐个翻完整数组**,大数组翻页纯烧轮次;也不要 schema_data 反复查);N = 数组长度(追加到末尾,read 返回的 total/length 即是)。框架自动补 __pgId。**固定流程**:直接 write data → validate_code({jsonPath:'${n}.N.${t}'}) 自检(从 data 读刚写的代码,零重传 content)→ read 确认;**不必手动 vfs_write 建工作副本**(框架下次委派自动 checkout;仅当本次委派内还要继续精修它,才 vfs_write 建副本再 vfs_edit)。**校验方式**:新建组件用 jsonPath(零重传)/ 修改组件用 path(vfs 文件)/ content 仅兜底;**禁止在思考里权衡「content 太长 / 要不要重传 / 先 vfs_write 再 by path」**,选对应方式一次校验即收口(为之纠结反费更多 token,真实复盘子 agent 曾在此循环 10+ 回合致整页超时)。**${t} 字段直接写完整代码字符串,换行/引号照常写,无需手工 JSON 转义**
10781
10831
 
10782
10832
  焦点精修(若继承到主 agent 焦点):
10783
10833
  - 上下文若提示「当前精修目标」(如 ${n}.2),说明主 agent 聚焦了某组件 → 你**只能改该焦点组件**的代码文件(vfs 文件 ${e}<焦点组件 __pgId>.${r});改其他组件的代码文件会被 PATH_DENIED 硬拦
@@ -11065,7 +11115,7 @@ function Af(e) {
11065
11115
  function jf(e) {
11066
11116
  if (!e) return e;
11067
11117
  let t = e;
11068
- return t.__pgAnthropicShaped || t._llmType?.() !== "chat-anthropic" ? e : (t.__pgAnthropicShaped = !0, D(e));
11118
+ return t.__pgAnthropicShaped || t._llmType?.() !== "chat-anthropic" ? e : (t.__pgAnthropicShaped = !0, O(e));
11069
11119
  }
11070
11120
  function Mf(e) {
11071
11121
  return !!e && typeof e == "object" && typeof e.invoke == "function" && typeof e.stream == "function";
@@ -11086,7 +11136,7 @@ function Pf(e) {
11086
11136
  return async (e) => {
11087
11137
  let t = new AbortController(), s = setTimeout(() => t.abort(), o);
11088
11138
  try {
11089
- return !l && c && (l = await te(c, {
11139
+ return !l && c && (l = await ee(c, {
11090
11140
  temperature: n,
11091
11141
  maxTokens: r,
11092
11142
  thinkingFallback: "simple"
@@ -11105,7 +11155,7 @@ function Ff(e) {
11105
11155
  return async (t) => {
11106
11156
  let n = t.filter((e) => e.role === "user" || e.role === "assistant").map((e) => `${e.role === "user" ? "用户" : "助手"}: ${e.content}`).join("\n").slice(0, 800), s = new AbortController(), c = setTimeout(() => s.abort(), 1e4);
11107
11157
  try {
11108
- !o && r && (o = await te(r, {
11158
+ !o && r && (o = await ee(r, {
11109
11159
  temperature: 0,
11110
11160
  maxTokens: 30,
11111
11161
  thinkingFallback: "simple"
@@ -11171,7 +11221,7 @@ function Bf(e) {
11171
11221
  return async (e) => {
11172
11222
  let t = new AbortController(), n = setTimeout(() => t.abort(), o);
11173
11223
  try {
11174
- !c && r && (c = await te(r, {
11224
+ !c && r && (c = await ee(r, {
11175
11225
  temperature: 0,
11176
11226
  maxTokens: s,
11177
11227
  thinkingFallback: "simple"
@@ -11841,11 +11891,11 @@ var Sp = {
11841
11891
  enableLLMSummary: !0
11842
11892
  }
11843
11893
  }, Cp = {
11844
- auto: ["describe_data", "read"],
11845
- conservative: ["describe_data"],
11846
- aggressive: ["describe_data", "read"],
11894
+ auto: ["schema_data", "read"],
11895
+ conservative: ["schema_data"],
11896
+ aggressive: ["schema_data", "read"],
11847
11897
  complex: [
11848
- "describe_data",
11898
+ "schema_data",
11849
11899
  "read",
11850
11900
  "query_data",
11851
11901
  "search_data"
@@ -12388,7 +12438,7 @@ function um(e, t, n) {
12388
12438
  name: "usageHints",
12389
12439
  augmentPrompt: (i) => {
12390
12440
  let a = [];
12391
- if (r.planning && (a.push("【自适应规划】按任务复杂度决定是否先规划,不要对简单任务过度编排:"), a.push(" · 简单/明确任务(改单字段、调样式、查值)→ 直接 read/write 执行,不必 write_todos。"), a.push(" · 复杂任务(多步、大改、有歧义、不可逆)→ 先 write_todos 拆解,首个任务标 in_progress,逐项推进。"), a.push(" · 执行中发现步骤要改/补/细分 → 用 update_todo({id, content?, status?}) 按 id 增量改单项,不必重传整个清单。"), a.push(" · update_todo 标 completed 时附 evidence: 本次实际写入的 jsonPath(如 \"components.2\"),供收口对账;工作经委派子 agent 完成等无主写路径时,如实写明完成方式(勿编造路径)。"), e?.humanConfirm ? a.push(" · 规划出多步方案若需用户拍板 → 先 request_human_confirmation 给方案选项,确认后再执行。") : a.push(" · 规划出多步方案若需用户拍板 → 以文字列出方案选项等用户回复,勿自行拍板。"), a.push(" · 计划修订有次数上限(maxPlanRevisions,默认 5,只计 write_todos 调用、调研轮不计):勿反复改计划而不执行,规划充分后即开始 write 落地。")), t && (a.push("改主数据前先 read({jsonPath}) 读其当前真实值(返回末尾 hash=xxx 为乐观锁标识),基于真实值改,不要凭记忆。写入是否被自动校验由集成方 conflictWatchFields 声明决定:若已声明且主数据在你 read 之后被外部改过,会触发冲突——集成方若开启人工介入,工具会挂起等用户决定(保留外部/强制覆盖/回退),你应等待工具返回后按结果继续(保留外部→重新 read 再改;强制覆盖→已写入,继续;回退→已回退到历史快照,基于回退值重写);未开启人工介入时返回 VERSION_CONFLICT 不写入,重新 read 拿最新值再改。"), a.push("读类分流:取值/结构 → read(多路径用 jsonPaths);字段约束 → schema_data;条件筛选定位 → query_data(多条一次用 queries);名字模糊找 → search_data;整体说明 → read 不传路径(= describe_data)。"), a.push("修改大对象/数组优先用 write 增量改({patch:{op,jsonPath,value}} 只发改动部分),避免 write({value}) 整体重传被 max_tokens 截断导致 JSON 不完整、校验失败。"), a.push("修改主数据出错时可用 restore_data 回退最近一次。"), a.push("在大数组里按条件筛选元素用 query_data(JSONPath,如 $.components[?(@.type==\"card\" && @.price<100)]),返回匹配元素的 path/index;定位后再 write({patch}) 改。"), a.push("找名字记不清的元素用 search_data(支持 substring/regex/fuzzy 模糊搜索)。"), a.push("需要过滤/映射/聚合/批量重写大数组时用 eval_script(沙箱脚本,入参 data);只读探查用 mode=query,批量重写用 mode=transform(返回值经校验后落地)。"), a.push("读大数组用 read({jsonPath,offset,limit}) 分页(返回 hasMore=true 时 offset+=limit 续读);一次读多个不相关子路径用 read({jsonPaths});复杂改动先 write({...,dryRun:true}) 预检不落盘。"), a.push("【省轮次·批量】≥2 个路径一律 read({jsonPaths:[...]}) 一次取回(路径互不相关也合批,禁止连续单路径 read);多条件筛选用 query_data({queries:[expr1,expr2,…]}) 一次取回(2-10 条);改多处用 write({patches:[{op:\"set\",jsonPath,value},...]}) 一次提交多改动(原子任一失败回滚),勿逐个 write 烧轮次预算。"), a.push("读到 <subtree Nkb keys:[…] #指纹> 或 <code Nkb> 占位 = 该子树键名/体积可见但内容未见:写入前先窄读全文(read({jsonPath:\"该子树路径\"}),结果根豁免返全文)或 set_focus 聚焦该区域;勿凭键名印象猜路径/猜值直写(直接写占位子树会被拦下要求先窄读)。"), a.push("对比当前与历史快照(或一段 JSON against)的差异用 diff_data({snapshotId?,against?})(返回结构化 path→from/to,verify 自纠/操作审计/\"刚才改了啥\");只读查历史快照值用 history_data({id?,jsonPath?})。")), r.subagent && a.push("独立子任务可 spawn_agent 委派(过程隔离,不占主上下文):默认只读,需要子 agent 写数据时传 writablePaths(路径前缀白名单,越界 PATH_OUT_OF_SCOPE)。多个独立子任务可 spawn_agents 并行委派(各子互不通信,结论由你汇总;并行委派不可授写权限,写操作由你收尾执行)。"), r.inspectEnv && a.push("排查页面环境(当前 URL/浏览器/视口/集成方调试变量)用 inspect_env——不传参返回环境摘要(location/navigator/viewport/document),传 key 读特定 window 属性(如 inspect_env({key:\"appConfig\"}) 读 window.appConfig)。改完数据看渲染、定位\"为何没生效\"时用它(只读,不改数据)。"), r.domInspect && a.push("改完数据想确认渲染是否生效(或定位元素/辅助 UI 设计问答)用 get_dom({selector?,depth?}) 读渲染后 DOM(结构化返回 tag/attrs/text/children,depth 控制深度防爆炸,只读)。配合宿主 actions(save_draft/publish 等)形成\"改数据→get_dom 看渲染→触发动作\"闭环。"), r.draftWrite && (a.push("生成超大 JSON(如 50+ 组件页面,单次 write 受 max_tokens 限制装不下)用 draft_write 分块构建 → draft_commit 原子提交:draft_write({draftId, chunk, mode}) mode:\"start\" 新建/\"append\" 追加(拼 JSON 片段到 drafts 池);累积完 draft_commit({draftId}) 合并 + schema 校验 + 写主数据(失败草稿保留可修后重试,成功自动清草稿)。小改仍用 write patch,只在大 JSON 从零生成时用 draft。"), a.push("⚠️ 大 JSON 分块构建是典型多轮工具调用(draft_write×N + draft_commit + read 确认 + 调研 read/query),默认 maxToolRounds=30(3.43 起;轮次预算吃紧时 system 会注入预算提示段,按提示优先收口);目标组件数很大时集成方仍可在 createChatSdk 显式上调 maxToolRounds(按 N+10 估算)。draft_commit 提交同样走乐观锁(改前 read 拿 hash,bind 被改过会触发冲突介入,不静默覆盖)。")), r.focus && (a.push("【上下文聚焦】判断任务范围,用 set_focus/add_focus/remove_focus/clear_focus 自动收敛工作范围:"), a.push(" · 局部任务(只改某一组件/区域,如「调导航栏」「改 components.3 样式」)→ 先 read 定位 jsonPath,再 set_focus({path:\"该子树路径\"}) 聚焦;聚焦后每轮只看该子树结构,写其他位置会被 PATH_DENIED 拒绝。"), a.push(" · 多个相关组件(如「同时改导航栏和页脚」)→ set_focus 聚焦首个后用 add_focus({path}) 追加其余;聚焦后可写任一焦点子树,越界仍被拒;移除单个用 remove_focus({path})。"), a.push(" · 全局任务(多处/整体结构,如「重排所有组件」「换主题」)→ 不要聚焦,保持全量视野直接写。"), a.push(" · 完成局部精修、要转向其他区域或做整体改动 → 调 clear_focus 退出聚焦(清空全部焦点),恢复全部读写权限。"), a.push(" · set_focus/add_focus 的 path 必须在 schema 内(类型校验);不确定路径先 read/describe_data 查。")), e?.subagents?.length) {
12441
+ if (r.planning && (a.push("【自适应规划】按任务复杂度决定是否先规划,不要对简单任务过度编排:"), a.push(" · 简单/明确任务(改单字段、调样式、查值)→ 直接 read/write 执行,不必 write_todos。"), a.push(" · 复杂任务(多步、大改、有歧义、不可逆)→ 先 write_todos 拆解,首个任务标 in_progress,逐项推进。"), a.push(" · 执行中发现步骤要改/补/细分 → 用 update_todo({id, content?, status?}) 按 id 增量改单项,不必重传整个清单。"), a.push(" · update_todo 标 completed 时附 evidence: 本次实际写入的 jsonPath(如 \"components.2\"),供收口对账;工作经委派子 agent 完成等无主写路径时,如实写明完成方式(勿编造路径)。"), e?.humanConfirm ? a.push(" · 规划出多步方案若需用户拍板 → 先 request_human_confirmation 给方案选项,确认后再执行。") : a.push(" · 规划出多步方案若需用户拍板 → 以文字列出方案选项等用户回复,勿自行拍板。"), a.push(" · 计划修订有次数上限(maxPlanRevisions,默认 5,只计 write_todos 调用、调研轮不计):勿反复改计划而不执行,规划充分后即开始 write 落地。")), t && (a.push("改主数据前先 read({jsonPath}) 读其当前真实值(返回末尾 hash=xxx 为乐观锁标识),基于真实值改,不要凭记忆。写入是否被自动校验由集成方 conflictWatchFields 声明决定:若已声明且主数据在你 read 之后被外部改过,会触发冲突——集成方若开启人工介入,工具会挂起等用户决定(保留外部/强制覆盖/回退),你应等待工具返回后按结果继续(保留外部→重新 read 再改;强制覆盖→已写入,继续;回退→已回退到历史快照,基于回退值重写);未开启人工介入时返回 VERSION_CONFLICT 不写入,重新 read 拿最新值再改。"), a.push("读类分流:取值/结构 → read(多路径用 jsonPaths);字段约束 → schema_data;条件筛选定位 → query_data(多条一次用 queries);名字模糊找 → search_data;整体说明 → read 不传路径。"), a.push("修改大对象/数组优先用 write 增量改({patch:{op,jsonPath,value}} 只发改动部分),避免 write({value}) 整体重传被 max_tokens 截断导致 JSON 不完整、校验失败。"), a.push("修改主数据出错时可用 restore_data 回退最近一次。"), a.push("在大数组里按条件筛选元素用 query_data(JSONPath,如 $.components[?(@.type==\"card\" && @.price<100)]),返回匹配元素的 path/index;定位后再 write({patch}) 改。"), a.push("找名字记不清的元素用 search_data(支持 substring/regex/fuzzy 模糊搜索)。"), a.push("需要过滤/映射/聚合/批量重写大数组时用 eval_script(沙箱脚本,入参 data);只读探查用 mode=query,批量重写用 mode=transform(返回值经校验后落地)。"), a.push("读大数组用 read({jsonPath,offset,limit}) 分页(返回 hasMore=true 时 offset+=limit 续读);一次读多个不相关子路径用 read({jsonPaths});复杂改动先 write({...,dryRun:true}) 预检不落盘。"), a.push("【省轮次·批量】≥2 个路径一律 read({jsonPaths:[...]}) 一次取回(路径互不相关也合批,禁止连续单路径 read);多条件筛选用 query_data({queries:[expr1,expr2,…]}) 一次取回(2-10 条);改多处用 write({patches:[{op:\"set\",jsonPath,value},...]}) 一次提交多改动(原子任一失败回滚),勿逐个 write 烧轮次预算。"), a.push("读到 <subtree Nkb keys:[…] #指纹> 或 <code Nkb> 占位 = 该子树键名/体积可见但内容未见:写入前先窄读全文(read({jsonPath:\"该子树路径\"}),结果根豁免返全文)或 set_focus 聚焦该区域;勿凭键名印象猜路径/猜值直写(直接写占位子树会被拦下要求先窄读)。"), a.push("对比当前与历史快照(或一段 JSON against)的差异用 diff_data({snapshotId?,against?})(返回结构化 path→from/to,verify 自纠/操作审计/\"刚才改了啥\");只读查历史快照值用 history_data({id?,jsonPath?})。")), r.subagent && a.push("独立子任务可 spawn_agent 委派(过程隔离,不占主上下文):默认只读,需要子 agent 写数据时传 writablePaths(路径前缀白名单,越界 PATH_OUT_OF_SCOPE)。多个独立子任务可 spawn_agents 并行委派(各子互不通信,结论由你汇总;并行委派不可授写权限,写操作由你收尾执行)。"), r.inspectEnv && a.push("排查页面环境(当前 URL/浏览器/视口/集成方调试变量)用 inspect_env——不传参返回环境摘要(location/navigator/viewport/document),传 key 读特定 window 属性(如 inspect_env({key:\"appConfig\"}) 读 window.appConfig)。改完数据看渲染、定位\"为何没生效\"时用它(只读,不改数据)。"), r.domInspect && a.push("改完数据想确认渲染是否生效(或定位元素/辅助 UI 设计问答)用 get_dom({selector?,depth?}) 读渲染后 DOM(结构化返回 tag/attrs/text/children,depth 控制深度防爆炸,只读)。配合宿主 actions(save_draft/publish 等)形成\"改数据→get_dom 看渲染→触发动作\"闭环。"), r.draftWrite && (a.push("生成超大 JSON(如 50+ 组件页面,单次 write 受 max_tokens 限制装不下)用 draft_write 分块构建 → draft_commit 原子提交:draft_write({draftId, chunk, mode}) mode:\"start\" 新建/\"append\" 追加(拼 JSON 片段到 drafts 池);累积完 draft_commit({draftId}) 合并 + schema 校验 + 写主数据(失败草稿保留可修后重试,成功自动清草稿)。小改仍用 write patch,只在大 JSON 从零生成时用 draft。"), a.push("⚠️ 大 JSON 分块构建是典型多轮工具调用(draft_write×N + draft_commit + read 确认 + 调研 read/query),默认 maxToolRounds=30(3.43 起;轮次预算吃紧时 system 会注入预算提示段,按提示优先收口);目标组件数很大时集成方仍可在 createChatSdk 显式上调 maxToolRounds(按 N+10 估算)。draft_commit 提交同样走乐观锁(改前 read 拿 hash,bind 被改过会触发冲突介入,不静默覆盖)。")), r.focus && (a.push("【上下文聚焦】判断任务范围,用 set_focus/add_focus/remove_focus/clear_focus 自动收敛工作范围:"), a.push(" · 局部任务(只改某一组件/区域,如「调导航栏」「改 components.3 样式」)→ 先 read 定位 jsonPath,再 set_focus({path:\"该子树路径\"}) 聚焦;聚焦后每轮只看该子树结构,写其他位置会被 PATH_DENIED 拒绝。"), a.push(" · 多个相关组件(如「同时改导航栏和页脚」)→ set_focus 聚焦首个后用 add_focus({path}) 追加其余;聚焦后可写任一焦点子树,越界仍被拒;移除单个用 remove_focus({path})。"), a.push(" · 全局任务(多处/整体结构,如「重排所有组件」「换主题」)→ 不要聚焦,保持全量视野直接写。"), a.push(" · 完成局部精修、要转向其他区域或做整体改动 → 调 clear_focus 退出聚焦(清空全部焦点),恢复全部读写权限。"), a.push(" · set_focus/add_focus 的 path 必须在 schema 内(类型校验);不确定路径先 read 查。")), e?.subagents?.length) {
12392
12442
  let t = e.subagents.filter((e) => (e.temperature ?? 0) >= lm || /规划|创意|设计|方案|brainstorm|plan/i.test(e.description)), n = e.subagents.filter((e) => (e.temperature ?? 0) < lm && /反思|审查|挑刺|校验|review|critique|reflect/i.test(e.description));
12393
12443
  a.push("【规划-反思-执行·路由】按任务性质选模式,不要对简单任务过度编排:"), t.length && (a.push(` · 创作/设计/开放性需求(如"设计主题风格""换个感觉")→ 先调 ${t.map((e) => "use_" + e.id).join("/")} 出 2-3 套方案(高温创意),`), a.push(e?.humanConfirm ? " 不要自己拍板;拿到方案后,若需用户拍板用 request_human_confirmation 弹选项。" : " 不要自己拍板;拿到方案后以文字列出选项等用户回复(humanConfirm 未开,勿调不存在工具)。")), n.length && a.push(` · 严谨/易错/校验类 → 可先调 ${n.map((e) => "use_" + e.id).join("/")} 反思挑刺(低温审查),据反馈修订。`), a.push(" · 方案定稿后,由你(主 agent)用 write 落地成 JSON(低温度执行 + schema 校验 + 写前确认)。"), a.push(" · 简单/明确任务(如\"标题改红色\")直接执行,不必走规划-反思。");
12394
12444
  }
@@ -12530,7 +12580,7 @@ function Tm(e, t, n, r) {
12530
12580
  }), i;
12531
12581
  },
12532
12582
  afterModel: (t) => {
12533
- let n = oe(t.message);
12583
+ let n = ae(t.message);
12534
12584
  n && (r.prompt_tokens = (r.prompt_tokens ?? 0) + (n.prompt_tokens ?? 0), r.completion_tokens = (r.completion_tokens ?? 0) + (n.completion_tokens ?? 0), r.total_tokens = (r.total_tokens ?? 0) + (n.total_tokens ?? 0), n.reasoning_tokens && (r.reasoning_tokens = (r.reasoning_tokens ?? 0) + n.reasoning_tokens), i++, e({
12535
12585
  type: "usage",
12536
12586
  round: i,
@@ -12600,7 +12650,7 @@ function Dm(e, n) {
12600
12650
  } } : void 0,
12601
12651
  maxBytes: e.vfs?.maxBytes,
12602
12652
  poolBytes: e.vfs?.poolBytes
12603
- }), w = lo([], { maxPlanRevisions: e.maxPlanRevisions }), T = ks(), ee = Fs((e) => {
12653
+ }), w = lo([], { maxPlanRevisions: e.maxPlanRevisions }), T = ks(), D = Fs((e) => {
12604
12654
  Y.agent?.debugLogs?.value?.push({
12605
12655
  timestamp: Date.now(),
12606
12656
  type: "middleware",
@@ -12609,13 +12659,13 @@ function Dm(e, n) {
12609
12659
  preview: e
12610
12660
  }
12611
12661
  });
12612
- }), D = Ls(() => {
12662
+ }), O = Ls(() => {
12613
12663
  Y.agent?.debugLogs?.value?.push({
12614
12664
  timestamp: Date.now(),
12615
12665
  type: "middleware",
12616
12666
  data: { stage: "resume_notice" }
12617
12667
  });
12618
- }), ne, re = e.approval?.timeoutMs, ie = re !== void 0 && Number.isFinite(re) && re > 0 ? re : re !== void 0 && (!Number.isFinite(re) || re < 0) ? 0 : 3e4, ae = (e) => {
12668
+ }), te, ne = e.approval?.timeoutMs, re = ne !== void 0 && Number.isFinite(ne) && ne > 0 ? ne : ne !== void 0 && (!Number.isFinite(ne) || ne < 0) ? 0 : 3e4, ie = (e) => {
12619
12669
  J({
12620
12670
  type: "error",
12621
12671
  message: `确认请求(${e.toolName})${Math.round(e.waitedMs / 1e3)}s 无响应已自动拒绝 —— 当前路径无 UI 响应方;可传 approval.timeoutMs 调整(Infinity = 无限等)`,
@@ -12623,8 +12673,8 @@ function Dm(e, n) {
12623
12673
  code: "APPROVAL_AUTO_REJECTED",
12624
12674
  context: e
12625
12675
  });
12626
- }, oe = Pl((e) => {
12627
- ne = e, Kt({ planConfirmation: e }), Y.agent?.debugLogs?.value?.push({
12676
+ }, ae = Pl((e) => {
12677
+ te = e, Kt({ planConfirmation: e }), Y.agent?.debugLogs?.value?.push({
12628
12678
  timestamp: Date.now(),
12629
12679
  type: "middleware",
12630
12680
  data: {
@@ -12634,55 +12684,55 @@ function Dm(e, n) {
12634
12684
  }
12635
12685
  });
12636
12686
  }, {
12637
- timeoutMs: ie,
12638
- onAutoReject: ae
12639
- }), O = lc({
12687
+ timeoutMs: re,
12688
+ onAutoReject: ie
12689
+ }), k = lc({
12640
12690
  getSchema: () => U()?.schema,
12641
12691
  getBind: () => U()?.bind,
12642
12692
  onChange: (e) => J({
12643
12693
  type: "focus_change",
12644
12694
  focuses: e
12645
12695
  })
12646
- }), k = Sl(), A = Cl(e.memory || "");
12647
- typeof e.memory == "function" && A.refresh();
12648
- let se = { current: null }, j = e.data ? {
12696
+ }), A = Sl(), j = Cl(e.memory || "");
12697
+ typeof e.memory == "function" && j.refresh();
12698
+ let oe = { current: null }, M = e.data ? {
12649
12699
  ...e.data,
12650
12700
  description: e.data.description ?? "主数据对象"
12651
- } : void 0, M = !(e.subagents ?? []).some((e) => e._codeAsset) && bp(e.capabilities).subagent, N = e.subagents;
12652
- M && j?.schema && rs(j.schema).length && (N = [...e.subagents ?? [], Tf()], console.info("[page-agent-sdk] 检测到 schema 含代码组件数组(如 components[].code),已自动装配 HTML 代码子 agent(委派编排 + vfs 工作副本 + 格式校验 + 增量 commit)。需定制(codeField/formatCheck/craftNotes 等)请显式传 createHtmlSubagent(...)"));
12653
- let ce = (N ?? []).filter((e) => !!e._codeAsset), P = /* @__PURE__ */ new Set();
12654
- for (let e of ce) {
12701
+ } : void 0, N = !(e.subagents ?? []).some((e) => e._codeAsset) && bp(e.capabilities).subagent, P = e.subagents;
12702
+ N && M?.schema && rs(M.schema).length && (P = [...e.subagents ?? [], Tf()], console.info("[page-agent-sdk] 检测到 schema 含代码组件数组(如 components[].code),已自动装配 HTML 代码子 agent(委派编排 + vfs 工作副本 + 格式校验 + 增量 commit)。需定制(codeField/formatCheck/craftNotes 等)请显式传 createHtmlSubagent(...)"));
12703
+ let se = (P ?? []).filter((e) => !!e._codeAsset), F = /* @__PURE__ */ new Set();
12704
+ for (let e of se) {
12655
12705
  if (e._codeAsset.writablePaths.length) continue;
12656
- let t = rs(j?.schema, e._codeAsset.codeField);
12657
- t.length ? (e._codeAsset.writablePaths = t, Array.isArray(e.writablePaths) && (e.writablePaths = t), e._rebuildCodeAssetPaths?.(t[0]), console.info(`[page-agent-sdk][createHtmlSubagent] 未传 writablePaths,已从 schema 推断: [${t.map((e) => `'${e}'`).join(", ")}]`)) : (console.warn("[page-agent-sdk][createHtmlSubagent] 未能从 schema 推断 writablePaths(开放 schema(z.any()/z.record())/嵌套容器(如 sections[].children[])/点路径 codeField(如 props.html_code)不支持自动推断),已跳过该 html 子 agent(整体不受影响);如确需代码资产机制(vfs + 格式校验 + 增量 commit),请显式传 writablePaths(代码组件 data 区,如 ['components'])"), P.add(e));
12706
+ let t = rs(M?.schema, e._codeAsset.codeField);
12707
+ t.length ? (e._codeAsset.writablePaths = t, Array.isArray(e.writablePaths) && (e.writablePaths = t), e._rebuildCodeAssetPaths?.(t[0]), console.info(`[page-agent-sdk][createHtmlSubagent] 未传 writablePaths,已从 schema 推断: [${t.map((e) => `'${e}'`).join(", ")}]`)) : (console.warn("[page-agent-sdk][createHtmlSubagent] 未能从 schema 推断 writablePaths(开放 schema(z.any()/z.record())/嵌套容器(如 sections[].children[])/点路径 codeField(如 props.html_code)不支持自动推断),已跳过该 html 子 agent(整体不受影响);如确需代码资产机制(vfs + 格式校验 + 增量 commit),请显式传 writablePaths(代码组件 data 区,如 ['components'])"), F.add(e));
12658
12708
  }
12659
- let F = P.size ? ce.filter((e) => !P.has(e)) : ce, le = P.size ? (N ?? []).filter((e) => !P.has(e)) : N, ue = F.length > 0, I = F.flatMap((e) => e._codeAsset.writablePaths), de = F.flatMap((e) => e._codeAsset.writablePaths.map((t) => `${t}.${e._codeAsset.codeField}`)), L = e.checkpoint, R = L !== void 0 && L !== !1, z = R ? Vl({
12709
+ let I = F.size ? se.filter((e) => !F.has(e)) : se, ce = F.size ? (P ?? []).filter((e) => !F.has(e)) : P, le = I.length > 0, L = I.flatMap((e) => e._codeAsset.writablePaths), ue = I.flatMap((e) => e._codeAsset.writablePaths.map((t) => `${t}.${e._codeAsset.codeField}`)), R = e.checkpoint, de = R !== void 0 && R !== !1, z = de ? Vl({
12660
12710
  getData: () => U()?.bind,
12661
12711
  consumeDataDirty: () => H?.consumeDataDirty?.() ?? !0,
12662
- slotPaths: j ? [""] : [],
12712
+ slotPaths: M ? [""] : [],
12663
12713
  vfsStore: C,
12664
12714
  todosMw: w,
12665
- getTodos: () => se.current?.getState?.()?.todos ?? [],
12715
+ getTodos: () => oe.current?.getState?.()?.todos ?? [],
12666
12716
  messages: S,
12667
- maxCheckpoints: L && typeof L == "object" ? L.maxCheckpoints : void 0
12668
- }) : null, fe = !L || typeof L != "object" || L.auto !== !1, B = bp(e.capabilities), pe = B.dataOps, me = B.draftWrite, V = B.automation, he = yu({
12717
+ maxCheckpoints: R && typeof R == "object" ? R.maxCheckpoints : void 0
12718
+ }) : null, fe = !R || typeof R != "object" || R.auto !== !1, B = bp(e.capabilities), pe = B.dataOps, me = B.draftWrite, V = B.automation, he = yu({
12669
12719
  ...e,
12670
12720
  locale: e.i18n?.locale
12671
12721
  });
12672
- if (ue) {
12673
- let e = F.map((e) => e._codeAsset.orchestratorPrompt).filter(Boolean).join("\n\n");
12722
+ if (le) {
12723
+ let e = I.map((e) => e._codeAsset.orchestratorPrompt).filter(Boolean).join("\n\n");
12674
12724
  e && (he += "\n\n" + e);
12675
- } else j?.schema && ns(j.schema) && (he += "\n\n" + bs.htmlDirectWriteFallback, console.warn("[page-agent-sdk] 检测到 schema 含 code 字段但未注册 html 子 agent:已自动注入「主 agent 自己写 HTML」编排(code 作普通字段直接 write,无 vfs 工作副本 / 无格式校验门禁)。如需代码资产机制(vfs + 格式校验 + 增量 commit + 主上下文 code 摘要),注册 createHtmlSubagent;若确为降级意图可忽略。"));
12676
- let ge = pe && j ? _d(j, {
12725
+ } else M?.schema && ns(M.schema) && (he += "\n\n" + bs.htmlDirectWriteFallback, console.warn("[page-agent-sdk] 检测到 schema 含 code 字段但未注册 html 子 agent:已自动注入「主 agent 自己写 HTML」编排(code 作普通字段直接 write,无 vfs 工作副本 / 无格式校验门禁)。如需代码资产机制(vfs + 格式校验 + 增量 commit + 主上下文 code 摘要),注册 createHtmlSubagent;若确为降级意图可忽略。"));
12726
+ let ge = pe && M ? _d(M, {
12677
12727
  onAudit: e.onAudit ?? (e.debug ? (e) => console.log("[page-agent-sdk][data audit]", e) : void 0),
12678
12728
  maxSnapshots: e.maxSnapshots,
12679
12729
  onConflict: i.set,
12680
12730
  conflictWatchFields: e.conflictWatchFields,
12681
12731
  maxParallelTools: e.maxParallelTools,
12682
- vfsStore: me || j?.resources?.length ? C : void 0,
12683
- ...I.length ? { pgIdPaths: I } : {},
12684
- ...de.length ? { largeTextPaths: de } : {}
12685
- }) : [], _e = pe ? ge : [], H = pe && j ? ge.controller ?? null : null, ve = pe && j?.resources?.length && H?.getResourcesSnapshot ? dm({ getResourcesSnapshot: () => H?.getResourcesSnapshot?.() ?? [] }) : void 0, U = () => H?.get() ?? j, ye = new Set(ge.map((e) => e.name)), be = e.conflictWatchFields ?? [], xe = !be.includes("*") && be.length ? new Set(be) : void 0, Se = H ? Xd({
12732
+ vfsStore: me || M?.resources?.length ? C : void 0,
12733
+ ...L.length ? { pgIdPaths: L } : {},
12734
+ ...ue.length ? { largeTextPaths: ue } : {}
12735
+ }) : [], _e = pe ? ge : [], H = pe && M ? ge.controller ?? null : null, ve = pe && M?.resources?.length && H?.getResourcesSnapshot ? dm({ getResourcesSnapshot: () => H?.getResourcesSnapshot?.() ?? [] }) : void 0, U = () => H?.get() ?? M, ye = new Set(ge.map((e) => e.name)), be = e.conflictWatchFields ?? [], xe = !be.includes("*") && be.length ? new Set(be) : void 0, Se = H ? Xd({
12686
12736
  getBind: () => U()?.bind,
12687
12737
  recomputeAll: () => H.recomputeAllBaselines?.(),
12688
12738
  hasBaselines: () => H.hasBaselines?.() ?? !1,
@@ -12711,7 +12761,7 @@ function Dm(e, n) {
12711
12761
  Te.forEach((e) => W.set(e.name, "action"));
12712
12762
  let G = [], Ee = !1, De = e.humanConfirm !== !1 && (!e.approval || e.approval.humanConfirmTool !== !1), Oe = De ? Nl() : null;
12713
12763
  Oe && W.set(jl, "builtin");
12714
- let ke = R && z ? [s(async () => {
12764
+ let ke = de && z ? [s(async () => {
12715
12765
  let e = z.list();
12716
12766
  return e.length ? z.restore() ? `已回退到最近一次正常状态(checkpoint #${e[e.length - 1].id})。对话历史、主数据、vfs、todos 已整体还原。请基于回退后的状态重新判断并继续。` : "回退失败:无可用 checkpoint。" : "无可用 checkpoint,无法回退。";
12717
12767
  }, {
@@ -12729,7 +12779,7 @@ function Dm(e, n) {
12729
12779
  ke.forEach((e) => W.set(e.name, "builtin"));
12730
12780
  let Ae = B.focus, je = s(async ({ path: e, label: t }) => {
12731
12781
  let n = U()?.schema;
12732
- return n ? Go(n, e) ? (O.setFocus({
12782
+ return n ? Go(n, e) ? (k.setFocus({
12733
12783
  path: e,
12734
12784
  ...t ? { label: t } : {}
12735
12785
  }, "agent"), `已聚焦到 ${e}${t ? `(${t})` : ""}。后续仅可写该子树(越界被拒),每轮只看到该组件结构。完成精修后调 clear_focus 退出。`) : `PATH_DENIED · 聚焦失败:path "${e}" 不在 schema 内。请先用 read 查看可操作路径再聚焦。` : "聚焦失败:当前无主数据 schema,无法聚焦。";
@@ -12740,7 +12790,7 @@ function Dm(e, n) {
12740
12790
  path: t.string().describe("要聚焦的组件 jsonPath,如 components.3"),
12741
12791
  label: t.string().optional().describe("人类可读标签,如「导航栏」")
12742
12792
  })
12743
- }), Me = s(async () => (O.clearFocus("agent"), "已清除聚焦,恢复全量可操作范围(可读写所有组件)。"), {
12793
+ }), Me = s(async () => (k.clearFocus("agent"), "已清除聚焦,恢复全量可操作范围(可读写所有组件)。"), {
12744
12794
  name: "clear_focus",
12745
12795
  description: "清除当前聚焦,退出精修模式,恢复对全部组件的读写权限。",
12746
12796
  schema: t.object({}).optional()
@@ -12748,11 +12798,11 @@ function Dm(e, n) {
12748
12798
  let n = U()?.schema;
12749
12799
  if (!n) return "聚焦失败:当前无主数据 schema,无法聚焦。";
12750
12800
  if (!Go(n, e)) return `PATH_DENIED · 聚焦失败:path "${e}" 不在 schema 内。请先用 read 查看可操作路径再聚焦。`;
12751
- O.addFocus({
12801
+ k.addFocus({
12752
12802
  path: e,
12753
12803
  ...t ? { label: t } : {}
12754
12804
  }, "agent");
12755
- let r = O.getFocuses();
12805
+ let r = k.getFocuses();
12756
12806
  return `已聚焦 ${e}${t ? `(${t})` : ""}(当前共 ${r.length} 个焦点:${r.map((e) => e.path).join(", ")})。后续仅可写这些子树之一(越界被拒)。`;
12757
12807
  }, {
12758
12808
  name: "add_focus",
@@ -12762,9 +12812,9 @@ function Dm(e, n) {
12762
12812
  label: t.string().optional().describe("人类可读标签")
12763
12813
  })
12764
12814
  }), Pe = s(async ({ path: e }) => {
12765
- let t = O.getFocuses().length;
12766
- O.removeFocus(e, "agent");
12767
- let n = O.getFocuses();
12815
+ let t = k.getFocuses().length;
12816
+ k.removeFocus(e, "agent");
12817
+ let n = k.getFocuses();
12768
12818
  return n.length === t ? `path "${e}" 不在当前焦点列表中(当前:${n.map((e) => e.path).join(", ") || "无"})。` : n.length ? `已移除焦点 ${e}(剩余 ${n.length} 个:${n.map((e) => e.path).join(", ")})。` : `已移除焦点 ${e},聚焦已清空,恢复全量操作范围。`;
12769
12819
  }, {
12770
12820
  name: "remove_focus",
@@ -12816,7 +12866,7 @@ function Dm(e, n) {
12816
12866
  ]);
12817
12867
  return t.length && console.warn("[page-agent-sdk] 工具重名,后注册覆盖先注册:", t.map((e) => `${e.name}(${e.loser}→${e.winner})`).join(", ")), e;
12818
12868
  }
12819
- let ze = B.planning, Be = B.missionAnchor, Ve = B.workingMemory, He = B.skills, Ue = B.vfs || ue;
12869
+ let ze = B.planning, Be = B.missionAnchor, Ve = B.workingMemory, He = B.skills, Ue = B.vfs || le;
12820
12870
  if (Ue) for (let e of Au) W.set(e, "builtin");
12821
12871
  if (ze) for (let e of w.tools ?? []) W.set(e.name, "builtin");
12822
12872
  let We = B.summarization, Ge = B.agentCompression && !!d;
@@ -12825,8 +12875,8 @@ function Dm(e, n) {
12825
12875
  Xe && !q && e.verify?.enabled !== !1 && console.warn("[page-agent-sdk][verify] 检测到 verify 配置(check/maxAttempts/adversarial)但未装载(capabilities.verify:false 显式关闭 或 maxAttempts≤0)");
12826
12876
  let $e = e.subagent, et = $e?.allowedTools ?? [], tt = e.permissions?.length ? kl(e.permissions) : void 0, nt = e.approval && (e.approval.tools !== void 0 || e.approval.confirm) ? Al({
12827
12877
  ...e.approval,
12828
- timeoutMs: e.approval.timeoutMs ?? ie,
12829
- onAutoReject: ae
12878
+ timeoutMs: e.approval.timeoutMs ?? re,
12879
+ onAutoReject: ie
12830
12880
  }) : void 0, rt = [
12831
12881
  ...tt ? [tt] : [],
12832
12882
  ...nt ? [nt] : [],
@@ -12844,7 +12894,7 @@ function Dm(e, n) {
12844
12894
  maxParallel: $e?.maxParallel,
12845
12895
  thinkingMode: $e?.thinkingMode,
12846
12896
  debug: e.debug,
12847
- getFocuses: () => O.getActiveFocuses(),
12897
+ getFocuses: () => k.getActiveFocuses(),
12848
12898
  getSchema: () => U()?.schema ?? null,
12849
12899
  tracker: Je,
12850
12900
  guardMiddleware: rt.length ? rt : void 0,
@@ -12855,7 +12905,7 @@ function Dm(e, n) {
12855
12905
  r.prompt_tokens = (r.prompt_tokens ?? 0) + (e.prompt_tokens ?? 0), r.completion_tokens = (r.completion_tokens ?? 0) + (e.completion_tokens ?? 0), r.total_tokens = (r.total_tokens ?? 0) + (e.total_tokens ?? 0), e.reasoning_tokens && (r.reasoning_tokens = (r.reasoning_tokens ?? 0) + e.reasoning_tokens);
12856
12906
  },
12857
12907
  timeoutMs: $e?.timeoutMs
12858
- }), at = le?.map((e) => {
12908
+ }), at = ce?.map((e) => {
12859
12909
  if (!e._codeAsset) return e;
12860
12910
  let t = e._codeAsset, n = Fd({
12861
12911
  writablePaths: t.writablePaths,
@@ -12872,12 +12922,12 @@ function Dm(e, n) {
12872
12922
  ...e,
12873
12923
  middleware: r
12874
12924
  };
12875
- }), ot = ue && qe ? Id() : void 0, st = ot ? Ud({
12925
+ }), ot = le && qe ? Id() : void 0, st = ot ? Ud({
12876
12926
  getBind: () => U()?.bind,
12877
- writablePaths: I,
12927
+ writablePaths: L,
12878
12928
  getLocked: () => ot.locked(),
12879
12929
  tools: K,
12880
- getCodeFieldPaths: () => Vd(U()?.bind, F.map((e) => ({
12930
+ getCodeFieldPaths: () => Vd(U()?.bind, I.map((e) => ({
12881
12931
  writablePaths: e._codeAsset.writablePaths,
12882
12932
  codeField: e._codeAsset.codeField
12883
12933
  })))
@@ -12890,7 +12940,7 @@ function Dm(e, n) {
12890
12940
  staleReadInvalidation: e.staleReadInvalidation,
12891
12941
  allTools: () => Y.agent?.allTools ?? K,
12892
12942
  debug: e.debug,
12893
- getFocuses: () => O.getActiveFocuses(),
12943
+ getFocuses: () => k.getActiveFocuses(),
12894
12944
  getSchema: () => U()?.schema ?? null,
12895
12945
  getBind: () => U()?.bind,
12896
12946
  tracker: Je,
@@ -12904,7 +12954,7 @@ function Dm(e, n) {
12904
12954
  timeoutMs: e.subagent?.timeoutMs,
12905
12955
  ...ot ? {
12906
12956
  componentLock: ot,
12907
- resolveComponents: (e) => Ld(e, jd(U()?.bind, I))
12957
+ resolveComponents: (e) => Ld(e, jd(U()?.bind, L))
12908
12958
  } : {}
12909
12959
  }) : void 0, ut = lt ? lt.controller : null, dt = (t) => {
12910
12960
  let n = t.thinkingMode ?? e.subagent?.thinkingMode, r = n ? Mf(t.llm ?? e.llm) ? "instance-noop" : "applied" : "inherited";
@@ -12913,11 +12963,7 @@ function Dm(e, n) {
12913
12963
  ...n ? { thinkingMode: n } : {},
12914
12964
  thinkingApplied: r
12915
12965
  };
12916
- }, ft = [
12917
- "describe_data",
12918
- "read",
12919
- "fetch_document"
12920
- ], pt = K.filter((e) => ft.includes(e.name)), mt = q ? Wl({
12966
+ }, ft = ["read", "fetch_document"], pt = K.filter((e) => ft.includes(e.name)), mt = q ? Wl({
12921
12967
  check: e.verify.check ?? Xl({
12922
12968
  schemas: () => U() ? { "": U().schema } : {},
12923
12969
  root: () => U()?.bind
@@ -12932,8 +12978,8 @@ function Dm(e, n) {
12932
12978
  }) : void 0, gt = um({
12933
12979
  ...B,
12934
12980
  humanConfirm: De,
12935
- subagents: le?.map(dt)
12936
- }, pe && !!j, { promptSoftCap: Uc(f.contextWindow, m.promptSoftCapTokens) }), _t = j ? {
12981
+ subagents: ce?.map(dt)
12982
+ }, pe && !!M, { promptSoftCap: Uc(f.contextWindow, m.promptSoftCapTokens) }), _t = M ? {
12937
12983
  name: "dataHint",
12938
12984
  augmentPrompt: () => vu(U(), e.schemaHint) || void 0
12939
12985
  } : null, vt = e.augmentSystem ? {
@@ -12993,8 +13039,8 @@ function Dm(e, n) {
12993
13039
  ..._t ? [_t] : [],
12994
13040
  gt,
12995
13041
  ...Be ? [T] : [],
12996
- ee,
12997
13042
  D,
13043
+ O,
12998
13044
  ...ze ? [w] : [],
12999
13045
  ...He ? [bt = wc([...B.domInspect && !(e.skills || []).some((e) => e.name === Kp.name) ? [Kp] : [], ...e.skills || []], {
13000
13046
  readVfs: Ue ? (e) => C.files[e]?.content : void 0,
@@ -13008,13 +13054,13 @@ function Dm(e, n) {
13008
13054
  })] : [],
13009
13055
  ...Ue ? [Mu(C)] : [],
13010
13056
  ...Dt ? [Dt] : [],
13011
- ...Ve ? [k] : [],
13012
- ...Ae ? [O] : [],
13057
+ ...Ve ? [A] : [],
13058
+ ...Ae ? [k] : [],
13013
13059
  ...ve ? [ve] : [],
13014
- ...Ke ? [A] : [],
13060
+ ...Ke ? [j] : [],
13015
13061
  ...tt ? [tt] : [],
13016
- ...R && fe && z ? [Hl(z)] : [],
13017
- ...De ? [oe] : [],
13062
+ ...de && fe && z ? [Hl(z)] : [],
13063
+ ...De ? [ae] : [],
13018
13064
  ...nt ? [nt] : [],
13019
13065
  ...Se ? [Se] : [],
13020
13066
  ...mt ? [mt] : [],
@@ -13066,10 +13112,10 @@ function Dm(e, n) {
13066
13112
  vfsStore: C,
13067
13113
  listeners: yt.listeners,
13068
13114
  todosMw: w,
13069
- memoryMw: A,
13115
+ memoryMw: j,
13070
13116
  missionMw: T,
13071
- workingMemoryMw: k,
13072
- focusMw: O,
13117
+ workingMemoryMw: A,
13118
+ focusMw: k,
13073
13119
  agent: null,
13074
13120
  initDone: Promise.resolve(),
13075
13121
  sessionId: "",
@@ -13102,11 +13148,11 @@ function Dm(e, n) {
13102
13148
  K = Re(), Y.agent && Y.agent.setTools(K);
13103
13149
  },
13104
13150
  applySnapshot(t) {
13105
- if (t.vfs && C.hydrate && C.hydrate(t.vfs), t.messages?.length && (S.push(...Ci(t.messages, (e) => (e ? Y.vfsStore?.files?.[e]?.content : void 0) || void 0)), D.markResumed()), t.todos?.length && w.reset(t.todos), t.memory && !e.memory && A.reset(t.memory), t.checkpoints?.length && z && z.importStack(t.checkpoints), t.usage && Object.assign(r, t.usage), t.mission && Be && T.setMission(t.mission), t.workingMemory && Ve && k.restore(t.workingMemory), t.planConfirmation && (ne = t.planConfirmation), Ae) {
13151
+ if (t.vfs && C.hydrate && C.hydrate(t.vfs), t.messages?.length && (S.push(...Ci(t.messages, (e) => (e ? Y.vfsStore?.files?.[e]?.content : void 0) || void 0)), O.markResumed()), t.todos?.length && w.reset(t.todos), t.memory && !e.memory && j.reset(t.memory), t.checkpoints?.length && z && z.importStack(t.checkpoints), t.usage && Object.assign(r, t.usage), t.mission && Be && T.setMission(t.mission), t.workingMemory && Ve && A.restore(t.workingMemory), t.planConfirmation && (te = t.planConfirmation), Ae) {
13106
13152
  let n = t.focus, r = n ? Array.isArray(n) ? n : [n] : [];
13107
13153
  if (r.length) {
13108
13154
  let t = U()?.schema, n = t ? r.filter((e) => Go(t, e.path)) : [];
13109
- if (n.length && (O.setFocus(null), n.forEach((e) => O.addFocus(e))), e.debug && n.length < r.length) {
13155
+ if (n.length && (k.setFocus(null), n.forEach((e) => k.addFocus(e))), e.debug && n.length < r.length) {
13110
13156
  let e = r.filter((e) => !n.includes(e)).map((e) => e.path);
13111
13157
  console.warn("[page-agent-sdk][focus] 恢复的焦点部分 path 已失效(schema 变化/无 schema),剔除:", e);
13112
13158
  }
@@ -13328,17 +13374,17 @@ function Dm(e, n) {
13328
13374
  e && Kt({ mission: e });
13329
13375
  }
13330
13376
  if (Ve) {
13331
- let e = k.getWorkingMemory();
13377
+ let e = A.getWorkingMemory();
13332
13378
  e && Kt({ workingMemory: e });
13333
13379
  }
13334
13380
  if (Ae) {
13335
- let e = O.getFocuses();
13381
+ let e = k.getFocuses();
13336
13382
  Kt({ focus: e.length ? e : null });
13337
13383
  }
13338
13384
  }
13339
13385
  C.flush?.(), await o.flush();
13340
13386
  let r = t ?? "", a;
13341
- if (r ? (a = await o.load(n, r), a || await o.createSession(n, e.session?.title, r)) : r = await o.createSession(n, e.session?.title), Y.sessionId = r, S.splice(0, S.length), C.clear?.(), w.reset([]), e.memory || A.reset(""), T.reset(), k.reset(), O.reset(), Dt?.reset(), D.reset(), ne = void 0, z && z.importStack([]), Y.agent.debugLogs.value = [], Y.agent.resetStaleReadsInvalidated?.(), !a) try {
13387
+ if (r ? (a = await o.load(n, r), a || await o.createSession(n, e.session?.title, r)) : r = await o.createSession(n, e.session?.title), Y.sessionId = r, S.splice(0, S.length), C.clear?.(), w.reset([]), e.memory || j.reset(""), T.reset(), A.reset(), k.reset(), Dt?.reset(), O.reset(), te = void 0, z && z.importStack([]), Y.agent.debugLogs.value = [], Y.agent.resetStaleReadsInvalidated?.(), !a) try {
13342
13388
  a = await o.load(n, r);
13343
13389
  } catch (e) {
13344
13390
  J({
@@ -13353,10 +13399,10 @@ function Dm(e, n) {
13353
13399
  type: "session_restored",
13354
13400
  sessionId: r,
13355
13401
  rounds: a.messages?.length ?? 0
13356
- })), e.memory && Kt({ memory: A.get() || (typeof e.memory == "string" ? e.memory : "") }), Nt(), Ht = void 0, Wt = !1, Y.infoTick.value++, r;
13402
+ })), e.memory && Kt({ memory: j.get() || (typeof e.memory == "string" ? e.memory : "") }), Nt(), Ht = void 0, Wt = !1, Y.infoTick.value++, r;
13357
13403
  },
13358
13404
  resetSession: () => {
13359
- Lt(), i.resolve("keep_external"), Y.sessionId = Uf(), S.splice(0, S.length), C.clear?.(), w.reset([]), e.memory || A.reset(""), T.reset(), k.reset(), O.reset(), Dt?.reset(), D.reset(), ne = void 0, z && z.importStack([]), Y.agent && (Y.agent.debugLogs.value = [], Y.agent.resetStaleReadsInvalidated?.()), o && o.createSession(Y.agentId, e.session?.title, Y.sessionId).catch((t) => {
13405
+ Lt(), i.resolve("keep_external"), Y.sessionId = Uf(), S.splice(0, S.length), C.clear?.(), w.reset([]), e.memory || j.reset(""), T.reset(), A.reset(), k.reset(), Dt?.reset(), O.reset(), te = void 0, z && z.importStack([]), Y.agent && (Y.agent.debugLogs.value = [], Y.agent.resetStaleReadsInvalidated?.()), o && o.createSession(Y.agentId, e.session?.title, Y.sessionId).catch((t) => {
13360
13406
  e.debug && console.warn("[page-agent-sdk][persist] createSession 失败(已吞):", t);
13361
13407
  }), J({
13362
13408
  type: "session_restored",
@@ -13428,10 +13474,10 @@ function Dm(e, n) {
13428
13474
  Y.agent && (Y.agent.setLlm(n), Y.agent.setModelCaps?.(f)), Dt?.setContextWindow?.(f.contextWindow), ht?.setContextWindow?.(f.contextWindow), Y.infoTick.value++, e.debug && console.log("[page-agent-sdk][setLlm] 重解析 modelCaps + 回灌:", f);
13429
13475
  },
13430
13476
  setMemory(e) {
13431
- A.reset(e), typeof e == "function" && A.refresh(), Y.infoTick.value++;
13477
+ j.reset(e), typeof e == "function" && j.refresh(), Y.infoTick.value++;
13432
13478
  },
13433
13479
  refreshMemory() {
13434
- return A.refresh();
13480
+ return j.refresh();
13435
13481
  },
13436
13482
  setSubagents(t) {
13437
13483
  if (!ut) {
@@ -13484,7 +13530,7 @@ function Dm(e, n) {
13484
13530
  summaryThresholdRatio: m.summaryThresholdRatio ?? .5,
13485
13531
  promptSoftCap: Uc(f.contextWindow, m.promptSoftCapTokens)
13486
13532
  },
13487
- memory: A.get(),
13533
+ memory: j.get(),
13488
13534
  staleReadsInvalidated: Y.agent?.getStaleReadsInvalidated?.() ?? 0,
13489
13535
  middleware: Ot.map((e) => e.name),
13490
13536
  todos: (Y.agent?.getState?.()?.todos ?? []).map((e) => ({
@@ -13498,10 +13544,10 @@ function Dm(e, n) {
13498
13544
  })),
13499
13545
  planPhase: w.getPlanPhase(),
13500
13546
  mission: Be ? T.getMission() : void 0,
13501
- planConfirmation: ne,
13502
- workingMemory: Ve ? k.getWorkingMemory() : void 0,
13503
- focus: Ae ? O.getFocus() : void 0,
13504
- focuses: Ae ? O.getFocuses() : [],
13547
+ planConfirmation: te,
13548
+ workingMemory: Ve ? A.getWorkingMemory() : void 0,
13549
+ focus: Ae ? k.getFocus() : void 0,
13550
+ focuses: Ae ? k.getFocuses() : [],
13505
13551
  actions: rm(e.actions ?? {}),
13506
13552
  subagent: {
13507
13553
  enabled: !!it,
@@ -13583,27 +13629,27 @@ function Dm(e, n) {
13583
13629
  T.setMission(t), Y.infoTick.value++;
13584
13630
  },
13585
13631
  getFocus() {
13586
- return Ae ? O.getFocus() : void 0;
13632
+ return Ae ? k.getFocus() : void 0;
13587
13633
  },
13588
13634
  getFocuses() {
13589
- return Ae ? O.getFocuses() : [];
13635
+ return Ae ? k.getFocuses() : [];
13590
13636
  },
13591
13637
  setFocus(t) {
13592
13638
  let n = Em(t, "setFocus", Ae, () => U()?.schema, e.debug);
13593
- return n.ok ? (O.setFocus(t), e.debug && O.isInvokeActive() && console.info("[page-agent-sdk][focus] 在途流程进行中,聚焦将在下一次输入生效(当前流程不受影响)"), Y.infoTick.value++, { ok: !0 }) : n;
13639
+ return n.ok ? (k.setFocus(t), e.debug && k.isInvokeActive() && console.info("[page-agent-sdk][focus] 在途流程进行中,聚焦将在下一次输入生效(当前流程不受影响)"), Y.infoTick.value++, { ok: !0 }) : n;
13594
13640
  },
13595
13641
  addFocus(t) {
13596
13642
  let n = Em(t, "addFocus", Ae, () => U()?.schema, e.debug);
13597
- return n.ok ? O.getFocuses().length >= 8 ? (e.debug && console.warn("[page-agent-sdk][focus] addFocus 拒绝:焦点数已达上限 8(augmentPrompt 注入每焦点子树 schema,过多致 system prompt 超预算)"), {
13643
+ return n.ok ? k.getFocuses().length >= 8 ? (e.debug && console.warn("[page-agent-sdk][focus] addFocus 拒绝:焦点数已达上限 8(augmentPrompt 注入每焦点子树 schema,过多致 system prompt 超预算)"), {
13598
13644
  ok: !1,
13599
13645
  error: "焦点数上限 8(避免 system prompt 撑爆)"
13600
- }) : (O.addFocus(t), e.debug && O.isInvokeActive() && console.info("[page-agent-sdk][focus] 在途流程进行中,聚焦将在下一次输入生效(当前流程不受影响)"), Y.infoTick.value++, { ok: !0 }) : n;
13646
+ }) : (k.addFocus(t), e.debug && k.isInvokeActive() && console.info("[page-agent-sdk][focus] 在途流程进行中,聚焦将在下一次输入生效(当前流程不受影响)"), Y.infoTick.value++, { ok: !0 }) : n;
13601
13647
  },
13602
13648
  removeFocus(e) {
13603
- Ae && (O.removeFocus(e), Y.infoTick.value++);
13649
+ Ae && (k.removeFocus(e), Y.infoTick.value++);
13604
13650
  },
13605
13651
  clearFocus() {
13606
- Ae && (O.clearFocus(), Y.infoTick.value++);
13652
+ Ae && (k.clearFocus(), Y.infoTick.value++);
13607
13653
  }
13608
13654
  };
13609
13655
  async function Rt() {
@@ -13660,7 +13706,7 @@ function Dm(e, n) {
13660
13706
  }), e.debug && console.log("[page-agent-sdk][restore] 恢复会话", Y.sessionId, `${n.messages?.length ?? 0} msgs`)) : e.debug && console.log("[page-agent-sdk][restore] 会话 meta 存在但快照为空", Y.sessionId);
13661
13707
  } else Y.sessionId = await o.createSession(n, a.title), e.debug && console.log("[page-agent-sdk][restore] 新建会话(无历史)", Y.sessionId);
13662
13708
  } else Y.sessionId = await o.createSession(n, a.title);
13663
- e.memory && Kt({ memory: A.get() || (typeof e.memory == "string" ? e.memory : "") }), Nt();
13709
+ e.memory && Kt({ memory: j.get() || (typeof e.memory == "string" ? e.memory : "") }), Nt();
13664
13710
  }
13665
13711
  async function X() {
13666
13712
  await Et();
@@ -13765,16 +13811,16 @@ function Dm(e, n) {
13765
13811
  }
13766
13812
  function Zt() {
13767
13813
  if (!Y.sessionId || !o) return;
13768
- if (Kt({ messages: Si(JSON.parse(JSON.stringify(S))) }), Kt({ todos: Y.agent?.getState?.()?.todos ?? [] }), Kt({ planConfirmation: ne }), Be) {
13814
+ if (Kt({ messages: Si(JSON.parse(JSON.stringify(S))) }), Kt({ todos: Y.agent?.getState?.()?.todos ?? [] }), Kt({ planConfirmation: te }), Be) {
13769
13815
  let e = T.getMission();
13770
13816
  e && Kt({ mission: e });
13771
13817
  }
13772
13818
  if (Ve) {
13773
- let e = k.getWorkingMemory();
13819
+ let e = A.getWorkingMemory();
13774
13820
  e && Kt({ workingMemory: e });
13775
13821
  }
13776
13822
  if (Ae) {
13777
- let e = O.getFocuses();
13823
+ let e = k.getFocuses();
13778
13824
  Kt({ focus: e.length ? e : null });
13779
13825
  }
13780
13826
  V && z && (Kt({ checkpoints: z.exportStack() }), Kt({ usage: r }));
@@ -13856,7 +13902,7 @@ function Dm(e, n) {
13856
13902
  }
13857
13903
  }));
13858
13904
  })();
13859
- let t = Mf(e.llm) ? e.llm : await te(e.llm);
13905
+ let t = Mf(e.llm) ? e.llm : await ee(e.llm);
13860
13906
  Y.agent = Vo({
13861
13907
  llm: t,
13862
13908
  systemPrompt: he,
@@ -13880,7 +13926,7 @@ function Dm(e, n) {
13880
13926
  x = e;
13881
13927
  },
13882
13928
  debug: e.debug
13883
- }), se.current = Y.agent, lt && lt.setReconfigureHook && lt.setReconfigureHook(() => {
13929
+ }), oe.current = Y.agent, lt && lt.setReconfigureHook && lt.setReconfigureHook(() => {
13884
13930
  Y.agent && Y.agent.setTools(Re());
13885
13931
  });
13886
13932
  })(), Y;
@@ -14405,11 +14451,11 @@ function Lm(e = {}) {
14405
14451
  function E() {
14406
14452
  d.value = [], u?.abort(), u = null, s.loading = !1, s.error = null, f.value = null;
14407
14453
  }
14408
- function ee(e) {
14454
+ function D(e) {
14409
14455
  let t = f.value;
14410
14456
  t && (f.value = null, t.resolve(e));
14411
14457
  }
14412
- async function D() {
14458
+ async function O() {
14413
14459
  if (!s.error) return;
14414
14460
  let e = s.messages, t = -1;
14415
14461
  for (let n = e.length - 1; n >= 0; n--) if (e[n].role === "user") {
@@ -14430,9 +14476,9 @@ function Lm(e = {}) {
14430
14476
  clearMessages: w,
14431
14477
  stop: T,
14432
14478
  reset: E,
14433
- retry: D,
14479
+ retry: O,
14434
14480
  regenerate: S,
14435
- resolveApproval: ee,
14481
+ resolveApproval: D,
14436
14482
  onScroll: p,
14437
14483
  onWheel: m
14438
14484
  };
@@ -14966,56 +15012,56 @@ function Wm(e = {}) {
14966
15012
  };
14967
15013
  }), x = ri(() => (n.messages.length, typeof e.canUndo == "function" && !!e.canUndo())), S = () => {
14968
15014
  e.onUndo?.() && (n.error = null);
14969
- }, C = (e) => new Date(e).toLocaleTimeString(ce, {
15015
+ }, C = (e) => new Date(e).toLocaleTimeString(se, {
14970
15016
  hour: "2-digit",
14971
15017
  minute: "2-digit"
14972
15018
  }), w = () => {
14973
15019
  let e = T.value;
14974
- !o.value.trim() && !e.length || (r(o.value, O.value, e.length ? [...e] : void 0), o.value = "", T.value = []);
14975
- }, T = /* @__PURE__ */ Ut([]), E = /* @__PURE__ */ Ut(""), ee = /* @__PURE__ */ Ut(!1), D, te = (e) => {
14976
- E.value = e, clearTimeout(D), D = setTimeout(() => {
15020
+ !o.value.trim() && !e.length || (r(o.value, k.value, e.length ? [...e] : void 0), o.value = "", T.value = []);
15021
+ }, T = /* @__PURE__ */ Ut([]), E = /* @__PURE__ */ Ut(""), D = /* @__PURE__ */ Ut(!1), O, ee = (e) => {
15022
+ E.value = e, clearTimeout(O), O = setTimeout(() => {
14977
15023
  E.value = "";
14978
15024
  }, 4e3);
14979
- }, ne = async (e) => {
15025
+ }, te = async (e) => {
14980
15026
  let t = Array.from(e).filter((e) => /^image\//i.test(e.type) || /\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name));
14981
15027
  if (!t.length) return;
14982
15028
  let n = 4 - T.value.length;
14983
15029
  if (n <= 0) {
14984
- te(`${P.imageCountLimitPrefix}4${P.imageCountLimitSuffix}`);
15030
+ ee(`${F.imageCountLimitPrefix}4${F.imageCountLimitSuffix}`);
14985
15031
  return;
14986
15032
  }
14987
- t.length > n && te(`${P.imageCountLimitPrefix}4${P.imageCountLimitSuffix}`), ee.value = !0;
15033
+ t.length > n && ee(`${F.imageCountLimitPrefix}4${F.imageCountLimitSuffix}`), D.value = !0;
14988
15034
  try {
14989
15035
  for (let e of t.slice(0, n)) try {
14990
15036
  let t = await Ei(e, { name: e.name });
14991
15037
  T.value.push(t);
14992
15038
  } catch (e) {
14993
- te(e instanceof hi ? `${e.message}` : P.imageInvalid);
15039
+ ee(e instanceof hi ? `${e.message}` : F.imageInvalid);
14994
15040
  }
14995
15041
  } finally {
14996
- ee.value = !1;
15042
+ D.value = !1;
14997
15043
  }
14998
- }, re = (e) => {
15044
+ }, ne = (e) => {
14999
15045
  T.value = T.value.filter((t) => t.id !== e);
15000
- }, ie = (e) => {
15046
+ }, re = (e) => {
15001
15047
  e.isComposing || e.keyCode === 229 || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), w());
15002
- }, ae = (e) => {
15048
+ }, ie = (e) => {
15003
15049
  o.value = a.value[e] || "", i(e);
15004
- }, oe = (e) => {
15050
+ }, ae = (e) => {
15005
15051
  let t = n.messages, r = t[e];
15006
15052
  if (!r || r.role !== "assistant") return !1;
15007
15053
  let i = "reasoning" in r ? r.reasoning : void 0, a = "steps" in r ? r.steps : void 0;
15008
15054
  return n.loading && e === t.length - 1 && !r.content && !i && !(a && a.length);
15009
- }, O = ri(() => (e.infoTick?.value, e.getFocuses?.() ?? [])), k = ri(() => (e.infoTick?.value, e.getInfo?.()?.planConfirmation)), A = (t) => e.onAddFocus ? e.onAddFocus(t) : {
15055
+ }, k = ri(() => (e.infoTick?.value, e.getFocuses?.() ?? [])), A = ri(() => (e.infoTick?.value, e.getInfo?.()?.planConfirmation)), j = (t) => e.onAddFocus ? e.onAddFocus(t) : {
15010
15056
  ok: !1,
15011
15057
  error: "focus 未启用"
15012
- }, se = (t) => {
15058
+ }, oe = (t) => {
15013
15059
  e.onRemoveFocus?.(t);
15014
- }, j = () => {
15060
+ }, M = () => {
15015
15061
  e.onClearFocus?.();
15016
- }, M = (t) => {
15062
+ }, N = (t) => {
15017
15063
  e.onFocusChipClick?.(t);
15018
- }, N = zm(e.icons), ce = e.locale ?? "zh-CN", P = Hm(ce, e.dialogMessages);
15064
+ }, P = zm(e.icons), se = e.locale ?? "zh-CN", F = Hm(se, e.dialogMessages);
15019
15065
  return {
15020
15066
  chat: t,
15021
15067
  inputText: o,
@@ -15037,23 +15083,23 @@ function Wm(e = {}) {
15037
15083
  undo: S,
15038
15084
  formatTime: C,
15039
15085
  send: w,
15040
- keydown: ie,
15086
+ keydown: re,
15041
15087
  pendingImages: T,
15042
- addImageFiles: ne,
15043
- removePendingImage: re,
15088
+ addImageFiles: te,
15089
+ removePendingImage: ne,
15044
15090
  imageInputError: E,
15045
- compressingImages: ee,
15046
- editQueued: ae,
15047
- isPendingAssistant: oe,
15048
- focuses: O,
15049
- planConfirmation: k,
15050
- addFocus: A,
15051
- removeFocus: se,
15052
- clearFocus: j,
15053
- focusChipClick: M,
15054
- icons: N,
15055
- locale: ce,
15056
- messages: P,
15091
+ compressingImages: D,
15092
+ editQueued: ie,
15093
+ isPendingAssistant: ae,
15094
+ focuses: k,
15095
+ planConfirmation: A,
15096
+ addFocus: j,
15097
+ removeFocus: oe,
15098
+ clearFocus: M,
15099
+ focusChipClick: N,
15100
+ icons: P,
15101
+ locale: se,
15102
+ messages: F,
15057
15103
  toolStepView: e.toolStepView
15058
15104
  };
15059
15105
  }
@@ -15068,4 +15114,4 @@ function Km(e) {
15068
15114
  return Om(e);
15069
15115
  }
15070
15116
  //#endregion
15071
- export { yp as CAPABILITIES, Sp as CONTEXT_PRESETS, kf as CompressDecisionSchema, Fp as DEFAULT_COMPUTED_STYLES, Vc as DEFAULT_PROMPT_SOFT_CAP, gu as DEFAULT_SYSTEM_PROMPT, vd as HTML_VOID_TAGS, jl as HUMAN_CONFIRM_TOOL_NAME, hi as ImageInputError, g as LOW_CAPS_HINT_BASELINE, p as MIN_CONTEXT_WINDOW, Qi as MODEL_UNAVAILABLE_GUIDANCE, Bc as SOFT_CAP_MIN_WINDOW, Pc as STOP_WORDS, Rs as UNSAFE_KEYS, rm as actionsToInspectInfo, nm as actionsToTools, di as agentError, lu as analyzeContext, Zs as applyPatchToClone, ec as applyPatchToLive, od as applyPatchesToBind, Zo as arrayMinLength, ui as asAgentError, uf as buildCollectorJs, Bp as buildCssPath, vu as buildDataPrompt, tf as buildDiagnosticsReport, df as buildSandboxSrcdoc, yu as buildSystemPrompt, Um as chatContextKey, ad as commitSetToBind, _f as composeStructureThenRender, Ei as compressImage, hu as connectMcp, te as constructLlmFromConfig, E as constructOpenLlmSync, Fm as copyText, Vo as createAgent, Al as createApprovalMiddleware, Wm as createChatContext, Km as createChatSdk, Vl as createCheckpointManager, Hl as createCheckpointMiddleware, Hf as createConflictManager, uu as createContextInspectorMiddleware, Cf as createCraftNoteCheck, _d as createDataOps, xf as createHtmlFormatCheck, gf as createHtmlRenderCheck, Tf as createHtmlSubagent, Pl as createHumanConfirmMiddleware, Nl as createHumanConfirmTool, up as createMemoryBackend, Cl as createMemoryMiddleware, u as createProxyLlm, Pm as createRagSubagent, aa as createSandboxRunner, xp as createSdkEvents, bm as createSerialRunner, mp as createSessionStore, hp as createSessionStoreWithBackend, gm as createSkillStore, ml as createSubagentMiddleware, Jc as createSubagentTracker, _l as createSubagentsMiddleware, um as createUsageHintsMiddleware, Wl as createVerifyMiddleware, Cu as createVfs, fp as createWebStorageBackend, Xl as createWriteBackCheck, $i as decorateModelUnavailable, Us as deepClone, om as defineDataToolset, uc as defineSkill, Ef as defineTool, Hs as deleteByPath, Af as deriveTitle, ds as describeSchemaNode, Do as detectGarbledToolCall, ic as diffObjects, Gp as domInfoTool, Kp as domInspectSkill, Wp as domSearchTool, Mp as domToStructure, Pp as domTools, am as domToolsStatic, Qo as elementSchemaCandidates, Rp as ensureDomListenerRecorder, Ic as estimateMessageTokens, Lc as estimateRoundTokens, y as estimateTokens, re as extractReasoningDelta, ws as extractSchemaHint, du as extractText, ne as extractTextDelta, ie as extractUsage, Op as fetchDocTools, im as fetchTools, rc as findStrippedKeys, fs as formatConstraints, oi as formatZodIssues, Q as getByPath, Np as getDomTool, Up as getElementInfo, Yp as getEnvSummary, zp as getRecordedListeners, mf as getSandboxLifecycle, Go as getSchemaAtPath, Ho as getSchemaTopKeys, Ys as hashValue, ys as htmlOrchestratorPrompt, Rc as indexSummarize, Qp as inspectEnvTool, $p as inspectTools, Mf as isChatModel, Xi as isContextLengthError, Zi as isModelUnavailableError, Uo as isPathAllowed, np as isQuotaError, zs as isUnsafePath, ha as jpEval, ci as jsonParseError, qs as limitDepth, _ as lowCapsHint, $d as maskUrlCredentials, Gs as maybeParseValue, qd as measureWriteScale, lf as normalizeRenderResult, oe as normalizeUsage, x as offloadPassThroughChars, b as offloadThresholdChars, vs as presets, as as projectBySchema, is as projectBySchemaDeep, Ks as projectFields, zc as recallRounds, hf as renderInSandbox, ps as renderSchemaHint, ms as renderSchemaOverview, _s as renderSchemaShallow, bp as resolveCapabilities, wp as resolveContextOptions, vp as resolveDialogConfig, Vf as resolveLlm, v as resolveModelCaps, Uc as resolvePromptSoftCap, Jo as resolveSchemaPath, _p as resolveStorage, nc as restoreInPlace, tc as restoreLive, li as routeError, ya as runSandboxedScript, Bs as safeMerge, Jp as safeSerialize, $ as safeStringify, Xo as schemaHasRefinement, Vp as searchDom, _a as searchJson, sm as selectBuiltinTools, Vs as setByPath, Wc as shouldTriggerCompression, nf as stringifyDiagnosticsReport, bs as systemPromptHelpers, h as tableMaxOutputTokens, Fc as tokenize, Z as toolError, Wo as unwrapSchema, Lm as useChat, Gm as useChatContext, Yo as validateAtPath, bd as validateHtmlFormat, rd as validateRootValueLocally, id as validateWriteLocally, Xs as watchFieldsHash, e as z, si as zodError };
15117
+ export { yp as CAPABILITIES, Sp as CONTEXT_PRESETS, kf as CompressDecisionSchema, Fp as DEFAULT_COMPUTED_STYLES, Vc as DEFAULT_PROMPT_SOFT_CAP, gu as DEFAULT_SYSTEM_PROMPT, vd as HTML_VOID_TAGS, jl as HUMAN_CONFIRM_TOOL_NAME, hi as ImageInputError, g as LOW_CAPS_HINT_BASELINE, p as MIN_CONTEXT_WINDOW, Qi as MODEL_UNAVAILABLE_GUIDANCE, Bc as SOFT_CAP_MIN_WINDOW, Pc as STOP_WORDS, Rs as UNSAFE_KEYS, rm as actionsToInspectInfo, nm as actionsToTools, di as agentError, lu as analyzeContext, Zs as applyPatchToClone, ec as applyPatchToLive, od as applyPatchesToBind, Zo as arrayMinLength, ui as asAgentError, uf as buildCollectorJs, Bp as buildCssPath, vu as buildDataPrompt, tf as buildDiagnosticsReport, df as buildSandboxSrcdoc, yu as buildSystemPrompt, Um as chatContextKey, ad as commitSetToBind, _f as composeStructureThenRender, Ei as compressImage, hu as connectMcp, ee as constructLlmFromConfig, E as constructOpenLlmSync, Fm as copyText, Vo as createAgent, Al as createApprovalMiddleware, Wm as createChatContext, Km as createChatSdk, Vl as createCheckpointManager, Hl as createCheckpointMiddleware, Hf as createConflictManager, uu as createContextInspectorMiddleware, Cf as createCraftNoteCheck, _d as createDataOps, xf as createHtmlFormatCheck, gf as createHtmlRenderCheck, Tf as createHtmlSubagent, Pl as createHumanConfirmMiddleware, Nl as createHumanConfirmTool, up as createMemoryBackend, Cl as createMemoryMiddleware, u as createProxyLlm, Pm as createRagSubagent, ia as createSandboxRunner, xp as createSdkEvents, bm as createSerialRunner, mp as createSessionStore, hp as createSessionStoreWithBackend, gm as createSkillStore, ml as createSubagentMiddleware, Jc as createSubagentTracker, _l as createSubagentsMiddleware, um as createUsageHintsMiddleware, Wl as createVerifyMiddleware, Cu as createVfs, fp as createWebStorageBackend, Xl as createWriteBackCheck, $i as decorateModelUnavailable, Us as deepClone, om as defineDataToolset, uc as defineSkill, Ef as defineTool, Hs as deleteByPath, Af as deriveTitle, ds as describeSchemaNode, Do as detectGarbledToolCall, ic as diffObjects, Gp as domInfoTool, Kp as domInspectSkill, Wp as domSearchTool, Mp as domToStructure, Pp as domTools, am as domToolsStatic, Qo as elementSchemaCandidates, Rp as ensureDomListenerRecorder, Ic as estimateMessageTokens, Lc as estimateRoundTokens, y as estimateTokens, ne as extractReasoningDelta, ws as extractSchemaHint, du as extractText, te as extractTextDelta, re as extractUsage, Op as fetchDocTools, im as fetchTools, rc as findStrippedKeys, fs as formatConstraints, oi as formatZodIssues, Q as getByPath, Np as getDomTool, Up as getElementInfo, Yp as getEnvSummary, zp as getRecordedListeners, mf as getSandboxLifecycle, Go as getSchemaAtPath, Ho as getSchemaTopKeys, Ys as hashValue, ys as htmlOrchestratorPrompt, Rc as indexSummarize, Qp as inspectEnvTool, $p as inspectTools, Mf as isChatModel, Xi as isContextLengthError, Zi as isModelUnavailableError, Uo as isPathAllowed, np as isQuotaError, zs as isUnsafePath, ma as jpEval, ci as jsonParseError, qs as limitDepth, _ as lowCapsHint, $d as maskUrlCredentials, Gs as maybeParseValue, qd as measureWriteScale, lf as normalizeRenderResult, ae as normalizeUsage, x as offloadPassThroughChars, b as offloadThresholdChars, vs as presets, as as projectBySchema, is as projectBySchemaDeep, Ks as projectFields, zc as recallRounds, hf as renderInSandbox, ps as renderSchemaHint, ms as renderSchemaOverview, _s as renderSchemaShallow, bp as resolveCapabilities, wp as resolveContextOptions, vp as resolveDialogConfig, Vf as resolveLlm, v as resolveModelCaps, Uc as resolvePromptSoftCap, Jo as resolveSchemaPath, _p as resolveStorage, nc as restoreInPlace, tc as restoreLive, li as routeError, va as runSandboxedScript, Bs as safeMerge, Jp as safeSerialize, $ as safeStringify, Xo as schemaHasRefinement, Vp as searchDom, ga as searchJson, sm as selectBuiltinTools, Vs as setByPath, Wc as shouldTriggerCompression, nf as stringifyDiagnosticsReport, bs as systemPromptHelpers, h as tableMaxOutputTokens, Fc as tokenize, Z as toolError, Wo as unwrapSchema, Lm as useChat, Gm as useChatContext, Yo as validateAtPath, bd as validateHtmlFormat, rd as validateRootValueLocally, id as validateWriteLocally, Xs as watchFieldsHash, e as z, si as zodError };