前言¶
在 DeepSeek Harness(dsh)裏,插件往往隨 profile 的 dependencies 與 dsh.profile.bundles 一起安裝、啓用。版本分散在 npm registry 上,手動對照 package.json 再執行 dsh plugin add 容易漏項,也不符合「打開環境就能幹活」的習慣。
下面介紹社區插件 dsh-auto-update(維護者 1708994293-hue):每次打開 DSH 後,在後臺檢查你已下載且已啓用的插件是否有可前向升級的 semver 新版本,有則在界面列出並詢問,確認後才走官方 dsh plugin add 通道更新;無更新則靜默。分類爲工作流,目錄頁見 SkillHub,源碼與說明見 GitHub。
這是什麼¶
dsh-auto-update 是 DSH 的 bundle 插件(npm 包名 @sueleven/dsh-auto-update,當前資料版本 1.0.1)。它解決的是:啓動後自動發現已啓用插件的可升級版本,由你決定是否更新,且不覆蓋 profile 配置。
與「完全手動查版本、逐條安裝」相比,檢查在啓動約 8 秒後後臺進行,不阻塞界面;更新語義與插件市場一致,完成後提示重啓 DSH 後生效。
核心功能¶
資料中可覈對的行爲如下:
- 檢查範圍:profile
package.json的dependencies與dsh.profile.bundles的交集(已下載且已啓用);排除市場裏被禁用的包、file:/link:/git:等非 registry 依賴,以及插件自身。 - 版本比較:使用 semver,只列出可前向升級的項,不會建議降級。
- 界面:有新版本時右下角出現
shell.overlay提示卡,逐條顯示「插件 當前版本 → 最新版本」;按鈕爲全部更新與稍後提醒;無更新時不打擾。 - 更新路徑:調用與 DSH 插件市場相同的官方 CLI 通道(
dsh plugin ... add,並帶--config.minimum-release-age=0),不直接改 profile 文件。
實現上分爲 Host(lib/index.js:延時檢查、狀態機、路由 /dsh-auto-update/status|check|apply|dismiss)、Client(lib/client.js:提示卡與輪詢)、以及檢查/更新器(lib/update.mjs:讀 profile、查 npm、按需執行官方 add)。
安裝與啓用¶
要求 dsh 0.2.1 及以上(插件聲明瞭 dsh.bundle manifest)。Node 引擎要求 >=20(見 package.json)。
從 npm 安裝(推薦,任意平臺)
npm 上無 scope 名 dsh-auto-update 因與已有包名過於相似被拒絕,因此發佈名爲帶 scope 的 @sueleven/dsh-auto-update:
dsh plugin --profile desktop add @sueleven/dsh-auto-update
從 GitHub 安裝
dsh plugin --profile desktop add github:1708994293-hue/dsh-auto-update
從本地目錄安裝
# Windows:腳本會複製插件並調用官方 dsh plugin 通道安裝
pwsh -NoProfile -File scripts/install.ps1
任意平臺也可用 link 安裝(將路徑換成本倉庫絕對路徑):
dsh plugin --profile desktop add link:<本倉庫絕對路徑>
裝完後完全退出並重啓 DSH,側邊欄「插件」頁裏應出現 dsh-auto-update。
從 1.0.0 升級¶
1.0.0 的前端模塊註冊名遺漏 npm scope,可能導致 Desktop 啓動失敗並記錄 duplicate factory registration for "dsh-auto-update";1.0.1 已修復。完全退出 DSH 後執行:
dsh plugin --profile desktop add '@sueleven/dsh-auto-update@1.0.1' --config.minimum-release-age=0
重新打開 DSH;若此前因恢復操作停用了插件,在插件頁重新啓用即可。
典型用法¶
日常使用無需額外操作:啓動 DSH 後等待默認約 8 秒,若有可升級項會彈出提示卡,按需點「全部更新」或「稍後提醒」。
需要腳本或排障時,可在插件目錄下直接調用更新器(路徑隨安裝方式不同:npm 安裝一般在 profile 的 node_modules/@sueleven/dsh-auto-update,本地 link: 多在 ~/.dsh/plugins/dsh-auto-update):
# 只檢查,不做任何修改
node <插件目錄>/lib/update.mjs --check
# 列出可更新項(JSON)
node <插件目錄>/lib/update.mjs --check --json
update.mjs 還支持 --profile、--dry-run、--help。
環境變量與日誌¶
可通過環境變量調整行爲(均爲資料原文):
| 變量 | 作用 |
|---|---|
DSH_AUTO_UPDATE_DELAY_MS |
啓動後延時多久開始檢查(默認 8000) |
DSH_AUTO_UPDATE_DISABLE=1 |
本次啓動不檢查、不顯示提示 |
DSH_AUTO_UPDATE_PROFILE |
覆蓋 profile 名(默認讀 DSH_PROFILE,否則 desktop) |
DSH_AUTO_UPDATE_DATA_DIR |
覆蓋日誌/狀態目錄(默認插件包目錄) |
日誌與狀態:
<插件目錄>/logs/auto-update.log:檢查與更新記錄<插件目錄>/logs/plugin.log:生命週期與錯誤<插件目錄>/state/last-run.json:最近一次檢查的結構化結果
適用場景與注意¶
適合誰:長期在 Desktop profile 下啓用多個來自 npm 的 DSH 插件、希望啓動時被動收到升級提醒、且希望更新仍經官方 dsh plugin add 的開發者。
注意:
- 插件以當前 dsh 進程權限運行,安裝前請自行閱讀 倉庫源碼 與 MIT 許可證。
- 僅對 registry 依賴做檢查;
link:、Git 等非 registry 安裝不會出現在可更新列表中。 - 社區目錄(如 awesome-dsh-plugin)與 SkillHub 等爲社區索引,與 DeepSeek / 幻方無官方從屬關係;本插件是生態中的工作流類擴展,不是 DSH 內置功能。
卸載示例:
dsh plugin --profile desktop remove @sueleven/dsh-auto-update
Windows 本地安裝還可使用倉庫中的 scripts/uninstall.ps1 刪除插件目錄。
結尾¶
dsh-auto-update 把「已啓用插件的版本對齊」收攏到每次啓動後的單次檢查與用戶確認流程裏,減少手工查 registry 與漏更。需要安裝說明、環境變量與手動檢查命令時,以 README 爲準:
- 目錄頁:https://www.skillhub.cn/plugins/1708994293-hue/dsh-auto-update
- GitHub:https://github.com/1708994293-hue/dsh-auto-update