DamonKoy/dsh-plugins--packages-dsh-system-proxy0

dsh-system-proxy

DeepSeek Harness 系统代理插件:检测 macOS scutil 或环境变量代理,提供代理状态与导出工具及 RPC。

AI 分析

核心用途是自动检测并适配系统代理设置。适合在受限网络环境下,需要 DSH 智能体自动识别 macOS 或环境变量代理以确保联网请求畅通的用户。

包名
dsh-system-proxy
版本
0.1.0
最近更新
2026年8月15日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:DamonKoy/dsh-plugins#fd97e01fb1c26454f27310dd42a6f8d7b66e8e29&path:packages/dsh-system-proxy

dsh-system-proxy

System proxy support for DeepSeek Harness. Inspired by the PAC/WPAD system proxy routing in Codex 0.143 — implemented as a user-space plugin.

English | 中文

What it does

  • System proxy detection:
    • macOS: reads scutil --proxy and extracts the HTTP/HTTPS proxies and the PAC/WPAD URL (HTTPEnable / HTTPProxy / HTTPPort, HTTPSEnable / HTTPSProxy / HTTPSPort, ProxyAutoConfigEnable / ProxyAutoConfigURLString). Degrades gracefully to environment variables when scutil is unavailable.
    • Linux / other: reads HTTP_PROXY / HTTPS_PROXY / ALL_PROXY / NO_PROXY from the environment (both cases, ALL_PROXY as fallback).
  • system_proxy_status model tool: read-only report of the detected proxy, the plugin-config overrides in effect, detection source (scutil / env / none) and the no_proxy list.
  • proxy_export model tool: returns a bash snippet (export http_proxy=... https_proxy=... no_proxy=...) the model can paste into a terminal command so child processes use the proxy.
  • Package-private RPC (harness.handle): system-proxy/status for client halves and other plugins — same payload as system_proxy_status.

Install

dsh plugin --profile web add link:~/dsh-plugins/packages/dsh-system-proxy

Restart dsh web.

Config

Optional file ~/.dsh/dsh-system-proxy.json:

{
  "overrideHttp": "",
  "overrideHttps": "",
  "overridePac": "",
  "noProxy": "localhost,127.0.0.1,.local",
  "allowExportEnv": true
}
FieldDefaultMeaning
overrideHttp""Overrides the detected HTTP proxy (empty = use detection)
overrideHttps""Overrides the detected HTTPS proxy
overridePac""Overrides the detected PAC/WPAD URL
noProxy"localhost,127.0.0.1,.local"no_proxy list used by proxy_export
allowExportEnvtruefalse disables proxy_export (see Security notes)

Config is re-read on every call, so edits apply without a restart. The detected system values stay visible read-only in the detected field; the override* fields only win when non-empty.

Example outputs

system_proxy_status (macOS with scutil):

{
  "platform": "darwin",
  "source": "scutil",
  "viaEnv": false,
  "httpProxy": "http://192.168.1.1:8080",
  "httpsProxy": "http://192.168.1.1:8443",
  "pacUrl": null,
  "noProxy": "localhost,127.0.0.1,.local",
  "detected": {
    "httpProxy": "http://192.168.1.1:8080",
    "httpsProxy": "http://192.168.1.1:8443",
    "pacUrl": null
  },
  "override": { "httpProxy": "", "httpsProxy": "", "pacUrl": "" },
  "allowExportEnv": true,
  "configPath": "/Users/you/.dsh/dsh-system-proxy.json"
}

proxy_export (success):

{
  "exported": true,
  "shell": "bash",
  "command": "export http_proxy='http://192.168.1.1:8080'\nexport https_proxy='http://192.168.1.1:8443'\nexport no_proxy='localhost,127.0.0.1,.local'",
  "exportedVars": ["http_proxy", "https_proxy", "no_proxy"]
}

proxy_export returns { "exported": false, "reason": "..." } when no proxy is detected, when only a PAC URL is present (PAC cannot be expressed as environment variables), or when allowExportEnv is false.

Platform differences

PlatformDetectionNotes
macOSscutil --proxyFalls back to env vars when scutil fails or is absent
Linuxenv vars onlyHTTP_PROXY / HTTPS_PROXY / ALL_PROXY / NO_PROXY
Windowsenv vars onlySame as Linux (no registry/WinINET probing)

HTTPS proxies are reported as http:// URLs — HTTPS traffic goes through an HTTP proxy via CONNECT, which is what https_proxy means everywhere.

Security notes

  • proxy_export writes the proxy into child-process environment variables, which changes their network egress — that is a security-sensitive operation. Set "allowExportEnv": false in the config to disable it entirely; the tool then returns a denial reason.
  • Proxy values may contain credentials (user:pass@host) if you put them in override* fields or the environment; they are stored in your home-dir config file and appear in tool output.
  • This plugin does not modify the DSH host process's own LLM request network stack — that belongs to the core llm layer and is not reachable from a plugin. It is the user-space version of Codex system proxy support: detection, status queries, and explicit opt-in for child processes / terminal commands.
  • Detection is read-only; nothing is persisted or uploaded.

License

MIT