前言¶
DeepSeek Harness(DSH)把能力拆成可組合的插件:profile 裏掛越多 bundle,啓動表面上仍正常,但某個能力靜默失效、上游依賴漂移、或單個工具反覆失敗拖慢回合、堆高 Token,都越來越難一眼看出原因。宿主側有一些超時與重複調用策略,卻不替代「看清每個 bundle 加載結果、登記依賴與調用成本」這一層。
dsh-keelwatch(npm 包名 @kutebai/dsh-keelwatch)由 kute 維護,定位爲 DSH 插件的 operations layer:不增加新的 Agent 能力,集中處理依賴漂移、失敗剎車,以及 Token 與耗時歸因。SkillHub 上歸類爲工作流。
這是什麼¶
一句話:裝在一組 DSH 插件之上,持續觀察 bundle 健康、依賴版本漂移、工具連續失敗與上下文成本,並通過日誌、插件頁、對話內拉取報告三種方式告知你。
理解兩個層級有助於讀報告:DSH profile(~/.dsh/profiles/<name>/)由多個插件行組成;實際安裝單位是 bundle(一個 npm 包 + cordis.patch.yml 補丁)。報告裏的 bundles: 是包層;row 是配置層。某插件「壞了」可能是包加載失敗,也可能是某一行配置錯誤。
核心功能¶
下面三塊對應 README 中的三張問題表,均以已安裝生態爲觀測對象。
依賴漂移雷達(driftRadar)¶
對比各 bundle 在磁盤上的 package.json 聲明與 registry 上的可用版本,按 major / minor / patch 分級提示漂移,避免「今天能用、下次重裝或升級就斷」。
- 默認每 24 小時掃描一次;
checkIntervalHours: 0表示僅在啓動時掃描。 alertLevel可取major、minor、all;設爲major時,報告裏no findings只表示沒有跨 major 邊界,minor 漂移需用all纔會出現在結論裏。
失敗剎車(failureBrake)¶
對每個工具統計連續失敗次數(用戶取消不計入)。超過閾值後,在下一次調用前拒絕執行,並給出與原因相關的下一步說明,而不是單純返回「不允許」。
- 默認關閉剎車,僅記錄(
enabled: false,action: log);啓用後可設爲action: brake。 - 可配置
maxConsecutiveErrors、cooldownMinutes、tools/exclude白黑名單;neverBrake默認包含ask_user_question。
Token 與耗時歸因(costAttribution)¶
按來源(user / model / tool / plugin:xxx)彙總 surface Token,並列出最貴的單條消息;同時按工具統計調用次數、錯誤、總耗時與 p95。歸因從插件加載後開始記錄,早於加載的消息會落在 unattributed。
Bundle 健康¶
啓動約 5 秒後檢查各 bundle 加載結果,之後與漂移掃描共用 checkIntervalHours 節奏;能指出具體加載失敗的包名。
可選 Dashboard¶
dashboard.enabled 默認爲 false。開啓後註冊 /keelwatch/dashboard(獨立 HTML 頁,非側欄一節),展示 bundle 健康、漂移與修復建議、剎車狀態、工具延遲、Token 來源、7 日趨勢與近期歷史。插件配置頁會出現帶 GUI token 的「open dashboard ↗」鏈接;關閉開關會註銷路由。
對話內報告工具¶
不主動向對話注入監控噪音;需要時用 keelwatch_report 拉取完整報告與結論,例如:
keelwatch_report
keelwatch_report action=disable bundle=<pkg name>
報告各段含 EN: / ZH:,末尾有單一 Conclusion 說明今日是否要動手。
安裝與啓用¶
要求:engines.dsh 爲 >=0.2.1-0 <0.3.0-0(覆蓋 DSH 0.2.1.x / 0.2.2.x),Node >=22.19,全平臺。當前 package 版本爲 0.4.3,許可證 MIT。
推薦從 npm 安裝(預構建,無需構建授權):
dsh plugin --profile <profile> add @kutebai/dsh-keelwatch
其他官方途徑(摘自 README):
# GitHub release 的 tarball
dsh plugin --profile <profile> add ./kutebai-dsh-keelwatch-0.2.0.tgz
# 倉庫(構建產物已提交)
dsh plugin --profile <profile> add github:kute/dsh-keelwatch
# 本地開發:改代碼後需 pnpm build 並重啓
pnpm build
dsh plugin --profile <profile> add /path/to/dsh-keelwatch
在 DSH 插件市場發現頁添加索引源(社區無中心化目錄,非官方應用商店):
https://kute.github.io/dsh-keelwatch/index.json
配置¶
兩種方式等價:Web GUI(Plugins → @kutebai/dsh-keelwatch → 配置區,保存會校驗、備份 patch 並讓 Loader 重載),或直接編輯 ~/.dsh/profiles/<profile>/cordis.patch.yml。
- id: keelwatch
config:
driftRadar:
enabled: true
checkIntervalHours: 24 # 0 = 僅啓動時掃描
alertLevel: major # major | minor | all
whitelist: []
registryUrl: '' # 空則使用已配置的 npm registry
requestTimeoutMs: 8000
failureBrake:
enabled: false # 默認關閉:只記錄
action: log # log | brake
maxConsecutiveErrors: 5
cooldownMinutes: 10
tools: []
exclude: []
neverBrake: [ask_user_question]
costAttribution:
enabled: true
retentionDays: 7
topN: 10
toolToBundle: {}
dashboard:
enabled: false # 可選:提供 /keelwatch/dashboard
refreshSeconds: 30 # 10-600
開啓 Dashboard 時可在 YAML 中設:
dashboard:
enabled: true
refreshSeconds: 30
檢測結果如何送達¶
| 渠道 | 說明 |
|---|---|
| 日誌 | 重要發現也會寫入 stderr(例如 macOS 上 ~/Library/Logs/dsh-web.err.log),不依賴是否開着會話 |
| 插件頁 | 「recent detections」列表:時間、級別、中英雙語一行摘要 |
| 對話 | keelwatch_report 拉取全量報告與結論 |
歷史落盤:~/.dsh/keelwatch/history.jsonl(原始 JSONL);插件頁展示最近 20 條;GET /keelwatch/history?limit=50 需 GUI token。保留天數由 costAttribution.retentionDays(默認 7)控制,條目上限 500。
各檢查觸發時機(摘自 README):bundle 健康與依賴漂移在啓動後及每個 checkIntervalHours;失敗剎車在每次調用後計數、下次調用前 enforcement;Token 與延遲實時累計、按需彙總。
適用場景與注意¶
適合誰: 已在 profile 中掛載較多 DSH 插件 / bundle,需要統一看加載是否成功、依賴是否會隨 registry 變化而斷裂、哪幾個工具在燒 Token 或拖慢回合,並可選地對連續失敗的工具做剎車。
刻意不做的事(避免與宿主重複或越權):** 不設工具超時(由宿主 dsh-tool-call-timeout-policy 負責)、不做重複調用提醒(dsh-repeat-tool-reminder)、不強制終止進行中的調用、不改源碼、不替換工具執行器、不提供獨立大型 Web UI、不給健康打分。
安全與權限: 插件以當前 DSH 進程權限運行,會讀 profile、bundle 與本地歷史文件;安裝前應在 GitHub 倉庫覈對源碼與 MIT 許可證。Dashboard 與 history HTTP 路由帶同源校驗與 token 要求;瀏覽器跨源訪問 localhost 會被 401 拒絕。
GitHub 倉庫當前星標爲 0;功能與版本以倉庫 README 與發佈包爲準。
結尾¶
dsh-keelwatch 把「插件多了之後看不見的問題」收成可操作的報告:哪幾個包沒加載、依賴漂到哪一級、要不要開剎車、Token 花在哪。需要全量狀態時調用 keelwatch_report;要圖表可把 Dashboard 打開。
- 目錄頁:https://www.skillhub.cn/plugins/kute/dsh-keelwatch
- GitHub:https://github.com/kute/dsh-keelwatch