跳到正文
dsh-market 浏览插件 GitHub EN

173787247/dsh-wsl-fetch

在 ctx.web 注册 wsl-proxy 抓取后端,让官方 web_fetch 经 HTTP(S)_PROXY 用 undici ProxyAgent 出网,避免官方实现在 WSL 里 DNS 钉死后直连公网 IP,从而在 Windows 代理后出现 TypeError: fetch failed。

Star 数 ★ 1 分类 WSL 与 Windows 互操作 收录于 2026-09-09

安装

在 DeepSeek Harness 里通过 dsh-market 安装

dsh plugin --profile web add dshmarket

或使用命令行

dsh plugin --profile web add github:173787247/dsh-wsl-fetch

装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络。请先审阅源码,并尽量锁定 commit(github:owner/repo#sha)。

README

套件: dsh-wsl-kit。KIT_SET=daily 或 llm 都会安装本插件。

版本 / 兼容一行: 见下方 兼容性(与 dsh-wsl-kit 同步)。

让官方 web_fetch 从 WSL 走 Windows HTTP 代理,而不是直连公网 IP。

English → README.md

在套件里的位置

让官方 web_fetch 走 Windows HTTP 代理。dsh-wsl-net 只诊断,本插件才真正去抓。

flowchart LR
  agent["web_fetch"] --> fetch["dsh-wsl-fetch"] --> proxy["Windows HTTP 代理"] --> web["HTTPS"]

整套关系图和版本快照:dsh-wsl-kit 中文说明。本插件是 0.1.2(daily,也在 llm)。不要把那份总表抄进本 README。

兼容性

项 值
插件 dsh-wsl-fetch 0.1.2
最低 dsh ≥ 0.1.2(Windows 中继 :3081 一次性 ?token=)
最新验证 以 dsh-wsl-kit 兼容性 为准(当前 0.2.0-rc.2)— 套件唯一真源
套件档位 daily(亦含于 github / full;fetch+net 亦在 llm)
云端 Flash settings / llm-deepseek 使用 deepseek-flash(V4.1 Flash);本插件不配置模型 id
Agent Teams 上游实验包;本插件不依赖

套件版本地板:check-plugin-versions.sh。故障树:TROUBLESHOOTING.zh.md。

范围: 进程内官方 web_fetch 走 undici ProxyAgent。需要 HTTP(S)_PROXY。经 Clash 遇到 Cloudflare 403/1010 需对该域名 DIRECT——不在本插件能力内。

为什么

官方 dsh-web-fetch-http 在 WSL 解析 DNS 后,用自定义 undici Agent 直连该 IP,从而绕过 NODE_USE_ENV_PROXY。DeepSeek API 可以通,Mattermost / 文档站的 web_fetch 却报 TypeError: fetch failed。

dsh-wsl-net 只给 bash/npm 子进程注入代理,管不到进程内的 web_fetch。

本插件注册 wsl-proxy;存在 HTTPS_PROXY / HTTP_PROXY 时选中它,用 ProxyAgent 抓公网 HTTPS。内网和 localhost 仍然拒绝。

安装

dsh plugin --profile web add github:173787247/dsh-wsl-fetch

或经套件:KIT_SET=daily bash install.sh(已含本插件)。

本地目录:

dsh plugin --profile web add /path/to/dsh-wsl-fetch

用套件 restart-dsh-web.sh 重启(带 NODE_USE_ENV_PROXY=1 和代理环境)。新开会话。

awesome 已收录:条目(#4736 已合)。

配置

- id: dsh-wsl-fetch
  name: dsh-wsl-fetch
  config:
    timeoutMs: 30000
    maxRedirects: 5
    retries: 2
    retryDelayMs: 400
键 默认 含义
timeoutMs 30000 单次抓取超时
maxRedirects 5 同站重定向(允许 www ↔ 裸域)
retries 2 代理/网络瞬时失败后的额外重试
retryDelayMs 400 重试基础间隔(× 次数)
maxResponseBytes 5000000 响应体字节上限
maxBodyChars 100000 解码后字符上限
userAgent 产品 UA 请求 User-Agent

没有 HTTP(S)_PROXY 时插件保持注册但不可用,继续走官方 http。

成功 / 失败怎么判断

  • 日志出现 [dsh-wsl-fetch] web_fetch via proxy (...:端口) provider=wsl-proxy → 后端已启用。
  • UI 变红但有上述日志 → 单个 URL 的代理/TLS/站点问题,换源再抓;不是「没装插件」。
  • 经 Clash 遇到 Cloudflare 403 / 1010 → 站点 WAF;对该域名加 Clash DIRECT。本插件改不了 WAF。

测试

npm test
# 走真实代理(与 dsh web_fetch 同路径)
bash scripts/stress.sh

变更记录

见 CHANGELOG.md。

许可

MIT

内容来自项目 README(GitHub)↗

评论

评论存放在 GitHub Discussions。用 GitHub 账号登录后可发表评论或点表情。