Char0nChengg/dsh-remote-suite ↗★ 1
@char0nchengg/dsh-remote-suite
Remote shell, file, and transfer tools for DeepSeek Harness over local OpenSSH or WSL, with chat-editable per-server environment notes; no agent on the server and no outbound connection from the server.
설치
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Char0nChengg/dsh-remote-suite快速使用
不需要记工具名,直接在聊天里说:
列出 myserver 上 ~/project 的文件
读一下 myserver 上 ~/project/run.log 最后 100 行
把 myserver 上的 submit.sh 下载到 D:\results
在 myserver 的 ~/project 下提交 sbatch submit.sh
在 WSL Ubuntu 里看一下当前目录
如果服务器已经在 ~/.ssh/config 里有别名,可以直接用 ssh:,不需要改插件配置:
Host myserver
HostName server.example.edu
User Username
IdentityFile C:\Users\Username\.ssh\id_ed25519
IdentitiesOnly yes
remote_targets({ "check": true })
remote_exec({ "target": "ssh:myserver", "command": "hostname; pwd" })
remote_targets 会列出已配置目标和 ~/.ssh/config 里的 Host 别名(不会主动连接它们)。
配置服务器与环境提示
配置服务器有两种方式:直接在聊天里用 remote_config 改,或者手动编辑 profile 的 cordis.patch.yml。
在 DSH 里直接改(推荐)
remote_config 会把修改写入当前 profile 的 patch,并通过 Loader 立即生效,通常不需要重启 DSH:
看看远程插件的配置
把 wsl-ubuntu 的环境说明改成:默认用户,已装 conda
给 myserver 加上环境:module load intel/2022;conda activate example-env
把 myserver 的 conda 环境改成 example-env-v2
删除 myserver 这个目标
把全局远程提示改成:登录节点不要跑重计算,优先 sbatch
对应操作:
| 你说的话 | 实际动作 |
|---|---|
| 看看配置 | remote_config({ action: "show" }) |
| 改某个服务器的环境说明 | set_environment,只改 environment,不影响其他字段 |
| 新增/整体替换服务器 | upsert_target,传入完整 target |
| 删除服务器 | remove_target |
| 改全局提示 | set_prompt |
set_environment 适合只改 module/conda/Slurm 说明;新增服务器时 upsert_target 需要完整字段(id、transport,SSH 还需要 host 等)。改完会立即更新系统提示,下一次请求就能看到新的环境说明。
手动编辑 YAML
在 profile 的 cordis.patch.yml 追加/覆盖 dsh-remote-suite 这一行。config 会整体替换,所以需要把想保留的 WSL 目标一起写上。完整示例见 targets.example.yml。
- id: dsh-remote-suite
name: '@char0nchengg/dsh-remote-suite'
config:
# 可选:所有目标共享的使用习惯
prompt: |
不要在登录节点跑重计算;优先用 sbatch 提交。
读日志优先用 remote_read 的 tail/range,不要整文件 cat。
targets:
- id: wsl-ubuntu
label: WSL Ubuntu
transport: wsl
distro: Ubuntu
defaultCwd: "~"
environment: |
Local WSL distro; no sshd required. Use the distro's default user.
- id: myserver
label: 示例登录节点
transport: ssh
host: myserver # 复用 ~/.ssh/config 的 Host 别名
defaultCwd: /home/Username/project
environment: |
- Slurm 登录节点,批处理分区常用 `fat`,示例脚本 32 核。
- `module load intel/2022 netcdf/4.7.4`
- Conda:`conda activate example-env`。
- 项目数据在 `/home/Username/project`,临时目录在 `/scratch/$USER`。
- 不要在登录节点跑长时间计算;用 `sbatch` 提交后读 `.out` / `.err`。
environment 也可以写成字符串数组:
environment:
- "module load intel/2022 netcdf/4.7.4"
- "conda activate example-env"
预加载提示词是怎么工作的
当配置里存在 prompt 或任一 targets[].environment 时,插件会在 system prompt 中注册一段 dsh-remote-suite:targets 上下文。模型在每次请求开始前就能看到这些环境说明,不必先调用 remote_targets。
- 只注入配置里的文字,不会自动执行
module load、conda activate或任何命令; - 它只是提示,环境变化后模型仍应用
remote_exec验证; - 每个目标的
environment最多 4000 字符,整段提示最多 6000 字符; remote_targets也会显示同样的环境说明,方便核对;- 不要把密码、token、私钥内容写进
environment,它会进入模型上下文和会话记录。
配置字段
| 字段 | 说明 |
|---|---|
prompt | 可选,所有目标共享的预加载说明 |
targets[].id | 工具里使用的目标 id,唯一 |
targets[].label | 显示名称 |
targets[].transport | ssh 或 wsl |
targets[].host | SSH 主机名、IP 或 ~/.ssh/config 别名 |
targets[].user / port | 可选;不填则沿用 ssh config |
targets[].identityFile | 私钥路径,支持 ~ |
targets[].proxyJump | 可选,对应 ssh -J |
targets[].sshOptions | 追加的 -o 选项数组 |
targets[].distro | WSL 发行版名;省略表示默认发行版 |
targets[].defaultCwd | 远端默认工作目录;~ 或绝对路径 |
targets[].environment | 该服务器的环境说明,字符串或字符串数组 |
strictHostKeyChecking | accept-new(默认)/ yes / no / ask |
connectTimeoutSec | SSH 连接超时,默认 10 秒 |
defaultTimeoutMs | remote_exec 默认远端超时,默认 120000 |
transferTimeoutMs | 单次上传/下载超时,默认 1800000(30 分钟) |
maxOutputBytes | remote_exec 每路输出上限,默认 262144 |
defaultReadBytes | remote_read 默认上限,默认 262144 |
largeFileBytes / previewBytes | auto 模式的大文件阈值 / 预览字节数 |
sshPath / scpPath / wslPath | 可选,覆盖本机客户端路径 |