dsh-plugin-guardkit:DSH 插件運行時監控與風險評分

前言

在 DeepSeek Harness(DSH)裏裝第三方插件很方便,難的是事後回答一個問題:這些插件在進程裏究竟在做什麼、風險有多大。靜態清單(安裝時掃一遍 package.json)往往和 Cordis 上的真實拓撲脫節——條目可能卡在加載中、被 override、或帶着 install script 與遠程注入聲明。

dsh-plugin-guardkit(README 中稱 Plugin Guardian · 插件衛士)面向「已安裝插件的運行時態勢」:由 Host 側讀取 pluginManager 與各 bundle 的 package.json,在 Plugins → 監控 面板裏展示健康度、finding、時間線與一鍵收斂(containment)操作。下面按定位、能力、安裝與配置說明用法。

這是什麼

項 說明
npm 包名 dsh-plugin-guardkit
維護者 karla-zhang
分類 admin-security(社區目錄)
版本 0.1.2(MIT)
運行要求 Node >=22

一句話:監視當前 profile 下已安裝的 DSH 插件,對運行時風險打分,並在同一面板內啓用/禁用單條 Cordis 條目或整個 bundle。

面板數據來自 Host 的實時 Cordis 拓撲,而不是構建時抓取的靜態列表。

面板裏能看到什麼

README 將界面劃分爲幾塊,對應不同粒度的信息:

  1. Health bar:整體風險分數/等級、按 fiber phase 統計的插件數、bundle 數量、快照新鮮度。
  2. Top findings:所有已觸發的 finding,按嚴重程度從 critical 到 info 排序,帶 subject 與 evidence。
  3. Bundle cards:每個插件 bundle 的安裝來源(第三方/官方)、版本、許可證、倉庫、install scripts、聲明的 bin、client/typert 注入、overrides、版本豁免等。
  4. Runtime table:每條 Cordis 條目:模塊、所屬 bundle、是否啓用、fiber phase、狀態遷移、最近變更、診斷信息。
  5. Timeline:phase 切換、啓用/禁用、版本與可用性變化、guardian 操作記錄。
  6. Actions:對單條插件條目或整個 bundle 做 enable/disable(一鍵收斂)。

客戶端文案在 zh/en 間隨 UI 語言切換;樣式使用 --dsw-alias-* 主題 token。

風險模型

每個 finding 帶有嚴重度;插件總分是各 finding 權重之和,上限 100:

critical 40 · high 20 · medium 8 · low 3 · info 0

等級劃分:≥ 40 爲 high,≥ 10 爲 watch,否則爲 safe。

README 列出的 finding 類型包括:失敗/卸載中/卡住的條目、只讀條目、已禁用條目、第三方 bundle、缺失或出錯的 bundle、patch override、DSH 版本豁免、install 腳本(preinstall/install/postinstall/prepare)、聲明的 bin、client-bundle 或 typert 遠程注入、缺失許可證、local/git 安裝來源,以及監控數據過時(stale monitoring)。

數據流與接口

Host 側從 pluginManager 服務收集數據(listPlugins、listBundles、listVersionExemptions),從 profile 讀取各已安裝包的 package.json,每次刷新時對清單做 diff 以生成 timeline,並通過同源只讀 JSON 路由對外提供服務:

GET  /plugin-guardian/api/snapshot
POST /plugin-guardian/api/action   # body: { action, entryId?, name? }

瀏覽器側在 Plugins 頁標籤行(plugins.tab)以及存在該頁時的 Settings → Plugins 標籤行(settings.plugins.tab)註冊 React 組件:輪詢 snapshot、渲染面板、POST 操作。

路由安全:響應帶 no-store;通過比較 Origin 與 Host 拒絕跨站請求;action body 上限 64 KiB 並做校驗。

安裝與啓用

可在 DSH 桌面應用的 Settings → Plugins 從插件市場安裝,或安裝本地目錄後重啓。終端安裝時須使用真實 profile 名(桌面版一般爲 desktop):

dsh plugin --profile desktop add dsh-plugin-guardkit                       # from npm
dsh plugin --profile desktop add github:karla-zhang/dsh-plugin-guardkit   # straight from GitHub
dsh plugin --profile desktop add /path/to/plugin-guardian                 # local directory

新增 bundle 會改變 Host 啓動圖,安裝後需重啓 DSH。

卸載:

dsh plugin --profile desktop remove dsh-plugin-guardkit

也可在 Settings → Plugins 頁面卸載。

配置

可選配置寫在 profile 的 Cordis patch 行 plugin-guardian 下:

- id: plugin-guardian
  name: dsh-plugin-guardkit
  config:
    refreshMs: 12000   # 3000..120000
    audit: true        # write snapshot.json / timeline.ndjson / route-hits.ndjson
    auditDir: null     # defaults to <DSH_HOME>/plugin-guardian
    trusted: []        # extra Origins allowed to call the action route
    maxTimeline: 100   # timeline ring size

開啓 audit 時,默認目錄爲 <DSH_HOME>/plugin-guardian/,會寫入:

  • snapshot.json:最近一次快照,便於離線查看
  • timeline.ndjson:追加式事件日誌,每行一個 JSON 對象
  • route-hits.ndjson:最近 20 次 API 請求(method、path、status、time)

典型用法

  1. 安裝插件並重啓 DSH 後,打開 Plugins → 監控(或 Settings 下對應 Plugins 標籤)。
  2. 查看 Health bar 與 Top findings,定位高風險 bundle 或條目。
  3. 在 Bundle cards 覈對安裝來源、install script、bin 與注入聲明;在 Runtime table 對照 fiber phase 與診斷。
  4. 需要臨時收斂時,在 Actions 中對單條條目或整個 bundle 執行 disable;若 Host 報告需重啓才能生效,按提示處理而非假設已生效。
  5. 若要做合規或事後審計,將 audit: true,定期查看 timeline.ndjson 與 snapshot.json。

面板在 fetch 失敗時會顯示錯誤條並保留上一幀快照,不會把整個頁面拋崩。

適用場景與注意

適合誰:在 DSH 上維護較多社區插件的開發者或管理員;需要對照 Cordis 運行時與 package.json 聲明、並按風險分數做收斂決策時。

權限與信任:插件與當前 DSH 進程同級運行,並能通過 pluginManager 啓用/禁用其他插件。安裝前應閱讀 GitHub 倉庫 源碼與 MIT 許可證,自行判斷是否納入 profile。

行爲邊界(README Notes):

  • 只讀條目(management-required、unaddressable)會被上報,不會默認爲是健康狀態;嘗試切換時返回 Host 自帶說明。
  • 收斂走 Host 的 pluginManager API;需要重啓的變更會如實提示。

生態說明:DSH 奉行「一切皆插件」;社區插件目錄(如 SkillHub)爲獨立站點,與 DeepSeek / 幻方無官方從屬關係。本插件亦可從 npm(dsh-plugin-guardkit)或 GitHub 安裝,星標與分類信息以目錄頁爲準。

結尾

dsh-plugin-guardkit 把「第三方插件在做什麼」落到可輪詢的快照、可量化的風險分數和可操作的收斂入口上,數據鏈綁定 live Cordis 而非靜態清單。若要進一步瞭解或提 issue,可訪問:

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

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

小夜