dsh-approval-guardian:爲 DSH 沙箱升級審批接入一次性 reviewer

前言

DSH 生態強調「一切皆插件」。在一些自動化流程裏,交互式審批是個實際斷點:當 agent 需要擴大 sandbox 時,DSH 可能彈出給人看的 allow / deny 提示;如果流程希望無人值守,就需要一個邊界清晰的前置審批路徑。

dsh-approval-guardian 就是針對這個點做的 DeepSeek Harness(DSH)bundle:它只認領 strict sandbox escalation approvals,把這類請求交給一次性 approval-reviewer agent,並應用其結構化 allow 或 deny。

需要說明:社區目錄是獨立站點,與 DeepSeek / 幻方無官方從屬關係;本文也不把它描述爲官方應用商店。

這是什麼

dsh-approval-guardian 的定位是一個 DSH profile bundle:它攔截真實 sandbox escalation prompts,並把它們路由給專門的審批 reviewer。

它解決的核心問題是:自動化運行中,agent 需要擴大 sandbox 時,原本可能需要人工確認;該插件只處理與本次工具執行相關的 strict sandbox escalation,其他請求繼續交給 downstream answerer。

可覈實資料中:

  • 倉庫地址:https://github.com/karuboniru/dsh-approval-guardian
  • 目錄頁:https://www.skillhub.cn/plugins/karuboniru/dsh-approval-guardian
  • 許可證:MIT
  • 維護者字段:可覈實資料未給出 package.json 中的 author/maintainer 字段,因此本文不將倉庫路徑中的 karuboniru 描述爲已確認的維護者。

核心能力

下面介紹已覈實的路由邊界。一次工具執行會落入三種情況之一:

  1. 操作在當前 sandbox mode 內可執行:插件不干預。
  2. approval 不是由本次工具執行發出,或不是 strict widening:插件調用 downstream answerer,保持 DSH 原有行爲。
  3. 一次 strict sandbox escalation 且與本次工具執行精確相關:插件啓動新的 one-shot approval-reviewer agent,並應用其結構化 allow 或 deny。

結果注入方式:

  • reviewer 完成後,結果通過 deferContext 排隊,並注入到匹配的 tool/result 之後。
  • 插件通過 package.json 中的 dsh.bundle.patch 註冊,指向 cordis.patch.yml。

失敗模式:

  • failureMode 支持 fail-closed 和 fallback-to-user。
  • fail-closed:reviewer timeout、unavailable 或 invalid output 時返回 unavailable。
  • fallback-to-user:只在 reviewer failure 時把請求交回 downstream answerer。
  • 顯式 deny 是最終決定,在兩種模式下都不回落到用戶。

安裝與啓用

先確認運行環境:

  • Node.js:^22.19.0 或 >=24.0.0
  • pnpm
  • peer packages:@deepseek-ai/cordis ^4.0.1,以及 ^0.1.0-rc.5 的 DSH packages
  • 已覈實對照 DSH CLI 0.1.0-rc.6

安裝已發佈包:

dsh plugin --profile <profile-name> add dsh-approval-guardian@0.1.1

這一步會把插件註冊到指定 profile。插件通過 package.json 的 dsh.bundle.patch 指向 cordis.patch.yml,安裝後重啓 DSH surface 即可加載。

如果從本地 checkout 安裝:

pnpm install
pnpm run build
dsh plugin --profile web add .

Git 安裝會執行 prepare script。pnpm 10+ 可能需要在目標 profile 的 pnpm-workspace.yaml 中允許該包運行 build scripts。

升級:

dsh plugin --profile <profile-name> add dsh-approval-guardian@<new-version>

禁用:在 profile 的 cordis.patch.yml 中設置 id approval-guardian 爲 disabled: true,然後重啓:

- id: approval-guardian
  disabled: true

移除:

dsh plugin --profile <profile-name> remove dsh-approval-guardian

如果之前添加過 profile-level override,也移除對應 approval-guardian 塊,然後重啓。

典型用法與配置

最小安裝後即可使用。需要定製部署策略時,在 profile 的 cordis.patch.yml 中覆蓋同一個 id。已覈實的配置點包括:

  • prompt:可承載 deployment-specific security policy;如果包含內部規則,不要放入公共倉庫。
  • provider 與 model:必須同時提供或同時省略;只提供一個屬於配置錯誤,插件會拒絕啓動。
  • failureMode:選擇 fail-closed 或 fallback-to-user。
  • 模型供應商憑據由 DSH 的 model routing 管理,該插件沒有插件專屬環境變量。

示例形態(僅列出已覈實字段):

- id: approval-guardian
  config:
    prompt: |
      - Deny operations that touch protected paths unless the user explicitly names them.
    provider: <provider-id>
    model: <model-id>
    failureMode: fail-closed

說明:示例中的 prompt、provider、model、failureMode 均屬於已覈實資料中出現的配置項;示例中的佔位值需要按部署環境替換。

適用場景與注意

適合:

  • 希望 automation 中避免人工彈窗的 strict sandbox escalation 審批。
  • 希望 reviewer 使用結構化 allow / deny,失敗時有明確 fallback 的團隊。
  • 只對真實 sandbox 擴大請求做前置策略,不替代 general approval policy 的場景。

注意:

  • 不要期望它處理 sandbox 內可執行的普通操作;這類操作不進入該流程。
  • 非 strict、非本次工具執行相關的 approval 會繼續到 downstream answerer。
  • 插件以當前 dsh 進程權限運行;安裝前應檢查源碼、許可證和依賴版本。
  • prompt 可能包含內部安全規則,公共倉庫中應避免寫入。
  • 可覈實資料中 README 的 Permissions & data 段落被截斷,完整數據讀取行爲未確認;使用前請自行覈對源碼和運行日誌。
  • dsh-approval-guardian 不是 general approval-policy replacement;它只認領 genuine sandbox widening requests,其他請求交給下游 answerer。

結尾

dsh-approval-guardian 的價值比較具體:把 DSH 中真實出現的 strict sandbox escalation approvals 路由到一次性 reviewer,並保持結構化 allow / deny 與失敗回退邊界清晰。它適合需要無人值守、可解釋審批路徑的 DSH profile,也適合希望保留原有 interactive answerer 作爲 fallback 的團隊。

目錄頁:

https://www.skillhub.cn/plugins/karuboniru/dsh-approval-guardian

GitHub:

https://github.com/karuboniru/dsh-approval-guardian
羽毛球分组比赛记分
小程序二维码

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

小夜