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.createSessionIdcreateUserMessageAgent.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

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

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

Xiaoye