page-agent-sdk 2.4.1 → 2.5.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 -2
- package/README.zh-CN.md +3 -2
- package/dist/page-agent-sdk.iife.js +118 -118
- package/dist/page-agent-sdk.js +585 -401
- package/dist/page-agent-sdk.umd.cjs +33 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,9 +24,10 @@ At its core, it gives the AI a **standardized, safe JSON-operation channel**. AI
|
|
|
24
24
|
|
|
25
25
|
| Constraint | Mechanism | Effect |
|
|
26
26
|
|---|---|---|
|
|
27
|
-
| **Scope control** | Property registry (`data`) — only declared paths are writable | AI touching undeclared fields →
|
|
27
|
+
| **Scope control** | Property registry (`data`) — only declared paths are writable; schema shape auto-whitelist (top-level keys limit visible + writable; undeclared fields hidden/denied; whole-set becomes merge to prevent accidental deletion) | AI touching undeclared fields → `PATH_DENIED` |
|
|
28
28
|
| **Validity check** | zod schema — `write`/`set`/`edit` validated against schema | Invalid type/enum/structure → structured error, no write |
|
|
29
|
-
| **Incremental op** | `write` with `patch` (or advanced `edit_data`
|
|
29
|
+
| **Incremental op** | `write` with `patch`/`patches` (batch, atomic rollback) or advanced `edit_data` patches by `jsonPath` (set/remove/merge/append) | Avoid re-sending the whole large JSON; precise local edits; use `patches` to edit many at once |
|
|
30
|
+
| **Large-object retrieval** | `read` supports `fields` (projection) + `depth` (truncation) to shrink payload; `query_data` (JSONPath)/`search_data` (text)/`eval_script` (sandboxed JS) | Efficient retrieval + pinpoint location in large JSON |
|
|
30
31
|
| **Rollbackable** | per-path snapshots (auto-stacked) + session checkpoint | Bad edit → one-click restore to the last good state |
|
|
31
32
|
| **Optimistic lock** | `expectedHash` on `set`/`edit`/`delete` + conflict human-in-the-loop | Concurrent external edits detected → suspend, user picks keep/overwrite/restore |
|
|
32
33
|
|
package/README.zh-CN.md
CHANGED
|
@@ -24,9 +24,10 @@
|
|
|
24
24
|
|
|
25
25
|
| 约束 | 机制 | 作用 |
|
|
26
26
|
|---|---|---|
|
|
27
|
-
| **范围控制** | schema 校验(`data`)—— 只能改 schema
|
|
27
|
+
| **范围控制** | schema 校验(`data`)—— 只能改 schema 允许的值;schema 形状自动白名单(顶层 key 限制可见 + 可写,未声明字段隐藏/拒改/整体 set 转 merge 防误删) | AI 传非法值 → 拒绝;非声明字段 → `PATH_DENIED` |
|
|
28
28
|
| **合法性校验** | zod schema —— `write`/`set`/`edit` 按 schema 校验 | 类型/枚举/结构不合法 → 结构化错误,不写入 |
|
|
29
|
-
| **增量操作** | `write` 的 `patch`(或 advanced `edit_data`
|
|
29
|
+
| **增量操作** | `write` 的 `patch`/`patches`(批量,原子回滚)或 advanced `edit_data` 按 `jsonPath` 发 patch(set/remove/merge/append) | 避免重传整个大 JSON,精确改局部;一次改多处用 `patches` |
|
|
30
|
+
| **大对象检索** | `read` 支持 `fields`(字段裁剪)+ `depth`(深度截断)减体积;`query_data`(JSONPath)/`search_data`(文本)/`eval_script`(沙箱 JS) | 大 JSON 高效检索 + 局部定位 |
|
|
30
31
|
| **可回滚** | per-path 快照(自动入栈)+ 会话 checkpoint | 改坏了一键回退到上次正常态 |
|
|
31
32
|
| **乐观锁** | `set`/`edit`/`delete` 传 `expectedHash` + 冲突人工介入 | 检测并发外部修改 → 挂起,用户选保留/覆盖/回退 |
|
|
32
33
|
|