@linxin666/dsh-ssh 0.1.1
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.md +75 -0
- package/cordis.patch.yml +12 -0
- package/lib/client.js +15638 -0
- package/lib/index.js +3297 -0
- package/lib/invariant.js +6 -0
- package/lib/types/client/api.d.ts +72 -0
- package/lib/types/client/index.d.ts +37 -0
- package/lib/types/client/locales.d.ts +137 -0
- package/lib/types/client/mount.d.ts +12 -0
- package/lib/types/client/panel/ClusterTab.d.ts +7 -0
- package/lib/types/client/panel/HostFormDialog.d.ts +12 -0
- package/lib/types/client/panel/HostsTab.d.ts +9 -0
- package/lib/types/client/panel/SshPanel.d.ts +13 -0
- package/lib/types/client/panel/TerminalTab.d.ts +11 -0
- package/lib/types/client/panel/TransferTab.d.ts +7 -0
- package/lib/types/client/panel/TunnelsTab.d.ts +7 -0
- package/lib/types/client/panel/controller.d.ts +22 -0
- package/lib/types/client/panel/helpers.d.ts +14 -0
- package/lib/types/client/panel/xterm.css.d.ts +2 -0
- package/lib/types/client/sidebar-entry.d.ts +24 -0
- package/lib/types/engine.d.ts +135 -0
- package/lib/types/index.d.ts +40 -0
- package/lib/types/invariant.d.ts +3 -0
- package/lib/types/protocol.d.ts +189 -0
- package/lib/types/routes.d.ts +29 -0
- package/lib/types/store.d.ts +54 -0
- package/lib/types/tools.d.ts +18 -0
- package/package.json +106 -0
- package/src/client/api.ts +363 -0
- package/src/client/css-modules.d.ts +5 -0
- package/src/client/index.ts +68 -0
- package/src/client/locales.ts +284 -0
- package/src/client/mount.tsx +83 -0
- package/src/client/panel/ClusterTab.tsx +123 -0
- package/src/client/panel/HostFormDialog.tsx +221 -0
- package/src/client/panel/HostsTab.tsx +166 -0
- package/src/client/panel/SshPanel.tsx +77 -0
- package/src/client/panel/TerminalTab.tsx +176 -0
- package/src/client/panel/TransferTab.tsx +232 -0
- package/src/client/panel/TunnelsTab.tsx +177 -0
- package/src/client/panel/controller.ts +48 -0
- package/src/client/panel/helpers.ts +26 -0
- package/src/client/panel/panel.module.css +833 -0
- package/src/client/panel/xterm.css.ts +2 -0
- package/src/client/sidebar-entry.ts +123 -0
- package/src/engine.ts +780 -0
- package/src/index.ts +155 -0
- package/src/invariant.ts +4 -0
- package/src/protocol.ts +188 -0
- package/src/routes.ts +540 -0
- package/src/store.ts +344 -0
- package/src/tools.ts +371 -0
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# dsh-ssh — 远程 SSH 运维插件(DSH 版 ssh-skill)
|
|
2
|
+
|
|
3
|
+
基于 [badseal/ssh-skill](https://github.com/badseal/ssh-skill) 的能力清单,为
|
|
4
|
+
DeepSeek Harness(DSH)定制的远程 SSH 插件:Host 进程内的持久连接池 + Web GUI
|
|
5
|
+
主机管理面板 + Web 终端 + Agent 工具,全部通过官方 NPM SDK 实现,不修改 DSH
|
|
6
|
+
源码。
|
|
7
|
+
|
|
8
|
+
## 能力
|
|
9
|
+
|
|
10
|
+
| 能力 | 说明 |
|
|
11
|
+
| --- | --- |
|
|
12
|
+
| 主机管理 | 增删改查、搜索、连接测试;配置存 `~/.dsh/dsh-ssh.json`;支持密钥 / 密码认证、passphrase 密钥、ProxyJump 跳板机(多级) |
|
|
13
|
+
| 配置导入 | 一键解析标准 `~/.ssh/config`(Host/HostName/User/Port/IdentityFile/ProxyJump 等),已有别名自动跳过 |
|
|
14
|
+
| 持久连接池 | 每台主机复用长连接(对应 ssh-skill 的守护进程),空闲 30 分钟自动断开,断线自动重连(最多 3 次) |
|
|
15
|
+
| 命令执行 | exec 带超时(默认 60s),stdout/stderr 分离,输出截断保护(2MB) |
|
|
16
|
+
| Web 终端 | xterm.js + WebSocket PTY 终端,自适应尺寸,实时输出 |
|
|
17
|
+
| 文件传输 | SFTP 上传(浏览器选文件,NDJSON 进度流)、下载(进度条 + 浏览器保存);远程目录浏览 |
|
|
18
|
+
| 端口转发 | 本地端口转发隧道(仅监听 127.0.0.1),访问远程数据库 / 内网服务,支持列表 / 停止 |
|
|
19
|
+
| 集群执行 | 一条命令并发跑多台主机(按别名 / 环境 / 标签过滤,默认并发 8) |
|
|
20
|
+
| Agent 工具 | `ssh_list` / `ssh_exec` / `ssh_upload` / `ssh_download` / `ssh_tunnel` / `ssh_cluster`,GUI 与 Agent 共享同一份主机配置 |
|
|
21
|
+
|
|
22
|
+
## 安全模型
|
|
23
|
+
|
|
24
|
+
- 所有 `/api/dsh-ssh/*` 路由仅限 loopback 访问(含同源校验)——对远程服务器执行
|
|
25
|
+
命令的接口不会暴露给局域网。
|
|
26
|
+
- 密码 / 密钥口令以明文保存在 `~/.dsh/dsh-ssh.json`,文件权限 0600、目录 0700
|
|
27
|
+
(与 ssh-skill 把密码写进 ssh-config 注释同一信任模型)。
|
|
28
|
+
- 隧道只监听 `127.0.0.1`。
|
|
29
|
+
- Agent 使用工具前,主机需先在 GUI 中配置(或从 ~/.ssh/config 导入)。
|
|
30
|
+
- `ssh_upload` / `ssh_download` 以宿主进程权限直接读写本机任意路径(不经 bash
|
|
31
|
+
沙箱)——与 ssh-skill 的宿主本地路径语义一致,注意该权限面。
|
|
32
|
+
- exec / cluster 的远程输出原样返回(不脱敏),命令如 `env` 可能把远端环境中的
|
|
33
|
+
密钥带回对话记录。
|
|
34
|
+
|
|
35
|
+
## 安装
|
|
36
|
+
|
|
37
|
+
推荐直接安装全家桶聚合包 `@linxin666/dsh-web-ui-all`(一个包装齐全部功能插件与皮肤),或单独安装本插件:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
# 当前(插件尚未发布到 npm):克隆全家桶仓库后安装
|
|
41
|
+
git clone https://github.com/zhu1090093659/dsh-web-ui.git
|
|
42
|
+
cd dsh-web-ui
|
|
43
|
+
pnpm install && pnpm -r build
|
|
44
|
+
dsh plugin --profile web add link:$(pwd)/packages/dsh-ssh
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
安装后**重启 `dsh web`**:侧边栏出现「SSH」入口;Agent 提示词中自动出现插件说明。
|
|
49
|
+
|
|
50
|
+
## 配置
|
|
51
|
+
|
|
52
|
+
设置面板(插件配置)可开关 `announceToAgent`(是否向 Agent 宣告插件)与
|
|
53
|
+
`enabled`(总开关)。
|
|
54
|
+
|
|
55
|
+
## 数据
|
|
56
|
+
|
|
57
|
+
- 主机配置:`~/.dsh/dsh-ssh.json`(版本化 JSON,原子写入)
|
|
58
|
+
- 传输暂存:`os.tmpdir()/dsh-ssh-uploads/`
|
|
59
|
+
|
|
60
|
+
## 开发
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
pnpm install --filter @linxin666/dsh-ssh...
|
|
64
|
+
pnpm --filter @linxin666/dsh-ssh test # 单测:store + 引擎(内嵌 ssh2 Server + 真实 sshd)
|
|
65
|
+
pnpm --filter @linxin666/dsh-ssh build # tsc 类型 + tsdown 双半区产物
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 已知限制
|
|
69
|
+
|
|
70
|
+
- 上传的远程目标路径必须是绝对路径(相对路径会被拒绝)。
|
|
71
|
+
- 下载暂不支持整个目录(逐文件下载);上传支持目录递归(walk 本地目录逐文件传)。
|
|
72
|
+
- exec 断线自动重连(最多 3 次)可能重复执行非幂等命令——长命令注意副作用。
|
|
73
|
+
- 跳板机 ProxyJump 的每一跳必须是本插件已配置的主机别名。
|
|
74
|
+
- 断点续传(resume)暂未实现。
|
|
75
|
+
- Agent 工具的传输为宿主机器本地路径(与 ssh-skill 相同的语义)。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# dsh-ssh bundle patch: inserts the dual-face plugin row into the web
|
|
2
|
+
# profile roster. Applied as a profile bundle layer (the `dsh.bundle.patch`
|
|
3
|
+
# manifest field) over dsh-base; activate with
|
|
4
|
+
# `dsh plugin --profile <name> add link:~/code/dsh-web-ui/packages/dsh-ssh`.
|
|
5
|
+
#
|
|
6
|
+
# The row is a bare plugin by package name: the node half (exports ".") runs
|
|
7
|
+
# in the host process (SSH engine, /api/dsh-ssh routes, agent tools), and the
|
|
8
|
+
# `dsh.client` declaration in package.json makes the browser half
|
|
9
|
+
# (exports "./client", served at /plugins/<id>/client.js) load in the web GUI.
|
|
10
|
+
- insert:
|
|
11
|
+
- id: ssh
|
|
12
|
+
name: '@linxin666/dsh-ssh'
|