dsh-auto-open-web 0.1.3 → 0.1.4
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 +9 -4
- package/README.md +8 -4
- package/host-publish/DshAppWindow.deps.json +2 -2
- 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 +5 -1
- package/lib/index.js +56 -1
- package/package.json +9 -1
package/README.en.md
CHANGED
|
@@ -86,14 +86,14 @@ whole config; fields not listed fall back to defaults):
|
|
|
86
86
|
|
|
87
87
|
This package is a **bundle**: an npm package carrying a configuration layer — `dsh.bundle` in
|
|
88
88
|
`package.json` declares the patch file (`cordis.patch.yml`), and a profile activates the plugin row
|
|
89
|
-
by package name when installed. Published to the **npm registry** (`dsh-auto-open-web@0.1.
|
|
89
|
+
by package name when installed. Published to the **npm registry** (`dsh-auto-open-web@0.1.4`) and
|
|
90
90
|
**GitHub** (https://github.com/jinsiyu/dsh-auto-open-web, `main` branch).
|
|
91
91
|
|
|
92
92
|
### Packaging
|
|
93
93
|
|
|
94
94
|
```bash
|
|
95
95
|
cd dsh-auto-open-web
|
|
96
|
-
pnpm pack # the prepack hook compiles the WebView2 host first (dotnet publish), producing dsh-auto-open-web-0.1.
|
|
96
|
+
pnpm pack # the prepack hook compiles the WebView2 host first (dotnet publish), producing dsh-auto-open-web-0.1.4.tgz
|
|
97
97
|
```
|
|
98
98
|
|
|
99
99
|
### Installation (pick one)
|
|
@@ -108,7 +108,7 @@ dsh plugin --profile web add C:\path\to\dsh-auto-open-web
|
|
|
108
108
|
**Option 2: tarball (published artifact, recommended for delivery; no build permission needed)**
|
|
109
109
|
|
|
110
110
|
```bash
|
|
111
|
-
dsh plugin --profile web add ./dsh-auto-open-web-0.1.
|
|
111
|
+
dsh plugin --profile web add ./dsh-auto-open-web-0.1.4.tgz
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
**Option 3: npm registry (after publishing)**
|
|
@@ -145,6 +145,11 @@ without touching the package.
|
|
|
145
145
|
|
|
146
146
|
### Notes
|
|
147
147
|
|
|
148
|
+
- **DSH version requirement**: this plugin supports **dsh `>=0.1.0-rc.7 <0.2.0`** (declared as an
|
|
149
|
+
optional peer, provided by the DSH deployment, no install warnings). `settings.plugin.item`
|
|
150
|
+
became a keyed slot in that release; the card registers with both `id` and `key` so it mounts on
|
|
151
|
+
both old and new dsh generations. Below the supported range the host logs a clear error at
|
|
152
|
+
startup (pointing to a dsh upgrade) and the card may not mount.
|
|
148
153
|
- **The npm package already contains the compiled WebView2 host** (built by the prepack hook before
|
|
149
154
|
publishing); the **GitHub `main` branch and source-checkout installs do not** include
|
|
150
155
|
`host-publish/` (build artifacts are .gitignore'd): for webview2 mode, run
|
|
@@ -167,7 +172,7 @@ without touching the package.
|
|
|
167
172
|
win32.js is never evaluated on posix.
|
|
168
173
|
- If installing by editing `package.json` manually (not via the `dsh plugin` command), you must add
|
|
169
174
|
both the `dependencies` entry and `dsh.profile.bundles`; when using a local `file:` dependency,
|
|
170
|
-
`dsh web` normalizes `file:` to `^0.1.
|
|
175
|
+
`dsh web` normalizes `file:` to `^0.1.4` at startup, which does not affect runtime.
|
|
171
176
|
|
|
172
177
|
## Icons
|
|
173
178
|
|
package/README.md
CHANGED
|
@@ -79,14 +79,14 @@ Job Object(强杀也生效)+ 退出清理结束进程树。
|
|
|
79
79
|
|
|
80
80
|
本包是**组合包(bundle)**:一个附带配置层的 npm 包——`package.json` 的
|
|
81
81
|
`dsh.bundle` 声明配置层文件(`cordis.patch.yml`),profile 安装它时按包名激活
|
|
82
|
-
插件行。已发布到 **npm registry**(`dsh-auto-open-web@0.1.
|
|
82
|
+
插件行。已发布到 **npm registry**(`dsh-auto-open-web@0.1.4`)与 **GitHub**
|
|
83
83
|
(https://github.com/jinsiyu/dsh-auto-open-web,main 分支)。
|
|
84
84
|
|
|
85
85
|
### 打包
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
88
|
cd dsh-auto-open-web
|
|
89
|
-
pnpm pack # prepack 钩子自动先编译 WebView2 宿主(dotnet publish),产出 dsh-auto-open-web-0.1.
|
|
89
|
+
pnpm pack # prepack 钩子自动先编译 WebView2 宿主(dotnet publish),产出 dsh-auto-open-web-0.1.4.tgz
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
### 安装方式(任选其一)
|
|
@@ -101,7 +101,7 @@ dsh plugin --profile web add C:\path\to\dsh-auto-open-web
|
|
|
101
101
|
**方式二:tarball(发布产物,推荐交付;无需构建授权)**
|
|
102
102
|
|
|
103
103
|
```bash
|
|
104
|
-
dsh plugin --profile web add ./dsh-auto-open-web-0.1.
|
|
104
|
+
dsh plugin --profile web add ./dsh-auto-open-web-0.1.4.tgz
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
**方式三:npm 注册表(发布后)**
|
|
@@ -137,6 +137,10 @@ dsh plugin --profile web remove dsh-auto-open-web # 同时移除依赖与对
|
|
|
137
137
|
|
|
138
138
|
### 注意事项
|
|
139
139
|
|
|
140
|
+
- **dsh 版本要求**:本插件支持 **dsh `>=0.1.0-rc.7 <0.2.0`**(peer 声明,由 DSH 部署
|
|
141
|
+
提供,安装无警告)。`settings.plugin.item` 自该版本起为 keyed 插槽,卡片注册
|
|
142
|
+
同时提供 `id` 与 `key` 以兼容新旧两代 dsh;低于支持范围时宿主启动会记录
|
|
143
|
+
明确错误日志(提示升级 dsh),卡片可能无法挂载。
|
|
140
144
|
- **npm 包已含 WebView2 宿主编译产物**(prepack 编译后发布);**GitHub
|
|
141
145
|
main 分支与源码 checkout 方式不含** `host-publish/`(构建产物被
|
|
142
146
|
.gitignore 忽略):webview2 模式需先在 `node_modules/dsh-auto-open-web`
|
|
@@ -153,7 +157,7 @@ dsh plugin --profile web remove dsh-auto-open-web # 同时移除依赖与对
|
|
|
153
157
|
不可用),且平台适配器按平台条件加载,posix 上完全不求值 win32.js。
|
|
154
158
|
- 若手动编辑 `package.json` 安装(不经 dsh plugin 命令),需同时追加
|
|
155
159
|
`dependencies` 与 `dsh.profile.bundles` 两项;使用本地 `file:` 依赖时
|
|
156
|
-
`dsh web` 启动会把 `file:` 规范化成 `^0.1.
|
|
160
|
+
`dsh web` 启动会把 `file:` 规范化成 `^0.1.4`,运行时不受影响。
|
|
157
161
|
|
|
158
162
|
## 图标
|
|
159
163
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"compilationOptions": {},
|
|
7
7
|
"targets": {
|
|
8
8
|
".NETCoreApp,Version=v10.0": {
|
|
9
|
-
"DshAppWindow/0.1.
|
|
9
|
+
"DshAppWindow/0.1.4": {
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"Microsoft.Web.WebView2": "1.0.3124.44",
|
|
12
12
|
"Microsoft.Web.WebView2.Core": "1.0.3124.44",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
"libraries": {
|
|
66
|
-
"DshAppWindow/0.1.
|
|
66
|
+
"DshAppWindow/0.1.4": {
|
|
67
67
|
"type": "project",
|
|
68
68
|
"serviceable": false,
|
|
69
69
|
"sha512": ""
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/client.js
CHANGED
|
@@ -383,9 +383,13 @@ window.__ModuleLoader__.load({
|
|
|
383
383
|
console.error('[auto-open-web] slots service unavailable')
|
|
384
384
|
return
|
|
385
385
|
}
|
|
386
|
+
// settings.plugin.item 注册的 dsh 版本兼容:
|
|
387
|
+
// dsh ≥0.1.0-rc.7 为 keyed 插槽,必须带 options.key;
|
|
388
|
+
// 更早版本为 list 插槽,必须带 options.id。
|
|
389
|
+
// 同时提供 id 与 key:新版取 key,旧版取 id,两代 dsh 都能挂载卡片。
|
|
386
390
|
slots.inject('settings.plugin.item', () =>
|
|
387
391
|
slots.register(
|
|
388
|
-
{ name: 'settings.plugin.item', id: 'auto-open-web', order: 40, label: '自动打开网页' },
|
|
392
|
+
{ name: 'settings.plugin.item', id: 'auto-open-web', key: 'auto-open-web', order: 40, label: '自动打开网页' },
|
|
389
393
|
() => React.createElement(AutoOpenSettingsPage, null)
|
|
390
394
|
)
|
|
391
395
|
)
|
package/lib/index.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* (WebView2 宿主例外:随 DSH 退出而关闭)。
|
|
24
24
|
*/
|
|
25
25
|
import { spawn } from 'node:child_process';
|
|
26
|
-
import { rmSync, writeFileSync } from 'node:fs';
|
|
26
|
+
import { existsSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
27
27
|
import { join } from 'node:path';
|
|
28
28
|
import z from '@deepseek-ai/schemastery';
|
|
29
29
|
import { dshHome, appProfileDir, testProfileDir, instanceStateFile } from './paths.js';
|
|
@@ -311,6 +311,48 @@ async function ensureIconFile(server) {
|
|
|
311
311
|
|
|
312
312
|
// ── 插件主体 ─────────────────────────────────────────────────────────────
|
|
313
313
|
|
|
314
|
+
/**
|
|
315
|
+
* dsh 宿主版本兼容范围(与 package.json 的 peerDependencies 一致):
|
|
316
|
+
* settings.plugin.item 自 dsh 0.1.0-rc.7 起为 keyed 插槽(注册需 options.key);
|
|
317
|
+
* 0.1.4 的卡片注册同时提供 id 与 key,新旧两代 dsh 均可挂载,但低于
|
|
318
|
+
* 0.1.0-rc.7 时官方 UI 未定义该插槽的 keyed 语义,超出支持范围。
|
|
319
|
+
*/
|
|
320
|
+
const DSH_MIN_VERSION = '0.1.0-rc.7';
|
|
321
|
+
const DSH_MAX_VERSION = '0.2.0';
|
|
322
|
+
|
|
323
|
+
/** 解析 "x.y.z[-rc.N]" 为数值数组;rc 缺失视为 Infinity(正式版 > 同号 rc)。失败返回 null。 */
|
|
324
|
+
function parseVersion(text) {
|
|
325
|
+
const m = /^(\d+)\.(\d+)\.(\d+)(?:-rc\.(\d+))?/.exec(String(text).trim());
|
|
326
|
+
if (m === null) return null;
|
|
327
|
+
return [Number(m[1]), Number(m[2]), Number(m[3]), m[4] !== undefined ? Number(m[4]) : Infinity];
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function compareVersions(a, b) {
|
|
331
|
+
return a[0] - b[0] || a[1] - b[1] || a[2] - b[2] || a[3] - b[3];
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** dsh 版本是否在支持范围内;版本未知(读不到/解析失败)返回 true(不误伤)。 */
|
|
335
|
+
export function isDshVersionSupported(versionText) {
|
|
336
|
+
const v = parseVersion(versionText);
|
|
337
|
+
const min = parseVersion(DSH_MIN_VERSION);
|
|
338
|
+
const max = parseVersion(DSH_MAX_VERSION);
|
|
339
|
+
if (v === null || min === null || max === null) return true;
|
|
340
|
+
return compareVersions(v, min) >= 0 && compareVersions(v, max) < 0;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/** 尽力读取部署的 dsh 版本(Windows 全局 npm 布局;其余环境返回 null)。 */
|
|
344
|
+
export function detectDshVersion() {
|
|
345
|
+
try {
|
|
346
|
+
const globalRoot = process.env.APPDATA ? join(process.env.APPDATA, 'npm', 'node_modules') : '';
|
|
347
|
+
const entry = join(globalRoot, '@deepseek-ai', 'dsh', 'package.json');
|
|
348
|
+
if (!existsSync(entry)) return null;
|
|
349
|
+
const version = JSON.parse(readFileSync(entry, 'utf8')).version;
|
|
350
|
+
return typeof version === 'string' && version !== '' ? version : null;
|
|
351
|
+
} catch {
|
|
352
|
+
return null;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
314
356
|
/**
|
|
315
357
|
* 窗口退出监听共享标志:"窗口关闭时退出 DSH"当前是否生效。
|
|
316
358
|
* 监听始终注册(见 openAppWindow/spawnHostWindow),行为由本标志实时决定:
|
|
@@ -332,11 +374,24 @@ export const internals = {
|
|
|
332
374
|
setExitWatcherEnabled(value) {
|
|
333
375
|
exitWatcherEnabled = value === true;
|
|
334
376
|
},
|
|
377
|
+
isDshVersionSupported,
|
|
378
|
+
detectDshVersion,
|
|
335
379
|
};
|
|
336
380
|
|
|
337
381
|
export function apply(ctx, config) {
|
|
338
382
|
removeLegacyState();
|
|
339
383
|
|
|
384
|
+
// dsh 宿主版本约束(声明性):低于支持范围时明确提示(宿主能力兼容,
|
|
385
|
+
// 卡片注册做了新旧双兼容,不硬停;日志指导用户升级 dsh)。
|
|
386
|
+
const dshVersion = detectDshVersion();
|
|
387
|
+
if (dshVersion !== null && !isDshVersionSupported(dshVersion)) {
|
|
388
|
+
console.error(
|
|
389
|
+
`[auto-open-web] DSH version ${dshVersion} is outside the supported range ` +
|
|
390
|
+
`(${DSH_MIN_VERSION} <= dsh < ${DSH_MAX_VERSION}); the settings card may not mount. ` +
|
|
391
|
+
'Please upgrade dsh to continue using this plugin.',
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
|
|
340
395
|
// browser 模式的专用实例随 DSH 退出:正常退出时结束其实例进程树
|
|
341
396
|
// (被强杀时由下次启动前的预清理兜底)。
|
|
342
397
|
process.on('exit', () => {
|
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.4",
|
|
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
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -42,5 +42,13 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@deepseek-ai/schemastery": "^3.18.1"
|
|
44
44
|
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@deepseek-ai/dsh": ">=0.1.0-rc.7 <0.2.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependenciesMeta": {
|
|
49
|
+
"@deepseek-ai/dsh": {
|
|
50
|
+
"optional": true
|
|
51
|
+
}
|
|
52
|
+
},
|
|
45
53
|
"license": "MIT"
|
|
46
54
|
}
|