dsh-builtin-browser 0.5.7 → 0.5.8

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.en.md +48 -22
  3. package/README.md +48 -22
  4. package/client.js +469 -81
  5. package/desktop-bridge/install-and-start.cmd +4 -5
  6. package/desktop-bridge/install.mjs +251 -159
  7. package/desktop-bridge/maintenance-progress.ps1 +166 -0
  8. package/desktop-bridge/plugin-browser-bridge.js +151 -18
  9. package/desktop-bridge/request-desktop-quit.ps1 +170 -0
  10. package/docs/user-guide.md +28 -4
  11. package/lib/browser-electron/automatic-maintenance.d.ts +41 -0
  12. package/lib/browser-electron/automatic-maintenance.js +426 -0
  13. package/lib/browser-electron/bridge-auto.d.ts +93 -0
  14. package/lib/browser-electron/bridge-auto.js +113 -0
  15. package/lib/browser-electron/bridge-connection.d.ts +0 -2
  16. package/lib/browser-electron/bridge-connection.js +2 -4
  17. package/lib/browser-electron/bridge-endpoint.js +1 -19
  18. package/lib/browser-electron/bridge-install.d.ts +41 -4
  19. package/lib/browser-electron/bridge-install.js +131 -18
  20. package/lib/browser-electron/bridge-maintenance.d.ts +24 -0
  21. package/lib/browser-electron/bridge-maintenance.js +125 -0
  22. package/lib/browser-electron/bridge-status.d.ts +10 -3
  23. package/lib/browser-electron/bridge-status.js +76 -45
  24. package/lib/browser-electron/desktop-bridge-host.d.ts +5 -2
  25. package/lib/browser-electron/desktop-bridge-host.js +54 -33
  26. package/lib/browser-electron/desktop-identity.js +21 -9
  27. package/lib/browser-electron/electron-provision.js +5 -2
  28. package/lib/browser-electron/entry.js +104 -74
  29. package/lib/browser-electron/ephemeral-profile.js +67 -26
  30. package/lib/browser-electron/history-store.js +2 -2
  31. package/lib/browser-electron/host-main.js +26 -37
  32. package/lib/browser-electron/http-body.d.ts +24 -0
  33. package/lib/browser-electron/http-body.js +33 -0
  34. package/lib/browser-electron/json-reply.d.ts +13 -1
  35. package/lib/browser-electron/json-reply.js +16 -2
  36. package/lib/browser-electron/maintenance-broker.d.ts +35 -0
  37. package/lib/browser-electron/maintenance-broker.js +114 -0
  38. package/lib/browser-electron/maintenance-lifecycle.d.ts +32 -0
  39. package/lib/browser-electron/maintenance-lifecycle.js +67 -0
  40. package/lib/browser-electron/maintenance-route.d.ts +18 -0
  41. package/lib/browser-electron/maintenance-route.js +75 -0
  42. package/lib/browser-electron/paths.d.ts +4 -0
  43. package/lib/browser-electron/paths.js +19 -0
  44. package/lib/browser-electron/process.d.ts +14 -0
  45. package/lib/browser-electron/process.js +24 -0
  46. package/lib/browser-electron/provider.d.ts +7 -7
  47. package/lib/browser-electron/provider.js +13 -14
  48. package/lib/browser-electron/remote-host.js +18 -16
  49. package/lib/browser-electron/runtime-status.d.ts +27 -13
  50. package/lib/browser-electron/runtime-status.js +24 -4
  51. package/lib/browser-electron/settings-store.d.ts +11 -0
  52. package/lib/browser-electron/settings-store.js +8 -2
  53. package/lib/browser-electron/sidebar-only-host.d.ts +36 -0
  54. package/lib/browser-electron/sidebar-only-host.js +192 -0
  55. package/lib/browser-electron/system-browser.d.ts +1 -9
  56. package/lib/browser-electron/system-browser.js +19 -22
  57. package/lib/browser-electron/timing.d.ts +8 -0
  58. package/lib/browser-electron/timing.js +13 -0
  59. package/lib/browser-electron/windows-system.d.ts +3 -0
  60. package/lib/browser-electron/windows-system.js +19 -0
  61. package/lib/tool-browser/index.js +5 -4
  62. package/package.json +2 -2
  63. package/scripts/run-tests.mjs +32 -0
  64. package/scripts/verify-preview-route.mjs +19 -1
  65. package/src/browser-electron/automatic-maintenance.ts +414 -0
  66. package/src/browser-electron/bridge-auto.ts +158 -0
  67. package/src/browser-electron/bridge-connection.ts +2 -4
  68. package/src/browser-electron/bridge-endpoint.ts +1 -18
  69. package/src/browser-electron/bridge-install.ts +151 -20
  70. package/src/browser-electron/bridge-maintenance.ts +161 -0
  71. package/src/browser-electron/bridge-status.ts +78 -48
  72. package/src/browser-electron/desktop-bridge-host.ts +48 -32
  73. package/src/browser-electron/desktop-identity.ts +18 -9
  74. package/src/browser-electron/electron-provision.ts +5 -2
  75. package/src/browser-electron/entry.ts +91 -69
  76. package/src/browser-electron/ephemeral-profile.ts +65 -28
  77. package/src/browser-electron/history-store.ts +2 -2
  78. package/src/browser-electron/host-main.ts +23 -36
  79. package/src/browser-electron/http-body.ts +42 -0
  80. package/src/browser-electron/json-reply.ts +18 -3
  81. package/src/browser-electron/maintenance-broker.ts +142 -0
  82. package/src/browser-electron/maintenance-lifecycle.ts +86 -0
  83. package/src/browser-electron/maintenance-route.ts +64 -0
  84. package/src/browser-electron/paths.ts +21 -0
  85. package/src/browser-electron/process.ts +23 -0
  86. package/src/browser-electron/provider.ts +18 -18
  87. package/src/browser-electron/remote-host.ts +19 -19
  88. package/src/browser-electron/runtime-status.ts +52 -17
  89. package/src/browser-electron/settings-store.ts +20 -3
  90. package/src/browser-electron/sidebar-only-host.ts +199 -0
  91. package/src/browser-electron/system-browser.ts +19 -22
  92. package/src/browser-electron/timing.ts +16 -0
  93. package/src/browser-electron/windows-system.ts +23 -0
  94. package/src/tool-browser/index.ts +5 -4
package/CHANGELOG.md CHANGED
@@ -2,6 +2,70 @@
2
2
 
3
3
  本文件记录各轮功能开发与问题修复(由仓库外独立文档迁入,随仓库管理)。
4
4
 
5
+ ## 0.5.8(2026-11-07)
6
+
7
+ ### 五项已确认基线问题的修复与集成验收
8
+
9
+ - Chrome/Edge 安静模式不再覆盖有界面设置:由 `browser.headless` 单独决定窗口是否存在,安静模式继续只控制激活、展示与标签选择。
10
+ - 桥接卸载不再假成功:当 Electron 实际加载的入口仍含桥接片段时,返回 `INCOMPLETE` 与非零退出码;其它插件的补丁和原始备份仍逐字节保留。
11
+ - 远程观看在存在多个会话时提供简洁的会话选择,默认观看最近创建的会话,不再固定取会话列表第一项。
12
+ - 观看循环按代次隔离并中止在途请求:停止、切换会话、停止后重开与重复点击都只保留一条截图循环,旧帧不再被绘制。
13
+ - 临时浏览器配置清理改以整棵目录树内最近一次写入为判据:根目录时间很旧但嵌套文件仍在写入时保留配置;遍历不可证实也一律保留。
14
+ - 新增 8 项对应以上缺陷的行为回归测试;全套检查 789 项、788 通过、0 失败、1 跳过。
15
+ - 集成链路以单一总控按序跑通 10 个阶段:真实桥接安装 → 重装 → 其它插件补丁下的卸载(如实报未完成)→ 人工修复后干净卸载 → 安装并自动重启 → 重启后再次卸载 → 真实 Edge 安静模式窗口 → 真实 Electron 侧栏 17/17 → 真实渲染进程中的远程观看切换/停止/重开 → 活跃写入的临时配置清理;跨阶段一致性检查全部通过。
16
+
17
+ 验收边界:以上结论只覆盖本次已验证的场景(隔离安装树、项目内置 Electron、本机 Edge/Chromium、受控会话与帧服务)。未覆盖真实 DSH 安装目录的一键维护、真实 LAN/隧道远程观看、全部浏览器与宿主版本组合,以及其它操作系统。
18
+
19
+ ### 侧栏首次打开与标签绑定
20
+
21
+ - 选择 DSH 侧栏后,打开网址会显示目标会话、展开侧栏并初始化真实浏览器页面;连接丢失后继续重连侧栏。
22
+ - 安静模式保留系统前台窗口和鼠标位置,同时支持显式打开网址与切换侧栏标签。
23
+ - 桥接协议按逻辑页面绑定原生标签,支持同网址的多个独立页面,缓存页面再次导航时展开折叠的侧栏。
24
+ - 被动预览只读取已绑定页面,导航前的文档探测只使用已有 guest;销毁后的延迟初始化响应保留销毁状态。
25
+ - 侧栏文字和按键通过目标 guest 的原生输入接口发送,修复新增标签输入丢失及误投邻页;保持系统焦点和鼠标位置。
26
+ - 侧栏下载使用目标页面的浏览器会话,将数据分段写入临时文件并排他提交到用户指定位置,支持登录 Cookie、大小限制和失败清理。
27
+
28
+ ### 桥接维护期间的独立进度提示
29
+
30
+ - 点击维护按钮立即显示准备状态,握手期间按钮显示忙碌状态。
31
+ - 独立进度窗跨桌面退出和重启显示当前阶段与总用时,完成后自动收起,失败或取消时保留结果。
32
+ - 进度窗跟随界面语言,保持后台显示,关闭后维护继续运行。
33
+
34
+ ### 修复 Electron Node 模式安装桥接时的归档自锁
35
+
36
+ - 安装器统一使用原始文件接口完成目录探测、归档校验、解包与重命名,修复普通 Electron 文件探测缓存归档句柄后导致的 `EBUSY`。
37
+ - 桥接状态读取使用原始归档存在检查,读取状态后继续允许维护进程移动归档。
38
+ - 维护诊断合并重复的错误和安装输出,保留额外的恢复错误信息。
39
+ - 在 Electron 44.7 / Node 24.21 下完成官方完整归档的安装与还原验证,22,102 个文件解包后成功切换归档,恢复后的哈希一致。
40
+
41
+ ### Windows 桌面端一键维护与环境检测
42
+
43
+ - 安装、修复、重装和卸载按钮由独立 Windows 维护进程协调正常退出、文件维护与自动重启,安装成功通过新进程的鉴权桥接连接确认。
44
+ - 正常退出使用原生菜单的无障碍调用;进行中的任务继续使用 DSH 原有的退出确认,取消退出会取消维护。阶段和结果跨宿主重启保存。
45
+ - 环境检查直接报告已找到的 Chrome / Edge、内置运行时与侧栏桥状态,自动模式显示选中的载体。
46
+ - 浏览器下拉菜单按内容设置宽度,选项保持单行;静态状态行保持普通背景。
47
+
48
+ ### 桥接维护保留当前宿主会话(2026-11-06)
49
+
50
+ - 退出后维护取代此前的宿主内关闭、强制终止和 detached 交接重启方案。安装器在写入前检查目标桌面端已退出,并拒绝来自目标 GUI 祖先进程的调用。
51
+ - 插件启动时的自动安装路径已移除,`bridge.autoInstall` 默认关闭,旧配置中的开启值也保留当前运行会话。
52
+ - 安装器的文件维护接口保留最终结果和错误原因;上方显式维护流程负责桌面端的退出和重新启动。
53
+ - 手动维护按钮继续显示,诊断始终提供外部终端命令,包括已安装状态。
54
+ - Windows 进程枚举使用 UTF-8,并隐藏子进程窗口;归档读取和解包在成功与失败路径均释放文件句柄。
55
+ - 桥接状态核对部署模块的存在和内容,旧副本及缺失副本显示修复入口,安装目录按 DSH 身份核验。
56
+
57
+ ### 设置入口完整性与坐标操作命名
58
+
59
+ - 自动浏览器模式恢复登录状态保留和窗口模式入口,这两项在自动选择 Chrome / Edge 时继续使用原有配置。
60
+ - 页面定位更名为坐标点击与拖拽,选项改为允许和禁止,保留 `auto` / `nonVisual` 配置值。
61
+ - 登录状态保留选项补充重启后生效提示。
62
+
63
+ ### 恢复设置面板的桥接管理入口
64
+
65
+ - 就绪状态下方显示安装、修复或重新安装桥接按钮,已安装时在诊断中提供卸载入口。
66
+ - 点击后调用安装接口,在目标桌面端退出后校验并执行文件维护;操作期间锁定按钮,完成后刷新状态。
67
+ - 显示安装器返回的失败原因,并覆盖 HTTP 成功但安装失败的结果。
68
+
5
69
  ## 0.5.7(2026-11-05)
6
70
 
7
71
  ### 适配 DSH 0.2.2-alpha.3:插件路由改用宿主会话鉴权
@@ -51,6 +115,8 @@
51
115
 
52
116
  ### 桥:从"给你一条命令"改成"面板里一个按钮"
53
117
 
118
+ 本节记录当时的实现。当前维护策略见上方 2026-11-06 的宿主会话保护修复,原有 `--restart --yes` 宿主内重启流程已被替代。
119
+
54
120
  原来面板只把修复命令印出来,让用户自己去终端跑。这一步会**关闭并重启桌面端**,手工跑半个(cwd 不对、node 不对、路径带空格引号掉了)就会把外壳留在更难诊断的状态。
55
121
 
56
122
  - 新端点 `POST /dsh-builtin-browser/bridge-action`(`{action:"install"|"uninstall"}`),**按写操作准入**(`sameOrigin(request, true)`):它会停掉外壳,不该和读取同一把尺子
package/README.en.md CHANGED
@@ -12,47 +12,78 @@
12
12
 
13
13
  Use DSH to open pages, read content, fill forms, and download files in the bundled browser, the desktop sidebar, or a local installation of Chrome or Edge. Each task has its own tabs and action history. In a visible window or the desktop sidebar, you can take over the page the agent is using.
14
14
 
15
- This feature list matches **0.5.7** (compatible with DSH 0.2.2-alpha.3: plugin routes go through the host session auth). [Changelog](CHANGELOG.md)
15
+ This feature list matches **0.5.8** (compatible with DSH 0.2.2-alpha.3: plugin routes go through the host session auth). [Changelog](CHANGELOG.md)
16
16
 
17
- ## Install
17
+ ## Quick start
18
18
 
19
- Desktop and Web use separate plugin profiles. Run the command for the profile you use.
19
+ **First, which side are you on** — these are two separate installs; updating one does not update the other, and they host the browser differently.
20
20
 
21
- ~~~sh
21
+ > **Updating an installed plugin takes two steps** (since DSH 0.2.1-alpha.2, installing over an installed package fails outright with `already-installed`): run `dsh plugin --profile <profile> remove dsh-builtin-browser` first, then `add` the target version. See the [user guide](docs/user-guide.md) (Chinese).
22
+
23
+ ### DSH Desktop
24
+
25
+ ```sh
22
26
  dsh plugin --profile desktop add dsh-builtin-browser
27
+ ```
28
+
29
+ When the desktop shell provides a controllable `<webview>` and the bridge is installed, the plugin drives the **official side panel**: the agent operates the very page you see. Otherwise it falls back to the plugin's own Electron window.
30
+
31
+ The sidebar bridge is installed into **the desktop app's own install directory**. On Windows Desktop, open **Settings → Browser** and select **Install and restart**. The action exits Desktop normally, installs the bridge, reopens Desktop, and verifies the new bridge connection. DSH retains its own confirmation for running tasks.
32
+
33
+ For terminal installation, save your task and exit DSH Desktop completely, including its tray process, then run this from the plugin directory:
34
+
35
+ ```sh
36
+ node desktop-bridge/install.mjs "<DSH Desktop install directory>"
37
+ ```
38
+
39
+ Start DSH Desktop after installation. On Windows, `desktop-bridge/install-and-start.cmd` installs and starts the app after Desktop has exited. The settings action uses an independent maintenance process; the installer verifies the closed target, its identity, and backups before writing files.
40
+
41
+ > **The bridge is optional**: without it, the plugin uses a standalone window. **Reinstall the bridge with the new script after plugin or desktop shell upgrades** — a desktop update restores `app.asar`, the bridge goes stale, and `bridge-status` reports `stale`. The state is visible at the top of the panel. See [carrier limitations](docs/limitations.md) (Chinese).
42
+
43
+ ### Web (`dsh web`)
44
+
45
+ ```sh
23
46
  dsh plugin --profile web add dsh-builtin-browser
24
- ~~~
47
+ ```
25
48
 
26
- To update, run `dsh plugin --profile <profile> remove dsh-builtin-browser`, then run the install command for the same profile. Replace `<profile>` with `desktop` or `web`.
49
+ There is **no side panel and no bridge** on the web side: the shared browser is **self-hosted** in a standalone window (titled `dsh-browser`) with a full toolbar (address bar, back/forward/reload, tab strip) you can use like any browser.
27
50
 
28
- After installation, try this task in DSH.
51
+ > Since 0.5.3 nothing is downloaded at install time and there is no `postinstall`: the runtime is prepared in the background on first need. Progress and retry live in **Settings → Browser** (use **Prepare the bundled browser** after a failure). To prepare it ahead of time (offline images, CI), run `npx --no dsh-browser-install-electron` from that profile directory (network required). See the [setup guide](docs/user-guide.md#准备-electron-二进制) (Chinese).
29
52
 
30
- > Open https://example.com and extract the page title and main content.
53
+ ### Both sides
31
54
 
32
- DSH prepares the Electron runtime for the bundled browser. Open **Settings → Browser** to check progress and use **Prepare the bundled browser** to retry a failed setup. To prepare Electron ahead of time, run `npx --no dsh-browser-install-electron` from the plugin profile directory. [User guide](docs/user-guide.md)
55
+ Once installation is complete, ask the agent:
56
+
57
+ ```
58
+ Open https://example.com and summarise the main content for me.
59
+ ```
60
+
61
+ The browser window appears with the first call, and you can operate in it yourself at any point. **Either side can be pointed at your own installed Chrome / Edge** in settings — that option behaves identically on both.
33
62
 
34
63
  ## Choose a browser
35
64
 
36
65
  | Option | How it works |
37
66
  | --- | --- |
38
67
  | Bundled browser | Opens pages in a separate window with an address bar, navigation controls, and tabs. |
39
- | DSH sidebar | Drives the sidebar on DSH Desktop builds that expose an Electron `webview`, with the bridge installed. |
68
+ | DSH sidebar | With the bridge installed on a Desktop build that exposes Electron `webview`, opening a URL expands the target conversation's sidebar browser. Lost connections reconnect to the selected sidebar. |
40
69
  | Local Chrome / Edge | Launches the installed browser with a dedicated plugin profile. |
41
70
  | Automatic | Chooses based on the available local browsers and desktop sidebar. |
42
71
 
43
- To use the **DSH sidebar**, run the following from the plugin directory. The installer verifies the DSH Desktop installation, installs the bridge, and restarts the desktop app. After a desktop update, check **Settings → Browser → Diagnostics** and use the same command to repair the bridge.
72
+ Windows Desktop **Settings → Browser** provides installation, repair, and reinstallation with automatic restart. **Diagnostics** includes uninstall and restart, plus an external-terminal command. Progress and results survive the restart, and successful installation requires a verified connection to the new process. For terminal maintenance, exit Desktop normally and run this from the plugin directory:
44
73
 
45
74
  ~~~sh
46
- node desktop-bridge/install.mjs "<DSH Desktop install directory>" --restart
75
+ node desktop-bridge/install.mjs "<DSH Desktop install directory>"
47
76
  ~~~
48
77
 
78
+ Preparation feedback appears immediately. While Desktop is closed, a separate progress window shows installation, startup, connection checks, and elapsed time, then closes after completion. The window stays in the background; closing it leaves maintenance running.
79
+
49
80
  ## Browser settings
50
81
 
51
- - **Readiness** reports browser availability. Expand **Diagnostics** to see the browser selection, bundled runtime, and desktop bridge status.
52
- - **Quiet mode** keeps your current window and tab in place. New Chrome and Edge instances run in the background, and minimized bundled browser windows stay minimized. For the desktop sidebar, open the target page by hand before handing it to DSH.
82
+ - **Environment check** reports detected Chrome / Edge, the bundled runtime, and sidebar bridge availability. Automatic mode identifies the selected carrier; **Diagnostics** includes the executable path.
83
+ - **Quiet mode** preserves the operating system's foreground window and pointer position. New browser windows appear in the background, and minimized bundled browser windows stay minimized. With DSH sidebar selected, opening a URL reveals the target conversation's sidebar page; explicit tab switching selects the corresponding native tab.
53
84
  - **Presentation** controls sidebar expansion, closing the browser with the session, the agent cursor, and remote viewing.
54
85
  - **Agent permissions** controls page scripts, downloads, and reading or writing sign-in state.
55
- - **Advanced settings** covers browsing history, page targeting, and sign-in persistence and window mode for Chrome and Edge. The delivery form validates and saves the tool name, argument template, failure policy, and per-site rules together.
86
+ - **Advanced settings** covers browsing history, permission for coordinate clicks and drags, and sign-in persistence and window mode for Chrome, Edge, and Automatic mode. The delivery form validates and saves the tool name, argument template, failure policy, and per-site rules together.
56
87
 
57
88
  On the local machine or in an isolated test environment, turn on **Allow remote viewing** and open the DSH viewer for a read-only view of the browser session. The viewer refreshes JPEG frames up to twice per second.
58
89
 
@@ -60,6 +91,8 @@ On the local machine or in an isolated test environment, turn on **Allow remote
60
91
 
61
92
  In **Advanced settings → Delivery**, enter an upload tool registered in DSH and configure its destination arguments. Automatic delivery uses the DSH native tool executor and retains the current task's tool permissions. The result includes the local download path and the upload tool's complete return value.
62
93
 
94
+ DSH sidebar downloads use the target page's authenticated browser session, stream to a temporary file, and commit the completed file while preserving existing destinations.
95
+
63
96
  The official Baidu Netdisk stdio MCP upload tool accepts this argument template:
64
97
 
65
98
  ```json
@@ -90,13 +123,6 @@ The current source registers 48 tools. The table lists their names after the `ds
90
123
  | Review records | `history` `visited` `replay` |
91
124
  | Diagnose issues and find help | `doctor` `help` |
92
125
 
93
- ### Use the new tools
94
-
95
- - Use `do` to open a page, fill fields, click, and wait in one call. It reports the step where execution stopped on failure. Use `assert` to verify page text, elements, the URL, or a script condition.
96
- - Use `state` to read the URL, title, load state, and visible text, and `find` to locate text. Use `console` and `network` to inspect messages and requests, and `wait_for_response` to match a response by URL.
97
- - Use `upload` to fill a file input, `hover` to open hover menus, and `drag` to operate sliders, sortable lists, drop targets, and canvases. Hover and drag use the browser's input channel. The bundled browser can use the current session's cookies to save a file with `download`.
98
- - Use `dialog` to inspect page-script dialogs and select how to answer them, `doctor` for the current page and tool status, and `help` for usage by topic.
99
-
100
126
  ## Documentation
101
127
 
102
128
  - [User guide](docs/user-guide.md)
package/README.md CHANGED
@@ -12,47 +12,78 @@
12
12
 
13
13
  让 DSH 在内置浏览器、桌面侧栏或本机 Chrome、Edge 中打开网页、读取内容、填写表单和下载文件。每个任务有自己的标签页和操作记录。使用可见窗口或桌面侧栏时,你可以接手 Agent 正在操作的页面。
14
14
 
15
- 本页功能清单对应 **0.5.7**(适配 DSH 0.2.2-alpha.3:插件路由走宿主会话鉴权)。[更新记录](CHANGELOG.md)
15
+ 本页功能清单对应 **0.5.8**(适配 DSH 0.2.2-alpha.3:插件路由走宿主会话鉴权)。[更新记录](CHANGELOG.md)
16
16
 
17
- ## 安装
17
+ ## 快速开始
18
18
 
19
- 桌面端和 Web 端使用各自的插件配置。按你使用的端执行对应命令。
19
+ **先确认你在哪一端** —— 两端是两份独立安装,**更新其中一端不会带上另一端**,浏览器的承载方式也不同。
20
20
 
21
- ~~~sh
21
+ > **更新已安装的插件是两步**(DSH 0.2.1-alpha.2 起,对已装包再装会直接报 `already-installed`):先 `dsh plugin --profile <profile> remove dsh-builtin-browser`,再 `add` 目标版本。详见[用户指南](docs/user-guide.md#先移除再安装)。
22
+
23
+ ### DSH Desktop(桌面端)
24
+
25
+ ```sh
22
26
  dsh plugin --profile desktop add dsh-builtin-browser
27
+ ```
28
+
29
+ 桌面端在外壳支持可驱动的 `<webview>` 且已安装 bridge 时,驱动**官方侧栏**里那个浏览器面板,agent 操作的就是你在界面上看到的同一页面。侧栏不可驱动时自动使用插件自己的 Electron 窗口。
30
+
31
+ 侧栏 bridge 安装在**桌面端自己的安装目录**中。Windows 桌面端打开 **设置 → 浏览器**,点击 **安装并重启**,即可完成正常退出、安装、重新启动和桥接连接验证。进行中的任务触发 DSH 自身的退出确认时,由用户决定是否退出。
32
+
33
+ 终端安装方式:保存任务并正常退出 DSH Desktop,包括托盘中的进程,再从插件目录运行:
34
+
35
+ ```sh
36
+ node desktop-bridge/install.mjs "<DSH Desktop 安装目录>"
37
+ ```
38
+
39
+ 完成后启动 DSH Desktop。Windows 用户也可在桌面端退出后运行 `desktop-bridge/install-and-start.cmd`,由它完成安装并启动桌面端。设置按钮由独立维护进程协调,安装器在桌面端退出后校验身份、备份和写入文件。
40
+
41
+ > **bridge 是可选项**:不装时自动退回自托管,多出一个独立窗口。**插件或桌面外壳升级后,重跑同一条命令即可修复** —— 桌面端升级会恢复 `app.asar`,桥随之失效,此时 `bridge-status` 报 `stale`。设置在面板顶部可见。载体差异见[已知限制](docs/limitations.md)。
42
+
43
+ ### Web 端(`dsh web`)
44
+
45
+ ```sh
23
46
  dsh plugin --profile web add dsh-builtin-browser
24
- ~~~
47
+ ```
25
48
 
26
- 更新时,先在对应配置下执行 `dsh plugin --profile <profile> remove dsh-builtin-browser`,再执行该端的安装命令。将 `<profile>` 替换为 `desktop` 或 `web`。
49
+ Web 端**没有侧栏,也没有 bridge**:共享浏览器由插件**自托管**拉起一个独立窗口(标题 `dsh-browser`),自带完整工具栏(地址栏 / 后退前进刷新 / 标签条),你可以像用普通浏览器一样直接用它。
27
50
 
28
- 安装后,可以在 DSH 会话里试用下面的任务。
51
+ > 0.5.3 起安装期不下载 Electron、也不带 `postinstall`:运行时要**首次需要时**在后台准备。查看进度和重试都在 **设置 → 浏览器**:准备失败时点「准备内置浏览器」;要在安装阶段提前备好(离线部署 / CI),在该 profile 目录执行 `npx --no dsh-browser-install-electron`(需网络)。详见[用户指南](docs/user-guide.md#准备-electron-二进制)。
29
52
 
30
- > 帮我打开 https://example.com,提取页面标题和主要内容。
53
+ ### 两端通用
31
54
 
32
- DSH 会准备内置浏览器所需的 Electron。打开 **设置 → 浏览器** 查看进度,准备失败时点击 **准备内置浏览器** 重试。需要提前准备时,可在对应的插件配置目录执行 `npx --no dsh-browser-install-electron`。[用户指南](docs/user-guide.md)
55
+ 完成安装后,直接让 agent 用它:
56
+
57
+ ```
58
+ 帮我打开 https://example.com,把页面上的主要内容用中文总结一下。
59
+ ```
60
+
61
+ 浏览器窗口会随第一次调用出现;你可以随时在那个窗口里自己操作,agent 会接着往下走。**两端都可以在设置里改用你本机已安装的 Chrome / Edge**,那是行为完全一致的选项。
33
62
 
34
63
  ## 选择浏览器
35
64
 
36
65
  | 选项 | 使用方式 |
37
66
  | --- | --- |
38
67
  | 内置浏览器 | 在独立窗口中打开页面,提供地址栏、前进、后退、刷新和标签栏。 |
39
- | DSH 侧栏 | 在支持 Electron `webview` 的桌面端安装桥接组件后使用。 |
68
+ | DSH 侧栏 | 在支持 Electron `webview` 的桌面端安装桥接组件后,打开网址会自动展开目标会话的侧栏浏览器。连接中断后继续重连所选侧栏。 |
40
69
  | 本机 Chrome / Edge | 使用插件专用的浏览器配置启动本机 Chrome 或 Edge。 |
41
70
  | 自动 | 根据本机浏览器和桌面侧栏的可用情况选择。 |
42
71
 
43
- 使用 **DSH 侧栏** 时,在插件目录运行下面的命令。安装器校验 DSH 安装目录,安装桥接组件后重启桌面端。桌面端升级后,可展开 **设置 → 浏览器 → 诊断** 查看桥接状态,并用同一条命令修复。
72
+ Windows 桌面端 **设置 → 浏览器** 提供安装、修复和重新安装并重启入口,**诊断** 中提供卸载并重启和外部终端命令。界面展示维护阶段,重启后读取持久化结果;安装成功以新进程的桥接连接验证为准。从终端维护时,在桌面端正常退出后从插件目录运行:
44
73
 
45
74
  ~~~sh
46
- node desktop-bridge/install.mjs "<DSH Desktop 安装目录>" --restart
75
+ node desktop-bridge/install.mjs "<DSH Desktop 安装目录>"
47
76
  ~~~
48
77
 
78
+ 点击后立即显示准备状态。桌面端退出期间,独立进度窗继续显示安装、启动和连接检查阶段及用时;完成后自动收起。进度窗保持后台显示,关闭它时维护继续运行。
79
+
49
80
  ## 浏览器设置
50
81
 
51
- - **就绪状态** 显示浏览器是否可用。展开 **诊断** 查看浏览器选项、内置运行时和桌面桥接状态。
52
- - **安静模式** 保留当前窗口和标签。新启动的 Chrome 和 Edge 在后台运行,最小化的内置浏览器保持最小化。使用桌面侧栏时,先手动打开目标页,再交给 DSH 操作。
82
+ - **环境检查** 显示已找到的 Chrome / Edge、内置运行环境和侧栏桥接状态。自动模式显示实际选择的载体,**诊断** 提供可执行文件路径。
83
+ - **安静模式** 保留操作系统的前台窗口和鼠标位置。新启动的浏览器窗口在后台显示,最小化的内置浏览器保持最小化。选择 DSH 侧栏后,打开网址会展示目标会话的侧栏页面,显式切换标签会选择对应的原生标签。
53
84
  - **展示** 提供侧栏自动展开、随会话关闭浏览器、Agent 光标和远程观看开关。
54
85
  - **Agent 权限** 控制页面脚本、文件下载和登录状态的读写。
55
- - **高级设置** 提供浏览历史、页面定位方式,以及 Chrome 和 Edge 的登录状态保留和窗口模式。交付表单可以设置工具名、参数模板、失败处理和站点规则,校验后一次保存。
86
+ - **高级设置** 提供浏览历史、坐标点击与拖拽许可,以及 Chrome、Edge 和自动模式的登录状态保留和窗口模式。交付表单可以设置工具名、参数模板、失败处理和站点规则,校验后一次保存。
56
87
 
57
88
  在本机或隔离测试环境中打开 **允许远程观看**,通过 DSH 的观看入口查看会话的只读画面。画面以 JPEG 刷新,最高每秒 2 帧。
58
89
 
@@ -60,6 +91,8 @@ node desktop-bridge/install.mjs "<DSH Desktop 安装目录>" --restart
60
91
 
61
92
  在 **高级设置 → 交付** 中填入已接入 DSH 的上传工具名,并根据该工具的参数设置目标目录。自动交付使用 DSH 原生工具执行器,保留当前任务的工具权限。文件先保存到本地,再交给所选工具,结果中包含本地路径和上传工具的完整返回值。
62
93
 
94
+ DSH 侧栏下载使用目标页面所属浏览器会话的登录状态,分段保存文件并在完成后提交到目标位置,保留已有的同名文件。
95
+
63
96
  例如,百度网盘官方 stdio MCP 的上传工具使用下面的参数模板:
64
97
 
65
98
  ```json
@@ -90,13 +123,6 @@ node desktop-bridge/install.mjs "<DSH Desktop 安装目录>" --restart
90
123
  | 查看记录 | `history` `visited` `replay` |
91
124
  | 排查问题与查用法 | `doctor` `help` |
92
125
 
93
- ### 新增工具怎么用
94
-
95
- - 用 `do` 按顺序打开网页、填表、点击和等待。执行失败时返回停止的步骤。用 `assert` 核对页面文本、元素、地址或脚本条件。
96
- - 用 `state` 查看地址、标题、加载状态和可见文本,用 `find` 找到文字及其位置。用 `console` 和 `network` 查看控制台消息与网络记录,用 `wait_for_response` 匹配指定地址的响应。
97
- - 用 `upload` 将本地文件填入网页的文件选择框,用 `hover` 展开悬停菜单,用 `drag` 操作滑块、排序列表、拖放区域和画布。悬停和拖拽通过浏览器输入通道发送。内置浏览器的 `download` 可使用当前会话的 Cookie 保存文件。
98
- - 用 `dialog` 查看页面脚本弹窗并设置应答方式,用 `doctor` 查看当前页面及工具状态,用 `help` 查询各类操作的用法。
99
-
100
126
  ## 文档
101
127
 
102
128
  - [用户指南](docs/user-guide.md)