dsh-envsel: Selecting Python, R, and CLI Environments in DSH Sessions

Preface

In DeepSeek Harness (DSH) web sessions, the model may invoke the shell to execute Python, R, or command-line tools. Different tasks often require different environments: a conda environment, a standalone R installation, a WSL distribution, or a manually specified interpreter path.

What dsh-envsel does is fairly specific: it provides three environment slots for DSH sessions — Python, R, and CLI tools — allowing selection from conda, standalone R, WSL, or user-pinned custom paths, and persists these selections across restarts.

What This Is

dsh-envsel is an independent DSH plugin maintained by beihzb, with the package name @beihaizb/dsh-envsel and licensed under MIT. It is installed via --profile web and is an npm-installable plugin.

The problem it solves is: within the same DSH instance, different sessions can bind to different language environments, and the model can see these selections in shell invocations.

Core Features

Below are the capabilities provided by the plugin:

  • Saves environment selections per session, retained after restarts.
  • Provides separate environment slots for Python, R, and CLI tools.
  • Environment sources include conda, standalone R installations, WSL distributions, and user-pinned custom paths.
  • Use the /env command in chat to read, assign, clear, and list environments.
  • Provides the session_env model tool, allowing the model to list, select, pin, and unpin environments.
  • Exposes shell facts DSH_ENV_PYTHON, DSH_ENV_RSCRIPT, and DSH_ENV_CLI_PREFIX for shell invocations.
  • Provides an Env dropdown menu in the session header, selectable by language, with an “Add path” form for pinning an interpreter or installation directory.
  • UI text follows DSH’s language settings, i.e., bilingual UI.

Installation and Enablement

The plugin requires DSH version 0.1.0-rc.7 or a compatible 0.1.0-rc.x web profile. It also requires pnpm to be present in PATH, as dsh plugin relies on it.

First, confirm that DSH and pnpm are available, then execute:

dsh plugin --profile web add @beihaizb/dsh-envsel

If you’re using a local source repository, you can also install via a local path:

dsh plugin --profile web add "file:/absolute/path/to/this/repo"

After the above steps, the plugin will be integrated as an independent plugin for the web profile. You can then manage environment selections for the current session using /env and session_env.

Typical Usage

Using the /env Command

/env is the primary entry point in the chat window. Common forms are as follows:

/env
/env python=mycondaenv
/env r=R-latest
/env cli=base
/env list [filter]
/env add <path>
/env unpin custom:<name>
/env clear
/env wsl

The purpose of each command:

  1. /env: View current selections.
  2. /env python=mycondaenv: Set the Python slot to the specified environment name.
  3. /env r=R-latest: Set the R slot to the specified environment name.
  4. /env cli=base: Set the CLI slot to the specified PATH prefix.
  5. /env list [filter]: List discoverable environments, optionally filtered.
  6. /env add <path>: Remember an interpreter or installation directory on this machine.
  7. /env unpin custom:<name>: Forget a previously pinned path.
  8. /env clear: Clear all slots.
  9. /env wsl: Rescan WSL distributions on Windows; non-Windows hosts skip the WSL scan.

Using the session_env Tool

The model can also manage environments itself. session_env supports listing, selecting, pinning, and unpinning environments. This is useful for letting the model choose an environment based on the task during a conversation, rather than manually typing /env each time.

Using the Session Header Env Menu

The session header provides an Env dropdown menu. It allows separate selection for Python, R, and CLI tools, and also offers an “Add path” form for pinning an interpreter or installation directory via an absolute path.

How Selections Take Effect

Here’s a point that’s easy to misunderstand: dsh-envsel selections are not rendered as runtime-context text into the model’s system prompt. The model sees the current selections through two main channels:

  • Every shell invocation sees DSH_ENV_PYTHON, DSH_ENV_RSCRIPT, and DSH_ENV_CLI_PREFIX.
  • The model can query the current state via /env or session_env.

Selections are stored in a local JSON store:

$DSH_HOME/envsel-state.json

This file uses session id as the key. Selections are not written to the session event log.

Optional Configuration

The plugin can be used without configuration. If your profile uses cordis.patch.yml, you can configure optional items under the envsel line. Verified configuration keys include:

  • listTtlMs
  • condaCommand
  • standaloneRRoots
  • wslEnabled
  • registerTool
  • probeTimeoutMs

For example, you can set options under the config of the envsel line:

config:
  wslEnabled: false
  registerTool: true

Suitable Scenarios and Notes

Suitable for:

  • Need multiple DSH sessions with different Python, R, or CLI environments.
  • Environment sources are conda, standalone R, WSL, or custom paths.
  • Want the model to see current selections via DSH_ENV_* in shell invocations.
  • Want to manage environments in-session using /env or session_env.

Notes:

  • The plugin runs with the permissions of the current dsh process. Before installing, inspect the source and license. This plugin declares the MIT license.
  • The plugin is peer-bound to @deepseek-ai/dsh-*@^0.1.0-rc.7; confirm your DSH version is within the required range before use.
  • WSL scanning is only enabled on Windows; non-Windows hosts automatically skip it.
  • Selections are not written to the model’s system prompt; instead, they are exposed via shell facts and /env / session_env.
  • The DSH plugin directory is an independent site and not equivalent to an official app store. Verified sources did not provide a star count or directory page URL; this article does not fabricate links that cannot be verified.

Conclusion

The value of dsh-envsel lies in turning “which Python / R / CLI environment does this session use” into session-level, persistent state that can be queried by the model. It’s well-suited for developers handling multi-language environment switching in DSH web profiles.

GitHub repository:

https://github.com/beihzb/dsh-envsel

Directory page link: Verified sources did not provide a URL; this article does not include one. If you need to search, look up the package name @beihaizb/dsh-envsel.

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

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

Xiaoye