@fitlab-ai/agent-infra 0.12.1 → 0.12.2

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.
Files changed (303) hide show
  1. package/README.md +0 -2
  2. package/README.zh-CN.md +0 -2
  3. package/dist/bin/internal-cli.js +2 -17
  4. package/dist/lib/agent-clients/adapter.js +0 -13
  5. package/dist/lib/agent-clients/adapters/antigravity-cli.js +0 -5
  6. package/dist/lib/agent-clients/adapters/claude-code-credentials.js +0 -17
  7. package/dist/lib/agent-clients/adapters/claude-code.js +0 -9
  8. package/dist/lib/agent-clients/adapters/codex.js +0 -52
  9. package/dist/lib/agent-clients/adapters/opencode.js +0 -5
  10. package/dist/lib/agent-clients/adapters/traecli.js +0 -5
  11. package/dist/lib/agent-clients/config.js +19 -54
  12. package/dist/lib/agent-clients/registry.js +1 -12
  13. package/dist/lib/agent-clients/schema.js +0 -18
  14. package/dist/lib/agent-clients/tokens.js +1 -2
  15. package/dist/lib/agent-clients/types.js +0 -1
  16. package/dist/lib/decide.js +2 -0
  17. package/dist/lib/git/worktree-identity.js +1 -9
  18. package/dist/lib/internal/agent-client.js +2 -62
  19. package/dist/lib/internal/cli-route-inventory.js +1 -5
  20. package/dist/lib/internal/manual-validation.js +18 -10
  21. package/dist/lib/internal/task-create.js +1 -1
  22. package/dist/lib/internal/task-event.js +1 -8
  23. package/dist/lib/internal/task-finalization.js +0 -1
  24. package/dist/lib/internal/task-lifecycle.js +2 -2
  25. package/dist/lib/internal/task-operation-registry.js +4 -20
  26. package/dist/lib/internal/task-review.js +4 -4
  27. package/dist/lib/platform/comment-safety.js +1 -7
  28. package/dist/lib/platform/in-label-sync.js +1 -14
  29. package/dist/lib/platform/issue-comments.js +1 -16
  30. package/dist/lib/platform/issues.js +1 -1
  31. package/dist/lib/platform/operation-coordinator.js +4 -2
  32. package/dist/lib/platform/pr-change-report.js +1 -4
  33. package/dist/lib/platform/pr-checks.js +2 -8
  34. package/dist/lib/platform/provider-validation.js +0 -20
  35. package/dist/lib/platform/pull-requests.js +73 -84
  36. package/dist/lib/platform/releases.js +1 -43
  37. package/dist/lib/platform/verification-required.js +0 -2
  38. package/dist/lib/platform/verification-sync.js +1 -79
  39. package/dist/lib/process-data/normalize.js +1 -185
  40. package/dist/lib/process-data/privacy.js +1 -16
  41. package/dist/lib/process-data/sources.js +2 -279
  42. package/dist/lib/render.js +0 -12
  43. package/dist/lib/run/index.js +15 -10
  44. package/dist/lib/run/skills.js +0 -3
  45. package/dist/lib/sandbox/commands/create.js +40 -53
  46. package/dist/lib/sandbox/commands/list-running.js +0 -18
  47. package/dist/lib/sandbox/commands/start.js +7 -8
  48. package/dist/lib/sandbox/constants.js +0 -6
  49. package/dist/lib/sandbox/control/client.js +0 -1
  50. package/dist/lib/sandbox/control/container-identity.js +1 -16
  51. package/dist/lib/sandbox/control/executor.js +0 -4
  52. package/dist/lib/sandbox/control/identity-sentinel.js +0 -7
  53. package/dist/lib/sandbox/control/lifecycle.js +21 -37
  54. package/dist/lib/sandbox/control/native-file-lock.js +0 -3
  55. package/dist/lib/sandbox/control/server.js +18 -38
  56. package/dist/lib/sandbox/control/state.js +1 -9
  57. package/dist/lib/sandbox/dockerfile.js +0 -6
  58. package/dist/lib/sandbox/engine.js +0 -14
  59. package/dist/lib/sandbox/engines/docker-exact-discovery.js +1 -4
  60. package/dist/lib/sandbox/engines/wsl2-paths.js +0 -3
  61. package/dist/lib/sandbox/recovery.js +24 -26
  62. package/dist/lib/sandbox/removal.js +11 -519
  63. package/dist/lib/sandbox/task-resolver.js +0 -41
  64. package/dist/lib/sandbox/tools.js +1 -4
  65. package/dist/lib/sandbox/workspace-view.js +1 -2
  66. package/dist/lib/server/display.js +0 -6
  67. package/dist/lib/task/activity-intent.js +45 -40
  68. package/dist/lib/task/activity-log.js +9 -16
  69. package/dist/lib/task/artifact-command.js +1 -1
  70. package/dist/lib/task/artifact-lifecycle.js +61 -63
  71. package/dist/lib/task/artifact-name.js +0 -6
  72. package/dist/lib/task/artifact-operations.js +3 -3
  73. package/dist/lib/task/capabilities.js +4 -5
  74. package/dist/lib/task/commands/log.js +0 -6
  75. package/dist/lib/task/commands/status.js +17 -60
  76. package/dist/lib/task/commit-operation.js +28 -39
  77. package/dist/lib/task/completion-facts.js +56 -43
  78. package/dist/lib/task/control-authority.js +23 -256
  79. package/dist/lib/task/control-recovery.js +3 -5
  80. package/dist/lib/task/create.js +2 -4
  81. package/dist/lib/task/decision-intents.js +8 -9
  82. package/dist/lib/task/delivery-target.js +1 -40
  83. package/dist/lib/task/events.js +84 -107
  84. package/dist/lib/task/finalization.js +44 -8
  85. package/dist/lib/task/ledger-intents.js +1 -1
  86. package/dist/lib/task/lifecycle-execution.js +38 -33
  87. package/dist/lib/task/lifecycle.js +49 -41
  88. package/dist/lib/task/local-artifact-finalization.js +1 -4
  89. package/dist/lib/task/manual-validation-evidence.js +1 -37
  90. package/dist/lib/task/platform-operation-recovery.js +67 -24
  91. package/dist/lib/task/pr-delivery-fact.js +2 -5
  92. package/dist/lib/task/qualification-confirmation.js +5 -7
  93. package/dist/lib/task/resolve-ref.js +1 -25
  94. package/dist/lib/task/review-command.js +2 -2
  95. package/dist/lib/task/review-finalization.js +1 -21
  96. package/dist/lib/task/review-fingerprint.js +0 -4
  97. package/dist/lib/task/secure-fs.js +0 -56
  98. package/dist/lib/task/short-id.js +1 -39
  99. package/dist/lib/task/skill-scope.js +0 -1
  100. package/dist/lib/task/verification-engine.js +58 -282
  101. package/dist/lib/task/verification.js +6 -3
  102. package/dist/lib/task/write.js +11 -1
  103. package/lib/agent-clients/adapter.ts +0 -76
  104. package/lib/agent-clients/adapters/antigravity-cli.ts +0 -5
  105. package/lib/agent-clients/adapters/claude-code-credentials.ts +0 -19
  106. package/lib/agent-clients/adapters/claude-code.ts +0 -9
  107. package/lib/agent-clients/adapters/codex.ts +0 -56
  108. package/lib/agent-clients/adapters/opencode.ts +0 -5
  109. package/lib/agent-clients/adapters/traecli.ts +0 -5
  110. package/lib/agent-clients/config.ts +20 -61
  111. package/lib/agent-clients/registry.ts +1 -34
  112. package/lib/agent-clients/schema.ts +0 -18
  113. package/lib/agent-clients/tokens.ts +1 -2
  114. package/lib/agent-clients/types.ts +0 -15
  115. package/lib/decide.ts +1 -0
  116. package/lib/git/worktree-identity.ts +0 -10
  117. package/lib/internal/agent-client.ts +2 -70
  118. package/lib/internal/cli-route-inventory.ts +1 -4
  119. package/lib/internal/manual-validation.ts +16 -9
  120. package/lib/internal/task-create.ts +0 -1
  121. package/lib/internal/task-event.ts +1 -5
  122. package/lib/internal/task-finalization.ts +0 -1
  123. package/lib/internal/task-lifecycle.ts +3 -5
  124. package/lib/internal/task-operation-registry.ts +3 -19
  125. package/lib/internal/task-review.ts +4 -4
  126. package/lib/platform/comment-safety.ts +0 -10
  127. package/lib/platform/github-provider.ts +0 -2
  128. package/lib/platform/in-label-sync.ts +0 -16
  129. package/lib/platform/issue-comments.ts +0 -21
  130. package/lib/platform/issues.ts +0 -2
  131. package/lib/platform/operation-coordinator.ts +4 -2
  132. package/lib/platform/pr-change-report.ts +0 -5
  133. package/lib/platform/pr-checks.ts +1 -10
  134. package/lib/platform/pr-review.ts +1 -1
  135. package/lib/platform/provider-bridge.ts +0 -1
  136. package/lib/platform/provider-loader.ts +1 -5
  137. package/lib/platform/provider-validation.ts +1 -49
  138. package/lib/platform/pull-requests.ts +64 -99
  139. package/lib/platform/releases.ts +1 -40
  140. package/lib/platform/verification-required.ts +0 -2
  141. package/lib/platform/verification-sync.ts +0 -94
  142. package/lib/process-data/normalize.ts +1 -186
  143. package/lib/process-data/privacy.ts +2 -19
  144. package/lib/process-data/sources.ts +3 -283
  145. package/lib/render.ts +0 -15
  146. package/lib/run/index.ts +13 -7
  147. package/lib/run/skills.ts +0 -4
  148. package/lib/sandbox/commands/create.ts +37 -74
  149. package/lib/sandbox/commands/list-running.ts +0 -19
  150. package/lib/sandbox/commands/start.ts +7 -10
  151. package/lib/sandbox/constants.ts +0 -8
  152. package/lib/sandbox/control/client.ts +0 -1
  153. package/lib/sandbox/control/container-identity.ts +1 -16
  154. package/lib/sandbox/control/executor.ts +1 -5
  155. package/lib/sandbox/control/identity-sentinel.ts +0 -8
  156. package/lib/sandbox/control/lifecycle.ts +18 -51
  157. package/lib/sandbox/control/native-file-lock.ts +0 -8
  158. package/lib/sandbox/control/protocol.ts +0 -2
  159. package/lib/sandbox/control/server.ts +13 -39
  160. package/lib/sandbox/control/state.ts +1 -10
  161. package/lib/sandbox/dockerfile.ts +0 -11
  162. package/lib/sandbox/engine.ts +0 -17
  163. package/lib/sandbox/engines/docker-exact-discovery.ts +1 -5
  164. package/lib/sandbox/engines/wsl2-paths.ts +0 -4
  165. package/lib/sandbox/recovery.ts +24 -26
  166. package/lib/sandbox/removal.ts +11 -696
  167. package/lib/sandbox/shell.ts +1 -1
  168. package/lib/sandbox/task-resolver.ts +0 -48
  169. package/lib/sandbox/tools.ts +1 -5
  170. package/lib/sandbox/workspace-view.ts +2 -4
  171. package/lib/server/display.ts +0 -14
  172. package/lib/server/process-control.ts +1 -1
  173. package/lib/task/activity-intent.ts +36 -44
  174. package/lib/task/activity-log.ts +9 -22
  175. package/lib/task/artifact-command.ts +1 -1
  176. package/lib/task/artifact-lifecycle.ts +58 -67
  177. package/lib/task/artifact-name.ts +0 -7
  178. package/lib/task/artifact-operations.ts +3 -3
  179. package/lib/task/capabilities.ts +5 -6
  180. package/lib/task/commands/log.ts +0 -7
  181. package/lib/task/commands/status.ts +14 -79
  182. package/lib/task/commit-operation.ts +29 -51
  183. package/lib/task/completion-facts.ts +45 -42
  184. package/lib/task/control-authority.ts +27 -317
  185. package/lib/task/control-recovery.ts +2 -5
  186. package/lib/task/create.ts +2 -5
  187. package/lib/task/decision-intents.ts +5 -5
  188. package/lib/task/delivery-target.ts +0 -40
  189. package/lib/task/events.ts +89 -123
  190. package/lib/task/finalization.ts +41 -9
  191. package/lib/task/ledger-intents.ts +1 -1
  192. package/lib/task/lifecycle-execution.ts +37 -89
  193. package/lib/task/lifecycle.ts +48 -44
  194. package/lib/task/local-artifact-finalization.ts +0 -7
  195. package/lib/task/manual-validation-evidence.ts +1 -47
  196. package/lib/task/platform-operation-recovery.ts +50 -26
  197. package/lib/task/pr-delivery-fact.ts +2 -11
  198. package/lib/task/qualification-confirmation.ts +6 -6
  199. package/lib/task/resolve-ref.ts +0 -23
  200. package/lib/task/review-command.ts +2 -2
  201. package/lib/task/review-finalization.ts +1 -27
  202. package/lib/task/review-fingerprint.ts +0 -8
  203. package/lib/task/secure-fs.ts +0 -42
  204. package/lib/task/short-id.ts +0 -43
  205. package/lib/task/skill-scope.ts +0 -1
  206. package/lib/task/verification-engine.ts +56 -287
  207. package/lib/task/verification.ts +5 -5
  208. package/lib/task/write.ts +12 -1
  209. package/package.json +2 -2
  210. package/templates/.agents/README.en.md +1 -3
  211. package/templates/.agents/README.zh-CN.md +0 -2
  212. package/templates/.agents/rules/README.en.md +0 -1
  213. package/templates/.agents/rules/README.zh-CN.md +0 -1
  214. package/templates/.agents/rules/commit-and-pr.en.md +1 -1
  215. package/templates/.agents/rules/commit-and-pr.zh-CN.md +1 -1
  216. package/templates/.agents/rules/no-mid-flow-questions.en.md +0 -10
  217. package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +0 -10
  218. package/templates/.agents/rules/pr-sync.en.md +1 -1
  219. package/templates/.agents/rules/pr-sync.zh-CN.md +1 -1
  220. package/templates/.agents/rules/task-management.en.md +3 -3
  221. package/templates/.agents/rules/task-management.zh-CN.md +3 -3
  222. package/templates/.agents/skills/analyze-task/SKILL.en.md +3 -3
  223. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +3 -3
  224. package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
  225. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
  226. package/templates/.agents/skills/code-task/SKILL.en.md +2 -2
  227. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +4 -4
  228. package/templates/.agents/skills/commit/SKILL.en.md +2 -2
  229. package/templates/.agents/skills/commit/SKILL.zh-CN.md +2 -2
  230. package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +6 -6
  231. package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +6 -6
  232. package/templates/.agents/skills/plan-task/SKILL.en.md +2 -2
  233. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +2 -2
  234. package/templates/.agents/skills/review-analysis/SKILL.en.md +3 -3
  235. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +3 -3
  236. package/templates/.agents/skills/review-code/SKILL.en.md +5 -5
  237. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -5
  238. package/templates/.agents/skills/review-plan/SKILL.en.md +3 -3
  239. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +3 -3
  240. package/templates/.agents/skills/review-pr/SKILL.en.md +4 -4
  241. package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +4 -4
  242. package/templates/.agents/skills/run-manual-validation/SKILL.en.md +1 -1
  243. package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +1 -1
  244. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +3 -75
  245. package/templates/.agents/templates/task.en.md +1 -0
  246. package/templates/.agents/templates/task.zh-CN.md +1 -0
  247. package/templates/.claude/settings.json +0 -24
  248. package/templates/.codex/hooks.json +0 -50
  249. package/dist/lib/agent-clients/adapters/codex-lifecycle/app-server.js +0 -582
  250. package/dist/lib/agent-clients/adapters/codex-lifecycle/binding.js +0 -114
  251. package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +0 -237
  252. package/dist/lib/agent-clients/adapters/codex-lifecycle/cli.js +0 -443
  253. package/dist/lib/agent-clients/adapters/codex-lifecycle/evidence.js +0 -236
  254. package/dist/lib/agent-clients/adapters/codex-lifecycle/recovery.js +0 -292
  255. package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +0 -267
  256. package/dist/lib/agent-clients/adapters/codex-orchestration.js +0 -466
  257. package/dist/lib/internal/task-orchestration.js +0 -71
  258. package/dist/lib/platform/verification.js +0 -6
  259. package/dist/lib/run/prompt.js +0 -2
  260. package/dist/lib/sandbox/engines/authority.js +0 -289
  261. package/dist/lib/task/delegation-receipts.js +0 -410
  262. package/dist/lib/task/orchestration.js +0 -1233
  263. package/dist/lib/task/verification-checks.js +0 -9
  264. package/dist/lib/task/workspace-snapshot.js +0 -121
  265. package/dist/lifecycle-build-manifest.json +0 -6
  266. package/lib/agent-clients/adapters/codex-lifecycle/app-server.ts +0 -688
  267. package/lib/agent-clients/adapters/codex-lifecycle/binding.ts +0 -147
  268. package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +0 -349
  269. package/lib/agent-clients/adapters/codex-lifecycle/cli.ts +0 -506
  270. package/lib/agent-clients/adapters/codex-lifecycle/evidence.ts +0 -385
  271. package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +0 -41
  272. package/lib/agent-clients/adapters/codex-lifecycle/recovery.ts +0 -418
  273. package/lib/agent-clients/adapters/codex-lifecycle/store.ts +0 -354
  274. package/lib/agent-clients/adapters/codex-orchestration.ts +0 -630
  275. package/lib/internal/task-orchestration.ts +0 -74
  276. package/lib/platform/verification.ts +0 -11
  277. package/lib/run/prompt.ts +0 -1
  278. package/lib/sandbox/engines/authority.ts +0 -365
  279. package/lib/task/delegation-receipts.ts +0 -547
  280. package/lib/task/orchestration.ts +0 -1651
  281. package/lib/task/verification-checks.ts +0 -10
  282. package/lib/task/workspace-snapshot.ts +0 -144
  283. package/templates/.agents/hooks/lifecycle-delegation.js +0 -140
  284. package/templates/.agents/rules/lifecycle-orchestration.en.md +0 -44
  285. package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +0 -44
  286. package/templates/.agents/skills/run-task/SKILL.en.md +0 -29
  287. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +0 -29
  288. package/templates/.agents/skills/run-task/config/verify.en.json +0 -10
  289. package/templates/.agents/skills/run-task/config/verify.zh-CN.json +0 -10
  290. package/templates/.agents/skills/run-task/reference/host-validation.en.md +0 -24
  291. package/templates/.agents/skills/run-task/reference/host-validation.zh-CN.md +0 -24
  292. package/templates/.claude/agents/agent-infra-lifecycle-executor.en.md +0 -6
  293. package/templates/.claude/agents/agent-infra-lifecycle-executor.zh-CN.md +0 -6
  294. package/templates/.claude/agents/agent-infra-lifecycle-reviewer.en.md +0 -6
  295. package/templates/.claude/agents/agent-infra-lifecycle-reviewer.zh-CN.md +0 -6
  296. package/templates/.claude/commands/run-task.en.md +0 -8
  297. package/templates/.claude/commands/run-task.zh-CN.md +0 -8
  298. package/templates/.codex/agents/agent-infra-lifecycle-executor.en.toml +0 -3
  299. package/templates/.codex/agents/agent-infra-lifecycle-executor.zh-CN.toml +0 -3
  300. package/templates/.codex/agents/agent-infra-lifecycle-reviewer.en.toml +0 -3
  301. package/templates/.codex/agents/agent-infra-lifecycle-reviewer.zh-CN.toml +0 -3
  302. package/templates/.opencode/commands/run-task.en.md +0 -11
  303. package/templates/.opencode/commands/run-task.zh-CN.md +0 -11
@@ -9,7 +9,7 @@ description: >
9
9
  # 代码审查
10
10
  > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
11
11
 
12
- 若入口业务操作数包含 `--orchestrated`,绑定 `{execution-flag}` = `--orchestrated` 并原样转发给 summary finalizer 与 completed 事件;否则绑定为空。不得从 `orchestration.json`、环境变量或历史产物推断该标记。生命周期事件还必须携带显式触发信息:编排调用使用 `{trigger-initiator}=orchestrator`,否则使用 `model`;`{request-id}` 是本任务与本轮产物的稳定单行标识,普通调用的 `{reason-code}` 使用 `user-request` 或 `review-finding`;仅用户明确要求补充审查时,使用 `--initiator human --reason-code manual-review-supplement`。started 与 completed 使用同一组值。
12
+ 生命周期事件必须携带显式触发信息:普通调用使用 `model`;仅用户明确要求补充审查时,使用 `--initiator human --reason-code manual-review-supplement`。`{request-id}` 是本任务与本轮产物的稳定单行标识,`{reason-code}` 普通审查使用 `user-request` 或 `review-finding`;started 与 completed 使用同一组值。
13
13
 
14
14
  审查最新代码轮次,并产出 `review-code.md` 或 `review-code-r{N}.md`。
15
15
 
@@ -112,9 +112,9 @@ agent-infra-internal task-artifact {task-id} init --family review-code --artifac
112
112
 
113
113
  ### 6. 更新任务状态
114
114
 
115
- - 报告完成后,先调用 `agent-infra-internal task-review {task-id} preflight --stage code --artifact {review-artifact} {execution-flag}`,不得先写入账本。失败后直接修正正式产物并重跑。
115
+ - 报告完成后,先调用 `agent-infra-internal task-review {task-id} preflight --stage code --artifact {review-artifact}`,不得先写入账本。失败后直接修正正式产物并重跑。
116
116
  - 只有 preflight 通过后,新 finding 才逐条调用 `agent-infra-internal task-ledger {task-id} finding-upsert --stage code --review-artifact {review-artifact} --ordinal {n} --severity {blocker|major|minor} --evidence {review-artifact}#{anchor}`;复核上一轮响应时调用 `finding-review --id {ledger-id} --status {confirmed|closed|open|needs-human-decision} --evidence {相称证据}`。升级为 `needs-human-decision` 时,按详情块中的判断追加 `--needs-implementation true|false`。不得扫描编号或手写账本行
117
- - 全部账本写入完成后调用 `agent-infra-internal task-review {task-id} finalize-summary --stage code --artifact {review-artifact} {execution-flag}`;不能把失败类型或 `changed=false` 当作自动授权
117
+ - 全部账本写入完成后调用 `agent-infra-internal task-review {task-id} finalize-summary --stage code --artifact {review-artifact}`;不能把失败类型或 `changed=false` 当作自动授权
118
118
 
119
119
  从该次返回值绑定并复用以下结构化映射:
120
120
 
@@ -124,10 +124,10 @@ agent-infra-internal task-artifact {task-id} init --family review-code --artifac
124
124
  {unresolved-minor} = stageStatus.unresolvedFindingCounts.minor
125
125
  ```
126
126
 
127
- 该 intent 原子最终化报告摘要并返回同一次账本快照;不得再调用 `stage-status`、手工替换占位符或扫描问题清单。失败后,模型只能在共享规则的机械安全门通过时修改同一个受控 artifact,并完整重跑相同 intent;每次失败都重新判断是否收敛。最终一次完整成功返回决定同一快照的 verdict 和计数:`stageStatus.canAdvance=true` 且结论为 Approved 时允许跨阶段推进;`stageStatus.canAdvance=false` 时仍须执行 `agent-infra-internal task-event {task-id} review-code.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {review-artifact} --verdict {approved|changes-requested|rejected} --blockers {unresolved-blockers} --major {unresolved-major} --minor {unresolved-minor} --manual-validation {n} {execution-flag}`,使用 `changes-requested` 并路由到同阶段修订/复审(报告明确拒绝时使用 `rejected`)。失败、模型停止、无进展或紧急熔断时,不发布完成事件或跨阶段命令,但必须按 `reference/output-templates.md` 的 `repair-stop` 场景展示已有 summary/findings、artifact、实际修复次数、最后诊断和停止原因
127
+ 该 intent 原子最终化报告摘要并返回同一次账本快照;不得再调用 `stage-status`、手工替换占位符或扫描问题清单。失败后,模型只能在共享规则的机械安全门通过时修改同一个受控 artifact,并完整重跑相同 intent;每次失败都重新判断是否收敛。最终一次完整成功返回决定同一快照的 verdict 和计数:`stageStatus.canAdvance=true` 且结论为 Approved 时允许跨阶段推进;`stageStatus.canAdvance=false` 时仍须执行 `agent-infra-internal task-event {task-id} review-code.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {review-artifact} --verdict {approved|changes-requested|rejected} --blockers {unresolved-blockers} --major {unresolved-major} --minor {unresolved-minor} --manual-validation {n}`,使用 `changes-requested` 并路由到同阶段修订/复审(报告明确拒绝时使用 `rejected`)。失败、模型停止、无进展或紧急熔断时,不发布完成事件或跨阶段命令,但必须按 `reference/output-templates.md` 的 `repair-stop` 场景展示已有 summary/findings、artifact、实际修复次数、最后诊断和停止原因
128
128
  - 仅当 `canAdvance=true`、本轮结论为 Approved 且 `T == R^{tree}` 时写入 `last_reviewed_commit: {R}`;Approved 快照包含未提交差异时清除旧值。否则保留既有值,不得推进或清空
129
129
  - Approved 出口按 `reference/output-templates.md` 选择唯一场景,并使用对应的 `agent-client next-steps` helper 生成下一步命令。
130
- - 完成 `last_reviewed_commit` 处理后执行 `agent-infra-internal task-event {task-id} review-code.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {review-artifact} --verdict {approved|changes-requested|rejected} --blockers {unresolved-blockers} --major {unresolved-major} --minor {unresolved-minor} --manual-validation {n} {execution-flag}`
130
+ - 完成 `last_reviewed_commit` 处理后执行 `agent-infra-internal task-event {task-id} review-code.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {review-artifact} --verdict {approved|changes-requested|rejected} --blockers {unresolved-blockers} --major {unresolved-major} --minor {unresolved-minor} --manual-validation {n}`
131
131
 
132
132
  完成日志必须始终写入 `Manual-validation: {n}` 字段,0 也保留。
133
133
  `manual-validation` 是 `ai task log` 中 review 行「人工校验点」(EN `Manual-validation`)计数的数据源;不要新增并行人工验证字段。
@@ -9,7 +9,7 @@ description: >
9
9
  # Technical Plan Review
10
10
  > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
11
11
 
12
- If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--orchestrated` and forward it unchanged to both the summary finalizer and completed event; otherwise bind it to an empty value. Never infer it from `orchestration.json`, environment variables, or prior artifacts. Lifecycle events also require explicit trigger data: use `{trigger-initiator}=orchestrator` for orchestration and `model` otherwise; `{request-id}` is a stable single-line identifier for this task and artifact round, and `{reason-code}` is `user-request` or `review-finding`. Reuse the same values for started and completed.
12
+ Lifecycle events require explicit trigger data: ordinary skill invocation uses `model`; use `human` only when the user explicitly requests it. `{request-id}` is a stable single-line identifier for this task and artifact round, and `{reason-code}` use `user-request` or `review-finding`. Reuse the same values for started and completed.
13
13
 
14
14
  Review the latest plan artifact and produce `review-plan.md` or `review-plan-r{N}.md`.
15
15
 
@@ -87,7 +87,7 @@ Create `<task-workspace>/active/{task-id}/{review-artifact}`.
87
87
 
88
88
  ### 6. Update Task Status
89
89
 
90
- After the report, call `agent-infra-internal task-review {task-id} preflight --stage plan --artifact {review-artifact} {execution-flag}` before any ledger write. On failure, correct the formal artifact directly and rerun it. Only after preflight passes, submit each new finding with `agent-infra-internal task-ledger {task-id} finding-upsert --stage plan --review-artifact {review-artifact} --ordinal {n} --severity {blocker|major|minor} --evidence {review-artifact}#{anchor}` or prior-response dispositions with `finding-review --id {ledger-id} --status {confirmed|closed|open|needs-human-decision} --evidence {evidence}`. Do not scan ids or edit ledger rows. After all ledger writes, call `agent-infra-internal task-review {task-id} finalize-summary --stage plan --artifact {review-artifact} {execution-flag}`; never treat an error type or `changed=false` as automatic authorization.
90
+ After the report, call `agent-infra-internal task-review {task-id} preflight --stage plan --artifact {review-artifact}` before any ledger write. On failure, correct the formal artifact directly and rerun it. Only after preflight passes, submit each new finding with `agent-infra-internal task-ledger {task-id} finding-upsert --stage plan --review-artifact {review-artifact} --ordinal {n} --severity {blocker|major|minor} --evidence {review-artifact}#{anchor}` or prior-response dispositions with `finding-review --id {ledger-id} --status {confirmed|closed|open|needs-human-decision} --evidence {evidence}`. Do not scan ids or edit ledger rows. After all ledger writes, call `agent-infra-internal task-review {task-id} finalize-summary --stage plan --artifact {review-artifact}`; never treat an error type or `changed=false` as automatic authorization.
91
91
 
92
92
  Bind and reuse this structured mapping from that one response:
93
93
 
@@ -97,7 +97,7 @@ Bind and reuse this structured mapping from that one response:
97
97
  {unresolved-minor} = stageStatus.unresolvedFindingCounts.minor
98
98
  ```
99
99
 
100
- The intent atomically finalizes the report summary and returns the same ledger snapshot. Do not call `stage-status`, replace placeholders manually, or rescan the finding list. After a failure, the model may edit the same controlled artifact and rerun the same intent only when the shared rule's mechanical gates pass; reassess convergence after every failure. The final complete result determines the verdict and counts from that same snapshot: `stageStatus.canAdvance=true` with an Approved conclusion permits cross-stage advancement; `stageStatus.canAdvance=false` still requires `agent-infra-internal task-event {task-id} review-plan.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {review-artifact} --verdict {approved|changes-requested|rejected} --blockers {unresolved-blockers} --major {unresolved-major} --minor {unresolved-minor} --manual-validation {n} {execution-flag}`, using `changes-requested` and routing to same-stage revision/review (use `rejected` when the report explicitly rejects). On failure, model stop, lack of progress, or the emergency cap, do not publish a completion event or cross-stage command; use the `repair-stop` scenario in `reference/output-templates.md` to show existing summary/findings, the artifact, actual repair attempts, the last diagnostic, and the stop reason.
100
+ The intent atomically finalizes the report summary and returns the same ledger snapshot. Do not call `stage-status`, replace placeholders manually, or rescan the finding list. After a failure, the model may edit the same controlled artifact and rerun the same intent only when the shared rule's mechanical gates pass; reassess convergence after every failure. The final complete result determines the verdict and counts from that same snapshot: `stageStatus.canAdvance=true` with an Approved conclusion permits cross-stage advancement; `stageStatus.canAdvance=false` still requires `agent-infra-internal task-event {task-id} review-plan.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {review-artifact} --verdict {approved|changes-requested|rejected} --blockers {unresolved-blockers} --major {unresolved-major} --minor {unresolved-minor} --manual-validation {n}`, using `changes-requested` and routing to same-stage revision/review (use `rejected` when the report explicitly rejects). On failure, model stop, lack of progress, or the emergency cap, do not publish a completion event or cross-stage command; use the `repair-stop` scenario in `reference/output-templates.md` to show existing summary/findings, the artifact, actual repair attempts, the last diagnostic, and the stop reason.
101
101
 
102
102
  `manual-validation` is the data source for the `Manual-validation` count folded into review rows in `ai task log`; do not add a parallel manual-verification field.
103
103
 
@@ -9,7 +9,7 @@ description: >
9
9
  # 技术方案审查
10
10
  > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
11
11
 
12
- 若入口业务操作数包含 `--orchestrated`,绑定 `{execution-flag}` = `--orchestrated` 并原样转发给 summary finalizer 与 completed 事件;否则绑定为空。不得从 `orchestration.json`、环境变量或历史产物推断该标记。生命周期事件还必须携带显式触发信息:编排调用使用 `{trigger-initiator}=orchestrator`,否则使用 `model`;`{request-id}` 是本任务与本轮产物的稳定单行标识,`{reason-code}` 使用 `user-request` 或 `review-finding`;started 与 completed 使用同一组值。
12
+ 生命周期事件必须携带显式触发信息:普通技能调用使用 `model`;仅用户明确要求时使用 `human`。`{request-id}` 是本任务与本轮产物的稳定单行标识,`{reason-code}` 使用 `user-request` 或 `review-finding`;started 与 completed 使用同一组值。
13
13
 
14
14
  审查最新技术方案产物,并产出 `review-plan.md` 或 `review-plan-r{N}.md`。
15
15
 
@@ -90,7 +90,7 @@ agent-infra-internal task-artifact {task-id} init --family review-plan --artifac
90
90
 
91
91
  ### 6. 更新任务状态
92
92
 
93
- 报告完成后,先调用 `agent-infra-internal task-review {task-id} preflight --stage plan --artifact {review-artifact} {execution-flag}`,不得先写入账本。失败后直接修正正式产物并重跑;只有 preflight 通过后,才逐条调用 `agent-infra-internal task-ledger {task-id} finding-upsert --stage plan --review-artifact {review-artifact} --ordinal {n} --severity {blocker|major|minor} --evidence {review-artifact}#{anchor}`,或复核上一轮响应时调用 `finding-review --id {ledger-id} --status {confirmed|closed|open|needs-human-decision} --evidence {相称证据}`。不得扫描编号或手写账本行。全部账本写入完成后调用 `agent-infra-internal task-review {task-id} finalize-summary --stage plan --artifact {review-artifact} {execution-flag}`;不能把失败类型或 `changed=false` 当作自动授权。
93
+ 报告完成后,先调用 `agent-infra-internal task-review {task-id} preflight --stage plan --artifact {review-artifact}`,不得先写入账本。失败后直接修正正式产物并重跑;只有 preflight 通过后,才逐条调用 `agent-infra-internal task-ledger {task-id} finding-upsert --stage plan --review-artifact {review-artifact} --ordinal {n} --severity {blocker|major|minor} --evidence {review-artifact}#{anchor}`,或复核上一轮响应时调用 `finding-review --id {ledger-id} --status {confirmed|closed|open|needs-human-decision} --evidence {相称证据}`。不得扫描编号或手写账本行。全部账本写入完成后调用 `agent-infra-internal task-review {task-id} finalize-summary --stage plan --artifact {review-artifact}`;不能把失败类型或 `changed=false` 当作自动授权。
94
94
 
95
95
  从该次返回值绑定并复用以下结构化映射:
96
96
 
@@ -100,7 +100,7 @@ agent-infra-internal task-artifact {task-id} init --family review-plan --artifac
100
100
  {unresolved-minor} = stageStatus.unresolvedFindingCounts.minor
101
101
  ```
102
102
 
103
- 该 intent 原子最终化报告摘要并返回同一次账本快照;不得再调用 `stage-status`、手工替换占位符或扫描问题清单。失败后,模型只能在共享规则的机械安全门通过时修改同一个受控 artifact,并完整重跑相同 intent;每次失败都重新判断是否收敛。最终一次完整成功返回决定同一快照的 verdict 和计数:`stageStatus.canAdvance=true` 且结论为 Approved 时允许跨阶段推进;`stageStatus.canAdvance=false` 时仍须执行 `agent-infra-internal task-event {task-id} review-plan.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {review-artifact} --verdict {approved|changes-requested|rejected} --blockers {unresolved-blockers} --major {unresolved-major} --minor {unresolved-minor} --manual-validation {n} {execution-flag}`,使用 `changes-requested` 并路由到同阶段修订/复审(报告明确拒绝时使用 `rejected`)。失败、模型停止、无进展或紧急熔断时,不发布完成事件或跨阶段命令,但必须按 `reference/output-templates.md` 的 `repair-stop` 场景展示已有 summary/findings、artifact、实际修复次数、最后诊断和停止原因。
103
+ 该 intent 原子最终化报告摘要并返回同一次账本快照;不得再调用 `stage-status`、手工替换占位符或扫描问题清单。失败后,模型只能在共享规则的机械安全门通过时修改同一个受控 artifact,并完整重跑相同 intent;每次失败都重新判断是否收敛。最终一次完整成功返回决定同一快照的 verdict 和计数:`stageStatus.canAdvance=true` 且结论为 Approved 时允许跨阶段推进;`stageStatus.canAdvance=false` 时仍须执行 `agent-infra-internal task-event {task-id} review-plan.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {review-artifact} --verdict {approved|changes-requested|rejected} --blockers {unresolved-blockers} --major {unresolved-major} --minor {unresolved-minor} --manual-validation {n}`,使用 `changes-requested` 并路由到同阶段修订/复审(报告明确拒绝时使用 `rejected`)。失败、模型停止、无进展或紧急熔断时,不发布完成事件或跨阶段命令,但必须按 `reference/output-templates.md` 的 `repair-stop` 场景展示已有 summary/findings、artifact、实际修复次数、最后诊断和停止原因。
104
104
 
105
105
  `manual-validation` 是 `ai task log` 中 review 行「人工校验点」(EN `Manual-validation`)计数的数据源;不要新增并行人工验证字段。
106
106
 
@@ -135,7 +135,7 @@ After closure, re-run step 1 for the next canonical round; never start the new r
135
135
 
136
136
  ### 6. Write back the publication result and task state
137
137
 
138
- - **Task-anchored path**: write the actual publication status in the `pr-review-rN.md` "Publication Result" section. Record the Review ID/URL for `applied` / `no-op`; for a failed write with a durable journal entry, record `blocked` / `failed`, the error code, and recovery action. Then close the local Activity Log with the verdict/counts frozen in step 3:
138
+ - **Task-anchored path**: write the actual publication status in the `pr-review-rN.md` "Publication Result" section. Record the Review ID/URL for `applied` / `no-op`; for a failed write with a durable journal entry, record `blocked` / `failed`, the error code, and recovery action. Then close the local review state with the verdict/counts frozen in step 3:
139
139
 
140
140
  ```bash
141
141
  agent-infra-internal task-activity {task-id} pr-review-complete --agent {agent} \
@@ -143,13 +143,13 @@ After closure, re-run step 1 for the next canonical round; never start the new r
143
143
  --blockers {blockers} --major {major} --minor {minor}
144
144
  ```
145
145
 
146
- `task-activity` generates `Verdict: <result>, blockers: N, major: N, minor: N → {pr-review-artifact}` from the typed payload and atomically writes the Activity Log, `## Review Feedback` link, and version stamp through `writeTask`. It never changes `current_step` or puts receipt/head/Review URL into the NOTE.
146
+ `task-activity` generates `Verdict: <result>, blockers: N, major: N, minor: N → {pr-review-artifact}` from the typed payload and atomically writes the structured review state, `## Review Feedback` link, and version stamp through `writeTask`. It appends the log when safe and otherwise returns a diagnostic. It never changes `current_step` or puts receipt/head/Review URL into the NOTE.
147
147
 
148
148
  - **One-shot path (no task)**: record the actual publication status in the `pr-review-rN.md` "Publication Result" section. Record the Review ID/URL on success, or the error and lack of automatic recovery on failure. Do not call `task-activity`.
149
149
 
150
150
  ### 7. Re-sync after write-back (task-anchored path)
151
151
 
152
- Step 6 rewrote the local `pr-review-rN.md` "Publication Result" section and task.md (Activity Log), while step 4 synced the older snapshot. Attempt the syncs again in order; record failures as warnings for `complete-task` to restore before archiving:
152
+ Step 6 rewrote the local `pr-review-rN.md` "Publication Result" section and task.md (review state and available log), while step 4 synced the older snapshot. Attempt the syncs again in order; record failures as warnings for `complete-task` to restore before archiving:
153
153
 
154
154
  ```bash
155
155
  agent-infra-internal platform-comment sync {task-id} --kind task --agent {agent}
@@ -186,7 +186,7 @@ Pick the single exit branch per `reference/output-guidance.md` (local review com
186
186
  - [ ] Published the formal Review, durably recorded its pending publication, or accurately recorded a one-shot publication failure
187
187
  - [ ] Synced the Issue artifact/task comments or recorded their pending recovery on the task-anchored path
188
188
  - [ ] Ran the completion verification (`task-verify` or `verify-artifact`)
189
- - [ ] Updated task.md and appended the Activity Log entry (task-anchored path)
189
+ - [ ] Updated task.md review state and recorded log diagnostics when applicable
190
190
 
191
191
  ## Stop
192
192
 
@@ -135,7 +135,7 @@ agent-infra-internal task-activity {task-id} pr-review-terminate --agent {agent}
135
135
 
136
136
  ### 6. 回写发布结果与任务状态
137
137
 
138
- - **任务锚定路径**:把 publish 的实际状态写入 `pr-review-rN.md`「发布结果」段。`applied` / `no-op` 时记录 Review ID/URL;写入失败且已有任务账本记录时写 `blocked` / `failed`、错误码和恢复动作。随后以步骤 3 冻结的同一组 verdict/counts 闭合本地活动日志:
138
+ - **任务锚定路径**:把 publish 的实际状态写入 `pr-review-rN.md`「发布结果」段。`applied` / `no-op` 时记录 Review ID/URL;写入失败且已有任务账本记录时写 `blocked` / `failed`、错误码和恢复动作。随后以步骤 3 冻结的同一组 verdict/counts 闭合本地审查状态:
139
139
 
140
140
  ```bash
141
141
  agent-infra-internal task-activity {task-id} pr-review-complete --agent {agent} \
@@ -143,13 +143,13 @@ agent-infra-internal task-activity {task-id} pr-review-terminate --agent {agent}
143
143
  --blockers {blockers} --major {major} --minor {minor}
144
144
  ```
145
145
 
146
- `task-activity` 由 typed payload 生成 `Verdict: <结论>, blockers: N, major: N, minor: N → {pr-review-artifact}`,并经 `writeTask` 原子完成 Activity Log、`## 审查反馈` 链接与版本戳刷新;不改 `current_step`,也不把 receipt/head/Review URL 写入 NOTE。
146
+ `task-activity` 由 typed payload 生成 `Verdict: <结论>, blockers: N, major: N, minor: N → {pr-review-artifact}`,并经 `writeTask` 原子完成结构化审查状态、`## 审查反馈` 链接与版本戳刷新;日志可安全追加时一并写入,否则返回诊断;不改 `current_step`,也不把 receipt/head/Review URL 写入 NOTE。
147
147
 
148
148
  - **一次性路径(无任务)**:把实际发布状态写入 `pr-review-rN.md`「发布结果」段;成功时记录 Review ID/URL,失败时记录错误与不可自动恢复的限制。不调用 `task-activity`。
149
149
 
150
150
  ### 7. 发布后回写再同步(任务锚定路径)
151
151
 
152
- 步骤 6 已改写本地 `pr-review-rN.md`「发布结果」段与 task.md(活动日志),而步骤 4 同步的是旧快照。依次尝试再同步;失败记录 warning,由 `complete-task` 在归档前补齐:
152
+ 步骤 6 已改写本地 `pr-review-rN.md`「发布结果」段与 task.md(审查状态及可用日志),而步骤 4 同步的是旧快照。依次尝试再同步;失败记录 warning,由 `complete-task` 在归档前补齐:
153
153
 
154
154
  ```bash
155
155
  agent-infra-internal platform-comment sync {task-id} --kind task --agent {agent}
@@ -186,7 +186,7 @@ agent-infra-internal platform-comment sync {task-id} --kind artifact --artifact
186
186
  - [ ] 正式 Review 已发布、任务账本已记录待恢复操作,或一次性路径已如实记录发布失败
187
187
  - [ ] 任务锚定路径的 Issue artifact/task 评论已同步,或失败已记录待恢复
188
188
  - [ ] 已完成校验(`task-verify` 或 `verify-artifact`)
189
- - [ ] 已更新 task.md 并追加 Activity Log(任务锚定路径)
189
+ - [ ] 已更新 task.md 中的审查状态并记录日志诊断(如适用)
190
190
 
191
191
  ## 停止
192
192
 
@@ -8,7 +8,7 @@ description: >
8
8
 
9
9
  # Run Manual Validation
10
10
 
11
- Lifecycle events require explicit trigger data: use `{trigger-initiator}=orchestrator` for orchestration and `model` otherwise; `{request-id}` is a stable single-line identifier for this task and artifact round, and `{reason-code}` is `user-request` or `validation-rerun`. Reuse the same values for started and completed.
11
+ Lifecycle events require explicit trigger data: ordinary skill invocation uses `model`; use `human` only when the user explicitly requests it. `{request-id}` is a stable single-line identifier for this task and artifact round, and `{reason-code}` use `user-request` or `validation-rerun`. Reuse the same values for started and completed.
12
12
 
13
13
  ## Task Context Resolution
14
14
 
@@ -8,7 +8,7 @@ description: >
8
8
 
9
9
  # 运行人工校验
10
10
 
11
- 生命周期事件必须携带显式触发信息:编排调用使用 `{trigger-initiator}=orchestrator`,否则使用 `model`;`{request-id}` 是本任务与本轮产物的稳定单行标识,`{reason-code}` 使用 `user-request` 或 `validation-rerun`;started 与 completed 使用同一组值。
11
+ 生命周期事件必须携带显式触发信息:普通技能调用使用 `model`;仅用户明确要求时使用 `human`。`{request-id}` 是本任务与本轮产物的稳定单行标识,`{reason-code}` 使用 `user-request` 或 `validation-rerun`;started 与 completed 使用同一组值。
12
12
 
13
13
  ## 任务上下文解析
14
14
 
@@ -251,11 +251,10 @@ function normalizeAgentClientConfig(cfg) {
251
251
  }
252
252
  const keys = Object.keys(candidate);
253
253
  if (
254
- (keys.length !== 3 && keys.length !== 4)
254
+ keys.length !== 3
255
255
  || !own(candidate, 'id')
256
256
  || !own(candidate, 'enabled')
257
257
  || !own(candidate, 'installInSandbox')
258
- || (keys.length === 4 && !own(candidate, 'orchestration'))
259
258
  ) {
260
259
  return failure('INVALID_AGENT_CLIENTS', entryPath);
261
260
  }
@@ -266,52 +265,9 @@ function normalizeAgentClientConfig(cfg) {
266
265
  if (typeof candidate.enabled !== 'boolean' || typeof candidate.installInSandbox !== 'boolean') {
267
266
  return failure('INVALID_AGENT_CLIENTS', entryPath);
268
267
  }
269
- let orchestration;
270
- if (own(candidate, 'orchestration')) {
271
- const policy = candidate.orchestration;
272
- if (
273
- !policy
274
- || typeof policy !== 'object'
275
- || Array.isArray(policy)
276
- || Object.keys(policy).length !== 2
277
- || !own(policy, 'executor')
278
- || !own(policy, 'reviewer')
279
- ) {
280
- return failure('INVALID_AGENT_CLIENTS', `${entryPath}.orchestration`);
281
- }
282
- const parseExact = (value, path) => {
283
- if (typeof value !== 'string' || value.length === 0 || value.trim() !== value) {
284
- return failure('INVALID_AGENT_CLIENTS', path);
285
- }
286
- return value;
287
- };
288
- const parseRole = (role, rolePath) => {
289
- if (
290
- !role
291
- || typeof role !== 'object'
292
- || Array.isArray(role)
293
- || Object.keys(role).length !== 2
294
- || !own(role, 'model')
295
- || !own(role, 'reasoningEffort')
296
- ) {
297
- return failure('INVALID_AGENT_CLIENTS', rolePath);
298
- }
299
- const model = parseExact(role.model, `${rolePath}.model`);
300
- if (typeof model !== 'string') return model;
301
- const reasoningEffort = parseExact(role.reasoningEffort, `${rolePath}.reasoningEffort`);
302
- if (typeof reasoningEffort !== 'string') return reasoningEffort;
303
- return { model, reasoningEffort };
304
- };
305
- const executor = parseRole(policy.executor, `${entryPath}.orchestration.executor`);
306
- if (executor.errorCode) return executor;
307
- const reviewer = parseRole(policy.reviewer, `${entryPath}.orchestration.reviewer`);
308
- if (reviewer.errorCode) return reviewer;
309
- orchestration = { executor, reviewer };
310
- }
311
268
  entries.set(candidate.id, {
312
269
  enabled: candidate.enabled,
313
- installInSandbox: candidate.installInSandbox,
314
- ...(orchestration ? { orchestration } : {})
270
+ installInSandbox: candidate.installInSandbox
315
271
  });
316
272
  }
317
273
  if (AGENT_CLIENT_IDS.some((id) => !entries.has(id))) {
@@ -676,22 +632,6 @@ function mergeTemplateSources(baseRoot, sources, report) {
676
632
  };
677
633
  }
678
634
 
679
- function writeIfChanged(projectRoot, targetPath, content, reportBucket) {
680
- const fullPath = path.join(projectRoot, targetPath);
681
- const exists = fs.existsSync(fullPath);
682
-
683
- if (exists && fs.readFileSync(fullPath, 'utf8') === content) {
684
- reportBucket.unchanged.push(targetPath);
685
- return;
686
- }
687
-
688
- const dir = path.dirname(fullPath);
689
- if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
690
- fs.writeFileSync(fullPath, content, 'utf8');
691
-
692
- (exists ? reportBucket.updated : reportBucket.generated).push(targetPath);
693
- }
694
-
695
635
  function syncCustomSkillSources(projectRoot, sources, report, templateSkillNames) {
696
636
  const skillsDir = path.join(projectRoot, '.agents/skills');
697
637
  const syncedSkills = new Map();
@@ -1102,7 +1042,7 @@ function syncTemplates(projectRoot, templateRootOverride) {
1102
1042
  && !Array.isArray(cfg.files.managedBaselines)
1103
1043
  ? { ...cfg.files.managedBaselines }
1104
1044
  : {};
1105
- let baselinesChanged = false;
1045
+
1106
1046
 
1107
1047
  for (const target of Object.keys(managedBaselines)) {
1108
1048
  if (
@@ -1111,7 +1051,6 @@ function syncTemplates(projectRoot, templateRootOverride) {
1111
1051
  && !allClientManaged.some((entry) => assetMatches(entry, target))
1112
1052
  ) {
1113
1053
  delete managedBaselines[target];
1114
- baselinesChanged = true;
1115
1054
  }
1116
1055
  }
1117
1056
 
@@ -1206,7 +1145,6 @@ function syncTemplates(projectRoot, templateRootOverride) {
1206
1145
  if (!fs.existsSync(candidatePath)) {
1207
1146
  if (Object.prototype.hasOwnProperty.call(managedBaselines, candidate)) {
1208
1147
  delete managedBaselines[candidate];
1209
- baselinesChanged = true;
1210
1148
  }
1211
1149
  continue;
1212
1150
  }
@@ -1232,7 +1170,6 @@ function syncTemplates(projectRoot, templateRootOverride) {
1232
1170
  }
1233
1171
  if (Object.prototype.hasOwnProperty.call(managedBaselines, candidate)) {
1234
1172
  delete managedBaselines[candidate];
1235
- baselinesChanged = true;
1236
1173
  }
1237
1174
  }
1238
1175
  removeEmptyDirs(target);
@@ -1252,7 +1189,6 @@ function syncTemplates(projectRoot, templateRootOverride) {
1252
1189
  report.managed.removed.push(entry);
1253
1190
  if (Object.prototype.hasOwnProperty.call(managedBaselines, entry)) {
1254
1191
  delete managedBaselines[entry];
1255
- baselinesChanged = true;
1256
1192
  }
1257
1193
  } else {
1258
1194
  report.managed.protected.push({
@@ -1321,7 +1257,6 @@ function syncTemplates(projectRoot, templateRootOverride) {
1321
1257
 
1322
1258
  if (rawBaseline !== undefined && baseline === null) {
1323
1259
  delete managedBaselines[target];
1324
- baselinesChanged = true;
1325
1260
  }
1326
1261
  if (baseline === null && localHash !== null && localHash !== templateHash) {
1327
1262
  report.managed.conflicts.push({
@@ -1362,7 +1297,6 @@ function syncTemplates(projectRoot, templateRootOverride) {
1362
1297
  bucket.unchanged.push(target);
1363
1298
  if (managedBaselines[target] !== templateHash) {
1364
1299
  managedBaselines[target] = templateHash;
1365
- baselinesChanged = true;
1366
1300
  }
1367
1301
  return false;
1368
1302
  }
@@ -1371,7 +1305,6 @@ function syncTemplates(projectRoot, templateRootOverride) {
1371
1305
  if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
1372
1306
  fs.writeFileSync(dstFull, content);
1373
1307
  managedBaselines[target] = templateHash;
1374
- baselinesChanged = true;
1375
1308
  if (Object.prototype.hasOwnProperty.call(bucket, 'written')) {
1376
1309
  (exists ? bucket.written : bucket.created).push(target);
1377
1310
  } else {
@@ -1417,7 +1350,6 @@ function syncTemplates(projectRoot, templateRootOverride) {
1417
1350
  report.managed.removed.push(renderedTarget);
1418
1351
  if (Object.prototype.hasOwnProperty.call(managedBaselines, renderedTarget)) {
1419
1352
  delete managedBaselines[renderedTarget];
1420
- baselinesChanged = true;
1421
1353
  }
1422
1354
  continue;
1423
1355
  }
@@ -1479,7 +1411,6 @@ function syncTemplates(projectRoot, templateRootOverride) {
1479
1411
  if (localHash === null) {
1480
1412
  if (Object.prototype.hasOwnProperty.call(managedBaselines, target)) {
1481
1413
  delete managedBaselines[target];
1482
- baselinesChanged = true;
1483
1414
  }
1484
1415
  continue;
1485
1416
  }
@@ -1492,7 +1423,6 @@ function syncTemplates(projectRoot, templateRootOverride) {
1492
1423
  report.managed.removed.push(target);
1493
1424
  if (Object.prototype.hasOwnProperty.call(managedBaselines, target)) {
1494
1425
  delete managedBaselines[target];
1495
- baselinesChanged = true;
1496
1426
  }
1497
1427
  removeEmptyDirs(path.dirname(dstFull));
1498
1428
  continue;
@@ -1608,7 +1538,6 @@ function syncTemplates(projectRoot, templateRootOverride) {
1608
1538
  if (baseline !== null && localHash === baseline) {
1609
1539
  fs.unlinkSync(path.join(projectRoot, projFile));
1610
1540
  delete managedBaselines[projFile];
1611
- baselinesChanged = true;
1612
1541
  report.managed.removed.push(projFile);
1613
1542
  } else {
1614
1543
  report.managed.protected.push({
@@ -1715,7 +1644,6 @@ function syncTemplates(projectRoot, templateRootOverride) {
1715
1644
  if (Object.keys(managedBaselines).length > 0) {
1716
1645
  cfg.files.managedBaselines = managedBaselines;
1717
1646
  } else {
1718
- if (Object.prototype.hasOwnProperty.call(cfg.files, 'managedBaselines')) baselinesChanged = true;
1719
1647
  delete cfg.files.managedBaselines;
1720
1648
  }
1721
1649
  cfg.templateVersion = version;
@@ -13,6 +13,7 @@ start_date: # Optional Issue field for Feature: YYYY-MM-DD
13
13
  target_date: # Optional Issue field for Feature: YYYY-MM-DD
14
14
  current_step: requirement-analysis # requirement-analysis | requirement-analysis-review | technical-design | technical-design-review | code | code-review | completed
15
15
  assigned_to: # claude | codex | antigravity | opencode | human
16
+ lifecycle_execution: '{"version":1,"open":[],"prReview":{"open":null,"terminals":[]}}'
16
17
  pr_delivery_fact: '{"version":2,"state":"unbound","reason":"initial"}'
17
18
  delivery_remote: origin # Git remote used to deliver the task branch
18
19
  delivery_base_ref: main # Target branch for the task PR
@@ -13,6 +13,7 @@ start_date: # Feature 可选 Issue 字段:YYYY-MM-DD
13
13
  target_date: # Feature 可选 Issue 字段:YYYY-MM-DD
14
14
  current_step: requirement-analysis # requirement-analysis | requirement-analysis-review | technical-design | technical-design-review | code | code-review | completed
15
15
  assigned_to: # claude | codex | antigravity | opencode | human
16
+ lifecycle_execution: '{"version":1,"open":[],"prReview":{"open":null,"terminals":[]}}'
16
17
  pr_delivery_fact: '{"version":2,"state":"unbound","reason":"initial"}'
17
18
  delivery_remote: origin # 任务分支交付使用的 Git remote
18
19
  delivery_base_ref: main # 任务 PR 的目标分支
@@ -30,30 +30,6 @@
30
30
  ]
31
31
  }
32
32
  ],
33
- "SubagentStart": [
34
- {
35
- "matcher": "agent-infra-lifecycle-(executor|reviewer)",
36
- "hooks": [
37
- {
38
- "type": "command",
39
- "command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client claude-code",
40
- "timeout": 10
41
- }
42
- ]
43
- }
44
- ],
45
- "SubagentStop": [
46
- {
47
- "matcher": "agent-infra-lifecycle-(executor|reviewer)",
48
- "hooks": [
49
- {
50
- "type": "command",
51
- "command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client claude-code",
52
- "timeout": 10
53
- }
54
- ]
55
- }
56
- ],
57
33
  "StopFailure": [
58
34
  {
59
35
  "matcher": "",
@@ -11,56 +11,6 @@
11
11
  "statusMessage": "Checking template version before git commit"
12
12
  }
13
13
  ]
14
- },
15
- {
16
- "matcher": "^collaborationspawn_agent$",
17
- "hooks": [
18
- {
19
- "type": "command",
20
- "command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client codex --event pre-tool",
21
- "timeout": 30,
22
- "statusMessage": "Recording Codex lifecycle spawn evidence"
23
- }
24
- ]
25
- }
26
- ],
27
- "PostToolUse": [
28
- {
29
- "matcher": "",
30
- "hooks": [
31
- {
32
- "type": "command",
33
- "command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client codex --event post-tool",
34
- "timeout": 30,
35
- "statusMessage": "Recording Codex lifecycle tool completion"
36
- }
37
- ]
38
- }
39
- ],
40
- "SubagentStart": [
41
- {
42
- "matcher": "",
43
- "hooks": [
44
- {
45
- "type": "command",
46
- "command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client codex --event subagent-start",
47
- "timeout": 30,
48
- "statusMessage": "Recording Codex child identity"
49
- }
50
- ]
51
- }
52
- ],
53
- "SubagentStop": [
54
- {
55
- "matcher": "",
56
- "hooks": [
57
- {
58
- "type": "command",
59
- "command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client codex --event subagent-stop",
60
- "timeout": 30,
61
- "statusMessage": "Recording Codex child stop evidence"
62
- }
63
- ]
64
14
  }
65
15
  ]
66
16
  }