dsh-sidebar-browser-control 0.1.0 → 0.2.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 +58 -12
- package/README.zh.md +13 -5
- package/client.js +611 -29
- package/index.js +361 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -38,35 +38,68 @@ automation, downloads or screenshots.
|
|
|
38
38
|
|
|
39
39
|
| Tool | Actions |
|
|
40
40
|
|---|---|
|
|
41
|
-
| `browser_tabs` | list open built-in-browser tabs: id, live title, URL, owning session, panel state, whether page control is available |
|
|
41
|
+
| `browser_tabs` | list open built-in-browser tabs: id, live title, URL, owning session, panel state, whether page control is available, plus capture diagnostics |
|
|
42
42
|
| `browser_control` | `open` · `navigate` · `back` · `forward` · `reload` · `close` · `focus` · `expand` · `collapse` · `fullscreen` · `split` · `float` · `dock` · `external` |
|
|
43
|
-
| `browser_page` | `text` · `links` · `elements` · `eval` · `click` · `type` · `scroll` · `wait` *(Desktop only)* |
|
|
44
|
-
| `/browser` | `open <url>` · `tabs` · `back` · `forward` · `reload` · `close` · `focus` · `expand` · `collapse` · `fullscreen` · `split` · `float` · `dock` · `external` · `read` |
|
|
43
|
+
| `browser_page` | `text` · `links` · `elements` · `eval` · `click` · `type` · `fill` · `key` · `login` · `scroll` · `wait` · `images` · `image` · `screenshot` *(page actions: Desktop only)* |
|
|
44
|
+
| `/browser` | `open <url>` · `tabs` · `back` · `forward` · `reload` · `close` · `focus` · `expand` · `collapse` · `fullscreen` · `split` · `float` · `dock` · `external` · `read` · `images` · `image <N>` · `screenshot` |
|
|
45
45
|
|
|
46
46
|
The tools and the slash command share one implementation, so `/browser open …`
|
|
47
47
|
costs no model round trip and behaves exactly like the tool.
|
|
48
48
|
|
|
49
|
+
### Operating the page, not just reading it
|
|
50
|
+
|
|
51
|
+
- `elements` reports what a person sees: `type`, `name`, `label`, `placeholder`,
|
|
52
|
+
`autocomplete`, `value`, `checked`, plus a selector for `click`.
|
|
53
|
+
- `fill` takes several fields at once and matches them by **label or
|
|
54
|
+
placeholder**, not only by CSS selector — `[{ label: "用户名", value: "alice" },
|
|
55
|
+
{ label: "密码", value: "…" }, { label: "记住我", value: true }]` — and can
|
|
56
|
+
submit. Passwords are masked in every result.
|
|
57
|
+
- `login` is the whole flow in one call: find the account and password fields
|
|
58
|
+
(also inside a same-origin iframe), fill, submit, wait, then report which
|
|
59
|
+
fields were found, whether the password field disappeared, the address it
|
|
60
|
+
landed on and an excerpt of the page. It never echoes the password back.
|
|
61
|
+
- `key` presses Enter/Tab/Escape; Enter submits the surrounding form.
|
|
62
|
+
- `wait` can wait for a selector, a text, or `url_contains`.
|
|
63
|
+
|
|
64
|
+
### Seeing the page
|
|
65
|
+
|
|
66
|
+
Two ways to give the model actual pixels:
|
|
67
|
+
|
|
68
|
+
- `images` lists the pictures in the viewport; `image { index }` attaches one of
|
|
69
|
+
them, so the model can look at a photo, chart, QR code or captcha. HTTP(S)
|
|
70
|
+
sources are fetched by the Host (the page's own `fetch` is bound by CORS);
|
|
71
|
+
`data:`, `blob:` and `<canvas>` sources are decoded inside the page.
|
|
72
|
+
- `screenshot` captures the Browser pane itself and attaches it. It deliberately
|
|
73
|
+
avoids every native capture API — `webview.capturePage()` crashed the renderer
|
|
74
|
+
(see below) — and instead reads the pane's geometry from the page, then
|
|
75
|
+
captures the DSH window with `PrintWindow` through PowerShell and crops to that
|
|
76
|
+
rectangle. Because it renders the window's own pixels, it also works while
|
|
77
|
+
other applications cover the window. A **minimized** window has no rendered
|
|
78
|
+
surface, so the tool refuses with that reason — pass `restore: true` to let it
|
|
79
|
+
bring the window back first. This path is Windows-only today; elsewhere the
|
|
80
|
+
tool says so instead of failing quietly.
|
|
81
|
+
|
|
49
82
|
## Install
|
|
50
83
|
|
|
51
84
|
The plugin is a normal DSH bundle, so any spec the plugin manager accepts works.
|
|
52
85
|
|
|
53
|
-
**From
|
|
54
|
-
needed:
|
|
86
|
+
**From npm** (published as `dsh-sidebar-browser-control`). Ask the agent, no
|
|
87
|
+
restart needed:
|
|
55
88
|
|
|
56
89
|
```
|
|
57
|
-
plugin_manager { action: install_bundle, target: "
|
|
90
|
+
plugin_manager { action: install_bundle, target: "dsh-sidebar-browser-control" }
|
|
58
91
|
```
|
|
59
92
|
|
|
60
93
|
or with the CLI:
|
|
61
94
|
|
|
62
95
|
```sh
|
|
63
|
-
dsh plugin --profile desktop add
|
|
96
|
+
dsh plugin --profile desktop add dsh-sidebar-browser-control
|
|
64
97
|
```
|
|
65
98
|
|
|
66
|
-
**From
|
|
99
|
+
**From GitHub**, if you prefer tracking `main`:
|
|
67
100
|
|
|
68
101
|
```
|
|
69
|
-
plugin_manager { action: install_bundle, target: "dsh-sidebar-browser-control" }
|
|
102
|
+
plugin_manager { action: install_bundle, target: "github:XUFENGCHINA/dsh-sidebar-browser-control" }
|
|
70
103
|
```
|
|
71
104
|
|
|
72
105
|
**From a checkout**, for development:
|
|
@@ -89,6 +122,17 @@ Just ask, in any session whose Sidebar is on screen:
|
|
|
89
122
|
- "search Bing in the built-in browser for DeepSeek Harness and give me the first three results"
|
|
90
123
|
- `/browser open https://example.com` — straight from the composer, no model call
|
|
91
124
|
|
|
125
|
+
Two behaviours worth knowing while driving it:
|
|
126
|
+
|
|
127
|
+
- **A link that opens a new window becomes a new sidebar tab** — DSH turns the
|
|
128
|
+
popup request into a tab of its own. `browser_page click` reports it as
|
|
129
|
+
`opened_tab`/`opened_url`; continue with that id, because the original tab
|
|
130
|
+
stays where it was.
|
|
131
|
+
- **A page that fails to load says so** — DNS, network, certificate and bot-check
|
|
132
|
+
failures leave Chromium's error page in the tab, and page actions report that
|
|
133
|
+
explicitly instead of returning empty content that reads as "the page is
|
|
134
|
+
empty".
|
|
135
|
+
|
|
92
136
|
## How it works
|
|
93
137
|
|
|
94
138
|
The browser lives in the Web renderer, tools live in the Host, and DSH exposes no
|
|
@@ -126,9 +170,11 @@ while tab and layout control keep working; the table of those dependencies is in
|
|
|
126
170
|
|
|
127
171
|
## Known limitations
|
|
128
172
|
|
|
129
|
-
- **No screenshots.** `webview.capturePage()` natively crashed
|
|
130
|
-
renderer on the verified deployment, so
|
|
131
|
-
|
|
173
|
+
- **No screenshots through Electron.** `webview.capturePage()` natively crashed
|
|
174
|
+
the Electron renderer on the verified deployment, so it is not used anywhere.
|
|
175
|
+
`browser_page screenshot` goes through PrintWindow instead: the window must not
|
|
176
|
+
be minimized, and only Windows is implemented (macOS/Linux report that).
|
|
177
|
+
Evidence and survivable alternatives:
|
|
132
178
|
[docs/architecture.md](https://github.com/XUFENGCHINA/dsh-sidebar-browser-control/blob/main/docs/architecture.md#why-there-is-no-screenshot).
|
|
133
179
|
- Page-level actions are **Desktop only**.
|
|
134
180
|
- Tab ids are unique per session; an ambiguous id is reported and accepted as
|
package/README.zh.md
CHANGED
|
@@ -45,22 +45,22 @@ npm 上已有一个走 CDP 的 DSH 浏览器插件(`dsh-browser-control`)。
|
|
|
45
45
|
|
|
46
46
|
它就是一个普通 DSH bundle,plugin manager 接受的任何 spec 都能用。
|
|
47
47
|
|
|
48
|
-
**从
|
|
48
|
+
**从 npm 安装**(已发布为 `dsh-sidebar-browser-control`)。让 Agent 装,无需重启:
|
|
49
49
|
|
|
50
50
|
```
|
|
51
|
-
plugin_manager { action: install_bundle, target: "
|
|
51
|
+
plugin_manager { action: install_bundle, target: "dsh-sidebar-browser-control" }
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
或用 CLI:
|
|
55
55
|
|
|
56
56
|
```sh
|
|
57
|
-
dsh plugin --profile desktop add
|
|
57
|
+
dsh plugin --profile desktop add dsh-sidebar-browser-control
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
**从
|
|
60
|
+
**从 GitHub 安装**(想跟 `main` 分支时用):
|
|
61
61
|
|
|
62
62
|
```
|
|
63
|
-
plugin_manager { action: install_bundle, target: "dsh-sidebar-browser-control" }
|
|
63
|
+
plugin_manager { action: install_bundle, target: "github:XUFENGCHINA/dsh-sidebar-browser-control" }
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
**从本地 checkout 安装**(开发用):
|
|
@@ -83,6 +83,14 @@ dsh plugin --profile desktop add link:/绝对路径/到/本仓库
|
|
|
83
83
|
- 「在内置浏览器用 Bing 搜 DeepSeek Harness,给我前三条结果」
|
|
84
84
|
- `/browser open https://example.com` —— 输入框直接敲,不经过模型
|
|
85
85
|
|
|
86
|
+
驱动它时值得知道的两条实际行为:
|
|
87
|
+
|
|
88
|
+
- **新窗口打开的链接会变成一个**新的侧栏标签**:DSH 把 popup 请求转成了独立的 tab。
|
|
89
|
+
`browser_page click` 会把它报成 `opened_tab`/`opened_url`,请接着用那个 id——
|
|
90
|
+
原标签仍停在原来的页面上。
|
|
91
|
+
- **加载失败的页面会明确报出来**:DNS、网络、证书、以及反爬挑战失败时,标签里是
|
|
92
|
+
Chromium 错误页;页面级动作会明确说明这一点,而不是返回空内容让你误以为"页面是空的"。
|
|
93
|
+
|
|
86
94
|
## 工作原理
|
|
87
95
|
|
|
88
96
|
浏览器活在 Web 渲染进程里,工具活在 Host 进程里,而 DSH 没有面向第三方插件的
|