page-agent-sdk 4.24.5 → 4.25.1

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.
@@ -506,7 +506,7 @@ process.env.NODE_ENV === "production" || Object.freeze([]);
506
506
  var j = () => {}, M = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && (e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97), oe = (e) => e.startsWith("onUpdate:"), N = Object.assign, se = (e, t) => {
507
507
  let n = e.indexOf(t);
508
508
  n > -1 && e.splice(n, 1);
509
- }, P = Object.prototype.hasOwnProperty, F = (e, t) => P.call(e, t), I = Array.isArray, ce = (e) => me(e) === "[object Map]", L = (e) => me(e) === "[object Set]", R = (e) => typeof e == "function", le = (e) => typeof e == "string", ue = (e) => typeof e == "symbol", de = (e) => typeof e == "object" && !!e, fe = (e) => (de(e) || R(e)) && R(e.then) && R(e.catch), pe = Object.prototype.toString, me = (e) => pe.call(e), z = (e) => me(e).slice(8, -1), B = (e) => me(e) === "[object Object]", V = (e) => le(e) && e !== "NaN" && e[0] !== "-" && "" + parseInt(e, 10) === e, he = ((e) => {
509
+ }, P = Object.prototype.hasOwnProperty, F = (e, t) => P.call(e, t), I = Array.isArray, ce = (e) => me(e) === "[object Map]", le = (e) => me(e) === "[object Set]", L = (e) => typeof e == "function", ue = (e) => typeof e == "string", de = (e) => typeof e == "symbol", R = (e) => typeof e == "object" && !!e, fe = (e) => (R(e) || L(e)) && L(e.then) && L(e.catch), pe = Object.prototype.toString, me = (e) => pe.call(e), z = (e) => me(e).slice(8, -1), B = (e) => me(e) === "[object Object]", V = (e) => ue(e) && e !== "NaN" && e[0] !== "-" && "" + parseInt(e, 10) === e, he = ((e) => {
510
510
  let t = /* @__PURE__ */ Object.create(null);
511
511
  return ((n) => t[n] || (t[n] = e(n)));
512
512
  })((e) => e.charAt(0).toUpperCase() + e.slice(1)), ge = (e, t) => !Object.is(e, t), _e = (e, t, n, r = !1) => {
@@ -521,11 +521,11 @@ function H(e) {
521
521
  if (I(e)) {
522
522
  let t = {};
523
523
  for (let n = 0; n < e.length; n++) {
524
- let r = e[n], i = le(r) ? Se(r) : H(r);
524
+ let r = e[n], i = ue(r) ? Se(r) : H(r);
525
525
  if (i) for (let e in i) t[e] = i[e];
526
526
  }
527
527
  return t;
528
- } else if (le(e) || de(e)) return e;
528
+ } else if (ue(e) || R(e)) return e;
529
529
  }
530
530
  var be = /;(?![^(]*\))/g, U = /:([^]+)/, xe = /\/\*[^]*?\*\//g;
531
531
  function Se(e) {
@@ -539,12 +539,12 @@ function Se(e) {
539
539
  }
540
540
  function W(e) {
541
541
  let t = "";
542
- if (le(e)) t = e;
542
+ if (ue(e)) t = e;
543
543
  else if (I(e)) for (let n = 0; n < e.length; n++) {
544
544
  let r = W(e[n]);
545
545
  r && (t += r + " ");
546
546
  }
547
- else if (de(e)) for (let n in e) e[n] && (t += n + " ");
547
+ else if (R(e)) for (let n in e) e[n] && (t += n + " ");
548
548
  return t.trim();
549
549
  }
550
550
  //#endregion
@@ -769,7 +769,7 @@ function et(e, t, n, r, i, a) {
769
769
  if (i && n === "length") {
770
770
  let e = Number(r);
771
771
  o.forEach((t, n) => {
772
- (n === "length" || n === Qe || !ue(n) && n >= e) && s(t);
772
+ (n === "length" || n === Qe || !de(n) && n >= e) && s(t);
773
773
  });
774
774
  } else switch ((n !== void 0 || o.has(void 0)) && s(o.get(n)), a && s(o.get(Qe)), t) {
775
775
  case "add":
@@ -923,9 +923,9 @@ function lt(e, t, n = []) {
923
923
  let r = (/* @__PURE__ */ J(e))[t].apply(e, n);
924
924
  return Ne(), Ue(), r;
925
925
  }
926
- var ut = /* @__PURE__ */ ie("__proto__,__v_isRef,__isVue"), dt = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((e) => e !== "arguments" && e !== "caller").map((e) => Symbol[e]).filter(ue));
926
+ var ut = /* @__PURE__ */ ie("__proto__,__v_isRef,__isVue"), dt = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((e) => e !== "arguments" && e !== "caller").map((e) => Symbol[e]).filter(de));
927
927
  function ft(e) {
928
- ue(e) || (e = String(e));
928
+ de(e) || (e = String(e));
929
929
  let t = /* @__PURE__ */ J(this);
930
930
  return $e(t, "has", e), t.hasOwnProperty(e);
931
931
  }
@@ -947,12 +947,12 @@ var pt = class {
947
947
  if (t === "hasOwnProperty") return ft;
948
948
  }
949
949
  let o = Reflect.get(e, t, /* @__PURE__ */ Wt(e) ? e : n);
950
- if ((ue(t) ? dt.has(t) : ut(t)) || (r || $e(e, "get", t), i)) return o;
950
+ if ((de(t) ? dt.has(t) : ut(t)) || (r || $e(e, "get", t), i)) return o;
951
951
  if (/* @__PURE__ */ Wt(o)) {
952
952
  let e = a && V(t) ? o : o.value;
953
- return r && de(e) ? /* @__PURE__ */ Ft(e) : e;
953
+ return r && R(e) ? /* @__PURE__ */ Ft(e) : e;
954
954
  }
955
- return de(o) ? r ? /* @__PURE__ */ Ft(o) : /* @__PURE__ */ Pt(o) : o;
955
+ return R(o) ? r ? /* @__PURE__ */ Ft(o) : /* @__PURE__ */ Pt(o) : o;
956
956
  }
957
957
  }, mt = class extends pt {
958
958
  constructor(e = !1) {
@@ -973,7 +973,7 @@ var pt = class {
973
973
  }
974
974
  has(e, t) {
975
975
  let n = Reflect.has(e, t);
976
- return (!ue(t) || !dt.has(t)) && $e(e, "has", t), n;
976
+ return (!de(t) || !dt.has(t)) && $e(e, "has", t), n;
977
977
  }
978
978
  ownKeys(e) {
979
979
  return $e(e, "iterate", I(e) ? "length" : Xe), Reflect.ownKeys(e);
@@ -1109,7 +1109,7 @@ function It(e) {
1109
1109
  return Lt(e, !0, vt, Dt, Mt);
1110
1110
  }
1111
1111
  function Lt(e, t, n, r, i) {
1112
- if (!de(e)) return process.env.NODE_ENV !== "production" && Ce(`value cannot be made ${t ? "readonly" : "reactive"}: ${String(e)}`), e;
1112
+ if (!R(e)) return process.env.NODE_ENV !== "production" && Ce(`value cannot be made ${t ? "readonly" : "reactive"}: ${String(e)}`), e;
1113
1113
  if (e.__v_raw && !(t && e.__v_isReactive) || e.__v_skip || !Object.isExtensible(e)) return e;
1114
1114
  let a = i.get(e);
1115
1115
  if (a) return a;
@@ -1142,7 +1142,7 @@ function J(e) {
1142
1142
  function Vt(e) {
1143
1143
  return !F(e, "__v_skip") && Object.isExtensible(e) && _e(e, "__v_skip", !0), e;
1144
1144
  }
1145
- var Ht = (e) => de(e) ? /* @__PURE__ */ Pt(e) : e, Ut = (e) => de(e) ? /* @__PURE__ */ Ft(e) : e;
1145
+ var Ht = (e) => R(e) ? /* @__PURE__ */ Pt(e) : e, Ut = (e) => R(e) ? /* @__PURE__ */ Ft(e) : e;
1146
1146
  // @__NO_SIDE_EFFECTS__
1147
1147
  function Wt(e) {
1148
1148
  return e ? e.__v_isRef === !0 : !1;
@@ -1224,7 +1224,7 @@ var Qt = class {
1224
1224
  // @__NO_SIDE_EFFECTS__
1225
1225
  function $t(e, t, n = !1) {
1226
1226
  let r, i;
1227
- R(e) ? r = e : (r = e.get, i = e.set);
1227
+ L(e) ? r = e : (r = e.get, i = e.set);
1228
1228
  let a = new Qt(r, i, n);
1229
1229
  return process.env.NODE_ENV !== "production" && t && !n && (a.onTrack = t.onTrack, a.onTrigger = t.onTrigger), a;
1230
1230
  }
@@ -1242,9 +1242,9 @@ function an(e, t, n = ae) {
1242
1242
  if (/* @__PURE__ */ Wt(e) ? (f = () => e.value, h = /* @__PURE__ */ q(e)) : /* @__PURE__ */ Rt(e) ? (f = () => u(e), h = !0) : I(e) ? (g = !0, h = e.some((e) => /* @__PURE__ */ Rt(e) || /* @__PURE__ */ q(e)), f = () => e.map((e) => {
1243
1243
  if (/* @__PURE__ */ Wt(e)) return e.value;
1244
1244
  if (/* @__PURE__ */ Rt(e)) return u(e);
1245
- if (R(e)) return c ? c(e, 2) : e();
1245
+ if (L(e)) return c ? c(e, 2) : e();
1246
1246
  process.env.NODE_ENV !== "production" && l(e);
1247
- })) : R(e) ? f = t ? c ? () => c(e, 2) : e : () => {
1247
+ })) : L(e) ? f = t ? c ? () => c(e, 2) : e : () => {
1248
1248
  if (p) {
1249
1249
  He();
1250
1250
  try {
@@ -1304,10 +1304,10 @@ function an(e, t, n = ae) {
1304
1304
  }, process.env.NODE_ENV !== "production" && (d.onTrack = n.onTrack, d.onTrigger = n.onTrigger), t ? r ? b(!0) : y = d.run() : o ? o(b.bind(null, !0), !0) : d.run(), v.pause = d.pause.bind(d), v.resume = d.resume.bind(d), v.stop = v, v;
1305
1305
  }
1306
1306
  function on(e, t = Infinity, n) {
1307
- if (t <= 0 || !de(e) || e.__v_skip || (n ||= /* @__PURE__ */ new Map(), (n.get(e) || 0) >= t)) return e;
1307
+ if (t <= 0 || !R(e) || e.__v_skip || (n ||= /* @__PURE__ */ new Map(), (n.get(e) || 0) >= t)) return e;
1308
1308
  if (n.set(e, t), t--, /* @__PURE__ */ Wt(e)) on(e.value, t, n);
1309
1309
  else if (I(e)) for (let r = 0; r < e.length; r++) on(e[r], t, n);
1310
- else if (L(e) || ce(e)) e.forEach((e) => {
1310
+ else if (le(e) || ce(e)) e.forEach((e) => {
1311
1311
  on(e, t, n);
1312
1312
  });
1313
1313
  else if (B(e)) {
@@ -1378,11 +1378,11 @@ function mn(e) {
1378
1378
  }), n.length > 3 && t.push(" ..."), t;
1379
1379
  }
1380
1380
  function hn(e, t, n) {
1381
- return le(t) ? (t = JSON.stringify(t), n ? t : [`${e}=${t}`]) : typeof t == "number" || typeof t == "boolean" || t == null ? n ? t : [`${e}=${t}`] : /* @__PURE__ */ Wt(t) ? (t = hn(e, /* @__PURE__ */ J(t.value), !0), n ? t : [
1381
+ return ue(t) ? (t = JSON.stringify(t), n ? t : [`${e}=${t}`]) : typeof t == "number" || typeof t == "boolean" || t == null ? n ? t : [`${e}=${t}`] : /* @__PURE__ */ Wt(t) ? (t = hn(e, /* @__PURE__ */ J(t.value), !0), n ? t : [
1382
1382
  `${e}=Ref<`,
1383
1383
  t,
1384
1384
  ">"
1385
- ]) : R(t) ? [`${e}=fn${t.name ? `<${t.name}>` : ""}`] : (t = /* @__PURE__ */ J(t), n ? t : [`${e}=`, t]);
1385
+ ]) : L(t) ? [`${e}=fn${t.name ? `<${t.name}>` : ""}`] : (t = /* @__PURE__ */ J(t), n ? t : [`${e}=`, t]);
1386
1386
  }
1387
1387
  var gn = {
1388
1388
  sp: "serverPrefetch hook",
@@ -1425,7 +1425,7 @@ function _n(e, t, n, r) {
1425
1425
  }
1426
1426
  }
1427
1427
  function vn(e, t, n, r) {
1428
- if (R(e)) {
1428
+ if (L(e)) {
1429
1429
  let i = _n(e, t, n, r);
1430
1430
  return i && fe(i) && i.catch((e) => {
1431
1431
  yn(e, t, n);
@@ -1598,7 +1598,7 @@ function Zn(e, t, n = !1) {
1598
1598
  if (r || Sr) {
1599
1599
  let i = Sr ? Sr._context.provides : r ? r.parent == null || r.ce ? r.vnode.appContext && r.vnode.appContext.provides : r.parent.provides : void 0;
1600
1600
  if (i && e in i) return i[e];
1601
- if (arguments.length > 1) return n && R(t) ? t.call(r && r.proxy) : t;
1601
+ if (arguments.length > 1) return n && L(t) ? t.call(r && r.proxy) : t;
1602
1602
  process.env.NODE_ENV !== "production" && dn(`injection "${String(e)}" not found.`);
1603
1603
  } else process.env.NODE_ENV !== "production" && dn("inject() can only be used inside setup() or functional components.");
1604
1604
  }
@@ -1637,8 +1637,8 @@ function er(e, t, n = ae) {
1637
1637
  return Xr && (l ? l.push(f) : c && f()), f;
1638
1638
  }
1639
1639
  function tr(e, t, n) {
1640
- let r = this.proxy, i = le(e) ? e.includes(".") ? nr(r, e) : () => r[e] : e.bind(r, r), a;
1641
- R(t) ? a = t : (a = t.handler, n = t);
1640
+ let r = this.proxy, i = ue(e) ? e.includes(".") ? nr(r, e) : () => r[e] : e.bind(r, r), a;
1641
+ L(t) ? a = t : (a = t.handler, n = t);
1642
1642
  let o = Jr(this), s = er(i, a.bind(r), n);
1643
1643
  return o(), s;
1644
1644
  }
@@ -1722,7 +1722,7 @@ function ur(e) {
1722
1722
  var dr = !0;
1723
1723
  function fr(e) {
1724
1724
  let t = e.type, { mixins: n, extends: r } = t, { mixins: i, optionsCache: a, config: { optionMergeStrategies: o } } = e.appContext, s = a.get(t), c;
1725
- return s ? c = s : !i.length && !n && !r ? c = t : (c = {}, i.length && i.forEach((e) => pr(c, e, o, !0)), pr(c, t, o)), de(t) && a.set(t, c), c;
1725
+ return s ? c = s : !i.length && !n && !r ? c = t : (c = {}, i.length && i.forEach((e) => pr(c, e, o, !0)), pr(c, t, o)), R(t) && a.set(t, c), c;
1726
1726
  }
1727
1727
  function pr(e, t, n, r = !1) {
1728
1728
  let { mixins: i, extends: a } = t;
@@ -1762,7 +1762,7 @@ var mr = {
1762
1762
  };
1763
1763
  function hr(e, t) {
1764
1764
  return t ? e ? function() {
1765
- return N(R(e) ? e.call(this, this) : e, R(t) ? t.call(this, this) : t);
1765
+ return N(L(e) ? e.call(this, this) : e, L(t) ? t.call(this, this) : t);
1766
1766
  } : t : e;
1767
1767
  }
1768
1768
  function gr(e, t) {
@@ -1800,7 +1800,7 @@ var Or = /* @__PURE__ */ Symbol.for("v-fgt"), kr = /* @__PURE__ */ Symbol.for("v
1800
1800
  function jr(e) {
1801
1801
  return e ? e.__v_isVNode === !0 : !1;
1802
1802
  }
1803
- var Mr, Nr = (...e) => Rr(...Mr ? Mr(e, Yn) : e), Pr = ({ key: e }) => e ?? null, Fr = ({ ref: e, ref_key: t, ref_for: n }) => (typeof e == "number" && (e = "" + e), e == null ? null : le(e) || /* @__PURE__ */ Wt(e) || R(e) ? {
1803
+ var Mr, Nr = (...e) => Rr(...Mr ? Mr(e, Yn) : e), Pr = ({ key: e }) => e ?? null, Fr = ({ ref: e, ref_key: t, ref_for: n }) => (typeof e == "number" && (e = "" + e), e == null ? null : ue(e) || /* @__PURE__ */ Wt(e) || L(e) ? {
1804
1804
  i: Yn,
1805
1805
  r: e,
1806
1806
  k: t,
@@ -1836,7 +1836,7 @@ function Ir(e, t = null, n = null, r = 0, i = null, a = e === Or ? 0 : 1, o = !1
1836
1836
  appContext: null,
1837
1837
  ctx: Yn
1838
1838
  };
1839
- return s ? (Ur(c, n), a & 128 && e.normalize(c)) : n && (c.shapeFlag |= le(n) ? 8 : 16), process.env.NODE_ENV !== "production" && c.key !== c.key && dn("VNode created with invalid key (NaN). VNode type:", c.type), c;
1839
+ return s ? (Ur(c, n), a & 128 && e.normalize(c)) : n && (c.shapeFlag |= ue(n) ? 8 : 16), process.env.NODE_ENV !== "production" && c.key !== c.key && dn("VNode created with invalid key (NaN). VNode type:", c.type), c;
1840
1840
  }
1841
1841
  var Lr = process.env.NODE_ENV === "production" ? Rr : Nr;
1842
1842
  function Rr(e, t = null, n = null, r = 0, i = null, a = !1) {
@@ -1847,9 +1847,9 @@ function Rr(e, t = null, n = null, r = 0, i = null, a = !1) {
1847
1847
  if (ni(e) && (e = e.__vccOpts), t) {
1848
1848
  t = zr(t);
1849
1849
  let { class: e, style: n } = t;
1850
- e && !le(e) && (t.class = W(e)), de(n) && (/* @__PURE__ */ Bt(n) && !I(n) && (n = N({}, n)), t.style = H(n));
1850
+ e && !ue(e) && (t.class = W(e)), R(n) && (/* @__PURE__ */ Bt(n) && !I(n) && (n = N({}, n)), t.style = H(n));
1851
1851
  }
1852
- let o = le(e) ? 1 : Er(e) ? 128 : rr(e) ? 64 : de(e) ? 4 : R(e) ? 2 : 0;
1852
+ let o = ue(e) ? 1 : Er(e) ? 128 : rr(e) ? 64 : R(e) ? 4 : L(e) ? 2 : 0;
1853
1853
  return process.env.NODE_ENV !== "production" && o & 4 && /* @__PURE__ */ Bt(e) && (e = /* @__PURE__ */ J(e), dn("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.", "\nComponent that was made reactive: ", e)), Ir(e, t, n, r, i, o, a, !0);
1854
1854
  }
1855
1855
  function zr(e) {
@@ -1905,7 +1905,7 @@ function Ur(e, t) {
1905
1905
  n && (n._c && (n._d = !1), Ur(e, n()), n._c && (n._d = !0));
1906
1906
  return;
1907
1907
  } else n = 32, !t._ && !wr(t) && (t._ctx = Yn);
1908
- else if (R(t)) {
1908
+ else if (L(t)) {
1909
1909
  if (r & 65) {
1910
1910
  Ur(e, { default: t });
1911
1911
  return;
@@ -1964,7 +1964,7 @@ function Zr(e) {
1964
1964
  }
1965
1965
  var Qr = /(?:^|[-_])\w/g, $r = (e) => e.replace(Qr, (e) => e.toUpperCase()).replace(/[-_]/g, "");
1966
1966
  function ei(e, t = !0) {
1967
- return R(e) ? e.displayName || e.name : e.name || t && e.__name;
1967
+ return L(e) ? e.displayName || e.name : e.name || t && e.__name;
1968
1968
  }
1969
1969
  function ti(e, t, n = !1) {
1970
1970
  let r = ei(t);
@@ -1981,7 +1981,7 @@ function ti(e, t, n = !1) {
1981
1981
  return r ? $r(r) : n ? "App" : "Anonymous";
1982
1982
  }
1983
1983
  function ni(e) {
1984
- return R(e) && "__vccOpts" in e;
1984
+ return L(e) && "__vccOpts" in e;
1985
1985
  }
1986
1986
  var ri = (e, t) => {
1987
1987
  let n = /* @__PURE__ */ $t(e, t, Xr);
@@ -1996,7 +1996,7 @@ function ii() {
1996
1996
  let e = { style: "color:#3ba776" }, t = { style: "color:#1677ff" }, n = { style: "color:#f5222d" }, r = { style: "color:#eb2f96" }, i = {
1997
1997
  __vue_custom_formatter: !0,
1998
1998
  header(t) {
1999
- if (!de(t)) return null;
1999
+ if (!R(t)) return null;
2000
2000
  if (t.__isVue) return [
2001
2001
  "div",
2002
2002
  e,
@@ -2109,7 +2109,7 @@ function ii() {
2109
2109
  "span",
2110
2110
  r,
2111
2111
  e
2112
- ] : de(e) ? ["object", { object: i ? /* @__PURE__ */ J(e) : e }] : [
2112
+ ] : R(e) ? ["object", { object: i ? /* @__PURE__ */ J(e) : e }] : [
2113
2113
  "span",
2114
2114
  n,
2115
2115
  String(e)
@@ -2117,14 +2117,14 @@ function ii() {
2117
2117
  }
2118
2118
  function c(e, t) {
2119
2119
  let n = e.type;
2120
- if (R(n)) return;
2120
+ if (L(n)) return;
2121
2121
  let r = {};
2122
2122
  for (let i in e.ctx) l(n, i, t) && (r[i] = e.ctx[i]);
2123
2123
  return r;
2124
2124
  }
2125
2125
  function l(e, t, n) {
2126
2126
  let r = e[n];
2127
- if (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;
2127
+ if (I(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;
2128
2128
  }
2129
2129
  function u(e) {
2130
2130
  return /* @__PURE__ */ q(e) ? "ShallowRef" : e.effect ? "ComputedRef" : "Ref";
@@ -4013,17 +4013,17 @@ function Fs(e) {
4013
4013
  function ce(e) {
4014
4014
  se = e, F = b(se.contextWindow), I = x(se.contextWindow);
4015
4015
  }
4016
- let L = /* @__PURE__ */ Y([]), R = 0, le = () => ({
4016
+ let le = /* @__PURE__ */ Y([]), L = 0, ue = () => ({
4017
4017
  retries: 0,
4018
4018
  exhausted: 0
4019
- }), ue = {
4020
- transitional_retry: le(),
4021
- completion_gate: le(),
4022
- evidence_audit_gate: le(),
4023
- zero_tool_gate: le(),
4024
- status_query_gate: le(),
4025
- ...e.pageAssertionGate === !0 ? { page_assertion_gate: le() } : {}
4026
- }, de = {
4019
+ }), de = {
4020
+ transitional_retry: ue(),
4021
+ completion_gate: ue(),
4022
+ evidence_audit_gate: ue(),
4023
+ zero_tool_gate: ue(),
4024
+ status_query_gate: ue(),
4025
+ ...e.pageAssertionGate === !0 ? { page_assertion_gate: ue() } : {}
4026
+ }, R = {
4027
4027
  ZERO_TOOL_GATE_EXHAUSTED: "zero_tool_gate",
4028
4028
  AUDIT_GATE_EXHAUSTED: "evidence_audit_gate",
4029
4029
  COMPLETION_GATE_EXHAUSTED: "completion_gate",
@@ -4035,14 +4035,14 @@ function Fs(e) {
4035
4035
  type: e,
4036
4036
  data: ks(t)
4037
4037
  };
4038
- L.value.push(n), L.value.length > Ts && L.value.splice(0, L.value.length - Ts), Jt(L), ie?.(n), oe && console.log(`%c[Agent] ${e}`, "color:#667eea;font-weight:bold", t);
4038
+ le.value.push(n), le.value.length > Ts && le.value.splice(0, le.value.length - Ts), Jt(le), ie?.(n), oe && console.log(`%c[Agent] ${e}`, "color:#667eea;font-weight:bold", t);
4039
4039
  }
4040
4040
  let V = (e) => {
4041
- L.value.push({
4041
+ le.value.push({
4042
4042
  ...e,
4043
4043
  timestamp: typeof e.timestamp == "number" ? e.timestamp : Date.now(),
4044
4044
  data: ks(e.data)
4045
- }), L.value.length > Ts && L.value.splice(0, L.value.length - Ts), Jt(L);
4045
+ }), le.value.length > Ts && le.value.splice(0, le.value.length - Ts), Jt(le);
4046
4046
  }, he = [...h.flatMap((e) => e.tools || []), ...m], ge = e.llm ?? new n({
4047
4047
  apiKey: t,
4048
4048
  model: c,
@@ -4407,8 +4407,8 @@ function Fs(e) {
4407
4407
  }])), v = /* @__PURE__ */ new Map(), b = 0, x = (e) => {
4408
4408
  let t = he.find((t) => t.name === e);
4409
4409
  return t && "writeCapable" in t ? typeof t.writeCapable == "function" || t.writeCapable === !0 : Ns.has(e);
4410
- }, S = 0, C = 0, w = js(N, _), T = null, E = 0, D = !1, O = !1;
4411
- for (; (S < N || O) && C < w && (C++, !r?.aborted);) {
4410
+ }, S = 0, C = 0, w = js(N, _), T = null, E = 0, D = !1, O = !1, ee = !1;
4411
+ for (; (S < N || ee) && C < w && (C++, !r?.aborted);) {
4412
4412
  if (A > 0 && d.invokeUsage.total_tokens > A) {
4413
4413
  let e = `本轮 token 预算(约 ${A})已用尽:任务在 ${S} 轮工具调用后中断,已完成的部分均保留。可继续对话,指定下一步(如「继续完成」/「只改 X」/「提高预算重试」)。`;
4414
4414
  return B("error", {
@@ -4461,7 +4461,7 @@ function Fs(e) {
4461
4461
  {
4462
4462
  let e = t.message?.response_metadata ?? t.message?.responseMetadata, n = e?.stop_reason ?? e?.finish_reason, r = re(t.message);
4463
4463
  if ((n === "length" || !t.content && (r?.completion_tokens ?? 0) >= 4e3) && !D) {
4464
- D = !0, O = !0, B("error", {
4464
+ D = !0, ee = !0, B("error", {
4465
4465
  stage: "completion_truncated_retry",
4466
4466
  completionTokens: r?.completion_tokens,
4467
4467
  stopReason: n ?? null,
@@ -4470,6 +4470,15 @@ function Fs(e) {
4470
4470
  }), c.push(new i("⚠️ 你上一轮输出为空(疑似被 max_tokens 截断:单次输出过长,常见于把完整大段代码塞进一次工具调用参数)。必须改用分块输出,不要一次性输出完整大段内容:① 先写小体积骨架 —— 大 code 场景先 write 组件、code 字段只含开头一小段(≤800 字符);② 用增量追加逐块补全 —— write({ patch:{ op:\"append\", jsonPath:\"<该组件 code 的路径>\", value:\"<后续代码块,每段 ≤1500 字符>\" } })(append 对字符串是尾接,可连续多次直至完整);③ 已写入部分勿在后续调用重传全文。其他大内容同理:先骨架后增量。"));
4471
4471
  continue;
4472
4472
  }
4473
+ if (!t.content && (r?.reasoning_tokens ?? 0) > 0 && !O) {
4474
+ O = !0, ee = !0, B("error", {
4475
+ stage: "reasoning_exhausted_retry",
4476
+ completionTokens: r?.completion_tokens ?? null,
4477
+ reasoningTokens: r?.reasoning_tokens ?? null,
4478
+ hint: "空输出且 completion 全为 reasoning,疑似思考耗尽未答;回灌直接作答"
4479
+ }), c.push(new i("⚠️ 你上一轮把全部输出都花在了思考(reasoning)上,没有产出任何正文,用户看到的是空回复。请直接输出对用户问题的回答正文;可以有少量必要思考,但本轮必须给出正文。"));
4480
+ continue;
4481
+ }
4473
4482
  }
4474
4483
  let r = vs(t.content), a = r ? Ss(t.content) : null;
4475
4484
  if (a && a.length) {
@@ -4487,7 +4496,7 @@ function Fs(e) {
4487
4496
  });
4488
4497
  } else {
4489
4498
  if (r && E < 2) {
4490
- E += 1, O = !0, B("middleware", {
4499
+ E += 1, ee = !0, B("middleware", {
4491
4500
  stage: "format_retry",
4492
4501
  attempt: E,
4493
4502
  content: t.content.slice(0, 200)
@@ -4522,8 +4531,8 @@ function Fs(e) {
4522
4531
  deferredWriteTools: e.deferredWriteTools
4523
4532
  });
4524
4533
  if (a?.kind === "feedback") {
4525
- O = !0;
4526
- let e = ue[a.gate.stage];
4534
+ ee = !0;
4535
+ let e = de[a.gate.stage];
4527
4536
  e && (e.retries += 1), B("middleware", {
4528
4537
  stage: a.gate.stage,
4529
4538
  attempt: a.gate.attempt,
@@ -4533,8 +4542,8 @@ function Fs(e) {
4533
4542
  continue;
4534
4543
  }
4535
4544
  if (a?.kind === "observable") {
4536
- let e = de[a.obs.code];
4537
- e && ue[e] && (ue[e].exhausted += 1), B("error", {
4545
+ let e = R[a.obs.code];
4546
+ e && de[e] && (de[e].exhausted += 1), B("error", {
4538
4547
  stage: a.obs.code,
4539
4548
  ...a.obs.context,
4540
4549
  content: t.content.slice(0, 160)
@@ -4562,7 +4571,7 @@ function Fs(e) {
4562
4571
  continue;
4563
4572
  }
4564
4573
  }
4565
- O = !1;
4574
+ ee = !1;
4566
4575
  let o = t.content;
4567
4576
  if (r) {
4568
4577
  let e = ys(o);
@@ -4574,7 +4583,7 @@ function Fs(e) {
4574
4583
  }), o;
4575
4584
  }
4576
4585
  }
4577
- O = !1;
4586
+ ee = !1;
4578
4587
  let s = t.toolCalls, p = s.map((e) => {
4579
4588
  let t = e.id || `call_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
4580
4589
  return {
@@ -4689,7 +4698,7 @@ function Fs(e) {
4689
4698
  round: S + 1,
4690
4699
  maxParallelTools: k
4691
4700
  });
4692
- e.invalidatedCount > 0 && (c = e.messages, R += e.invalidatedCount, B("middleware", {
4701
+ e.invalidatedCount > 0 && (c = e.messages, L += e.invalidatedCount, B("middleware", {
4693
4702
  stage: "stale_read_invalidated",
4694
4703
  round: S + 1,
4695
4704
  writtenPaths: y.map((e) => Ps(e.args) || "(整体)"),
@@ -4703,7 +4712,7 @@ function Fs(e) {
4703
4712
  type: "done",
4704
4713
  content: ""
4705
4714
  }), "";
4706
- let ee = `\n\n(提示:工具调用次数已达上限(${N} 轮 / ${w} 次迭代),以上为基于已完成操作的阶段性结果,任务可能未完成。回复「继续」或告诉我下一步重点,即可接着做。)`;
4715
+ let te = `\n\n(提示:工具调用次数已达上限(${N} 轮 / ${w} 次迭代),以上为基于已完成操作的阶段性结果,任务可能未完成。回复「继续」或告诉我下一步重点,即可接着做。)`;
4707
4716
  B("error", {
4708
4717
  stage: "react_call_limit_exceeded",
4709
4718
  rounds: S,
@@ -4722,10 +4731,10 @@ function Fs(e) {
4722
4731
  maxIterations: w
4723
4732
  }
4724
4733
  });
4725
- let te = ss(H.todos ?? [], g, z);
4726
- if (te.length) {
4727
- ue.evidence_audit_gate.exhausted += 1;
4728
- let e = te.map((e) => ({
4734
+ let ie = ss(H.todos ?? [], g, z);
4735
+ if (ie.length) {
4736
+ de.evidence_audit_gate.exhausted += 1;
4737
+ let e = ie.map((e) => ({
4729
4738
  id: e.id,
4730
4739
  evidence: e.evidence
4731
4740
  }));
@@ -4734,21 +4743,21 @@ function Fs(e) {
4734
4743
  offenders: e
4735
4744
  }), n({
4736
4745
  type: "error",
4737
- message: `轮次耗尽收口:${te.length} 项已完成任务的 evidence 路径与写入记录不符,最终回复中的完成声明可能不实`,
4746
+ message: `轮次耗尽收口:${ie.length} 项已完成任务的 evidence 路径与写入记录不符,最终回复中的完成声明可能不实`,
4738
4747
  severity: "observable",
4739
4748
  code: "AUDIT_EVIDENCE_SUSPECT",
4740
4749
  context: { offenders: e }
4741
4750
  });
4742
4751
  }
4743
4752
  if (T != null) {
4744
- let e = T + ee;
4753
+ let e = T + te;
4745
4754
  return n({
4746
4755
  type: "done",
4747
4756
  content: e
4748
4757
  }), e;
4749
4758
  }
4750
- let ie = c[c.length - 1];
4751
- if (ie && Te(ie) === "tool") {
4759
+ let ae = c[c.length - 1];
4760
+ if (ae && Te(ae) === "tool") {
4752
4761
  let e = c[0] && Te(c[0]) === "system" ? c.slice(1) : c.slice(), t = [new a(xe() + "\n\n工具调用次数已达上限,请基于已有工具结果直接给出最终回答,不要再调用工具。"), ...e];
4753
4762
  B("llm_request", {
4754
4763
  round: "wrap_up",
@@ -4784,15 +4793,15 @@ function Fs(e) {
4784
4793
  }
4785
4794
  return n({
4786
4795
  type: "done",
4787
- content: e + ee
4788
- }), e + ee;
4796
+ content: e + te
4797
+ }), e + te;
4789
4798
  }
4790
4799
  }
4791
- let ae = "我已完成本轮能做的操作,但未能综合出最终结论。请基于上方已完成的工具操作结果继续,或告诉我下一步重点。";
4800
+ let j = "我已完成本轮能做的操作,但未能综合出最终结论。请基于上方已完成的工具操作结果继续,或告诉我下一步重点。";
4792
4801
  return n({
4793
4802
  type: "done",
4794
- content: ae + ee
4795
- }), ae + ee;
4803
+ content: j + te
4804
+ }), j + te;
4796
4805
  } finally {
4797
4806
  try {
4798
4807
  await ms(h, H);
@@ -4821,19 +4830,19 @@ function Fs(e) {
4821
4830
  get allTools() {
4822
4831
  return he;
4823
4832
  },
4824
- getStaleReadsInvalidated: () => R,
4833
+ getStaleReadsInvalidated: () => L,
4825
4834
  getLlmRetries: () => pe,
4826
4835
  getLlmCallFailures: () => me,
4827
- getGateStats: () => ue,
4836
+ getGateStats: () => de,
4828
4837
  getLastSystemSegments: () => fe,
4829
4838
  resetSessionCounters: () => {
4830
- R = 0, pe = 0, me = 0;
4831
- for (let e of Object.keys(ue)) ue[e] = le();
4839
+ L = 0, pe = 0, me = 0;
4840
+ for (let e of Object.keys(de)) de[e] = ue();
4832
4841
  },
4833
4842
  setTools: ke,
4834
4843
  setLlm: Ae,
4835
4844
  setModelCaps: ce,
4836
- debugLogs: L,
4845
+ debugLogs: le,
4837
4846
  getEffectiveSystemPrompt: () => xe()
4838
4847
  };
4839
4848
  }
@@ -8625,8 +8634,20 @@ function $d(e, t) {
8625
8634
  //#region src/core/tools/dataOps.ts
8626
8635
  function ef(e, t) {
8627
8636
  if (!e) return null;
8628
- let n = (t ? zs(e, t) : e)?.shape;
8629
- return n && typeof n == "object" ? Object.keys(n) : null;
8637
+ let n = t ? zs(e, t) : e;
8638
+ if (!n) return null;
8639
+ let r = n?.shape;
8640
+ if (r && typeof r == "object") return Object.keys(r);
8641
+ let i = n?.options;
8642
+ if (Array.isArray(i)) {
8643
+ let e = /* @__PURE__ */ new Set();
8644
+ for (let t of i) {
8645
+ let n = t?.shape;
8646
+ if (n && typeof n == "object") for (let t of Object.keys(n)) e.add(t);
8647
+ }
8648
+ return e.size ? [...e] : null;
8649
+ }
8650
+ return null;
8630
8651
  }
8631
8652
  var tf = (e) => e && e.length ? `(可用字段:${e.slice(0, 12).join(", ")}${e.length > 12 ? " …" : ""})` : "", nf = (e) => /[.[]/.test(e) ? e.replace(/[.[][^.[]*$/, "") : "";
8632
8653
  function rf(e) {
@@ -8701,7 +8722,7 @@ function rf(e) {
8701
8722
  error: Z({
8702
8723
  code: "SCHEMA_STRIP",
8703
8724
  message: `字段 ${s.join(", ")} 不在 schema 声明内,写入被拒绝(防静默丢失)`,
8704
- hint: "该数据结构不支持这些字段;请只用 schema 声明的字段,或在 data.schema 中声明后重试",
8725
+ hint: `该数据结构不支持这些字段;请只用 schema 声明的字段,或在 data.schema 中声明后重试${tf(ef(t, nf(String(s[0]))))}`,
8705
8726
  path: s[0],
8706
8727
  details: { stripped: s }
8707
8728
  }),
@@ -8742,7 +8763,7 @@ function af(e) {
8742
8763
  }, f = (e) => Z({
8743
8764
  code: "SCHEMA_STRIP",
8744
8765
  message: `字段 ${e.join(", ")} 不在 schema 声明内,写入被拒绝(防静默丢失)`,
8745
- hint: "该数据结构不支持这些字段;请只用 schema 声明的字段,或在 data.schema 中声明后重试",
8766
+ hint: `该数据结构不支持这些字段;请只用 schema 声明的字段,或在 data.schema 中声明后重试${tf(ef(t, nf(String(e[0]))))}`,
8746
8767
  path: e[0],
8747
8768
  details: { stripped: e }
8748
8769
  }), p = [];
@@ -9677,7 +9698,7 @@ function vf(e, n = {}) {
9677
9698
  jsonPath: t.string().optional().describe("只看快照的某子路径"),
9678
9699
  list: t.boolean().optional().describe("true 列出快照时间线(序号/操作/标签/时间/大小)")
9679
9700
  })
9680
- }), L = s(async ({ expr: e, queries: t, limit: n }, r) => {
9701
+ }), le = s(async ({ expr: e, queries: t, limit: n }, r) => {
9681
9702
  let i = b(r);
9682
9703
  if (typeof c != "object" || !c) return Z({
9683
9704
  code: "NOT_OBJECT",
@@ -9720,7 +9741,7 @@ function vf(e, n = {}) {
9720
9741
  queries: t.array(t.string()).min(2).max(10).optional().describe("批量模式:2-10 条 JSONPath 一次取回(与 expr 同传按 queries);逐条独立返回,单条失败该项标 error 不整批"),
9721
9742
  limit: t.number().int().min(1).max(200).optional().describe("返回结果上限(批量时逐条适用),默认 50")
9722
9743
  })
9723
- }), R = s(async ({ query: e, mode: t, fuzzyThreshold: n, matchKey: r, limit: i }) => {
9744
+ }), L = s(async ({ query: e, mode: t, fuzzyThreshold: n, matchKey: r, limit: i }) => {
9724
9745
  if (c == null) return Z({
9725
9746
  code: "EMPTY",
9726
9747
  message: "主数据为空,无可搜索内容"
@@ -9758,7 +9779,7 @@ function vf(e, n = {}) {
9758
9779
  matchKey: t.boolean().optional().describe("是否同时匹配 key 名,默认 true"),
9759
9780
  limit: t.number().int().min(1).max(200).optional().describe("返回上限,默认 50")
9760
9781
  })
9761
- }), le = s(async ({ script: e, mode: t, jsonPath: n }, r) => {
9782
+ }), ue = s(async ({ script: e, mode: t, jsonPath: n }, r) => {
9762
9783
  let s = b(r);
9763
9784
  if (e.length > 8e3) return Z({
9764
9785
  code: "SCRIPT_TOO_LARGE",
@@ -9914,8 +9935,8 @@ function vf(e, n = {}) {
9914
9935
  jsonPath: t.string().optional().describe("子树模式:仅对该子树执行;transform 返回值作为子树新值")
9915
9936
  })
9916
9937
  });
9917
- F(le, (e) => e?.mode === "transform");
9918
- let ue = s(async ({ jsonPath: e, jsonPaths: t, fields: n, depth: r, offset: i, limit: a }, s) => {
9938
+ F(ue, (e) => e?.mode === "transform");
9939
+ let de = s(async ({ jsonPath: e, jsonPaths: t, fields: n, depth: r, offset: i, limit: a }, s) => {
9919
9940
  let c = b(s), f = x(s), p = l(), m, g = () => m ??= k();
9920
9941
  if (t && t.length) {
9921
9942
  let e = !1, i = t.map((t) => {
@@ -10005,7 +10026,7 @@ function vf(e, n = {}) {
10005
10026
  offset: t.number().int().min(0).optional().describe("数组分页起始偏移(仅数组目标,默认 0)"),
10006
10027
  limit: t.number().int().min(1).max(200).optional().describe("数组分页每页条数(默认 50,上限 200),返回切片+total/hasMore")
10007
10028
  })
10008
- }), de = s(async ({ value: e, patch: t, patches: n, del: i, dryRun: s }, u) => {
10029
+ }), R = s(async ({ value: e, patch: t, patches: n, del: i, dryRun: s }, u) => {
10009
10030
  let f = b(u), p = "set";
10010
10031
  i ? p = "delete" : (n && n.length || t) && (p = "edit");
10011
10032
  let m = t?.value === void 0 ? e : t.value, v = await A();
@@ -10151,7 +10172,7 @@ function vf(e, n = {}) {
10151
10172
  dryRun: t.boolean().optional().describe("预检:走完整校验链但不落盘不入快照;冲突返回 VERSION_CONFLICT 不挂起")
10152
10173
  })
10153
10174
  });
10154
- F(de);
10175
+ F(R);
10155
10176
  let fe = s(async ({ jsonPath: e }) => {
10156
10177
  let t = e || "", n = t ? zs(o, t) : o;
10157
10178
  return n ? `schema${t ? ` @ ${t}` : ""} = ${$(ac(n))}` : Z({
@@ -10387,11 +10408,11 @@ function vf(e, n = {}) {
10387
10408
  let B = [
10388
10409
  I,
10389
10410
  ce,
10390
- L,
10391
- R,
10392
10411
  le,
10412
+ L,
10393
10413
  ue,
10394
10414
  de,
10415
+ R,
10395
10416
  fe,
10396
10417
  pe,
10397
10418
  ...me,
@@ -15239,13 +15260,13 @@ function ev(e, n, r) {
15239
15260
  description: e.data.description ?? "主数据对象"
15240
15261
  } : void 0, F = !(e.subagents ?? []).some((e) => e._codeAsset) && Cm(e.capabilities).subagent, I = e.subagents;
15241
15262
  F && P?.schema && Zs(P.schema).length && (I = [...e.subagents ?? [], Ep()], console.info("[page-agent-sdk] 检测到 schema 含代码组件数组(如 components[].code),已自动装配 HTML 代码子 agent(委派编排 + vfs 工作副本 + 格式校验 + 增量 commit)。需定制(codeField/formatCheck/craftNotes 等)请显式传 createHtmlSubagent(...)"));
15242
- let ce = (I ?? []).filter((e) => !!e._codeAsset), L = /* @__PURE__ */ new Set();
15263
+ let ce = (I ?? []).filter((e) => !!e._codeAsset), le = /* @__PURE__ */ new Set();
15243
15264
  for (let e of ce) {
15244
15265
  if (e._codeAsset.writablePaths.length) continue;
15245
15266
  let t = Zs(P?.schema, e._codeAsset.codeField);
15246
- 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'])"), L.add(e));
15267
+ 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'])"), le.add(e));
15247
15268
  }
15248
- let R = L.size ? ce.filter((e) => !L.has(e)) : ce, le = L.size ? (I ?? []).filter((e) => !L.has(e)) : I, ue = R.length > 0, de = R.flatMap((e) => e._codeAsset.writablePaths), fe = R.flatMap((e) => e._codeAsset.writablePaths.map((t) => `${t}.${e._codeAsset.codeField}`)), pe = e.checkpoint, me = pe !== void 0 && pe !== !1, z = me ? Fu({
15269
+ let L = le.size ? ce.filter((e) => !le.has(e)) : ce, ue = le.size ? (I ?? []).filter((e) => !le.has(e)) : I, de = L.length > 0, R = L.flatMap((e) => e._codeAsset.writablePaths), fe = L.flatMap((e) => e._codeAsset.writablePaths.map((t) => `${t}.${e._codeAsset.codeField}`)), pe = e.checkpoint, me = pe !== void 0 && pe !== !1, z = me ? Fu({
15249
15270
  getData: () => W()?.bind,
15250
15271
  consumeDataDirty: () => U?.consumeDataDirty?.() ?? !0,
15251
15272
  slotPaths: P ? [""] : [],
@@ -15261,8 +15282,8 @@ function ev(e, n, r) {
15261
15282
  domInspect: V.domInspect === !0,
15262
15283
  screenshot: ve
15263
15284
  });
15264
- if (ue) {
15265
- let e = R.map((e) => e._codeAsset.orchestratorPrompt).filter(Boolean).join("\n\n");
15285
+ if (de) {
15286
+ let e = L.map((e) => e._codeAsset.orchestratorPrompt).filter(Boolean).join("\n\n");
15266
15287
  e && (ye += "\n\n" + e);
15267
15288
  } else P?.schema && Xs(P.schema) && (ye += "\n\n" + mc.htmlDirectWriteFallback, console.warn("[page-agent-sdk] 检测到 schema 含 code 字段但未注册 html 子 agent:已自动注入「主 agent 自己写 HTML」编排(code 作普通字段直接 write,无 vfs 工作副本 / 无格式校验门禁)。如需代码资产机制(vfs + 格式校验 + 增量 commit + 主上下文 code 摘要),注册 createHtmlSubagent;若确为降级意图可忽略。"));
15268
15289
  let H = he && P ? vf(P, {
@@ -15272,7 +15293,7 @@ function ev(e, n, r) {
15272
15293
  conflictWatchFields: e.conflictWatchFields,
15273
15294
  maxParallelTools: e.maxParallelTools,
15274
15295
  vfsStore: ge || P?.resources?.length ? T : void 0,
15275
- ...de.length ? { pgIdPaths: de } : {},
15296
+ ...R.length ? { pgIdPaths: R } : {},
15276
15297
  ...fe.length ? { largeTextPaths: fe } : {}
15277
15298
  }) : [], be = he ? H : [], U = he && P ? H.controller ?? null : null, xe = he && P ? H.previewWrite : void 0, Se = he && P?.resources?.length && U?.getResourcesSnapshot ? R_({ getResourcesSnapshot: () => U?.getResourcesSnapshot?.() ?? [] }) : void 0, W = () => U?.get() ?? P, Ce = new Set(H.map((e) => e.name)), we = e.conflictWatchFields ?? [], Te = !we.includes("*") && we.length ? new Set(we) : void 0, G = U ? Zf({
15278
15299
  getBind: () => W()?.bind,
@@ -15467,7 +15488,7 @@ function ev(e, n, r) {
15467
15488
  focusTools: () => $e,
15468
15489
  mcpTools: () => Ue,
15469
15490
  loadedSkillTools: () => et
15470
- }), K = nt(), rt = V.planning, it = V.missionAnchor, at = V.workingMemory, ot = V.skills, st = V.vfs || ue;
15491
+ }), K = nt(), rt = V.planning, it = V.missionAnchor, at = V.workingMemory, ot = V.skills, st = V.vfs || de;
15471
15492
  if (st) for (let e of Ad) Ee.set(e, "builtin");
15472
15493
  if (rt) for (let e of D.tools ?? []) Ee.set(e.name, "builtin");
15473
15494
  let ct = V.summarization, lt = V.agentCompression && !!m;
@@ -15507,7 +15528,7 @@ function ev(e, n, r) {
15507
15528
  a.prompt_tokens = (a.prompt_tokens ?? 0) + (e.prompt_tokens ?? 0), a.completion_tokens = (a.completion_tokens ?? 0) + (e.completion_tokens ?? 0), a.total_tokens = (a.total_tokens ?? 0) + (e.total_tokens ?? 0), e.reasoning_tokens && (a.reasoning_tokens = (a.reasoning_tokens ?? 0) + e.reasoning_tokens);
15508
15529
  },
15509
15530
  timeoutMs: vt?.timeoutMs
15510
- }), Et = le?.map((e) => {
15531
+ }), Et = ue?.map((e) => {
15511
15532
  if (!e._codeAsset) return e;
15512
15533
  let t = e._codeAsset, n = If({
15513
15534
  writablePaths: t.writablePaths,
@@ -15524,12 +15545,12 @@ function ev(e, n, r) {
15524
15545
  ...e,
15525
15546
  middleware: r
15526
15547
  };
15527
- }), Dt = ue && dt ? Lf() : void 0, Ot = Dt ? Wf({
15548
+ }), Dt = de && dt ? Lf() : void 0, Ot = Dt ? Wf({
15528
15549
  getBind: () => W()?.bind,
15529
- writablePaths: de,
15550
+ writablePaths: R,
15530
15551
  getLocked: () => Dt.locked(),
15531
15552
  tools: K,
15532
- getCodeFieldPaths: () => Hf(W()?.bind, R.map((e) => ({
15553
+ getCodeFieldPaths: () => Hf(W()?.bind, L.map((e) => ({
15533
15554
  writablePaths: e._codeAsset.writablePaths,
15534
15555
  codeField: e._codeAsset.codeField
15535
15556
  })))
@@ -15556,7 +15577,7 @@ function ev(e, n, r) {
15556
15577
  timeoutMs: e.subagent?.timeoutMs,
15557
15578
  ...Dt ? {
15558
15579
  componentLock: Dt,
15559
- resolveComponents: (e) => Rf(e, Mf(W()?.bind, de))
15580
+ resolveComponents: (e) => Rf(e, Mf(W()?.bind, R))
15560
15581
  } : {}
15561
15582
  }) : void 0, jt = At ? At.controller : null, Mt = (t) => {
15562
15583
  let n = t.thinkingMode ?? e.subagent?.thinkingMode, r = n ? Np(t.llm ?? e.llm) ? "instance-noop" : "applied" : "inherited";
@@ -15585,7 +15606,7 @@ function ev(e, n, r) {
15585
15606
  hasActions: !!e.actions && Object.keys(e.actions).length > 0,
15586
15607
  hasProposals: !!e.proposals,
15587
15608
  viewImage: !!ke,
15588
- subagents: le?.map(Mt)
15609
+ subagents: ue?.map(Mt)
15589
15610
  }, he && !!P, { promptSoftCap: Il(g.contextWindow, y.promptSoftCapTokens) }), zt = V.pageContext ? L_({
15590
15611
  getPageInfo: () => typeof document < "u" && typeof location < "u" ? {
15591
15612
  title: document.title || "",
@@ -17001,19 +17022,19 @@ function mv(e = {}) {
17001
17022
  messages: e.messages ?? [],
17002
17023
  loading: !1,
17003
17024
  error: null
17004
- }), c = /* @__PURE__ */ Gt(null), l = /* @__PURE__ */ Gt(!0), u = null, d = /* @__PURE__ */ Gt([]), f = /* @__PURE__ */ Gt(null);
17005
- function p() {}
17006
- function m(e) {
17025
+ }), c = /* @__PURE__ */ Gt(null), l = /* @__PURE__ */ Gt(!0), u = null, d = 0, f = /* @__PURE__ */ Gt([]), p = /* @__PURE__ */ Gt(null);
17026
+ function m() {}
17027
+ function h(e) {
17007
17028
  let t = c.value;
17008
17029
  e.deltaY < 0 ? l.value = !1 : t && (l.value = t.scrollHeight - t.scrollTop - t.clientHeight < 64);
17009
17030
  }
17010
- function h() {
17031
+ function g() {
17011
17032
  c.value && requestAnimationFrame(() => {
17012
17033
  let e = c.value;
17013
17034
  !e || !l.value || (e.scrollTop = e.scrollHeight);
17014
17035
  });
17015
17036
  }
17016
- function g(e, t, n, r, i) {
17037
+ function _(e, t, n, r, i) {
17017
17038
  s.messages.push({
17018
17039
  role: e,
17019
17040
  content: t,
@@ -17021,9 +17042,10 @@ function mv(e = {}) {
17021
17042
  ...n && n.length ? { focuses: n } : {},
17022
17043
  ...r?.length ? { images: r } : {},
17023
17044
  ...i ? { quote: i } : {}
17024
- }), l.value = !0, h();
17045
+ }), l.value = !0, g();
17025
17046
  }
17026
- async function _(e) {
17047
+ async function v(e) {
17048
+ let r = ++d;
17027
17049
  if (l.value = !0, n) {
17028
17050
  let t = /* @__PURE__ */ Pt({
17029
17051
  role: "assistant",
@@ -17032,19 +17054,19 @@ function mv(e = {}) {
17032
17054
  reasoning: "",
17033
17055
  reasoningTotal: 0,
17034
17056
  steps: []
17035
- }), r = !1;
17057
+ }), i = !1;
17036
17058
  s.messages.push(t);
17037
17059
  try {
17038
17060
  await n(s.messages.slice(0, -1), (e) => {
17039
17061
  switch (e.type) {
17040
17062
  case "round_start":
17041
- e.round > 1 && (t.content || t.reasoning) && (r = !0);
17063
+ e.round > 1 && (t.content || t.reasoning) && (i = !0);
17042
17064
  break;
17043
17065
  case "reasoning":
17044
- r &&= (t.reasoning += "\n", !1), t.reasoningTotal += e.delta.length, t.reasoning = (t.reasoning + e.delta).slice(-4e3);
17066
+ i &&= (t.reasoning += "\n", !1), t.reasoningTotal += e.delta.length, t.reasoning = (t.reasoning + e.delta).slice(-4e3);
17045
17067
  break;
17046
17068
  case "text":
17047
- r &&= (t.content += "\n", !1), t.content += e.delta;
17069
+ i &&= (t.content += "\n", !1), t.content += e.delta;
17048
17070
  break;
17049
17071
  case "tool_call":
17050
17072
  t.steps.push({
@@ -17094,7 +17116,7 @@ function mv(e = {}) {
17094
17116
  break;
17095
17117
  }
17096
17118
  case "approval_request":
17097
- e.hold?.(), f.value = {
17119
+ e.hold?.(), p.value = {
17098
17120
  toolName: e.toolName,
17099
17121
  args: e.args,
17100
17122
  resolve: e.resolve,
@@ -17102,7 +17124,7 @@ function mv(e = {}) {
17102
17124
  };
17103
17125
  break;
17104
17126
  }
17105
- h();
17127
+ g();
17106
17128
  }, e);
17107
17129
  } catch (n) {
17108
17130
  if (aa(n, e) || (s.error = n.message || "请求失败,请重试"), !t.content && !t.reasoning) {
@@ -17110,19 +17132,19 @@ function mv(e = {}) {
17110
17132
  e >= 0 && s.messages.splice(e, 1);
17111
17133
  }
17112
17134
  } finally {
17113
- await y(), f.value = null;
17135
+ await b(r), r === d && (p.value = null);
17114
17136
  }
17115
17137
  return;
17116
17138
  }
17117
17139
  try {
17118
- g("assistant", await (t || C)(s.messages, e));
17140
+ _("assistant", await (t || T)(s.messages, e));
17119
17141
  } catch (t) {
17120
17142
  aa(t, e) || (s.error = t.message || "请求失败,请重试");
17121
17143
  } finally {
17122
- await y();
17144
+ await b(r);
17123
17145
  }
17124
17146
  }
17125
- function v(e) {
17147
+ function y(e) {
17126
17148
  let t = (e) => {
17127
17149
  if (e?.length) for (let n of e) n.status === "running" && (n.status = "error", n.result ||= "(本轮已结束,该步骤未收到结果 —— 子 agent 中断/异常)"), n.children?.length && t(n.children);
17128
17150
  };
@@ -17131,28 +17153,30 @@ function mv(e = {}) {
17131
17153
  break;
17132
17154
  }
17133
17155
  }
17134
- async function y() {
17135
- v(s.messages);
17156
+ async function b(t) {
17157
+ if (t !== d) return;
17158
+ y(s.messages);
17136
17159
  try {
17137
17160
  await r?.(s.messages);
17138
17161
  } catch {}
17162
+ if (t !== d) return;
17139
17163
  s.loading = !1, u = null;
17140
- let t = d.value.shift();
17141
- t !== void 0 && (g("user", t, e.getFocuses?.()), s.loading = !0, s.error = null, u = new AbortController(), await _(u.signal));
17164
+ let n = f.value.shift();
17165
+ n !== void 0 && (_("user", n, e.getFocuses?.()), s.loading = !0, s.error = null, u = new AbortController(), await v(u.signal));
17142
17166
  }
17143
- function b(e) {
17144
- d.value.splice(e, 1);
17167
+ function x(e) {
17168
+ f.value.splice(e, 1);
17145
17169
  }
17146
- async function x(e, t, n, r) {
17170
+ async function S(e, t, n, r) {
17147
17171
  if (!(!e.trim() && !n?.length)) {
17148
17172
  if (s.loading) {
17149
- d.value.push(e.trim());
17173
+ f.value.push(e.trim());
17150
17174
  return;
17151
17175
  }
17152
- g("user", e.trim() || "[image]", t, n, r), s.loading = !0, s.error = null, u = new AbortController(), await _(u.signal);
17176
+ _("user", e.trim() || "[image]", t, n, r), s.loading = !0, s.error = null, u = new AbortController(), await v(u.signal);
17153
17177
  }
17154
17178
  }
17155
- async function S() {
17179
+ async function C() {
17156
17180
  if (s.loading) return;
17157
17181
  o?.();
17158
17182
  let e = s.messages;
@@ -17160,25 +17184,38 @@ function mv(e = {}) {
17160
17184
  e.splice(t);
17161
17185
  break;
17162
17186
  }
17163
- e.some((e) => e.role === "user") && (s.loading = !0, s.error = null, u = new AbortController(), await _(u.signal));
17187
+ e.some((e) => e.role === "user") && (s.loading = !0, s.error = null, u = new AbortController(), await v(u.signal));
17164
17188
  }
17165
- async function C(e) {
17189
+ async function w(e, t) {
17190
+ let n = s.messages[e];
17191
+ if (!n || n.role !== "user") return;
17192
+ let i = !!n.images?.length, a = t.trim();
17193
+ if (!a && !i) return;
17194
+ s.loading && D();
17195
+ let { focuses: c, images: l, quote: d } = n;
17196
+ o?.(), s.messages.splice(e), _("user", a || "[image]", c, l, d);
17197
+ try {
17198
+ await r?.(s.messages);
17199
+ } catch {}
17200
+ s.loading = !0, s.error = null, u = new AbortController(), await v(u.signal);
17201
+ }
17202
+ async function T(e) {
17166
17203
  return await new Promise((e) => setTimeout(e, 800 + Math.random() * 1200)), `收到你的消息:"${e.filter((e) => e.role === "user").pop()?.content}"。这是一个模拟回复,请接入实际的 AI API。`;
17167
17204
  }
17168
- function w() {
17205
+ function E() {
17169
17206
  i?.(), s.messages.splice(0, s.messages.length), s.error = null;
17170
17207
  }
17171
- function T() {
17172
- d.value.length && a?.([...d.value]), d.value = [], u?.abort();
17208
+ function D() {
17209
+ f.value.length && a?.([...f.value]), f.value = [], u?.abort();
17173
17210
  }
17174
- function E() {
17175
- d.value = [], u?.abort(), u = null, s.loading = !1, s.error = null, f.value = null;
17211
+ function O() {
17212
+ f.value = [], u?.abort(), u = null, s.loading = !1, s.error = null, p.value = null;
17176
17213
  }
17177
- function D(e) {
17178
- let t = f.value;
17179
- t && (f.value = null, t.resolve(e));
17214
+ function k(e) {
17215
+ let t = p.value;
17216
+ t && (p.value = null, t.resolve(e));
17180
17217
  }
17181
- async function O() {
17218
+ async function ee() {
17182
17219
  if (!s.error) return;
17183
17220
  let e = s.messages, t = -1;
17184
17221
  for (let n = e.length - 1; n >= 0; n--) if (e[n].role === "user") {
@@ -17187,23 +17224,24 @@ function mv(e = {}) {
17187
17224
  }
17188
17225
  if (t < 0) return;
17189
17226
  let n = e[t].content;
17190
- e.splice(t), s.error = null, await x(n);
17227
+ e.splice(t), s.error = null, await S(n);
17191
17228
  }
17192
17229
  return {
17193
17230
  state: s,
17194
17231
  scrollContainer: c,
17195
- pendingApproval: f,
17196
- queuedTasks: d,
17197
- sendMessage: x,
17198
- removeQueuedTask: b,
17199
- clearMessages: w,
17200
- stop: T,
17201
- reset: E,
17202
- retry: O,
17203
- regenerate: S,
17204
- resolveApproval: D,
17205
- onScroll: p,
17206
- onWheel: m
17232
+ pendingApproval: p,
17233
+ queuedTasks: f,
17234
+ sendMessage: S,
17235
+ removeQueuedTask: x,
17236
+ clearMessages: E,
17237
+ stop: D,
17238
+ reset: O,
17239
+ retry: ee,
17240
+ regenerate: C,
17241
+ editAndResend: w,
17242
+ resolveApproval: k,
17243
+ onScroll: m,
17244
+ onWheel: h
17207
17245
  };
17208
17246
  }
17209
17247
  //#endregion
@@ -17266,6 +17304,10 @@ var _v = {
17266
17304
  copy: "复制",
17267
17305
  copied: "已复制",
17268
17306
  regenerate: "重新生成",
17307
+ edit: "编辑",
17308
+ editTitle: "编辑后重发:之后的回复将被移除并重新生成",
17309
+ editSave: "保存并重发",
17310
+ editCancel: "取消",
17269
17311
  expand: "展开",
17270
17312
  collapse: "收起",
17271
17313
  noResult: "(无返回值)",
@@ -17500,6 +17542,10 @@ var _v = {
17500
17542
  copy: "Copy",
17501
17543
  copied: "Copied",
17502
17544
  regenerate: "Regenerate",
17545
+ edit: "Edit",
17546
+ editTitle: "Edit & resubmit: replies after it will be removed and regenerated",
17547
+ editSave: "Save & resubmit",
17548
+ editCancel: "Cancel",
17503
17549
  expand: "Expand",
17504
17550
  collapse: "Collapse",
17505
17551
  noResult: "(no result)",
@@ -17751,12 +17797,12 @@ function xv(e = {}) {
17751
17797
  };
17752
17798
  }), x = ri(() => (n.messages.length, typeof e.canUndo == "function" && !!e.canUndo())), S = () => {
17753
17799
  e.onUndo?.() && (n.error = null);
17754
- }, C = (e) => new Date(e).toLocaleTimeString(ce, {
17800
+ }, C = (e) => new Date(e).toLocaleTimeString(de, {
17755
17801
  hour: "2-digit",
17756
17802
  minute: "2-digit"
17757
17803
  }), w = () => {
17758
17804
  let e = T.value, t = ne.value;
17759
- !o.value.trim() && !e.length || (r(o.value, M.value, e.length ? [...e] : void 0, t ?? void 0), o.value = "", T.value = [], t && re());
17805
+ !o.value.trim() && !e.length || (r(o.value, P.value, e.length ? [...e] : void 0, t ?? void 0), o.value = "", T.value = [], t && re());
17760
17806
  }, T = /* @__PURE__ */ Gt([]), E = /* @__PURE__ */ Gt(""), D = /* @__PURE__ */ Gt(!1), O, k = (e) => {
17761
17807
  E.value = e, clearTimeout(O), O = setTimeout(() => {
17762
17808
  E.value = "";
@@ -17766,16 +17812,16 @@ function xv(e = {}) {
17766
17812
  if (!t.length) return;
17767
17813
  let n = 4 - T.value.length;
17768
17814
  if (n <= 0) {
17769
- k(`${L.imageCountLimitPrefix}4${L.imageCountLimitSuffix}`);
17815
+ k(`${R.imageCountLimitPrefix}4${R.imageCountLimitSuffix}`);
17770
17816
  return;
17771
17817
  }
17772
- t.length > n && k(`${L.imageCountLimitPrefix}4${L.imageCountLimitSuffix}`), D.value = !0;
17818
+ t.length > n && k(`${R.imageCountLimitPrefix}4${R.imageCountLimitSuffix}`), D.value = !0;
17773
17819
  try {
17774
17820
  for (let e of t.slice(0, n)) try {
17775
17821
  let t = await Ei(e, { name: e.name });
17776
17822
  T.value.push(t);
17777
17823
  } catch (e) {
17778
- k(e instanceof hi ? `${e.message}` : L.imageInvalid);
17824
+ k(e instanceof hi ? `${e.message}` : R.imageInvalid);
17779
17825
  }
17780
17826
  } finally {
17781
17827
  D.value = !1;
@@ -17790,21 +17836,30 @@ function xv(e = {}) {
17790
17836
  e.isComposing || e.keyCode === 229 || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), w());
17791
17837
  }, ae = (e) => {
17792
17838
  o.value = a.value[e] || "", i(e);
17793
- }, j = (e) => {
17839
+ }, j = /* @__PURE__ */ Gt(null), M = (e) => {
17840
+ e.role === "user" && (n.loading && t.stop(), j.value = e);
17841
+ }, oe = () => {
17842
+ j.value = null;
17843
+ }, N = (e) => {
17844
+ let r = j.value;
17845
+ if (j.value = null, !r) return;
17846
+ let i = n.messages.indexOf(r);
17847
+ i < 0 || t.editAndResend(i, e);
17848
+ }, se = (e) => {
17794
17849
  let t = n.messages, r = t[e];
17795
17850
  if (!r || r.role !== "assistant") return !1;
17796
17851
  let i = "reasoning" in r ? r.reasoning : void 0, a = "steps" in r ? r.steps : void 0;
17797
17852
  return n.loading && e === t.length - 1 && !r.content && !i && !(a && a.length);
17798
- }, M = ri(() => (e.infoTick?.value, e.getFocuses?.() ?? [])), oe = ri(() => (e.infoTick?.value, e.getInfo?.()?.planConfirmation)), N = (t) => e.onAddFocus ? e.onAddFocus(t) : {
17853
+ }, P = ri(() => (e.infoTick?.value, e.getFocuses?.() ?? [])), F = ri(() => (e.infoTick?.value, e.getInfo?.()?.planConfirmation)), I = (t) => e.onAddFocus ? e.onAddFocus(t) : {
17799
17854
  ok: !1,
17800
17855
  error: "focus 未启用"
17801
- }, se = (t) => {
17856
+ }, ce = (t) => {
17802
17857
  e.onRemoveFocus?.(t);
17803
- }, P = () => {
17858
+ }, le = () => {
17804
17859
  e.onClearFocus?.();
17805
- }, F = (t) => {
17860
+ }, L = (t) => {
17806
17861
  e.onFocusChipClick?.(t);
17807
- }, I = gv(e.icons), ce = e.locale ?? "zh-CN", L = yv(ce, e.dialogMessages);
17862
+ }, ue = gv(e.icons), de = e.locale ?? "zh-CN", R = yv(de, e.dialogMessages);
17808
17863
  return {
17809
17864
  chat: t,
17810
17865
  inputText: o,
@@ -17836,16 +17891,20 @@ function xv(e = {}) {
17836
17891
  setQuote: A,
17837
17892
  clearQuote: re,
17838
17893
  editQueued: ae,
17839
- isPendingAssistant: j,
17840
- focuses: M,
17841
- planConfirmation: oe,
17842
- addFocus: N,
17843
- removeFocus: se,
17844
- clearFocus: P,
17845
- focusChipClick: F,
17846
- icons: I,
17847
- locale: ce,
17848
- messages: L,
17894
+ editingMessage: j,
17895
+ startEdit: M,
17896
+ cancelEdit: oe,
17897
+ submitEdit: N,
17898
+ isPendingAssistant: se,
17899
+ focuses: P,
17900
+ planConfirmation: F,
17901
+ addFocus: I,
17902
+ removeFocus: ce,
17903
+ clearFocus: le,
17904
+ focusChipClick: L,
17905
+ icons: ue,
17906
+ locale: de,
17907
+ messages: R,
17849
17908
  toolStepView: e.toolStepView
17850
17909
  };
17851
17910
  }