@jingyi0605/codingns4dsh 0.1.1 → 0.1.2

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 CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  [简体中文](README.md) · **English**
12
12
 
13
- **Current release `@jingyi0605/codingns4dsh@0.1.1`** · DSH **`>=0.1.5-rc.3 <=0.1.7-rc.2`** (validated `0.1.5-rc.3`, `0.1.6-alpha.2`, `0.1.7-rc.2`) · Node **`>= 22.19`** · macOS / Linux / Windows
13
+ **Current release `@jingyi0605/codingns4dsh@0.1.2`** · DSH **`>=0.1.5-rc.3 <=0.1.7-rc.2`** (validated `0.1.5-rc.3`, `0.1.6-alpha.2`, `0.1.7-rc.2`) · Node **`>= 22.19`** · macOS / Linux / Windows
14
14
 
15
15
  **[GitHub](https://github.com/jingyi0605/Codingns4DSH)** · **[npm](https://www.npmjs.com/package/@jingyi0605/codingns4dsh)** · **QQ group 1092985965**
16
16
 
@@ -203,7 +203,7 @@ The “access” line tells you whether you entered DSH Web locally, over the LA
203
203
  DSH automatically initializes the `web` profile on first use. You do not need to create a config file or run `--dump-config`:
204
204
 
205
205
  ```bash
206
- dsh plugin --profile web add @jingyi0605/codingns4dsh@0.1.1
206
+ dsh plugin --profile web add @jingyi0605/codingns4dsh@0.1.2
207
207
  dsh web
208
208
  ```
209
209
 
@@ -213,7 +213,7 @@ If you do not want to modify the built-in `web` profile, create a separate profi
213
213
 
214
214
  ```bash
215
215
  dsh codingns --from-default-profile web --dump-config
216
- dsh plugin --profile codingns add @jingyi0605/codingns4dsh@0.1.1
216
+ dsh plugin --profile codingns add @jingyi0605/codingns4dsh@0.1.2
217
217
  dsh codingns
218
218
  ```
219
219
 
@@ -234,7 +234,7 @@ dsh plugin --profile web remove @jingyi0605/codingns4dsh
234
234
  ```bash
235
235
  git clone https://github.com/jingyi0605/Codingns4DSH.git && cd Codingns4DSH
236
236
  pnpm install && pnpm build
237
- dsh plugin --profile web add "$PWD" # or: npm pack, then add ./jingyi0605-codingns4dsh-0.1.1.tgz
237
+ dsh plugin --profile web add "$PWD" # or: npm pack, then add ./jingyi0605-codingns4dsh-0.1.2.tgz
238
238
  dsh web
239
239
  ```
240
240
 
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  **简体中文** · [English](README.en.md)
12
12
 
13
- **当前版本 `@jingyi0605/codingns4dsh@0.1.1`** · DSH **`>=0.1.5-rc.3 <=0.1.7-rc.2`**(已验证 `0.1.5-rc.3`、`0.1.6-alpha.2`、`0.1.7-rc.2`)· Node **`>= 22.19`** · macOS / Linux / Windows
13
+ **当前版本 `@jingyi0605/codingns4dsh@0.1.2`** · DSH **`>=0.1.5-rc.3 <=0.1.7-rc.2`**(已验证 `0.1.5-rc.3`、`0.1.6-alpha.2`、`0.1.7-rc.2`)· Node **`>= 22.19`** · macOS / Linux / Windows
14
14
 
15
15
  **[GitHub](https://github.com/jingyi0605/Codingns4DSH)** · **[npm](https://www.npmjs.com/package/@jingyi0605/codingns4dsh)** · **QQ 群 1092985965**
16
16
 
@@ -208,7 +208,7 @@ DSH 设置按钮旁的账户入口会显示登录状态、访问路径与延迟
208
208
  DSH 的 `web` Profile 会在首次使用时自动初始化,不需要手动创建配置文件,也不需要执行 `--dump-config`:
209
209
 
210
210
  ```bash
211
- dsh plugin --profile web add @jingyi0605/codingns4dsh@0.1.1
211
+ dsh plugin --profile web add @jingyi0605/codingns4dsh@0.1.2
212
212
  dsh web
213
213
  ```
214
214
 
@@ -218,7 +218,7 @@ dsh web
218
218
 
219
219
  ```bash
220
220
  dsh codingns --from-default-profile web --dump-config
221
- dsh plugin --profile codingns add @jingyi0605/codingns4dsh@0.1.1
221
+ dsh plugin --profile codingns add @jingyi0605/codingns4dsh@0.1.2
222
222
  dsh codingns
223
223
  ```
224
224
 
@@ -239,7 +239,7 @@ dsh plugin --profile web remove @jingyi0605/codingns4dsh
239
239
  ```bash
240
240
  git clone https://github.com/jingyi0605/Codingns4DSH.git && cd Codingns4DSH
241
241
  pnpm install && pnpm build
242
- dsh plugin --profile web add "$PWD" # 或 npm pack 后 add ./jingyi0605-codingns4dsh-0.1.1.tgz
242
+ dsh plugin --profile web add "$PWD" # 或 npm pack 后 add ./jingyi0605-codingns4dsh-0.1.2.tgz
243
243
  dsh web
244
244
  ```
245
245
 
@@ -1107,7 +1107,7 @@ window.__ModuleLoader__.load({
1107
1107
  return /^0\.1\.5(?:-|$)/u.test(version);
1108
1108
  }
1109
1109
  /** Codingns4DSH 插件自身的 npm 版本。 */
1110
- const CODINGNS_VERSION = "0.1.1";
1110
+ const CODINGNS_VERSION = "0.1.2";
1111
1111
  /** 判断宿主版本是否落在当前插件声明的 DSH 兼容范围内。 */
1112
1112
  function isDshVersionCompatible(version) {
1113
1113
  const match = /^>=([^ ]+) <=([^ ]+)$/u.exec(DSH_COMPATIBILITY);
@@ -35955,7 +35955,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
35955
35955
  const idParameter = () => json("id", "id", "codingns4dsh/shared#WebTerminalId", terminalIdSchema);
35956
35956
  const attachmentParameter = () => json("attachmentId", "attachmentId", "codingns4dsh/shared#TerminalAttachmentId", attachmentIdSchema);
35957
35957
  const TYPERT = {
35958
- package: "@jingyi0605/codingns4dsh",
35958
+ package: "codingns4dsh",
35959
35959
  face: "host",
35960
35960
  schemas: [],
35961
35961
  invocations: [
@@ -3,9 +3,8 @@
3
3
  *
4
4
  * DSH 0.1.6 尚未把启动器版本作为 Cordis 服务暴露给插件,因此不能从
5
5
  * 插件自身的 DSH_VERSION 常量推断宿主版本。优先沿当前 dsh 可执行入口
6
- * 向上查找 @deepseek-ai/dsh/package.json。Desktop Host 额外传入 Runtime
7
- * 根目录,需要直接从该目录的 node_modules 读取实际加载的包版本;只有
8
- * 这些路径都无法提供版本时才回退到 PATH 中的 `dsh --version`。
6
+ * 向上查找 @deepseek-ai/dsh/package.json,只有开发环境无法提供入口时才
7
+ * 回退到 PATH 中的 `dsh --version`。
9
8
  */
10
9
  export declare function detectRuntimeDshVersion(): string;
11
10
  /** Host 启动后供 Web Client 复用的版本注入名称。 */
@@ -1,5 +1,4 @@
1
1
  import { readFileSync } from 'node:fs';
2
- import { createRequire } from 'node:module';
3
2
  import { dirname, join } from 'node:path';
4
3
  import { spawnSync } from 'node:child_process';
5
4
  import { fileURLToPath } from 'node:url';
@@ -10,17 +9,13 @@ const VERSION_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u;
10
9
  *
11
10
  * DSH 0.1.6 尚未把启动器版本作为 Cordis 服务暴露给插件,因此不能从
12
11
  * 插件自身的 DSH_VERSION 常量推断宿主版本。优先沿当前 dsh 可执行入口
13
- * 向上查找 @deepseek-ai/dsh/package.json。Desktop Host 额外传入 Runtime
14
- * 根目录,需要直接从该目录的 node_modules 读取实际加载的包版本;只有
15
- * 这些路径都无法提供版本时才回退到 PATH 中的 `dsh --version`。
12
+ * 向上查找 @deepseek-ai/dsh/package.json,只有开发环境无法提供入口时才
13
+ * 回退到 PATH 中的 `dsh --version`。
16
14
  */
17
15
  export function detectRuntimeDshVersion() {
18
16
  const candidates = [
19
17
  process.env.DSH_RUNTIME_VERSION,
20
18
  process.env.DSH_VERSION,
21
- ...process.argv.slice(1).map(readDshVersionFromRuntimeRoot),
22
- ...process.argv.slice(1).map(readDshVersionFromModule),
23
- ...readDshVersionsFromDesktopResources(),
24
19
  readDshPackageVersion(process.argv[1]),
25
20
  readDshPackageVersion(fileURLToPath(import.meta.url)),
26
21
  readDshVersionFromCommand(),
@@ -55,70 +50,6 @@ function readDshPackageVersion(entryPath) {
55
50
  }
56
51
  return undefined;
57
52
  }
58
- /**
59
- * Desktop 启动器把 Runtime 根目录作为 Host 参数传入,Host 入口本身与
60
- * @deepseek-ai/dsh 是兄弟目录,无法通过普通的父目录遍历找到它。
61
- */
62
- function readDshVersionFromRuntimeRoot(runtimeRoot) {
63
- if (runtimeRoot === undefined || runtimeRoot.trim() === '')
64
- return undefined;
65
- const packageVersion = readDshPackageManifestVersion(join(runtimeRoot, 'node_modules', '@deepseek-ai', 'dsh', 'package.json'));
66
- if (packageVersion !== undefined)
67
- return packageVersion;
68
- // 某些打包方式只保留 Runtime 根 package.json 的依赖声明。
69
- try {
70
- const manifest = JSON.parse(readFileSync(join(runtimeRoot, 'package.json'), 'utf8'));
71
- const declaredVersion = manifest.dependencies?.['@deepseek-ai/dsh'] ?? manifest.devDependencies?.['@deepseek-ai/dsh'];
72
- return typeof declaredVersion === 'string' && VERSION_PATTERN.test(declaredVersion) ? declaredVersion : undefined;
73
- }
74
- catch {
75
- return undefined;
76
- }
77
- }
78
- /**
79
- * 让 Node/Electron 按 Desktop Host 自身的依赖边界解析 DSH。asar 内部路径
80
- * 由 Electron 的模块加载器处理,不能假设普通文件 API 能独立遍历所有目录。
81
- */
82
- function readDshVersionFromModule(entryPath) {
83
- if (entryPath === undefined || entryPath.trim() === '' || entryPath.startsWith('-'))
84
- return undefined;
85
- try {
86
- const require = createRequire(entryPath);
87
- const manifestPath = require.resolve('@deepseek-ai/dsh/package.json');
88
- return readDshPackageManifestVersion(manifestPath);
89
- }
90
- catch {
91
- return undefined;
92
- }
93
- }
94
- /** Electron 可能消费部分 argv;此时从自身 Resources 目录定位 Desktop Runtime。 */
95
- function readDshVersionsFromDesktopResources() {
96
- const processWithResources = process;
97
- const resourcesRoots = [
98
- processWithResources.resourcesPath,
99
- join(dirname(dirname(process.execPath)), 'Resources'),
100
- ].filter((value) => typeof value === 'string' && value.trim() !== '');
101
- const runtimeRoots = resourcesRoots.flatMap((resourcesRoot) => [
102
- join(resourcesRoot, 'app.asar', 'dsh'),
103
- join(resourcesRoot, 'app.asar.unpacked', 'dsh'),
104
- join(resourcesRoot, 'dsh'),
105
- ]);
106
- return runtimeRoots.flatMap((runtimeRoot) => [
107
- readDshVersionFromRuntimeRoot(runtimeRoot),
108
- readDshVersionFromModule(join(runtimeRoot, 'node_modules', '@deepseek-ai', 'dsh-desktop-host', 'lib', 'index.js')),
109
- ]);
110
- }
111
- function readDshPackageManifestVersion(manifestPath) {
112
- try {
113
- const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
114
- if (manifest.name === '@deepseek-ai/dsh' && typeof manifest.version === 'string')
115
- return manifest.version;
116
- }
117
- catch {
118
- return undefined;
119
- }
120
- return undefined;
121
- }
122
53
  function readDshVersionFromCommand() {
123
54
  try {
124
55
  const result = spawnSync(process.platform === 'win32' ? 'dsh.cmd' : 'dsh', ['--version'], {
@@ -58,12 +58,13 @@ export function apply(ctx) {
58
58
  hasWebServer: hostCtx.webServer !== undefined,
59
59
  });
60
60
  const webServerPort = hostCtx.webServer.port;
61
- // Desktop 自己会通过 dshDesktopBoot 注入带 streamBaseUrl 的 __DSH_TRANSPORT__。
62
- // 插件不能用只有 ownsHost 的对象覆盖它,否则 Desktop 的 /api/remote.mux
63
- // 会退回 dsh-app://app 并返回 404。远程 iframe 的 transport 由自身桥接代码注入。
61
+ // LAN 入口和中继 Web 页面可能使用非 loopback URL,但它们都已经经过
62
+ // DSH Host 的认证边界并回到本机 Host。通过启动页注入 transport 所有权,
63
+ // 让 DSH 原生 ui-settings 保持 host 模式,而不是错误降级为 memory 模式。
64
64
  const indexInjectionEvents = hostCtx;
65
65
  debugInfo('codingns4dsh: host index injection registration begin');
66
66
  indexInjectionEvents.on('webserver/index-inject', (table) => {
67
+ table.push({ kind: 'global', name: '__DSH_TRANSPORT__', value: { ownsHost: true } });
67
68
  table.push({ kind: 'global', name: DSH_VERSION_INJECTION_NAME, value: dshVersion });
68
69
  });
69
70
  debugInfo('codingns4dsh: host index injection registration ready');
@@ -11,7 +11,7 @@ export declare const CODINGNS_DSH_VERSION_GLOBAL: "__CODINGNS_DSH_VERSION__";
11
11
  /** 识别没有 alpha2 Sidebar 扩展 API 的 DSH 旧版运行时。 */
12
12
  export declare function isLegacyDshVersion(version: string): boolean;
13
13
  /** Codingns4DSH 插件自身的 npm 版本。 */
14
- export declare const CODINGNS_VERSION: "0.1.1";
14
+ export declare const CODINGNS_VERSION: "0.1.2";
15
15
  /** 判断宿主版本是否落在当前插件声明的 DSH 兼容范围内。 */
16
16
  export declare function isDshVersionCompatible(version: string): boolean;
17
17
  /** 判断 DSH 版本是否达到某个功能模块要求的最低版本。 */
@@ -13,7 +13,7 @@ export function isLegacyDshVersion(version) {
13
13
  return /^0\.1\.5(?:-|$)/u.test(version);
14
14
  }
15
15
  /** Codingns4DSH 插件自身的 npm 版本。 */
16
- export const CODINGNS_VERSION = '0.1.1';
16
+ export const CODINGNS_VERSION = '0.1.2';
17
17
  /** 判断宿主版本是否落在当前插件声明的 DSH 兼容范围内。 */
18
18
  export function isDshVersionCompatible(version) {
19
19
  const match = /^>=([^ ]+) <=([^ ]+)$/u.exec(DSH_COMPATIBILITY);
@@ -1,5 +1,5 @@
1
1
  export declare const TYPERT: {
2
- readonly package: "@jingyi0605/codingns4dsh";
2
+ readonly package: "codingns4dsh";
3
3
  readonly face: "host";
4
4
  readonly schemas: readonly [];
5
5
  readonly invocations: readonly [Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>];
@@ -92,8 +92,7 @@ const voidResult = (method) => codec(`codingns4dsh#terminal/${method}:result`, z
92
92
  const idParameter = () => json('id', 'id', 'codingns4dsh/shared#WebTerminalId', terminalIdSchema);
93
93
  const attachmentParameter = () => json('attachmentId', 'attachmentId', 'codingns4dsh/shared#TerminalAttachmentId', attachmentIdSchema);
94
94
  export const TYPERT = {
95
- // Typert Loader 要求 manifest.package 与导出该 manifest 的 npm 包名完全一致。
96
- package: '@jingyi0605/codingns4dsh',
95
+ package: 'codingns4dsh',
97
96
  face: 'host',
98
97
  schemas: [],
99
98
  invocations: [
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@jingyi0605/codingns4dsh",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Codingns4DSH 插件骨架与连接契约",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/jingyi0605/Codingns4DSH"
8
+ },
5
9
  "type": "module",
6
10
  "main": "./data/build/dist/index.js",
7
11
  "types": "./data/build/dist/index.d.ts",
package/profile/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Codingns4DSH Profile
2
2
 
3
- 这是独立的 Codingns4DSH Profile,插件版本为 `0.1.1`,兼容 DSH `>=0.1.5-rc.3 <=0.1.7-rc.2`,当前测试版本为 `0.1.6-alpha.2`。
3
+ 这是独立的 Codingns4DSH Profile,插件版本为 `0.1.2`,兼容 DSH `>=0.1.5-rc.3 <=0.1.7-rc.2`,当前测试版本为 `0.1.6-alpha.2`。
4
4
 
5
5
  Profile 只选择 `codingns4dsh` Bundle。`cordis.patch.yml` 保持 `[]`,因为启动期
6
6
  Transport 必须由外部 pre-Cordis 启动胶水在 DSH Client/Cordis 创建前登记,不能由
@@ -9,7 +9,7 @@ Transport 必须由外部 pre-Cordis 启动胶水在 DSH Client/Cordis 创建前
9
9
  发布后,在 DSH 的 Profile 中安装精确版本的插件 Bundle:
10
10
 
11
11
  ```bash
12
- dsh plugin --profile codingns4dsh add @jingyi0605/codingns4dsh@0.1.1
12
+ dsh plugin --profile codingns4dsh add @jingyi0605/codingns4dsh@0.1.2
13
13
  ```
14
14
 
15
15
  Profile 安装完成后,使用 DSH 官方启动器启动:
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codingns4dsh-profile",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "engines": {
@@ -10,7 +10,7 @@
10
10
  "preinstall": "node scripts/check-dsh-install.mjs"
11
11
  },
12
12
  "dependencies": {
13
- "@jingyi0605/codingns4dsh": "0.1.1"
13
+ "@jingyi0605/codingns4dsh": "0.1.2"
14
14
  },
15
15
  "dsh": {
16
16
  "profile": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "pluginVersion": "0.1.1",
2
+ "pluginVersion": "0.1.2",
3
3
  "dshCompatibility": ">=0.1.5-rc.3 <=0.1.7-rc.2",
4
4
  "dshTestedVersion": "0.1.6-alpha.2"
5
5
  }
package/version.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "pluginVersion": "0.1.1",
2
+ "pluginVersion": "0.1.2",
3
3
  "dshCompatibility": ">=0.1.5-rc.3 <=0.1.7-rc.2",
4
4
  "dshTestedVersion": "0.1.6-alpha.2",
5
5
  "dshProtocolVersion": 1