dsh-compute-env: Specify a Compute Environment for a DSH Session

Introduction

When developing or debugging agents in DSH (DeepSeek Harness), the local development environment and the production environment are often inconsistent. Running commands directly on the local machine means that file I/O, search, Skills, and AGENTS.md all remain on the host, making it difficult to reproduce the real behavior of a production environment. Existing approaches require manually switching directories, configuring SSH or container parameters, which is error-prone and hard to manage.

The dsh-compute-env plugin allows you to select a compute environment before a session starts, routing command execution, file I/O, search, Skill loading, and global instructions to the target environment. The environment is locked for the duration of the session, and real-time CPU, memory, and disk load monitoring is also provided.

What Is This

dsh-compute-env is DSH’s compute environment management plugin, developed by maintainer vlln and categorized under Workflows. It supports three environment types:

  • Local: The local host machine, using the local workspace directory directly.
  • OCI: Local container images, executed via docker / podman / nerdctl, with configurable container network policies.
  • SSH: Remote hosts, supporting the user@host:port:/remoteDir format, with connection reuse and optimized remote directory browsing.

The plugin provides environment isolation and routing for commands, file I/O (ctx.fs), search (ctx.subprocess + remote rg), and Skills and AGENTS.md. Once a session starts, the compute environment is locked and cannot be changed.

Core Features

Environment Types & Workspace Mechanism

Environment Type Target Format Workspace Mechanism Commands, Files & Context
Local Local host machine (built-in) Uses the local workspace directory directly Native execution; no remote bridging enabled
OCI Local image (manually entered or scanned from docker / podman / nerdctl) Host directories are bind-mounted into the container at the same absolute path; associated workspaces and default directories per OCI engine are recorded bash / sh delegated via the container CLI; file I/O directly hits the host-mounted bytes; configurable container network policy (none / default)
SSH user@host:port:/remoteDir (supports ssh:// and SCP-style) A local stand-in directory is created under the plugin state directory and mapped to the real remote path Commands, file I/O, search, and ancestor-directory instructions are all routed to the remote host

Adjustable Before the First Turn, Locked Afterward

You can switch the compute environment and workspace at any time before sending the first message. Once the first message is sent, the environment is permanently bound to that session and cannot be changed during runtime.

Real-Time Resource Monitoring

View system information, toolchain details, and real-time CPU / memory / disk usage for the current environment. The monitoring panel is displayed below the input box by default; it can be changed to “above the input box” or “Smart (container/SSH pinned to top)” in the plugin settings.

Workspace Isolation & Directory Selector

The plugin provides unified per-environment isolation for the left sidebar, the new-session workspace menu, and the directory picker dialog:

  • The “Workspaces” title row in the left sidebar directly injects an environment dropdown menu consistent with the new-session flow, filtering workspaces by local, each OCI, and each SSH environment separately.
  • Creating a new workspace, configuring a “default working directory”, or launching a session under a specific OCI environment automatically records the host path into ociWorkspaces and persists it.
  • When switching environments in the new-session UI, it automatically selects the last remembered workspace, default directory (SSH: remoteTaskDir, OCI: defaultWorkdir), or matching workspace for that environment.
  • The directory picker is locked to the currently selected environment, uses @headless-tree/react for lazy-loaded directory trees, and supports address-bar editing, breadcrumb navigation, recursive search in the current directory, and folder creation.

SSH Authentication & Transfer Optimization

  • Probe on Add: When confirming an SSH environment, staged waiting status is displayed, and a fresh connection is used to verify login and remote directory accessibility. On failure, a structured diagnostic card is shown.
  • Strictly Isolated Password Mode: When password authentication is enabled, BatchMode=no, PubkeyAuthentication=no, and PreferredAuthentications=password,keyboard-interactive are automatically set to prevent silent fallback to local public keys. Credentials are stored only in the current Web process environment variable (DSH_CE_SSH_PASSWORD) and passed via SSH_ASKPASS—never written to disk or exposed in the command-line argv.
  • One-Click Public Key Installation: In the add dialog or environment configuration card, when in password mode you can directly select a local ~/.ssh/*.pub public key. It is idempotently written to the remote ~/.ssh/authorized_keys (700/600 permissions) and verified with a pure key-based connection. On success, it immediately switches back to public key authentication and clears the in-memory password.
  • Independent Host Fingerprints: On first connection, the fingerprint is written to the plugin-private known_hosts (<state>/ssh/known_hosts, StrictHostKeyChecking=accept-new), without polluting the user’s ~/.ssh/known_hosts.
  • Connection Reuse: Via ControlMaster=auto, ControlPath=/tmp/dsh-ce-ssh-<hash>.sock, and ControlPersist=600, shell commands, search, file operations, and load sampling for the same target share a single authenticated connection.
  • Persistent Directory Browsing Channel: The directory picker’s lsdir maintains a long-lived subprocess pipe per SSH environment, streaming directory listings on a per-directory basis.
  • Merged Round-Trip Scripts: File read + status probing, write + version guard, delete + readback, and move + readback are all executed atomically within a single remote script.

Per-Environment Skill & AGENTS.md Loading

Each non-local environment configuration card provides two groups of toggles:

Skill Toggles

  • Load Local Skills: When enabled, local Skills are included in the directory listing. Files are synced to the environment-private directory (container: /opt/dsh-compute-env/skills, SSH: <remoteDir>/.dsh-compute-env/skills) only when the model actually loads a Skill, and resourceBase is pointed to that path. When disabled, local Skills are completely hidden.
  • Load In-Environment Skills: When enabled, existing Skills are read from the target environment (project root .dsh/skills, .agents/skills, and $DSH_HOME/skills, $DSH_AGENTS_HOME/skills). When disabled, the environment is not probed.

AGENTS.md / AGENTS.local.md Toggles

AGENTS.md / AGENTS.local.md in the project directory and its ancestor chain are automatically effective in all environments. User global instructions are controlled by two independent toggles:

  • Load Local Global AGENTS.md: When enabled, the host machine’s ~/.dsh/AGENTS.md and ~/.agents/AGENTS.md are included in the context. When disabled, host global files are suppressed in the current environment step, without affecting project-level AGENTS.md / AGENTS.local.md.
  • Load In-Environment Global AGENTS.md: When enabled, $DSH_HOME/AGENTS.md (or ~/.dsh/AGENTS.md) and $AGENTS_HOME/AGENTS.md (or ~/.agents/AGENTS.md) are read from the target container or SSH host. Content is deduplicated and injected into the session history as a summary. When disabled, environment global instructions are not read.

Permission Boundaries & Known Limitations

  • read / write / edit / patch / delete / move: SSH uses remote file bridging; writes are strictly confined to the session working directory, with out-of-bounds access denied (FS_PERMISSION_DENIED); the plugin-private Skill directory is read-only.
  • grep / glob: Read-only operations; on the SSH side, they are dispatched on demand and use the static binary at ~/.dsh-compute-env/bin/rg.
  • bash / background jobs: No remote sandbox; commands are executed via docker exec or ssh under the corresponding user identity within the target environment.
  • ctx.fs path-based routing: Because the file service does not carry a session ID, if two SSH sessions simultaneously use the exact same remote folder, file tools will share that routing (command execution and background tasks remain strictly isolated by DSH_SESSION_ID).
  • Password lifecycle: The same Web process holds only one active SSH password at a time; setting a second password overwrites the first, and it must be re-entered after a process restart.
  • Environment info caching: envinfo cache TTL is 60 seconds for local, 5 minutes for SSH, and 30 minutes for OCI. Passing refresh: true forces a refresh.

Installation & Activation

The plugin is published on npm. Install it using the official command:

# Install to the default profile
dsh plugin add dsh-compute-env

# Or install to a specific profile (e.g., web)
dsh plugin --profile web add dsh-compute-env

After installation, the plugin is automatically assembled into the DSH Profile and provides a “Compute Environments” management panel in the sidebar.

Typical Usage

Adding an SSH Environment

  1. In the sidebar under “Compute Environments”, click “Add Environment”.
  2. Select “SSH”, enter the target address (e.g., demo@gpu-node-01:22) and the remote directory.
  3. Click Confirm—the plugin will automatically probe the connection and directory accessibility.
  4. If password login is required, the plugin will prompt for password input (credentials are stored only in the current Web process environment variable).
  5. After a successful probe, click the SSH environment in the environment list, and it will be available for selection when entering a session.

Using an OCI Container

  1. In “Compute Environments”, click “Add Environment”.
  2. Select “OCI” and enter the image reference (e.g., docker.io/library/python:3.11-slim).
  3. Configure the default working directory and container network policy (none or default).
  4. After starting a session, all commands, file I/O, and search operations are executed via the container CLI. Host directories are bind-mounted into the container at the same absolute path.

Per-Environment Skill & AGENTS.md Loading

In the configuration card for a non-local environment, you can independently control the loading of local Skills vs. in-environment Skills, as well as local vs. environment AGENTS.md. For example, enabling “Load Local Skills” in an SSH environment allows the model to use your local Skill directory in a remote session; disabling “Load In-Environment Skills” prevents reading Skills from the remote that may not exist or be outdated.

Use Cases & Notes

This plugin is suitable for developers who need to debug agents across different compute environments, reproduce production behavior, or collaborate across environments. For example, use the Local environment during local development, switch to SSH or OCI when simulating production, while maintaining consistency of file context, Skills, and global instructions.

Note that the plugin runs with the permissions of the current dsh process. Review the source code and license before installing. The plugin requires Node.js >= 22.19.0 and DSH >= 0.2.2-rc.2; ensure your environment meets these version requirements.

In Short

dsh-compute-env provides environment isolation and routing that lets DSH sessions flexibly choose between Local / OCI / SSH environments while maintaining transparent placement of files, Skills, and global instructions. After installation, you can select a compute environment before a session starts, and it is locked with real-time resource load monitoring once the session is running. For more details, see the GitHub repository.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye