@ntdgy/dsh-remote-bridge-plugin 0.1.0 → 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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +105 -0
  3. package/package.json +18 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-remote-bridge contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,105 @@
1
+ # @ntdgy/dsh-remote-bridge-plugin
2
+
3
+ DSH 插件半边 —— 跑在**私网 DSH 进程内**,主动出站连接公网网关。
4
+
5
+ 配合 [`@ntdgy/dsh-remote-relay`](https://www.npmjs.com/package/@ntdgy/dsh-remote-relay) 使用:
6
+ 浏览器 → 公网网关 → 这条出站长连接 → 你的私网 DSH。
7
+
8
+ **私网 DSH 不监听任何公网端口,也没有隧道。**
9
+
10
+ ---
11
+
12
+ ## 安装
13
+
14
+ ```bash
15
+ dsh plugin --profile web add @ntdgy/dsh-remote-bridge-plugin
16
+ ```
17
+
18
+ > ⚠️ **0.1.0 是坏的**(缺 peerDependencies,装上 import 会直接失败),已标记 deprecated。
19
+ > 正常情况下会解析到 0.1.1。若被 pnpm 的 `minimumReleaseAge` 挡住装到了旧的,
20
+ > 请显式指定版本:
21
+ >
22
+ > ```bash
23
+ > dsh plugin --profile web add @ntdgy/dsh-remote-bridge-plugin@0.1.1
24
+ > ```
25
+
26
+ ---
27
+
28
+ ## 配置
29
+
30
+ 在 profile 目录的 `cordis.patch.yml` 里插入:
31
+
32
+ ```yaml
33
+ - insert:
34
+ - id: remote-bridge
35
+ name: '@ntdgy/dsh-remote-bridge-plugin'
36
+ config:
37
+ relayUrl: wss://你的域名/agent
38
+ instanceId: my-dsh
39
+ instanceKey: '与网关侧 DSH_REMOTE_INSTANCE_KEYS 里完全一致的那串'
40
+ ```
41
+
42
+ | 配置项 | 必填 | 说明 |
43
+ |---|---|---|
44
+ | `relayUrl` | ✅ | 网关地址,**结尾是 `/agent`**,生产环境必须 `wss://` |
45
+ | `instanceId` | ✅ | 本实例标识,必须与网关的 `DSH_PROXY_INSTANCE` 一致 |
46
+ | `instanceKey` | ✅ | 与网关共享的 HMAC 密钥,必须与 `DSH_REMOTE_INSTANCE_KEYS` 里的一致 |
47
+ | `reconnectBaseMs` | — | 重连初始退避,默认 3000 |
48
+ | `reconnectMaxMs` | — | 重连退避上限,默认 60000 |
49
+
50
+ ### 关于 `ws://`
51
+
52
+ 用 `ws://` 时插件仍会连接,但每次启动会打一条醒目告警:
53
+
54
+ > relayUrl uses ws:// (plaintext): the HMAC handshake can be bypassed by a man-in-the-middle.
55
+
56
+ 原因:明文链路上,中间人可以替换 nonce 与签名,那样"认证通过"只是假象。
57
+ 本机联调或前面有 TLS 终结时可以用,公网直连不行。
58
+
59
+ ---
60
+
61
+ ## DSH 启动必须带 `--trusted-host`
62
+
63
+ ```bash
64
+ dsh web --host 127.0.0.1 --port 3080 --trusted-host 你的域名
65
+ ```
66
+
67
+ **漏了这条的症状很坑**:首页 200、页面骨架能渲染,但**所有 `/api/*` 返回 403**。
68
+ 不是启动报错,是运行时静默拒绝 —— 不写在这里,每个新用户都要重新踩一遍。
69
+
70
+ ---
71
+
72
+ ## 它做什么
73
+
74
+ | 职责 | 说明 |
75
+ |---|---|
76
+ | 出站注册 | HMAC 挑战应答自证身份,不发送任何凭据 |
77
+ | 窄 RPC 服务端 | 只响应白名单 method(`session.list` / `history` / `prompt` / `follow`),未知一律拒绝 |
78
+ | 路径上报 | 把 DSH 实际注册的 HTTP 前缀报给网关,网关据此放行转发 |
79
+ | 会话代持上报 | 上报已认证的 launch URL,让网关代持 DSH 会话(用户不必手输 `?token=`) |
80
+ | 状态面板 | 在 DSH 侧边栏显示连接状态与断线原因 |
81
+
82
+ **不做**的事:不转发任意 TCP、不建隧道、不读 DSH 的凭据文件。
83
+
84
+ ---
85
+
86
+ ## 依赖说明
87
+
88
+ `peerDependencies` 里的四项由 **DSH 宿主提供**,本包不打包:
89
+
90
+ - `@deepseek-ai/cordis` —— 插件基类与服务容器
91
+ - `@deepseek-ai/dsh` —— 宿主,范围 `^0.2.1-rc.2`
92
+ - `@deepseek-ai/schemastery` —— 配置 schema
93
+ - `react` —— 客户端面板
94
+
95
+ 装上后 `pnpm peers check` 会报这四项 missing。**这是预期行为** ——
96
+ 它们由宿主在运行时提供,profile 里本来就不该有。判断标准是插件能不能加载,
97
+ 而不是这条警告在不在。
98
+
99
+ ---
100
+
101
+ ## 状态
102
+
103
+ 早期版本(0.1.x)。协议无版本协商字段,**请与网关保持同版本**。
104
+
105
+ 完整部署步骤见主仓库 README。许可证见 LICENSE。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ntdgy/dsh-remote-bridge-plugin",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "DSH host-side plugin: outbound registration and narrow RPC server",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -46,16 +46,18 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@ntdgy/dsh-remote-proto": "^0.1.0",
49
- "@deepseek-ai/schemastery": "^3.18.5",
50
49
  "ws": "^8.18.0"
51
50
  },
52
51
  "devDependencies": {
53
52
  "@deepseek-ai/cordis": "^4.0.5",
53
+ "@deepseek-ai/schemastery": "^3.18.5",
54
54
  "@types/node": "^22.19.0",
55
55
  "@types/ws": "^8.5.13"
56
56
  },
57
57
  "peerDependencies": {
58
+ "@deepseek-ai/cordis": "^4.0.5",
58
59
  "@deepseek-ai/dsh": "^0.2.1-rc.2",
60
+ "@deepseek-ai/schemastery": "^3.18.5",
59
61
  "react": "^18.2.0"
60
62
  },
61
63
  "peerDependenciesMeta": {
@@ -66,5 +68,18 @@
66
68
  "engines": {
67
69
  "node": ">=20.11.0",
68
70
  "dsh": "^0.2.1-rc.2"
69
- }
71
+ },
72
+ "license": "MIT",
73
+ "repository": {
74
+ "type": "git",
75
+ "url": "https://cnb.cool/ntdgy.top/dsh-remote.git",
76
+ "directory": "packages/bridge-plugin"
77
+ },
78
+ "keywords": [
79
+ "dsh",
80
+ "remote",
81
+ "gateway",
82
+ "websocket",
83
+ "tunnel-free"
84
+ ]
70
85
  }