前言¶
DeepSeek Harness (DSH) 在加載插件時,loader 會先去重並創建條目,隨後才實例化插件。如果 dsh.profile.bundles 列表中同時包含一個聚合 bundle(如 @linxin666/dsh-web-ui-all)及其所有子插件,loader 會收到重複的 entry id,導致在創建任何插件條目之前拋出 duplicate loader entry id 錯誤,使整個 profile 啓動失敗。
dsh-bundle-dedup-guard 是爲此場景設計的 guard 插件,它在每次插件加載時檢測重複的 loader entry ids,並審計整個插件環境,防止此類靜默崩潰。
核心功能¶
該插件提供以下能力:
- 檢測重複的 loader entry ids:識別被多次插入的 id,並追溯來源(哪個 bundle 或 patch 插入的)。
- 審計插件環境:檢查 vendor tree、plugin junctions 和已知衝突對。
- 報告診斷信息:
- 未解析的 bundles。
- 無 bundle 的 packages(即配置了
dsh.bundle但未包含在 bundles 列表中)。 - 預測性 reconcile 警告。
- Site-level health checks:
- 檢測已知衝突對。
- 檢查 vendor tree 完整性。
- 檢查 plugin junction 完整性。
安裝¶
使用 DSH 的 CLI 安裝該插件:
dsh plugin --profile web add dsh-bundle-dedup-guard
用法¶
插件在加載時會自動運行檢查。若需手動診斷(特別是啓動已崩潰時),可使用以下命令:
# 檢查所有 profile + site-level health
node bin/check.mjs
# 檢查特定 profile
node bin/check.mjs --profile web
# 檢查特定 profile,不寫入報告文件(僅輸出)
node bin/check.mjs --profile web -- --no-write
# 跳過 site-level health 審計
node bin/check.mjs --no-site
運行成功退出碼爲 0 表示健康;發現重複項、未解析 bundle 或 site-level 問題時退出碼爲 1(可用於 CI 流水線)。
注意事項¶
- 只讀診斷:插件僅進行診斷,不會修改任何文件。
- 進程內限制:loader 在創建任何插件條目之前會進行去重。如果啓動時重複項已經存在,進程內檢查無法運行。此時需使用上述 CLI 進行純磁盤讀取的檢查。
- 適用場景:適合用於開發環境和生產環境,作爲管理員/安全插件監控插件環境的完整性。