page-agent-sdk 4.2.0 → 4.2.2

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 CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  [![npm](https://img.shields.io/npm/v/page-agent-sdk.svg)](https://www.npmjs.com/package/page-agent-sdk)
10
10
  [![license](https://img.shields.io/badge/license-ISC-blue.svg)](https://github.com/whyymj/page-agent-sdk/blob/master/LICENSE)
11
- [![tests](https://img.shields.io/badge/self%20tests-3054%20asserts-brightgreen.svg)](#self-tests)
11
+ [![tests](https://img.shields.io/badge/self%20tests-3055%20asserts-brightgreen.svg)](#self-tests)
12
12
 
13
13
  ---
14
14
 
package/README.zh-CN.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  [![npm](https://img.shields.io/npm/v/page-agent-sdk.svg)](https://www.npmjs.com/package/page-agent-sdk)
10
10
  [![license](https://img.shields.io/badge/license-ISC-blue.svg)](https://github.com/whyymj/page-agent-sdk/blob/master/LICENSE)
11
- [![tests](https://img.shields.io/badge/self%20tests-3054%20asserts-brightgreen.svg)](#自测)
11
+ [![tests](https://img.shields.io/badge/self%20tests-3055%20asserts-brightgreen.svg)](#自测)
12
12
 
13
13
  ---
14
14
 
@@ -8,7 +8,7 @@ function l(e) {
8
8
  return !!(e == null || typeof e == "string" || e instanceof ArrayBuffer || ArrayBuffer.isView(e) || typeof Blob < "u" && e instanceof Blob || e instanceof URLSearchParams || e instanceof FormData);
9
9
  }
10
10
  function u(e) {
11
- let t = e.model || "gpt-3.5-turbo", r = e.temperature, i = e.maxTokens, a = e.baseUrl;
11
+ let t = e.model || "deepseek-v4-flash", r = e.temperature, i = e.maxTokens, a = e.baseUrl;
12
12
  if (e.mode === "direct") {
13
13
  let o = !1;
14
14
  try {
@@ -3575,7 +3575,7 @@ function No(e) {
3575
3575
  return Array.isArray(r) && r.length && r[0] && typeof r[0].jsonPath == "string" ? r[0].jsonPath : "";
3576
3576
  }
3577
3577
  function Po(e) {
3578
- let { apiKey: t, baseUrl: r, model: c = "gpt-3.5-turbo", temperature: l = .7, maxTokens: u, extraBody: d, extraConfig: f, systemPrompt: p, tools: v = [], middleware: y = [], maxToolRounds: S, maxIterations: C, maxRetries: E = 2, retryDelayMs: D = 500, stallMs: O = Bi, streamMaxMs: k = Hi, toolTimeoutMs: te, maxParallelTools: ne = 1, maxVerifyAttempts: A = 0, roundTokenBudget: j = 0, onLog: re, onLlmChange: M, imageContentFormat: N = "openai", staleReadInvalidation: P = !0, debug: ie = !1 } = e, F = S ?? Eo;
3578
+ let { apiKey: t, baseUrl: r, model: c = "deepseek-v4-flash", temperature: l = .7, maxTokens: u, extraBody: d, extraConfig: f, systemPrompt: p, tools: v = [], middleware: y = [], maxToolRounds: S, maxIterations: C, maxRetries: E = 2, retryDelayMs: D = 500, stallMs: O = Bi, streamMaxMs: k = Hi, toolTimeoutMs: te, maxParallelTools: ne = 1, maxVerifyAttempts: A = 0, roundTokenBudget: j = 0, onLog: re, onLlmChange: M, imageContentFormat: N = "openai", staleReadInvalidation: P = !0, debug: ie = !1 } = e, F = S ?? Eo;
3579
3579
  (!Number.isFinite(F) || F < 1) && (console.warn(`[page-agent-sdk] maxToolRounds=${F} 非法(须 ≥1 正整数),已 clamp 到 1(0/负数致主循环 while 不进 → agent 不调 LLM 静默返回兜底文案)`), F = 1);
3580
3580
  let I = m({
3581
3581
  model: c,
@@ -5215,6 +5215,7 @@ function nc(e) {
5215
5215
  "## 当前精修目标",
5216
5216
  t.map((e) => `· ${e.path}${e.label ? `(${e.label})` : ""}`).join("\n"),
5217
5217
  `仅操作上述 ${t.length} 个聚焦子树${t.length > 1 ? "之一" : ""},用户未指明目标的指令默认作用于聚焦组件(「增加/修改/删除 X」类指令优先理解为对聚焦组件本身的改动 —— 如为其加页签/子项,写焦点路径的子路径;仅用户明确要求新建独立组件时才需解除焦点);不要改动其他组件;${a}`,
5218
+ "用户用指示代词提问(「这是啥/这个/它是干什么的」等)时,所指默认是聚焦目标 —— 先 read 聚焦子树,再围绕聚焦组件回答,勿泛答整页",
5218
5219
  "read 不带路径时默认只返回聚焦子树;需要全量主数据时显式列顶层键(read({jsonPaths:[...]}) )"
5219
5220
  ], r = e.getSchema();
5220
5221
  if (r) {
@@ -13831,6 +13832,7 @@ function hm(e = {}) {
13831
13832
  content: "",
13832
13833
  timestamp: Date.now(),
13833
13834
  reasoning: "",
13835
+ reasoningTotal: 0,
13834
13836
  steps: []
13835
13837
  }), r = !1;
13836
13838
  s.messages.push(t);
@@ -13841,7 +13843,7 @@ function hm(e = {}) {
13841
13843
  e.round > 1 && (t.content || t.reasoning) && (r = !0);
13842
13844
  break;
13843
13845
  case "reasoning":
13844
- r &&= (t.reasoning += "\n", !1), t.reasoning = (t.reasoning + e.delta).slice(-4e3);
13846
+ r &&= (t.reasoning += "\n", !1), t.reasoningTotal += e.delta.length, t.reasoning = (t.reasoning + e.delta).slice(-4e3);
13845
13847
  break;
13846
13848
  case "text":
13847
13849
  r &&= (t.content += "\n", !1), t.content += e.delta;