Preface¶
DeepSeek Harness (dsh) relies heavily on outbound HTTP for many capabilities: LLM conversations, web search, web_fetch, model discovery, MCP over HTTP, etc. — all of which ultimately go through the host process’s global fetch. On the Node side, the proxy is typically determined by NODE_USE_ENV_PROXY and HTTP(S)_PROXY, and this choice is usually resolved only once at startup within the process — changing process.env.HTTP_PROXY after startup generally has no effect. Previously, switching proxies meant modifying environment variables or configuration and restarting dsh. Below, we introduce the community plugin dsh-proxy-switcher (maintained by JinSuperOfficial, category: networking tools), which changes “which proxy to use” from a startup-time decision to a request-time decision. It lets you switch between direct connection, system proxy, or saved custom proxies in dsh Settings → Proxy, and changes take effect immediately without restarting dsh.
What Is This¶
dsh-proxy-switcher is a hot-switching proxy Cordis plugin for dsh. It supports HTTP, HTTPS, and SOCKS5 (including socks5h), and can switch outbound policies in real time from the settings UI, via commands, or through the API, covering all paths that use the global fetch.
- Directory page: https://www.skillhub.cn/plugins/JinSuperOfficial/dsh-proxy-switcher
- Source code and docs: https://github.com/JinSuperOfficial/dsh-proxy-switcher
- License: MIT (see the repository’s
package.json) - dsh version requirement:
>=0.2.0-rc.1(can automatically reuse@deepseek-ai/dsh-http-proxy; earlier versions use the plugin’s own built-in path)
The DSH ecosystem emphasizes “everything is a plugin”; community directories such as SkillHub are independent sites and have no official affiliation with DeepSeek / Higgsfield. Before installing third-party plugins, it is recommended to review the source code and license yourself, and understand that plugins run in the same process as dsh with the same permissions and privileges as the host.
What Problem It Solves¶
If the proxy behind dsh’s outbound requests cannot be changed simply by modifying environment variables after the process has started, switching network environments or debugging proxies requires a restart. This plugin works by replacing the undici global dispatcher used by Node’s built-in fetch (the global slot written by setGlobalDispatcher), installing a new transport policy at runtime. When switching, it calls close() on the old dispatcher so that in-flight requests can complete on the old connection, while new requests use the new policy.
On dsh 0.2.x, the plugin preferentially delegates to the official seam @deepseek-ai/dsh-http-proxy’s installProxyFromEnvironment, keeping the undici global dispatcher, proxyRouteFor() (which affects whether dsh-web-fetch-http pins addresses), and proxy environment variables inherited by child processes consistent. SOCKS5 is not supported by the official module by design, so the plugin installs the global dispatcher itself for SOCKS5.
Core Features¶
Three Modes and Multiple Proxy Profiles¶
- Direct: Direct connection.
- System: Follow
http_proxyetc. in the system/environment (policy is a snapshot; after changing environment variables, click Re-read env & apply in the settings page or run/proxy on— no restart needed). - Custom: Switch by selecting one from multiple saved proxies; the editor supports protocol, host, port, username, password (masked), password sourced from environment variable
passwordEnv, and per-proxyno_proxy.
The settings page Settings → Proxy provides the current active state, mode switch, saved proxy list (Test / Edit / Add), advanced options (global no_proxy, probe URL, timeout, refuse or direct-connect when proxy is missing, automatic fallback after consecutive failures), recent activity (sanitized), and operations such as Save and apply, Test current, and Re-read env & apply. One-click switching in the list and mode takes effect immediately and is saved; changes in the editor require Save and apply.
Other Entry Points¶
/proxycommand:status,on,off,direct,system,use <id>,temp <id>,test [id], etc.- Plugin API (for other Cordis plugins):
ctx.proxySwitcher.status(),config(),configure(patch),applyRuntime(patch),reset(),test(candidate). - HTTP (used by the settings page, with same-origin validation):
GET/POSTat/dsh-proxy-switcher/*(e.g.,state,status,apply,reset,reapply,test).
Configuration and Priority¶
Default config file: $DSH_HOME/proxy-switcher.json, can be overridden with the environment variable DSH_PROXY_SWITCHER_CONFIG. Fields include enabled, mode (direct|system|custom), activeProfile, profiles[], noProxy, probeUrl, timeoutMs, onMissingProfile (default block), fallback, etc.; see the repository’s config.example.json for examples.
Priority (high to low):
Runtime settings (settings page / /proxy / API) > environment variables > config file > defaults
Common environment variables: DSH_PROXY_SWITCHER_ENABLED, DSH_PROXY_SWITCHER_MODE, DSH_PROXY_SWITCHER_PROFILE, DSH_PROXY_SWITCHER_URL, DSH_PROXY_SWITCHER_NO_PROXY, etc. (see the table in the README for details).
Security and Compatibility¶
Passwords are not returned in plaintext to the browser via the API; logs and state are sanitized through redactProxyUrl(). It is recommended to use passwordEnv to avoid passwords being written to disk. HTTP interfaces perform same-origin and loopback validation.
- Runtime: Node 22.19+ / 24+ (README documents tested configurations such as Electron 44 ↔ Node 24.18.1).
- Proxy protocols: http, https, socks5 / socks5h.
- Operating systems: the implementation depends on
node:net/node:tls/undiciwith no platform-specific code; there are tested records on Windows.
Installation and Enabling¶
The repository provides a PowerShell installation script (backs up the profile’s package.json, creates a junction in <profile>/node_modules/ pointing to the plugin directory, writes dependencies and dsh.profile.bundles; does not run pnpm, does not access the network, does not modify the lockfile):
pwsh -File install.ps1 # default desktop profile
pwsh -File install.ps1 -Profile web
You can also use dsh’s official installer (requires pointing to the plugin directory on your machine):
dsh plugin --profile desktop add link:<this directory>
After installation, dsh needs to reload the loader for the plugin to appear in Settings → Proxy; before that, it is just files on disk and does not affect behavior.
Uninstallation:
pwsh -File uninstall.ps1 # removes junction + reverts package.json changes
pwsh -File uninstall.ps1 -RestoreBackup # additionally restores package.json from before installation
On uninstall, the plugin restores the dispatcher and proxy environment variables from startup. To clear saved proxy configuration, delete $DSH_HOME/proxy-switcher.json. To upgrade, overwrite the plugin directory and reload the loader; the junction will still point to that directory.
Typical Usage¶
- Complete the installation and reload the loader as described above, then open Settings → Proxy.
- If
http_proxyis already set on the machine, you can select System; after changing shell environment variables, click Re-read env & apply. - Click Add proxy to fill in an HTTP/HTTPS/SOCKS5 proxy, pass Test this proxy, then Save and apply; single-select in the list to hot-switch.
- Temporary direct connection for debugging: set the mode to Direct, or use the command
/proxy direct; to restore the system proxy, use/proxy systemor/proxy on. - Check status:
/proxy status, or (same-origin)GET /dsh-proxy-switcher/status.
The repository README notes: after reloading the loader, no full-process restart is needed; POST /apply with persist:false can temporarily change the mode within the current process (not written to file).
Use Cases and Known Limitations¶
Suitable for: switching between corporate network / home network / local Clash and other proxies within the same dsh session; debugging LLM, search, and web_fetch outbound paths; saving multiple proxies and testing them with one click.
Important notes:
- The plugin runs in the same process as dsh; review the source code and MIT license before installing.
- OTLP telemetry does not go through the proxy (telemetry can be disabled with
DSH_TELEMETRY_MODE=DISABLED). web_fetchunder SOCKS5 may connect directly (related to the design ofdsh-http-proxy/proxyRouteFor()); LLM, search, etc. can still go through the proxy under SOCKS5 as described in the README.systemmode does not re-read environment variables on every request; manual Re-read env & apply is required.- Model self-authored programs / workers intentionally do not get the proxy (dsh design, to avoid leaking proxy URLs containing passwords).
onMissingProfiledefaults toblock, to avoid mistakenly believing traffic is going through the proxy when it is silently connecting directly.
Local test run (no network, using fake proxies):
pwsh -File test/run-tests.ps1
Conclusion¶
dsh-proxy-switcher addresses the constraint that dsh’s outbound proxy “only takes effect after a restart”, by implementing runtime switching between direct connection, system proxy, and multiple custom proxies through the undici global dispatcher and the official dsh-http-proxy seam (when available). All operations can be performed via the settings page, /proxy, or the API. If you frequently debug networking capabilities in DSH, you can check the introduction on the SkillHub directory page and read the full README, configuration examples, and limitation descriptions on GitHub before installing.