Skip to main content
H

dsh-ssh-scper

hosimiake/dsh-ssh-scper

Runs read, write, edit, grep, glob and bash on a remote host over a saved SSH connection, with an encrypted local vault, pinned host keys and a Sidebar preview of remote files.

Install

dsh plugin --profile web add github:hosimiake/dsh-ssh-scper

README

dsh-ssh-scper

SSH / SCP-er remote workspace for DeepSeek Harness.

Turn a saved SSH connection into the agent's workspace: while a channel is on, the standard read, write, edit, grep, glob and bash tools run on the remote host instead of the local machine, and new sessions get a prompt section that names the remote root. The local session directory is untouched, so no local file is read or written by those tools. The plugin is built on the same connection model as the SSH/SCP-er desktop app and can import its vault.

The right Sidebar can also preview remote files. Clicking a file path in the conversation (a read/write/edit row, a diff card, a search result) opens the shipped preview tab; for a Session in a remote workspace the plugin reads the file over SSH instead of from the empty local placeholder, so the click no longer ends in "file not found".

Install

Clone this repository, then:

  1. In DeepSeek Harness open Settings → Plugins → Add plugin (or use plugin_manager install_bundle with this directory) and add the repository folder.
  2. Restart DeepSeek Harness when the plugin manager asks for it, then refresh the Web page.
  3. Open Settings → SSH / SCP-er.

What a source install needs

The plugin is plain JavaScript, but its one dependency — ssh2 — is fetched over git from GitHub during the install. Two things are worth knowing before you start, because both surface as errors rather than prompts:

  • git must be on PATH. Without it the install stops at ERR_PNPM_GIT_RESOLVE_FAILED. Run git --version in the environment that launches DeepSeek Harness; a Git install that did not put its cmd directory on PATH fails here even though git works in a terminal that adds it.
  • ssh2 asks to run build scripts, which pnpm declines by default. A raw dsh plugin add therefore ends with ERR_PNPM_IGNORED_BUILDS naming ssh2 and cpu-features and exits non-zero, even though the package is installed. The plugin manager surfaces the same list as a build-approval prompt. Approving it is optional: those scripts only build the optional native accelerator, and without it ssh2 runs in pure JavaScript — which is how the 26 checks below were run.

Both are properties of installing from a repository rather than a published package; a prebuilt tarball would not need git. Once installed, the package management step is not repeated.

Configure a channel

  1. New connection: host, port, username, authentication (password or private key file), and the remote directory that should act as the workspace root (. means the login home directory). The private-key field has a Browse… button that opens the host's native file chooser (Windows OpenFileDialog) and fills in the absolute path; the path can also be typed or pasted.
  2. Test verifies reachability and reports the host's SHA256 fingerprint. On first contact the fingerprint is shown in a dialog; confirm it only after comparing it with the server administrator's value. From then on the key is pinned, and a changed key aborts the connection before credentials are sent.
  3. Enable channel connects and turns remote mode on for sessions created afterwards. Existing sessions keep their local tools; that is deliberate.
  4. Read-only mode reconnects the channel and exposes only reading tools (read, grep, glob, remote_download).

Import from SSH-SCP-er reads %LOCALAPPDATA%\SSHSCPEr\vault.json with the same DPAPI protection, lists the saved connections, and copies the selected ones into this plugin's own encrypted vault. The desktop app is never modified.

Remote Workspaces (the "New workspace" flow)

The plugin replaces the workspace-directory flow with a first step that asks Local folder or Remote SSH:

  • Local folder offers Browse in Explorer…, which opens the host's native folder chooser through uiWorkspace.pickDirectory(). The same tab keeps the in-app directory list, breadcrumbs, an editable path field (Enter = go), and Use this folder, so a composition whose picker cannot open an OS dialog still works.
  • Remote SSH picks one of the saved connections, a remote directory, and an optional workspace name. Test connection probes reachability and opens the fingerprint dialog for an unconfirmed host, and New SSH server embeds the full connection form right in the dialog — save it there, it is tested immediately, and the confirmed connection is selected for the workspace. The plugin then creates a DSH Workspace backed by a small local placeholder directory ($DSH_HOME/dsh-ssh-scper/workspaces/…) and stores the binding workspace path → SSH connection + remote root in its encrypted vault. A session started in that workspace records the placeholder as its DSH working directory, while the agent's read/write/edit/grep/glob/ bash tools resolve paths against the remote root and execute over SSH.

Bindings are resolved from the session's immutable cwd at agent/created, so forked and resumed sessions in the workspace stay remote automatically. Sessions outside a remote workspace (and every workspace created before this plugin was enabled) are untouched.

The same remote-workspace form is also available from Settings → SSH 远程 → 远程工作区, which creates the workspace and opens it directly — a fallback if another plugin or theme module wins the directory-flow slot.

What is local and what is remote

  • Local: the DSH Workspace row and its placeholder directory, session logs, the sidebar file tree, workspace-files browsing and workspace diff cards.
  • Remote: every model-facing file/shell tool in sessions of that workspace, and the content of a file previewed from that Session's conversation.
  • The sidebar file tree therefore shows the empty placeholder, not the remote directory; use the agent's tools, a conversation file link, or the Settings page to inspect remote files.
  • remote_upload / remote_download are the only tools that touch the local machine, and only the local DSH workspace directory: put a file into the workspace folder (the placeholder shown in the sidebar) to upload it; downloaded files land there.

Remote file preview

A file path in the conversation opens the right Sidebar's text preview, which normally reads the Session's local filesystem. In a remote workspace that filesystem is only the empty placeholder, so the click used to fail. The plugin registers an extension-band tab type that claims dsh-resource://file/session/<sessionId>/<path> addresses only for remote Sessions:

  • a remote-workspace Session is recognized from its bound placeholder cwd;
  • a Session on the legacy global channel is recognized from the Host's set of Sessions that registered the remote tool set;
  • every other Session keeps the shipped local preview, unchanged.

Claiming happens without a round trip: the workspace bindings are fetched at load, cached in browser storage, and refreshed when the Session catalog changes or the Settings page opens. The tab body then reads through the same SSH connection and the same workspace-root confinement as the read tool. The viewer shows line numbers, wrapping, copy, and a reload action; a tool row's line reference scrolls to and briefly highlights that line. Raster images (PNG, JPEG, GIF, WebP, BMP, ICO, AVIF) render inline. Text above 2 MiB shows its head, the viewer builds at most 5000 lines at a time with a Show more lines control, images above 8 MiB are refused whole, and binary or invalid-UTF-8 files say why they cannot be shown. Nothing read for a preview is written to the local disk.

The Host route behind it is POST /api/dsh-ssh-scper/preview/read; it is authenticated by the same Host connection gate and trust fence as the other plugin routes and never returns a credential.

Security model

  • Passwords and key passphrases are stored in $DSH_HOME/dsh-ssh-scper/vault.json, sealed with Windows DPAPI in the current user's scope. The file cannot be decrypted by another Windows account or on another machine. On non-Windows platforms the vault uses AES-256-GCM with an owner-only key file, which is obfuscation rather than a hardware-backed boundary.
  • Host keys are trust-on-first-use with SHA-256 pinning. An unknown key is collected and refused before authentication; a changed key is a hard abort.
  • Credentials never reach the Web client, the model, or logs. The plugin opens no network listener: the Web routes are served by the existing DSH loopback server. Every plugin route first passes the Host connection gate — the same Host/Origin trust fence and signed browser-session cookie the Host /api bridge uses — so a loopback request without a valid DSH browser session is refused (401/403) even though it arrives on 127.0.0.1. A same-origin loopback check remains as defense in depth.
  • remote_upload / remote_download keep their local side inside the session's local DSH workspace directory. Paths are canonicalized with realpath; .. escapes, absolute paths outside the workspace, symlinked sources/targets and reserved Windows device names are refused. Uploads are capped at 64 MiB and download targets must be plain files whose parent directory already exists. Untrusted content seen through the SSH channel therefore cannot use these tools to read local secrets or write arbitrary local files.
  • The key-file Browse… button spawns one bundled PowerShell script (lib/pick-file.ps1) that shows a Win32 OpenFileDialog on the host. The dialog title, filter and initial directory arrive through environment variables (never as PowerShell source), and only the selected path is read back. The script is a local chooser: no file content leaves the machine.
  • Remote file tools are confined to the configured workspace root. bash is a normal shell on the remote host and is not confined; use read-only mode when the session should not run commands.

How remote tools work

On first connection a single-file Python 3 helper is uploaded to <workspace>/.dsh-ssh/agent.py and registered in .git/info/exclude, so it never appears in git status. The helper serves fast recursive grep and glob over one SSH channel (using rg when installed, otherwise a bounded Python scanner). If the remote host has no usable python3, the plugin falls back to SFTP and shell utilities; file reads and writes always use SFTP.

Limits

  • Remote mode applies to sessions created after the channel is enabled.
  • DSH's sidebar file tree, workspace-files browser and workspace picker still show the local placeholder, and their file rows open the placeholder. Only the conversation's file links preview the remote content, together with the model-facing tools and their prompt section. (A placeholder file row whose relative path exists on the remote host resolves to the remote file, because the tab type keys on the Session, not on where the link came from.)
  • A remote preview is a snapshot re-read on demand; there is no automatic file watch over SSH. The pane's reload action re-reads the file.
  • Remote previews stay inside the configured workspace root, like the read tool; an absolute path outside it is refused.
  • A Session created on the legacy global channel is recognized as remote only after its agent registers the remote tool set. A Host restart therefore forgets that mapping until the Session is prompted again, while a remote-workspace Session is recognized from its bound cwd regardless.
  • bash runs with the SSH user's full privileges on the remote host.
  • The local side of remote_upload / remote_download is limited to the session's local DSH workspace directory — for a remote workspace that is the local placeholder directory $DSH_HOME/dsh-ssh-scper/workspaces/… that the sidebar shows as the workspace. There is no way to transfer an arbitrary local path from the agent; move files in or out of that folder with the host's own file manager.
  • One channel can be active at a time.
  • Windows host keys are displayed in OpenSSH SHA256:<base64> form.
  • The native key-file chooser is Windows-only. On other platforms Browse… reports that the system dialog is unavailable and the path stays editable.
  • After installing or updating the plugin, restart DeepSeek Harness (or let the plugin manager recompose) so the Host half and the browser bundle are reloaded.

Verification performed

  • test/integration.mjs — 26 checks against a local paramiko SSH/SFTP server: DPAPI vault round-trip, unknown host key refused with a fingerprint, pinned connect, exec stdout/stderr/exit codes, SFTP read/write/list, helper glob/grep, every tool's exact result envelope, timeout marker, read-only tool set, key auth, SSH-SCP-er vault import, vault reload, remote-Workspace placeholder + DSH workspace + session-cwd binding, the Local-tab directory listing, the transfer boundary (a workspace file uploads; a path outside the local workspace is refused for both upload and download), and remote preview reads (UTF-8 text with line count, an absolute path inside the root, an inline PNG, a binary file, refusal outside the root, and a local Session refused).
  • test/preview-routing.mjs — the browser bundle's tab-type claim, driven against the real client factory with a fake loader, Session catalog and plugin routes: a bound remote-workspace Session and a legacy global-channel Session are claimed, while local, unknown, absolute and non-address strings stay with the shipped preview; the tab body registers under the definition id.
  • test/local-paths.mjs — the transfer boundary in isolation: canonical root, .. and absolute escapes, sibling-directory prefix confusion, symlinked source/target, missing parents, directories, reserved Windows device names and the upload size cap.
  • test/preview.mjs — the preview classifier: UTF-8 text and line counts, empty files, NUL and invalid-UTF-8 rejection, raster-image MIME and caps, and SVG staying source text.
  • test/validate-schemas.mjs — every tool output schema validated by the harness's own assertSupportedJsonSchema inside the DSH runtime.
  • test/render-check.mjs — the browser bundle evaluates as a lazy factory, registers the Settings page, all three workspace-flow holes and the remote preview type/body, renders the Settings page and the preview's loading state, and renders the Local/Remote new-workspace dialog (including the Explorer action and the theme-aware button label).
  • test/routes.mjs — mounts the real apply() on the shipped web-server route contract and speaks HTTP to it: prefix registration, state, fs/list, connection/save (secrets stay out of the response), fs/pick-file, preview/sessions, preview/read refusing a non-remote Session, JSON 404 for unknown actions, the Host connection gate refusing an unauthenticated request (401) and passing a trust-fence refusal through (403), and the cross-origin fence. This is the regression test for the "HTTP 404" every plugin request used to receive when the prefix path carried a trailing slash.
  • Live reachability probe: the saved SSH-SCP-er connection (key auth, pinned SHA-256) connected through RemoteWorkspace.test() in 2.3 s, its fingerprint matched the pin, its remote root resolved, and echo dsh-scper-ok returned exit 0 — that server is reachable; the reported failure was the Web route, not SSH.
  • Manual end-to-end check in a live DSH session: bash/read/grep/glob executed inside the SSH workspace root, not the local session directory.
  • The Settings page, the new-workspace dialog, the remote preview pane and slot precedence have not been visually verified in a browser; check them after installation. If another plugin wins a directory-flow slot, use Settings → SSH 远程 → 远程工作区 to create and open a remote workspace.

Reproduce the checks

test/integration.mjs and test-ssh-server/verify.js run against the bundled SSH/SFTP test double: a loopback-only (127.0.0.1:2222) paramiko server with fake credentials, never a real host. Start it first — it generates its own host key, client key and fingerprint on first run:

npm install                                 # ssh2, for both suites
python test-ssh-server/server.py            # listens on 127.0.0.1:2222
node --test test/integration.mjs            # 26 checks
node test-ssh-server/verify.js              # 9 steps at the ssh2 layer

test/render-check.mjs renders the browser bundle and needs react and react-dom, which are not plugin dependencies:

npm install --no-save react react-dom
node test/render-check.mjs

test/seed-enabled.mjs is a helper rather than a test: with DSH_HOME pointing at a harness home, it stores an enabled channel to the test server so a live session can exercise the remote tools.

Related plugins