dsh-live-browser 0.4.0 → 0.5.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.en.md +38 -14
- package/README.md +35 -16
- package/client.js +413 -124
- package/lib/agent-script.js +723 -723
- package/lib/skills.js +11 -1
- package/lib/tools.js +66 -3
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -36,8 +36,12 @@ UI instead: **Plugins → Add plugin**, paste
|
|
|
36
36
|
|
|
37
37
|
### From npm
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
```bash
|
|
40
|
+
dsh plugin --profile web add dsh-live-browser
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Package page: https://www.npmjs.com/package/dsh-live-browser . Installing from npm
|
|
44
|
+
is what makes the plugin show up in DSH's built-in plugin center.
|
|
41
45
|
|
|
42
46
|
### Verify the install
|
|
43
47
|
|
|
@@ -91,24 +95,28 @@ external window:
|
|
|
91
95
|
So `browser_navigate` on a cold start shows up as a sidebar tab that opens by
|
|
92
96
|
itself and loads the requested page.
|
|
93
97
|
|
|
94
|
-
### One browser per conversation
|
|
98
|
+
### One browser worker per conversation
|
|
95
99
|
|
|
96
|
-
DSH
|
|
100
|
+
DSH gives every Session its own sidebar, and this plugin isolates by Session:
|
|
97
101
|
|
|
102
|
+
- Every live Session gets its own `panelId` and long poll, permanently bound to that
|
|
103
|
+
Session id.
|
|
98
104
|
- Every command carries the Session id of the chat that issued it
|
|
99
|
-
(`exec.agent.session.id` on the host).
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
mistaken for the page in front of the human.
|
|
105
|
-
- After switching chats, commands belonging to the old chat are refused with an
|
|
106
|
-
explanation instead of running against a page nobody can see.
|
|
105
|
+
(`exec.agent.session.id` on the host). Background chats keep polling, so a command
|
|
106
|
+
still runs in that chat's own webview even after the user switches away.
|
|
107
|
+
- A worker only looks inside its own Session's `[data-sidebar-right-session]`; it
|
|
108
|
+
never touches the chat currently on screen. A background sidebar marked `hidden`
|
|
109
|
+
does not stop execution.
|
|
107
110
|
- When the browser has to be opened, it opens in the **requesting** chat via
|
|
108
111
|
`openTabIn(sessionId, …)`, not in whichever chat happens to be on screen.
|
|
112
|
+
- With several tabs in one Session, the one with a real layout box wins, not the
|
|
113
|
+
last mounted one.
|
|
114
|
+
- A Web-build iframe is cross-origin to DSH and cannot be scripted:
|
|
115
|
+
`browser_status` returns `mode: "iframe"` and the plugin shows a bottom-right
|
|
116
|
+
notice pointing the user to the Desktop webview.
|
|
109
117
|
|
|
110
|
-
That
|
|
111
|
-
|
|
118
|
+
That stops the old failure mode: ask for a page in chat A, switch to chat B, and
|
|
119
|
+
have the command refused or the browser appear in B.
|
|
112
120
|
|
|
113
121
|
> Why the renderer does the opening: the sidebar lives entirely in the client —
|
|
114
122
|
> its host module contributes nothing — so there is no host service to call. The
|
|
@@ -275,6 +283,22 @@ carries the `dsh-plugin` topic; those indexes rescan on their own schedule.
|
|
|
275
283
|
|
|
276
284
|
## Changelog
|
|
277
285
|
|
|
286
|
+
### 0.5.0
|
|
287
|
+
|
|
288
|
+
- New: one poll worker per conversation. Every live Session has its own panel and
|
|
289
|
+
long poll, so a command still runs in that chat's webview after the user switches
|
|
290
|
+
chats instead of being refused or hitting the visible chat.
|
|
291
|
+
- Fixed: lost/timed-out commands and cross-chat page operations during rapid chat
|
|
292
|
+
switches, window minimize, and new conversations.
|
|
293
|
+
- New: Web-build iframe detection, a bottom-right notice, and `browser_status`
|
|
294
|
+
returning `mode:"iframe"` with instructions to use the Desktop webview.
|
|
295
|
+
- Fixed: `browser_open_panel` opens via the client `openPanel` command in the
|
|
296
|
+
requesting chat, with the host opener as fallback.
|
|
297
|
+
- Fixed: the embedded `dsh-live-browser` skill's `source` field so DSH 0.2.x can
|
|
298
|
+
load it.
|
|
299
|
+
- Tested: single chat, two-chat isolation, 12 rapid chat switches, minimize/restore,
|
|
300
|
+
fullscreen, and background navigation.
|
|
301
|
+
|
|
278
302
|
### 0.4.0
|
|
279
303
|
|
|
280
304
|
- Fixed: the first sidebar in the document was treated as the current chat's
|
package/README.md
CHANGED
|
@@ -31,7 +31,12 @@ dsh plugin --profile web add github:c347087870/dsh-live-browser
|
|
|
31
31
|
|
|
32
32
|
### 从 npm 安装
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
```bash
|
|
35
|
+
dsh plugin --profile web add dsh-live-browser
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
包地址:https://www.npmjs.com/package/dsh-live-browser 。装 npm 包的好处是能出现在 DSH
|
|
39
|
+
的「插件中心」里,一键安装。
|
|
35
40
|
|
|
36
41
|
### 确认装好了
|
|
37
42
|
|
|
@@ -78,19 +83,22 @@ agent 不会先让你去开浏览器,也永远不会去开外部窗口:
|
|
|
78
83
|
|
|
79
84
|
所以冷启动时一句 `browser_navigate`,表现就是右侧栏自己弹出一个标签页并加载目标地址。
|
|
80
85
|
|
|
81
|
-
###
|
|
86
|
+
### 每个对话一个浏览器 worker
|
|
82
87
|
|
|
83
|
-
DSH 每个 Session
|
|
88
|
+
DSH 每个 Session 一个侧边栏,插件按会话隔离:
|
|
84
89
|
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
- 每个存活的 Session 都有自己独立的 `panelId` 和长轮询,并固定绑定自己的 Session id。
|
|
91
|
+
- 每条命令都带着发起它的 Session id(宿主侧取 `exec.agent.session.id`);即使当前屏幕切到
|
|
92
|
+
别的对话,后台对话的 worker 仍继续轮询,命令仍在它自己的 webview 里执行。
|
|
93
|
+
- 面板只在该 Session 自己的 `[data-sidebar-right-session]` 里找页面,不会操到当前显示的
|
|
94
|
+
对话;后台对话的侧边栏即使被标了 `hidden` 也不影响执行。
|
|
90
95
|
- 需要打开浏览器时,用 `openTabIn(sessionId, …)` 在**发起请求的那个对话**里打开,
|
|
91
96
|
而不是在屏幕上恰好显示的那个对话里。
|
|
97
|
+
- 同一 Session 有多个标签时,挑真正有布局盒子的那个,而不是最后挂载的那个。
|
|
98
|
+
- Web 版的 iframe 浏览器与 DSH 跨域,插件无法注入脚本:`browser_status` 会返回
|
|
99
|
+
`mode: "iframe"` 并给出提示,右下角也会指导用户改用桌面版 webview。
|
|
92
100
|
|
|
93
|
-
这消除了老的故障模式:在 A 对话要页面,没等它出来就切到 B
|
|
101
|
+
这消除了老的故障模式:在 A 对话要页面,没等它出来就切到 B,结果命令被拒绝或浏览器出现在 B。
|
|
94
102
|
|
|
95
103
|
> 为什么打开动作放在渲染层:侧边栏整个在客户端,它的宿主模块什么都不贡献,所以没有
|
|
96
104
|
> 宿主服务可调。客户端那一半通过 `ctx.reflect.provide` 发布 `sidebarRight`,插件用的就是这个。
|
|
@@ -134,13 +142,12 @@ DSH 每个 Session 一个侧边栏,插件遵守这个边界:
|
|
|
134
142
|
也能读文件(`readUpload`)。
|
|
135
143
|
- **`lib/config.js` / `lib/schema.js`** —— 配置值与 DSH 渲染的表单。取值部分不依赖第三方包,
|
|
136
144
|
所以工具层和测试不需要 `node_modules` 就能跑。
|
|
137
|
-
- **`client.js`** ——
|
|
138
|
-
`webview[data-sidebar-browser-frame="webview"]
|
|
139
|
-
后台对话的侧边栏还挂在 DOM 里(`keepMounted
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
会跟邻居撞名。
|
|
145
|
+
- **`client.js`** —— 为每个存活的对话维护一个 worker:找到该对话侧边栏里的
|
|
146
|
+
`webview[data-sidebar-browser-frame="webview"]`,注入脚本,需要时打开标签页,各自跑轮询。
|
|
147
|
+
后台对话的侧边栏还挂在 DOM 里(`keepMounted`),它们的 worker 继续工作;同一栏里有多个
|
|
148
|
+
标签时,挑真正有布局盒子的那个,而不是最后挂载的那个。标签页右键菜单也在这里补三项:
|
|
149
|
+
监听 `contextmenu`,等 DSH 的菜单 portal 出现后追加按钮,仍然不改 DSH。整体包在 IIFE 里:
|
|
150
|
+
DSH 会把多个插件 bundle 塞进同一个 combo `<script>`,顶层 `const` 会跟邻居撞名。
|
|
144
151
|
|
|
145
152
|
### 为什么不用 `connection.rpc.handle`
|
|
146
153
|
|
|
@@ -294,6 +301,18 @@ npm run strip-bom # 扫掉全仓库文本文件的 BOM
|
|
|
294
301
|
|
|
295
302
|
## 更新记录
|
|
296
303
|
|
|
304
|
+
### 0.5.0
|
|
305
|
+
|
|
306
|
+
- 新增:按对话独立轮询。每个存活 Session 一个 worker/panel,切走对话后原对话的命令仍在
|
|
307
|
+
自己的 webview 中执行,不再被拒绝或串到当前对话。
|
|
308
|
+
- 修复:快速切换对话、最小化窗口、新开对话时命令丢失/超时/操作错页面的问题。
|
|
309
|
+
- 新增:Web 版 iframe 浏览器检测与右下角提示,`browser_status` 返回 `mode:"iframe"`,
|
|
310
|
+
引导用户改用桌面版 webview。
|
|
311
|
+
- 修复:`browser_open_panel` 通过客户端 `openPanel` 在发起对话里打开标签页;宿主侧 opener
|
|
312
|
+
作为兜底。
|
|
313
|
+
- 修复:内置 `dsh-live-browser` skill 的 `source` 字段,DSH 0.2.x 可正常加载。
|
|
314
|
+
- 测试:单对话、双对话隔离、快速切换 12 次、最小化/恢复、全屏、后台导航全部通过。
|
|
315
|
+
|
|
297
316
|
### 0.4.0
|
|
298
317
|
|
|
299
318
|
- 修复:把「文档里第一个右侧栏」当成当前对话的侧边栏,导致 agent 读到别的对话/别的标签页;
|