前言¶
DeepSeek Harness(DSH)採用「一切皆插件」的理念,內置的插件列表通常只能查看已安裝的包,看不到是否有更新或與當前運行時版本是否兼容。開發者需要手動去 npm 查詢版本、比對 peerDependencies,或者打開瀏覽器逐個檢查。這種割裂的檢查方式容易遺漏更新,也容易在升級 DSH 後遇到不兼容的插件。
這是什麼¶
dsh-plugin-update-checker 是一個 DeepSeek Harness 插件,爲「內置插件」設置頁增加了一個「Check updates」選項卡。點擊按鈕後,插件會掃描所有已安裝的插件包,分別檢查它們在 npm 上的最新版本,以及與當前 DSH 運行時的 peerDependencies 兼容性,並在表格中逐行展示結果。它不提供自己的配置,只負責報告和提供一鍵更新動作。
核心功能¶
更新可用性檢查¶
插件通過 npm registry 的 latest 標籤,對比已安裝版本和 registry 上的最新版本。對於通過 tarball / git / path 安裝的包,插件會將其標記爲「Unsupported」,而不是錯誤地顯示「Up to date」。這意味着本地或私有倉庫的包不會因爲無法訪問 registry 而被誤判爲最新。
兼容性檢查¶
插件複用 @deepseek-ai/dsh-app-boot 的 evaluatePluginCompatibility 邏輯,將每個插件的 @deepseek-ai/dsh* peerDependencies 與當前 DSH 版本進行比對。如果存在精確版本豁免(在 compatibility.json 中聲明),會顯示「Compatible (exempted)」。兼容性檢查與更新可用性檢查相互獨立:即使 registry 無響應或很慢,也不會隱藏不兼容的 peer 範圍;即使本地包無法訪問 registry,也會給出兼容性結論。
註冊表探測策略¶
插件不再硬編碼 registry.npmjs.org,而是從環境變量、用戶 profile 的 .npmrc、以及用戶全局的 ~/.npmrc 中讀取配置,按順序查找第一個有效的配置。然後併發探測多個候選註冊表,取第一個成功響應的。探測策略分三種情況:
- 未配置任何註冊表:同時探測 launcher 的鏡像和公共註冊表。
- 公共註冊表被默認配置:保留公共註冊表,並在其後添加鏡像,兩者都是公開,不會泄露內部包名。
- 配置了其他註冊表(企業或內部):僅使用該註冊表,不與公共註冊表併發,避免內部包名泄露。
如果一個包聲明瞭 publishConfig.registry,則使用該註冊表。探測到的註冊表會隨結果行一起傳遞,用於後續的一鍵更新,確保版本讀取和安裝來自同一個源。
安裝與啓用¶
從 npm 安裝(推薦)¶
dsh install-plugin dsh-plugin-update-checker
從 npm 安裝後,插件從 0.1.4 開始使用普通版本號解析,面板上的「Update」按鈕可以正常工作。
從 GitHub 安裝¶
- 打開側邊欄的「Plugins」頁面 →「Add plugin」。
- 在源字段中輸入以下安裝規格之一(launcher 通過
installBundle解析):
github:windrover/dsh-plugin-update-checker
# 或完整 URL:
https://github.com/windrover/dsh-plugin-update-checker
- 重啓以加載新插件:
dsh check # 啓動前檢查
dsh restart # 重載 web profile,加載新插件
- 打開「Settings → Built-in plugins → Check updates」,點擊「Check updates」按鈕。檢查按鈕的
/api/plugin-update-checker/scan接口在已認證的瀏覽器會話中運行,無需手動提供 token。
本地鏈接(開發用)¶
- 在 DSH 工作區克隆倉庫:
git clone https://github.com/windrover/dsh-plugin-update-checker dsh-plugin-update-checker
- 在 profile manifest 中添加
link:依賴和bundles入口:
// ~/.dsh/profiles/web/package.json
{
"dependencies": {
"dsh-plugin-update-checker": "link:/abs/path/to/dsh-plugin-update-checker"
},
"dsh": { "profile": { "bundles": [ "…", "dsh-plugin-update-checker" ] } }
}
- 安裝依賴。由於 profile 是 pnpm workspace,
npm install會拒絕link:協議,應使用pnpm:
cd ~/.dsh/profiles/web
pnpm install --registry=https://registry.npmmirror.com
- 手動鏈接
semver包到插件目錄,因爲dsh的wire_link_plugin_deps只處理@deepseek-ai/*依賴:
mkdir -p dsh-plugin-update-checker/node_modules
ln -sfn ~/.npm/_npx/<active-dsh-hash>/node_modules/semver \
dsh-plugin-update-checker/node_modules/semver
- 重啓並打開插件(
dsh check && dsh restart,路徑同上)。
典型用法¶
- 安裝插件後,打開「Settings → Built-in plugins → Check updates」。
- 點擊「Check updates」按鈕,插件會掃描所有已安裝的插件。
- 查看結果表格:每行顯示插件名稱、已安裝版本、最新版本、兼容性狀態,以及「Update」按鈕。
- 對有更新的插件,點擊「Update」即可執行安裝(底層使用與「Add plugin」對話框相同的
installBundle原語)。
適用場景與注意事項¶
- 適合需要統一管理 DSH 插件更新與兼容性的開發者,尤其是頻繁升級 DSH 版本或管理大量插件的團隊。
- 插件以當前 DSH 進程的權限運行,安裝前應檢查倉庫源碼與許可證。
- 插件只報告和提供更新動作,不負責啓用、禁用或刪除插件,也不修改插件配置。
- 更新失敗會逐行報告,不會因某個包的問題而阻塞整體掃描。
結尾¶
dsh-plugin-update-checker 在 DSH 的內置插件設置中提供了一站式的更新與兼容性檢查入口,讓開發者無需離開設置頁面即可掌握插件狀態。安裝後即可在「Settings → Built-in plugins → Check updates」中使用,點擊按鈕即可掃描並更新。
- 插件目錄頁:https://www.skillhub.cn/plugins/windrover/dsh-plugin-update-checker
- GitHub 倉庫:https://github.com/windrover/dsh-plugin-update-checker