dsh-oh-my-workflow 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +4 -3
- package/package.json +3 -3
- package/preset/agent.cordis.yml +6 -2
- package/preset/guard/evidence.mjs +13 -2
- package/preset/skills/wf-engineering/SKILL.md +6 -0
- package/preset/skills/wf-route/SKILL.md +19 -1
- package/preset/turn-guard.mjs +25 -1
- package/test/guard.test.mjs +49 -5
- package/test/routing.test.mjs +11 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ All notable changes to this project are documented here. The format is based on
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
|
|
5
5
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.3.0] - 2026-11-25
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- 复杂/深入档与长任务的**多 agent 协作**纪律:persona、`wf-route`、`wf-engineering` 明确要求把工作拆成可独立推进的子任务,用 `subagent`(全新上下文,可并行)/`subagent_fork`(继承上下文)委派,宽搜索/批量阅读/独立评审/批量扇出分别交给子代理或 `workflow`;主线只保留目标、决策与集成,子代理只回传结论与证据,控制上下文膨胀。
|
|
12
|
+
- `wf-route` 深入档流程加入“拆分并行委派”,并新增“复杂/长任务全自己扛”的反模式。
|
|
13
|
+
|
|
14
|
+
## [0.2.0] - 2026-11-25
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- `turn-guard` 规则 A(改完必须验证)默认改为 **balanced** 判定:本轮在**首个改动之后**只要出现过一次成功验证就算通过,之后的收尾小改动不再反复触发打回。仍可通过 `evidenceScope: strict` 恢复旧的“验证必须在最后一次改动之后”语义。
|
|
19
|
+
- 官方 `bash`/`pwsh` 的成功结果现在会被识别:这类工具只在非零退出时输出 `[exit code: N]`,因此“非 error 且无标记”视为 exit 0(`assumed-ok`)。OPS `ops_bash` 仍只认显式 `opsShell` 进程事实。可用 `assumeOfficialShellSuccess: false` 关闭。
|
|
20
|
+
- 扩大“强验证”命令识别:`bun`/`deno test|check|lint`、`uv|poetry|pdm|pipenv run pytest|mypy|ruff|tox|nox`、`npm|pnpm|yarn|bun run <test|check|verify|build|lint|type|spec|e2e…>`,以及 `dotnet|go|gradle|flutter|deno|bun run` 目标程序。
|
|
21
|
+
|
|
7
22
|
## [0.1.0] - 2026-11-23
|
|
8
23
|
|
|
9
24
|
### Added
|
package/README.md
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
`dsh-oh-my-workflow` 是一个 DeepSeek Harness 代理预设插件。它把「先想清楚、保持简单、只做必要修改、以可验证目标驱动执行」落成一条可执行流水线:需求追问 → 写规格 → 拆工单 → 实现 → 评审 → 验证 → 交接。
|
|
6
6
|
|
|
7
7
|
- **三档推进**:按目标清晰度与风险,自动判断 **快速 / 标准 / 深入** 三档;快速档直接改并验证,标准档先给 3–6 步计划,深入档先澄清/建模/写规格再实现。
|
|
8
|
+
- **多 agent 协作**:深入档 / 复杂 / 长任务默认不是单线程扛到底——能拆出 2 个以上独立子任务时,用 `subagent` / `subagent_fork` 并行委派(宽搜索、批量阅读、独立评审、批量扇出走 `workflow`),主线只保留目标、决策与集成,子代理只回传结论与证据,避免上下文膨胀。
|
|
8
9
|
- **22 个技能**:覆盖需求追问、写规格、拆工单、实现、评审、验证与交接(来源与许可见 [NOTICE.md](NOTICE.md))。
|
|
9
|
-
-
|
|
10
|
+
- **轮次守卫**:每轮结束前要求「改完必须真验证」的行为证据(默认 balanced:首个改动后的任意一次成功验证即算数,收尾小改动不再反复打回);同一种修法连续失败两次就停下来重新核对共同前提,避免 AI 反复瞎改。
|
|
10
11
|
- **可优雅卸载**:卸载时先清理默认预设指针,避免悬空指针让新会话启动失败。
|
|
11
12
|
|
|
12
13
|
## Install
|
|
@@ -23,9 +24,9 @@ dsh plugin --profile web add github:KianWu/dsh-oh-my-workflow
|
|
|
23
24
|
|
|
24
25
|
## What you get
|
|
25
26
|
|
|
26
|
-
- **Preset `workflow`**(显示名 `Workflow`):自定义 persona
|
|
27
|
+
- **Preset `workflow`**(显示名 `Workflow`):自定义 persona、三档推进纪律、复杂任务多 agent 并行委派纪律、`agent-instructions` 工作区规则注入。
|
|
27
28
|
- **OPS Native 集成**:通过公开的 `dsh-ops/integration` 入口接入文件/Shell/渐进发现工具,不碰私有 `lib/*` 路径。
|
|
28
|
-
- **Turn guard(`turn-guard.mjs
|
|
29
|
+
- **Turn guard(`turn-guard.mjs`)**:在轮次收尾的串行钩子上读取本轮日志;发现「改了文件却没有任何成功验证」或「同一修法重复失败」时,回灌一条短消息让本轮再走一步;守卫自身失败不阻塞回合。默认 `evidenceScope: balanced`(首个改动后验证一次即通过),`assumeOfficialShellSuccess: true`(官方 bash/pwsh 非零才输出退出码,非 error 即视为成功);需要旧严格语义时设 `evidenceScope: strict`。
|
|
29
30
|
- **22 个技能**:见下方清单,全部随包内置,挂载时从本包目录加载。
|
|
30
31
|
- **Uninstall guard + 生命周期 CLI**:`dsh-oh-my-workflow status | doctor [--fix] | uninstall`。
|
|
31
32
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-oh-my-workflow",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "oh-my-workflow:开箱即用的 AI 软件交付工作流。借鉴 Karpathy 的 AI 编程四原则(先想清楚、保持简单、只做必要修改、以可验证目标驱动执行),融合 Matt Pocock 的工程技能包,内置 22 个技能与“改完必须真验证”的轮次守卫,覆盖需求追问 → 写规格 → 拆工单 → 实现 → 评审 → 验证 →
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "oh-my-workflow:开箱即用的 AI 软件交付工作流。借鉴 Karpathy 的 AI 编程四原则(先想清楚、保持简单、只做必要修改、以可验证目标驱动执行),融合 Matt Pocock 的工程技能包,内置 22 个技能与“改完必须真验证”的轮次守卫,覆盖需求追问 → 写规格 → 拆工单 → 实现 → 评审 → 验证 → 交接;复杂/深入任务自动拆分并行委派子代理以控制上下文,让 AI 交付的代码真正可验收。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": "^22.19.0 || >=24.0.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"LICENSE"
|
|
47
47
|
],
|
|
48
48
|
"bin": {
|
|
49
|
-
"dsh-oh-my-workflow": "
|
|
49
|
+
"dsh-oh-my-workflow": "bin/oh-my-workflow.mjs"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"test": "node test/guard.test.mjs && node test/ops-outcome.test.mjs && node test/routing.test.mjs && node test/project-init.test.mjs && node test/uninstall-guard.test.mjs && node scripts/verify-preset.mjs && node scripts/verify-ops-integration.mjs && node scripts/verify-skills.mjs && node scripts/verify-manifest.mjs && node scripts/verify-mount.mjs && node scripts/verify-host-contract.mjs",
|
package/preset/agent.cordis.yml
CHANGED
|
@@ -29,14 +29,16 @@
|
|
|
29
29
|
主线:复述目标 → 判断档位 → 实现 → 验证 → 汇报。
|
|
30
30
|
- 快速档:目标明确、改动小、风险低;直接改并验证。
|
|
31
31
|
- 标准档:多文件或可见行为变化;先给 3–6 步简短计划,再实现。
|
|
32
|
-
-
|
|
32
|
+
- 深入档:需求含糊、高风险、结构变化;先澄清/建模/写规格,经用户确认后实现,复杂时拆分并行委派。
|
|
33
33
|
- 长任务是正交分支:用 st-ledger / st-context-reset / to-tickets / handoff。
|
|
34
34
|
|
|
35
|
+
多 agent 协作:复杂/深入档或长任务,一旦能拆出 2 个以上边界清晰、可独立推进的子任务,先把工作拆成自包含任务并主动委派——用 subagent(全新上下文,可并行)或 subagent_fork(继承当前上下文);宽搜索、批量阅读、日志/数据普查、独立评审优先交给子代理;大批量扇出用 workflow。主线只保留目标、关键决策、跨子任务集成与验收;子代理只回传结论、证据(命令/退出码/文件:行)与文件指针,不回传大段原始输出,避免上下文膨胀。简单任务不要为委派而委派。
|
|
36
|
+
|
|
35
37
|
项目入口:进入代码项目先查 `.agent/AGENTS.md`;存在则读取遵循、不覆盖;缺失则加载 wf-project-init,扫描后创建,只写事实、未知标「待确认」。深入/长任务记录放 `.agent/workflow/`,快速档不建过程文档。
|
|
36
38
|
|
|
37
39
|
工程基线:复用优先;解根因;最小 diff;开工前明确边界与验收;只清理本次孤儿;同步长期文档;证据先于结论。
|
|
38
40
|
|
|
39
|
-
纪律:改后运行真实验证;读回文件不算行为证据;同一修法失败两次就停并验证共同前提(st-unstick);无法验证时明确披露范围。默认只改和验证;提交、开 PR/push
|
|
41
|
+
纪律:改后运行真实验证;读回文件不算行为证据;同一修法失败两次就停并验证共同前提(st-unstick);无法验证时明确披露范围。默认只改和验证;提交、开 PR/push 需用户明确要求,不自动合并。子代理结果必须带证据。
|
|
40
42
|
|
|
41
43
|
优先级:用户明确要求 > 项目 AGENTS/规范 > 本基线。
|
|
42
44
|
|
|
@@ -77,6 +79,8 @@
|
|
|
77
79
|
failStreak: 2
|
|
78
80
|
maxSteersPerTurn: 2
|
|
79
81
|
includeSubagents: true
|
|
82
|
+
evidenceScope: balanced
|
|
83
|
+
assumeOfficialShellSuccess: true
|
|
80
84
|
mutationTools: [write, edit, ops_replace, ops_write_file, ops_edit_file, ops_copy, ops_move, ops_remove]
|
|
81
85
|
checkTools: [bash, pwsh, ops_bash]
|
|
82
86
|
documentationSuffixes: ['.md', '.mdx', '.txt', '.rst', '.adoc']
|
|
@@ -67,10 +67,14 @@ function exitCodeFromText(text) {
|
|
|
67
67
|
* Reduce one outcome to process facts.
|
|
68
68
|
* Returns `null` for non-shell tools, otherwise `{ completed, exitCode, signal, command, reason }`.
|
|
69
69
|
*/
|
|
70
|
-
export function processFact(outcome) {
|
|
70
|
+
export function processFact(outcome, options = {}) {
|
|
71
71
|
if (!SHELLS.has(outcome?.name)) return null
|
|
72
72
|
const command = commandOf(outcome)
|
|
73
73
|
const shell = opsShellOf(outcome)
|
|
74
|
+
// Official `bash`/`pwsh` report `[exit code: N]` only for a non-zero exit, so
|
|
75
|
+
// a non-error result with no marker and no signal is a successful run. OPS
|
|
76
|
+
// results always carry explicit `opsShell` facts and are never assumed.
|
|
77
|
+
const assumeSuccess = options.assumeOfficialShellSuccess !== false
|
|
74
78
|
|
|
75
79
|
// OPS: a background/promoted result has no `opsShell` facts and is never a
|
|
76
80
|
// completed foreground process. A signal also outranks any text rendering.
|
|
@@ -93,6 +97,9 @@ export function processFact(outcome) {
|
|
|
93
97
|
return { completed: false, exitCode: code, signal, command, reason: 'signal' }
|
|
94
98
|
}
|
|
95
99
|
if (code === undefined) {
|
|
100
|
+
if (assumeSuccess && outcome?.isError !== true) {
|
|
101
|
+
return { completed: true, exitCode: 0, signal: undefined, command, reason: 'assumed-ok' }
|
|
102
|
+
}
|
|
96
103
|
return { completed: false, exitCode: undefined, signal: undefined, command, reason: 'missing-exit-code' }
|
|
97
104
|
}
|
|
98
105
|
return { completed: code === 0, exitCode: code, signal: undefined, command, reason: code === 0 ? 'ok' : 'non-zero-exit' }
|
|
@@ -113,6 +120,9 @@ const PROJECT_CHECK_PATTERNS = [
|
|
|
113
120
|
/\bmake\s+(?:test|check|build)\b/i,
|
|
114
121
|
/\bcmake\s+--build\b/i,
|
|
115
122
|
/\bnode\s+--test\b/i,
|
|
123
|
+
/\b(?:bun|deno)\s+(?:test|check|lint)\b/i,
|
|
124
|
+
/\b(?:uv|poetry|pdm|pipenv)\s+run\s+(?:pytest|mypy|ruff|tox|nox)\b/i,
|
|
125
|
+
/\b(?:npm|pnpm|yarn|bun)\s+run\s+[\w:-]*(?:test|check|verify|build|lint|type|spec|e2e)[\w:-]*/i,
|
|
116
126
|
]
|
|
117
127
|
|
|
118
128
|
/** Running a target script is evidence only when it names an edited file. */
|
|
@@ -124,6 +134,7 @@ const TARGET_RUN_PATTERNS = [
|
|
|
124
134
|
/\bpython(?:3)?\s+(?:\.\/)?([^\s]+\.py)\b/i,
|
|
125
135
|
/\bpython(?:3)?\s+-c\b/i,
|
|
126
136
|
/(?:^|\s)(?:\.\/)?([^\s]+\.(?:exe|cmd|bat|ps1|sh))\b/i,
|
|
137
|
+
/\b(?:dotnet|go|gradle|gradlew|flutter|deno|bun)\s+run\b/i,
|
|
127
138
|
]
|
|
128
139
|
|
|
129
140
|
function mentionsAny(command, files) {
|
|
@@ -160,7 +171,7 @@ export function classifyVerificationCommand(command, config = {}, mutatedFiles =
|
|
|
160
171
|
|
|
161
172
|
/** Full verification fact for one shell outcome. */
|
|
162
173
|
export function verificationFact(outcome, config = {}, mutatedFiles = []) {
|
|
163
|
-
const process = processFact(outcome)
|
|
174
|
+
const process = processFact(outcome, config)
|
|
164
175
|
if (process === null) return null
|
|
165
176
|
const classification = process.completed
|
|
166
177
|
? classifyVerificationCommand(process.command, config, mutatedFiles)
|
|
@@ -26,6 +26,12 @@ description: "通用开发基线:复用、根因、最小 diff、显式边界
|
|
|
26
26
|
9. **同步文档**:结构、命令和行为变化同步长期文档;不复制规范全文,只维护入口与事实。
|
|
27
27
|
10. **证据汇报**:汇报分三段——改了什么、如何验证(命令与结果)、还剩什么(未验证范围/后续项)。不把推测写成结果。
|
|
28
28
|
|
|
29
|
+
## 协作与委派
|
|
30
|
+
|
|
31
|
+
- 可拆成多个独立子任务,或需要宽搜索 / 批量阅读 / 独立评审时,拆给 `subagent` / `subagent_fork` 并行处理;主线只保留结论、证据与集成。
|
|
32
|
+
- 子代理用新上下文、只回传结论与证据(命令 / 退出码 / 文件:行),不把原始大段输出带回主线。
|
|
33
|
+
- 简单任务不要为委派而委派。
|
|
34
|
+
|
|
29
35
|
## 验证分级
|
|
30
36
|
|
|
31
37
|
- **强证据**:测试、构建、类型检查、目标程序运行,真实完成且退出码为 0。
|
|
@@ -15,7 +15,7 @@ description: "Workflow 三档路由与长任务分支。Use when starting a task
|
|
|
15
15
|
|---|---|---|---|
|
|
16
16
|
| 快速档 | 目标明确、改动小、风险低,通常单文件 | 读取必要代码后直接修改并验证 | 至少一条能证明改动的真实命令;纯文档改动可说明豁免 |
|
|
17
17
|
| 标准档 | 多文件,或存在可见行为变化 | 先给简短计划(3–6 步)→ 实现 → 验证 → 自查 | 测试、构建、类型检查或目标程序运行 |
|
|
18
|
-
| 深入档 | 需求含糊、高风险、涉及结构/接口/数据流变化 | 澄清 → 建模或规格 → 用户确认 → 实现 → 验证 → 评审 | 按规格验收,保留规格/计划/ADR |
|
|
18
|
+
| 深入档 | 需求含糊、高风险、涉及结构/接口/数据流变化 | 澄清 → 建模或规格 → 用户确认 → 拆分并行委派 → 实现 → 验证 → 评审 | 按规格验收,保留规格/计划/ADR |
|
|
19
19
|
|
|
20
20
|
判定倾向:
|
|
21
21
|
|
|
@@ -24,6 +24,23 @@ description: "Workflow 三档路由与长任务分支。Use when starting a task
|
|
|
24
24
|
- 只改文案、注释、README 且无行为变化,可按**快速档**。
|
|
25
25
|
- 任务开始时用一句话说明档位和理由,不要长篇解释。
|
|
26
26
|
|
|
27
|
+
## 多 agent 协作
|
|
28
|
+
|
|
29
|
+
复杂、深入档或长任务,默认不是单线程扛到底。满足任一条就拆分并委派:
|
|
30
|
+
|
|
31
|
+
- 有 2 个以上边界清晰、可独立推进的子任务(不同模块 / 文件集 / 调研问题);
|
|
32
|
+
- 需要宽搜索、批量阅读、日志或数据普查,原始输出很大;
|
|
33
|
+
- 需要独立评审、第二意见,或一个不含本对话历史的干净上下文。
|
|
34
|
+
|
|
35
|
+
分工与选型:
|
|
36
|
+
|
|
37
|
+
- `subagent`:全新上下文,自包含任务(研究、批量检索、独立实现、评审),可同时起多个并行。
|
|
38
|
+
- `subagent_fork`:继承当前对话,用于接续已有结论的后续分析或评审。
|
|
39
|
+
- `workflow`:按脚本对大量文件 / 条目扇出(审计、迁移、批量验证)。
|
|
40
|
+
- `list_agents` / `send_message`:查看、续接已存在的子代理。
|
|
41
|
+
|
|
42
|
+
主线保留目标、关键决策、跨子任务集成与最终验收;子代理只回传结论、证据(命令 / 退出码 / 文件:行)和文件指针,不回传大段原始输出。简单任务不要硬拆。
|
|
43
|
+
|
|
27
44
|
## 长任务分支
|
|
28
45
|
|
|
29
46
|
长任务是正交分支,可与标准档或深入档组合,触发条件:
|
|
@@ -58,4 +75,5 @@ description: "Workflow 三档路由与长任务分支。Use when starting a task
|
|
|
58
75
|
- 需求含糊却直接改代码。
|
|
59
76
|
- 深入档未经用户确认就开始大规模实现。
|
|
60
77
|
- 快速档顺手重构、扩大范围。
|
|
78
|
+
- 复杂/长任务全自己扛,上下文越滚越大、反复重读。
|
|
61
79
|
- 长任务只靠聊天记忆,不写 PROGRESS/ledger。
|
package/preset/turn-guard.mjs
CHANGED
|
@@ -42,6 +42,8 @@ const DEFAULTS = Object.freeze({
|
|
|
42
42
|
failStreak: 2,
|
|
43
43
|
maxSteersPerTurn: 2,
|
|
44
44
|
includeSubagents: true,
|
|
45
|
+
evidenceScope: 'balanced',
|
|
46
|
+
assumeOfficialShellSuccess: true,
|
|
45
47
|
mutationTools: MUTATION_TOOLS,
|
|
46
48
|
checkTools: SHELL_TOOLS,
|
|
47
49
|
documentationSuffixes: DEFAULT_DOCUMENTATION_SUFFIXES,
|
|
@@ -64,6 +66,15 @@ function positiveInteger(config, key) {
|
|
|
64
66
|
return value
|
|
65
67
|
}
|
|
66
68
|
|
|
69
|
+
function enumOption(config, key, allowed, fallback) {
|
|
70
|
+
const value = config[key]
|
|
71
|
+
if (value === undefined) return fallback
|
|
72
|
+
if (typeof value !== 'string' || !allowed.includes(value)) {
|
|
73
|
+
throw new TypeError(`${name}: ${key} must be one of ${allowed.join(', ')}`)
|
|
74
|
+
}
|
|
75
|
+
return value
|
|
76
|
+
}
|
|
77
|
+
|
|
67
78
|
function stringList(config, key, fallback) {
|
|
68
79
|
const value = config[key]
|
|
69
80
|
if (value === undefined) return [...fallback]
|
|
@@ -89,6 +100,8 @@ export function normalizeOptions(raw = {}) {
|
|
|
89
100
|
failStreak: positiveInteger(config, 'failStreak'),
|
|
90
101
|
maxSteersPerTurn: positiveInteger(config, 'maxSteersPerTurn'),
|
|
91
102
|
includeSubagents: booleanOption(config, 'includeSubagents'),
|
|
103
|
+
evidenceScope: enumOption(config, 'evidenceScope', ['balanced', 'strict'], DEFAULTS.evidenceScope),
|
|
104
|
+
assumeOfficialShellSuccess: booleanOption(config, 'assumeOfficialShellSuccess'),
|
|
92
105
|
mutationTools,
|
|
93
106
|
checkTools,
|
|
94
107
|
documentationSuffixes,
|
|
@@ -121,6 +134,7 @@ export function evaluateTurn(outcomes, options = {}) {
|
|
|
121
134
|
}
|
|
122
135
|
|
|
123
136
|
const lastMutation = mutations.length === 0 ? -1 : mutations[mutations.length - 1].index
|
|
137
|
+
const firstMutation = mutations.length === 0 ? -1 : mutations[0].index
|
|
124
138
|
const strong = verifications.filter(fact => fact.strong)
|
|
125
139
|
const lastStrong = strong.length === 0 ? -1 : strong[strong.length - 1].index
|
|
126
140
|
|
|
@@ -128,7 +142,14 @@ export function evaluateTurn(outcomes, options = {}) {
|
|
|
128
142
|
const unprovenFiles = [...new Set(unproven.flatMap(fact => fact.paths))]
|
|
129
143
|
const docOnly = unprovenFiles.length > 0 && onlyDocumentation(unprovenFiles, documentationSuffixes)
|
|
130
144
|
|
|
131
|
-
const
|
|
145
|
+
const evidenceScope = options.evidenceScope === 'strict' ? 'strict' : 'balanced'
|
|
146
|
+
// balanced: one strong verification after the *first* change of the turn is
|
|
147
|
+
// enough; later small edits do not force another run. strict: the check must
|
|
148
|
+
// come after the *last* change.
|
|
149
|
+
const missingUnderScope = evidenceScope === 'strict'
|
|
150
|
+
? lastMutation >= 0 && lastStrong < lastMutation
|
|
151
|
+
: lastMutation >= 0 && !(lastStrong > firstMutation)
|
|
152
|
+
const evidenceMissing = missingUnderScope && !docOnly
|
|
132
153
|
const failures = failureSummary(list, threshold)
|
|
133
154
|
|
|
134
155
|
let rule = 'allow'
|
|
@@ -139,7 +160,9 @@ export function evaluateTurn(outcomes, options = {}) {
|
|
|
139
160
|
rule,
|
|
140
161
|
mutationCount: mutations.length,
|
|
141
162
|
lastMutation,
|
|
163
|
+
firstMutation,
|
|
142
164
|
lastStrong,
|
|
165
|
+
evidenceScope,
|
|
143
166
|
evidenceMissing,
|
|
144
167
|
documentationOnly: docOnly,
|
|
145
168
|
mutatedFiles: allMutatedFiles,
|
|
@@ -238,6 +261,7 @@ export function apply(ctx, rawConfig = {}) {
|
|
|
238
261
|
documentationSuffixes: project.documentationSuffixes?.length > 0
|
|
239
262
|
? project.documentationSuffixes
|
|
240
263
|
: options.documentationSuffixes,
|
|
264
|
+
assumeOfficialShellSuccess: options.assumeOfficialShellSuccess,
|
|
241
265
|
}
|
|
242
266
|
|
|
243
267
|
const analysis = evaluateTurn(toolOutcomes(current), { ...options, verification })
|
package/test/guard.test.mjs
CHANGED
|
@@ -93,6 +93,22 @@ check('command classification separates project checks, target runs and noise',
|
|
|
93
93
|
assert.equal(classifyVerificationCommand('node custom-check.js', { commands: ['node custom-check.js'] }, []).strong, true)
|
|
94
94
|
})
|
|
95
95
|
|
|
96
|
+
check('official shell success without a marker is assumed ok; errors are not', () => {
|
|
97
|
+
const ok = toolOutcomes(events(
|
|
98
|
+
call(1, 'c1', 'pwsh', { command: 'npm test' }),
|
|
99
|
+
result(1, 'c1', { text: 'all tests passed' }),
|
|
100
|
+
))[0]
|
|
101
|
+
assert.equal(processFact(ok).completed, true)
|
|
102
|
+
assert.equal(processFact(ok).reason, 'assumed-ok')
|
|
103
|
+
assert.equal(processFact(ok, { assumeOfficialShellSuccess: false }).completed, false)
|
|
104
|
+
|
|
105
|
+
const errored = toolOutcomes(events(
|
|
106
|
+
call(1, 'c2', 'pwsh', { command: 'npm test' }),
|
|
107
|
+
result(1, 'c2', { text: 'boom', isError: true }),
|
|
108
|
+
))[0]
|
|
109
|
+
assert.equal(processFact(errored).completed, false)
|
|
110
|
+
})
|
|
111
|
+
|
|
96
112
|
check('failureSummary counts same-kind trailing failures only', () => {
|
|
97
113
|
const same = toolOutcomes(events(
|
|
98
114
|
...officialShell(1, 'c1', 'pwsh', 'npm test', 1),
|
|
@@ -207,15 +223,26 @@ await checkAsync('documentation-only edit is exempt; mixed edit is not', async (
|
|
|
207
223
|
assert.match(textOf(mixed.steers[0]), /core\.ts/)
|
|
208
224
|
})
|
|
209
225
|
|
|
210
|
-
await checkAsync('
|
|
226
|
+
await checkAsync('balanced: one check after the first edit covers later edits', async () => {
|
|
211
227
|
const run = makeRun()
|
|
212
228
|
await run.stop(events(
|
|
213
|
-
call(1, 'c1', 'write', { file_path: '
|
|
229
|
+
call(1, 'c1', 'write', { file_path: 'first.ts' }), result(1, 'c1'),
|
|
214
230
|
...officialShell(1, 'c2', 'pwsh', 'npm test', 0),
|
|
215
|
-
call(1, 'c3', 'edit', { file_path: '
|
|
231
|
+
call(1, 'c3', 'edit', { file_path: 'later.ts' }), result(1, 'c3'),
|
|
216
232
|
), 1)
|
|
217
|
-
assert.
|
|
218
|
-
|
|
233
|
+
assert.equal(run.steers.length, 0)
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
await checkAsync('strict scope still asks for a check after the last edit', async () => {
|
|
237
|
+
const run = makeRun({ evidenceScope: 'strict' })
|
|
238
|
+
await run.stop(events(
|
|
239
|
+
call(1, 'c1', 'write', { file_path: 'first.ts' }), result(1, 'c1'),
|
|
240
|
+
...officialShell(1, 'c2', 'pwsh', 'npm test', 0),
|
|
241
|
+
call(1, 'c3', 'edit', { file_path: 'later.ts' }), result(1, 'c3'),
|
|
242
|
+
), 1)
|
|
243
|
+
assert.equal(run.steers.length, 1)
|
|
244
|
+
assert.match(textOf(run.steers[0]), /later\.ts/)
|
|
245
|
+
assert.doesNotMatch(textOf(run.steers[0]), /first\.ts/)
|
|
219
246
|
})
|
|
220
247
|
|
|
221
248
|
await checkAsync('per-turn budget caps steers and rewords the second', async () => {
|
|
@@ -260,6 +287,7 @@ check('bad config throws at mount', () => {
|
|
|
260
287
|
assert.throws(() => makeRun({ failStreak: 0 }), /positive integer/)
|
|
261
288
|
assert.throws(() => makeRun({ evidence: 'yes' }), /must be a boolean/)
|
|
262
289
|
assert.throws(() => makeRun({ mutationTools: [] }), /must not be empty/)
|
|
290
|
+
assert.throws(() => makeRun({ evidenceScope: 'loose' }), /evidenceScope/)
|
|
263
291
|
})
|
|
264
292
|
|
|
265
293
|
await checkAsync('OPS completed + ops_bash success closes without a nudge', async () => {
|
|
@@ -323,4 +351,20 @@ await checkAsync('parent and child sessions keep independent counters', async ()
|
|
|
323
351
|
assert.equal(run.steers.length, 2)
|
|
324
352
|
})
|
|
325
353
|
|
|
354
|
+
check('running the edited target program is strong evidence', () => {
|
|
355
|
+
const cmd = "Start-Process -FilePath E:/Steam/steamapps/common/Godot/godot.windows.opt.tools.64.exe -ArgumentList '--path',$proj,'res://tmp_perf_probe.tscn' -Wait"
|
|
356
|
+
assert.equal(classifyVerificationCommand(cmd, {}, ['godot-flight-simulator/tmp_perf_probe.tscn']).strong, true)
|
|
357
|
+
})
|
|
358
|
+
|
|
359
|
+
await checkAsync('real-world: a Godot target run with no exit marker closes without a nudge', async () => {
|
|
360
|
+
const run = makeRun()
|
|
361
|
+
const cmd = "Start-Process -FilePath E:/Steam/steamapps/common/Godot/godot.windows.opt.tools.64.exe -ArgumentList '--path',$proj,'res://tmp_perf_probe.tscn' -Wait"
|
|
362
|
+
await run.stop(events(
|
|
363
|
+
call(1, 'c1', 'write', { file_path: 'godot-flight-simulator/tmp_perf_probe.tscn' }), result(1, 'c1'),
|
|
364
|
+
call(1, 'c2', 'pwsh', { command: cmd }),
|
|
365
|
+
result(1, 'c2', { text: 'elapsed=53s\r\nPERF|60|26.0|28.56|150.00' }),
|
|
366
|
+
), 1)
|
|
367
|
+
assert.equal(run.steers.length, 0)
|
|
368
|
+
})
|
|
369
|
+
|
|
326
370
|
console.log(`\n${passed} checks passed`)
|
package/test/routing.test.mjs
CHANGED
|
@@ -83,4 +83,15 @@ check('persona points at the route skill and the main skills', () => {
|
|
|
83
83
|
assert.match(persona, /code-review/)
|
|
84
84
|
})
|
|
85
85
|
|
|
86
|
+
check('complex tasks route to multi-agent delegation', () => {
|
|
87
|
+
assert.match(route, /多 agent 协作/)
|
|
88
|
+
assert.match(route, /subagent_fork/)
|
|
89
|
+
assert.match(route, /并行/)
|
|
90
|
+
assert.match(route, /上下文/)
|
|
91
|
+
assert.match(route, /拆分并行委派/)
|
|
92
|
+
assert.match(persona, /多 agent 协作/)
|
|
93
|
+
assert.match(persona, /subagent_fork/)
|
|
94
|
+
assert.match(engineering, /委派/)
|
|
95
|
+
})
|
|
96
|
+
|
|
86
97
|
console.log(`\n${passed} checks passed`)
|