dsh-micromamba-env
A DeepSeek Harness plugin that lets you view your micromamba environments without leaving the app, and select one environment per workspace. The environment/package catalog is strictly read-only; the only write is the workspace's own selection file.
What it does
- Sidebar panel — a new Micromamba entry in the global panel list opens a
main panel listing every environment with its name, absolute path,
base/default/external/selectedflags, package count, and Python/R version when present. The panel also shows the current workspace's selected environment and offers a name/path filter. - Package browser — click an environment to expand a filterable list of its installed packages (name, version, build, channel).
- Per-workspace selection — an Environment picker in the composer
(left of the input box) remembers one micromamba environment per workspace in
<workspace>/.context/micromamba-environment.json, so switching workspaces restores each project's own environment. - Agent tools:
micromamba_list_envs— environments, flags, counts, interpretersmicromamba_list_packages— packages in one environment, optional filtermicromamba_info— binary path, version, root prefix, platformmicromamba_workspace_environment— read/persist the active workspace's selectionmicromamba_run— run a command line with the selected environment
All micromamba invocation happens on the Host half. The browser half only reads
same-origin JSON routes (/dsh-micromamba-env/envs, /packages,
/environments, and /selection) and never runs a shell command.
Execution policy
When a workspace has a selected environment and enforcePythonTool is true
(the default), the Host denies Python commands submitted through Bash and
directs the model to micromamba_run. The detector unwraps the usual wrappers —
sudo, env, xargs, nohup, nice, timeout, strace, bash -c,
pip, pytest, ipython, uv run python, and friends — and it also inspects
terminal_send. Non-Python Bash commands are unaffected, and clearing the
selection lifts the restriction.
micromamba_run executes through the same sandboxing shell executor as the
Bash tool: it resolves the session's sandboxPolicy and passes it to the shell,
so read-only and workspace-write sessions confine it identically. Without a
sandboxing executor it falls back to executing the parsed argv directly.
The Python detector is best-effort: it inspects the command text of shell-like tool calls. A determined caller can always find a new wrapper, so treat it as a guardrail for the model rather than a hard security boundary — the sandbox policy on
micromamba_runis the enforced boundary.
Install
Author the bundle in this directory, then install it in the current profile with
the Harness Plugin Manager (install_bundle), or let the agent do it. The
bundle patch inserts one Host row, micromamba-env, and the dsh.client
declaration loads client.js in the browser.
Configuration
The row config (in cordis.patch.yml) accepts:
| Field | Default | Meaning |
|---|---|---|
micromambaPath |
"" |
Absolute path to micromamba. Empty auto-detects: $MICROMAMBA / $MAMBA_EXE, then $HOME/bin, $HOME/.local/bin, /opt/homebrew/bin, /usr/local/bin, then PATH. |
rootPrefix |
"" |
micromamba root prefix (-r). Empty uses $MAMBA_ROOT_PREFIX, then micromamba's own default. |
extraEnvPaths |
[] |
Extra environment paths to show even when micromamba env list omits them. |
maxDetailEnvs |
25 |
How many environments get a package summary on the list call. |
maxPackages |
20000 |
Hard cap on packages returned by one package-list call. |
timeoutMs |
30000 |
Per-command timeout for every micromamba invocation. |
enforcePythonTool |
true |
Deny Python commands through Bash while a workspace has a selected environment. |
cacheTtlMs |
30000 |
How long an environment listing is reused. The panel's refresh button bypasses the cache. |
Example:
- insert:
- id: micromamba-env
name: 'dsh-micromamba-env'
config:
rootPrefix: /Users/you/.local/share/mamba
Repository layout
index.js plugin entry: tools, HTTP routes, system-prompt section
lib/config.js configuration schema
lib/micromamba.js executable discovery and micromamba reads
lib/selection.js per-workspace selection, execution, and the policy guard
client.js sidebar panel + composer picker
test/ unit tests (`npm test`)
Notes
- The
defaultflag comes frommicromamba info --json'senv location, i.e. the environment micromamba uses by default in the Harness process. It is not a live view of a terminal you may have activated elsewhere.selectedis the current workspace's own choice. - Environments outside the root prefix (for example a project-local
~/micromamba/envs/...) are labelledexternal. - The bundle has no static dependencies outside Node's standard library. Its
config schema prefers
@deepseek-ai/schemasterywhen the profile can supply it (loaded by absolute path, because a symlinked checkout cannot resolve the profile'snode_modules), and otherwise falls back to a small built-in Standard Schema with the same defaults and type checks. micromamba_runmapspython/python3/python.exeandRscriptonto the selected environment's interpreters, and setsPYTHONNOUSERSITE=1.
No comments yet. Be the first to write one.