@linxin666/dsh-client-ui-browser-view 0.4.19 → 0.4.20
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.i18n.yaml +2 -2
- package/README.md +3 -3
- package/README.zh.md +3 -3
- package/lib/client.js +18 -2
- package/lib/client.js.map +1 -1
- package/lib/index.js +82 -9
- package/lib/types/client/settings-form.d.ts +2 -0
- package/lib/types/host/auth.d.ts +25 -0
- package/lib/types/host/service.d.ts +14 -3
- package/package.json +1 -1
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# node scripts/verify-docs.mjs --write <dir>
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: eea6a0c0810763e7ac5604940d09df281487b29b
|
|
6
|
+
README.zh.md: b82aacd30dd25b2cdb9847db965953b66e9ed677
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ This package is an external plugin for DeepSeek Harness (DSH), structured as a c
|
|
|
19
19
|
- **Evidence in the conversation**: every `browser_screenshot` result carries the image, so the transcript keeps the picture the agent acted on instead of only a sentence about it.
|
|
20
20
|
- **Isolated by default**: the plugin launches its own Chromium with a throwaway profile, so the browser you are signed into is not touched while the mode below stays off.
|
|
21
21
|
- **Your own browser on request**: with `realBrowserEnabled` set, the plugin attaches over CDP to a browser you started with remote debugging. Each DSH session on this host can enumerate, read, navigate, click and type in every tab that browser has — tabs that existed before the attach and tabs opened afterwards — and the sign-ins already in that profile work, because the pages run in it and no cookie is imported.
|
|
22
|
-
- **Signs itself in to this host's own GUI**: a fresh isolated profile has no session cookie, so the viewer would only ever see the 401 challenge. When a navigation lands on that challenge over loopback, the plugin asks the host's connection service for the same ticketed URL `dsh web` printed, and retries once. The cookie that mints lives in the throwaway profile and dies with it.
|
|
22
|
+
- **Signs itself in to this host's own GUI**: a fresh isolated profile has no session cookie, so the viewer would only ever see the 401 challenge. When a navigation lands on that challenge over loopback, the plugin asks the host's connection service for the same ticketed URL `dsh web` printed, and retries once. The challenge is either the exchange page's own sentence or the bare `unauthorized` a Host answers when route admission refuses the site root first; the bare form only counts when the requested URL is this host's own listener origin (same protocol and port). The cookie that mints lives in the throwaway profile and dies with it.
|
|
23
23
|
- **Closing is explicit, and idle pages clean themselves up**: `browser_close` without a tab id closes only the tabs the calling session opened; a tab of an attached browser closes only when the call names its id. The panel shows no close control for such a tab. Separately, a page the plugin opened itself closes once no browser tool has touched it for `idleCloseDays` days, so a forgotten page does not outlive the session that opened it.
|
|
24
24
|
|
|
25
25
|
## How it works
|
|
@@ -81,7 +81,7 @@ Sign in to the sites the agent should see inside that profile once; the plugin d
|
|
|
81
81
|
|
|
82
82
|
## Security model
|
|
83
83
|
|
|
84
|
-
- **Loopback only, in both modes**: the panel socket is fenced to loopback requests, and a CDP endpoint whose host is not loopback is refused before a connection is attempted.
|
|
84
|
+
- **Loopback only, in both modes**: the panel socket is fenced to loopback requests, and a CDP endpoint whose host is not loopback is refused before a connection is attempted. Both the panel socket and its status route declare anonymous admission and enforce that fence themselves, so a Host that requires authentication for unspecified routes still serves them to a loopback caller.
|
|
85
85
|
- **No authentication on the CDP endpoint**: the devtools protocol has no credentials, so any process on this machine that can reach that port drives the same tabs. The mode is off by default, and a loopback endpoint is what keeps that reach local.
|
|
86
86
|
- **Throwaway profile in isolated mode**: Chrome runs on a fresh `--user-data-dir` under the system temp directory with a random debugging port, so no cookie, session or extension of the user's real browser is reachable.
|
|
87
87
|
- **Your sign-ins stay in your browser**: the plugin reads pages, not the cookie jar; nothing is copied out of the attached profile into the plugin, the isolated profile or disk.
|
|
@@ -90,7 +90,7 @@ Sign in to the sites the agent should see inside that profile once; the plugin d
|
|
|
90
90
|
- **Idle close never touches an adopted page**: the sweep selects only targets the plugin created itself, so a tab of your own browser closes only when a caller names its id, and disposing the plugin still closes nothing there.
|
|
91
91
|
- **Process lifetime**: a Chromium the plugin launched is killed when the plugin disposes; disposing or changing configuration only detaches from an external browser and closes neither the browser nor any of its tabs. A session whose CDP socket has closed is dropped on its next call and detached the same way — it never closes an external browser or its tabs — then reconnected to the configured endpoint; a reconnect that fails is reported as the connection error, and the configured source is never swapped for another one.
|
|
92
92
|
- **Failure is an error, not a downgrade**: an endpoint that does not answer fails the tool call with the connection error, and the plugin never falls back to the isolated browser, so the panel cannot show a browser other than the configured one.
|
|
93
|
-
- **Token handling**: the launch token is minted per navigation, held in memory, and never written to disk; the retry only happens on a loopback target whose document is DSH's own challenge, so no other local service is ever handed the token.
|
|
93
|
+
- **Token handling**: the launch token is minted per navigation, held in memory, and never written to disk; the retry only happens on a loopback target whose document is DSH's own challenge, so no other local service is ever handed the token. A bare refusal is attributed to this host by its published listener origin before the token is minted.
|
|
94
94
|
|
|
95
95
|
## Known limits
|
|
96
96
|
|
package/README.zh.md
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
- **证据留在对话里**:每次 `browser_screenshot` 的结果都带图,于是对话记录保留的是 agent 真正看到的那一屏,而不只是一句转述。
|
|
20
20
|
- **默认隔离**:插件自己拉起 Chromium,用一次性 profile;只要下面那个模式关着,它就不碰你已经登录的浏览器。
|
|
21
21
|
- **按需接管你自己的浏览器**:把 `realBrowserEnabled` 打开后,插件经 CDP 接管你用远程调试启动的浏览器。本机每个 DSH 会话都能枚举、读取、导航、点击与输入它现有的全部标签页,以及之后新开的标签页;那个 profile 里已有的登录态直接可用,因为页面就跑在里面,插件不导入任何 cookie。
|
|
22
|
-
- **能进这台机器自己的 GUI**:全新隔离 profile 没有会话 cookie,本来只会看到 401 提示页。当导航落在 loopback 上的那页提示时,插件向宿主的连接服务要一条与 `dsh web` 启动时打印的同样的带票 URL
|
|
22
|
+
- **能进这台机器自己的 GUI**:全新隔离 profile 没有会话 cookie,本来只会看到 401 提示页。当导航落在 loopback 上的那页提示时,插件向宿主的连接服务要一条与 `dsh web` 启动时打印的同样的带票 URL,补一次。提示页有两种:token 交换页自己的那句话,以及宿主在路由准入阶段拒绝站点根地址时返回的裸 `unauthorized`;后者只在请求 URL 就是本宿主自己的监听者(协议与端口一致)时才算数。种下的 cookie 只活在这个一次性 profile 里,随它一起销毁。
|
|
23
23
|
- **关闭是显式的,闲置页面由插件自己收尾**:不带 tab id 的 `browser_close` 只关调用它的会话自己打开的标签页;被接管浏览器的标签页,只有调用里点名它的 id 才会关。面板对这种标签页不提供关闭控件。另外,插件自己打开的页面在 `idleCloseDays` 天没有工具动作后自动关闭,被遗忘的页面不会比打开它的会话活得更久。
|
|
24
24
|
|
|
25
25
|
## 工作原理
|
|
@@ -81,7 +81,7 @@ agent 工具调用 ──► 宿主半区 ──► CDP ──► 它自己的 C
|
|
|
81
81
|
|
|
82
82
|
## 安全模型
|
|
83
83
|
|
|
84
|
-
- **两种模式都只走 loopback**:面板 socket 以 loopback 围栏,非本机来源在升级之前就被拒绝;CDP 端点的主机不是 loopback
|
|
84
|
+
- **两种模式都只走 loopback**:面板 socket 以 loopback 围栏,非本机来源在升级之前就被拒绝;CDP 端点的主机不是 loopback 时,在建立连接之前就被拒绝。面板 socket 与它的状态路由都声明匿名准入并自己执行这条围栏,因此在把未声明策略的路由默认按需鉴权处理的宿主上,本机调用仍能拿到它们。
|
|
85
85
|
- **CDP 端点没有鉴权**:devtools 协议没有凭据,本机上任何能连到那个端口的进程都能驱动同一批标签页。模式默认关闭,端点限制在 loopback,是为了把这份触达留在这台机器里。
|
|
86
86
|
- **隔离模式用一次性 profile**:Chrome 跑在系统临时目录下全新的 `--user-data-dir` 上,调试端口随机,用户真实浏览器的 cookie、会话与扩展都够不着。
|
|
87
87
|
- **登录态留在你自己的浏览器里**:插件读的是页面,不是 cookie 罐;被接管 profile 里的任何东西都不会被复制进插件、隔离 profile 或磁盘。
|
|
@@ -90,7 +90,7 @@ agent 工具调用 ──► 宿主半区 ──► CDP ──► 它自己的 C
|
|
|
90
90
|
- **闲置关闭不碰接管的页面**:扫描只选插件自己创建的 target,所以你自己的浏览器标签页仍然只有调用点名 id 才会关,插件卸载时那边也依然什么都不关。
|
|
91
91
|
- **进程寿命**:插件自己拉起的 Chromium 在插件卸载时被杀掉;插件卸载或配置变更只从外部浏览器分离,不关闭浏览器,也不关闭它的任何标签页。CDP socket 已关闭的会话在下一次调用时被丢弃、按同样方式分离——绝不关闭外部浏览器或其标签页——再重新连接到所配置的端点;重连失败按连接错误上报,所配置的来源绝不会被换成另一个。
|
|
92
92
|
- **失败是报错,不是降级**:端点没有应答时工具调用以连接错误失败,插件绝不回退到隔离浏览器,因此面板不会显示出所配置之外的那个浏览器。
|
|
93
|
-
- **令牌处理**:启动令牌每次导航现取、只在内存里,从不落盘;补票只发生在 loopback 目标且文档确实是 DSH
|
|
93
|
+
- **令牌处理**:启动令牌每次导航现取、只在内存里,从不落盘;补票只发生在 loopback 目标且文档确实是 DSH 自己的鉴权页时,因此令牌不会被交给别的本地服务。裸 `unauthorized` 先按宿主发布的监听者 origin 归因,确认是本机后才取票。
|
|
94
94
|
|
|
95
95
|
## 已知限制
|
|
96
96
|
|
package/lib/client.js
CHANGED
|
@@ -1991,7 +1991,7 @@ window.__ModuleLoader__.load({
|
|
|
1991
1991
|
}
|
|
1992
1992
|
/** A whole- or decimal-number field. An empty draft clears the field; any other draft that is not a finite number within the constraints stays unwritten. */
|
|
1993
1993
|
function numberField(field, constraints = {}) {
|
|
1994
|
-
const { integer = false, min } = constraints;
|
|
1994
|
+
const { integer = false, min, max } = constraints;
|
|
1995
1995
|
return {
|
|
1996
1996
|
field,
|
|
1997
1997
|
entry: "type",
|
|
@@ -2003,6 +2003,7 @@ window.__ModuleLoader__.load({
|
|
|
2003
2003
|
if (!Number.isFinite(parsed)) return void 0;
|
|
2004
2004
|
if (integer && !Number.isInteger(parsed)) return void 0;
|
|
2005
2005
|
if (min !== void 0 && parsed < min) return void 0;
|
|
2006
|
+
if (max !== void 0 && parsed > max) return void 0;
|
|
2006
2007
|
return {
|
|
2007
2008
|
kind: "set",
|
|
2008
2009
|
value: parsed
|
|
@@ -2289,7 +2290,7 @@ window.__ModuleLoader__.load({
|
|
|
2289
2290
|
*/
|
|
2290
2291
|
landedSet(field, value) {
|
|
2291
2292
|
if (this.specOf(field).secret) return true;
|
|
2292
|
-
return this.userLayer()?.[field]
|
|
2293
|
+
return jsonValuesEqual(this.userLayer()?.[field], value);
|
|
2293
2294
|
}
|
|
2294
2295
|
/**
|
|
2295
2296
|
* Read-back judgment for a planned unset: the field must be gone from the
|
|
@@ -2348,6 +2349,21 @@ window.__ModuleLoader__.load({
|
|
|
2348
2349
|
for (const listener of this.listeners) listener();
|
|
2349
2350
|
}
|
|
2350
2351
|
};
|
|
2352
|
+
/** Structural equality for JSON settings values (primitives, arrays, plain objects). */
|
|
2353
|
+
function jsonValuesEqual(left, right) {
|
|
2354
|
+
if (Object.is(left, right)) return true;
|
|
2355
|
+
if (typeof left !== "object" || left === null || typeof right !== "object" || right === null) return false;
|
|
2356
|
+
if (Array.isArray(left) || Array.isArray(right)) {
|
|
2357
|
+
if (!Array.isArray(left) || !Array.isArray(right) || left.length !== right.length) return false;
|
|
2358
|
+
return left.every((item, index) => jsonValuesEqual(item, right[index]));
|
|
2359
|
+
}
|
|
2360
|
+
const a = left;
|
|
2361
|
+
const b = right;
|
|
2362
|
+
const keysA = Object.keys(a).filter((key) => a[key] !== void 0);
|
|
2363
|
+
const keysB = Object.keys(b).filter((key) => b[key] !== void 0);
|
|
2364
|
+
if (keysA.length !== keysB.length) return false;
|
|
2365
|
+
return keysA.every((key) => Object.hasOwn(b, key) && jsonValuesEqual(a[key], b[key]));
|
|
2366
|
+
}
|
|
2351
2367
|
//#endregion
|
|
2352
2368
|
//#region src/client/settings-entry-form.ts
|
|
2353
2369
|
/** The snapshot a form reports before the Host has answered with this entry. */
|