Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dsh-proxy

本仓库由 DeepSeek Harness(DSH)智能体自动生成。 所有提交均由 DSH 完成,提交者:dsh

DSH 环境开关插件:一键切换 Clash 代理 + google_search 谷歌搜索工具。运行时可切换、无需重启、无需 Clash 系统代理、命令行启动同样生效。

功能

  1. 环境代理开关:侧栏底部(设置齿轮正上方)快捷按钮,单击立即切换(绿点 = 开 / 灰点 = 关);通用设置顶部有完整配置行(系统代理 / 手动配置)。
  2. 运行时生效:开启后 DSH 全链路(模型调用 / 内置搜索 / 网页抓取 / MCP)立即改走 Clash 代理,无需重启。
  3. google_search 工具:经 Clash 访问谷歌,三级降级(普通 SERP → Google News RSS → Google Scholar),结果标注 backend

使用方法(核心场景:Clash 运行但未开系统代理)

  1. 运行 Clash(只需运行,不需要开启 Clash 的「系统代理」——插件直连 Clash 本地端口 127.0.0.1:7897,与 Windows 系统代理无关)。

  2. 打开 DSH 网页界面,点击侧栏底部「环境代理」开关按钮。

  3. 测试外网访问:让 DSH 执行谷歌搜索任意词条,例如:

    google_search("OpenAI latest news")

    返回真实谷歌结果即成功([backend: news] 表示经 Google News 后端返回)。

  4. 建议在通用设置里选择「手动配置」,端口填 http://127.0.0.1:7897(默认值)——这样开关只依赖 Clash 本体在运行,与系统代理开关彻底无关。

  5. 关闭开关即恢复直连;配置持久化在 ~/.dsh/settings.yaml,重启 DSH 后自动恢复。

安装(profile 方式,无需重启)

  1. 将本仓库放入 profile 的 node_modules/dsh-proxy(或使用 dsh plugin add 安装)。

  2. 在 profile 的 cordis.patch.yml 加入激活行(live 热重载,无需重启 host):

    - insert:
        - id: dsh-proxy
          name: 'dsh-proxy'
  3. 刷新 DSH 网页即可看到侧栏按钮。

HTTP API

方法 路径 说明
GET /dsh-proxy/get { config, active, url, system, tool, toolRegistered }
GET /dsh-proxy/google 同上(别名)
POST /dsh-proxy/update { enabled, mode: system|manual, url },持久化并立即应用

开发与测试

node --check lib/index.js && node --check lib/google.js   # 语法检查
node test/runtime-switch-test.mjs          # 运行时 dispatcher 切换实证
node test/host-unit-test.mjs               # settings.yaml 读写 + 路由单测
node test/google-integration-test.mjs 词条 # 真实谷歌搜索集成测试(需 Clash 运行)

部分测试脚本内含本机绝对路径(DSH 安装目录),移植到其他机器时需按注释调整。

已知边界

  • web_fetch 工具在 DSH host 重启前直连(其内部自建 Agent,绕过全局 dispatcher);本插件已在加载时给 undici.Agent 打补丁,host 重启后 web_fetch 同样走代理。
  • 数据中心 IP 的谷歌网页版可能返回 JS 壳,此时 google_search 自动降级到 Google News RSS。

License

MIT

About

DSH 环境开关插件:Clash 代理一键切换(无需系统代理)+ google_search 谷歌搜索工具

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages