@duke-dsh-plugins/dsh-remote-control 0.0.0-stage → 1.1.3
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/LICENSE +21 -0
- package/README.md +88 -3
- package/client.js +747 -0
- package/cordis.patch.yml +12 -0
- package/icon.svg +20 -0
- package/index.js +731 -0
- package/lib/config.mjs +270 -0
- package/lib/host-bridge.mjs +2848 -0
- package/lib/images.mjs +458 -0
- package/lib/pairing.mjs +266 -0
- package/lib/protocol.mjs +390 -0
- package/lib/push.mjs +229 -0
- package/lib/qr.mjs +439 -0
- package/lib/relay-client.mjs +741 -0
- package/lib/relay-supervisor.mjs +798 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +75 -6
- package/typert.host.js +243 -0
- package/vendor/relay/server.js +777 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Duke / dsh-remote-control 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
CHANGED
|
@@ -1,3 +1,88 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# plugin —— DSH 插件(Host 侧半边)
|
|
2
|
+
|
|
3
|
+
用 HarmonyOS 手机远程控制 DeepSeek Harness 的 DSH 插件:会话遥控、审批/提问应答、推送通知。
|
|
4
|
+
|
|
5
|
+
架构与安全模型见仓库根 [README](../README.md);线协议见 [docs/PROTOCOL.md](../docs/PROTOCOL.md)(v1.0.2)。
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
dsh plugin add <本目录> # 或 DSH 的 plugin_manager install_bundle(target 指向本目录)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 配对(一次性)
|
|
14
|
+
|
|
15
|
+
1. 插件首次启用会在 `%DSH_HOME%/remote-control/config.json`(默认 `~/.dsh`)生成配对信息:
|
|
16
|
+
- `channel`:16 位 base32(`^[A-Z2-7]{16,64}$`)
|
|
17
|
+
- `secret`:E2E 密钥材料(**不要**发给中继或任何第三方)
|
|
18
|
+
2. 在 `config.json` 里填写 `relayUrl`(如 `ws://192.168.3.2:8787` 或 `wss://relay.example.com/`),
|
|
19
|
+
需要中继鉴权时填 `relayToken`(对应中继的 `RELAY_TOKEN`)。
|
|
20
|
+
3. 手机 App([../app](../app/))配对页输入同样的 `relayUrl / channel / secret`,连接即配对。
|
|
21
|
+
|
|
22
|
+
> 修改 `config.json` 后如插件未即时生效,用 plugin_manager 把本插件 disable→enable,
|
|
23
|
+
> 或 remove 后重新 install(link 安装指向本目录,磁盘即最新源码)。
|
|
24
|
+
|
|
25
|
+
## 扫码配对(§3.5,v1.0.3)
|
|
26
|
+
|
|
27
|
+
除手动输入外,可用会话命令 `/remote-pairing` 生成**配对二维码**(协议
|
|
28
|
+
[docs/PROTOCOL.md](../docs/PROTOCOL.md) §3.5):手机 App 配对页「扫码」直接填入
|
|
29
|
+
`relayUrl / channel / secret`,免手抄。
|
|
30
|
+
|
|
31
|
+
| 命令 | 作用 |
|
|
32
|
+
|---|---|
|
|
33
|
+
| `/remote-pairing` | 显示配对二维码(ASCII,会话窗口直接扫)+ 配对 URI(可复制兜底)+ 使用说明;同时写 `%DSH_HOME%/remote-control/pairing.svg` 并尝试用系统默认程序打开 |
|
|
34
|
+
| `/remote-pairing rotate` | 重新生成 channel+secret → 落盘 → 中继链路立即以新配对信息重连;**旧二维码/旧口述即刻失效** |
|
|
35
|
+
| `/remote-pairing hide` | 删除本机 `pairing.svg` 文件(不在屏幕上留图) |
|
|
36
|
+
|
|
37
|
+
编码细节(可由手机端实现者对照):URI 形如
|
|
38
|
+
`dshrc://pair?r=<encodeURIComponent(relayUrl)>&c=<channel>&s=<secret>[&t=<encodeURIComponent(relayToken)>]`,
|
|
39
|
+
二维码为 byte 模式、纠错级 M、版本自适应 1–10(内嵌零依赖编码器,`lib/qr.mjs`)。
|
|
40
|
+
|
|
41
|
+
> ⚠️ **安全提示(§3.5)**:二维码/URI 含 secret 明文(与口述同级信任域)——只在受信任
|
|
42
|
+
> 屏幕上展示;不需要时用 `rotate`(换 secret 作废旧码)或 `hide`(删图)清理;
|
|
43
|
+
> 插件日志对 URI 做脱敏(`s=***`/`t=***`),不落明文。
|
|
44
|
+
|
|
45
|
+
## 配置项(config.json)
|
|
46
|
+
|
|
47
|
+
| 键 | 默认 | 说明 |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| `enabled` | `true` | 总开关;false 时不连中继、不拦截任何请求 |
|
|
50
|
+
| `relayUrl` | `""` | 中继地址;空 = 空转待配对 |
|
|
51
|
+
| `relayToken` | `""` | 中继自身鉴权 token(可选) |
|
|
52
|
+
| `channel` / `secret` | 首启生成 | 配对信息 |
|
|
53
|
+
| `interceptApprovals` | `true` | 手机在线时代理审批请求 |
|
|
54
|
+
| `interceptQuestions` | `true` | 手机在线时代理用户提问 |
|
|
55
|
+
| `approvalTimeoutMs` | `120000` | 手机应答超时(钳制 10s–600s);**超时一律放行给桌面答案器** |
|
|
56
|
+
| `push.*` | 关闭 | Push Kit(`appId` / `clientId` / `clientSecret` / `channelId` / `topic` / `notifyTurnEnd`) |
|
|
57
|
+
|
|
58
|
+
## 目录
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
index.js Cordis 插件入口(KAT→配置→/remote-pairing→装配→清理)
|
|
62
|
+
lib/protocol.mjs 信封 + HKDF/AES-GCM + assertKat
|
|
63
|
+
lib/config.mjs config.json 读写(首启生成 channel/secret)
|
|
64
|
+
lib/relay-client.mjs 中继客户端(重连退避/心跳/sid:seq 去重/reload 热更换)
|
|
65
|
+
lib/host-bridge.mjs Host 服务桥接(sessionController + 事件 + 审批/提问瀑布)
|
|
66
|
+
lib/pairing.mjs 配对 URI(§3.5)+ SVG 落盘/打开/隐藏 + /remote-pairing 命令
|
|
67
|
+
lib/qr.mjs 内嵌 QR 编码器(byte/ECC-M/版本 1–10,零运行时依赖)
|
|
68
|
+
lib/push.mjs Push Kit REST 发送
|
|
69
|
+
scripts/smoke-link.mjs 链路冒烟
|
|
70
|
+
scripts/verify-qr.mjs QR 正确性自检(jsqr 独立解码 + 矩阵级 RS 自检;devDependencies)
|
|
71
|
+
scripts/verify-pairing.mjs /remote-pairing 命令逻辑自检(mock ctx;devDependencies)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 安装(npm 分发,v1.1.3 起)
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# DSH 插件管理器(推荐):会解析 peerDependencies 并做兼容性 gate
|
|
78
|
+
plugin_manager install @duke-dsh-plugins/dsh-remote-control
|
|
79
|
+
|
|
80
|
+
# 或直接 link 安装(本地开发)
|
|
81
|
+
plugin_manager install_bundle /path/to/this/repo/plugin
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
装好后到 DSH「设置 → DSH Pocket」分区填中继地址、扫码配对。中继进程会由插件
|
|
85
|
+
自动托管(`relayUrl` 指向本机时);VPS 部署请另装
|
|
86
|
+
[`@duke-dsh-plugins/dsh-remote-control-relay`](../relay/README.md)。
|
|
87
|
+
协议契约见 [`docs/PROTOCOL.md`](../docs/PROTOCOL.md)(v1.1.3:端到端加密 +
|
|
88
|
+
会话纪元抗重放 + 可选中继 TLS)。
|