dsh-browser-verify 0.1.1 → 0.1.2

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
@@ -18,7 +18,7 @@ verification is just tool calls.
18
18
  ## Quick start
19
19
 
20
20
  ```sh
21
- dsh plugin --profile web add dsh-browser-verify@0.1.1
21
+ dsh plugin --profile web add dsh-browser-verify@0.1.2
22
22
  ```
23
23
 
24
24
  1. **Install** with the command above (or see [Install](#install)).
@@ -69,7 +69,7 @@ browser_screenshot
69
69
  ## Install
70
70
 
71
71
  ```sh
72
- dsh plugin --profile web add dsh-browser-verify@0.1.1
72
+ dsh plugin --profile web add dsh-browser-verify@0.1.2
73
73
  ```
74
74
 
75
75
  The version is pinned on purpose: pnpm 11 holds back packages published in the
@@ -92,17 +92,6 @@ or point the plugin at an existing binary via `DSH_BROWSER_VERIFY_CHROMIUM`
92
92
  (see [Environment variables](#environment-variables)). Without either, the
93
93
  first `browser_open` fails with an actionable install hint.
94
94
 
95
- ### From a source checkout
96
-
97
- ```sh
98
- pnpm install && pnpm build && pnpm pack # → dsh-browser-verify-<version>.tgz
99
- dsh plugin --profile web add ./dsh-browser-verify-<version>.tgz
100
- # or: dsh plugin --profile web add /path/to/dsh-browser-verify (build first — lib/ is gitignored)
101
- ```
102
-
103
- The tarball ships a prebuilt `lib/`, so no build step runs on the installing
104
- machine.
105
-
106
95
  ## Environment variables
107
96
 
108
97
  | Variable | Default | Meaning |
@@ -163,6 +152,11 @@ CLI (harness-free debug path): `node lib/cli.js --url <u> [--mock <file.json>]
163
152
  [--wait-selector <sel>] [--assert <sel>] [--screenshot] [--persist <dir>]
164
153
  [--viewport <WxH>]`.
165
154
 
155
+ Contributors can install the local build with
156
+ `dsh plugin --profile web add ./dsh-browser-verify-<version>.tgz` after
157
+ `pnpm build`; the tarball ships a prebuilt `lib/`, so no build step runs on
158
+ the installing machine.
159
+
166
160
  ## License & attribution
167
161
 
168
162
  Apache-2.0. Architecture and implementation notes for agents and
package/README.zh.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [English](README.md) | 中文
4
4
 
5
5
  [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
6
- [![Node](https://img.shields.io/badge/node-%3E%3D22-blue.svg)](package.json)
6
+ [![Node](<https://img.shields.io/badge/node-%3E%3D22-blue.svg>)](package.json)
7
7
 
8
8
  **给你的 DeepSeek Harness 一双看网页的眼睛** —— 只读浏览器验证,≤4 次工具调用完成:打开、mock、断言、截图。
9
9
 
@@ -12,7 +12,7 @@
12
12
  ## 快速上手
13
13
 
14
14
  ```sh
15
- dsh plugin --profile web add dsh-browser-verify@0.1.1
15
+ dsh plugin --profile web add dsh-browser-verify@0.1.2
16
16
  ```
17
17
 
18
18
  1. **安装**(更多方式见 [安装](#安装))。
@@ -34,12 +34,12 @@ browser_assert selector=".empty-wrap" text="暂无可用缴费服务"
34
34
 
35
35
  ## 它做什么
36
36
 
37
- | 工具 | 用途 |
38
- |---|---|
39
- | `browser_open` | 在全新场景中打开 URL(无头 Chromium,默认视口 390×844 @2x),返回 title / HTTP 状态 / 可见文本摘要 / console 错误。可选 `waitSelector` 等待关键元素出现后再返回;可选内联 `mocks` 在**首次导航前**拦截接口——用于一启动就依赖 mock 数据的页面。 |
40
- | `browser_mock` | 注册 playwright glob 路由(如 `**/api/*.do*`)返回指定 JSON,并自动 reload 页面展示 mock 状态——不碰后端最快验证空态/异常态。重复 pattern 会提示报错。 |
41
- | `browser_assert` | 最省 token 也最精确的验证:等待 CSS 选择器出现,校验数量与包含文本,返回 `{pass, count, actualText, elapsedMs}`。不满足时返回 `pass:false`(附差异),**绝不抛错**——失败是一等公民的结果,而不是要调试的异常。 |
42
- | `browser_screenshot` | 截取当前页面(视口或整页),**自动以 image block 投影到模型上下文**——模型直接"看见"版式,无需任何文件处理。返回尺寸、sha256;与上一张完全一致时 `identicalToPrevious:true`(疑似页面未刷新)。 |
37
+ | 工具 | 用途 |
38
+ | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
39
+ | `browser_open` | 在全新场景中打开 URL(无头 Chromium,默认视口 390×844 @2x),返回 title / HTTP 状态 / 可见文本摘要 / console 错误。可选`waitSelector` 等待关键元素出现后再返回;可选内联 `mocks` 在**首次导航前**拦截接口——用于一启动就依赖 mock 数据的页面。 |
40
+ | `browser_mock` | 注册 playwright glob 路由(如`**/api/*.do*`)返回指定 JSON,并自动 reload 页面展示 mock 状态——不碰后端最快验证空态/异常态。重复 pattern 会提示报错。 |
41
+ | `browser_assert` | 最省 token 也最精确的验证:等待 CSS 选择器出现,校验数量与包含文本,返回`{pass, count, actualText, elapsedMs}`。不满足时返回 `pass:false`(附差异),**绝不抛错**——失败是一等公民的结果,而不是要调试的异常。 |
42
+ | `browser_screenshot` | 截取当前页面(视口或整页),**自动以 image block 投影到模型上下文**——模型直接"看见"版式,无需任何文件处理。返回尺寸、sha256;与上一张完全一致时 `identicalToPrevious:true`(疑似页面未刷新)。 |
43
43
 
44
44
  先 `browser_assert` 再 `browser_screenshot`:断言更便宜,截图留给必须判断
45
45
  渲染效果的时刻。
@@ -61,11 +61,10 @@ browser_screenshot
61
61
  ## 安装
62
62
 
63
63
  ```sh
64
- dsh plugin --profile web add dsh-browser-verify@0.1.1
64
+ dsh plugin --profile web add dsh-browser-verify@0.1.2
65
65
  ```
66
66
 
67
- 版本故意钉死:pnpm 11 会暂缓 24 小时内新发布的包,裸写 `add
68
- dsh-browser-verify`(latest)会在发布当天装到上一个版本。`--profile web`
67
+ 版本故意钉死:pnpm 11 会暂缓 24 小时内新发布的包,裸写 `add dsh-browser-verify`(latest)会在发布当天装到上一个版本。`--profile web`
69
68
  是本部署的 GUI profile——如果不同请换成你自己的 profile 名。
70
69
 
71
70
  要求 **dsh ≥ 0.1.2-alpha.1**。
@@ -81,23 +80,13 @@ npx playwright install chromium # 需要 playwright-core@1.62.0
81
80
  或通过 `DSH_BROWSER_VERIFY_CHROMIUM` 指向已有二进制(见
82
81
  [环境变量](#环境变量))。两者都没有时,第一次 `browser_open` 会给出可操作的安装提示。
83
82
 
84
- ### 源码 checkout 安装
85
-
86
- ```sh
87
- pnpm install && pnpm build && pnpm pack # → dsh-browser-verify-<version>.tgz
88
- dsh plugin --profile web add ./dsh-browser-verify-<version>.tgz
89
- # 或:dsh plugin --profile web add /path/to/dsh-browser-verify (需先 build——lib/ 不入库)
90
- ```
91
-
92
- tgz 内已含预构建 `lib/`,安装机无需再构建。
93
-
94
83
  ## 环境变量
95
84
 
96
- | 变量 | 默认 | 含义 |
97
- |---|---|---|
98
- | `DSH_BROWSER_VERIFY_CHROMIUM` | *(未设置)* | Chromium 完整路径;优先于缓存探测。路径错误时启动即报可操作提示。 |
99
- | `DSH_BROWSER_VERIFY_TIMEOUT` | `10000` | `browser_open` 页面加载路径的墙钟预算(ms),含 wait-selector 与 mock reload。 |
100
- | `DSH_BROWSER_VERIFY_IDLE_MS` | `600000` | 空闲回收窗口(ms),超时后浏览器实例自动关闭;插件 dispose 时强制清理。 |
85
+ | 变量 | 默认 | 含义 |
86
+ | ------------------------------- | ------------ | -------------------------------------------------------------------------------- |
87
+ | `DSH_BROWSER_VERIFY_CHROMIUM` | *(未设置)* | Chromium 完整路径;优先于缓存探测。路径错误时启动即报可操作提示。 |
88
+ | `DSH_BROWSER_VERIFY_TIMEOUT` | `10000` | `browser_open` 页面加载路径的墙钟预算(ms),含 wait-selector 与 mock reload。 |
89
+ | `DSH_BROWSER_VERIFY_IDLE_MS` | `600000` | 空闲回收窗口(ms),超时后浏览器实例自动关闭;插件 dispose 时强制清理。 |
101
90
 
102
91
  ## 可靠性与清理
103
92
 
@@ -108,7 +97,6 @@ tgz 内已含预构建 `lib/`,安装机无需再构建。
108
97
  ```sh
109
98
  rm -rf "$(node -p 'require("os").tmpdir()')/dsh-browser-verify-*"
110
99
  ```
111
-
112
100
  - **错误即接口**——所有错误以 `browser-verify: ` 前缀开头、以可操作建议结尾;验证"失败"是结果(`pass:false`),不是异常。
113
101
 
114
102
  ## 测试状态
@@ -133,9 +121,11 @@ pnpm vitest run --coverage # discover / cleanup / attachments 每文件 ≥90%
133
121
  scripts/smoke.sh # 两态端到端;需要参考应用 dev server 在 :5173
134
122
  ```
135
123
 
136
- CLI(免 harness 的调试路径):`node lib/cli.js --url <u> [--mock <file.json>]
137
- [--wait-selector <sel>] [--assert <sel>] [--screenshot] [--persist <dir>]
138
- [--viewport <WxH>]`。
124
+ CLI(免 harness 的调试路径):`node lib/cli.js --url <u> [--mock <file.json>] [--wait-selector <sel>] [--assert <sel>] [--screenshot] [--persist <dir>] [--viewport <WxH>]`。
125
+
126
+ 贡献者可本地构建后安装:`pnpm build` 后
127
+ `dsh plugin --profile web add ./dsh-browser-verify-<version>.tgz`——tgz 内已含
128
+ 预构建 `lib/`,安装机无需再构建。
139
129
 
140
130
  ## 许可与署名
141
131
 
package/cordis.patch.yml CHANGED
@@ -1,17 +1,11 @@
1
- # dsh-browser-verify bundle patch: inserts the four browser verification
2
- # tools into the web profile roster. Applied as a profile bundle layer (the
3
- # dsh.bundle.patch manifest field).
1
+ # dsh-browser-verify bundle patch: registers the four read-only browser
2
+ # verification tools (browser_open / browser_mock / browser_assert /
3
+ # browser_screenshot) in the profile's tool roster. Applied automatically as a
4
+ # profile bundle layer (dsh.bundle.patch in package.json).
4
5
  #
5
- # Install (from a source checkout; tarball name follows the current version):
6
- # pnpm install && pnpm build && pnpm pack
7
- # dsh plugin --profile web add ./dsh-browser-verify-<version>.tgz
8
- # # or, during development, add the checkout directory directly (pnpm link):
9
- # dsh plugin --profile web add <path-to-this-directory>
10
- #
11
- # Host half only: the node half (exports ".") registers browser_open /
12
- # browser_mock / browser_assert / browser_screenshot. No client half, no
13
- # settings card. Configuration is env-var only (DSH_BROWSER_VERIFY_*); do NOT
14
- # add a `config:` block here.
6
+ # Install: dsh plugin --profile web add dsh-browser-verify@<version>
7
+ # Host half only no client half, no settings card. Configuration is env-var
8
+ # only (DSH_BROWSER_VERIFY_*); do NOT add a `config:` block here.
15
9
  - insert:
16
10
  - id: browser-verify
17
11
  name: 'dsh-browser-verify'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-browser-verify",
3
3
  "description": "Read-only browser verification tools for the DeepSeek Harness web GUI: browser_open / browser_mock / browser_assert / browser_screenshot — verify a page (H5/desktop) in ≤4 tool calls with mock interception, DOM assertions, and screenshots that auto-project into the model context.",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.7.0",
7
7
  "engines": {
@@ -31,6 +31,10 @@
31
31
  "dependencies": {
32
32
  "playwright-core": "1.62.0"
33
33
  },
34
+ "peerDependencies": {
35
+ "@deepseek-ai/dsh-attachment": "^0.1.2-alpha.4",
36
+ "@deepseek-ai/dsh-tools": "^0.1.2-alpha.4"
37
+ },
34
38
  "devDependencies": {
35
39
  "@deepseek-ai/cordis": "^4.0.1",
36
40
  "@deepseek-ai/dsh-attachment": "^0.1.2-alpha.4",