page-agent-sdk 1.4.2 → 2.0.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.
@@ -13082,7 +13082,7 @@ app.mount('#app');
13082
13082
  key: e.name,
13083
13083
  class: "info-item"
13084
13084
  }, [Y("div", Gp, V(e.name), 1), Y("div", Kp, V(e.description), 1)]))), 128))])) : X("", !0),
13085
- b.value.windowProps.length ? (q(), J("div", qp, [Y("div", Jp, "🪟 可操作属性 (" + V(b.value.windowProps.length) + ")", 1), (q(!0), J(K, null, Xi(b.value.windowProps, (e) => (q(), J("div", {
13085
+ b.value.dataSlots.length ? (q(), J("div", qp, [Y("div", Jp, "🪟 可操作属性 (" + V(b.value.dataSlots.length) + ")", 1), (q(!0), J(K, null, Xi(b.value.dataSlots, (e) => (q(), J("div", {
13086
13086
  key: e.path,
13087
13087
  class: "info-item"
13088
13088
  }, [Y("div", Yp, V(e.path), 1), Y("div", Xp, V(e.description), 1)]))), 128))])) : X("", !0),
@@ -13125,7 +13125,7 @@ app.mount('#app');
13125
13125
  _: 1
13126
13126
  })]));
13127
13127
  }
13128
- }), [["__scopeId", "data-v-ac94546c"]]), zm = { class: "chat-header" }, Bm = { class: "header-left" }, Vm = { class: "header-title" }, Hm = {
13128
+ }), [["__scopeId", "data-v-2a895152"]]), zm = { class: "chat-header" }, Bm = { class: "header-left" }, Vm = { class: "header-title" }, Hm = {
13129
13129
  key: 0,
13130
13130
  class: "status-dot pulse"
13131
13131
  }, Um = { class: "header-actions" }, Wm = {
@@ -13591,7 +13591,7 @@ app.mount('#app');
13591
13591
  ])
13592
13592
  ], 2));
13593
13593
  }
13594
- }), [["__scopeId", "data-v-063f5f71"]]);
13594
+ }), [["__scopeId", "data-v-5bd12eb9"]]);
13595
13595
  function Zh(e) {
13596
13596
  return e.replace(/^\/+/, "").replace(/\/+/g, "/");
13597
13597
  }
@@ -14357,14 +14357,14 @@ function Ag(e = "") {
14357
14357
  //#endregion
14358
14358
  //#region src/core/harness/permissions.ts
14359
14359
  var jg = /* @__PURE__ */ new Set([
14360
- "set_window_prop",
14361
- "delete_window_prop",
14360
+ "set_data_slot",
14361
+ "delete_data_slot",
14362
14362
  "vfs_write",
14363
14363
  "vfs_edit"
14364
14364
  ]), Mg = /* @__PURE__ */ new Set([
14365
- "get_window_prop",
14366
- "describe_window_prop",
14367
- "list_window_props",
14365
+ "get_data_slot",
14366
+ "describe_data_slot",
14367
+ "list_data_slots",
14368
14368
  "vfs_read",
14369
14369
  "vfs_ls",
14370
14370
  "vfs_glob",
@@ -14530,7 +14530,7 @@ function qg(e) {
14530
14530
  return {
14531
14531
  save(i) {
14532
14532
  let a = Kg(e.messages), o = {};
14533
- for (let t of e.windowPaths) o[t] = Vg(Hg(window, t));
14533
+ for (let t of e.slotPaths) o[t] = Vg(Hg(window, t));
14534
14534
  let s = {
14535
14535
  id: r++,
14536
14536
  label: i,
@@ -14584,10 +14584,10 @@ function Yg(e) {
14584
14584
  return !!e && typeof e == "object" && typeof e.invoke == "function" && typeof e.stream == "function";
14585
14585
  }
14586
14586
  var Xg = [
14587
- "get_window_prop",
14588
- "get_window_paths",
14589
- "list_window_props",
14590
- "describe_window_prop",
14587
+ "get_data_slot",
14588
+ "get_slot_paths",
14589
+ "list_data_slots",
14590
+ "describe_data_slot",
14591
14591
  "fetch_document"
14592
14592
  ], Zg = 1, Qg = 4, $g = 6, e_ = ["spawn_agent", "spawn_agents"];
14593
14593
  async function t_(e, t, n, r, i) {
@@ -14753,9 +14753,9 @@ function o_(e) {
14753
14753
  };
14754
14754
  }
14755
14755
  var s_ = /* @__PURE__ */ new Set([
14756
- "set_window_prop",
14757
- "edit_window_prop",
14758
- "delete_window_prop"
14756
+ "set_data_slot",
14757
+ "edit_data_slot",
14758
+ "delete_data_slot"
14759
14759
  ]), c_ = /校验失败|未在注册表中声明|未注册|不存在|仅支持|必须是/;
14760
14760
  function l_(e) {
14761
14761
  let t = /* @__PURE__ */ new Map();
@@ -14796,7 +14796,7 @@ function f_(e = {}) {
14796
14796
  let r = s ? i.get(s) : void 0;
14797
14797
  if (r && c_.test(r)) continue;
14798
14798
  let c = d_(t, e);
14799
- if (n === "delete_window_prop") c !== void 0 && o.push(`${e} 删除后读回仍有值,疑似未生效`);
14799
+ if (n === "delete_data_slot") c !== void 0 && o.push(`${e} 删除后读回仍有值,疑似未生效`);
14800
14800
  else if (c == null) o.push(`写入 ${e} 后读回为空,疑似未生效`);
14801
14801
  else if (a[e]) {
14802
14802
  let t = a[e].safeParse(c);
@@ -14834,7 +14834,7 @@ async function v_(e, t, n, r) {
14834
14834
  "你是严格的对抗式审查者,目标是找出以下 AI 助手回复的错误并证明它有问题(事实错误 / 遗漏 / 逻辑矛盾 / 与需求不符)。",
14835
14835
  `用户需求:${i || "(未明确)"}`,
14836
14836
  `助手回复:${a}`,
14837
- o ? "重点检查 window 修改:① 属性路径是否正确(是否误写未注册路径);② 值类型是否符合该属性 schema;③ 语义是否符合属性 description。可用只读工具(get_window_prop / list_window_props 等)读回实际值实证。" : "只报告具体、可验证的问题。",
14837
+ o ? "重点检查 window 修改:① 属性路径是否正确(是否误写未注册路径);② 值类型是否符合该属性 schema;③ 语义是否符合属性 description。可用只读工具(get_data_slot / list_data_slots 等)读回实际值实证。" : "只报告具体、可验证的问题。",
14838
14838
  "若确实无问题,只回复\"无问题\"。"
14839
14839
  ].join("\n"), c = "你是严格的对抗式审查者,只找问题不赞美。目标是反驳,不是改进。", l = n ? (e) => n(e.type, {
14840
14840
  ...e.data,
@@ -15042,11 +15042,11 @@ function P_(e = {}) {
15042
15042
  }
15043
15043
  else u = M_(o, l), d = s + "index_summary";
15044
15044
  let f = t.enableRecall ? N_(o, c, t.recallTopK) : [], p = f.length ? f.map((e) => `- 第${e.round}轮:${w_(e.userMsg.content, 60)} → ${e.assistantMsgs[0] ? w_(e.assistantMsgs[0].content, 80) : ""}`).join("\n") : "", m = [`【对话历史摘要】以下是之前 ${o.length} 轮对话的要点(最新 ${a.length} 轮已完整保留):`, u];
15045
- if (p && m.push("\n【与当前问题可能相关的早期对话】", p), t.getRegisteredProps) try {
15046
- let e = t.getRegisteredProps();
15045
+ if (p && m.push("\n【与当前问题可能相关的早期对话】", p), t.getRegisteredSlots) try {
15046
+ let e = t.getRegisteredSlots();
15047
15047
  if (e.length) {
15048
15048
  let t = e.map((e) => `- ${e.path}: ${e.description}`).join("\n");
15049
- m.push("\n【当前可操作 window 属性(动态增删后的最新状态,操作前以 list_window_props 为准)】", t);
15049
+ m.push("\n【当前可操作数据槽 属性(动态增删后的最新状态,操作前以 list_data_slots 为准)】", t);
15050
15050
  }
15051
15051
  } catch {}
15052
15052
  let h = {
@@ -15110,7 +15110,7 @@ function I_(e = {}) {
15110
15110
  //#endregion
15111
15111
  //#region src/core/presets.ts
15112
15112
  var L_ = {
15113
- pageBuilder: { systemPrompt: "你是页面构建助手。流程:get_window_prop 读取当前页面结构 → set_window_prop / edit_window_prop 修改属性 → 页面实时更新。多步任务先用 write_todos 拆解,逐步推进。" },
15113
+ pageBuilder: { systemPrompt: "你是页面构建助手。流程:get_data_slot 读取当前页面结构 → set_data_slot / edit_data_slot 修改属性 → 页面实时更新。多步任务先用 write_todos 拆解,逐步推进。" },
15114
15114
  researcher: {
15115
15115
  systemPrompt: "你是调研助手。多路调研用 spawn_agents 并行委派子 agent(各负责一个方向);单份资料用 fetch_document 抓取;最后结构化汇总,给出结论与依据。",
15116
15116
  subagent: { maxParallel: 4 }
@@ -15125,11 +15125,11 @@ var L_ = {
15125
15125
  } }
15126
15126
  }, R_ = { reliableWriteRules: [
15127
15127
  "【可靠写入规则】",
15128
- "1. 改任何属性前,先用 get_window_prop 读其当前真实值,基于真实值改,不要凭记忆;",
15129
- "2. 若不确定可操作哪些属性,先 list_window_props 查看当前注册项(动态组件场景下注册表会增删,以工具返回为准,勿凭旧记忆);",
15130
- "3. 不确定某属性字段结构时,先 describe_window_prop 看其说明,字段以 describe 返回为准;",
15128
+ "1. 改任何属性前,先用 get_data_slot 读其当前真实值,基于真实值改,不要凭记忆;",
15129
+ "2. 若不确定可操作哪些属性,先 list_data_slots 查看当前注册项(动态组件场景下注册表会增删,以工具返回为准,勿凭旧记忆);",
15130
+ "3. 不确定某属性字段结构时,先 describe_data_slot 看其说明,字段以 describe 返回为准;",
15131
15131
  "4. 写入若被 schema 校验拒绝(返回结构化错误含字段名与期望类型),按错误修正后重试,不要放弃;",
15132
- "5. 优先用 edit_window_prop 增量 patch(只发改动),避免 set 整体重传大 JSON 被截断。"
15132
+ "5. 优先用 edit_data_slot 增量 patch(只发改动),避免 set 整体重传大 JSON 被截断。"
15133
15133
  ].join("\n") }, z_ = {
15134
15134
  auto: {
15135
15135
  summaryThresholdRatio: .5,
@@ -15184,7 +15184,7 @@ function H_(e, t) {
15184
15184
  code: "SCHEMA_INVALID",
15185
15185
  path: e,
15186
15186
  message: `值不符合 "${e}" 的 schema(${t.length} 处问题)`,
15187
- hint: `按 describe_window_prop("${e}") 查看格式,修正后重试;改大对象优先用 edit_window_prop 增量 patch(只发改动部分)`,
15187
+ hint: `按 describe_data_slot("${e}") 查看格式,修正后重试;改大对象优先用 edit_data_slot 增量 patch(只发改动部分)`,
15188
15188
  details: V_(t)
15189
15189
  });
15190
15190
  }
@@ -15403,7 +15403,7 @@ function Q_(e) {
15403
15403
  };
15404
15404
  }
15405
15405
  //#endregion
15406
- //#region src/core/tools/windowQuery.ts
15406
+ //#region src/core/tools/dataSlotQuery.ts
15407
15407
  var $_ = /[\w$-]/;
15408
15408
  function ev(e) {
15409
15409
  let t = [], n = e.trim(), r = +(n[0] === "$");
@@ -15804,7 +15804,7 @@ function pv(e, t, n = 3e3) {
15804
15804
  });
15805
15805
  }
15806
15806
  //#endregion
15807
- //#region src/core/tools/windowOps.ts
15807
+ //#region src/core/tools/dataSlotOps.ts
15808
15808
  var mv = /* @__PURE__ */ new Set([
15809
15809
  "__proto__",
15810
15810
  "constructor",
@@ -15872,7 +15872,7 @@ function Sv(e) {
15872
15872
  return n.toString(36);
15873
15873
  }
15874
15874
  function Cv(e, t, n, r) {
15875
- if (t === "set") return n ? (vv(e, n, r), null) : "set 操作需要 jsonPath(整体替换请用 set_window_prop)";
15875
+ if (t === "set") return n ? (vv(e, n, r), null) : "set 操作需要 jsonPath(整体替换请用 set_data_slot)";
15876
15876
  if (t === "remove") return n ? (yv(e, n), null) : "remove 操作需要 jsonPath";
15877
15877
  if (t === "merge") {
15878
15878
  let t = n ? _v(e, n) : e;
@@ -15923,7 +15923,7 @@ function Dv(e, r = {}) {
15923
15923
  let e = [...i.keys()];
15924
15924
  if (!e.length) return "";
15925
15925
  let t = e.join(", ");
15926
- return e.length > 8 || t.length > 240 ? `\n(当前可操作属性共 ${e.length} 项,用 list_window_props 查看)` : `\n(当前可操作 path: ${t})`;
15926
+ return e.length > 8 || t.length > 240 ? `\n(当前可操作属性共 ${e.length} 项,用 list_data_slots 查看)` : `\n(当前可操作 path: ${t})`;
15927
15927
  }
15928
15928
  let u = (r.whitelist ?? !0) === !1;
15929
15929
  function d(e) {
@@ -15948,7 +15948,7 @@ function Dv(e, r = {}) {
15948
15948
  code: "VERSION_CONFLICT",
15949
15949
  path: e,
15950
15950
  message: `乐观锁冲突:expectedHash=${n} 但当前 hash=${s}。属性 "${e}" 在你 get 之后已被修改(外部代码/其他 agent/用户手动改)。`,
15951
- hint: `重新 get_window_prop("${e}") 拿最新值与 hash,基于最新值修改后再写入(传新的 expectedHash)。当前值:${xv(o, 400)}`
15951
+ hint: `重新 get_data_slot("${e}") 拿最新值与 hash,基于最新值修改后再写入(传新的 expectedHash)。当前值:${xv(o, 400)}`
15952
15952
  });
15953
15953
  let c = await r.onConflict({
15954
15954
  path: e,
@@ -15959,7 +15959,7 @@ function Dv(e, r = {}) {
15959
15959
  expectedHash: n,
15960
15960
  snapshotId: 0
15961
15961
  });
15962
- if (c.action === "keep_external") return `已保留外部修改(未写入)。当前值:${xv(o, 400)} (hash=${s})。请重新 get_window_prop("${e}") 拿最新值与 hash 再改。`;
15962
+ if (c.action === "keep_external") return `已保留外部修改(未写入)。当前值:${xv(o, 400)} (hash=${s})。请重新 get_data_slot("${e}") 拿最新值与 hash 再改。`;
15963
15963
  if (c.action === "restore") {
15964
15964
  let t = a.get(e) || [];
15965
15965
  if (!t.length) return `无历史快照可回退(本次为首次操作)。当前值:${xv(o, 400)} (hash=${s})。请重新 get 再改或选「强制覆盖」。`;
@@ -15971,41 +15971,41 @@ function Dv(e, r = {}) {
15971
15971
  return null;
15972
15972
  }
15973
15973
  let m = n(async () => {
15974
- if (!i.size) return "当前没有已注册的可操作 window 属性。";
15974
+ if (!i.size) return "当前没有已注册的可操作 数据槽。";
15975
15975
  let e = [...i.values()].map((e) => `- ${e.path}: ${e.description}`);
15976
- return `可操作的 window 属性(共 ${i.size} 项):\n${e.join("\n")}`;
15976
+ return `可操作的 数据槽(共 ${i.size} 项):\n${e.join("\n")}`;
15977
15977
  }, {
15978
- name: "list_window_props",
15979
- description: "列出所有已注册、可操作的 window 属性(path + 说明)。操作 window 前先调用此工具了解可用范围。",
15978
+ name: "list_data_slots",
15979
+ description: "列出所有已注册、可操作的 数据槽(path + 说明)。操作数据槽前先调用此工具了解可用范围。",
15980
15980
  schema: t.object({})
15981
15981
  }), h = n(async ({ path: e }) => {
15982
15982
  let t = i.get(e);
15983
15983
  return t ? [
15984
15984
  `路径: ${t.path}`,
15985
15985
  `说明: ${t.description}`,
15986
- "格式: 写入值需为 JSON,且通过注册时声明的 schema 校验(校验失败时 set_window_prop/edit_window_prop 会返回结构化错误,含具体字段与期望类型)。"
15986
+ "格式: 写入值需为 JSON,且通过注册时声明的 schema 校验(校验失败时 set_data_slot/edit_data_slot 会返回结构化错误,含具体字段与期望类型)。"
15987
15987
  ].join("\n") : $({
15988
15988
  code: "NOT_REGISTERED",
15989
15989
  path: e,
15990
15990
  message: `属性 "${e}" 未注册`,
15991
- hint: "用 list_window_props 查看可用属性"
15991
+ hint: "用 list_data_slots 查看可用属性"
15992
15992
  });
15993
15993
  }, {
15994
- name: "describe_window_prop",
15995
- description: "获取单个已注册 window 属性的说明与格式要求。",
15994
+ name: "describe_data_slot",
15995
+ description: "获取单个已注册 数据槽的说明与格式要求。",
15996
15996
  schema: t.object({ path: t.string().describe("属性路径,如 app.theme") })
15997
15997
  }), g = n(async ({ path: e }) => {
15998
15998
  if (!d(e)) return $({
15999
15999
  code: "NOT_REGISTERED",
16000
16000
  path: e,
16001
16001
  message: `属性 "${e}" 不可读取(未注册,且非已注册路径的后代)`,
16002
- hint: "用 list_window_props 查看可操作字段;字段白名单读模式下未注册的祖先(整体大 JSON)不暴露,需读其声明子路径"
16002
+ hint: "用 list_data_slots 查看可操作字段;字段白名单读模式下未注册的祖先(整体大 JSON)不暴露,需读其声明子路径"
16003
16003
  });
16004
16004
  let t = _v(window, e);
16005
16005
  return t === void 0 ? `${e} = (undefined)` : `${e} = ${xv(t)} (hash=${Sv(t)})`;
16006
16006
  }, {
16007
- name: "get_window_prop",
16008
- description: "读取一个已注册 window 属性的当前值(安全序列化:函数/DOM/循环引用做摘要;大结果由系统自动外存,提示用 vfs_read 回读)。返回含 hash(乐观锁):改属性前先 get 拿 hash,写入时(set/edit/delete)传 expectedHash 回传,系统对比当前 hash 防\"基于过期值覆盖\"(外部代码/其他 agent/用户手动改过会 CONFLICT,需重新 get 再改)。字段白名单读模式(默认)下仅可读注册 path 自身/后代;未注册祖先(整体大 JSON)不可读,避免大 JSON 拉进上下文。",
16007
+ name: "get_data_slot",
16008
+ description: "读取一个已注册 数据槽的当前值(安全序列化:函数/DOM/循环引用做摘要;大结果由系统自动外存,提示用 vfs_read 回读)。返回含 hash(乐观锁):改属性前先 get 拿 hash,写入时(set/edit/delete)传 expectedHash 回传,系统对比当前 hash 防\"基于过期值覆盖\"(外部代码/其他 agent/用户手动改过会 CONFLICT,需重新 get 再改)。字段白名单读模式(默认)下仅可读注册 path 自身/后代;未注册祖先(整体大 JSON)不可读,避免大 JSON 拉进上下文。",
16009
16009
  schema: t.object({ path: t.string().describe("已注册的属性路径或其后代") })
16010
16010
  }), _ = n(async ({ path: e, value: t, expectedHash: n }) => {
16011
16011
  let r = i.get(e);
@@ -16013,7 +16013,7 @@ function Dv(e, r = {}) {
16013
16013
  code: "NOT_REGISTERED",
16014
16014
  path: e,
16015
16015
  message: `属性 "${e}" 未在注册表中声明,不可写`,
16016
- hint: "用 list_window_props 查看可用属性;集成方需先在 windowProps 声明该 path"
16016
+ hint: "用 list_data_slots 查看可用属性;集成方需先在 dataSlots 声明该 path"
16017
16017
  });
16018
16018
  let a = await p(e, "set", n);
16019
16019
  if (a !== null) return a;
@@ -16034,12 +16034,12 @@ function Dv(e, r = {}) {
16034
16034
  timestamp: Date.now()
16035
16035
  }), `已设置 ${e} = ${xv(s.data, 600)} (新 hash=${Sv(_v(window, e))})${l()}`;
16036
16036
  }, {
16037
- name: "set_window_prop",
16038
- description: "设置一个已注册 window 属性的值(整体替换)。仅能操作注册表内声明的属性;value 为 JSON 字符串,需通过该属性声明的 schema 校验。校验失败会返回错误而非写入。expectedHash(可选):改前 get_window_prop 返回的 hash,传入则启用乐观锁——若属性已被改过(外部代码/其他 agent/用户手动)则返回 VERSION_CONFLICT 不写入,需重新 get 再改,防\"基于过期值覆盖\"。大对象/数组强烈建议改用 edit_window_prop 增量 patch。",
16037
+ name: "set_data_slot",
16038
+ description: "设置一个已注册 数据槽的值(整体替换)。仅能操作注册表内声明的属性;value 为 JSON 字符串,需通过该属性声明的 schema 校验。校验失败会返回错误而非写入。expectedHash(可选):改前 get_data_slot 返回的 hash,传入则启用乐观锁——若属性已被改过(外部代码/其他 agent/用户手动)则返回 VERSION_CONFLICT 不写入,需重新 get 再改,防\"基于过期值覆盖\"。大对象/数组强烈建议改用 edit_data_slot 增量 patch。",
16039
16039
  schema: t.object({
16040
16040
  path: t.string().describe("已注册的属性路径"),
16041
16041
  value: t.string().describe("JSON 字符串形式的值,需符合该属性 schema"),
16042
- expectedHash: t.string().optional().describe("乐观锁:改前 get_window_prop 返回的 hash;传入则校验,不一致拒绝写入防覆盖")
16042
+ expectedHash: t.string().optional().describe("乐观锁:改前 get_data_slot 返回的 hash;传入则校验,不一致拒绝写入防覆盖")
16043
16043
  })
16044
16044
  }), v = n(async ({ path: e, op: t, jsonPath: n, value: r, expectedHash: a }) => {
16045
16045
  let o = i.get(e);
@@ -16047,7 +16047,7 @@ function Dv(e, r = {}) {
16047
16047
  code: "NOT_REGISTERED",
16048
16048
  path: e,
16049
16049
  message: `属性 "${e}" 未在注册表中声明,不可写`,
16050
- hint: "用 list_window_props 查看可用属性"
16050
+ hint: "用 list_data_slots 查看可用属性"
16051
16051
  });
16052
16052
  let s = n || "";
16053
16053
  if (hv(s)) return $({
@@ -16062,7 +16062,7 @@ function Dv(e, r = {}) {
16062
16062
  code: "NOT_OBJECT",
16063
16063
  path: e,
16064
16064
  message: `edit 仅适用于对象/数组属性,"${e}" 当前是 ${u === void 0 ? "undefined" : typeof u}`,
16065
- hint: "叶子属性(原始类型)请用 set_window_prop 整体设置"
16065
+ hint: "叶子属性(原始类型)请用 set_data_slot 整体设置"
16066
16066
  });
16067
16067
  let m;
16068
16068
  if (t !== "remove") {
@@ -16094,8 +16094,8 @@ function Dv(e, r = {}) {
16094
16094
  timestamp: Date.now()
16095
16095
  }), `已 edit ${e}(${t}${s ? " @ " + s : ""})。当前值:${xv(_v(window, e), 600)} (新 hash=${Sv(_v(window, e))})${l()}`) : H_(e, _.error.issues);
16096
16096
  }, {
16097
- name: "edit_window_prop",
16098
- description: "增量编辑一个已注册的「对象/数组」window 属性,只发改动的 patch,无需重传整个大对象。op:set(在 jsonPath 设值)、remove(删 jsonPath)、merge(把 value 合并到 jsonPath 指向的对象,默认根)、append(把 value 追加到 jsonPath 指向的数组,默认根)。jsonPath 为相对属性根的点号路径(数组索引用数字,如 components.0.text);value 为 JSON 字符串。整体仍经 schema 校验,失败不写入。expectedHash(可选):改前 get_window_prop 返回的 hash,传入启用乐观锁防\"基于过期值覆盖\"。",
16097
+ name: "edit_data_slot",
16098
+ description: "增量编辑一个已注册的「对象/数组」数据槽,只发改动的 patch,无需重传整个大对象。op:set(在 jsonPath 设值)、remove(删 jsonPath)、merge(把 value 合并到 jsonPath 指向的对象,默认根)、append(把 value 追加到 jsonPath 指向的数组,默认根)。jsonPath 为相对属性根的点号路径(数组索引用数字,如 components.0.text);value 为 JSON 字符串。整体仍经 schema 校验,失败不写入。expectedHash(可选):改前 get_data_slot 返回的 hash,传入启用乐观锁防\"基于过期值覆盖\"。",
16099
16099
  schema: t.object({
16100
16100
  path: t.string().describe("已注册的对象/数组属性路径"),
16101
16101
  op: t.enum([
@@ -16106,14 +16106,14 @@ function Dv(e, r = {}) {
16106
16106
  ]),
16107
16107
  jsonPath: t.string().optional().describe("相对属性根的点号路径(数组索引用数字,如 components.0.text)。set/remove 必填;merge/append 不填则作用于根"),
16108
16108
  value: t.string().optional().describe("JSON 字符串(set/merge/append 必填)"),
16109
- expectedHash: t.string().optional().describe("乐观锁:改前 get_window_prop 返回的 hash;传入则校验,不一致拒绝写入防覆盖")
16109
+ expectedHash: t.string().optional().describe("乐观锁:改前 get_data_slot 返回的 hash;传入则校验,不一致拒绝写入防覆盖")
16110
16110
  })
16111
16111
  }), y = n(async ({ path: e, expectedHash: t }) => {
16112
16112
  if (!i.has(e)) return $({
16113
16113
  code: "NOT_REGISTERED",
16114
16114
  path: e,
16115
16115
  message: `属性 "${e}" 未在注册表中声明,不可删除`,
16116
- hint: "用 list_window_props 查看可用属性"
16116
+ hint: "用 list_data_slots 查看可用属性"
16117
16117
  });
16118
16118
  let n = await p(e, "delete", t);
16119
16119
  if (n !== null) return n;
@@ -16125,20 +16125,20 @@ function Dv(e, r = {}) {
16125
16125
  timestamp: Date.now()
16126
16126
  }), r ? `已删除 ${e}${l()}` : `${e} 不存在(无需删除)${l()}`;
16127
16127
  }, {
16128
- name: "delete_window_prop",
16129
- description: "删除一个已注册 window 属性。expectedHash(可选):改前 get_window_prop 返回的 hash,传入启用乐观锁防\"基于过期值删除\"。",
16128
+ name: "delete_data_slot",
16129
+ description: "删除一个已注册 数据槽。expectedHash(可选):改前 get_data_slot 返回的 hash,传入启用乐观锁防\"基于过期值删除\"。",
16130
16130
  schema: t.object({
16131
16131
  path: t.string().describe("已注册的属性路径"),
16132
- expectedHash: t.string().optional().describe("乐观锁:改前 get_window_prop 返回的 hash;传入则校验,不一致拒绝删除防覆盖")
16132
+ expectedHash: t.string().optional().describe("乐观锁:改前 get_data_slot 返回的 hash;传入则校验,不一致拒绝删除防覆盖")
16133
16133
  })
16134
- }), b = n(async ({ path: e, label: t }) => i.has(e) ? `已为 ${e} 创建快照 #${f(e, "manual", t)}${t ? `(${t})` : ""}。可用 list_window_snapshots 查看、restore_window_snapshot 回退。` : $({
16134
+ }), b = n(async ({ path: e, label: t }) => i.has(e) ? `已为 ${e} 创建快照 #${f(e, "manual", t)}${t ? `(${t})` : ""}。可用 list_data_snapshots 查看、restore_data_snapshot 回退。` : $({
16135
16135
  code: "NOT_REGISTERED",
16136
16136
  path: e,
16137
16137
  message: `属性 "${e}" 未注册,无法打快照`,
16138
- hint: "用 list_window_props 查看可用属性"
16138
+ hint: "用 list_data_slots 查看可用属性"
16139
16139
  }), {
16140
- name: "snapshot_window_prop",
16141
- description: "为已注册 window 属性手动创建一个命名快照(检查点)。set/edit/delete 也会自动存快照。",
16140
+ name: "snapshot_data_slot",
16141
+ description: "为已注册 数据槽手动创建一个命名快照(检查点)。set/edit/delete 也会自动存快照。",
16142
16142
  schema: t.object({
16143
16143
  path: t.string().describe("已注册的属性路径"),
16144
16144
  label: t.string().optional().describe("可选的快照标签,便于识别")
@@ -16149,7 +16149,7 @@ function Dv(e, r = {}) {
16149
16149
  code: "NOT_REGISTERED",
16150
16150
  path: e,
16151
16151
  message: `属性 "${e}" 未注册`,
16152
- hint: "用 list_window_props 查看可用属性"
16152
+ hint: "用 list_data_slots 查看可用属性"
16153
16153
  });
16154
16154
  let n = [];
16155
16155
  for (let r of t) {
@@ -16164,10 +16164,10 @@ function Dv(e, r = {}) {
16164
16164
  n.push(` #${e.id} [${e.op}]${e.label ? ` "${e.label}"` : ""} ${r} 修改前≈${t}字符`);
16165
16165
  }
16166
16166
  }
16167
- return n.join("\n") || "无快照。set/edit/delete 会自动存快照,也可用 snapshot_window_prop 手动创建检查点。";
16167
+ return n.join("\n") || "无快照。set/edit/delete 会自动存快照,也可用 snapshot_data_slot 手动创建检查点。";
16168
16168
  }, {
16169
- name: "list_window_snapshots",
16170
- description: "列出 window 属性的快照时间线(序号、操作类型、标签、大小)。不传 path 列出所有属性。",
16169
+ name: "list_data_snapshots",
16170
+ description: "列出 数据槽的快照时间线(序号、操作类型、标签、大小)。不传 path 列出所有属性。",
16171
16171
  schema: t.object({ path: t.string().optional().describe("限定单个属性,不传则列出全部") })
16172
16172
  }), S = n(async ({ path: e, id: t }) => {
16173
16173
  let n = i.get(e);
@@ -16175,21 +16175,21 @@ function Dv(e, r = {}) {
16175
16175
  code: "NOT_REGISTERED",
16176
16176
  path: e,
16177
16177
  message: `属性 "${e}" 未注册`,
16178
- hint: "用 list_window_props 查看可用属性"
16178
+ hint: "用 list_data_slots 查看可用属性"
16179
16179
  });
16180
16180
  let r = a.get(e) || [];
16181
16181
  if (!r.length) return $({
16182
16182
  code: "NO_SNAPSHOT",
16183
16183
  path: e,
16184
16184
  message: `"${e}" 无快照可回退`,
16185
- hint: "set/edit/delete 会自动存快照;也可先 snapshot_window_prop 手动创建检查点"
16185
+ hint: "set/edit/delete 会自动存快照;也可先 snapshot_data_slot 手动创建检查点"
16186
16186
  });
16187
16187
  let o = t === void 0 ? r[r.length - 1] : r.find((e) => e.id === t);
16188
16188
  if (!o) return $({
16189
16189
  code: "SNAPSHOT_NOT_FOUND",
16190
16190
  path: e,
16191
16191
  message: `未找到快照 #${t}`,
16192
- hint: "用 list_window_snapshots 查看可用快照序号"
16192
+ hint: "用 list_data_snapshots 查看可用快照序号"
16193
16193
  });
16194
16194
  let s = n.schema.safeParse(o.value);
16195
16195
  return s.success ? (Tv(e, bv(o.value)), c({
@@ -16205,8 +16205,8 @@ function Dv(e, r = {}) {
16205
16205
  details: V_(s.error.issues)
16206
16206
  });
16207
16207
  }, {
16208
- name: "restore_window_snapshot",
16209
- description: "把已注册 window 属性回退到某个快照(就地还原,保留响应式)。不传 id 则回退最近一次(快速回退)。可用 list_window_snapshots 查看快照列表。",
16208
+ name: "restore_data_snapshot",
16209
+ description: "把已注册 数据槽回退到某个快照(就地还原,保留响应式)。不传 id 则回退最近一次(快速回退)。可用 list_data_snapshots 查看快照列表。",
16210
16210
  schema: t.object({
16211
16211
  path: t.string().describe("已注册的属性路径"),
16212
16212
  id: t.number().int().optional().describe("指定快照序号;不传则回退最近一次")
@@ -16223,7 +16223,7 @@ function Dv(e, r = {}) {
16223
16223
  code: "NOT_REGISTERED",
16224
16224
  path: n,
16225
16225
  message: "不可读取(未注册,且非已注册路径的后代)",
16226
- hint: "用 list_window_props 查看可操作字段"
16226
+ hint: "用 list_data_slots 查看可操作字段"
16227
16227
  })}`);
16228
16228
  continue;
16229
16229
  }
@@ -16232,8 +16232,8 @@ function Dv(e, r = {}) {
16232
16232
  }
16233
16233
  return t.join("\n");
16234
16234
  }, {
16235
- name: "get_window_paths",
16236
- description: "批量按路径读取 window 属性的局部或多个字段(避免对大 JSON 整体读取)。paths 支持注册属性的任意后代路径(如 page.components.0.text)、自身。字段白名单读模式(默认)下未注册祖先不可读。逐行返回 path = value;单个值过大仍由系统自动外存 vfs。",
16235
+ name: "get_slot_paths",
16236
+ description: "批量按路径读取 数据槽的局部或多个字段(避免对大 JSON 整体读取)。paths 支持注册属性的任意后代路径(如 page.components.0.text)、自身。字段白名单读模式(默认)下未注册祖先不可读。逐行返回 path = value;单个值过大仍由系统自动外存 vfs。",
16237
16237
  schema: t.object({ paths: t.array(t.string().describe("路径,如 page.components.0.text")).min(1).max(20) })
16238
16238
  }),
16239
16239
  _,
@@ -16247,14 +16247,14 @@ function Dv(e, r = {}) {
16247
16247
  code: "NOT_REGISTERED",
16248
16248
  path: e,
16249
16249
  message: `属性 "${e}" 未注册`,
16250
- hint: "用 list_window_props 查看可用属性"
16250
+ hint: "用 list_data_slots 查看可用属性"
16251
16251
  });
16252
16252
  let r = _v(window, e);
16253
16253
  if (typeof r != "object" || !r) return $({
16254
16254
  code: "NOT_OBJECT",
16255
16255
  path: e,
16256
16256
  message: `"${e}" 不是对象/数组,无法查询(当前为 ${r === void 0 ? "undefined" : typeof r})`,
16257
- hint: "query 仅适用于对象/数组;叶子属性用 get_window_prop 读"
16257
+ hint: "query 仅适用于对象/数组;叶子属性用 get_data_slot 读"
16258
16258
  });
16259
16259
  let a;
16260
16260
  try {
@@ -16271,8 +16271,8 @@ function Dv(e, r = {}) {
16271
16271
  let o = n ?? 50, s = a.slice(0, o), c = s.map((e) => `{"path":${JSON.stringify(e.path)},"index":${e.index === void 0 ? "null" : e.index},"value":${xv(e.value)}}`);
16272
16272
  return `{"matched":${a.length},"returned":${s.length},"truncated":${a.length > o},"results":[${c.join(",")}]}`;
16273
16273
  }, {
16274
- name: "query_window_prop",
16275
- description: "用 JSONPath 表达式对一个已注册的对象/数组属性做结构化查询(只读,无副作用)。语法子集:$ 根、.key、[n]、[\"key\"]、[*] 通配、[?(filter)] 过滤、..key 递归找后代、..* 全后代。过滤表达式:@.field op literal(op:==/!=/</<=/>/>=),&&/||/() 连接;@ 指当前元素。注意过滤作用于\"当前节点的子元素数组\",若注册属性是对象需先点出数组字段再过滤,如 $.components[?(@.type==\"card\" && @.price<100)]。返回匹配元素的 path(相对属性根,数组索引可作后续 edit_window_prop 的 jsonPath)+ index(若父为数组)+ value。适合在大数组里按条件筛选元素,定位后再用 edit_window_prop 增量改。",
16274
+ name: "query_data_slot",
16275
+ description: "用 JSONPath 表达式对一个已注册的对象/数组属性做结构化查询(只读,无副作用)。语法子集:$ 根、.key、[n]、[\"key\"]、[*] 通配、[?(filter)] 过滤、..key 递归找后代、..* 全后代。过滤表达式:@.field op literal(op:==/!=/</<=/>/>=),&&/||/() 连接;@ 指当前元素。注意过滤作用于\"当前节点的子元素数组\",若注册属性是对象需先点出数组字段再过滤,如 $.components[?(@.type==\"card\" && @.price<100)]。返回匹配元素的 path(相对属性根,数组索引可作后续 edit_data_slot 的 jsonPath)+ index(若父为数组)+ value。适合在大数组里按条件筛选元素,定位后再用 edit_data_slot 增量改。",
16276
16276
  schema: t.object({
16277
16277
  path: t.string().describe("已注册的对象/数组属性路径"),
16278
16278
  expr: t.string().describe("JSONPath 表达式,如 $[?(@.type==\"card\" && @.price<100)] 或 $..title(递归找所有 title)"),
@@ -16284,7 +16284,7 @@ function Dv(e, r = {}) {
16284
16284
  code: "NOT_REGISTERED",
16285
16285
  path: e,
16286
16286
  message: `属性 "${e}" 未注册`,
16287
- hint: "用 list_window_props 查看可用属性"
16287
+ hint: "用 list_data_slots 查看可用属性"
16288
16288
  });
16289
16289
  let s = _v(window, e);
16290
16290
  if (s == null) return $({
@@ -16313,8 +16313,8 @@ function Dv(e, r = {}) {
16313
16313
  });
16314
16314
  }
16315
16315
  }, {
16316
- name: "search_window_prop",
16317
- description: "在一个已注册 window 属性内做文本搜索(只读,无副作用)。mode:substring(子串,默认,大小写不敏感)、regex(正则,i 标志)、fuzzy(模糊:子串命中或 Levenshtein 距离 ≤ fuzzyThreshold)。递归遍历所有叶子值(及可选 key),返回命中元素的 path + value(超 200 字符截断)。适合在大 JSON 里找名字近似、记不清的元素,定位 path 后用 edit_window_prop 改。",
16316
+ name: "search_data_slot",
16317
+ description: "在一个已注册 数据槽内做文本搜索(只读,无副作用)。mode:substring(子串,默认,大小写不敏感)、regex(正则,i 标志)、fuzzy(模糊:子串命中或 Levenshtein 距离 ≤ fuzzyThreshold)。递归遍历所有叶子值(及可选 key),返回命中元素的 path + value(超 200 字符截断)。适合在大 JSON 里找名字近似、记不清的元素,定位 path 后用 edit_data_slot 改。",
16318
16318
  schema: t.object({
16319
16319
  path: t.string().describe("已注册的属性路径(在它的子树内搜索)"),
16320
16320
  query: t.string().describe("搜索词(substring/regex/fuzzy 共用)"),
@@ -16334,7 +16334,7 @@ function Dv(e, r = {}) {
16334
16334
  code: "NOT_REGISTERED",
16335
16335
  path: e,
16336
16336
  message: `属性 "${e}" 未注册`,
16337
- hint: "用 list_window_props 查看可用属性"
16337
+ hint: "用 list_data_slots 查看可用属性"
16338
16338
  });
16339
16339
  if (t.length > 8e3) return $({
16340
16340
  code: "SCRIPT_TOO_LARGE",
@@ -16362,7 +16362,7 @@ function Dv(e, r = {}) {
16362
16362
  code: "SCHEMA_INVALID",
16363
16363
  path: e,
16364
16364
  message: "脚本返回值校验失败,未写入(transform 模式要求返回该属性的完整新值且符合 schema)",
16365
- hint: `确认脚本 return 了完整新值(非部分);按 describe_window_prop("${e}") 查看格式`,
16365
+ hint: `确认脚本 return 了完整新值(非部分);按 describe_data_slot("${e}") 查看格式`,
16366
16366
  details: V_(t.error.issues)
16367
16367
  });
16368
16368
  f(e, "edit", "eval_transform");
@@ -16380,8 +16380,8 @@ function Dv(e, r = {}) {
16380
16380
  elapsedMs: a.elapsedMs
16381
16381
  });
16382
16382
  }, {
16383
- name: "eval_window_script",
16384
- description: "在隔离的 Web Worker 沙箱里对一个已注册 window 属性跑自定义 JS 脚本(无 window/document 访问,fetch/XHR/WebSocket/importScripts 已禁用,超时 3s 可终止)。脚本以 `data` 为入参(该属性的深拷贝),返回值即结果。mode:query(默认,只读,把返回值回给 LLM,适合过滤/映射/聚合/统计大数组)、transform(把返回值作为该属性的新整体值,经 schema 校验后就地落地,适合批量重写)。注意:transform 需返回完整新值;query 不改 window。脚本内可用标准 JS(Array/Object/JSON/Math 等)与 async/await。",
16383
+ name: "eval_script",
16384
+ description: "在隔离的 Web Worker 沙箱里对一个已注册 数据槽跑自定义 JS 脚本(无 window/document 访问,fetch/XHR/WebSocket/importScripts 已禁用,超时 3s 可终止)。脚本以 `data` 为入参(该属性的深拷贝),返回值即结果。mode:query(默认,只读,把返回值回给 LLM,适合过滤/映射/聚合/统计大数组)、transform(把返回值作为该属性的新整体值,经 schema 校验后就地落地,适合批量重写)。注意:transform 需返回完整新值;query 不改 window。脚本内可用标准 JS(Array/Object/JSON/Math 等)与 async/await。",
16385
16385
  schema: t.object({
16386
16386
  path: t.string().describe("已注册的属性路径,其深拷贝作为脚本的 data 入参"),
16387
16387
  script: t.string().describe("JS 脚本体,如 data.filter(c=>c.stock>0).map(c=>c.id);入参名 data;末尾表达式或 return 即返回值"),
@@ -16432,7 +16432,7 @@ function jv(e, t) {
16432
16432
  return Dv(e, t);
16433
16433
  }
16434
16434
  function Mv(e, t, n) {
16435
- let r = e?.windowOps !== !1, i = e?.fetch !== !1;
16435
+ let r = e?.dataSlotOps !== !1, i = e?.fetch !== !1;
16436
16436
  return [...r ? t : [], ...i ? n : []];
16437
16437
  }
16438
16438
  //#endregion
@@ -16443,9 +16443,9 @@ function Pv(e, t) {
16443
16443
  name: "usageHints",
16444
16444
  augmentPrompt: () => {
16445
16445
  let n = [];
16446
- if (e?.planning !== !1 && n.push("多步任务建议先 write_todos 拆解为步骤并逐步推进。"), t && (n.push("改属性前先 get_window_prop(path) 读其当前真实值与 hash(返回末尾 hash=xxx),基于真实值改,不要凭记忆。写入(set/edit/delete)时回传 expectedHash=该 hash 启用乐观锁——若属性在你 get 之后被外部代码/其他 agent/用户手动改过,会触发冲突:集成方若开启人工介入,工具会挂起等用户决定(保留外部/强制覆盖/回退),你应等待工具返回后按结果继续(保留外部→重新 get 再改;强制覆盖→已写入,继续;回退→已回退到历史快照,基于回退值重写);未开启人工介入时返回 VERSION_CONFLICT 不写入,重新 get 拿最新值与 hash 再改。"), n.push("不确定可操作哪些属性时用 list_window_props 查看(动态组件场景下注册表会增删,以工具返回为准,勿凭旧记忆);不确定某属性字段结构时用 describe_window_prop。"), n.push("修改大对象/数组属性优先用 edit_window_prop 增量 patch(只发改动部分),避免 set 整体重传被 max_tokens 截断导致 JSON 不完整、校验失败。"), n.push("修改属性出错时可用 restore_window_snapshot(path) 回退最近一次。"), n.push("在大数组里按条件筛选元素用 query_window_prop(JSONPath,如 $[?(@.type==\"card\" && @.price<100)]),返回匹配元素的 path/index;定位后再 edit_window_prop 改。"), n.push("找名字记不清的元素用 search_window_prop(支持 substring/regex/fuzzy 模糊搜索)。"), n.push("需要过滤/映射/聚合/批量重写大数组时用 eval_window_script(沙箱脚本,入参 data);只读探查用 mode=query,批量重写用 mode=transform(返回值经校验后落地)。")), e?.subagent !== !1 && n.push("独立子任务可 spawn_agent 委派(只读工具,过程不占主上下文)。"), e?.subagents?.length) {
16446
+ if (e?.planning !== !1 && n.push("多步任务建议先 write_todos 拆解为步骤并逐步推进。"), t && (n.push("改属性前先 get_data_slot(path) 读其当前真实值与 hash(返回末尾 hash=xxx),基于真实值改,不要凭记忆。写入(set/edit/delete)时回传 expectedHash=该 hash 启用乐观锁——若属性在你 get 之后被外部代码/其他 agent/用户手动改过,会触发冲突:集成方若开启人工介入,工具会挂起等用户决定(保留外部/强制覆盖/回退),你应等待工具返回后按结果继续(保留外部→重新 get 再改;强制覆盖→已写入,继续;回退→已回退到历史快照,基于回退值重写);未开启人工介入时返回 VERSION_CONFLICT 不写入,重新 get 拿最新值与 hash 再改。"), n.push("不确定可操作哪些属性时用 list_data_slots 查看(动态组件场景下注册表会增删,以工具返回为准,勿凭旧记忆);不确定某属性字段结构时用 describe_data_slot。"), n.push("修改大对象/数组属性优先用 edit_data_slot 增量 patch(只发改动部分),避免 set 整体重传被 max_tokens 截断导致 JSON 不完整、校验失败。"), n.push("修改属性出错时可用 restore_data_snapshot(path) 回退最近一次。"), n.push("在大数组里按条件筛选元素用 query_data_slot(JSONPath,如 $[?(@.type==\"card\" && @.price<100)]),返回匹配元素的 path/index;定位后再 edit_data_slot 改。"), n.push("找名字记不清的元素用 search_data_slot(支持 substring/regex/fuzzy 模糊搜索)。"), n.push("需要过滤/映射/聚合/批量重写大数组时用 eval_script(沙箱脚本,入参 data);只读探查用 mode=query,批量重写用 mode=transform(返回值经校验后落地)。")), e?.subagent !== !1 && n.push("独立子任务可 spawn_agent 委派(只读工具,过程不占主上下文)。"), e?.subagents?.length) {
16447
16447
  let t = e.subagents.filter((e) => (e.temperature ?? 0) >= Nv || /规划|创意|设计|方案|brainstorm|plan/i.test(e.description)), r = e.subagents.filter((e) => (e.temperature ?? 0) < Nv && /反思|审查|挑刺|校验|review|critique|reflect/i.test(e.description));
16448
- n.push("【规划-反思-执行·路由】按任务性质选模式,不要对简单任务过度编排:"), t.length && (n.push(` · 创作/设计/开放性需求(如"设计主题风格""换个感觉")→ 先调 ${t.map((e) => "use_" + e.id).join("/")} 出 2-3 套方案(高温创意),`), n.push(" 不要自己拍板;拿到方案后,若需用户拍板用 request_human_confirmation 弹选项。")), r.length && n.push(` · 严谨/易错/校验类 → 可先调 ${r.map((e) => "use_" + e.id).join("/")} 反思挑刺(低温审查),据反馈修订。`), n.push(" · 方案定稿后,由你(主 agent)用 edit_window_prop 落地成 JSON(低温度执行 + schema 校验 + 写前确认)。"), n.push(" · 简单/明确任务(如\"标题改红色\")直接执行,不必走规划-反思。");
16448
+ n.push("【规划-反思-执行·路由】按任务性质选模式,不要对简单任务过度编排:"), t.length && (n.push(` · 创作/设计/开放性需求(如"设计主题风格""换个感觉")→ 先调 ${t.map((e) => "use_" + e.id).join("/")} 出 2-3 套方案(高温创意),`), n.push(" 不要自己拍板;拿到方案后,若需用户拍板用 request_human_confirmation 弹选项。")), r.length && n.push(` · 严谨/易错/校验类 → 可先调 ${r.map((e) => "use_" + e.id).join("/")} 反思挑刺(低温审查),据反馈修订。`), n.push(" · 方案定稿后,由你(主 agent)用 edit_data_slot 落地成 JSON(低温度执行 + schema 校验 + 写前确认)。"), n.push(" · 简单/明确任务(如\"标题改红色\")直接执行,不必走规划-反思。");
16449
16449
  }
16450
16450
  return e?.humanConfirm && (n.push("【人工确认·必读】以下情形必须先调 request_human_confirmation 征询用户、拿到答复后再继续,不要自行拍板:"), n.push(" 1) 用户让你「给方案/列选项/我来选/挑一个」时:把每个方案作为一个 option,调 request_human_confirmation(question=简述, options=[方案A,方案B,...], recommendation=你推荐的)。不要只回文字罗列方案让用户自己回复——要用工具把选项做成可点选按钮。"), n.push(" 2) 需求有歧义/不确定时:调工具问清楚(options 不传则用户答同意或拒绝)。"), n.push(" 3) 即将执行高风险不可逆操作(删除/覆盖/批量改动)前:调工具确认。"), n.push("用户在选项里选了哪个,就按那个方案继续;选「拒绝」则停止并询问如何调整。")), n.length && n.unshift("调用工具务必用标准 function calling(工具调用)格式发起,不要在回复正文里输出伪 XML/标签(如 deepseek 的 tool_calls 标签、invoke、function_call、tool_call 等)或 JSON 文本——那不会被识别为工具调用,会被当普通文字,工具不执行。"), n.length ? "## 能力使用提示\n" + n.join("\n") : void 0;
16451
16451
  }
@@ -16871,7 +16871,7 @@ function fy(e) {
16871
16871
  };
16872
16872
  }
16873
16873
  function py(e) {
16874
- return e === "set_window_prop" ? "set" : e === "edit_window_prop" ? "edit" : e === "delete_window_prop" ? "delete" : e === "restore_window_snapshot" ? "restore" : null;
16874
+ return e === "set_data_slot" ? "set" : e === "edit_data_slot" ? "edit" : e === "delete_data_slot" ? "delete" : e === "restore_data_snapshot" ? "restore" : null;
16875
16875
  }
16876
16876
  function my(e) {
16877
16877
  let t = e.split("."), n = globalThis.window;
@@ -16889,7 +16889,7 @@ function hy(e, t) {
16889
16889
  if (i) {
16890
16890
  let n = String(t.args?.path ?? "");
16891
16891
  e({
16892
- type: "window_prop_change",
16892
+ type: "data_slot_change",
16893
16893
  path: n,
16894
16894
  operation: i,
16895
16895
  value: n ? my(n) : void 0
@@ -16942,17 +16942,17 @@ function gy(e, r) {
16942
16942
  } } : void 0,
16943
16943
  maxBytes: e.vfs?.maxBytes
16944
16944
  }), m = Sg(), h = Ag(e.memory || ""), g = { current: null }, _ = e.checkpoint, v = _ !== void 0 && _ !== !1, y = v ? qg({
16945
- windowPaths: (e.windowProps ?? []).map((e) => e.path),
16945
+ slotPaths: (e.dataSlots ?? []).map((e) => e.path),
16946
16946
  vfsStore: p,
16947
16947
  todosMw: m,
16948
16948
  getTodos: () => g.current?.getState?.()?.todos ?? [],
16949
16949
  messages: f,
16950
16950
  maxCheckpoints: _ && typeof _ == "object" ? _.maxCheckpoints : void 0
16951
- }) : null, b = !_ || typeof _ != "object" || _.auto !== !1, x = e.capabilities, S = x?.windowOps !== !1, C = S ? Dv(e.windowProps || [], {
16951
+ }) : null, b = !_ || typeof _ != "object" || _.auto !== !1, x = e.capabilities, S = x?.dataSlotOps !== !1, C = S ? Dv(e.dataSlots || [], {
16952
16952
  onAudit: e.debug ? (e) => console.log("[page-agent-sdk][window audit]", e) : void 0,
16953
16953
  maxSnapshots: e.maxSnapshots,
16954
16954
  onConflict: o
16955
- }) : [], w = S ? C.controller ?? null : null, T = () => w?.list() ?? e.windowProps ?? [], E = /* @__PURE__ */ new Map(), D = Mv(x, C, kv);
16955
+ }) : [], w = S ? C.controller ?? null : null, T = () => w?.list() ?? e.dataSlots ?? [], E = /* @__PURE__ */ new Map(), D = Mv(x, C, kv);
16956
16956
  D.forEach((e) => E.set(e.name, "builtin"));
16957
16957
  let O = [...e.tools || []];
16958
16958
  O.forEach((e) => E.set(e.name, "user"));
@@ -16960,10 +16960,10 @@ function gy(e, r) {
16960
16960
  A && E.set(Lg, "builtin");
16961
16961
  let j = v && y ? [n(async () => {
16962
16962
  let e = y.list();
16963
- return e.length ? y.restore() ? `已回退到最近一次正常状态(checkpoint #${e[e.length - 1].id})。对话历史、window 注册属性、vfs、todos 已整体还原。请基于回退后的状态重新判断并继续。` : "回退失败:无可用 checkpoint。" : "无可用 checkpoint,无法回退。";
16963
+ return e.length ? y.restore() ? `已回退到最近一次正常状态(checkpoint #${e[e.length - 1].id})。对话历史、数据槽注册项、vfs、todos 已整体还原。请基于回退后的状态重新判断并继续。` : "回退失败:无可用 checkpoint。" : "无可用 checkpoint,无法回退。";
16964
16964
  }, {
16965
16965
  name: "restore_last_checkpoint",
16966
- description: "回退到最近一次正常状态(整体还原对话历史 + window 注册属性 + vfs + todos)。当本轮操作出错、页面被改坏、或走偏时调用,回到本轮起点重新来过。不传参数即回退最近一次。",
16966
+ description: "回退到最近一次正常状态(整体还原对话历史 + 数据槽注册项 + vfs + todos)。当本轮操作出错、页面被改坏、或走偏时调用,回到本轮起点重新来过。不传参数即回退最近一次。",
16967
16967
  schema: t.object({}).optional()
16968
16968
  }), n(async () => {
16969
16969
  let e = y.list();
@@ -16997,10 +16997,10 @@ function gy(e, r) {
16997
16997
  allTools: M,
16998
16998
  debug: e.debug
16999
16999
  }) : void 0, ae = [
17000
- "get_window_prop",
17001
- "get_window_paths",
17002
- "list_window_props",
17003
- "describe_window_prop",
17000
+ "get_data_slot",
17001
+ "get_slot_paths",
17002
+ "list_data_slots",
17003
+ "describe_data_slot",
17004
17004
  "fetch_document"
17005
17005
  ], oe = M.filter((e) => ae.includes(e.name)), se = z ? o_({
17006
17006
  check: e.verify.check ?? f_({ schemas: () => Object.fromEntries(T().map((e) => [e.path, e.schema])) }),
@@ -17016,7 +17016,7 @@ function gy(e, r) {
17016
17016
  description: e.description,
17017
17017
  temperature: e.temperature
17018
17018
  }))
17019
- }, S && !!e.windowProps?.length), le = e.onEvent, ue = /* @__PURE__ */ new Set(), de = (e) => {
17019
+ }, S && !!e.dataSlots?.length), le = e.onEvent, ue = /* @__PURE__ */ new Set(), de = (e) => {
17020
17020
  if (e.type !== "approval_request") {
17021
17021
  if (le) try {
17022
17022
  le(e);
@@ -17033,11 +17033,11 @@ function gy(e, r) {
17033
17033
  ...I ? [I_({
17034
17034
  ...B_(e, u.contextWindow),
17035
17035
  llmInvoke: d,
17036
- getRegisteredProps: () => T().map((e) => ({
17036
+ getRegisteredSlots: () => T().map((e) => ({
17037
17037
  path: e.path,
17038
17038
  description: e.description
17039
17039
  })),
17040
- preserveLastToolResults: (e.contextOptions && e.contextOptions.preserveLastToolResults) ?? ["describe_window_prop", "list_window_props"]
17040
+ preserveLastToolResults: (e.contextOptions && e.contextOptions.preserveLastToolResults) ?? ["describe_data_slot", "list_data_slots"]
17041
17041
  })] : [],
17042
17042
  ...L ? [h] : [],
17043
17043
  ...e.permissions?.length ? [Fg(e.permissions)] : [],
@@ -17064,9 +17064,9 @@ function gy(e, r) {
17064
17064
  mcpClosers: [],
17065
17065
  mcpServers: [],
17066
17066
  checkpoint: y,
17067
- windowOpsController: w,
17067
+ dataSlotOpsController: w,
17068
17068
  pendingConflict: i,
17069
- liveWindowProps: T,
17069
+ liveDataSlots: T,
17070
17070
  applySnapshot(t) {
17071
17071
  t.messages?.length && f.push(...t.messages), t.vfs && p.hydrate && p.hydrate(t.vfs), t.todos?.length && m.reset(t.todos), t.memory && !e.memory && h.reset(t.memory);
17072
17072
  },
@@ -17133,7 +17133,7 @@ function gy(e, r) {
17133
17133
  name: e.name,
17134
17134
  description: e.description
17135
17135
  })),
17136
- windowProps: T().map((e) => ({
17136
+ dataSlots: T().map((e) => ({
17137
17137
  path: e.path,
17138
17138
  description: e.description,
17139
17139
  schema: e.schema
@@ -17293,15 +17293,15 @@ function _y(e) {
17293
17293
  restoreLastCheckpoint: () => i.checkpoint?.restore() ?? !1,
17294
17294
  listCheckpoints: () => i.checkpoint?.list() ?? [],
17295
17295
  hook: (e) => (i.listeners.add(e), () => i.listeners.delete(e)),
17296
- addWindowProp: (e) => {
17297
- if (!i.windowOpsController) {
17298
- console.warn("[page-agent-sdk] addWindowProp 忽略:windowOps 已关闭(capabilities.windowOps:false)");
17296
+ addDataSlot: (e) => {
17297
+ if (!i.dataSlotOpsController) {
17298
+ console.warn("[page-agent-sdk] addDataSlot 忽略:dataSlotOps 已关闭(capabilities.dataSlotOps:false)");
17299
17299
  return;
17300
17300
  }
17301
- i.windowOpsController.add(e);
17301
+ i.dataSlotOpsController.add(e);
17302
17302
  },
17303
- removeWindowProp: (e) => i.windowOpsController ? i.windowOpsController.remove(e) : !1,
17304
- listWindowProps: () => i.liveWindowProps(),
17303
+ removeDataSlot: (e) => i.dataSlotOpsController ? i.dataSlotOpsController.remove(e) : !1,
17304
+ listDataSlots: () => i.liveDataSlots(),
17305
17305
  pendingConflict: i.pendingConflict,
17306
17306
  resolveConflict: (e) => i.resolveConflict(e)
17307
17307
  };
@@ -17319,4 +17319,4 @@ function vy(e) {
17319
17319
  });
17320
17320
  }
17321
17321
  //#endregion
17322
- export { z_ as CONTEXT_PRESETS, Xh as ChatDialog, ef as CodePreview, Lg as HUMAN_CONFIRM_TOOL_NAME, nf as MessageContent, S_ as connectMcp, Sl as copyText, bg as createAgent, Ig as createApprovalMiddleware, _y as createChatSdk, qg as createCheckpointManager, Jg as createCheckpointMiddleware, Bg as createHumanConfirmMiddleware, zg as createHumanConfirmTool, ty as createMemoryBackend, ay as createSessionStore, n_ as createSubagentMiddleware, a_ as createSubagentsMiddleware, Pv as createUsageHintsMiddleware, o_ as createVerifyMiddleware, G_ as createVfs, ry as createWebStorageBackend, Dv as createWindowOps, f_ as createWriteBackCheck, Cg as defineSkill, vy as defineTool, jv as defineWindowToolset, hg as detectGarbledToolCall, rg as estimateTokens, y_ as extractText, kv as fetchDocTools, Av as fetchTools, V_ as formatZodIssues, qv as isQuotaError, cv as jpEval, U_ as jsonParseError, ag as offloadPassThroughChars, ig as offloadThresholdChars, L_ as presets, B_ as resolveContextOptions, ng as resolveModelCaps, pv as runSandboxedScript, uv as searchJson, Mv as selectBuiltinTools, R_ as systemPromptHelpers, $ as toolError, xl as useChat, e as z, H_ as zodError };
17322
+ export { z_ as CONTEXT_PRESETS, Xh as ChatDialog, ef as CodePreview, Lg as HUMAN_CONFIRM_TOOL_NAME, nf as MessageContent, S_ as connectMcp, Sl as copyText, bg as createAgent, Ig as createApprovalMiddleware, _y as createChatSdk, qg as createCheckpointManager, Jg as createCheckpointMiddleware, Dv as createDataSlotOps, Bg as createHumanConfirmMiddleware, zg as createHumanConfirmTool, ty as createMemoryBackend, ay as createSessionStore, n_ as createSubagentMiddleware, a_ as createSubagentsMiddleware, Pv as createUsageHintsMiddleware, o_ as createVerifyMiddleware, G_ as createVfs, ry as createWebStorageBackend, f_ as createWriteBackCheck, jv as defineDataSlotToolset, Cg as defineSkill, vy as defineTool, hg as detectGarbledToolCall, rg as estimateTokens, y_ as extractText, kv as fetchDocTools, Av as fetchTools, V_ as formatZodIssues, qv as isQuotaError, cv as jpEval, U_ as jsonParseError, ag as offloadPassThroughChars, ig as offloadThresholdChars, L_ as presets, B_ as resolveContextOptions, ng as resolveModelCaps, pv as runSandboxedScript, uv as searchJson, Mv as selectBuiltinTools, R_ as systemPromptHelpers, $ as toolError, xl as useChat, e as z, H_ as zodError };