DeepSeek Harness Plugin

mafeis/dsh-net-proxy

Stars ★ 20 Downloads (30d) 1,843 Category Tools & Capabilities Added 2026-08-14 npm dsh-net-proxy

Route agent network requests through a local HTTP/CONNECT/SOCKS5 proxy.

Install

# from npm (prebuilt)

dsh plugin --profile web add dsh-net-proxy

# from a prebuilt release tarball

dsh plugin --profile web add "https://github.com/mafeis/dsh-net-proxy/releases/latest/download/dsh-net-proxy.tgz"

# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)

dsh plugin --profile web add github:mafeis/dsh-net-proxy

Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).

README

This plugin publishes its README in Chinese only.

DeepSeek Harness 网络代理插件:让 agent 自己发起的网络请求(web_search / web_fetch / 外部 API)走你配置的 HTTP / HTTPS-CONNECT / SOCKS5 代理,配置持久化、启动即自动生效,并提供可视化设置页。

安装

dsh plugin --profile web add dsh-net-proxy

安装后重启 dsh web,在 设置 → 网络代理 里启用并填写代理地址(如 127.0.0.1:7890)。

或从 GitHub 直装(始终取最新 main,未经 npm 版本校验):

dsh plugin --profile web add github:mafeis/dsh-net-proxy

也可手动在 profile 的 cordis.patch.yml 加入:

- insert:
    - id: net-proxy
      name: 'dsh-net-proxy'

兼容的 DSH 版本

DSH 运行时 状态
0.1 线(如 0.1.7-rc.2) 兼容
0.2 线(0.2.0-rc.1 / 0.2.0-rc.2 / 0.2.x) 兼容(0.8.0 起)

主要功能

双通道代理生效:包装 agent 进程的全局 fetch(手写 HTTP/SOCKS5 转发,零运行时依赖),同时把生效策略同步安装进 web_fetch 实际使用的 harness 代理层——两类请求全覆盖,停用/卸载完整还原。

跟随系统代理:每 3 秒读取系统代理设置,自动启停、自动跟随端口变化(v2rayN / Clash 切换无需改配置);系统关闭时回退手填地址;Windows ProxyOverride 绕过列表自动并入 NO_PROXY。

请求日志:经插件代理的每条请求一条记录——方法、URL、状态码、耗时、上下行流量、发送/返回内容预览;全部内存环形缓冲(最近 500 条),不落盘、不外发,占用有硬上限(< 1MB,可熔断)。

本地中继:web_fetch 流量经本地回环中继过插件之手——可观测、可统计,同时解除 harness 层的 SOCKS5 限制(socks5 配置现在全覆盖)。中继端口在插件进程内终身不变,第三方单例代理组件的地址引用不会过期;中继意外停止时 5 秒内自动重装策略。

流量图表:请求日志实时聚合为时间线 / 状态分布 / 耗时分布 / 通道分布 / 目标主机 TOP 10 五张自绘图表,前端纯函数聚合、零新增存储、5 秒刷新。

JSON 详情:日志条目展开关键信息,「详情」弹窗内查看完整请求/响应内容;JSON 体自动渲染为可折叠树视图,完整内容按需加载(单条 ≤256KB / 总池 ≤4MB 硬上限)。

设置页:一级菜单 + 页内二级标签(代理设置 / 请求日志 / 流量图表),连通性探测、地址过滤、渐进加载;配色全部走宿主主题变量,视觉与宿主一致。

不代理的范围

Desktop 侧边栏浏览器:右侧「浏览器」页面由 Electron <webview> guest 实现,代理策略在 Electron 主进程的 session 上,而插件宿主是主进程拉起的子 Node 进程、够不到 session——在插件里做的任何配置(启停、改端口、改协议)对侧边栏都不生效,其流量不经过插件,请求日志里也不会有它的记录。侧边栏始终跟随 Windows 系统代理(Chromium 默认行为):跟随系统时两者出口一致;插件配置偏离系统代理时,侧边栏仍按系统代理走。属 DSH 架构限制,需主进程侧桥接(#6),lib/desktop-session.js 已保留为就绪桩,未来宿主在主进程内加载插件时自动激活。

TLS 隧道内容:隧道内加密不可见,只记目标与字节数。

配置字段(net-proxy.json)

字段 默认 含义
enabled false 是否启用代理
followSystem false 跟随系统代理
protocol http http(含 CONNECT 隧道)或 socks5
host / port 127.0.0.1 / 7890 代理地址
timeout 60000 插件 fetch 转发的超时,单位毫秒,整数 1–2147483647;设置页以秒编辑
alpn http/1.1 TLS ALPN 声明:http/1.1(只声明 HTTP/1.1)、h2(优先 h2,失败可降级)、off(不声明 ALPN)。见 ALPN 与 h2 降级
h2Fallback true alpn: "h2" 时,握手被重置(ECONNRESET 等)且尚未发出请求字节,则改按 HTTP/1.1 重试一次
username / password 空 可选认证
noProxy ["127.0.0.1","localhost","::1"] 命中则直连
logEnabled true 请求日志开关(关闭后不再记录新条目)
logPreviewBytes 512 每侧内容预览的最大字节数(0–8192,0 = 不记内容)

ALPN 与 h2 降级

TLS ClientHello 里的 ALPN 对代理是可见的,部分代理出口/目标边缘一见到 h2 就把连接 RST,表现为 TLS to <host> failed: read ECONNRESET(#13)。

因此默认改为只声明 http/1.1:

  • 默认(alpn: "http/1.1"):不出现 h2,对 h2 敏感的链路直接可用;代价是拿不到 h2 的多路复用。
  • alpn: "h2":仍然优先 h2,但握手被重置且请求字节尚未发出时,会自动重拨隧道并以 http/1.1 再握一次。写过请求字节就不再重试,流式 body 因此不会被重放。窄带联通后再遇到同类目标会记住(按「协议+代理+目标」记最多 256 条,代理或 ALPN 设置变更即清空),不必每条请求都先失败一次。
  • h2Fallback: false:保留重试前的行为——只握一次,失败即抛。
  • alpn: "off":完全不发 ALPN 扩展(个别老代理需此)。

目标是仅支持 h2 的服务(且链路不重置)时,用默认的 http/1.1 会握手失败;把 alpn 设为 h2 即可。

技术说明

  • harness 代理层:DSH ≥ 0.1.5-rc.1 起 web_fetch 的出口不经过 globalThis.fetch,由 harness 的代理策略模块 @deepseek-ai/dsh-http-proxy 决定走向(#5)。插件定位 harness 已加载的同一模块实例(桌面端命中 app.asar 内实例,CLI 布局按 argv/bare 顺序回退)同步安装策略,停用与卸载还原到安装前状态。
  • 协议限制:harness 代理层只接受 http:// 代理 URL。协议选 socks5 时由本地中继桥接,socks5 两层全覆盖;PAC 模式暂不支持自动跟随,回退手动配置并提示。
  • 隐私边界:日志与完整内容只存内存、不落盘、不外发;TLS 隧道内容不可见;二进制内容不存(只记类型与大小);清空日志即彻底消失。
  • 零运行时依赖:代理栈、中继、日志、图表全部 Node 原生模块 + 自绘实现。
  • 宿主兼容自检:node tools/dsh-compat-probe.mjs <含 node_modules/@deepseek-ai 的目录>(通常是 ~/.dsh/profiles)用真实 cordis + dsh-host-webserver 挂载本插件,再直接请求 /_dsh/net-proxy 与 /_dsh/net-proxy/log,打出激活期与请求期的每条错误。排查「换了 DSH 版本后插件还灵不灵」时先跑它;退出码非 0 即存在硬错误。

许可证

MIT

变更历史见 GitHub Releases。

Content from the project README on GitHub ↗

Links

More in this category

View the whole category →

Community comments

Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.