Skip to main content
S

dsh-remote-ssh-plugin

shangyulei-hit/dsh-remote-ssh-plugin

SSH remote development: a Settings panel adds and tests SSH machines, browses remote directories, and registers remote workspaces where the agent runs commands and edits files through remote_* tools. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.

Install

dsh plugin --profile web add github:shangyulei-hit/dsh-remote-ssh-plugin

README

dsh-remote-ssh-plugin

dsh-plugin license npm selftest

SSH remote development for DeepSeek Harness: manage SSH machines in Settings, browse remote directories over SSH, register real remote Workspaces, and let the agent run commands and edit files on the remote host through a set of typed remote_* tools — while the local shell and file tools keep working on this machine.

中文文档:README.zh.md

Architecture diagram: a local DeepSeek Harness session manages SSH machines and remote workspaces, then talks to a Linux host over an encrypted SSH channel; the agent runs commands and edits files there through the remote tools

The picture above is the whole model in one glance: the local DSH session manages machines and workspaces in Settings, the SSH channel carries commands and file contents, and the remote host holds the project directory your agent works in. Adding a machine and choosing a remote directory registers a workspace named SSH · machine · path; a session opened there sends the remote_* tools to that directory while the local shell and file tools stay on this Mac.

Features

  • Visual machine management in Settings → SSH remote development: add, edit, test and remove machines; connection pills, "Test all", auto-probe on open.
  • Remote directory browser over SSH: breadcrumbs, home/root/up, typed path, hidden directories, inline folder creation, explicit selection.
  • Remote Workspaces: choosing a machine directory registers a DSH workspace (SSH · machine · path) that appears in the new-session workspace list. Sessions opened there are bound to that remote directory; there the remote_* tools default to it and the local bash/read/write/edit/glob/grep tools are hidden.
  • Multiplexed SSH transport with ControlMaster/ControlPersist, bounded output, cooperative cancellation and per-call timeouts.
  • Bilingual UI (English/中文), host theme tokens, keyboard-accessible dialogs.
  • No DSH package imports: the bundle loads on any 0.2.2 host without dependency resolution tricks.

Agent tools

ToolPurpose
remote_statusProbe a machine: user, hostname, OS, directory, latency, toolchain. Lists configured machines.
remote_execRun a command; returns exit code, stdout, stderr, duration, timeout state.
remote_readRead a line window of a remote file plus its total line count.
remote_writeCreate or overwrite a remote file with complete UTF-8 content.
remote_editReplace exact text, refusing ambiguous matches.
remote_grepSearch remote contents with grep (ERE), skipping .git/node_modules.
remote_globList remote files by glob (** via bash globstar).
remote_upload / remote_downloadMove files between this Mac and the remote host.

Every tool accepts an optional host argument (machine id or OpenSSH destination); without it the tool targets the primary machine, or the machine a remote-workspace session is bound to.

Install

In the DSH Web/Desktop GUI: Plugins → Add plugin → enter dsh-remote-ssh-plugin. From a shell with the dsh CLI (web profile; the Desktop profile is managed by the app itself, install through its GUI):

dsh plugin --profile web add dsh-remote-ssh-plugin

From GitHub

Use the GitHub source when you want the repository head:

dsh plugin --profile web add github:ShangyuLei-HIT/dsh-remote-ssh-plugin

From a local checkout

git clone https://github.com/ShangyuLei-HIT/dsh-remote-ssh-plugin.git

Then Plugins → Add plugin → choose the cloned directory (or call the plugin_manager tool with the absolute path). Restart/refresh the GUI once so the settings panel loads.

Custom plugin index

The repository publishes a DSH plugin-market index at plugin-market/index.json. Add its raw URL as an index source (Plugins → Discover → Add index source):

https://raw.githubusercontent.com/ShangyuLei-HIT/dsh-remote-ssh-plugin/main/plugin-market/index.json

Quick start

  1. Make sure the host is reachable non-interactively: key-based login, host key in ~/.ssh/config/known_hosts. Run ssh <host> once if needed.
  2. Open Settings → SSH remote development and add a machine: name + OpenSSH destination (~/.ssh/config alias or user@host), then Browse to a remote directory and Use this directory.
  3. The workspace SSH · machine · path now exists. Create a new session and pick it in the workspace list.
  4. Ask the agent to work there, e.g. Run the tests in /srv/app and show the diff. It uses the remote_* tools with that directory as the default root.
  5. Local sessions are unchanged — remote tools are available there too if you want a one-off command.

How remote Workspaces work

DSH workspaces must name an existing local directory (ctx.workspaceRegistry.create canonicalizes it with fs.realpath), and the built-in fs/shell tools are host-global. So, like other remote-workspace plugins, this bundle uses a local mirror directory as the workspace path and records the binding (mirror → machine + remote path):

  • ~/.dsh/ssh-remote/machines.json — machine registry (GUI-managed, wins over the seed in cordis.patch.yml)
  • ~/.dsh/ssh-remote/workspaces.json — workspace bindings and DSH workspace ids
  • ~/.dsh/ssh-remote/workspaces/<machine>/<path>/ — mirror directory (workspace anchor)

The mirror is not a synced copy: remote access always goes through the remote_* tools.

Configuration

The GUI manages machines; the row configuration only seeds a fresh install. For a manual setup, override the row in your profile patch (~/.dsh/profiles/desktop/cordis.patch.yml):

- id: ssh-remote
  name: dsh-ssh-remote
  config:
    host: gpu-box          # primary OpenSSH destination
    workspace: /data/work  # primary default directory
    hosts:                 # more machines
      - id: prod
        host: root@10.0.0.30
        workspace: /srv/app
    clearForwardings: true
FieldDefaultMeaning
hostssh-hostPrimary OpenSSH destination (alias or user@host); a fresh install uses this placeholder until a machine is added in Settings.
workspace''Primary default remote directory; '' means the login directory.
hosts[]Additional machines: [{ id, host, workspace? }].
sshBinarysshSSH client executable.
remoteShellbashShell for each command.
connectTimeoutSeconds10Connect deadline.
defaultTimeoutMs120000Default per-call deadline.
maxOutputChars60000Per-stream output cap.
maxTransferBytes20000000Upload/download/write cap.
maxEditBytes1500000Largest file remote_edit rewrites.
controlPersistSeconds300Multiplexed connection keep-alive.
clearForwardingstrueIgnore LocalForward/RemoteForward for tool calls.
extraArgs[]Extra ssh options, e.g. ["-i", "/path/key"].

Requirements and security

  • Linux or macOS remote host; non-interactive key auth; host key already trusted.
  • Commands run as your SSH user with no extra approval gate — only configure machines you are willing to let the session modify. The settings API binds to loopback and refuses cross-origin requests.
  • No TTY: interactive programs hang until the call times out.
  • DSH 0.2.2-rc.5 was the tested host; the bundle declares engines.dsh >=0.2.2-0 <0.3.0. Newer hosts may work but are unverified.

Limitations

  • The local file sidebar and @ completion show the empty mirror directory, not the remote tree; there is no remote file editor/terminal/Git panel (install dsh-remote for that IDE-like surface).
  • No remote language server, debugger or port auto-forwarding.
  • Agent instruction files (AGENTS.md) are not fetched from the remote tree.
  • The settings page uses the generic gear icon in the settings navigation.

Development

Plain JavaScript, no build step. Node ≥ 22.

node scripts/selftest.mjs --offline     # manifests, contracts, API, no SSH needed
node scripts/client-selftest.mjs        # client module, slot, dictionaries, renders
node scripts/selftest.mjs --ssh         # + real SSH: probe, exec, browse, session binding
ELECTRON_RUN_AS_NODE=1 "$DSH_NODE_EXECUTABLE" scripts/selftest.mjs --dsh  # running-DSH validators

CI runs the two offline suites on Node 22 and 24 (.github/workflows/selftest.yml).

Maintainers regenerate the plugin-market index after a release commit:

node scripts/make-index.mjs

Acknowledgements

The remote-workspace mechanism (local mirror + remote binding + workspace-bound tools, and hiding native file/shell tools in remote sessions) was inspired by dsh-remote; this project implements it independently for a focused, settings-panel-first experience.

License

MIT © ShangyuLei-HIT

Related plugins