page-agent-sdk 3.44.1 → 3.45.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.
- package/README.md +3 -3
- package/README.zh-CN.md +3 -3
- package/dist/page-agent-sdk.headless.js +470 -456
- package/dist/page-agent-sdk.iife.js +143 -143
- package/dist/page-agent-sdk.js +1893 -1879
- package/dist/page-agent-sdk.legacy.js +10114 -10097
- package/dist/page-agent-sdk.umd.cjs +57 -57
- package/package.json +1 -1
- package/types/headless.d.ts +1 -0
- package/types/index.d.ts +2 -0
|
@@ -3221,7 +3221,12 @@ function Ka(e, t) {
|
|
|
3221
3221
|
return !(!e.length || !e.some((e) => e.status !== "completed") || /[??]\s*$/.test(t));
|
|
3222
3222
|
}
|
|
3223
3223
|
function qa(e, t) {
|
|
3224
|
-
let n = e.filter((e) => e.status !== "completed"), r = n.map((e) => `#${e.id} [${e.status}] ${e.content.length > 60 ? `${e.content.slice(0, 60)}…` : e.content}`).join("\n"), i = e.filter((e) =>
|
|
3224
|
+
let n = e.filter((e) => e.status !== "completed"), r = n.map((e) => `#${e.id} [${e.status}] ${e.content.length > 60 ? `${e.content.slice(0, 60)}…` : e.content}`).join("\n"), i = e.filter((e) => {
|
|
3225
|
+
if (e.status !== "completed" || e.evidence) return !1;
|
|
3226
|
+
if (!t) return !0;
|
|
3227
|
+
let n = t.get(e.id);
|
|
3228
|
+
return !n || n.status !== "completed" || n.content !== e.content;
|
|
3229
|
+
}), a = i.length ? `\n另有 ${i.length} 项已标记完成但 evidence 为空(${i.map((e) => `#${e.id}`).join("、")}):标记完成时请用 update_todo 附 evidence(本次实际写入的 jsonPath,如 components.2);经委派完成等无主写路径时如实写明完成方式。` : "";
|
|
3225
3230
|
return `⚠️ 任务未完成:待办清单还有 ${n.length} 项未完成:\n${r}\n若这些工作实际已完成,请先用 update_todo 把它们全部标记 completed(或一次 write_todos 整表替换)再给出最终总结;若尚未完成,请继续执行剩余任务。不要中途停止。${a}`;
|
|
3226
3231
|
}
|
|
3227
3232
|
function Ja(e = [], n = {}) {
|
|
@@ -3399,9 +3404,11 @@ function eo(e) {
|
|
|
3399
3404
|
function to(e, t, n) {
|
|
3400
3405
|
let r = Array.from(n ?? []);
|
|
3401
3406
|
return e.filter((e) => {
|
|
3402
|
-
if (e.status !== "completed"
|
|
3403
|
-
let n =
|
|
3404
|
-
|
|
3407
|
+
if (e.status !== "completed") return !1;
|
|
3408
|
+
let n = t?.get(e.id);
|
|
3409
|
+
if (n && n.status === "completed" && n.content === e.content) return !1;
|
|
3410
|
+
let i = Va(e.evidence ?? "");
|
|
3411
|
+
return i.length ? !Ha(i, r) : !1;
|
|
3405
3412
|
});
|
|
3406
3413
|
}
|
|
3407
3414
|
function no(e) {
|
|
@@ -3873,7 +3880,10 @@ function Eo(e) {
|
|
|
3873
3880
|
counts: {},
|
|
3874
3881
|
writePaths: [],
|
|
3875
3882
|
failures: 0
|
|
3876
|
-
}, p = Ya(), m = new Map((U.todos ?? []).map((e) => [e.id,
|
|
3883
|
+
}, p = Ya(), m = new Map((U.todos ?? []).map((e) => [e.id, {
|
|
3884
|
+
status: e.status,
|
|
3885
|
+
content: e.content
|
|
3886
|
+
}])), g = /* @__PURE__ */ new Map(), _ = (e) => {
|
|
3877
3887
|
let t = B.find((t) => t.name === e);
|
|
3878
3888
|
return t && "writeCapable" in t ? typeof t.writeCapable == "function" || t.writeCapable === !0 : wo.has(e);
|
|
3879
3889
|
}, y = 0, S = 0, w = So(ne, C), T = null, E = 0, D = !1;
|
|
@@ -7807,7 +7817,13 @@ function ju(e, t) {
|
|
|
7807
7817
|
}
|
|
7808
7818
|
//#endregion
|
|
7809
7819
|
//#region src/core/tools/dataOps.ts
|
|
7810
|
-
function Mu(e) {
|
|
7820
|
+
function Mu(e, t) {
|
|
7821
|
+
if (!e) return null;
|
|
7822
|
+
let n = (t ? Ao(e, t) : e)?.shape;
|
|
7823
|
+
return n && typeof n == "object" ? Object.keys(n) : null;
|
|
7824
|
+
}
|
|
7825
|
+
var Nu = (e) => e && e.length ? `(可用字段:${e.slice(0, 12).join(", ")}${e.length > 12 ? " …" : ""})` : "", Pu = (e) => /[.[]/.test(e) ? e.replace(/[.[][^.[]*$/, "") : "";
|
|
7826
|
+
function Fu(e) {
|
|
7811
7827
|
let { schema: t, allowKeys: n, value: r, bindRef: i } = e, a = [];
|
|
7812
7828
|
if (n) {
|
|
7813
7829
|
if (typeof r != "object" || !r || Array.isArray(r)) return {
|
|
@@ -7832,7 +7848,7 @@ function Mu(e) {
|
|
|
7832
7848
|
error: X({
|
|
7833
7849
|
code: "SCHEMA_STRIP",
|
|
7834
7850
|
message: `字段 ${r} 不在 schema 声明内,写入被拒绝(防静默丢失)`,
|
|
7835
|
-
hint:
|
|
7851
|
+
hint: `该数据结构不支持这些字段;请只用 schema 声明的字段,或在 data.schema 中声明后重试${Nu(Mu(t, ""))}`,
|
|
7836
7852
|
path: r,
|
|
7837
7853
|
details: { stripped: [r] }
|
|
7838
7854
|
}),
|
|
@@ -7852,7 +7868,7 @@ function Mu(e) {
|
|
|
7852
7868
|
error: X({
|
|
7853
7869
|
code: "SCHEMA_STRIP",
|
|
7854
7870
|
message: `字段 ${c.join(", ")} 不在 schema 声明内,写入被拒绝(防静默丢失)`,
|
|
7855
|
-
hint:
|
|
7871
|
+
hint: `该数据结构不支持这些字段;请只用 schema 声明的字段,或在 data.schema 中声明后重试${Nu(Mu(t, Pu(String(c[0]))))}`,
|
|
7856
7872
|
path: c[0],
|
|
7857
7873
|
details: { stripped: c }
|
|
7858
7874
|
}),
|
|
@@ -7891,7 +7907,7 @@ function Mu(e) {
|
|
|
7891
7907
|
notices: a
|
|
7892
7908
|
};
|
|
7893
7909
|
}
|
|
7894
|
-
function
|
|
7910
|
+
function Iu(e) {
|
|
7895
7911
|
let { schema: t, bindRef: n, clone: r, patches: i, schemaErrorMode: a = "zod", appendCaptures: o, moveCaptures: s } = e, c = [], l = (t) => {
|
|
7896
7912
|
let n = Q(r, t);
|
|
7897
7913
|
return n === void 0 ? e.valueAt?.(t) : n;
|
|
@@ -8158,7 +8174,7 @@ function Nu(e) {
|
|
|
8158
8174
|
notices: c
|
|
8159
8175
|
};
|
|
8160
8176
|
}
|
|
8161
|
-
function
|
|
8177
|
+
function Lu(e) {
|
|
8162
8178
|
let { bindRef: t, schema: n, allowKeys: r, snapshots: i, maxSnapshots: a, audit: o, dryRun: s, op: c = "set", protectedCtx: l, snapshotLabel: u } = e, d = e.value, f = e.internalAfterWrite ? Os(t) : null;
|
|
8163
8179
|
if (l) {
|
|
8164
8180
|
let e = ku({
|
|
@@ -8171,7 +8187,7 @@ function Pu(e) {
|
|
|
8171
8187
|
};
|
|
8172
8188
|
d = e.value;
|
|
8173
8189
|
}
|
|
8174
|
-
let p =
|
|
8190
|
+
let p = Fu({
|
|
8175
8191
|
schema: n,
|
|
8176
8192
|
allowKeys: r,
|
|
8177
8193
|
value: d,
|
|
@@ -8215,7 +8231,7 @@ function Pu(e) {
|
|
|
8215
8231
|
notices: p.notices
|
|
8216
8232
|
};
|
|
8217
8233
|
}
|
|
8218
|
-
function
|
|
8234
|
+
function Ru(e) {
|
|
8219
8235
|
let { bindRef: t, patches: n, schema: r, allowKeys: i, snapshots: a, maxSnapshots: o, markDataDirty: s, schemaErrorMode: c = "zod", snapshotLabel: l, dryRun: u, protectedCtx: d } = e, f = e.internalAfterWrite ? Os(t) : null, p = Os(t), m = [], h = [], g = [], _ = [], v = (e, t) => {
|
|
8220
8236
|
(e === "set" || e === "merge") && _.push({
|
|
8221
8237
|
jp: t,
|
|
@@ -8237,7 +8253,7 @@ function Fu(e) {
|
|
|
8237
8253
|
error: X({
|
|
8238
8254
|
code: "PATH_DENIED",
|
|
8239
8255
|
message: `patches[${e}] @ "${a}" 不在 schema 声明字段内`,
|
|
8240
|
-
hint:
|
|
8256
|
+
hint: `仅 schema 声明的 key 可写${Nu(Mu(r, Pu(a)))}`
|
|
8241
8257
|
})
|
|
8242
8258
|
};
|
|
8243
8259
|
let o = t.op ?? "set", s;
|
|
@@ -8260,7 +8276,7 @@ function Fu(e) {
|
|
|
8260
8276
|
error: X({
|
|
8261
8277
|
code: "PATH_DENIED",
|
|
8262
8278
|
message: `patches[${e}] move 目标 "${s}" 不在 schema 声明字段内`,
|
|
8263
|
-
hint:
|
|
8279
|
+
hint: `move 的 value(目标路径)也须在 schema 声明字段内${Nu(Mu(r, Pu(String(s))))}`
|
|
8264
8280
|
})
|
|
8265
8281
|
};
|
|
8266
8282
|
}
|
|
@@ -8298,7 +8314,7 @@ function Fu(e) {
|
|
|
8298
8314
|
error: e.error
|
|
8299
8315
|
};
|
|
8300
8316
|
}
|
|
8301
|
-
let y =
|
|
8317
|
+
let y = Iu({
|
|
8302
8318
|
schema: r,
|
|
8303
8319
|
bindRef: t,
|
|
8304
8320
|
clone: p,
|
|
@@ -8343,37 +8359,37 @@ function Fu(e) {
|
|
|
8343
8359
|
notices: y.notices
|
|
8344
8360
|
};
|
|
8345
8361
|
}
|
|
8346
|
-
function
|
|
8362
|
+
function zu(e) {
|
|
8347
8363
|
return e < 1024 ? `${e}B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)}KB` : `${(e / (1024 * 1024)).toFixed(1)}MB`;
|
|
8348
8364
|
}
|
|
8349
|
-
function
|
|
8365
|
+
function Bu(e, t, n, r) {
|
|
8350
8366
|
if (!t || !n.length || typeof e != "object" || !e) return e;
|
|
8351
8367
|
let i = new Set(n.map((e) => e.field)), a = Os(e);
|
|
8352
8368
|
return (function e(t) {
|
|
8353
8369
|
if (Array.isArray(t)) for (let n of t) e(n);
|
|
8354
8370
|
else if (t && typeof t == "object") for (let n of Object.keys(t)) {
|
|
8355
8371
|
let a = t[n];
|
|
8356
|
-
typeof a == "string" && i.has(n) && a.length >= r ? t[n] = `<${n} ${
|
|
8372
|
+
typeof a == "string" && i.has(n) && a.length >= r ? t[n] = `<${n} ${zu(a.length)}>` : e(a);
|
|
8357
8373
|
}
|
|
8358
8374
|
})(a), a;
|
|
8359
8375
|
}
|
|
8360
|
-
var
|
|
8361
|
-
function
|
|
8362
|
-
return
|
|
8376
|
+
var Vu = 0;
|
|
8377
|
+
function Hu() {
|
|
8378
|
+
return Vu++, "c_" + Math.random().toString(36).slice(2, 8) + Vu.toString(36);
|
|
8363
8379
|
}
|
|
8364
|
-
function
|
|
8380
|
+
function Uu(e, t) {
|
|
8365
8381
|
if (!(!e || typeof e != "object")) for (let n of t) {
|
|
8366
8382
|
let t = Q(e, n);
|
|
8367
|
-
if (Array.isArray(t)) for (let e of t) e && typeof e == "object" && !("__pgId" in e) && (e.__pgId =
|
|
8383
|
+
if (Array.isArray(t)) for (let e of t) e && typeof e == "object" && !("__pgId" in e) && (e.__pgId = Hu());
|
|
8368
8384
|
}
|
|
8369
8385
|
}
|
|
8370
|
-
function
|
|
8386
|
+
function Wu(e) {
|
|
8371
8387
|
(function e(t) {
|
|
8372
8388
|
if (Array.isArray(t)) t.forEach(e);
|
|
8373
8389
|
else if (t && typeof t == "object") for (let n of Object.keys(t)) n.startsWith("__pg") ? delete t[n] : e(t[n]);
|
|
8374
8390
|
})(e);
|
|
8375
8391
|
}
|
|
8376
|
-
function
|
|
8392
|
+
function Gu(e, n = {}) {
|
|
8377
8393
|
let i = n.pgIdPaths ?? [], a = i.length ? (e, t) => {
|
|
8378
8394
|
if (t && typeof t == "object") for (let n of i) {
|
|
8379
8395
|
let r = Q(t, n), i = Q(e, n);
|
|
@@ -8400,7 +8416,7 @@ function Hu(e, n = {}) {
|
|
|
8400
8416
|
t && n && typeof n == "object" && !("__pgId" in n) && (n.__pgId = t, o.add(e));
|
|
8401
8417
|
}
|
|
8402
8418
|
}
|
|
8403
|
-
|
|
8419
|
+
Uu(e, i);
|
|
8404
8420
|
} : void 0, o = i.length ? ts(e.schema, i).schema : e.schema, s = e.bind, c = e.description ?? "主数据对象", l = Do(o), u = /* @__PURE__ */ new Map(), d = n.vfsStore ? new wu(n.vfsStore) : void 0;
|
|
8405
8421
|
function f(e) {
|
|
8406
8422
|
if (u.clear(), e) for (let t of e) {
|
|
@@ -8568,7 +8584,7 @@ function Hu(e, n = {}) {
|
|
|
8568
8584
|
resourceStore: p.resourceStore
|
|
8569
8585
|
}));
|
|
8570
8586
|
let a = w();
|
|
8571
|
-
return b(a, n), i === void 0 ? `主数据${r ? ` @ ${r}` : ""} = (undefined) (hash=${a})` : (i =
|
|
8587
|
+
return b(a, n), i === void 0 ? `主数据${r ? ` @ ${r}` : ""} = (undefined) (hash=${a})` : (i = Bu(i, n === "", D, E), `主数据${r ? ` @ ${r}` : ""} = ${$(i)} (hash=${a})`);
|
|
8572
8588
|
}, {
|
|
8573
8589
|
name: "get_data",
|
|
8574
8590
|
description: "@deprecated(改用 read,等价且支持 fields/depth/分页)。读取主数据当前值(返回含 hash 供乐观锁);jsonPath 可选读子路径。大结果自动外存 vfs。",
|
|
@@ -8578,7 +8594,7 @@ function Hu(e, n = {}) {
|
|
|
8578
8594
|
if (r !== null) return r;
|
|
8579
8595
|
let i = ks(e);
|
|
8580
8596
|
if (i.parseError) return Yr("", e, i.parseError);
|
|
8581
|
-
let c =
|
|
8597
|
+
let c = Lu({
|
|
8582
8598
|
bindRef: s,
|
|
8583
8599
|
value: i.parsed,
|
|
8584
8600
|
schema: o,
|
|
@@ -8623,7 +8639,7 @@ function Hu(e, n = {}) {
|
|
|
8623
8639
|
message: `edit 仅适用于对象/数组主数据,当前是 ${s === void 0 ? "undefined" : typeof s}`,
|
|
8624
8640
|
hint: "叶子(原始类型)请用 set_data 整体设置"
|
|
8625
8641
|
});
|
|
8626
|
-
let f =
|
|
8642
|
+
let f = Ru({
|
|
8627
8643
|
bindRef: s,
|
|
8628
8644
|
patches: [{
|
|
8629
8645
|
op: r,
|
|
@@ -8808,7 +8824,7 @@ function Hu(e, n = {}) {
|
|
|
8808
8824
|
details: { expr: e }
|
|
8809
8825
|
});
|
|
8810
8826
|
}
|
|
8811
|
-
let c = t ?? 50, u = a.slice(0, c), d = u.map((e) => `{"path":${JSON.stringify(e.path)},"index":${e.index === void 0 ? "null" : e.index},"value":${$(
|
|
8827
|
+
let c = t ?? 50, u = a.slice(0, c), d = u.map((e) => `{"path":${JSON.stringify(e.path)},"index":${e.index === void 0 ? "null" : e.index},"value":${$(Bu(e.value, r === "", D, E))}}`);
|
|
8812
8828
|
return `{"matched":${a.length},"returned":${u.length},"truncated":${a.length > c},"results":[${d.join(",")}]}`;
|
|
8813
8829
|
}, {
|
|
8814
8830
|
name: "query_data",
|
|
@@ -8890,7 +8906,7 @@ function Hu(e, n = {}) {
|
|
|
8890
8906
|
if (t === "transform") {
|
|
8891
8907
|
let e = f.result;
|
|
8892
8908
|
if (c) {
|
|
8893
|
-
let t =
|
|
8909
|
+
let t = Ru({
|
|
8894
8910
|
bindRef: s,
|
|
8895
8911
|
patches: [{
|
|
8896
8912
|
op: "set",
|
|
@@ -8919,7 +8935,7 @@ function Hu(e, n = {}) {
|
|
|
8919
8935
|
message: `主数据 bind 为原始类型(${s === null ? "null" : typeof s}),eval transform(patches) 无法就地替换`,
|
|
8920
8936
|
hint: "主数据 bind 必须为对象/数组;叶子值请用对象包裹或集成方通过 sdk.setData 替换 bind"
|
|
8921
8937
|
});
|
|
8922
|
-
let t =
|
|
8938
|
+
let t = Ru({
|
|
8923
8939
|
bindRef: s,
|
|
8924
8940
|
patches: e.patches,
|
|
8925
8941
|
schema: o,
|
|
@@ -8952,7 +8968,7 @@ function Hu(e, n = {}) {
|
|
|
8952
8968
|
message: `主数据 bind 为原始类型(${s === null ? "null" : typeof s}),eval transform 无法就地替换外部持有的值引用`,
|
|
8953
8969
|
hint: "主数据 bind 必须为对象/数组;叶子值请用对象包裹或集成方通过 sdk.setData 替换 bind"
|
|
8954
8970
|
});
|
|
8955
|
-
let n =
|
|
8971
|
+
let n = Fu({
|
|
8956
8972
|
schema: o,
|
|
8957
8973
|
allowKeys: l,
|
|
8958
8974
|
value: t,
|
|
@@ -9003,7 +9019,7 @@ function Hu(e, n = {}) {
|
|
|
9003
9019
|
resolved: c,
|
|
9004
9020
|
resourcesByPath: p.resourcesByPath,
|
|
9005
9021
|
resourceStore: p.resourceStore
|
|
9006
|
-
})), n && n.length && (c = As(c, n)), r != null && (c = js(c, r)), c =
|
|
9022
|
+
})), n && n.length && (c = As(c, n)), r != null && (c = js(c, r)), c = Bu(c, d === "", D, E), c === void 0 ? `- ${i} = (undefined)` : `- ${i} = ${$(c)}`;
|
|
9007
9023
|
});
|
|
9008
9024
|
return e && b(f, d), `多路径读取(共 ${t.length} 项,hash=${f}):\n${i.join("\n")}`;
|
|
9009
9025
|
}
|
|
@@ -9013,10 +9029,7 @@ function Hu(e, n = {}) {
|
|
|
9013
9029
|
message: `jsonPath "${m}" 含非法段(__proto__/constructor/prototype)`,
|
|
9014
9030
|
hint: "使用正常属性路径,如 components.0.text(数组索引数字)"
|
|
9015
9031
|
});
|
|
9016
|
-
let h = (e, t) =>
|
|
9017
|
-
let n = (e ? Ao(o, e) : o)?.shape;
|
|
9018
|
-
return n && typeof n == "object" ? Object.keys(n) : t && typeof t == "object" && !Array.isArray(t) ? Object.keys(t) : [];
|
|
9019
|
-
};
|
|
9032
|
+
let h = (e, t) => Mu(o, e) ?? (t && typeof t == "object" && !Array.isArray(t) ? Object.keys(t) : []);
|
|
9020
9033
|
if (!Oo(m, o, l)) {
|
|
9021
9034
|
let e = /[.[]/.test(m) ? m.replace(/[.[][^.[]*$/, "") : "", t = h(e, e ? Q(s, e) : s), n = t.length ? `;父级 "${e || "(root)"}" 的可用字段:${t.slice(0, 12).join(", ")}${t.length > 12 ? " …" : ""}` : "";
|
|
9022
9035
|
return X({
|
|
@@ -9049,7 +9062,7 @@ function Hu(e, n = {}) {
|
|
|
9049
9062
|
resolved: _,
|
|
9050
9063
|
resourcesByPath: p.resourcesByPath,
|
|
9051
9064
|
resourceStore: p.resourceStore
|
|
9052
|
-
})), b(f, d), n && n.length && (_ = As(_, n)), r != null && (_ = js(_, r)), _ =
|
|
9065
|
+
})), b(f, d), n && n.length && (_ = As(_, n)), r != null && (_ = js(_, r)), _ = Bu(_, d === "", D, E);
|
|
9053
9066
|
let y = e ? "" : `主数据说明: ${c}\n格式: 写入值需为 JSON,且通过声明的 schema 校验(校验失败时 write 会返回结构化错误)。字段约束(类型/min/max/enum/必填/默认)见 systemPrompt「可操作数据」段,或用 schema_data({ jsonPath }) 按需查。\n\n`, x = n && n.length ? `(字段裁剪:${n.join(",")})` : "", S = r == null ? "" : `(深度≤${r})`, C = x || S ? ` ${x}${S}` : "";
|
|
9054
9067
|
if ((i !== void 0 || a !== void 0) && Array.isArray(_)) {
|
|
9055
9068
|
let e = _.length, t = Math.max(0, i ?? 0), n = Math.min(200, Math.max(1, a ?? 50)), r = _.slice(t, t + n), o = t + n < e;
|
|
@@ -9129,7 +9142,7 @@ function Hu(e, n = {}) {
|
|
|
9129
9142
|
op: t.op ?? "set",
|
|
9130
9143
|
jsonPath: t.jsonPath || "",
|
|
9131
9144
|
value: f
|
|
9132
|
-
}], c =
|
|
9145
|
+
}], c = Ru({
|
|
9133
9146
|
bindRef: s,
|
|
9134
9147
|
patches: r,
|
|
9135
9148
|
schema: o,
|
|
@@ -9151,13 +9164,13 @@ function Hu(e, n = {}) {
|
|
|
9151
9164
|
timestamp: Date.now()
|
|
9152
9165
|
});
|
|
9153
9166
|
let d = T(u);
|
|
9154
|
-
return
|
|
9167
|
+
return Wu(c.clone), `已 write(edit) 主数据(${c.applied.length} 个 patch)。当前值:${$(c.clone, 600)} (新 hash=${d})`;
|
|
9155
9168
|
}
|
|
9156
9169
|
let _ = ks(f);
|
|
9157
9170
|
if (_.parseError) return Yr("", f, _.parseError);
|
|
9158
9171
|
let x = await N("set", g);
|
|
9159
9172
|
if (x !== null) return x;
|
|
9160
|
-
let S =
|
|
9173
|
+
let S = Lu({
|
|
9161
9174
|
bindRef: s,
|
|
9162
9175
|
value: _.parsed,
|
|
9163
9176
|
schema: o,
|
|
@@ -9174,7 +9187,7 @@ function Hu(e, n = {}) {
|
|
|
9174
9187
|
if (!S.ok) return S.error;
|
|
9175
9188
|
if (i) return `dryRun(set): schema 校验通过。预览新值:${$(S.data, 600)}。未实际写入、未入快照。`;
|
|
9176
9189
|
let E = w();
|
|
9177
|
-
return b(E, u),
|
|
9190
|
+
return b(E, u), Wu(S.data), `已 write(set) 主数据 = ${$(S.data, 600)} (新 hash=${E})${l ? "(白名单模式:仅更新 schema 声明字段,未声明字段保留)" : ""}`;
|
|
9178
9191
|
}, {
|
|
9179
9192
|
name: "write",
|
|
9180
9193
|
description: "写入主数据(高层入口,合并 set/edit/delete + 自动乐观锁 + 自动快照)。四意图:① 整体替换 write({value:整个对象});② 增量 write({patch:{op,jsonPath,value}}) op=set/remove/merge/append/move(move 的 value=目标路径字符串);③ 批量原子 write({patches:[...]})(任一失败整批回滚);④ 删子路径 write({patch:{jsonPath},del:true})。dryRun:true 预检不落盘。写入自动 schema 校验(失败不写,按错误修正重试)+ 自动快照。详细用法见系统提示「能力使用提示」。",
|
|
@@ -9293,7 +9306,7 @@ function Hu(e, n = {}) {
|
|
|
9293
9306
|
}
|
|
9294
9307
|
let f = await N("set", C ? y(r) : void 0);
|
|
9295
9308
|
if (f !== null) return f;
|
|
9296
|
-
let g =
|
|
9309
|
+
let g = Lu({
|
|
9297
9310
|
bindRef: s,
|
|
9298
9311
|
value: d,
|
|
9299
9312
|
schema: o,
|
|
@@ -9454,7 +9467,7 @@ function Hu(e, n = {}) {
|
|
|
9454
9467
|
}
|
|
9455
9468
|
//#endregion
|
|
9456
9469
|
//#region src/core/tools/htmlValidate.ts
|
|
9457
|
-
var
|
|
9470
|
+
var Ku = /* @__PURE__ */ new Set([
|
|
9458
9471
|
"area",
|
|
9459
9472
|
"base",
|
|
9460
9473
|
"br",
|
|
@@ -9469,8 +9482,8 @@ var Uu = /* @__PURE__ */ new Set([
|
|
|
9469
9482
|
"source",
|
|
9470
9483
|
"track",
|
|
9471
9484
|
"wbr"
|
|
9472
|
-
]),
|
|
9473
|
-
function
|
|
9485
|
+
]), qu = /* @__PURE__ */ new Set(["script", "style"]);
|
|
9486
|
+
function Ju(e) {
|
|
9474
9487
|
let t = [], n = e.length;
|
|
9475
9488
|
if (!e.trim()) return t;
|
|
9476
9489
|
let r = [0];
|
|
@@ -9547,8 +9560,8 @@ function Gu(e) {
|
|
|
9547
9560
|
}
|
|
9548
9561
|
continue;
|
|
9549
9562
|
}
|
|
9550
|
-
if (!(
|
|
9551
|
-
if (
|
|
9563
|
+
if (!(Ku.has(p) || m)) {
|
|
9564
|
+
if (qu.has(p)) {
|
|
9552
9565
|
let n = RegExp(`</${p}\\s*>`, "i").exec(e.slice(o));
|
|
9553
9566
|
if (!n) {
|
|
9554
9567
|
t.push({
|
|
@@ -9577,8 +9590,8 @@ function Gu(e) {
|
|
|
9577
9590
|
}
|
|
9578
9591
|
//#endregion
|
|
9579
9592
|
//#region src/core/sdk/codeAssetMiddleware.ts
|
|
9580
|
-
var
|
|
9581
|
-
function
|
|
9593
|
+
var Yu = "__pgTouched", Xu = "__pgFinalText", Zu = "__pgCodeHashes", Qu = "__pgKeepExternal", $u = "__pgNotes", ed = 200;
|
|
9594
|
+
function td(e) {
|
|
9582
9595
|
let t = [];
|
|
9583
9596
|
for (let n of e.split("\n")) {
|
|
9584
9597
|
let e = n.match(/^\s*[-*]?\s*\[note\]\s*(.*)$/i);
|
|
@@ -9586,27 +9599,27 @@ function Qu(e) {
|
|
|
9586
9599
|
}
|
|
9587
9600
|
return [...new Set(t)];
|
|
9588
9601
|
}
|
|
9589
|
-
function
|
|
9590
|
-
let n = Array.isArray(e[
|
|
9591
|
-
e[
|
|
9602
|
+
function nd(e, t) {
|
|
9603
|
+
let n = Array.isArray(e[$u]) ? e[$u].filter((e) => typeof e == "string") : [];
|
|
9604
|
+
e[$u] = [.../* @__PURE__ */ new Set([...n, ...t])].map((e) => e.length > ed ? e.slice(0, ed) + "…" : e).slice(-5);
|
|
9592
9605
|
}
|
|
9593
|
-
function
|
|
9606
|
+
function rd(e) {
|
|
9594
9607
|
let t = 5381;
|
|
9595
9608
|
for (let n = 0; n < e.length; n++) t = (t << 5) + t + e.charCodeAt(n) | 0;
|
|
9596
9609
|
return (t >>> 0).toString(16);
|
|
9597
9610
|
}
|
|
9598
|
-
function
|
|
9611
|
+
function id(e, t) {
|
|
9599
9612
|
let n = [];
|
|
9600
|
-
return
|
|
9613
|
+
return od(e, t, (e) => {
|
|
9601
9614
|
typeof e.name == "string" && e.name && n.push(e.name);
|
|
9602
9615
|
}), n;
|
|
9603
9616
|
}
|
|
9604
|
-
function
|
|
9617
|
+
function ad(e, t) {
|
|
9605
9618
|
if (!e.startsWith(t)) return null;
|
|
9606
9619
|
let n = e.slice(t.length), r = n.lastIndexOf(".");
|
|
9607
9620
|
return (r > 0 ? n.slice(0, r) : r === 0 ? "" : n) || null;
|
|
9608
9621
|
}
|
|
9609
|
-
function
|
|
9622
|
+
function od(e, t, n) {
|
|
9610
9623
|
if (!(!e || typeof e != "object")) for (let r of t) {
|
|
9611
9624
|
let t = Q(e, r);
|
|
9612
9625
|
if (Array.isArray(t)) for (let e = 0; e < t.length; e++) {
|
|
@@ -9615,7 +9628,7 @@ function rd(e, t, n) {
|
|
|
9615
9628
|
}
|
|
9616
9629
|
}
|
|
9617
9630
|
}
|
|
9618
|
-
function
|
|
9631
|
+
function sd(e, t, n) {
|
|
9619
9632
|
let r = /* @__PURE__ */ new Set();
|
|
9620
9633
|
if (!e || typeof e != "object") return r;
|
|
9621
9634
|
for (let i of t) {
|
|
@@ -9634,20 +9647,20 @@ function id(e, t, n) {
|
|
|
9634
9647
|
}
|
|
9635
9648
|
return r;
|
|
9636
9649
|
}
|
|
9637
|
-
function
|
|
9650
|
+
function cd(e) {
|
|
9638
9651
|
let { writablePaths: t, codeVfsPrefix: n, ext: r, codeField: i = "code", onWarning: a, getController: o, vfsStore: s, craftNotes: c = !0 } = e, l = s, u = l.__pgLastCheckout ??= /* @__PURE__ */ new Map(), d = l.__pgPendingRetry ??= /* @__PURE__ */ new Set();
|
|
9639
9652
|
return {
|
|
9640
9653
|
name: "code-asset-checkout-commit",
|
|
9641
9654
|
beforeAgent: (e) => {
|
|
9642
9655
|
let c = o()?.get?.().bind;
|
|
9643
|
-
c &&
|
|
9656
|
+
c && Uu(c, t);
|
|
9644
9657
|
let l = 0, f = 0, p = /* @__PURE__ */ new Map();
|
|
9645
|
-
if (
|
|
9658
|
+
if (od(c, t, (e) => {
|
|
9646
9659
|
l++;
|
|
9647
9660
|
let t = Q(e, i);
|
|
9648
9661
|
if (typeof t == "string") {
|
|
9649
9662
|
f++;
|
|
9650
|
-
let i = e.__pgId, a =
|
|
9663
|
+
let i = e.__pgId, a = rd(t);
|
|
9651
9664
|
p.set(i, a);
|
|
9652
9665
|
let o = `${n}${i}.${r}`, c = s.files[o], l = u.get(i);
|
|
9653
9666
|
c && typeof c.content == "string" && c.content !== t && l === a ? d.add(o) : (s.files[o] = {
|
|
@@ -9668,23 +9681,23 @@ function ad(e) {
|
|
|
9668
9681
|
}
|
|
9669
9682
|
return {
|
|
9670
9683
|
files: s.files,
|
|
9671
|
-
[
|
|
9672
|
-
[
|
|
9673
|
-
[
|
|
9674
|
-
[
|
|
9684
|
+
[Yu]: /* @__PURE__ */ new Set(),
|
|
9685
|
+
[Xu]: { text: "" },
|
|
9686
|
+
[Zu]: p,
|
|
9687
|
+
[Qu]: []
|
|
9675
9688
|
};
|
|
9676
9689
|
},
|
|
9677
9690
|
wrapModelCall: async (e, t) => {
|
|
9678
|
-
let n = await t(e), r = e.state[
|
|
9691
|
+
let n = await t(e), r = e.state[Xu];
|
|
9679
9692
|
return r && !(n.toolCalls && n.toolCalls.length) && typeof n.content == "string" && n.content && (r.text = n.content), n;
|
|
9680
9693
|
},
|
|
9681
9694
|
augmentPrompt: () => {
|
|
9682
9695
|
let e = o()?.get?.().bind, i = [], a = 0;
|
|
9683
|
-
if (
|
|
9696
|
+
if (od(e, t, (e, t, o) => {
|
|
9684
9697
|
a++;
|
|
9685
9698
|
let l = typeof e.name == "string" && e.name ? e.name : "", u = l ? `${l} [${o}]` : `(未命名 [${o}])`, d = `${n}${e.__pgId}.${r}`, f = !!s.files[d];
|
|
9686
9699
|
if (i.push(`- ${u} → ${d}${f ? "" : "(尚未检出,先 vfs_write 创建)"}`), c) {
|
|
9687
|
-
let t = Array.isArray(e[
|
|
9700
|
+
let t = Array.isArray(e[$u]) ? e[$u].filter((e) => typeof e == "string") : [];
|
|
9688
9701
|
if (t.length) {
|
|
9689
9702
|
let e = t[t.length - 1];
|
|
9690
9703
|
i.push(` 📝 笔记×${t.length}(最近):${e.length > 120 ? e.slice(0, 120) + "…" : e}`);
|
|
@@ -9706,9 +9719,9 @@ function ad(e) {
|
|
|
9706
9719
|
if (c) {
|
|
9707
9720
|
let i = e.state.focuses;
|
|
9708
9721
|
if (i && i.length) {
|
|
9709
|
-
let e =
|
|
9722
|
+
let e = sd(o()?.get?.().bind, t, i);
|
|
9710
9723
|
if (e.size) {
|
|
9711
|
-
let t =
|
|
9724
|
+
let t = ad(s, n);
|
|
9712
9725
|
if (t && !e.has(t)) return {
|
|
9713
9726
|
content: `PATH_DENIED · vfs 越界:当前聚焦代码文件 [${[...e].map((e) => `${n}${e}.${r}`).join(", ")}],你要改的 "${s}" 不在其中。请只改焦点组件的代码文件;如需改其他组件,请在收口回复中说明需先取消聚焦(焦点由主会话/用户管理,你无 focus 工具)后重试。`,
|
|
9714
9727
|
status: "error"
|
|
@@ -9718,7 +9731,7 @@ function ad(e) {
|
|
|
9718
9731
|
}
|
|
9719
9732
|
let l = await i(e);
|
|
9720
9733
|
if (c) {
|
|
9721
|
-
let t = e.state[
|
|
9734
|
+
let t = e.state[Yu];
|
|
9722
9735
|
t && t.add(s);
|
|
9723
9736
|
}
|
|
9724
9737
|
return l;
|
|
@@ -9726,10 +9739,10 @@ function ad(e) {
|
|
|
9726
9739
|
afterAgent: (e) => {
|
|
9727
9740
|
let a = o(), l = a?.get?.().bind;
|
|
9728
9741
|
if (!l) return;
|
|
9729
|
-
let u = e[
|
|
9742
|
+
let u = e[Yu] ?? /* @__PURE__ */ new Set();
|
|
9730
9743
|
if (u.size) {
|
|
9731
|
-
let o = e[
|
|
9732
|
-
|
|
9744
|
+
let o = e[Zu] ?? /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set();
|
|
9745
|
+
od(l, t, (t) => {
|
|
9733
9746
|
let a = t.__pgId;
|
|
9734
9747
|
c.add(a);
|
|
9735
9748
|
let l = `${n}${a}.${r}`;
|
|
@@ -9739,14 +9752,14 @@ function ad(e) {
|
|
|
9739
9752
|
let r = o.get(a);
|
|
9740
9753
|
if (r !== void 0) {
|
|
9741
9754
|
let n = Q(t, i);
|
|
9742
|
-
if (typeof n != "string" ||
|
|
9755
|
+
if (typeof n != "string" || rd(n) !== r) {
|
|
9743
9756
|
console.warn(`[page-agent-sdk][code-asset] 组件 ${t.name ?? a}(${l})在修改期间被外部更新,已保留外部版本(keep_external),本次子 agent 修改未提交`);
|
|
9744
|
-
let n = e[
|
|
9745
|
-
Array.isArray(n) ? n.push(r) : e[
|
|
9757
|
+
let n = e[Qu], r = String(t.name ?? a);
|
|
9758
|
+
Array.isArray(n) ? n.push(r) : e[Qu] = [r];
|
|
9746
9759
|
return;
|
|
9747
9760
|
}
|
|
9748
9761
|
}
|
|
9749
|
-
let s =
|
|
9762
|
+
let s = Ju(n.content);
|
|
9750
9763
|
if (s.length) {
|
|
9751
9764
|
console.warn(`[page-agent-sdk][code-asset] 跳过 commit 未通过校验的半成品(可能 abort/timeout 未跑完 verify):${l} - ${s[0].message}(${s[0].code})`);
|
|
9752
9765
|
return;
|
|
@@ -9758,22 +9771,22 @@ function ad(e) {
|
|
|
9758
9771
|
}
|
|
9759
9772
|
});
|
|
9760
9773
|
for (let e of u) {
|
|
9761
|
-
let t =
|
|
9774
|
+
let t = ad(e, n);
|
|
9762
9775
|
t && !c.has(t) && (console.warn(`[page-agent-sdk][code-asset] 组件 ${t}(${e})已被外部删除,放弃 commit 并清理 vfs 工作副本(不复活组件)`), delete s.files[e]);
|
|
9763
9776
|
}
|
|
9764
9777
|
a?.markDataDirty?.(), a?.recomputeBaseline?.();
|
|
9765
9778
|
}
|
|
9766
9779
|
if (!c) return;
|
|
9767
|
-
let f =
|
|
9780
|
+
let f = td(e[Xu]?.text ?? "");
|
|
9768
9781
|
if (!f.length) return;
|
|
9769
9782
|
let p = [];
|
|
9770
|
-
if (
|
|
9783
|
+
if (od(l, t, (e) => {
|
|
9771
9784
|
(u.size === 0 || u.has(`${n}${e.__pgId}.${r}`)) && p.push(e);
|
|
9772
9785
|
}), !p.length) return;
|
|
9773
9786
|
let m = !1;
|
|
9774
9787
|
for (let e of f) {
|
|
9775
9788
|
let t = p.length === 1 ? p[0] : p.find((t) => typeof t.name == "string" && !!t.name && e.includes(t.name));
|
|
9776
|
-
t && (
|
|
9789
|
+
t && (nd(t, [e]), m = !0);
|
|
9777
9790
|
}
|
|
9778
9791
|
m && a?.markDataDirty?.();
|
|
9779
9792
|
}
|
|
@@ -9781,7 +9794,7 @@ function ad(e) {
|
|
|
9781
9794
|
}
|
|
9782
9795
|
//#endregion
|
|
9783
9796
|
//#region src/core/sdk/componentLock.ts
|
|
9784
|
-
function
|
|
9797
|
+
function ld() {
|
|
9785
9798
|
let e = /* @__PURE__ */ new Map();
|
|
9786
9799
|
return {
|
|
9787
9800
|
async acquire(t, n) {
|
|
@@ -9820,7 +9833,7 @@ function od() {
|
|
|
9820
9833
|
}
|
|
9821
9834
|
};
|
|
9822
9835
|
}
|
|
9823
|
-
function
|
|
9836
|
+
function ud(e, t) {
|
|
9824
9837
|
if (Array.isArray(e.components) && e.components.length) {
|
|
9825
9838
|
let n = new Set(t), r = [...new Set(e.components.filter((e) => typeof e == "string" && e && n.has(e)))];
|
|
9826
9839
|
if (r.length) return {
|
|
@@ -9837,12 +9850,12 @@ function sd(e, t) {
|
|
|
9837
9850
|
via: "none"
|
|
9838
9851
|
};
|
|
9839
9852
|
}
|
|
9840
|
-
function
|
|
9853
|
+
function dd(e, t, n) {
|
|
9841
9854
|
let r = new Set(n);
|
|
9842
9855
|
if (!r.size || !e || typeof e != "object") return [];
|
|
9843
9856
|
let i = [];
|
|
9844
9857
|
for (let n of t) {
|
|
9845
|
-
let t =
|
|
9858
|
+
let t = fd(e, n);
|
|
9846
9859
|
if (Array.isArray(t)) for (let e = 0; e < t.length; e++) {
|
|
9847
9860
|
let a = t[e];
|
|
9848
9861
|
a && typeof a == "object" && typeof a.name == "string" && r.has(a.name) && i.push(`${n}.${e}`);
|
|
@@ -9850,7 +9863,7 @@ function cd(e, t, n) {
|
|
|
9850
9863
|
}
|
|
9851
9864
|
return i;
|
|
9852
9865
|
}
|
|
9853
|
-
function
|
|
9866
|
+
function fd(e, t) {
|
|
9854
9867
|
let n = e;
|
|
9855
9868
|
for (let e of t.split(".")) {
|
|
9856
9869
|
if (!n || typeof n != "object") return;
|
|
@@ -9858,26 +9871,26 @@ function ld(e, t) {
|
|
|
9858
9871
|
}
|
|
9859
9872
|
return n;
|
|
9860
9873
|
}
|
|
9861
|
-
function
|
|
9874
|
+
function pd(e, t) {
|
|
9862
9875
|
return t.some((t) => e === t || e.startsWith(t + "."));
|
|
9863
9876
|
}
|
|
9864
|
-
function
|
|
9877
|
+
function md(e, t) {
|
|
9865
9878
|
let n = [];
|
|
9866
9879
|
for (let { writablePaths: r, codeField: i } of t) for (let t of r) {
|
|
9867
|
-
let r =
|
|
9880
|
+
let r = fd(e, t);
|
|
9868
9881
|
if (Array.isArray(r)) for (let e = 0; e < r.length; e++) {
|
|
9869
9882
|
let a = r[e];
|
|
9870
|
-
a && typeof a == "object" && typeof
|
|
9883
|
+
a && typeof a == "object" && typeof fd(a, i) == "string" && n.push(`${t}.${e}.${i}`);
|
|
9871
9884
|
}
|
|
9872
9885
|
}
|
|
9873
9886
|
return n;
|
|
9874
9887
|
}
|
|
9875
|
-
function
|
|
9888
|
+
function hd(e) {
|
|
9876
9889
|
let t = e ?? {}, n = /* @__PURE__ */ new Set();
|
|
9877
9890
|
if (typeof t.jsonPath == "string" && t.jsonPath && n.add(t.jsonPath), typeof t.path == "string" && t.path && n.add(t.path), t.patch && typeof t.patch.jsonPath == "string" && t.patch.jsonPath && n.add(t.patch.jsonPath), Array.isArray(t.patches)) for (let e of t.patches) e && typeof e.jsonPath == "string" && e.jsonPath && n.add(e.jsonPath);
|
|
9878
9891
|
return [...n];
|
|
9879
9892
|
}
|
|
9880
|
-
function
|
|
9893
|
+
function gd(e) {
|
|
9881
9894
|
return {
|
|
9882
9895
|
name: "component-write-guard",
|
|
9883
9896
|
wrapToolCall: async (t, n) => {
|
|
@@ -9896,9 +9909,9 @@ function pd(e) {
|
|
|
9896
9909
|
status: "error"
|
|
9897
9910
|
};
|
|
9898
9911
|
}
|
|
9899
|
-
let a = e.getLocked(), o = Object.keys(a), s = e.getCodeFieldPaths?.() ?? [], c =
|
|
9912
|
+
let a = e.getLocked(), o = Object.keys(a), s = e.getCodeFieldPaths?.() ?? [], c = hd(i);
|
|
9900
9913
|
if (s.length) {
|
|
9901
|
-
let t = c.filter((e) =>
|
|
9914
|
+
let t = c.filter((e) => pd(e, s));
|
|
9902
9915
|
if (t.length) return e.onReject?.({
|
|
9903
9916
|
paths: t,
|
|
9904
9917
|
lockedPrefixes: s,
|
|
@@ -9909,7 +9922,7 @@ function pd(e) {
|
|
|
9909
9922
|
};
|
|
9910
9923
|
}
|
|
9911
9924
|
if (!o.length) return n(t);
|
|
9912
|
-
let l =
|
|
9925
|
+
let l = dd(e.getBind(), e.writablePaths, o);
|
|
9913
9926
|
if (!l.length) return n(t);
|
|
9914
9927
|
if (!c.length) return e.onReject?.({
|
|
9915
9928
|
paths: ["(整体 set)"],
|
|
@@ -9919,7 +9932,7 @@ function pd(e) {
|
|
|
9919
9932
|
content: `COMPONENT_LOCKED · 组件 [${o.join(", ")}] 正在被子 agent 修改,整体写入会触碰它们。请改用增量 patch(write({patch:{jsonPath,...}}))只写未锁定组件,或等委派结束后再整体操作。`,
|
|
9920
9933
|
status: "error"
|
|
9921
9934
|
};
|
|
9922
|
-
let u = c.filter((e) =>
|
|
9935
|
+
let u = c.filter((e) => pd(e, l));
|
|
9923
9936
|
return u.length ? (e.onReject?.({
|
|
9924
9937
|
paths: u,
|
|
9925
9938
|
lockedPrefixes: l,
|
|
@@ -9933,7 +9946,7 @@ function pd(e) {
|
|
|
9933
9946
|
}
|
|
9934
9947
|
//#endregion
|
|
9935
9948
|
//#region src/core/sdk/baselineGuard.ts
|
|
9936
|
-
function
|
|
9949
|
+
function _d(e) {
|
|
9937
9950
|
return {
|
|
9938
9951
|
name: "baseline-guard",
|
|
9939
9952
|
wrapToolCall: async (t, n) => {
|
|
@@ -9953,21 +9966,21 @@ function md(e) {
|
|
|
9953
9966
|
}
|
|
9954
9967
|
//#endregion
|
|
9955
9968
|
//#region src/core/sdk/diagnostics.ts
|
|
9956
|
-
var
|
|
9957
|
-
function
|
|
9969
|
+
var vd = 5e4, yd = 6e6;
|
|
9970
|
+
function bd(e) {
|
|
9958
9971
|
return e.replace(/([?&][^=&?]*(?:key|token|secret|password|signature)[^=&?]*=)[^&]*/gi, "$1***");
|
|
9959
9972
|
}
|
|
9960
|
-
function
|
|
9961
|
-
if (typeof e == "string") return e.length >
|
|
9962
|
-
if (Array.isArray(e)) return e.map(
|
|
9973
|
+
function xd(e) {
|
|
9974
|
+
if (typeof e == "string") return e.length > vd ? e.slice(0, vd) + `…<truncated:${e.length - vd} chars>` : e;
|
|
9975
|
+
if (Array.isArray(e)) return e.map(xd);
|
|
9963
9976
|
if (e && typeof e == "object") {
|
|
9964
9977
|
let t = {};
|
|
9965
|
-
for (let [n, r] of Object.entries(e)) t[n] =
|
|
9978
|
+
for (let [n, r] of Object.entries(e)) t[n] = xd(r);
|
|
9966
9979
|
return t;
|
|
9967
9980
|
}
|
|
9968
9981
|
return e;
|
|
9969
9982
|
}
|
|
9970
|
-
function
|
|
9983
|
+
function Sd(e) {
|
|
9971
9984
|
let t = Array.isArray(e.debugLogs) ? e.debugLogs : [];
|
|
9972
9985
|
return {
|
|
9973
9986
|
format: "page-agent-sdk/diagnostics",
|
|
@@ -9975,23 +9988,23 @@ function yd(e) {
|
|
|
9975
9988
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9976
9989
|
environment: {
|
|
9977
9990
|
userAgent: typeof navigator < "u" ? navigator.userAgent : "node",
|
|
9978
|
-
url: typeof location < "u" ?
|
|
9991
|
+
url: typeof location < "u" ? bd(location.href) : null
|
|
9979
9992
|
},
|
|
9980
9993
|
sessionId: e.sessionId ?? null,
|
|
9981
9994
|
usage: e.usage ?? null,
|
|
9982
9995
|
pendingConflict: e.pendingConflict ?? null,
|
|
9983
9996
|
dataSummary: e.dataSummary ?? null,
|
|
9984
|
-
info: e.info ?
|
|
9985
|
-
messages: (e.messages ?? []).map(
|
|
9986
|
-
debugLogs: t.map(
|
|
9997
|
+
info: e.info ? xd(e.info) : null,
|
|
9998
|
+
messages: (e.messages ?? []).map(xd),
|
|
9999
|
+
debugLogs: t.map(xd),
|
|
9987
10000
|
extra: e.extra ?? null
|
|
9988
10001
|
};
|
|
9989
10002
|
}
|
|
9990
|
-
function
|
|
10003
|
+
function Cd(e) {
|
|
9991
10004
|
let t = JSON.stringify(e);
|
|
9992
|
-
if (t.length <=
|
|
10005
|
+
if (t.length <= yd) return t;
|
|
9993
10006
|
let n = Array.isArray(e.debugLogs) ? e.debugLogs : [], r = 0;
|
|
9994
|
-
for (; t.length >
|
|
10007
|
+
for (; t.length > yd && n.length > 1;) {
|
|
9995
10008
|
let i = Math.max(1, Math.floor(n.length / 2));
|
|
9996
10009
|
n.splice(0, i), r += i, t = JSON.stringify(e);
|
|
9997
10010
|
}
|
|
@@ -10001,13 +10014,13 @@ function bd(e) {
|
|
|
10001
10014
|
data: {
|
|
10002
10015
|
stage: "diagnostics_truncated",
|
|
10003
10016
|
droppedOldestLogs: r,
|
|
10004
|
-
reason: `report > ${
|
|
10017
|
+
reason: `report > ${yd} chars`
|
|
10005
10018
|
}
|
|
10006
10019
|
}), t = JSON.stringify(e)), t;
|
|
10007
10020
|
}
|
|
10008
10021
|
//#endregion
|
|
10009
10022
|
//#region src/core/sdk/htmlSubagent.ts
|
|
10010
|
-
function
|
|
10023
|
+
function wd(e, t, n) {
|
|
10011
10024
|
let r = "html";
|
|
10012
10025
|
return `你是纯代码组件生成专家。可用工具:vfs_write / vfs_edit / vfs_rm(写/改/删代码工作副本 vfs ${e}) / vfs_read + vfs_grep(读 vfs) / validate_code(代码格式自检) / write(写 data,writablePaths 限定;set/patch 增量或整体) / read / write_todos + update_todo(规划)。
|
|
10013
10026
|
|
|
@@ -10061,7 +10074,7 @@ ${`- 输出形态:完整、自包含的 HTML 页面(.${r},可独立成页)`}
|
|
|
10061
10074
|
- 一次想清楚 → 动手 → 验证 → 收口。**思考是手段不是目的,产出代码才是**。
|
|
10062
10075
|
8. **收口格式(必守,最后一行)**:收口回复 = 简短结果总结 + **末行交接笔记** \`[note] <一句话实现要点>\` —— 关键设计决策 / 用户偏好 / 踩坑(如「[note] 液面用 height keyframes 4.2s 循环;装饰仅灯串+光斑 2 类」)。框架只识别末尾 [note] 行存进组件、自动转交下次维护该组件的子 agent;**漏写 = 下任失去交接**(真 LLM 实测漏写率 3/4,务必末行带上)。一行内,只写可复用结论。`;
|
|
10063
10076
|
}
|
|
10064
|
-
function
|
|
10077
|
+
function Td(e, t) {
|
|
10065
10078
|
return `# HTML 完整页面生成规范
|
|
10066
10079
|
|
|
10067
10080
|
## 代码资产模型(重要)
|
|
@@ -10099,14 +10112,14 @@ function Sd(e, t) {
|
|
|
10099
10112
|
- 语义化标签(button / nav / section);图片 alt;交互可键盘聚焦
|
|
10100
10113
|
- 颜色对比达标;不只用颜色传达信息`;
|
|
10101
10114
|
}
|
|
10102
|
-
function
|
|
10115
|
+
function Ed(e = "components", t = "code") {
|
|
10103
10116
|
return {
|
|
10104
10117
|
name: "html-fragment",
|
|
10105
10118
|
description: "完整 HTML 页面生成规范:代码作为 data 资产 / vfs 工作副本 / 完整自包含可独立成页 / script+CSS 集中放置 / 可引外部 JS/CSS / validate_code 自检 / 安全底线 / 可访问性",
|
|
10106
|
-
getContent: () =>
|
|
10119
|
+
getContent: () => Td(e, t)
|
|
10107
10120
|
};
|
|
10108
10121
|
}
|
|
10109
|
-
function
|
|
10122
|
+
function Dd(e = {}) {
|
|
10110
10123
|
let t = e.vfsPrefix ?? "html/";
|
|
10111
10124
|
return ({ state: e }) => {
|
|
10112
10125
|
let n = e.files;
|
|
@@ -10114,7 +10127,7 @@ function wd(e = {}) {
|
|
|
10114
10127
|
let r = [];
|
|
10115
10128
|
for (let [e, i] of Object.entries(n)) {
|
|
10116
10129
|
if (!e.startsWith(t)) continue;
|
|
10117
|
-
let n =
|
|
10130
|
+
let n = Ju(i.content);
|
|
10118
10131
|
for (let t of n) r.push(`${e} 第 ${t.line} 行:${t.message}(${t.code})`);
|
|
10119
10132
|
}
|
|
10120
10133
|
return r.length ? {
|
|
@@ -10123,7 +10136,7 @@ function wd(e = {}) {
|
|
|
10123
10136
|
} : { ok: !0 };
|
|
10124
10137
|
};
|
|
10125
10138
|
}
|
|
10126
|
-
function
|
|
10139
|
+
function Od(e) {
|
|
10127
10140
|
let n, i, a = {
|
|
10128
10141
|
name: "html-validate-tools",
|
|
10129
10142
|
beforeAgent: (e) => {
|
|
@@ -10158,7 +10171,7 @@ function Td(e) {
|
|
|
10158
10171
|
}
|
|
10159
10172
|
let s = [];
|
|
10160
10173
|
for (let e of o) {
|
|
10161
|
-
let t =
|
|
10174
|
+
let t = Ju(e.content);
|
|
10162
10175
|
t.length && s.push(`${e.path}:\n${t.map((e) => ` 第 ${e.line} 行 ${e.message}(${e.code})`).join("\n")}`);
|
|
10163
10176
|
}
|
|
10164
10177
|
return s.length ? `❌ 格式校验未通过:\n${s.join("\n")}\n请用 vfs_edit 修正后重新调用 validate_code 复查。` : `✅ 格式校验通过(${o.map((e) => e.path).join(", ")}:标签闭合等结构合法)。`;
|
|
@@ -10176,16 +10189,16 @@ function Td(e) {
|
|
|
10176
10189
|
i = e;
|
|
10177
10190
|
}, a;
|
|
10178
10191
|
}
|
|
10179
|
-
var
|
|
10180
|
-
function
|
|
10192
|
+
var kd = 2;
|
|
10193
|
+
function Ad(e = {}) {
|
|
10181
10194
|
let { writablePaths: t, codeVfsPrefix: n = "html/", id: r = "html", description: i, planning: a = !0, summarization: o = !0, maxToolRounds: s = 12, temperature: c = .4, skills: l, extraTools: u, formatCheck: d = !0, codeField: f = "code", orchestratorPrompt: p = !0, craftNotes: m = !0, llm: h, thinkingMode: g } = e;
|
|
10182
10195
|
if (t !== void 0 && !Array.isArray(t)) throw Error("[page-agent-sdk][createHtmlSubagent] writablePaths 须为字符串数组(代码组件 data 区,如 [\"components\"])/ 省略以从 schema 自动推断");
|
|
10183
10196
|
let _ = [];
|
|
10184
|
-
a && _.push(Ja()), d && (_.push(
|
|
10197
|
+
a && _.push(Ja()), d && (_.push(Od(n)), _.push(Tl({ check: Dd({ vfsPrefix: n }) })));
|
|
10185
10198
|
let v = u ?? [], y = t?.[0] ?? "components", b = l === void 0, x = {
|
|
10186
10199
|
id: r,
|
|
10187
10200
|
description: i ?? `生成/修改纯代码组件(代码作为 data 资产,代码字段 ${f} 随 data 持久化;vfs 作工作副本;能规划(write_todos)+ 执行)。需写代码组件或灵活定制时委派`,
|
|
10188
|
-
systemPrompt:
|
|
10201
|
+
systemPrompt: wd(n, f, y),
|
|
10189
10202
|
...h ? { llm: h } : {},
|
|
10190
10203
|
...g ? { thinkingMode: g } : {},
|
|
10191
10204
|
writablePaths: t ?? [],
|
|
@@ -10198,9 +10211,9 @@ function Dd(e = {}) {
|
|
|
10198
10211
|
],
|
|
10199
10212
|
middleware: _.length ? _ : void 0,
|
|
10200
10213
|
summarization: o === !1 ? void 0 : o,
|
|
10201
|
-
maxVerifyAttempts: d ?
|
|
10214
|
+
maxVerifyAttempts: d ? kd : void 0,
|
|
10202
10215
|
temperature: c,
|
|
10203
|
-
skills: b ? [
|
|
10216
|
+
skills: b ? [Ed(y, f)] : l,
|
|
10204
10217
|
maxToolRounds: s,
|
|
10205
10218
|
tools: v.length ? v : void 0,
|
|
10206
10219
|
_codeAsset: {
|
|
@@ -10213,13 +10226,13 @@ function Dd(e = {}) {
|
|
|
10213
10226
|
}
|
|
10214
10227
|
};
|
|
10215
10228
|
return x._rebuildCodeAssetPaths = (e) => {
|
|
10216
|
-
x.systemPrompt =
|
|
10229
|
+
x.systemPrompt = wd(n, f, e), b && (x.skills = [Ed(e, f)]);
|
|
10217
10230
|
}, x;
|
|
10218
10231
|
}
|
|
10219
10232
|
//#endregion
|
|
10220
10233
|
//#region src/core/sdk/defineTool.ts
|
|
10221
|
-
function
|
|
10222
|
-
|
|
10234
|
+
function jd(e) {
|
|
10235
|
+
let t = r(async (t) => {
|
|
10223
10236
|
let n = await e.handler(t);
|
|
10224
10237
|
return typeof n == "string" ? n : JSON.stringify(n);
|
|
10225
10238
|
}, {
|
|
@@ -10227,10 +10240,11 @@ function Od(e) {
|
|
|
10227
10240
|
description: e.description,
|
|
10228
10241
|
schema: e.schema
|
|
10229
10242
|
});
|
|
10243
|
+
return e.writeCapable !== void 0 && (t.writeCapable = e.writeCapable), t;
|
|
10230
10244
|
}
|
|
10231
10245
|
//#endregion
|
|
10232
10246
|
//#region src/core/sdk/inspectContextTool.ts
|
|
10233
|
-
var
|
|
10247
|
+
var Md = t.object({
|
|
10234
10248
|
path: t.string().optional().describe("分类 key 过滤(如 toolResults/history/systemPrompt/dataHint);不传=全部分类"),
|
|
10235
10249
|
role: t.enum([
|
|
10236
10250
|
"user",
|
|
@@ -10240,11 +10254,11 @@ var kd = t.object({
|
|
|
10240
10254
|
]).optional().describe("聚焦每轮首句的角色(assistant→回复摘要,user→问题摘要);不影响工具列表"),
|
|
10241
10255
|
limit: t.number().int().min(1).max(50).optional().describe("返回最近 N 轮(默认全部;超 50 自动截最近 50 防返回过大)")
|
|
10242
10256
|
});
|
|
10243
|
-
function
|
|
10244
|
-
return
|
|
10257
|
+
function Nd(e) {
|
|
10258
|
+
return jd({
|
|
10245
10259
|
name: "inspect_context",
|
|
10246
10260
|
description: "查看当前对话上下文的构成(供压缩决策)。返回:totalTokens(历史轮次 token 总和,与触发判断同口径)、occupancy(窗口占用比)、contextWindow、categories(分类占用)、rounds(每轮 token/工具/首句)。先调用本工具查看构成,再决定压缩策略。",
|
|
10247
|
-
schema:
|
|
10261
|
+
schema: Md,
|
|
10248
10262
|
handler: (t) => {
|
|
10249
10263
|
let n = lc(e.getMessages()), r = n.length > 50 ? n.slice(n.length - 50) : n, i = (t.limit && r.length > t.limit ? r.slice(r.length - t.limit) : r).map((e) => {
|
|
10250
10264
|
let n = xc(e), r = dc(e), i = t.role === "assistant" ? e.assistantMsgs[0] ?? e.userMsg : e.userMsg, a = uc(typeof i.content == "string" ? i.content : "", 60);
|
|
@@ -10267,7 +10281,7 @@ function Ad(e) {
|
|
|
10267
10281
|
}
|
|
10268
10282
|
//#endregion
|
|
10269
10283
|
//#region src/core/sdk/compressDecision.ts
|
|
10270
|
-
var
|
|
10284
|
+
var Pd = t.object({
|
|
10271
10285
|
keepRounds: t.number().int().min(0).max(50).optional(),
|
|
10272
10286
|
windowRatio: t.number().min(0).max(1).optional(),
|
|
10273
10287
|
summarize: t.object({ mode: t.enum(["index", "llm"]) }),
|
|
@@ -10277,23 +10291,23 @@ var jd = t.object({
|
|
|
10277
10291
|
}).refine((e) => e.keepRounds !== void 0 || e.windowRatio !== void 0, { message: "keepRounds 与 windowRatio 至少填一个(按当前触发模式)" });
|
|
10278
10292
|
//#endregion
|
|
10279
10293
|
//#region src/core/sdk/llmResolver.ts
|
|
10280
|
-
function
|
|
10294
|
+
function Fd(e) {
|
|
10281
10295
|
let t = e.find((e) => e.role === "user");
|
|
10282
10296
|
if (!t) return;
|
|
10283
10297
|
let n = t.content, r = (typeof n == "string" ? n : Array.isArray(n) ? n.map((e) => typeof e == "string" ? e : e?.text ?? "").join("") : String(n ?? "")).trim().replace(/[\n\r]+/g, " ");
|
|
10284
10298
|
if (r) return r.length > 30 ? r.slice(0, 30) + "…" : r;
|
|
10285
10299
|
}
|
|
10286
|
-
function
|
|
10300
|
+
function Id(e) {
|
|
10287
10301
|
return !!e && typeof e == "object" && typeof e.invoke == "function" && typeof e.stream == "function";
|
|
10288
10302
|
}
|
|
10289
|
-
function
|
|
10303
|
+
function Ld(e) {
|
|
10290
10304
|
let t = e.content;
|
|
10291
10305
|
return typeof t == "string" ? t : Array.isArray(t) ? t.map((e) => typeof e == "string" ? e : e?.text ?? "").join("") : String(t ?? "");
|
|
10292
10306
|
}
|
|
10293
|
-
function
|
|
10307
|
+
function Rd(e) {
|
|
10294
10308
|
let t = e.summaryLlm ?? e.llm;
|
|
10295
10309
|
if (!t) return;
|
|
10296
|
-
let n = e.summaryTemperature ?? .3, r = e.summaryMaxTokens ?? 1024, i = e.summaryTimeoutMs ?? 15e3, s =
|
|
10310
|
+
let n = e.summaryTemperature ?? .3, r = e.summaryMaxTokens ?? 1024, i = e.summaryTimeoutMs ?? 15e3, s = Id(t) ? t : null, c = Id(t) ? null : t;
|
|
10297
10311
|
if (c && !c.apiKey) {
|
|
10298
10312
|
e.summaryLlm && console.warn("[page-agent-sdk][summarization] summaryLlm 已配置但缺 apiKey,摘要回退主 agent 模型或零成本索引摘要");
|
|
10299
10313
|
return;
|
|
@@ -10305,16 +10319,16 @@ function Fd(e) {
|
|
|
10305
10319
|
return !l && c && (l = await h(c, {
|
|
10306
10320
|
temperature: n,
|
|
10307
10321
|
maxTokens: r
|
|
10308
|
-
})),
|
|
10322
|
+
})), Ld(await l.invoke([new o("你是对话历史压缩助手。把下面按轮次索引的对话要点,改写成一段连贯、紧凑的中文摘要,保留关键事实、用户意图与已用工具,不要编造。直接输出摘要正文。"), new a(e)], { signal: t.signal })).trim();
|
|
10309
10323
|
} finally {
|
|
10310
10324
|
clearTimeout(s);
|
|
10311
10325
|
}
|
|
10312
10326
|
};
|
|
10313
10327
|
}
|
|
10314
|
-
function
|
|
10328
|
+
function zd(e) {
|
|
10315
10329
|
let t = e.titleLlm ?? e.summaryLlm ?? e.llm;
|
|
10316
10330
|
if (!t) return;
|
|
10317
|
-
let n =
|
|
10331
|
+
let n = Id(t) ? t : null, r = Id(t) ? null : t;
|
|
10318
10332
|
if (r && !r.apiKey) return;
|
|
10319
10333
|
let i = n;
|
|
10320
10334
|
return async (t) => {
|
|
@@ -10325,7 +10339,7 @@ function Id(e) {
|
|
|
10325
10339
|
maxTokens: 30
|
|
10326
10340
|
}));
|
|
10327
10341
|
let t = await i.invoke([new o(e.i18n?.locale === "en-US" ? "Generate a short English title (max 10 words) summarizing the conversation below. Output the title text only, no quotes or punctuation." : "根据以下对话的主旨,生成一个简短的中文标题(不超过15个字,不要标点和引号,直接输出标题文字)。"), new a(n)], { signal: s.signal }), c = e.i18n?.locale === "en-US" ? 60 : 20;
|
|
10328
|
-
return
|
|
10342
|
+
return Ld(t).trim().replace(/^["'""「『]|["'""」』]$/g, "").split("\n")[0].slice(0, c);
|
|
10329
10343
|
} catch {
|
|
10330
10344
|
return "";
|
|
10331
10345
|
} finally {
|
|
@@ -10333,10 +10347,10 @@ function Id(e) {
|
|
|
10333
10347
|
}
|
|
10334
10348
|
};
|
|
10335
10349
|
}
|
|
10336
|
-
function
|
|
10350
|
+
function Bd() {
|
|
10337
10351
|
return `call_dec_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
10338
10352
|
}
|
|
10339
|
-
function
|
|
10353
|
+
function Vd(e) {
|
|
10340
10354
|
let t = e.match(/```(?:json)?\s*([\s\S]*?)```/), n = t ? t[1] : e, r = n.indexOf("{"), i = n.lastIndexOf("}");
|
|
10341
10355
|
if (r < 0 || i < 0 || i <= r) return null;
|
|
10342
10356
|
try {
|
|
@@ -10345,21 +10359,21 @@ function Rd(e) {
|
|
|
10345
10359
|
return null;
|
|
10346
10360
|
}
|
|
10347
10361
|
}
|
|
10348
|
-
function
|
|
10362
|
+
function Hd(e) {
|
|
10349
10363
|
if (!e) return null;
|
|
10350
|
-
let t =
|
|
10364
|
+
let t = Vd(e);
|
|
10351
10365
|
if (t == null) return null;
|
|
10352
|
-
let n =
|
|
10366
|
+
let n = Pd.safeParse(t);
|
|
10353
10367
|
return n.success ? n.data : null;
|
|
10354
10368
|
}
|
|
10355
|
-
async function
|
|
10369
|
+
async function Ud(e, t, n, r) {
|
|
10356
10370
|
let i = [...n];
|
|
10357
10371
|
for (let n = 0; n < 3; n++) {
|
|
10358
10372
|
let n = await e.invoke(i, { signal: r }), a = n?.tool_calls ?? [];
|
|
10359
|
-
if (!a.length) return
|
|
10373
|
+
if (!a.length) return Ld(n).trim();
|
|
10360
10374
|
i = [...i, n];
|
|
10361
10375
|
for (let e of a) {
|
|
10362
|
-
let n = e.id ??
|
|
10376
|
+
let n = e.id ?? Bd();
|
|
10363
10377
|
try {
|
|
10364
10378
|
let r = await t.invoke(e.args ?? {}), a = typeof r == "string" ? r : r?.content ?? JSON.stringify(r);
|
|
10365
10379
|
i = [...i, new s({
|
|
@@ -10376,10 +10390,10 @@ async function Bd(e, t, n, r) {
|
|
|
10376
10390
|
}
|
|
10377
10391
|
return "";
|
|
10378
10392
|
}
|
|
10379
|
-
function
|
|
10393
|
+
function Wd(e) {
|
|
10380
10394
|
let t = e.summaryLlm ?? e.llm;
|
|
10381
10395
|
if (!t) return;
|
|
10382
|
-
let n =
|
|
10396
|
+
let n = Id(t) ? t : null, r = Id(t) ? null : t;
|
|
10383
10397
|
if (r && !r.apiKey) return;
|
|
10384
10398
|
let i = e.decisionTimeoutMs ?? 6e3, s = e.decisionMaxTokens ?? 2048, c = n;
|
|
10385
10399
|
return async (e) => {
|
|
@@ -10391,12 +10405,12 @@ function Vd(e) {
|
|
|
10391
10405
|
}));
|
|
10392
10406
|
let n = c;
|
|
10393
10407
|
if (typeof n.bindTools != "function") return null;
|
|
10394
|
-
let i =
|
|
10408
|
+
let i = Nd({
|
|
10395
10409
|
getMessages: e.getMessages,
|
|
10396
10410
|
getSnapshot: e.getSnapshot,
|
|
10397
10411
|
contextWindow: e.contextWindow
|
|
10398
10412
|
}), l = n.bindTools([i]), u = e.triggerMode === "token" ? "token 模式:必填 windowRatio(0~1 保留窗口预算比例,如 0.4);keepRounds 可选" : "轮数模式:必填 keepRounds(保留最近几轮,如 6);windowRatio 可选", d = [new o(`你是对话历史压缩决策助手。当前触发模式 = ${e.triggerMode}(${e.triggerReason})。先调用 inspect_context 查看上下文构成,再输出压缩决策 JSON。${u}。仅输出 JSON,不要多余文字/markdown。schema:{keepRounds?(int 0-50), windowRatio?(0-1), summarize:{mode:"index"|"llm"}, recallTopK?(int 0-10), preserveTools?(string[]≤10), reason?(≤200字)}。keepRounds/windowRatio 至少填一个。`), new a(`触发原因:${e.triggerReason}\n上下文窗口:${e.contextWindow ?? "未知"} tokens\n阈值比例:${e.thresholdRatio ?? "未知"}\n\n请决策压缩策略(先 inspect_context 查看,再输出 JSON)。`)];
|
|
10399
|
-
return
|
|
10413
|
+
return Hd(await Ud(l, i, d, t.signal)) || Hd(await Ud(l, i, [...d, new a("上一次输出无效(JSON 解析失败或 schema 校验不通过)。请只输出符合 schema 的压缩决策 JSON,不要多余文字/markdown 代码块。")], t.signal));
|
|
10400
10414
|
} catch {
|
|
10401
10415
|
return null;
|
|
10402
10416
|
} finally {
|
|
@@ -10404,8 +10418,8 @@ function Vd(e) {
|
|
|
10404
10418
|
}
|
|
10405
10419
|
};
|
|
10406
10420
|
}
|
|
10407
|
-
function
|
|
10408
|
-
let t = e.llm, n =
|
|
10421
|
+
function Gd(e) {
|
|
10422
|
+
let t = e.llm, n = Id(e.llm) ? void 0 : e.llm;
|
|
10409
10423
|
return {
|
|
10410
10424
|
modelCaps: Ci({
|
|
10411
10425
|
model: n?.model ?? t?.model ?? t?.modelName,
|
|
@@ -10413,14 +10427,14 @@ function Hd(e) {
|
|
|
10413
10427
|
maxOutputTokens: e.maxOutputTokens ?? n?.maxOutputTokens ?? t?.maxOutputTokens,
|
|
10414
10428
|
vision: n?.vision ?? t?.vision
|
|
10415
10429
|
}),
|
|
10416
|
-
summaryLlmInvoke:
|
|
10417
|
-
titleLlmInvoke:
|
|
10418
|
-
compressDecisionInvoke:
|
|
10430
|
+
summaryLlmInvoke: Rd(e),
|
|
10431
|
+
titleLlmInvoke: zd(e),
|
|
10432
|
+
compressDecisionInvoke: Wd(e)
|
|
10419
10433
|
};
|
|
10420
10434
|
}
|
|
10421
10435
|
//#endregion
|
|
10422
10436
|
//#region src/core/sdk/conflictManager.ts
|
|
10423
|
-
function
|
|
10437
|
+
function Kd(e, t) {
|
|
10424
10438
|
let n = /* @__PURE__ */ jt(null), r = 0;
|
|
10425
10439
|
function i(i) {
|
|
10426
10440
|
let a = t?.() ?? "ask";
|
|
@@ -10464,7 +10478,7 @@ function Ud(e, t) {
|
|
|
10464
10478
|
}
|
|
10465
10479
|
//#endregion
|
|
10466
10480
|
//#region src/core/utils/id.ts
|
|
10467
|
-
function
|
|
10481
|
+
function qd() {
|
|
10468
10482
|
try {
|
|
10469
10483
|
if (typeof crypto < "u" && typeof crypto.randomUUID == "function") return crypto.randomUUID();
|
|
10470
10484
|
} catch {}
|
|
@@ -10472,7 +10486,7 @@ function Wd() {
|
|
|
10472
10486
|
}
|
|
10473
10487
|
//#endregion
|
|
10474
10488
|
//#region src/core/backends/storage.ts
|
|
10475
|
-
var
|
|
10489
|
+
var Jd = "chat-sdk", Yd = 50 * 1024 * 1024, Xd = 4 * 1024 * 1024, Zd = 10 * 1024 * 1024, Qd = .9, $d = 500, ef = 300, tf = "__meta__", nf = "v:1", rf = [
|
|
10476
10490
|
"messages",
|
|
10477
10491
|
"vfs",
|
|
10478
10492
|
"todos",
|
|
@@ -10484,51 +10498,51 @@ var Gd = "chat-sdk", Kd = 50 * 1024 * 1024, qd = 4 * 1024 * 1024, Jd = 10 * 1024
|
|
|
10484
10498
|
"focus",
|
|
10485
10499
|
"planConfirmation"
|
|
10486
10500
|
];
|
|
10487
|
-
function
|
|
10488
|
-
return e === "local" || e === "session" ?
|
|
10501
|
+
function af(e) {
|
|
10502
|
+
return e === "local" || e === "session" ? Xd : Yd;
|
|
10489
10503
|
}
|
|
10490
|
-
function
|
|
10504
|
+
function of(e) {
|
|
10491
10505
|
if (typeof e != "object" || !e) return !1;
|
|
10492
10506
|
let t = e;
|
|
10493
10507
|
return t.name === "QuotaExceededError" || t.name === "NS_ERROR_DOM_QUOTA_REACHED" || t.code === 22 || t.code === 1014;
|
|
10494
10508
|
}
|
|
10495
|
-
function
|
|
10509
|
+
function sf(e, t, n, r) {
|
|
10496
10510
|
return [
|
|
10497
|
-
|
|
10511
|
+
nf,
|
|
10498
10512
|
e,
|
|
10499
10513
|
t,
|
|
10500
10514
|
n,
|
|
10501
10515
|
r
|
|
10502
10516
|
].join("::");
|
|
10503
10517
|
}
|
|
10504
|
-
function
|
|
10518
|
+
function cf(e, t, n) {
|
|
10505
10519
|
return [
|
|
10506
|
-
|
|
10520
|
+
nf,
|
|
10507
10521
|
e,
|
|
10508
10522
|
t,
|
|
10509
10523
|
n
|
|
10510
10524
|
].join("::") + "::";
|
|
10511
10525
|
}
|
|
10512
|
-
function
|
|
10526
|
+
function lf(e, t) {
|
|
10513
10527
|
return [
|
|
10514
|
-
|
|
10528
|
+
nf,
|
|
10515
10529
|
e,
|
|
10516
10530
|
t
|
|
10517
10531
|
].join("::") + "::";
|
|
10518
10532
|
}
|
|
10519
|
-
function
|
|
10520
|
-
return [
|
|
10533
|
+
function uf(e) {
|
|
10534
|
+
return [nf, e].join("::") + "::";
|
|
10521
10535
|
}
|
|
10522
|
-
var
|
|
10523
|
-
function
|
|
10524
|
-
|
|
10536
|
+
var df = null;
|
|
10537
|
+
function ff(e) {
|
|
10538
|
+
df ||= new TextEncoder();
|
|
10525
10539
|
try {
|
|
10526
|
-
return
|
|
10540
|
+
return df.encode(JSON.stringify(e)).length;
|
|
10527
10541
|
} catch {
|
|
10528
10542
|
return 0;
|
|
10529
10543
|
}
|
|
10530
10544
|
}
|
|
10531
|
-
function
|
|
10545
|
+
function pf(e, t, n) {
|
|
10532
10546
|
let r = e.reduce((e, t) => e + t.bytes, 0);
|
|
10533
10547
|
if (r <= t) return [];
|
|
10534
10548
|
let i = t * n, a = [...e].sort((e, t) => e.lastAccessed - t.lastAccessed), o = [];
|
|
@@ -10538,7 +10552,7 @@ function uf(e, t, n) {
|
|
|
10538
10552
|
}
|
|
10539
10553
|
return o;
|
|
10540
10554
|
}
|
|
10541
|
-
function
|
|
10555
|
+
function mf() {
|
|
10542
10556
|
let e = /* @__PURE__ */ new Map();
|
|
10543
10557
|
return {
|
|
10544
10558
|
async get(t) {
|
|
@@ -10558,7 +10572,7 @@ function df() {
|
|
|
10558
10572
|
}
|
|
10559
10573
|
};
|
|
10560
10574
|
}
|
|
10561
|
-
function
|
|
10575
|
+
function hf(e) {
|
|
10562
10576
|
return new Promise((t, n) => {
|
|
10563
10577
|
if (typeof indexedDB > "u") {
|
|
10564
10578
|
n(/* @__PURE__ */ Error("indexedDB 不可用"));
|
|
@@ -10619,7 +10633,7 @@ function ff(e) {
|
|
|
10619
10633
|
}, r.onerror = () => n(r.error);
|
|
10620
10634
|
});
|
|
10621
10635
|
}
|
|
10622
|
-
function
|
|
10636
|
+
function gf(e) {
|
|
10623
10637
|
return {
|
|
10624
10638
|
async get(t) {
|
|
10625
10639
|
let n = e.getItem(t);
|
|
@@ -10664,12 +10678,12 @@ function pf(e) {
|
|
|
10664
10678
|
}
|
|
10665
10679
|
};
|
|
10666
10680
|
}
|
|
10667
|
-
function
|
|
10681
|
+
function _f(e, t, n) {
|
|
10668
10682
|
let r = (e.get(t) ?? Promise.resolve()).then(n, n);
|
|
10669
10683
|
return e.set(t, r.then(() => void 0, () => void 0)), r;
|
|
10670
10684
|
}
|
|
10671
|
-
function
|
|
10672
|
-
let t = e.dbName ??
|
|
10685
|
+
function vf(e = {}) {
|
|
10686
|
+
let t = e.dbName ?? Jd, n = e.backend ?? "indexed", r = e.maxBytes ?? af(n), i = e.maxBytesPerSession ?? Zd, a = e.evictionWatermark ?? Qd, o = e.debounceMs ?? $d, s = /* @__PURE__ */ new Set();
|
|
10673
10687
|
function c(e) {
|
|
10674
10688
|
for (let t of s) try {
|
|
10675
10689
|
t(e);
|
|
@@ -10682,16 +10696,16 @@ function hf(e = {}) {
|
|
|
10682
10696
|
try {
|
|
10683
10697
|
if (n === "indexed") {
|
|
10684
10698
|
if (typeof indexedDB > "u") throw Error("indexedDB 不可用");
|
|
10685
|
-
l = await
|
|
10699
|
+
l = await hf(t), d(!0);
|
|
10686
10700
|
} else if (n === "session") {
|
|
10687
10701
|
if (typeof sessionStorage > "u") throw Error("sessionStorage 不可用");
|
|
10688
|
-
l =
|
|
10702
|
+
l = gf(sessionStorage), d(!0);
|
|
10689
10703
|
} else if (n === "local") {
|
|
10690
10704
|
if (typeof localStorage > "u") throw Error("localStorage 不可用");
|
|
10691
|
-
l =
|
|
10692
|
-
} else l =
|
|
10705
|
+
l = gf(localStorage), d(!0);
|
|
10706
|
+
} else l = mf(), d(!1);
|
|
10693
10707
|
} catch (e) {
|
|
10694
|
-
l =
|
|
10708
|
+
l = mf();
|
|
10695
10709
|
let t = e instanceof Error ? e.message : String(e);
|
|
10696
10710
|
d(!1), Promise.resolve().then(() => c({
|
|
10697
10711
|
type: "degraded",
|
|
@@ -10701,10 +10715,10 @@ function hf(e = {}) {
|
|
|
10701
10715
|
})();
|
|
10702
10716
|
let p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
|
|
10703
10717
|
function g(e, n, r, a) {
|
|
10704
|
-
let o =
|
|
10705
|
-
return
|
|
10718
|
+
let o = sf(t, r, a, tf);
|
|
10719
|
+
return _f(h, o, async () => {
|
|
10706
10720
|
let t = async () => {
|
|
10707
|
-
let t = await l.get(o), s = await l.get(e), u = s == null ? 0 :
|
|
10721
|
+
let t = await l.get(o), s = await l.get(e), u = s == null ? 0 : ff(s), d = ff(n), f = (t?.bytes ?? 0) + (d - u);
|
|
10708
10722
|
if (f > i) {
|
|
10709
10723
|
c({
|
|
10710
10724
|
type: "quota",
|
|
@@ -10726,12 +10740,12 @@ function hf(e = {}) {
|
|
|
10726
10740
|
try {
|
|
10727
10741
|
await t();
|
|
10728
10742
|
} catch (e) {
|
|
10729
|
-
if (
|
|
10743
|
+
if (of(e) && !u) {
|
|
10730
10744
|
u = !0;
|
|
10731
10745
|
try {
|
|
10732
10746
|
await b();
|
|
10733
10747
|
} catch {}
|
|
10734
|
-
l =
|
|
10748
|
+
l = mf(), Promise.resolve().then(() => c({
|
|
10735
10749
|
type: "degraded",
|
|
10736
10750
|
reason: "存储配额超限(QuotaExceededError),已淘汰最旧会话并降级内存"
|
|
10737
10751
|
}));
|
|
@@ -10743,7 +10757,7 @@ function hf(e = {}) {
|
|
|
10743
10757
|
});
|
|
10744
10758
|
}
|
|
10745
10759
|
function _(e, n, r, i) {
|
|
10746
|
-
let a =
|
|
10760
|
+
let a = sf(t, e, n, r), s = p.get(a);
|
|
10747
10761
|
s && s.resolve();
|
|
10748
10762
|
let c = m.get(a);
|
|
10749
10763
|
return c && clearTimeout(c), new Promise((t) => {
|
|
@@ -10770,15 +10784,15 @@ function hf(e = {}) {
|
|
|
10770
10784
|
function y() {
|
|
10771
10785
|
v ||= setTimeout(() => {
|
|
10772
10786
|
v = null, b();
|
|
10773
|
-
},
|
|
10787
|
+
}, ef);
|
|
10774
10788
|
}
|
|
10775
10789
|
async function b() {
|
|
10776
10790
|
let e = [];
|
|
10777
|
-
await l.scan(
|
|
10791
|
+
await l.scan(uf(t), (t, n) => {
|
|
10778
10792
|
t.endsWith("::__meta__") && e.push(n);
|
|
10779
10793
|
});
|
|
10780
|
-
let n =
|
|
10781
|
-
for (let e of n) await l.clearPrefix(
|
|
10794
|
+
let n = pf(e, r, a);
|
|
10795
|
+
for (let e of n) await l.clearPrefix(cf(t, e.agentId, e.sessionId)), c({
|
|
10782
10796
|
type: "evicted",
|
|
10783
10797
|
agentId: e.agentId,
|
|
10784
10798
|
sessionId: e.sessionId,
|
|
@@ -10789,13 +10803,13 @@ function hf(e = {}) {
|
|
|
10789
10803
|
ready: f,
|
|
10790
10804
|
async listSessions(e) {
|
|
10791
10805
|
let n = [];
|
|
10792
|
-
return await l.scan(
|
|
10806
|
+
return await l.scan(lf(t, e), (e, t) => {
|
|
10793
10807
|
e.endsWith("::__meta__") && n.push(t);
|
|
10794
10808
|
}), n.sort((e, t) => t.lastAccessed - e.lastAccessed);
|
|
10795
10809
|
},
|
|
10796
10810
|
async load(e, n) {
|
|
10797
|
-
let r =
|
|
10798
|
-
return await
|
|
10811
|
+
let r = sf(t, e, n, tf);
|
|
10812
|
+
return await _f(h, r, async () => {
|
|
10799
10813
|
let i = await l.get(r);
|
|
10800
10814
|
if (!i) return;
|
|
10801
10815
|
let a = {
|
|
@@ -10804,8 +10818,8 @@ function hf(e = {}) {
|
|
|
10804
10818
|
todos: [],
|
|
10805
10819
|
memory: ""
|
|
10806
10820
|
};
|
|
10807
|
-
for (let r of
|
|
10808
|
-
let i = await l.get(
|
|
10821
|
+
for (let r of rf) {
|
|
10822
|
+
let i = await l.get(sf(t, e, n, r));
|
|
10809
10823
|
i != null && (a[r] = i);
|
|
10810
10824
|
}
|
|
10811
10825
|
return i.lastAccessed = Date.now(), await l.set(r, i), a;
|
|
@@ -10813,12 +10827,12 @@ function hf(e = {}) {
|
|
|
10813
10827
|
},
|
|
10814
10828
|
async save(e, t, n) {
|
|
10815
10829
|
let r = [];
|
|
10816
|
-
for (let i of
|
|
10830
|
+
for (let i of rf) n[i] !== void 0 && r.push(_(e, t, i, n[i]));
|
|
10817
10831
|
await Promise.all(r);
|
|
10818
10832
|
},
|
|
10819
10833
|
async updateTitle(e, n, r) {
|
|
10820
|
-
let i =
|
|
10821
|
-
return
|
|
10834
|
+
let i = sf(t, e, n, tf);
|
|
10835
|
+
return _f(h, i, async () => {
|
|
10822
10836
|
let e = await l.get(i);
|
|
10823
10837
|
e && (e.title = r, e.lastAccessed = Date.now(), await l.set(i, e));
|
|
10824
10838
|
});
|
|
@@ -10834,13 +10848,13 @@ function hf(e = {}) {
|
|
|
10834
10848
|
})), c({ type: "flush" }), await b();
|
|
10835
10849
|
},
|
|
10836
10850
|
async deleteSession(e, n) {
|
|
10837
|
-
let r =
|
|
10851
|
+
let r = cf(t, e, n);
|
|
10838
10852
|
for (let [e, t] of p.entries()) e.startsWith(r) && (t.resolve(), p.delete(e));
|
|
10839
10853
|
for (let [e, t] of m.entries()) e.startsWith(r) && (clearTimeout(t), m.delete(e));
|
|
10840
10854
|
await l.clearPrefix(r);
|
|
10841
10855
|
},
|
|
10842
10856
|
async createSession(e, n, r) {
|
|
10843
|
-
let i = r ??
|
|
10857
|
+
let i = r ?? qd(), a = Date.now(), o = {
|
|
10844
10858
|
agentId: e,
|
|
10845
10859
|
sessionId: i,
|
|
10846
10860
|
createdAt: a,
|
|
@@ -10848,7 +10862,7 @@ function hf(e = {}) {
|
|
|
10848
10862
|
bytes: 0,
|
|
10849
10863
|
title: n
|
|
10850
10864
|
};
|
|
10851
|
-
return await l.set(
|
|
10865
|
+
return await l.set(sf(t, e, i, tf), o), i;
|
|
10852
10866
|
},
|
|
10853
10867
|
onEvent(e) {
|
|
10854
10868
|
s.add(e);
|
|
@@ -10863,15 +10877,15 @@ function hf(e = {}) {
|
|
|
10863
10877
|
}
|
|
10864
10878
|
//#endregion
|
|
10865
10879
|
//#region src/core/sdk/optionsResolver.ts
|
|
10866
|
-
function
|
|
10867
|
-
return e === void 0 ?
|
|
10880
|
+
function yf(e) {
|
|
10881
|
+
return e === void 0 ? vf({ backend: "memory" }) : e === !1 ? null : typeof e == "string" ? vf({ backend: e }) : e.enabled === !1 ? null : vf(e);
|
|
10868
10882
|
}
|
|
10869
|
-
function
|
|
10883
|
+
function bf(e) {
|
|
10870
10884
|
return e.dialog ?? {};
|
|
10871
10885
|
}
|
|
10872
10886
|
//#endregion
|
|
10873
10887
|
//#region src/core/capabilities.ts
|
|
10874
|
-
var
|
|
10888
|
+
var xf = [
|
|
10875
10889
|
{
|
|
10876
10890
|
name: "dataOps",
|
|
10877
10891
|
defaultOn: !0
|
|
@@ -10964,13 +10978,13 @@ var vf = [
|
|
|
10964
10978
|
defaultOn: !1
|
|
10965
10979
|
}
|
|
10966
10980
|
];
|
|
10967
|
-
function
|
|
10981
|
+
function Sf(e) {
|
|
10968
10982
|
let t = {};
|
|
10969
|
-
for (let n of
|
|
10983
|
+
for (let n of xf) {
|
|
10970
10984
|
let r = e?.[n.name];
|
|
10971
10985
|
t[n.name] = n.defaultOn ? r !== !1 : r === !0;
|
|
10972
10986
|
}
|
|
10973
|
-
for (let e of
|
|
10987
|
+
for (let e of xf) if (e.requires && t[e.name]) {
|
|
10974
10988
|
for (let n of e.requires) if (!t[n]) {
|
|
10975
10989
|
t[e.name] = !1;
|
|
10976
10990
|
break;
|
|
@@ -10980,7 +10994,7 @@ function yf(e) {
|
|
|
10980
10994
|
}
|
|
10981
10995
|
//#endregion
|
|
10982
10996
|
//#region src/core/sdk/events.ts
|
|
10983
|
-
function
|
|
10997
|
+
function Cf(e) {
|
|
10984
10998
|
let t = /* @__PURE__ */ new Set(), n = (n) => {
|
|
10985
10999
|
if (n.type !== "approval_request") {
|
|
10986
11000
|
if (e) try {
|
|
@@ -11006,7 +11020,7 @@ function bf(e) {
|
|
|
11006
11020
|
}
|
|
11007
11021
|
//#endregion
|
|
11008
11022
|
//#region src/core/sdk/contextPreset.ts
|
|
11009
|
-
var
|
|
11023
|
+
var wf = {
|
|
11010
11024
|
auto: {
|
|
11011
11025
|
summaryThresholdRatio: .5,
|
|
11012
11026
|
windowRatio: .4,
|
|
@@ -11034,7 +11048,7 @@ var xf = {
|
|
|
11034
11048
|
enableRecall: !0,
|
|
11035
11049
|
enableLLMSummary: !0
|
|
11036
11050
|
}
|
|
11037
|
-
},
|
|
11051
|
+
}, Tf = {
|
|
11038
11052
|
auto: ["describe_data", "read"],
|
|
11039
11053
|
conservative: ["describe_data"],
|
|
11040
11054
|
aggressive: ["describe_data", "read"],
|
|
@@ -11045,8 +11059,8 @@ var xf = {
|
|
|
11045
11059
|
"search_data"
|
|
11046
11060
|
]
|
|
11047
11061
|
};
|
|
11048
|
-
function
|
|
11049
|
-
let n =
|
|
11062
|
+
function Ef(e, t) {
|
|
11063
|
+
let n = wf[e.contextPreset ?? "auto"] ?? {}, r = e.contextOptions === !1 ? {} : e.contextOptions ?? {};
|
|
11050
11064
|
return {
|
|
11051
11065
|
...n,
|
|
11052
11066
|
...r,
|
|
@@ -11056,7 +11070,7 @@ function Cf(e, t) {
|
|
|
11056
11070
|
}
|
|
11057
11071
|
//#endregion
|
|
11058
11072
|
//#region src/core/sdk/middlewareStack.ts
|
|
11059
|
-
var
|
|
11073
|
+
var Df = {
|
|
11060
11074
|
dataHint: 10,
|
|
11061
11075
|
usageHints: 20,
|
|
11062
11076
|
todos: 30,
|
|
@@ -11073,17 +11087,17 @@ var wf = {
|
|
|
11073
11087
|
subagents: 140,
|
|
11074
11088
|
augmentSystem: 150
|
|
11075
11089
|
};
|
|
11076
|
-
function
|
|
11090
|
+
function Of(e) {
|
|
11077
11091
|
return e.map((e, t) => ({
|
|
11078
11092
|
m: e,
|
|
11079
11093
|
i: t,
|
|
11080
|
-
p:
|
|
11094
|
+
p: Df[e.name] ?? Infinity
|
|
11081
11095
|
})).sort((e, t) => e.p - t.p || e.i - t.i).map((e) => e.m);
|
|
11082
11096
|
}
|
|
11083
11097
|
//#endregion
|
|
11084
11098
|
//#region src/core/tools/fetchDoc.ts
|
|
11085
|
-
var
|
|
11086
|
-
let n = new AbortController(), r = setTimeout(() => n.abort(),
|
|
11099
|
+
var kf = 3e4, Af = [r(async ({ url: e, as: t }) => {
|
|
11100
|
+
let n = new AbortController(), r = setTimeout(() => n.abort(), kf);
|
|
11087
11101
|
try {
|
|
11088
11102
|
let r = await fetch(e, {
|
|
11089
11103
|
method: "GET",
|
|
@@ -11100,7 +11114,7 @@ var Ef = 3e4, Df = [r(async ({ url: e, as: t }) => {
|
|
|
11100
11114
|
].join("\n");
|
|
11101
11115
|
} catch (t) {
|
|
11102
11116
|
let r = t?.message || String(t);
|
|
11103
|
-
return n.signal.aborted ? `获取失败:请求超时(${
|
|
11117
|
+
return n.signal.aborted ? `获取失败:请求超时(${kf}ms,${e})。` : /Failed to fetch|NetworkError|CORS|blocked/i.test(r) ? `获取失败:可能是 CORS 跨域拦截或网络错误(${r})。浏览器仅能 GET 同源或服务端已配置 CORS 的资源;跨域抓取需后端代理。` : `获取失败:${r}`;
|
|
11104
11118
|
} finally {
|
|
11105
11119
|
clearTimeout(r);
|
|
11106
11120
|
}
|
|
@@ -11111,7 +11125,7 @@ var Ef = 3e4, Df = [r(async ({ url: e, as: t }) => {
|
|
|
11111
11125
|
url: t.string().describe("要抓取的 URL(同源或已配 CORS)"),
|
|
11112
11126
|
as: t.enum(["text", "markdown"]).optional().describe("返回格式标签,默认 text")
|
|
11113
11127
|
})
|
|
11114
|
-
})],
|
|
11128
|
+
})], jf = [
|
|
11115
11129
|
"id",
|
|
11116
11130
|
"class",
|
|
11117
11131
|
"href",
|
|
@@ -11123,12 +11137,12 @@ var Ef = 3e4, Df = [r(async ({ url: e, as: t }) => {
|
|
|
11123
11137
|
"aria-label",
|
|
11124
11138
|
"name",
|
|
11125
11139
|
"type"
|
|
11126
|
-
],
|
|
11127
|
-
function
|
|
11140
|
+
], Mf = /^(value|srcdoc|formaction|on\w+)$/i, Nf = /token|secret|password|passwd|api[-_]?key|auth|cred|csrf|session/i;
|
|
11141
|
+
function Pf(e, t) {
|
|
11128
11142
|
if (!e) return null;
|
|
11129
|
-
let { depth: n, attrs: r, includeText: i = !0 } = t, a = r !== void 0, o = r ??
|
|
11143
|
+
let { depth: n, attrs: r, includeText: i = !0 } = t, a = r !== void 0, o = r ?? jf, s = (e) => {
|
|
11130
11144
|
let t = {};
|
|
11131
|
-
for (let n of Array.from(e.attributes)) (a ? o.includes(n.name) : o.includes(n.name) || n.name.startsWith("data-")) && (
|
|
11145
|
+
for (let n of Array.from(e.attributes)) (a ? o.includes(n.name) : o.includes(n.name) || n.name.startsWith("data-")) && (Mf.test(n.name) || Nf.test(n.name) || (t[n.name] = n.value));
|
|
11132
11146
|
return t;
|
|
11133
11147
|
}, c = (e, t) => {
|
|
11134
11148
|
let n = {
|
|
@@ -11144,10 +11158,10 @@ function jf(e, t) {
|
|
|
11144
11158
|
};
|
|
11145
11159
|
return c(e, n);
|
|
11146
11160
|
}
|
|
11147
|
-
var
|
|
11161
|
+
var Ff = r(({ selector: e, depth: t, attrs: n, includeText: r }) => {
|
|
11148
11162
|
let i = e ? document.querySelector(e) : document.body;
|
|
11149
11163
|
if (!i) return `未找到匹配元素:selector="${e}"`;
|
|
11150
|
-
let a =
|
|
11164
|
+
let a = Pf(i, {
|
|
11151
11165
|
depth: t ?? 3,
|
|
11152
11166
|
attrs: n,
|
|
11153
11167
|
includeText: r ?? !0
|
|
@@ -11162,22 +11176,22 @@ var Mf = r(({ selector: e, depth: t, attrs: n, includeText: r }) => {
|
|
|
11162
11176
|
attrs: t.array(t.string()).optional().describe("属性白名单(传了 = 严格白名单;不传 = 默认常用 + data-*)"),
|
|
11163
11177
|
includeText: t.boolean().optional().describe("是否包含直接文本(默认 true)")
|
|
11164
11178
|
})
|
|
11165
|
-
}),
|
|
11166
|
-
function
|
|
11167
|
-
if (
|
|
11179
|
+
}), If = [Ff], Lf = /* @__PURE__ */ "display.position.visibility.opacity.color.background-color.background-image.font-size.font-weight.line-height.text-align.z-index.overflow.width.height.margin.padding.border.border-radius.box-shadow.transform.transition.animation.cursor.pointer-events.flex-direction.gap.max-width.min-height".split("."), Rf = /* @__PURE__ */ new WeakMap(), zf = !1;
|
|
11180
|
+
function Bf() {
|
|
11181
|
+
if (zf) return;
|
|
11168
11182
|
let e = globalThis.EventTarget;
|
|
11169
11183
|
if (!e?.prototype?.addEventListener) return;
|
|
11170
|
-
|
|
11184
|
+
zf = !0;
|
|
11171
11185
|
let t = e.prototype.addEventListener, n = e.prototype.removeEventListener;
|
|
11172
11186
|
e.prototype.addEventListener = function(e, ...n) {
|
|
11173
11187
|
try {
|
|
11174
|
-
let t =
|
|
11175
|
-
t || (t = /* @__PURE__ */ new Map(),
|
|
11188
|
+
let t = Rf.get(this);
|
|
11189
|
+
t || (t = /* @__PURE__ */ new Map(), Rf.set(this, t)), t.set(String(e), (t.get(String(e)) ?? 0) + 1);
|
|
11176
11190
|
} catch {}
|
|
11177
11191
|
return t.call(this, e, ...n);
|
|
11178
11192
|
}, e.prototype.removeEventListener = function(e, ...t) {
|
|
11179
11193
|
try {
|
|
11180
|
-
let t =
|
|
11194
|
+
let t = Rf.get(this);
|
|
11181
11195
|
if (t) {
|
|
11182
11196
|
let n = (t.get(String(e)) ?? 1) - 1;
|
|
11183
11197
|
n <= 0 ? t.delete(String(e)) : t.set(String(e), n);
|
|
@@ -11186,10 +11200,10 @@ function Lf() {
|
|
|
11186
11200
|
return n.call(this, e, ...t);
|
|
11187
11201
|
};
|
|
11188
11202
|
}
|
|
11189
|
-
function
|
|
11190
|
-
return [...
|
|
11203
|
+
function Vf(e) {
|
|
11204
|
+
return [...Rf.get(e)?.entries() ?? []].filter(([, e]) => e > 0).map(([e]) => e);
|
|
11191
11205
|
}
|
|
11192
|
-
function
|
|
11206
|
+
function Hf(e, t = 12) {
|
|
11193
11207
|
let n = [], r = e, i = 0;
|
|
11194
11208
|
for (; r && r.tagName && i < t;) {
|
|
11195
11209
|
let e = r.tagName.toLowerCase(), t = r.id;
|
|
@@ -11210,7 +11224,7 @@ function zf(e, t = 12) {
|
|
|
11210
11224
|
}
|
|
11211
11225
|
return n.join(" > ");
|
|
11212
11226
|
}
|
|
11213
|
-
function
|
|
11227
|
+
function Uf(e, t, n = {}) {
|
|
11214
11228
|
if (!e) return {
|
|
11215
11229
|
hits: [],
|
|
11216
11230
|
total: 0,
|
|
@@ -11248,7 +11262,7 @@ function Bf(e, t, n = {}) {
|
|
|
11248
11262
|
n = r.slice(Math.max(0, i - 20), i + t.length + 40);
|
|
11249
11263
|
}
|
|
11250
11264
|
return {
|
|
11251
|
-
selector:
|
|
11265
|
+
selector: Hf(e),
|
|
11252
11266
|
tag: e.tagName.toLowerCase(),
|
|
11253
11267
|
text: n.slice(0, 120)
|
|
11254
11268
|
};
|
|
@@ -11257,7 +11271,7 @@ function Bf(e, t, n = {}) {
|
|
|
11257
11271
|
truncated: a.length > o
|
|
11258
11272
|
};
|
|
11259
11273
|
}
|
|
11260
|
-
var
|
|
11274
|
+
var Wf = [
|
|
11261
11275
|
"content",
|
|
11262
11276
|
"display",
|
|
11263
11277
|
"width",
|
|
@@ -11265,14 +11279,14 @@ var Vf = [
|
|
|
11265
11279
|
"background-color",
|
|
11266
11280
|
"position"
|
|
11267
11281
|
];
|
|
11268
|
-
function
|
|
11282
|
+
function Gf(e, t = {}) {
|
|
11269
11283
|
if (!e) return null;
|
|
11270
11284
|
let n = {
|
|
11271
|
-
selector:
|
|
11285
|
+
selector: Hf(e),
|
|
11272
11286
|
tag: e.tagName.toLowerCase(),
|
|
11273
11287
|
attrs: {}
|
|
11274
11288
|
};
|
|
11275
|
-
for (let t of Array.from(e.attributes)) !(
|
|
11289
|
+
for (let t of Array.from(e.attributes)) !(jf.includes(t.name) || t.name.startsWith("data-")) || Mf.test(t.name) || Nf.test(t.name) || (n.attrs[t.name] = t.value);
|
|
11276
11290
|
let r = Array.from(e.childNodes).filter((e) => e.nodeType === 3).map((e) => e.textContent || "").join("").trim();
|
|
11277
11291
|
r && (n.text = r.slice(0, 400));
|
|
11278
11292
|
let i = String(e.innerText ?? e.textContent ?? "").trim();
|
|
@@ -11294,7 +11308,7 @@ function Hf(e, t = {}) {
|
|
|
11294
11308
|
if (typeof a != "function") return r;
|
|
11295
11309
|
try {
|
|
11296
11310
|
let i = a(e, n ?? null);
|
|
11297
|
-
for (let e of n ?
|
|
11311
|
+
for (let e of n ? Wf : t.styles ?? Lf) {
|
|
11298
11312
|
let t = typeof i.getPropertyValue == "function" ? i.getPropertyValue(e) : i[e];
|
|
11299
11313
|
t && (r[e] = String(t).slice(0, 200));
|
|
11300
11314
|
}
|
|
@@ -11312,16 +11326,16 @@ function Hf(e, t = {}) {
|
|
|
11312
11326
|
n.events = {
|
|
11313
11327
|
inline: t,
|
|
11314
11328
|
vue: r ? Object.keys(r).filter((e) => /^on[A-Z]/.test(e)).map((e) => e.slice(2).toLowerCase()) : [],
|
|
11315
|
-
captured:
|
|
11329
|
+
captured: Vf(e)
|
|
11316
11330
|
};
|
|
11317
11331
|
}
|
|
11318
11332
|
return n;
|
|
11319
11333
|
}
|
|
11320
|
-
var
|
|
11321
|
-
|
|
11334
|
+
var Kf = r(({ query: e, mode: t, limit: n, root: r }) => {
|
|
11335
|
+
Bf();
|
|
11322
11336
|
let i = r ? document.querySelector(r) : document;
|
|
11323
11337
|
if (r && !i) return `未找到 root 元素:selector="${r}"`;
|
|
11324
|
-
let a =
|
|
11338
|
+
let a = Uf(i, e, {
|
|
11325
11339
|
mode: t,
|
|
11326
11340
|
limit: n
|
|
11327
11341
|
});
|
|
@@ -11338,11 +11352,11 @@ var Uf = r(({ query: e, mode: t, limit: n, root: r }) => {
|
|
|
11338
11352
|
limit: t.number().int().min(1).max(20).optional().describe("返回上限(默认 10)"),
|
|
11339
11353
|
root: t.string().optional().describe("限定搜索范围的容器选择器(默认整页)")
|
|
11340
11354
|
})
|
|
11341
|
-
}),
|
|
11342
|
-
|
|
11355
|
+
}), qf = r(({ selector: e, styles: t, includeHtml: n, htmlLimit: r, includeEvents: i, includeRect: a, pseudo: o }) => {
|
|
11356
|
+
Bf();
|
|
11343
11357
|
let s = document.querySelector(e);
|
|
11344
11358
|
if (!s) return `未找到匹配元素:selector="${e}"(可先用 dom_search 定位)`;
|
|
11345
|
-
let c =
|
|
11359
|
+
let c = Gf(s, {
|
|
11346
11360
|
styles: t,
|
|
11347
11361
|
includeHtml: n,
|
|
11348
11362
|
htmlLimit: r,
|
|
@@ -11363,7 +11377,7 @@ var Uf = r(({ query: e, mode: t, limit: n, root: r }) => {
|
|
|
11363
11377
|
includeRect: t.boolean().optional().describe("是否含几何位置(默认 true)"),
|
|
11364
11378
|
pseudo: t.boolean().optional().describe("是否含 ::before/::after 伪元素摘要(默认 false)")
|
|
11365
11379
|
})
|
|
11366
|
-
}),
|
|
11380
|
+
}), Jf = {
|
|
11367
11381
|
name: "dom-inspect",
|
|
11368
11382
|
description: "页面 DOM 深度检视工具(dom_search 搜索元素 / dom_info 读内容·计算样式·事件绑定·几何)。定位元素、验证样式落地、排查交互绑定时加载",
|
|
11369
11383
|
getContent: () => [
|
|
@@ -11380,15 +11394,15 @@ var Uf = r(({ query: e, mode: t, limit: n, root: r }) => {
|
|
|
11380
11394
|
"## 排障套路",
|
|
11381
11395
|
"1. dom_search(mode:\"text\", query:按钮文案) 定位 → 2. dom_info(styles:[\"display\",\"background-color\",\"pointer-events\"]) 验证样式/点击性 → 3. 不符则改数据(get_dom 看结构对照)"
|
|
11382
11396
|
].join("\n"),
|
|
11383
|
-
tools: [() => [
|
|
11397
|
+
tools: [() => [Kf, qf]]
|
|
11384
11398
|
};
|
|
11385
11399
|
//#endregion
|
|
11386
11400
|
//#region src/core/tools/envTool.ts
|
|
11387
|
-
function
|
|
11401
|
+
function Yf(e) {
|
|
11388
11402
|
let t = e;
|
|
11389
11403
|
return typeof t.tagName == "string" || typeof t.nodeType == "number" && typeof t.nodeName == "string";
|
|
11390
11404
|
}
|
|
11391
|
-
function
|
|
11405
|
+
function Xf(e, t = 3, n = 2e3, r, i) {
|
|
11392
11406
|
if (e == null) return e;
|
|
11393
11407
|
if (typeof e == "string") return e.length > n ? e.slice(0, n) + "…(已截断)" : e;
|
|
11394
11408
|
if (typeof e == "number" || typeof e == "boolean") return e;
|
|
@@ -11397,14 +11411,14 @@ function qf(e, t = 3, n = 2e3, r, i) {
|
|
|
11397
11411
|
if (typeof e == "bigint") return `${e.toString()}n`;
|
|
11398
11412
|
if (typeof e != "object") return String(e);
|
|
11399
11413
|
let a = e;
|
|
11400
|
-
if (
|
|
11414
|
+
if (Yf(a)) {
|
|
11401
11415
|
let e = a;
|
|
11402
11416
|
return e.tagName ? `[Element: <${e.tagName.toLowerCase()}>]` : `[Node: ${e.nodeName}]`;
|
|
11403
11417
|
}
|
|
11404
11418
|
if (r?.has(a)) return "[Circular]";
|
|
11405
11419
|
let o = r ?? /* @__PURE__ */ new WeakSet();
|
|
11406
11420
|
if (o.add(a), Array.isArray(e)) {
|
|
11407
|
-
let r = e.slice(0, 100).map((e) =>
|
|
11421
|
+
let r = e.slice(0, 100).map((e) => Xf(e, t - 1, n, o, i));
|
|
11408
11422
|
return e.length > 100 && r.push(`…(共 ${e.length} 项,已截断)`), r;
|
|
11409
11423
|
}
|
|
11410
11424
|
if (t < 0) return "(对象,已截断)";
|
|
@@ -11417,14 +11431,14 @@ function qf(e, t = 3, n = 2e3, r, i) {
|
|
|
11417
11431
|
}
|
|
11418
11432
|
try {
|
|
11419
11433
|
let e = a[r];
|
|
11420
|
-
i?.test(r) ? s[r] = "[REDACTED]" : s[r] =
|
|
11434
|
+
i?.test(r) ? s[r] = "[REDACTED]" : s[r] = Xf(e, t - 1, n, o, i);
|
|
11421
11435
|
} catch {
|
|
11422
11436
|
s[r] = "(getter 抛错)";
|
|
11423
11437
|
}
|
|
11424
11438
|
}
|
|
11425
11439
|
return s;
|
|
11426
11440
|
}
|
|
11427
|
-
function
|
|
11441
|
+
function Zf(e) {
|
|
11428
11442
|
let t = e ?? (typeof window < "u" ? window : {}), n = t.navigator, r = t.location, i = t.document;
|
|
11429
11443
|
return {
|
|
11430
11444
|
location: {
|
|
@@ -11457,9 +11471,9 @@ function Jf(e) {
|
|
|
11457
11471
|
} : "(无 document)"
|
|
11458
11472
|
};
|
|
11459
11473
|
}
|
|
11460
|
-
var
|
|
11474
|
+
var Qf = /^(localStorage|sessionStorage|cookie|document|frames|frameElement|opener|parent|top|self|window|globalThis|closed|history|navigation|trustedTypes|origin|crossOriginIsolated)$/, $f = /token|secret|password|passwd|api[-_]?key|auth|cred|csrf|session|ticket/i, ep = r(({ key: e }) => {
|
|
11461
11475
|
if (e) {
|
|
11462
|
-
if (
|
|
11476
|
+
if (Qf.test(e) || $f.test(e)) return JSON.stringify({
|
|
11463
11477
|
key: e,
|
|
11464
11478
|
denied: !0,
|
|
11465
11479
|
reason: "安全:该 key 在 denylist(localStorage/sessionStorage/cookie/document 或敏感命名 token/secret/key/auth),不读取防泄漏"
|
|
@@ -11469,18 +11483,18 @@ var Yf = /^(localStorage|sessionStorage|cookie|document|frames|frameElement|open
|
|
|
11469
11483
|
key: e,
|
|
11470
11484
|
exists: t !== void 0,
|
|
11471
11485
|
type: typeof t,
|
|
11472
|
-
value:
|
|
11486
|
+
value: Xf(t, 3, 2e3, void 0, $f)
|
|
11473
11487
|
}, null, 2);
|
|
11474
11488
|
}
|
|
11475
|
-
return JSON.stringify(
|
|
11489
|
+
return JSON.stringify(Zf(), null, 2);
|
|
11476
11490
|
}, {
|
|
11477
11491
|
name: "inspect_env",
|
|
11478
11492
|
description: "读宿主页面环境信息(排查调试)。不传参返回摘要(URL/origin、浏览器/语言、viewport、title/readyState);传 key 读指定 window 属性值(如 key:\"appConfig\")。只读,大结果自动外存 vfs。",
|
|
11479
11493
|
schema: t.object({ key: t.string().optional().describe("要读取的 window 属性名(如 \"appConfig\"/\"__DEBUG__\");不传 = 返回环境摘要") })
|
|
11480
|
-
}),
|
|
11494
|
+
}), tp = [ep];
|
|
11481
11495
|
//#endregion
|
|
11482
11496
|
//#region src/core/harness/budget.ts
|
|
11483
|
-
function
|
|
11497
|
+
function np(e, t, n) {
|
|
11484
11498
|
let r = 0;
|
|
11485
11499
|
return {
|
|
11486
11500
|
name: "budget",
|
|
@@ -11505,12 +11519,12 @@ function $f(e, t, n) {
|
|
|
11505
11519
|
}
|
|
11506
11520
|
//#endregion
|
|
11507
11521
|
//#region src/core/sdk/actions.ts
|
|
11508
|
-
var
|
|
11509
|
-
function
|
|
11522
|
+
var rp = /^[a-zA-Z][a-zA-Z0-9_]*$/;
|
|
11523
|
+
function ip(e) {
|
|
11510
11524
|
let n = [];
|
|
11511
11525
|
for (let [i, a] of Object.entries(e)) {
|
|
11512
|
-
if (!
|
|
11513
|
-
console.warn(`[page-agent-sdk][actions] 动作名 "${i}" 非法(须匹配 ${
|
|
11526
|
+
if (!rp.test(i)) {
|
|
11527
|
+
console.warn(`[page-agent-sdk][actions] 动作名 "${i}" 非法(须匹配 ${rp}),已跳过`);
|
|
11514
11528
|
continue;
|
|
11515
11529
|
}
|
|
11516
11530
|
let e = a.description || `宿主动作 ${i}`;
|
|
@@ -11530,9 +11544,9 @@ function tp(e) {
|
|
|
11530
11544
|
}
|
|
11531
11545
|
return n;
|
|
11532
11546
|
}
|
|
11533
|
-
function
|
|
11547
|
+
function ap(e) {
|
|
11534
11548
|
let t = {};
|
|
11535
|
-
for (let [n, r] of Object.entries(e))
|
|
11549
|
+
for (let [n, r] of Object.entries(e)) rp.test(n) && (t[n] = {
|
|
11536
11550
|
description: r.description,
|
|
11537
11551
|
hasParams: !!r.params
|
|
11538
11552
|
});
|
|
@@ -11540,12 +11554,12 @@ function np(e) {
|
|
|
11540
11554
|
}
|
|
11541
11555
|
//#endregion
|
|
11542
11556
|
//#region src/core/toolsets.ts
|
|
11543
|
-
var
|
|
11544
|
-
function
|
|
11545
|
-
return
|
|
11557
|
+
var op = Af, sp = If;
|
|
11558
|
+
function cp(e, t) {
|
|
11559
|
+
return Gu(e, t);
|
|
11546
11560
|
}
|
|
11547
|
-
function
|
|
11548
|
-
let a =
|
|
11561
|
+
function lp(e, t, n, r, i) {
|
|
11562
|
+
let a = Sf(e);
|
|
11549
11563
|
return [
|
|
11550
11564
|
...a.dataOps ? t : [],
|
|
11551
11565
|
...a.fetch ? n : [],
|
|
@@ -11555,7 +11569,7 @@ function op(e, t, n, r, i) {
|
|
|
11555
11569
|
}
|
|
11556
11570
|
//#endregion
|
|
11557
11571
|
//#region src/core/sdk/toolRegistry.ts
|
|
11558
|
-
function
|
|
11572
|
+
function up(e) {
|
|
11559
11573
|
let t = /* @__PURE__ */ new Map(), n = [];
|
|
11560
11574
|
for (let r of e) for (let e of r.tools) {
|
|
11561
11575
|
let i = t.get(e.name);
|
|
@@ -11575,15 +11589,15 @@ function sp(e) {
|
|
|
11575
11589
|
}
|
|
11576
11590
|
//#endregion
|
|
11577
11591
|
//#region src/core/harness/usageHints.ts
|
|
11578
|
-
var
|
|
11579
|
-
function
|
|
11580
|
-
let r =
|
|
11592
|
+
var dp = .7;
|
|
11593
|
+
function fp(e, t, n) {
|
|
11594
|
+
let r = Sf(e);
|
|
11581
11595
|
return {
|
|
11582
11596
|
name: "usageHints",
|
|
11583
11597
|
augmentPrompt: (i) => {
|
|
11584
11598
|
let a = [];
|
|
11585
11599
|
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("改主数据前先 get_data({jsonPath}) 读其当前真实值(返回末尾 hash=xxx 为乐观锁标识),基于真实值改,不要凭记忆。写入是否被自动校验由集成方 conflictWatchFields 声明决定:若已声明且主数据在你 read 之后被外部改过,会触发冲突——集成方若开启人工介入,工具会挂起等用户决定(保留外部/强制覆盖/回退),你应等待工具返回后按结果继续(保留外部→重新 get 再改;强制覆盖→已写入,继续;回退→已回退到历史快照,基于回退值重写);未开启人工介入时返回 VERSION_CONFLICT 不写入,重新 get 拿最新值再改。"), a.push("不确定主数据字段结构时用 describe_data 查看说明。"), a.push("修改大对象/数组优先用 edit_data 增量 patch(只发改动部分),避免 set_data 整体重传被 max_tokens 截断导致 JSON 不完整、校验失败。"), a.push("修改主数据出错时可用 restore_data 回退最近一次。"), a.push("在大数组里按条件筛选元素用 query_data(JSONPath,如 $.components[?(@.type==\"card\" && @.price<100)]),返回匹配元素的 path/index;定位后再 edit_data 改。"), 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("【省轮次·批量】读多个同构子路径(如各组件 props)用 read({jsonPaths:[...]}) 一次取回,勿发多个独立 read;改多处用 write({patches:[{op:\"set\",jsonPath,value},...]}) 一次提交多改动(原子任一失败回滚),勿逐个 edit_data/write 烧轮次预算。"), 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.todoDeps && a.push("复杂任务可用 todos 层级依赖:write_todos 时给 todo 传 parentId(父任务 id,表达层级)+ deps(依赖的 todo id 数组,必须先完成)。有依赖的任务,deps 全 completed 后再标 in_progress;完成时 update_todo({id, status:\"completed\", evidence:\"完成证据\"}) 记证据。无依赖关系的任务不传 parentId/deps(扁平)。"), 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) {
|
|
11586
|
-
let t = e.subagents.filter((e) => (e.temperature ?? 0) >=
|
|
11600
|
+
let t = e.subagents.filter((e) => (e.temperature ?? 0) >= dp || /规划|创意|设计|方案|brainstorm|plan/i.test(e.description)), n = e.subagents.filter((e) => (e.temperature ?? 0) < dp && /反思|审查|挑刺|校验|review|critique|reflect/i.test(e.description));
|
|
11587
11601
|
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)用 edit_data 落地成 JSON(低温度执行 + schema 校验 + 写前确认)。"), a.push(" · 简单/明确任务(如\"标题改红色\")直接执行,不必走规划-反思。");
|
|
11588
11602
|
}
|
|
11589
11603
|
e?.humanConfirm && (a.push("【人工确认·必读】以下情形必须先调 request_human_confirmation 征询用户、拿到答复后再继续,不要自行拍板:"), a.push(" 1) 用户让你「给方案/列选项/我来选/挑一个」时:把每个方案作为一个 option,调 request_human_confirmation(question=简述, options=[方案A,方案B,...], recommendation=你推荐的)。不要只回文字罗列方案让用户自己回复——要用工具把选项做成可点选按钮。"), a.push(" 2) 需求有歧义/不确定时:调工具问清楚(options 不传则用户答同意或拒绝)。"), a.push(" 3) 即将执行高风险不可逆操作(删除/覆盖/批量改动)前:调工具确认。"), a.push(" 4) 规划出多步方案需用户确认时:把整个方案(或关键分步)作为 option 调 request_human_confirmation,确认后再执行。"), a.push("用户在选项里选了哪个,就按那个方案继续;选「拒绝」则停止并询问如何调整。"));
|
|
@@ -11603,7 +11617,7 @@ function lp(e, t, n) {
|
|
|
11603
11617
|
}
|
|
11604
11618
|
//#endregion
|
|
11605
11619
|
//#region src/core/harness/resourcesPin.ts
|
|
11606
|
-
function
|
|
11620
|
+
function pp(e) {
|
|
11607
11621
|
return {
|
|
11608
11622
|
name: "resourcesPin",
|
|
11609
11623
|
augmentPrompt: () => {
|
|
@@ -11617,102 +11631,102 @@ function up(e) {
|
|
|
11617
11631
|
}
|
|
11618
11632
|
//#endregion
|
|
11619
11633
|
//#region src/core/backends/skillStore.ts
|
|
11620
|
-
var
|
|
11621
|
-
function
|
|
11622
|
-
return `${
|
|
11634
|
+
var mp = "v:1::skill-store", hp = "chat-sdk";
|
|
11635
|
+
function gp(e, t, n) {
|
|
11636
|
+
return `${mp}::${e}::${t}::${n}`;
|
|
11623
11637
|
}
|
|
11624
|
-
function
|
|
11625
|
-
return `${
|
|
11638
|
+
function _p(e, t) {
|
|
11639
|
+
return `${mp}::${e}::${t}::`;
|
|
11626
11640
|
}
|
|
11627
|
-
function
|
|
11628
|
-
let t = e.dbName ??
|
|
11641
|
+
function vp(e = {}) {
|
|
11642
|
+
let t = e.dbName ?? hp, n = e.backend ?? "indexed", r = e.id ?? "", i, a, o = new Promise((e) => {
|
|
11629
11643
|
a = e;
|
|
11630
11644
|
});
|
|
11631
11645
|
return (async () => {
|
|
11632
11646
|
try {
|
|
11633
11647
|
if (n === "indexed") {
|
|
11634
11648
|
if (typeof indexedDB > "u") throw Error("indexedDB 不可用");
|
|
11635
|
-
i = await
|
|
11649
|
+
i = await hf(t), a(!0);
|
|
11636
11650
|
} else if (n === "session") {
|
|
11637
11651
|
if (typeof sessionStorage > "u") throw Error("sessionStorage 不可用");
|
|
11638
|
-
i =
|
|
11652
|
+
i = gf(sessionStorage), a(!0);
|
|
11639
11653
|
} else if (n === "local") {
|
|
11640
11654
|
if (typeof localStorage > "u") throw Error("localStorage 不可用");
|
|
11641
|
-
i =
|
|
11642
|
-
} else i =
|
|
11655
|
+
i = gf(localStorage), a(!0);
|
|
11656
|
+
} else i = mf(), a(!1);
|
|
11643
11657
|
} catch {
|
|
11644
|
-
i =
|
|
11658
|
+
i = mf(), a(!1);
|
|
11645
11659
|
}
|
|
11646
11660
|
})(), {
|
|
11647
11661
|
ready: o,
|
|
11648
11662
|
async list() {
|
|
11649
11663
|
let e = [];
|
|
11650
|
-
return await i.scan(
|
|
11664
|
+
return await i.scan(_p(t, r), (t, n) => {
|
|
11651
11665
|
e.push(n);
|
|
11652
11666
|
}), e;
|
|
11653
11667
|
},
|
|
11654
11668
|
async get(e) {
|
|
11655
|
-
return await i.get(
|
|
11669
|
+
return await i.get(gp(t, r, e));
|
|
11656
11670
|
},
|
|
11657
11671
|
async put(e) {
|
|
11658
11672
|
try {
|
|
11659
|
-
await i.set(
|
|
11673
|
+
await i.set(gp(t, r, e.name), e);
|
|
11660
11674
|
} catch (e) {
|
|
11661
|
-
|
|
11675
|
+
of(e) && (i = mf());
|
|
11662
11676
|
}
|
|
11663
11677
|
},
|
|
11664
11678
|
async remove(e) {
|
|
11665
|
-
let n =
|
|
11679
|
+
let n = gp(t, r, e);
|
|
11666
11680
|
return await i.get(n) == null ? !1 : (await i.del(n), !0);
|
|
11667
11681
|
},
|
|
11668
11682
|
async clear() {
|
|
11669
|
-
await i.clearPrefix(
|
|
11683
|
+
await i.clearPrefix(_p(t, r));
|
|
11670
11684
|
},
|
|
11671
11685
|
dispose() {}
|
|
11672
11686
|
};
|
|
11673
11687
|
}
|
|
11674
11688
|
//#endregion
|
|
11675
11689
|
//#region src/core/backends/preferenceStore.ts
|
|
11676
|
-
var
|
|
11690
|
+
var yp = [
|
|
11677
11691
|
"color",
|
|
11678
11692
|
"copy",
|
|
11679
11693
|
"layout",
|
|
11680
11694
|
"interaction",
|
|
11681
11695
|
"tech",
|
|
11682
11696
|
"other"
|
|
11683
|
-
],
|
|
11684
|
-
function
|
|
11685
|
-
return `${
|
|
11697
|
+
], bp = "v:1::pref-store", xp = "chat-sdk";
|
|
11698
|
+
function Sp(e, t, n) {
|
|
11699
|
+
return `${bp}::${e}::${t}::${n}`;
|
|
11686
11700
|
}
|
|
11687
|
-
function
|
|
11688
|
-
return `${
|
|
11701
|
+
function Cp(e, t) {
|
|
11702
|
+
return `${bp}::${e}::${t}::`;
|
|
11689
11703
|
}
|
|
11690
|
-
function
|
|
11704
|
+
function wp() {
|
|
11691
11705
|
return `pref-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
11692
11706
|
}
|
|
11693
|
-
function
|
|
11694
|
-
let t = e.dbName ??
|
|
11707
|
+
function Tp(e = {}) {
|
|
11708
|
+
let t = e.dbName ?? xp, n = e.backend ?? "indexed", r = e.id ?? "", i = e.maxEntries ?? 20, a, o, s = new Promise((e) => {
|
|
11695
11709
|
o = e;
|
|
11696
11710
|
});
|
|
11697
11711
|
(async () => {
|
|
11698
11712
|
try {
|
|
11699
11713
|
if (n === "indexed") {
|
|
11700
11714
|
if (typeof indexedDB > "u") throw Error("indexedDB 不可用");
|
|
11701
|
-
a = await
|
|
11715
|
+
a = await hf(t), o(!0);
|
|
11702
11716
|
} else if (n === "session") {
|
|
11703
11717
|
if (typeof sessionStorage > "u") throw Error("sessionStorage 不可用");
|
|
11704
|
-
a =
|
|
11718
|
+
a = gf(sessionStorage), o(!0);
|
|
11705
11719
|
} else if (n === "local") {
|
|
11706
11720
|
if (typeof localStorage > "u") throw Error("localStorage 不可用");
|
|
11707
|
-
a =
|
|
11708
|
-
} else a =
|
|
11721
|
+
a = gf(localStorage), o(!0);
|
|
11722
|
+
} else a = mf(), o(!1);
|
|
11709
11723
|
} catch {
|
|
11710
|
-
a =
|
|
11724
|
+
a = mf(), o(!1);
|
|
11711
11725
|
}
|
|
11712
11726
|
})();
|
|
11713
11727
|
async function c() {
|
|
11714
11728
|
let e = [];
|
|
11715
|
-
return await a.scan(
|
|
11729
|
+
return await a.scan(Cp(t, r), (t, n) => {
|
|
11716
11730
|
e.push(n);
|
|
11717
11731
|
}), e;
|
|
11718
11732
|
}
|
|
@@ -11723,7 +11737,7 @@ function Sp(e = {}) {
|
|
|
11723
11737
|
},
|
|
11724
11738
|
async put(e) {
|
|
11725
11739
|
let n = await c(), o = Date.now(), s = n.reduce((e, t) => Math.max(e, t.updatedAt), 0), l = n.find((t) => t.topic === e.topic), u = {
|
|
11726
|
-
id: e.id ?? l?.id ??
|
|
11740
|
+
id: e.id ?? l?.id ?? wp(),
|
|
11727
11741
|
content: e.content,
|
|
11728
11742
|
topic: e.topic,
|
|
11729
11743
|
sourceSessionId: l?.sourceSessionId ?? e.sourceSessionId,
|
|
@@ -11731,71 +11745,71 @@ function Sp(e = {}) {
|
|
|
11731
11745
|
createdAt: l?.createdAt ?? o,
|
|
11732
11746
|
updatedAt: Math.max(o, s + 1)
|
|
11733
11747
|
};
|
|
11734
|
-
l && l.id !== u.id && await a.del(
|
|
11748
|
+
l && l.id !== u.id && await a.del(Sp(t, r, l.id));
|
|
11735
11749
|
try {
|
|
11736
|
-
await a.set(
|
|
11750
|
+
await a.set(Sp(t, r, u.id), u);
|
|
11737
11751
|
} catch (e) {
|
|
11738
|
-
|
|
11752
|
+
of(e) && (a = mf(), await a.set(Sp(t, r, u.id), u));
|
|
11739
11753
|
}
|
|
11740
11754
|
let d = await c();
|
|
11741
11755
|
if (d.length > i) {
|
|
11742
11756
|
let e = d.sort((e, t) => e.updatedAt - t.updatedAt).slice(0, d.length - i);
|
|
11743
|
-
for (let n of e) await a.del(
|
|
11757
|
+
for (let n of e) await a.del(Sp(t, r, n.id));
|
|
11744
11758
|
}
|
|
11745
11759
|
return u;
|
|
11746
11760
|
},
|
|
11747
11761
|
async remove(e) {
|
|
11748
|
-
let n =
|
|
11762
|
+
let n = Sp(t, r, e);
|
|
11749
11763
|
return await a.get(n) == null ? !1 : (await a.del(n), !0);
|
|
11750
11764
|
},
|
|
11751
11765
|
async clear() {
|
|
11752
|
-
await a.clearPrefix(
|
|
11766
|
+
await a.clearPrefix(Cp(t, r));
|
|
11753
11767
|
},
|
|
11754
11768
|
dispose() {}
|
|
11755
11769
|
};
|
|
11756
11770
|
}
|
|
11757
11771
|
//#endregion
|
|
11758
11772
|
//#region src/core/harness/preferences.ts
|
|
11759
|
-
var
|
|
11773
|
+
var Ep = {
|
|
11760
11774
|
color: "颜色",
|
|
11761
11775
|
copy: "文案",
|
|
11762
11776
|
layout: "排版",
|
|
11763
11777
|
interaction: "交互",
|
|
11764
11778
|
tech: "技术",
|
|
11765
11779
|
other: "其他"
|
|
11766
|
-
},
|
|
11780
|
+
}, Dp = [
|
|
11767
11781
|
/^(?:请|帮我|麻烦)?你?记住[::,,、]?\s*(.{4,200})/,
|
|
11768
11782
|
/^(?:从)?今后(?:开始|起)?[::,,]?\s*(.{4,200})/,
|
|
11769
11783
|
/^以后(?:都|全都|总是|尽量)?[::,,]?\s*(.{4,200})/
|
|
11770
|
-
],
|
|
11784
|
+
], Op = /(?:不要|别再|别用|别加|太(?:艳|花|亮|暗|大|小|密|挤|乱|复杂|素|少)|不喜欢|讨厌|希望|更喜欢|偏好|永远|一律|统一保持|保持统一)/, kp = [
|
|
11771
11785
|
["layout", /布局|排版|间距|留白|密度|居中|对齐|栅格|边距|紧凑|圆角|分栏|层级|大小|尺寸/],
|
|
11772
11786
|
["copy", /文案|文字|标题|副标题|字体|字号|措辞|语气|口语|书面|简洁|简短|详尽|emoji|表情/],
|
|
11773
11787
|
["interaction", /动画|动效|过渡|交互|悬停|hover|点击反馈|弹窗|提示|加载|滚动/],
|
|
11774
11788
|
["tech", /代码|框架|组件|技术|写法|命名|注释|依赖|版本|接口/],
|
|
11775
11789
|
["color", /颜色|配色|色调|色彩|深色|浅色|饱和|渐变|紫|红|橙|黄|绿|青|蓝|粉|棕|灰|黑|白|金|银/]
|
|
11776
11790
|
];
|
|
11777
|
-
function
|
|
11778
|
-
for (let [t, n] of
|
|
11791
|
+
function Ap(e) {
|
|
11792
|
+
for (let [t, n] of kp) if (n.test(e)) return t;
|
|
11779
11793
|
return "other";
|
|
11780
11794
|
}
|
|
11781
|
-
function
|
|
11795
|
+
function jp(e) {
|
|
11782
11796
|
let t = e.trim();
|
|
11783
|
-
if (!(!t || t.length > 500)) for (let e of
|
|
11797
|
+
if (!(!t || t.length > 500)) for (let e of Dp) {
|
|
11784
11798
|
let n = t.match(e);
|
|
11785
11799
|
if (n?.[1]) {
|
|
11786
11800
|
let e = n[1].trim().replace(/[。.!!]+$/, "");
|
|
11787
11801
|
return e.length < 3 ? void 0 : {
|
|
11788
11802
|
content: e,
|
|
11789
|
-
topic:
|
|
11803
|
+
topic: Ap(e)
|
|
11790
11804
|
};
|
|
11791
11805
|
}
|
|
11792
11806
|
}
|
|
11793
11807
|
}
|
|
11794
|
-
function
|
|
11808
|
+
function Mp(e) {
|
|
11795
11809
|
let t = e.trim();
|
|
11796
|
-
return t.length < 4 || t.length > 500 || /^(你好|hi|hello|ok|好的|继续|嗯|谢谢|hey|哈喽|收到|明白)/i.test(t) ? !1 :
|
|
11810
|
+
return t.length < 4 || t.length > 500 || /^(你好|hi|hello|ok|好的|继续|嗯|谢谢|hey|哈喽|收到|明白)/i.test(t) ? !1 : Op.test(t);
|
|
11797
11811
|
}
|
|
11798
|
-
function
|
|
11812
|
+
function Np(e) {
|
|
11799
11813
|
return [
|
|
11800
11814
|
"你是用户偏好提取器。判断下面的用户消息是否包含「持久偏好」—— 对未来同类工作都适用的口味/规则(如配色口味、文案风格、排版密度),而非仅针对本轮的任务指令。",
|
|
11801
11815
|
"只输出 JSON(无任何其他文本):{\"captured\": true, \"content\": \"一句话中性陈述(用户视角,如:不用紫色,偏好低饱和)\", \"topic\": \"color|copy|layout|interaction|tech|other\"} 或 {\"captured\": false, \"content\": \"\", \"topic\": \"other\"}",
|
|
@@ -11804,7 +11818,7 @@ function Ap(e) {
|
|
|
11804
11818
|
`用户消息:"""${e.slice(0, 800)}"""`
|
|
11805
11819
|
].join("\n");
|
|
11806
11820
|
}
|
|
11807
|
-
function
|
|
11821
|
+
function Pp(e) {
|
|
11808
11822
|
if (!e) return;
|
|
11809
11823
|
let t = (e.match(/```(?:json)?\s*([\s\S]*?)```/)?.[1] ?? e).match(/\{[\s\S]*\}/)?.[0];
|
|
11810
11824
|
if (t) try {
|
|
@@ -11813,19 +11827,19 @@ function jp(e) {
|
|
|
11813
11827
|
let n = typeof e.content == "string" ? e.content.trim().replace(/[。.!!]+$/, "") : "";
|
|
11814
11828
|
return n.length < 3 || n.length > 200 ? void 0 : {
|
|
11815
11829
|
content: n,
|
|
11816
|
-
topic:
|
|
11830
|
+
topic: yp.includes(e.topic) ? e.topic : "other"
|
|
11817
11831
|
};
|
|
11818
11832
|
} catch {
|
|
11819
11833
|
return;
|
|
11820
11834
|
}
|
|
11821
11835
|
}
|
|
11822
|
-
function
|
|
11836
|
+
function Fp(e) {
|
|
11823
11837
|
if (!e.length) return;
|
|
11824
11838
|
let t = ["## 用户偏好(跨会话沉淀;除非用户本轮另有指示,遵守以下偏好)"];
|
|
11825
|
-
for (let n of e) t.push(`- ${
|
|
11839
|
+
for (let n of e) t.push(`- ${Ep[n.topic]}:${n.content}`);
|
|
11826
11840
|
return t.join("\n");
|
|
11827
11841
|
}
|
|
11828
|
-
function
|
|
11842
|
+
function Ip(e) {
|
|
11829
11843
|
let t = [], n = -1, r = Promise.resolve(), i = (t) => e.onDebug?.({
|
|
11830
11844
|
stage: "preferences",
|
|
11831
11845
|
...t
|
|
@@ -11846,21 +11860,21 @@ function Np(e) {
|
|
|
11846
11860
|
}
|
|
11847
11861
|
return {
|
|
11848
11862
|
name: "preferences",
|
|
11849
|
-
augmentPrompt: () =>
|
|
11863
|
+
augmentPrompt: () => Fp(t),
|
|
11850
11864
|
afterAgent: (t) => {
|
|
11851
11865
|
let r = t.messages ?? [];
|
|
11852
11866
|
for (let t = n + 1; t < r.length; t++) {
|
|
11853
11867
|
let n = r[t];
|
|
11854
11868
|
if (n.role !== "user" || typeof n.content != "string" || !n.content) continue;
|
|
11855
|
-
let o = n.content, s =
|
|
11869
|
+
let o = n.content, s = jp(o);
|
|
11856
11870
|
if (s) {
|
|
11857
11871
|
a(s.content, s.topic, t, "explicit");
|
|
11858
11872
|
continue;
|
|
11859
11873
|
}
|
|
11860
|
-
if (e.llmInvoke &&
|
|
11874
|
+
if (e.llmInvoke && Mp(o)) {
|
|
11861
11875
|
let n = t;
|
|
11862
|
-
e.llmInvoke(
|
|
11863
|
-
let t =
|
|
11876
|
+
e.llmInvoke(Np(o)).then((e) => {
|
|
11877
|
+
let t = Pp(e);
|
|
11864
11878
|
t && a(t.content, t.topic, n, "llm");
|
|
11865
11879
|
}).catch((e) => i({ extractError: String(e) }));
|
|
11866
11880
|
}
|
|
@@ -11883,12 +11897,12 @@ function Np(e) {
|
|
|
11883
11897
|
}
|
|
11884
11898
|
};
|
|
11885
11899
|
}
|
|
11886
|
-
var
|
|
11887
|
-
function
|
|
11900
|
+
var Lp = /large_results\/[^\s"'`),]+\.txt/g;
|
|
11901
|
+
function Rp(e) {
|
|
11888
11902
|
let t = /* @__PURE__ */ new Set(), n = (e) => {
|
|
11889
11903
|
if (typeof e != "string" || !e) return;
|
|
11890
11904
|
let n;
|
|
11891
|
-
for (
|
|
11905
|
+
for (Lp.lastIndex = 0; (n = Lp.exec(e)) !== null;) t.add(n[0]);
|
|
11892
11906
|
};
|
|
11893
11907
|
for (let r of e) {
|
|
11894
11908
|
if (n(r.content), r.steps) for (let e of r.steps) n(e.result);
|
|
@@ -11896,14 +11910,14 @@ function Fp(e) {
|
|
|
11896
11910
|
}
|
|
11897
11911
|
return t;
|
|
11898
11912
|
}
|
|
11899
|
-
function
|
|
11913
|
+
function zp(e, t) {
|
|
11900
11914
|
let n = [];
|
|
11901
11915
|
for (let r of Object.keys(e)) r.startsWith("large_results/") && !t.has(r) && n.push(r);
|
|
11902
11916
|
return n;
|
|
11903
11917
|
}
|
|
11904
11918
|
//#endregion
|
|
11905
11919
|
//#region src/core/utils/serialRunner.ts
|
|
11906
|
-
function
|
|
11920
|
+
function Bp() {
|
|
11907
11921
|
let e = Promise.resolve();
|
|
11908
11922
|
return function(t) {
|
|
11909
11923
|
let n = e.then(t, t);
|
|
@@ -11912,24 +11926,24 @@ function Lp() {
|
|
|
11912
11926
|
}
|
|
11913
11927
|
//#endregion
|
|
11914
11928
|
//#region src/core/sdk/createChatSdk.ts
|
|
11915
|
-
var
|
|
11916
|
-
function
|
|
11929
|
+
var Vp = 30, Hp = /* @__PURE__ */ new Map();
|
|
11930
|
+
function Up(e, t) {
|
|
11917
11931
|
return e === "set_data" ? "set" : e === "edit_data" ? "edit" : e === "delete_data" ? "delete" : e === "restore_data" ? "restore" : e === "write" ? t?.del ? "delete" : t?.patch ? "edit" : "set" : null;
|
|
11918
11932
|
}
|
|
11919
|
-
function
|
|
11933
|
+
function Wp(e) {
|
|
11920
11934
|
return e === "spawn_agent" || e === "spawn_agents" || e.startsWith("use_");
|
|
11921
11935
|
}
|
|
11922
|
-
function
|
|
11936
|
+
function Gp(e, t, n, r) {
|
|
11923
11937
|
let i = 0;
|
|
11924
11938
|
return {
|
|
11925
11939
|
name: "sdk-events",
|
|
11926
11940
|
wrapToolCall: async (t, r) => {
|
|
11927
|
-
let i = await r(t), a =
|
|
11941
|
+
let i = await r(t), a = Up(t.name, t.args);
|
|
11928
11942
|
return a ? e({
|
|
11929
11943
|
type: "data_change",
|
|
11930
11944
|
operation: a,
|
|
11931
11945
|
value: n()?.bind
|
|
11932
|
-
}) : i.status === "done" &&
|
|
11946
|
+
}) : i.status === "done" && Wp(t.name) && e({
|
|
11933
11947
|
type: "data_change",
|
|
11934
11948
|
operation: "edit",
|
|
11935
11949
|
value: n()?.bind
|
|
@@ -11956,7 +11970,7 @@ function Hp(e, t, n, r) {
|
|
|
11956
11970
|
}
|
|
11957
11971
|
};
|
|
11958
11972
|
}
|
|
11959
|
-
function
|
|
11973
|
+
function Kp(e, t, n, r, i) {
|
|
11960
11974
|
if (!n) return i && console.warn(`[page-agent-sdk][focus] capabilities.focus 关闭,${t} 忽略`), {
|
|
11961
11975
|
ok: !1,
|
|
11962
11976
|
error: "capabilities.focus 关闭"
|
|
@@ -11974,16 +11988,16 @@ function Up(e, t, n, r, i) {
|
|
|
11974
11988
|
error: "当前无主数据 schema,无法聚焦"
|
|
11975
11989
|
});
|
|
11976
11990
|
}
|
|
11977
|
-
function
|
|
11991
|
+
function qp(e, n) {
|
|
11978
11992
|
let i = {
|
|
11979
11993
|
prompt_tokens: 0,
|
|
11980
11994
|
completion_tokens: 0,
|
|
11981
11995
|
total_tokens: 0
|
|
11982
|
-
}, a =
|
|
11996
|
+
}, a = Kd(() => K, () => e.conflictPolicy ?? "ask"), o = /* @__PURE__ */ jt(0), s = yf(e.storage);
|
|
11983
11997
|
e.debug && s && s.onEvent((e) => console.log("[page-agent-sdk][storage]", e));
|
|
11984
|
-
let { modelCaps: c, summaryLlmInvoke: l, titleLlmInvoke: u, compressDecisionInvoke: d } =
|
|
11998
|
+
let { modelCaps: c, summaryLlmInvoke: l, titleLlmInvoke: u, compressDecisionInvoke: d } = Gd(e), f = c;
|
|
11985
11999
|
if (e.debug && console.log("[page-agent-sdk][modelCaps]", f), f.contextWindow < 2e5) throw Error(`[page-agent-sdk] 模型上下文窗口 ${f.contextWindow} 小于最小支持 ${Si}(需 ≥200K 窗口模型,如 GLM-5.2/Claude/Kimi/Qwen-1M/DeepSeek-v4)`);
|
|
11986
|
-
let p =
|
|
12000
|
+
let p = Ef(e, f.contextWindow), g = p.enableLLMSummary !== !1, _ = (e.contextOptions && e.contextOptions.preserveLastToolResults) ?? Tf[e.contextPreset ?? "auto"], v = new Set(_), y = e.llm;
|
|
11987
12001
|
e.debug && !l && console.warn("[page-agent-sdk][summarization] 未构造 llmInvoke(apiKey 缺失?),摘要回退零成本索引摘要");
|
|
11988
12002
|
let b = /* @__PURE__ */ bt([]), x = iu(e.vfs?.initialFiles, {
|
|
11989
12003
|
persist: s ? { save: (e) => {
|
|
@@ -12028,8 +12042,8 @@ function Wp(e, n) {
|
|
|
12028
12042
|
let j = { current: null }, M = e.data ? {
|
|
12029
12043
|
...e.data,
|
|
12030
12044
|
description: e.data.description ?? "主数据对象"
|
|
12031
|
-
} : void 0, N = !(e.subagents ?? []).some((e) => e._codeAsset) &&
|
|
12032
|
-
N && M?.schema && Ho(M.schema).length && (P = [...e.subagents ?? [],
|
|
12045
|
+
} : void 0, N = !(e.subagents ?? []).some((e) => e._codeAsset) && Sf(e.capabilities).subagent, P = e.subagents;
|
|
12046
|
+
N && M?.schema && Ho(M.schema).length && (P = [...e.subagents ?? [], Ad()], console.info("[page-agent-sdk] 检测到 schema 含代码组件数组(如 components[].code),已自动装配 HTML 代码子 agent(委派编排 + vfs 工作副本 + 格式校验 + 增量 commit)。需定制(codeField/formatCheck/craftNotes 等)请显式传 createHtmlSubagent(...)"));
|
|
12033
12047
|
let ee = (P ?? []).filter((e) => !!e._codeAsset), F = /* @__PURE__ */ new Set();
|
|
12034
12048
|
for (let e of ee) {
|
|
12035
12049
|
if (e._codeAsset.writablePaths.length) continue;
|
|
@@ -12045,7 +12059,7 @@ function Wp(e, n) {
|
|
|
12045
12059
|
getTodos: () => j.current?.getState?.()?.todos ?? [],
|
|
12046
12060
|
messages: b,
|
|
12047
12061
|
maxCheckpoints: ae && typeof ae == "object" ? ae.maxCheckpoints : void 0
|
|
12048
|
-
}) : null, se = !ae || typeof ae != "object" || ae.auto !== !1, R =
|
|
12062
|
+
}) : null, se = !ae || typeof ae != "object" || ae.auto !== !1, R = Sf(e.capabilities), z = R.dataOps, ce = R.draftWrite, le = R.tracing, ue = R.automation, de = eu({
|
|
12049
12063
|
...e,
|
|
12050
12064
|
locale: e.i18n?.locale
|
|
12051
12065
|
});
|
|
@@ -12053,7 +12067,7 @@ function Wp(e, n) {
|
|
|
12053
12067
|
let e = te.map((e) => e._codeAsset.orchestratorPrompt).filter(Boolean).join("\n\n");
|
|
12054
12068
|
e && (de += "\n\n" + e);
|
|
12055
12069
|
} else M?.schema && Vo(M.schema) && (de += "\n\n" + as.htmlDirectWriteFallback, console.warn("[page-agent-sdk] 检测到 schema 含 code 字段但未注册 html 子 agent:已自动注入「主 agent 自己写 HTML」编排(code 作普通字段直接 write,无 vfs 工作副本 / 无格式校验门禁)。如需代码资产机制(vfs + 格式校验 + 增量 commit + 主上下文 code 摘要),注册 createHtmlSubagent;若确为降级意图可忽略。"));
|
|
12056
|
-
let fe = z && M ?
|
|
12070
|
+
let fe = z && M ? Gu(M, {
|
|
12057
12071
|
onAudit: e.onAudit ?? (e.debug ? (e) => console.log("[page-agent-sdk][data audit]", e) : void 0),
|
|
12058
12072
|
maxSnapshots: e.maxSnapshots,
|
|
12059
12073
|
onConflict: a.set,
|
|
@@ -12061,7 +12075,7 @@ function Wp(e, n) {
|
|
|
12061
12075
|
vfsStore: ce || M?.resources?.length ? x : void 0,
|
|
12062
12076
|
...re.length ? { pgIdPaths: re } : {},
|
|
12063
12077
|
...ie.length ? { largeTextPaths: ie } : {}
|
|
12064
|
-
}) : [], pe = z ? fe : [], B = z && M ? fe.controller ?? null : null, me = z && M?.resources?.length && B?.getResourcesSnapshot ?
|
|
12078
|
+
}) : [], pe = z ? fe : [], B = z && M ? fe.controller ?? null : null, me = z && M?.resources?.length && B?.getResourcesSnapshot ? pp({ getResourcesSnapshot: () => B?.getResourcesSnapshot?.() ?? [] }) : void 0, V = () => B?.get() ?? M, H = new Set(fe.map((e) => e.name)), he = e.conflictWatchFields ?? [], U = !he.includes("*") && he.length ? new Set(he) : void 0, ge = B ? _d({
|
|
12065
12079
|
getBind: () => V()?.bind,
|
|
12066
12080
|
recomputeAll: () => B.recomputeAllBaselines?.(),
|
|
12067
12081
|
hasBaselines: () => B.hasBaselines?.() ?? !1,
|
|
@@ -12078,15 +12092,15 @@ function Wp(e, n) {
|
|
|
12078
12092
|
}
|
|
12079
12093
|
}), Ft(n));
|
|
12080
12094
|
}
|
|
12081
|
-
}) : void 0, W = /* @__PURE__ */ new Map(), _e =
|
|
12082
|
-
...
|
|
12083
|
-
|
|
12084
|
-
|
|
12085
|
-
] :
|
|
12095
|
+
}) : void 0, W = /* @__PURE__ */ new Map(), _e = lp(R, pe, Af, R.domInspect && !R.skills ? [
|
|
12096
|
+
...If,
|
|
12097
|
+
Kf,
|
|
12098
|
+
qf
|
|
12099
|
+
] : If, tp);
|
|
12086
12100
|
_e.forEach((e) => W.set(e.name, "builtin"));
|
|
12087
12101
|
let ve = [...e.tools || []];
|
|
12088
12102
|
ve.forEach((e) => W.set(e.name, "user"));
|
|
12089
|
-
let ye =
|
|
12103
|
+
let ye = ip(e.actions ?? {});
|
|
12090
12104
|
ye.forEach((e) => W.set(e.name, "action"));
|
|
12091
12105
|
let be = [], xe = !1, Se = e.humanConfirm !== !1 && (!e.approval || e.approval.humanConfirmTool !== !1), Ce = Se ? pl() : null;
|
|
12092
12106
|
Ce && W.set(dl, "builtin");
|
|
@@ -12158,7 +12172,7 @@ function Wp(e, n) {
|
|
|
12158
12172
|
Ae.forEach((e) => W.set(e.name, "builtin"));
|
|
12159
12173
|
let je = [], Me = /* @__PURE__ */ new Map(), G = Ne();
|
|
12160
12174
|
function Ne() {
|
|
12161
|
-
let { tools: e, collisions: t } =
|
|
12175
|
+
let { tools: e, collisions: t } = up([
|
|
12162
12176
|
{
|
|
12163
12177
|
label: "builtin",
|
|
12164
12178
|
tools: _e
|
|
@@ -12231,7 +12245,7 @@ function Wp(e, n) {
|
|
|
12231
12245
|
timeoutMs: Ye?.timeoutMs
|
|
12232
12246
|
}), tt = ne?.map((e) => {
|
|
12233
12247
|
if (!e._codeAsset) return e;
|
|
12234
|
-
let t = e._codeAsset, n =
|
|
12248
|
+
let t = e._codeAsset, n = cd({
|
|
12235
12249
|
writablePaths: t.writablePaths,
|
|
12236
12250
|
codeVfsPrefix: t.codeVfsPrefix,
|
|
12237
12251
|
ext: t.ext,
|
|
@@ -12246,12 +12260,12 @@ function Wp(e, n) {
|
|
|
12246
12260
|
...e,
|
|
12247
12261
|
middleware: r
|
|
12248
12262
|
};
|
|
12249
|
-
}), nt = I && He ?
|
|
12263
|
+
}), nt = I && He ? ld() : void 0, rt = nt ? gd({
|
|
12250
12264
|
getBind: () => V()?.bind,
|
|
12251
12265
|
writablePaths: re,
|
|
12252
12266
|
getLocked: () => nt.locked(),
|
|
12253
12267
|
tools: G,
|
|
12254
|
-
getCodeFieldPaths: () =>
|
|
12268
|
+
getCodeFieldPaths: () => md(V()?.bind, te.map((e) => ({
|
|
12255
12269
|
writablePaths: e._codeAsset.writablePaths,
|
|
12256
12270
|
codeField: e._codeAsset.codeField
|
|
12257
12271
|
})))
|
|
@@ -12275,7 +12289,7 @@ function Wp(e, n) {
|
|
|
12275
12289
|
timeoutMs: e.subagent?.timeoutMs,
|
|
12276
12290
|
...nt ? {
|
|
12277
12291
|
componentLock: nt,
|
|
12278
|
-
resolveComponents: (e) =>
|
|
12292
|
+
resolveComponents: (e) => ud(e, id(V()?.bind, re))
|
|
12279
12293
|
} : {}
|
|
12280
12294
|
}) : void 0, at = !!e.capabilities?.bulkGuard && !!Qe, ot = at ? gl({
|
|
12281
12295
|
...e.bulkGuard ?? {},
|
|
@@ -12292,7 +12306,7 @@ function Wp(e, n) {
|
|
|
12292
12306
|
}) : void 0;
|
|
12293
12307
|
e.capabilities?.bulkGuard && !Qe && console.info("[page-agent-sdk] bulkGuard 已请求但未配置 approval,门禁未装配(整体 no-op;配置 approval.tools 或 approval.confirm 后生效)");
|
|
12294
12308
|
let st = it ? it.controller : null, ct = (t) => {
|
|
12295
|
-
let n = t.thinkingMode ?? e.subagent?.thinkingMode, r = n ?
|
|
12309
|
+
let n = t.thinkingMode ?? e.subagent?.thinkingMode, r = n ? Id(t.llm ?? e.llm) ? "instance-noop" : "applied" : "inherited";
|
|
12296
12310
|
return {
|
|
12297
12311
|
...t,
|
|
12298
12312
|
...n ? { thinkingMode: n } : {},
|
|
@@ -12314,8 +12328,8 @@ function Wp(e, n) {
|
|
|
12314
12328
|
} : void 0
|
|
12315
12329
|
}) : void 0, ft = Je ? Gl({
|
|
12316
12330
|
contextWindow: f.contextWindow,
|
|
12317
|
-
thresholdRatio:
|
|
12318
|
-
}) : void 0, pt =
|
|
12331
|
+
thresholdRatio: Ef(e, f.contextWindow).summaryThresholdRatio
|
|
12332
|
+
}) : void 0, pt = fp({
|
|
12319
12333
|
...R,
|
|
12320
12334
|
humanConfirm: Se,
|
|
12321
12335
|
subagents: ne?.map(ct)
|
|
@@ -12335,7 +12349,7 @@ function Wp(e, n) {
|
|
|
12335
12349
|
return;
|
|
12336
12350
|
}
|
|
12337
12351
|
}
|
|
12338
|
-
} : null, gt =
|
|
12352
|
+
} : null, gt = Cf(e.onEvent), K = gt.emit, _t, vt = [], yt = (e) => ({
|
|
12339
12353
|
name: e.name,
|
|
12340
12354
|
description: e.description,
|
|
12341
12355
|
content: typeof e.getContent == "function" ? e.getContent() : ""
|
|
@@ -12343,13 +12357,13 @@ function Wp(e, n) {
|
|
|
12343
12357
|
name: e.name,
|
|
12344
12358
|
description: e.description,
|
|
12345
12359
|
getContent: () => e.content
|
|
12346
|
-
}), St = e.skillStorage === !1 ? null :
|
|
12360
|
+
}), St = e.skillStorage === !1 ? null : vp({
|
|
12347
12361
|
...typeof e.skillStorage == "object" ? e.skillStorage : {},
|
|
12348
12362
|
id: e.skillStorage && typeof e.skillStorage == "object" && e.skillStorage.id ? e.skillStorage.id : `agent::${n}`
|
|
12349
|
-
}), Ct = R.preferences, wt = Ct && e.preferenceStorage !== !1 ?
|
|
12363
|
+
}), Ct = R.preferences, wt = Ct && e.preferenceStorage !== !1 ? Tp({
|
|
12350
12364
|
...typeof e.preferenceStorage == "object" ? e.preferenceStorage : {},
|
|
12351
12365
|
id: e.preferenceStorage && typeof e.preferenceStorage == "object" && e.preferenceStorage.id ? e.preferenceStorage.id : `agent::${n}`
|
|
12352
|
-
}) : null, q = wt ?
|
|
12366
|
+
}) : null, q = wt ? Ip({
|
|
12353
12367
|
store: wt,
|
|
12354
12368
|
llmInvoke: l,
|
|
12355
12369
|
getSessionId: () => Y.sessionId,
|
|
@@ -12390,7 +12404,7 @@ function Wp(e, n) {
|
|
|
12390
12404
|
decideInvoke: d,
|
|
12391
12405
|
getSnapshot: () => ft?.getSnapshot()
|
|
12392
12406
|
} : {}
|
|
12393
|
-
}) : void 0, Dt =
|
|
12407
|
+
}) : void 0, Dt = Of([
|
|
12394
12408
|
...mt ? [mt] : [],
|
|
12395
12409
|
pt,
|
|
12396
12410
|
...Fe ? [C] : [],
|
|
@@ -12398,7 +12412,7 @@ function Wp(e, n) {
|
|
|
12398
12412
|
T,
|
|
12399
12413
|
...q ? [q] : [],
|
|
12400
12414
|
...Pe ? [S] : [],
|
|
12401
|
-
...Le ? [_t = cc([...R.domInspect && !(e.skills || []).some((e) => e.name ===
|
|
12415
|
+
...Le ? [_t = cc([...R.domInspect && !(e.skills || []).some((e) => e.name === Jf.name) ? [Jf] : [], ...e.skills || []], {
|
|
12402
12416
|
readVfs: Re ? (e) => x.files[e]?.content : void 0,
|
|
12403
12417
|
hostScriptEnabled: R.skillHostScript,
|
|
12404
12418
|
onToolsReady: (e, t) => {
|
|
@@ -12428,12 +12442,12 @@ function Wp(e, n) {
|
|
|
12428
12442
|
...ht ? [ht] : [],
|
|
12429
12443
|
...ft ? [ft] : [],
|
|
12430
12444
|
...e.middleware || [],
|
|
12431
|
-
...ue ? [
|
|
12445
|
+
...ue ? [np(i, {
|
|
12432
12446
|
tokenBudget: e.tokenBudget,
|
|
12433
12447
|
timeBudgetMs: e.timeBudgetMs
|
|
12434
12448
|
}, K)] : [],
|
|
12435
|
-
|
|
12436
|
-
]), Ot = e.maxMemoryRounds ??
|
|
12449
|
+
Gp(K, b, V, i)
|
|
12450
|
+
]), Ot = e.maxMemoryRounds ?? Vp, kt = e.approval?.timeoutMs, At = kt === void 0 || kt === 0 ? 3e4 : !Number.isFinite(kt) || kt < 0 ? 0 : kt;
|
|
12437
12451
|
function Mt(e) {
|
|
12438
12452
|
if (At) return (t) => {
|
|
12439
12453
|
if (t.type !== "approval_request") return;
|
|
@@ -12466,7 +12480,7 @@ function Wp(e, n) {
|
|
|
12466
12480
|
e.debug && console.warn("[page-agent-sdk][persist] refreshSessions 失败(已吞):", t);
|
|
12467
12481
|
}
|
|
12468
12482
|
}
|
|
12469
|
-
let Lt =
|
|
12483
|
+
let Lt = Bp(), Rt = /* @__PURE__ */ new Set();
|
|
12470
12484
|
function zt(e) {
|
|
12471
12485
|
let t = new AbortController(), n = () => t.abort();
|
|
12472
12486
|
return e && (e.aborted ? t.abort() : e.addEventListener("abort", n, { once: !0 })), Rt.add(t), {
|
|
@@ -12730,7 +12744,7 @@ function Wp(e, n) {
|
|
|
12730
12744
|
})), e.memory && Yt({ memory: A.get() || (typeof e.memory == "string" ? e.memory : "") }), It(), Kt = void 0, qt = !1, Y.infoTick.value++, r;
|
|
12731
12745
|
},
|
|
12732
12746
|
resetSession: () => {
|
|
12733
|
-
Bt(), a.resolve("keep_external"), Y.sessionId =
|
|
12747
|
+
Bt(), a.resolve("keep_external"), Y.sessionId = qd(), b.splice(0, b.length), x.clear?.(), S.reset([]), e.memory || A.reset(""), C.reset(), k.reset(), O.reset(), T.reset(), E = void 0, ot?.state.reset(), q?.resetScanCursor(), L && L.importStack([]), Y.agent && (Y.agent.debugLogs.value = [], Y.agent.resetStaleReadsInvalidated?.()), s && s.createSession(Y.agentId, e.session?.title, Y.sessionId).catch((t) => {
|
|
12734
12748
|
e.debug && console.warn("[page-agent-sdk][persist] createSession 失败(已吞):", t);
|
|
12735
12749
|
}), K({
|
|
12736
12750
|
type: "session_restored",
|
|
@@ -12750,7 +12764,7 @@ function Wp(e, n) {
|
|
|
12750
12764
|
code: "IMAGE_UNSUPPORTED_MODEL"
|
|
12751
12765
|
}), Error(`[page-agent-sdk] ${e}`);
|
|
12752
12766
|
}
|
|
12753
|
-
x?.setProtectedRefs?.(
|
|
12767
|
+
x?.setProtectedRefs?.(Rp(e));
|
|
12754
12768
|
let i = (e) => {
|
|
12755
12769
|
t?.(e), K(e), e.type === "subagent" && (e.kind === "tool_call" || e.kind === "tool_result") && Y.infoTick.value++;
|
|
12756
12770
|
};
|
|
@@ -12765,7 +12779,7 @@ function Wp(e, n) {
|
|
|
12765
12779
|
if (Y.refCount--, Y.refCount <= 0) {
|
|
12766
12780
|
Bt(), xe = !0, s && (x.flush?.(), s.flush(), s.dispose()), St && St.dispose();
|
|
12767
12781
|
let e = Y.mcpClosers.splice(0);
|
|
12768
|
-
e.length && Promise.allSettled(e.map((e) => e())),
|
|
12782
|
+
e.length && Promise.allSettled(e.map((e) => e())), Hp.delete(n);
|
|
12769
12783
|
}
|
|
12770
12784
|
},
|
|
12771
12785
|
resolveConflict: a.resolve,
|
|
@@ -12785,14 +12799,14 @@ function Wp(e, n) {
|
|
|
12785
12799
|
},
|
|
12786
12800
|
setLlm(t) {
|
|
12787
12801
|
let n;
|
|
12788
|
-
if (
|
|
12802
|
+
if (Id(t)) n = t;
|
|
12789
12803
|
else {
|
|
12790
12804
|
let e = t;
|
|
12791
12805
|
if ((e.provider ?? "openai") === "anthropic") throw Error("[page-agent-sdk][setLlm] 切换到 Anthropic 需传 BaseChatModel 实例(动态 import 无法同步);请先 const { ChatAnthropic } = await import(\"@langchain/anthropic\") 构造实例后传入");
|
|
12792
12806
|
n = m(e);
|
|
12793
12807
|
}
|
|
12794
12808
|
typeof n.bindTools != "function" && e.debug && console.warn("[page-agent-sdk][setLlm] 新模型不支持 bindTools(tool calling 会失效)"), y = t;
|
|
12795
|
-
let r =
|
|
12809
|
+
let r = Id(t) ? void 0 : t;
|
|
12796
12810
|
if (f = Ci({
|
|
12797
12811
|
model: r?.model ?? t.model ?? t.modelName,
|
|
12798
12812
|
contextWindow: e.contextWindow ?? r?.contextWindow,
|
|
@@ -12836,7 +12850,7 @@ function Wp(e, n) {
|
|
|
12836
12850
|
return {
|
|
12837
12851
|
id: n,
|
|
12838
12852
|
sessionId: Y.sessionId,
|
|
12839
|
-
model:
|
|
12853
|
+
model: Id(y) ? y.model ?? y.modelName : y.model,
|
|
12840
12854
|
systemPrompt: Y.agent?.getEffectiveSystemPrompt?.() ?? de + $l(V(), e.schemaHint),
|
|
12841
12855
|
tools: (Y.agent?.allTools ?? G).map((e) => ({
|
|
12842
12856
|
name: e.name,
|
|
@@ -12887,7 +12901,7 @@ function Wp(e, n) {
|
|
|
12887
12901
|
spans: Y.agent.spans.value,
|
|
12888
12902
|
metrics: Ei(Y.agent.spans.value)
|
|
12889
12903
|
} : void 0,
|
|
12890
|
-
actions:
|
|
12904
|
+
actions: ap(e.actions ?? {}),
|
|
12891
12905
|
subagent: {
|
|
12892
12906
|
enabled: !!et,
|
|
12893
12907
|
maxDepth: e.subagent?.maxDepth ?? 1,
|
|
@@ -12946,7 +12960,7 @@ function Wp(e, n) {
|
|
|
12946
12960
|
approxBytes: e
|
|
12947
12961
|
};
|
|
12948
12962
|
}
|
|
12949
|
-
return
|
|
12963
|
+
return Cd(Sd({
|
|
12950
12964
|
debugLogs: Y.agent?.debugLogs?.value ?? [],
|
|
12951
12965
|
messages: Y.messages,
|
|
12952
12966
|
info: t,
|
|
@@ -12984,11 +12998,11 @@ function Wp(e, n) {
|
|
|
12984
12998
|
return Te ? O.getFocuses() : [];
|
|
12985
12999
|
},
|
|
12986
13000
|
setFocus(t) {
|
|
12987
|
-
let n =
|
|
13001
|
+
let n = Kp(t, "setFocus", Te, () => V()?.schema, e.debug);
|
|
12988
13002
|
return n.ok ? (O.setFocus(t), Y.infoTick.value++, { ok: !0 }) : n;
|
|
12989
13003
|
},
|
|
12990
13004
|
addFocus(t) {
|
|
12991
|
-
let n =
|
|
13005
|
+
let n = Kp(t, "addFocus", Te, () => V()?.schema, e.debug);
|
|
12992
13006
|
return n.ok ? O.getFocuses().length >= 8 ? (e.debug && console.warn("[page-agent-sdk][focus] addFocus 拒绝:焦点数已达上限 8(augmentPrompt 注入每焦点子树 schema,过多致 system prompt 超预算)"), {
|
|
12993
13007
|
ok: !1,
|
|
12994
13008
|
error: "焦点数上限 8(避免 system prompt 撑爆)"
|
|
@@ -13032,14 +13046,14 @@ function Wp(e, n) {
|
|
|
13032
13046
|
}
|
|
13033
13047
|
function Ut(e) {
|
|
13034
13048
|
let t = {};
|
|
13035
|
-
for (let n of
|
|
13049
|
+
for (let n of Rp(e)) {
|
|
13036
13050
|
let e = x.files[n];
|
|
13037
13051
|
e && (t[n] = e.content);
|
|
13038
13052
|
}
|
|
13039
13053
|
return t;
|
|
13040
13054
|
}
|
|
13041
13055
|
function Wt() {
|
|
13042
|
-
let e =
|
|
13056
|
+
let e = zp(x.files, Rp(b));
|
|
13043
13057
|
for (let t of e) delete x.files[t];
|
|
13044
13058
|
}
|
|
13045
13059
|
function Gt() {
|
|
@@ -13143,7 +13157,7 @@ function Wp(e, n) {
|
|
|
13143
13157
|
Yt({ focus: e.length ? e : null });
|
|
13144
13158
|
}
|
|
13145
13159
|
ue && L && (Yt({ checkpoints: L.exportStack() }), Yt({ usage: i }));
|
|
13146
|
-
let t =
|
|
13160
|
+
let t = Fd(b);
|
|
13147
13161
|
if (t && t !== Kt && (Kt = t, Xt(Y.sessionId, t)), e.autoTitle !== !1 && u && !qt && b.some((e) => e.role === "user") && b.some((e) => e.role === "assistant")) {
|
|
13148
13162
|
qt = !0;
|
|
13149
13163
|
let e = Y.sessionId;
|
|
@@ -13221,7 +13235,7 @@ function Wp(e, n) {
|
|
|
13221
13235
|
}
|
|
13222
13236
|
}));
|
|
13223
13237
|
})();
|
|
13224
|
-
let t =
|
|
13238
|
+
let t = Id(e.llm) ? e.llm : await h(e.llm);
|
|
13225
13239
|
Y.agent = Eo({
|
|
13226
13240
|
llm: t,
|
|
13227
13241
|
systemPrompt: de,
|
|
@@ -13235,7 +13249,7 @@ function Wp(e, n) {
|
|
|
13235
13249
|
contextWindow: f.contextWindow,
|
|
13236
13250
|
maxOutputTokens: f.maxOutputTokens,
|
|
13237
13251
|
vision: f.vision,
|
|
13238
|
-
imageContentFormat: !
|
|
13252
|
+
imageContentFormat: !Id(e.llm) && (e.llm.provider ?? "openai") === "anthropic" ? "anthropic" : "openai",
|
|
13239
13253
|
maxVerifyAttempts: qe ? We : 0,
|
|
13240
13254
|
roundTokenBudget: e.roundTokenBudget ?? 0,
|
|
13241
13255
|
staleReadInvalidation: e.staleReadInvalidation,
|
|
@@ -13257,12 +13271,12 @@ function Wp(e, n) {
|
|
|
13257
13271
|
});
|
|
13258
13272
|
})(), Y;
|
|
13259
13273
|
}
|
|
13260
|
-
function
|
|
13261
|
-
let n = e.id ??
|
|
13274
|
+
function Jp(e, t) {
|
|
13275
|
+
let n = e.id ?? qd();
|
|
13262
13276
|
e.id || console.warn(`[page-agent-sdk] 未传 options.id,已生成随机 id "${n}"。刷新后持久化数据无法恢复,请传稳定 id。`);
|
|
13263
|
-
let r = e.streaming ?? !0, i = e.ui ?? "default", a, o = e.shareContext ?
|
|
13264
|
-
o ? a = o : (a =
|
|
13265
|
-
let s = null, c =
|
|
13277
|
+
let r = e.streaming ?? !0, i = e.ui ?? "default", a, o = e.shareContext ? Hp.get(n) : void 0;
|
|
13278
|
+
o ? a = o : (a = qp(e, n), e.shareContext && Hp.set(n, a)), a.refCount++;
|
|
13279
|
+
let s = null, c = bf(e), l = null, u = null;
|
|
13266
13280
|
async function d(n) {
|
|
13267
13281
|
if (await a.initDone, s) {
|
|
13268
13282
|
s.show();
|
|
@@ -13484,7 +13498,7 @@ function Gp(e, t) {
|
|
|
13484
13498
|
}
|
|
13485
13499
|
//#endregion
|
|
13486
13500
|
//#region src/core/sdk/ragSubagent.ts
|
|
13487
|
-
function
|
|
13501
|
+
function Yp(e, t, n, r, i) {
|
|
13488
13502
|
let a = [];
|
|
13489
13503
|
e && a.push("vfs_grep + vfs_read(搜预注入文档)"), t && a.push(`${r}(语义检索)`), n && a.push(`${i}(按 source 加载)`), a.push("fetch_document(公网 URL)");
|
|
13490
13504
|
let o = [];
|
|
@@ -13499,7 +13513,7 @@ function Kp(e, t, n, r, i) {
|
|
|
13499
13513
|
|
|
13500
13514
|
你是只读检索角色,不要尝试修改任何数据。不要尝试上面未列出的工具。`;
|
|
13501
13515
|
}
|
|
13502
|
-
function
|
|
13516
|
+
function Xp(e, t, n, r, i) {
|
|
13503
13517
|
let a = [], o = [];
|
|
13504
13518
|
return e && (a.push("- vfs_grep / vfs_read:搜集成方预注入 vfs 的文档(组件文档 / UI 规范)—— 快、静态,先查"), o.push("- 静态文档(组件库文档 / UI 规范):vfs_grep")), t && (a.push(`- ${r}:语义检索(retriever 向量库)—— 模糊匹配,关键词不确定 / 语义相似时用`), o.push(`- 语义相似(「瀑布流组件」「倒计时」「拼团」):${r}`)), n && (a.push(`- ${i}:按 source 精确加载(已知文档 id / URL / key)—— 精确取特定文档`), o.push(`- 已知文档 id / URL:${i}`)), a.push("- fetch_document:公网 URL —— 查公开资料"), o.push("- 公开 URL(设计规范网站 / 第三方文档):fetch_document"), `# 知识检索策略(RAG)
|
|
13505
13519
|
|
|
@@ -13516,12 +13530,12 @@ ${a.join("\n")}
|
|
|
13516
13530
|
## 何时用何源
|
|
13517
13531
|
${o.join("\n")}`;
|
|
13518
13532
|
}
|
|
13519
|
-
var
|
|
13533
|
+
var Zp = {
|
|
13520
13534
|
name: "rag-search",
|
|
13521
13535
|
description: "多源知识检索策略:vfs 预注入文档 → 语义检索 → 指定文档加载 → 公网;综合结构化结论 + 溯源",
|
|
13522
|
-
getContent: () =>
|
|
13536
|
+
getContent: () => Xp(!0, !0, !0, "search_docs", "load_doc")
|
|
13523
13537
|
};
|
|
13524
|
-
function
|
|
13538
|
+
function Qp(e, n, i) {
|
|
13525
13539
|
return r(async ({ query: e, topK: t }) => {
|
|
13526
13540
|
try {
|
|
13527
13541
|
let r = await n(e, { topK: t ?? i });
|
|
@@ -13538,7 +13552,7 @@ function Yp(e, n, i) {
|
|
|
13538
13552
|
})
|
|
13539
13553
|
});
|
|
13540
13554
|
}
|
|
13541
|
-
function
|
|
13555
|
+
function $p(e, n) {
|
|
13542
13556
|
return r(async ({ source: e }) => {
|
|
13543
13557
|
try {
|
|
13544
13558
|
let t = await n(e), r = Array.isArray(t) ? t : [t];
|
|
@@ -13552,19 +13566,19 @@ function Xp(e, n) {
|
|
|
13552
13566
|
schema: t.object({ source: t.string().describe("文档标识(id/URL/key)") })
|
|
13553
13567
|
});
|
|
13554
13568
|
}
|
|
13555
|
-
function
|
|
13569
|
+
function em(e) {
|
|
13556
13570
|
let { retriever: t, loader: n, useVfs: r = !0, id: i = "rag", description: a, topK: o = 5, searchToolName: s = "search_docs", loadToolName: c = "load_doc", maxToolRounds: l = 8, summarization: u, skills: d, extraTools: f } = e;
|
|
13557
13571
|
if (!t && !n && r === !1) throw Error("[page-agent-sdk][createRagSubagent] 至少配一种知识源:retriever / loader / useVfs(true)");
|
|
13558
13572
|
let p = [];
|
|
13559
|
-
t && p.push(
|
|
13573
|
+
t && p.push(Qp(s, t, o)), n && p.push($p(c, n)), f && p.push(...f);
|
|
13560
13574
|
let m = r ? [
|
|
13561
13575
|
"vfs_grep",
|
|
13562
13576
|
"vfs_read",
|
|
13563
13577
|
"vfs_json_read"
|
|
13564
|
-
] : void 0, h =
|
|
13578
|
+
] : void 0, h = Yp(r, !!t, !!n, s, c), g = {
|
|
13565
13579
|
name: "rag-search",
|
|
13566
|
-
description:
|
|
13567
|
-
getContent: () =>
|
|
13580
|
+
description: Zp.description,
|
|
13581
|
+
getContent: () => Xp(r, !!t, !!n, s, c)
|
|
13568
13582
|
};
|
|
13569
13583
|
return {
|
|
13570
13584
|
id: i,
|
|
@@ -13579,7 +13593,7 @@ function Zp(e) {
|
|
|
13579
13593
|
}
|
|
13580
13594
|
//#endregion
|
|
13581
13595
|
//#region src/core/utils/clipboard.ts
|
|
13582
|
-
async function
|
|
13596
|
+
async function tm(e) {
|
|
13583
13597
|
try {
|
|
13584
13598
|
let t = globalThis.navigator?.clipboard;
|
|
13585
13599
|
if (t && typeof t.writeText == "function") return await t.writeText(e), !0;
|
|
@@ -13597,8 +13611,8 @@ async function Qp(e) {
|
|
|
13597
13611
|
}
|
|
13598
13612
|
//#endregion
|
|
13599
13613
|
//#region src/core/composables/useChat.ts
|
|
13600
|
-
var
|
|
13601
|
-
function
|
|
13614
|
+
var nm = 4e3;
|
|
13615
|
+
function rm(e = {}) {
|
|
13602
13616
|
let { fetchResponse: t, fetchStream: n, onPersist: r, onClear: i, onQueuedCleared: a, onBeforeRegenerate: o } = e, s = /* @__PURE__ */ bt({
|
|
13603
13617
|
messages: e.messages ?? [],
|
|
13604
13618
|
loading: !1,
|
|
@@ -13677,7 +13691,7 @@ function em(e = {}) {
|
|
|
13677
13691
|
let t = e.delta || "";
|
|
13678
13692
|
n.subReasonFull = (n.subReasonFull || "") + t;
|
|
13679
13693
|
let r = (n.subReason || "") + t;
|
|
13680
|
-
n.subReason = r.length >
|
|
13694
|
+
n.subReason = r.length > nm ? r.slice(-4e3) : r;
|
|
13681
13695
|
break;
|
|
13682
13696
|
}
|
|
13683
13697
|
n.children ||= [];
|
|
@@ -13807,7 +13821,7 @@ function em(e = {}) {
|
|
|
13807
13821
|
}
|
|
13808
13822
|
//#endregion
|
|
13809
13823
|
//#region src/core/components/icons.ts
|
|
13810
|
-
var
|
|
13824
|
+
var im = {
|
|
13811
13825
|
header: "🤖",
|
|
13812
13826
|
subagent: "🤖",
|
|
13813
13827
|
subagentProgress: "🧬",
|
|
@@ -13818,10 +13832,10 @@ var tm = {
|
|
|
13818
13832
|
recommend: "💡",
|
|
13819
13833
|
conflict: "⚠️"
|
|
13820
13834
|
};
|
|
13821
|
-
function
|
|
13822
|
-
let t = { ...
|
|
13835
|
+
function am(e) {
|
|
13836
|
+
let t = { ...im };
|
|
13823
13837
|
if (!e) return t;
|
|
13824
|
-
let n = Object.keys(
|
|
13838
|
+
let n = Object.keys(im);
|
|
13825
13839
|
for (let r of n) {
|
|
13826
13840
|
let n = e[r];
|
|
13827
13841
|
typeof n == "string" && (t[r] = n);
|
|
@@ -13830,7 +13844,7 @@ function nm(e) {
|
|
|
13830
13844
|
}
|
|
13831
13845
|
//#endregion
|
|
13832
13846
|
//#region src/core/components/messages.ts
|
|
13833
|
-
var
|
|
13847
|
+
var om = {
|
|
13834
13848
|
defaultTitle: "AI 助手",
|
|
13835
13849
|
inputPlaceholder: "输入消息,Enter 发送...",
|
|
13836
13850
|
newSession: "新建会话",
|
|
@@ -14069,8 +14083,8 @@ var rm = {
|
|
|
14069
14083
|
codeDemoText: "这是一段示例文字,用于展示 CSS 效果。",
|
|
14070
14084
|
codeDemoButton: "按钮",
|
|
14071
14085
|
codeDemoInput: "输入框"
|
|
14072
|
-
},
|
|
14073
|
-
"zh-CN":
|
|
14086
|
+
}, sm = {
|
|
14087
|
+
"zh-CN": om,
|
|
14074
14088
|
"en-US": {
|
|
14075
14089
|
defaultTitle: "AI Assistant",
|
|
14076
14090
|
inputPlaceholder: "Type a message, Enter to send...",
|
|
@@ -14312,10 +14326,10 @@ var rm = {
|
|
|
14312
14326
|
codeDemoInput: "Input"
|
|
14313
14327
|
}
|
|
14314
14328
|
};
|
|
14315
|
-
function
|
|
14329
|
+
function cm(e = "zh-CN", t) {
|
|
14316
14330
|
let n = {
|
|
14317
|
-
...
|
|
14318
|
-
...
|
|
14331
|
+
...om,
|
|
14332
|
+
...sm[e]
|
|
14319
14333
|
};
|
|
14320
14334
|
if (!t) return n;
|
|
14321
14335
|
let r = { ...n };
|
|
@@ -14327,9 +14341,9 @@ function am(e = "zh-CN", t) {
|
|
|
14327
14341
|
}
|
|
14328
14342
|
//#endregion
|
|
14329
14343
|
//#region src/core/composables/chatContext.ts
|
|
14330
|
-
var
|
|
14331
|
-
function
|
|
14332
|
-
let t =
|
|
14344
|
+
var lm = Symbol("chatContext");
|
|
14345
|
+
function um(e = {}) {
|
|
14346
|
+
let t = rm({
|
|
14333
14347
|
fetchResponse: e.fetchResponse,
|
|
14334
14348
|
fetchStream: e.fetchStream,
|
|
14335
14349
|
messages: e.messages,
|
|
@@ -14350,7 +14364,7 @@ function sm(e = {}) {
|
|
|
14350
14364
|
}, h = /* @__PURE__ */ jt({}), g = (e) => h.value[e] === !0, _ = (e) => {
|
|
14351
14365
|
h.value[e] = !g(e);
|
|
14352
14366
|
}, v = /* @__PURE__ */ jt(!1), y = (e) => {
|
|
14353
|
-
|
|
14367
|
+
tm(e).then((e) => {
|
|
14354
14368
|
e && (v.value = !0, setTimeout(() => {
|
|
14355
14369
|
v.value = !1;
|
|
14356
14370
|
}, 1500));
|
|
@@ -14412,7 +14426,7 @@ function sm(e = {}) {
|
|
|
14412
14426
|
e.onClearFocus?.();
|
|
14413
14427
|
}, re = (t) => {
|
|
14414
14428
|
e.onFocusChipClick?.(t);
|
|
14415
|
-
}, ie =
|
|
14429
|
+
}, ie = am(e.icons), ae = e.locale ?? "zh-CN", oe = cm(ae, e.dialogMessages);
|
|
14416
14430
|
return {
|
|
14417
14431
|
chat: t,
|
|
14418
14432
|
inputText: o,
|
|
@@ -14453,15 +14467,15 @@ function sm(e = {}) {
|
|
|
14453
14467
|
messages: oe
|
|
14454
14468
|
};
|
|
14455
14469
|
}
|
|
14456
|
-
function
|
|
14457
|
-
let e = Rn(
|
|
14470
|
+
function dm() {
|
|
14471
|
+
let e = Rn(lm);
|
|
14458
14472
|
if (!e) throw Error("useChatContext 必须在 provide(chatContextKey) 的组件子树内调用");
|
|
14459
14473
|
return e;
|
|
14460
14474
|
}
|
|
14461
14475
|
//#endregion
|
|
14462
14476
|
//#region src/core/index.headless.ts
|
|
14463
|
-
function
|
|
14464
|
-
return
|
|
14477
|
+
function fm(e) {
|
|
14478
|
+
return Jp(e);
|
|
14465
14479
|
}
|
|
14466
14480
|
//#endregion
|
|
14467
|
-
export {
|
|
14481
|
+
export { xf as CAPABILITIES, wf as CONTEXT_PRESETS, Pd as CompressDecisionSchema, Lf as DEFAULT_COMPUTED_STYLES, Tc as DEFAULT_PROMPT_SOFT_CAP, Zl as DEFAULT_SYSTEM_PROMPT, Ku as HTML_VOID_TAGS, dl as HUMAN_CONFIRM_TOOL_NAME, ni as ImageInputError, Si as MIN_CONTEXT_WINDOW, wc as SOFT_CAP_MIN_WINDOW, vc as STOP_WORDS, Cs as UNSAFE_KEYS, ap as actionsToInspectInfo, ip as actionsToTools, Qr as agentError, Wl as analyzeContext, Fs as applyPatchToClone, Rs as applyPatchToLive, Ru as applyPatchesToBind, Io as arrayMinLength, Zr as asAgentError, Hf as buildCssPath, $l as buildDataPrompt, Sd as buildDiagnosticsReport, eu as buildSystemPrompt, lm as chatContextKey, Lu as commitSetToBind, pi as compressImage, Xl as connectMcp, h as constructLlmFromConfig, m as constructOpenLlmSync, tm as copyText, Eo as createAgent, ul as createApprovalMiddleware, gl as createBulkGuardMiddleware, um as createChatContext, fm as createChatSdk, Cl as createCheckpointManager, wl as createCheckpointMiddleware, Kd as createConflictManager, Gl as createContextInspectorMiddleware, Gu as createDataOps, Dd as createHtmlFormatCheck, Ad as createHtmlSubagent, ml as createHumanConfirmMiddleware, pl as createHumanConfirmTool, mf as createMemoryBackend, rl as createMemoryMiddleware, u as createProxyLlm, em as createRagSubagent, Wi as createSandboxRunner, Cf as createSdkEvents, Bp as createSerialRunner, vf as createSessionStore, vp as createSkillStore, Jc as createSubagentMiddleware, jc as createSubagentTracker, Zc as createSubagentsMiddleware, fp as createUsageHintsMiddleware, Tl as createVerifyMiddleware, iu as createVfs, gf as createWebStorageBackend, jl as createWriteBackCheck, Os as deepClone, cp as defineDataToolset, Ys as defineSkill, jd as defineTool, Ds as deleteByPath, Fd as deriveTitle, Xo as describeSchemaNode, fo as detectGarbledToolCall, Hs as diffObjects, qf as domInfoTool, Jf as domInspectSkill, Kf as domSearchTool, Pf as domToStructure, If as domTools, sp as domToolsStatic, Lo as elementSchemaCandidates, Bf as ensureDomListenerRecorder, bc as estimateMessageTokens, xc as estimateRoundTokens, Z as estimateTokens, _ as extractReasoningDelta, ls as extractSchemaHint, Kl as extractText, g as extractTextDelta, v as extractUsage, Af as fetchDocTools, op as fetchTools, Vs as findStrippedKeys, Zo as formatConstraints, qr as formatZodIssues, Q as getByPath, Ff as getDomTool, Gf as getElementInfo, Zf as getEnvSummary, Vf as getRecordedListeners, Ao as getSchemaAtPath, Do as getSchemaTopKeys, Ei as getTraceMetrics, Ns as hashValue, is as htmlOrchestratorPrompt, Sc as indexSummarize, ep as inspectEnvTool, tp as inspectTools, Id as isChatModel, zi as isContextLengthError, Oo as isPathAllowed, of as isQuotaError, ws as isUnsafePath, ea as jpEval, Yr as jsonParseError, js as limitDepth, bd as maskUrlCredentials, ks as maybeParseValue, hl as measureWriteScale, b as normalizeUsage, Ti as offloadPassThroughChars, wi as offloadThresholdChars, rs as presets, Wo as projectBySchema, Uo as projectBySchemaDeep, As as projectFields, Cc as recallRounds, Qo as renderSchemaHint, $o as renderSchemaOverview, ns as renderSchemaShallow, Sf as resolveCapabilities, Ef as resolveContextOptions, bf as resolveDialogConfig, Gd as resolveLlm, Ci as resolveModelCaps, Ec as resolvePromptSoftCap, No as resolveSchemaPath, yf as resolveStorage, Bs as restoreInPlace, zs as restoreLive, Xr as routeError, Js as runHostScript, ia as runSandboxedScript, Ts as safeMerge, Xf as safeSerialize, $ as safeStringify, Fo as schemaHasRefinement, Uf as searchDom, na as searchJson, lp as selectBuiltinTools, Es as setByPath, Dc as shouldTriggerCompression, Cd as stringifyDiagnosticsReport, as as systemPromptHelpers, yc as tokenize, X as toolError, ko as unwrapSchema, rm as useChat, dm as useChatContext, Po as validateAtPath, Ju as validateHtmlFormat, Fu as validateRootValueLocally, Iu as validateWriteLocally, Ps as watchFieldsHash, e as z, Jr as zodError };
|