dsh-auto-review-model-select
Manifest validGives Auto review its own model instead of inheriting the main one, and repairs replies that break the reviewer's closed JSON protocol: prose, Markdown fences, an `allow` carrying a `reason`, a trunca
dsh-auto-review-model-select
让 DeepSeek Harness 的「自动审查」改用指定模型,并把不合规的裁决输出就地修正。
为什么需要
DSH 的 Auto review 是逐调用的模型授权门:每次工具调用执行前,都会用当前 agent 最近一次请求的 provider/model 再问一次模型。它有两个硬约束:
- 路由写死:reviewer 读的是
session.requestHeader().config,所以永远跟着主模型走,没有配置项。 - 协议很窄:回复必须是「0..n 个 reasoning 块 + 恰好 1 个 text 块」,text 里是六种合法 JSON 形状之一,且 finish 必须是
stop。通用模型经常带前后缀、代码围栏、给allow加reason,或输出被max-tokens截断——这些都会变成AUTO_REVIEW_FAILED,调用被拦下且不会重试,也不会转人工。
这个插件解决第二类问题,并顺带把路由变成可配置的。
它做什么
- 换审查模型:把
auto-review请求重新派发到你指定的 provider/model(留空则跟随主模型)。 - 格式提醒:在 reviewer 的 system prompt 末尾再强调一次 JSON 协议。
- 修复输出:在流层面把回复归一化——容忍夹叙、代码围栏、多余
reason、low + deny、high + allow、max-tokens截断、甚至被写成 tool call 的裁决。 - 失败兜底:确实读不出裁决、或审查请求本身就没成功(限流、连接中断)时,默认降级为
medium + deny,在ask审批策略下变成一次普通审批弹窗,而不是让工具调用直接失败。审查器不可用只影响这一次裁决,不会把整轮工具调用全部拦下。
安装
需要 DSH >= 0.2.2-rc.1;构建和测试需要 Node.js >= 22.19.0。
尚未发布到 npm,从 GitHub 安装:
dsh plugin --profile <profile> add github:GT-610/dsh-auto-review-model-select
也可以克隆后安装本地目录:
git clone https://github.com/GT-610/dsh-auto-review-model-select
dsh plugin --profile <profile> add /path/to/dsh-auto-review-model-select
装好后重启 DSH。dist/ 随仓库提交,从 git 安装无需放行构建脚本;本地包也可以在「设置 → 插件」里安装。
安装后,设置位置:设置 → 插件 → 自动审查模型 → 配置。
本地开发
pnpm install
pnpm build # 改了源码后重建 dist/
把仓库链接进 profile 的 node_modules:
# macOS / Linux
ln -s "$PWD" ~/.dsh/profiles/<profile>/node_modules/dsh-auto-review-model-select
# Windows
New-Item -ItemType SymbolicLink -Path "$env:USERPROFILE\.dsh\profiles\<profile>\node_modules\dsh-auto-review-model-select" -Target (Get-Location)
之后运行 pnpm dev(tsdown --watch)。客户端改动刷新页面即可;Host 半边(src/index.ts、src/repair.ts)改动需要重启 DSH。
配置
| 字段 | 默认 | 说明 |
|---|---|---|
enabled | true | 总开关 |
provider | "" | 审查模型提供方;留空跟随主模型 |
model | "" | 审查模型 id;留空跟随主模型 |
reasoningEffort | "" | 审查时的推理强度;留空用模型默认 |
hint | true | 是否追加格式提醒 |
repair | true | 是否归一化裁决输出 |
retry | 1 | 完全读不出裁决时重问几次(0–2) |
fallback | "deny" | 读不出裁决或审查请求失败时:deny 转人工审批,fail 让调用失败 |
provider 和 model 要一起填写:只填其中一个时按「跟随主模型」处理,不会只换一半。
也可以直接写在 cordis.patch.yml 的插件行里;设置页改的是同一份配置(字段是 volatile 的,改完下一次审查即生效,不重启插件)。
原理
- 监听
llm/streamwaterfall,只处理purpose === 'auto-review'的请求。 - waterfall 不能原地改请求(gate 传进来的 options 是 deep-frozen 的),所以复制一份重新
ctx.llm.stream();用WeakSet标记自己派发的请求,避免递归。 - 输出侧缓冲文本与 tool-call 参数、原样转发 reasoning/usage、丢弃 text 与 tool 块,最后合成「1 个 text 块 +
stop」。用的是 gate 自己那套BlockAssembler能接受的形状。 - 解析顺序:先整段
JSON.parse;失败则扫描文本里平衡的{}/[](代码围栏、夹叙、数组包装都在这一步被顺带容忍),取最后一个合法形状。 - 归一化:
allow一律去掉reason;low + deny变medium + deny(保留拒绝);high + allow变high + deny(fail-closed)。 - 错误处理:provider 报错(限流、连接中断)不是协议问题——没有回复可读,也没有格式可纠,所以不消耗重试,直接走
fallback;失败原因会写进审批弹窗。aborted原样透传,因为那是调用方自己取消的,不该在取消之后弹出一个审批框。
已知限制
- 只改审查请求,不影响主模型,也不改变 Auto 模式本身的沙箱与审批语义。
- 换到另一个 provider 会丢掉审查请求的前缀缓存,长会话下审查成本会上升。
run_code程序内部的直接 Node 副作用本来就不在 Auto review 范围内,本插件也不覆盖。retry每次最多追加 2 次审查请求,长会话下会放大审查成本。
开发
pnpm install
pnpm check # 类型检查 + 代码检查 + 构建 + 单元测试 + 产物纯净度 + 语言卡片
pnpm test # 重新构建客户端产物并跑测试
dist/ 随仓库提交,CI 会重新构建并比对,产物漂移直接失败。
客户端产物只能 require 外壳冻结模块表里的模块;scripts/check-client-purity.mjs 读取构建结果拒绝越界请求——这类错误不会在类型检查或测试阶段暴露,只会在运行时静默失效。
兼容性
- 仅换审查请求的路由与裁决输出,不改变主模型、Auto 沙箱或审批语义。
- 与 DSH 自带的
dsh-experimental-auto-review配合工作,不替换它。 - 设置页文案跟随 DSH 界面的语言。
许可
Comments
Loading…
Similar plugins
by LAwLi3tCoding
Adds an "approve for me" access mode whose approval requests are answered by an independent reviewer model instead of a person: the reviewer can read the workspace read-only, a reviewer that cannot ru
★ 0
NOASSERTION
TypeScript
Oct 14, 2026
dsh plugin --profile web add dsh-approval-reviewby AntaresCorn
Codex-style auto-review permission mode: adds an auto-review preset that auto-approves safe sandbox escalations, asks on risky or ambiguous ones, and rejects critical unconfirmed operations.
★ 0
BSD-3-Clause
TypeScript
Sep 16, 2026
dsh plugin --profile web add @dsh-external/dsh-auto-reviewerDeepSeek Harness approval guardian: a reviewer model decides permission requests before they reach you, with a System One decision-API backend (TypeSafe Jev, SiliconFlow, self-hosted Laya), a configur
★ 0
dsh plugin --profile web add dsh-auto-review-jevby flyhai
Interception and audit frame for DeepSeek Harness: one approval ladder, hash-chained audit, result redaction.
★ 0
BSD-3-Clause
JavaScript
Nov 17, 2026
dsh plugin --profile web add dsh-auto-approval-frameby PerryLink
Second-model AI auto-review for DeepSeek Harness approval requests: a read-only reviewer subagent returns structured allow/deny verdicts with reasons, fail-closed by default, fully auditable from the
★ 253
↓ 1.4k/wk
Apache-2.0
TypeScript
Nov 14, 2026
dsh plugin --profile web add dsh-auto-reviewby Elaina-real
Tiered auto-review for DeepSeek Harness (DSH): static-rule safety net + LLM reviewer + human fallback. Auto-approve safe actions, auto-deny irreversible ones, ask a human for the rest. PURE VIBE CODING - not audited, use at your own risk.
★ 0
↓ 22/wk
MIT
JavaScript
Aug 14, 2026
dsh plugin --profile web add dsh-tiered-approval