@buildr-ai/buildr 0.1.0-rc.26 → 0.1.0-rc.28

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.
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schemaVersion": "buildr.application-payload/v1",
3
3
  "packageName": "@buildr-ai/buildr",
4
- "buildrVersion": "0.1.0-rc.26",
4
+ "buildrVersion": "0.1.0-rc.28",
5
5
  "protocolIdentity": "buildr.web-protocol/v1",
6
- "sourceCommit": "46158e982bcd405b18eb60152462458a12855345",
6
+ "sourceCommit": "39fd793d506558fed2d9640ad88581d1942ff46c",
7
7
  "enginesNode": ">=24.15.0 <25",
8
8
  "productionDependencies": [
9
9
  {
@@ -54,13 +54,13 @@
54
54
  "path": "resources/product/package.json",
55
55
  "mode": 420,
56
56
  "size": 769,
57
- "sha256": "a2ae471618eefddf861ce20236e8fdd9f57d45468b3ddd38f6f676431289cd21"
57
+ "sha256": "079b8aa61fcdcabbc4d62454296e576417719bc820388155498200e9b603b7f8"
58
58
  },
59
59
  {
60
60
  "path": "resources/product/package/targets/runtime/skills/buildr/SKILL.md",
61
61
  "mode": 420,
62
- "size": 35042,
63
- "sha256": "3c07342e0c66082b89b52eceaf8293344d69d4d98d4468d918b615694e4b3044"
62
+ "size": 34286,
63
+ "sha256": "59eddba6aed3ef9a0b4c471405d713fecb705ebdbcd3420cd159ae72fca0d5c8"
64
64
  },
65
65
  {
66
66
  "path": "resources/product/resources/contracts/bootstrap.yml",
@@ -83,8 +83,8 @@
83
83
  {
84
84
  "path": "resources/product/resources/manifest.yml",
85
85
  "mode": 420,
86
- "size": 31921,
87
- "sha256": "53844be5521d3af5fde7f8db08cf155448637b5bbd197c132bf6a8b21af9ed1b"
86
+ "size": 31933,
87
+ "sha256": "c74a8c5e895f6865e2d7d4f88bfd3b340aa79c3507e82f6b35b3e7ab50d7a51d"
88
88
  },
89
89
  {
90
90
  "path": "resources/product/resources/workspace/AGENTS.md",
@@ -179,8 +179,8 @@
179
179
  {
180
180
  "path": "resources/product/resources/workspace/skills/buildr/current-knowledge-maintenance/SKILL.md",
181
181
  "mode": 420,
182
- "size": 7069,
183
- "sha256": "342e42d7119e5797079e7fa707708aeab9b38f76a137b12d51c44652c329e6f3"
182
+ "size": 7217,
183
+ "sha256": "9941bf1fdc4709467a45675949778ed43d891c15edd7dc04d70b1432d2c7bd72"
184
184
  },
185
185
  {
186
186
  "path": "resources/product/resources/workspace/skills/buildr/declaration-intake/SKILL.md",
@@ -221,8 +221,8 @@
221
221
  {
222
222
  "path": "resources/product/resources/workspace/skills/buildr/task-development/SKILL.md",
223
223
  "mode": 420,
224
- "size": 25853,
225
- "sha256": "bf8711033a3aebdf4b004a8242c46138839a1c895ba46c2a66504cccb60b9e25"
224
+ "size": 26112,
225
+ "sha256": "97e821504a413df10e47c75a39a9105d8e570a2b36e3b01505733c17ba1087b5"
226
226
  },
227
227
  {
228
228
  "path": "resources/product/resources/workspace/skills/buildr/task-environment/SKILL.md",
@@ -257,8 +257,8 @@
257
257
  {
258
258
  "path": "resources/product/resources/workspace/skills/buildr/task-finish/SKILL.md",
259
259
  "mode": 420,
260
- "size": 7569,
261
- "sha256": "2e741b6283a8dd35c49dfb127b6cfd63a54079fd9a10e47d5c7bc0e1f41e79c4"
260
+ "size": 6308,
261
+ "sha256": "567f74e7b7cfafdd6398dcd2dfcb8a3a12e8aacbd708b2b85715a6d8f0d7da0b"
262
262
  },
263
263
  {
264
264
  "path": "resources/product/resources/workspace/skills/buildr/task-manager/SKILL.md",
@@ -299,20 +299,20 @@
299
299
  {
300
300
  "path": "resources/product/resources/workspace/skills/buildr/task-triage/SKILL.md",
301
301
  "mode": 420,
302
- "size": 18883,
303
- "sha256": "1f18e9eec1f1a73ece16bfdbf2f00c7a334ac64caf311e7ec97ba8eb93d85bd6"
302
+ "size": 19195,
303
+ "sha256": "a8f88ebcc38f0c33a1b002a2c5146136d7646d90a4cba04f813e662ffffae3bf"
304
304
  },
305
305
  {
306
306
  "path": "resources/product/resources/workspace/skills/buildr/task-verification/SKILL.md",
307
307
  "mode": 420,
308
- "size": 18992,
309
- "sha256": "9fecd05bf07b912a7329f88aad8888e52014b038d37d04b48b020080b1f88f59"
308
+ "size": 19631,
309
+ "sha256": "2b89d65fc382276c61d4960ace72bc821065bf1821867903e0a0c97d8d34eae0"
310
310
  },
311
311
  {
312
312
  "path": "resources/product/resources/workspace/skills/buildr/task-verification/references/project-verification-v3.md",
313
313
  "mode": 420,
314
- "size": 2187,
315
- "sha256": "23019fa180875e60d07a10b283a05993ecd6580771f7c7e64669981329ae5c8d"
314
+ "size": 2258,
315
+ "sha256": "23ad3a75dda85af4786985e46373764c4dcc1a2d1655ea07fe2cebcb0508ed77"
316
316
  },
317
317
  {
318
318
  "path": "resources/product/resources/workspace/skills/buildr/task-verification/templates/project-verification.yml",
@@ -347,8 +347,8 @@
347
347
  {
348
348
  "path": "resources/product/resources/workspace/skills/contracts/buildr/current-knowledge-maintenance/v2.md",
349
349
  "mode": 420,
350
- "size": 4388,
351
- "sha256": "bd5b9f7d2527a0f2fd2c044e93087891d99239548e4c6639208277260484261b"
350
+ "size": 4592,
351
+ "sha256": "4f436c1a3012c12e2f75345d3a27f7b64b8c4dea6785596c352d53f1ab3139a3"
352
352
  },
353
353
  {
354
354
  "path": "resources/product/resources/workspace/skills/contracts/buildr/git-operations/v1.md",
@@ -365,8 +365,8 @@
365
365
  {
366
366
  "path": "resources/product/resources/workspace/skills/contracts/buildr/task-development/v2.md",
367
367
  "mode": 420,
368
- "size": 13970,
369
- "sha256": "b6a57aebf5c10f05e596256711706927ecf95a60d4fbb4086dff1614e245875b"
368
+ "size": 14201,
369
+ "sha256": "5fb4475d844c3bde36dfe87fdbb480345b458471f50fe57a713afe99fcd5940d"
370
370
  },
371
371
  {
372
372
  "path": "resources/product/resources/workspace/skills/contracts/buildr/task-environment/v1.md",
@@ -377,8 +377,8 @@
377
377
  {
378
378
  "path": "resources/product/resources/workspace/skills/contracts/buildr/task-finish/v1.md",
379
379
  "mode": 420,
380
- "size": 5086,
381
- "sha256": "3028249712c7b25a4b730cf9a29724a43eed4a555d1fb8a8f27d3ea52fdec00d"
380
+ "size": 5261,
381
+ "sha256": "fd1ff7dbe655105445adb6de2ddaed598490171fd05f0cd2243823f236ab441c"
382
382
  },
383
383
  {
384
384
  "path": "resources/product/resources/workspace/skills/contracts/buildr/task-record/v2.md",
@@ -401,8 +401,8 @@
401
401
  {
402
402
  "path": "resources/product/resources/workspace/skills/contracts/buildr/task-verification/v3.md",
403
403
  "mode": 420,
404
- "size": 12319,
405
- "sha256": "5ec011a5dd7089f2130176c934da215206f8fbc8e9ef052eeae782b629d3b118"
404
+ "size": 12603,
405
+ "sha256": "c16d118fb874347c128c478206abeecaf2ba2ea9597af58bda071e43a1e926d8"
406
406
  },
407
407
  {
408
408
  "path": "resources/product/resources/workspace/skills/contracts/buildr/terminology-governance/v1.md",
@@ -599,15 +599,15 @@
599
599
  {
600
600
  "path": "resources/runtime/read-worker.cjs",
601
601
  "mode": 420,
602
- "size": 3655968,
603
- "sha256": "ee159f2499e927ef762c9f124ccb9342161598d68906035ad8e9df31d0566d58"
602
+ "size": 3666222,
603
+ "sha256": "d2eac91e6953284f4e051d2b408d4f29fbc6be2c6419ffe6a9817a0ebeb2b4d6"
604
604
  },
605
605
  {
606
606
  "path": "runtime/buildr.cjs",
607
607
  "mode": 420,
608
- "size": 3719112,
609
- "sha256": "4c3b941d84c6aa1729dffa03088a8704676803cceafe9a807269177a1d60e3ac"
608
+ "size": 3729356,
609
+ "sha256": "042930e8cd09ceea4517c01ded1dd59d22e3d7182ef0aed71def47cc11a99ca3"
610
610
  }
611
611
  ],
612
- "applicationPayloadDigest": "sha256-6d898f5c79ce2247f5e93bf80f0f103b5910a1ba2dadd239192a5bce09e4eeb4"
612
+ "applicationPayloadDigest": "sha256-c506cf78e00feea3565c4b72f0f3e402acec7bd10163a52c7cc7f9bf66c7e54d"
613
613
  }
@@ -3,11 +3,11 @@
3
3
  "channel": "npm",
4
4
  "runtimeRole": "host",
5
5
  "package": "@buildr-ai/buildr",
6
- "version": "0.1.0-rc.26",
6
+ "version": "0.1.0-rc.28",
7
7
  "protocolIdentity": "buildr.web-protocol/v1",
8
- "applicationPayloadDigest": "sha256-6d898f5c79ce2247f5e93bf80f0f103b5910a1ba2dadd239192a5bce09e4eeb4",
9
- "sourceCommit": "46158e982bcd405b18eb60152462458a12855345",
8
+ "applicationPayloadDigest": "sha256-c506cf78e00feea3565c4b72f0f3e402acec7bd10163a52c7cc7f9bf66c7e54d",
9
+ "sourceCommit": "39fd793d506558fed2d9640ad88581d1942ff46c",
10
10
  "sourceTag": null,
11
- "installUnit": "@buildr-ai/buildr@0.1.0-rc.26",
12
- "ownershipIdentity": "sha256-249def5f6ad8b07d80a69bbcae5f28b81026938d5e91de999dfb604c73790b48"
11
+ "installUnit": "@buildr-ai/buildr@0.1.0-rc.28",
12
+ "ownershipIdentity": "sha256-00c9ea314c6dc31117922e5f3d68771a79360963eb3ef8f9d590e801d8d561e6"
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildr-ai/buildr",
3
- "version": "0.1.0-rc.26",
3
+ "version": "0.1.0-rc.28",
4
4
  "description": "Buildr CLI for managing Agent workspace assets.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -47,8 +47,7 @@ Agent runtime 先根据 Skill description 和用户目标发现入口 Skill。
47
47
  | 为正式 Task 准备、检查、恢复或清理实际执行环境 | `buildr.task-environment/v1` selected provider |
48
48
  | 显式创建、检查或清理 Task 的 Git worktree/provider evidence | `buildr.git-worktree-provider/v1` selected provider |
49
49
  | 从首个proposal、方案或直接实现等正式研发动作开始,维护planning facts、稳定Content Target、正式Verification、Task Candidate、Completion Review、风险决定与handoff | `buildr.task-development/v2` selected provider |
50
- | 对已有active formal Task消费current Development handoff并完成交付 | `buildr.task-finish/v1` selected provider;Agent选择自动Finish或直接Git/PR,外部交付后用reconciliation登记Delivery,Activation、Environment Cleanup与Diagnostics独立处理 |
51
- | Workspace 没有 active Task 时,用户说“收尾”或等价的当前 Git 交付 | 产品入口解析当前 Git facts 后,将已选定的 fetch、必要时精确 commit、rebase、普通 push 等 operation 交给 `buildr.git-operations/v1`;不创建临时 Task 或 Formal Finish evidence |
50
+ | 用户要求“收尾”“交付”或完成当前工作 | `task-finish` Skill先识别当前范围内匹配的未结束Task;有Task就沿`task next`推进并通过`buildr.task-finish/v1`完成正式交付,没有Task就通过`buildr.git-operations/v1`完成普通Git收尾,两条路径不混用生命周期证据 |
52
51
  | 已明确 repository/ref 的 commit、push、commit+push 或其他已选 Git Operation | `buildr.git-operations/v1` selected provider;本 Skill 或直接用户继续决定 operation、目标与顺序 |
53
52
  | 统一安装、更新和卸载一组 workspace Rules、Skills、Command collections | 组件(Components) |
54
53
  | 沉淀每次会话必须遵守的约束 | 规则(Rules) |
@@ -58,8 +57,7 @@ Agent runtime 先根据 Skill description 和用户目标发现入口 Skill。
58
57
  | 为 Buildr 增加新的 Agent runtime adapter | runtime trait intake + OpenSpec change |
59
58
  | 采用内部流程、调整工作方式、修改或替换 Skill 行为 | `capability-adaptation` Skill;先识别跨 Skill 稳定依赖边界,再开发、验证和激活 |
60
59
  产品入口 Buildr Skill 只对自身已命中的 Buildr 管理意图执行内部能力路由,不是同时 required 依赖全部 capabilities 的 workspace consumer。只有某类 Buildr 管理意图命中本 Skill 后,才把对应 capability 作为本次动作的 required dependency;单项 capability blocked 不得阻塞 init、doctor、Project/Service 或其他无关 Buildr 管理动作。顶层 capability 的 binding 只选择 provider,不自动产生 Agent 意图命中;替换顶层入口时必须由能力适配同时验证 selected provider 的 runtime 可发现性、description 覆盖和触发歧义。Formal Task和Task Environment不是编辑、构建或有界测试的通用工作许可:用户授权、repository/ref、owned scope与副作用明确时,Agent可以直接工作,但不得冒充Environment或正式Result。需要Buildr-managed checkout、Preparation、runtime projection、Task-owned资源、正式环境证据或自动Finish时,使用 `buildr task environment prepare <task-id> --agent <agent> --target <canonical-workspace> --json`;`prepare` 确定性完成实际执行位置、Runtime、Workspace CLI、依赖、runtime projection 和真实 probes,重复调用承担恢复。只有结果为 `ready` 才在返回的执行根中继续受管动作。Git worktree 只是可组合 provider;其 evidence 不代表环境 ready。任一 provider 返回 `treeChanged: true` 后,按本 Skill 的 workspace transition 约束,在对应已初始化 Buildr workspace 中针对当前 Agent 和 workspace root 运行 doctor。doctor 指出 workspace sync 是合适修复动作时,询问用户是否由 Agent 立即同步,同时提供准确手动命令作为备选;确认后由 Agent 执行 sync 并验证。当前 session 是否重新发现新资产由 Agent runtime 决定。“更新 workspace”或“同步 workspace”已包含 Git 更新与 Buildr sync 授权,不重复询问 sync;遇到本地改动、分叉、冲突、缺少 upstream 或其他需要用户决策的状态时停止,不自动 stash、reset、rebase、merge、覆盖,也不继续 sync。
61
- 无 active Task 的“收尾”不是 Task Finish 的降级模式,而是直接 Git 收尾。先只读确认 Workspace 中没有 active Task,并解析当前 repository、HEAD 分支、dirty/index、唯一目标 ref、remote 和 push destination;completed/abandoned Task 不得复用。事实唯一时,按 `fetch → 必要时精确 commit → rebase → push` 的已选顺序调用 `git-operations`;ownership 不明、目标歧义、rebase 冲突、共享历史改写或 force push 时 fail closed。直接路径只报告独立 Git Operation Result,不创建 Task、Environment、Verification、Candidate、Finish Result 或 Task terminal status。rebase 成功改变已检出 Buildr Workspace tree 后,按本 Skill 的 workspace transition 约束运行当前 Agent Doctor。
62
- 已有active Task的“收尾”由Agent根据当前repository与协作方式选择自动Finish、直接Git或PR。Buildr不要求业务代码必须经过Delivery Carrier;直接交付后必须由`task finish reconcile`从真实远端验证并登记,不接受claimed success。Doctor、Activation、Environment Cleanup或Diagnostics attention不撤销已确认Delivery。
60
+ 完整“收尾/交付”意图由`task-finish`统一解释,产品入口不复制它的Task识别、Git顺序、恢复或清理手册。`task-finish`只把当前分支需要的能力提升为required:匹配未结束Task时渐进消费`task next`并在current handoff后使用`buildr.task-finish/v1`;没有匹配Task时使用`buildr.git-operations/v1`完成直接Git收尾。普通Git路径只报告独立Git Operation Result,不创建Task生命周期证据;正式路径的外部交付必须由`task finish reconcile`从真实远端登记。两条路径都不得自动force push、丢弃改动、改写共享历史或清理ownership不明的资源。
63
61
  ## 资产维护
64
62
 
65
63
  ### Workspace / Organization Root
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildr-ai/buildr",
3
- "version": "0.1.0-rc.26",
3
+ "version": "0.1.0-rc.28",
4
4
  "description": "Buildr CLI for managing Agent workspace assets.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -361,7 +361,7 @@ builtins:
361
361
  - id: task-finish
362
362
  path: resources/workspace/skills/buildr/task-finish
363
363
  target: skills/buildr/task-finish
364
- description: 用户要求已有正式任务(formal Task)“收尾”或交付当前研发交接(Development handoff)时使用;由智能体(Agent)选择直接 Git/PR、Buildr 自动 Finish 或交付对账(delivery reconciliation),并独立处理激活、环境清理和诊断。
364
+ description: 用户要求“收尾”“交付”或完成当前工作时使用;先识别当前范围内匹配的未结束 Buildr Task,有 Task 就沿正式生命周期推进到交付和安全清理,没有 Task 就按普通 Git 完成提交、集成、推送、远端确认和可证明的本地善后。
365
365
  required: false
366
366
  provides:
367
367
  - capability: buildr.task-finish
@@ -91,7 +91,7 @@ sourceIdentities: <paths/specs/tree>
91
91
  treeIdentity: <current candidate identity>
92
92
  ```
93
93
 
94
- Development聚合时只保存`aligned|not-applicable|attention|blocked`、tree identity、summary、source identities与bounded unresolved items;`updated`后必须重新观察新tree,`unresolved|change-required`按是否会造成错误完成结论转为blocked或先回到Change flow,不能伪装aligned。Archive只移动已对齐的Change、Brief和sidecar;archive后不得再写glossary或current knowledge。
94
+ Development聚合时只保存`aligned|not-applicable|attention|blocked`、tree identity、summary、source identities与bounded unresolved items。多Project Task必须逐Project取得Result并提交精确覆盖全部有效Project的dispositions;不得让一个Project结果代表整个Task。`updated`后必须重新观察新tree,`unresolved|change-required`按是否会造成错误完成结论转为blocked或先回到Change flow,不能伪装aligned。Archive只移动已对齐的Change、Brief和sidecar;archive后不得再写glossary或current knowledge。
95
95
 
96
96
  ## Guardrails
97
97
 
@@ -112,7 +112,7 @@ stable Content Target形成后按默认顺序执行:
112
112
 
113
113
  1. 针对每个有效Project形成并复核closed Formal Verification Plan;只运行较窄focused feedback,不在阶段切换前另启相同broad affected execution。
114
114
  2. Plan preview为`action-required`时,把原样`preparation.planRequest`交给Task Environment一次幂等prepare;不手写安装或扩大Task scope。
115
- 3. 使用同一批Plan documents调用`discover policy --plan <project>::<json-file>`,检查selected、not-selected、coverage gaps与必要risk override,再把返回的closed `inputJson`交给policy writer。
115
+ 3. 使用同一批Plan documents调用`discover policy --plan <project>::<json-file>`;若返回聚合`preparation.planRequest`,先原样交给Task Environment一次prepare并重跑同一批Plan preview/discover。检查selected、not-selected、coverage gaps与必要risk override,再把返回的closed `inputJson`交给policy writer。
116
116
  4. Task Context、Planning、Content Target、Environment准备与policy均current后调用freeze形成或复用Candidate;随后把同一Plan文件交给formal run/reconcile。
117
117
 
118
118
  该顺序是Formal Development的推荐工作流,不自动prepare、policy、freeze或run,也不是普通开发的许可层;Agent仍决定额外风险能力、override、外部授权及是否采用其他满足owner contract的合法路径。Plan、target、declaration或capability identity变化时重新plan,不复用旧preview或execution。
@@ -127,7 +127,7 @@ Candidate形成后读取response-only`formalVerificationReadiness`:`ready`时
127
127
 
128
128
  所有Change disposition非pending、每个`converged`由current working copy archived事实证明、planning disposition明确且Content Target与policy current后,即可调用Development Application freeze。freeze不修改内容、不运行命令,只创建或复用current Candidate;Verification、Completion与Current Knowledge都不进入Candidate identity,也不作为首次freeze前置。Change lifecycle、planning、Content、Task context或policy变化会使旧Candidate失效并在下一次freeze递增generation。
129
129
 
130
- Candidate形成后,按实际工作需要形成matching Verification、用`task-review`执行Completion Review,并由Current Knowledge provider形成绑定current Content Target的最小disposition。`blocked`只用于会造成错误完成结论的冲突;`attention`保留portable follow-up但不阻止proceed/handoff。根据current gates记录:
130
+ Candidate形成后,按实际工作需要形成matching Verification、用`task-review`执行Completion Review,并由Current Knowledge provider形成绑定current Content Target的最小disposition。多Project Task逐Project取得Result后一次提交精确Project集合,单Project与仅工作区Task可沿用原聚合输入。`blocked`只用于会造成错误完成结论的冲突;`attention`保留portable follow-up但不阻止proceed/handoff。根据current gates记录:
131
131
 
132
132
  - `blocked`:说明未获接受的风险或仍需处理的问题,不修改Task顶层status;
133
133
  - `proceed`:必须绑定current Candidate。Verification not-passed、coverage gap或Completion changes-required时,每项风险都要绑定`verification|completion`、精确Result digest、scope、summary和用户授权source;跳过整个适用gate使用`gate`记录waiver,不伪造Result或混入风险列表。
@@ -1,80 +1,74 @@
1
1
  ---
2
2
  name: task-finish
3
- description: 用户要求已有正式任务(formal Task)“收尾”或交付当前研发交接(Development handoff)时使用;由智能体(Agent)选择直接 Git/PR、Buildr 自动 Finish 或交付对账(delivery reconciliation),并独立处理激活、环境清理和诊断。
3
+ description: 用户要求“收尾”“交付”或完成当前工作时使用;先识别当前范围内匹配的未结束 Buildr Task,有 Task 就沿正式生命周期推进到交付和安全清理,没有 Task 就按普通 Git 完成提交、集成、推送、远端确认和可证明的本地善后。
4
4
  ---
5
5
 
6
- # 任务收尾(Task Finish)
6
+ # 收尾与交付
7
7
 
8
- 本 Skill 是 `buildr.task-finish/v1` 的默认 provider。它帮助智能体(Agent)完成正式任务交付,不把 Buildr 自动 Finish 变成唯一通道。
8
+ 本 Skill 是完整“收尾/交付”意图的统一入口,也是 `buildr.task-finish/v1` 的默认 provider。它选择正确路径并持续推进,不合并正式 Task 与普通 Git 的状态和证据。
9
9
 
10
- > Buildr 约束 Agent 不要做错事,不要求 Agent 必须通过 Buildr 才能做事。
10
+ “收尾/交付”授权当前范围内安全、常规且目标明确的提交、集成、推送、对账和清理;不授权强制推送、丢弃改动、覆盖他人工作、改写共享历史、替用户解决语义冲突或删除归属不明的资源。
11
11
 
12
- Agent 负责选择 Git、拉取请求(Pull Request, PR)、分支与恢复策略;Buildr 负责读取当前研发交接(Development handoff)、验证真实远端、登记交付,并在可证明安全时协助清理。Task Finish 不运行或记录 Task Verification、Task Review,不生成 Candidate,也不收敛 OpenSpec Change。
12
+ ## 1. 选择路径
13
13
 
14
- 开始决策前先读取 Finish current facts。它统一表达 handoff、repository topology、run/carrier ownership、side effects、remote containment、维护结果、typed blockers、required 安全前置与 available capabilities。`task next`只把这些事实和能力带到入口,不替 Agent 选择唯一动作;兼容性的 `next` 提示不是行为权威。
14
+ 先确认 Workspace、实际仓库集合、用户目标和改动归属,再读取当前范围的 Task 事实。
15
15
 
16
- ## 交付前
16
+ - 唯一匹配的未结束 Task:进入正式 Task 路径。匹配必须同时符合仓库集合、Task scope 和用户目标。
17
+ - 没有匹配 Task:进入普通 Git 路径。已完成、已放弃或无关 Task 按不存在处理,不复用其环境、候选、验证、研发交接或收尾证据。
18
+ - 多个 Task 可能匹配,或仓库、范围、目标无法唯一确定:只询问会改变交付对象的最少问题。
17
19
 
18
- 1. 确认 Task ID、canonical Workspace、current Development handoff 和实际 repository 集合。
19
- 2. 核验每个 repository 的 source、target branch、remote identity、任务贡献(Task Contribution)和远端现状。
20
- 3. 需要 force push、覆盖他人提交、改写共享历史,或 repository/ref/remote 有歧义时停止并请求决定。
21
- 4. Development handoff 或 Candidate 真实 stale 时返回 `task-development`;远端前进、路径不重叠或 Buildr 内部记录缺失本身不使 handoff stale。
20
+ 两条路径互斥。普通 Git 路径不创建临时 Task,也不产生正式生命周期证据。
22
21
 
23
- `--commit-message` 由 Agent 提供时,默认遵循当前 workspace `AGENTS.md` 的提交语言约定;Project、Service、repository 的更具体约定优先。Task Finish 不翻译或重写提交信息。
22
+ ## 2. 正式 Task 路径
24
23
 
25
- ## 由 Agent 选择路径
24
+ ### 推进到研发交接
26
25
 
27
- ### Buildr 自动 Finish
26
+ 运行 `buildr task next <task-id> --target <canonical-workspace> --json`,只处理它返回的当前动作。`required` 前置由返回的 selected provider 恢复;`recommended` 由 Agent 结合真实目标选择。
28
27
 
29
- 目标明确且适合普通 fast-forward 交付时,可复用交付载体(Delivery Carrier):
28
+ 调用对应专业 owner 并消费结果,本 Skill 不代写环境、研发、审查、验证、候选或风险决定。owner 成功后重读 `task next`,直到形成 current Development handoff、Task 按无变更路径结束,或出现需要新授权、业务判断或外部变化的真实 blocker。同一状态没有变化时停止,不循环调用或伪造进展。
30
29
 
31
- `buildr task finish run --task <task-id> --commit-message '<semantic-message>' --target <canonical-workspace> --detail compact --json`
30
+ ### 完成交付
32
31
 
33
- `run` 按 `preflight → prepare → verify → deliver → cleanup` 尝试自动化;这些阶段不是 Agent 必须遵循的唯一工作方式。出现冲突或远端变化时,Agent 可继续同一 run、处理交付适配(Delivery Adaptation)、改走 PR 或直接 Git。不得手写 resume token、claimed success 或语义等价证明。
32
+ 形成 current handoff 后读取 Finish current facts,核对 Task、仓库集合、任务贡献、目标 branch/remote、run/carrier ownership、remote containment、typed blockers 和 available capabilities。
34
33
 
35
- Agent-reviewed Delivery Adaptation必须对冻结Task Contribution的每个路径形成唯一处置:目标精确包含、carrier实际改变,或Agent通过matching run/resume使用`--reviewed-target-path <repository-selector>::<path>::<reason>`逐路径确认目标语义承接。Buildr只证明路径集合、Git bytes与identity闭合;逐路径理由仍是Agent判断,不被描述为机器证明。缺失、未知、重复、空理由或陈旧run/target/carrier输入保持同一run blocked。零差异适配仍需`--accept-zero-delta-adaptation`,且不隐式豁免逐路径覆盖。
34
+ 适合普通 fast-forward 时可运行:
36
35
 
37
- 如果Agent误改原Task worktree并形成新的current Candidate,先重新读取Finish current facts。只有facts明确返回`stale-run-retirable`与available `finish-rollover`能力时,Agent才可显式执行:
36
+ `buildr task finish run --task <task-id> --commit-message '<semantic-message>' --target <canonical-workspace> --detail compact --json`
38
37
 
39
- `buildr task finish rollover --task <task-id> --recovery-token <facts-token> --commit-message '<semantic-message>' --target <canonical-workspace> --detail compact --json`
38
+ `run` 提供 `preflight → prepare → verify → deliver → cleanup` 可选自动化。提交信息遵循当前 workspace `AGENTS.md` 及更具体规则,Task Finish 不翻译或重写提交信息。
40
39
 
41
- `rollover`只重新验证已知Task Contribution漂移、不可刷新的carrier初始内容证明、无lease/Delivery/Activation/Cleanup副作用及不变repository topology;它精确清理旧carrier并以current-row fence创建绑定新Handoff的active run,不访问远端、不执行Delivery。能力不可用、token漂移或carrier被Agent修改时保留现场,Agent改走检查、直接Git/PR、reconcile、Development或放弃策略。普通`run`不得替Agent静默执行该换代。
40
+ 也可通过直接 Git、拉取请求或其他已授权方式交付;完成后必须运行:
42
41
 
43
- ### Agent 直接交付
42
+ `buildr task finish reconcile --task <task-id> --target <canonical-workspace> --detail compact --json`
44
43
 
45
- Agent 可通过 Git Operations、PR 或其他已授权方式推进代码;每个 repository 保留独立结果,部分成功不得伪装为原子事务,也不得重复推送已交付 repository。
44
+ `reconcile`只接受真实远端事实,不接受调用方声明成功或自制证明。多仓库逐项保留结果,部分成功不伪装成原子事务,也不重复交付已确认仓库。
46
45
 
47
- 交付后运行:
46
+ 出现 target race、交付适配(Delivery Adaptation)、stale run 或其他恢复状态时,只使用 current facts 返回的同一 run、token 和封闭能力。Agent 审查的适配必须覆盖冻结任务贡献的每个路径;零差异适配仍使用产品要求的显式确认。不得手写 token、claimed success、任意删除路径或语义等价证明。
48
47
 
49
- `buildr task finish reconcile --task <task-id> --target <canonical-workspace> --detail compact --json`
48
+ 只有原 Task source、Task Context、planning、policy 或其他候选输入真实变化,才返回 `task-development`。远端前进、carrier 冲突、路径不重叠或 Buildr 内部记录缺失本身不使 handoff stale。
49
+
50
+ ### 完成善后
50
51
 
51
- 交付对账(Delivery Reconciliation)不接受调用方提交“已成功”、commit 列表或证明文件。它优先复用current Environment;Environment不存在、已清理或局部不可用时,从current immutable handoff、Task scope、Project/Service registries、实际Git topology以及明确或唯一的remote/target构造只读上下文,不恢复或补造Receipt。它逐repository确认carrier已到达、已被后继包含,或目标tree精确包含任务贡献结果;无法证明时只报告对应repository的事实缺口,并保留其他repository已经登记的Delivery checkpoint。
52
+ 四个独立结果是交付、激活、环境清理和诊断。只有交付决定任务贡献是否进入目标远端;其他结果失败形成 attention,不撤销已确认交付。
52
53
 
53
- ## 四个独立结果
54
+ 交付成立后执行适用激活,通过 `buildr task environment cleanup <task-id> --target <canonical-workspace> --json` 清理环境,并保留诊断和未解决 attention。Buildr 自举 Workspace 只走运行时追加的唯一自举流程;Task 顶层登记失败时重跑 `reconcile`,不重新提交或推送业务代码。
54
55
 
55
- - 交付(Delivery):Task Contribution 是否已在目标远端;
56
- - 激活(Activation):运行时投射、Buildr 自举或 Doctor 是否需要关注;
57
- - 环境清理(Environment Cleanup):Task worktree 和资源是否已安全清理;
58
- - 诊断(Diagnostics):Execution Record 与诊断材料是否成功保留。
56
+ 完成标准:每个仓库的交付已确认,Task 已进入正确终态,激活、环境清理和诊断已完成或留下准确 attention,并且没有仍可安全执行的 current action。
59
57
 
60
- 只有 Delivery 决定业务任务是否已交付。Doctor、Execution Record、Activation、Cleanup、Task 登记或 Buildr 内部派生证据失败只能形成 `attention`,不能撤销已确认交付。Task 顶层登记失败时重复 `task finish reconcile`,不得重新提交或推送业务代码。
58
+ ## 3. 普通 Git 路径
61
59
 
62
- 环境清理由 Agent 在适当时机独立执行:`buildr task environment cleanup <task-id> --target <canonical-workspace> --json`
60
+ 确认每个实际仓库的 branch/HEAD、dirty/index、精确 owned scope、目标 ref、remote 和 push destination。事实唯一后,由 Agent 选择符合仓库协作方式的顺序,并把每个已支持的单次操作交给 `buildr.git-operations/v1` selected provider。
63
61
 
64
- Environment 只消费 Buildr 已持久化的交付证据或明确 abandon 终态。无法证明 worktree 内容已交付、ownership 不明或 source 已漂移时必须保留现场;没有current Environment时,Cleanup必须报告`not-applicable`或`attention`,不得声称`cleaned`。
62
+ 通常依次观察和刷新目标 ref,必要时精确暂存并提交,按仓库约定完成 rebase、merge、拉取请求或其他已授权集成,普通 push 后回读 destination ref 和完整 publication range,最后清理只属于本次交付且能证明安全删除的临时 worktree、local branch 或其他资源。
65
63
 
66
- 精确 carrier cleanup、旧 run retirement和本地安全rollover只能通过 Buildr 提供的封闭原语执行。原语会重新验证 Task/run/carrier identity、ownership、repository topology、phase、side effects,以及对应路径需要的remote containment或carrier disposability proof,不接受调用方指定任意删除路径;事实不足时保留现场,由 Agent 选择下一策略。
64
+ `fetch`、`commit`、`rebase` 和 `push` 保持独立结果。某一步失败时保留已发生 effects,不把组合动作描述为原子事务;内容已在目标远端时不制造空 commit 或重复 push。
67
65
 
68
- ## 应当阻断的边界
66
+ 本路径只报告 Git Operation Result、远端回读和本地善后。无法证明资源归属或删除安全时保留现场并报告 attention,不声称 Environment Cleanup,也不创建 Task、Development、Review、Verification、Candidate、Finish Result 或 Task terminal status。
69
67
 
70
- - remote target 不包含 Task Contribution;
71
- - repository、branch、remote 或 Task identity 有歧义;
72
- - 需要 force push、覆盖他人提交或改写共享历史;
73
- - 无法证明 worktree、carrier 或资源属于当前 Task 并可安全删除;
74
- - 调用方试图伪造交付、语义等价或完成证据;Agent-reviewed carrier没有完整处置Task Contribution的全部路径,或路径覆盖证明已漂移。
68
+ 完成标准:当前 owned scope 已提交,按目标协作方式完成集成,远端 ref 已回读确认,可安全清理的本次资源已经清理,并且没有未说明的遗留状态。
75
69
 
76
- Buildr 状态不一致、可重建证明缺失、重复观察已交付 repository、单个 Cleanup 或 Diagnostics 失败,不属于 Delivery 阻断条件。
70
+ ## 4. 停止与报告
77
71
 
78
- ## 报告
72
+ Task、仓库、branch、remote、目标 ref、owned scope 或资源归属不明确,remote 不能证明包含交付内容,current owner 需要新的用户决定,或继续需要破坏性动作时停止并保留现场。
79
73
 
80
- 先报告每个 repository 的 Delivery,再分别报告 Activation、Environment Cleanup、Diagnostics 和需要 Agent 处理的 attention。只有未交付、身份不明或涉及破坏性风险时请求用户决策;交付后可询问是否复盘。
74
+ 报告先按仓库说明交付或 Git 结果,再说明 Task 终态、激活、环境清理、诊断、本地善后和 attention。只有仍未交付、身份不明或涉及破坏性风险时请求用户决定。
@@ -59,7 +59,7 @@ authority 冲突、授权或 repository set 不明、不可逆行为缺少决定
59
59
 
60
60
  | 分支 | Capability / 动作 | 必要输入与成功证据 | 失败处理 |
61
61
  |---|---|---|---|
62
- | 新正式 Task 的 Git 基线 | `buildr.git-operations/v1` 的独立 `fetch` 与 `rebase` | 完整 repository set 均证明当前为 clean `dev`、upstream 为 `origin/dev`;每个 operation 返回 before/after、effects 与 current facts,适用 Workspace transition check ready | 任一前置事实、provider、fetch、rebase、冲突恢复或 Doctor blocked 时不调用 Task Record `create`;报告全部部分 effects,不换策略 |
62
+ | 新正式 Task 的 Git 基线 | `buildr.git-operations/v1` 的独立 `fetch` 与 `rebase` | 完整 repository set 分别证明current integration branch、matching upstream与clean状态;每个 operation 返回before/after、effects与current facts,适用Workspace transition check ready | 任一目标解析、前置事实、provider、fetch、rebase、冲突恢复或Doctor blocked时不调用Task Record `create`;报告全部部分effects,不换策略 |
63
63
  | 待办意向 | `buildr.task-record/v2` 的 `create --status todo` | 用户已接受但尚未启动的意向、stable ID、title、intent、scope与可选复盘来源;只返回SQLite record/effects | 不运行Git基线,不创建Environment、Change或专业placeholder |
64
64
  | 正式持久交付 | `buildr.task-record/v2` 的 active `create`、todo `activate` 或 `inspect` | stable Task ID、title、intent、canonical Workspace 与真实 scope/Change;首次执行写入前返回 current active record | provider或Git门禁blocked时停止正式交付写入;已有active inspect不重复门禁 |
65
65
  | 正式执行位置 | `buildr.task-environment/v1` 的 Plan `record/inspect` 与 Environment `prepare/inspect` | Task ID、canonical Workspace、完整 Task Project/Service scope、Project `preparation.yml`及Agent选择的Recipe;首次受管效果前取得`ready`、实际execution roots、validation root和执行CLI | Declaration/Plan缺失或scope不完整时只阻塞消费Environment authority的动作;不猜技术栈,不回退到cwd或旧Receipt |
@@ -84,16 +84,17 @@ Child Task必须先以`--parent <parent-task-id>`和自身scope创建,且初
84
84
 
85
85
  如果Child真实依赖Parent尚未交付的代码、文档或其他authority,先在Parent Plan中表达依赖并完成前置Contribution;可以先保留Child意向,但必须延后Child Environment prepare。前置贡献完成正式Finish且进入最新`dev`等canonical baseline后,再从收敛后的baseline准备Child Environment。不得通过从Parent worktree派生Child checkout、复制Parent Environment Receipt或提前共享未归档Change绕过该顺序。
86
86
 
87
- ### 新正式 Task 创建前收敛统一 dev 基线
87
+ ### 新正式 Task 创建前收敛逐 repository 权威基线
88
88
 
89
89
  只有即将创建 active Task 或把 todo 激活为 active 时执行本门禁;todo create、inspect、已有active继续、纯讨论和只读探索不执行。
90
90
 
91
- 1. 以已经解析的完整 repository set 为输入,按 selector 固定顺序逐个核验真实 Git root、当前符号分支恰为 `dev`、upstream 恰为 `origin/dev`、remote/ref 可读、index 与 working tree clean,并且没有 rebase、merge、cherry-pick 等进行中的 Git operation。任一事实不成立时在 tree/history 零写入状态返回 `blocked`;不 checkout、不 stash/autostash、不猜其他 branch/remote。
92
- 2. 读取 optional `buildr.git-operations/v1` binding;在本 create 分支把 ready selected provider 作为 required。先为全部 repositories 逐一选择独立 `fetch` operation,明确 `origin` 与 `dev`,消费每个 Result。任一 fetch blocked 时不执行尚未开始的 rebase,不创建 Task,并报告全部已发生的 remote-ref effects。
93
- 3. 全部 fetch 成功后重新核验 `dev`、`origin/dev` 与 clean 状态,再按同一顺序为每个 repository 明确选择 `rebase` operation,将本地 `dev` rebase 到本次观察的 `origin/dev`。本地已对齐、仅落后或含未 push 且未共享 commit 都使用同一 operation;provider 不自行选择 merge 或 push。
94
- 4. rebase 冲突时,consumer 明确授权 provider 只在 pre-state 已证明 clean 时执行有界 `rebase --abort`。只有 branch、HEAD、index 与 working tree 精确恢复到 pre-rebase facts 才记为 recovered;无论恢复是否成功,本次 Task create 都是 `blocked`。abort 失败或恢复不可证明时保留现场。已经在其他 repository 成功的 fetch/rebase 不反向回滚,必须作为部分 effects 报告。
95
- 5. 任一 rebase 返回 `treeChanged: true` 时,按产品入口 Buildr Skill 的 workspace transition 约束,对相应 Buildr Workspace 执行当前 Agent 的 check;Doctor 或必要收敛未 ready 时不创建 Task。若tree前进来自`origin/dev`上的协作者提交且当前会话不存在绑定同一Workspace、Task、run与delivered ref的matching Formal Finish Result,只能把它归类为普通Workspace update:本地没有协作者Task是正常事实,不得因此查找、恢复或启动`buildr-self-bootstrap-sync`。Doctor仅指向当前Agent managed workspace/runtime projection stale时,将现有用户授权或一次明确sync确认交给产品入口Buildr Skill执行`buildr sync <agent> --target <workspace-root>`并消费最终Doctor;存在非sync blocker时按对应authority停止或处理,不用一次sync掩盖。
96
- 6. 只有完整 repository set 的 fetch、rebase、恢复检查与适用 transition check 全部成功,才调用 selected `buildr.task-record/v2` provider 的 active `create` 或 `activate`。任一门禁blocked时todo保持不变。Task Record Application、Buildr Web 与 Task Environment 不获得任何Git mutation或本门禁状态authority。
91
+ 1. 以已经解析的完整repository set为输入,按selector固定顺序为每个repository解析integration branch、remote与matching upstream。优先使用Project/Service registry的Git声明;声明缺失时只接受当前符号branch/upstream或用户明确选择形成的唯一事实。无法唯一解析时在tree/history零写入状态返回`blocked`,不得猜测`dev`或复制Workspace目标。
92
+ 2. 逐个核验真实Git root、当前符号branch恰为已解析integration branch、upstream恰为matching remote ref、remote/ref可读、index与working tree clean,并且没有rebase、merge、cherry-pick等进行中的Git operation。任一事实不成立时在tree/history零写入状态返回`blocked`;不checkout、不stash/autostash、不猜其他branch/remote。
93
+ 3. 读取optional `buildr.git-operations/v1` binding;在本create分支把ready selected provider作为required。先为全部repositories逐一选择独立`fetch` operation,明确各自remote与integration branch,消费每个Result。任一fetch blocked时不执行尚未开始的rebase,不创建Task,并报告全部已发生的remote-ref effects。
94
+ 4. 全部fetch成功后重新核验每个local integration branch、matching remote ref与clean状态,再按同一顺序为每个repository明确选择`rebase` operation。本地已对齐、仅落后或含未push且未共享commit都使用同一operation;provider不自行选择merge或push。
95
+ 5. rebase冲突时,consumer明确授权provider只在pre-state已证明clean时执行有界`rebase --abort`。只有branch、HEAD、index与working tree精确恢复到pre-rebase facts才记为recovered;无论恢复是否成功,本次Task create都是`blocked`。abort失败或恢复不可证明时保留现场。已经在其他repository成功的fetch/rebase不反向回滚,必须作为部分effects报告。
96
+ 6. 任一rebase返回`treeChanged: true`时,按产品入口Buildr Skill的workspace transition约束,对相应Buildr Workspace执行当前Agent的check;Doctor或必要收敛未ready时不创建Task。若tree前进来自matching upstream上的协作者提交且当前会话不存在绑定同一Workspace、Task、run与delivered ref的matching Formal Finish Result,只能把它归类为普通Workspace update:本地没有协作者Task是正常事实,不得因此查找、恢复或启动`buildr-self-bootstrap-sync`。Doctor仅指向当前Agent managed workspace/runtime projection stale时,将现有用户授权或一次明确sync确认交给产品入口Buildr Skill执行`buildr sync <agent> --target <workspace-root>`并消费最终Doctor;存在非sync blocker时按对应authority停止或处理,不用一次sync掩盖。
97
+ 7. 只有完整repository set的fetch、rebase、恢复检查与适用transition check全部成功,才调用selected `buildr.task-record/v2` provider的active `create`或`activate`。任一门禁blocked时todo保持不变。Task Record Application、Buildr Web与Task Environment不获得任何Git mutation或本门禁状态authority。
97
98
 
98
99
  上述Workspace update分类只组合本次Git Result、post-transition Doctor与当前会话已有的matching Formal Finish Result,不按commit author推断ownership,也不建立持久状态。只有真实matching Finish Result才能把同一run交给self-bootstrap;普通workspace sync不创建Task、Environment、Verification、Candidate、Finish Result或self-bootstrap evidence。
99
100
 
@@ -108,7 +109,7 @@ Child Task必须先以`--parent <parent-task-id>`和自身scope创建,且初
108
109
  - 语义治理:code-only / spec-maintenance / change-flow / blocked
109
110
  - 执行形态:implementation / metadata-only / unknown
110
111
  - Repository set:<selectors 或 unresolved>
111
- - Git 基线:converged / none / blocked(仅新正式 Task create;包含 dev/origin/dev 与部分 effects)
112
+ - Git 基线:converged / none / blocked(仅新正式Task create;包含每个repository的integration branch/upstream与部分effects)
112
113
  - Task Record:create / inspect / none / blocked
113
114
  - Task Environment:prepare / inspect / none / blocked
114
115
  - 事实依据:<最小 authority/evidence>
@@ -90,7 +90,7 @@ stable Content Target的Formal Plans按有效Project全部形成后,使用matc
90
90
  --plan <project>::<plan-file> [--plan <project>::<plan-file> ...]
91
91
  ```
92
92
 
93
- Task Verification Application会重新校验Plan closed identity、task-delivery target、current Content Target、Project/declaration与selected capability,并返回policy writer所需的closed `inputJson`、Plan identities和response-only not-selected摘要;它零写入,不把Plan正文、preparation、not-selected或文件路径保存到Result/Receipt。Project集合缺失/重复或任一identity陈旧时重新plan,不手抄或猜选能力。Plan文件位于操作系统临时目录,只保留到同一Plan完成policy派生和formal run;随后立即删除。无Plan时仍可使用declaration默认policy discovery作为合法降级,但不得把它声称为Plan-derived选择。
93
+ Task Verification Application会重新校验Plan closed identity、task-delivery target、current Content Target、Project/declaration与selected capability,并返回policy writer所需的closed `inputJson`、Plan identities和response-only not-selected摘要。全部Project都提供正式Plan result envelope时,投影还会把每份`preparation.requirements`合成精确并集;任一Project为`action-required`时,只把聚合后的`preparation.planRequest`原样交给Task Environment一次prepare,不得依次提交局部Project request相互覆盖。该投影零写入,不把Plan正文、preparation、not-selected或文件路径保存到Result/Receipt。Project集合缺失/重复或任一identity陈旧时重新plan,不手抄或猜选能力。Plan文件位于操作系统临时目录,只保留到同一Plan完成policy派生和formal run;随后立即删除。无Plan时仍可使用declaration默认policy discovery作为合法降级,但不得把它声称为Plan-derived选择。
94
94
 
95
95
  `verification run`只执行已选择的command capability;`--json`默认返回有界`buildr.long-running-operation-summary/v1`,只有诊断需要时才显式使用`--detail full`返回既有`buildr.verification-execution/v1`。compact中的recovery pointer必须先用于回读同一Execution Record;stdout丢失、等待超时、展示截断或既有failed都不授权重跑。它不接受`--declaration-root`。带matching Task Environment的正式execution必须由Development consumer提交current Candidate lease,并在启动capability前把Candidate加入invocation identity和Task Execution Record;runner不反向读取或写Development。完成后先seal受控、脱敏、有限期正文,再精确清理transient evidence。Task外execution不接受Candidate lease且仍只产生transient evidence。`--declaration-root`只用于Result reconciliation;`inspect`不重新观察声明。
96
96
 
@@ -137,6 +137,8 @@ buildr task verification reconcile <task-id> \
137
137
 
138
138
  Application独立读取record metadata与受控`summary.json`,核验body integrity、Task、owner/kind、Candidate、generation、target stability、Project、declaration与selected checks,再派生capability outcome、portable facts、evidence identities和整体结论。调用方不得提交或补充capability outcome/fact、evidence digest、declaration identity或claimed external success;任一authority不匹配、正文不可用或执行未terminal时零写入失败。
139
139
 
140
+ 多Project Task按Project聚合:同一Project的records必须绑定相同Request/Plan/provider,不同Project允许使用各自独立Plan。records与`project:<code>` coverage gaps必须精确覆盖全部有效Project;不得寻找或构造跨Project合并Plan,也不得用其他Project的passed记录替代缺失Project。
141
+
140
142
  仅工作区Result不执行不存在的能力,可用兼容`task verification record`入口提交Candidate、target、唯一workspace gap与`not-passed`;该入口拒绝capability claims及任何Project/Service/Change Task。Project coverage gap随至少一个matching execution authority一起reconcile;没有可执行authority时如实报告尚不能形成formal Result。
141
143
 
142
144
  Result只回答Candidate、target、采用的declarations、从authority派生的实际能力及facts/evidence identities、coverage gaps和总体验证结论。不要复制stdout/stderr、耗时、临时evidence path、Environment Receipt、本机绝对路径、applicability、digest、history/revision,或写入proceed/blocked与Task状态。
@@ -21,7 +21,7 @@ Verification Request 冻结 target、selection scope、changed paths/risks 与 d
21
21
 
22
22
  普通 capability 使用 discovery 选择 affected;缺少可信 affected 入口时显式扩大到 full。未知 owner 失败关闭。复杂 Product 可使用 provider,但 provider 只能投射统一 Plan/Execution facts,不得公开内部 registry DAG、Context cache 或写 Task Result。
23
23
 
24
- 正式执行必须使用 matching current Plan;preview 不是 evidence。Execution Record 绑定 Request、Plan、declaration、Candidate、target 与 execution unit,reconciliation 只消费同一 Plan 的 terminal records。
24
+ 正式执行必须使用matching current Plan;preview不是evidence。Execution Record绑定Request、Plan、declaration、Candidate、target与execution unit。reconciliation在同一Project内只消费同一Plan的terminal records,不同Project使用各自Plan并按有效Project完整聚合。
25
25
 
26
26
  ## Maintenance boundary
27
27
 
@@ -12,7 +12,7 @@ version: 2
12
12
 
13
13
  ## Consumer Obligations
14
14
 
15
- consumer 必须提供 operation(`assess`、`reconcile`、`inspect` 或 `maintain`)、Workspace/Project identity、当前候选 tree 范围、允许的写入阶段和已有 evidence。Change lifecycle operations 还必须提供 change identity 与 artifact paths;`maintain` 必须提供 target assets、fact sources 和明确的 knowledge 写入授权,且不得伪造 Change identity 或 sidecar。
15
+ consumer 必须提供 operation(`assess`、`reconcile`、`inspect` 或 `maintain`)、Workspace/Project identity、当前候选 tree 范围、允许的写入阶段和已有 evidence。Change lifecycle operations 还必须提供 change identity 与 artifact paths;`maintain` 必须提供 target assets、fact sources 和明确的 knowledge 写入授权,且不得伪造 Change identity 或 sidecar。多Project Task的Development consumer必须分别取得每个有效Project的Result,再以精确Project集合提交最小dispositions;provider不得把单Project Result声明为整个Task已对齐。
16
16
 
17
17
  consumer 必须在可能修改 delivery content 的 `reconcile` 或 `maintain` 后重新建立验证 evidence,并不得在 archive 后请求当前知识写入。
18
18
 
@@ -35,7 +35,7 @@ consumer不得直接读写Workspace SQLite Development current slot或旧`.build
35
35
  - policy identity只绑定current declarations、selected capabilities、coverage gaps与明确overrides;Task Verification不拥有policy。仅工作区policy的空集合与workspace gap仍必须形成稳定identity;其Content Target改变时旧policy stale,Task新增Project/Service/Project-bound Change时必须改用完整Project declarations。
36
36
  - current专业Result、`not-applicable`和明确`waived`是不同gate事实。stale/incomplete Result不得被waiver或风险接受变成current。
37
37
  - Candidate closed shape继续只绑定generation、Content Target、Task Context与policy identity;Task Context、Content Target、policy或Candidate前planning disposition变化必须清除current Candidate,下一次freeze递增generation。Verification、Completion、Current Knowledge与专业Result identity不得进入Candidate,也不得仅因其更新递增generation。
38
- - Current Knowledge `knowledge` action只保存current Content Target identity、`aligned|not-applicable|attention|blocked`、portable summary、source identities与bounded unresolved items;`blocked`阻止proceed/handoff,`attention`保留在handoff但不得阻止完成。Application不解释knowledge正文或固定调用顺序。
38
+ - Current Knowledge `knowledge` action只保存current Content Target identity、`aligned|not-applicable|attention|blocked`、portable summary、source identities与bounded unresolved items。多Project Task必须提交按Project排序且精确覆盖有效Project集合的最小dispositions,Application从该集合确定性聚合顶层status/source/unresolved facts;单Project与仅工作区Task兼容旧聚合输入。`blocked`阻止proceed/handoff,`attention`保留在handoff但不得阻止完成。Application不解释knowledge正文或固定调用顺序。
39
39
  - handoff snapshot绑定Candidate、Change dispositions、Current Knowledge disposition、全部current gate/disposition、proceed decision与精确风险/waiver授权;已写snapshot append-only immutable。
40
40
  - Contribution Handoff只作为同一immutable handoff的可选专业事实;必须绑定current Parent Plan与已保存planned binding。Parent coordination read model只组合Task Record与已保存Development/Finish facts,不新增progress/lifecycle/event/history store,不回写Child状态。
41
41
  - 已completed、非no-change的直接Child若具有matching terminal Finish association与不含Contribution Handoff的immutable handoff,且全部Task-scoped Change仍由current working copy证明archived,可通过`task parent reconcile-child-delivery`显式追加一次terminal contribution reconciliation。该专业evidence由Task Development Application唯一写入,必须绑定current Parent Plan、Parent/Child关系、Candidate/generation、三个gate、完整Contribution Handoff、reason与source;若历史binding存在则planned必须精确匹配,缺失binding时由调用方显式提交planned映射。它不修改Receipt、handoff、Finish、Task Record或Parent Plan;相同identity重放unchanged,不同覆盖或其他Child owner冲突零写入失败。
@@ -18,7 +18,7 @@ provider只消费Development handoff,不得运行或记录Task Verification/Ta
18
18
 
19
19
  ## Minimum Guarantees
20
20
 
21
- provider必须冻结Task、handoff、Candidate/generation、Content Target、repository set和Task Contribution。自动路径继续要求matching ready Environment,只能普通fast-forward/push并回读远端;reconciliation优先复用current Environment,缺失、已清理或局部不可用时必须从current handoff、Task scope、Project/Service registries、Git topology及明确或唯一remote/target构造只读context,不得恢复或补造Receipt。它逐repository从真实remote target重建containment;已证明交付的repository必须立即checkpoint并幂等复用。
21
+ provider必须冻结Task、handoff、Candidate/generation、Content Target、repository set和Task Contribution。自动路径继续要求matching ready Environment与非空受管repository set,只能普通fast-forward/push并回读远端;reconciliation优先复用current Environment。Environment缺失、已清理、局部不可用,或ready shared placement没有provider repository set时,必须从current handoff、Task scope、Project/Service registries、Git topology及明确或唯一remote/target构造只读delivery context,不得恢复或补造Receipt;ready shared Environment的cleanup availability仍保持current。它逐repository从真实remote target重建containment;已证明交付的repository必须立即checkpoint并幂等复用。
22
22
 
23
23
  Agent-reviewed Delivery Adaptation必须从冻结Task Contribution派生完整路径集合,并为每个路径保存唯一处置:target精确包含、carrier实际改变或Agent通过matching run/resume提交逐路径非空理由。未知、重复、未处置路径或run/target/carrier identity漂移必须在adoption、deliver与cleanup前fail closed。逐路径Agent判断必须标记为Buildr未证明语义等价;provider不得把task-wide review隐式应用到未列出的路径。覆盖事实必须进入既有carrier proof identity并由remote readback与cleanup重验,不得创建第二Result或事件store。
24
24
 
@@ -21,8 +21,8 @@ consumer与Application必须以Task显式Project、Service所属Project和Change
21
21
  ## Minimum Guarantees
22
22
 
23
23
  - Project `verification.yml` 只接受 `buildr.project-verification/v3`,声明既有 capability family 的 scope、proves、evidence、usable targets、discovery、affected/full/provider invocation及必要执行边界;旧声明不兼容读取。
24
- - Application必须从closed Verification Request与current declarations/provider生成内容寻址Plan。正式execution和Execution Record必须绑定matching request/plan/provider/declaration/execution unit identities;preview不得充当evidence,不同Plan的records不得混合reconcile。
25
- - Application必须提供零写入的Formal Plan到Task Development policy投影:按有效Project完整对账closed Plan document、current Content Target、declaration和selected capability,输出required capabilities、portable coverage gaps、空默认overrides与response-only not-selected摘要。Plan、preparation、not-selected摘要和文件路径不得进入Development Receipt、Verification Result或新store;Project缺失/重复或identity陈旧时零写入失败。
24
+ - Application必须从closed Verification Request与current declarations/provider生成内容寻址Plan。正式execution和Execution Record必须绑定matching request/plan/provider/declaration/execution unit identities;preview不得充当evidence。同一Project的records必须绑定相同Plan,不同Project允许使用各自独立Plan;reconcile必须以records或project coverage gap精确覆盖Task有效Project集合。
25
+ - Application必须提供零写入的Formal Plan到Task Development policy投影:按有效Project完整对账closed Plan document、current Content Target、declaration和selected capability,输出required capabilities、portable coverage gaps、空默认overrides与response-only not-selected摘要;全部Plan result均含preparation preview时,还必须输出全部Project requirements精确并集形成的唯一closed Environment Plan Request。Plan、preparation、not-selected摘要和文件路径不得进入Development Receipt、Verification Result或新store;Project缺失/重复或identity陈旧时零写入失败。
26
26
  - capability可选通过`environment.preparation`引用同Project已登记Preparation Recipe。Formal command execution必须先纯读合并selected capability requirements,绑定capability/declaration、closure、Environment Plan/Receipt与runtime invocation identities;只有admission current且ready后才能open Execution Record或启动target/process/Browser/resource副作用。首次副作用前必须按相同expected identities重验,漂移时fail closed且record不得open。
27
27
  - 只有可由声明Recipe恢复的preparation gap可以返回closed supplemental Plan Request,并且只能交给Task Environment唯一writer幂等prepare后重跑admission。辅助Service不得进入Task scope、Change、Content Target、allowed execution roots或源码写入authority。Verification不得自行安装依赖、设置`BUILDR_NODE`/PATH、猜cwd或复制Environment facts进Result。
28
28
  - Formal admission只门禁正式execution、current Result与完成声明。provider/Receipt/preflight暂不可用时,无关开发、只读调查和明确非正式的有界检查不受阻塞,但不得产生Formal Result或完成声明。coverage、declaration invalid、authorization与external-system/resource gap必须保持各自owner,不得伪装成preparation recovery。
@@ -27857,16 +27857,17 @@ ${excerpt}`);
27857
27857
  if (skill.id === "task-finish") {
27858
27858
  for (const requiredText5 of [
27859
27859
  "buildr.task-finish/v1",
27860
+ "完整“收尾/交付”意图",
27861
+ "正式 Task 路径",
27862
+ "普通 Git 路径",
27863
+ "buildr task next",
27860
27864
  "current Development handoff",
27861
27865
  "preflight → prepare → verify → deliver → cleanup",
27862
27866
  "交付适配(Delivery Adaptation)",
27863
- "Agent 直接交付",
27864
27867
  "task finish reconcile",
27865
- "交付(Delivery)",
27866
- "激活(Activation)",
27867
- "环境清理(Environment Cleanup)",
27868
- "诊断(Diagnostics)",
27869
- "不得手写 resume token"
27868
+ "四个独立结果",
27869
+ "不得手写 token",
27870
+ "不产生正式生命周期证据"
27870
27871
  ]) {
27871
27872
  if (!skillContent.includes(requiredText5)) problems.push(`task-finish Skill must include ${JSON.stringify(requiredText5)}.`);
27872
27873
  }
@@ -27915,7 +27916,7 @@ ${excerpt}`);
27915
27916
  if (!(skill.requires || []).some((item) => item.capability === "buildr.task-record" && item.version === 2 && item.mode === "required")) problems.push("task-retrospective must require buildr.task-record@2.");
27916
27917
  }
27917
27918
  if (skill.id === "task-triage") {
27918
- for (const requiredText5 of ["## 2. 两轴决策", "`code-only`", "`spec-maintenance`", "`change-flow`", "`blocked`", "Repository set", "`implementation`", "`metadata-only`", "`unknown`", "`buildr.task-record/v2`", "待办意向", "todo create", "Formal Task Record本身不是编辑、构建或有界测试的通用工作许可", "首次受管效果前取得`ready`", "`buildr.git-operations/v1`", "从 Parent 规划项启动独立 Child Task", "初始不引用Parent Change", "Child execution root中创建该独立目标自己的窄Change", "新正式 Task 创建前收敛统一 dev 基线", "`fetch` operation", "`rebase` operation", "`rebase --abort`", "Git 基线:converged / none / blocked", "`buildr.current-knowledge-maintenance/v2`", "`buildr.task-environment/v1`", "`maintain`", "`change-required`", "provider 不 ready", "selected `buildr.task-development/v2` provider", "selected `buildr.task-verification/v3` provider", "不预设 minimal/affected/candidate 层级", "## 4. 输出契约"]) {
27919
+ for (const requiredText5 of ["## 2. 两轴决策", "`code-only`", "`spec-maintenance`", "`change-flow`", "`blocked`", "Repository set", "`implementation`", "`metadata-only`", "`unknown`", "`buildr.task-record/v2`", "待办意向", "todo create", "Formal Task Record本身不是编辑、构建或有界测试的通用工作许可", "首次受管效果前取得`ready`", "`buildr.git-operations/v1`", "从 Parent 规划项启动独立 Child Task", "初始不引用Parent Change", "Child execution root中创建该独立目标自己的窄Change", "新正式 Task 创建前收敛逐 repository 权威基线", "`fetch` operation", "`rebase` operation", "`rebase --abort`", "Git 基线:converged / none / blocked", "`buildr.current-knowledge-maintenance/v2`", "`buildr.task-environment/v1`", "`maintain`", "`change-required`", "provider 不 ready", "selected `buildr.task-development/v2` provider", "selected `buildr.task-verification/v3` provider", "不预设 minimal/affected/candidate 层级", "## 4. 输出契约"]) {
27919
27920
  if (!skillContent.includes(requiredText5)) problems.push(`task-triage Skill must include ${JSON.stringify(requiredText5)}.`);
27920
27921
  }
27921
27922
  if (!(skill.requires || []).some((item) => item.capability === "buildr.task-record" && item.version === 2 && item.mode === "optional")) problems.push("task-triage must optionally require buildr.task-record@2.");
@@ -37628,6 +37629,42 @@ function registerTaskVerificationApplication(runtime2) {
37628
37629
  function declarationValues(observations) {
37629
37630
  return observations.map(({ project, path: declarationPath, identity: identity7 }) => ({ project, path: declarationPath, identity: identity7 }));
37630
37631
  }
37632
+ function aggregateFormalPlanPreparation(effectiveProjects, byProject) {
37633
+ const documents = effectiveProjects.map((project) => ({ project, result: byProject.get(project)?.result || null }));
37634
+ if (documents.some((entry) => !entry.result?.preparation)) return null;
37635
+ const requirements = [];
37636
+ const baseRequests = [];
37637
+ for (const { project, result: result5 } of documents) {
37638
+ const preparation = result5.preparation;
37639
+ if (preparation.status === "action-required" && !preparation.planRequest) throw taskVerificationError("task_verification_policy_preparation_request_missing", `Formal Plan preparation缺少Plan Request:${project}。`, 409, { project });
37640
+ if (preparation.planRequest) {
37641
+ assertFields4(preparation.planRequest, /* @__PURE__ */ new Set(["schemaVersion", "notApplicableReason", "projects", "auxiliaryPreparation"]), `formalPlans.${project}.preparation.planRequest`);
37642
+ if (preparation.planRequest.schemaVersion !== "buildr.task-environment-plan-request/v1" || !Array.isArray(preparation.planRequest.projects)) throw taskVerificationError("task_verification_policy_preparation_request_invalid", `Formal Plan preparation Plan Request不合法:${project}。`, 409, { project });
37643
+ baseRequests.push({ project, request: preparation.planRequest });
37644
+ }
37645
+ for (const [index, requirement] of preparation.requirements.entries()) {
37646
+ assertFields4(requirement, /* @__PURE__ */ new Set(["capability", "capabilityIdentity", "project", "selector", "recipe"]), `formalPlans.${project}.preparation.requirements[${index}]`);
37647
+ if ([requirement.capability, requirement.capabilityIdentity, requirement.project, requirement.selector, requirement.recipe].some((value) => typeof value !== "string" || !value)) throw taskVerificationError("task_verification_policy_preparation_requirement_invalid", `Formal Plan preparation requirement不合法:${project}/${index}。`, 409, { project, index });
37648
+ if (requirement.project !== project) throw taskVerificationError("task_verification_policy_preparation_requirement_project_mismatch", `Formal Plan preparation requirement Project不匹配:${project}/${requirement.project}。`, 409, { project, actualProject: requirement.project });
37649
+ requirements.push(requirement);
37650
+ }
37651
+ }
37652
+ const uniqueRequirements = [...new Map(requirements.sort((left, right) => JSON.stringify(left).localeCompare(JSON.stringify(right))).map((item) => [`${item.capabilityIdentity}/${item.project}/${item.selector}/${item.recipe}`, item])).values()];
37653
+ if (!baseRequests.length) return { status: "ready", identity: digest3({ projects: effectiveProjects, requirements: uniqueRequirements }), requirements: uniqueRequirements, planRequest: null };
37654
+ const base = baseRequests[0].request;
37655
+ const baseIdentity = JSON.stringify({ projects: base.projects, ...base.notApplicableReason ? { notApplicableReason: base.notApplicableReason } : {} });
37656
+ for (const entry of baseRequests.slice(1)) {
37657
+ const actual = JSON.stringify({ projects: entry.request.projects, ...entry.request.notApplicableReason ? { notApplicableReason: entry.request.notApplicableReason } : {} });
37658
+ if (actual !== baseIdentity) throw taskVerificationError("task_verification_policy_preparation_base_mismatch", `Formal Plan preparation base scopes不一致:${entry.project}。`, 409, { project: entry.project });
37659
+ }
37660
+ const planRequest = {
37661
+ schemaVersion: "buildr.task-environment-plan-request/v1",
37662
+ ...base.notApplicableReason ? { notApplicableReason: base.notApplicableReason } : {},
37663
+ projects: structuredClone(base.projects),
37664
+ auxiliaryPreparation: uniqueRequirements.map((item) => ({ ...item }))
37665
+ };
37666
+ return { status: "action-required", identity: digest3({ projects: effectiveProjects, requirements: uniqueRequirements, planRequest }), requirements: uniqueRequirements, planRequest };
37667
+ }
37631
37668
  function deriveTaskVerificationPolicyInput(targetRoot, taskId2, input2) {
37632
37669
  assertFields4(input2, /* @__PURE__ */ new Set(["targetIdentity", "formalPlans", "declarationRoot"]), "Task Verification policy projection");
37633
37670
  const targetIdentity = currentTarget2(input2.targetIdentity);
@@ -37658,13 +37695,13 @@ function registerTaskVerificationApplication(runtime2) {
37658
37695
  if (typeof entry.project !== "string" || !entry.project.trim()) throw taskVerificationError("task_verification_policy_plan_project_invalid", `formalPlans[${index}].project必须是非空字符串。`, 400);
37659
37696
  const project = entry.project.trim();
37660
37697
  if (byProject.has(project)) throw taskVerificationError("task_verification_policy_plan_project_duplicate", `Formal Plan Project重复:${project}。`, 400, { project });
37661
- let plan2;
37698
+ let document;
37662
37699
  try {
37663
- plan2 = assertVerificationPlanDocument(entry.document).plan;
37700
+ document = assertVerificationPlanDocument(entry.document);
37664
37701
  } catch (error3) {
37665
37702
  throw taskVerificationError("task_verification_policy_plan_invalid", `Formal Plan不可用:${project}:${error3.message}`, 400, { project });
37666
37703
  }
37667
- byProject.set(project, plan2);
37704
+ byProject.set(project, document);
37668
37705
  }
37669
37706
  const actualProjects = [...byProject.keys()].sort((left, right) => left.localeCompare(right));
37670
37707
  if (JSON.stringify(actualProjects) !== JSON.stringify(effectiveProjects)) {
@@ -37678,7 +37715,7 @@ function registerTaskVerificationApplication(runtime2) {
37678
37715
  for (const project of effectiveProjects) {
37679
37716
  const observation2 = observationByProject.get(project);
37680
37717
  if (!observation2?.valid || !observation2.declaration) throw taskVerificationError("task_verification_declaration_invalid", `Project ${project} verification declaration不可用:${observation2?.diagnostic || "missing"}。`, 409, { project, identity: observation2?.identity || null });
37681
- const plan2 = byProject.get(project);
37718
+ const plan2 = byProject.get(project).plan;
37682
37719
  if (plan2.target.kind !== "task-delivery" || plan2.target.identity !== targetIdentity) {
37683
37720
  throw taskVerificationError("task_verification_policy_plan_target_mismatch", `Formal Plan target不匹配:${project}。`, 409, { project, expectedTarget: targetIdentity, actualTarget: plan2.target });
37684
37721
  }
@@ -37705,6 +37742,7 @@ function registerTaskVerificationApplication(runtime2) {
37705
37742
  if (selectedIds.size === 0 && plan2.coverageGaps.length === 0) throw taskVerificationError("task_verification_policy_plan_empty", `Formal Plan既未选择capability也没有coverage gap:${project}。`, 409, { project });
37706
37743
  plans.push({ project, identity: plan2.identity, requestIdentity: plan2.requestIdentity, status: plan2.status, declarationIdentity: plan2.declarationIdentity });
37707
37744
  }
37745
+ const preparation = aggregateFormalPlanPreparation(effectiveProjects, byProject);
37708
37746
  return {
37709
37747
  schemaVersion: "buildr.task-verification-policy-input-projection/v1",
37710
37748
  operation: "derive-policy",
@@ -37713,6 +37751,7 @@ function registerTaskVerificationApplication(runtime2) {
37713
37751
  targetIdentity,
37714
37752
  inputJson: { capabilities, coverageGaps, overrides: [] },
37715
37753
  selection: { plans, notSelectedCapabilities },
37754
+ preparation,
37716
37755
  diagnostic: null,
37717
37756
  effects: [],
37718
37757
  nextActions: coverageGaps.length ? ["保留Plan coverage gap并由Agent决定修复、补充风险能力或在后续Result中如实对账。"] : []
@@ -37886,7 +37925,8 @@ function registerTaskVerificationApplication(runtime2) {
37886
37925
  const observations = observeDeclarations(task, input2.declarationRoot);
37887
37926
  const observationByProject = new Map(observations.map((item) => [item.project, item]));
37888
37927
  const capabilities = [];
37889
- let planBinding = null;
37928
+ const planBindings = /* @__PURE__ */ new Map();
37929
+ const recordProjects = /* @__PURE__ */ new Set();
37890
37930
  for (const recordId of input2.recordIds) {
37891
37931
  let detail;
37892
37932
  let summary;
@@ -37901,13 +37941,18 @@ function registerTaskVerificationApplication(runtime2) {
37901
37941
  if (summary.schemaVersion !== "buildr.verification-execution-record-summary/v1" || summary.task?.id !== taskId2) throw taskVerificationError("task_verification_evidence_mismatch", `Execution Record Task或schema不匹配:${recordId}。`, 409, { recordId });
37902
37942
  if (!summary.plan?.identity || !summary.plan?.requestIdentity) throw taskVerificationError("task_verification_evidence_plan_missing", `Execution Record未绑定Verification Request/Plan:${recordId}。`, 409, { recordId });
37903
37943
  if (!Array.isArray(summary.plan.executionUnits) || summary.plan.executionUnits.length === 0) throw taskVerificationError("task_verification_evidence_plan_missing", `Execution Record未绑定selected execution unit:${recordId}。`, 409, { recordId });
37904
- if (!planBinding) planBinding = { identity: summary.plan.identity, requestIdentity: summary.plan.requestIdentity, providerIdentity: summary.plan.providerIdentity || null };
37905
- else if (planBinding.identity !== summary.plan.identity || planBinding.requestIdentity !== summary.plan.requestIdentity || planBinding.providerIdentity !== (summary.plan.providerIdentity || null)) throw taskVerificationError("task_verification_evidence_plan_mismatch", `Execution Records不属于同一Verification Request/Plan/provider:${recordId}。`, 409, { recordId, expected: planBinding, actual: summary.plan });
37906
37944
  if (summary.candidate?.identity !== input2.candidateIdentity || summary.candidate?.generation !== input2.candidateGeneration || summary.candidate?.contentTargetIdentity !== input2.targetIdentity || summary.target?.identity !== input2.targetIdentity) throw taskVerificationError("task_verification_evidence_candidate_mismatch", `Execution Record Candidate或Content Target不匹配:${recordId}。`, 409, { recordId });
37907
37945
  if (summary.target?.stable !== true || summary.target?.drift) throw taskVerificationError("task_verification_evidence_target_drift", `Execution Record target发生漂移:${recordId}。`, 409, { recordId });
37908
37946
  const project = summary.project?.code;
37909
37947
  const observation2 = observationByProject.get(project);
37910
37948
  if (!observation2 || observation2.path !== summary.declaration?.path || observation2.identity !== summary.declaration?.identity) throw taskVerificationError("task_verification_evidence_declaration_mismatch", `Execution Record declaration不匹配:${recordId}。`, 409, { recordId, project });
37949
+ const planBinding = { identity: summary.plan.identity, requestIdentity: summary.plan.requestIdentity, providerIdentity: summary.plan.providerIdentity || null };
37950
+ const expectedPlanBinding = planBindings.get(project);
37951
+ if (expectedPlanBinding && (expectedPlanBinding.identity !== planBinding.identity || expectedPlanBinding.requestIdentity !== planBinding.requestIdentity || expectedPlanBinding.providerIdentity !== planBinding.providerIdentity)) {
37952
+ throw taskVerificationError("task_verification_evidence_plan_mismatch", `同一Project的Execution Records不属于同一Verification Request/Plan/provider:${recordId}。`, 409, { recordId, project, expected: expectedPlanBinding, actual: planBinding });
37953
+ }
37954
+ planBindings.set(project, planBinding);
37955
+ recordProjects.add(project);
37911
37956
  const selected = new Map((summary.selectedCapabilities || []).map((item) => [item.id, item]));
37912
37957
  if (!Array.isArray(summary.checks) || summary.checks.length !== selected.size) throw taskVerificationError("task_verification_evidence_incomplete", `Execution Record capability checks不完整:${recordId}。`, 409, { recordId });
37913
37958
  for (const check of summary.checks) {
@@ -37922,6 +37967,14 @@ function registerTaskVerificationApplication(runtime2) {
37922
37967
  }
37923
37968
  }
37924
37969
  const coverageGaps = input2.coverageGaps || [];
37970
+ const coveredProjects = new Set(recordProjects);
37971
+ for (const gap2 of coverageGaps) {
37972
+ const project = gap2.scope?.match(/^project:([^/]+)$/)?.[1];
37973
+ if (project) coveredProjects.add(project);
37974
+ }
37975
+ const effectiveProjects = taskRecordEffectiveProjectCodes(task.record);
37976
+ const missingProjects = effectiveProjects.filter((project) => !coveredProjects.has(project));
37977
+ if (missingProjects.length) throw taskVerificationError("task_verification_evidence_projects_incomplete", "Execution Records与project coverage gaps必须精确覆盖Task有效Project集合。", 409, { expectedProjects: effectiveProjects, actualProjects: [...coveredProjects].sort((left, right) => left.localeCompare(right)), missingProjects });
37925
37978
  const failed = capabilities.some((item) => item.outcome === "failed") || coverageGaps.length > 0;
37926
37979
  const draft = normalizeTaskVerificationResult({
37927
37980
  schemaVersion: "buildr.task-verification-result/v2",
@@ -38850,14 +38903,40 @@ function normalizeDecision(value) {
38850
38903
  }
38851
38904
  function createTaskDevelopmentKnowledge(value) {
38852
38905
  const knowledge2 = object11(value, "currentKnowledge");
38853
- closed12(knowledge2, /* @__PURE__ */ new Set(["identity", "treeIdentity", "status", "summary", "sourceIdentities", "unresolvedItems"]), "currentKnowledge");
38854
- if (!TASK_DEVELOPMENT_KNOWLEDGE_STATUSES.includes(knowledge2.status)) throw taskDevelopmentError("task_development_knowledge_status_invalid", "currentKnowledge.status不受支持。", 400, { status: knowledge2.status });
38906
+ closed12(knowledge2, /* @__PURE__ */ new Set(["identity", "treeIdentity", "status", "summary", "sourceIdentities", "unresolvedItems", "projects"]), "currentKnowledge");
38907
+ if (knowledge2.projects !== void 0 && !Array.isArray(knowledge2.projects)) throw taskDevelopmentError("task_development_field_invalid", "currentKnowledge.projects必须是数组。", 400, { field: "currentKnowledge.projects" });
38908
+ const projects = knowledge2.projects === void 0 ? null : knowledge2.projects.map((value2, index) => {
38909
+ const field = `currentKnowledge.projects[${index}]`;
38910
+ const item = object11(value2, field);
38911
+ closed12(item, /* @__PURE__ */ new Set(["project", "status", "summary", "sourceIdentities", "unresolvedItems"]), field);
38912
+ if (!TASK_DEVELOPMENT_KNOWLEDGE_STATUSES.includes(item.status)) throw taskDevelopmentError("task_development_knowledge_status_invalid", `${field}.status不受支持。`, 400, { status: item.status });
38913
+ const unresolvedItems2 = uniqueStrings(item.unresolvedItems, `${field}.unresolvedItems`);
38914
+ if (item.status === "blocked" && unresolvedItems2.length === 0) throw taskDevelopmentError("task_development_knowledge_blocker_required", `${field} blocked必须包含unresolvedItems。`, 409);
38915
+ return {
38916
+ project: portableText3(item.project, `${field}.project`),
38917
+ status: item.status,
38918
+ summary: portableText3(item.summary, `${field}.summary`),
38919
+ sourceIdentities: uniqueStrings(item.sourceIdentities, `${field}.sourceIdentities`),
38920
+ unresolvedItems: unresolvedItems2
38921
+ };
38922
+ }).sort((left, right) => left.project.localeCompare(right.project));
38923
+ if (projects && new Set(projects.map((item) => item.project)).size !== projects.length) throw taskDevelopmentError("task_development_knowledge_project_duplicate", "currentKnowledge.projects Project不能重复。", 400);
38924
+ const status = projects ? projects.some((item) => item.status === "blocked") ? "blocked" : projects.some((item) => item.status === "attention") ? "attention" : projects.some((item) => item.status === "aligned") ? "aligned" : "not-applicable" : knowledge2.status;
38925
+ if (!TASK_DEVELOPMENT_KNOWLEDGE_STATUSES.includes(status)) throw taskDevelopmentError("task_development_knowledge_status_invalid", "currentKnowledge.status不受支持。", 400, { status });
38926
+ const summary = projects ? `${projects.length}个Project Current Knowledge已聚合:${projects.map((item) => `${item.project}=${item.status}`).join(",")}。` : portableText3(knowledge2.summary, "currentKnowledge.summary");
38927
+ const sourceIdentities = projects ? [...new Set(projects.flatMap((item) => item.sourceIdentities))].sort() : uniqueStrings(knowledge2.sourceIdentities, "currentKnowledge.sourceIdentities");
38928
+ const unresolvedItems = projects ? [...new Set(projects.flatMap((item) => item.unresolvedItems))].sort() : uniqueStrings(knowledge2.unresolvedItems, "currentKnowledge.unresolvedItems");
38929
+ if (projects && knowledge2.status !== void 0 && knowledge2.status !== status) throw taskDevelopmentError("task_development_knowledge_aggregate_mismatch", "currentKnowledge.status与Project dispositions聚合不一致。", 409, { expected: status, actual: knowledge2.status });
38930
+ if (projects && knowledge2.summary !== void 0 && knowledge2.summary !== summary) throw taskDevelopmentError("task_development_knowledge_aggregate_mismatch", "currentKnowledge.summary与Project dispositions聚合不一致。", 409);
38931
+ if (projects && knowledge2.sourceIdentities !== void 0 && JSON.stringify([...knowledge2.sourceIdentities].sort()) !== JSON.stringify(sourceIdentities)) throw taskDevelopmentError("task_development_knowledge_aggregate_mismatch", "currentKnowledge.sourceIdentities与Project dispositions聚合不一致。", 409);
38932
+ if (projects && knowledge2.unresolvedItems !== void 0 && JSON.stringify([...knowledge2.unresolvedItems].sort()) !== JSON.stringify(unresolvedItems)) throw taskDevelopmentError("task_development_knowledge_aggregate_mismatch", "currentKnowledge.unresolvedItems与Project dispositions聚合不一致。", 409);
38855
38933
  const payload2 = {
38856
38934
  treeIdentity: digestIdentity(knowledge2.treeIdentity, "currentKnowledge.treeIdentity"),
38857
- status: knowledge2.status,
38858
- summary: portableText3(knowledge2.summary, "currentKnowledge.summary"),
38859
- sourceIdentities: uniqueStrings(knowledge2.sourceIdentities, "currentKnowledge.sourceIdentities"),
38860
- unresolvedItems: uniqueStrings(knowledge2.unresolvedItems, "currentKnowledge.unresolvedItems")
38935
+ status,
38936
+ summary,
38937
+ sourceIdentities,
38938
+ unresolvedItems,
38939
+ ...projects ? { projects } : {}
38861
38940
  };
38862
38941
  const identity7 = taskDevelopmentDigest(payload2);
38863
38942
  if (knowledge2.identity !== void 0) assertDerivedIdentity(knowledge2.identity, identity7, "currentKnowledge.identity");
@@ -39235,7 +39314,14 @@ var init_task_development_operation_contracts = __esm({
39235
39314
  status: { type: "string", enum: ["aligned", "not-applicable", "attention", "blocked"] },
39236
39315
  summary: text15(),
39237
39316
  sourceIdentities: array2(text15()),
39238
- unresolvedItems: array2(text15())
39317
+ unresolvedItems: array2(text15()),
39318
+ projects: array2(closed14({
39319
+ project: text15("Task有效Project code。"),
39320
+ status: { type: "string", enum: ["aligned", "not-applicable", "attention", "blocked"] },
39321
+ summary: text15(),
39322
+ sourceIdentities: array2(text15()),
39323
+ unresolvedItems: array2(text15())
39324
+ }, ["project", "status", "summary", "sourceIdentities", "unresolvedItems"]))
39239
39325
  };
39240
39326
  risk = closed14({
39241
39327
  gate: { type: "string", enum: ["verification", "completion"] },
@@ -39309,8 +39395,8 @@ var init_task_development_operation_contracts = __esm({
39309
39395
  },
39310
39396
  knowledge: {
39311
39397
  summary: "保存selected Current Knowledge provider针对current Content Target的最小disposition。",
39312
- inputSchema: inputSchema(knowledge, ["treeIdentity", "status", "summary", "sourceIdentities", "unresolvedItems"]),
39313
- example: { treeIdentity: "sha256-<content-target>", status: "aligned", summary: "<knowledge-summary>", sourceIdentities: [], unresolvedItems: [] }
39398
+ inputSchema: inputSchema(knowledge, ["treeIdentity"]),
39399
+ example: { treeIdentity: "sha256-<content-target>", projects: [{ project: "<project>", status: "aligned", summary: "<knowledge-summary>", sourceIdentities: [], unresolvedItems: [] }] }
39314
39400
  },
39315
39401
  gate: {
39316
39402
  summary: "记录 planning、verification 或 completion gate 的明确 waiver/not-applicable disposition。",
@@ -39972,6 +40058,12 @@ function registerTaskDevelopmentApplication(runtime2) {
39972
40058
  const persistence7 = runtime2.readTaskDevelopmentPersistence(targetRoot, taskId2, { optional: false });
39973
40059
  const observed = observeCurrent(targetRoot, taskId2, persistence7.receipt);
39974
40060
  if (!observed.target || observed.target.identity !== persistence7.receipt.contentTarget?.identity || input2.treeIdentity !== observed.target.identity) throw taskDevelopmentError("task_development_knowledge_target_mismatch", "knowledge disposition必须绑定current Content Target。", 409, { expected: observed.target?.identity || null, actual: input2.treeIdentity });
40061
+ const effectiveProjects = taskRecordEffectiveProjectCodes(observed.inspected.record);
40062
+ if (effectiveProjects.length > 1 && !Array.isArray(input2.projects)) throw taskDevelopmentError("task_development_knowledge_projects_required", "多Project Task的knowledge disposition必须按Project完整提交。", 409, { expectedProjects: effectiveProjects });
40063
+ if (Array.isArray(input2.projects)) {
40064
+ const actualProjects = input2.projects.map((item) => item?.project).sort((left, right) => String(left).localeCompare(String(right)));
40065
+ if (!same2(actualProjects, effectiveProjects)) throw taskDevelopmentError("task_development_knowledge_projects_incomplete", "Current Knowledge Project dispositions必须精确覆盖Task有效Project集合。", 409, { expectedProjects: effectiveProjects, actualProjects });
40066
+ }
39975
40067
  const currentKnowledge = createTaskDevelopmentKnowledge(input2);
39976
40068
  const receipt = normalizeTaskDevelopmentReceipt({ ...persistence7.receipt, currentKnowledge, gates: observed.gates, decision: null, updatedAt: now2() }, { expectedTaskId: taskId2 });
39977
40069
  const written = writeDevelopment(targetRoot, taskId2, persistence7.receipt, receipt);
@@ -42976,6 +43068,13 @@ function observeTaskFinishEntryReadiness({
42976
43068
  pushGap(gaps, gap("delivery", error3.code || "task_finish.reconciliation_context_unavailable", error3.message, error3.details ? { details: error3.details } : {}));
42977
43069
  context2 = null;
42978
43070
  }
43071
+ } else if (environmentReady && allowEnvironmentless && resolved.current && (context2.repositories || []).length === 0) {
43072
+ try {
43073
+ const fallback = resolveTaskFinishReconciliationContext({ runtime: runtime2, root, task, receipt: resolved.receipt, requestedTargetBranch, requestedRemote });
43074
+ repositories = fallback.repositories;
43075
+ } catch (error3) {
43076
+ pushGap(gaps, gap("delivery", error3.code || "task_finish.reconciliation_context_unavailable", error3.message, error3.details ? { details: error3.details } : {}));
43077
+ }
42979
43078
  } else if (environmentReady) {
42980
43079
  repositories = resolveRepositoryPlans({ context: context2, requestedTargetBranch, requestedRemote, gaps });
42981
43080
  }
@@ -28534,6 +28534,42 @@ function registerTaskVerificationApplication(runtime) {
28534
28534
  function declarationValues(observations) {
28535
28535
  return observations.map(({ project, path: declarationPath, identity: identity7 }) => ({ project, path: declarationPath, identity: identity7 }));
28536
28536
  }
28537
+ function aggregateFormalPlanPreparation(effectiveProjects, byProject) {
28538
+ const documents = effectiveProjects.map((project) => ({ project, result: byProject.get(project)?.result || null }));
28539
+ if (documents.some((entry) => !entry.result?.preparation)) return null;
28540
+ const requirements = [];
28541
+ const baseRequests = [];
28542
+ for (const { project, result: result5 } of documents) {
28543
+ const preparation = result5.preparation;
28544
+ if (preparation.status === "action-required" && !preparation.planRequest) throw taskVerificationError("task_verification_policy_preparation_request_missing", `Formal Plan preparation缺少Plan Request:${project}。`, 409, { project });
28545
+ if (preparation.planRequest) {
28546
+ assertFields4(preparation.planRequest, /* @__PURE__ */ new Set(["schemaVersion", "notApplicableReason", "projects", "auxiliaryPreparation"]), `formalPlans.${project}.preparation.planRequest`);
28547
+ if (preparation.planRequest.schemaVersion !== "buildr.task-environment-plan-request/v1" || !Array.isArray(preparation.planRequest.projects)) throw taskVerificationError("task_verification_policy_preparation_request_invalid", `Formal Plan preparation Plan Request不合法:${project}。`, 409, { project });
28548
+ baseRequests.push({ project, request: preparation.planRequest });
28549
+ }
28550
+ for (const [index, requirement] of preparation.requirements.entries()) {
28551
+ assertFields4(requirement, /* @__PURE__ */ new Set(["capability", "capabilityIdentity", "project", "selector", "recipe"]), `formalPlans.${project}.preparation.requirements[${index}]`);
28552
+ if ([requirement.capability, requirement.capabilityIdentity, requirement.project, requirement.selector, requirement.recipe].some((value) => typeof value !== "string" || !value)) throw taskVerificationError("task_verification_policy_preparation_requirement_invalid", `Formal Plan preparation requirement不合法:${project}/${index}。`, 409, { project, index });
28553
+ if (requirement.project !== project) throw taskVerificationError("task_verification_policy_preparation_requirement_project_mismatch", `Formal Plan preparation requirement Project不匹配:${project}/${requirement.project}。`, 409, { project, actualProject: requirement.project });
28554
+ requirements.push(requirement);
28555
+ }
28556
+ }
28557
+ const uniqueRequirements = [...new Map(requirements.sort((left, right) => JSON.stringify(left).localeCompare(JSON.stringify(right))).map((item) => [`${item.capabilityIdentity}/${item.project}/${item.selector}/${item.recipe}`, item])).values()];
28558
+ if (!baseRequests.length) return { status: "ready", identity: digest4({ projects: effectiveProjects, requirements: uniqueRequirements }), requirements: uniqueRequirements, planRequest: null };
28559
+ const base = baseRequests[0].request;
28560
+ const baseIdentity = JSON.stringify({ projects: base.projects, ...base.notApplicableReason ? { notApplicableReason: base.notApplicableReason } : {} });
28561
+ for (const entry of baseRequests.slice(1)) {
28562
+ const actual = JSON.stringify({ projects: entry.request.projects, ...entry.request.notApplicableReason ? { notApplicableReason: entry.request.notApplicableReason } : {} });
28563
+ if (actual !== baseIdentity) throw taskVerificationError("task_verification_policy_preparation_base_mismatch", `Formal Plan preparation base scopes不一致:${entry.project}。`, 409, { project: entry.project });
28564
+ }
28565
+ const planRequest = {
28566
+ schemaVersion: "buildr.task-environment-plan-request/v1",
28567
+ ...base.notApplicableReason ? { notApplicableReason: base.notApplicableReason } : {},
28568
+ projects: structuredClone(base.projects),
28569
+ auxiliaryPreparation: uniqueRequirements.map((item) => ({ ...item }))
28570
+ };
28571
+ return { status: "action-required", identity: digest4({ projects: effectiveProjects, requirements: uniqueRequirements, planRequest }), requirements: uniqueRequirements, planRequest };
28572
+ }
28537
28573
  function deriveTaskVerificationPolicyInput(targetRoot, taskId2, input2) {
28538
28574
  assertFields4(input2, /* @__PURE__ */ new Set(["targetIdentity", "formalPlans", "declarationRoot"]), "Task Verification policy projection");
28539
28575
  const targetIdentity = currentTarget2(input2.targetIdentity);
@@ -28564,13 +28600,13 @@ function registerTaskVerificationApplication(runtime) {
28564
28600
  if (typeof entry.project !== "string" || !entry.project.trim()) throw taskVerificationError("task_verification_policy_plan_project_invalid", `formalPlans[${index}].project必须是非空字符串。`, 400);
28565
28601
  const project = entry.project.trim();
28566
28602
  if (byProject.has(project)) throw taskVerificationError("task_verification_policy_plan_project_duplicate", `Formal Plan Project重复:${project}。`, 400, { project });
28567
- let plan2;
28603
+ let document;
28568
28604
  try {
28569
- plan2 = assertVerificationPlanDocument(entry.document).plan;
28605
+ document = assertVerificationPlanDocument(entry.document);
28570
28606
  } catch (error3) {
28571
28607
  throw taskVerificationError("task_verification_policy_plan_invalid", `Formal Plan不可用:${project}:${error3.message}`, 400, { project });
28572
28608
  }
28573
- byProject.set(project, plan2);
28609
+ byProject.set(project, document);
28574
28610
  }
28575
28611
  const actualProjects = [...byProject.keys()].sort((left, right) => left.localeCompare(right));
28576
28612
  if (JSON.stringify(actualProjects) !== JSON.stringify(effectiveProjects)) {
@@ -28584,7 +28620,7 @@ function registerTaskVerificationApplication(runtime) {
28584
28620
  for (const project of effectiveProjects) {
28585
28621
  const observation2 = observationByProject.get(project);
28586
28622
  if (!observation2?.valid || !observation2.declaration) throw taskVerificationError("task_verification_declaration_invalid", `Project ${project} verification declaration不可用:${observation2?.diagnostic || "missing"}。`, 409, { project, identity: observation2?.identity || null });
28587
- const plan2 = byProject.get(project);
28623
+ const plan2 = byProject.get(project).plan;
28588
28624
  if (plan2.target.kind !== "task-delivery" || plan2.target.identity !== targetIdentity) {
28589
28625
  throw taskVerificationError("task_verification_policy_plan_target_mismatch", `Formal Plan target不匹配:${project}。`, 409, { project, expectedTarget: targetIdentity, actualTarget: plan2.target });
28590
28626
  }
@@ -28611,6 +28647,7 @@ function registerTaskVerificationApplication(runtime) {
28611
28647
  if (selectedIds.size === 0 && plan2.coverageGaps.length === 0) throw taskVerificationError("task_verification_policy_plan_empty", `Formal Plan既未选择capability也没有coverage gap:${project}。`, 409, { project });
28612
28648
  plans.push({ project, identity: plan2.identity, requestIdentity: plan2.requestIdentity, status: plan2.status, declarationIdentity: plan2.declarationIdentity });
28613
28649
  }
28650
+ const preparation = aggregateFormalPlanPreparation(effectiveProjects, byProject);
28614
28651
  return {
28615
28652
  schemaVersion: "buildr.task-verification-policy-input-projection/v1",
28616
28653
  operation: "derive-policy",
@@ -28619,6 +28656,7 @@ function registerTaskVerificationApplication(runtime) {
28619
28656
  targetIdentity,
28620
28657
  inputJson: { capabilities, coverageGaps, overrides: [] },
28621
28658
  selection: { plans, notSelectedCapabilities },
28659
+ preparation,
28622
28660
  diagnostic: null,
28623
28661
  effects: [],
28624
28662
  nextActions: coverageGaps.length ? ["保留Plan coverage gap并由Agent决定修复、补充风险能力或在后续Result中如实对账。"] : []
@@ -28792,7 +28830,8 @@ function registerTaskVerificationApplication(runtime) {
28792
28830
  const observations = observeDeclarations(task, input2.declarationRoot);
28793
28831
  const observationByProject = new Map(observations.map((item) => [item.project, item]));
28794
28832
  const capabilities = [];
28795
- let planBinding = null;
28833
+ const planBindings = /* @__PURE__ */ new Map();
28834
+ const recordProjects = /* @__PURE__ */ new Set();
28796
28835
  for (const recordId of input2.recordIds) {
28797
28836
  let detail;
28798
28837
  let summary;
@@ -28807,13 +28846,18 @@ function registerTaskVerificationApplication(runtime) {
28807
28846
  if (summary.schemaVersion !== "buildr.verification-execution-record-summary/v1" || summary.task?.id !== taskId2) throw taskVerificationError("task_verification_evidence_mismatch", `Execution Record Task或schema不匹配:${recordId}。`, 409, { recordId });
28808
28847
  if (!summary.plan?.identity || !summary.plan?.requestIdentity) throw taskVerificationError("task_verification_evidence_plan_missing", `Execution Record未绑定Verification Request/Plan:${recordId}。`, 409, { recordId });
28809
28848
  if (!Array.isArray(summary.plan.executionUnits) || summary.plan.executionUnits.length === 0) throw taskVerificationError("task_verification_evidence_plan_missing", `Execution Record未绑定selected execution unit:${recordId}。`, 409, { recordId });
28810
- if (!planBinding) planBinding = { identity: summary.plan.identity, requestIdentity: summary.plan.requestIdentity, providerIdentity: summary.plan.providerIdentity || null };
28811
- else if (planBinding.identity !== summary.plan.identity || planBinding.requestIdentity !== summary.plan.requestIdentity || planBinding.providerIdentity !== (summary.plan.providerIdentity || null)) throw taskVerificationError("task_verification_evidence_plan_mismatch", `Execution Records不属于同一Verification Request/Plan/provider:${recordId}。`, 409, { recordId, expected: planBinding, actual: summary.plan });
28812
28849
  if (summary.candidate?.identity !== input2.candidateIdentity || summary.candidate?.generation !== input2.candidateGeneration || summary.candidate?.contentTargetIdentity !== input2.targetIdentity || summary.target?.identity !== input2.targetIdentity) throw taskVerificationError("task_verification_evidence_candidate_mismatch", `Execution Record Candidate或Content Target不匹配:${recordId}。`, 409, { recordId });
28813
28850
  if (summary.target?.stable !== true || summary.target?.drift) throw taskVerificationError("task_verification_evidence_target_drift", `Execution Record target发生漂移:${recordId}。`, 409, { recordId });
28814
28851
  const project = summary.project?.code;
28815
28852
  const observation2 = observationByProject.get(project);
28816
28853
  if (!observation2 || observation2.path !== summary.declaration?.path || observation2.identity !== summary.declaration?.identity) throw taskVerificationError("task_verification_evidence_declaration_mismatch", `Execution Record declaration不匹配:${recordId}。`, 409, { recordId, project });
28854
+ const planBinding = { identity: summary.plan.identity, requestIdentity: summary.plan.requestIdentity, providerIdentity: summary.plan.providerIdentity || null };
28855
+ const expectedPlanBinding = planBindings.get(project);
28856
+ if (expectedPlanBinding && (expectedPlanBinding.identity !== planBinding.identity || expectedPlanBinding.requestIdentity !== planBinding.requestIdentity || expectedPlanBinding.providerIdentity !== planBinding.providerIdentity)) {
28857
+ throw taskVerificationError("task_verification_evidence_plan_mismatch", `同一Project的Execution Records不属于同一Verification Request/Plan/provider:${recordId}。`, 409, { recordId, project, expected: expectedPlanBinding, actual: planBinding });
28858
+ }
28859
+ planBindings.set(project, planBinding);
28860
+ recordProjects.add(project);
28817
28861
  const selected = new Map((summary.selectedCapabilities || []).map((item) => [item.id, item]));
28818
28862
  if (!Array.isArray(summary.checks) || summary.checks.length !== selected.size) throw taskVerificationError("task_verification_evidence_incomplete", `Execution Record capability checks不完整:${recordId}。`, 409, { recordId });
28819
28863
  for (const check of summary.checks) {
@@ -28828,6 +28872,14 @@ function registerTaskVerificationApplication(runtime) {
28828
28872
  }
28829
28873
  }
28830
28874
  const coverageGaps = input2.coverageGaps || [];
28875
+ const coveredProjects = new Set(recordProjects);
28876
+ for (const gap2 of coverageGaps) {
28877
+ const project = gap2.scope?.match(/^project:([^/]+)$/)?.[1];
28878
+ if (project) coveredProjects.add(project);
28879
+ }
28880
+ const effectiveProjects = taskRecordEffectiveProjectCodes(task.record);
28881
+ const missingProjects = effectiveProjects.filter((project) => !coveredProjects.has(project));
28882
+ if (missingProjects.length) throw taskVerificationError("task_verification_evidence_projects_incomplete", "Execution Records与project coverage gaps必须精确覆盖Task有效Project集合。", 409, { expectedProjects: effectiveProjects, actualProjects: [...coveredProjects].sort((left, right) => left.localeCompare(right)), missingProjects });
28831
28883
  const failed = capabilities.some((item) => item.outcome === "failed") || coverageGaps.length > 0;
28832
28884
  const draft = normalizeTaskVerificationResult({
28833
28885
  schemaVersion: "buildr.task-verification-result/v2",
@@ -29756,14 +29808,40 @@ function normalizeDecision(value) {
29756
29808
  }
29757
29809
  function createTaskDevelopmentKnowledge(value) {
29758
29810
  const knowledge2 = object11(value, "currentKnowledge");
29759
- closed13(knowledge2, /* @__PURE__ */ new Set(["identity", "treeIdentity", "status", "summary", "sourceIdentities", "unresolvedItems"]), "currentKnowledge");
29760
- if (!TASK_DEVELOPMENT_KNOWLEDGE_STATUSES.includes(knowledge2.status)) throw taskDevelopmentError("task_development_knowledge_status_invalid", "currentKnowledge.status不受支持。", 400, { status: knowledge2.status });
29811
+ closed13(knowledge2, /* @__PURE__ */ new Set(["identity", "treeIdentity", "status", "summary", "sourceIdentities", "unresolvedItems", "projects"]), "currentKnowledge");
29812
+ if (knowledge2.projects !== void 0 && !Array.isArray(knowledge2.projects)) throw taskDevelopmentError("task_development_field_invalid", "currentKnowledge.projects必须是数组。", 400, { field: "currentKnowledge.projects" });
29813
+ const projects = knowledge2.projects === void 0 ? null : knowledge2.projects.map((value2, index) => {
29814
+ const field = `currentKnowledge.projects[${index}]`;
29815
+ const item = object11(value2, field);
29816
+ closed13(item, /* @__PURE__ */ new Set(["project", "status", "summary", "sourceIdentities", "unresolvedItems"]), field);
29817
+ if (!TASK_DEVELOPMENT_KNOWLEDGE_STATUSES.includes(item.status)) throw taskDevelopmentError("task_development_knowledge_status_invalid", `${field}.status不受支持。`, 400, { status: item.status });
29818
+ const unresolvedItems2 = uniqueStrings(item.unresolvedItems, `${field}.unresolvedItems`);
29819
+ if (item.status === "blocked" && unresolvedItems2.length === 0) throw taskDevelopmentError("task_development_knowledge_blocker_required", `${field} blocked必须包含unresolvedItems。`, 409);
29820
+ return {
29821
+ project: portableText3(item.project, `${field}.project`),
29822
+ status: item.status,
29823
+ summary: portableText3(item.summary, `${field}.summary`),
29824
+ sourceIdentities: uniqueStrings(item.sourceIdentities, `${field}.sourceIdentities`),
29825
+ unresolvedItems: unresolvedItems2
29826
+ };
29827
+ }).sort((left, right) => left.project.localeCompare(right.project));
29828
+ if (projects && new Set(projects.map((item) => item.project)).size !== projects.length) throw taskDevelopmentError("task_development_knowledge_project_duplicate", "currentKnowledge.projects Project不能重复。", 400);
29829
+ const status = projects ? projects.some((item) => item.status === "blocked") ? "blocked" : projects.some((item) => item.status === "attention") ? "attention" : projects.some((item) => item.status === "aligned") ? "aligned" : "not-applicable" : knowledge2.status;
29830
+ if (!TASK_DEVELOPMENT_KNOWLEDGE_STATUSES.includes(status)) throw taskDevelopmentError("task_development_knowledge_status_invalid", "currentKnowledge.status不受支持。", 400, { status });
29831
+ const summary = projects ? `${projects.length}个Project Current Knowledge已聚合:${projects.map((item) => `${item.project}=${item.status}`).join(",")}。` : portableText3(knowledge2.summary, "currentKnowledge.summary");
29832
+ const sourceIdentities = projects ? [...new Set(projects.flatMap((item) => item.sourceIdentities))].sort() : uniqueStrings(knowledge2.sourceIdentities, "currentKnowledge.sourceIdentities");
29833
+ const unresolvedItems = projects ? [...new Set(projects.flatMap((item) => item.unresolvedItems))].sort() : uniqueStrings(knowledge2.unresolvedItems, "currentKnowledge.unresolvedItems");
29834
+ if (projects && knowledge2.status !== void 0 && knowledge2.status !== status) throw taskDevelopmentError("task_development_knowledge_aggregate_mismatch", "currentKnowledge.status与Project dispositions聚合不一致。", 409, { expected: status, actual: knowledge2.status });
29835
+ if (projects && knowledge2.summary !== void 0 && knowledge2.summary !== summary) throw taskDevelopmentError("task_development_knowledge_aggregate_mismatch", "currentKnowledge.summary与Project dispositions聚合不一致。", 409);
29836
+ if (projects && knowledge2.sourceIdentities !== void 0 && JSON.stringify([...knowledge2.sourceIdentities].sort()) !== JSON.stringify(sourceIdentities)) throw taskDevelopmentError("task_development_knowledge_aggregate_mismatch", "currentKnowledge.sourceIdentities与Project dispositions聚合不一致。", 409);
29837
+ if (projects && knowledge2.unresolvedItems !== void 0 && JSON.stringify([...knowledge2.unresolvedItems].sort()) !== JSON.stringify(unresolvedItems)) throw taskDevelopmentError("task_development_knowledge_aggregate_mismatch", "currentKnowledge.unresolvedItems与Project dispositions聚合不一致。", 409);
29761
29838
  const payload2 = {
29762
29839
  treeIdentity: digestIdentity(knowledge2.treeIdentity, "currentKnowledge.treeIdentity"),
29763
- status: knowledge2.status,
29764
- summary: portableText3(knowledge2.summary, "currentKnowledge.summary"),
29765
- sourceIdentities: uniqueStrings(knowledge2.sourceIdentities, "currentKnowledge.sourceIdentities"),
29766
- unresolvedItems: uniqueStrings(knowledge2.unresolvedItems, "currentKnowledge.unresolvedItems")
29840
+ status,
29841
+ summary,
29842
+ sourceIdentities,
29843
+ unresolvedItems,
29844
+ ...projects ? { projects } : {}
29767
29845
  };
29768
29846
  const identity7 = taskDevelopmentDigest(payload2);
29769
29847
  if (knowledge2.identity !== void 0) assertDerivedIdentity(knowledge2.identity, identity7, "currentKnowledge.identity");
@@ -30141,7 +30219,14 @@ var init_task_development_operation_contracts = __esm({
30141
30219
  status: { type: "string", enum: ["aligned", "not-applicable", "attention", "blocked"] },
30142
30220
  summary: text16(),
30143
30221
  sourceIdentities: array2(text16()),
30144
- unresolvedItems: array2(text16())
30222
+ unresolvedItems: array2(text16()),
30223
+ projects: array2(closed15({
30224
+ project: text16("Task有效Project code。"),
30225
+ status: { type: "string", enum: ["aligned", "not-applicable", "attention", "blocked"] },
30226
+ summary: text16(),
30227
+ sourceIdentities: array2(text16()),
30228
+ unresolvedItems: array2(text16())
30229
+ }, ["project", "status", "summary", "sourceIdentities", "unresolvedItems"]))
30145
30230
  };
30146
30231
  risk = closed15({
30147
30232
  gate: { type: "string", enum: ["verification", "completion"] },
@@ -30215,8 +30300,8 @@ var init_task_development_operation_contracts = __esm({
30215
30300
  },
30216
30301
  knowledge: {
30217
30302
  summary: "保存selected Current Knowledge provider针对current Content Target的最小disposition。",
30218
- inputSchema: inputSchema(knowledge, ["treeIdentity", "status", "summary", "sourceIdentities", "unresolvedItems"]),
30219
- example: { treeIdentity: "sha256-<content-target>", status: "aligned", summary: "<knowledge-summary>", sourceIdentities: [], unresolvedItems: [] }
30303
+ inputSchema: inputSchema(knowledge, ["treeIdentity"]),
30304
+ example: { treeIdentity: "sha256-<content-target>", projects: [{ project: "<project>", status: "aligned", summary: "<knowledge-summary>", sourceIdentities: [], unresolvedItems: [] }] }
30220
30305
  },
30221
30306
  gate: {
30222
30307
  summary: "记录 planning、verification 或 completion gate 的明确 waiver/not-applicable disposition。",
@@ -30878,6 +30963,12 @@ function registerTaskDevelopmentApplication(runtime) {
30878
30963
  const persistence7 = runtime.readTaskDevelopmentPersistence(targetRoot, taskId2, { optional: false });
30879
30964
  const observed = observeCurrent(targetRoot, taskId2, persistence7.receipt);
30880
30965
  if (!observed.target || observed.target.identity !== persistence7.receipt.contentTarget?.identity || input2.treeIdentity !== observed.target.identity) throw taskDevelopmentError("task_development_knowledge_target_mismatch", "knowledge disposition必须绑定current Content Target。", 409, { expected: observed.target?.identity || null, actual: input2.treeIdentity });
30966
+ const effectiveProjects = taskRecordEffectiveProjectCodes(observed.inspected.record);
30967
+ if (effectiveProjects.length > 1 && !Array.isArray(input2.projects)) throw taskDevelopmentError("task_development_knowledge_projects_required", "多Project Task的knowledge disposition必须按Project完整提交。", 409, { expectedProjects: effectiveProjects });
30968
+ if (Array.isArray(input2.projects)) {
30969
+ const actualProjects = input2.projects.map((item) => item?.project).sort((left, right) => String(left).localeCompare(String(right)));
30970
+ if (!same2(actualProjects, effectiveProjects)) throw taskDevelopmentError("task_development_knowledge_projects_incomplete", "Current Knowledge Project dispositions必须精确覆盖Task有效Project集合。", 409, { expectedProjects: effectiveProjects, actualProjects });
30971
+ }
30881
30972
  const currentKnowledge = createTaskDevelopmentKnowledge(input2);
30882
30973
  const receipt = normalizeTaskDevelopmentReceipt({ ...persistence7.receipt, currentKnowledge, gates: observed.gates, decision: null, updatedAt: now2() }, { expectedTaskId: taskId2 });
30883
30974
  const written = writeDevelopment(targetRoot, taskId2, persistence7.receipt, receipt);
@@ -33882,6 +33973,13 @@ function observeTaskFinishEntryReadiness({
33882
33973
  pushGap(gaps, gap("delivery", error3.code || "task_finish.reconciliation_context_unavailable", error3.message, error3.details ? { details: error3.details } : {}));
33883
33974
  context2 = null;
33884
33975
  }
33976
+ } else if (environmentReady && allowEnvironmentless && resolved.current && (context2.repositories || []).length === 0) {
33977
+ try {
33978
+ const fallback = resolveTaskFinishReconciliationContext({ runtime, root, task, receipt: resolved.receipt, requestedTargetBranch, requestedRemote });
33979
+ repositories = fallback.repositories;
33980
+ } catch (error3) {
33981
+ pushGap(gaps, gap("delivery", error3.code || "task_finish.reconciliation_context_unavailable", error3.message, error3.details ? { details: error3.details } : {}));
33982
+ }
33885
33983
  } else if (environmentReady) {
33886
33984
  repositories = resolveRepositoryPlans({ context: context2, requestedTargetBranch, requestedRemote, gaps });
33887
33985
  }
@@ -51654,16 +51752,17 @@ ${excerpt}`);
51654
51752
  if (skill.id === "task-finish") {
51655
51753
  for (const requiredText5 of [
51656
51754
  "buildr.task-finish/v1",
51755
+ "完整“收尾/交付”意图",
51756
+ "正式 Task 路径",
51757
+ "普通 Git 路径",
51758
+ "buildr task next",
51657
51759
  "current Development handoff",
51658
51760
  "preflight → prepare → verify → deliver → cleanup",
51659
51761
  "交付适配(Delivery Adaptation)",
51660
- "Agent 直接交付",
51661
51762
  "task finish reconcile",
51662
- "交付(Delivery)",
51663
- "激活(Activation)",
51664
- "环境清理(Environment Cleanup)",
51665
- "诊断(Diagnostics)",
51666
- "不得手写 resume token"
51763
+ "四个独立结果",
51764
+ "不得手写 token",
51765
+ "不产生正式生命周期证据"
51667
51766
  ]) {
51668
51767
  if (!skillContent.includes(requiredText5)) problems.push(`task-finish Skill must include ${JSON.stringify(requiredText5)}.`);
51669
51768
  }
@@ -51712,7 +51811,7 @@ ${excerpt}`);
51712
51811
  if (!(skill.requires || []).some((item) => item.capability === "buildr.task-record" && item.version === 2 && item.mode === "required")) problems.push("task-retrospective must require buildr.task-record@2.");
51713
51812
  }
51714
51813
  if (skill.id === "task-triage") {
51715
- for (const requiredText5 of ["## 2. 两轴决策", "`code-only`", "`spec-maintenance`", "`change-flow`", "`blocked`", "Repository set", "`implementation`", "`metadata-only`", "`unknown`", "`buildr.task-record/v2`", "待办意向", "todo create", "Formal Task Record本身不是编辑、构建或有界测试的通用工作许可", "首次受管效果前取得`ready`", "`buildr.git-operations/v1`", "从 Parent 规划项启动独立 Child Task", "初始不引用Parent Change", "Child execution root中创建该独立目标自己的窄Change", "新正式 Task 创建前收敛统一 dev 基线", "`fetch` operation", "`rebase` operation", "`rebase --abort`", "Git 基线:converged / none / blocked", "`buildr.current-knowledge-maintenance/v2`", "`buildr.task-environment/v1`", "`maintain`", "`change-required`", "provider 不 ready", "selected `buildr.task-development/v2` provider", "selected `buildr.task-verification/v3` provider", "不预设 minimal/affected/candidate 层级", "## 4. 输出契约"]) {
51814
+ for (const requiredText5 of ["## 2. 两轴决策", "`code-only`", "`spec-maintenance`", "`change-flow`", "`blocked`", "Repository set", "`implementation`", "`metadata-only`", "`unknown`", "`buildr.task-record/v2`", "待办意向", "todo create", "Formal Task Record本身不是编辑、构建或有界测试的通用工作许可", "首次受管效果前取得`ready`", "`buildr.git-operations/v1`", "从 Parent 规划项启动独立 Child Task", "初始不引用Parent Change", "Child execution root中创建该独立目标自己的窄Change", "新正式 Task 创建前收敛逐 repository 权威基线", "`fetch` operation", "`rebase` operation", "`rebase --abort`", "Git 基线:converged / none / blocked", "`buildr.current-knowledge-maintenance/v2`", "`buildr.task-environment/v1`", "`maintain`", "`change-required`", "provider 不 ready", "selected `buildr.task-development/v2` provider", "selected `buildr.task-verification/v3` provider", "不预设 minimal/affected/candidate 层级", "## 4. 输出契约"]) {
51716
51815
  if (!skillContent.includes(requiredText5)) problems.push(`task-triage Skill must include ${JSON.stringify(requiredText5)}.`);
51717
51816
  }
51718
51817
  if (!(skill.requires || []).some((item) => item.capability === "buildr.task-record" && item.version === 2 && item.mode === "optional")) problems.push("task-triage must optionally require buildr.task-record@2.");