DeepSeek Harness 插件:sevastopol36/dsh-plugin-ghproxy

前言

DeepSeek Harness (DSH) 的核心能力依賴於插件生態。當本地網絡無法直接訪問 GitHub 或 api.github.com 時,開發者需要繞過網絡限制。sevastopol36/dsh-plugin-ghproxy 是一個原生 Cordis 插件,它通過公共代理鏡像轉發請求,解決直連超時問題。該插件不依賴外部運行時庫,使用 Node.js 內置模塊實現。

安裝

使用 DSH 命令行工具安裝該插件:

dsh plugin --profile web add github:sevastopol36/dsh-plugin-ghproxy

安裝完成後,需重啓 profile(如 dsh web)以加載插件。

核心能力

該插件提供以下能力:

  1. 多鏡像容錯:按順序嘗試多個代理,第一個健康的勝出,失效的自動跳過。
  2. 健康度記憶:每個鏡像的成功/失敗結果緩存 5 分鐘,避免反覆測試不健康的鏡像。
  3. 讀取文件:支持讀取 raw、blob、gist 及 api.github.com 的 JSON 數據。
  4. 下載文件:支持下載 release 資產、倉庫歸檔和 gist 到本地。
  5. 命令行加速:生成鏡像 URL,供 git clone、curl 或 wget 使用。
  6. 自帶診斷:通過命令測試每個鏡像的健康狀況。
  7. 零運行時依賴:僅使用 Node.js 內置的 fetch、fs 和 stream。

使用方式

插件註冊了以下工具:

  • 讀取文件
    使用 sevastopol36_ghproxy_fetch 讀取 raw / 文本 / JSON。如果文本過大或爲二進制,會自動落盤。

  • 下載文件
    使用 sevastopol36_ghproxy_download 下載 raw、release 資產、archive、gist 到本地。

  • 生成 URL
    使用 sevastopol36_ghproxy_proxy_url 生成鏡像 URL。

  • 診斷
    使用 sevastopol36_ghproxy_probe 實測每個鏡像,並給出建議的 proxyBases 配置。

  • 終端用法
    直接使用代理 URL 進行操作:

    git clone https://gh-proxy.com/https://github.com/<owner>/<repo>.git
    curl -LO https://gh-proxy.com/https://github.com/<owner>/<repo>/releases/download/<tag>/<asset>

配置示例

插件支持通過 YAML 配置。默認配置如下:

- id: sevastopol36-ghproxy
  config:
    proxyBases:
      - 'https://gh-proxy.com'
      - 'https://sevastopol36-ghproxy.net'
      - 'https://ghfast.top'
      - 'https://gh.ddlc.top'
      - 'https://gh.jasonzeng.dev'
    downloadDir: 'downloads/github'
    timeoutMs: 60000
    retries: 1
    retryDelayMs: 800
    healthCacheMs: 300000
    maxTextBytes: 262144
    maxBytes: 209715200
    overwrite: false
    allowApi: true

注意事項

  • 版本變更:0.1.0 版本硬編碼了單一代理 https://gh.jasonzeng.dev,該服務現已失效,無法抓取任何內容。0.2.0 版本改爲多鏡像列表。
  • 運行環境:僅支持 Node.js >= 22.19.0。
  • 權限:插件以當前 DSH 進程的權限運行,請確保代理鏡像不會訪問敏感信息。

生態背景

該插件託管在社區目錄,與 DeepSeek 或幻方官方無從屬關係。

  • 項目主頁:https://github.com/sevastopol36/dsh-plugin-ghproxy
  • 社區目錄:https://www.skillhub.cn/plugins/sevastopol36/dsh-plugin-ghproxy
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜