page-agent-sdk 3.41.0 → 3.43.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 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-2525%20asserts-brightgreen.svg)](#self-tests)
11
+ [![tests](https://img.shields.io/badge/self%20tests-2806%20asserts-brightgreen.svg)](#self-tests)
12
12
 
13
13
  ---
14
14
 
@@ -252,12 +252,12 @@ ChatDialog, MessageContent, CodePreview, SkillPanel, DebugDrawer, useChat
252
252
  | | `contextOptions` | `Partial<ContextManagerOptions> \| false` | Fine params (`false` disables compression). Includes `promptSoftCapTokens` (3.11+ compression cost cap — 160K default when window ≥320K, explicit `0` disables) and `preserveLastToolResults` (default `['describe_data','describe_data']` — keep field descriptions in compressed summary) |
253
253
  | | `summaryLlm` | `BaseChatModel \| LLMConfig` | Summary-dedicated LLM (defaults to main `llm`) |
254
254
  | | `maxMemoryRounds` | `number` · default `30` | Dialog history memory round cap (`0` disables trim) |
255
- | | `vfs` | `{initialFiles?,maxBytes?,poolBytes?,mainTools?}` · default 4MB, `mainTools:true` | In-memory workspace cap (LRU evict on overflow). `mainTools:false` (3.41+) hides the 9 vfs tools from the main agent's view (usageHints sync-skips the vfs section) while subagent stacks keep supply via the internal tool pool for orchestrator-only main agents |
256
- | | `data.tools` | `'high' \| string[]` | 3.41+ assembly-time dataOps tool whitelist. `'high'` drops the legacy quartet (`get/set/edit/delete_data` superseded by `read`/`write`); an explicit name array filters exactly; opt-in families (draft/resource) always preserved when assembled
255
+ | | `staleReadInvalidation` | `boolean` · default `true` | 3.42+ write-driven stale read invalidation: within one invoke's ReAct window, old `read`/`query_data`/`search_data` results hit by a later successful write are replaced with an invalidation placeholder (keeps the model from answering state from stale snapshots; anti-thrash copy references the write's own new value/hash). `false` = off for main + subagent stacks |
256
+ | | `vfs` | `{initialFiles?,maxBytes?,poolBytes?}` · default 4MB | In-memory workspace cap (LRU evict on overflow) |
257
257
  | **Persistence** | `storage` | `'indexed' \| 'session' \| 'local' \| 'memory' \| config \| false` · default off | Assign to enable; multi-agent isolated by `id` |
258
258
  | | `session` | `{id?,autoResume?,title?}` | Session control |
259
259
  | | `shareContext` | `boolean` · default `false` | Same `id` instances share one agent |
260
- | **Robustness/other** | `maxRetries` / `maxParallelTools` / `maxToolRounds` | `number` · 2 / 1 / 10 | Model retries / per-round tool concurrency (>1 enables same-round parallel delegation with failure isolation + per-component mutex locks) / max rounds |
260
+ | **Robustness/other** | `maxRetries` / `maxParallelTools` / `maxToolRounds` | `number` · 2 / 1 / 30 | Model retries / per-round tool concurrency (>1 enables same-round parallel delegation with failure isolation + per-component mutex locks) / max rounds |
261
261
  | | `roundTokenBudget` | `number` · default `0` (off) | Per-invocation cumulative token cap (3.11+; exceed → friendly wrap-up, partial work preserved; orthogonal to automation's `tokenBudget`, no automation capability needed) |
262
262
  | | `mcp` | `McpServerConfig[]` | Remote MCP servers (http/sse/websocket) |
263
263
  | | `middleware` | `Middleware[]` | Custom middleware (appended to built-in stack) |
@@ -495,8 +495,8 @@ function switchTo(i: number) {
495
495
  ## Self-tests
496
496
 
497
497
  ```bash
498
- npm test # 2762 assertions (tsx, source-level; no LLM dependency)
499
- npm run test:e2e # 906 integration assertions (node, built dist; covers APIs/options/modules/simple&complex scenes: default systemPrompt(capability overview) / dynamic register + inspect sync / inspect(tools/middleware/subagent/verify/mcp/todos/lastCompression/checkpoints reflect config) / custom tools/middleware/skills/memory injection / runtime dynamic reconfiguration(setTools/addTool/removeTool/setLlm/setMemory/setSubagents reflect) / switchSession(on/off) / shareContext on/off sharing/independent / storage backends + object config / presets(3) / checkpoint / exports complete(39+ fns/components) / util fns usable(isQuotaError/estimateTokens/jpEval/searchJson) / source=builtin / mount boundary / hook multi-listener / llm config / hide/show / error scenes)
498
+ npm test # 2806 assertions (tsx, source-level; no LLM dependency)
499
+ npm run test:e2e # 929 integration assertions (node, built dist; covers APIs/options/modules/simple&complex scenes: default systemPrompt(capability overview) / dynamic register + inspect sync / inspect(tools/middleware/subagent/verify/mcp/todos/lastCompression/checkpoints reflect config) / custom tools/middleware/skills/memory injection / runtime dynamic reconfiguration(setTools/addTool/removeTool/setLlm/setMemory/setSubagents reflect) / switchSession(on/off) / shareContext on/off sharing/independent / storage backends + object config / presets(3) / checkpoint / exports complete(39+ fns/components) / util fns usable(isQuotaError/estimateTokens/jpEval/searchJson) / source=builtin / mount boundary / hook multi-listener / llm config / hide/show / error scenes)
500
500
  ```
501
501
 
502
502
  ## Local npm package test
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-2525%20asserts-brightgreen.svg)](#自测)
11
+ [![tests](https://img.shields.io/badge/self%20tests-2806%20asserts-brightgreen.svg)](#自测)
12
12
 
13
13
  ---
14
14
 
@@ -248,12 +248,12 @@ ChatDialog, MessageContent, CodePreview, SkillPanel, DebugDrawer, useChat
248
248
  | | `contextOptions` | `Partial<ContextManagerOptions> \| false` | 细参覆盖(`false` 关压缩)。含 `promptSoftCapTokens`(3.11+ 压缩触发成本上限,窗口 ≥320K 默认 160K、显式 0 关)与 `preserveLastToolResults`(默认 `['describe_data','describe_data']`——压缩摘要里保留字段说明) |
249
249
  | | `summaryLlm` | `BaseChatModel \| LLMConfig` | 摘要专用 LLM(不配用主 `llm`) |
250
250
  | | `maxMemoryRounds` | `number` · 默认 `30` | 对话历史内存上限轮次(`0` 关裁剪) |
251
- | | `vfs` | `{initialFiles?,maxBytes?,poolBytes?,mainTools?}` · 默认 4MB, `mainTools:true` | 内存工作区上限(超限 LRU 淘汰)。`mainTools:false`(3.41+)把 9 vfs 工具从主 agent 视野隐藏(usageHints 同步不注入 vfs 段),子 agent 栈经内部工具池照常供给 —— 适合主 agent 只编排不落盘的场景 |
252
- | | `data.tools` | `'high' \| string[]` | 3.41+ dataOps 装配期工具白名单。`'high'` 裁掉旧四件(`get/set/edit/delete_data`,与高层 `read`/`write` 同职能二选一);具体名单按名精确过滤;opt-in 家族(draft/resource)装配了就保留 |
251
+ | | `staleReadInvalidation` | `boolean` · 默认 `true` | 3.42+ 写驱动过期读失效:单次 invoke 窗口内,后续成功写击中路径的旧 `read`/`query_data`/`search_data` 结果替换为失效占位(防模型凭旧快照答状态;占位引用写结果自带新值/hash thrash)。`false` = 主/子栈一致关闭 |
252
+ | | `vfs` | `{initialFiles?,maxBytes?,poolBytes?}` · 默认 4MB | 内存工作区上限(超限 LRU 淘汰) |
253
253
  | **持久化** | `storage` | `'indexed' \| 'session' \| 'local' \| 'memory' \| 配置 \| false` · 默认关 | 赋值开启;多 agent 靠 `id` 隔离 |
254
254
  | | `session` | `{id?,autoResume?,title?}` | 会话控制 |
255
255
  | | `shareContext` | `boolean` · 默认 `false` | 同 `id` 多实例共享同一 agent |
256
- | **鲁棒/其他** | `maxRetries` / `maxParallelTools` / `maxToolRounds` | `number` · 2 / 1 / 10 | 模型重试 / 同轮工具并发(>1 启用同轮并行委派,失败隔离 + 同组件锁互斥)/ 最大轮次 |
256
+ | **鲁棒/其他** | `maxRetries` / `maxParallelTools` / `maxToolRounds` | `number` · 2 / 1 / 30 | 模型重试 / 同轮工具并发(>1 启用同轮并行委派,失败隔离 + 同组件锁互斥)/ 最大轮次 |
257
257
  | | `roundTokenBudget` | `number` · 默认 `0`(关) | 单次调用累计 token 上限(3.11+;超限友好收口,已完成部分保留;与 automation 的 `tokenBudget` 正交,无需开 automation) |
258
258
  | | `mcp` | `McpServerConfig[]` | 远程 MCP server(http/sse/websocket) |
259
259
  | | `middleware` | `Middleware[]` | 自定义中间件(拼到内置栈末尾) |
@@ -498,8 +498,8 @@ function switchTo(i: number) {
498
498
  ## 自测
499
499
 
500
500
  ```bash
501
- npm test # 2762 项断言(tsx 源码级,不依赖 LLM)
502
- npm run test:e2e # 906 项集成断言(node 跑构建产物 dist;覆盖各 API/配置项/功能模块/简单与复杂场景:默认 systemPrompt(含能力概述) / 动态注册与 inspect 同步 / inspect(tools/middleware/subagent/verify/mcp/todos/lastCompression/checkpoints 反映配置) / 自定义 tools/middleware/skills/memory 注入 / 运行时动态重配置(setTools/addTool/removeTool/setLlm/setMemory/setSubagents 反映) / switchSession(开/未开) / shareContext 开/关共享独立 / storage 后端+对象配置 / presets 三预设 / checkpoint / 导出项完整(39+ 函数/组件) / 工具函数可用(isQuotaError/estimateTokens/jpEval/searchJson) / source=builtin / mount 边界 / hook 多监听器 / llm 配置 / 错误场景)
501
+ npm test # 2806 项断言(tsx 源码级,不依赖 LLM)
502
+ npm run test:e2e # 929 项集成断言(node 跑构建产物 dist;覆盖各 API/配置项/功能模块/简单与复杂场景:默认 systemPrompt(含能力概述) / 动态注册与 inspect 同步 / inspect(tools/middleware/subagent/verify/mcp/todos/lastCompression/checkpoints 反映配置) / 自定义 tools/middleware/skills/memory 注入 / 运行时动态重配置(setTools/addTool/removeTool/setLlm/setMemory/setSubagents 反映) / switchSession(开/未开) / shareContext 开/关共享独立 / storage 后端+对象配置 / presets 三预设 / checkpoint / 导出项完整(39+ 函数/组件) / 工具函数可用(isQuotaError/estimateTokens/jpEval/searchJson) / source=builtin / mount 边界 / hook 多监听器 / llm 配置 / 错误场景)
503
503
  ```
504
504
 
505
505
  ## 本地 npm 包测试