dsh-ssh-workspace: Treat SSH Host Directory as DSH Workspace

Introduction

In DSH, agent development typically relies on local workspaces for file I/O, shell access, searching, and change tracking. When code and build environments are located on remote Linux servers or cloud hosts, common workflows involve rsync/scp synchronization, network drive mounting, or SSHing into the machine to open a separate editor. These approaches either introduce a synchronization step or depend on third-party file systems, making it difficult to extend DSH’s read / write / edit and sandbox semantics directly to remote directories.

The following introduces the community plugin dsh-ssh-workspace (Maintainer: siqyka, GitHub: siqyka/dsh-ssh-workspace). It adds a “remote half” to DSH’s ctx.fs (@deepseek-ai/dsh-fs) abstraction: enabling reading and writing of remote files via SFTP, while executing shell commands, ripgrep, and git on the remote host. This eliminates the need for manual synchronization, mount drivers, or third-party file systems. The plugin is categorized as a “Networking Tool” in the SkillHub directory.

What is this

dsh-ssh-workspace registers a directory on an SSH host as a DSH workspace. The workspace path syntax is:

ssh://<host-alias>/<remote-absolute-path>
e.g.,  ssh://myserver/home/user/project

In the UI, paths of this type are displayed as ssh://<host-alias>@/<remote-absolute-path> (an @ is inserted after the alias) for readability; however, copying, mounting, file operations, and tool calls still use the actual syntax ssh://<host-alias>/<remote-absolute-path>.

The DSH tool layer (read / write / edit / bash / glob / grep, change panel, etc.) routes through ctx.fs: paths with the ssh:// prefix use this plugin’s SFTP backend, while other paths continue to use the deployment’s existing local (sandbox) backend. Behaviors such as sandbox write restrictions, version guards, and atomic writes for local workspaces remain unchanged; remote workspaces utilize the same set of tools and error semantics.

Core Features

Direct SFTP and File Semantics

  • read / write / edit operate entirely via SFTP, supporting full error semantics (e.g., FS_STALE_VERSION, FS_NOT_OBSERVED, FS_AMBIGUOUS_EDIT, FS_NOT_FOUND, etc.).
  • Atomic writes: Writes to a staging file in the same directory first, then replace; prefers posix-rename@openssh.com, falling back to delete-then-rename if unsupported.
  • Remote writes are restricted to within the mounted remote workspace; out-of-bounds attempts return FS_OUTSIDE_WORKSPACE. “View-only” mode blocks remote writes (FS_SANDBOX_DENIED). Reads are not restricted.
  • Large files are read in streaming chunks of 256 KiB; remote directory changes are prioritized via inotifywait push notifications, with polling as a fallback if not installed.

Remote Execution

  • When the session workspace is ssh://, pwsh / bash execute on the remote machine with POSIX shell semantics; glob / grep invoke rg on the remote host (failing explicitly with exit code 127 if not installed).
  • The “Changes” panel uses remote git for snapshots and diffs; if git is not installed on the remote, this feature automatically disables without affecting other functions.

UI and Agent Tools

The sidebar provides a file tree, @ remote file references, drag-and-drop into tasks, a host management panel, a directory browsing dialog, and upload/download capabilities. After restarting the client, registered remote workspaces are automatically remounted from the persistent registry.

Tools exposed to the Agent by the plugin include (see docs/tools.md for full parameters):

Tool Purpose
ssh_workspace_hosts List available hosts
ssh_workspace_mount / unmount / enable Mount, disable, or re-enable remote workspaces
ssh_workspace_status Mount list and connection status
ssh_workspace_exec / shell Execute commands remotely (shell can retain state across calls)
ssh_workspace_transfer Transfer files between local and remote via SFTP
ssh_workspace_forward / unforward Port forwarding

Installation and Activation

Environment requirements (see repository README and package.json): Node >= 20, DSH >= 0.2.0-rc.1, dependency ssh2 ^1.17.0; License: MIT.

  1. Open the official DSH desktop client and go to the “Plugins” page in “Settings” (or the plugin entry in the left navigation bar).
  2. In the plugin management interface, choose one of the following in the installation input box and click Install:
    - npm Package (supports version locking):
     @shiqyka/dsh-ssh-workspace
 Or specify a version, e.g.:
     @shiqyka/dsh-ssh-workspace@0.2.6
  • Repository URL:
     https://github.com/siqyka/dsh-ssh-workspace
  1. Restart the client after installation is complete.

Plugin configuration options (defaults are usually sufficient):

Field Default Meaning
enabled true Master switch
announceToAgent false Whether to inject capability descriptions to the agent
engine.idleTimeoutMs 1800000 Connection idle timeout (milliseconds)
engine.connectTimeoutMs 15000 SSH handshake timeout
engine.keepaliveIntervalMs 15000 Keepalive interval
engine.sweepIntervalMs 60000 Idle connection scan interval

Typical Usage

Following the installation and restart steps above, you can use it as follows:

  1. Confirm or add hosts in the “Remote Workspaces” panel (add here if using for the first time).
  2. Select “Add Workspace → New Remote Workspace”, choose the host, browse the remote directory, and mount it.
  3. Create a session in this workspace; file I/O, shell, search, and change tracking will automatically target the remote machine.

Host records are stored in $DSH_HOME/dsh-ssh.json by default; if this file does not exist, it falls back to reading specific Host blocks from ~/.ssh/config in read-only mode, so pre-configured SSH hosts usually do not need to be re-entered. Passwords and private key passphrases are encrypted and stored in the secrets section of dsh-ssh.json and are not transmitted back to the browser.

Each host alias maintains a persistent connection (keep-alive SFTP channel); idle connections are reclaimed after approximately 30 minutes. On the first connection, the host key fingerprint is recorded using TOFU (Trust On First Use); if the fingerprint changes, the connection is refused, and you can re-trust it via “Forget Host Key” in the panel.

Use Cases and Caveats

Suitable for: Users who separate their development machine from the runtime environment, need to directly modify remote projects within DSH, run builds/tests/git diffs remotely, and do not want to maintain synchronization scripts or FUSE mounts.

Explicit Limitations (see README “Limitations”):

  • Jump hosts / ProxyCommand not supported: The engine connects directly to the target host only; hosts with proxyJump / ProxyCommand will be rejected during parsing with an explanation.
  • When the session workspace is ssh://, the shell runs on the remote with the login user’s permissions and is not subject to local file sandbox constraints; commands in the local workdir remain within the local sandbox.

DSH community plugins are published independently by their maintainers; the SkillHub directory page (dsh-ssh-workspace) and the GitHub repository are not official DeepSeek / High-Flyer application stores. Before installation, it is recommended to review the source code and MIT license, confirm that the plugin runs with the current DSH process permissions, and ensure that the host credential storage strategy meets your security requirements.

Links

  • Directory Page: https://www.skillhub.cn/plugins/siqyka/dsh-ssh-workspace
  • Repository: https://github.com/siqyka/dsh-ssh-workspace
  • npm: https://www.npmjs.com/package/@shiqyka/dsh-ssh-workspace
羽毛球分组比赛记分
小程序二维码

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

Xiaoye