page-agent-sdk 4.18.0 → 4.19.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-3698%20asserts-brightgreen.svg)](#self-tests)
11
+ [![tests](https://img.shields.io/badge/self%20tests-3705%20asserts-brightgreen.svg)](#self-tests)
12
12
 
13
13
  ---
14
14
 
@@ -285,6 +285,7 @@ ChatDialog, MessageContent, CodePreview, SkillPanel, DebugDrawer, useChat
285
285
  | `title` / `placeholder` | `string` | Dialog title / input placeholder (cosmetic) |
286
286
  | `drawer` | `boolean` · default `false` | Drawer mode: ChatDialog slides in from right + mask + close button (replaces collapse arrow); clicking mask/close defaults to `hide` (keeps agent/history/in-flight generation; `mount`/`show` resumes). Pass `onClose` to customize |
287
287
  | `drawerWidth` | `number \| string` · default `420` | Drawer mode width (pixels or CSS string, e.g. `500` / `'500px'` / `'40vw'`); only effective when `drawer: true`; inline mode width determined by `container` |
288
+ | `drawerResizable` | `boolean` · default `true` | Drawer left-edge drag handle: drag / arrow keys to resize (clamped 320 ~ min(960, 90% viewport)); width remembered in `localStorage`; `false` = fixed width |
288
289
  | `drawerHidden` | `boolean` · default `false` | Drawer mode hidden by default (not shown after `mount`; requires `sdk.show()` to display): for "click button to show chatbox" scenarios; only effective when `drawer: true` |
289
290
  | `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 |
290
291
  | `onClose` | `() => void` | Drawer mode close callback (default `hide`; pass to override and sync external mount state) |
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-3698%20asserts-brightgreen.svg)](#自测)
11
+ [![tests](https://img.shields.io/badge/self%20tests-3705%20asserts-brightgreen.svg)](#自测)
12
12
 
13
13
  ---
14
14
 
@@ -287,6 +287,7 @@ ChatDialog, MessageContent, CodePreview, SkillPanel, DebugDrawer, useChat
287
287
  | `title` / `placeholder` | `string` | 对话框标题 / 输入框 placeholder(装饰性) |
288
288
  | `drawer` | `boolean` · 默认 `false` | 抽屉模式:ChatDialog 从右滑入 + 遮罩 + 关闭按钮(替代收起下箭头);点遮罩/关闭按钮默认 `hide`(保留 agent/历史/生成进程,再 `mount`/`show` 恢复),传 `onClose` 自定义 |
289
289
  | `drawerWidth` | `number \| string` · 默认 `420` | 抽屉模式宽度(像素或 CSS 字符串,如 `500` / `'500px'` / `'40vw'`);仅 `drawer:true` 生效;inline 模式宽度由 `container` 决定 |
290
+ | `drawerResizable` | `boolean` · 默认 `true` | 抽屉左边缘拖拽手柄:拖动 / 方向键调宽(钳制 320 ~ min(960, 视口 90%));宽度经 `localStorage` 记住;`false` = 纯固定宽度 |
290
291
  | `drawerHidden` | `boolean` · 默认 `false` | 抽屉模式默认隐藏(`mount` 后不显示,需 `sdk.show()` 才出现):适合「点击按钮才出现聊天框」场景;仅 `drawer:true` 生效 |
291
292
  | `inputRows` | `number` · 默认 `2` | 输入框行数(可见高度);`1` = 单行;`2` = 2 行初始高度,自动扩展至 max-height:100px;`>2` = 更高初始高度 |
292
293
  | `onClose` | `() => void` | 抽屉模式关闭回调(默认 `hide`;传此选项覆盖默认,便于同步外部挂载状态) |
@@ -7816,12 +7816,14 @@ var sd = [
7816
7816
  "你可以经专用工具探查页面:read_page 读页面正文(长文按 hasMore 分页续读)、get_dom 读渲染后结构、dom_search / dom_info 定位元素与查属性" + (e ? "、take_screenshot 截图查看实际渲染效果(视觉问题优先截图,结构推断不能代替)" : "") + ";一切以工具读到的页面实料为准。",
7817
7817
  "用户消息可能带 [引用原文] 块(其在页面上选中的文字):优先围绕引用内容作答,需要更多上下文再向外探索(所在小节 → 整页)。",
7818
7818
  "回答纪律:答案须来自你实际读到的页面内容并点明出处;页面内容与你的先验知识冲突时以页面为准;页面没写的不要编造,本页找不到的如实说明。",
7819
+ "输出从简:直接说内容,不写过程 —— 不要「我先读一下页面」这类旁白、不要「先给结论/依据是」这类包装、不要解释结论是怎么推出来的、不要「下面分三点/综上」这类套话;出处用句末括注(如「(§小节名)」)带过即可。",
7819
7820
  ld
7820
7821
  ].join("\n"), fd = (e) => [
7821
7822
  "You are a page content assistant that helps users understand, locate, and troubleshoot the web page they are on.",
7822
7823
  "You can inspect the page through dedicated tools: read_page for page text (paginate via hasMore on long documents), get_dom for the rendered structure, dom_search / dom_info to locate elements and read attributes" + (e ? ", and take_screenshot to see the actual rendered appearance (prefer a screenshot for visual questions; structural inference is no substitute)" : "") + "; the page as read by tools is the source of truth.",
7823
7824
  "User messages may carry a [quoted text] block (text they selected on the page): answer around the quote first, then explore outward (its section → the whole page) if more context is needed.",
7824
7825
  "Answer discipline: answers must come from the page content you actually read, citing where it came from; when the page conflicts with your prior knowledge, the page wins; never invent what the page does not say, and state honestly when something cannot be found on this page.",
7826
+ "Be terse: state the content directly, never narrate process — no \"let me first read the page\" asides, no \"in summary / the evidence is\" packaging, no explaining how you derived the conclusion, no \"here are three points\" preambles; cite sources inline as a short parenthetical such as \"(§ section name)\".",
7825
7827
  ud,
7826
7828
  "Respond in English."
7827
7829
  ].join("\n"), pd = ["你是一个智能助手。", ld].join("\n"), md = [
@@ -14254,7 +14256,13 @@ function Wg(e = {}) {
14254
14256
  "## 回答纪律(页面问答的底线)",
14255
14257
  "- **基于页面实料**:答案须来自你读到的页面内容(引用原文/read_page/dom 工具结果),并在回答中点明出处小节/位置",
14256
14258
  "- **页面 ≠ 训练数据**:页面内容可能与你的先验知识不同,冲突时以页面为准;页面没写的不要编造",
14257
- "- **不确定就说不确定**:找不到的内容如实说「本页未找到」,给出已探索的范围,勿凭印象补全"
14259
+ "- **不确定就说不确定**:找不到的内容如实说「本页未找到」,给出已探索的范围,勿凭印象补全",
14260
+ "## 输出纪律(直接说内容,不写过程)",
14261
+ "- 禁**过程叙述**:「我先读一下页面」「让我确认一下」—— 工具调用用户看得见,不需要旁白",
14262
+ "- 禁**元话术**:「先给结论」「依据是」「简言之」—— 第一句直接就是答案本身,不要先宣布你要说什么",
14263
+ "- 禁**方法论自述**:不要解释结论是怎么来的(「这些不是页面写明的,而是从正文用词反推的」)—— 那是你的内部过程",
14264
+ "- 禁**预告与套话**:「下面分三点」「综上」—— 该分点就直接分点,说完就停",
14265
+ "- 出处仍要标,但用最简形式:句末括注(如「(§小节名)」「(原文)」);引原文时直接引,不写「依据是…原文两行:」这样的引导句"
14258
14266
  ].join("\n")
14259
14267
  };
14260
14268
  }