dsh-shells: Providing Agents with Cross-Platform Persistent Background Shell

Introduction

Running commands with Agents in DeepSeek Harness (DSH) typically follows the official terminal toolchain: opening sessions, sending stdin, reading output, sending signals, closing, and listing. On POSIX systems, an official bash backend already exists; on Windows, environments such as cmd, Git Bash, and pwsh are required. Furthermore, for long-running tasks, it is often desirable for the shell to persist in the background rather than spawning a new process for every tool call.

dsh-shells is a client-side plugin that builds upon the composition and extension of the six official @deepseek-ai/dsh-tool-terminal tools. It registers multiple shell backends for the Agent and provides a read-only PTY stream panel in the DSH Web interface sidebar, facilitating the comparison of output visible to the model.

What is this

  • Name: dsh-shells (GitHub: liu-zhengdong/dsh-shells)
  • Maintainer: liu-zhengdong
  • Category: Client (Web Injection Sidebar & Remote)
  • Current Version (package.json): 0.1.3, License: MIT

The plugin does not re-implement the PTY session mechanism; instead, it reuses the official BashTerminalBackend (handling readiness, scrollback, sanitization, read paging, etc.). It only modifies the environment or discovers executable paths via spawnTerminal. On the model side, it continues to use official tool names and parameter formats such as terminal_open, terminal_send, and terminal_read.

Core Features

Model Surface

Aligned with the official @deepseek-ai/dsh-tool-terminal, the Agent has access to six tools: terminal_open, terminal_send, terminal_read, terminal_signal, terminal_close, and terminal_list. This plugin is responsible for mounting multiple shell types at the backend layer.

Shell Backends

Environment Type Description
POSIX bash Official dsh-terminal-bash, with backendType set to shell
POSIX zsh Registered by this plugin; injects prompt markers via PS1, uses -f to skip rc files and prevent overwriting
Windows cmd Injects the same markers via the PROMPT environment variable
Windows gitbash Auto-discovers git-bash.exe
Windows pwsh Official dialect; registers a stub backend with a clear error message if the path is not found

The README notes: Windows backends cannot be verified on the maintainer’s local machine and are considered experimental features.

The client injects slots such as sidebarRight / sidebarRightTabs via Cordis to provide the “Background Shell” panel:

  • Read-only following of the PTY stream for the current Agent session (consistent with what the model sees, sanitized plain text).
  • Remote namespace dshShellsPanel (list / attach stream), filtering terminals for the current session by record.owner.session.id.
  • Approximately 300ms polling with non-destructive read().

The composition layer (cordis.patch.yml) mounts: dsh-terminal + dsh-terminal-bash + @deepseek-ai/dsh-tool-terminal + dsh-shells.

Installation and Activation

The package publishes JS directly from the src/ directory without requiring a build step. Installation commands follow the README:

# From GitHub
dsh plugin --profile <profile> add github:liu-zhengdong/dsh-shells

For local development, you can point to the checkout directory:

dsh plugin --profile <profile> add /abs/path/to/dsh-shells

Dependencies include @deepseek-ai/dsh-tool-terminal, @deepseek-ai/dsh-terminal, @deepseek-ai/dsh-terminal-bash (all 0.2.1-rc.2), and @deepseek-ai/schemastery (approx. ~3.18.4). If you encounter a failed to import error after installation, the README suggests checking if @deepseek-ai/schemastery is installed—in profiles with autoInstallPeers: false, it may not be installed automatically if declared as a peer dependency.

Typical Usage (Agent Side)

Example of opening a zsh session, sending a command, and reading output (from the README):

terminal_open { "type": "zsh", "name": "watcher", "cwd": "/tmp" }
terminal_send { "id": "...", "stdin": "htop\n", "wait": "stdin_read" }
terminal_read { "id": "..." }

Replace "type" with a registered backend (e.g., cmd, gitbash, pwsh, etc., subject to actual registration in the current environment). The id returned by terminal_open should be filled into subsequent calls.

Use Cases and Notes

Suitable for: Developers who need to use zsh or various Windows shells within DSH Agent workflows, desire persistent background sessions, and wish to view PTY output alongside in the UI.

Notes:

  1. The plugin runs with the same permissions as the DSH process; review the source code and MIT license before installation to ensure compliance with your security policy.
  2. Windows backends are marked as experimental; test them on the target machine before using in production.
  3. The DSH ecosystem philosophy is “Everything is a plugin”; the community directory SkillHub Plugin Page is an independent site and has no official affiliation with DeepSeek or High-Flyer.

Conclusion

dsh-shells combines the official terminal toolchain with multiple shell backends and sidebar PTY monitoring, reducing glue code for cross-platform shell scenarios in Agents. For more information, visit the SkillHub Directory Page and the GitHub Repository.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye