前言¶
在 DeepSeek Harness(DSH)裏跑多成員蜂羣時,常見做法是靠模型自己判斷要不要暫停、升級或改策略。模型可以「判」,但同樣有權限直接調工具、改運行時狀態;一旦預算打滿、事件流斷檔或日誌異常,純靠提示詞很難保證每次都會停手。另一方面,事後追責往往要拼 swarm、pressure、watch 等多源日誌,缺少一條可校驗、可串聯的賬。
dsh-overwatch(瞭望塔)由維護者 AiLunSin 提供,分類爲 admin-security。它給受控蜂羣疊兩層監管:無模型的硬閘門(Guard) 與 受工具限制的值班員(Watch),並維護獨立 watch.jsonl 哈希鏈作爲跨源證據賬;Host 側服務與 Web 面板一併發佈。一句話記憶點:模型可以判,不能動手;硬閘門不靠模型;沒有證據不動作。
這是什麼¶
插件 npm 包名爲 @ailunsin/dsh-overwatch,倉庫爲 AiLunSin/dsh-overwatch,許可證 MIT,要求 Node.js >= 22、DSH >= 0.2.2-rc.3 且 < 0.3.0。README 標明當前處於 M0–M4 發佈候選:值班員仍爲 experimental;npm 1.0.0 已發佈,package.json 中版本爲 1.0.1(M4.1 待賬號持有人 OTP 的場景在 README 中有說明)。
面向「supervised」編隊時,在第一個 L2+ 事件單到來時懶啓動子代理值班員:只能讀案情卡與有限次證據,通過 watch_decide 提交結構化決定;校驗、執行、驗證與記賬由代碼路徑完成。預算 80% / 95% / 100%、牆鍾超時、事件流缺口、日誌損壞等硬限始終由確定性 Guard 執行,不經過模型。
核心功能¶
Guard 與 Watch 如何分工¶
| 條件 | 動作 | 執行者 |
|---|---|---|
| 預算 ≥ 80% / ≥95% / ≥100% | throttle(默認 10 分鐘後自動 resume)/ pause / abort | Guard |
牆鍾 ≥ thresholds.maxRunMs(默認 8h) |
abort | Guard |
| 事件流缺口或日誌損壞 | abort | Guard |
| L2+ 事件單 | 懶啓動值班員,讀案情卡 + ≤3 次證據,提交 notice/coach/throttle/pause/escalate 等決定 | Watch + Executor |
requiresHuman 決定或計劃 |
持久入隊,人工 challenge 後 approve,再原樣重放執行 | Human + Executor |
值班員工具表僅 watch_case、watch_evidence、watch_decide;硬閘門使用獨立的 autopilot.pauseOnHardLimit,與隻影響值班員暫停建議的 autopilot.pause 分開配置。值班員超時或崩潰達 2 次會降級爲 guard-only 並記錄 watch/degraded;預留 token 用盡後不再喚醒,Guard 繼續運行。
證據賬與多源探針¶
src/store.js 對 watch.jsonl 做單寫者哈希鏈記賬,支持崩潰尾部截斷與篡改檢測。src/probe.js 負責三源採樣、事件游標與缺口鎖存;src/signals.js 用純函數處理預算檔位、失敗連擊、停滯、上下文壓力等信號並開出 L1/L2 事件單。面板回放頁 /runs/:id/timeline 按固定順序合併 swarm、pressure 採樣與 watch 事件。
M3:魚缸、回放與恢復¶
Host 只讀索引 ~/.dsh/fishkeeper(可通過 fish.dataDir 覆蓋)的檢查點與 audit 尾部,不讀 blob。恢復流程在面板側走 fishkeeper 的 dryRun 預檢與二次確認;overwatch 只記錄 watch/restore/intent|result,拒絕任何 confirmToken。/overwatch/api/doctor 用於檢查數據目錄、服務鏈、上游、寫 token、魚缸索引與各 run 鎖/鏈/值班員狀態。
HTTP 與人工批准¶
只讀 API 在 /overwatch/api/*;寫操作(arm/disarm/ack/close/resume/purge/approvals/restores)需請求頭 x-overwatch-token。通過 HTTP 只能 arm guard 或 observe;supervised 必須由根 agent 的工具調用發起。requiresHuman 項寫入 run 下 approvals 隊列,批准後由 Executor 重放。
安裝與啓用¶
DSH 0.2.2-rc.3 沒有官方公共插件索引,從 registry 安裝需 profile 能訪問 npm:
dsh plugin --profile ow add @ailunsin/dsh-overwatch@1.0.0
開發時可從本地目錄安裝(README 建議先用臨時 profile 與獨立 DSH_HOME,避免直接改動主力 profile):
$env:DSH_HOME = "$env:TEMP\dsh-overwatch-try"
dsh --profile ow --from-default-profile headless --dump-config
dsh plugin --profile ow add C:\path\to\dsh-overwatch
Web 面板需要 web profile。裝好後側邊欄出現「瞭望塔」,可用健康檢查確認服務與鏈狀態:
GET http://127.0.0.1:<port>/overwatch/api/health
在 profile 的 cordis.patch.yml 中按插件 id 覆蓋配置;完整示例見倉庫 examples/profile-patch.yml。常見字段包括 mode、http.token(空則寫接口禁用;supervised 需要 token)、ports.swarmToken(須與 swarm 的 http.token 一致)、supervisor 喚醒超時與每小時上限、policy.autopilot.pauseOnHardLimit 等。
典型用法¶
根 agent 在 supervised 模式下將本會話作爲值班員 parent,對指定 run 執行 arm/status/report/disarm:
watch_arm({ runId: 'swarm_xxx', mode: 'supervised' })
watch_status({ runId: 'swarm_xxx' })
watch_report({ runId: 'swarm_xxx' })
watch_disarm({ runId: 'swarm_xxx', reason: '收工' })
supervised 前置檢查包括:swarm 可達、運行狀態爲 running/paused、http.token 非空、根 agent 存在、成員數在 maxActiveSubagents 容量內;不滿足時返回 CAPACITY_CONFLICT、AGENT_REQUIRED、WRITE_DISABLED 等錯誤碼。
只讀查詢示例:
curl http://127.0.0.1:PORT/overwatch/api/runs/swarm_xxx
curl 'http://127.0.0.1:PORT/overwatch/api/runs/swarm_xxx/cases?state=open'
curl 'http://127.0.0.1:PORT/overwatch/api/runs/swarm_xxx/timeline?since=0'
curl http://127.0.0.1:PORT/overwatch/api/fish
curl http://127.0.0.1:PORT/overwatch/api/doctor
適用場景與注意¶
適合已在 DSH 上使用 dsh-swarm 等編隊、希望在預算與事件完整性上有一套不依賴模型臨場發揮的硬規則,並在 L2+ 案情上引入工具面受限的值班員、同時用哈希鏈留痕的團隊。常與 pressure、fishkeeper 同 profile 聯用;README 記錄了與真實 swarm、真實模型的迴歸用例規模,可自行對照倉庫 e2e 與 CI 說明。
安裝前請閱讀源碼與 LICENSE、SECURITY.md。插件以當前 DSH 進程權限運行;http.token 與 ports.swarmToken 需按環境輪換,寫 token 爲空時受控寫接口默認關閉。社區目錄 SkillHub 插件頁 與 GitHub 倉庫相互獨立,不等同於 DeepSeek 或幻方官方應用商店。
結尾¶
dsh-overwatch 把「硬停手」交給 Guard、「讀案卷後出決定」交給受控 Watch,再用 watch.jsonl 把動作釘在可校驗的鏈上,適合作爲 admin-security 類編排裏的監管層。詳情與變更見 GitHub:AiLunSin/dsh-overwatch,目錄介紹見 SkillHub:dsh-overwatch。