DeepSeek Harness Plugin

OMSociety/dsh-ssh-tunnel

Stars ★ 9 Downloads (30d) 3,550 Category Remote & Mobile Added 2026-10-12 npm dsh-ssh-tunnel

Multi-host SSH workbench: keep remote servers in a host library, grant them per project, and open an interactive terminal or dual-pane SFTP in the right sidebar, while the SSHManager tool runs remote commands and transfers files without exposing keys to the model.

Install

# from npm (prebuilt)

dsh plugin --profile web add dsh-ssh-tunnel

# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)

dsh plugin --profile web add github:OMSociety/dsh-ssh-tunnel

Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).

README

What this is

DSH SSH Tunnel is a community plugin for DeepSeek Harness, mounted as a tab in the official DSH right sidebar. It collects your SSH hosts into one host inventory, authorizes them per project, and then opens an interactive terminal (xterm) or dual-pane SFTP in the center panel.

It does not replace the global fs / subprocess with a remote disk: remote operations happen only in the SSHManager tool you call explicitly and inside the panel, and local and remote files remain two clearly separated sides.

Prior art

The product shape and several UX patterns are informed by the open-source LiveAgent (multi-host SSH inventory, project-scoped access, sidebar tunnel management, center terminal / SFTP surfaces).

Screenshots

Installation

Use the DSH plugin command and specify the target profile:

# stop the running DSH first (a live service holds the dependency lock; start it again afterwards)
dsh plugin --profile <profile> add "dsh-ssh-tunnel@1.3.0"

Note: After installing, refresh the browser page for the "SSH Tunnel" entry to appear in the sidebar — restarting the host alone is not enough, because the client artifact is fetched when the page loads.

First run (owner browser session)

  1. Select SSH Tunnel from the sidebar + menu and add a host on the Hosts page (password or private key)
  2. Switch to Project access and grant that host to the current project, then save (without a grant you cannot connect — that is intentional)
  3. Back on Sessions, press Connect; the first connection asks you to confirm the host key fingerprint
  4. Click Terminal for an interactive shell, or SFTP for the dual-pane panel
  5. Have the model run SSHManager action=exec, list a directory with sftp_list, and move a file with sftp_upload / sftp_download to verify the whole chain

Sidebar

One sidebar tab with three pages; the UI follows the DSH interface language between Chinese and English live:

Page Purpose
Project access Hosts the current project may use; the grant key is the DSH session workspace (projectPathKey)
Hosts Host CRUD and OpenSSH config scan import; password or private key (with passphrase), keys stay host-side
Sessions Connect / disconnect, open the terminal or SFTP; dropped sessions stay as tombstones you can reconnect (same id) or close; unexpected drops auto-reconnect up to 3 times, ssh2 keepalive 30s × 3

Model tool

SSHManager actions, grouped by purpose:

Action Purpose
list_hosts / list_sessions List the hosts granted to the project and its sessions
create_session / close_session Open or close a session (together with session_strategy)
exec Run a remote command (command, cwd, timeout_ms)
sftp_list / sftp_stat / sftp_read_text / sftp_write_text Remote listing, metadata and text I/O
sftp_mkdir / sftp_rename / sftp_delete Remote directory creation, rename and delete
sftp_upload / sftp_download Transfer files between the project workspace and the remote side
read_session / send_input / resize_session Read, feed and resize an interactive session
  • Session strategies: reuse_or_create (default; revives a disconnected session for that host), new, require_existing, or an explicit session_id
  • Timeouts: exec 30s, SFTP metadata 30s, SFTP transfers 120s, shell operations (read_session / send_input / resize_session) 10s by default; timeout_ms overrides them, clamped to 1000–300000, with a 300s ceiling for the whole call
  • max_bytes counts raw bytes, from 1024 to 1048576. For exec, stdout and stderr share a single budget in arrival order (default 256 KiB). sftp_read_text retains the file prefix (default 512 KiB). When data exceeds the budget, the tool text includes truncated: true.
  • exec returns text and isError. The text includes stdout, stderr and an exit line such as exit: 0 or exit: killed by signal TERM (no exit-status). If the connection drops before an exit status arrives, it reports exit: unknown and warns that output may be partial. Only a known zero exit code counts as success.
  • send_input sends carriage returns, whitespace and multiline text verbatim. The sidebar pages through terminal output with shellRead: up to 512 KiB retained, at most 256 KiB per page. Pass the previous page’s since to continue; dropped: true means the requested records were evicted, so resume from baseSeq - 1.
  • Authentication is password or private key only; keyboard-interactive (including bastion web MFA) is not supported

Security

Who can manage hosts: on DSH 0.2.3-alpha.2, sidebar HTTP routes require a host-verified owner. The owner manages the host and trust stores; sidebar operations use the project specified in the request. The model tool gets its project from the host session; a tool argument cannot select a different grant scope.

DSH 0.2.2-rc.5 adapter: the health check and static terminal assets use host request admission. Sidebar management, including host key confirmation, additionally requires the host to identify its own browser peer as the owner. Session authentication alone or an API credential is insufficient. On both versions SSHManager uses the current project’s grants. The manifest permits installation with engines.dsh: "*". Offline admission tests cover these two host versions; other versions are unverified.

Authorization and path-guard action list:

  • Grant before connect: a host that is not checked under Project access cannot be connected, and Connect never auto-writes grants
  • Revocation and cancellation: the grant is checked again before delivery. Downloads go to a temporary file in the destination directory; only a successful, authorized download replaces the destination. Failure, cancellation or a failed grant check leaves the existing file intact. Cancelling an upload cannot undo bytes already written remotely; inspect the remote file before retrying.
  • Local path guard fails closed: local upload / download / list / mkdir / delete / rename paths are constrained to the project workspace root, with both lexical and realpath checks, and out-of-bounds paths or symlinks pointing outside the workspace are rejected; when no workspace root can be resolved the operation is refused (the environment variable DSH_SSH_TUNNEL_WORKSPACE_ROOT can set one explicitly)
  • Tool results and list APIs never return password / PEM / passphrase
  • Host keys are stored as SHA256 hex in known_hosts.json; the first connect or a fingerprint change is confirmed in the sidebar with the fingerprint shown
  • Prefer key-based auth; rotate credentials immediately if secrets.json may have leaked
  • Authentication is password or private key

Where data lives

Under $DSH_HOME/ssh-tunnel/ (directory mode 0700; this is POSIX behavior — on Windows NTFS permissions come from inherited ACLs and chmod does not change the DACL):

File Contents Mode (POSIX)
hosts.json Host metadata (no secret material) 0600
secrets.json Passwords / PEM / passphrases 0600
grants.json projectPathKey → hostIds[] 0600
known_hosts.json Trusted host key fingerprints 0600

Development

npm test                            # full regression of the smoke scripts (runs node scripts/smoke-test.mjs)
npm run check                       # syntax check + smoke tests
node scripts/smoke-test.mjs --no-listen  # skip cases that require a loopback listener
npm run test:pack                   # verify npm pack members and missing-member regressions
npm run build:preview               # regenerate the preview images under docs/ (needs local Chrome; CHROME_PATH overrides)
node scripts/portal-probe.mjs       # client tab render probe (runs when react resolves, otherwise skips)

The full suite uses a temporary data directory and an ssh2 test server listening on 127.0.0.1. It needs no public network, remote host or running DSH. CI runs syntax checks, the full suite and package verification.

Layout:

lib/index.js            Host entry: tool registration, /dsh-ssh-tunnel/api routes, grants and path guard, xterm asset serving
lib/client.js           Client bundle (committed; dsh plugin add does not build)
lib/session.js          Session lifecycle: connect, keepalive, drop tombstones and auto-reconnect, exec/SFTP execution
lib/shared/             Pure functions shared by host and client: path / args / host-key / host-summary / http-trust / persist /
                        session-auth / session-policy / shell-buffer / vendor
docs/preview/           Preview input: fixture.json is fictional data; panel.html and docs/panel-*.png are generated by build:preview
scripts/                smoke-test.mjs · check-pack.mjs · portal-probe.mjs · build-preview.mjs
cordis.patch.yml        In-package bundle patch the CLI turns into dsh.profile.bundles

xterm loading

@xterm/xterm@5.5.0 and @xterm/addon-fit@0.11.0 are pinned runtime dependencies. The host serves their UMD and CSS from an allowlisted same-origin route (/dsh-ssh-tunnel/vendor/xterm.js|addon-fit.js|xterm.css), and the client loads them with plain <script> / <link> tags. There is no CDN fallback and no module-table requirement.

Support and credits

  • If this plugin helps you, a Star is welcome; questions and suggestions go to Issues or Pull Requests.
  • Changes are recorded in the CHANGELOG.
  • LiveAgent (thirsty5034/LiveAgent): prior art for the product shape and several UX patterns (see "Prior art" above)
  • DeepSeek Harness: the host for plugins, tools and agent shells

License and author

MIT. The license terms and copyright are defined by LICENSE; upstream project and code author @thirsty5034.

Content from the project README on GitHub ↗

Links

More in this category

View the whole category →

Community comments

Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.