Introduction

DeepSeek Harness (DSH) uses a fixed undici Agent when handling internal requests, but external tools (such as shell, git, and npm) need to access the network through a proxy. Manually configuring environment variables is cumbersome and easy to overlook. This plugin aims to solve two problems: automatically injecting proxy environment variables when DSH starts and self-checking the entire proxy chain.

Core Features

  1. Automatic environment variable injection
    On startup, it writes HTTP_PROXY, HTTPS_PROXY, NODE_USE_ENV_PROXY, and NO_PROXY into the main process environment. All child processes automatically inherit these variables with no manual setx or restart required.

  2. Self-checking the entire proxy chain
    Tests are performed in the following order: port listening, CONNECT request, DNS resolution, and TLS tunnel detection. Results are written to $DSH_HOME/proxy-env/report.json.

  3. Tool registration
    Registers the proxy_env_check tool, allowing diagnostics to be run on demand.

Installation and Enablement

Install using pnpm:

pnpm add github:looeton/dsh-plugin-proxy-env

Include it in your configuration file:
* Configure it via cordis.patch.yml.
* Or add the package name to the profile’s dsh.profile.bundles.

Typical Usage

- id: proxy-env
  config:
    proxyUrl: http://127.0.0.1:7897
    noProxy: localhost,127.0.0.1,::1,api.deepseek.com
    selfCheck: true
    tool: true

Configuration options:
* proxyUrl: Proxy address; leave empty to auto-detect.
* noProxy: List of addresses that should bypass the proxy.
* selfCheck: Whether to run a self-check at startup.
* tool: Whether to register the proxy_env_check tool.
* override: Whether to override existing environment variables with the same names.
* patchGlobalDispatcher: Whether to dynamically switch the global dispatcher to EnvHttpProxyAgent (requires undici support).

Use Cases and Notes

  • Version requirement: Requires Node.js ^22.19.0 || >=24.0.0.
  • Process environment vs Web Fetch: This plugin manages process environment variables and does not affect DSH’s internal web_fetch (the latter uses an undici Agent with a fixed IP).
  • Windows dependency: The self-check logic relies on reg.exe to read the system proxy and uses file redirection instead of pipes due to the restricted-token sandbox.
  • Non-Windows environments: Does not read the system proxy and relies only on configuration and environment variables.