dsh-agent-arena:DSH 插件中的多模型編碼比較與確定性驗收

前言

在 DSH 的插件式開發流程中,比較多個模型的編碼結果時,常見需求是把每個模型的修改隔離運行、用統一命令驗證、逐一審看 diff,並顯式選擇要保留的結果。dsh-agent-arena 面向這個流程,提供 2–4 個已配置模型的對戰、確定性驗證、評分和報告,最後由使用者明確應用其中一個 winner。

這是什麼

dsh-agent-arena 是 LeemanCheung 維護的 MIT 許可 DSH 插件,定位是 “Isolated multi-model coding matches with deterministic verification, scoring, and reports”。它適合需要比較多個 provider/model 路線編碼結果,並且希望驗收過程不依賴 LLM judge 的 DSH 使用者。

核心功能

多模型隔離對局

  • 支持在隔離 Git worktrees 中比較 2–4 個已配置模型。
  • 每個 contestant 通過公開的 ctx.agents.create、SessionId、createUserMessage 和 Agent.followup APIs 啓動。
  • 對局支持 Start、Cancel、diff review 和 Apply winner,且不依賴瀏覽器全局對象。
  • 插件會審查每個 diff,並顯式應用一個 winner。

確定性驗證

  • Git 與 validation argv 通過 ctx.subprocess.spawn 執行,不會使用 shell。
  • Settings 中的 validation 字段接受保守的 whitespace-separated argv,例如:
corepack pnpm test
git status --porcelain=v1
  • 以下輸入會被拒絕:quotes、shell variables、pipes、redirections、command separators、backticks、newlines。
  • 評分不使用 LLM judge:每個 validation 有 positive weight,contestant score 是成功退出 validation 的 total positive validation weight 百分比;平局時使用 contestant id 作爲 stable deterministic tie-breaker。

diff 審查與應用

  • 對局開始前要求 clean git status --porcelain=v1,之後纔會創建 worktrees。
  • 審查使用 binary-capable git diff HEAD,覆蓋 staged、unstaged 和 intent-to-add files。
  • winner worktree 會保留到使用者顯式 apply。
  • Apply 時會再次執行 cleanliness check,確認 HEAD 仍等於記錄的 base revision,然後運行:
git apply --check
git apply --index --whitespace=error
  • Arena 不會自動 apply、commit、push 或 rewrite history。

持久化與邊界限制

  • Match reports 通過 storageDomain 持久化。
  • 插件會 poll 生成的 agentArena Remote namespace in Settings。
  • Host 重啓後,interrupted nonterminal match 會被標記爲 failed。
  • Cancellation 依賴所選 provider 是否遵循 supplied abort signal。
  • 超過 1 MB review/apply bound 的 patch 會在 mutation 前被拒絕,而不是被截斷。

安裝與啓用

安裝命令:

dsh plugin --profile web add github:LeemanCheung/dsh-agent-arena

安裝後,需要重啓現有的 DSH Web 進程並刷新其頁面。

所選 profile 必須提供:

  • agents
  • subprocess
  • storageDomain
  • Typert Remotes
  • Settings
  • 至少兩條可用 provider/model routes

典型用法

1、配置 validation commands。參數不應需要 shell quoting,例如:

corepack pnpm test
git status --porcelain=v1

2、開始對局前,確認倉庫狀態滿足 clean git status --porcelain=v1。

3、運行插件支持的 Start、Cancel、diff review 和 Apply winner 流程,查看每個 contestant 的 diff、score 和 report。

4、如果需要在本地開發該插件,可在 repository root 運行:

corepack pnpm typecheck
corepack pnpm test
corepack pnpm build
corepack pnpm pack:check

適用場景與注意

適合在 DSH 中比較多個模型編碼結果,並且希望驗證、評分和應用流程可解釋、可復現的開發者。

使用前注意:

  • 插件以當前 dsh 進程權限運行,安裝前應檢查源碼與 MIT 許可證。
  • validation argv 使用 deliberately conservative tokenizer,不能表達包含 whitespace 的參數。
  • Apply 要求 clean git status --porcelain=v1,並且 HEAD 等於記錄的 base revision。
  • Cancellation 是否有效,取決於所選 provider 是否遵循 supplied abort signal。
  • 超過 1 MB review/apply bound 的 patch 會被拒絕,而不是截斷。
  • Arena 不會自動 apply、commit、push 或 rewrite history。

結尾

dsh-agent-arena 的作用是把多模型編碼比較放進隔離 worktrees、確定性 validation、diff review 和顯式 Apply 的流程裏。GitHub 倉庫見:https://github.com/LeemanCheung/dsh-agent-arena

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

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

小夜