dsh-builtin-browser 0.5.2 → 0.5.4
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/CHANGELOG.md +145 -0
- package/README.en.md +77 -68
- package/README.md +69 -89
- package/client.js +147 -15
- package/desktop-bridge/desktop-identity.json +9 -0
- package/desktop-bridge/install.mjs +220 -1
- package/desktop-bridge/plugin-browser-bridge.js +5 -0
- package/docs/README.md +1 -1
- package/docs/architecture.md +1 -1
- package/docs/limitations.md +19 -1
- package/docs/tool-reference.md +2 -1
- package/lib/browser-electron/bridge-status.d.ts +5 -3
- package/lib/browser-electron/bridge-status.js +53 -9
- package/lib/browser-electron/desktop-bridge-host.d.ts +25 -25
- package/lib/browser-electron/desktop-bridge-host.js +67 -40
- package/lib/browser-electron/desktop-identity.d.ts +58 -0
- package/lib/browser-electron/desktop-identity.js +236 -0
- package/lib/browser-electron/electron-provision.d.ts +59 -0
- package/lib/browser-electron/electron-provision.js +176 -0
- package/lib/browser-electron/entry.js +12 -0
- package/lib/browser-electron/host-main.js +68 -14
- package/lib/browser-electron/provider.d.ts +53 -3
- package/lib/browser-electron/provider.js +26 -5
- package/lib/browser-electron/remote-host.d.ts +3 -3
- package/lib/browser-electron/remote-host.js +25 -11
- package/lib/browser-electron/settings-store.d.ts +19 -0
- package/lib/browser-electron/settings-store.js +5 -1
- package/package.json +2 -3
- package/src/browser-electron/bridge-status.ts +56 -10
- package/src/browser-electron/desktop-bridge-host.ts +70 -41
- package/src/browser-electron/desktop-identity.ts +260 -0
- package/src/browser-electron/electron-provision.ts +208 -0
- package/src/browser-electron/entry.ts +12 -0
- package/src/browser-electron/host-main.ts +62 -12
- package/src/browser-electron/provider.ts +73 -8
- package/src/browser-electron/remote-host.ts +26 -12
- package/src/browser-electron/settings-store.ts +24 -1
- package/src/types/electron-shim.d.ts +8 -0
package/README.md
CHANGED
|
@@ -8,50 +8,42 @@
|
|
|
8
8
|
|
|
9
9
|
<p align="center"><sub>中文 · <a href="README.en.md">English</a></sub></p>
|
|
10
10
|
|
|
11
|
-
<h3 align="center">为 DeepSeek Harness
|
|
11
|
+
<h3 align="center">为 DeepSeek Harness 打造的<b>共享真实浏览器</b>插件</h3>
|
|
12
12
|
|
|
13
|
-
<h4 align="center">agent
|
|
13
|
+
<h4 align="center">agent 驱动一个真实、可见、可随时接管的浏览器——人与 agent 操作的是<b>同一个页面</b>。</h4>
|
|
14
14
|
|
|
15
15
|
## 这是什么
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
- **真实浏览器,不是转播**:桌面端优先驱动官方侧栏;侧栏不可用时用插件自托管的窗口;也可以在设置里换成你本机的 **Chrome / Edge**。
|
|
18
|
+
- **人机同页**:agent 看到和操作的,与你屏幕上是同一个页面,随时可以接手。
|
|
19
|
+
- **装完即用**:`dsh_browser_*` 下 **35 个工具**——打开、读取、点击、填表、截图、下载、登录态,不需要额外配置。
|
|
20
|
+
- **按任务隔离**:每个任务自己的标签与历史,互不串扰。
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
- **人机同页**(桌面端):agent 操作的页面与人看到的是**同一个**页面 —— 不再是一个你看不见的窗口;
|
|
21
|
-
- **自动选择载体**:桌面侧栏可用时优先侧栏,否则自托管;宿主允许安装脚本且下载可用时,插件会在安装阶段准备 Electron 二进制;
|
|
22
|
-
- **一插件即一套工具**:安装后 agent 自动获得 34 个 `dsh_browser_*` 工具(打开、查看、无障碍树、等待、语义/坐标操作、滚动、回退、批量/单控件填表、按键、结构化提取、截图、下载、登录态管理……)。
|
|
22
|
+
## 安装
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
两端是两份独立安装,**更新一端不会带上另一端**。
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
更新已装版本要两步(DSH 0.2.1-alpha.2 起对已装包再 `add` 会报 `already-installed`):
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
> **0.4.16 正在准备发布**,包含安全、稳定性与桌面 rc.5 侧栏适配修复;现有用户建议在版本发布后更新。插件更新不会更新 DSH 桌面外壳,也不会自动刷新外壳内的 bridge 或已有 `ELECTRON_PATH` 覆盖。先备份,再按[0.4.16 升级说明](docs/user-guide.md#升级到-0416)处理。
|
|
28
|
+
```sh
|
|
29
|
+
dsh plugin --profile <profile> remove dsh-builtin-browser
|
|
30
|
+
dsh plugin --profile <profile> add dsh-builtin-browser@0.5.2
|
|
31
|
+
```
|
|
33
32
|
|
|
34
|
-
###
|
|
33
|
+
### 桌面端
|
|
35
34
|
|
|
36
35
|
```sh
|
|
37
36
|
dsh plugin --profile desktop add dsh-builtin-browser
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
要让插件驱动侧栏,还需要一条 bridge(它装在**桌面端自己的安装目录**里,不在 profile 中)。**0.5.0 起可以一步完成**:
|
|
39
|
+
要让插件驱动**官方侧栏**里那个浏览器面板,还需在桌面端**自己的安装目录**里装一条 bridge(可选;不装则用自托管窗口):
|
|
43
40
|
|
|
44
41
|
```sh
|
|
45
|
-
# Windows:双击即用,或
|
|
46
|
-
desktop-bridge/install-and-start.cmd
|
|
47
|
-
|
|
48
|
-
# 任意平台:脚本自己关闭 DSH、安装、再启动
|
|
49
42
|
node desktop-bridge/install.mjs "<DSH Desktop 安装目录>" --restart
|
|
43
|
+
# 或双击 desktop-bridge/install-and-start.cmd
|
|
50
44
|
```
|
|
51
45
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
> **bridge 是可选项**:不装时自动退回自托管,多出一个独立窗口。**插件或桌面外壳升级后,重跑同一条命令即可修复** —— 桌面端升级会恢复 `app.asar`,桥随之失效,此时 `bridge-status` 报 `stale`。设置在面板顶部可见。载体差异见[已知限制](docs/limitations.md)。
|
|
46
|
+
不要在桌面端运行中手工安装:归档被占用,`rename` 会以 `EBUSY` 失败。桌面端升级后 bridge 会失效(`bridge-status` 报 `stale`),重跑同一条命令即可修复。
|
|
55
47
|
|
|
56
48
|
### Web 端(`dsh web`)
|
|
57
49
|
|
|
@@ -59,104 +51,92 @@ node desktop-bridge/install.mjs "<DSH Desktop 安装目录>" --restart
|
|
|
59
51
|
dsh plugin --profile web add dsh-builtin-browser
|
|
60
52
|
```
|
|
61
53
|
|
|
62
|
-
Web
|
|
63
|
-
|
|
64
|
-
> 0.4.16 通常会通过安装脚本准备 Electron 二进制。DSH rc.5 的 pnpm 11.7 使用 `strict-dep-builds`,首次安装可能需在宿主原生插件管理器中批准本插件的构建脚本;插件不会自行修改 `allowBuilds`。使用 `--ignore-scripts` 或明确跳过下载后,可在正确的 profile 目录执行 `npx --no dsh-browser-install-electron` 手动准备(需网络)。若设置了 `ELECTRON_SKIP_BINARY_DOWNLOAD`,该命令也会遵守跳过选择。详见[用户指南](docs/user-guide.md#准备-electron-二进制)。
|
|
54
|
+
Web 端没有侧栏也没有 bridge:插件自托管一个独立窗口(标题 `dsh-browser`),自带地址栏、前进后退刷新与标签条,可以直接当浏览器用。
|
|
65
55
|
|
|
66
|
-
|
|
56
|
+
> Electron 二进制通常由安装脚本准备。宿主使用 `strict-dep-builds` 时需先批准本插件的构建脚本;跳过了可在 profile 目录执行 `npx --no dsh-browser-install-electron` 手动准备。详见[用户指南](docs/user-guide.md)。
|
|
67
57
|
|
|
68
|
-
|
|
58
|
+
### 装好之后
|
|
69
59
|
|
|
70
60
|
```
|
|
71
|
-
帮我打开 https://example.com
|
|
61
|
+
帮我打开 https://example.com,把主要内容用中文总结一下。
|
|
72
62
|
```
|
|
73
63
|
|
|
74
|
-
|
|
64
|
+
## 载体:自动选择,也可指定
|
|
75
65
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
66
|
+
| 载体 | 何时使用 |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| 桌面侧栏 | 外壳支持可驱动的 `<webview>` 且已装 bridge(默认优先) |
|
|
69
|
+
| 自托管窗口 | 侧栏不可用或未装 bridge;Web 端总是这一种 |
|
|
70
|
+
| 本机 Chrome / Edge | 设置里显式指定 |
|
|
79
71
|
|
|
80
|
-
|
|
72
|
+
侧栏原本有两种"要人先动手"的情况——列没打开、会话不在前台。0.5.2 起都由插件自己处理:没有展开就展开,会话不在前台就请求外壳显示它。取舍与边界见[已知限制](docs/limitations.md)。
|
|
81
73
|
|
|
82
|
-
|
|
74
|
+
## 工具(`dsh_browser_*`,35 个)
|
|
83
75
|
|
|
84
|
-
|
|
|
76
|
+
| 组 | 工具 |
|
|
85
77
|
| --- | --- |
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
|
78
|
+
| 打开与导航 | `open` `back` `forward` `refresh` `list_tabs` `switch_tab` `close_tab` |
|
|
79
|
+
| 读页面 | `snapshot` `a11y` `content` `scrape` `screenshot` `challenge` |
|
|
80
|
+
| 操作 | `click` `click_sequence` `type` `key` `scroll` `execute` |
|
|
81
|
+
| 表单 | `fill` `set_value` `clear` `check` `select` `get_value` |
|
|
82
|
+
| 会话 | `session` `reset` `reset_session` `restrict` `auth` |
|
|
83
|
+
| 记录 | `history` `visited` `replay` |
|
|
84
|
+
| 其它 | `wait` `download` |
|
|
90
85
|
|
|
91
|
-
|
|
86
|
+
参数、输出与示例见[工具参考](docs/tool-reference.md)。
|
|
92
87
|
|
|
93
|
-
|
|
88
|
+
`click_sequence`(0.5.2 新增)一次调用打一串坐标点击,用于 canvas 页面:那些页面不采信脚本派发的 `MouseEvent`,只认真实输入。
|
|
94
89
|
|
|
95
|
-
|
|
96
|
-
| --- | --- |
|
|
97
|
-
| `GET sessions` | 面板用来取得可观看的会话 id(只有 id,无 URL/标题) |
|
|
98
|
-
| `GET frame?session=…` | 一张 JPEG |
|
|
99
|
-
| `GET …/bridge-status` | 桌面 bridge 的安装状态 |
|
|
100
|
-
|
|
101
|
-
画面可能包含验证码、账户信息或登录后内容 —— 打开前请确认这是你要看的页面。
|
|
90
|
+
## 远程观看(默认关闭)
|
|
102
91
|
|
|
103
|
-
|
|
92
|
+
从另一台设备用 DSH 时,浏览器在主机屏幕上。主机在设置里打开 `remoteView.enabled` 后,面板给出一个**只读**画面:2 fps、JPEG 质量 70、等比缩放到 1280×720 内、一帧一请求(慢网络自然降速)、不落盘、不进入聊天或模型上下文。不转发点击/键盘/滚轮。
|
|
104
93
|
|
|
105
|
-
|
|
106
|
-
| --- | --- |
|
|
107
|
-
| 了解插件为什么存在、与无头方案的区别 | [为什么做共享真实浏览器](docs/why-browser.md) |
|
|
108
|
-
| 安装、配置、日常使用与常见问题 | [用户指南](docs/user-guide.md) |
|
|
109
|
-
| 全部 34 个工具的参数、输出与示例 | [工具参考](docs/tool-reference.md) |
|
|
110
|
-
| 了解 seam / provider / 工具三层与自托管实现 | [架构说明](docs/architecture.md) |
|
|
111
|
-
| 知道哪些事**做不到**、以及为什么 | [已知限制](docs/limitations.md) |
|
|
112
|
-
| 构建、测试、复验宿主兼容性 | [开发](docs/development.md) |
|
|
113
|
-
| 查看全部文档与 README 分工 | [文档索引](docs/README.md) |
|
|
94
|
+
关闭时**不出现浮动入口、也不发任何诊断请求**;在设置页打开「远程观看」开关后,入口**立刻**出现——不需要刷新页面,也不需要快捷键(手机上没有)。
|
|
114
95
|
|
|
115
|
-
|
|
96
|
+
三个端点,仅同源:`GET /dsh-builtin-browser/browser-view/sessions`、`GET …/browser-view/frame?session=…`、`GET /dsh-builtin-browser/bridge-status`。
|
|
116
97
|
|
|
117
|
-
|
|
98
|
+
画面可能包含验证码、账户信息或登录后内容——打开前请确认这是你要看的页面。
|
|
118
99
|
|
|
119
|
-
|
|
100
|
+
## 相关项目
|
|
120
101
|
|
|
121
|
-
**0.4.
|
|
102
|
+
**[yeuxuan/dsh-builtin-browser](https://github.com/yeuxuan/dsh-builtin-browser)** —— 社区基于本项目 0.4.14(MIT,保留原 LICENSE 与署名)做的**侧栏专用衍生版**:只用桌面外壳右侧栏的 `<webview>` 载体,去掉自托管 Electron 子进程、本机 Chrome/Edge 与 iframe 载体;元素快照带编号、动作用 `target.by: "ref"` 定位并在点击前做命中测试;每条 CDP 命令带超时;弹窗、HTTP 认证、下载汇总到页面顶部状态栏。
|
|
122
103
|
|
|
123
|
-
|
|
104
|
+
如果你的场景**只有桌面侧栏**、不需要多载体回退,它比本项目更小更专注。它是第三方项目,由作者独立维护——问题与改动请提到它的仓库,不要记在这里。
|
|
124
105
|
|
|
125
|
-
|
|
106
|
+
## 文档
|
|
126
107
|
|
|
127
|
-
|
|
108
|
+
| 想知道 | 去哪 |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| 安装、配置、日常使用、常见问题 | [用户指南](docs/user-guide.md) |
|
|
111
|
+
| 35 个工具的参数、输出与示例 | [工具参考](docs/tool-reference.md) |
|
|
112
|
+
| 为什么做成共享真实浏览器 | [为什么做共享真实浏览器](docs/why-browser.md) |
|
|
113
|
+
| seam / provider / 工具三层与自托管实现 | [架构说明](docs/architecture.md) |
|
|
114
|
+
| 哪些事做不到,以及为什么 | [已知限制](docs/limitations.md) |
|
|
115
|
+
| 构建、测试、复验宿主兼容性 | [开发](docs/development.md) |
|
|
116
|
+
| 全部文档的分工 | [文档索引](docs/README.md) |
|
|
128
117
|
|
|
129
118
|
## 更新记录
|
|
130
119
|
|
|
131
|
-
完整明细(按轮次,含每处修复的原因与证据)见 [CHANGELOG.md](CHANGELOG.md)
|
|
120
|
+
完整明细(按轮次,含每处修复的原因与证据)见 [CHANGELOG.md](CHANGELOG.md)。
|
|
132
121
|
|
|
133
122
|
| 版本 | 日期 | 主题 |
|
|
134
123
|
| --- | --- | --- |
|
|
135
|
-
| **0.5.
|
|
136
|
-
| **0.5.
|
|
137
|
-
| **0.5.
|
|
138
|
-
| **0.
|
|
139
|
-
|
|
|
140
|
-
| **0.4.8** | 2026-10-14 | **工具名空间**:34 个工具移入 `dsh_browser_*`,一个名字被占不再毁掉整套工具 |
|
|
141
|
-
| **0.4.7** | 2026-10-12 | 三个"同形"缺陷:载体被写死、宿主死了不换、设置读了不生效;收 #26 的四条建议 |
|
|
142
|
-
| **0.4.6** | 2026-10-08 | 跨会话读错侧栏、等待期间误建空白页、升级把浏览器登出 |
|
|
143
|
-
| **0.4.5** | 2026-10-06 | 会话串扰的真正根因:面板放置改按会话 id,而非"外壳当前显示谁" |
|
|
144
|
-
| **0.4.0**–**0.4.4** | 2026-10-02 | 把"限制"分成真限制与实现限制:`dsh_browser_auth` 三种载体全可用、本机 Chrome/Edge 支持 JPEG、降采样全载体可用;修掉会崩宿主、会静默做错事、会永久挂住的缺陷 |
|
|
124
|
+
| **0.5.4** | 2026-11-03 | **预览是只读的**:取帧不再经 `ensureSidebar`(旧桥会按键+打字),只读 `list`,面板不再被顶到前台;浮标几何、关闭键、层级与 `img[hidden]` 修正(修 #46);**远程观看改为设置里的开关,点了立刻生效**(手机没有快捷键);bridge 修复命令指向包内真实路径(修 #40 第四项) |
|
|
125
|
+
| **0.5.3** | 2026-11-03 | **安装不再依赖网络**:去掉 `postinstall`,Electron 运行时改为首次需要时才准备且永不失败安装(修 #41/#42 的市场安装失败);安装器先验应用身份再动手,校验先于删除(修 #40);观看入口按需挂载、翻译与主题令牌修正 |
|
|
126
|
+
| **0.5.2** | 2026-11-01 | 侧栏页面不再需要人先动手:列没打开就展开,会话不在前台就请求外壳显示它并做有界重试;新增批量坐标点击 `click_sequence`;旧 bridge 的无 code 拒绝也按显示状态处理 |
|
|
127
|
+
| **0.5.1** | 2026-10-31 | 接管浏览器自己打开的页面:`switch_tab` 与 `open` 落到你正在看的那一页;canvas 检测不再要求元素列表为空;空白页由页面自身 URL 判定 |
|
|
128
|
+
| 更早 | — | 见 [CHANGELOG.md](CHANGELOG.md)(`0.5.0` 只打过 tag,未发布到 npm) |
|
|
145
129
|
|
|
146
|
-
|
|
130
|
+
**工具名空间**:0.4.8 起全部工具在 `dsh_browser_*` 下(此前是无前缀的 `browser_*`,与另一个插件相撞,一次重名会让后注册者整套工具消失)。日志里出现 `could not register dsh_browser_xxx` 说明有别的插件占了同名工具——每个工具独立注册,碰撞只影响那一个。自定义提示词里若还写着 `browser_*`,改成 `dsh_browser_*`。
|
|
147
131
|
|
|
148
|
-
|
|
132
|
+
## 感谢
|
|
149
133
|
|
|
150
|
-
|
|
134
|
+
感谢 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 与 DeepSeek AI 团队——本插件的 seam、工具运行时与插件体系都构建在这个项目之上;感谢 [Cordis](https://github.com/cordiverse/cordis) 提供的插件化基础;以及所有带着完整复现与本地补丁来的报告者,这些修复因此不必靠猜。
|
|
151
135
|
|
|
152
|
-
##
|
|
136
|
+
## 作者
|
|
153
137
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
**wx:`hui13866591135`**(请在申请好友时注明)
|
|
138
|
+
对插件有意见、或想聊别的插件,欢迎加微信:**`hui13866591135`**(申请时请注明)。
|
|
157
139
|
|
|
158
140
|
## License
|
|
159
141
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
> 本项目是 DeepSeek Harness 的社区插件,并非 DeepSeek 官方产品。
|
|
142
|
+
[MIT License](LICENSE)。本项目是 DeepSeek Harness 的社区插件,并非 DeepSeek 官方产品。
|
package/client.js
CHANGED
|
@@ -26,6 +26,14 @@ window.__ModuleLoader__.load({ id: "dsh-builtin-browser", factory: (require) =>
|
|
|
26
26
|
const NS = "settings.dsh-builtin-browser"
|
|
27
27
|
const ROUTE = "/dsh-builtin-browser/settings"
|
|
28
28
|
let translate = (key) => key
|
|
29
|
+
/**
|
|
30
|
+
* Re-evaluate the floating watch entry.
|
|
31
|
+
*
|
|
32
|
+
* Set by `installWatchPanel`, called by the settings writer after a `remoteView` change so the
|
|
33
|
+
* switch takes effect on the spot. A no-op until the panel is installed, and a no-op forever on a
|
|
34
|
+
* host without one.
|
|
35
|
+
*/
|
|
36
|
+
let refreshWatchEntry = () => {}
|
|
29
37
|
|
|
30
38
|
const zh = {
|
|
31
39
|
nav: "浏览器",
|
|
@@ -62,6 +70,8 @@ window.__ModuleLoader__.load({ id: "dsh-builtin-browser", factory: (require) =>
|
|
|
62
70
|
"ui.closeWithSession.hint": "关闭会释放浏览器进程;浏览历史与登录状态会保留。",
|
|
63
71
|
"ui.virtualCursor": "显示可视化鼠标",
|
|
64
72
|
"ui.virtualCursor.hint": "让 Agent 正在操作的位置可见(出现即代表它在接管该标签页)。",
|
|
73
|
+
"ui.quiet": "安静模式",
|
|
74
|
+
"ui.quiet.hint": "Agent 操作时不激活应用、不抢键盘焦点;导航与截图不还原最小化的窗口。真实点击/输入仍需要窗口可见,可能把最小化的窗口恢复,但不会成为前台窗口,也不会盖住你正在用的窗口。",
|
|
65
75
|
"vision.title": "视觉策略",
|
|
66
76
|
"vision.strategy": "默认策略",
|
|
67
77
|
"vision.auto": "Auto(坐标与语义都允许;适合能读图的模型)",
|
|
@@ -86,6 +96,9 @@ window.__ModuleLoader__.load({ id: "dsh-builtin-browser", factory: (require) =>
|
|
|
86
96
|
"actions.allowDownload.hint": "dsh_browser_download 会把 URL 下载到 downloadDir 内(带登录态;仍需通过目录准入,不覆盖已有文件)。关闭后一律被拒(BROWSER_DOWNLOAD_DISABLED)。截图另存走的是同一套目录准入,不受此项影响。",
|
|
87
97
|
"actions.allowCredentialWrite": "允许写入登录状态",
|
|
88
98
|
"actions.allowCredentialWrite.hint": "dsh_browser_auth 的 restore 会向任意域写入 cookie。关闭后只能导出、不能导入(BROWSER_AUTH_WRITE_DISABLED);读取仍由上面「凭据」那一项控制。",
|
|
99
|
+
"remoteView.title": "远程观看",
|
|
100
|
+
"remoteView.enabled": "允许从其它设备观看这台机器的浏览器",
|
|
101
|
+
"remoteView.enabled.hint": "打开后,本机右下角出现一个只读画面入口:2 fps、JPEG、一帧一请求,不转发点击与键盘。改动**立刻生效**,不需要刷新页面。关闭时入口消失,相关端点也不返回图像。",
|
|
89
102
|
}
|
|
90
103
|
|
|
91
104
|
const en = {
|
|
@@ -123,6 +136,8 @@ window.__ModuleLoader__.load({ id: "dsh-builtin-browser", factory: (require) =>
|
|
|
123
136
|
"ui.closeWithSession.hint": "Closing releases the browser process; history and login state survive.",
|
|
124
137
|
"ui.virtualCursor": "Show the synthetic cursor",
|
|
125
138
|
"ui.virtualCursor.hint": "Makes the agent's operating position visible (its presence means the agent has taken over that tab).",
|
|
139
|
+
"ui.quiet": "Quiet mode",
|
|
140
|
+
"ui.quiet.hint": "The agent does not activate the app or steal keyboard focus; navigation and screenshots leave a minimized window minimized. Real clicks and typing still need a visible window, so they may restore it — but never raise it above your work or make it the front window.",
|
|
126
141
|
"vision.title": "Vision strategy",
|
|
127
142
|
"vision.strategy": "Default strategy",
|
|
128
143
|
"vision.auto": "Auto (coordinates and semantics both allowed; for models that read images)",
|
|
@@ -147,9 +162,18 @@ window.__ModuleLoader__.load({ id: "dsh-builtin-browser", factory: (require) =>
|
|
|
147
162
|
"actions.allowDownload.hint": "dsh_browser_download fetches a URL into downloadDir (with login state; still subject to the directory admission gate, never overwriting an existing file). Off refuses it outright (BROWSER_DOWNLOAD_DISABLED). Saving a screenshot goes through the same directory gate and is not covered by this switch.",
|
|
148
163
|
"actions.allowCredentialWrite": "Write login state",
|
|
149
164
|
"actions.allowCredentialWrite.hint": "dsh_browser_auth's restore writes cookies to arbitrary domains. Off allows export but not import (BROWSER_AUTH_WRITE_DISABLED); reading stays under the Credentials switch above.",
|
|
165
|
+
"remoteView.title": "Remote viewing",
|
|
166
|
+
"remoteView.enabled": "Let other devices watch this machine's browser",
|
|
167
|
+
"remoteView.enabled.hint": "On, a read-only view appears in the bottom-right corner here: 2 fps, JPEG, one frame per request, and no forwarding of clicks or keys. The change applies **immediately** — no page reload needed. Off, the entry disappears and the endpoints return no image.",
|
|
150
168
|
}
|
|
151
169
|
|
|
152
|
-
/**
|
|
170
|
+
/**
|
|
171
|
+
* Read or patch the host-owned settings document.
|
|
172
|
+
*
|
|
173
|
+
* A patch that touches remote viewing re-evaluates the floating entry right away. Without that,
|
|
174
|
+
* turning the switch on wrote the file and did nothing anyone could see until the page was
|
|
175
|
+
* reloaded — unusable from a phone, and reported as such on #46.
|
|
176
|
+
*/
|
|
153
177
|
async function callSettings(patch) {
|
|
154
178
|
const response = await fetch(ROUTE, patch === undefined
|
|
155
179
|
? { method: "GET", headers: { accept: "application/json" } }
|
|
@@ -162,6 +186,9 @@ window.__ModuleLoader__.load({ id: "dsh-builtin-browser", factory: (require) =>
|
|
|
162
186
|
if (data === undefined || data.ok !== true) {
|
|
163
187
|
throw new Error((data && data.error) || `HTTP ${response.status}`)
|
|
164
188
|
}
|
|
189
|
+
if (patch !== undefined && patch !== null && typeof patch === "object" && patch.remoteView !== undefined) {
|
|
190
|
+
try { refreshWatchEntry() } catch { /* the entry is a convenience, not the setting */ }
|
|
191
|
+
}
|
|
165
192
|
return data
|
|
166
193
|
}
|
|
167
194
|
|
|
@@ -257,7 +284,12 @@ window.__ModuleLoader__.load({ id: "dsh-builtin-browser", factory: (require) =>
|
|
|
257
284
|
|
|
258
285
|
/* Live-view panel. Fixed layer rather than a slot: the host has no stable slot for an extra
|
|
259
286
|
surface over the conversation, and a layer works in every layout including a phone. */
|
|
260
|
-
.dsh-bw-watch {
|
|
287
|
+
.dsh-bw-watch {
|
|
288
|
+
position: fixed; right: 16px; bottom: 16px; font-family: inherit;
|
|
289
|
+
/* Below a modal or popover rather than above everything: the old 2147483000 sat on top of the page,
|
|
290
|
+
* its inputs and any dialog the host opened (issue #46). A floating helper is a guest here. */
|
|
291
|
+
z-index: 1000;
|
|
292
|
+
}
|
|
261
293
|
.dsh-bw-watch-open {
|
|
262
294
|
display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
|
|
263
295
|
border: 1px solid var(--dsw-alias-border, rgba(128,128,128,.45)); border-radius: 999px;
|
|
@@ -267,20 +299,38 @@ window.__ModuleLoader__.load({ id: "dsh-builtin-browser", factory: (require) =>
|
|
|
267
299
|
.dsh-bw-watch-open:hover { background: var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,.2)); }
|
|
268
300
|
.dsh-bw-watch-dot { width: 7px; height: 7px; border-radius: 50%; background: #d9534f; }
|
|
269
301
|
.dsh-bw-watch-panel {
|
|
270
|
-
position: absolute; right: 0; bottom:
|
|
302
|
+
position: absolute; right: 0; bottom: calc(100% + 8px); width: min(560px, calc(100vw - 32px));
|
|
303
|
+
/* The panel used to sit at 40px from the bottom while the button it hangs off occupied 16-46px
|
|
304
|
+
* from the bottom edge of its own box: the two overlapped by 6px and, because the panel's
|
|
305
|
+
* background is opaque, it covered the only way back out (issue #46). 100% is the button's own
|
|
306
|
+
* height, so the gap survives a font-size or padding change instead of being a second magic
|
|
307
|
+
* number. */
|
|
271
308
|
border: 1px solid var(--dsw-alias-border, rgba(128,128,128,.35)); border-radius: 10px;
|
|
272
|
-
|
|
309
|
+
/* --dsw-alias-bg-elevated does not exist in the theme this ships against (measured on rc.5: 0
|
|
310
|
+
* occurrences, while --dsw-alias-bg-layer-2 has 5). With a token that is never defined, the
|
|
311
|
+
* fallback is what everyone sees — a dark card in a light theme. bg-layer-2 is the token the
|
|
312
|
+
* host's own elevated rows use. */
|
|
313
|
+
background: var(--dsw-alias-bg-layer-2, #1b1b1f); color: inherit; overflow: hidden;
|
|
273
314
|
box-shadow: 0 10px 30px rgba(0,0,0,.35);
|
|
274
315
|
}
|
|
275
316
|
.dsh-bw-watch-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 12px; }
|
|
276
317
|
.dsh-bw-watch-title { font-weight: 600; }
|
|
277
318
|
.dsh-bw-watch-state { opacity: .7; margin-left: auto; }
|
|
278
319
|
.dsh-bw-watch-close {
|
|
279
|
-
|
|
280
|
-
|
|
320
|
+
/* A visible control, not a hinted one: the old close was a 16px glyph at 70% opacity with no border
|
|
321
|
+
* or background, in the same colour as the title — reported as 'no way out but a page refresh'
|
|
322
|
+
* (issue #46). */
|
|
323
|
+
border: 1px solid var(--dsw-alias-border, rgba(128,128,128,.45)); border-radius: 6px;
|
|
324
|
+
background: var(--dsw-alias-interactive-bg, rgba(128,128,128,.12));
|
|
325
|
+
color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 3px 7px;
|
|
281
326
|
}
|
|
327
|
+
.dsh-bw-watch-close:hover { background: var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,.2)); }
|
|
282
328
|
.dsh-bw-watch-stage { background: #000; min-height: 120px; display: flex; align-items: center; justify-content: center; }
|
|
283
329
|
.dsh-bw-watch-img { display: block; max-width: 100%; height: auto; }
|
|
330
|
+
/* The hidden ATTRIBUTE is styled by the UA sheet as [hidden]{display:none}, and an author rule
|
|
331
|
+
* defeats it whatever its specificity — so img.hidden = true in the script did nothing and the
|
|
332
|
+
* empty-state image kept taking space (issue #46). */
|
|
333
|
+
.dsh-bw-watch-img[hidden] { display: none; }
|
|
284
334
|
.dsh-bw-watch-note { margin: 0; padding: 24px 14px; font-size: 12px; opacity: .75; text-align: center; }
|
|
285
335
|
.dsh-bw-watch-foot {
|
|
286
336
|
display: flex; align-items: center; gap: 8px; padding: 7px 10px;
|
|
@@ -536,6 +586,14 @@ window.__ModuleLoader__.load({ id: "dsh-builtin-browser", factory: (require) =>
|
|
|
536
586
|
busy,
|
|
537
587
|
onChange: value => patch({ ui: { virtualCursor: value } }),
|
|
538
588
|
}),
|
|
589
|
+
h(Toggle, {
|
|
590
|
+
key: "quiet",
|
|
591
|
+
labelKey: "ui.quiet",
|
|
592
|
+
hintKey: "ui.quiet.hint",
|
|
593
|
+
checked: settings.ui.quiet,
|
|
594
|
+
busy,
|
|
595
|
+
onChange: value => patch({ ui: { quiet: value } }),
|
|
596
|
+
}),
|
|
539
597
|
]),
|
|
540
598
|
|
|
541
599
|
section("vision.title", [
|
|
@@ -620,6 +678,20 @@ window.__ModuleLoader__.load({ id: "dsh-builtin-browser", factory: (require) =>
|
|
|
620
678
|
}),
|
|
621
679
|
]),
|
|
622
680
|
|
|
681
|
+
// Reported on #46: turning remote viewing on had to be done by editing the settings file and
|
|
682
|
+
// reloading the page — and a phone has no keyboard shortcut to reload with. The switch belongs
|
|
683
|
+
// here, and flipping it applies immediately (see `callSettings`).
|
|
684
|
+
section("remoteView.title", [
|
|
685
|
+
h(Toggle, {
|
|
686
|
+
key: "remoteViewEnabled",
|
|
687
|
+
labelKey: "remoteView.enabled",
|
|
688
|
+
hintKey: "remoteView.enabled.hint",
|
|
689
|
+
checked: settings.remoteView.enabled,
|
|
690
|
+
busy,
|
|
691
|
+
onChange: value => patch({ remoteView: { enabled: value } }),
|
|
692
|
+
}),
|
|
693
|
+
]),
|
|
694
|
+
|
|
623
695
|
h("div", { key: "status", style: styles.status }, [
|
|
624
696
|
saved ? h("span", { key: "s" }, t("saved")) : null,
|
|
625
697
|
error !== "" ? h("span", { key: "e", style: styles.error }, ` ${t("failed")} ${error} `) : null,
|
|
@@ -1146,17 +1218,46 @@ window.__ModuleLoader__.load({ id: "dsh-builtin-browser", factory: (require) =>
|
|
|
1146
1218
|
panel.appendChild(foot)
|
|
1147
1219
|
layer.appendChild(openButton)
|
|
1148
1220
|
layer.appendChild(panel)
|
|
1149
|
-
|
|
1221
|
+
// Deliberately NOT appended here. The entry is mounted only when the host reports that watching
|
|
1222
|
+
// is on — reported as issue #40: with the feature off, the button still sat on every page and
|
|
1223
|
+
// the bridge-status request fired at startup, so a setting nobody turned on produced a permanent
|
|
1224
|
+
// control and a permanent diagnostic call.
|
|
1150
1225
|
|
|
1151
1226
|
/** Localized text, falling back to the key so a missing entry is visible rather than blank. */
|
|
1152
1227
|
const say = key => {
|
|
1153
1228
|
try { return translate(key) } catch { return key }
|
|
1154
1229
|
}
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* Apply the current locale to every static label.
|
|
1233
|
+
*
|
|
1234
|
+
* Called at mount and again once the dictionaries are bound. The panel used to set these exactly
|
|
1235
|
+
* once, inside `apply()`, *before* `locale.register` had run — so the shipped build showed
|
|
1236
|
+
* `watch.title` as its title and the key was never replaced (issue #40).
|
|
1237
|
+
*/
|
|
1238
|
+
const relabel = () => {
|
|
1239
|
+
openLabel.textContent = say("watch.open")
|
|
1240
|
+
title.textContent = say("watch.title")
|
|
1241
|
+
readonlyLabel.textContent = say("watch.readOnly")
|
|
1242
|
+
stopButton.textContent = say("watch.stop")
|
|
1243
|
+
openButton.title = say("watch.open")
|
|
1244
|
+
}
|
|
1245
|
+
relabel()
|
|
1246
|
+
|
|
1247
|
+
let mounted = false
|
|
1248
|
+
/** Put the entry on the page. Idempotent, so a second enable cannot stack copies. */
|
|
1249
|
+
const mount = () => {
|
|
1250
|
+
if (mounted) return
|
|
1251
|
+
mounted = true
|
|
1252
|
+
document.body.appendChild(layer)
|
|
1253
|
+
relabel()
|
|
1254
|
+
}
|
|
1255
|
+
/** Take it off again — the host turned the feature off after it had been on. */
|
|
1256
|
+
const unmount = () => {
|
|
1257
|
+
if (!mounted) return
|
|
1258
|
+
mounted = false
|
|
1259
|
+
layer.remove()
|
|
1260
|
+
}
|
|
1160
1261
|
|
|
1161
1262
|
/** One running view: a session, its frames, and whether it should keep pulling. */
|
|
1162
1263
|
const view = { session: undefined, timer: undefined, running: false, lastAt: 0, objectUrl: undefined }
|
|
@@ -1288,7 +1389,8 @@ window.__ModuleLoader__.load({ id: "dsh-builtin-browser", factory: (require) =>
|
|
|
1288
1389
|
|
|
1289
1390
|
ctx.effect(() => () => {
|
|
1290
1391
|
stop()
|
|
1291
|
-
|
|
1392
|
+
unmount()
|
|
1393
|
+
refreshWatchEntry = () => {}
|
|
1292
1394
|
}, "dsh-builtin-browser: live view panel")
|
|
1293
1395
|
|
|
1294
1396
|
/**
|
|
@@ -1325,7 +1427,33 @@ window.__ModuleLoader__.load({ id: "dsh-builtin-browser", factory: (require) =>
|
|
|
1325
1427
|
}
|
|
1326
1428
|
panel.insertBefore(notice, panel.firstChild)
|
|
1327
1429
|
}
|
|
1328
|
-
|
|
1430
|
+
|
|
1431
|
+
/**
|
|
1432
|
+
* Mount the entry only if the host says viewing is enabled, and only then ask about the bridge.
|
|
1433
|
+
*
|
|
1434
|
+
* Both halves are the point of the ordering: the probe answers "is this feature on", and the
|
|
1435
|
+
* bridge-status request is a diagnostic for a feature that is on. Issuing it for a feature that
|
|
1436
|
+
* is off is what the review called a default entry manufacturing a call (issue #40).
|
|
1437
|
+
*
|
|
1438
|
+
* A host that does not serve the sessions endpoint answers `enabled: false`, so the fallback is
|
|
1439
|
+
* "no entry" rather than "an entry that cannot work".
|
|
1440
|
+
*/
|
|
1441
|
+
const mountIfEnabled = async () => {
|
|
1442
|
+
const found = await probe()
|
|
1443
|
+
if (!found.enabled) {
|
|
1444
|
+
// Turning the feature off must also stop what it started: a running stream outliving its own
|
|
1445
|
+
// switch is the sort of state that looks like a ghost later.
|
|
1446
|
+
stop()
|
|
1447
|
+
unmount()
|
|
1448
|
+
return
|
|
1449
|
+
}
|
|
1450
|
+
mount()
|
|
1451
|
+
await showBridgeStatus()
|
|
1452
|
+
}
|
|
1453
|
+
// The settings switch calls this after writing `remoteView.enabled` (issue #46): no page reload,
|
|
1454
|
+
// which is the difference between usable and useless on a phone.
|
|
1455
|
+
refreshWatchEntry = () => { void mountIfEnabled() }
|
|
1456
|
+
void mountIfEnabled()
|
|
1329
1457
|
}
|
|
1330
1458
|
|
|
1331
1459
|
function apply(ctx) {
|
|
@@ -1333,10 +1461,14 @@ window.__ModuleLoader__.load({ id: "dsh-builtin-browser", factory: (require) =>
|
|
|
1333
1461
|
// one. Idempotent, so a re-apply does not stack copies.
|
|
1334
1462
|
installStyles()
|
|
1335
1463
|
installPanelService(ctx)
|
|
1336
|
-
|
|
1464
|
+
// Dictionaries and the bound `t` come BEFORE anything that sets text from them. The watch panel
|
|
1465
|
+
// used to be installed first, so its static labels were written while `translate` still returned
|
|
1466
|
+
// the key and were never rewritten — the panel shipped with `watch.title` as its title
|
|
1467
|
+
// (issue #40).
|
|
1337
1468
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }), "dsh-builtin-browser: dictionaries")
|
|
1338
1469
|
const t = ctx.locale.bind(NS)
|
|
1339
1470
|
translate = t
|
|
1471
|
+
installWatchPanel(ctx)
|
|
1340
1472
|
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
1341
1473
|
name: "settings.section",
|
|
1342
1474
|
id: "dsh-builtin-browser",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "What proves a directory is DSH Desktop, in one place: the installer (desktop-bridge/install.mjs) and the plugin's status reader (src/browser-electron/bridge-status.ts) both read this file, and a test asserts neither hard-codes a second copy. A generic Electron layout — resources/app/lib/main.js or resources/app.asar — is NOT proof: any Electron app has that shape.",
|
|
3
|
+
"packageNames": [
|
|
4
|
+
"@deepseek-ai/dsh-desktop",
|
|
5
|
+
"dsh-desktop"
|
|
6
|
+
],
|
|
7
|
+
"mainEntry": "lib/main.js",
|
|
8
|
+
"_layoutNote": "resources/app.asar wins over resources/app whenever it exists, so identity is read from the archive in that case and never from the sibling extraction, which the updater leaves behind and which may be a different build."
|
|
9
|
+
}
|