前言¶
在 DeepSeek Harness(DSH)里让 Agent 跑命令,通常走官方终端工具链:打开会话、发 stdin、读输出、发信号、关闭、列举。POSIX 上官方已有 bash 后端;Windows 上还需要 cmd、Git Bash、pwsh 等环境,且长任务往往希望 shell 在后台持续存在,而不是每次工具调用都起新进程。
dsh-shells 是在官方 @deepseek-ai/dsh-tool-terminal 六工具之上做组合与扩展的客户端插件:为 Agent 注册多种 shell 后端,并在 DSH Web 界面侧边栏提供只读 PTY 流面板,便于对照模型所见输出。
这是什么¶
- 名称:
dsh-shells(GitHub:liu-zhengdong/dsh-shells) - 维护者:liu-zhengdong
- 分类:客户端(Web 注入侧边栏与 Remote)
- 当前版本(package.json):0.1.3,许可证 MIT
插件不重新实现 PTY 会话机,而是复用官方 BashTerminalBackend(readiness、scrollback、sanitizer、read 分页等),仅通过 spawnTerminal 改写环境或发现可执行路径;模型侧仍使用 terminal_open / terminal_send / terminal_read 等官方工具名与参数形态。
核心功能¶
模型面¶
与官方 @deepseek-ai/dsh-tool-terminal 对齐,Agent 可用六工具:terminal_open、terminal_send、terminal_read、terminal_signal、terminal_close、terminal_list。本插件负责在后端层挂载多种 shell 类型。
Shell 后端¶
| 环境 | 类型 | 说明 |
|---|---|---|
| POSIX | bash |
官方 dsh-terminal-bash,backendType 为 shell |
| POSIX | zsh |
本插件注册;通过 PS1 注入 prompt 标记,-f 跳过 rc 防覆盖 |
| Windows | cmd |
通过 PROMPT 环境变量注入同样标记 |
| Windows | gitbash |
自动发现 git-bash.exe |
| Windows | pwsh |
官方 dialect;路径找不到时注册 stub 后端并给出清晰报错 |
README 注明:Windows 后端在维护者本机无法验证,属实验性能力。
侧边栏「后台 Shell」¶
客户端经 Cordis 注入 sidebarRight / sidebarRightTabs 等槽位,提供「后台 Shell」面板:
- 只读跟随当前 Agent 会话的 PTY 流(与模型所见一致,经 sanitizer 清洗后的纯文本)
- Remote 命名空间
dshShellsPanel(list/attachstream),按record.owner.session.id过滤当前会话终端 - 约 300ms 轮询、非破坏式
read()
组合层(cordis.patch.yml)挂载:dsh-terminal + dsh-terminal-bash + @deepseek-ai/dsh-tool-terminal + dsh-shells。
安装与启用¶
包直接发布 src/ 下 JS,无需构建。安装命令以 README 为准:
# 从 GitHub
dsh plugin --profile <profile> add github:liu-zhengdong/dsh-shells
本地开发时可指向 checkout 目录:
dsh plugin --profile <profile> add /abs/path/to/dsh-shells
依赖包括 @deepseek-ai/dsh-tool-terminal、@deepseek-ai/dsh-terminal、@deepseek-ai/dsh-terminal-bash(均为 0.2.1-rc.2)以及 @deepseek-ai/schemastery(约 ~3.18.4)。若安装后报 failed to import,README 建议检查 @deepseek-ai/schemastery 是否已安装——在 autoInstallPeers: false 的 profile 里,若它被声明为 peer 可能不会自动安装。
典型用法(Agent 侧)¶
打开 zsh 会话、发送命令并读取输出示例(来自 README):
terminal_open { "type": "zsh", "name": "watcher", "cwd": "/tmp" }
terminal_send { "id": "...", "stdin": "htop\n", "wait": "stdin_read" }
terminal_read { "id": "..." }
将 "type" 换成已注册的后端(如 cmd、gitbash、pwsh 等,以当前环境实际注册为准),id 由 terminal_open 返回后填入后续调用。
适用场景与注意¶
适合:需要在 DSH Agent 工作流里使用 zsh 或 Windows 多种 shell、并希望后台会话持久、同时在 UI 里对照 PTY 输出的开发者。
注意:
- 插件与 DSH 进程同权限运行;安装前应自行查看源码与 MIT 许可证,确认符合你的安全策略。
- Windows 后端标注为实验性,生产环境使用前应在目标机器上实测。
- DSH 生态理念是「一切皆插件」;社区目录 SkillHub 插件页 为独立站点,与 DeepSeek / 幻方无官方从属关系。
结尾¶
dsh-shells 把官方终端工具链与多 shell 后端、侧边栏 PTY 监视拼在一起,减少 Agent 跨平台 shell 场景的胶水代码。进一步了解可访问 SkillHub 目录页 与 GitHub 仓库。