前言¶
DeepSeek Harness(DSH)採用「一切皆插件」的架構:能力靠插件疊加,但不同 DSH 版本之間的配置 schema、服務名、peer 聲明差異會讓「能裝上」和「能跑起來」變成兩件事。社區目錄裏一條條看說明、手動改 package.json 再試,成本高且不可複用。
dsh-autofit 是維護者 AdamPlatin123 發佈的工作流類 DSH 插件(npm 包名 dsh-autofit,當前版本 0.4.0,MIT)。定位是:在隔離環境裏做 L1/L2 試裝,能機械或規則修好的自動修,修不好的交給受護欄約束的 agent;通過組合包 UI 或 CLI 接入,並與 DSH Plugin Radar 的索引疊加。下文按「是什麼 → 怎麼用 → 注意點」展開。
這是什麼¶
一句話:在不碰你當前 profile 的前提下,對任意來源的 DSH 插件做試裝與兼容判定,必要時生成 +autofit.N 修復版再安裝。
倉庫內主要模塊(README 原文劃分):
- 組合包(插件頁內):添加插件菜單「Install with Autofit…」、Autofit 標籤頁(awesome 索引 + 雷達判定目錄)、詳情頁 Autofit check;新裝插件約 1 分鐘內後臺補測。
dsh-autofit/probe:零依賴 L1/L2 試裝器。dsh-autofit/autofix:試裝 → 規則修復 → 重打包 → 再試裝(最多 3 輪)。dsh-autofit/describe:L0 靜態畫像(類型、目標 profile、影響、運行要求)。scripts/build-index.mjs:把雷達運行級判定疊到 format-1 市場索引上。
目錄頁:SkillHub - dsh-autofit(社區插件站點,與 DeepSeek / 幻方無官方從屬關係)。源碼與文檔:GitHub - AdamPlatin123/dsh-autofit。
核心功能¶
試裝:probe(L1 / L2)¶
L1 爲真實安裝;L2 在 host 與 client 兩端嘗試加載。每次試裝使用臨時 DSH_HOME 與全新 web profile。
命令行示例:
npx dsh-autofit probe <插件 spec> # npm 名[@版本]、git spec、tarball 或目錄
npx dsh-autofit probe dsh-foo@1.2.0 --json
npx dsh-autofit probe dsh-foo --exempt # 原生版本拒裝時,在臨時 home 內豁免後繼續測
npx dsh-autofit probe dsh-foo --allow-builds node-pty
npx dsh-autofit probe dsh-foo --bin /path/to/other/dsh # 對另一個 DSH 版本試裝
npx dsh-autofit host # 當前 DSH 的版本、參數與能力分檔
程序化調用時,r.verdict 可取 pass | fail | incompatible | infra-fail | inconclusive | not-published;r.layers.L1 / L2.host / L2.client 與 r.codes(如 schema-additional-properties、native-build)供後續修復階梯使用。
隔離與邊界(README 明確說明): 安裝階段沿用調用方 npm 源與代理;加載階段用最小化環境。L2 會在本機執行插件代碼,不是安全沙箱;有容器時可用 --home 與 --phase install|boot 拆分聯網安裝與斷網加載。client 端經 Node 內置 WebSocket 走 Chrome DevTools 協議,依賴本機 Chrome / Edge / Chromium(可用環境變量 DSH_AUTOFIT_BROWSER);無瀏覽器時 client 標爲 unverified。
DSH 版本檔位(實測 0.0.1-rc.5 至 0.2.2-alpha.3):full(≥0.2.1)、standard(0.1.5–0.2.0)、basic(≤0.1.2),probe 行爲隨檔位變化(如原生版本拒裝識別、host 失敗是否 fatal、client 是否完整執行)。
修復:autofix 階梯與 agent¶
npx dsh-autofit fix <插件 spec> [--allow-builds node-pty] [--json]
規則層級(README 表格摘要):
| 層級 | 作用(節選) |
|---|---|
| A 機械 | 放寬 peer / engines.dsh;舊 patch 寫法改爲頂層列表等 |
| B 規則 | schema 補 additionalProperties;工具補 output;已知服務改名(僅改 inject 與取服務處) |
| C 需授權 | 被攔下的依賴構建腳本,用戶批准後帶 allowBuilds 重試 |
| D agent | 規則不足時用 DSH 默認 llm 開修復對話 |
修復版爲本地 tarball,版本形如 <版本>+autofit.N,package.json 的 autofit 字段記錄來源與改動;原包不修改,未通過試裝的不提供安裝。規則修好的版本組合包會直接安裝;agent 修好的需在小窗查看 diff 後點「安裝修復版」。
agent 僅有 list_files / read_file / write_file / replace_in_file / run_trial / finish,且 run_trial 通過纔算修好;lib/autofix/guard.js 限制對 package.json 關鍵字段、bundle patch、.register 等危險改動。
組合包 UI 工作流¶
裝 dsh-autofit 組合包後,典型路徑包括:
- 「添加插件」→「Install with Autofit…」:輸入 npm、git、tarball 或本地路徑,點「Install with autofix」;右下角小窗依次試裝、規則修復、agent 修復、安裝,可最小化或關閉,任務後臺繼續。
- Autofit 標籤頁:瀏覽帶雷達判定的卡片,每張可「Install with autofix」。
- 插件詳情:Autofit check 區塊與標題旁標籤;任意入口安裝的插件約 1 分鐘內後臺自動補測。
跨版本入口(README 2026-11-06 表):0.2.1-rc.2 至 0.2.2-rc.1 等多版本在插件頁 Autofit 標籤、添加菜單、詳情區塊可用;更早版本對應 Autofit Installer 或設置裏的 Autofit 標籤。
安裝與啓用¶
先在 web profile 安裝組合包(命令須與 README 一致):
dsh plugin --profile web add dsh-autofit # 或在 DSH 插件頁「Add plugin」裏輸入 dsh-autofit
dsh --profile web # 插件頁 → Add plugin 下拉 / Autofit 標籤頁
桌面版(官方 DeepSeek Harness 或社區 DSH Desktop):只能在應用內插件頁「Add plugin」輸入 dsh-autofit,往 desktop profile 安裝;內置運行時版本可能與全局 CLI 不同,probe 會按應用內 DSH 實測(README 對官方 0.2.2-rc.1、社區 2.0.x 等有記錄)。
僅 CLI、不裝組合包時,可單獨使用:
npx dsh-autofit probe <插件>
npx dsh-autofit fix <插件>
包要求 Node >=22(package.json 的 engines)。
典型用法¶
場景一:裝社區插件前先判定
npx dsh-autofit probe dsh-foo@1.2.0 --json
根據 verdict 與 codes 決定是直接 dsh plugin add 還是走 fix。
場景二:在 DSH 插件頁一鍵 autofix
打開 web profile 插件頁 → Autofit 或 Install with Autofit… → 輸入包名或路徑 → 等待小窗完成試裝與修復階梯。
場景三:對比另一套 DSH 版本
npx dsh-autofit probe dsh-foo --bin /path/to/other/dsh
場景四:開發側生成雷達疊加索引
維護者本地:
node scripts/build-index.mjs # 生成雷達疊加索引
適用場景與注意¶
適合誰: 經常從 npm、git、本地目錄試裝 DSH 插件的開發者;需要在一臺機器上對齊多個 DSH 版本(含桌面內置運行時)的兼容結論時;希望把 Radar 目錄上的「能不能跑」與安裝動作串成一條工作流的用戶。
務必注意:
- 插件與 probe 的 L2 階段以當前 DSH 進程權限在本機執行代碼,安裝前應閱讀目標插件源碼與許可證,勿把試裝當作惡意代碼隔離。
- agent 修復會改插件副本並可能引入行爲變化;規則自動安裝的改動記錄在
autofit字段,agent 版需你確認 diff 後再裝。 - 桌面版 UI 自動化驗證尚未完整(README:首次引導與「只能從應用內安裝」限制);CLI
probe/fix與組合包能力以你已安裝的 DSH / 桌面版本爲準查閱 README 實測表。 - autofix 實測數據(如 DSH 0.2.1-rc.2 下 9 個插件中 5 個規則修好)來自作者實驗環境,你的網絡、模型與插件版本可能不同。
結尾¶
dsh-autofit 把「裝之前先實測、裝不上嘗試規則與 agent 修復、有更新可先試」收進 DSH 插件頁與 npx 兩條入口,並與 Plugin Radar 索引聯動,減少手工改 manifest 的重複勞動。查閱詳情與 issue:
- 目錄頁:https://www.skillhub.cn/plugins/AdamPlatin123/dsh-autofit
- GitHub:https://github.com/AdamPlatin123/dsh-autofit