page-agent-sdk 4.8.3 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4569,7 +4569,7 @@ function ql(e, t) {
4569
4569
  code: "SCHEMA_INVALID",
4570
4570
  path: e,
4571
4571
  message: `值不符合 "${e}" 的 schema(${t.length} 处问题)`,
4572
- hint: `用 read({jsonPath:"${e}"}) 查看当前值,按 describe_data() 查看主数据 schema,修正后重试;改大对象优先用 write 的 patch 增量(只发改动部分)`,
4572
+ hint: `用 read({jsonPath:"${e}"}) 查看当前值,按 schema_data() 查看主数据 schema,修正后重试;改大对象优先用 write 的 patch 增量(只发改动部分)`,
4573
4573
  details: Kl(t)
4574
4574
  });
4575
4575
  }
@@ -4947,17 +4947,8 @@ function zu(e) {
4947
4947
  return !0;
4948
4948
  }
4949
4949
  //#endregion
4950
- //#region src/core/harness/writeGate.ts
4951
- function Bu(e, t, n) {
4952
- if (!e || !n || n.status === "error" || t && t.dryRun === !0) return !1;
4953
- let r = "writeCapable" in e ? e.writeCapable : void 0;
4954
- if (!(typeof r == "function" ? r(t ?? {}) : r === !0)) return !1;
4955
- let i = String(n.content || "");
4956
- return !(i.startsWith("ERROR:") || i.includes("未写入") || i.includes("无需删除"));
4957
- }
4958
- //#endregion
4959
4950
  //#region src/core/tools/sandbox.ts
4960
- function Vu(e) {
4951
+ function Bu(e) {
4961
4952
  let t = (t, n) => {
4962
4953
  try {
4963
4954
  Object.defineProperty(e, t, {
@@ -4985,7 +4976,7 @@ function Vu(e) {
4985
4976
  });
4986
4977
  } catch {}
4987
4978
  }
4988
- var Hu = `(${Vu.toString()})(self);`, Uu = [
4979
+ var Vu = `(${Bu.toString()})(self);`, Hu = [
4989
4980
  {
4990
4981
  re: /\bimport\s*\(/,
4991
4982
  msg: "动态 import() 拉外网模块"
@@ -5031,17 +5022,17 @@ var Hu = `(${Vu.toString()})(self);`, Uu = [
5031
5022
  msg: "沙箱脚本不允许反射访问"
5032
5023
  }
5033
5024
  ];
5034
- function Wu(e) {
5025
+ function Uu(e) {
5035
5026
  return /\breturn\b/.test(e) ? e : `return (${e})`;
5036
5027
  }
5037
- function Gu(e, t = 3e3) {
5028
+ function Wu(e, t = 3e3) {
5038
5029
  return async (n) => {
5039
- for (let { re: t, msg: n } of Uu) if (t.test(e)) return {
5030
+ for (let { re: t, msg: n } of Hu) if (t.test(e)) return {
5040
5031
  ok: !1,
5041
5032
  error: `沙箱拒绝执行:脚本含禁用模式(${n})`,
5042
5033
  elapsedMs: 0
5043
5034
  };
5044
- let r = Wu(e);
5035
+ let r = Uu(e);
5045
5036
  return new Promise((e) => {
5046
5037
  let i = Date.now(), a = !1, o = (t) => {
5047
5038
  if (!a) {
@@ -5054,7 +5045,7 @@ function Gu(e, t = 3e3) {
5054
5045
  elapsedMs: Date.now() - i
5055
5046
  });
5056
5047
  }
5057
- }, s = Hu + "\nself.onmessage = async (e) => {\n try {\n const fn = new Function(\"data\", e.data.script);\n try { self.eval = undefined; self.Function = undefined; } catch {}\n let result = fn(e.data.data);\n if (result && typeof result.then === \"function\") result = await result;\n self.postMessage({ ok: true, result });\n } catch (err) {\n self.postMessage({ ok: false, error: String((err && err.message) || err) });\n }\n};", c = "", l;
5048
+ }, s = Vu + "\nself.onmessage = async (e) => {\n try {\n const fn = new Function(\"data\", e.data.script);\n try { self.eval = undefined; self.Function = undefined; } catch {}\n let result = fn(e.data.data);\n if (result && typeof result.then === \"function\") result = await result;\n self.postMessage({ ok: true, result });\n } catch (err) {\n self.postMessage({ ok: false, error: String((err && err.message) || err) });\n }\n};", c = "", l;
5058
5049
  try {
5059
5050
  let e = new Blob([s], { type: "application/javascript" });
5060
5051
  c = URL.createObjectURL(e), l = new Worker(c);
@@ -5090,8 +5081,8 @@ function Gu(e, t = 3e3) {
5090
5081
  }
5091
5082
  //#endregion
5092
5083
  //#region src/core/tools/dataSlotQuery.ts
5093
- var Ku = /[\w$-]/;
5094
- function qu(e) {
5084
+ var Gu = /[\w$-]/;
5085
+ function Ku(e) {
5095
5086
  let t = [], n = e.trim(), r = +(n[0] === "$");
5096
5087
  for (; r < n.length;) {
5097
5088
  let e = n[r];
@@ -5102,7 +5093,7 @@ function qu(e) {
5102
5093
  continue;
5103
5094
  }
5104
5095
  let e = "";
5105
- for (; r < n.length && Ku.test(n[r]);) e += n[r++];
5096
+ for (; r < n.length && Gu.test(n[r]);) e += n[r++];
5106
5097
  if (!e) throw Error("JSONPath: .. 后缺属性名");
5107
5098
  t.push({
5108
5099
  type: "descendKey",
@@ -5115,7 +5106,7 @@ function qu(e) {
5115
5106
  continue;
5116
5107
  }
5117
5108
  let e = "";
5118
- for (; r < n.length && Ku.test(n[r]);) e += n[r++];
5109
+ for (; r < n.length && Gu.test(n[r]);) e += n[r++];
5119
5110
  if (!e) throw Error("JSONPath: . 后缺属性名");
5120
5111
  t.push({
5121
5112
  type: "key",
@@ -5171,7 +5162,7 @@ function qu(e) {
5171
5162
  }
5172
5163
  return t;
5173
5164
  }
5174
- function Ju(e) {
5165
+ function qu(e) {
5175
5166
  let t = [], n = 0, r = e.trim();
5176
5167
  for (; n < r.length;) {
5177
5168
  let e = r[n];
@@ -5216,7 +5207,7 @@ function Ju(e) {
5216
5207
  }
5217
5208
  return t;
5218
5209
  }
5219
- var Yu = class {
5210
+ var Ju = class {
5220
5211
  toks;
5221
5212
  item;
5222
5213
  pos = 0;
@@ -5252,12 +5243,12 @@ var Yu = class {
5252
5243
  return this.next(), e;
5253
5244
  }
5254
5245
  let e = this.operand(), t = this.peek();
5255
- return t === "==" || t === "!=" || t === "<" || t === "<=" || t === ">" || t === ">=" ? (this.next(), Qu(t, e, this.operand())) : Xu(e);
5246
+ return t === "==" || t === "!=" || t === "<" || t === "<=" || t === ">" || t === ">=" ? (this.next(), Zu(t, e, this.operand())) : Yu(e);
5256
5247
  }
5257
5248
  operand() {
5258
5249
  let e = this.next();
5259
5250
  if (e === void 0) throw Error("过滤表达式:缺操作数");
5260
- if (e.startsWith("@")) return Zu(e, this.item);
5251
+ if (e.startsWith("@")) return Xu(e, this.item);
5261
5252
  if (e[0] === "'" || e[0] === "\"") return e.slice(1, -1);
5262
5253
  if (e === "true") return !0;
5263
5254
  if (e === "false") return !1;
@@ -5267,10 +5258,10 @@ var Yu = class {
5267
5258
  throw Error(`过滤表达式:未知操作数 '${e}'`);
5268
5259
  }
5269
5260
  };
5270
- function Xu(e) {
5261
+ function Yu(e) {
5271
5262
  return !!e && e !== 0 && e !== "" && e !== null;
5272
5263
  }
5273
- function Zu(e, t) {
5264
+ function Xu(e, t) {
5274
5265
  let n = e.split(".").filter((e) => e && e !== "@"), r = t;
5275
5266
  for (let e of n) {
5276
5267
  if (typeof r != "object" || !r) return;
@@ -5278,7 +5269,7 @@ function Zu(e, t) {
5278
5269
  }
5279
5270
  return r;
5280
5271
  }
5281
- function Qu(e, t, n) {
5272
+ function Zu(e, t, n) {
5282
5273
  switch (e) {
5283
5274
  case "==": return t === n;
5284
5275
  case "!=": return t !== n;
@@ -5289,47 +5280,47 @@ function Qu(e, t, n) {
5289
5280
  default: return !1;
5290
5281
  }
5291
5282
  }
5292
- function $u(e, t) {
5293
- return new Yu(Ju(e), t).parse();
5283
+ function Qu(e, t) {
5284
+ return new Ju(qu(e), t).parse();
5294
5285
  }
5295
- function ed(e, t) {
5286
+ function $u(e, t) {
5296
5287
  return e ? `${e}.${t}` : String(t);
5297
5288
  }
5298
- function td(e, t) {
5289
+ function ed(e, t) {
5299
5290
  let n = [{
5300
5291
  path: "",
5301
5292
  value: e
5302
5293
  }];
5303
- for (let e of qu(t)) {
5294
+ for (let e of Ku(t)) {
5304
5295
  let t = [];
5305
5296
  if (e.type === "key") for (let r of n) r.value != null && typeof r.value == "object" && e.key in r.value && t.push({
5306
- path: ed(r.path, e.key),
5297
+ path: $u(r.path, e.key),
5307
5298
  value: r.value[e.key]
5308
5299
  });
5309
5300
  else if (e.type === "index") {
5310
5301
  for (let r of n) if (Array.isArray(r.value)) {
5311
5302
  let n = r.value[e.index];
5312
5303
  e.index >= 0 && e.index < r.value.length && t.push({
5313
- path: ed(r.path, e.index),
5304
+ path: $u(r.path, e.index),
5314
5305
  value: n,
5315
5306
  index: e.index
5316
5307
  });
5317
5308
  }
5318
5309
  } else if (e.type === "wildcard") {
5319
5310
  for (let e of n) if (Array.isArray(e.value)) e.value.forEach((n, r) => t.push({
5320
- path: ed(e.path, r),
5311
+ path: $u(e.path, r),
5321
5312
  value: n,
5322
5313
  index: r
5323
5314
  }));
5324
5315
  else if (e.value != null && typeof e.value == "object") for (let n of Object.keys(e.value)) t.push({
5325
- path: ed(e.path, n),
5316
+ path: $u(e.path, n),
5326
5317
  value: e.value[n]
5327
5318
  });
5328
5319
  } else if (e.type === "descendKey") {
5329
5320
  let r = e.key, i = (e) => {
5330
5321
  if (!(e.value == null || typeof e.value != "object")) for (let n of Object.keys(e.value)) {
5331
5322
  let a = {
5332
- path: ed(e.path, n),
5323
+ path: $u(e.path, n),
5333
5324
  value: e.value[n]
5334
5325
  };
5335
5326
  n === r && t.push(a), i(a);
@@ -5340,7 +5331,7 @@ function td(e, t) {
5340
5331
  let e = (n) => {
5341
5332
  if (!(n.value == null || typeof n.value != "object")) for (let r of Object.keys(n.value)) {
5342
5333
  let i = {
5343
- path: ed(n.path, r),
5334
+ path: $u(n.path, r),
5344
5335
  value: n.value[r]
5345
5336
  };
5346
5337
  t.push(i), e(i);
@@ -5349,16 +5340,16 @@ function td(e, t) {
5349
5340
  for (let t of n) e(t);
5350
5341
  } else if (e.type === "filter") {
5351
5342
  for (let r of n) if (Array.isArray(r.value)) r.value.forEach((n, i) => {
5352
- $u(e.filter, n) && t.push({
5353
- path: ed(r.path, i),
5343
+ Qu(e.filter, n) && t.push({
5344
+ path: $u(r.path, i),
5354
5345
  value: n,
5355
5346
  index: i
5356
5347
  });
5357
5348
  });
5358
5349
  else if (r.value != null && typeof r.value == "object") for (let n of Object.keys(r.value)) {
5359
5350
  let i = r.value[n];
5360
- $u(e.filter, i) && t.push({
5361
- path: ed(r.path, n),
5351
+ Qu(e.filter, i) && t.push({
5352
+ path: $u(r.path, n),
5362
5353
  value: i
5363
5354
  });
5364
5355
  }
@@ -5367,7 +5358,7 @@ function td(e, t) {
5367
5358
  }
5368
5359
  return n;
5369
5360
  }
5370
- function nd(e, t) {
5361
+ function td(e, t) {
5371
5362
  let n = e.length, r = t.length;
5372
5363
  if (!n) return r;
5373
5364
  if (!r) return n;
@@ -5383,7 +5374,7 @@ function nd(e, t) {
5383
5374
  }
5384
5375
  return i[r];
5385
5376
  }
5386
- function rd(e, t, n = {}) {
5377
+ function nd(e, t, n = {}) {
5387
5378
  let r = n.mode || "substring", i = n.limit ?? 50, a = n.matchKey !== !1, o = [], s = null;
5388
5379
  if (r === "regex") try {
5389
5380
  s = new RegExp(t, "i");
@@ -5393,11 +5384,11 @@ function rd(e, t, n = {}) {
5393
5384
  let c = (e, l, u) => {
5394
5385
  if (o.length >= i || e == null) return;
5395
5386
  if (typeof e == "object") {
5396
- if (Array.isArray(e)) e.forEach((e, t) => c(e, ed(l, t), String(t)));
5397
- else for (let t of Object.keys(e)) c(e[t], ed(l, t), t);
5387
+ if (Array.isArray(e)) e.forEach((e, t) => c(e, $u(l, t), String(t)));
5388
+ else for (let t of Object.keys(e)) c(e[t], $u(l, t), t);
5398
5389
  return;
5399
5390
  }
5400
- let d = String(e), f = id(d, t, r, n.fuzzyThreshold ?? 2, s);
5391
+ let d = String(e), f = rd(d, t, r, n.fuzzyThreshold ?? 2, s);
5401
5392
  if (f) {
5402
5393
  o.push({
5403
5394
  path: l,
@@ -5408,7 +5399,7 @@ function rd(e, t, n = {}) {
5408
5399
  return;
5409
5400
  }
5410
5401
  if (a && u) {
5411
- let e = id(u, t, r, n.fuzzyThreshold ?? 2, s);
5402
+ let e = rd(u, t, r, n.fuzzyThreshold ?? 2, s);
5412
5403
  e && o.push({
5413
5404
  path: l,
5414
5405
  key: u,
@@ -5419,65 +5410,65 @@ function rd(e, t, n = {}) {
5419
5410
  };
5420
5411
  return c(e, ""), o;
5421
5412
  }
5422
- function id(e, t, n, r, i) {
5413
+ function rd(e, t, n, r, i) {
5423
5414
  let a = e.toLowerCase(), o = t.toLowerCase();
5424
5415
  if (n === "substring") return a.includes(o) ? 1 : null;
5425
5416
  if (n === "regex") return i && i.test(e) ? 1 : null;
5426
5417
  if (n === "fuzzy") {
5427
5418
  if (a.includes(o)) return 2;
5428
- let e = nd(a, o);
5419
+ let e = td(a, o);
5429
5420
  return e <= r ? r - e + 1 : null;
5430
5421
  }
5431
5422
  return null;
5432
5423
  }
5433
- function ad(e, t, n = 3e3) {
5434
- return Gu(t, n)(e);
5424
+ function id(e, t, n = 3e3) {
5425
+ return Wu(t, n)(e);
5435
5426
  }
5436
5427
  //#endregion
5437
5428
  //#region src/core/harness/readInvalidation.ts
5438
- var od = "", sd = "根(整体)", cd = /* @__PURE__ */ new Set([
5429
+ var ad = "", od = "根(整体)", sd = /* @__PURE__ */ new Set([
5439
5430
  "read",
5440
5431
  "query_data",
5441
5432
  "search_data"
5442
- ]), ld = /* @__PURE__ */ new Set(["resource_update", "resource_delete"]), ud = /* @__PURE__ */ new Set(["remove", "move"]);
5443
- function dd(e) {
5433
+ ]), cd = /* @__PURE__ */ new Set(["resource_update", "resource_delete"]), ld = /* @__PURE__ */ new Set(["remove", "move"]);
5434
+ function ud(e) {
5444
5435
  let t = String(e).trim();
5445
- return t === "(root)" || t === "$" ? od : (t.startsWith("$.") ? t = t.slice(2) : t.startsWith("$") && (t = t.slice(1)), t = t.replace(/\[(\d+)\]/g, ".$1"), t);
5436
+ return t === "(root)" || t === "$" ? ad : (t.startsWith("$.") ? t = t.slice(2) : t.startsWith("$") && (t = t.slice(1)), t = t.replace(/\[(\d+)\]/g, ".$1"), t);
5446
5437
  }
5447
- function fd(e) {
5448
- let t = dd(e);
5449
- return t === od ? sd : t;
5438
+ function dd(e) {
5439
+ let t = ud(e);
5440
+ return t === ad ? od : t;
5450
5441
  }
5451
- function pd(e) {
5442
+ function fd(e) {
5452
5443
  let t = Math.max(e.lastIndexOf("."), e.lastIndexOf("["));
5453
- return t <= 0 ? od : e.slice(0, t);
5444
+ return t <= 0 ? ad : e.slice(0, t);
5454
5445
  }
5455
- function md(e, t) {
5456
- let n = dd(e), r = dd(t);
5457
- return n === od || r === od || n === r || n.startsWith(r + ".") || n.startsWith(r + "[") || r.startsWith(n + ".") || r.startsWith(n + "[");
5446
+ function pd(e, t) {
5447
+ let n = ud(e), r = ud(t);
5448
+ return n === ad || r === ad || n === r || n.startsWith(r + ".") || n.startsWith(r + "[") || r.startsWith(n + ".") || r.startsWith(n + "[");
5458
5449
  }
5459
- function hd(e) {
5460
- if (!e) return od;
5450
+ function md(e) {
5451
+ if (!e) return ad;
5461
5452
  try {
5462
5453
  let t = [];
5463
- for (let n of qu(e)) if (n.type === "key" && n.key) t.push(n.key);
5454
+ for (let n of Ku(e)) if (n.type === "key" && n.key) t.push(n.key);
5464
5455
  else if (n.type === "index" && n.index !== void 0) t.push(String(n.index));
5465
5456
  else break;
5466
- return t.length ? t.join(".") : od;
5457
+ return t.length ? t.join(".") : ad;
5467
5458
  } catch {
5468
- return od;
5459
+ return ad;
5469
5460
  }
5470
5461
  }
5471
- function gd(e, t) {
5462
+ function hd(e, t) {
5472
5463
  let n = t || {};
5473
- if (e === "query_data") return (Array.isArray(n.queries) && n.queries.length ? n.queries.map(String) : [String(n.expr || "")]).map((e) => hd(e));
5474
- if (e === "search_data") return [od];
5464
+ if (e === "query_data") return (Array.isArray(n.queries) && n.queries.length ? n.queries.map(String) : [String(n.expr || "")]).map((e) => md(e));
5465
+ if (e === "search_data") return [ad];
5475
5466
  let r = [];
5476
5467
  if (typeof n.jsonPath == "string" && n.jsonPath && r.push(n.jsonPath), Array.isArray(n.jsonPaths)) for (let e of n.jsonPaths) typeof e == "string" && e && r.push(e);
5477
- return r.length ? r.map(dd) : [od];
5468
+ return r.length ? r.map(ud) : [ad];
5478
5469
  }
5479
- function _d(e) {
5480
- if (ld.has(e.name)) return null;
5470
+ function gd(e) {
5471
+ if (cd.has(e.name)) return null;
5481
5472
  let t = e.args || {}, n = t.del === !0, r = [];
5482
5473
  if (n) r.push({
5483
5474
  path: String(t.patch?.jsonPath ?? t.jsonPath ?? ""),
@@ -5499,15 +5490,15 @@ function _d(e) {
5499
5490
  path: t.path,
5500
5491
  op: "set"
5501
5492
  }) : r.push({
5502
- path: od,
5493
+ path: ad,
5503
5494
  op: "set"
5504
5495
  });
5505
5496
  let i = /* @__PURE__ */ new Set();
5506
5497
  for (let { path: e, op: t, value: n } of r) {
5507
- let r = dd(e);
5508
- if (i.add(r), ud.has(t) && i.add(pd(r)), t === "move" && typeof n == "string" && n) {
5509
- let e = dd(n);
5510
- i.add(e), i.add(pd(e));
5498
+ let r = ud(e);
5499
+ if (i.add(r), ld.has(t) && i.add(fd(r)), t === "move" && typeof n == "string" && n) {
5500
+ let e = ud(n);
5501
+ i.add(e), i.add(fd(e));
5511
5502
  }
5512
5503
  }
5513
5504
  return {
@@ -5516,12 +5507,12 @@ function _d(e) {
5516
5507
  callIndex: e.callIndex
5517
5508
  };
5518
5509
  }
5519
- function vd(e, t, n, r) {
5520
- let i = e.map(fd).join("、"), a = [...new Set(n.flatMap((e) => e.paths))].map(fd).join("、"), o = [`⏱[过期快照] 此前读取 ${i} 的结果已失效(${r === void 0 ? `已写入 ${a}` : `第 ${r} 轮写入了 ${a}`})。`];
5510
+ function _d(e, t, n, r) {
5511
+ let i = e.map(dd).join("、"), a = [...new Set(n.flatMap((e) => e.paths))].map(dd).join("、"), o = [`⏱[过期快照] 此前读取 ${i} 的结果已失效(${r === void 0 ? `已写入 ${a}` : `第 ${r} 轮写入了 ${a}`})。`];
5521
5512
  return n.some((e) => e.hasPostValue) ? o.push(`该轮写入结果已含 ${a} 最新值与新 hash,直接引用即可;原读取结果整体已过期,未提及路径需引用时按下方指引重读/重跑。`) : o.push("原读取结果整体已过期(含未触及的兄弟路径),需引用时按下方指引重读/重跑。"), t === "query_data" || t === "search_data" ? o.push(`需当前结果时重跑 ${t}(表达式/条件不变即可)。`) : o.push(`需当前精确值时再 read(建议窄读:${i})。`), o.join("\n");
5522
5513
  }
5523
- function yd(e, t, n = {}) {
5524
- let r = n.maxParallelTools ?? 1, i = t.map((e) => _d(e)).filter((e) => e !== null);
5514
+ function vd(e, t, n = {}) {
5515
+ let r = n.maxParallelTools ?? 1, i = t.map((e) => gd(e)).filter((e) => e !== null);
5525
5516
  if (!i.length || !e.length) return {
5526
5517
  messages: e,
5527
5518
  invalidatedCount: 0,
@@ -5556,11 +5547,11 @@ function yd(e, t, n = {}) {
5556
5547
  let e = n.name;
5557
5548
  r = e ? l.find((t) => !t.used && t.name === e) : l.find((e) => !e.used);
5558
5549
  }
5559
- r && (r.used = !0, cd.has(r.name) && c.push({
5550
+ r && (r.used = !0, sd.has(r.name) && c.push({
5560
5551
  aiIndex: u,
5561
5552
  callIndex: r.callIndex,
5562
5553
  name: r.name,
5563
- paths: gd(r.name, r.args),
5554
+ paths: hd(r.name, r.args),
5564
5555
  msgIndex: t
5565
5556
  }));
5566
5557
  }
@@ -5569,11 +5560,11 @@ function yd(e, t, n = {}) {
5569
5560
  for (let t of c) {
5570
5561
  let a = e[t.msgIndex];
5571
5562
  if (String(a.content ?? "").startsWith("⏱[过期快照]")) continue;
5572
- let c = i.filter((e) => e.paths.some((e) => t.paths.some((t) => md(t, e))));
5563
+ let c = i.filter((e) => e.paths.some((e) => t.paths.some((t) => pd(t, e))));
5573
5564
  if (!c.length) continue;
5574
5565
  let l;
5575
5566
  if (l = t.aiIndex !== s || r > 1 || c.some((e) => e.callIndex === void 0 || t.callIndex < e.callIndex), !l) continue;
5576
- let u = vd(t.paths, t.name, c, n.round);
5567
+ let u = _d(t.paths, t.name, c, n.round);
5577
5568
  d ||= e.slice(), d[t.msgIndex] = new o({
5578
5569
  tool_call_id: a.tool_call_id ?? "",
5579
5570
  name: a.name,
@@ -5591,47 +5582,51 @@ function yd(e, t, n = {}) {
5591
5582
  }
5592
5583
  //#endregion
5593
5584
  //#region src/core/harness/actionGate.ts
5594
- var bd = /(改|改掉|改成|修改|更新|加|添加|新增|加上|删|删掉|删除|移除|移|移动|换|替换|调|调整|调换|生成|创建|做|做个|做一个|建|搭建|重建|重新|清空|设置|配置|美化|优化|排版|布置|填充|写入|保存|发布|上线|部署)/, xd = /(看看|看一下|查|查一下|查询|了解|了解下|说说|讲讲|解释|解释下|总结|总结一下|对比|对比一下|确认|确认一下|核对|检查|检查一下|看看有没有|帮我看看|review|Review)/, Sd = /(不用改|不用动|只是问|只是想问|先别动|先不要|不用写入|不要保存|只是确认|告诉我即可|不用执行)/, Cd = /^(use_|spawn_agent|spawn_agents)/;
5595
- function wd(e) {
5585
+ var yd = /(改|改掉|改成|修改|更新|加|添加|新增|加上|删|删掉|删除|移除|移|移动|换|替换|调|调整|调换|生成|创建|做|做个|做一个|建|搭建|重建|重新|清空|设置|配置|美化|优化|排版|布置|填充|写入|保存|发布|上线|部署)/, bd = /(看看|看一下|查|查一下|查询|了解|了解下|说说|讲讲|解释|解释下|总结|总结一下|对比|对比一下|确认|确认一下|核对|检查|检查一下|看看有没有|帮我看看|review|Review)/, xd = /(不用改|不用动|只是问|只是想问|先别动|先不要|不用写入|不要保存|只是确认|告诉我即可|不用执行)/, Sd = /^(use_|spawn_agent|spawn_agents)/;
5586
+ function Cd(e) {
5596
5587
  let t = (e || "").trim();
5597
- if (!t || Sd.test(t) || /(吗|呢)[??]?\s*$/.test(t) || /[??]\s*$/.test(t)) return !1;
5588
+ if (!t || xd.test(t) || /(吗|呢)[??]?\s*$/.test(t) || /[??]\s*$/.test(t)) return !1;
5598
5589
  let n = (t.split(/[。!?;,!?;,\n]/)[0] ?? t).slice(0, 16);
5599
- return !xd.test(n) && bd.test(n);
5590
+ return !bd.test(n) && yd.test(n);
5600
5591
  }
5601
- function Td(e, t) {
5602
- for (let [n, r] of Object.entries(e.counts)) if (!(r <= 0) && (t(n) || Cd.test(n))) return !1;
5592
+ function wd(e, t) {
5593
+ for (let [n, r] of Object.entries(e.counts)) if (!(r <= 0) && (t(n) || Sd.test(n) && r - (e.rejectedDelegations?.[n] ?? 0) > 0)) return !1;
5603
5594
  return !0;
5604
5595
  }
5605
- function Ed(e, t, n = () => !1) {
5606
- let r = Object.entries(e.counts).filter(([e, t]) => t > 0 || n(e)).map(([e, t]) => `${e}×${t}`);
5596
+ function Td(e, t, n = () => !1) {
5597
+ let r = Object.entries(e.counts).filter(([e, t]) => t > 0 || n(e)).map(([t, n]) => {
5598
+ let r = e.rejectedDelegations?.[t] ?? 0;
5599
+ return r > 0 && Sd.test(t) ? `${t}×${n}(其中 ${r} 次被拒未生效,如组件锁 COMPONENT_BUSY)` : `${t}×${n}`;
5600
+ });
5607
5601
  e.counts.write === void 0 && n("write") && r.push("write×0");
5608
5602
  let i = r.length ? r.join(", ") : "无", a = e.writePaths.length ? e.writePaths.slice(0, 5).join(", ") + (e.writePaths.length > 5 ? ` 等 ${e.writePaths.length} 处` : "") : "无", o = t?.length ?? 0, s = t?.filter((e) => e.status === "completed").length ?? 0, c = o ? `${s}/${o} 完成` : "无 todos";
5609
5603
  return `本轮事实:工具调用 ${i};成功写入路径:${a};失败/回灌 ${e.failures};todos:${c}。`;
5610
5604
  }
5611
- var Dd = /(components?\.\d+|child(ren)?\.\d+|[a-zA-Z][a-zA-Z0-9_-]{3,}\.\d+|jsonPath|@ ?"[^"]+"|路径)/;
5612
- function Od(e) {
5605
+ var Ed = /(components?\.\d+|child(ren)?\.\d+|[a-zA-Z][a-zA-Z0-9_-]{3,}\.\d+|jsonPath|@ ?"[^"]+"|路径)/;
5606
+ function Dd(e) {
5613
5607
  return [
5614
5608
  "⚠️ 这条指令看起来需要改动数据,但本轮没有任何写入或委派操作。",
5615
5609
  `${e}`,
5616
5610
  "如果确实已完成:请在回复中逐项说明改动位置(jsonPath / 组件 id),与上述事实对账;",
5617
5611
  "如果尚未完成:请继续执行(用 write 增量改 / 委派对应子 agent);",
5612
+ "如果委派被组件锁拒绝(COMPONENT_BUSY/COMPONENT_LOCKED):说明在途委派占用,等其结束后重试,勿谎称已完成;",
5618
5613
  "如果做不到或需要用户决定:请如实说明原因,不要回复「已完成」。"
5619
5614
  ].join("\n");
5620
5615
  }
5621
- function kd(e) {
5622
- return Dd.test(e || "");
5616
+ function Od(e) {
5617
+ return Ed.test(e || "");
5618
+ }
5619
+ var kd = /(写到了哪|写到哪|在哪写|什么位置|完成了吗|完成没|做完了吗|做好了|好了吗|搞定了吗|生成了吗|改好了吗|改完了吗|保存了吗|写入了吗|写入了没有|有没有写入|有没有保存|现在的?(页面|数据|状态|内容)|当前(页面|数据|状态)|进度如何|进度怎么样|什么状态)/, Ad = /(已写入|已保存|已添加|已删除|已修改|已更新|已设置|已生成|已创建|已搭建|已删除|已经写入|已经完成|全部完成|全部搞定)/;
5620
+ function jd(e) {
5621
+ return kd.test((e || "").trim());
5623
5622
  }
5624
- var Ad = /(写到了哪|写到哪|在哪写|什么位置|完成了吗|完成没|做完了吗|做好了|好了吗|搞定了吗|生成了吗|改好了吗|改完了吗|保存了吗|写入了吗|写入了没有|有没有写入|有没有保存|现在的?(页面|数据|状态|内容)|当前(页面|数据|状态)|进度如何|进度怎么样|什么状态)/, jd = /(已写入|已保存|已添加|已删除|已修改|已更新|已设置|已生成|已创建|已搭建|已删除|已经写入|已经完成|全部完成|全部搞定)/;
5625
5623
  function Md(e) {
5626
- return Ad.test((e || "").trim());
5624
+ return Ad.test(e || "");
5627
5625
  }
5628
5626
  function Nd(e) {
5629
- return jd.test(e || "");
5630
- }
5631
- function Pd(e) {
5632
5627
  return Object.values(e.counts).every((e) => e <= 0);
5633
5628
  }
5634
- function Fd(e) {
5629
+ function Pd(e) {
5635
5630
  return [
5636
5631
  "⚠️ 这是关于数据现状的询问,但本轮你没有调用任何工具(含 read)就断言了「已写入/已完成」状态。",
5637
5632
  `${e}`,
@@ -5639,27 +5634,36 @@ function Fd(e) {
5639
5634
  "请先用 read / list 类工具核实实际数据再据实回答;若实际未写入,如实说明并继续完成,不要凭印象回复「已完成」。"
5640
5635
  ].join("\n");
5641
5636
  }
5642
- var Id = /(我先|让我先|我先看|先看看|先了解|先加载|先查阅|稍后|接下来我|我将先|等我|查完.{0,12}再|看完.{0,12}再|了解.{0,8}再)/, Ld = /(已完成|已生成|已修改|已创建|已添加|已删除|已更新|已调整|已处理|已委派|已配置|已切换|成功|完成[。!?]|搞定了|做好了)/;
5643
- function Rd(e) {
5637
+ var Fd = /(我先|让我先|我先看|先看看|先了解|先加载|先查阅|稍后|接下来我|我将先|等我|查完.{0,12}再|看完.{0,12}再|了解.{0,8}再)/, Id = /(已完成|已生成|已修改|已创建|已添加|已删除|已更新|已调整|已处理|已委派|已配置|已切换|成功|完成[。!?]|搞定了|做好了)/;
5638
+ function Ld(e) {
5644
5639
  if (!e) return !1;
5645
5640
  let t = e.trim();
5646
- return t.length > 160 || Ld.test(t) ? !1 : Id.test(t);
5641
+ return t.length > 160 || Id.test(t) ? !1 : Fd.test(t);
5647
5642
  }
5648
- var zd = /(add_component|delete_component|move_component|list_components|select_component|load_skill|use_[a-z]+|rag_[a-z]+|request_human_confirmation|\bwrite\b|\bread\b)/, Bd = /(我来|让我|我先|现在|开始|先加载|先添加|先写|先删|先看看|执行|添加|写入|加载|删除)/;
5649
- function Vd(e) {
5643
+ var Rd = /(add_component|delete_component|move_component|list_components|select_component|load_skill|use_[a-z]+|rag_[a-z]+|request_human_confirmation|\bwrite\b|\bread\b)/, zd = /(我来|让我|我先|现在|开始|先加载|先添加|先写|先删|先看看|执行|添加|写入|加载|删除)/;
5644
+ function Bd(e) {
5650
5645
  if (!e) return !1;
5651
5646
  let t = e.trim();
5652
- return zd.test(t) && Bd.test(t);
5647
+ return Rd.test(t) && zd.test(t);
5653
5648
  }
5654
- function Hd(e) {
5649
+ function Vd(e) {
5655
5650
  if (!e) return [];
5656
5651
  let t = String(e).replace(/\$\.?/g, " ").replace(/\[(\d+)\]/g, ".$1"), n = [];
5657
5652
  for (let e of t.matchAll(/[A-Za-z_][\w-]*(?:\.[A-Za-z_][\w-]*|\.\d+)+/g)) n.push(e[0]);
5658
5653
  return [...new Set(n)];
5659
5654
  }
5660
- function Ud(e, t) {
5655
+ function Hd(e, t) {
5661
5656
  let n = Array.from(t);
5662
- return n.length ? e.some((e) => n.some((t) => md(e, t))) : !1;
5657
+ return n.length ? e.some((e) => n.some((t) => pd(e, t))) : !1;
5658
+ }
5659
+ //#endregion
5660
+ //#region src/core/harness/writeGate.ts
5661
+ function Ud(e, t, n) {
5662
+ if (!e || !n || n.status === "error" || t && t.dryRun === !0) return !1;
5663
+ let r = "writeCapable" in e ? e.writeCapable : void 0;
5664
+ if (!(typeof r == "function" ? r(t ?? {}) : r === !0)) return !1;
5665
+ let i = String(n.content || "");
5666
+ return !(i.startsWith("ERROR:") || i.includes("未写入") || i.includes("无需删除"));
5663
5667
  }
5664
5668
  //#endregion
5665
5669
  //#region src/core/harness/todos.ts
@@ -5795,7 +5799,7 @@ var Zd = 2, Qd = 2, $d = 2, ef = 2;
5795
5799
  function tf(e) {
5796
5800
  let { state: t, garbled: n, rounds: r } = e, i = e.finalContent;
5797
5801
  if (n) return null;
5798
- let a = !/[??]\s*$/.test(i.trim()) && (r > 0 ? Rd(i) : Vd(i));
5802
+ let a = !/[??]\s*$/.test(i.trim()) && (r > 0 ? Ld(i) : Bd(i));
5799
5803
  if (t.transitionalRetries < Zd && a) return t.transitionalRetries += 1, {
5800
5804
  kind: "feedback",
5801
5805
  gate: {
@@ -5846,38 +5850,38 @@ function tf(e) {
5846
5850
  break;
5847
5851
  }
5848
5852
  }
5849
- if (t.zeroToolRetries < $d && Td(e.turnUsage, e.isWriteToolByName) && wd(s) && !kd(i) && !/[??]\s*$/.test(i.trim())) {
5853
+ if (t.zeroToolRetries < $d && wd(e.turnUsage, e.isWriteToolByName) && Cd(s) && !Od(i) && !/[??]\s*$/.test(i.trim())) {
5850
5854
  t.zeroToolRetries += 1;
5851
- let n = Ed(e.turnUsage, e.todos, e.isWriteToolByName);
5855
+ let n = Td(e.turnUsage, e.todos, e.isWriteToolByName);
5852
5856
  return {
5853
5857
  kind: "feedback",
5854
5858
  gate: {
5855
5859
  stage: "zero_tool_gate",
5856
5860
  attempt: t.zeroToolRetries,
5857
- feedback: Od(n),
5861
+ feedback: Dd(n),
5858
5862
  logData: { factSheet: n }
5859
5863
  }
5860
5864
  };
5861
5865
  }
5862
- if (t.zeroToolRetries < $d && Pd(e.turnUsage) && Md(s) && Nd(i)) {
5866
+ if (t.zeroToolRetries < $d && Nd(e.turnUsage) && jd(s) && Md(i)) {
5863
5867
  t.zeroToolRetries += 1;
5864
- let n = Ed(e.turnUsage, e.todos, e.isWriteToolByName);
5868
+ let n = Td(e.turnUsage, e.todos, e.isWriteToolByName);
5865
5869
  return {
5866
5870
  kind: "feedback",
5867
5871
  gate: {
5868
5872
  stage: "status_query_gate",
5869
5873
  attempt: t.zeroToolRetries,
5870
- feedback: Fd(n),
5874
+ feedback: Pd(n),
5871
5875
  logData: { factSheet: n }
5872
5876
  }
5873
5877
  };
5874
5878
  }
5875
- return t.zeroToolRetries >= $d && Td(e.turnUsage, e.isWriteToolByName) && wd(s) ? {
5879
+ return t.zeroToolRetries >= $d && wd(e.turnUsage, e.isWriteToolByName) && Cd(s) ? {
5876
5880
  kind: "observable",
5877
5881
  obs: {
5878
5882
  code: "ZERO_TOOL_GATE_EXHAUSTED",
5879
5883
  message: "操作指令经 2 次回灌后仍以零工具纯文本收尾(疑似谎报完成),已放行;最终回复可能不实",
5880
- context: { factSheet: Ed(e.turnUsage, e.todos, e.isWriteToolByName) }
5884
+ context: { factSheet: Td(e.turnUsage, e.todos, e.isWriteToolByName) }
5881
5885
  }
5882
5886
  } : null;
5883
5887
  }
@@ -5887,8 +5891,8 @@ function nf(e, t, n) {
5887
5891
  if (e.status !== "completed") return !1;
5888
5892
  let n = t?.get(e.id);
5889
5893
  if (n && n.status === "completed" && n.content === e.content) return !1;
5890
- let i = Hd(e.evidence ?? "");
5891
- return i.length ? !Ud(i, r) : !1;
5894
+ let i = Vd(e.evidence ?? "");
5895
+ return i.length ? !Hd(i, r) : !1;
5892
5896
  });
5893
5897
  }
5894
5898
  function rf(e) {
@@ -6618,14 +6622,14 @@ function Df(e) {
6618
6622
  let t = _[e];
6619
6623
  if (!t) continue;
6620
6624
  let n = p[e].call.name;
6621
- if (f.counts[n] = (f.counts[n] ?? 0) + 1, t.status === "error" && (f.failures += 1), Bu(R.find((e) => e.name === n), p[e].call.args, t)) {
6625
+ if (f.counts[n] = (f.counts[n] ?? 0) + 1, t.status === "error" && (f.failures += 1), Sd.test(n) && String(t.content || "").startsWith("ERROR:") && (f.rejectedDelegations = f.rejectedDelegations ?? {}, f.rejectedDelegations[n] = (f.rejectedDelegations[n] ?? 0) + 1), Ud(R.find((e) => e.name === n), p[e].call.args, t)) {
6622
6626
  let t = Ef(p[e].call.args);
6623
6627
  f.writePaths.push(t || "(整体)"), E.push({
6624
6628
  name: n,
6625
6629
  args: p[e].call.args,
6626
6630
  callIndex: e
6627
6631
  });
6628
- let r = _d({
6632
+ let r = gd({
6629
6633
  name: n,
6630
6634
  args: p[e].call.args,
6631
6635
  callIndex: e
@@ -6634,7 +6638,7 @@ function Df(e) {
6634
6638
  }
6635
6639
  }
6636
6640
  if (ne && E.length) {
6637
- let e = yd(c, E, {
6641
+ let e = vd(c, E, {
6638
6642
  round: x + 1,
6639
6643
  maxParallelTools: C
6640
6644
  });
@@ -7871,7 +7875,7 @@ async function lm(e) {
7871
7875
  };
7872
7876
  r = t;
7873
7877
  } else r = e.code;
7874
- let i = await Gu(r)(void 0);
7878
+ let i = await Wu(r)(void 0);
7875
7879
  return i.ok ? {
7876
7880
  ok: !0,
7877
7881
  text: sm(i.result)
@@ -8196,7 +8200,7 @@ function Pm(e = {}) {
8196
8200
  let e = C();
8197
8201
  if (e.length) {
8198
8202
  let t = e.map((e) => `- ${e.path ? e.path + ": " : ""}${e.description}`).join("\n");
8199
- S.push("\n【当前可操作数据(动态增删后的最新状态,操作前以 describe_data / read 为准)】", t);
8203
+ S.push("\n【当前可操作数据(动态增删后的最新状态,操作前以 read 为准)】", t);
8200
8204
  }
8201
8205
  } catch {}
8202
8206
  let w = {
@@ -8302,7 +8306,6 @@ function Lm(e) {
8302
8306
  return !!e && typeof e == "object" && typeof e.invoke == "function" && typeof e.stream == "function";
8303
8307
  }
8304
8308
  var Rm = [
8305
- "describe_data",
8306
8309
  "read",
8307
8310
  "query_data",
8308
8311
  "search_data",
@@ -8911,7 +8914,6 @@ var fh = /* @__PURE__ */ new Set([
8911
8914
  "draft_commit",
8912
8915
  "eval_script"
8913
8916
  ]), ph = /* @__PURE__ */ new Set([
8914
- "describe_data",
8915
8917
  "read",
8916
8918
  "query_data",
8917
8919
  "search_data",
@@ -9335,7 +9337,7 @@ async function Wh(e, t, n, r) {
9335
9337
  "你是严格的对抗式审查者,目标是找出以下 AI 助手回复的错误并证明它有问题(事实错误 / 遗漏 / 逻辑矛盾 / 与需求不符)。",
9336
9338
  `用户需求:${i || "(未明确)"}`,
9337
9339
  `助手回复:${a}`,
9338
- o ? "重点检查主数据修改:① jsonPath 是否正确(是否误写不存在的子路径);② 值类型是否符合主数据 schema;③ 语义是否符合字段 description。可用只读工具(read / describe_data 等)读回实际值实证。" : "只报告具体、可验证的问题。",
9340
+ o ? "重点检查主数据修改:① jsonPath 是否正确(是否误写不存在的子路径);② 值类型是否符合主数据 schema;③ 语义是否符合字段 description。可用只读工具(read / schema_data 等)读回实际值实证。" : "只报告具体、可验证的问题。",
9339
9341
  "若确实无问题,只回复\"无问题\"。"
9340
9342
  ].join("\n"), c = "你是严格的对抗式审查者,只找问题不赞美。目标是反驳,不是改进。", l = n ? (e) => n(e.type, {
9341
9343
  ...e.data,
@@ -10465,7 +10467,7 @@ function Kg(e) {
10465
10467
  code: "SCHEMA_INVALID",
10466
10468
  path: e,
10467
10469
  message: `值不符合 "${e}" 的 schema(${t.length} 处问题)`,
10468
- hint: `用 read({jsonPath:"${e}"}) 查看当前值,按 describe_data() 查看主数据 schema,修正后重试;改大对象优先用 write 的 patch 增量(只发改动部分)${r}`,
10470
+ hint: `用 read({jsonPath:"${e}"}) 查看当前值,按 schema_data() 查看主数据 schema,修正后重试;改大对象优先用 write 的 patch 增量(只发改动部分)${r}`,
10469
10471
  details: Kl(t)
10470
10472
  }) : ql(e, t);
10471
10473
  }, f = (e) => $({
@@ -10540,16 +10542,16 @@ function Kg(e) {
10540
10542
  continue;
10541
10543
  }
10542
10544
  if (i === "append") {
10543
- let e = o[m++]?.elems ?? [], r = Dp(n, a);
10544
- if (typeof r == "string" && typeof e[0] == "string") {
10545
- let n = e[0], i = Pf(t, a);
10545
+ let e = o[m++]?.elems ?? [], n = Dp(r, a);
10546
+ if (typeof n == "string" && typeof e[0] == "string") {
10547
+ let r = e[0], i = Pf(t, a);
10546
10548
  if (i.kind === "missing") return {
10547
10549
  ok: !1,
10548
10550
  error: f([a]),
10549
10551
  writeBacks: [],
10550
10552
  notices: c
10551
10553
  };
10552
- let o = r + n;
10554
+ let o = n;
10553
10555
  if (i.kind !== "open") {
10554
10556
  let e = i.schemas.map((e) => e.safeParse(o)).find((e) => !e.success);
10555
10557
  if (e) return {
@@ -10562,7 +10564,7 @@ function Kg(e) {
10562
10564
  p.push({
10563
10565
  op: "appendStr",
10564
10566
  jp: a,
10565
- str: n
10567
+ str: r
10566
10568
  });
10567
10569
  continue;
10568
10570
  }
@@ -10932,18 +10934,21 @@ function Jg(e) {
10932
10934
  value: f ?? Ap(t),
10933
10935
  ...l ? { label: l } : {}
10934
10936
  }); a.length > o;) a.shift();
10935
- for (let e of b.writeBacks) if (e.op === "remove") kp(t, e.jp);
10936
- else if (e.op === "set") Op(t, e.jp, e.value);
10937
- else if (e.op === "move") Vp(t, e.jp, e.toPath);
10938
- else if (e.op === "mergeKeys") {
10939
- let n = e.jp ? Dp(t, e.jp) : t;
10940
- if (n && typeof n == "object" && !Array.isArray(n)) for (let [t, r] of e.entries ?? []) n[t] = r;
10941
- } else if (e.op === "appendElems") {
10942
- let n = e.jp ? Dp(t, e.jp) : t;
10943
- Array.isArray(n) && e.elems?.length && n.push(...e.elems);
10944
- } else if (e.op === "appendStr") {
10945
- let n = e.jp ? Dp(t, e.jp) : t;
10946
- typeof n == "string" && typeof e.str == "string" && Op(t, e.jp, n + e.str);
10937
+ let S = new Set(b.writeBacks.filter((e) => e.op === "set").map((e) => e.jp));
10938
+ for (let e of b.writeBacks) if (!((e.op === "appendElems" || e.op === "appendStr") && S.has(e.jp))) {
10939
+ if (e.op === "remove") kp(t, e.jp);
10940
+ else if (e.op === "set") Op(t, e.jp, e.value);
10941
+ else if (e.op === "move") Vp(t, e.jp, e.toPath);
10942
+ else if (e.op === "mergeKeys") {
10943
+ let n = e.jp ? Dp(t, e.jp) : t;
10944
+ if (n && typeof n == "object" && !Array.isArray(n)) for (let [t, r] of e.entries ?? []) n[t] = r;
10945
+ } else if (e.op === "appendElems") {
10946
+ let n = e.jp ? Dp(t, e.jp) : t;
10947
+ Array.isArray(n) && e.elems?.length && n.push(...e.elems);
10948
+ } else if (e.op === "appendStr") {
10949
+ let n = e.jp ? Dp(t, e.jp) : t;
10950
+ typeof n == "string" && typeof e.str == "string" && Op(t, e.jp, n + e.str);
10951
+ }
10947
10952
  }
10948
10953
  return e.internalAfterWrite?.(t, f), Mg(d), s?.(), {
10949
10954
  ok: !0,
@@ -11049,7 +11054,7 @@ function i_(e) {
11049
11054
  })(e);
11050
11055
  }
11051
11056
  function a_(e, n = {}) {
11052
- let r = n.pgIdPaths ?? [], i = n.sandboxRunner ?? ad, a = r.length ? (e, t) => {
11057
+ let r = n.pgIdPaths ?? [], i = n.sandboxRunner ?? id, a = r.length ? (e, t) => {
11053
11058
  if (t && typeof t == "object") for (let n of r) {
11054
11059
  let r = Dp(t, n), i = Dp(e, n);
11055
11060
  if (!Array.isArray(r) || !Array.isArray(i)) continue;
@@ -11263,11 +11268,7 @@ function a_(e, n = {}) {
11263
11268
  }
11264
11269
  let se = (e, t = !0) => {
11265
11270
  e.writeCapable = t;
11266
- }, ce = s(async () => [`说明: ${l}`, "格式: 写入值需为 JSON,且通过声明的 schema 校验(校验失败时 write 会返回结构化错误,含具体字段与期望类型)。"].join("\n"), {
11267
- name: "describe_data",
11268
- description: "获取主数据的说明与格式要求(等价于 read 不传 jsonPath;优先用 read 单一入口)。",
11269
- schema: t.object({})
11270
- }), le = s(async ({ id: e }, t) => {
11271
+ }, ce = s(async ({ id: e }, t) => {
11271
11272
  let n = y(t);
11272
11273
  if (!h.length) return $({
11273
11274
  code: "NO_SNAPSHOT",
@@ -11281,23 +11282,67 @@ function a_(e, n = {}) {
11281
11282
  hint: "用 history_data({list:true}) 查看可用快照序号"
11282
11283
  });
11283
11284
  let i = o.safeParse(r.value);
11284
- return i.success ? (Up(c, Ap(r.value)), N(), P({
11285
- op: "restore",
11286
- detail: `#${r.id}`,
11287
- timestamp: Date.now()
11288
- }), w(O(), n), `已回退主数据到快照 #${r.id}[${r.op}]${r.label ? `(${r.label})` : ""}。`) : $({
11285
+ if (!i.success) return $({
11289
11286
  code: "SNAPSHOT_SCHEMA_INVALID",
11290
11287
  message: `快照 #${r.id} 的值不符合当前 schema,无法回退`,
11291
11288
  hint: "schema 可能已变更;该快照已过期,选其他快照或重新设置",
11292
11289
  details: Kl(i.error.issues)
11293
11290
  });
11291
+ let a = [];
11292
+ if (m && m.resourcesByPath.size) for (let [e] of m.resourcesByPath) {
11293
+ let t = Dp(c, e);
11294
+ kg(t, Dp(r.value, e)) || a.push({
11295
+ p: e,
11296
+ cur: t
11297
+ });
11298
+ }
11299
+ if (!a.length) return Up(c, Ap(r.value)), N(), P({
11300
+ op: "restore",
11301
+ detail: `#${r.id}`,
11302
+ timestamp: Date.now()
11303
+ }), w(O(), n), `已回退主数据到快照 #${r.id}[${r.op}]${r.label ? `(${r.label})` : ""}。`;
11304
+ let s = a.map(({ p: e }) => {
11305
+ let t = Wg(e), n = t ? Dp(c, `${t}.__pgId`) : void 0;
11306
+ return {
11307
+ p: e,
11308
+ parent: t,
11309
+ pgId: typeof n == "string" ? n : void 0
11310
+ };
11311
+ }).map((e) => ({
11312
+ ...e,
11313
+ val: e.p ? Dp(c, e.p) : void 0
11314
+ }));
11315
+ Up(c, Ap(r.value));
11316
+ let l = [], u = [];
11317
+ for (let e of s) {
11318
+ let t = e.p.slice(e.p.lastIndexOf(".") + 1), n = e.p;
11319
+ if (e.pgId) {
11320
+ let r = Wg(e.parent), i = r ? Dp(c, r) : c, a = Array.isArray(i) ? i.findIndex((t) => t?.__pgId === e.pgId) : -1;
11321
+ if (a < 0) {
11322
+ u.push(e.p);
11323
+ continue;
11324
+ }
11325
+ n = `${r ? `${r}.${a}` : String(a)}.${t}`;
11326
+ } else if (e.parent && Dp(c, e.parent) === void 0) {
11327
+ u.push(e.p);
11328
+ continue;
11329
+ }
11330
+ e.val === void 0 ? u.push(e.p) : Op(c, n, e.val), l.push(e.p);
11331
+ }
11332
+ N(), P({
11333
+ op: "restore",
11334
+ detail: `#${r.id}(保护字段保留 ${l.length}${u.length ? `,未能回填 ${u.length}` : ""})`,
11335
+ timestamp: Date.now()
11336
+ }), w(O(), n);
11337
+ let d = u.length ? `;⚠ 以下保护字段未能回填当前值(快照窗口内元素已变/已删,保留快照旧值,请由宿主侧核对):${u.join("、")}` : "";
11338
+ return `已回退主数据到快照 #${r.id}[${r.op}]${r.label ? `(${r.label})` : ""}。⚠ 受保护字段保留当前值未回退:${l.join("、")}(freeze/verbatim 由宿主管辖,快照旧值不覆盖;history_data 看到的是快照原值,实际结果以 read 为准)${d}`;
11294
11339
  }, {
11295
11340
  name: "restore_data",
11296
11341
  description: "把主数据回退到某个快照(不传 id 回退最近一次)。快照列表用 history_data({list:true})。",
11297
11342
  schema: t.object({ id: t.number().int().optional().describe("快照序号;不传回退最近一次") })
11298
11343
  });
11299
- se(le);
11300
- let ue = s(async ({ id: e, jsonPath: t, list: n }) => {
11344
+ se(ce);
11345
+ let le = s(async ({ id: e, jsonPath: t, list: n }) => {
11301
11346
  if (n) {
11302
11347
  if (!h.length) return "无快照。set/edit/delete 会自动存快照。";
11303
11348
  let e = h.map((e) => {
@@ -11342,7 +11387,7 @@ function a_(e, n = {}) {
11342
11387
  jsonPath: t.string().optional().describe("只看快照的某子路径"),
11343
11388
  list: t.boolean().optional().describe("true 列出快照时间线(序号/操作/标签/时间/大小)")
11344
11389
  })
11345
- }), F = s(async ({ expr: e, queries: t, limit: n }, r) => {
11390
+ }), ue = s(async ({ expr: e, queries: t, limit: n }, r) => {
11346
11391
  let i = y(r);
11347
11392
  if (typeof c != "object" || !c) return $({
11348
11393
  code: "NOT_OBJECT",
@@ -11352,7 +11397,7 @@ function a_(e, n = {}) {
11352
11397
  let a = u ? Wf(c, o) : c, s = b(r), l = (e) => {
11353
11398
  let t;
11354
11399
  try {
11355
- t = td(a, e);
11400
+ t = ed(a, e);
11356
11401
  } catch (t) {
11357
11402
  return $({
11358
11403
  code: "JSONPATH_SYNTAX",
@@ -11385,13 +11430,13 @@ function a_(e, n = {}) {
11385
11430
  queries: t.array(t.string()).min(2).max(10).optional().describe("批量模式:2-10 条 JSONPath 一次取回(与 expr 同传按 queries);逐条独立返回,单条失败该项标 error 不整批"),
11386
11431
  limit: t.number().int().min(1).max(200).optional().describe("返回结果上限(批量时逐条适用),默认 50")
11387
11432
  })
11388
- }), I = s(async ({ query: e, mode: t, fuzzyThreshold: n, matchKey: r, limit: i }) => {
11433
+ }), F = s(async ({ query: e, mode: t, fuzzyThreshold: n, matchKey: r, limit: i }) => {
11389
11434
  if (c == null) return $({
11390
11435
  code: "EMPTY",
11391
11436
  message: "主数据为空,无可搜索内容"
11392
11437
  });
11393
11438
  try {
11394
- let a = rd(u ? Wf(c, o) : c, e, {
11439
+ let a = nd(u ? Wf(c, o) : c, e, {
11395
11440
  mode: t,
11396
11441
  fuzzyThreshold: n,
11397
11442
  matchKey: r,
@@ -11423,7 +11468,7 @@ function a_(e, n = {}) {
11423
11468
  matchKey: t.boolean().optional().describe("是否同时匹配 key 名,默认 true"),
11424
11469
  limit: t.number().int().min(1).max(200).optional().describe("返回上限,默认 50")
11425
11470
  })
11426
- }), de = s(async ({ script: e, mode: t, jsonPath: n }, r) => {
11471
+ }), I = s(async ({ script: e, mode: t, jsonPath: n }, r) => {
11427
11472
  let s = y(r);
11428
11473
  if (e.length > 8e3) return $({
11429
11474
  code: "SCRIPT_TOO_LARGE",
@@ -11466,7 +11511,9 @@ function a_(e, n = {}) {
11466
11511
  if (l) {
11467
11512
  let e = await j();
11468
11513
  try {
11469
- let e = Jg({
11514
+ let n = await oe("edit", D ? C(s) : void 0, void 0, e);
11515
+ if (n !== null) return n;
11516
+ let r = Jg({
11470
11517
  bindRef: c,
11471
11518
  patches: [{
11472
11519
  op: "set",
@@ -11483,11 +11530,11 @@ function a_(e, n = {}) {
11483
11530
  internalAfterWrite: a,
11484
11531
  protectedCtx: m
11485
11532
  });
11486
- return e.ok ? (P({
11533
+ return r.ok ? (P({
11487
11534
  op: "edit",
11488
11535
  detail: `eval_transform_subtree @ ${l}`,
11489
11536
  timestamp: Date.now()
11490
- }), w(O(), s), `已通过脚本 transform 子树 @ ${l} 更新(耗时 ${_.elapsedMs}ms)。当前值: ${Fp(c, 600)}`) : e.error;
11537
+ }), w(O(), s), `已通过脚本 transform 子树 @ ${l} 更新(耗时 ${_.elapsedMs}ms)。当前值: ${Fp(c, 600)}`) : r.error;
11491
11538
  } finally {
11492
11539
  e.release();
11493
11540
  }
@@ -11500,7 +11547,9 @@ function a_(e, n = {}) {
11500
11547
  });
11501
11548
  let e = await j();
11502
11549
  try {
11503
- let e = Jg({
11550
+ let n = await oe("edit", D ? C(s) : void 0, void 0, e);
11551
+ if (n !== null) return n;
11552
+ let r = Jg({
11504
11553
  bindRef: c,
11505
11554
  patches: t.patches,
11506
11555
  schema: o,
@@ -11513,11 +11562,11 @@ function a_(e, n = {}) {
11513
11562
  internalAfterWrite: a,
11514
11563
  protectedCtx: m
11515
11564
  });
11516
- return e.ok ? (P({
11565
+ return r.ok ? (P({
11517
11566
  op: "edit",
11518
- detail: `eval_transform(${e.applied.length} patches)`,
11567
+ detail: `eval_transform(${r.applied.length} patches)`,
11519
11568
  timestamp: Date.now()
11520
- }), w(O(), s), `已通过脚本 transform(patches) 更新主数据(${e.applied.length} 个 patch,耗时 ${_.elapsedMs}ms)。当前值: ${Fp(c, 600)}`) : e.error;
11569
+ }), w(O(), s), `已通过脚本 transform(patches) 更新主数据(${r.applied.length} 个 patch,耗时 ${_.elapsedMs}ms)。当前值: ${Fp(c, 600)}`) : r.error;
11521
11570
  } finally {
11522
11571
  e.release();
11523
11572
  }
@@ -11539,21 +11588,23 @@ function a_(e, n = {}) {
11539
11588
  });
11540
11589
  let i = a ? Ap(c) : null, d = await j();
11541
11590
  try {
11542
- let e = Gg({
11591
+ let e = await oe("set", D ? C(s) : void 0, n, d);
11592
+ if (e !== null) return e;
11593
+ let t = Gg({
11543
11594
  schema: o,
11544
11595
  allowKeys: u,
11545
11596
  value: n,
11546
11597
  bindRef: c
11547
11598
  });
11548
- return e.ok ? (ae("edit", "eval_transform"), e.wholeParsed ? Wp(c, e.assembly) : e.assembly !== null && typeof e.assembly == "object" && Ep(c, e.assembly), N(), a && (a(c, i), N()), P({
11599
+ return t.ok ? (ae("edit", "eval_transform"), t.wholeParsed ? Wp(c, t.assembly) : t.assembly !== null && typeof t.assembly == "object" && Ep(c, t.assembly), N(), a && (a(c, i), N()), P({
11549
11600
  op: "edit",
11550
11601
  detail: "eval_transform",
11551
11602
  timestamp: Date.now()
11552
11603
  }), w(O(), s), `已通过脚本 transform 更新主数据(耗时 ${_.elapsedMs}ms)。当前值: ${Fp(c, 600)}`) : $({
11553
11604
  code: "SCHEMA_INVALID",
11554
11605
  message: "脚本返回值校验失败,未写入(transform 模式要求返回主数据的完整新值或顶层 key 子集)",
11555
- hint: "确认脚本 return 了完整新值(非部分);或返回 {patches:[...]} 走增量模式;按 describe_data() 查看格式",
11556
- details: (e.error.match(/"details":\s*(\[[^\]]*\])/)?.[1] ?? "") || e.error
11606
+ hint: "确认脚本 return 了完整新值(非部分);或返回 {patches:[...]} 走增量模式;按 schema_data() 查看格式",
11607
+ details: (t.error.match(/"details":\s*(\[[^\]]*\])/)?.[1] ?? "") || t.error
11557
11608
  });
11558
11609
  } finally {
11559
11610
  d.release();
@@ -11573,8 +11624,8 @@ function a_(e, n = {}) {
11573
11624
  jsonPath: t.string().optional().describe("子树模式:仅对该子树执行;transform 返回值作为子树新值")
11574
11625
  })
11575
11626
  });
11576
- se(de, (e) => e?.mode === "transform");
11577
- let L = s(async ({ jsonPath: e, jsonPaths: t, fields: n, depth: r, offset: i, limit: a }, s) => {
11627
+ se(I, (e) => e?.mode === "transform");
11628
+ let de = s(async ({ jsonPath: e, jsonPaths: t, fields: n, depth: r, offset: i, limit: a }, s) => {
11578
11629
  let d = y(s), f = b(s), p = O();
11579
11630
  if (t && t.length) {
11580
11631
  let e = !1, i = t.map((t) => {
@@ -11664,7 +11715,7 @@ function a_(e, n = {}) {
11664
11715
  offset: t.number().int().min(0).optional().describe("数组分页起始偏移(仅数组目标,默认 0)"),
11665
11716
  limit: t.number().int().min(1).max(200).optional().describe("数组分页每页条数(默认 50,上限 200),返回切片+total/hasMore")
11666
11717
  })
11667
- }), fe = s(async ({ value: e, patch: t, patches: n, del: i, dryRun: s }, l) => {
11718
+ }), L = s(async ({ value: e, patch: t, patches: n, del: i, dryRun: s }, l) => {
11668
11719
  let d = y(l), f = "set";
11669
11720
  i ? f = "delete" : (n && n.length || t) && (f = "edit");
11670
11721
  let p = t?.value === void 0 ? e : t.value, _ = await j();
@@ -11810,8 +11861,8 @@ function a_(e, n = {}) {
11810
11861
  dryRun: t.boolean().optional().describe("预检:走完整校验链但不落盘不入快照;冲突返回 VERSION_CONFLICT 不挂起")
11811
11862
  })
11812
11863
  });
11813
- se(fe);
11814
- let R = s(async ({ jsonPath: e }) => {
11864
+ se(L);
11865
+ let fe = s(async ({ jsonPath: e }) => {
11815
11866
  let t = e || "", n = t ? jf(o, t) : o;
11816
11867
  return n ? `schema${t ? ` @ ${t}` : ""} = ${Fp(Zf(n))}` : $({
11817
11868
  code: "PATH_DENIED",
@@ -11822,7 +11873,7 @@ function a_(e, n = {}) {
11822
11873
  name: "schema_data",
11823
11874
  description: "查看主数据(或子路径)的字段约束:类型/min/max/enum/必填/默认值/嵌套 shape。写前查约束,避免写错重试。不传 jsonPath 查根;传子路径(如 components.0)查该位置约束。",
11824
11875
  schema: t.object({ jsonPath: t.string().optional().describe("要查约束的子路径;不传查根 schema") })
11825
- }), pe = s(async ({ snapshotId: e, against: t }) => {
11876
+ }), R = s(async ({ snapshotId: e, against: t }) => {
11826
11877
  let n = t != null, r, i;
11827
11878
  if (n) {
11828
11879
  let e = t;
@@ -11854,7 +11905,7 @@ function a_(e, n = {}) {
11854
11905
  snapshotId: t.number().int().optional().describe("对比的快照序号;不传则最近一次"),
11855
11906
  against: t.unknown().optional().describe("对比的一段 JSON 值(与 snapshotId 互斥;传则忽略快照)")
11856
11907
  })
11857
- }), me = [];
11908
+ }), pe = [];
11858
11909
  if (n.vfsStore) {
11859
11910
  let e = n.vfsStore, r = (e) => `drafts/${e}.json`, i = s(({ draftId: t, chunk: n, mode: i }) => {
11860
11911
  let a = r(t), o = e.files[a], s = i === "append" && o, c = s ? o.content + n : n;
@@ -11922,9 +11973,9 @@ function a_(e, n = {}) {
11922
11973
  description: "把 draft_write 累积的草稿合并 + JSON.parse + 乐观锁 + schema 校验,原子提交主数据(任一步失败不写,草稿保留可修后重试;成功清草稿 + 自动快照可回退)。仅大 JSON 从零生成用;小改用 write。",
11923
11974
  schema: t.object({ draftId: t.string().describe("要提交的草稿标识(对应 draft_write 的 draftId)") })
11924
11975
  });
11925
- se(l), me.push(i, l);
11976
+ se(l), pe.push(i, l);
11926
11977
  }
11927
- let z = [];
11978
+ let me = [];
11928
11979
  if (e.resources?.length && f) {
11929
11980
  let e = s(async ({ path: e, handle: t }) => {
11930
11981
  let n = e;
@@ -12036,9 +12087,9 @@ function a_(e, n = {}) {
12036
12087
  handle: t.string().optional().describe("占位符句柄(与 path 二选一)")
12037
12088
  })
12038
12089
  });
12039
- se(i), z.push(e, n, r, i);
12090
+ se(i), me.push(e, n, r, i);
12040
12091
  }
12041
- let B = [
12092
+ let z = [
12042
12093
  ce,
12043
12094
  le,
12044
12095
  ue,
@@ -12048,22 +12099,21 @@ function a_(e, n = {}) {
12048
12099
  L,
12049
12100
  fe,
12050
12101
  R,
12051
- pe,
12052
- ...me,
12053
- ...z
12102
+ ...pe,
12103
+ ...me
12054
12104
  ];
12055
- Object.defineProperty(B, "controller", {
12105
+ Object.defineProperty(z, "controller", {
12056
12106
  value: ie,
12057
12107
  enumerable: !1,
12058
12108
  configurable: !1,
12059
12109
  writable: !1
12060
12110
  });
12061
- for (let e of B) Object.defineProperty(e, "__dataOpsScoped", {
12111
+ for (let e of z) Object.defineProperty(e, "__dataOpsScoped", {
12062
12112
  value: !0,
12063
12113
  enumerable: !1,
12064
12114
  configurable: !1
12065
12115
  });
12066
- return B;
12116
+ return z;
12067
12117
  }
12068
12118
  //#endregion
12069
12119
  //#region src/core/tools/htmlValidate.ts
@@ -13198,7 +13248,7 @@ function av(e, t, n) {
13198
13248
 
13199
13249
  两条工作路径:
13200
13250
  - **修改已有组件**(改颜色/文案/布局等):必经 vfs —— 上下文有「组件代码文件地图」(name → vfs 路径),按 name 找到对应文件直接 vfs_edit 增量改目标片段 → validate_code 自检;框架自动回写 data.${t}。勿直接 write data.${t} 改已有组件(绕过 vfs/verify,且无增量友好);文件未检出时先 vfs_write 创建
13201
- - **新建组件**:write({ patch:{ op:'set', jsonPath:'${n}.N', value:{...} } }) —— value 按 data schema **全字段写**(含全部必填字段 —— 字段名以样本为准照抄,如类型/名称,外加 ${t} 代码正文;缺必填字段会被 schema 拒)。调研**只看一个样本**:read({jsonPath:'${n}', offset:0, limit:1}) 取首个元素照抄字段名即可(**禁止分页逐个翻完整数组**,大数组翻页纯烧轮次;也不要 describe_data/schema_data 反复查);N = 数组长度(追加到末尾,read 返回的 total/length 即是)。框架自动补 __pgId。**固定流程**:直接 write data → validate_code({jsonPath:'${n}.N.${t}'}) 自检(从 data 读刚写的代码,零重传 content)→ read 确认;**不必手动 vfs_write 建工作副本**(框架下次委派自动 checkout;仅当本次委派内还要继续精修它,才 vfs_write 建副本再 vfs_edit)。**校验方式**:新建组件用 jsonPath(零重传)/ 修改组件用 path(vfs 文件)/ content 仅兜底;**禁止在思考里权衡「content 太长 / 要不要重传 / 先 vfs_write 再 by path」**,选对应方式一次校验即收口(为之纠结反费更多 token,真实复盘子 agent 曾在此循环 10+ 回合致整页超时)。**${t} 字段直接写完整代码字符串,换行/引号照常写,无需手工 JSON 转义**
13251
+ - **新建组件**:write({ patch:{ op:'set', jsonPath:'${n}.N', value:{...} } }) —— value 按 data schema **全字段写**(含全部必填字段 —— 字段名以样本为准照抄,如类型/名称,外加 ${t} 代码正文;缺必填字段会被 schema 拒)。调研**只看一个样本**:read({jsonPath:'${n}', offset:0, limit:1}) 取首个元素照抄字段名即可(**禁止分页逐个翻完整数组**,大数组翻页纯烧轮次;也不要 schema_data 反复查);N = 数组长度(追加到末尾,read 返回的 total/length 即是)。框架自动补 __pgId。**固定流程**:直接 write data → validate_code({jsonPath:'${n}.N.${t}'}) 自检(从 data 读刚写的代码,零重传 content)→ read 确认;**不必手动 vfs_write 建工作副本**(框架下次委派自动 checkout;仅当本次委派内还要继续精修它,才 vfs_write 建副本再 vfs_edit)。**校验方式**:新建组件用 jsonPath(零重传)/ 修改组件用 path(vfs 文件)/ content 仅兜底;**禁止在思考里权衡「content 太长 / 要不要重传 / 先 vfs_write 再 by path」**,选对应方式一次校验即收口(为之纠结反费更多 token,真实复盘子 agent 曾在此循环 10+ 回合致整页超时)。**${t} 字段直接写完整代码字符串,换行/引号照常写,无需手工 JSON 转义**
13202
13252
 
13203
13253
  焦点精修(若继承到主 agent 焦点):
13204
13254
  - 上下文若提示「当前精修目标」(如 ${n}.2),说明主 agent 聚焦了某组件 → 你**只能改该焦点组件**的代码文件(vfs 文件 ${e}<焦点组件 __pgId>.${r});改其他组件的代码文件会被 PATH_DENIED 硬拦
@@ -14263,11 +14313,11 @@ var uy = {
14263
14313
  enableLLMSummary: !0
14264
14314
  }
14265
14315
  }, dy = {
14266
- auto: ["describe_data", "read"],
14267
- conservative: ["describe_data"],
14268
- aggressive: ["describe_data", "read"],
14316
+ auto: ["schema_data", "read"],
14317
+ conservative: ["schema_data"],
14318
+ aggressive: ["schema_data", "read"],
14269
14319
  complex: [
14270
- "describe_data",
14320
+ "schema_data",
14271
14321
  "read",
14272
14322
  "query_data",
14273
14323
  "search_data"
@@ -14810,7 +14860,7 @@ function Qy(e, t, n) {
14810
14860
  name: "usageHints",
14811
14861
  augmentPrompt: (i) => {
14812
14862
  let a = [];
14813
- if (r.planning && (a.push("【自适应规划】按任务复杂度决定是否先规划,不要对简单任务过度编排:"), a.push(" · 简单/明确任务(改单字段、调样式、查值)→ 直接 read/write 执行,不必 write_todos。"), a.push(" · 复杂任务(多步、大改、有歧义、不可逆)→ 先 write_todos 拆解,首个任务标 in_progress,逐项推进。"), a.push(" · 执行中发现步骤要改/补/细分 → 用 update_todo({id, content?, status?}) 按 id 增量改单项,不必重传整个清单。"), a.push(" · update_todo 标 completed 时附 evidence: 本次实际写入的 jsonPath(如 \"components.2\"),供收口对账;工作经委派子 agent 完成等无主写路径时,如实写明完成方式(勿编造路径)。"), e?.humanConfirm ? a.push(" · 规划出多步方案若需用户拍板 → 先 request_human_confirmation 给方案选项,确认后再执行。") : a.push(" · 规划出多步方案若需用户拍板 → 以文字列出方案选项等用户回复,勿自行拍板。"), a.push(" · 计划修订有次数上限(maxPlanRevisions,默认 5,只计 write_todos 调用、调研轮不计):勿反复改计划而不执行,规划充分后即开始 write 落地。")), t && (a.push("改主数据前先 read({jsonPath}) 读其当前真实值(返回末尾 hash=xxx 为乐观锁标识),基于真实值改,不要凭记忆。写入是否被自动校验由集成方 conflictWatchFields 声明决定:若已声明且主数据在你 read 之后被外部改过,会触发冲突——集成方若开启人工介入,工具会挂起等用户决定(保留外部/强制覆盖/回退),你应等待工具返回后按结果继续(保留外部→重新 read 再改;强制覆盖→已写入,继续;回退→已回退到历史快照,基于回退值重写);未开启人工介入时返回 VERSION_CONFLICT 不写入,重新 read 拿最新值再改。"), a.push("读类分流:取值/结构 → read(多路径用 jsonPaths);字段约束 → schema_data;条件筛选定位 → query_data(多条一次用 queries);名字模糊找 → search_data;整体说明 → read 不传路径(= describe_data)。"), a.push("修改大对象/数组优先用 write 增量改({patch:{op,jsonPath,value}} 只发改动部分),避免 write({value}) 整体重传被 max_tokens 截断导致 JSON 不完整、校验失败。"), a.push("修改主数据出错时可用 restore_data 回退最近一次。"), a.push("在大数组里按条件筛选元素用 query_data(JSONPath,如 $.components[?(@.type==\"card\" && @.price<100)]),返回匹配元素的 path/index;定位后再 write({patch}) 改。"), a.push("找名字记不清的元素用 search_data(支持 substring/regex/fuzzy 模糊搜索)。"), a.push("需要过滤/映射/聚合/批量重写大数组时用 eval_script(沙箱脚本,入参 data);只读探查用 mode=query,批量重写用 mode=transform(返回值经校验后落地)。"), a.push("读大数组用 read({jsonPath,offset,limit}) 分页(返回 hasMore=true 时 offset+=limit 续读);一次读多个不相关子路径用 read({jsonPaths});复杂改动先 write({...,dryRun:true}) 预检不落盘。"), a.push("【省轮次·批量】≥2 个路径一律 read({jsonPaths:[...]}) 一次取回(路径互不相关也合批,禁止连续单路径 read);多条件筛选用 query_data({queries:[expr1,expr2,…]}) 一次取回(2-10 条);改多处用 write({patches:[{op:\"set\",jsonPath,value},...]}) 一次提交多改动(原子任一失败回滚),勿逐个 write 烧轮次预算。"), a.push("读到 <subtree Nkb keys:[…] #指纹> 或 <code Nkb> 占位 = 该子树键名/体积可见但内容未见:写入前先窄读全文(read({jsonPath:\"该子树路径\"}),结果根豁免返全文)或 set_focus 聚焦该区域;勿凭键名印象猜路径/猜值直写(直接写占位子树会被拦下要求先窄读)。"), a.push("对比当前与历史快照(或一段 JSON against)的差异用 diff_data({snapshotId?,against?})(返回结构化 path→from/to,verify 自纠/操作审计/\"刚才改了啥\");只读查历史快照值用 history_data({id?,jsonPath?})。")), r.subagent && a.push("独立子任务可 spawn_agent 委派(过程隔离,不占主上下文):默认只读,需要子 agent 写数据时传 writablePaths(路径前缀白名单,越界 PATH_OUT_OF_SCOPE)。多个独立子任务可 spawn_agents 并行委派(各子互不通信,结论由你汇总;并行委派不可授写权限,写操作由你收尾执行)。"), r.inspectEnv && a.push("排查页面环境(当前 URL/浏览器/视口/集成方调试变量)用 inspect_env——不传参返回环境摘要(location/navigator/viewport/document),传 key 读特定 window 属性(如 inspect_env({key:\"appConfig\"}) 读 window.appConfig)。改完数据看渲染、定位\"为何没生效\"时用它(只读,不改数据)。"), r.domInspect && a.push("改完数据想确认渲染是否生效(或定位元素/辅助 UI 设计问答)用 get_dom({selector?,depth?}) 读渲染后 DOM(结构化返回 tag/attrs/text/children,depth 控制深度防爆炸,只读)。配合宿主 actions(save_draft/publish 等)形成\"改数据→get_dom 看渲染→触发动作\"闭环。"), r.draftWrite && (a.push("生成超大 JSON(如 50+ 组件页面,单次 write 受 max_tokens 限制装不下)用 draft_write 分块构建 → draft_commit 原子提交:draft_write({draftId, chunk, mode}) mode:\"start\" 新建/\"append\" 追加(拼 JSON 片段到 drafts 池);累积完 draft_commit({draftId}) 合并 + schema 校验 + 写主数据(失败草稿保留可修后重试,成功自动清草稿)。小改仍用 write patch,只在大 JSON 从零生成时用 draft。"), a.push("⚠️ 大 JSON 分块构建是典型多轮工具调用(draft_write×N + draft_commit + read 确认 + 调研 read/query),默认 maxToolRounds=30(3.43 起;轮次预算吃紧时 system 会注入预算提示段,按提示优先收口);目标组件数很大时集成方仍可在 createChatSdk 显式上调 maxToolRounds(按 N+10 估算)。draft_commit 提交同样走乐观锁(改前 read 拿 hash,bind 被改过会触发冲突介入,不静默覆盖)。")), r.focus && (a.push("【上下文聚焦】判断任务范围,用 set_focus/add_focus/remove_focus/clear_focus 自动收敛工作范围:"), a.push(" · 局部任务(只改某一组件/区域,如「调导航栏」「改 components.3 样式」)→ 先 read 定位 jsonPath,再 set_focus({path:\"该子树路径\"}) 聚焦;聚焦后每轮只看该子树结构,写其他位置会被 PATH_DENIED 拒绝。"), a.push(" · 多个相关组件(如「同时改导航栏和页脚」)→ set_focus 聚焦首个后用 add_focus({path}) 追加其余;聚焦后可写任一焦点子树,越界仍被拒;移除单个用 remove_focus({path})。"), a.push(" · 全局任务(多处/整体结构,如「重排所有组件」「换主题」)→ 不要聚焦,保持全量视野直接写。"), a.push(" · 完成局部精修、要转向其他区域或做整体改动 → 调 clear_focus 退出聚焦(清空全部焦点),恢复全部读写权限。"), a.push(" · set_focus/add_focus 的 path 必须在 schema 内(类型校验);不确定路径先 read/describe_data 查。")), e?.subagents?.length) {
14863
+ if (r.planning && (a.push("【自适应规划】按任务复杂度决定是否先规划,不要对简单任务过度编排:"), a.push(" · 简单/明确任务(改单字段、调样式、查值)→ 直接 read/write 执行,不必 write_todos。"), a.push(" · 复杂任务(多步、大改、有歧义、不可逆)→ 先 write_todos 拆解,首个任务标 in_progress,逐项推进。"), a.push(" · 执行中发现步骤要改/补/细分 → 用 update_todo({id, content?, status?}) 按 id 增量改单项,不必重传整个清单。"), a.push(" · update_todo 标 completed 时附 evidence: 本次实际写入的 jsonPath(如 \"components.2\"),供收口对账;工作经委派子 agent 完成等无主写路径时,如实写明完成方式(勿编造路径)。"), e?.humanConfirm ? a.push(" · 规划出多步方案若需用户拍板 → 先 request_human_confirmation 给方案选项,确认后再执行。") : a.push(" · 规划出多步方案若需用户拍板 → 以文字列出方案选项等用户回复,勿自行拍板。"), a.push(" · 计划修订有次数上限(maxPlanRevisions,默认 5,只计 write_todos 调用、调研轮不计):勿反复改计划而不执行,规划充分后即开始 write 落地。")), t && (a.push("改主数据前先 read({jsonPath}) 读其当前真实值(返回末尾 hash=xxx 为乐观锁标识),基于真实值改,不要凭记忆。写入是否被自动校验由集成方 conflictWatchFields 声明决定:若已声明且主数据在你 read 之后被外部改过,会触发冲突——集成方若开启人工介入,工具会挂起等用户决定(保留外部/强制覆盖/回退),你应等待工具返回后按结果继续(保留外部→重新 read 再改;强制覆盖→已写入,继续;回退→已回退到历史快照,基于回退值重写);未开启人工介入时返回 VERSION_CONFLICT 不写入,重新 read 拿最新值再改。"), a.push("读类分流:取值/结构 → read(多路径用 jsonPaths);字段约束 → schema_data;条件筛选定位 → query_data(多条一次用 queries);名字模糊找 → search_data;整体说明 → read 不传路径。"), a.push("修改大对象/数组优先用 write 增量改({patch:{op,jsonPath,value}} 只发改动部分),避免 write({value}) 整体重传被 max_tokens 截断导致 JSON 不完整、校验失败。"), a.push("修改主数据出错时可用 restore_data 回退最近一次。"), a.push("在大数组里按条件筛选元素用 query_data(JSONPath,如 $.components[?(@.type==\"card\" && @.price<100)]),返回匹配元素的 path/index;定位后再 write({patch}) 改。"), a.push("找名字记不清的元素用 search_data(支持 substring/regex/fuzzy 模糊搜索)。"), a.push("需要过滤/映射/聚合/批量重写大数组时用 eval_script(沙箱脚本,入参 data);只读探查用 mode=query,批量重写用 mode=transform(返回值经校验后落地)。"), a.push("读大数组用 read({jsonPath,offset,limit}) 分页(返回 hasMore=true 时 offset+=limit 续读);一次读多个不相关子路径用 read({jsonPaths});复杂改动先 write({...,dryRun:true}) 预检不落盘。"), a.push("【省轮次·批量】≥2 个路径一律 read({jsonPaths:[...]}) 一次取回(路径互不相关也合批,禁止连续单路径 read);多条件筛选用 query_data({queries:[expr1,expr2,…]}) 一次取回(2-10 条);改多处用 write({patches:[{op:\"set\",jsonPath,value},...]}) 一次提交多改动(原子任一失败回滚),勿逐个 write 烧轮次预算。"), a.push("读到 <subtree Nkb keys:[…] #指纹> 或 <code Nkb> 占位 = 该子树键名/体积可见但内容未见:写入前先窄读全文(read({jsonPath:\"该子树路径\"}),结果根豁免返全文)或 set_focus 聚焦该区域;勿凭键名印象猜路径/猜值直写(直接写占位子树会被拦下要求先窄读)。"), a.push("对比当前与历史快照(或一段 JSON against)的差异用 diff_data({snapshotId?,against?})(返回结构化 path→from/to,verify 自纠/操作审计/\"刚才改了啥\");只读查历史快照值用 history_data({id?,jsonPath?})。")), r.subagent && a.push("独立子任务可 spawn_agent 委派(过程隔离,不占主上下文):默认只读,需要子 agent 写数据时传 writablePaths(路径前缀白名单,越界 PATH_OUT_OF_SCOPE)。多个独立子任务可 spawn_agents 并行委派(各子互不通信,结论由你汇总;并行委派不可授写权限,写操作由你收尾执行)。"), r.inspectEnv && a.push("排查页面环境(当前 URL/浏览器/视口/集成方调试变量)用 inspect_env——不传参返回环境摘要(location/navigator/viewport/document),传 key 读特定 window 属性(如 inspect_env({key:\"appConfig\"}) 读 window.appConfig)。改完数据看渲染、定位\"为何没生效\"时用它(只读,不改数据)。"), r.domInspect && a.push("改完数据想确认渲染是否生效(或定位元素/辅助 UI 设计问答)用 get_dom({selector?,depth?}) 读渲染后 DOM(结构化返回 tag/attrs/text/children,depth 控制深度防爆炸,只读)。配合宿主 actions(save_draft/publish 等)形成\"改数据→get_dom 看渲染→触发动作\"闭环。"), r.draftWrite && (a.push("生成超大 JSON(如 50+ 组件页面,单次 write 受 max_tokens 限制装不下)用 draft_write 分块构建 → draft_commit 原子提交:draft_write({draftId, chunk, mode}) mode:\"start\" 新建/\"append\" 追加(拼 JSON 片段到 drafts 池);累积完 draft_commit({draftId}) 合并 + schema 校验 + 写主数据(失败草稿保留可修后重试,成功自动清草稿)。小改仍用 write patch,只在大 JSON 从零生成时用 draft。"), a.push("⚠️ 大 JSON 分块构建是典型多轮工具调用(draft_write×N + draft_commit + read 确认 + 调研 read/query),默认 maxToolRounds=30(3.43 起;轮次预算吃紧时 system 会注入预算提示段,按提示优先收口);目标组件数很大时集成方仍可在 createChatSdk 显式上调 maxToolRounds(按 N+10 估算)。draft_commit 提交同样走乐观锁(改前 read 拿 hash,bind 被改过会触发冲突介入,不静默覆盖)。")), r.focus && (a.push("【上下文聚焦】判断任务范围,用 set_focus/add_focus/remove_focus/clear_focus 自动收敛工作范围:"), a.push(" · 局部任务(只改某一组件/区域,如「调导航栏」「改 components.3 样式」)→ 先 read 定位 jsonPath,再 set_focus({path:\"该子树路径\"}) 聚焦;聚焦后每轮只看该子树结构,写其他位置会被 PATH_DENIED 拒绝。"), a.push(" · 多个相关组件(如「同时改导航栏和页脚」)→ set_focus 聚焦首个后用 add_focus({path}) 追加其余;聚焦后可写任一焦点子树,越界仍被拒;移除单个用 remove_focus({path})。"), a.push(" · 全局任务(多处/整体结构,如「重排所有组件」「换主题」)→ 不要聚焦,保持全量视野直接写。"), a.push(" · 完成局部精修、要转向其他区域或做整体改动 → 调 clear_focus 退出聚焦(清空全部焦点),恢复全部读写权限。"), a.push(" · set_focus/add_focus 的 path 必须在 schema 内(类型校验);不确定路径先 read 查。")), e?.subagents?.length) {
14814
14864
  let t = e.subagents.filter((e) => (e.temperature ?? 0) >= Zy || /规划|创意|设计|方案|brainstorm|plan/i.test(e.description)), n = e.subagents.filter((e) => (e.temperature ?? 0) < Zy && /反思|审查|挑刺|校验|review|critique|reflect/i.test(e.description));
14815
14865
  a.push("【规划-反思-执行·路由】按任务性质选模式,不要对简单任务过度编排:"), t.length && (a.push(` · 创作/设计/开放性需求(如"设计主题风格""换个感觉")→ 先调 ${t.map((e) => "use_" + e.id).join("/")} 出 2-3 套方案(高温创意),`), a.push(e?.humanConfirm ? " 不要自己拍板;拿到方案后,若需用户拍板用 request_human_confirmation 弹选项。" : " 不要自己拍板;拿到方案后以文字列出选项等用户回复(humanConfirm 未开,勿调不存在工具)。")), n.length && a.push(` · 严谨/易错/校验类 → 可先调 ${n.map((e) => "use_" + e.id).join("/")} 反思挑刺(低温审查),据反馈修订。`), a.push(" · 方案定稿后,由你(主 agent)用 write 落地成 JSON(低温度执行 + schema 校验 + 写前确认)。"), a.push(" · 简单/明确任务(如\"标题改红色\")直接执行,不必走规划-反思。");
14816
14866
  }
@@ -15335,11 +15385,7 @@ function hb(e, n) {
15335
15385
  ...n ? { thinkingMode: n } : {},
15336
15386
  thinkingApplied: r
15337
15387
  };
15338
- }, mt = [
15339
- "describe_data",
15340
- "read",
15341
- "fetch_document"
15342
- ], ht = ze.filter((e) => mt.includes(e.name)), gt = et ? Mh({
15388
+ }, mt = ["read", "fetch_document"], ht = ze.filter((e) => mt.includes(e.name)), gt = et ? Mh({
15343
15389
  check: e.verify.check ?? Rh({
15344
15390
  schemas: () => W() ? { "": W().schema } : {},
15345
15391
  root: () => W()?.bind
@@ -30939,4 +30985,4 @@ function dL(e) {
30939
30985
  return gb(e, UI);
30940
30986
  }
30941
30987
  //#endregion
30942
- export { yj as ApprovalBar, sy as CAPABILITIES, uy as CONTEXT_PRESETS, HI as ChatDialog, GE as ChatHeader, aM as ChatInput, uL as CodePreview, _v as CompressDecisionSchema, Ij as ConflictBar, Cy as DEFAULT_COMPUTED_STYLES, Ew as DEFAULT_DIALOG_ICONS, km as DEFAULT_PROMPT_SOFT_CAP, ig as DEFAULT_SYSTEM_PROMPT, ag as DEFAULT_SYSTEM_PROMPT_EN, hI as DebugDrawer, nD as FocusBar, rA as HLJS_BLOCK_MAX_CHARS, o_ as HTML_VOID_TAGS, yh as HUMAN_CONFIRM_TOOL_NAME, gE as IconGlyph, tu as ImageInputError, T as LOW_CAPS_HINT_BASELINE, kw as MESSAGES_EN_US, Ow as MESSAGES_ZH_CN, S as MIN_CONTEXT_WINDOW, Ru as MODEL_UNAVAILABLE_GUIDANCE, hA as MessageContent, JA as MessageList, RA as MessageRow, ij as QueuedBar, Om as SOFT_CAP_MIN_WINDOW, Sm as STOP_WORDS, VI as SkillPanel, wp as UNSAFE_KEYS, Gy as actionsToInspectInfo, Wy as actionsToTools, Zl as agentError, Zh as analyzeContext, zp as applyPatchToClone, Hp as applyPatchToLive, Jg as applyPatchesToBind, Lf as arrayMinLength, Xl as asAgentError, Z_ as buildCollectorJs, Oy as buildCssPath, og as buildDataPrompt, U_ as buildDiagnosticsReport, sv as buildHtmlFragmentSkill, Q_ as buildSandboxSrcdoc, sg as buildSystemPrompt, Mw as chatContextKey, qg as commitSetToBind, iv as composeStructureThenRender, fu as compressImage, rg as connectMcp, ie as constructLlmFromConfig, ne as constructOpenLlmSync, Tw as copyText, Df as createAgent, vh as createApprovalMiddleware, Nw as createChatContext, dL as createChatSdk, kh as createCheckpointManager, Ah as createCheckpointMiddleware, Av as createConflictManager, Qh as createContextInspectorMiddleware, dv as createCraftNoteCheck, a_ as createDataOps, lv as createHtmlFormatCheck, rv as createHtmlRenderCheck, pv as createHtmlSubagent, Sh as createHumanConfirmMiddleware, xh as createHumanConfirmTool, Qv as createMemoryBackend, dh as createMemoryMiddleware, y as createProxyLlm, YI as createRagSubagent, Gu as createSandboxRunner, ly as createSdkEvents, cb as createSerialRunner, ny as createSessionStore, ry as createSessionStoreWithBackend, ib as createSkillStore, nh as createSubagentMiddleware, Im as createSubagentTracker, ah as createSubagentsMiddleware, Qy as createUsageHintsMiddleware, Mh as createVerifyMiddleware, dg as createVfs, ey as createWebStorageBackend, Rh as createWriteBackCheck, zu as decorateModelUnavailable, Ap as deepClone, Jy as defineDataToolset, Qp as defineSkill, mv as defineTool, kp as deleteByPath, vv as deriveTitle, Zf as describeSchemaNode, pf as detectGarbledToolCall, Rd as detectTransitionalReply, Kp as diffObjects, Ny as domInfoTool, Py as domInspectSkill, My as domSearchTool, by as domToStructure, Sy as domTools, qy as domToolsStatic, Rf as elementSchemaCandidates, Ey as ensureDomListenerRecorder, wm as estimateMessageTokens, Tm as estimateRoundTokens, O as estimateTokens, ae as extractReasoningDelta, up as extractSchemaHint, $h as extractText, P as extractTextDelta, oe as extractUsage, gy as fetchDocTools, Ky as fetchTools, Gp as findStrippedKeys, Qf as formatConstraints, Kl as formatZodIssues, Dp as getByPath, xy as getDomTool, jy as getElementInfo, Ly as getEnvSummary, Dy as getRecordedListeners, tv as getSandboxLifecycle, jf as getSchemaAtPath, Of as getSchemaTopKeys, Lp as hashValue, cv as htmlFragmentSkill, ap as htmlOrchestratorPrompt, Em as indexSummarize, By as inspectEnvTool, Vy as inspectTools, bv as isChatModel, Iu as isContextLengthError, iE as isIconHtml, Lu as isModelUnavailableError, kf as isPathAllowed, Wv as isQuotaError, Tp as isUnsafePath, td as jpEval, Jl as jsonParseError, Pp as limitDepth, E as lowCapsHint, lA as markedToHtml, V_ as maskUrlCredentials, Mp as maybeParseValue, F_ as measureWriteScale, Vp as moveByPath, M as normalizeBaseUrl, X_ as normalizeRenderResult, ce as normalizeUsage, A as offloadPassThroughChars, k as offloadThresholdChars, ip as presets, Gf as projectBySchema, Wf as projectBySchemaDeep, Np as projectFields, Dm as recallRounds, nv as renderInSandbox, uA as renderMarkdownHtml, $f as renderSchemaHint, ep as renderSchemaOverview, rp as renderSchemaShallow, cy as resolveCapabilities, fy as resolveContextOptions, oy as resolveDialogConfig, Dw as resolveDialogIcons, jw as resolveDialogMessages, kv as resolveLlm, D as resolveModelCaps, jm as resolvePromptSoftCap, Pf as resolveSchemaPath, ay as resolveStorage, Wp as restoreInPlace, Up as restoreLive, Yl as routeError, ad as runSandboxedScript, Ep as safeMerge, Iy as safeSerialize, Fp as safeStringify, mf as sanitizeGarbledContent, cE as sanitizeIconHtml, dE as sanitizeMessageHtml, If as schemaHasRefinement, ky as searchDom, rd as searchJson, Yy as selectBuiltinTools, Op as setByPath, Mm as shouldTriggerCompression, W_ as stringifyDiagnosticsReport, te as stripStainlessFetch, op as systemPromptHelpers, w as tableMaxOutputTokens, Cm as tokenize, $ as toolError, Af as unwrapSchema, ww as useChat, Pw as useChatContext, Ff as validateAtPath, c_ as validateHtmlFormat, Gg as validateRootValueLocally, Kg as validateWriteLocally, Rp as watchFieldsHash, e as z, ql as zodError };
30988
+ export { yj as ApprovalBar, sy as CAPABILITIES, uy as CONTEXT_PRESETS, HI as ChatDialog, GE as ChatHeader, aM as ChatInput, uL as CodePreview, _v as CompressDecisionSchema, Ij as ConflictBar, Cy as DEFAULT_COMPUTED_STYLES, Ew as DEFAULT_DIALOG_ICONS, km as DEFAULT_PROMPT_SOFT_CAP, ig as DEFAULT_SYSTEM_PROMPT, ag as DEFAULT_SYSTEM_PROMPT_EN, hI as DebugDrawer, nD as FocusBar, rA as HLJS_BLOCK_MAX_CHARS, o_ as HTML_VOID_TAGS, yh as HUMAN_CONFIRM_TOOL_NAME, gE as IconGlyph, tu as ImageInputError, T as LOW_CAPS_HINT_BASELINE, kw as MESSAGES_EN_US, Ow as MESSAGES_ZH_CN, S as MIN_CONTEXT_WINDOW, Ru as MODEL_UNAVAILABLE_GUIDANCE, hA as MessageContent, JA as MessageList, RA as MessageRow, ij as QueuedBar, Om as SOFT_CAP_MIN_WINDOW, Sm as STOP_WORDS, VI as SkillPanel, wp as UNSAFE_KEYS, Gy as actionsToInspectInfo, Wy as actionsToTools, Zl as agentError, Zh as analyzeContext, zp as applyPatchToClone, Hp as applyPatchToLive, Jg as applyPatchesToBind, Lf as arrayMinLength, Xl as asAgentError, Z_ as buildCollectorJs, Oy as buildCssPath, og as buildDataPrompt, U_ as buildDiagnosticsReport, sv as buildHtmlFragmentSkill, Q_ as buildSandboxSrcdoc, sg as buildSystemPrompt, Mw as chatContextKey, qg as commitSetToBind, iv as composeStructureThenRender, fu as compressImage, rg as connectMcp, ie as constructLlmFromConfig, ne as constructOpenLlmSync, Tw as copyText, Df as createAgent, vh as createApprovalMiddleware, Nw as createChatContext, dL as createChatSdk, kh as createCheckpointManager, Ah as createCheckpointMiddleware, Av as createConflictManager, Qh as createContextInspectorMiddleware, dv as createCraftNoteCheck, a_ as createDataOps, lv as createHtmlFormatCheck, rv as createHtmlRenderCheck, pv as createHtmlSubagent, Sh as createHumanConfirmMiddleware, xh as createHumanConfirmTool, Qv as createMemoryBackend, dh as createMemoryMiddleware, y as createProxyLlm, YI as createRagSubagent, Wu as createSandboxRunner, ly as createSdkEvents, cb as createSerialRunner, ny as createSessionStore, ry as createSessionStoreWithBackend, ib as createSkillStore, nh as createSubagentMiddleware, Im as createSubagentTracker, ah as createSubagentsMiddleware, Qy as createUsageHintsMiddleware, Mh as createVerifyMiddleware, dg as createVfs, ey as createWebStorageBackend, Rh as createWriteBackCheck, zu as decorateModelUnavailable, Ap as deepClone, Jy as defineDataToolset, Qp as defineSkill, mv as defineTool, kp as deleteByPath, vv as deriveTitle, Zf as describeSchemaNode, pf as detectGarbledToolCall, Ld as detectTransitionalReply, Kp as diffObjects, Ny as domInfoTool, Py as domInspectSkill, My as domSearchTool, by as domToStructure, Sy as domTools, qy as domToolsStatic, Rf as elementSchemaCandidates, Ey as ensureDomListenerRecorder, wm as estimateMessageTokens, Tm as estimateRoundTokens, O as estimateTokens, ae as extractReasoningDelta, up as extractSchemaHint, $h as extractText, P as extractTextDelta, oe as extractUsage, gy as fetchDocTools, Ky as fetchTools, Gp as findStrippedKeys, Qf as formatConstraints, Kl as formatZodIssues, Dp as getByPath, xy as getDomTool, jy as getElementInfo, Ly as getEnvSummary, Dy as getRecordedListeners, tv as getSandboxLifecycle, jf as getSchemaAtPath, Of as getSchemaTopKeys, Lp as hashValue, cv as htmlFragmentSkill, ap as htmlOrchestratorPrompt, Em as indexSummarize, By as inspectEnvTool, Vy as inspectTools, bv as isChatModel, Iu as isContextLengthError, iE as isIconHtml, Lu as isModelUnavailableError, kf as isPathAllowed, Wv as isQuotaError, Tp as isUnsafePath, ed as jpEval, Jl as jsonParseError, Pp as limitDepth, E as lowCapsHint, lA as markedToHtml, V_ as maskUrlCredentials, Mp as maybeParseValue, F_ as measureWriteScale, Vp as moveByPath, M as normalizeBaseUrl, X_ as normalizeRenderResult, ce as normalizeUsage, A as offloadPassThroughChars, k as offloadThresholdChars, ip as presets, Gf as projectBySchema, Wf as projectBySchemaDeep, Np as projectFields, Dm as recallRounds, nv as renderInSandbox, uA as renderMarkdownHtml, $f as renderSchemaHint, ep as renderSchemaOverview, rp as renderSchemaShallow, cy as resolveCapabilities, fy as resolveContextOptions, oy as resolveDialogConfig, Dw as resolveDialogIcons, jw as resolveDialogMessages, kv as resolveLlm, D as resolveModelCaps, jm as resolvePromptSoftCap, Pf as resolveSchemaPath, ay as resolveStorage, Wp as restoreInPlace, Up as restoreLive, Yl as routeError, id as runSandboxedScript, Ep as safeMerge, Iy as safeSerialize, Fp as safeStringify, mf as sanitizeGarbledContent, cE as sanitizeIconHtml, dE as sanitizeMessageHtml, If as schemaHasRefinement, ky as searchDom, nd as searchJson, Yy as selectBuiltinTools, Op as setByPath, Mm as shouldTriggerCompression, W_ as stringifyDiagnosticsReport, te as stripStainlessFetch, op as systemPromptHelpers, w as tableMaxOutputTokens, Cm as tokenize, $ as toolError, Af as unwrapSchema, ww as useChat, Pw as useChatContext, Ff as validateAtPath, c_ as validateHtmlFormat, Gg as validateRootValueLocally, Kg as validateWriteLocally, Rp as watchFieldsHash, e as z, ql as zodError };