page-agent-sdk 4.24.5 → 4.25.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.
@@ -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
  }
@@ -9677,7 +9686,7 @@ function vf(e, n = {}) {
9677
9686
  jsonPath: t.string().optional().describe("只看快照的某子路径"),
9678
9687
  list: t.boolean().optional().describe("true 列出快照时间线(序号/操作/标签/时间/大小)")
9679
9688
  })
9680
- }), L = s(async ({ expr: e, queries: t, limit: n }, r) => {
9689
+ }), le = s(async ({ expr: e, queries: t, limit: n }, r) => {
9681
9690
  let i = b(r);
9682
9691
  if (typeof c != "object" || !c) return Z({
9683
9692
  code: "NOT_OBJECT",
@@ -9720,7 +9729,7 @@ function vf(e, n = {}) {
9720
9729
  queries: t.array(t.string()).min(2).max(10).optional().describe("批量模式:2-10 条 JSONPath 一次取回(与 expr 同传按 queries);逐条独立返回,单条失败该项标 error 不整批"),
9721
9730
  limit: t.number().int().min(1).max(200).optional().describe("返回结果上限(批量时逐条适用),默认 50")
9722
9731
  })
9723
- }), R = s(async ({ query: e, mode: t, fuzzyThreshold: n, matchKey: r, limit: i }) => {
9732
+ }), L = s(async ({ query: e, mode: t, fuzzyThreshold: n, matchKey: r, limit: i }) => {
9724
9733
  if (c == null) return Z({
9725
9734
  code: "EMPTY",
9726
9735
  message: "主数据为空,无可搜索内容"
@@ -9758,7 +9767,7 @@ function vf(e, n = {}) {
9758
9767
  matchKey: t.boolean().optional().describe("是否同时匹配 key 名,默认 true"),
9759
9768
  limit: t.number().int().min(1).max(200).optional().describe("返回上限,默认 50")
9760
9769
  })
9761
- }), le = s(async ({ script: e, mode: t, jsonPath: n }, r) => {
9770
+ }), ue = s(async ({ script: e, mode: t, jsonPath: n }, r) => {
9762
9771
  let s = b(r);
9763
9772
  if (e.length > 8e3) return Z({
9764
9773
  code: "SCRIPT_TOO_LARGE",
@@ -9914,8 +9923,8 @@ function vf(e, n = {}) {
9914
9923
  jsonPath: t.string().optional().describe("子树模式:仅对该子树执行;transform 返回值作为子树新值")
9915
9924
  })
9916
9925
  });
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) => {
9926
+ F(ue, (e) => e?.mode === "transform");
9927
+ let de = s(async ({ jsonPath: e, jsonPaths: t, fields: n, depth: r, offset: i, limit: a }, s) => {
9919
9928
  let c = b(s), f = x(s), p = l(), m, g = () => m ??= k();
9920
9929
  if (t && t.length) {
9921
9930
  let e = !1, i = t.map((t) => {
@@ -10005,7 +10014,7 @@ function vf(e, n = {}) {
10005
10014
  offset: t.number().int().min(0).optional().describe("数组分页起始偏移(仅数组目标,默认 0)"),
10006
10015
  limit: t.number().int().min(1).max(200).optional().describe("数组分页每页条数(默认 50,上限 200),返回切片+total/hasMore")
10007
10016
  })
10008
- }), de = s(async ({ value: e, patch: t, patches: n, del: i, dryRun: s }, u) => {
10017
+ }), R = s(async ({ value: e, patch: t, patches: n, del: i, dryRun: s }, u) => {
10009
10018
  let f = b(u), p = "set";
10010
10019
  i ? p = "delete" : (n && n.length || t) && (p = "edit");
10011
10020
  let m = t?.value === void 0 ? e : t.value, v = await A();
@@ -10151,7 +10160,7 @@ function vf(e, n = {}) {
10151
10160
  dryRun: t.boolean().optional().describe("预检:走完整校验链但不落盘不入快照;冲突返回 VERSION_CONFLICT 不挂起")
10152
10161
  })
10153
10162
  });
10154
- F(de);
10163
+ F(R);
10155
10164
  let fe = s(async ({ jsonPath: e }) => {
10156
10165
  let t = e || "", n = t ? zs(o, t) : o;
10157
10166
  return n ? `schema${t ? ` @ ${t}` : ""} = ${$(ac(n))}` : Z({
@@ -10387,11 +10396,11 @@ function vf(e, n = {}) {
10387
10396
  let B = [
10388
10397
  I,
10389
10398
  ce,
10390
- L,
10391
- R,
10392
10399
  le,
10400
+ L,
10393
10401
  ue,
10394
10402
  de,
10403
+ R,
10395
10404
  fe,
10396
10405
  pe,
10397
10406
  ...me,
@@ -15239,13 +15248,13 @@ function ev(e, n, r) {
15239
15248
  description: e.data.description ?? "主数据对象"
15240
15249
  } : void 0, F = !(e.subagents ?? []).some((e) => e._codeAsset) && Cm(e.capabilities).subagent, I = e.subagents;
15241
15250
  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();
15251
+ let ce = (I ?? []).filter((e) => !!e._codeAsset), le = /* @__PURE__ */ new Set();
15243
15252
  for (let e of ce) {
15244
15253
  if (e._codeAsset.writablePaths.length) continue;
15245
15254
  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));
15255
+ 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
15256
  }
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({
15257
+ 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
15258
  getData: () => W()?.bind,
15250
15259
  consumeDataDirty: () => U?.consumeDataDirty?.() ?? !0,
15251
15260
  slotPaths: P ? [""] : [],
@@ -15261,8 +15270,8 @@ function ev(e, n, r) {
15261
15270
  domInspect: V.domInspect === !0,
15262
15271
  screenshot: ve
15263
15272
  });
15264
- if (ue) {
15265
- let e = R.map((e) => e._codeAsset.orchestratorPrompt).filter(Boolean).join("\n\n");
15273
+ if (de) {
15274
+ let e = L.map((e) => e._codeAsset.orchestratorPrompt).filter(Boolean).join("\n\n");
15266
15275
  e && (ye += "\n\n" + e);
15267
15276
  } 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
15277
  let H = he && P ? vf(P, {
@@ -15272,7 +15281,7 @@ function ev(e, n, r) {
15272
15281
  conflictWatchFields: e.conflictWatchFields,
15273
15282
  maxParallelTools: e.maxParallelTools,
15274
15283
  vfsStore: ge || P?.resources?.length ? T : void 0,
15275
- ...de.length ? { pgIdPaths: de } : {},
15284
+ ...R.length ? { pgIdPaths: R } : {},
15276
15285
  ...fe.length ? { largeTextPaths: fe } : {}
15277
15286
  }) : [], 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
15287
  getBind: () => W()?.bind,
@@ -15467,7 +15476,7 @@ function ev(e, n, r) {
15467
15476
  focusTools: () => $e,
15468
15477
  mcpTools: () => Ue,
15469
15478
  loadedSkillTools: () => et
15470
- }), K = nt(), rt = V.planning, it = V.missionAnchor, at = V.workingMemory, ot = V.skills, st = V.vfs || ue;
15479
+ }), K = nt(), rt = V.planning, it = V.missionAnchor, at = V.workingMemory, ot = V.skills, st = V.vfs || de;
15471
15480
  if (st) for (let e of Ad) Ee.set(e, "builtin");
15472
15481
  if (rt) for (let e of D.tools ?? []) Ee.set(e.name, "builtin");
15473
15482
  let ct = V.summarization, lt = V.agentCompression && !!m;
@@ -15507,7 +15516,7 @@ function ev(e, n, r) {
15507
15516
  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
15517
  },
15509
15518
  timeoutMs: vt?.timeoutMs
15510
- }), Et = le?.map((e) => {
15519
+ }), Et = ue?.map((e) => {
15511
15520
  if (!e._codeAsset) return e;
15512
15521
  let t = e._codeAsset, n = If({
15513
15522
  writablePaths: t.writablePaths,
@@ -15524,12 +15533,12 @@ function ev(e, n, r) {
15524
15533
  ...e,
15525
15534
  middleware: r
15526
15535
  };
15527
- }), Dt = ue && dt ? Lf() : void 0, Ot = Dt ? Wf({
15536
+ }), Dt = de && dt ? Lf() : void 0, Ot = Dt ? Wf({
15528
15537
  getBind: () => W()?.bind,
15529
- writablePaths: de,
15538
+ writablePaths: R,
15530
15539
  getLocked: () => Dt.locked(),
15531
15540
  tools: K,
15532
- getCodeFieldPaths: () => Hf(W()?.bind, R.map((e) => ({
15541
+ getCodeFieldPaths: () => Hf(W()?.bind, L.map((e) => ({
15533
15542
  writablePaths: e._codeAsset.writablePaths,
15534
15543
  codeField: e._codeAsset.codeField
15535
15544
  })))
@@ -15556,7 +15565,7 @@ function ev(e, n, r) {
15556
15565
  timeoutMs: e.subagent?.timeoutMs,
15557
15566
  ...Dt ? {
15558
15567
  componentLock: Dt,
15559
- resolveComponents: (e) => Rf(e, Mf(W()?.bind, de))
15568
+ resolveComponents: (e) => Rf(e, Mf(W()?.bind, R))
15560
15569
  } : {}
15561
15570
  }) : void 0, jt = At ? At.controller : null, Mt = (t) => {
15562
15571
  let n = t.thinkingMode ?? e.subagent?.thinkingMode, r = n ? Np(t.llm ?? e.llm) ? "instance-noop" : "applied" : "inherited";
@@ -15585,7 +15594,7 @@ function ev(e, n, r) {
15585
15594
  hasActions: !!e.actions && Object.keys(e.actions).length > 0,
15586
15595
  hasProposals: !!e.proposals,
15587
15596
  viewImage: !!ke,
15588
- subagents: le?.map(Mt)
15597
+ subagents: ue?.map(Mt)
15589
15598
  }, he && !!P, { promptSoftCap: Il(g.contextWindow, y.promptSoftCapTokens) }), zt = V.pageContext ? L_({
15590
15599
  getPageInfo: () => typeof document < "u" && typeof location < "u" ? {
15591
15600
  title: document.title || "",
@@ -17001,19 +17010,19 @@ function mv(e = {}) {
17001
17010
  messages: e.messages ?? [],
17002
17011
  loading: !1,
17003
17012
  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) {
17013
+ }), c = /* @__PURE__ */ Gt(null), l = /* @__PURE__ */ Gt(!0), u = null, d = 0, f = /* @__PURE__ */ Gt([]), p = /* @__PURE__ */ Gt(null);
17014
+ function m() {}
17015
+ function h(e) {
17007
17016
  let t = c.value;
17008
17017
  e.deltaY < 0 ? l.value = !1 : t && (l.value = t.scrollHeight - t.scrollTop - t.clientHeight < 64);
17009
17018
  }
17010
- function h() {
17019
+ function g() {
17011
17020
  c.value && requestAnimationFrame(() => {
17012
17021
  let e = c.value;
17013
17022
  !e || !l.value || (e.scrollTop = e.scrollHeight);
17014
17023
  });
17015
17024
  }
17016
- function g(e, t, n, r, i) {
17025
+ function _(e, t, n, r, i) {
17017
17026
  s.messages.push({
17018
17027
  role: e,
17019
17028
  content: t,
@@ -17021,9 +17030,10 @@ function mv(e = {}) {
17021
17030
  ...n && n.length ? { focuses: n } : {},
17022
17031
  ...r?.length ? { images: r } : {},
17023
17032
  ...i ? { quote: i } : {}
17024
- }), l.value = !0, h();
17033
+ }), l.value = !0, g();
17025
17034
  }
17026
- async function _(e) {
17035
+ async function v(e) {
17036
+ let r = ++d;
17027
17037
  if (l.value = !0, n) {
17028
17038
  let t = /* @__PURE__ */ Pt({
17029
17039
  role: "assistant",
@@ -17032,19 +17042,19 @@ function mv(e = {}) {
17032
17042
  reasoning: "",
17033
17043
  reasoningTotal: 0,
17034
17044
  steps: []
17035
- }), r = !1;
17045
+ }), i = !1;
17036
17046
  s.messages.push(t);
17037
17047
  try {
17038
17048
  await n(s.messages.slice(0, -1), (e) => {
17039
17049
  switch (e.type) {
17040
17050
  case "round_start":
17041
- e.round > 1 && (t.content || t.reasoning) && (r = !0);
17051
+ e.round > 1 && (t.content || t.reasoning) && (i = !0);
17042
17052
  break;
17043
17053
  case "reasoning":
17044
- r &&= (t.reasoning += "\n", !1), t.reasoningTotal += e.delta.length, t.reasoning = (t.reasoning + e.delta).slice(-4e3);
17054
+ i &&= (t.reasoning += "\n", !1), t.reasoningTotal += e.delta.length, t.reasoning = (t.reasoning + e.delta).slice(-4e3);
17045
17055
  break;
17046
17056
  case "text":
17047
- r &&= (t.content += "\n", !1), t.content += e.delta;
17057
+ i &&= (t.content += "\n", !1), t.content += e.delta;
17048
17058
  break;
17049
17059
  case "tool_call":
17050
17060
  t.steps.push({
@@ -17094,7 +17104,7 @@ function mv(e = {}) {
17094
17104
  break;
17095
17105
  }
17096
17106
  case "approval_request":
17097
- e.hold?.(), f.value = {
17107
+ e.hold?.(), p.value = {
17098
17108
  toolName: e.toolName,
17099
17109
  args: e.args,
17100
17110
  resolve: e.resolve,
@@ -17102,7 +17112,7 @@ function mv(e = {}) {
17102
17112
  };
17103
17113
  break;
17104
17114
  }
17105
- h();
17115
+ g();
17106
17116
  }, e);
17107
17117
  } catch (n) {
17108
17118
  if (aa(n, e) || (s.error = n.message || "请求失败,请重试"), !t.content && !t.reasoning) {
@@ -17110,19 +17120,19 @@ function mv(e = {}) {
17110
17120
  e >= 0 && s.messages.splice(e, 1);
17111
17121
  }
17112
17122
  } finally {
17113
- await y(), f.value = null;
17123
+ await b(r), r === d && (p.value = null);
17114
17124
  }
17115
17125
  return;
17116
17126
  }
17117
17127
  try {
17118
- g("assistant", await (t || C)(s.messages, e));
17128
+ _("assistant", await (t || T)(s.messages, e));
17119
17129
  } catch (t) {
17120
17130
  aa(t, e) || (s.error = t.message || "请求失败,请重试");
17121
17131
  } finally {
17122
- await y();
17132
+ await b(r);
17123
17133
  }
17124
17134
  }
17125
- function v(e) {
17135
+ function y(e) {
17126
17136
  let t = (e) => {
17127
17137
  if (e?.length) for (let n of e) n.status === "running" && (n.status = "error", n.result ||= "(本轮已结束,该步骤未收到结果 —— 子 agent 中断/异常)"), n.children?.length && t(n.children);
17128
17138
  };
@@ -17131,28 +17141,30 @@ function mv(e = {}) {
17131
17141
  break;
17132
17142
  }
17133
17143
  }
17134
- async function y() {
17135
- v(s.messages);
17144
+ async function b(t) {
17145
+ if (t !== d) return;
17146
+ y(s.messages);
17136
17147
  try {
17137
17148
  await r?.(s.messages);
17138
17149
  } catch {}
17150
+ if (t !== d) return;
17139
17151
  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));
17152
+ let n = f.value.shift();
17153
+ n !== void 0 && (_("user", n, e.getFocuses?.()), s.loading = !0, s.error = null, u = new AbortController(), await v(u.signal));
17142
17154
  }
17143
- function b(e) {
17144
- d.value.splice(e, 1);
17155
+ function x(e) {
17156
+ f.value.splice(e, 1);
17145
17157
  }
17146
- async function x(e, t, n, r) {
17158
+ async function S(e, t, n, r) {
17147
17159
  if (!(!e.trim() && !n?.length)) {
17148
17160
  if (s.loading) {
17149
- d.value.push(e.trim());
17161
+ f.value.push(e.trim());
17150
17162
  return;
17151
17163
  }
17152
- g("user", e.trim() || "[image]", t, n, r), s.loading = !0, s.error = null, u = new AbortController(), await _(u.signal);
17164
+ _("user", e.trim() || "[image]", t, n, r), s.loading = !0, s.error = null, u = new AbortController(), await v(u.signal);
17153
17165
  }
17154
17166
  }
17155
- async function S() {
17167
+ async function C() {
17156
17168
  if (s.loading) return;
17157
17169
  o?.();
17158
17170
  let e = s.messages;
@@ -17160,25 +17172,38 @@ function mv(e = {}) {
17160
17172
  e.splice(t);
17161
17173
  break;
17162
17174
  }
17163
- e.some((e) => e.role === "user") && (s.loading = !0, s.error = null, u = new AbortController(), await _(u.signal));
17175
+ e.some((e) => e.role === "user") && (s.loading = !0, s.error = null, u = new AbortController(), await v(u.signal));
17176
+ }
17177
+ async function w(e, t) {
17178
+ let n = s.messages[e];
17179
+ if (!n || n.role !== "user") return;
17180
+ let i = !!n.images?.length, a = t.trim();
17181
+ if (!a && !i) return;
17182
+ s.loading && D();
17183
+ let { focuses: c, images: l, quote: d } = n;
17184
+ o?.(), s.messages.splice(e), _("user", a || "[image]", c, l, d);
17185
+ try {
17186
+ await r?.(s.messages);
17187
+ } catch {}
17188
+ s.loading = !0, s.error = null, u = new AbortController(), await v(u.signal);
17164
17189
  }
17165
- async function C(e) {
17190
+ async function T(e) {
17166
17191
  return await new Promise((e) => setTimeout(e, 800 + Math.random() * 1200)), `收到你的消息:"${e.filter((e) => e.role === "user").pop()?.content}"。这是一个模拟回复,请接入实际的 AI API。`;
17167
17192
  }
17168
- function w() {
17193
+ function E() {
17169
17194
  i?.(), s.messages.splice(0, s.messages.length), s.error = null;
17170
17195
  }
17171
- function T() {
17172
- d.value.length && a?.([...d.value]), d.value = [], u?.abort();
17196
+ function D() {
17197
+ f.value.length && a?.([...f.value]), f.value = [], u?.abort();
17173
17198
  }
17174
- function E() {
17175
- d.value = [], u?.abort(), u = null, s.loading = !1, s.error = null, f.value = null;
17199
+ function O() {
17200
+ f.value = [], u?.abort(), u = null, s.loading = !1, s.error = null, p.value = null;
17176
17201
  }
17177
- function D(e) {
17178
- let t = f.value;
17179
- t && (f.value = null, t.resolve(e));
17202
+ function k(e) {
17203
+ let t = p.value;
17204
+ t && (p.value = null, t.resolve(e));
17180
17205
  }
17181
- async function O() {
17206
+ async function ee() {
17182
17207
  if (!s.error) return;
17183
17208
  let e = s.messages, t = -1;
17184
17209
  for (let n = e.length - 1; n >= 0; n--) if (e[n].role === "user") {
@@ -17187,23 +17212,24 @@ function mv(e = {}) {
17187
17212
  }
17188
17213
  if (t < 0) return;
17189
17214
  let n = e[t].content;
17190
- e.splice(t), s.error = null, await x(n);
17215
+ e.splice(t), s.error = null, await S(n);
17191
17216
  }
17192
17217
  return {
17193
17218
  state: s,
17194
17219
  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
17220
+ pendingApproval: p,
17221
+ queuedTasks: f,
17222
+ sendMessage: S,
17223
+ removeQueuedTask: x,
17224
+ clearMessages: E,
17225
+ stop: D,
17226
+ reset: O,
17227
+ retry: ee,
17228
+ regenerate: C,
17229
+ editAndResend: w,
17230
+ resolveApproval: k,
17231
+ onScroll: m,
17232
+ onWheel: h
17207
17233
  };
17208
17234
  }
17209
17235
  //#endregion
@@ -17266,6 +17292,10 @@ var _v = {
17266
17292
  copy: "复制",
17267
17293
  copied: "已复制",
17268
17294
  regenerate: "重新生成",
17295
+ edit: "编辑",
17296
+ editTitle: "编辑后重发:之后的回复将被移除并重新生成",
17297
+ editSave: "保存并重发",
17298
+ editCancel: "取消",
17269
17299
  expand: "展开",
17270
17300
  collapse: "收起",
17271
17301
  noResult: "(无返回值)",
@@ -17500,6 +17530,10 @@ var _v = {
17500
17530
  copy: "Copy",
17501
17531
  copied: "Copied",
17502
17532
  regenerate: "Regenerate",
17533
+ edit: "Edit",
17534
+ editTitle: "Edit & resubmit: replies after it will be removed and regenerated",
17535
+ editSave: "Save & resubmit",
17536
+ editCancel: "Cancel",
17503
17537
  expand: "Expand",
17504
17538
  collapse: "Collapse",
17505
17539
  noResult: "(no result)",
@@ -17751,12 +17785,12 @@ function xv(e = {}) {
17751
17785
  };
17752
17786
  }), x = ri(() => (n.messages.length, typeof e.canUndo == "function" && !!e.canUndo())), S = () => {
17753
17787
  e.onUndo?.() && (n.error = null);
17754
- }, C = (e) => new Date(e).toLocaleTimeString(ce, {
17788
+ }, C = (e) => new Date(e).toLocaleTimeString(de, {
17755
17789
  hour: "2-digit",
17756
17790
  minute: "2-digit"
17757
17791
  }), w = () => {
17758
17792
  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());
17793
+ !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
17794
  }, T = /* @__PURE__ */ Gt([]), E = /* @__PURE__ */ Gt(""), D = /* @__PURE__ */ Gt(!1), O, k = (e) => {
17761
17795
  E.value = e, clearTimeout(O), O = setTimeout(() => {
17762
17796
  E.value = "";
@@ -17766,16 +17800,16 @@ function xv(e = {}) {
17766
17800
  if (!t.length) return;
17767
17801
  let n = 4 - T.value.length;
17768
17802
  if (n <= 0) {
17769
- k(`${L.imageCountLimitPrefix}4${L.imageCountLimitSuffix}`);
17803
+ k(`${R.imageCountLimitPrefix}4${R.imageCountLimitSuffix}`);
17770
17804
  return;
17771
17805
  }
17772
- t.length > n && k(`${L.imageCountLimitPrefix}4${L.imageCountLimitSuffix}`), D.value = !0;
17806
+ t.length > n && k(`${R.imageCountLimitPrefix}4${R.imageCountLimitSuffix}`), D.value = !0;
17773
17807
  try {
17774
17808
  for (let e of t.slice(0, n)) try {
17775
17809
  let t = await Ei(e, { name: e.name });
17776
17810
  T.value.push(t);
17777
17811
  } catch (e) {
17778
- k(e instanceof hi ? `${e.message}` : L.imageInvalid);
17812
+ k(e instanceof hi ? `${e.message}` : R.imageInvalid);
17779
17813
  }
17780
17814
  } finally {
17781
17815
  D.value = !1;
@@ -17790,21 +17824,30 @@ function xv(e = {}) {
17790
17824
  e.isComposing || e.keyCode === 229 || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), w());
17791
17825
  }, ae = (e) => {
17792
17826
  o.value = a.value[e] || "", i(e);
17793
- }, j = (e) => {
17827
+ }, j = /* @__PURE__ */ Gt(null), M = (e) => {
17828
+ e.role === "user" && (n.loading && t.stop(), j.value = e);
17829
+ }, oe = () => {
17830
+ j.value = null;
17831
+ }, N = (e) => {
17832
+ let r = j.value;
17833
+ if (j.value = null, !r) return;
17834
+ let i = n.messages.indexOf(r);
17835
+ i < 0 || t.editAndResend(i, e);
17836
+ }, se = (e) => {
17794
17837
  let t = n.messages, r = t[e];
17795
17838
  if (!r || r.role !== "assistant") return !1;
17796
17839
  let i = "reasoning" in r ? r.reasoning : void 0, a = "steps" in r ? r.steps : void 0;
17797
17840
  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) : {
17841
+ }, P = ri(() => (e.infoTick?.value, e.getFocuses?.() ?? [])), F = ri(() => (e.infoTick?.value, e.getInfo?.()?.planConfirmation)), I = (t) => e.onAddFocus ? e.onAddFocus(t) : {
17799
17842
  ok: !1,
17800
17843
  error: "focus 未启用"
17801
- }, se = (t) => {
17844
+ }, ce = (t) => {
17802
17845
  e.onRemoveFocus?.(t);
17803
- }, P = () => {
17846
+ }, le = () => {
17804
17847
  e.onClearFocus?.();
17805
- }, F = (t) => {
17848
+ }, L = (t) => {
17806
17849
  e.onFocusChipClick?.(t);
17807
- }, I = gv(e.icons), ce = e.locale ?? "zh-CN", L = yv(ce, e.dialogMessages);
17850
+ }, ue = gv(e.icons), de = e.locale ?? "zh-CN", R = yv(de, e.dialogMessages);
17808
17851
  return {
17809
17852
  chat: t,
17810
17853
  inputText: o,
@@ -17836,16 +17879,20 @@ function xv(e = {}) {
17836
17879
  setQuote: A,
17837
17880
  clearQuote: re,
17838
17881
  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,
17882
+ editingMessage: j,
17883
+ startEdit: M,
17884
+ cancelEdit: oe,
17885
+ submitEdit: N,
17886
+ isPendingAssistant: se,
17887
+ focuses: P,
17888
+ planConfirmation: F,
17889
+ addFocus: I,
17890
+ removeFocus: ce,
17891
+ clearFocus: le,
17892
+ focusChipClick: L,
17893
+ icons: ue,
17894
+ locale: de,
17895
+ messages: R,
17849
17896
  toolStepView: e.toolStepView
17850
17897
  };
17851
17898
  }