page-agent-sdk 3.19.0 → 3.20.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 +5 -3
- package/README.zh-CN.md +5 -3
- package/dist/page-agent-sdk.headless.js +1038 -797
- package/dist/page-agent-sdk.iife.js +133 -134
- package/dist/page-agent-sdk.js +1339 -1062
- package/dist/page-agent-sdk.umd.cjs +46 -47
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +90 -0
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/page-agent-sdk)
|
|
10
10
|
[](https://github.com/whyymj/page-agent-sdk/blob/master/LICENSE)
|
|
11
|
-
[](#self-tests)
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
@@ -248,6 +248,8 @@ ChatDialog, MessageContent, CodePreview, SkillPanel, DebugDrawer, useChat
|
|
|
248
248
|
| `inputRows` | `number` · default `2` | Input box rows (visible height); `1` = single row; `2` = 2-row initial height, auto-expands up to max-height:100px; `>2` = taller initial height |
|
|
249
249
|
| `onClose` | `() => void` | Drawer mode close callback (default `hide`; pass to override and sync external mount state) |
|
|
250
250
|
| `theme` | `'light' \| 'dark'` · default `'dark'` | Built-in theme (dark = Ark design palette); fully customizable via `--cs-*` on an ancestor |
|
|
251
|
+
| `locale` | `'zh-CN' \| 'en-US'` · default `'zh-CN'` | **UI language**: switches the built-in dialog message pack; `formatTime` (12h/24h) and autoTitle language follow |
|
|
252
|
+
| `messages` | `Partial<DialogMessages>` | **Per-key message overrides** (priority over the locale pack): switching language and tweaking individual strings (e.g. `statusDone`) in one mechanism; missing keys fall back to the pack |
|
|
251
253
|
| `icons` | `Partial<DialogIcons>` | **Icon customization**: partial override of default emojis (`header` 🤖 / `subagent` 🤖 / `subagentProgress` 🧬 / `empty` 💬 / `focus` 🎯 / `queued` 📋 / `queuedEdit` ✏️ / `recommend` 💡 / `conflict` ⚠️; `assistantAvatar`/`userAvatar` default to built-in SVG, pass a text glyph to replace). Values: plain text (emoji/char) **or an HTML fragment** (starting with `<`, e.g. inline `<svg>`/`<img>` — sanitized via a DOMPurify icon allowlist; event attributes/dangerous protocols stripped); empty string hides the icon; unset keys keep defaults |
|
|
252
254
|
|
|
253
255
|
### Extension points
|
|
@@ -530,8 +532,8 @@ function switchTo(i: number) {
|
|
|
530
532
|
## Self-tests
|
|
531
533
|
|
|
532
534
|
```bash
|
|
533
|
-
npm test #
|
|
534
|
-
npm run test:e2e #
|
|
535
|
+
npm test # 2241 assertions (tsx, source-level; no LLM dependency)
|
|
536
|
+
npm run test:e2e # 718 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)
|
|
535
537
|
```
|
|
536
538
|
|
|
537
539
|
## Local npm package test
|
package/README.zh-CN.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/page-agent-sdk)
|
|
10
10
|
[](https://github.com/whyymj/page-agent-sdk/blob/master/LICENSE)
|
|
11
|
-
[](#自测)
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
@@ -244,6 +244,8 @@ ChatDialog, MessageContent, CodePreview, SkillPanel, DebugDrawer, useChat
|
|
|
244
244
|
| `inputRows` | `number` · 默认 `2` | 输入框行数(可见高度);`1` = 单行;`2` = 2 行初始高度,自动扩展至 max-height:100px;`>2` = 更高初始高度 |
|
|
245
245
|
| `onClose` | `() => void` | 抽屉模式关闭回调(默认 `hide`;传此选项覆盖默认,便于同步外部挂载状态) |
|
|
246
246
|
| `theme` | `'light' \| 'dark'` · 默认 `'dark'` | 内置主题(dark = 方舟设计稿深色紫调);亦可祖先覆盖 `--cs-*` 完全自定义 |
|
|
247
|
+
| `locale` | `'zh-CN' \| 'en-US'` · 默认 `'zh-CN'` | **UI 语言**:切换内置对话框文案包;`formatTime`(12h/24h)与 autoTitle 标题语言跟随 |
|
|
248
|
+
| `messages` | `Partial<DialogMessages>` | **文案键级覆盖**(优先于 locale 包):换语言与改个别文案(如 `statusDone: '完成'`)一套机制;漏配键回退 locale 包 |
|
|
247
249
|
| `icons` | `Partial<DialogIcons>` | **图标自定义**:局部覆盖默认 emoji(`header` 🤖 / `subagent` 🤖 / `subagentProgress` 🧬 / `empty` 💬 / `focus` 🎯 / `queued` 📋 / `queuedEdit` ✏️ / `recommend` 💡 / `conflict` ⚠️;`assistantAvatar`/`userAvatar` 缺省 = 内置 SVG,传文本字形替换)。值为纯文本(emoji/字符)或 **HTML 片段**(以 `<` 开头,如内联 `<svg>`/`<img>`,经 DOMPurify 图标白名单净化,事件属性/危险协议剥除);空串 = 隐藏该图标;未传键用默认 |
|
|
248
250
|
|
|
249
251
|
### 扩展点
|
|
@@ -475,8 +477,8 @@ function switchTo(i: number) {
|
|
|
475
477
|
## 自测
|
|
476
478
|
|
|
477
479
|
```bash
|
|
478
|
-
npm test #
|
|
479
|
-
npm run test:e2e #
|
|
480
|
+
npm test # 2241 项断言(tsx 源码级,不依赖 LLM)
|
|
481
|
+
npm run test:e2e # 718 项集成断言(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 配置 / 错误场景)
|
|
480
482
|
```
|
|
481
483
|
|
|
482
484
|
## 本地 npm 包测试
|