page-agent-sdk 4.9.3 → 4.11.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
@@ -159,6 +159,9 @@ CDN zero-config: `<script src="https://unpkg.com/page-agent-sdk"></script>` →
159
159
  | 🛡️ compression-safe | Live data snapshot + preserved tool results in summary; write returns hint available paths; `systemPromptHelpers.reliableWriteRules` | built-in |
160
160
  | 💰 Context economy (3.10/3.11+) | Compression cost cap `promptSoftCapTokens` (defaults to 160K when window ≥320K — huge-window models no longer burn hundreds of thousands of tokens before compressing; reflected via `inspect().compression`) + agent budget self-awareness (70%-rounds / half-cap token hint, consecutive write-failure reminder, per-invocation `roundTokenBudget` friendly wrap-up) + tool-description slimming (-40% prompt) | `contextOptions.promptSoftCapTokens`, `roundTokenBudget` |
161
161
  | 💾 persistence | IndexedDB multi-session + quota eviction + switch | `storage` |
162
+ | ⚡ quick actions / session transfer (4.10+) | `dialog.quickActions` chip row above the input sends high-frequency prompts in one click (no pre-fill; queueing/gate semantics inherited); `sdk.exportSession`/`importSession` fully restorable session JSON (copy semantics, never overwrites; `dialog.sessionTransfer:true` adds history-panel entries); `dialog.onDropElement` callback when a host element is dragged into the input (focus entry, mapping stays host-side); `approval.preview:true` renders the write-approval bar as a structured old→new diff (validation failures visible before approving) | `dialog.{quickActions,sessionTransfer,onDropElement}` + `approval.preview` |
163
+ | 🖥 server-side (node) execution (smoke-backed 4.10+) | the same SDK runs in node: `page-agent-sdk/headless` subpath + `ui:false`, backed by a real-LLM dual-protocol smoke test (full read→write→restore_data tool loop); browser-domain APIs explicitly unavailable (get_dom returns a friendly pointer to data tools; canvas render checks auto-degrade); unattended combo (approval auto-reject + `conflictPolicy` + `batch`) for scheduled/webhook long tasks | `ui:false` + headless subpath (`npm run test:node-real` is the in-repo smoke) |
164
+ | 🧪 regression toolkit eval-toolkit | the SDK's own real-LLM regression core, exported for integrators to run **their own** pre-upgrade scenario regressions: `createEvalHarness({sdk})` (waitForIdle dual-condition idle detection + collectReport snapshots) + `diffReport` (token ±15% AND ±2000 / toolCount ±3 thresholds, variance-proof); report shape matches the SDK's own — bug reports parse for free; shipped from both main and headless entries | `import { createEvalHarness, diffReport } from 'page-agent-sdk'` |
162
165
  | 👁 DOM inspect (2.20+) | `get_dom` structure read + `dom_search` (selector/text) + `dom_info` (content/computed styles/event bindings from inline/Vue props/listener recorder) — lazy-injected via the `dom-inspect` skill so they don't occupy standing tool context | `capabilities.domInspect` |
163
166
  | 📊 Context inspector | Snapshot actual-LLM-message composition (total / occupancy / category ratio); DebugDrawer `📊 上下文` tab + `inspectContext()`; zero LLM cost, default on | `capabilities.contextInspector` |
164
167
  | 🤖 Agent-driven compression (2.33+) | `capabilities.agentCompression` (opt-in) lets the summary LLM decide per-trigger compression strategy via an `inspect_context` tool loop (keepRounds / windowRatio / summary mode / recall / preserve); `shouldTriggerCompression` gate avoids per-message LLM cost; decide failure/timeout degrades to static; `decisionTimeoutMs` / `decisionMaxTokens` configurable | `capabilities.agentCompression` + `summaryLlm` |
package/README.zh-CN.md CHANGED
@@ -159,6 +159,9 @@ CDN 零配置:`<script src="https://unpkg.com/page-agent-sdk"></script>` → `
159
159
  | 🛡️ 压缩不丢信息 | 摘要内嵌当前 data 快照 + 保留指定工具结果;写返回附可操作 path;`systemPromptHelpers.reliableWriteRules` | 内置 |
160
160
  | 💰 上下文经济性 (3.10/3.11+) | 压缩触发成本上限 `promptSoftCapTokens`(窗口 ≥320K 默认 160K,大窗口模型不再烧几十万 token 才压缩;`inspect().compression` 反射)+ agent 预算自感知(轮次 70%/token 半程注入提示、连续写失败提醒、单轮预算 `roundTokenBudget` 友好收口)+ 工具描述瘦身(-40% prompt) | `contextOptions.promptSoftCapTokens`、`roundTokenBudget` |
161
161
  | 💾 持久化 | IndexedDB 多会话 + 配额淘汰 + 切换 | `storage` |
162
+ | ⚡ 快捷指令 / 会话转移 (4.10+) | `dialog.quickActions` 输入区 chip 行一键发高频 prompt(不预填输入框,排队/门禁语义自动继承);`sdk.exportSession`/`importSession` 会话导出导入(可复全 JSON,副本语义不覆盖;`dialog.sessionTransfer:true` 历史面板入口);`dialog.onDropElement` 拖宿主元素进输入框回调(聚焦入口,映射归宿主);`approval.preview:true` write 审批确认条渲染结构化 old→new diff(校验失败批准前可见) | `dialog.{quickActions,sessionTransfer,onDropElement}` + `approval.preview` |
163
+ | 🖥 服务端(node)运行 (4.10+ 冒烟背书) | 同一套 SDK 在 node 跑:`page-agent-sdk/headless` 子路径 + `ui:false`,真 LLM 双协议冒烟(read→write→restore_data 完整工具循环)背书;浏览器域 API 明示不可用(get_dom 友好回退/canvas 渲染检查自动降级);无人值守组合(approval 自动拒 + `conflictPolicy` + `batch`)跑定时/webhook 长任务 | `ui:false` + headless 子路径(`npm run test:node-real` 为仓库内冒烟) |
164
+ | 🧪 回归工具 eval-toolkit | SDK 自用真 LLM 回归判定核公开导出,集成方为**自己的场景**跑升级前回归:`createEvalHarness({sdk})`(waitForIdle 双条件 idle 判定 + collectReport 报告快照)+ `diffReport`(token ±15% 且 ±2000 / toolCount ±3 阈值判定,防方差误报);与 SDK 自用报告同构,报问题格式互通;主包/headless 双入口同带 | `import { createEvalHarness, diffReport } from 'page-agent-sdk'` |
162
165
  | 🤖 无人值守自动化 (2.20+) | 资源预算闸(`tokenBudget`/`timeBudgetMs`)+ 致命错误自动恢复(`maxAutoRetries`:回退 checkpoint + 重试)+ 刷新续跑 + `sdk.batch(tasks)` 批处理 | `capabilities.automation` |
163
166
  | 📐 上下文健壮性 (2.30+) | 硬地板 `contextWindow ≥200K`(启动拒绝 <200K 模型如老款 `deepseek`/`gpt-4o`/`glm-4.5`);三道闸(压缩/trim/offload)阈值在 `setLlm` 后跟随实时窗口;遇 `context_length_exceeded` 反应性重试(激进 trim → 重试一次,不裸失败);vfs 大结果引用受保护免 LRU 淘汰 + OOM 1.5× 兜底;系统段预算(25% 窗口,丢弃非 pin 段保 base/mission/workingMemory) | 内置 |
164
167
  | 🎯 focus 自动切换 (2.31+) | AI 自动判断任务范围 → `set_focus`(局部任务)/ `clear_focus`(全局/完成);focus 跨刷新/切会话持久化(restore 经 `getSchemaAtPath` 校验 path,失效丢弃);子 agent 继承主焦点(三层收敛;主未聚焦 → 子无 focus 中间件,零回归) | `capabilities.focus` |