page-agent-sdk 1.1.4 → 1.2.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.
@@ -27,7 +27,7 @@ var v = process.env.NODE_ENV === "production" ? {} : Object.freeze({}), y = proc
27
27
  }, E = Object.prototype.hasOwnProperty, D = (e, t) => E.call(e, t), O = Array.isArray, k = (e) => R(e) === "[object Map]", A = (e) => R(e) === "[object Set]", j = (e) => R(e) === "[object Date]", M = (e) => typeof e == "function", N = (e) => typeof e == "string", P = (e) => typeof e == "symbol", F = (e) => typeof e == "object" && !!e, I = (e) => (F(e) || M(e)) && M(e.then) && M(e.catch), L = Object.prototype.toString, R = (e) => L.call(e), ee = (e) => R(e).slice(8, -1), te = (e) => R(e) === "[object Object]", ne = (e) => N(e) && e !== "NaN" && e[0] !== "-" && "" + parseInt(e, 10) === e, re = /* @__PURE__ */ _(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"), ie = /* @__PURE__ */ _("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"), ae = (e) => {
28
28
  let t = /* @__PURE__ */ Object.create(null);
29
29
  return ((n) => t[n] || (t[n] = e(n)));
30
- }, oe = /-\w/g, z = ae((e) => e.replace(oe, (e) => e.slice(1).toUpperCase())), se = /\B([A-Z])/g, B = ae((e) => e.replace(se, "-$1").toLowerCase()), ce = ae((e) => e.charAt(0).toUpperCase() + e.slice(1)), le = ae((e) => e ? `on${ce(e)}` : ""), ue = (e, t) => !Object.is(e, t), de = (e, ...t) => {
30
+ }, oe = /-\w/g, se = ae((e) => e.replace(oe, (e) => e.slice(1).toUpperCase())), ce = /\B([A-Z])/g, z = ae((e) => e.replace(ce, "-$1").toLowerCase()), le = ae((e) => e.charAt(0).toUpperCase() + e.slice(1)), B = ae((e) => e ? `on${le(e)}` : ""), ue = (e, t) => !Object.is(e, t), de = (e, ...t) => {
31
31
  for (let n = 0; n < e.length; n++) e[n](...t);
32
32
  }, fe = (e, t, n, r = !1) => {
33
33
  Object.defineProperty(e, t, {
@@ -630,7 +630,7 @@ function zt(e) {
630
630
  return function(...t) {
631
631
  if (process.env.NODE_ENV !== "production") {
632
632
  let n = t[0] ? `on key "${t[0]}" ` : "";
633
- Le(`${ce(e)} operation ${n}failed: target is readonly.`, /* @__PURE__ */ U(this));
633
+ Le(`${le(e)} operation ${n}failed: target is readonly.`, /* @__PURE__ */ U(this));
634
634
  }
635
635
  return e === "delete" ? !1 : e === "clear" ? void 0 : this;
636
636
  };
@@ -1772,7 +1772,7 @@ function Li(e, t, n = ps, r = !1) {
1772
1772
  return i(), it(), a;
1773
1773
  };
1774
1774
  return r ? i.unshift(a) : i.push(a), a;
1775
- } else process.env.NODE_ENV !== "production" && G(`${le(Ln[e].replace(/ hook$/, ""))} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`);
1775
+ } else process.env.NODE_ENV !== "production" && G(`${B(Ln[e].replace(/ hook$/, ""))} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`);
1776
1776
  }
1777
1777
  var Ri = (e) => (t, n = ps) => {
1778
1778
  (!Ss || e === "sp") && Li(e, (...e) => t(...e), n);
@@ -2169,13 +2169,13 @@ function wa(e, t) {
2169
2169
  return c;
2170
2170
  };
2171
2171
  }
2172
- var Ta = null, Ea = (e, t) => t === "modelValue" || t === "model-value" ? e.modelModifiers : e[`${t}Modifiers`] || e[`${z(t)}Modifiers`] || e[`${B(t)}Modifiers`];
2172
+ var Ta = null, Ea = (e, t) => t === "modelValue" || t === "model-value" ? e.modelModifiers : e[`${t}Modifiers`] || e[`${se(t)}Modifiers`] || e[`${z(t)}Modifiers`];
2173
2173
  function Da(e, t, ...n) {
2174
2174
  if (e.isUnmounted) return;
2175
2175
  let r = e.vnode.props || v;
2176
2176
  if (process.env.NODE_ENV !== "production") {
2177
2177
  let { emitsOptions: r, propsOptions: [i] } = e;
2178
- if (r) if (!(t in r)) (!i || !(le(z(t)) in i)) && G(`Component emitted event "${t}" but it is neither declared in the emits option nor as an "${le(z(t))}" prop.`);
2178
+ if (r) if (!(t in r)) (!i || !(B(se(t)) in i)) && G(`Component emitted event "${t}" but it is neither declared in the emits option nor as an "${B(se(t))}" prop.`);
2179
2179
  else {
2180
2180
  let e = r[t];
2181
2181
  M(e) && (e(...n) || G(`Invalid event arguments: event validation failed for event "${t}".`));
@@ -2184,10 +2184,10 @@ function Da(e, t, ...n) {
2184
2184
  let i = n, a = t.startsWith("update:"), o = a && Ea(r, t.slice(7));
2185
2185
  if (o && (o.trim && (i = n.map((e) => N(e) ? e.trim() : e)), o.number && (i = n.map(pe))), process.env.NODE_ENV !== "production" && Nr(e, t, i), process.env.NODE_ENV !== "production") {
2186
2186
  let n = t.toLowerCase();
2187
- n !== t && r[le(n)] && G(`Event "${n}" is emitted in component ${Ls(e, e.type)} but the handler is registered for "${t}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${B(t)}" instead of "${t}".`);
2187
+ n !== t && r[B(n)] && G(`Event "${n}" is emitted in component ${Ls(e, e.type)} but the handler is registered for "${t}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${z(t)}" instead of "${t}".`);
2188
2188
  }
2189
- let s, c = r[s = le(t)] || r[s = le(z(t))];
2190
- !c && a && (c = r[s = le(B(t))]), c && zn(c, e, 6, i);
2189
+ let s, c = r[s = B(t)] || r[s = B(se(t))];
2190
+ !c && a && (c = r[s = B(z(t))]), c && zn(c, e, 6, i);
2191
2191
  let l = r[s + "Once"];
2192
2192
  if (l) {
2193
2193
  if (!e.emitted) e.emitted = {};
@@ -2210,7 +2210,7 @@ function ka(e, t, n = !1) {
2210
2210
  return !a && !s ? (F(e) && r.set(e, null), null) : (O(a) ? a.forEach((e) => o[e] = null) : w(o, a), F(e) && r.set(e, o), o);
2211
2211
  }
2212
2212
  function Aa(e, t) {
2213
- return !e || !S(t) ? !1 : (t = t.slice(2), t = t === "Once" ? t : t.replace(/Once$/, ""), D(e, t[0].toLowerCase() + t.slice(1)) || D(e, B(t)) || D(e, t));
2213
+ return !e || !S(t) ? !1 : (t = t.slice(2), t = t === "Once" ? t : t.replace(/Once$/, ""), D(e, t[0].toLowerCase() + t.slice(1)) || D(e, z(t)) || D(e, t));
2214
2214
  }
2215
2215
  var ja = !1;
2216
2216
  function Ma() {
@@ -2351,7 +2351,7 @@ function Ja(e, t, n, r) {
2351
2351
  let u = t[o];
2352
2352
  if (c) if (D(a, o)) u !== a[o] && (a[o] = u, l = !0);
2353
2353
  else {
2354
- let t = z(o);
2354
+ let t = se(o);
2355
2355
  i[t] = Xa(c, s, t, u, e, !1);
2356
2356
  }
2357
2357
  else u !== a[o] && (a[o] = u, l = !0);
@@ -2360,7 +2360,7 @@ function Ja(e, t, n, r) {
2360
2360
  } else {
2361
2361
  Ya(e, t, i, a) && (l = !0);
2362
2362
  let r;
2363
- for (let a in s) (!t || !D(t, a) && ((r = B(a)) === a || !D(t, r))) && (c ? n && (n[a] !== void 0 || n[r] !== void 0) && (i[a] = Xa(c, s, a, void 0, e, !0)) : delete i[a]);
2363
+ for (let a in s) (!t || !D(t, a) && ((r = z(a)) === a || !D(t, r))) && (c ? n && (n[a] !== void 0 || n[r] !== void 0) && (i[a] = Xa(c, s, a, void 0, e, !0)) : delete i[a]);
2364
2364
  if (a !== s) for (let e in a) (!t || !D(t, e)) && (delete a[e], l = !0);
2365
2365
  }
2366
2366
  l && ht(e.attrs, "set", ""), process.env.NODE_ENV !== "production" && to(t || {}, i, e);
@@ -2370,7 +2370,7 @@ function Ya(e, t, n, r) {
2370
2370
  if (t) for (let c in t) {
2371
2371
  if (re(c)) continue;
2372
2372
  let l = t[c], u;
2373
- i && D(i, u = z(c)) ? !a || !a.includes(u) ? n[u] = l : (s ||= {})[u] = l : Aa(e.emitsOptions, c) || (!(c in r) || l !== r[c]) && (r[c] = l, o = !0);
2373
+ i && D(i, u = se(c)) ? !a || !a.includes(u) ? n[u] = l : (s ||= {})[u] = l : Aa(e.emitsOptions, c) || (!(c in r) || l !== r[c]) && (r[c] = l, o = !0);
2374
2374
  }
2375
2375
  if (a) {
2376
2376
  let t = /* @__PURE__ */ U(n), r = s || v;
@@ -2397,7 +2397,7 @@ function Xa(e, t, n, r, i, a) {
2397
2397
  } else r = e;
2398
2398
  i.ce && i.ce._setProp(n, r);
2399
2399
  }
2400
- o[0] && (a && !e ? r = !1 : o[1] && (r === "" || r === B(n)) && (r = !0));
2400
+ o[0] && (a && !e ? r = !1 : o[1] && (r === "" || r === z(n)) && (r = !0));
2401
2401
  }
2402
2402
  return r;
2403
2403
  }
@@ -2417,13 +2417,13 @@ function Qa(e, t, n = !1) {
2417
2417
  if (!a && !c) return F(e) && r.set(e, y), y;
2418
2418
  if (O(a)) for (let e = 0; e < a.length; e++) {
2419
2419
  process.env.NODE_ENV !== "production" && !N(a[e]) && G("props must be strings when using array syntax.", a[e]);
2420
- let t = z(a[e]);
2420
+ let t = se(a[e]);
2421
2421
  $a(t) && (o[t] = v);
2422
2422
  }
2423
2423
  else if (a) {
2424
2424
  process.env.NODE_ENV !== "production" && !F(a) && G("invalid props options", a);
2425
2425
  for (let e in a) {
2426
- let t = z(e);
2426
+ let t = se(e);
2427
2427
  if ($a(t)) {
2428
2428
  let n = a[e], r = o[t] = O(n) || M(n) ? { type: n } : w({}, n), i = r.type, c = !1, l = !0;
2429
2429
  if (O(i)) for (let e = 0; e < i.length; ++e) {
@@ -2448,7 +2448,7 @@ function eo(e) {
2448
2448
  return e === null ? "null" : typeof e == "function" ? e.name || "" : typeof e == "object" && e.constructor && e.constructor.name || "";
2449
2449
  }
2450
2450
  function to(e, t, n) {
2451
- let r = /* @__PURE__ */ U(t), i = n.propsOptions[0], a = Object.keys(e).map((e) => z(e));
2451
+ let r = /* @__PURE__ */ U(t), i = n.propsOptions[0], a = Object.keys(e).map((e) => se(e));
2452
2452
  for (let e in i) {
2453
2453
  let t = i[e];
2454
2454
  t != null && no(e, r[e], t, process.env.NODE_ENV === "production" ? r : /* @__PURE__ */ tn(r), !a.includes(e));
@@ -2490,7 +2490,7 @@ function io(e, t) {
2490
2490
  }
2491
2491
  function ao(e, t, n) {
2492
2492
  if (n.length === 0) return `Prop type [] for prop "${e}" won't match anything. Did you mean to use type Array instead?`;
2493
- let r = `Invalid prop: type check failed for prop "${e}". Expected ${n.map(ce).join(" | ")}`, i = n[0], a = ee(t), o = oo(t, i), s = oo(t, a);
2493
+ let r = `Invalid prop: type check failed for prop "${e}". Expected ${n.map(le).join(" | ")}`, i = n[0], a = ee(t), o = oo(t, i), s = oo(t, a);
2494
2494
  return n.length === 1 && so(i) && co(i, a) && (r += ` with value ${o}`), r += `, got ${a} `, so(a) && (r += `with value ${s}.`), r;
2495
2495
  }
2496
2496
  function oo(e, t) {
@@ -2577,7 +2577,7 @@ function Eo(e, t) {
2577
2577
  n.__VUE__ = !0, process.env.NODE_ENV !== "production" && Sr(n.__VUE_DEVTOOLS_GLOBAL_HOOK__, n);
2578
2578
  let { insert: r, remove: i, patchProp: a, createElement: o, createText: s, createComment: c, setText: l, setElementText: u, parentNode: d, nextSibling: f, setScopeId: p = b, insertStaticContent: m } = e, h = (e, t, n, r = null, i = null, a = null, o = void 0, s = null, c = process.env.NODE_ENV !== "production" && or ? !1 : !!t.dynamicChildren) => {
2579
2579
  if (e === t) return;
2580
- e && !Jo(e, t) && (r = B(e), ie(e, i, a, !0), e = null), t.patchFlag === -2 && (c = !1, t.dynamicChildren = null);
2580
+ e && !Jo(e, t) && (r = z(e), ie(e, i, a, !0), e = null), t.patchFlag === -2 && (c = !1, t.dynamicChildren = null);
2581
2581
  let { type: l, ref: u, shapeFlag: d } = t;
2582
2582
  switch (l) {
2583
2583
  case Lo:
@@ -2738,7 +2738,7 @@ function Eo(e, t) {
2738
2738
  let p = Na(e);
2739
2739
  process.env.NODE_ENV !== "production" && xo(e, "render");
2740
2740
  let m = e.subTree;
2741
- e.subTree = p, process.env.NODE_ENV !== "production" && bo(e, "patch"), h(m, p, d(m.el), B(m), e, i, a), process.env.NODE_ENV !== "production" && xo(e, "patch"), t.el = p.el, u === null && Ha(e, p.el), r && wo(r, i), (f = t.props && t.props.onVnodeUpdated) && wo(() => ls(f, s, t, c), i), process.env.NODE_ENV !== "production" && Er(e), process.env.NODE_ENV !== "production" && kn();
2741
+ e.subTree = p, process.env.NODE_ENV !== "production" && bo(e, "patch"), h(m, p, d(m.el), z(m), e, i, a), process.env.NODE_ENV !== "production" && xo(e, "patch"), t.el = p.el, u === null && Ha(e, p.el), r && wo(r, i), (f = t.props && t.props.onVnodeUpdated) && wo(() => ls(f, s, t, c), i), process.env.NODE_ENV !== "production" && Er(e), process.env.NODE_ENV !== "production" && kn();
2742
2742
  } else {
2743
2743
  let o, { el: s, props: c } = t, { bm: l, m: u, parent: d, root: f, type: p } = e, m = ji(t);
2744
2744
  if (Oo(e, !1), l && de(l), !m && (o = c && c.onVnodeBeforeMount) && ls(o, d, t), Oo(e, !0), s && me) {
@@ -2778,7 +2778,7 @@ function Eo(e, t) {
2778
2778
  return;
2779
2779
  }
2780
2780
  }
2781
- m & 8 ? (d & 16 && se(l, i, a), f !== l && u(n, f)) : d & 16 ? m & 16 ? te(l, f, n, r, i, a, o, s, c) : se(l, i, a, !0) : (d & 8 && u(n, ""), m & 16 && O(f, n, r, i, a, o, s, c));
2781
+ m & 8 ? (d & 16 && ce(l, i, a), f !== l && u(n, f)) : d & 16 ? m & 16 ? te(l, f, n, r, i, a, o, s, c) : ce(l, i, a, !0) : (d & 8 && u(n, ""), m & 16 && O(f, n, r, i, a, o, s, c));
2782
2782
  }, ee = (e, t, n, r, i, a, o, s, c) => {
2783
2783
  e ||= y, t ||= y;
2784
2784
  let l = e.length, u = t.length, d = Math.min(l, u), f;
@@ -2786,7 +2786,7 @@ function Eo(e, t) {
2786
2786
  let r = t[f] = c ? os(t[f]) : as(t[f]);
2787
2787
  h(e[f], r, n, null, i, a, o, s, c);
2788
2788
  }
2789
- l > u ? se(e, i, a, !0, !1, d) : O(t, n, r, i, a, o, s, c, d);
2789
+ l > u ? ce(e, i, a, !0, !1, d) : O(t, n, r, i, a, o, s, c, d);
2790
2790
  }, te = (e, t, n, r, i, a, o, s, c) => {
2791
2791
  let l = 0, u = t.length, d = e.length - 1, f = u - 1;
2792
2792
  for (; l <= d && l <= f;) {
@@ -2879,13 +2879,13 @@ function Eo(e, t) {
2879
2879
  return;
2880
2880
  }
2881
2881
  let h = u & 1 && f, g = !ji(e), _;
2882
- if (g && (_ = o && o.onVnodeBeforeUnmount) && ls(_, t, e), u & 6) z(e.component, n, r);
2882
+ if (g && (_ = o && o.onVnodeBeforeUnmount) && ls(_, t, e), u & 6) se(e.component, n, r);
2883
2883
  else {
2884
2884
  if (u & 128) {
2885
2885
  e.suspense.unmount(n, r);
2886
2886
  return;
2887
2887
  }
2888
- h && Br(e, null, t, "beforeUnmount"), u & 64 ? e.type.remove(e, t, n, ue, r) : l && !l.hasOnce && (a !== K || d > 0 && d & 64) ? se(l, t, n, !1, !0) : (a === K && d & 384 || !i && u & 16) && se(c, t, n), r && ae(e);
2888
+ h && Br(e, null, t, "beforeUnmount"), u & 64 ? e.type.remove(e, t, n, ue, r) : l && !l.hasOnce && (a !== K || d > 0 && d & 64) ? ce(l, t, n, !1, !0) : (a === K && d & 384 || !i && u & 16) && ce(c, t, n), r && ae(e);
2889
2889
  }
2890
2890
  let v = m != null && p == null;
2891
2891
  (g && (_ = o && o.onVnodeUnmounted) || h || v) && wo(() => {
@@ -2914,22 +2914,22 @@ function Eo(e, t) {
2914
2914
  let n;
2915
2915
  for (; e !== t;) n = f(e), i(e), e = n;
2916
2916
  i(t);
2917
- }, z = (e, t, n) => {
2917
+ }, se = (e, t, n) => {
2918
2918
  process.env.NODE_ENV !== "production" && e.type.__hmrId && dr(e);
2919
2919
  let { bum: r, scope: i, job: a, subTree: o, um: s, m: c, a: l } = e;
2920
2920
  No(c), No(l), r && de(r), i.stop(), a && (a.flags |= 8, ie(o, e, t, n)), s && wo(s, t), wo(() => {
2921
2921
  e.isUnmounted = !0;
2922
2922
  }, t), process.env.NODE_ENV !== "production" && Or(e);
2923
- }, se = (e, t, n, r = !1, i = !1, a = 0) => {
2923
+ }, ce = (e, t, n, r = !1, i = !1, a = 0) => {
2924
2924
  for (let o = a; o < e.length; o++) ie(e[o], t, n, r, i);
2925
- }, B = (e) => {
2926
- if (e.shapeFlag & 6) return B(e.component.subTree);
2925
+ }, z = (e) => {
2926
+ if (e.shapeFlag & 6) return z(e.component.subTree);
2927
2927
  if (e.shapeFlag & 128) return e.suspense.next();
2928
2928
  let t = f(e.anchor || e.el), n = t && t[Xr];
2929
2929
  return n ? f(n) : t;
2930
- }, ce = !1, le = (e, t, n) => {
2930
+ }, le = !1, B = (e, t, n) => {
2931
2931
  let r;
2932
- e == null ? t._vnode && (ie(t._vnode, null, null, !0), r = t._vnode.component) : h(t._vnode || null, e, t, null, null, null, n), t._vnode = e, ce ||= (ce = !0, tr(r), nr(), !1);
2932
+ e == null ? t._vnode && (ie(t._vnode, null, null, !0), r = t._vnode.component) : h(t._vnode || null, e, t, null, null, null, n), t._vnode = e, le ||= (le = !0, tr(r), nr(), !1);
2933
2933
  }, ue = {
2934
2934
  p: h,
2935
2935
  um: ie,
@@ -2939,13 +2939,13 @@ function Eo(e, t) {
2939
2939
  mc: O,
2940
2940
  pc: R,
2941
2941
  pbc: A,
2942
- n: B,
2942
+ n: z,
2943
2943
  o: e
2944
2944
  }, pe, me;
2945
2945
  return t && ([pe, me] = t(ue)), {
2946
- render: le,
2946
+ render: B,
2947
2947
  hydrate: pe,
2948
- createApp: wa(le, pe)
2948
+ createApp: wa(B, pe)
2949
2949
  };
2950
2950
  }
2951
2951
  function Do({ type: e, props: t }, n) {
@@ -3798,7 +3798,7 @@ function Oc(e, t, n) {
3798
3798
  else if (n ??= "", process.env.NODE_ENV !== "production" && Ec.test(n) && Us(`Unexpected semicolon at the end of '${t}' style value: '${n}'`), t.startsWith("--")) e.setProperty(t, n);
3799
3799
  else {
3800
3800
  let r = jc(e, t);
3801
- Dc.test(n) ? e.setProperty(B(r), n.replace(Dc, ""), "important") : e[r] = n;
3801
+ Dc.test(n) ? e.setProperty(z(r), n.replace(Dc, ""), "important") : e[r] = n;
3802
3802
  }
3803
3803
  }
3804
3804
  var kc = [
@@ -3809,9 +3809,9 @@ var kc = [
3809
3809
  function jc(e, t) {
3810
3810
  let n = Ac[t];
3811
3811
  if (n) return n;
3812
- let r = z(t);
3812
+ let r = se(t);
3813
3813
  if (r !== "filter" && r in e) return Ac[t] = r;
3814
- r = ce(r);
3814
+ r = le(r);
3815
3815
  for (let n = 0; n < kc.length; n++) {
3816
3816
  let i = kc[n] + r;
3817
3817
  if (i in e) return Ac[t] = i;
@@ -3867,7 +3867,7 @@ var Bc = /(Once|Passive|Capture)$/, Vc = /^on:?(?:Once|Passive|Capture)$/;
3867
3867
  function Hc(e) {
3868
3868
  let t, n;
3869
3869
  for (; (n = e.match(Bc)) && !Vc.test(e);) t ||= {}, e = e.slice(0, e.length - n[1].length), t[n[1].toLowerCase()] = !0;
3870
- return [e[2] === ":" ? e.slice(3) : B(e.slice(2)), t];
3870
+ return [e[2] === ":" ? e.slice(3) : z(e.slice(2)), t];
3871
3871
  }
3872
3872
  var Uc = 0, Wc = /* @__PURE__ */ Promise.resolve(), Gc = () => Uc ||= (Wc.then(() => Uc = 0), Date.now());
3873
3873
  function Kc(e, t) {
@@ -3895,7 +3895,7 @@ Expected function or array of functions, received type ${typeof e}.`), b);
3895
3895
  }
3896
3896
  var Jc = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && e.charCodeAt(2) > 96 && e.charCodeAt(2) < 123, Yc = (e, t, n, r, i, a) => {
3897
3897
  let o = i === "svg";
3898
- t === "class" ? vc(e, r, o) : t === "style" ? Tc(e, n, r) : S(t) ? C(t) || zc(e, t, n, r, a) : (t[0] === "." ? (t = t.slice(1), !0) : t[0] === "^" ? (t = t.slice(1), !1) : Xc(e, t, r, o)) ? (Fc(e, t, r), !e.tagName.includes("-") && (t === "value" || t === "checked" || t === "selected") && Pc(e, t, r, o, a, t !== "value")) : e._isVueCE && (Zc(e, t) || e._def.__asyncLoader && (/[A-Z]/.test(t) || !N(r))) ? Fc(e, z(t), r, a, t) : (t === "true-value" ? e._trueValue = r : t === "false-value" && (e._falseValue = r), Pc(e, t, r, o));
3898
+ t === "class" ? vc(e, r, o) : t === "style" ? Tc(e, n, r) : S(t) ? C(t) || zc(e, t, n, r, a) : (t[0] === "." ? (t = t.slice(1), !0) : t[0] === "^" ? (t = t.slice(1), !1) : Xc(e, t, r, o)) ? (Fc(e, t, r), !e.tagName.includes("-") && (t === "value" || t === "checked" || t === "selected") && Pc(e, t, r, o, a, t !== "value")) : e._isVueCE && (Zc(e, t) || e._def.__asyncLoader && (/[A-Z]/.test(t) || !N(r))) ? Fc(e, se(t), r, a, t) : (t === "true-value" ? e._trueValue = r : t === "false-value" && (e._falseValue = r), Pc(e, t, r, o));
3899
3899
  };
3900
3900
  function Xc(e, t, n, r) {
3901
3901
  if (r) return !!(t === "innerHTML" || t === "textContent" || t in e && Jc(t) && M(n));
@@ -3909,8 +3909,8 @@ function Xc(e, t, n, r) {
3909
3909
  function Zc(e, t) {
3910
3910
  let n = e._def.props;
3911
3911
  if (!n) return !1;
3912
- let r = z(t);
3913
- return Array.isArray(n) ? n.some((e) => z(e) === r) : Object.keys(n).some((e) => z(e) === r);
3912
+ let r = se(t);
3913
+ return Array.isArray(n) ? n.some((e) => se(e) === r) : Object.keys(n).some((e) => se(e) === r);
3914
3914
  }
3915
3915
  var Qc = (e) => {
3916
3916
  let t = e.props["onUpdate:modelValue"] || !1;
@@ -5976,10 +5976,10 @@ var ed = /* @__PURE__ */ m(((e, t) => {
5976
5976
  e.begin = e.match, delete e.match;
5977
5977
  }
5978
5978
  }
5979
- function z(e, t) {
5979
+ function se(e, t) {
5980
5980
  e.relevance === void 0 && (e.relevance = 1);
5981
5981
  }
5982
- var se = (e, t) => {
5982
+ var ce = (e, t) => {
5983
5983
  if (!e.beforeMatch) return;
5984
5984
  if (e.starts) throw Error("beforeMatch cannot be used with starts");
5985
5985
  let n = Object.assign({}, e);
@@ -5989,7 +5989,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
5989
5989
  relevance: 0,
5990
5990
  contains: [Object.assign(n, { endsParent: !0 })]
5991
5991
  }, e.relevance = 0, delete n.beforeMatch;
5992
- }, B = [
5992
+ }, z = [
5993
5993
  "of",
5994
5994
  "and",
5995
5995
  "for",
@@ -6001,11 +6001,11 @@ var ed = /* @__PURE__ */ m(((e, t) => {
6001
6001
  "parent",
6002
6002
  "list",
6003
6003
  "value"
6004
- ], ce = "keyword";
6005
- function le(e, t, n = ce) {
6004
+ ], le = "keyword";
6005
+ function B(e, t, n = le) {
6006
6006
  let r = Object.create(null);
6007
6007
  return typeof e == "string" ? i(n, e.split(" ")) : Array.isArray(e) ? i(n, e) : Object.keys(e).forEach(function(n) {
6008
- Object.assign(r, le(e[n], t, n));
6008
+ Object.assign(r, B(e[n], t, n));
6009
6009
  }), r;
6010
6010
  function i(e, n) {
6011
6011
  t && (n = n.map((e) => e.toLowerCase())), n.forEach(function(t) {
@@ -6018,7 +6018,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
6018
6018
  return t ? Number(t) : +!de(e);
6019
6019
  }
6020
6020
  function de(e) {
6021
- return B.includes(e.toLowerCase());
6021
+ return z.includes(e.toLowerCase());
6022
6022
  }
6023
6023
  var fe = {}, pe = (e) => {
6024
6024
  console.error(e);
@@ -6119,14 +6119,14 @@ var ed = /* @__PURE__ */ m(((e, t) => {
6119
6119
  re,
6120
6120
  oe,
6121
6121
  xe,
6122
- se
6122
+ ce
6123
6123
  ].forEach((e) => e(n, r)), e.compilerExtensions.forEach((e) => e(n, r)), n.__beforeBegin = null, [
6124
6124
  ie,
6125
6125
  ae,
6126
- z
6126
+ se
6127
6127
  ].forEach((e) => e(n, r)), n.isCompiled = !0;
6128
6128
  let s = null;
6129
- return typeof n.keywords == "object" && n.keywords.$pattern && (n.keywords = Object.assign({}, n.keywords), s = n.keywords.$pattern, delete n.keywords.$pattern), s ||= /\w+/, n.keywords &&= le(n.keywords, e.case_insensitive), a.keywordPatternRe = t(s, !0), r && (n.begin ||= /\B|\b/, a.beginRe = t(a.begin), !n.end && !n.endsWithParent && (n.end = /\B|\b/), n.end && (a.endRe = t(a.end)), a.terminatorEnd = p(a.end) || "", n.endsWithParent && r.terminatorEnd && (a.terminatorEnd += (n.end ? "|" : "") + r.terminatorEnd)), n.illegal && (a.illegalRe = t(n.illegal)), n.contains ||= [], n.contains = [].concat(...n.contains.map(function(e) {
6129
+ return typeof n.keywords == "object" && n.keywords.$pattern && (n.keywords = Object.assign({}, n.keywords), s = n.keywords.$pattern, delete n.keywords.$pattern), s ||= /\w+/, n.keywords &&= B(n.keywords, e.case_insensitive), a.keywordPatternRe = t(s, !0), r && (n.begin ||= /\B|\b/, a.beginRe = t(a.begin), !n.end && !n.endsWithParent && (n.end = /\B|\b/), n.end && (a.endRe = t(a.end)), a.terminatorEnd = p(a.end) || "", n.endsWithParent && r.terminatorEnd && (a.terminatorEnd += (n.end ? "|" : "") + r.terminatorEnd)), n.illegal && (a.illegalRe = t(n.illegal)), n.contains ||= [], n.contains = [].concat(...n.contains.map(function(e) {
6130
6130
  return we(e === "self" ? n : e);
6131
6131
  })), n.contains.forEach(function(e) {
6132
6132
  o(e, a);
@@ -11345,7 +11345,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
11345
11345
  ie("#"),
11346
11346
  re
11347
11347
  ]
11348
- }, oe = { match: i(/`/, x, /`/) }, z = [
11348
+ }, oe = { match: i(/`/, x, /`/) }, se = [
11349
11349
  oe,
11350
11350
  {
11351
11351
  className: "variable",
@@ -11355,7 +11355,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
11355
11355
  className: "variable",
11356
11356
  match: `\\$${b}+`
11357
11357
  }
11358
- ], se = [
11358
+ ], ce = [
11359
11359
  {
11360
11360
  match: /(@|#(un)?)available/,
11361
11361
  scope: "keyword",
@@ -11378,7 +11378,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
11378
11378
  scope: "meta",
11379
11379
  match: i(/@/, x)
11380
11380
  }
11381
- ], B = {
11381
+ ], z = {
11382
11382
  match: r(/\b[A-Z]/),
11383
11383
  relevance: 0,
11384
11384
  contains: [
@@ -11404,20 +11404,20 @@ var ed = /* @__PURE__ */ m(((e, t) => {
11404
11404
  relevance: 0
11405
11405
  }
11406
11406
  ]
11407
- }, ce = {
11407
+ }, le = {
11408
11408
  begin: /</,
11409
11409
  end: />/,
11410
11410
  keywords: D,
11411
11411
  contains: [
11412
11412
  ...a,
11413
11413
  ...O,
11414
- ...se,
11414
+ ...ce,
11415
11415
  A,
11416
- B
11416
+ z
11417
11417
  ]
11418
11418
  };
11419
- B.contains.push(ce);
11420
- let le = {
11419
+ z.contains.push(le);
11420
+ let B = {
11421
11421
  begin: /\(/,
11422
11422
  end: /\)/,
11423
11423
  relevance: 0,
@@ -11436,15 +11436,15 @@ var ed = /* @__PURE__ */ m(((e, t) => {
11436
11436
  ...j,
11437
11437
  P,
11438
11438
  te,
11439
- ...z,
11440
11439
  ...se,
11441
- B
11440
+ ...ce,
11441
+ z
11442
11442
  ]
11443
11443
  }, ue = {
11444
11444
  begin: /</,
11445
11445
  end: />/,
11446
11446
  keywords: "repeat each",
11447
- contains: [...a, B]
11447
+ contains: [...a, z]
11448
11448
  }, de = {
11449
11449
  begin: /\(/,
11450
11450
  end: /\)/,
@@ -11467,9 +11467,9 @@ var ed = /* @__PURE__ */ m(((e, t) => {
11467
11467
  ...j,
11468
11468
  P,
11469
11469
  te,
11470
- ...se,
11471
- B,
11472
- le
11470
+ ...ce,
11471
+ z,
11472
+ B
11473
11473
  ],
11474
11474
  endsParent: !0,
11475
11475
  illegal: /["']/
@@ -11518,7 +11518,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
11518
11518
  1: "keyword",
11519
11519
  3: "title"
11520
11520
  },
11521
- contains: [B],
11521
+ contains: [z],
11522
11522
  keywords: [...p, ...f],
11523
11523
  end: /}/
11524
11524
  }, ge = {
@@ -11580,7 +11580,7 @@ var ed = /* @__PURE__ */ m(((e, t) => {
11580
11580
  ...j,
11581
11581
  P,
11582
11582
  te,
11583
- ...z
11583
+ ...se
11584
11584
  ];
11585
11585
  t.contains = [...n, {
11586
11586
  begin: /\(/,
@@ -11612,10 +11612,10 @@ var ed = /* @__PURE__ */ m(((e, t) => {
11612
11612
  ...j,
11613
11613
  P,
11614
11614
  te,
11615
- ...z,
11616
11615
  ...se,
11617
- B,
11618
- le
11616
+ ...ce,
11617
+ z,
11618
+ B
11619
11619
  ]
11620
11620
  };
11621
11621
  }
@@ -14683,25 +14683,25 @@ function Qg(e, t) {
14683
14683
  return n;
14684
14684
  }
14685
14685
  function $g(e = {}) {
14686
- let t = e.window ?? globalThis.window, n = e.schemas ?? {};
14686
+ let t = e.window ?? globalThis.window, n = typeof e.schemas == "function" ? e.schemas : () => e.schemas ?? {};
14687
14687
  return async ({ messages: e }) => {
14688
14688
  let r = Xg(e);
14689
14689
  if (!r.length) return { ok: !0 };
14690
- let i = Zg(e), a = [];
14691
- for (let { path: e, op: o, callId: s } of r) {
14690
+ let i = Zg(e), a = n(), o = [];
14691
+ for (let { path: e, op: n, callId: s } of r) {
14692
14692
  let r = s ? i.get(s) : void 0;
14693
14693
  if (r && Yg.test(r)) continue;
14694
14694
  let c = Qg(t, e);
14695
- if (o === "delete_window_prop") c !== void 0 && a.push(`${e} 删除后读回仍有值,疑似未生效`);
14696
- else if (c == null) a.push(`写入 ${e} 后读回为空,疑似未生效`);
14697
- else if (n[e]) {
14698
- let t = n[e].safeParse(c);
14699
- t.success || a.push(`${e} 读回值不符合 schema:${t.error.issues?.[0]?.message ?? "校验失败"}`);
14695
+ if (n === "delete_window_prop") c !== void 0 && o.push(`${e} 删除后读回仍有值,疑似未生效`);
14696
+ else if (c == null) o.push(`写入 ${e} 后读回为空,疑似未生效`);
14697
+ else if (a[e]) {
14698
+ let t = a[e].safeParse(c);
14699
+ t.success || o.push(`${e} 读回值不符合 schema:${t.error.issues?.[0]?.message ?? "校验失败"}`);
14700
14700
  }
14701
14701
  }
14702
- return a.length ? {
14702
+ return o.length ? {
14703
14703
  ok: !1,
14704
- feedback: a.join(";\n")
14704
+ feedback: o.join(";\n")
14705
14705
  } : { ok: !0 };
14706
14706
  };
14707
14707
  }
@@ -15765,13 +15765,23 @@ function uv(e, t) {
15765
15765
  function dv(e, r = {}) {
15766
15766
  let i = /* @__PURE__ */ new Map();
15767
15767
  for (let t of e) i.set(t.path, t);
15768
- let a = /* @__PURE__ */ new Map(), o = r.maxSnapshots ?? 20, s = (e) => {
15768
+ let a = /* @__PURE__ */ new Map(), o = r.maxSnapshots ?? 20, s = {
15769
+ add: (e) => {
15770
+ i.set(e.path, e);
15771
+ },
15772
+ remove: (e) => {
15773
+ let t = i.delete(e);
15774
+ return t && a.delete(e), t;
15775
+ },
15776
+ list: () => [...i.values()],
15777
+ has: (e) => i.has(e)
15778
+ }, c = (e) => {
15769
15779
  r.onAudit?.(e);
15770
- }, c = (r.whitelist ?? !0) === !1;
15771
- function l(e) {
15772
- return r.allowRawRead ? !0 : [...i.keys()].some((t) => e === t || e.startsWith(t + ".") || c && t.startsWith(e + "."));
15780
+ }, l = (r.whitelist ?? !0) === !1;
15781
+ function u(e) {
15782
+ return r.allowRawRead ? !0 : [...i.keys()].some((t) => e === t || e.startsWith(t + ".") || l && t.startsWith(e + "."));
15773
15783
  }
15774
- function u(e, t, n) {
15784
+ function d(e, t, n) {
15775
15785
  let r = av(nv(window, e)), i = a.get(e) || [], s = i.length ? i[i.length - 1].id + 1 : 1;
15776
15786
  for (i.push({
15777
15787
  id: s,
@@ -15782,7 +15792,7 @@ function dv(e, r = {}) {
15782
15792
  }); i.length > o;) i.shift();
15783
15793
  return a.set(e, i), s;
15784
15794
  }
15785
- let d = n(async () => {
15795
+ let f = n(async () => {
15786
15796
  if (!i.size) return "当前没有已注册的可操作 window 属性。";
15787
15797
  let e = [...i.values()].map((e) => `- ${e.path}: ${e.description}`);
15788
15798
  return `可操作的 window 属性(共 ${i.size} 项):\n${e.join("\n")}`;
@@ -15790,7 +15800,7 @@ function dv(e, r = {}) {
15790
15800
  name: "list_window_props",
15791
15801
  description: "列出所有已注册、可操作的 window 属性(path + 说明)。操作 window 前先调用此工具了解可用范围。",
15792
15802
  schema: t.object({})
15793
- }), f = n(async ({ path: e }) => {
15803
+ }), p = n(async ({ path: e }) => {
15794
15804
  let t = i.get(e);
15795
15805
  return t ? [
15796
15806
  `路径: ${t.path}`,
@@ -15806,8 +15816,8 @@ function dv(e, r = {}) {
15806
15816
  name: "describe_window_prop",
15807
15817
  description: "获取单个已注册 window 属性的说明与格式要求。",
15808
15818
  schema: t.object({ path: t.string().describe("属性路径,如 app.theme") })
15809
- }), p = n(async ({ path: e }) => {
15810
- if (!l(e)) return $({
15819
+ }), m = n(async ({ path: e }) => {
15820
+ if (!u(e)) return $({
15811
15821
  code: "NOT_REGISTERED",
15812
15822
  path: e,
15813
15823
  message: `属性 "${e}" 不可读取(未注册,且非已注册路径的后代)`,
@@ -15819,7 +15829,7 @@ function dv(e, r = {}) {
15819
15829
  name: "get_window_prop",
15820
15830
  description: "读取一个已注册 window 属性的当前值(安全序列化:函数/DOM/循环引用做摘要;大结果由系统自动外存,提示用 vfs_read 回读)。字段白名单读模式(默认)下仅可读注册 path 自身/后代;未注册祖先(整体大 JSON)不可读,避免大 JSON 拉进上下文。",
15821
15831
  schema: t.object({ path: t.string().describe("已注册的属性路径或其后代") })
15822
- }), m = n(async ({ path: e, value: t }) => {
15832
+ }), h = n(async ({ path: e, value: t }) => {
15823
15833
  let n = i.get(e);
15824
15834
  if (!n) return $({
15825
15835
  code: "NOT_REGISTERED",
@@ -15835,9 +15845,9 @@ function dv(e, r = {}) {
15835
15845
  }
15836
15846
  let a = n.schema.safeParse(r);
15837
15847
  if (!a.success) return D_(e, a.error.issues);
15838
- u(e, "set");
15848
+ d(e, "set");
15839
15849
  let o = nv(window, e);
15840
- return typeof o == "object" && o && a.data !== null && typeof a.data == "object" ? uv(o, a.data) : rv(window, e, a.data), s({
15850
+ return typeof o == "object" && o && a.data !== null && typeof a.data == "object" ? uv(o, a.data) : rv(window, e, a.data), c({
15841
15851
  op: "set",
15842
15852
  path: e,
15843
15853
  value: a.data,
@@ -15850,7 +15860,7 @@ function dv(e, r = {}) {
15850
15860
  path: t.string().describe("已注册的属性路径"),
15851
15861
  value: t.string().describe("JSON 字符串形式的值,需符合该属性 schema")
15852
15862
  })
15853
- }), h = n(async ({ path: e, op: t, jsonPath: n, value: r }) => {
15863
+ }), g = n(async ({ path: e, op: t, jsonPath: n, value: r }) => {
15854
15864
  let a = i.get(e);
15855
15865
  if (!a) return $({
15856
15866
  code: "NOT_REGISTERED",
@@ -15865,7 +15875,7 @@ function dv(e, r = {}) {
15865
15875
  message: `jsonPath "${o}" 含非法段(__proto__/constructor/prototype)`,
15866
15876
  hint: "使用正常的属性路径,如 components.0.text(数组索引用数字)"
15867
15877
  });
15868
- let c;
15878
+ let s;
15869
15879
  if (t !== "remove") {
15870
15880
  if (r === void 0 || r === "") return $({
15871
15881
  code: "MISSING_VALUE",
@@ -15874,7 +15884,7 @@ function dv(e, r = {}) {
15874
15884
  hint: `op 为 ${t} 时 value 必填;若想删除请用 op:'remove'`
15875
15885
  });
15876
15886
  try {
15877
- c = JSON.parse(r);
15887
+ s = JSON.parse(r);
15878
15888
  } catch (t) {
15879
15889
  return O_(e, r, t);
15880
15890
  }
@@ -15886,19 +15896,19 @@ function dv(e, r = {}) {
15886
15896
  message: `edit 仅适用于对象/数组属性,"${e}" 当前是 ${l === void 0 ? "undefined" : typeof l}`,
15887
15897
  hint: "叶子属性(原始类型)请用 set_window_prop 整体设置"
15888
15898
  });
15889
- let d = av(l), f = sv(d, t, o, c);
15899
+ let u = av(l), f = sv(u, t, o, s);
15890
15900
  if (f) return $({
15891
15901
  code: "PATCH_FAILED",
15892
15902
  path: e,
15893
15903
  message: f,
15894
15904
  hint: "检查 op 与目标类型:merge 需目标为对象,append 需目标为数组;jsonPath 指向需存在"
15895
15905
  });
15896
- let p = a.schema.safeParse(d);
15897
- return p.success ? (u(e, "edit"), cv(e, t, o, c), s({
15906
+ let p = a.schema.safeParse(u);
15907
+ return p.success ? (d(e, "edit"), cv(e, t, o, s), c({
15898
15908
  op: "edit",
15899
15909
  path: e,
15900
15910
  detail: `${t}${o ? "@" + o : ""}`,
15901
- value: c,
15911
+ value: s,
15902
15912
  timestamp: Date.now()
15903
15913
  }), `已 edit ${e}(${t}${o ? " @ " + o : ""})。当前值:${ov(nv(window, e), 600)}`) : D_(e, p.error.issues);
15904
15914
  }, {
@@ -15915,16 +15925,16 @@ function dv(e, r = {}) {
15915
15925
  jsonPath: t.string().optional().describe("相对属性根的点号路径(数组索引用数字,如 components.0.text)。set/remove 必填;merge/append 不填则作用于根"),
15916
15926
  value: t.string().optional().describe("JSON 字符串(set/merge/append 必填)")
15917
15927
  })
15918
- }), g = n(async ({ path: e }) => {
15928
+ }), _ = n(async ({ path: e }) => {
15919
15929
  if (!i.has(e)) return $({
15920
15930
  code: "NOT_REGISTERED",
15921
15931
  path: e,
15922
15932
  message: `属性 "${e}" 未在注册表中声明,不可删除`,
15923
15933
  hint: "用 list_window_props 查看可用属性"
15924
15934
  });
15925
- u(e, "delete");
15935
+ d(e, "delete");
15926
15936
  let t = iv(window, e);
15927
- return s({
15937
+ return c({
15928
15938
  op: "delete",
15929
15939
  path: e,
15930
15940
  timestamp: Date.now()
@@ -15933,7 +15943,7 @@ function dv(e, r = {}) {
15933
15943
  name: "delete_window_prop",
15934
15944
  description: "删除一个已注册 window 属性。",
15935
15945
  schema: t.object({ path: t.string().describe("已注册的属性路径") })
15936
- }), _ = n(async ({ path: e, label: t }) => i.has(e) ? `已为 ${e} 创建快照 #${u(e, "manual", t)}${t ? `(${t})` : ""}。可用 list_window_snapshots 查看、restore_window_snapshot 回退。` : $({
15946
+ }), v = n(async ({ path: e, label: t }) => i.has(e) ? `已为 ${e} 创建快照 #${d(e, "manual", t)}${t ? `(${t})` : ""}。可用 list_window_snapshots 查看、restore_window_snapshot 回退。` : $({
15937
15947
  code: "NOT_REGISTERED",
15938
15948
  path: e,
15939
15949
  message: `属性 "${e}" 未注册,无法打快照`,
@@ -15945,7 +15955,7 @@ function dv(e, r = {}) {
15945
15955
  path: t.string().describe("已注册的属性路径"),
15946
15956
  label: t.string().optional().describe("可选的快照标签,便于识别")
15947
15957
  })
15948
- }), v = n(async ({ path: e }) => {
15958
+ }), y = n(async ({ path: e }) => {
15949
15959
  let t = e ? [e] : [...i.keys()];
15950
15960
  if (e && !i.has(e)) return $({
15951
15961
  code: "NOT_REGISTERED",
@@ -15971,7 +15981,7 @@ function dv(e, r = {}) {
15971
15981
  name: "list_window_snapshots",
15972
15982
  description: "列出 window 属性的快照时间线(序号、操作类型、标签、大小)。不传 path 列出所有属性。",
15973
15983
  schema: t.object({ path: t.string().optional().describe("限定单个属性,不传则列出全部") })
15974
- }), y = n(async ({ path: e, id: t }) => {
15984
+ }), b = n(async ({ path: e, id: t }) => {
15975
15985
  let n = i.get(e);
15976
15986
  if (!n) return $({
15977
15987
  code: "NOT_REGISTERED",
@@ -15993,8 +16003,8 @@ function dv(e, r = {}) {
15993
16003
  message: `未找到快照 #${t}`,
15994
16004
  hint: "用 list_window_snapshots 查看可用快照序号"
15995
16005
  });
15996
- let c = n.schema.safeParse(o.value);
15997
- return c.success ? (lv(e, av(o.value)), s({
16006
+ let s = n.schema.safeParse(o.value);
16007
+ return s.success ? (lv(e, av(o.value)), c({
15998
16008
  op: "restore",
15999
16009
  path: e,
16000
16010
  detail: `#${o.id}`,
@@ -16004,7 +16014,7 @@ function dv(e, r = {}) {
16004
16014
  path: e,
16005
16015
  message: `快照 #${o.id} 的值不符合当前 schema,无法回退`,
16006
16016
  hint: "schema 可能已变更;该快照已过期,选其他快照或重新设置",
16007
- details: E_(c.error.issues)
16017
+ details: E_(s.error.issues)
16008
16018
  });
16009
16019
  }, {
16010
16020
  name: "restore_window_snapshot",
@@ -16013,15 +16023,14 @@ function dv(e, r = {}) {
16013
16023
  path: t.string().describe("已注册的属性路径"),
16014
16024
  id: t.number().int().optional().describe("指定快照序号;不传则回退最近一次")
16015
16025
  })
16016
- });
16017
- return [
16018
- d,
16026
+ }), x = [
16019
16027
  f,
16020
16028
  p,
16029
+ m,
16021
16030
  n(async ({ paths: e }) => {
16022
16031
  let t = [];
16023
16032
  for (let n of e) {
16024
- if (!l(n)) {
16033
+ if (!u(n)) {
16025
16034
  t.push(`- ${n} = ERROR: ${$({
16026
16035
  code: "NOT_REGISTERED",
16027
16036
  path: n,
@@ -16039,12 +16048,12 @@ function dv(e, r = {}) {
16039
16048
  description: "批量按路径读取 window 属性的局部或多个字段(避免对大 JSON 整体读取)。paths 支持注册属性的任意后代路径(如 page.components.0.text)、自身。字段白名单读模式(默认)下未注册祖先不可读。逐行返回 path = value;单个值过大仍由系统自动外存 vfs。",
16040
16049
  schema: t.object({ paths: t.array(t.string().describe("路径,如 page.components.0.text")).min(1).max(20) })
16041
16050
  }),
16042
- m,
16043
16051
  h,
16044
16052
  g,
16045
16053
  _,
16046
16054
  v,
16047
16055
  y,
16056
+ b,
16048
16057
  n(async ({ path: e, expr: t, limit: n }) => {
16049
16058
  if (!i.get(e)) return $({
16050
16059
  code: "NOT_REGISTERED",
@@ -16168,9 +16177,9 @@ function dv(e, r = {}) {
16168
16177
  hint: `确认脚本 return 了完整新值(非部分);按 describe_window_prop("${e}") 查看格式`,
16169
16178
  details: E_(t.error.issues)
16170
16179
  });
16171
- u(e, "edit", "eval_transform");
16180
+ d(e, "edit", "eval_transform");
16172
16181
  let n = nv(window, e);
16173
- return typeof n == "object" && n && t.data !== null && typeof t.data == "object" ? uv(n, t.data) : rv(window, e, t.data), s({
16182
+ return typeof n == "object" && n && t.data !== null && typeof t.data == "object" ? uv(n, t.data) : rv(window, e, t.data), c({
16174
16183
  op: "edit",
16175
16184
  path: e,
16176
16185
  detail: "eval_transform",
@@ -16192,6 +16201,12 @@ function dv(e, r = {}) {
16192
16201
  })
16193
16202
  })
16194
16203
  ];
16204
+ return Object.defineProperty(x, "controller", {
16205
+ value: s,
16206
+ enumerable: !1,
16207
+ configurable: !1,
16208
+ writable: !1
16209
+ }), x;
16195
16210
  }
16196
16211
  //#endregion
16197
16212
  //#region src/core/tools/fetchDoc.ts
@@ -16723,13 +16738,13 @@ function $v(e, r) {
16723
16738
  }) : null, g = !p || typeof p != "object" || p.auto !== !1, _ = e.capabilities, v = _?.windowOps !== !1, y = v ? dv(e.windowProps || [], {
16724
16739
  onAudit: e.debug ? (e) => console.log("[page-agent-sdk][window audit]", e) : void 0,
16725
16740
  maxSnapshots: e.maxSnapshots
16726
- }) : [], b = /* @__PURE__ */ new Map(), x = gv(_, y, pv);
16727
- x.forEach((e) => b.set(e.name, "builtin"));
16728
- let S = [...e.tools || []];
16729
- S.forEach((e) => b.set(e.name, "user"));
16730
- let C = e.humanConfirm !== !1 && (!e.approval || e.approval.humanConfirmTool !== !1), w = C ? Eg() : null;
16731
- w && b.set(wg, "builtin");
16732
- let T = m && h ? [n(async () => {
16741
+ }) : [], b = v ? y.controller ?? null : null, x = () => b?.list() ?? e.windowProps ?? [], S = /* @__PURE__ */ new Map(), C = gv(_, y, pv);
16742
+ C.forEach((e) => S.set(e.name, "builtin"));
16743
+ let w = [...e.tools || []];
16744
+ w.forEach((e) => S.set(e.name, "user"));
16745
+ let T = e.humanConfirm !== !1 && (!e.approval || e.approval.humanConfirmTool !== !1), E = T ? Eg() : null;
16746
+ E && S.set(wg, "builtin");
16747
+ let D = m && h ? [n(async () => {
16733
16748
  let e = h.list();
16734
16749
  return e.length ? h.restore() ? `已回退到最近一次正常状态(checkpoint #${e[e.length - 1].id})。对话历史、window 注册属性、vfs、todos 已整体还原。请基于回退后的状态重新判断并继续。` : "回退失败:无可用 checkpoint。" : "无可用 checkpoint,无法回退。";
16735
16750
  }, {
@@ -16744,83 +16759,83 @@ function $v(e, r) {
16744
16759
  description: "列出可用会话 checkpoint(回退点)。",
16745
16760
  schema: t.object({}).optional()
16746
16761
  })] : [];
16747
- T.forEach((e) => b.set(e.name, "builtin"));
16748
- let E = [
16749
- ...x,
16750
- ...S,
16751
- ...w ? [w] : [],
16752
- ...T
16753
- ], D = _?.planning !== !1, O = _?.skills !== !1, k = _?.vfs !== !1, A = _?.summarization !== !1, j = _?.memory !== !1, M = _?.subagent !== !1, N = e.verify?.maxAttempts ?? 2, P = _?.verify === !0 && e.verify?.enabled !== !1 && N > 0;
16762
+ D.forEach((e) => S.set(e.name, "builtin"));
16763
+ let O = [
16764
+ ...C,
16765
+ ...w,
16766
+ ...E ? [E] : [],
16767
+ ...D
16768
+ ], k = _?.planning !== !1, A = _?.skills !== !1, j = _?.vfs !== !1, M = _?.summarization !== !1, N = _?.memory !== !1, P = _?.subagent !== !1, F = e.verify?.maxAttempts ?? 2, I = _?.verify === !0 && e.verify?.enabled !== !1 && F > 0;
16754
16769
  e.verify?.check && _?.verify !== !0 && console.warn("[page-agent-sdk][verify] 检测到 verify.check 但 capabilities.verify 未开启,verify 未装载");
16755
- let F = e.subagent, I = F?.allowedTools ?? [], L = !M || F?.enabled === !1 ? void 0 : Ug({
16756
- llm: F?.llm ?? e.llm,
16757
- allTools: E,
16758
- allowedTools: I.length ? I : void 0,
16759
- systemPrompt: F?.systemPrompt,
16760
- temperature: F?.temperature,
16761
- maxTokens: F?.maxTokens,
16762
- skills: F?.skills,
16763
- maxDepth: F?.maxDepth,
16764
- maxParallel: F?.maxParallel,
16770
+ let L = e.subagent, R = L?.allowedTools ?? [], ee = !P || L?.enabled === !1 ? void 0 : Ug({
16771
+ llm: L?.llm ?? e.llm,
16772
+ allTools: O,
16773
+ allowedTools: R.length ? R : void 0,
16774
+ systemPrompt: L?.systemPrompt,
16775
+ temperature: L?.temperature,
16776
+ maxTokens: L?.maxTokens,
16777
+ skills: L?.skills,
16778
+ maxDepth: L?.maxDepth,
16779
+ maxParallel: L?.maxParallel,
16765
16780
  debug: e.debug
16766
- }), R = e.subagents?.length ? Kg(e.subagents, {
16781
+ }), te = e.subagents?.length ? Kg(e.subagents, {
16767
16782
  llm: e.llm,
16768
- allTools: E,
16783
+ allTools: O,
16769
16784
  debug: e.debug
16770
- }) : void 0, ee = [
16785
+ }) : void 0, ne = [
16771
16786
  "get_window_prop",
16772
16787
  "get_window_paths",
16773
16788
  "list_window_props",
16774
16789
  "describe_window_prop",
16775
16790
  "fetch_document"
16776
- ], te = E.filter((e) => ee.includes(e.name)), ne = P ? qg({
16777
- check: e.verify.check ?? $g({ schemas: Object.fromEntries((e.windowProps ?? []).map((e) => [e.path, e.schema])) }),
16791
+ ], re = O.filter((e) => ne.includes(e.name)), ie = I ? qg({
16792
+ check: e.verify.check ?? $g({ schemas: () => Object.fromEntries(x().map((e) => [e.path, e.schema])) }),
16778
16793
  adversarial: e.verify?.adversarial ? {
16779
16794
  llm: e.llm,
16780
- tools: te
16795
+ tools: re
16781
16796
  } : void 0
16782
- }) : void 0, re = vv({
16797
+ }) : void 0, ae = vv({
16783
16798
  ..._,
16784
- humanConfirm: C,
16799
+ humanConfirm: T,
16785
16800
  subagents: e.subagents?.map((e) => ({
16786
16801
  id: e.id,
16787
16802
  description: e.description,
16788
16803
  temperature: e.temperature
16789
16804
  }))
16790
- }, v && !!e.windowProps?.length), ie = e.onEvent, ae = /* @__PURE__ */ new Set(), oe = (e) => {
16805
+ }, v && !!e.windowProps?.length), oe = e.onEvent, se = /* @__PURE__ */ new Set(), ce = (e) => {
16791
16806
  if (e.type !== "approval_request") {
16792
- if (ie) try {
16793
- ie(e);
16807
+ if (oe) try {
16808
+ oe(e);
16794
16809
  } catch {}
16795
- for (let t of ae) try {
16810
+ for (let t of se) try {
16796
16811
  t(e);
16797
16812
  } catch {}
16798
16813
  }
16799
16814
  }, z = [
16800
- re,
16801
- ...D ? [u] : [],
16802
- ...O ? [gg(e.skills || [], { readVfs: k ? (e) => l.files[e]?.content : void 0 })] : [],
16803
- ...k ? [L_(l)] : [],
16804
- ...A ? [C_({
16815
+ ae,
16816
+ ...k ? [u] : [],
16817
+ ...A ? [gg(e.skills || [], { readVfs: j ? (e) => l.files[e]?.content : void 0 })] : [],
16818
+ ...j ? [L_(l)] : [],
16819
+ ...M ? [C_({
16805
16820
  ...T_(e, o.contextWindow),
16806
16821
  llmInvoke: s
16807
16822
  })] : [],
16808
- ...j ? [d] : [],
16823
+ ...N ? [d] : [],
16809
16824
  ...e.permissions?.length ? [Sg(e.permissions)] : [],
16810
16825
  ...m && g && h ? [Fg(h)] : [],
16811
- ...C ? [Dg()] : [],
16826
+ ...T ? [Dg()] : [],
16812
16827
  ...e.approval && (e.approval.tools !== void 0 || e.approval.confirm) ? [Cg(e.approval)] : [],
16813
- ...ne ? [ne] : [],
16814
- ...L ? [L] : [],
16815
- ...R ? [R] : [],
16828
+ ...ie ? [ie] : [],
16829
+ ...ee ? [ee] : [],
16830
+ ...te ? [te] : [],
16816
16831
  ...e.middleware || [],
16817
- Qv(oe, c)
16818
- ], se = e.maxMemoryRounds ?? Wv, B = {
16832
+ Qv(ce, c)
16833
+ ], le = e.maxMemoryRounds ?? Wv, B = {
16819
16834
  agentId: r,
16820
16835
  store: i,
16821
16836
  messages: c,
16822
16837
  vfsStore: l,
16823
- listeners: ae,
16838
+ listeners: se,
16824
16839
  todosMw: u,
16825
16840
  memoryMw: d,
16826
16841
  agent: null,
@@ -16834,7 +16849,7 @@ function $v(e, r) {
16834
16849
  t.messages?.length && c.push(...t.messages), t.vfs && l.hydrate && l.hydrate(t.vfs), t.todos?.length && u.reset(t.todos), t.memory && !e.memory && d.reset(t.memory);
16835
16850
  },
16836
16851
  afterRound() {
16837
- le(), ue();
16852
+ de(), fe();
16838
16853
  },
16839
16854
  async send(e) {
16840
16855
  await B.initDone, c.push({
@@ -16850,7 +16865,7 @@ function $v(e, r) {
16850
16865
  timestamp: Date.now()
16851
16866
  }), B.afterRound(), i && await i.flush(), e;
16852
16867
  } catch (e) {
16853
- throw oe({
16868
+ throw ce({
16854
16869
  type: "error",
16855
16870
  message: e?.message || String(e)
16856
16871
  }), e;
@@ -16864,8 +16879,8 @@ function $v(e, r) {
16864
16879
  },
16865
16880
  stream: (e, t, n) => {
16866
16881
  if (!B.agent) throw Error("page-agent-sdk: agent 尚未初始化完成,请先 await mount()");
16867
- let r = ie ? (e) => {
16868
- t?.(e), oe(e);
16882
+ let r = oe ? (e) => {
16883
+ t?.(e), ce(e);
16869
16884
  } : t;
16870
16885
  return B.agent.stream(e, r, n);
16871
16886
  },
@@ -16880,17 +16895,17 @@ function $v(e, r) {
16880
16895
  return {
16881
16896
  id: r,
16882
16897
  model: Kv(e.llm) ? e.llm.model ?? e.llm.modelName : e.llm.model,
16883
- tools: E.map((e) => ({
16898
+ tools: O.map((e) => ({
16884
16899
  name: e.name,
16885
16900
  description: e.description,
16886
16901
  schema: e.schema,
16887
- source: b.get(e.name) || "user"
16902
+ source: S.get(e.name) || "user"
16888
16903
  })),
16889
16904
  skills: (e.skills ?? []).map((e) => ({
16890
16905
  name: e.name,
16891
16906
  description: e.description
16892
16907
  })),
16893
- windowProps: (e.windowProps ?? []).map((e) => ({
16908
+ windowProps: x().map((e) => ({
16894
16909
  path: e.path,
16895
16910
  description: e.description,
16896
16911
  schema: e.schema
@@ -16902,15 +16917,15 @@ function $v(e, r) {
16902
16917
  status: e.status
16903
16918
  })),
16904
16919
  subagent: {
16905
- enabled: !!L,
16920
+ enabled: !!ee,
16906
16921
  maxDepth: e.subagent?.maxDepth ?? 1,
16907
16922
  maxParallel: e.subagent?.maxParallel ?? 4,
16908
16923
  allowedTools: e.subagent?.allowedTools ?? []
16909
16924
  },
16910
16925
  verify: {
16911
- enabled: !!ne,
16912
- maxAttempts: P ? N : 0,
16913
- adversarial: P && !!e.verify?.adversarial
16926
+ enabled: !!ie,
16927
+ maxAttempts: I ? F : 0,
16928
+ adversarial: I && !!e.verify?.adversarial
16914
16929
  },
16915
16930
  mcp: { servers: B.mcpServers },
16916
16931
  lastCompression: B.agent?.getState?.()?.lastCompression,
@@ -16922,7 +16937,7 @@ function $v(e, r) {
16922
16937
  };
16923
16938
  }
16924
16939
  };
16925
- async function ce() {
16940
+ async function ue() {
16926
16941
  if (!i) return;
16927
16942
  await i.ready;
16928
16943
  let t = e.session || {};
@@ -16940,11 +16955,11 @@ function $v(e, r) {
16940
16955
  } else B.sessionId = await i.createSession(r, t.title);
16941
16956
  e.memory && i.save(r, B.sessionId, { memory: e.memory });
16942
16957
  }
16943
- function le() {
16944
- let e = p_(c, se);
16958
+ function de() {
16959
+ let e = p_(c, le);
16945
16960
  e.trimmed && c.splice(e.deleteFrom, e.deleteCount, e.summary);
16946
16961
  }
16947
- function ue() {
16962
+ function fe() {
16948
16963
  if (!B.sessionId || !i) return;
16949
16964
  let t = JSON.parse(JSON.stringify(c));
16950
16965
  i.save(r, B.sessionId, { messages: t });
@@ -16952,7 +16967,7 @@ function $v(e, r) {
16952
16967
  i.save(r, B.sessionId, { todos: n }), e.debug && console.log("[page-agent-sdk][persist] save", B.sessionId, `${c.length} msgs`);
16953
16968
  }
16954
16969
  return B.initDone = (async () => {
16955
- if (await ce(), e.mcp?.length) {
16970
+ if (await ue(), e.mcp?.length) {
16956
16971
  let t = await Promise.allSettled(e.mcp.map((e) => l_(e)));
16957
16972
  B.mcpClosers = t.flatMap((e) => e.status === "fulfilled" ? [e.value.close] : []), B.mcpServers = [];
16958
16973
  let n = [];
@@ -16962,8 +16977,8 @@ function $v(e, r) {
16962
16977
  name: a,
16963
16978
  url: i.url,
16964
16979
  toolCount: t.value.tools.length
16965
- }), t.value.tools.forEach((e) => b.set(e.name, `mcp:${a}`)), n.push(...t.value.tools)) : console.warn(`[page-agent-sdk][mcp] server ${a} 连接失败:`, t.reason);
16966
- }), E.push(...n), e.debug && console.log(`[page-agent-sdk][mcp] 注入 ${n.length} 个工具,${B.mcpServers.length} 个 server`);
16980
+ }), t.value.tools.forEach((e) => S.set(e.name, `mcp:${a}`)), n.push(...t.value.tools)) : console.warn(`[page-agent-sdk][mcp] server ${a} 连接失败:`, t.reason);
16981
+ }), O.push(...n), e.debug && console.log(`[page-agent-sdk][mcp] 注入 ${n.length} 个工具,${B.mcpServers.length} 个 server`);
16967
16982
  }
16968
16983
  B.agent = sg({
16969
16984
  ...Kv(e.llm) ? { llm: e.llm } : {
@@ -16974,14 +16989,14 @@ function $v(e, r) {
16974
16989
  maxTokens: e.llm.maxTokens
16975
16990
  },
16976
16991
  systemPrompt: e.systemPrompt,
16977
- tools: E,
16992
+ tools: O,
16978
16993
  middleware: z,
16979
16994
  maxToolRounds: e.maxToolRounds,
16980
16995
  maxRetries: e.maxRetries,
16981
16996
  maxParallelTools: e.maxParallelTools,
16982
16997
  contextWindow: o.contextWindow,
16983
16998
  maxOutputTokens: o.maxOutputTokens,
16984
- maxVerifyAttempts: P ? N : 0,
16999
+ maxVerifyAttempts: I ? F : 0,
16985
17000
  debug: e.debug
16986
17001
  }), f.current = B.agent;
16987
17002
  })(), B;
@@ -17041,7 +17056,16 @@ function ey(e) {
17041
17056
  messages: i.messages,
17042
17057
  restoreLastCheckpoint: () => i.checkpoint?.restore() ?? !1,
17043
17058
  listCheckpoints: () => i.checkpoint?.list() ?? [],
17044
- hook: (e) => (i.listeners.add(e), () => i.listeners.delete(e))
17059
+ hook: (e) => (i.listeners.add(e), () => i.listeners.delete(e)),
17060
+ addWindowProp: (e) => {
17061
+ if (!windowOpsController) {
17062
+ console.warn("[page-agent-sdk] addWindowProp 忽略:windowOps 已关闭(capabilities.windowOps:false)");
17063
+ return;
17064
+ }
17065
+ windowOpsController.add(e);
17066
+ },
17067
+ removeWindowProp: (e) => windowOpsController ? windowOpsController.remove(e) : !1,
17068
+ listWindowProps: () => liveWindowProps()
17045
17069
  };
17046
17070
  }
17047
17071
  //#endregion