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

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.27",
5
5
  "protocolIdentity": "buildr.web-protocol/v1",
6
- "sourceCommit": "46158e982bcd405b18eb60152462458a12855345",
6
+ "sourceCommit": "0c69ec993c958ca3a8dc98089897cc031c346d48",
7
7
  "enginesNode": ">=24.15.0 <25",
8
8
  "productionDependencies": [
9
9
  {
@@ -54,7 +54,7 @@
54
54
  "path": "resources/product/package.json",
55
55
  "mode": 420,
56
56
  "size": 769,
57
- "sha256": "a2ae471618eefddf861ce20236e8fdd9f57d45468b3ddd38f6f676431289cd21"
57
+ "sha256": "983326699d33365a177c89b3965d29c42a3fbaf4ba304b7deef3dfff20707829"
58
58
  },
59
59
  {
60
60
  "path": "resources/product/package/targets/runtime/skills/buildr/SKILL.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": 7754,
261
+ "sha256": "bcee67d7abe425e46f22fad7ccaba3aea0594c262bb5e10f80de50db1ee07116"
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": 3666202,
603
+ "sha256": "edbfb01f75a0199bc2f0ff1d0514ef85b44fc21771ae94c0e2e5b3e1a77e4103"
604
604
  },
605
605
  {
606
606
  "path": "runtime/buildr.cjs",
607
607
  "mode": 420,
608
- "size": 3719112,
609
- "sha256": "4c3b941d84c6aa1729dffa03088a8704676803cceafe9a807269177a1d60e3ac"
608
+ "size": 3729336,
609
+ "sha256": "46575d0a7890eeb707b8638e94033b8e3fa4130cc76a8b744293cafb62511dde"
610
610
  }
611
611
  ],
612
- "applicationPayloadDigest": "sha256-6d898f5c79ce2247f5e93bf80f0f103b5910a1ba2dadd239192a5bce09e4eeb4"
612
+ "applicationPayloadDigest": "sha256-296436ee7feeb1d94106866b691ca60e6e468f244951f84e2aa8cd0edc1c9051"
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.27",
7
7
  "protocolIdentity": "buildr.web-protocol/v1",
8
- "applicationPayloadDigest": "sha256-6d898f5c79ce2247f5e93bf80f0f103b5910a1ba2dadd239192a5bce09e4eeb4",
9
- "sourceCommit": "46158e982bcd405b18eb60152462458a12855345",
8
+ "applicationPayloadDigest": "sha256-296436ee7feeb1d94106866b691ca60e6e468f244951f84e2aa8cd0edc1c9051",
9
+ "sourceCommit": "0c69ec993c958ca3a8dc98089897cc031c346d48",
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.27",
12
+ "ownershipIdentity": "sha256-ddb932c4991f25475e15f1f8d73915f87c498af378fa2d3b46227c3e46f9f421"
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.27",
4
4
  "description": "Buildr CLI for managing Agent workspace assets.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -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.27",
4
4
  "description": "Buildr CLI for managing Agent workspace assets.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -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或混入风险列表。
@@ -48,7 +48,7 @@ Agent 可通过 Git Operations、PR 或其他已授权方式推进代码;每
48
48
 
49
49
  `buildr task finish reconcile --task <task-id> --target <canonical-workspace> --detail compact --json`
50
50
 
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。
51
+ 交付对账(Delivery Reconciliation)不接受调用方提交“已成功”、commit 列表或证明文件。它优先复用current Environment;Environment不存在、已清理、局部不可用,或ready shared placement没有provider repository set时,从current immutable handoff、Task scope、Project/Service registries、实际Git topology以及明确或唯一的remote/target构造只读delivery context,不恢复或补造Receipt。ready shared Environment仍保留自己的cleanup availability;该fallback不供自动Finish创建carrier。reconciliation逐repository确认carrier已到达、已被后继包含,或目标tree精确包含任务贡献结果;无法证明时只报告对应repository的事实缺口,并保留其他repository已经登记的Delivery checkpoint。
52
52
 
53
53
  ## 四个独立结果
54
54
 
@@ -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。
@@ -27915,7 +27915,7 @@ ${excerpt}`);
27915
27915
  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
27916
  }
27917
27917
  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. 输出契约"]) {
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 创建前收敛逐 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
27919
  if (!skillContent.includes(requiredText5)) problems.push(`task-triage Skill must include ${JSON.stringify(requiredText5)}.`);
27920
27920
  }
27921
27921
  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 +37628,42 @@ function registerTaskVerificationApplication(runtime2) {
37628
37628
  function declarationValues(observations) {
37629
37629
  return observations.map(({ project, path: declarationPath, identity: identity7 }) => ({ project, path: declarationPath, identity: identity7 }));
37630
37630
  }
37631
+ function aggregateFormalPlanPreparation(effectiveProjects, byProject) {
37632
+ const documents = effectiveProjects.map((project) => ({ project, result: byProject.get(project)?.result || null }));
37633
+ if (documents.some((entry) => !entry.result?.preparation)) return null;
37634
+ const requirements = [];
37635
+ const baseRequests = [];
37636
+ for (const { project, result: result5 } of documents) {
37637
+ const preparation = result5.preparation;
37638
+ if (preparation.status === "action-required" && !preparation.planRequest) throw taskVerificationError("task_verification_policy_preparation_request_missing", `Formal Plan preparation缺少Plan Request:${project}。`, 409, { project });
37639
+ if (preparation.planRequest) {
37640
+ assertFields4(preparation.planRequest, /* @__PURE__ */ new Set(["schemaVersion", "notApplicableReason", "projects", "auxiliaryPreparation"]), `formalPlans.${project}.preparation.planRequest`);
37641
+ 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 });
37642
+ baseRequests.push({ project, request: preparation.planRequest });
37643
+ }
37644
+ for (const [index, requirement] of preparation.requirements.entries()) {
37645
+ assertFields4(requirement, /* @__PURE__ */ new Set(["capability", "capabilityIdentity", "project", "selector", "recipe"]), `formalPlans.${project}.preparation.requirements[${index}]`);
37646
+ 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 });
37647
+ 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 });
37648
+ requirements.push(requirement);
37649
+ }
37650
+ }
37651
+ 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()];
37652
+ if (!baseRequests.length) return { status: "ready", identity: digest3({ projects: effectiveProjects, requirements: uniqueRequirements }), requirements: uniqueRequirements, planRequest: null };
37653
+ const base = baseRequests[0].request;
37654
+ const baseIdentity = JSON.stringify({ projects: base.projects, ...base.notApplicableReason ? { notApplicableReason: base.notApplicableReason } : {} });
37655
+ for (const entry of baseRequests.slice(1)) {
37656
+ const actual = JSON.stringify({ projects: entry.request.projects, ...entry.request.notApplicableReason ? { notApplicableReason: entry.request.notApplicableReason } : {} });
37657
+ if (actual !== baseIdentity) throw taskVerificationError("task_verification_policy_preparation_base_mismatch", `Formal Plan preparation base scopes不一致:${entry.project}。`, 409, { project: entry.project });
37658
+ }
37659
+ const planRequest = {
37660
+ schemaVersion: "buildr.task-environment-plan-request/v1",
37661
+ ...base.notApplicableReason ? { notApplicableReason: base.notApplicableReason } : {},
37662
+ projects: structuredClone(base.projects),
37663
+ auxiliaryPreparation: uniqueRequirements.map((item) => ({ ...item }))
37664
+ };
37665
+ return { status: "action-required", identity: digest3({ projects: effectiveProjects, requirements: uniqueRequirements, planRequest }), requirements: uniqueRequirements, planRequest };
37666
+ }
37631
37667
  function deriveTaskVerificationPolicyInput(targetRoot, taskId2, input2) {
37632
37668
  assertFields4(input2, /* @__PURE__ */ new Set(["targetIdentity", "formalPlans", "declarationRoot"]), "Task Verification policy projection");
37633
37669
  const targetIdentity = currentTarget2(input2.targetIdentity);
@@ -37658,13 +37694,13 @@ function registerTaskVerificationApplication(runtime2) {
37658
37694
  if (typeof entry.project !== "string" || !entry.project.trim()) throw taskVerificationError("task_verification_policy_plan_project_invalid", `formalPlans[${index}].project必须是非空字符串。`, 400);
37659
37695
  const project = entry.project.trim();
37660
37696
  if (byProject.has(project)) throw taskVerificationError("task_verification_policy_plan_project_duplicate", `Formal Plan Project重复:${project}。`, 400, { project });
37661
- let plan2;
37697
+ let document;
37662
37698
  try {
37663
- plan2 = assertVerificationPlanDocument(entry.document).plan;
37699
+ document = assertVerificationPlanDocument(entry.document);
37664
37700
  } catch (error3) {
37665
37701
  throw taskVerificationError("task_verification_policy_plan_invalid", `Formal Plan不可用:${project}:${error3.message}`, 400, { project });
37666
37702
  }
37667
- byProject.set(project, plan2);
37703
+ byProject.set(project, document);
37668
37704
  }
37669
37705
  const actualProjects = [...byProject.keys()].sort((left, right) => left.localeCompare(right));
37670
37706
  if (JSON.stringify(actualProjects) !== JSON.stringify(effectiveProjects)) {
@@ -37678,7 +37714,7 @@ function registerTaskVerificationApplication(runtime2) {
37678
37714
  for (const project of effectiveProjects) {
37679
37715
  const observation2 = observationByProject.get(project);
37680
37716
  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);
37717
+ const plan2 = byProject.get(project).plan;
37682
37718
  if (plan2.target.kind !== "task-delivery" || plan2.target.identity !== targetIdentity) {
37683
37719
  throw taskVerificationError("task_verification_policy_plan_target_mismatch", `Formal Plan target不匹配:${project}。`, 409, { project, expectedTarget: targetIdentity, actualTarget: plan2.target });
37684
37720
  }
@@ -37705,6 +37741,7 @@ function registerTaskVerificationApplication(runtime2) {
37705
37741
  if (selectedIds.size === 0 && plan2.coverageGaps.length === 0) throw taskVerificationError("task_verification_policy_plan_empty", `Formal Plan既未选择capability也没有coverage gap:${project}。`, 409, { project });
37706
37742
  plans.push({ project, identity: plan2.identity, requestIdentity: plan2.requestIdentity, status: plan2.status, declarationIdentity: plan2.declarationIdentity });
37707
37743
  }
37744
+ const preparation = aggregateFormalPlanPreparation(effectiveProjects, byProject);
37708
37745
  return {
37709
37746
  schemaVersion: "buildr.task-verification-policy-input-projection/v1",
37710
37747
  operation: "derive-policy",
@@ -37713,6 +37750,7 @@ function registerTaskVerificationApplication(runtime2) {
37713
37750
  targetIdentity,
37714
37751
  inputJson: { capabilities, coverageGaps, overrides: [] },
37715
37752
  selection: { plans, notSelectedCapabilities },
37753
+ preparation,
37716
37754
  diagnostic: null,
37717
37755
  effects: [],
37718
37756
  nextActions: coverageGaps.length ? ["保留Plan coverage gap并由Agent决定修复、补充风险能力或在后续Result中如实对账。"] : []
@@ -37886,7 +37924,8 @@ function registerTaskVerificationApplication(runtime2) {
37886
37924
  const observations = observeDeclarations(task, input2.declarationRoot);
37887
37925
  const observationByProject = new Map(observations.map((item) => [item.project, item]));
37888
37926
  const capabilities = [];
37889
- let planBinding = null;
37927
+ const planBindings = /* @__PURE__ */ new Map();
37928
+ const recordProjects = /* @__PURE__ */ new Set();
37890
37929
  for (const recordId of input2.recordIds) {
37891
37930
  let detail;
37892
37931
  let summary;
@@ -37901,13 +37940,18 @@ function registerTaskVerificationApplication(runtime2) {
37901
37940
  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
37941
  if (!summary.plan?.identity || !summary.plan?.requestIdentity) throw taskVerificationError("task_verification_evidence_plan_missing", `Execution Record未绑定Verification Request/Plan:${recordId}。`, 409, { recordId });
37903
37942
  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
37943
  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
37944
  if (summary.target?.stable !== true || summary.target?.drift) throw taskVerificationError("task_verification_evidence_target_drift", `Execution Record target发生漂移:${recordId}。`, 409, { recordId });
37908
37945
  const project = summary.project?.code;
37909
37946
  const observation2 = observationByProject.get(project);
37910
37947
  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 });
37948
+ const planBinding = { identity: summary.plan.identity, requestIdentity: summary.plan.requestIdentity, providerIdentity: summary.plan.providerIdentity || null };
37949
+ const expectedPlanBinding = planBindings.get(project);
37950
+ if (expectedPlanBinding && (expectedPlanBinding.identity !== planBinding.identity || expectedPlanBinding.requestIdentity !== planBinding.requestIdentity || expectedPlanBinding.providerIdentity !== planBinding.providerIdentity)) {
37951
+ throw taskVerificationError("task_verification_evidence_plan_mismatch", `同一Project的Execution Records不属于同一Verification Request/Plan/provider:${recordId}。`, 409, { recordId, project, expected: expectedPlanBinding, actual: planBinding });
37952
+ }
37953
+ planBindings.set(project, planBinding);
37954
+ recordProjects.add(project);
37911
37955
  const selected = new Map((summary.selectedCapabilities || []).map((item) => [item.id, item]));
37912
37956
  if (!Array.isArray(summary.checks) || summary.checks.length !== selected.size) throw taskVerificationError("task_verification_evidence_incomplete", `Execution Record capability checks不完整:${recordId}。`, 409, { recordId });
37913
37957
  for (const check of summary.checks) {
@@ -37922,6 +37966,14 @@ function registerTaskVerificationApplication(runtime2) {
37922
37966
  }
37923
37967
  }
37924
37968
  const coverageGaps = input2.coverageGaps || [];
37969
+ const coveredProjects = new Set(recordProjects);
37970
+ for (const gap2 of coverageGaps) {
37971
+ const project = gap2.scope?.match(/^project:([^/]+)$/)?.[1];
37972
+ if (project) coveredProjects.add(project);
37973
+ }
37974
+ const effectiveProjects = taskRecordEffectiveProjectCodes(task.record);
37975
+ const missingProjects = effectiveProjects.filter((project) => !coveredProjects.has(project));
37976
+ 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
37977
  const failed = capabilities.some((item) => item.outcome === "failed") || coverageGaps.length > 0;
37926
37978
  const draft = normalizeTaskVerificationResult({
37927
37979
  schemaVersion: "buildr.task-verification-result/v2",
@@ -38850,14 +38902,40 @@ function normalizeDecision(value) {
38850
38902
  }
38851
38903
  function createTaskDevelopmentKnowledge(value) {
38852
38904
  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 });
38905
+ closed12(knowledge2, /* @__PURE__ */ new Set(["identity", "treeIdentity", "status", "summary", "sourceIdentities", "unresolvedItems", "projects"]), "currentKnowledge");
38906
+ if (knowledge2.projects !== void 0 && !Array.isArray(knowledge2.projects)) throw taskDevelopmentError("task_development_field_invalid", "currentKnowledge.projects必须是数组。", 400, { field: "currentKnowledge.projects" });
38907
+ const projects = knowledge2.projects === void 0 ? null : knowledge2.projects.map((value2, index) => {
38908
+ const field = `currentKnowledge.projects[${index}]`;
38909
+ const item = object11(value2, field);
38910
+ closed12(item, /* @__PURE__ */ new Set(["project", "status", "summary", "sourceIdentities", "unresolvedItems"]), field);
38911
+ if (!TASK_DEVELOPMENT_KNOWLEDGE_STATUSES.includes(item.status)) throw taskDevelopmentError("task_development_knowledge_status_invalid", `${field}.status不受支持。`, 400, { status: item.status });
38912
+ const unresolvedItems2 = uniqueStrings(item.unresolvedItems, `${field}.unresolvedItems`);
38913
+ if (item.status === "blocked" && unresolvedItems2.length === 0) throw taskDevelopmentError("task_development_knowledge_blocker_required", `${field} blocked必须包含unresolvedItems。`, 409);
38914
+ return {
38915
+ project: portableText3(item.project, `${field}.project`),
38916
+ status: item.status,
38917
+ summary: portableText3(item.summary, `${field}.summary`),
38918
+ sourceIdentities: uniqueStrings(item.sourceIdentities, `${field}.sourceIdentities`),
38919
+ unresolvedItems: unresolvedItems2
38920
+ };
38921
+ }).sort((left, right) => left.project.localeCompare(right.project));
38922
+ if (projects && new Set(projects.map((item) => item.project)).size !== projects.length) throw taskDevelopmentError("task_development_knowledge_project_duplicate", "currentKnowledge.projects Project不能重复。", 400);
38923
+ 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;
38924
+ if (!TASK_DEVELOPMENT_KNOWLEDGE_STATUSES.includes(status)) throw taskDevelopmentError("task_development_knowledge_status_invalid", "currentKnowledge.status不受支持。", 400, { status });
38925
+ const summary = projects ? `${projects.length}个Project Current Knowledge已聚合:${projects.map((item) => `${item.project}=${item.status}`).join(",")}。` : portableText3(knowledge2.summary, "currentKnowledge.summary");
38926
+ const sourceIdentities = projects ? [...new Set(projects.flatMap((item) => item.sourceIdentities))].sort() : uniqueStrings(knowledge2.sourceIdentities, "currentKnowledge.sourceIdentities");
38927
+ const unresolvedItems = projects ? [...new Set(projects.flatMap((item) => item.unresolvedItems))].sort() : uniqueStrings(knowledge2.unresolvedItems, "currentKnowledge.unresolvedItems");
38928
+ 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 });
38929
+ if (projects && knowledge2.summary !== void 0 && knowledge2.summary !== summary) throw taskDevelopmentError("task_development_knowledge_aggregate_mismatch", "currentKnowledge.summary与Project dispositions聚合不一致。", 409);
38930
+ 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);
38931
+ 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
38932
  const payload2 = {
38856
38933
  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")
38934
+ status,
38935
+ summary,
38936
+ sourceIdentities,
38937
+ unresolvedItems,
38938
+ ...projects ? { projects } : {}
38861
38939
  };
38862
38940
  const identity7 = taskDevelopmentDigest(payload2);
38863
38941
  if (knowledge2.identity !== void 0) assertDerivedIdentity(knowledge2.identity, identity7, "currentKnowledge.identity");
@@ -39235,7 +39313,14 @@ var init_task_development_operation_contracts = __esm({
39235
39313
  status: { type: "string", enum: ["aligned", "not-applicable", "attention", "blocked"] },
39236
39314
  summary: text15(),
39237
39315
  sourceIdentities: array2(text15()),
39238
- unresolvedItems: array2(text15())
39316
+ unresolvedItems: array2(text15()),
39317
+ projects: array2(closed14({
39318
+ project: text15("Task有效Project code。"),
39319
+ status: { type: "string", enum: ["aligned", "not-applicable", "attention", "blocked"] },
39320
+ summary: text15(),
39321
+ sourceIdentities: array2(text15()),
39322
+ unresolvedItems: array2(text15())
39323
+ }, ["project", "status", "summary", "sourceIdentities", "unresolvedItems"]))
39239
39324
  };
39240
39325
  risk = closed14({
39241
39326
  gate: { type: "string", enum: ["verification", "completion"] },
@@ -39309,8 +39394,8 @@ var init_task_development_operation_contracts = __esm({
39309
39394
  },
39310
39395
  knowledge: {
39311
39396
  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: [] }
39397
+ inputSchema: inputSchema(knowledge, ["treeIdentity"]),
39398
+ example: { treeIdentity: "sha256-<content-target>", projects: [{ project: "<project>", status: "aligned", summary: "<knowledge-summary>", sourceIdentities: [], unresolvedItems: [] }] }
39314
39399
  },
39315
39400
  gate: {
39316
39401
  summary: "记录 planning、verification 或 completion gate 的明确 waiver/not-applicable disposition。",
@@ -39972,6 +40057,12 @@ function registerTaskDevelopmentApplication(runtime2) {
39972
40057
  const persistence7 = runtime2.readTaskDevelopmentPersistence(targetRoot, taskId2, { optional: false });
39973
40058
  const observed = observeCurrent(targetRoot, taskId2, persistence7.receipt);
39974
40059
  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 });
40060
+ const effectiveProjects = taskRecordEffectiveProjectCodes(observed.inspected.record);
40061
+ if (effectiveProjects.length > 1 && !Array.isArray(input2.projects)) throw taskDevelopmentError("task_development_knowledge_projects_required", "多Project Task的knowledge disposition必须按Project完整提交。", 409, { expectedProjects: effectiveProjects });
40062
+ if (Array.isArray(input2.projects)) {
40063
+ const actualProjects = input2.projects.map((item) => item?.project).sort((left, right) => String(left).localeCompare(String(right)));
40064
+ if (!same2(actualProjects, effectiveProjects)) throw taskDevelopmentError("task_development_knowledge_projects_incomplete", "Current Knowledge Project dispositions必须精确覆盖Task有效Project集合。", 409, { expectedProjects: effectiveProjects, actualProjects });
40065
+ }
39975
40066
  const currentKnowledge = createTaskDevelopmentKnowledge(input2);
39976
40067
  const receipt = normalizeTaskDevelopmentReceipt({ ...persistence7.receipt, currentKnowledge, gates: observed.gates, decision: null, updatedAt: now2() }, { expectedTaskId: taskId2 });
39977
40068
  const written = writeDevelopment(targetRoot, taskId2, persistence7.receipt, receipt);
@@ -42976,6 +43067,13 @@ function observeTaskFinishEntryReadiness({
42976
43067
  pushGap(gaps, gap("delivery", error3.code || "task_finish.reconciliation_context_unavailable", error3.message, error3.details ? { details: error3.details } : {}));
42977
43068
  context2 = null;
42978
43069
  }
43070
+ } else if (environmentReady && allowEnvironmentless && resolved.current && (context2.repositories || []).length === 0) {
43071
+ try {
43072
+ const fallback = resolveTaskFinishReconciliationContext({ runtime: runtime2, root, task, receipt: resolved.receipt, requestedTargetBranch, requestedRemote });
43073
+ repositories = fallback.repositories;
43074
+ } catch (error3) {
43075
+ pushGap(gaps, gap("delivery", error3.code || "task_finish.reconciliation_context_unavailable", error3.message, error3.details ? { details: error3.details } : {}));
43076
+ }
42979
43077
  } else if (environmentReady) {
42980
43078
  repositories = resolveRepositoryPlans({ context: context2, requestedTargetBranch, requestedRemote, gaps });
42981
43079
  }
@@ -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
  }
@@ -51712,7 +51810,7 @@ ${excerpt}`);
51712
51810
  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
51811
  }
51714
51812
  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. 输出契约"]) {
51813
+ 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
51814
  if (!skillContent.includes(requiredText5)) problems.push(`task-triage Skill must include ${JSON.stringify(requiredText5)}.`);
51717
51815
  }
51718
51816
  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.");