dsh-plugin-installer:在 Harness 界面裏安裝、更新與卸載插件

前言

DeepSeek Harness(DSH)把能力拆成可組合的插件 bundle,profile 用 pnpm 管理依賴。日常裝插件時,命令行 dsh plugin add … 在官方桌面端有一個硬限制:應用運行時 desktop profile 由進程獨佔,pnpm 鎖和加載器配置都在 app 手裏,CLI 往往改不動正在用的 profile。設置裏的官方「插件」頁又主要管已安裝列表和官方來源,社區包、GitHub 倉庫、本地目錄並不都在同一條路徑裏完成。

下面介紹社區插件 dsh-plugin-installer(維護者 DogEgg-alR,GitHub:DogEgg-alR/dsh-plugin-installer)。它在客戶端設置 → 插件裏增加 「安裝與更新」 標籤頁,通過進程內的 pluginManager 服務安裝與卸載,和官方插件頁同一條實現;更新則轉發 dshmarket 的公開更新接口,不在界面裏重寫版本策略。

這是什麼

一句話:在 DeepSeek Harness 客戶端界面裏直接安裝、更新、卸載 DSH 插件,並處理卸載後的 node_modules 殘留。

分類屬於 客戶端 插件:宿主半提供 HTTP 橋並調用 pluginManager,客戶端半在 plugins.tab 裏渲染 UI。許可證 MIT,當前 package 版本爲 1.4.3(以倉庫 package.json 爲準)。

核心功能

安裝

輸入任意 pnpm 認可的 spec,走 profile 自己的 pluginManager.installBundle,應用運行中也可安裝,不會和 desktop profile 的文件鎖對撞。

寫法 例子
npm 包名 dsh-whale-widget
指定版本 dsh-better-sidebar@0.28.2
GitHub 倉庫 github:DogEgg-alR/dsh-plugin-installer、owner/repo
本地目錄 C:\Users\me\dsh-plugins\my-plugin

裝完會說明結果是「已生效」還是「重啓後生效」;失敗時給出可操作原因(已安裝、不是插件包、依賴歧義已回滾、版本不兼容、pnpm 輸出等)。

更新

點「檢查更新」後逐行對比 當前版本 → 最新版本,可單行更新,帶進度、失敗說明,以及在市場提供恢復點時的「回滾到更新前」。進度展示跟隨市場報告的 phase / percent / downloaded / detail;階段文案來自 pnpm 的 pnpm:stage(解析依賴 → 下載 → 鏈接 → 構建)。輪詢間隔 400ms。

依賴:更新區需要已安裝 dshmarket,且市場需支持 update-api/v1(README 寫明兼容 dshmarket 1.66+,beta)。未裝市場時只顯示提示,不影響安裝。

特殊行爲(資料原文):agent 正在跑時市場可能返回 AGENTS_RUNNING,插件會改走 busyPolicy: "drain" 排隊,等對話結束再自動執行;RELEASE_TOO_FRESH / VERSION_UNCHANGED 時界面額外提供「強制更新」。

卸載與殘留清理

列表每行可卸載(兩步確認)。若 pluginManager.removeBundle() 因 bundle 正在使用而拒絕(桌面端常見 bundle-in-use),界面會逐級嘗試:直接移除 → 停用後再移除 → 只從 profile 的 dependencies 與 dsh.profile.bundles 摘除並提示重啓。第 3 步不碰正在運行的進程。

摘除的包會寫入 <profile>/.dsh-plugin-installer/pending-cleanup.json;宿主啓動約 10 秒後自動清理 node_modules 殘留,也可在界面觸發 POST /dsh-plugin-installer/api/cleanup 立即清理。

安裝與啓用

方式一:普通 profile(dsh web / CLI)

dsh plugin --profile web add github:DogEgg-alR/dsh-plugin-installer

桌面端把 web 換成 desktop 即可,但 須在完全退出官方桌面應用後 在外部終端執行,否則 CLI 仍可能等鎖。

方式二:手動寫進 profile

cd ~/.dsh/profiles/web
pnpm add github:DogEgg-alR/dsh-plugin-installer

還須在 package.json 的 dsh.profile.bundles 裏追加 "dsh-plugin-installer",或在 profile 的 cordis.patch.yml 裏插入掛載行;兩種方式不要同時用。

官方桌面端在應用運行時

  1. 讓 DSH 對話用 plugin_manager 的 install_bundle 安裝(見下一節),或
  2. 完全退出應用 → 外部終端執行方式一(profile 用 desktop)→ 再打開。

裝上後 重啓一次(新 bundle 只在啓動時讀加載器配置)。之後在 設置 → 插件 → 安裝與更新 裏裝其它插件通常不必再爲 installer 本身重啓。

讓 DeepSeek Harness 代爲安裝

把下面整段粘到 DSH 對話窗口:

幫我裝插件 github:DogEgg-alR/dsh-plugin-installer 。
用 plugin_manager 工具的 install_bundle,target 填絕對路徑或 spec;
裝完把 application 字段告訴我,如果是 restart-required 就提醒我重啓客戶端。
不要自己改 profile 的 package.json,也不要手跑 pnpm。

典型用法

  1. 完成上述安裝並重啓(若提示需要)。
  2. 打開 設置 → 插件 → 安裝與更新。
  3. 在輸入框填入 spec(例如 github:DogEgg-alR/dsh-plugin-installer 或 npm 包名),點「安裝」。
  4. 需要批量看版本時點「檢查更新」;確認 dshmarket 已就緒後再點某一行的「更新」。
  5. 卸載時按界面引導;若提示 bundle 在用,按結果說明停用或「從 profile 配置摘除」,必要時重啓或點「立即清理」處理隊列。

安裝請求在後臺是 POST /dsh-plugin-installer/api/install,立即返回 202 { jobId },客戶端輪詢 GET /dsh-plugin-installer/api/job?id= 取結果,避免長連接被掐斷——因此界面會有一段時間處於進行中狀態,pnpm 在整個 profile 裏解析並落盤,幾十秒在 README 中被描述爲常態。

適用場景與注意

適合誰:經常在桌面端或 dsh web 裏試社區插件、GitHub 開發版、本地目錄 bundle,又不想在 app 運行時和 profile 鎖搏鬥的 DSH 用戶。

安全與權限:插件以當前 DSH 進程權限執行 pnpm 與 pluginManager 操作,等同於你在該 profile 裏手動裝包。安裝前應查看目標倉庫源碼與許可證,不要安裝來源不明的 spec。

生態說明:DSH 社區插件目錄(如 SkillHub 上的條目)是獨立站點,與 DeepSeek / 幻方無官方從屬關係;本插件是社區維護的客戶端工具,不是官方應用商店。

兼容性(README):DeepSeek Harness 桌面端 / dsh web,profile 名任意;更新功能依賴 dshmarket 1.66+;客戶端半僅依賴加載器注入的 react。

結尾

dsh-plugin-installer 把「裝包 spec → pluginManager」和「更新 → dsh-market/update-api/v1」搬進 Harness UI,並補全卸載與 pending-cleanup 流程,針對的是 desktop profile 運行時 CLI 改不動、官方插件頁入口單一的問題。

羽毛球分组比赛记分
小程序二维码

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

小夜