dsh-plugin-proxy: DSH Runtime Proxy Switching Plugin

Introduction

When developing agents based on DeepSeek Harness (DSH), you often need to switch proxy servers based on network environment or specific tasks. Manually modifying configuration files and restarting services is not flexible enough, and using system proxies can affect other processes. The DSH plugin system aims to solve such problems through modularization, and dsh-plugin-proxy was created for this purpose.

What is This

This is a DSH plugin for dynamically switching outbound proxies at runtime. It takes over globalThis.fetch requests within the DSH process, supporting both HTTP and SOCKS5 protocols. The plugin maintainer ID is 1624318455, and it is released under the MIT License.

It addresses the need to quickly switch proxy modes, configure proxy whitelists, and pass proxy environment variables to child processes during DSH runtime—all without restarting the process.

Core Features

  1. Runtime Switching: Supports three modes: direct (direct connection), system (follow system proxy), and manual (manually specified). Changes take effect immediately after configuration updates.
  2. Web Settings Card: Configure directly through the DSH Web interface (Settings → Plugins → Plugin configuration) without needing to edit configuration files.
  3. Unified Protocol Matching: HTTP and SOCKS5 use the same routing dispatcher, with noProxy rules having consistent semantics across both protocols.
  4. Child Process Inheritance: When exportEnv is enabled, the plugin passes environment variables such as HTTP(S)_PROXY to child processes launched by DSH (e.g., curl, git in bash-tool).

Installation and Activation

Before installation, ensure your environment meets the requirements: DSH version ≥ 0.1.2-rc.1, Node.js version ≥ 20.

Run the following command to install:

dsh plugin --profile <name> add github:1624318455/dsh-plugin-proxy

After installation, restart the dsh web service, and the plugin will be available in the settings.

Typical Usage

You can configure by editing the $DSH_HOME/settings.yaml file or using the Web settings card.

Configuration Example

Add the dsh-proxy configuration section to settings.yaml:

dsh-proxy:
  mode: manual                           # direct | system | manual
  proxy: socks5://127.0.0.1:1080         # only effective in manual mode
  noProxy:
    - localhost
    - .internal.example
  exportEnv: true                        # only effective in manual mode, passed to child processes

Mode Description

Mode Behavior
direct All requests are connected directly without going through a proxy.
system Reads system environment variables or macOS system network proxy settings. The proxy, noProxy, and exportEnv settings in the configuration file are ignored in this mode.
manual Uses the proxy address specified in the proxy field of the configuration file; noProxy is used to bypass specific hosts.

Use Cases and Notes

Use Cases:
* Agent development requiring quick switching between different network environments.
* Scenarios where LLM requests, web searches, and HTTP MCP servers need to go through a unified proxy.
* Scenarios where child processes (e.g., Git operations) also need to use the proxy.

Notes:
* Process Isolation: The plugin only affects fetch requests within the DSH main process. The built-in Browser Host and browser download features are independent processes that do not go through this plugin’s proxy; you need to configure the browser proxy separately.
* Bedrock Routing: If using pi-ai’s Bedrock routing, the AWS SDK manages its own proxy, and the environment variables exported by the plugin will also be read by the SDK in this case.
* Child Process Timing: exportEnv only applies to child processes launched after the plugin is loaded. Child processes already running before switching modes will not automatically update their environment variables.
* SOCKS5 Experimental: The underlying Undici SOCKS5 Agent is currently marked as an experimental feature upstream.
* Manual Mode Environment Variables: In manual mode, the plugin ignores HTTP_PROXY/NO_PROXY and other variables in the current environment, and routing decisions are entirely determined by the configuration file.

Summary

dsh-plugin-proxy provides flexible proxy management capabilities for DSH. Through configuration files or the Web card, developers can adjust routing strategies without restarting the service. Combined with the exportEnv feature, it effectively solves the issues of proxy isolation and unification for network requests in agent development.

For more details, visit: GitHub Repository | DSH Plugin Directory

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

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

Xiaoye