Pular para o conteúdo principal
A

dsh-ssh-remote

awenjackson/dsh-ssh-remote

SSH remote connection manager for DeepSeek Harness with a settings page, explicit per-session server selection, and automatic reconnect.

Instalar

dsh plugin --profile web add github:awenjackson/dsh-ssh-remote

README

dsh-ssh-remote

An SSH remote-connection plugin for DeepSeek Harness. Save servers under Settings → Remote connections, then explicitly name one in a session before the agent may operate on it through the ssh_* tools.

Features

  • Manage many connections from a settings page: add, edit, rename, and delete up to 50 servers; saving a new server connects it immediately.
  • Test from the form: the Test button at the left of the Cancel / Save and connect row validates the host, authentication, and password or private key currently typed — including an unsaved draft.
  • System information after connecting: a connected card shows the remote OS (for example Ubuntu 24.04.2 LTS), kernel, architecture, and hostname.
  • Two authentication methods: password, or private key (a local key-file path, or pasted key content with an optional passphrase).
  • Explicit authorization: ssh_exec, ssh_read_file, and ssh_write_file only operate on a server after the current session names it. With no server named, or with an unlisted server, the call fails instead of guessing.
  • Automatic reconnect: the connection keeps a keepalive; after an unexpected drop it reconnects with exponential backoff (1s → 2s → 4s … capped at 30s). ssh_exec and file operations retry once after a connection-layer error.
  • Automatic safety rule declaration: when cc-safety-net is installed locally, the first successful connection declares the ssh_exec tool rule (skipped when the rule already exists).
  • In-session commands: /ssh <name> selects a server, /ssh off clears the selection, and /ssh lists saved servers.
  • Credential isolation: passwords, private keys, and passphrases live in the DSH credential store; ssh-remote.json holds connection metadata only.

Usage

1. Add a server

Open Settings → Remote connections and click Add connection, then fill in:

FieldDescription
NameThe name used to select the server in a session, for example production
HostIP address or domain, for example 192.168.1.10 / example.com
PortDefaults to 22
UsernameSSH login user
AuthenticationPassword / private key
PasswordLogin password, stored only in the local credential store
Private key file pathPath to the key file on this machine, for example C:\Users\me\.ssh\id_ed25519
Private key contentAlternatively paste the key directly; when empty, the file path is used
Key passphraseLeave empty when the key is not encrypted

The save button is Save and connect: a successful save connects immediately. The Test button at the far left of the form footer validates the current values before saving (unsaved drafts work too). After saving, Test validates the saved configuration and Connect / Disconnect controls the long-lived connection. The state dot on the card shows disconnected / connecting / connected / reconnecting / failed; when connected it also shows the remote OS, kernel, architecture, and hostname.

Safety rule

If cc-safety-net is installed on this machine, the plugin checks for and declares the ssh_exec rule after the first successful connection:

npx -y cc-safety-net rule tool add ssh_exec --no-cwd-arg

That command only declares a tool rule locally; it does not install cc-safety-net on the remote server, and the rule is not added twice.

2. Name a server in a session

Either of these works:

/ssh production

or say it directly:

Connect to production and check disk usage.

After a server is named, the agent calls tools on that server. When several servers are named, each call needs a connection argument.

Clear the selection:

/ssh off

List saved connections and the current selection:

/ssh

3. Agent tools

ToolPurpose
ssh_listList saved connections, their state, and the servers available in this session (does not touch any server)
ssh_execRun a shell command with optional cwd and timeoutMs (default 30 seconds, output capped at 256KB)
ssh_read_fileRead a remote text file by line; offset starts at 1, up to 2000 lines / first 1MB per call
ssh_write_fileCreate or overwrite a remote text file, up to 4MB per call, optionally creating parent directories

Reconnect behavior

  • Keepalive is enabled after connecting (15 seconds; three missed replies count as a drop).
  • On close / error from a network outage or an SSH service restart, the plugin reconnects automatically as long as the user did not press Disconnect.
  • Reconnect uses exponential backoff capped at 30 seconds; the settings page shows Reconnecting and the attempt count.
  • A running command or SFTP operation that hits a connection-layer error reconnects and retries once; authentication failures and missing files are not retried.
  • Pressing Disconnect stops automatic reconnection; pressing Connect again resumes it.

Data and security

  • Connection metadata: $DSH_HOME/ssh-remote.json (atomic writes, with a backup when the file is corrupt).
  • Credentials: DSH credential store, keyed dsh-ssh-remote/<connection-id>; the page never echoes passwords or private keys.
  • Deleting a connection also deletes its credential record.
  • Authorization is per session: the most recent explicit server selection in a session (or /ssh off) decides which server may be operated on; child sessions inherit the parent session's authorization.
  • The plugin never connects to a server without authorization; ssh_list reads local configuration only.

Known limitations

  • The target server's SSH service must be reachable; SSH jump hosts / ProxyJump are not supported.
  • The private-key file path is a path on the machine running DSH, not on the remote server.
  • Pasted private keys support common OpenSSH / PEM formats; encrypted keys need the passphrase.
  • Authentication supports password or private key, not keyboard-interactive prompts.
  • Changing credentials on the settings page does not force an established long connection to close; to make a new password or key take effect immediately, press Disconnect then Connect.

Installation

Install from the DSH plugin market (search for SSH Remote). Alternatively, download dsh-ssh-remote.tgz from the latest release and add it through your DSH profile's plugin installer (a file: bundle spec). The asset name carries no version number on purpose, so the market's tarball: URL keeps resolving after every release.

The plugin is host-side plus a web client bundle; no build step and no extra local tooling are required. ssh2 is installed automatically as a dependency.

Development

dsh-ssh-remote/
├── index.js          # Host: connection store, SSH manager, authorization, RPC, tools, /ssh command
├── client.js         # Client: settings page + navigation icon
├── cordis.patch.yml  # Plugin row
├── locale/           # zh / en strings
├── icon.svg
└── package.json

Editing client.js takes effect after refreshing the DSH page; editing index.js requires restarting DSH or reloading the plugin.

Syntax check and tests:

node --check index.js
node --check client.js
npm test

npm test runs the settings-RPC smoke test and a manager smoke test that starts a tiny in-process SSH server on 127.0.0.1, so no real server is needed.

License

MIT

Plugins relacionados