dsh-shared-browser 0.0.0-stage → 0.6.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FeiGenb
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,133 @@
1
- # Temporary Holding Version
1
+ # dsh-shared-browser
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A browser for **DeepSeek Harness desktop**: it upgrades the sidebar browser tab into a real integrated browser
4
+ (address bar, zoom, find-in-page, device emulation, history/bookmarks, site permissions, storage clearing and a
5
+ built-in DevTools panel) and adds **screenshots, region screenshots, element comments and console logs that go
6
+ straight into the chat draft**, plus 28 `bb_*` tools that let the agent drive **the same page the user is looking at**. When a Cloudflare-style verification wall appears, the tools tell the agent to stop and hand the page back to you.
7
+
8
+ One page, one session: the user can log in, solve a captcha or click around while the agent works, and the agent
9
+ sees exactly that state.
10
+
11
+ ```
12
+ user ─┐
13
+ ├─► Browser tab in the sidebar (Electron webview, isolated per workspace)
14
+ agent ─┘ ▲
15
+ bb_* tools ─┐
16
+ └─ host plugin /dsh-shared-browser (SSE command channel) ─► client plugin (the tab body)
17
+ ```
18
+
19
+ ## Turnkey
20
+
21
+ 1. Open **Plugins → Add plugin**, or `plugin_manager install_bundle target=dsh-shared-browser`.
22
+ 2. Restart DSH once.
23
+ 3. Click **Browser** in the sidebar (or `Ctrl+T`). Toolbar, menu and tools are all there.
24
+
25
+ No patching, no `app.asar` edits, no launch flags, no shortcut rewriting. Disable the bundle and the sidebar
26
+ falls back to the DSH built-in browser.
27
+
28
+ ## What the tab offers
29
+
30
+ | Capability | Entry point |
31
+ | --- | --- |
32
+ | Back / forward / reload / stop / address bar | left side of the toolbar |
33
+ | Zoom 50%–300% | `Ctrl+=` / `Ctrl+-` / `Ctrl+0`, or the menu |
34
+ | Find in page (match count, wrap-around, native highlight) | `Ctrl+F` |
35
+ | Device emulation (iPhone 14, Pixel 7, Galaxy S23, iPad mini, desktop) | menu → Device emulation |
36
+ | History / bookmarks | `Ctrl+H` / `Ctrl+D`, or the menu |
37
+ | Site permissions, clear storage, browser settings | menu |
38
+ | Screenshot to chat | toolbar ⤓ or menu → Screenshot |
39
+ | Region screenshot to chat | toolbar ▣ or menu → Region screenshot |
40
+ | Pick element to chat / comment on element | toolbar ⌖ / ✎ |
41
+ | Console log to chat | menu → Console log |
42
+ | DevTools panel: console / elements / network / run JS | `F12` or toolbar ⚙ |
43
+ | Open in external browser, copy address, new tab | menu |
44
+
45
+ Screenshots, region captures, element comments and console excerpts land in the **current session's composer**
46
+ as a quote plus an image or text block. Nothing is sent for you — edit and send it, or let the agent read it.
47
+
48
+ ## Two channels: in-app tab / your own browser
49
+
50
+ The in-app tab is an Electron `<webview>`: it lives in the sidebar and supports screenshots and element comments, but **its session is not persistent** and Cloudflare-class walls reject its user agent. When a real browser is needed the plugin can hand the same address to the local Edge/Chrome:
51
+
52
+ | Situation | How |
53
+ | --- | --- |
54
+ | Force the real browser | `bb_open { url, channel: "external" }` or `bb_external { action: "launch", url }` |
55
+ | Make it the default | `bb_settings { action: "set", channel: "external" }` |
56
+ | Auto-switch on a wall | On by default: when the in-app tab detects a challenge it is closed and the page reopens externally (`bb_settings { action: "set", autoLaunch: false }` disables it) |
57
+ | Inspect / stop it | `bb_external { action: "status" }` / `{ action: "close" }` |
58
+
59
+ External tabs are addressed as `ext:<id>`; every other tool (`bb_snapshot`, `bb_click`, `bb_screenshot`, `bb_console` …) routes on that id. The sidebar shows an "External browser" mirror that polls frames and forwards clicks and wheel events to the real window.
60
+
61
+ Settings live in `$DSH_HOME/shared-browser/settings.json`: `channel`, `browser` (`msedge`/`chrome`), `profileDir`, `autoLaunch`. The external profile defaults to `$DSH_HOME/shared-browser/profiles/<browser>` so logins survive restarts.
62
+
63
+ ### Verification walls (Cloudflare / DataDome)
64
+
65
+ When the in-app tab hits a challenge page the tools return `wall: true` with a fixed instruction: **do not** try to pass or bypass the check and **do not** click the verification widget — hand the page back to the user.
66
+ With `autoLaunch` on, the plugin closes the in-app tab and reopens the same address in the external browser window so you can complete the check yourself; the external channel keeps a persistent profile, so the result sticks.
67
+
68
+ ## Agent tools (28)
69
+
70
+ | Tool | Purpose |
71
+ | --- | --- |
72
+ | `bb_status` | connection state, tabs, counters |
73
+ | `bb_open` / `bb_navigate` | open a URL / back, forward, reload, stop |
74
+ | `bb_tabs` | list, activate, open, reload, close tabs |
75
+ | `bb_snapshot` | interactive element tree (`e12 <button> "Sign in"`) |
76
+ | `bb_text` | page text |
77
+ | `bb_click` / `bb_type` / `bb_press` / `bb_wait` | click, type, press keys, wait |
78
+ | `bb_eval` | run JavaScript in the page |
79
+ | `bb_screenshot` / `bb_region_screenshot` | screenshot / region capture, stored and served |
80
+ | `bb_console` / `bb_network` | console and network buffers (host side) |
81
+ | `bb_comment` / `bb_comments` | comment on an element / read comments |
82
+ | `bb_find` / `bb_zoom` / `bb_emulate` | find, zoom, device emulation |
83
+ | `bb_devtools` / `bb_open_devtools_native` | panel state / probe native CDP |
84
+ | `bb_storage` / `bb_permissions` / `bb_history` | storage, permission policy, history |
85
+ | `bb_add_to_chat` | put a screenshot / region / element / console log in the composer |
86
+ | `bb_external` | Detect, launch and close the local Edge/Chrome over CDP. |
87
+ | `bb_settings` | Read or change channel, external browser, profile folder, auto-switch. |
88
+
89
+ Tools and UI share one channel: the host sends commands over SSE, the tab executes them and reports back.
90
+ When no tab is open the tools say so explicitly. Once a comment is submitted, `bb_comments` returns its
91
+ selector, `ref`, text, rect and note — the agent can read what the user pointed at.
92
+
93
+ ## Compatibility
94
+
95
+ - **No DSH changes**: no `app.asar` patching, no binary edits, no global injection.
96
+ - Public surfaces only: tab type registration (`priority: 'extension'` taking over `kind: 'browser'`), slots,
97
+ the `window.dshDesktop.browser` lease bridge, host `webServer` routes and `ctx.tools`.
98
+ - Claims only the `browser` tab kind; other plugins and tab types are untouched. Disabling the bundle restores
99
+ the built-in browser immediately.
100
+ - In the Web carrier (no desktop bridge) the plugin steps aside and keeps the built-in browser intact.
101
+ - Styles live in `<style data-plugin="dsh-shared-browser">` and are removed with the plugin.
102
+
103
+ ## Known limits (imposed by the desktop shell)
104
+
105
+ - Inside the shared browser partition **site permissions, downloads and native popups are always denied** —
106
+ that is the shell's fixed policy for sidebar browsers.
107
+ - The packaged shell disables the guest's `devTools`, so `openDevTools()` is unavailable. This plugin ships its
108
+ own DevTools panel (console / elements / network / run JS). `bb_open_devtools_native` explains the external CDP
109
+ route.
110
+ - The partition is per workspace and **not persisted**: a DSH restart drops logins, same as the built-in browser.
111
+ - Screenshots need the window in front: when the DSH window is minimised or fully covered, `capturePage`
112
+ never returns a frame, so the plugin gives up after about six seconds with
113
+ "Capture failed: bring the DSH window to the front and try again" instead of spinning forever.
114
+ - Not supported yet: multiple windows, bookmark sync, download manager, extensions.
115
+
116
+ ## Requirements
117
+
118
+ | Item | Value |
119
+ | --- | --- |
120
+ | Carrier | DSH **desktop** 0.2.2-rc.5 or newer (verified on Electron 44 / Chrome 152) |
121
+ | `engines.dsh` | `>=0.2.2-rc.5 <0.3.0` |
122
+ | Dependencies | none |
123
+
124
+ ## Debugging
125
+
126
+ - Read-only host route: `GET /dsh-shared-browser/state` (state, tabs, counters).
127
+ - Start DSH with `DSH_SHARED_BROWSER_DEV=1` to also register `POST /dsh-shared-browser/debug/command`, which runs
128
+ a tool by name. Loopback only and development-only.
129
+ - Client side: `window.__dshBrowserDebug` (`session()`, `probe()`, `lastMount`).
130
+
131
+ ## License
132
+
133
+ MIT
package/README.zh.md ADDED
@@ -0,0 +1,127 @@
1
+ # dsh-shared-browser
2
+
3
+ 把 **DeepSeek Harness 桌面版**右侧栏的浏览器页签升级成一台真正的集成浏览器:地址栏、缩放、页内查找、设备仿真、
4
+ 历史/收藏、网站权限、清除存储、内置 DevTools 面板,外加 **截图 / 区域截图 / 元素评论 / 控制台日志直接进聊天**,
5
+ 以及 28 个让 Agent 操作**同一个页面**的 `bb_*` 工具;遇到 Cloudflare 一类人机验证时,插件会明确让 Agent 停手并交还给你。
6
+
7
+ 用户看到的就是 Agent 操作的那一个页面:同一份登录态、同一份页面状态,中途可以人工登录、过人机验证、随手点。
8
+
9
+ ```
10
+ 用户 ─┐
11
+ ├─► 右侧栏 Browser 页签(Electron webview,按工作区隔离)
12
+ Agent ─┘ ▲
13
+ bb_* 工具 ─┐
14
+ └─ 宿主插件 /dsh-shared-browser(SSE 命令通道)─► 客户端插件(页签本体)
15
+ ```
16
+
17
+ ## 开箱即用
18
+
19
+ 1. 打开 **插件** → 添加插件,或 `plugin_manager install_bundle target=dsh-shared-browser`。
20
+ 2. 重启一次 DSH。
21
+ 3. 右侧栏点 **浏览器**(或 `Ctrl+T`)。工具栏、菜单、工具都已经在位。
22
+
23
+ **不需要**打补丁、不需要改 `app.asar`、不需要启动参数、不需要改快捷方式。关掉这个 bundle,
24
+ 右侧栏就退回 DSH 自带的浏览器页签。
25
+
26
+ ## 页签里有什么
27
+
28
+ | 能力 | 入口 |
29
+ | --- | --- |
30
+ | 前进 / 后退 / 刷新 / 停止 / 地址栏 | 工具栏左侧 |
31
+ | 缩放 50%–300% | `Ctrl+=` / `Ctrl+-` / `Ctrl+0`,或菜单「放大 / 缩小 / 重置缩放」 |
32
+ | 页内查找(命中计数 + 上下循环 + 原生高亮) | `Ctrl+F` |
33
+ | 设备仿真(iPhone 14 / Pixel 7 / Galaxy S23 / iPad mini / 桌面) | 菜单「设备仿真」 |
34
+ | 历史记录 / 收藏夹 | `Ctrl+H` / `Ctrl+D`,或菜单 |
35
+ | 网站权限、清除存储、浏览器设置 | 菜单 |
36
+ | 截图到聊天 | 工具栏 ⤓ 或菜单「截图」 |
37
+ | 区域截图到聊天 | 工具栏 ▣ 或菜单「区域截图」 |
38
+ | 选取元素到聊天 / 评论元素 | 工具栏 ⌖ / ✎ |
39
+ | 控制台日志到聊天 | 菜单「控制台日志」 |
40
+ | DevTools 面板:控制台 / 元素 / 网络 / 运行 JS | `F12` 或工具栏 ⚙ |
41
+ | 在外部浏览器中打开、复制地址、新建标签页 | 菜单 |
42
+
43
+ 截图、区域截图、元素评论、控制台日志都会以「引用条 + 图片/文本」的形式落在**当前会话的输入框**里,
44
+ 不会替你发送;你可以改完再发,Agent 也能直接读到元素的选择器、文本与你的评论。
45
+
46
+ ## 双通道:内置页签 / 你的浏览器
47
+
48
+ 内置页签是 Electron 的 `<webview>`:同屏、可截图、可评论,但**会话不持久**,且 Cloudflare 一类防护会拒绝它的 UA。需要真实浏览器时,插件可以把同一地址交给本机的 Edge/Chrome:
49
+
50
+ | 场景 | 做法 |
51
+ | --- | --- |
52
+ | 明确要用真浏览器 | `bb_open { url, channel: "external" }`,或 `bb_external { action: "launch", url }` |
53
+ | 让外部通道成为默认 | `bb_settings { action: "set", channel: "external" }` |
54
+ | 遇到人机验证自动切换 | 默认开启:内置页签识别到 CF 类挑战时,自动关掉它并在外部浏览器打开同一地址(`bb_settings { action: "set", autoLaunch: false }` 可关闭) |
55
+ | 查看 / 关闭外部通道 | `bb_external { action: "status" }` / `{ action: "close" }` |
56
+
57
+ 外部通道的页签 id 形如 `ext:<id>`,其余工具(`bb_snapshot` / `bb_text` / `bb_click` / `bb_screenshot` / `bb_console` …)会按 id 自动路由;侧栏会出现一个「外部浏览器」镜面页签,实时显示画面并把点击、滚轮转发回真实窗口。
58
+
59
+ 设置写在 `$DSH_HOME/shared-browser/settings.json`:`channel`、`browser`(`msedge`/`chrome`)、`profileDir`、`autoLaunch`。外部浏览器使用独立 profile(默认 `$DSH_HOME/shared-browser/profiles/<browser>`),登录态可跨 DSH 重启保留。
60
+
61
+ ### 人机验证(Cloudflare / DataDome)
62
+
63
+ 内置页签撞上挑战页时,工具会返回 `wall: true` 和一条固定提示:**不要**尝试完成或绕过人机验证、**不要**点验证控件,而是把页面交给用户。
64
+ `autoLaunch` 打开时,插件会自动关掉内置页签并在外部浏览器窗口打开同一地址,由你亲自完成验证;外部通道使用独立的持久 profile,验证结果会留在那里。
65
+
66
+ ## Agent 工具(28 个)
67
+
68
+ | 工具 | 作用 |
69
+ | --- | --- |
70
+ | `bb_status` | 连接状态、页签、计数 |
71
+ | `bb_open` / `bb_navigate` | 打开网址 / 前进后退刷新停止 |
72
+ | `bb_tabs` | 列出、切换、新建、刷新、关闭页签 |
73
+ | `bb_snapshot` | 可交互元素树(`e12 <button> "登录"`) |
74
+ | `bb_text` | 页面文本 |
75
+ | `bb_click` / `bb_type` / `bb_press` / `bb_wait` | 点击、输入、按键、等待 |
76
+ | `bb_eval` | 在页面里执行 JavaScript |
77
+ | `bb_screenshot` / `bb_region_screenshot` | 截图 / 区域截图(落盘并给出附件 URL) |
78
+ | `bb_console` / `bb_network` | 控制台与网络请求缓存(宿主侧) |
79
+ | `bb_comment` / `bb_comments` | 给元素写评论 / 读取评论 |
80
+ | `bb_find` / `bb_zoom` / `bb_emulate` | 查找、缩放、设备仿真 |
81
+ | `bb_devtools` / `bb_open_devtools_native` | 内置面板状态 / 探测外部 CDP |
82
+ | `bb_storage` / `bb_permissions` / `bb_history` | 存储、权限策略、历史 |
83
+ | `bb_add_to_chat` | 把截图 / 区域 / 元素 / 控制台日志放进输入框 |
84
+ | `bb_external` | 探测 / 启动 / 关闭本机 Edge、Chrome(CDP,真实指纹) |
85
+ | `bb_settings` | 读改默认通道、外部浏览器、profile 目录、自动切换 |
86
+
87
+ 工具与 UI 共用一条通路:宿主把命令经 SSE 下发给页签,页签执行后回传结果。用户不在页签上时,
88
+ 工具会明确提示“先打开 Browser 页签”。评论一旦提交,Agent 用 `bb_comments` 就能读到
89
+ 选择器、`ref`、文本、矩形与你的注释。
90
+
91
+ ## 兼容性
92
+
93
+ - **不改 DSH 本身**:没有 `app.asar` 补丁、没有二进制改动、没有全局注入。
94
+ - 只用公开接口:页签类型注册(`priority: 'extension'` 接管 `kind: 'browser'`)、座位(slot)、
95
+ `window.dshDesktop.browser` 租约桥、宿主 `webServer` 路由、`ctx.tools`。
96
+ - 只接管「浏览器」这一类页签;其它插件、其它页签类型不受影响。关闭 bundle 立即恢复内置浏览器。
97
+ - 在 Web 版(没有桌面桥的载体)里自动让位,保留内置浏览器,不会把 UI 弄坏。
98
+ - 样式统一挂在 `<style data-plugin="dsh-shared-browser">` 下,随插件卸载一起移除。
99
+
100
+ ## 已知限制(来自桌面壳,不是本插件)
101
+
102
+ - 共享浏览器分区里**网站权限、下载、原生弹窗一律被拒绝**:这是 DSH 桌面壳对侧栏浏览器的固定策略。
103
+ - 打包版壳把 guest 的 `devTools` 关掉了,所以 `openDevTools()` 不可用;本插件提供**自绘的 DevTools 面板**
104
+ (控制台 / 元素 / 网络 / 运行 JS)。想要原生 DevTools,用 `bb_open_devtools_native` 了解外部 CDP 方案。
105
+ - 分区按工作区隔离且**不持久**:重启 DSH 会丢登录态,与内置浏览器行为一致。
106
+ - 截图依赖窗口在前台:DSH 窗口被最小化或被完全遮挡时 `capturePage` 不会返回画面,插件会在约 6 秒后
107
+ 提示「截图失败:请把 DSH 窗口切到前台后重试」,而不是一直转圈。
108
+ - 尚未支持:多窗口、书签同步、下载管理、扩展。
109
+
110
+ ## 环境
111
+
112
+ | 项目 | 取值 |
113
+ | --- | --- |
114
+ | 载体 | DSH **桌面版** 0.2.2-rc.5 及以上(Electron 44 / Chrome 152 上验证) |
115
+ | `engines.dsh` | `>=0.2.2-rc.5 <0.3.0` |
116
+ | 依赖 | 无(只用宿主与浏览器已有的能力) |
117
+
118
+ ## 调试
119
+
120
+ - 宿主侧自带只读诊断路由 `GET /dsh-shared-browser/state`(连接状态、页签、计数)。
121
+ - 需要按名字直接跑工具时,用 `DSH_SHARED_BROWSER_DEV=1` 启动 DSH,会额外注册
122
+ `POST /dsh-shared-browser/debug/command`(仅本机 loopback,且只在开发态存在)。
123
+ - 客户端诊断:控制台里 `window.__dshBrowserDebug`(`session()`、`probe()`、`lastMount`)。
124
+
125
+ ## 许可
126
+
127
+ MIT
@@ -0,0 +1,12 @@
1
+ # dsh-shared-browser turns DSH's own Browser tab into the shared browser.
2
+ #
3
+ # Host half: /dsh-shared-browser/* routes plus the bb_* tool surface.
4
+ # Client half: takes over the `browser` tab kind (extension priority) and draws
5
+ # the full chrome around the same Electron <webview> the desktop shell owns.
6
+ #
7
+ # Nothing here edits DSH itself: the tab type is registered through the public
8
+ # `sidebarRightTabs` registry, so removing this bundle restores the built-in
9
+ # browser unchanged.
10
+ - insert:
11
+ - id: dsh-shared-browser
12
+ name: 'dsh-shared-browser'
package/icon.svg ADDED
@@ -0,0 +1,10 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36">
2
+ <rect x="4.5" y="6.5" width="27" height="21" rx="4" fill="none" stroke="#3b82f6" stroke-width="2"/>
3
+ <line x1="4.5" y1="12.5" x2="31.5" y2="12.5" stroke="#3b82f6" stroke-width="2"/>
4
+ <circle cx="8.6" cy="9.6" r="1.1" fill="#3b82f6"/>
5
+ <circle cx="12.4" cy="9.6" r="1.1" fill="#3b82f6"/>
6
+ <circle cx="14.5" cy="20" r="3.1" fill="#93c5fd"/>
7
+ <circle cx="21.5" cy="20" r="3.1" fill="none" stroke="#1d4ed8" stroke-width="1.8"/>
8
+ <line x1="17.6" y1="20" x2="18.4" y2="20" stroke="#1d4ed8" stroke-width="1.8"/>
9
+ <path d="M18 27.5v3.2" stroke="#1d4ed8" stroke-width="1.8" stroke-linecap="round"/>
10
+ </svg>