dsh-auto-open-web 0.1.11 → 0.1.13
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 +12 -5
- package/README.md +11 -4
- package/cordis.patch.yml +2 -0
- package/host-publish/DshAppWindow.dll +0 -0
- package/host-publish/DshAppWindow.exe +0 -0
- package/host-publish/DshAppWindow.pdb +0 -0
- package/lib/client.js +4 -4
- package/lib/index.js +40 -0
- package/package.json +2 -2
package/README.en.md
CHANGED
|
@@ -39,6 +39,11 @@ selected by `windowKind`:
|
|
|
39
39
|
(win32 = `cmd /c start`, darwin = `open`, linux = `xdg-open`).
|
|
40
40
|
`appWindow: false` behaves **exactly like the official core**: the GUI is opened in the
|
|
41
41
|
system default browser (plain tab, official `open` method).
|
|
42
|
+
4. **`--no-open` / SSH sessions (official identical suppression)**: `dsh web --no-open`
|
|
43
|
+
(`webStartup.openBrowser === false`) or an SSH session (`SSH_CONNECTION`/`SSH_TTY`
|
|
44
|
+
environment variables, the same source as the official `launchedThroughSsh`) opens
|
|
45
|
+
**nothing** — the plugin reads the **same source** as the official core (the `webStartup`
|
|
46
|
+
service provided by web-startup) and suppresses opening the same way.
|
|
42
47
|
|
|
43
48
|
The port comes from the real listening value of the webServer service (`--port` overrides and
|
|
44
49
|
`--port 0` both work). **No waiting needed**: the plugin declares webServer as a hard dependency
|
|
@@ -54,8 +59,9 @@ cleanup.
|
|
|
54
59
|
> plugin's bundle patch, so the opening behavior is fully owned by the plugin: with
|
|
55
60
|
> `appWindow: true` the app-style window opens and no ordinary browser page pops up; with
|
|
56
61
|
> `appWindow: false` the plugin performs **the same default-browser handoff as the official core**
|
|
57
|
-
> (open package → native platform launch), matching the no-plugin behavior.
|
|
58
|
-
>
|
|
62
|
+
> (open package → native platform launch), matching the no-plugin behavior. With
|
|
63
|
+
> `dsh web --no-open` (or in an SSH session) the plugin, like the official core, opens
|
|
64
|
+
> nothing. Uninstalling the plugin restores the official default.
|
|
59
65
|
|
|
60
66
|
### WebView2 host requirements (webview2 mode only)
|
|
61
67
|
|
|
@@ -164,9 +170,10 @@ without touching the package.
|
|
|
164
170
|
|
|
165
171
|
- **Zero dependencies**: every runtime dependency is provided by the **DSH deployment** and
|
|
166
172
|
declared as an optional peer (no install warnings):
|
|
167
|
-
- `@deepseek-ai/dsh` (the host; declares the compatibility range `>=0.1.0-rc.
|
|
168
|
-
|
|
169
|
-
`
|
|
173
|
+
- `@deepseek-ai/dsh` (the host; declares the compatibility range `>=0.1.0-rc.8 <0.2.0` —
|
|
174
|
+
rc.8 removed `dsh-client-schema-form` from the client frozen table and introduced
|
|
175
|
+
`dsh-client-runtime`; the plugin's settings card and opening behavior depend on that
|
|
176
|
+
release; no runtime version check is performed)
|
|
170
177
|
- `@deepseek-ai/schemastery` (config schema validator; resolved at runtime: normal import
|
|
171
178
|
first, then the DSH deployment copy under the Windows global npm layout)
|
|
172
179
|
- `koffi` (Windows only: Job Object / process verification / native file dialog; same runtime
|
package/README.md
CHANGED
|
@@ -36,6 +36,11 @@ dsh web profile 启动后自动打开独立应用窗口(或网页标签页)
|
|
|
36
36
|
linux = `xdg-open`)。
|
|
37
37
|
`appWindow: false` 时**与官方相同**:默认浏览器打开(普通标签页,官方
|
|
38
38
|
open 方式)。
|
|
39
|
+
4. **`--no-open` / SSH 会话(与官方相同的不打开)**:`dsh web --no-open`
|
|
40
|
+
(webStartup 服务的 `openBrowser === false`)或 SSH 会话(`SSH_CONNECTION`/
|
|
41
|
+
`SSH_TTY` 环境变量,与官方 `launchedThroughSsh` 同源)时不打开任何
|
|
42
|
+
窗口/页面——插件读取与官方**同一来源**(web-startup 提供的 webStartup
|
|
43
|
+
服务)做同样的抑制。
|
|
39
44
|
|
|
40
45
|
端口取自 webServer 服务的真实监听值(`--port` 自定义、`--port 0` 均正确)。
|
|
41
46
|
**无需等待**:插件把 webServer 声明为硬依赖(`inject`),Cordis 会等
|
|
@@ -49,8 +54,9 @@ Job Object(强杀也生效)+ 退出清理结束进程树。
|
|
|
49
54
|
> 安装本插件后,插件的 bundle 补丁会把 `web-runtime.openBrowser` 置为 `false`,
|
|
50
55
|
> 打开行为完全由本插件接管:`appWindow: true` 时打开独立应用窗口,不弹出
|
|
51
56
|
> 普通浏览器页面;`appWindow: false` 时插件执行**与官方核心相同的默认浏览器
|
|
52
|
-
> 交接**(open 包 →
|
|
53
|
-
>
|
|
57
|
+
> 交接**(open 包 → 平台原生拉起),行为与未安装插件时一致;`dsh web
|
|
58
|
+
> --no-open`(或 SSH 会话)时与官方一致不打开任何窗口/页面。卸载插件后
|
|
59
|
+
> 恢复官方默认行为。
|
|
54
60
|
|
|
55
61
|
### WebView2 宿主要求(仅 webview2 模式)
|
|
56
62
|
|
|
@@ -154,8 +160,9 @@ dsh plugin --profile web remove dsh-auto-open-web # 同时移除依赖与对
|
|
|
154
160
|
|
|
155
161
|
- **本包零 dependencies**:所有运行时依赖均由 **DSH 部署提供**,以 optional
|
|
156
162
|
peer 声明(安装无警告):
|
|
157
|
-
- `@deepseek-ai/dsh`(宿主,声明兼容范围 `>=0.1.0-rc.
|
|
158
|
-
|
|
163
|
+
- `@deepseek-ai/dsh`(宿主,声明兼容范围 `>=0.1.0-rc.8 <0.2.0`:
|
|
164
|
+
自 rc.8 起客户端冻结表移除 `dsh-client-schema-form`、引入
|
|
165
|
+
`dsh-client-runtime`,本插件的设置卡片与打开行为均依赖该版本;
|
|
159
166
|
不做运行时版本检测)
|
|
160
167
|
- `@deepseek-ai/schemastery`(配置 schema 校验器;运行时解析:常规 import
|
|
161
168
|
优先,其次 Windows 全局 npm 布局下的 DSH 部署副本)
|
package/cordis.patch.yml
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
# openBrowser 关闭后打开行为由插件全权接管:appWindow: true → 独立应用窗口;
|
|
13
13
|
# appWindow: false → 插件执行与官方核心相同的默认浏览器交接(open 包 →
|
|
14
14
|
# 平台原生拉起,普通标签页),行为与未安装本插件时一致。
|
|
15
|
+
# `dsh web --no-open`(webStartup.openBrowser === false)或 SSH 会话时,插件
|
|
16
|
+
# 读取**同一 webStartup 服务**判断,与官方一致不打开任何窗口/页面。
|
|
15
17
|
- id: web-runtime
|
|
16
18
|
config:
|
|
17
19
|
openBrowser: false
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/client.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
// require 解析浏览器端模块表(react 为壳层静态模块,@deepseek-ai/dsh-client-runtime
|
|
4
4
|
// 为动态包)。**不** require @deepseek-ai/dsh-client-ui-primitives 等官方 UI 包。
|
|
5
5
|
//
|
|
6
|
-
// 依赖边界(
|
|
7
|
-
// - settingsScope:官方 settings 域(命名空间 `auto-open-web
|
|
8
|
-
//
|
|
9
|
-
// - slots:settings.plugin.item 插槽(keyed
|
|
6
|
+
// 依赖边界(与官方数据的对接面,均为公开接口;本插件声明 dsh ≥0.1.0-rc.8):
|
|
7
|
+
// - settingsScope:官方 settings 域(命名空间 `auto-open-web`;第三方命名空间
|
|
8
|
+
// 白名单自 rc.7 起已取消,rc.8 下无限制)
|
|
9
|
+
// - slots:settings.plugin.item 插槽(keyed 注册,rc.7 起要求 options.key)
|
|
10
10
|
// - locale:文案注册(zh/en/ja/ko/fr/de/ru,跟随界面语言)
|
|
11
11
|
// - dsh-client-runtime:createSnapshotStore 快照 store(缺失时内置兜底实现)
|
|
12
12
|
//
|
package/lib/index.js
CHANGED
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
* 作为最后的兜底;open 包不可用时平台原生 cmd start / open / xdg-open)。
|
|
18
18
|
* appWindow: false → **与官方相同**:同样执行默认浏览器交接(官方 open 方式),
|
|
19
19
|
* 替代被本插件补丁关闭的官方核心交接,行为与未安装本插件时一致。
|
|
20
|
+
* --no-open / SSH 会话 → **与官方相同**:不打开任何窗口/页面(读取官方
|
|
21
|
+
* webStartup 服务的 openBrowser 标志;SSH 会话按官方同源环境变量判定)。
|
|
20
22
|
*
|
|
21
23
|
* 配置来源:行配置(cordis.patch.yml)作为启动种子;设置页卡片(客户端 bundle,
|
|
22
24
|
* settings.plugin.item 插槽)经官方 settings 域(settingsScope)读写本命名
|
|
@@ -296,6 +298,33 @@ async function openDefaultBrowser(url) {
|
|
|
296
298
|
return platform.openDefaultBrowser(url);
|
|
297
299
|
}
|
|
298
300
|
|
|
301
|
+
// ── 与官方相同的打开抑制(--no-open / SSH 会话) ────────────────────────────
|
|
302
|
+
//
|
|
303
|
+
// 官方(web-app)的默认浏览器交接条件是 handoffBrowser = config.openBrowser &&
|
|
304
|
+
// !launchedThroughSsh(ctx):config.openBrowser 来自 web-startup 插件提供的
|
|
305
|
+
// webStartup 服务(--no-open 时 openBrowser === false,即 commander 对
|
|
306
|
+
// --no-open 的反向选项 options.open);SSH 会话(SSH_CONNECTION/SSH_TTY 进程
|
|
307
|
+
// 环境变量)同样不自动打开。本插件的 bundle 补丁把官方 openBrowser 恒置为
|
|
308
|
+
// false、打开行为由本插件接管,故此处读取**同一来源**做同样的抑制,保证
|
|
309
|
+
// `dsh web --no-open`(及 SSH 会话)与官方行为一致:不打开任何窗口/页面。
|
|
310
|
+
/**
|
|
311
|
+
* --no-open 是否已传(webStartup.openBrowser === false)。
|
|
312
|
+
* webStartup 由 web-startup 插件提供(同一 isolate 的根服务表,ctx.get 可见);
|
|
313
|
+
* 非 web 组合(服务缺失)视为未传,不误伤。
|
|
314
|
+
*/
|
|
315
|
+
function noOpenRequested(ctx) {
|
|
316
|
+
const webStartup = ctx.get('webStartup');
|
|
317
|
+
return webStartup !== undefined && webStartup !== null && webStartup.openBrowser === false;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/** 是否 SSH 会话(与官方 launchedThroughSsh 同源:进程环境变量)。 */
|
|
321
|
+
function sshSessionDetected() {
|
|
322
|
+
return (
|
|
323
|
+
(process.env.SSH_CONNECTION !== undefined && process.env.SSH_CONNECTION !== '') ||
|
|
324
|
+
(process.env.SSH_TTY !== undefined && process.env.SSH_TTY !== '')
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
|
|
299
328
|
// ── 配置与历史迁移(共通) ─────────────────────────────────────────────────
|
|
300
329
|
|
|
301
330
|
/** 删除 v0.3 遗留的 state 文件(一次性清理,防孤儿数据)。 */
|
|
@@ -421,6 +450,8 @@ export const internals = {
|
|
|
421
450
|
spawnHostWindow,
|
|
422
451
|
getOpenPackage,
|
|
423
452
|
openDefaultBrowser,
|
|
453
|
+
noOpenRequested,
|
|
454
|
+
sshSessionDetected,
|
|
424
455
|
/** 测试钩子:同步"窗口关闭时退出 DSH"生效标志(模拟设置保存)。 */
|
|
425
456
|
setExitWatcherEnabled(value) {
|
|
426
457
|
exitWatcherEnabled = value === true;
|
|
@@ -561,6 +592,15 @@ export function apply(ctx, config) {
|
|
|
561
592
|
}
|
|
562
593
|
const url = `http://127.0.0.1:${String(server.port)}`;
|
|
563
594
|
|
|
595
|
+
// 与官方相同的打开抑制:--no-open(webStartup.openBrowser === false)或
|
|
596
|
+
// SSH 会话时不打开任何窗口/页面(官方同样不交接)。
|
|
597
|
+
const noOpen = noOpenRequested(ctx);
|
|
598
|
+
const ssh = sshSessionDetected();
|
|
599
|
+
if (noOpen || ssh) {
|
|
600
|
+
console.log(`[auto-open-web] ${noOpen ? '--no-open given' : 'SSH session'}; not opening anything (official behavior)`);
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
|
|
564
604
|
// 独立应用窗口:按 windowKind 显式选择(webview2 | browser),直接加载 GUI 根地址。
|
|
565
605
|
// 所选类型不可用时降级到最后兜底:默认浏览器打开(官方 dsh web 同款,
|
|
566
606
|
// 普通标签页),保证用户至少能打开 GUI。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-auto-open-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "Open the DSH Web GUI in an app-style WebView2 window on profile start, with a settings card for browser paths",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"README.en.md"
|
|
47
47
|
],
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@deepseek-ai/dsh": ">=0.1.0-rc.
|
|
49
|
+
"@deepseek-ai/dsh": ">=0.1.0-rc.8 <0.2.0",
|
|
50
50
|
"@deepseek-ai/schemastery": "^3.18.1"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|