@kungfu-tech/buildchain 4.0.9 → 4.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1536) hide show
  1. package/AGENTS.md +35 -5
  2. package/CONTRIBUTING.md +18 -29
  3. package/README.md +55 -29
  4. package/actions/build/artifact/prepare-attestation/README.md +26 -0
  5. package/actions/build/artifact/seal-attestation/README.md +26 -0
  6. package/actions/build/lifecycle/run/README.md +71 -0
  7. package/actions/build/lifecycle/validate/README.md +52 -0
  8. package/actions/governance/incident/report/README.md +107 -0
  9. package/actions/release/promotion/ref/README.md +92 -0
  10. package/architecture/action-taxonomy.json +543 -0
  11. package/architecture/agent-change-map.md +2061 -431
  12. package/architecture/build-environments.json +18 -2
  13. package/architecture/build-orchestration.json +58 -9
  14. package/architecture/capability-state-machine-manifest.json +15 -16
  15. package/architecture/capability-state-machine-manifest.schema.json +2 -2
  16. package/architecture/ci-lane-change-budget.json +2105 -225
  17. package/architecture/code-layout.json +55 -0
  18. package/architecture/core-mechanisms.json +1160 -0
  19. package/architecture/cross-platform-adopter-qualification.json +4 -14
  20. package/architecture/delivery-authority-parity.json +46 -46
  21. package/architecture/delivery-warrant-shadow-bootstrap-plan.json +4 -4
  22. package/architecture/delivery-warrant-shadow-bootstrap-plan.md +3 -3
  23. package/architecture/dev-delivery-orchestration.json +175 -0
  24. package/architecture/floating-consumer-policy.json +15 -11
  25. package/architecture/history/warrant-shadow-observations.json +900 -0
  26. package/architecture/internal-capabilities.json +2332 -358
  27. package/architecture/layered-transition.json +32 -0
  28. package/architecture/maintainability-debt.json +883 -1840
  29. package/architecture/maintainability-policy.json +63 -1438
  30. package/architecture/partial-mutation-recovery-qualification.json +4 -4
  31. package/architecture/platform-stage-checkpoints.json +1 -1
  32. package/architecture/promotion-job-topology.json +85 -0
  33. package/architecture/provider-operation-journal-contract.json +5 -5
  34. package/architecture/publication-facade-patches.json +5 -5
  35. package/architecture/release-activation-shadow-domain.json +4 -4
  36. package/architecture/release-invocation-fixtures.json +31 -16
  37. package/architecture/release-tail-contract-inventory.json +1 -9
  38. package/architecture/release-tail-contract.json +273 -0
  39. package/architecture/release-topology.json +245 -215
  40. package/architecture/runtime-ref-resume-authority.json +1 -1
  41. package/architecture/runtime-semantic-closure.json +27 -17
  42. package/architecture/rust-libnode-bridge-evaluation.json +1 -1
  43. package/architecture/rust-wasm-production-authority.json +7 -7
  44. package/architecture/stable-publication-fence.json +4 -4
  45. package/architecture/stage-capsule-qualification.json +4 -4
  46. package/architecture/stage-capsule-resume-planner.json +1 -1
  47. package/architecture/stage-capsule-store-contract.json +2 -2
  48. package/architecture/tail-reseal-parity.json +22 -17
  49. package/architecture/universal-workflow-bootstrap.json +121 -102
  50. package/architecture/universal-workflow-fault-campaign.json +11 -11
  51. package/architecture/universal-workflow-train-admission.json +44 -8
  52. package/architecture/workflow-taxonomy.json +81 -798
  53. package/bin/buildchain.mjs +2 -1820
  54. package/contracts/buildchain-v2-residuals-v1.json +2 -138
  55. package/contracts/dev-delivery-authority-v2.schema.json +509 -231
  56. package/contracts/fixtures/v4-tail-reseal-v1/valid.json +1 -1
  57. package/contracts/promotion-invocation-v1.schema.json +547 -0
  58. package/contracts/promotion-request-v1.schema.json +472 -0
  59. package/contracts/v4-adopter-delivery-v1.schema.json +1 -1
  60. package/contracts/v4-compatibility-facts-v1.schema.json +4 -4
  61. package/contracts/v4-floating-consumer-policy-receipt-v1.schema.json +124 -21
  62. package/contracts/v4-release-invocation-v1.schema.json +1 -1
  63. package/crates/buildchain-host-bridge/src/main.rs +1 -1
  64. package/dist/site/buildchain-contract.json +145 -2206
  65. package/dist/site/buildchain-site.json +350 -326
  66. package/dist/site/capability-registry.json +17 -17
  67. package/dist/site/cli-registry.json +354 -365
  68. package/dist/site/controller-registry.json +142 -715
  69. package/dist/site/kfd-claims.json +5871 -3138
  70. package/dist/site/kfd-upstream-aggregate.json +1 -1
  71. package/dist/site/manual-registry.json +26 -26
  72. package/dist/site/node-api-registry.json +12561 -16063
  73. package/dist/site/page-registry.json +312 -292
  74. package/dist/site/public-surface-audit.json +3844 -3601
  75. package/dist/site/publication-authority-registry.json +295 -1117
  76. package/dist/site/publication-registry.json +5 -5
  77. package/dist/site/release-provenance.json +80 -90
  78. package/dist/site/schemas/dev-delivery-authority-v2.schema.json +509 -231
  79. package/dist/site/schemas/v4-adopter-delivery-v1.schema.json +1 -1
  80. package/dist/site/schemas/v4-compatibility-facts-v1.schema.json +4 -4
  81. package/dist/site/site-manifest.json +31 -31
  82. package/dist/site/workflow-registry.json +7274 -5321
  83. package/docs/MAP.md +8 -6
  84. package/docs/auditable-demo.md +4 -4
  85. package/docs/aws-us-elastic-runner-burst-plane.md +5 -5
  86. package/docs/binary-distribution.md +2 -2
  87. package/docs/bootstrap-recovery.md +50 -0
  88. package/docs/cli-reference.md +2 -35
  89. package/docs/cli.md +6 -6
  90. package/docs/code-organization.md +131 -0
  91. package/docs/consumer-issue-reporting.md +1 -1
  92. package/docs/dev-alpha-candidate-patrol.md +1 -1
  93. package/docs/dev-delivery-orchestration.md +116 -0
  94. package/docs/dev-delivery-qualification-landing-adr.md +1 -1
  95. package/docs/dev-delivery-warrant.md +5 -2
  96. package/docs/dev-qualification-patrol.md +1 -1
  97. package/docs/engineering-housekeeper.md +3 -3
  98. package/docs/github-artifact-attestation.md +3 -3
  99. package/docs/kfd-support.md +1 -1
  100. package/docs/lifecycle-protocol.md +8 -8
  101. package/docs/migration-inventory.md +6 -6
  102. package/docs/next-development-transition.md +4 -4
  103. package/docs/node-api-reference.md +2273 -2644
  104. package/docs/ownership.md +3 -3
  105. package/docs/publication-artifacts.md +5 -5
  106. package/docs/publication-authority.md +4 -4
  107. package/docs/publish-transaction.md +10 -10
  108. package/docs/release-activation-transaction.md +1 -1
  109. package/docs/release-candidate.md +4 -4
  110. package/docs/release-governance.md +25 -25
  111. package/docs/release-passport.md +2 -2
  112. package/docs/release-promotion-request.md +64 -0
  113. package/docs/release-propagation.md +19 -18
  114. package/docs/release-tail-contract.md +40 -76
  115. package/docs/release-tail-provider-plane.md +17 -26
  116. package/docs/reusable-build-surface.md +34 -21
  117. package/docs/shifu-gate-profiles.md +4 -4
  118. package/docs/site-bundle-contract.md +1 -1
  119. package/docs/stable-candidate-patrol.md +1 -1
  120. package/docs/v4-adopter-delivery.md +50 -121
  121. package/docs/v4-canonical-contracts.md +3 -3
  122. package/docs/v4-compatibility-facts.md +1 -1
  123. package/docs/v4-declarative-release-tail-migration.md +24 -29
  124. package/docs/v4-production-release.md +16 -1
  125. package/docs/v4-publication-rehearsal.md +1 -1
  126. package/docs/v4-runtime-ref-resume-authority.md +2 -2
  127. package/docs/v4-rust-wasm-production-authority.md +2 -2
  128. package/docs/v4-stage-capsule.md +1 -1
  129. package/docs/web-surface-deployments.md +22 -28
  130. package/docs/workflow-catalog.md +82 -127
  131. package/docs/workflow-path-migration.md +1 -5
  132. package/package.json +99 -102
  133. package/packages/core/README.md +41 -164
  134. package/packages/core/adoption/adopter-delivery-parity.js +219 -0
  135. package/packages/core/adoption/adopter-delivery.js +210 -0
  136. package/packages/core/adoption/buildchain-kfd-claims.js +733 -0
  137. package/packages/core/adoption/cli/delivery.mjs +39 -0
  138. package/packages/core/adoption/cli/dispatch.mjs +5 -0
  139. package/packages/core/adoption/cli/kfd-aggregate.mjs +20 -0
  140. package/packages/core/adoption/cli/kfd-hub.mjs +53 -0
  141. package/packages/core/adoption/cli/kfd-migrate-layout.mjs +27 -0
  142. package/packages/core/adoption/cli/kfd-schema.mjs +55 -0
  143. package/packages/core/adoption/cli/kfd-status.mjs +21 -0
  144. package/packages/core/adoption/cli/kfd-upstream.mjs +69 -0
  145. package/packages/core/adoption/cli/kfd.mjs +63 -0
  146. package/packages/core/adoption/cli/output.mjs +18 -0
  147. package/packages/core/adoption/cli/product-gate.mjs +110 -0
  148. package/packages/core/adoption/cli/project.mjs +38 -0
  149. package/packages/core/adoption/cli/standards.mjs +282 -0
  150. package/packages/core/adoption/cli/support.mjs +101 -0
  151. package/packages/core/adoption/cli/surface-register.mjs +172 -0
  152. package/packages/core/adoption/commands/cross-platform-adopter-qualification.mjs +28 -0
  153. package/packages/core/adoption/commands/init-repo.mjs +518 -0
  154. package/packages/core/adoption/cross-platform-adopter-qualification.js +217 -0
  155. package/packages/core/adoption/kfd-agent-hub.js +496 -0
  156. package/packages/core/adoption/kfd.js +966 -0
  157. package/packages/core/adoption/kfd2-product-claims.js +454 -0
  158. package/packages/core/adoption/kfd3-surface-register.js +924 -0
  159. package/packages/core/adoption/qualification/actions.js +106 -0
  160. package/packages/core/adoption/qualification/admission.js +96 -0
  161. package/packages/core/adoption/qualification/aggregate.js +10 -0
  162. package/packages/core/adoption/qualification/io.js +51 -0
  163. package/packages/core/adoption/qualification/platform.js +120 -0
  164. package/packages/core/build/anchored-version-material.js +281 -0
  165. package/packages/core/build/artifact/actions.js +47 -0
  166. package/packages/core/build/artifact/attestation.js +166 -0
  167. package/packages/core/build/artifact/contracts.js +168 -0
  168. package/packages/core/build/artifact/coordinates.js +113 -0
  169. package/packages/core/build/artifact/credential-transport.js +68 -0
  170. package/packages/core/build/artifact/expectations.js +94 -0
  171. package/packages/core/build/artifact/files.js +14 -0
  172. package/packages/core/build/artifact/naming.js +65 -0
  173. package/packages/core/build/artifact/services.js +17 -0
  174. package/packages/core/build/artifact/store.js +119 -0
  175. package/packages/core/build/artifact/summary.js +20 -0
  176. package/packages/core/build/artifact/transfer-policy.js +34 -0
  177. package/packages/core/build/artifact/transport.js +112 -0
  178. package/packages/core/build/artifact/upload.js +178 -0
  179. package/packages/core/build/artifact-coordinate-action.js +46 -0
  180. package/packages/core/build/artifact-coordinate.js +58 -0
  181. package/packages/core/build/artifact-integrity.js +10 -0
  182. package/packages/core/build/artifact-passport.js +842 -0
  183. package/packages/core/build/artifact-verification-envelope.js +500 -0
  184. package/packages/core/build/binary/actions.js +77 -0
  185. package/packages/core/build/binary/checksums.js +33 -0
  186. package/packages/core/build/binary/distribution.js +271 -0
  187. package/packages/core/build/binary-publication-dispatch.js +49 -0
  188. package/packages/core/build/build-facts.js +518 -0
  189. package/packages/core/build/cache/compiler-evidence.js +287 -0
  190. package/packages/core/build/cli/cache.mjs +77 -0
  191. package/packages/core/build/cli/facts.mjs +120 -0
  192. package/packages/core/build/cli/homebrew.mjs +101 -0
  193. package/packages/core/build/cli/lifecycle.mjs +66 -0
  194. package/packages/core/build/commands/aggregate-build-summary.mjs +75 -0
  195. package/packages/core/build/commands/anchored-version-material.mjs +42 -0
  196. package/packages/core/build/commands/artifact-signing-controller.mjs +112 -0
  197. package/packages/core/build/commands/artifact-signing-delegation.mjs +34 -0
  198. package/packages/core/build/commands/auditable-demo-platform.mjs +77 -0
  199. package/packages/core/build/commands/auditable-demo-transport-smoke.mjs +24 -0
  200. package/packages/core/build/commands/auditable-demo.mjs +63 -0
  201. package/packages/core/build/commands/compiler-cache-evidence.mjs +39 -0
  202. package/packages/core/build/commands/dispatch-artifact-signing-authority.mjs +19 -0
  203. package/packages/core/build/commands/import-artifact-signing-results.mjs +10 -0
  204. package/packages/core/build/commands/lifecycle-substage-evidence.mjs +42 -0
  205. package/packages/core/build/commands/resolve-artifact-coordinates.mjs +58 -0
  206. package/packages/core/build/commands/resolve-artifact-transfer-mode.mjs +54 -0
  207. package/packages/core/build/commands/resolve-build-configuration.mjs +23 -0
  208. package/packages/core/build/commands/resolve-build-contract.mjs +94 -0
  209. package/packages/core/build/commands/run-candidate-body-prefix-renderer.mjs +24 -0
  210. package/packages/core/build/commands/run-lifecycle.mjs +56 -0
  211. package/packages/core/build/commands/seal-artifact-signing-requests.mjs +10 -0
  212. package/packages/core/build/commands/seal-macos-credential-input.mjs +4 -0
  213. package/packages/core/build/commands/shifu-gate-profile.mjs +43 -0
  214. package/packages/core/build/commands/source-verification-evidence.mjs +14 -0
  215. package/packages/core/build/commands/stage-capsule-qualification.mjs +79 -0
  216. package/packages/core/build/commands/validate-package-manager-contract.mjs +24 -0
  217. package/packages/core/build/credential/seal-input.js +109 -0
  218. package/packages/core/build/demo/action-context.js +25 -0
  219. package/packages/core/build/demo/adapter-actions.js +35 -0
  220. package/packages/core/build/demo/adapter-transactions.js +66 -0
  221. package/packages/core/build/demo/adapter.js +272 -0
  222. package/packages/core/build/demo/binary-action.js +29 -0
  223. package/packages/core/build/demo/bundle-verification.js +211 -0
  224. package/packages/core/build/demo/capture-adaptation.js +37 -0
  225. package/packages/core/build/demo/capture.js +377 -0
  226. package/packages/core/build/demo/collection-actions.js +62 -0
  227. package/packages/core/build/demo/collection-containers.js +136 -0
  228. package/packages/core/build/demo/collection-context.js +40 -0
  229. package/packages/core/build/demo/collection.js +129 -0
  230. package/packages/core/build/demo/composition.js +319 -0
  231. package/packages/core/build/demo/container.js +113 -0
  232. package/packages/core/build/demo/gate.js +297 -0
  233. package/packages/core/build/demo/inspection-worker.js +4 -0
  234. package/packages/core/build/demo/io.js +220 -0
  235. package/packages/core/build/demo/materialization.js +350 -0
  236. package/packages/core/build/demo/media-bundle.js +112 -0
  237. package/packages/core/build/demo/media-inspection.js +332 -0
  238. package/packages/core/build/demo/media-profile.js +399 -0
  239. package/packages/core/build/demo/media-qualification-action.js +37 -0
  240. package/packages/core/build/demo/media-qualification.js +117 -0
  241. package/packages/core/build/demo/presentation.js +222 -0
  242. package/packages/core/build/demo/publication.js +118 -0
  243. package/packages/core/build/demo/renderer-evidence.js +193 -0
  244. package/packages/core/build/demo/renditions.js +398 -0
  245. package/packages/core/build/demo/scenario.js +493 -0
  246. package/packages/core/build/demo/schema.js +278 -0
  247. package/packages/core/build/demo/transport-smoke.js +149 -0
  248. package/packages/core/build/demo/values.js +137 -0
  249. package/packages/core/build/environment/action.js +17 -0
  250. package/packages/core/build/environment/provision.js +121 -0
  251. package/packages/core/build/gate/actions.js +99 -0
  252. package/packages/core/build/gate/aggregate.js +21 -0
  253. package/packages/core/build/gate/commands.js +66 -0
  254. package/packages/core/build/gate/controller.js +43 -0
  255. package/packages/core/build/gate/environment.js +18 -0
  256. package/packages/core/build/gate/execution.js +88 -0
  257. package/packages/core/build/gate/files.js +46 -0
  258. package/packages/core/build/gate/outputs.js +31 -0
  259. package/packages/core/build/gate/plan.js +61 -0
  260. package/packages/core/build/github-artifact-attestation.js +642 -0
  261. package/packages/core/build/github-attestation/action.js +26 -0
  262. package/packages/core/build/github-attestation/admission.js +34 -0
  263. package/packages/core/build/github-attestation/transaction.js +83 -0
  264. package/packages/core/build/homebrew.js +416 -0
  265. package/packages/core/build/lifecycle/action.js +65 -0
  266. package/packages/core/build/lifecycle/artifacts.js +123 -0
  267. package/packages/core/build/lifecycle/context.js +202 -0
  268. package/packages/core/build/lifecycle/diagnostics.js +254 -0
  269. package/packages/core/build/lifecycle/errors.js +44 -0
  270. package/packages/core/build/lifecycle/execution.js +221 -0
  271. package/packages/core/build/lifecycle/files.js +61 -0
  272. package/packages/core/build/lifecycle/manifest.js +107 -0
  273. package/packages/core/build/lifecycle/sampling.js +209 -0
  274. package/packages/core/build/lifecycle/stage-action.js +18 -0
  275. package/packages/core/build/lifecycle/stage.js +143 -0
  276. package/packages/core/build/lifecycle/substage-evidence.js +232 -0
  277. package/packages/core/build/lifecycle/transaction.js +13 -0
  278. package/packages/core/build/macos-credential-island/action.js +704 -0
  279. package/packages/core/build/macos-credential-island/cleanup.js +48 -0
  280. package/packages/core/build/macos-credential-island/dmg-assembly.js +443 -0
  281. package/packages/core/build/macos-credential-island/lib.js +816 -0
  282. package/packages/core/build/package-manager.js +315 -0
  283. package/packages/core/build/plan/action-context.js +30 -0
  284. package/packages/core/build/plan/action.js +79 -0
  285. package/packages/core/build/plan/admission.js +93 -0
  286. package/packages/core/build/plan/configuration.js +196 -0
  287. package/packages/core/build/plan/environment.js +18 -0
  288. package/packages/core/build/plan/identity.js +49 -0
  289. package/packages/core/build/plan/lifecycle.js +38 -0
  290. package/packages/core/build/plan/matrices.js +58 -0
  291. package/packages/core/build/plan/resolve.js +76 -0
  292. package/packages/core/build/plan/runners.js +48 -0
  293. package/packages/core/build/plan/source.js +58 -0
  294. package/packages/core/build/plan/stage-order.js +10 -0
  295. package/packages/core/build/plan/values.js +10 -0
  296. package/packages/core/build/platform-stage-checkpoints.js +471 -0
  297. package/packages/core/build/release-evidence-bundle.js +156 -0
  298. package/packages/core/build/runner/matrix.js +266 -0
  299. package/packages/core/build/runner/presets.js +115 -0
  300. package/packages/core/build/signing/actions.js +54 -0
  301. package/packages/core/build/signing/authority-actions.js +147 -0
  302. package/packages/core/build/signing/authority-transaction.js +82 -0
  303. package/packages/core/build/signing/control.js +223 -0
  304. package/packages/core/build/signing/controller-transaction.js +110 -0
  305. package/packages/core/build/signing/credential-transaction.js +66 -0
  306. package/packages/core/build/signing/delegation.js +281 -0
  307. package/packages/core/build/signing/detached.js +170 -0
  308. package/packages/core/build/signing/dispatch.js +307 -0
  309. package/packages/core/build/signing/environment.js +13 -0
  310. package/packages/core/build/signing/files.js +53 -0
  311. package/packages/core/build/signing/import-results.js +151 -0
  312. package/packages/core/build/signing/intake.js +113 -0
  313. package/packages/core/build/signing/materialize.js +54 -0
  314. package/packages/core/build/signing/merge-results.js +82 -0
  315. package/packages/core/build/signing/native-result.js +244 -0
  316. package/packages/core/build/signing/prepare.js +44 -0
  317. package/packages/core/build/signing/request.js +519 -0
  318. package/packages/core/build/signing/seal-requests.js +402 -0
  319. package/packages/core/build/signing/transaction.js +158 -0
  320. package/packages/core/build/signing/verify-results.js +118 -0
  321. package/packages/core/build/source/checkout-action.js +16 -0
  322. package/packages/core/build/source/controller-actions.js +52 -0
  323. package/packages/core/build/source/controller.js +182 -0
  324. package/packages/core/build/source/lifecycle-action.js +32 -0
  325. package/packages/core/build/source/lifecycle.js +134 -0
  326. package/packages/core/build/source/proof-actions.js +57 -0
  327. package/packages/core/build/source/proof-lookup.js +82 -0
  328. package/packages/core/build/source/proof.js +134 -0
  329. package/packages/core/build/source-admission.js +35 -0
  330. package/packages/core/build/stage-capsule/actions.js +53 -0
  331. package/packages/core/build/stage-capsule/campaign/aggregate.js +51 -0
  332. package/packages/core/build/stage-capsule/campaign/context.js +51 -0
  333. package/packages/core/build/stage-capsule/campaign/resume.js +240 -0
  334. package/packages/core/build/stage-capsule/campaign/run.js +47 -0
  335. package/packages/core/build/stage-capsule/campaign/seed.js +124 -0
  336. package/packages/core/build/stage-capsule/campaign/worker.js +17 -0
  337. package/packages/core/build/stage-capsule/canary.js +62 -0
  338. package/packages/core/build/stage-capsule/rehearsal/checkpoint.js +110 -0
  339. package/packages/core/build/stage-capsule/rehearsal/files.js +36 -0
  340. package/packages/core/build/stage-capsule/rehearsal/macos-tail.js +104 -0
  341. package/packages/core/build/stage-capsule/rehearsal/resume.js +38 -0
  342. package/packages/core/build/stage-capsule/rehearsal/run.js +46 -0
  343. package/packages/core/build/stage-capsule/rehearsal/verify.js +56 -0
  344. package/packages/core/build/stage-capsule/rehearsal/worker.js +11 -0
  345. package/packages/core/build/stage-capsule-local-store.js +428 -0
  346. package/packages/core/build/stage-capsule-qualification-campaign.js +511 -0
  347. package/packages/core/build/stage-capsule-qualification.js +455 -0
  348. package/packages/core/build/stage-capsule-resume-planner.js +397 -0
  349. package/packages/core/build/stage-capsule-store.js +404 -0
  350. package/packages/core/build/stage-capsule.js +319 -0
  351. package/packages/core/build/standalone/build.js +266 -0
  352. package/packages/core/build/standalone/bundle.js +69 -0
  353. package/packages/core/build/standalone/identity.js +47 -0
  354. package/packages/core/build/standalone/logging.js +72 -0
  355. package/packages/core/build/standalone/process.js +50 -0
  356. package/packages/core/build/summary/action.js +33 -0
  357. package/packages/core/build/summary/aggregation.js +120 -0
  358. package/packages/core/build/summary/artifacts.js +165 -0
  359. package/packages/core/build/summary/controller-receipt.js +50 -0
  360. package/packages/core/build/summary/execution.js +39 -0
  361. package/packages/core/build/summary/finalization.js +133 -0
  362. package/packages/core/build/summary/payloads.js +80 -0
  363. package/packages/core/build/validate-config/action.js +58 -0
  364. package/packages/core/build/validate-config/lib.js +42 -0
  365. package/packages/core/build/verification/actions.js +54 -0
  366. package/packages/core/build/verification/discovery.js +115 -0
  367. package/packages/core/build/verification/identity.js +123 -0
  368. package/packages/core/build/verification/proof.js +8 -0
  369. package/packages/core/build/verification/repository.js +4 -0
  370. package/packages/core/build/verification/runner.js +69 -0
  371. package/packages/core/build/verification/source.js +169 -0
  372. package/packages/core/consumer/buildchain-config.js +1825 -0
  373. package/packages/core/consumer/channel-selection.js +211 -0
  374. package/packages/core/consumer/cli/infrastructure.mjs +6 -0
  375. package/packages/core/consumer/commands/buildchain-channel-router.mjs +81 -0
  376. package/packages/core/consumer/commands/consumer-policy.mjs +229 -0
  377. package/packages/core/consumer/floating-consumer-evidence.js +341 -0
  378. package/packages/core/consumer/floating-consumer-policy.js +596 -0
  379. package/packages/core/consumer/invocation-selector.js +4 -0
  380. package/packages/core/consumer/policy-admission.js +103 -0
  381. package/packages/core/consumer/policy-scan.js +33 -0
  382. package/packages/core/consumer/runtime-selector-persistence.js +291 -0
  383. package/packages/core/consumer/workflow-definition-authority.js +64 -0
  384. package/packages/core/contracts/action-inventory.js +78 -0
  385. package/packages/core/contracts/action-taxonomy.js +46 -0
  386. package/packages/core/contracts/buildchain-contract.js +1038 -0
  387. package/packages/core/contracts/canonical-contracts.js +239 -0
  388. package/packages/core/contracts/cli/context.mjs +28 -0
  389. package/packages/core/contracts/cli/introspection.mjs +47 -0
  390. package/packages/core/contracts/cli/options.mjs +85 -0
  391. package/packages/core/contracts/cli-reference.js +192 -0
  392. package/packages/core/contracts/commands/buildchain-contract-lock.mjs +120 -0
  393. package/packages/core/contracts/commands/workflow-call-contract.mjs +133 -0
  394. package/packages/core/contracts/public-surface-audit.js +274 -0
  395. package/packages/core/contracts/public-surface-cli.js +134 -0
  396. package/packages/core/contracts/runtime-contract-action.js +48 -0
  397. package/packages/core/contracts/runtime-contract-inspection.js +115 -0
  398. package/packages/core/contracts/structured-values.js +29 -0
  399. package/packages/core/contracts/workflow-yaml-contract.js +373 -0
  400. package/packages/core/dev-delivery/admission/gh-cli-client.js +110 -0
  401. package/packages/core/dev-delivery/admission/github-client.js +274 -0
  402. package/packages/core/dev-delivery/admission/policy.js +177 -0
  403. package/packages/core/dev-delivery/admission/queue.js +554 -0
  404. package/packages/core/dev-delivery/admission/readiness.js +222 -0
  405. package/packages/core/dev-delivery/admission/report.js +27 -0
  406. package/packages/core/dev-delivery/admission/request.js +34 -0
  407. package/packages/core/dev-delivery/admission/targeted.js +375 -0
  408. package/packages/core/dev-delivery/admission/transaction.js +47 -0
  409. package/packages/core/dev-delivery/buildchain-delivery-bootstrap.js +240 -0
  410. package/packages/core/dev-delivery/buildchain-delivery-infrastructure.js +164 -0
  411. package/packages/core/dev-delivery/buildchain-delivery-self-dogfood.js +395 -0
  412. package/packages/core/dev-delivery/candidate/admission-actions.js +34 -0
  413. package/packages/core/dev-delivery/candidate/admission.js +172 -0
  414. package/packages/core/dev-delivery/candidate/coordinates.js +46 -0
  415. package/packages/core/dev-delivery/candidate/evidence.js +20 -0
  416. package/packages/core/dev-delivery/candidate/request.js +39 -0
  417. package/packages/core/dev-delivery/candidate/reservation-action.js +21 -0
  418. package/packages/core/dev-delivery/candidate/reservation.js +98 -0
  419. package/packages/core/dev-delivery/candidate/source-paths.js +102 -0
  420. package/packages/core/dev-delivery/candidate/submission.js +41 -0
  421. package/packages/core/dev-delivery/cli/dispatch.mjs +54 -0
  422. package/packages/core/dev-delivery/commands/dev-delivery-authority-command-adapters.mjs +193 -0
  423. package/packages/core/dev-delivery/commands/dev-delivery-authority-provider.mjs +28 -0
  424. package/packages/core/dev-delivery/commands/dev-delivery-authority.mjs +454 -0
  425. package/packages/core/dev-delivery/commands/dev-delivery-process-boundary.mjs +93 -0
  426. package/packages/core/dev-delivery/commands/dev-delivery-proof.mjs +258 -0
  427. package/packages/core/dev-delivery/commands/dev-delivery-provider-heartbeat.mjs +76 -0
  428. package/packages/core/dev-delivery/commands/dev-delivery-request.sh +160 -0
  429. package/packages/core/dev-delivery/commands/dev-delivery-source-proof-reuse.mjs +128 -0
  430. package/packages/core/dev-delivery/commands/dev-delivery-two-phase.mjs +180 -0
  431. package/packages/core/dev-delivery/commands/dev-delivery-warrant-options.mjs +283 -0
  432. package/packages/core/dev-delivery/commands/dev-delivery-warrant.mjs +65 -0
  433. package/packages/core/dev-delivery/commands/dev-merge-queue.mjs +98 -0
  434. package/packages/core/dev-delivery/commands/dev-pr-auto-merge.mjs +111 -0
  435. package/packages/core/dev-delivery/commands/dev-pr-delivery-warrant.mjs +467 -0
  436. package/packages/core/dev-delivery/commands/dev-pr-prequeue-guard.mjs +381 -0
  437. package/packages/core/dev-delivery/commands/dev-qualification-patrol.mjs +21 -0
  438. package/packages/core/dev-delivery/delivery-warrant-fixture-runner.js +375 -0
  439. package/packages/core/dev-delivery/delivery-warrant-read-candidate.js +281 -0
  440. package/packages/core/dev-delivery/delivery-warrant-semantic-diff-gate.js +351 -0
  441. package/packages/core/dev-delivery/delivery-warrant-shadow-adapter.js +444 -0
  442. package/packages/core/dev-delivery/dev-delivery-authority-candidate.js +197 -0
  443. package/packages/core/dev-delivery/dev-delivery-authority-landing.js +459 -0
  444. package/packages/core/dev-delivery/dev-delivery-authority-state.js +424 -0
  445. package/packages/core/dev-delivery/dev-delivery-candidate-identity.js +152 -0
  446. package/packages/core/dev-delivery/dev-delivery-contract-surface.js +74 -0
  447. package/packages/core/dev-delivery/dev-delivery-native-proof.js +509 -0
  448. package/packages/core/dev-delivery/dev-delivery-proof.js +282 -0
  449. package/packages/core/dev-delivery/dev-delivery-warrant-native-requirements.js +7 -0
  450. package/packages/core/dev-delivery/dev-delivery-warrant-state.js +580 -0
  451. package/packages/core/dev-delivery/dev-delivery-warrant.js +588 -0
  452. package/packages/core/dev-delivery/merge-queue-policy.js +543 -0
  453. package/packages/core/dev-delivery/native/action-context.js +59 -0
  454. package/packages/core/dev-delivery/native/actions.js +74 -0
  455. package/packages/core/dev-delivery/native/attempt.js +93 -0
  456. package/packages/core/dev-delivery/native/candidate.js +101 -0
  457. package/packages/core/dev-delivery/native/context-record.js +26 -0
  458. package/packages/core/dev-delivery/native/execution.js +176 -0
  459. package/packages/core/dev-delivery/native/failure.js +105 -0
  460. package/packages/core/dev-delivery/native/files.js +11 -0
  461. package/packages/core/dev-delivery/native/finalizer-admission.js +93 -0
  462. package/packages/core/dev-delivery/native/heartbeat-action.js +29 -0
  463. package/packages/core/dev-delivery/native/heartbeat.js +137 -0
  464. package/packages/core/dev-delivery/native/provider-boundary.js +71 -0
  465. package/packages/core/dev-delivery/native/qualification.js +228 -0
  466. package/packages/core/dev-delivery/native/readback.js +32 -0
  467. package/packages/core/dev-delivery/native/reuse.js +60 -0
  468. package/packages/core/dev-delivery/native/seal-action.js +19 -0
  469. package/packages/core/dev-delivery/native/transactions.js +156 -0
  470. package/packages/core/dev-delivery/native/transfer.js +122 -0
  471. package/packages/core/dev-delivery/published-delivery-authority.js +266 -0
  472. package/packages/core/dev-delivery/qualification/action.js +60 -0
  473. package/packages/core/dev-delivery/qualification/controller.js +218 -0
  474. package/packages/core/dev-delivery/qualification/github-client.js +108 -0
  475. package/packages/core/dev-delivery/qualification/model.js +186 -0
  476. package/packages/core/dev-delivery/qualification/report.js +25 -0
  477. package/packages/core/dev-delivery/queue/completion.js +52 -0
  478. package/packages/core/dev-delivery/queue/landing-action.js +60 -0
  479. package/packages/core/dev-delivery/queue/reconciliation-action.js +45 -0
  480. package/packages/core/dev-delivery/source-proof/evidence.js +92 -0
  481. package/packages/core/dev-delivery/source-proof/io.js +97 -0
  482. package/packages/core/dev-delivery/source-proof/predicates.js +88 -0
  483. package/packages/core/dev-delivery/source-proof/replay.js +143 -0
  484. package/packages/core/dev-delivery/source-proof/reuse.js +116 -0
  485. package/packages/core/dev-delivery/source-proof/seal.js +32 -0
  486. package/packages/core/dev-delivery/warrant/actions.js +78 -0
  487. package/packages/core/dev-delivery/warrant/cancellation.js +49 -0
  488. package/packages/core/dev-delivery/warrant/failure-settlement.js +93 -0
  489. package/packages/core/dev-delivery/warrant/handoff.js +107 -0
  490. package/packages/core/dev-delivery/warrant/observation.js +59 -0
  491. package/packages/core/dev-delivery/warrant/persistence.js +109 -0
  492. package/packages/core/dev-delivery/warrant/reservation-readback.js +72 -0
  493. package/packages/core/dev-delivery/warrant/service.js +134 -0
  494. package/packages/core/dev-delivery/warrant/terminal-policy.js +53 -0
  495. package/packages/core/dev-delivery/warrant/terminal.js +89 -0
  496. package/packages/core/dev-delivery/warrant/transitions.js +222 -0
  497. package/packages/core/dev-delivery/warrant/values.js +102 -0
  498. package/packages/core/governance/alpha-candidate/action.js +96 -0
  499. package/packages/core/governance/alpha-candidate/controller.js +490 -0
  500. package/packages/core/governance/alpha-candidate/lifecycle.js +121 -0
  501. package/packages/core/governance/alpha-candidate/options.js +60 -0
  502. package/packages/core/governance/alpha-candidate/outputs.js +23 -0
  503. package/packages/core/governance/alpha-candidate/provider.js +192 -0
  504. package/packages/core/governance/alpha-candidate/report.js +56 -0
  505. package/packages/core/governance/alpha-candidate/state.js +184 -0
  506. package/packages/core/governance/alpha-candidate/values.js +90 -0
  507. package/packages/core/governance/architecture-graph.js +24 -0
  508. package/packages/core/governance/audit/actions.js +57 -0
  509. package/packages/core/governance/audit/collection.js +259 -0
  510. package/packages/core/governance/audit/github-reader.js +204 -0
  511. package/packages/core/governance/audit/identity.js +86 -0
  512. package/packages/core/governance/audit/incident.mjs +39 -0
  513. package/packages/core/governance/audit/transactions.js +75 -0
  514. package/packages/core/governance/buildchain-compatibility-authority.js +335 -0
  515. package/packages/core/governance/buildchain-compatibility-fact.js +386 -0
  516. package/packages/core/governance/buildchain-compatibility-facts.json +18 -0
  517. package/packages/core/governance/buildchain-compatibility-proof.js +523 -0
  518. package/packages/core/governance/buildchain-publication-authority.js +117 -0
  519. package/packages/core/governance/candidate/body-action.js +18 -0
  520. package/packages/core/governance/candidate/body-renderer.js +160 -0
  521. package/packages/core/governance/ci-lane-change-budget.js +260 -0
  522. package/packages/core/governance/cli/compatibility-facts.mjs +101 -0
  523. package/packages/core/governance/cli/dispatch.mjs +19 -0
  524. package/packages/core/governance/cli/doctor.mjs +144 -0
  525. package/packages/core/governance/commands/architecture.mjs +594 -0
  526. package/packages/core/governance/commands/audit-github-governance.mjs +43 -0
  527. package/packages/core/governance/commands/audit-publication-control-plane.mjs +26 -0
  528. package/packages/core/governance/commands/buildchain-patrol.mjs +32 -0
  529. package/packages/core/governance/commands/create-github-artifact-attestation-policy.mjs +62 -0
  530. package/packages/core/governance/commands/engineering-housekeeper-workflow.mjs +23 -0
  531. package/packages/core/governance/commands/reconcile-github-governance.mjs +689 -0
  532. package/packages/core/governance/commands/reconcile-release-governance.mjs +77 -0
  533. package/packages/core/governance/commands/workflow-friction-report.mjs +375 -0
  534. package/packages/core/governance/github-governance-authority.js +1367 -0
  535. package/packages/core/governance/housekeeping/action.js +45 -0
  536. package/packages/core/governance/housekeeping/execution.js +75 -0
  537. package/packages/core/governance/housekeeping/options.js +103 -0
  538. package/packages/core/governance/housekeeping/report.js +53 -0
  539. package/packages/core/governance/housekeeping/transactions.js +96 -0
  540. package/packages/core/governance/patrol/action.js +41 -0
  541. package/packages/core/governance/patrol/controller.js +125 -0
  542. package/packages/core/governance/patrol/options.js +121 -0
  543. package/packages/core/governance/patrol/report.js +53 -0
  544. package/packages/core/governance/patrol/transaction.js +30 -0
  545. package/packages/core/governance/publication/audit.js +26 -0
  546. package/packages/core/governance/publication/collection.js +396 -0
  547. package/packages/core/governance/publication/policy-values.js +227 -0
  548. package/packages/core/governance/publication/source-authorization.js +293 -0
  549. package/packages/core/governance/receipt-admission-action.js +12 -0
  550. package/packages/core/governance/receipt-admission.js +34 -0
  551. package/packages/core/governance/release-check-policy.js +179 -0
  552. package/packages/core/governance/release-reconciliation-action.js +25 -0
  553. package/packages/core/governance/release-reconciliation.js +122 -0
  554. package/packages/core/governance/report-issue/action.js +201 -0
  555. package/packages/core/index.js +85 -117
  556. package/packages/core/observability/cli/candidate.mjs +42 -0
  557. package/packages/core/observability/cli/context.mjs +47 -0
  558. package/packages/core/observability/cli/diagnostics.mjs +88 -0
  559. package/packages/core/observability/cli/events.mjs +126 -0
  560. package/packages/core/observability/cli/process-sample.mjs +71 -0
  561. package/packages/core/observability/commands/aggregate-diagnostics-summary.mjs +45 -0
  562. package/packages/core/observability/commands/controller-evidence.mjs +109 -0
  563. package/packages/core/observability/commands/observed-evidence.mjs +27 -0
  564. package/packages/core/observability/controller/identity-action.js +11 -0
  565. package/packages/core/observability/controller/identity.js +32 -0
  566. package/packages/core/observability/controller-actions.js +63 -0
  567. package/packages/core/observability/controller-evidence-io.js +112 -0
  568. package/packages/core/observability/controller-evidence.js +555 -0
  569. package/packages/core/observability/controller-input-boundary.js +47 -0
  570. package/packages/core/observability/diagnostics/aggregate.js +25 -0
  571. package/packages/core/observability/diagnostics.js +1904 -0
  572. package/packages/core/observability/evidence/actions.js +20 -0
  573. package/packages/core/observability/evidence/bundle.js +163 -0
  574. package/packages/core/observability/evidence/publication.js +360 -0
  575. package/packages/core/observability/evidence/transactions.js +62 -0
  576. package/packages/core/observability/process/sampling.js +128 -0
  577. package/packages/core/observability/publisher-admission.js +26 -0
  578. package/packages/core/observability/transaction-journal.js +40 -0
  579. package/packages/core/paper/cli/dispatch.mjs +17 -0
  580. package/packages/core/paper/commands/paper-agent-cli.mjs +35 -0
  581. package/packages/core/paper/commands/paper-work-fleet-cli.mjs +577 -0
  582. package/packages/core/paper/commands/paper.mjs +632 -0
  583. package/packages/core/paper/operations/bootstrap.js +73 -0
  584. package/packages/core/paper/operations/files.js +48 -0
  585. package/packages/core/paper/operations/github-observation.js +136 -0
  586. package/packages/core/paper/operations/identity.js +59 -0
  587. package/packages/core/paper/operations/npm-observation.js +118 -0
  588. package/packages/core/paper/operations/plans.js +213 -0
  589. package/packages/core/paper/operations/preflight-checks.js +269 -0
  590. package/packages/core/paper/operations/provisioning-validation.js +155 -0
  591. package/packages/core/paper/operations/provisioning.js +113 -0
  592. package/packages/core/paper/operations/runtime-observation.js +25 -0
  593. package/packages/core/paper/operations/runtime.js +84 -0
  594. package/packages/core/paper/operations/scaffold-config.js +77 -0
  595. package/packages/core/paper/operations/scaffold-workflows.js +99 -0
  596. package/packages/core/paper/operations/scaffold.js +370 -0
  597. package/packages/core/paper/operations/status-facts.js +264 -0
  598. package/packages/core/paper/operations/status.js +353 -0
  599. package/packages/core/paper/operations/toolchain-observation.js +49 -0
  600. package/packages/core/paper/operations/workspace.js +60 -0
  601. package/packages/core/paper/paper-agent-entry.js +396 -0
  602. package/packages/core/paper/paper-fleet.js +310 -0
  603. package/packages/core/paper/paper-npm-bootstrap.js +492 -0
  604. package/packages/core/paper/paper-repository.js +214 -0
  605. package/packages/core/paper/paper-runtime-channels.js +344 -0
  606. package/packages/core/paper/paper-scaffold-content.js +574 -0
  607. package/packages/core/paper/paper.js +308 -0
  608. package/packages/core/paper/publication/actions.js +109 -0
  609. package/packages/core/paper/publication/candidate.js +140 -0
  610. package/packages/core/paper/publication/controller.js +117 -0
  611. package/packages/core/paper/publication/envelope.js +118 -0
  612. package/packages/core/paper/publication/propagation.js +135 -0
  613. package/packages/core/paper/publication/readback.js +89 -0
  614. package/packages/core/paper/publication/target.js +54 -0
  615. package/packages/core/paper/publication-controller.js +144 -0
  616. package/packages/core/providers/artifact-relay/files.js +71 -0
  617. package/packages/core/providers/artifact-relay/s3-client.js +259 -0
  618. package/packages/core/providers/artifact-relay/transactions.js +258 -0
  619. package/packages/core/providers/commands/artifact-relay-s3.mjs +62 -0
  620. package/packages/core/providers/commands/aws-codebuild-toolchain.mjs +15 -0
  621. package/packages/core/providers/commands/aws-macos-jit-controller-runtime.mjs +82 -0
  622. package/packages/core/providers/commands/aws-runner-burst-core.mjs +249 -0
  623. package/packages/core/providers/commands/aws-runner-burst.mjs +80 -0
  624. package/packages/core/providers/commands/aws-windows-jit-campaign.mjs +202 -0
  625. package/packages/core/providers/commands/aws-windows-jit-controller.mjs +578 -0
  626. package/packages/core/providers/commands/aws-windows-jit-operator.sh +506 -0
  627. package/packages/core/providers/commands/infra-contract-core.mjs +1032 -0
  628. package/packages/core/providers/commands/infra-contract.mjs +345 -0
  629. package/packages/core/providers/commands/locked-source-checkout.mjs +9 -0
  630. package/packages/core/providers/commands/route-offline-runners.mjs +30 -0
  631. package/packages/core/providers/demo/capture-worker.py +541 -0
  632. package/packages/core/providers/dev-delivery/candidate.js +112 -0
  633. package/packages/core/providers/dev-delivery/protection.js +29 -0
  634. package/packages/core/providers/dev-delivery/store.js +292 -0
  635. package/packages/core/providers/git/fetch-process.js +27 -0
  636. package/packages/core/providers/git/fetch-worker.js +146 -0
  637. package/packages/core/providers/git/patch-root.js +54 -0
  638. package/packages/core/providers/git-ref-readback.mjs +22 -0
  639. package/packages/core/providers/github/artifact-attestation.js +32 -0
  640. package/packages/core/providers/github/commits.js +32 -0
  641. package/packages/core/providers/github/json-client.js +65 -0
  642. package/packages/core/providers/github/product-publication.js +44 -0
  643. package/packages/core/providers/github/publication-control-plane.js +116 -0
  644. package/packages/core/providers/github/pull-requests.js +24 -0
  645. package/packages/core/providers/github/qualification.js +181 -0
  646. package/packages/core/providers/github/release-assets.js +91 -0
  647. package/packages/core/providers/github/signing-request.js +81 -0
  648. package/packages/core/providers/github/source-lock.js +98 -0
  649. package/packages/core/providers/github-cli-api.js +35 -0
  650. package/packages/core/providers/github-issue-comment.js +83 -0
  651. package/packages/core/providers/github-permission.js +11 -0
  652. package/packages/core/providers/github-token.js +121 -0
  653. package/packages/core/providers/process/sample-worker.mjs +14 -0
  654. package/packages/core/providers/runner/observation.js +30 -0
  655. package/packages/core/providers/runner/offline-routing.js +205 -0
  656. package/packages/core/providers/signing/detached-key.js +20 -0
  657. package/packages/core/providers/signing/macos/compound-archive.py +434 -0
  658. package/packages/core/providers/signing/macos/sign-request.sh +145 -0
  659. package/packages/core/providers/signing/native.js +77 -0
  660. package/packages/core/providers/signing/windows/sign-request.ps1 +48 -0
  661. package/packages/core/providers/source-checkout/action.js +31 -0
  662. package/packages/core/providers/source-checkout/auth.js +32 -0
  663. package/packages/core/providers/source-checkout/fetch.js +135 -0
  664. package/packages/core/providers/source-checkout/git.js +220 -0
  665. package/packages/core/providers/source-checkout/transaction.js +360 -0
  666. package/packages/core/providers/source-checkout/values.js +115 -0
  667. package/packages/core/providers/source-checkout/workspace.js +50 -0
  668. package/packages/core/providers/sync-git/action.mjs +16 -0
  669. package/packages/core/providers/sync-git/transfer.mjs +86 -0
  670. package/packages/core/providers/toolchain/codebuild-policy.js +36 -0
  671. package/packages/core/providers/toolchain/codebuild.js +220 -0
  672. package/packages/core/publication/authority/actions.js +156 -0
  673. package/packages/core/publication/authority/admission.js +113 -0
  674. package/packages/core/publication/authority/assembly.js +77 -0
  675. package/packages/core/publication/authority/binary-evidence.js +77 -0
  676. package/packages/core/publication/authority/candidate-evidence.js +42 -0
  677. package/packages/core/publication/authority/consumer-gate.js +80 -0
  678. package/packages/core/publication/authority/control-plane.js +38 -0
  679. package/packages/core/publication/authority/evidence.js +113 -0
  680. package/packages/core/publication/authority/gate.js +39 -0
  681. package/packages/core/publication/authority/governance.js +61 -0
  682. package/packages/core/publication/authority/paper-evidence.js +24 -0
  683. package/packages/core/publication/authority/request.js +13 -0
  684. package/packages/core/publication/authority/result.js +37 -0
  685. package/packages/core/publication/authority/runner.js +26 -0
  686. package/packages/core/publication/authority/seal.js +97 -0
  687. package/packages/core/publication/authority/verification-evidence.js +80 -0
  688. package/packages/core/publication/authority/verification.js +94 -0
  689. package/packages/core/publication/binary/action.js +33 -0
  690. package/packages/core/publication/binary/capability.js +55 -0
  691. package/packages/core/publication/binary/evidence.js +109 -0
  692. package/packages/core/publication/binary/transaction.js +38 -0
  693. package/packages/core/publication/candidate/artifact.js +71 -0
  694. package/packages/core/publication/candidate/collection-action.js +24 -0
  695. package/packages/core/publication/candidate/collection.js +70 -0
  696. package/packages/core/publication/candidate/kind.js +93 -0
  697. package/packages/core/publication/candidate/manifest.js +35 -0
  698. package/packages/core/publication/candidate/package-binding.js +42 -0
  699. package/packages/core/publication/candidate/package.js +50 -0
  700. package/packages/core/publication/candidate/paper-package.js +120 -0
  701. package/packages/core/publication/candidate/passport.js +36 -0
  702. package/packages/core/publication/candidate/qualification-action.js +41 -0
  703. package/packages/core/publication/candidate/qualification.js +56 -0
  704. package/packages/core/publication/candidate/registry-hydration.js +204 -0
  705. package/packages/core/publication/candidate/reproducibility.js +29 -0
  706. package/packages/core/publication/candidate/sealing.js +184 -0
  707. package/packages/core/publication/candidate/stage-capsules.js +205 -0
  708. package/packages/core/publication/candidate/toolchain.js +80 -0
  709. package/packages/core/publication/cli/dispatch.mjs +107 -0
  710. package/packages/core/publication/commands/create-release-bundle.mjs +32 -0
  711. package/packages/core/publication/commands/generate-release-candidate-passport.mjs +80 -0
  712. package/packages/core/publication/commands/installer-publication.mjs +45 -0
  713. package/packages/core/publication/commands/npm-publish-dry-run.mjs +48 -0
  714. package/packages/core/publication/commands/npm-publish-transaction.mjs +55 -0
  715. package/packages/core/publication/commands/publication-artifact-candidate.mjs +48 -0
  716. package/packages/core/publication/commands/publication-artifact.mjs +67 -0
  717. package/packages/core/publication/commands/publication-package.mjs +38 -0
  718. package/packages/core/publication/commands/publication-registry-hydrate.mjs +19 -0
  719. package/packages/core/publication/commands/publication-reproducibility.mjs +62 -0
  720. package/packages/core/publication/installer/evidence.js +319 -0
  721. package/packages/core/publication/npm/environment.js +18 -0
  722. package/packages/core/publication/npm/evidence.js +57 -0
  723. package/packages/core/publication/npm/pack-preview.js +22 -0
  724. package/packages/core/publication/npm/package-plan.js +82 -0
  725. package/packages/core/publication/npm/package.js +120 -0
  726. package/packages/core/publication/npm/preview-action.js +30 -0
  727. package/packages/core/publication/npm/preview.js +92 -0
  728. package/packages/core/publication/npm/registry.js +61 -0
  729. package/packages/core/publication/npm/transaction.js +115 -0
  730. package/packages/core/publication/oci/preview-actions.js +48 -0
  731. package/packages/core/publication/oci/preview-admission.js +93 -0
  732. package/packages/core/publication/oci/preview-promotion.js +64 -0
  733. package/packages/core/publication/oci/preview-registry.js +36 -0
  734. package/packages/core/publication/oci/preview-transaction.js +42 -0
  735. package/packages/core/publication/oci/preview-values.js +8 -0
  736. package/packages/core/publication/oci-compose-qualification.js +143 -0
  737. package/packages/core/publication/oci-publication-bundle.js +281 -0
  738. package/packages/core/publication/publication-artifact-candidate.js +128 -0
  739. package/packages/core/publication/publication-artifact.js +641 -0
  740. package/packages/core/publication/publication-authority.js +1163 -0
  741. package/packages/core/publication/publication-development.js +72 -0
  742. package/packages/core/publication/publication-package.js +252 -0
  743. package/packages/core/publication/publication-rehearsal-capsule.js +468 -0
  744. package/packages/core/publication/publication-rehearsal-projection.js +104 -0
  745. package/packages/core/publication/publication-rehearsal-runtime.js +190 -0
  746. package/packages/core/publication/publication-rehearsal.js +481 -0
  747. package/packages/core/publication/publication-reproducibility.js +947 -0
  748. package/packages/core/publication/settlement/actions.js +63 -0
  749. package/packages/core/publication/settlement/transaction.js +197 -0
  750. package/packages/core/release/binary/coordinates-action.js +25 -0
  751. package/packages/core/release/binary/coordinates.js +76 -0
  752. package/packages/core/release/candidate/download.js +64 -0
  753. package/packages/core/release/candidate/lineage.js +72 -0
  754. package/packages/core/release/candidate/materialize.js +155 -0
  755. package/packages/core/release/candidate/payloads.js +330 -0
  756. package/packages/core/release/candidate/publication-intent.js +89 -0
  757. package/packages/core/release/candidate/resolve.js +132 -0
  758. package/packages/core/release/candidate/run-selection.js +88 -0
  759. package/packages/core/release/candidate/selection.js +181 -0
  760. package/packages/core/release/candidate/transport.js +143 -0
  761. package/packages/core/release/cli/command-handlers.mjs +14 -0
  762. package/packages/core/release/cli/dispatch.mjs +39 -0
  763. package/packages/core/release/cli/inspection-handlers.mjs +178 -0
  764. package/packages/core/release/cli/release-handlers.mjs +332 -0
  765. package/packages/core/release/cli/trust-release.mjs +19 -0
  766. package/packages/core/release/cli/verification-handlers.mjs +303 -0
  767. package/packages/core/release/commands/dev-alpha-candidate-patrol.mjs +42 -0
  768. package/packages/core/release/commands/ensure-github-release.mjs +199 -0
  769. package/packages/core/release/commands/next-development-review.mjs +77 -0
  770. package/packages/core/release/commands/next-development-transition.mjs +47 -0
  771. package/packages/core/release/commands/promotion-channel-router.mjs +62 -0
  772. package/packages/core/release/commands/promotion-identity-resolver.mjs +77 -0
  773. package/packages/core/release/commands/publish-source-ref-resolver.mjs +113 -0
  774. package/packages/core/release/commands/release-candidate-resolver.mjs +122 -0
  775. package/packages/core/release/commands/release-line-dry-run.mjs +53 -0
  776. package/packages/core/release/commands/release-propagation.mjs +411 -0
  777. package/packages/core/release/commands/release-tail.mjs +169 -0
  778. package/packages/core/release/commands/release-transaction.mjs +212 -0
  779. package/packages/core/release/commands/resolve-publish-gate.mjs +34 -0
  780. package/packages/core/release/commands/resolve-publish-source.mjs +96 -0
  781. package/packages/core/release/commands/resume-from-candidate-run.mjs +107 -0
  782. package/packages/core/release/commands/stable-candidate-patrol.mjs +31 -0
  783. package/packages/core/release/commands/stable-candidate-qualification.mjs +24 -0
  784. package/packages/core/release/commands/stable-release-gate.mjs +351 -0
  785. package/packages/core/release/commands/tail-reseal.mjs +148 -0
  786. package/packages/core/release/commands/verify-promotion-router-binding.sh +36 -0
  787. package/packages/core/release/commands/verify-publish-channel-ref.mjs +83 -0
  788. package/packages/core/release/commands/verify-publish-source-lock.mjs +37 -0
  789. package/packages/core/release/commands/verify-release-pr.mjs +6 -0
  790. package/packages/core/release/commands/verify-version-state-delta.mjs +21 -0
  791. package/packages/core/release/github-provider-plane.js +319 -0
  792. package/packages/core/release/github-release.js +385 -0
  793. package/packages/core/release/line/action.js +49 -0
  794. package/packages/core/release/line/governance.js +96 -0
  795. package/packages/core/release/line/plan.js +56 -0
  796. package/packages/core/release/line/policy.js +320 -0
  797. package/packages/core/release/line/protection.js +35 -0
  798. package/packages/core/release/line/request.js +22 -0
  799. package/packages/core/release/line/source.js +79 -0
  800. package/packages/core/release/line/transaction.js +33 -0
  801. package/packages/core/release/line/verification-action.js +13 -0
  802. package/packages/core/release/line/verification.js +13 -0
  803. package/packages/core/release/next-development/actions.js +122 -0
  804. package/packages/core/release/next-development/approval.js +59 -0
  805. package/packages/core/release/next-development/enqueue.js +51 -0
  806. package/packages/core/release/next-development/finalization.js +127 -0
  807. package/packages/core/release/next-development/observation.js +41 -0
  808. package/packages/core/release/next-development/review-policy.js +56 -0
  809. package/packages/core/release/next-development/verification.js +89 -0
  810. package/packages/core/release/next-development-projection.js +310 -0
  811. package/packages/core/release/next-development-transition.js +737 -0
  812. package/packages/core/release/partial-mutation-recovery-qualification.js +18 -0
  813. package/packages/core/release/passport/artifact-index.js +65 -0
  814. package/packages/core/release/passport/assembly-artifacts.js +43 -0
  815. package/packages/core/release/passport/assembly-inputs.js +107 -0
  816. package/packages/core/release/passport/assembly-material.js +261 -0
  817. package/packages/core/release/passport/assembly-render.js +320 -0
  818. package/packages/core/release/passport/assembly.js +12 -0
  819. package/packages/core/release/passport/assets.js +46 -0
  820. package/packages/core/release/passport/attachments.js +88 -0
  821. package/packages/core/release/passport/authoritative-base.js +123 -0
  822. package/packages/core/release/passport/build.js +39 -0
  823. package/packages/core/release/passport/collection-inputs.js +383 -0
  824. package/packages/core/release/passport/collection-material.js +199 -0
  825. package/packages/core/release/passport/collection-options.js +97 -0
  826. package/packages/core/release/passport/collection-output.js +303 -0
  827. package/packages/core/release/passport/collection.js +10 -0
  828. package/packages/core/release/passport/commands.js +44 -0
  829. package/packages/core/release/passport/consumer-input.js +18 -0
  830. package/packages/core/release/passport/consumer-validation.js +83 -0
  831. package/packages/core/release/passport/discovery.js +36 -0
  832. package/packages/core/release/passport/documents.js +116 -0
  833. package/packages/core/release/passport/evidence-validation.js +280 -0
  834. package/packages/core/release/passport/files.js +43 -0
  835. package/packages/core/release/passport/fixture.js +19 -0
  836. package/packages/core/release/passport/identity.js +46 -0
  837. package/packages/core/release/passport/impact-validation.js +230 -0
  838. package/packages/core/release/passport/impact.js +149 -0
  839. package/packages/core/release/passport/inputs.js +55 -0
  840. package/packages/core/release/passport/invariants.js +93 -0
  841. package/packages/core/release/passport/issues.js +29 -0
  842. package/packages/core/release/passport/json.js +16 -0
  843. package/packages/core/release/passport/locations.js +82 -0
  844. package/packages/core/release/passport/packages.js +123 -0
  845. package/packages/core/release/passport/publish-validation.js +279 -0
  846. package/packages/core/release/passport/publish.js +58 -0
  847. package/packages/core/release/passport/report.js +154 -0
  848. package/packages/core/release/passport/state-validation.js +163 -0
  849. package/packages/core/release/passport/transaction.js +69 -0
  850. package/packages/core/release/passport/trust-claims.js +365 -0
  851. package/packages/core/release/passport/trust-validation.js +528 -0
  852. package/packages/core/release/product-publication.js +59 -0
  853. package/packages/core/release/promote-candidate/action.js +9 -0
  854. package/packages/core/release/promote-candidate/development-source.js +39 -0
  855. package/packages/core/release/promote-candidate/evidence-binding.js +142 -0
  856. package/packages/core/release/promote-candidate/evidence-inputs.js +99 -0
  857. package/packages/core/release/promote-candidate/files.js +10 -0
  858. package/packages/core/release/promote-candidate/next-development-provider.js +300 -0
  859. package/packages/core/release/promote-candidate/next-development-queue.js +63 -0
  860. package/packages/core/release/promote-candidate/oci-provider.js +241 -0
  861. package/packages/core/release/promote-candidate/oci-registry-client.js +67 -0
  862. package/packages/core/release/promote-candidate/outputs.js +29 -0
  863. package/packages/core/release/promote-candidate/product-finalization-wait.js +52 -0
  864. package/packages/core/release/promote-candidate/product-provider-adapters.js +462 -0
  865. package/packages/core/release/promote-candidate/product-provider-github-adapters.js +595 -0
  866. package/packages/core/release/promote-candidate/product-provider.js +188 -0
  867. package/packages/core/release/promote-candidate/provider-request.js +51 -0
  868. package/packages/core/release/promote-candidate/provider-settlement.js +83 -0
  869. package/packages/core/release/promote-candidate/publication-completion.js +56 -0
  870. package/packages/core/release/promote-candidate/release-documents.js +156 -0
  871. package/packages/core/release/promote-candidate/transaction.js +130 -0
  872. package/packages/core/release/promote-ref/action-environment.js +2 -0
  873. package/packages/core/release/promote-ref/action-inputs.js +285 -0
  874. package/packages/core/release/promote-ref/action-outputs.js +140 -0
  875. package/packages/core/release/promote-ref/action-request.js +205 -0
  876. package/packages/core/release/promote-ref/action.js +92 -0
  877. package/packages/core/release/promote-ref/internal/branch-protection.js +218 -0
  878. package/packages/core/release/promote-ref/internal/candidate-admission.js +149 -0
  879. package/packages/core/release/promote-ref/internal/channel-governance.js +297 -0
  880. package/packages/core/release/promote-ref/internal/channel-resume.js +198 -0
  881. package/packages/core/release/promote-ref/internal/channel-tags.js +207 -0
  882. package/packages/core/release/promote-ref/internal/contained-published-version-state.js +80 -0
  883. package/packages/core/release/promote-ref/internal/durable-transaction-operations.js +463 -0
  884. package/packages/core/release/promote-ref/internal/durable-transaction-store.js +395 -0
  885. package/packages/core/release/promote-ref/internal/generated-branch.js +16 -0
  886. package/packages/core/release/promote-ref/internal/generated-identity.js +12 -0
  887. package/packages/core/release/promote-ref/internal/generated-ref.js +93 -0
  888. package/packages/core/release/promote-ref/internal/github-adapter.js +312 -0
  889. package/packages/core/release/promote-ref/internal/npm-distribution.js +185 -0
  890. package/packages/core/release/promote-ref/internal/npm-existing-evidence.js +61 -0
  891. package/packages/core/release/promote-ref/internal/passport-files.js +116 -0
  892. package/packages/core/release/promote-ref/internal/passport-generation.js +567 -0
  893. package/packages/core/release/promote-ref/internal/promote-alpha-channel.js +588 -0
  894. package/packages/core/release/promote-ref/internal/promote-major-channel.js +476 -0
  895. package/packages/core/release/promote-ref/internal/promote-release-channel.js +573 -0
  896. package/packages/core/release/promote-ref/internal/promotion-operations.js +1170 -0
  897. package/packages/core/release/promote-ref/internal/promotion-options.js +101 -0
  898. package/packages/core/release/promote-ref/internal/promotion-policy.js +218 -0
  899. package/packages/core/release/promote-ref/internal/publish-command.js +211 -0
  900. package/packages/core/release/promote-ref/internal/publish-contract.js +181 -0
  901. package/packages/core/release/promote-ref/internal/publish-transaction.js +510 -0
  902. package/packages/core/release/promote-ref/internal/tag-selection.js +159 -0
  903. package/packages/core/release/promote-ref/internal/transaction-context.js +506 -0
  904. package/packages/core/release/promote-ref/internal/transaction-recovery.js +379 -0
  905. package/packages/core/release/promote-ref/internal/version-state-operations.js +545 -0
  906. package/packages/core/release/promote-ref/lib.js +600 -0
  907. package/packages/core/release/promote-ref/release-tail.js +102 -0
  908. package/packages/core/release/promote-ref/source-lock.js +91 -0
  909. package/packages/core/release/promotion/actions.js +133 -0
  910. package/packages/core/release/promotion/admission.js +52 -0
  911. package/packages/core/release/promotion/candidate.js +71 -0
  912. package/packages/core/release/promotion/channel.js +104 -0
  913. package/packages/core/release/promotion/identities.js +56 -0
  914. package/packages/core/release/promotion/product-state.js +68 -0
  915. package/packages/core/release/promotion/publish-gate.js +128 -0
  916. package/packages/core/release/promotion/qualification-action.js +72 -0
  917. package/packages/core/release/promotion/qualification.js +95 -0
  918. package/packages/core/release/promotion/routing.js +94 -0
  919. package/packages/core/release/promotion/selection.js +55 -0
  920. package/packages/core/release/promotion/source-intent.js +35 -0
  921. package/packages/core/release/promotion-request.js +148 -0
  922. package/packages/core/release/propagation/actions.js +75 -0
  923. package/packages/core/release/propagation/delivery.js +202 -0
  924. package/packages/core/release/propagation/planning.js +197 -0
  925. package/packages/core/release/propagation/report.js +97 -0
  926. package/packages/core/release/propagation/store.js +26 -0
  927. package/packages/core/release/propagation/transactions.js +213 -0
  928. package/packages/core/release/propagation/work.js +146 -0
  929. package/packages/core/release/protected-publication-source.js +91 -0
  930. package/packages/core/release/provider-operation-journal.js +62 -0
  931. package/packages/core/release/provider-readback-idempotency.js +309 -0
  932. package/packages/core/release/qualification/actions.js +51 -0
  933. package/packages/core/release/qualification/campaign.js +154 -0
  934. package/packages/core/release/qualification/options.js +102 -0
  935. package/packages/core/release/qualification/public-build.js +109 -0
  936. package/packages/core/release/recovery/artifacts.js +161 -0
  937. package/packages/core/release/recovery/candidate.js +529 -0
  938. package/packages/core/release/recovery/capsules.js +102 -0
  939. package/packages/core/release/recovery/download.js +191 -0
  940. package/packages/core/release/recovery/files.js +39 -0
  941. package/packages/core/release/recovery/provenance.js +199 -0
  942. package/packages/core/release/recovery/publication.js +193 -0
  943. package/packages/core/release/recovery/readback.js +169 -0
  944. package/packages/core/release/recovery/runtime.js +224 -0
  945. package/packages/core/release/recovery/transactions.js +139 -0
  946. package/packages/core/release/release-activation-shadow.js +32 -0
  947. package/packages/core/release/release-blocker-priority.js +183 -0
  948. package/packages/core/release/release-candidate-recovery.js +595 -0
  949. package/packages/core/release/release-candidate.js +591 -0
  950. package/packages/core/release/release-invocation.js +64 -0
  951. package/packages/core/release/release-line-bootstrap.js +292 -0
  952. package/packages/core/release/release-line-dry-run.js +302 -0
  953. package/packages/core/release/release-passport-contract.js +479 -0
  954. package/packages/core/release/release-passport.js +74 -0
  955. package/packages/core/release/release-tail-provider-adapters.js +460 -0
  956. package/packages/core/release/release-tail-provider-plane.js +248 -0
  957. package/packages/core/release/reseal/actions.js +84 -0
  958. package/packages/core/release/reseal/admission.js +75 -0
  959. package/packages/core/release/reseal/files.js +39 -0
  960. package/packages/core/release/reseal/finalize-platform.js +65 -0
  961. package/packages/core/release/reseal/outputs.js +21 -0
  962. package/packages/core/release/reseal/plan.js +24 -0
  963. package/packages/core/release/reseal/platform.js +135 -0
  964. package/packages/core/release/reseal/readbacks.js +36 -0
  965. package/packages/core/release/reseal/seal.js +125 -0
  966. package/packages/core/release/reuse-complete-release.js +240 -0
  967. package/packages/core/release/runtime-override-authorization.js +242 -0
  968. package/packages/core/release/settle/action.js +412 -0
  969. package/packages/core/release/source/channel.js +45 -0
  970. package/packages/core/release/source/coordinates.js +160 -0
  971. package/packages/core/release/source/lineage.js +144 -0
  972. package/packages/core/release/source/manifest.js +114 -0
  973. package/packages/core/release/stable-patrol/action.js +87 -0
  974. package/packages/core/release/stable-patrol/controller.js +346 -0
  975. package/packages/core/release/stable-patrol/coordinates.js +16 -0
  976. package/packages/core/release/stable-patrol/github-client.js +181 -0
  977. package/packages/core/release/stable-patrol/options.js +87 -0
  978. package/packages/core/release/stable-patrol/report.js +28 -0
  979. package/packages/core/release/stable-publication-fence.js +28 -0
  980. package/packages/core/release/tail-reseal-github.js +175 -0
  981. package/packages/core/release/tail-reseal-receipt.js +228 -0
  982. package/packages/core/release/tail-reseal.js +594 -0
  983. package/packages/core/release/version-state/verification.js +164 -0
  984. package/packages/core/release/version-state.js +458 -0
  985. package/packages/core/runtime/action-host.js +19 -0
  986. package/packages/core/runtime/action-process.mjs +23 -0
  987. package/packages/core/runtime/buildchain-domain.wasm +0 -0
  988. package/packages/core/runtime/checkout-identity.js +27 -0
  989. package/packages/core/runtime/commands/bridge-bootstrap.mjs +147 -0
  990. package/packages/core/runtime/commands/host-adapter.mjs +185 -0
  991. package/packages/core/runtime/commands/runtime-ref-core.mjs +171 -0
  992. package/packages/core/runtime/consumer-shell.js +174 -0
  993. package/packages/core/runtime/domain-wasm-artifact.js +7 -0
  994. package/packages/core/runtime/installation-root.js +29 -0
  995. package/packages/core/runtime/locked-dependencies.js +74 -0
  996. package/packages/core/runtime/provider-closure.js +60 -0
  997. package/packages/core/runtime/runtime-selection-action.js +34 -0
  998. package/packages/core/runtime/runtime-selection.js +136 -0
  999. package/packages/core/runtime/toolchain/actions.js +14 -0
  1000. package/packages/core/runtime/toolchain/user-paths.js +9 -0
  1001. package/packages/core/runtime/toolchain/windows-rust.js +67 -0
  1002. package/packages/core/runtime/workflow-runtime.js +11 -0
  1003. package/packages/core/web/apply-admission-action.js +20 -0
  1004. package/packages/core/web/apply-admission.js +44 -0
  1005. package/packages/core/web/cli/badges.mjs +100 -0
  1006. package/packages/core/web/cli/surface.mjs +6 -0
  1007. package/packages/core/web/commands/web-surface-core.mjs +2603 -0
  1008. package/packages/core/web/commands/web-surface-production-release-pr.mjs +126 -0
  1009. package/packages/core/web/commands/web-surface.mjs +294 -0
  1010. package/packages/core/web/controller-actions.js +45 -0
  1011. package/packages/core/web/controller.js +145 -0
  1012. package/packages/core/web/deployment/apply-action.js +31 -0
  1013. package/packages/core/web/deployment/apply-evidence.js +134 -0
  1014. package/packages/core/web/deployment/apply.js +118 -0
  1015. package/packages/core/web/deployment/cloudfront-wait.js +88 -0
  1016. package/packages/core/web/deployment/plan-files.js +41 -0
  1017. package/packages/core/web/deployment/planning-action.js +28 -0
  1018. package/packages/core/web/deployment/planning.js +126 -0
  1019. package/packages/core/web/deployment/report-action.js +74 -0
  1020. package/packages/core/web/deployment/summary.js +44 -0
  1021. package/packages/core/web/preview-feedback-action.js +26 -0
  1022. package/packages/core/web/preview-feedback.js +40 -0
  1023. package/packages/core/web/production-decision-action.js +42 -0
  1024. package/packages/core/web/production-decision.js +85 -0
  1025. package/packages/core/web/production-intent-action.js +14 -0
  1026. package/packages/core/web/production-intent.js +167 -0
  1027. package/packages/core/web/publication-admission-action.js +92 -0
  1028. package/packages/core/web/publication-admission.js +183 -0
  1029. package/packages/core/web/publication-capability-action.js +22 -0
  1030. package/packages/core/web/publication-capability.js +73 -0
  1031. package/packages/core/web/readme-badges.js +891 -0
  1032. package/packages/core/web/release-feedback.js +414 -0
  1033. package/packages/core/web/release-pr-action.js +47 -0
  1034. package/packages/core/web/release-pr-handoff.js +176 -0
  1035. package/packages/core/web/release-pr-provider.js +295 -0
  1036. package/packages/core/web/release-pr-summary.js +42 -0
  1037. package/packages/core/web/release-pr-transaction.js +158 -0
  1038. package/packages/core/web/release-review-action.js +21 -0
  1039. package/packages/core/web/release-review.js +130 -0
  1040. package/packages/core/web/web-surface-publication-candidate.js +162 -0
  1041. package/packages/core/workflow/admission/actions.js +56 -0
  1042. package/packages/core/workflow/admission/recovery.js +47 -0
  1043. package/packages/core/workflow/admission/review.js +188 -0
  1044. package/packages/core/workflow/admission/transactions.js +60 -0
  1045. package/packages/core/workflow/cli/main.mjs +131 -0
  1046. package/packages/core/workflow/cli/process.mjs +16 -0
  1047. package/packages/core/workflow/commands/buildchain-cli-help.mjs +318 -0
  1048. package/packages/core/workflow/commands/universal-workflow-backflow.mjs +26 -0
  1049. package/packages/core/workflow/commands/universal-workflow-engine.mjs +73 -0
  1050. package/packages/core/workflow/dogfood/actions.js +62 -0
  1051. package/packages/core/workflow/dogfood/readiness.js +74 -0
  1052. package/packages/core/workflow/dogfood/transactions.js +90 -0
  1053. package/packages/core/workflow/engine/action.js +42 -0
  1054. package/packages/core/workflow/engine/conformance.js +93 -0
  1055. package/packages/core/workflow/engine/execution.js +77 -0
  1056. package/packages/core/workflow/engine/identity.js +34 -0
  1057. package/packages/core/workflow/engine/provider-context.js +16 -0
  1058. package/packages/core/workflow/engine/release-environment.js +57 -0
  1059. package/packages/core/workflow/engine/release-evidence.js +39 -0
  1060. package/packages/core/workflow/engine/release-observation.js +97 -0
  1061. package/packages/core/workflow/engine/release-promotion.js +227 -0
  1062. package/packages/core/workflow/event-trust.js +25 -0
  1063. package/packages/core/workflow/installation.js +33 -0
  1064. package/packages/core/workflow/request-rejection.js +3 -0
  1065. package/packages/core/workflow/settlement/actions.js +34 -0
  1066. package/packages/core/workflow/settlement/backflow.js +187 -0
  1067. package/packages/core/workflow/universal-self-dogfood.js +163 -0
  1068. package/packages/core/workflow/universal-workflow-bootstrap.js +586 -0
  1069. package/packages/core/workflow/workflow-taxonomy.mjs +351 -0
  1070. package/scripts/bridge-evidence.mjs +9 -2
  1071. package/scripts/build-domain-wasm.mjs +15 -3
  1072. package/scripts/build-standalone-binary.mjs +1 -375
  1073. package/scripts/check-action-bundles.mjs +14 -25
  1074. package/scripts/check-ci-lane-change-budget.mjs +3 -3
  1075. package/scripts/check-code-layout.mjs +386 -0
  1076. package/scripts/check-core-mechanism-inventory.mjs +17 -16
  1077. package/scripts/check-dev-delivery-actions.mjs +35 -0
  1078. package/scripts/check-floating-consumer-policy-contract.mjs +33 -59
  1079. package/scripts/check-implementation-naming.mjs +2 -23
  1080. package/scripts/check-internal-architecture.mjs +3 -3
  1081. package/scripts/check-inventory.mjs +160 -318
  1082. package/scripts/check-javascript-syntax.mjs +1 -1
  1083. package/scripts/check-maintainability.mjs +25 -21
  1084. package/scripts/check-project-cut-merge-queue-admission.mjs +1 -1
  1085. package/scripts/check-public-dogfood-contract.mjs +166 -43
  1086. package/scripts/check-release-tail-contract.mjs +62 -71
  1087. package/scripts/check-release-topology.mjs +101 -77
  1088. package/scripts/check-runtime-semantic-closure.mjs +5 -8
  1089. package/scripts/check-source-bindings.mjs +54 -0
  1090. package/scripts/check-universal-workflow-bootstrap.mjs +136 -124
  1091. package/scripts/check-workflow-taxonomy.mjs +1 -1
  1092. package/scripts/check-workflows.sh +11 -0
  1093. package/scripts/generate-bootstrap-admission.mjs +32 -0
  1094. package/scripts/generate-bootstrap-recovery.mjs +94 -0
  1095. package/scripts/generate-buildchain-kfd-witnesses.mjs +3 -3
  1096. package/scripts/generate-channel-promotion-workflow.mjs +39 -518
  1097. package/scripts/generate-next-development-guidance.mjs +1 -1
  1098. package/scripts/generate-public-reference.mjs +2 -2
  1099. package/scripts/generate-site-bundle.mjs +42 -43
  1100. package/scripts/generate-tail-reseal-fixture.mjs +108 -0
  1101. package/scripts/generate-workflow-taxonomy.mjs +2 -2
  1102. package/scripts/inventory/binary.mjs +36 -0
  1103. package/scripts/inventory/promotion.mjs +72 -0
  1104. package/scripts/maintainability-domain-metrics.mjs +1 -1
  1105. package/scripts/maintainability-metrics.mjs +37 -37
  1106. package/scripts/maintainability-public-surface.mjs +19 -95
  1107. package/scripts/next-development-self-dogfood-harness.mjs +2 -2
  1108. package/scripts/next-development-self-dogfood.mjs +2 -2
  1109. package/scripts/platform-stage-checkpoint-rehearsal.mjs +33 -201
  1110. package/scripts/public-reference.mjs +0 -187
  1111. package/scripts/publication-rehearsal-fixture.mjs +1 -1
  1112. package/scripts/release-train-self-dogfood.mjs +9 -14
  1113. package/scripts/site-action-audit.mjs +16 -0
  1114. package/scripts/site-capability-metadata.mjs +3 -7
  1115. package/scripts/source-metric-lineage.mjs +17 -0
  1116. package/scripts/stage-capsule-resume-rehearsal.mjs +19 -55
  1117. package/scripts/tail-reseal-macos-rehearsal.mjs +1 -109
  1118. package/scripts/tsup-action.config.mjs +21 -0
  1119. package/scripts/verify-golden-path.mjs +1 -1
  1120. package/scripts/warrant-shadow-plan.mjs +49 -243
  1121. package/scripts/workflow-action-graph.mjs +149 -0
  1122. package/templates/bootstrap-recovery/actions/build/source/admit/action.yml +17 -0
  1123. package/templates/bootstrap-recovery/actions/build/source/admit/dist/index.js +63 -0
  1124. package/templates/bootstrap-recovery/actions/runtime/dependencies/install/action.yml +18 -0
  1125. package/templates/bootstrap-recovery/actions/runtime/dependencies/install/dist/index.js +63 -0
  1126. package/templates/bootstrap-recovery/actions/runtime/environment/prepare/action.yml +21 -0
  1127. package/templates/bootstrap-recovery/actions/workflow/admission/inspect/action.yml +27 -0
  1128. package/templates/bootstrap-recovery/actions/workflow/admission/inspect/dist/index.js +64 -0
  1129. package/templates/bootstrap-recovery/actions/workflow/admission/review/action.yml +15 -0
  1130. package/templates/bootstrap-recovery/actions/workflow/admission/review/dist/index.js +65 -0
  1131. package/templates/bootstrap-recovery/actions/workflow/recovery/admit/action.yml +47 -0
  1132. package/templates/bootstrap-recovery/actions/workflow/recovery/execute/action.yml +48 -0
  1133. package/templates/bootstrap-recovery/actions/workflow/recovery/settle/action.yml +54 -0
  1134. package/templates/bootstrap-recovery/actions/workflow/settlement/seal/action.yml +17 -0
  1135. package/templates/bootstrap-recovery/actions/workflow/settlement/seal/dist/index.js +65 -0
  1136. package/templates/bootstrap-recovery/manifest.json +68 -0
  1137. package/templates/bootstrap-recovery/package.json +9 -0
  1138. package/templates/native-dev-delivery.yml +28 -41
  1139. package/templates/universal-buildchain-bootstrap-recovery.yml +46 -213
  1140. package/templates/universal-buildchain-bootstrap.yml +1 -1
  1141. package/actions/github-artifact-attestation/README.md +0 -10
  1142. package/actions/promote-buildchain-ref/README.md +0 -549
  1143. package/actions/report-buildchain-issue/README.md +0 -107
  1144. package/actions/run-lifecycle/README.md +0 -71
  1145. package/actions/validate-config/README.md +0 -52
  1146. package/architecture/implementation-naming.json +0 -1273
  1147. package/bin/internal/adopter-delivery-cli.mjs +0 -70
  1148. package/bin/internal/cli-options.mjs +0 -79
  1149. package/bin/internal/compatibility-facts-cli.mjs +0 -101
  1150. package/bin/internal/trust-release-cli.mjs +0 -19
  1151. package/bin/internal/trust-release-command-handlers.mjs +0 -14
  1152. package/bin/internal/trust-release-inspection-handlers.mjs +0 -175
  1153. package/bin/internal/trust-release-release-handlers.mjs +0 -332
  1154. package/bin/internal/trust-release-verification-handlers.mjs +0 -306
  1155. package/contracts/fixtures/v4-adopter-delivery-v1/archive-template.json +0 -19
  1156. package/contracts/fixtures/v4-adopter-delivery-v1/bootstrap-positive.json +0 -93
  1157. package/packages/compatibility/adopter-delivery.js +0 -16
  1158. package/packages/compatibility/cross-platform-adopter-qualification.js +0 -12
  1159. package/packages/compatibility/floating-consumer-policy.js +0 -14
  1160. package/packages/compatibility/publication-qualification.js +0 -11
  1161. package/packages/compatibility/publication-rehearsal.js +0 -18
  1162. package/packages/compatibility/runtime-ref-resume-authority.js +0 -13
  1163. package/packages/compatibility/tail-reseal-receipt.js +0 -7
  1164. package/packages/compatibility/tail-reseal.js +0 -11
  1165. package/packages/core/adopter-delivery-parity.js +0 -219
  1166. package/packages/core/adopter-delivery.js +0 -359
  1167. package/packages/core/anchored-version-material.js +0 -281
  1168. package/packages/core/artifact-passport.js +0 -847
  1169. package/packages/core/artifact-verification-envelope.js +0 -500
  1170. package/packages/core/build-facts.js +0 -575
  1171. package/packages/core/buildchain-compatibility-authority.js +0 -336
  1172. package/packages/core/buildchain-compatibility-fact.js +0 -394
  1173. package/packages/core/buildchain-compatibility-facts.json +0 -217
  1174. package/packages/core/buildchain-compatibility-proof.js +0 -566
  1175. package/packages/core/buildchain-config.js +0 -1887
  1176. package/packages/core/buildchain-contract.js +0 -1048
  1177. package/packages/core/buildchain-delivery-bootstrap.js +0 -240
  1178. package/packages/core/buildchain-delivery-infrastructure.js +0 -164
  1179. package/packages/core/buildchain-delivery-self-dogfood.js +0 -395
  1180. package/packages/core/buildchain-domain.wasm +0 -0
  1181. package/packages/core/buildchain-kfd-claims.js +0 -733
  1182. package/packages/core/buildchain-publication-authority.js +0 -118
  1183. package/packages/core/canonical-contracts.js +0 -239
  1184. package/packages/core/ci-lane-change-budget.js +0 -260
  1185. package/packages/core/controller-evidence.js +0 -553
  1186. package/packages/core/cross-platform-adopter-qualification.js +0 -343
  1187. package/packages/core/delivery-warrant-fixture-runner.js +0 -375
  1188. package/packages/core/delivery-warrant-read-candidate.js +0 -286
  1189. package/packages/core/delivery-warrant-semantic-diff-gate.js +0 -351
  1190. package/packages/core/delivery-warrant-shadow-adapter.js +0 -447
  1191. package/packages/core/dev-delivery-authority-candidate.js +0 -270
  1192. package/packages/core/dev-delivery-authority-landing.js +0 -461
  1193. package/packages/core/dev-delivery-authority-state.js +0 -583
  1194. package/packages/core/dev-delivery-candidate-identity.js +0 -169
  1195. package/packages/core/dev-delivery-contract-surface.js +0 -76
  1196. package/packages/core/dev-delivery-native-proof.js +0 -566
  1197. package/packages/core/dev-delivery-proof.js +0 -286
  1198. package/packages/core/dev-delivery-warrant-legacy-recovery.js +0 -248
  1199. package/packages/core/dev-delivery-warrant-native-compatibility.js +0 -33
  1200. package/packages/core/dev-delivery-warrant-state.js +0 -599
  1201. package/packages/core/dev-delivery-warrant.js +0 -598
  1202. package/packages/core/diagnostics.js +0 -1904
  1203. package/packages/core/domain-wasm-artifact.js +0 -7
  1204. package/packages/core/floating-consumer-evidence.js +0 -338
  1205. package/packages/core/floating-consumer-policy.js +0 -571
  1206. package/packages/core/github-artifact-attestation.js +0 -642
  1207. package/packages/core/github-governance-authority.js +0 -1369
  1208. package/packages/core/homebrew.js +0 -414
  1209. package/packages/core/kfd-agent-hub.js +0 -496
  1210. package/packages/core/kfd.js +0 -966
  1211. package/packages/core/kfd2-product-claims.js +0 -454
  1212. package/packages/core/kfd3-surface-register.js +0 -924
  1213. package/packages/core/legacy-kfd-adopter-driver.js +0 -167
  1214. package/packages/core/next-development-projection.js +0 -310
  1215. package/packages/core/next-development-transition.js +0 -737
  1216. package/packages/core/oci-compose-qualification.js +0 -143
  1217. package/packages/core/oci-publication-bundle.js +0 -281
  1218. package/packages/core/package-manager.js +0 -323
  1219. package/packages/core/paper-agent-entry.js +0 -396
  1220. package/packages/core/paper-fleet.js +0 -313
  1221. package/packages/core/paper-npm-bootstrap.js +0 -492
  1222. package/packages/core/paper-repository.js +0 -214
  1223. package/packages/core/paper-runtime-channels.js +0 -348
  1224. package/packages/core/paper-scaffold-content.js +0 -574
  1225. package/packages/core/paper.js +0 -2478
  1226. package/packages/core/partial-mutation-recovery-qualification.js +0 -18
  1227. package/packages/core/platform-stage-checkpoints.js +0 -471
  1228. package/packages/core/product-publication.js +0 -59
  1229. package/packages/core/protected-publication-source.js +0 -91
  1230. package/packages/core/provider-operation-journal.js +0 -62
  1231. package/packages/core/provider-readback-idempotency.js +0 -309
  1232. package/packages/core/public-export-compatibility.js +0 -33
  1233. package/packages/core/public-surface-audit.js +0 -273
  1234. package/packages/core/public-surface-cli.js +0 -128
  1235. package/packages/core/publication-artifact-candidate.js +0 -128
  1236. package/packages/core/publication-artifact.js +0 -641
  1237. package/packages/core/publication-authority.js +0 -1163
  1238. package/packages/core/publication-development.js +0 -72
  1239. package/packages/core/publication-package.js +0 -252
  1240. package/packages/core/publication-rehearsal-capsule.js +0 -468
  1241. package/packages/core/publication-rehearsal-projection.js +0 -104
  1242. package/packages/core/publication-rehearsal-runtime.js +0 -190
  1243. package/packages/core/publication-rehearsal.js +0 -481
  1244. package/packages/core/publication-reproducibility.js +0 -947
  1245. package/packages/core/published-delivery-authority.js +0 -266
  1246. package/packages/core/readme-badges.js +0 -893
  1247. package/packages/core/release-activation-shadow.js +0 -32
  1248. package/packages/core/release-blocker-priority.js +0 -192
  1249. package/packages/core/release-candidate-recovery.js +0 -595
  1250. package/packages/core/release-candidate.js +0 -591
  1251. package/packages/core/release-invocation.js +0 -64
  1252. package/packages/core/release-line-bootstrap.js +0 -297
  1253. package/packages/core/release-line-dry-run.js +0 -303
  1254. package/packages/core/release-passport-contract.js +0 -479
  1255. package/packages/core/release-passport.js +0 -2884
  1256. package/packages/core/release-tail-compatibility.js +0 -60
  1257. package/packages/core/release-tail-provider-adapters.js +0 -461
  1258. package/packages/core/release-tail-provider-plane.js +0 -248
  1259. package/packages/core/runtime-selector-persistence.js +0 -228
  1260. package/packages/core/stable-publication-fence.js +0 -28
  1261. package/packages/core/stage-capsule-local-store.js +0 -428
  1262. package/packages/core/stage-capsule-qualification-campaign.js +0 -511
  1263. package/packages/core/stage-capsule-qualification.js +0 -455
  1264. package/packages/core/stage-capsule-resume-planner.js +0 -397
  1265. package/packages/core/stage-capsule-store.js +0 -404
  1266. package/packages/core/stage-capsule.js +0 -319
  1267. package/packages/core/tail-reseal-github.js +0 -178
  1268. package/packages/core/tail-reseal-receipt.js +0 -225
  1269. package/packages/core/tail-reseal.js +0 -594
  1270. package/packages/core/universal-workflow-bootstrap.js +0 -586
  1271. package/packages/core/web-surface-publication-candidate.js +0 -162
  1272. package/packages/core/workflow-yaml-contract.js +0 -342
  1273. package/scripts/aggregate-build-summary.mjs +0 -187
  1274. package/scripts/aggregate-diagnostics-summary.mjs +0 -54
  1275. package/scripts/anchored-version-material.mjs +0 -42
  1276. package/scripts/architecture.mjs +0 -610
  1277. package/scripts/artifact-relay-s3.mjs +0 -539
  1278. package/scripts/artifact-signing-controller-core.mjs +0 -525
  1279. package/scripts/artifact-signing-controller.mjs +0 -302
  1280. package/scripts/artifact-signing-delegation.mjs +0 -316
  1281. package/scripts/assemble-binary-release-admission.mjs +0 -213
  1282. package/scripts/assemble-publication-artifact-admission.mjs +0 -200
  1283. package/scripts/assemble-self-publication-admission.mjs +0 -201
  1284. package/scripts/assemble-web-surface-publication-admission.mjs +0 -204
  1285. package/scripts/audit-github-governance.mjs +0 -493
  1286. package/scripts/audit-publication-control-plane.mjs +0 -527
  1287. package/scripts/auditable-demo-bundle-verification.mjs +0 -148
  1288. package/scripts/auditable-demo-platform.mjs +0 -600
  1289. package/scripts/auditable-demo-presentation.mjs +0 -83
  1290. package/scripts/auditable-demo-renditions.mjs +0 -399
  1291. package/scripts/auditable-demo-transport-smoke.mjs +0 -176
  1292. package/scripts/auditable-demo.mjs +0 -1324
  1293. package/scripts/aws-codebuild-toolchain.mjs +0 -285
  1294. package/scripts/aws-macos-jit-controller-runtime.mjs +0 -82
  1295. package/scripts/aws-runner-burst-core.mjs +0 -248
  1296. package/scripts/aws-runner-burst.mjs +0 -79
  1297. package/scripts/aws-windows-jit-campaign.mjs +0 -202
  1298. package/scripts/aws-windows-jit-controller.mjs +0 -578
  1299. package/scripts/binary-publication-evidence.mjs +0 -133
  1300. package/scripts/bridge-bootstrap.mjs +0 -137
  1301. package/scripts/build-contract-core.mjs +0 -1216
  1302. package/scripts/buildchain-channel-router.mjs +0 -249
  1303. package/scripts/buildchain-cli-help.mjs +0 -321
  1304. package/scripts/buildchain-contract-lock.mjs +0 -184
  1305. package/scripts/buildchain-patrol.mjs +0 -280
  1306. package/scripts/compiler-cache-evidence.mjs +0 -304
  1307. package/scripts/consumer-policy.mjs +0 -231
  1308. package/scripts/controller-evidence.mjs +0 -208
  1309. package/scripts/copy-domain-wasm.mjs +0 -14
  1310. package/scripts/create-github-artifact-attestation-policy.mjs +0 -62
  1311. package/scripts/create-release-bundle.mjs +0 -167
  1312. package/scripts/cross-platform-adopter-qualification.mjs +0 -228
  1313. package/scripts/declarative-promotion-admission.mjs +0 -45
  1314. package/scripts/dev-alpha-candidate-patrol.mjs +0 -1197
  1315. package/scripts/dev-delivery-authority-command-adapters.mjs +0 -206
  1316. package/scripts/dev-delivery-authority-provider.mjs +0 -28
  1317. package/scripts/dev-delivery-authority.mjs +0 -490
  1318. package/scripts/dev-delivery-native-run.mjs +0 -177
  1319. package/scripts/dev-delivery-process-boundary.mjs +0 -260
  1320. package/scripts/dev-delivery-proof.mjs +0 -258
  1321. package/scripts/dev-delivery-provider-heartbeat.mjs +0 -215
  1322. package/scripts/dev-delivery-source-proof-replay.mjs +0 -153
  1323. package/scripts/dev-delivery-source-proof-reuse.mjs +0 -548
  1324. package/scripts/dev-delivery-two-phase-resume.mjs +0 -345
  1325. package/scripts/dev-delivery-two-phase.mjs +0 -573
  1326. package/scripts/dev-delivery-warrant-options.mjs +0 -298
  1327. package/scripts/dev-delivery-warrant-store.mjs +0 -316
  1328. package/scripts/dev-delivery-warrant-transition.mjs +0 -109
  1329. package/scripts/dev-delivery-warrant.mjs +0 -559
  1330. package/scripts/dev-merge-queue.mjs +0 -536
  1331. package/scripts/dev-pr-auto-merge.mjs +0 -1222
  1332. package/scripts/dev-pr-delivery-warrant.mjs +0 -467
  1333. package/scripts/dev-pr-prequeue-guard.mjs +0 -381
  1334. package/scripts/dev-qualification-patrol.mjs +0 -594
  1335. package/scripts/dispatch-artifact-signing-authority.mjs +0 -407
  1336. package/scripts/engineering-housekeeper-workflow.mjs +0 -401
  1337. package/scripts/ensure-github-release.mjs +0 -199
  1338. package/scripts/finalize-native-artifact-signing-result.mjs +0 -272
  1339. package/scripts/generate-channel-build-workflow.mjs +0 -69
  1340. package/scripts/generate-release-candidate-passport.mjs +0 -285
  1341. package/scripts/generate-universal-workflow-facades.mjs +0 -499
  1342. package/scripts/git-fetch-process-tree.mjs +0 -175
  1343. package/scripts/host-adapter.mjs +0 -182
  1344. package/scripts/implementation-references.mjs +0 -25
  1345. package/scripts/import-artifact-signing-results.mjs +0 -135
  1346. package/scripts/infra-contract-core.mjs +0 -1032
  1347. package/scripts/infra-contract.mjs +0 -345
  1348. package/scripts/init-repo.mjs +0 -518
  1349. package/scripts/inspect-artifact-signing-requests.mjs +0 -157
  1350. package/scripts/installer-publication.mjs +0 -361
  1351. package/scripts/lifecycle-substage-evidence.mjs +0 -274
  1352. package/scripts/locked-source-checkout.mjs +0 -595
  1353. package/scripts/materialize-artifact-signing-request.mjs +0 -66
  1354. package/scripts/merge-artifact-signing-results.mjs +0 -76
  1355. package/scripts/next-development-review.mjs +0 -331
  1356. package/scripts/next-development-transition.mjs +0 -47
  1357. package/scripts/npm-publish-dry-run.mjs +0 -182
  1358. package/scripts/npm-publish-transaction.mjs +0 -331
  1359. package/scripts/observed-evidence.mjs +0 -311
  1360. package/scripts/oci-compose-preview.mjs +0 -261
  1361. package/scripts/paper-agent-cli.mjs +0 -35
  1362. package/scripts/paper-work-fleet-cli.mjs +0 -594
  1363. package/scripts/paper.mjs +0 -644
  1364. package/scripts/product-publication-intent.mjs +0 -129
  1365. package/scripts/promotion-channel-router.mjs +0 -139
  1366. package/scripts/promotion-identity-resolver.mjs +0 -129
  1367. package/scripts/publication-artifact-candidate.mjs +0 -122
  1368. package/scripts/publication-artifact.mjs +0 -67
  1369. package/scripts/publication-candidate-kind.mjs +0 -93
  1370. package/scripts/publication-candidate-sealer.mjs +0 -119
  1371. package/scripts/publication-package.mjs +0 -38
  1372. package/scripts/publication-registry-hydrate.mjs +0 -216
  1373. package/scripts/publication-reproducibility.mjs +0 -62
  1374. package/scripts/publication-settlement.mjs +0 -217
  1375. package/scripts/publish-source-ref-resolver.mjs +0 -113
  1376. package/scripts/reconcile-github-governance.mjs +0 -689
  1377. package/scripts/reconcile-release-governance.mjs +0 -368
  1378. package/scripts/release-asset-client.mjs +0 -91
  1379. package/scripts/release-candidate-adapter.mjs +0 -41
  1380. package/scripts/release-candidate-anchor-provenance.mjs +0 -99
  1381. package/scripts/release-candidate-resolver.mjs +0 -842
  1382. package/scripts/release-finalization-review.mjs +0 -53
  1383. package/scripts/release-line-dry-run.mjs +0 -53
  1384. package/scripts/release-line-policy.mjs +0 -231
  1385. package/scripts/release-propagation.mjs +0 -411
  1386. package/scripts/release-tail.mjs +0 -178
  1387. package/scripts/release-transaction.mjs +0 -212
  1388. package/scripts/resolve-artifact-coordinates.mjs +0 -174
  1389. package/scripts/resolve-artifact-transfer-mode.mjs +0 -126
  1390. package/scripts/resolve-build-configuration.mjs +0 -105
  1391. package/scripts/resolve-build-contract.mjs +0 -96
  1392. package/scripts/resolve-publish-gate.mjs +0 -33
  1393. package/scripts/resolve-publish-source.mjs +0 -99
  1394. package/scripts/resume-from-candidate-run.mjs +0 -1117
  1395. package/scripts/route-offline-runners.mjs +0 -237
  1396. package/scripts/run-candidate-body-prefix-renderer.mjs +0 -187
  1397. package/scripts/run-lifecycle-core.mjs +0 -850
  1398. package/scripts/run-lifecycle.mjs +0 -56
  1399. package/scripts/runtime-ref-core.mjs +0 -171
  1400. package/scripts/seal-artifact-signing-requests.mjs +0 -431
  1401. package/scripts/seal-macos-credential-input.mjs +0 -135
  1402. package/scripts/shifu-gate-profile.mjs +0 -374
  1403. package/scripts/sign-detached-artifact-requests.mjs +0 -237
  1404. package/scripts/source-verification-evidence.mjs +0 -344
  1405. package/scripts/stable-candidate-patrol.mjs +0 -527
  1406. package/scripts/stable-candidate-policy.mjs +0 -25
  1407. package/scripts/stable-candidate-qualification.mjs +0 -358
  1408. package/scripts/stable-release-gate.mjs +0 -351
  1409. package/scripts/stage-capsule-qualification.mjs +0 -528
  1410. package/scripts/tail-reseal.mjs +0 -416
  1411. package/scripts/universal-facade-maintainability.mjs +0 -91
  1412. package/scripts/universal-workflow-backflow.mjs +0 -212
  1413. package/scripts/universal-workflow-engine.mjs +0 -620
  1414. package/scripts/universal-workflow-self-dogfood.mjs +0 -212
  1415. package/scripts/validate-package-manager-contract.mjs +0 -24
  1416. package/scripts/verify-artifact-signing-results.mjs +0 -124
  1417. package/scripts/verify-publish-channel-ref.mjs +0 -125
  1418. package/scripts/verify-publish-source-lock.mjs +0 -37
  1419. package/scripts/verify-release-pr.mjs +0 -34
  1420. package/scripts/verify-version-state-delta.mjs +0 -175
  1421. package/scripts/verify-web-surface-publication-capability.mjs +0 -78
  1422. package/scripts/web-surface-core.mjs +0 -2603
  1423. package/scripts/web-surface-production-decision.mjs +0 -158
  1424. package/scripts/web-surface-production-release-pr.mjs +0 -712
  1425. package/scripts/web-surface-release-feedback.mjs +0 -358
  1426. package/scripts/web-surface-release-pr-review.mjs +0 -187
  1427. package/scripts/web-surface.mjs +0 -460
  1428. package/scripts/workflow-call-contract.mjs +0 -133
  1429. package/scripts/workflow-friction-report.mjs +0 -375
  1430. package/scripts/workflow-taxonomy.mjs +0 -507
  1431. /package/actions/{macos-credential-island → build/credential/macos-island}/README.md +0 -0
  1432. /package/actions/{release-candidate-promote → release/promotion/candidate}/README.md +0 -0
  1433. /package/actions/{release-tail → release/tail/settle}/README.md +0 -0
  1434. /package/packages/core/{adopter-delivery-gate.js → adoption/adopter-delivery-gate.js} +0 -0
  1435. /package/packages/core/{adopter-delivery-json.js → adoption/adopter-delivery-json.js} +0 -0
  1436. /package/packages/core/{adopter-delivery-passport.js → adoption/adopter-delivery-passport.js} +0 -0
  1437. /package/packages/core/{adopter-delivery-vectors.js → adoption/adopter-delivery-vectors.js} +0 -0
  1438. /package/packages/core/{adopter-delivery-vectors.json → adoption/adopter-delivery-vectors.json} +0 -0
  1439. /package/packages/core/{buildchain-agent-manuals.js → adoption/buildchain-agent-manuals.js} +0 -0
  1440. /package/packages/core/{kfd-adopter-category-driver.js → adoption/kfd-adopter-category-driver.js} +0 -0
  1441. /package/packages/core/{kfd-adopter-manifest.js → adoption/kfd-adopter-manifest.js} +0 -0
  1442. /package/packages/core/{kfd-gate.js → adoption/kfd-gate.js} +0 -0
  1443. /package/packages/core/{kfd-product-gates.js → adoption/kfd-product-gates.js} +0 -0
  1444. /package/packages/core/{artifact-signing-result.js → build/artifact-signing-result.js} +0 -0
  1445. /package/packages/core/{artifact-signing.js → build/artifact-signing.js} +0 -0
  1446. /package/packages/core/{build-configuration.js → build/build-configuration.js} +0 -0
  1447. /package/{scripts → packages/core/build/commands}/resolve-artifact-signing-upload-route.mjs +0 -0
  1448. /package/packages/core/{detached-artifact-signature.js → build/detached-artifact-signature.js} +0 -0
  1449. /package/{scripts/gate-profile-core.mjs → packages/core/build/gate/contracts.js} +0 -0
  1450. /package/packages/core/{portable-dev-cache.js → build/portable-dev-cache.js} +0 -0
  1451. /package/packages/core/{buildchain-channel-identity.js → consumer/buildchain-channel-identity.js} +0 -0
  1452. /package/packages/core/{floating-consumer-release-passport.js → consumer/floating-consumer-release-passport.js} +0 -0
  1453. /package/packages/core/{runtime-ref-resume-authority.js → consumer/runtime-ref-resume-authority.js} +0 -0
  1454. /package/packages/core/{buildchain-layout.js → contracts/buildchain-layout.js} +0 -0
  1455. /package/{bin/internal → packages/core/contracts}/command-registry.mjs +0 -0
  1456. /package/packages/core/{kungfu-temporal-fact.js → contracts/kungfu-temporal-fact.js} +0 -0
  1457. /package/packages/core/{surface-manifest.js → contracts/surface-manifest.js} +0 -0
  1458. /package/packages/core/{workflow-call-contract.js → contracts/workflow-call-contract.js} +0 -0
  1459. /package/{scripts → packages/core/dev-delivery/commands}/project-cut-merge-queue-admission.mjs +0 -0
  1460. /package/packages/core/{dev-delivery-authority-evidence.js → dev-delivery/dev-delivery-authority-evidence.js} +0 -0
  1461. /package/packages/core/{dev-delivery-authority-observation.js → dev-delivery/dev-delivery-authority-observation.js} +0 -0
  1462. /package/packages/core/{dev-delivery-authority-qualification.js → dev-delivery/dev-delivery-authority-qualification.js} +0 -0
  1463. /package/packages/core/{dev-delivery-authority-settlement.js → dev-delivery/dev-delivery-authority-settlement.js} +0 -0
  1464. /package/packages/core/{dev-delivery-common.js → dev-delivery/dev-delivery-common.js} +0 -0
  1465. /package/packages/core/{dev-delivery-execution-failure.js → dev-delivery/dev-delivery-execution-failure.js} +0 -0
  1466. /package/packages/core/{dev-delivery-execution-transfer.js → dev-delivery/dev-delivery-execution-transfer.js} +0 -0
  1467. /package/packages/core/{dev-delivery-landing-admission-core.js → dev-delivery/dev-delivery-landing-admission-core.js} +0 -0
  1468. /package/packages/core/{dev-delivery-landing-readback.js → dev-delivery/dev-delivery-landing-readback.js} +0 -0
  1469. /package/packages/core/{dev-delivery-landing-terminal-evidence.js → dev-delivery/dev-delivery-landing-terminal-evidence.js} +0 -0
  1470. /package/packages/core/{dev-delivery-landing-testing-port.js → dev-delivery/dev-delivery-landing-testing-port.js} +0 -0
  1471. /package/packages/core/{dev-delivery-native-execution.js → dev-delivery/dev-delivery-native-execution.js} +0 -0
  1472. /package/packages/core/{dev-delivery-process-boundary.js → dev-delivery/dev-delivery-process-boundary.js} +0 -0
  1473. /package/packages/core/{dev-delivery-provider-attempt.js → dev-delivery/dev-delivery-provider-attempt.js} +0 -0
  1474. /package/packages/core/{dev-delivery-provider-heartbeat.js → dev-delivery/dev-delivery-provider-heartbeat.js} +0 -0
  1475. /package/packages/core/{dev-delivery-warrant-cancellation.js → dev-delivery/dev-delivery-warrant-cancellation.js} +0 -0
  1476. /package/packages/core/{dev-delivery-warrant-qualification.js → dev-delivery/dev-delivery-warrant-qualification.js} +0 -0
  1477. /package/packages/core/{dev-delivery-warrant-settlement.js → dev-delivery/dev-delivery-warrant-settlement.js} +0 -0
  1478. /package/packages/core/{dev-delivery-writer-protocol-transition.js → dev-delivery/dev-delivery-writer-protocol-transition.js} +0 -0
  1479. /package/packages/core/{engineering-housekeeper-github-client.js → governance/engineering-housekeeper-github-client.js} +0 -0
  1480. /package/packages/core/{engineering-housekeeper-github.js → governance/engineering-housekeeper-github.js} +0 -0
  1481. /package/packages/core/{engineering-housekeeper.js → governance/engineering-housekeeper.js} +0 -0
  1482. /package/packages/core/{issue-reporting.js → governance/issue-reporting.js} +0 -0
  1483. /package/packages/core/{cache-evidence.js → observability/cache-evidence.js} +0 -0
  1484. /package/packages/core/{candidate-timeline.js → observability/candidate-timeline.js} +0 -0
  1485. /package/packages/core/{logging.js → observability/logging.js} +0 -0
  1486. /package/packages/core/{paper-work.js → paper/paper-work.js} +0 -0
  1487. /package/{scripts → packages/core/providers/commands}/aws-macos-jit-controller-core.mjs +0 -0
  1488. /package/{scripts → packages/core/providers/commands}/aws-macos-jit-controller.mjs +0 -0
  1489. /package/{scripts → packages/core/providers/commands}/aws-macos-jit-core.mjs +0 -0
  1490. /package/{scripts → packages/core/providers/commands}/aws-macos-jit-job-controller.mjs +0 -0
  1491. /package/{scripts → packages/core/providers/commands}/aws-macos-jit.mjs +0 -0
  1492. /package/{scripts → packages/core/providers/commands}/aws-windows-jit-campaign-core.mjs +0 -0
  1493. /package/{scripts → packages/core/providers/commands}/aws-windows-jit-controller-core.mjs +0 -0
  1494. /package/{scripts → packages/core/providers/commands}/aws-windows-jit-core.mjs +0 -0
  1495. /package/{scripts → packages/core/providers/commands}/aws-windows-jit.mjs +0 -0
  1496. /package/{scripts → packages/core/providers/commands}/github-output.mjs +0 -0
  1497. /package/packages/core/{oci-publication-graph.js → publication/oci-publication-graph.js} +0 -0
  1498. /package/packages/core/{publication-control-plane-audit.js → publication/publication-control-plane-audit.js} +0 -0
  1499. /package/packages/core/{publication-qualification.js → publication/publication-qualification.js} +0 -0
  1500. /package/packages/core/{publication-rehearsal-provider-bindings.js → publication/publication-rehearsal-provider-bindings.js} +0 -0
  1501. /package/packages/core/{publication-sealed-bundle.js → publication/publication-sealed-bundle.js} +0 -0
  1502. /package/packages/core/{channel-candidate.js → release/channel-candidate.js} +0 -0
  1503. /package/packages/core/{channel-promotion-baseline.js → release/channel-promotion-baseline.js} +0 -0
  1504. /package/{scripts → packages/core/release/commands}/promotion-routing-evidence.mjs +0 -0
  1505. /package/packages/core/{dev-alpha-active-release-train.js → release/dev-alpha-active-release-train.js} +0 -0
  1506. /package/packages/core/{dev-alpha-candidate-selection.js → release/dev-alpha-candidate-selection.js} +0 -0
  1507. /package/packages/core/{next-development-candidate-reservation.js → release/next-development-candidate-reservation.js} +0 -0
  1508. /package/packages/core/{next-development-controller.js → release/next-development-controller.js} +0 -0
  1509. /package/packages/core/{publish-transaction.js → release/publish-transaction.js} +0 -0
  1510. /package/packages/core/{release-activation-transaction.js → release/release-activation-transaction.js} +0 -0
  1511. /package/packages/core/{release-propagation-agent-entry.js → release/release-propagation-agent-entry.js} +0 -0
  1512. /package/packages/core/{release-propagation-capture.js → release/release-propagation-capture.js} +0 -0
  1513. /package/packages/core/{release-propagation-common.js → release/release-propagation-common.js} +0 -0
  1514. /package/packages/core/{release-propagation-execution-profile.js → release/release-propagation-execution-profile.js} +0 -0
  1515. /package/packages/core/{release-propagation-pickup.js → release/release-propagation-pickup.js} +0 -0
  1516. /package/packages/core/{release-propagation-push.js → release/release-propagation-push.js} +0 -0
  1517. /package/packages/core/{release-propagation-release.js → release/release-propagation-release.js} +0 -0
  1518. /package/packages/core/{release-propagation-stage-evidence.js → release/release-propagation-stage-evidence.js} +0 -0
  1519. /package/packages/core/{release-propagation-work-capture.js → release/release-propagation-work-capture.js} +0 -0
  1520. /package/packages/core/{release-propagation-work-constants.js → release/release-propagation-work-constants.js} +0 -0
  1521. /package/packages/core/{release-propagation-work-control.js → release/release-propagation-work-control.js} +0 -0
  1522. /package/packages/core/{release-propagation-work-transitions.js → release/release-propagation-work-transitions.js} +0 -0
  1523. /package/packages/core/{release-propagation-work.js → release/release-propagation-work.js} +0 -0
  1524. /package/packages/core/{release-propagation.js → release/release-propagation.js} +0 -0
  1525. /package/packages/core/{release-tail-product-capabilities.js → release/release-tail-product-capabilities.js} +0 -0
  1526. /package/packages/core/{release-train.js → release/release-train.js} +0 -0
  1527. /package/packages/core/{self-dogfood-version.js → release/self-dogfood-version.js} +0 -0
  1528. /package/packages/core/{stable-candidate-ledger.js → release/stable-candidate-ledger.js} +0 -0
  1529. /package/packages/core/{stable-release-gate.js → release/stable-release-gate.js} +0 -0
  1530. /package/packages/core/{tail-reseal-contract.js → release/tail-reseal-contract.js} +0 -0
  1531. /package/packages/core/{domain-wasm.js → runtime/domain-wasm.js} +0 -0
  1532. /package/packages/core/{spawn-command.js → runtime/spawn-command.js} +0 -0
  1533. /package/packages/core/{badges.js → web/badges.js} +0 -0
  1534. /package/{scripts → packages/core/web/commands}/web-surface-cloudfront-rewrite.mjs +0 -0
  1535. /package/{scripts → packages/core/web/commands}/web-surface-immutable-object.mjs +0 -0
  1536. /package/{scripts → packages/core/web/commands}/web-surface-routing.mjs +0 -0
@@ -1,2884 +0,0 @@
1
- import crypto from "node:crypto";
2
- import { spawnSync } from "node:child_process";
3
- import fs from "node:fs";
4
- import http from "node:http";
5
- import https from "node:https";
6
- import os from "node:os";
7
- import path from "node:path";
8
- import {
9
- createKfd1ReleaseGateEvidence,
10
- createKfd3CollaborationInterfaceReleaseGateEvidence,
11
- resolveKfd1Metadata,
12
- resolveKfd3Metadata,
13
- validateKfd2TrustTaxonomyEntry,
14
- validateKfd1ReleaseGateEvidence,
15
- validateKfd3CollaborationInterfaceReleaseGateEvidence,
16
- } from "./kfd-gate.js";
17
- import {
18
- RELEASE_CHECK_REPORT_CONTRACT,
19
- RELEASE_PASSPORT_CONTRACT,
20
- buildReleaseArtifactEvidence,
21
- collectKfdAdopterReleaseEvidence,
22
- defaultReleaseAgentIndex as defaultAgentIndex,
23
- defaultReleaseImpact as defaultImpact,
24
- defaultReleaseLlmsText as defaultLlmsText,
25
- defaultReleaseProductMechanism as defaultProductMechanism,
26
- prepareReleasePassportKfdSections,
27
- resolveReleasePassportVerificationInputs,
28
- validateKfdAdopterReleaseEvidence,
29
- } from "./release-passport-contract.js";
30
- import { createSurfaceTimestampPolicy } from "./surface-manifest.js";
31
- import { validatePublishEvidence as validateTransactionPublishEvidence } from "./publish-transaction.js";
32
- import { normalizeControllerReceiptReferences } from "./controller-evidence.js";
33
- import {
34
- normalizeGitHubArtifactAttestationPolicy,
35
- } from "./github-artifact-attestation.js";
36
- import { verifyFloatingConsumerPolicyCertification } from "./floating-consumer-evidence.js";
37
- import {
38
- normalizePromotionEvidence,
39
- normalizePromotionRouting,
40
- normalizeRuntimeResumeEvidence,
41
- isPromotionRouting,
42
- releasePassportCertificationVerificationOptions,
43
- requireConsumerPolicyCertification,
44
- resolveConsumerPolicyCertificationIdentity,
45
- } from "./floating-consumer-release-passport.js";
46
- import {
47
- verifyRuntimeAuthorizationReceipt,
48
- verifyRuntimeResumeLineage,
49
- } from "./runtime-ref-resume-authority.js";
50
-
51
- export { RELEASE_CHECK_REPORT_CONTRACT, RELEASE_PASSPORT_CONTRACT };
52
- export const ARTIFACT_EVIDENCE_CONTRACT = "kungfu-buildchain-artifact-evidence";
53
- export const IMPACT_LEDGER_CONTRACT = "kungfu-buildchain-impact";
54
- export const AGENT_INDEX_CONTRACT = "kungfu-buildchain-agent-index";
55
- export const PRODUCT_MECHANISM_CONTRACT = "kungfu-buildchain-product-mechanism";
56
- export const RELEASE_EVIDENCE_ATTACHMENT_CONTRACT = "kungfu-buildchain-release-evidence-attachment";
57
- export const KFD2_RELEASE_TRUST_PASSPORT_CONTRACT = "kungfu-buildchain-kfd-2-release-trust-passport-audit";
58
- export const KFD2_TRUST_PROOF_CONTRACT = "kungfu-buildchain-kfd-2-trust-proof";
59
- export const INVARIANT_PASSPORT_GATE_CONTRACT = "buildchain.invariant-passport-gate/v1";
60
- export const KFD_AGENT_HUB_RELEASE_EVIDENCE_CONTRACT = "kungfu-buildchain-kfd-agent-hub-release-evidence/v1";
61
-
62
- const CONTRACTS = new Set([
63
- RELEASE_PASSPORT_CONTRACT,
64
- ARTIFACT_EVIDENCE_CONTRACT,
65
- IMPACT_LEDGER_CONTRACT,
66
- AGENT_INDEX_CONTRACT,
67
- PRODUCT_MECHANISM_CONTRACT,
68
- RELEASE_EVIDENCE_ATTACHMENT_CONTRACT,
69
- ]);
70
-
71
- function nowIso() {
72
- return new Date().toISOString();
73
- }
74
-
75
- function nonEmptyString(value, label) {
76
- const normalized = String(value || "").trim();
77
- if (!normalized) {
78
- throw new Error(`${label} must be a non-empty string`);
79
- }
80
- return normalized;
81
- }
82
-
83
- function optionalString(value) {
84
- return value === undefined || value === null ? "" : String(value);
85
- }
86
-
87
- const VERSION_IMPACT_ORDER = new Map([
88
- ["unknown", 0],
89
- ["patch", 1],
90
- ["minor", 2],
91
- ["major", 3],
92
- ]);
93
-
94
- function normalizeImpactLevel(value, fallback = "unknown") {
95
- const normalized = optionalString(value || fallback).toLowerCase();
96
- return VERSION_IMPACT_ORDER.has(normalized) ? normalized : optionalString(value || fallback);
97
- }
98
-
99
- function highestImpactLevel(levels = []) {
100
- let highest = "unknown";
101
- for (const level of levels) {
102
- const normalized = normalizeImpactLevel(level);
103
- if ((VERSION_IMPACT_ORDER.get(normalized) ?? -1) > (VERSION_IMPACT_ORDER.get(highest) ?? -1)) {
104
- highest = normalized;
105
- }
106
- }
107
- return highest;
108
- }
109
-
110
- function surfaceImpactRequirement({ passport = {}, impact = {} } = {}) {
111
- const release = passport?.release && typeof passport.release === "object" ? passport.release : {};
112
- const impactRelease = impact?.release && typeof impact.release === "object" ? impact.release : {};
113
- const channel = optionalString(release.channel || impactRelease.channel).toLowerCase();
114
- const targetRef = optionalString(
115
- release.targetRef ||
116
- release.target_ref ||
117
- impactRelease.targetRef ||
118
- impactRelease.target_ref,
119
- ).toLowerCase();
120
- if (channel === "release" || targetRef.startsWith("release/")) {
121
- return {
122
- required: true,
123
- type: "production-release",
124
- reason: "production release passports require surfaceImpacts[] so agents can audit the final version impact",
125
- channel,
126
- targetRef,
127
- };
128
- }
129
- if (channel === "major" || targetRef === "publish-gate/major" || targetRef === "major-gate") {
130
- return {
131
- required: true,
132
- type: "major-gate",
133
- reason: "major publish gates require surfaceImpacts[] so breaking-surface rationale is explicit",
134
- channel,
135
- targetRef,
136
- };
137
- }
138
- return {
139
- required: false,
140
- type: channel || (targetRef ? "non-production-release" : "legacy"),
141
- reason: "surfaceImpacts[] is optional for alpha, local, and legacy passport contexts",
142
- channel,
143
- targetRef,
144
- };
145
- }
146
-
147
- function stableJson(value) {
148
- if (Array.isArray(value)) {
149
- return `[${value.map(stableJson).join(",")}]`;
150
- }
151
- if (value && typeof value === "object") {
152
- return `{${Object.keys(value)
153
- .sort()
154
- .map((key) => `${JSON.stringify(key)}:${stableJson(value[key])}`)
155
- .join(",")}}`;
156
- }
157
- return JSON.stringify(value);
158
- }
159
-
160
- export function sha256Text(value) {
161
- return crypto.createHash("sha256").update(value).digest("hex");
162
- }
163
-
164
- function invariantSemanticPreimage(passport) {
165
- const value = structuredClone(passport);
166
- delete value.passportRoot;
167
- delete value.observedAt;
168
- return value;
169
- }
170
-
171
- function normalizeInvariantPassport(meta, index = 0) {
172
- const value = meta?.value;
173
- const label = `invariantPassportJsons[${index}]`;
174
- if (!value || typeof value !== "object" || Array.isArray(value)) {
175
- throw new Error(`${label} must be a JSON object`);
176
- }
177
- for (const field of ["schema", "product", "canonicalization", "passportRoot", "contractRoot", "registryRoot", "verdict"]) {
178
- nonEmptyString(value[field], `${label}.${field}`);
179
- }
180
- if (value.canonicalization !== "stable-json-sha256-v1") {
181
- throw new Error(`${label}.canonicalization must be stable-json-sha256-v1`);
182
- }
183
- if (!/^sha256:[0-9a-f]{64}$/.test(value.passportRoot)) {
184
- throw new Error(`${label}.passportRoot must be sha256:<64-lowercase-hex>`);
185
- }
186
- const expectedRoot = `sha256:${sha256Text(stableJson(invariantSemanticPreimage(value)))}`;
187
- if (value.passportRoot !== expectedRoot) {
188
- throw new Error(`${label}.passportRoot mismatch: expected ${expectedRoot}, got ${value.passportRoot}`);
189
- }
190
- if (value.verdict !== "verified") {
191
- throw new Error(`${label}.verdict must be verified, got ${value.verdict}`);
192
- }
193
- if (value.coverage?.complete !== true) {
194
- throw new Error(`${label}.coverage.complete must be true`);
195
- }
196
- if (value.source?.dirty !== false) {
197
- throw new Error(`${label}.source.dirty must be false`);
198
- }
199
- if (!/^[0-9a-f]{40}$/.test(optionalString(value.source?.revision))) {
200
- throw new Error(`${label}.source.revision must be an exact 40-hex revision`);
201
- }
202
- const platforms = Array.isArray(value.coverage?.platforms)
203
- ? [...new Set(value.coverage.platforms.map(String))].sort()
204
- : [];
205
- if (platforms.length === 0) throw new Error(`${label}.coverage.platforms must be non-empty`);
206
- if (!Array.isArray(value.residualRisk)) throw new Error(`${label}.residualRisk must be an array`);
207
- return {
208
- path: optionalString(meta.path),
209
- sha256: optionalString(meta.sha256),
210
- schema: value.schema,
211
- product: value.product,
212
- passportRoot: value.passportRoot,
213
- contractRoot: value.contractRoot,
214
- registryRoot: value.registryRoot,
215
- verdict: value.verdict,
216
- source: structuredClone(value.source),
217
- coverage: structuredClone(value.coverage),
218
- platforms,
219
- residualRisk: structuredClone(value.residualRisk),
220
- };
221
- }
222
-
223
- export function createInvariantPassportGate(passportMetas = []) {
224
- const passports = passportMetas.filter((meta) => meta?.value).map(normalizeInvariantPassport);
225
- if (passports.length === 0) return undefined;
226
- return {
227
- contract: INVARIANT_PASSPORT_GATE_CONTRACT,
228
- result: "passed",
229
- passports,
230
- responsibility: {
231
- invariantSemanticsOwner: "consumer",
232
- passportVerificationOwner: "consumer",
233
- releaseAdmissionOwner: "Buildchain",
234
- },
235
- };
236
- }
237
-
238
- export function sha256File(filePath) {
239
- return crypto.createHash("sha256").update(fs.readFileSync(filePath)).digest("hex");
240
- }
241
-
242
- function readJsonFile(filePath) {
243
- return JSON.parse(fs.readFileSync(filePath, "utf8"));
244
- }
245
-
246
- function resolveJsonInputPath(input, { cwd = process.cwd() } = {}) {
247
- const normalized = String(input || "").trim();
248
- if (!normalized) {
249
- return "";
250
- }
251
- if (path.isAbsolute(normalized)) {
252
- return fs.existsSync(normalized) ? normalized : "";
253
- }
254
- const cwdCandidate = cwd ? path.resolve(cwd, normalized) : "";
255
- if (cwdCandidate && fs.existsSync(cwdCandidate)) {
256
- return cwdCandidate;
257
- }
258
- return fs.existsSync(normalized) ? path.resolve(normalized) : "";
259
- }
260
-
261
- function jsonInputError({ input, label, cwd, cause }) {
262
- const suffix = cwd ? ` or an existing JSON file path relative to ${cwd}` : " or an existing JSON file path";
263
- return new Error(`${label} must be valid JSON${suffix}; received ${JSON.stringify(input)}`, { cause });
264
- }
265
-
266
- function writeJsonFile(filePath, value) {
267
- fs.mkdirSync(path.dirname(filePath), { recursive: true });
268
- fs.writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\n`);
269
- }
270
-
271
- function writeTextFile(filePath, value) {
272
- fs.mkdirSync(path.dirname(filePath), { recursive: true });
273
- fs.writeFileSync(filePath, value.endsWith("\n") ? value : `${value}\n`);
274
- }
275
-
276
- function normalizeReleaseEvidenceAttachment(meta, {
277
- cwd,
278
- expectedSourceSha,
279
- expectedTag,
280
- expectedChannel,
281
- index,
282
- } = {}) {
283
- const document = meta?.value;
284
- if (!document || typeof document !== "object" || Array.isArray(document)) {
285
- throw new Error(`releaseEvidenceJsons[${index}] must be a JSON object`);
286
- }
287
- const inputPath = resolveJsonInputPath(meta.path, { cwd });
288
- if (!inputPath) {
289
- throw new Error(`releaseEvidenceJsons[${index}] must be an existing JSON file path`);
290
- }
291
- if (Number(document.schemaVersion) !== 1) {
292
- throw new Error(`releaseEvidenceJsons[${index}].schemaVersion must be 1`);
293
- }
294
- const id = nonEmptyString(document.id, `releaseEvidenceJsons[${index}].id`);
295
- if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(id)) {
296
- throw new Error(`releaseEvidenceJsons[${index}].id must use only letters, digits, dot, underscore, or hyphen`);
297
- }
298
- const contract = nonEmptyString(document.contract, `releaseEvidenceJsons[${index}].contract`);
299
- const release = document.release;
300
- if (!release || typeof release !== "object" || Array.isArray(release)) {
301
- throw new Error(`releaseEvidenceJsons[${index}].release must be a JSON object`);
302
- }
303
- const sourceSha = nonEmptyString(release.sourceSha, `releaseEvidenceJsons[${index}].release.sourceSha`);
304
- const tag = nonEmptyString(release.tag, `releaseEvidenceJsons[${index}].release.tag`);
305
- const channel = nonEmptyString(release.channel, `releaseEvidenceJsons[${index}].release.channel`);
306
- if (!/^[0-9a-f]{40}$/i.test(sourceSha)) {
307
- throw new Error(`releaseEvidenceJsons[${index}].release.sourceSha must be a full 40-character Git SHA`);
308
- }
309
- if (!expectedSourceSha || sourceSha !== expectedSourceSha) {
310
- throw new Error(`releaseEvidenceJsons[${index}].release.sourceSha must match the release passport source SHA`);
311
- }
312
- if (!expectedTag || tag !== expectedTag) {
313
- throw new Error(`releaseEvidenceJsons[${index}].release.tag must match the release passport tag`);
314
- }
315
- if (!expectedChannel || channel !== expectedChannel) {
316
- throw new Error(`releaseEvidenceJsons[${index}].release.channel must match the release passport channel`);
317
- }
318
- const relativePath = `release-evidence-${id}.json`;
319
- return {
320
- document,
321
- inputPath,
322
- reference: {
323
- schemaVersion: 1,
324
- contract: RELEASE_EVIDENCE_ATTACHMENT_CONTRACT,
325
- id,
326
- kind: optionalString(document.kind || "product-release-evidence"),
327
- documentContract: contract,
328
- path: relativePath,
329
- sha256: sha256Text(stableJson(document)),
330
- release: { sourceSha, tag, channel },
331
- },
332
- };
333
- }
334
-
335
- function inferPlatformFromName(name) {
336
- const lower = String(name || "").toLowerCase();
337
- if (lower.includes("apple-darwin") || lower.includes("darwin") || lower.includes("macos")) {
338
- return lower.includes("aarch64") || lower.includes("arm64") ? "darwin-arm64" : "darwin-x64";
339
- }
340
- if (lower.includes("windows") || lower.includes("pc-windows") || lower.endsWith(".zip")) {
341
- return "windows-x64";
342
- }
343
- if (lower.includes("linux") || lower.includes("unknown-linux")) {
344
- return lower.includes("aarch64") || lower.includes("arm64") ? "linux-arm64" : "linux-x64";
345
- }
346
- return "";
347
- }
348
-
349
- function normalizeAsset(asset, index = 0) {
350
- const name = nonEmptyString(asset.name || asset.filename, `assets[${index}].name`);
351
- const digest = optionalString(asset.digest || asset.sha256 || asset.checksum);
352
- const sha256 = digest.replace(/^sha256:/, "");
353
- return {
354
- name,
355
- kind: optionalString(asset.kind || "release-asset"),
356
- platform: optionalString(asset.platform || inferPlatformFromName(name)),
357
- size: Number(asset.size || asset.sizeBytes || 0),
358
- url: optionalString(asset.browser_download_url || asset.downloadUrl || asset.url),
359
- githubAssetId: optionalString(asset.id || asset.githubAssetId),
360
- sha256,
361
- sourcePath: optionalString(asset.path || asset.sourcePath),
362
- };
363
- }
364
-
365
- function parseJsonInput(value, fallback = undefined, { cwd = process.cwd(), label = "JSON input" } = {}) {
366
- const input = String(value || "").trim();
367
- if (!input) {
368
- return fallback;
369
- }
370
- const filePath = resolveJsonInputPath(input, { cwd });
371
- if (filePath) {
372
- return readJsonFile(filePath);
373
- }
374
- try {
375
- return JSON.parse(input);
376
- } catch (error) {
377
- throw jsonInputError({ input, label, cwd, cause: error });
378
- }
379
- }
380
-
381
- function parseJsonInputWithMeta(value, fallback = undefined, { cwd = process.cwd(), label = "JSON input" } = {}) {
382
- const input = String(value || "").trim();
383
- if (!input) {
384
- return { value: fallback, path: "", sha256: "" };
385
- }
386
- const filePath = resolveJsonInputPath(input, { cwd });
387
- if (filePath) {
388
- return {
389
- value: readJsonFile(filePath),
390
- path: input,
391
- sha256: sha256File(filePath),
392
- };
393
- }
394
- let parsed;
395
- try {
396
- parsed = JSON.parse(input);
397
- } catch (error) {
398
- throw jsonInputError({ input, label, cwd, cause: error });
399
- }
400
- return {
401
- value: parsed,
402
- path: "",
403
- sha256: sha256Text(stableJson(parsed)),
404
- };
405
- }
406
-
407
- function mergeAuthoritativePassportBase(passport, basePassport = undefined, { requireKfd = false } = {}) {
408
- if (!basePassport) {
409
- if (requireKfd) {
410
- throw new Error("release passport base with KFD evidence is required");
411
- }
412
- return passport;
413
- }
414
- if (typeof basePassport !== "object" || Array.isArray(basePassport)) {
415
- throw new Error("release passport base must be a JSON object");
416
- }
417
- const kfdKeys = ["kfd-1", "kfd-2", "kfd-3"];
418
- const missingKfd = kfdKeys.filter((key) => (
419
- !basePassport[key] ||
420
- typeof basePassport[key] !== "object" ||
421
- Array.isArray(basePassport[key])
422
- ));
423
- if (requireKfd && missingKfd.length > 0) {
424
- throw new Error(`release passport base is missing required KFD sections: ${missingKfd.join(", ")}`);
425
- }
426
- const merged = {
427
- ...passport,
428
- release: {
429
- ...(passport.release && typeof passport.release === "object" && !Array.isArray(passport.release) ? passport.release : {}),
430
- ...(basePassport.release && typeof basePassport.release === "object" && !Array.isArray(basePassport.release) ? basePassport.release : {}),
431
- },
432
- evidence: {
433
- ...(passport.evidence && typeof passport.evidence === "object" && !Array.isArray(passport.evidence) ? passport.evidence : {}),
434
- kfd1: basePassport.evidence?.kfd1 || passport.evidence?.kfd1 || "",
435
- kfd2: basePassport.evidence?.kfd2 || passport.evidence?.kfd2 || "",
436
- kfd3: basePassport.evidence?.kfd3 || passport.evidence?.kfd3 || "",
437
- },
438
- };
439
- for (const key of [
440
- "versionImpact",
441
- "surfaceImpacts",
442
- "promotionRouting",
443
- "v4ConsumerPolicy",
444
- "v4RuntimeResume",
445
- "transaction",
446
- "trustedPublishing",
447
- "distTagPromotion",
448
- ])
449
- if (basePassport[key] !== undefined) merged[key] = basePassport[key];
450
- if (basePassport.controllerReceipts !== undefined) {
451
- merged.controllerReceipts = basePassport.controllerReceipts;
452
- }
453
- for (const key of kfdKeys) {
454
- if (basePassport[key] && typeof basePassport[key] === "object" && !Array.isArray(basePassport[key])) {
455
- merged[key] = basePassport[key];
456
- }
457
- }
458
- return merged;
459
- }
460
-
461
- function mergeAuthoritativeImpactBase(impact, basePassport = undefined) {
462
- if (!basePassport || typeof basePassport !== "object" || Array.isArray(basePassport)) {
463
- return impact;
464
- }
465
- const merged = { ...impact };
466
- if (optionalString(impact?.release?.version)) {
467
- return merged;
468
- }
469
- if (basePassport.versionImpact && typeof basePassport.versionImpact === "object" && !Array.isArray(basePassport.versionImpact)) {
470
- merged.versionImpact = {
471
- ...(impact.versionImpact && typeof impact.versionImpact === "object" && !Array.isArray(impact.versionImpact) ? impact.versionImpact : {}),
472
- ...basePassport.versionImpact,
473
- };
474
- }
475
- if (Array.isArray(basePassport.surfaceImpacts)) {
476
- merged.surfaceImpacts = basePassport.surfaceImpacts;
477
- }
478
- for (const key of ["classification", "breaking", "security", "migrationRequired", "summary"]) {
479
- if (basePassport[key] !== undefined) {
480
- merged[key] = basePassport[key];
481
- }
482
- }
483
- return merged;
484
- }
485
-
486
- function parseJsonCommandOutput({ command = "", cwd = process.cwd(), label = "command" } = {}) {
487
- const normalized = String(command || "").trim();
488
- if (!normalized) {
489
- return { value: undefined, path: "", sha256: "" };
490
- }
491
- const result = spawnSync(normalized, [], {
492
- cwd,
493
- shell: true,
494
- encoding: "utf8",
495
- maxBuffer: 16 * 1024 * 1024,
496
- });
497
- if (result.error) {
498
- throw new Error(`${label} failed to start: ${result.error.message}`);
499
- }
500
- if (result.status !== 0) {
501
- const stderr = String(result.stderr || "").trim();
502
- throw new Error(`${label} exited with ${result.status}${stderr ? `: ${stderr.slice(-1000)}` : ""}`);
503
- }
504
- const stdout = String(result.stdout || "").trim();
505
- if (!stdout) {
506
- throw new Error(`${label} produced no JSON on stdout`);
507
- }
508
- let parsed;
509
- try {
510
- parsed = JSON.parse(stdout);
511
- } catch (error) {
512
- throw new Error(`${label} output must be valid JSON: ${error.message}`, { cause: error });
513
- }
514
- return {
515
- value: parsed,
516
- path: "",
517
- sha256: sha256Text(stableJson(parsed)),
518
- };
519
- }
520
-
521
- function discoverAssetsFromDir(dir) {
522
- if (!dir || !fs.existsSync(dir)) {
523
- return [];
524
- }
525
- return fs
526
- .readdirSync(dir, { withFileTypes: true })
527
- .filter((entry) => entry.isFile())
528
- .map((entry, index) => {
529
- const filePath = path.join(dir, entry.name);
530
- return normalizeAsset({
531
- name: entry.name,
532
- path: filePath,
533
- size: fs.statSync(filePath).size,
534
- sha256: sha256File(filePath),
535
- }, index);
536
- })
537
- .sort((a, b) => a.name.localeCompare(b.name));
538
- }
539
-
540
- function readPackageVersion(cwd) {
541
- const packagePath = path.join(cwd, "package.json");
542
- if (!fs.existsSync(packagePath)) {
543
- return "";
544
- }
545
- try {
546
- return readJsonFile(packagePath).version || "";
547
- } catch {
548
- return "";
549
- }
550
- }
551
-
552
- function normalizePackageEntry(entry = {}) {
553
- return {
554
- name: optionalString(entry.name),
555
- version: optionalString(entry.version || entry.ref),
556
- distTag: optionalString(entry.distTag || entry.dist_tag),
557
- digest: optionalString(entry.digest || entry.integrity || entry.sha256 || entry.shasum),
558
- registry: optionalString(entry.registry),
559
- platform: optionalString(entry.platform),
560
- action: optionalString(entry.action),
561
- };
562
- }
563
-
564
- function normalizePackageSet(value = undefined, { packageName = "", packageVersion = "", publish = {} } = {}) {
565
- if (!value) {
566
- return undefined;
567
- }
568
- const rawMain = value.main || value.mainPackage || {
569
- name: value.main_package || packageName,
570
- version: value.version || packageVersion,
571
- distTag: value.distTag || value.dist_tag || publish.distTag,
572
- };
573
- const platforms = Array.isArray(value.platforms)
574
- ? value.platforms.map((entry) => normalizePackageEntry(entry)).filter((entry) => entry.name || entry.version)
575
- : [];
576
- return {
577
- order: optionalString(value.order || value.packageSetOrder || value.package_set_order || publish.packageSetOrder),
578
- registry: optionalString(value.registry || publish.registry),
579
- main: normalizePackageEntry(rawMain),
580
- platforms,
581
- };
582
- }
583
-
584
- function normalizeAnchorManifest(meta) {
585
- const value = meta?.value;
586
- if (!value) {
587
- return undefined;
588
- }
589
- return {
590
- path: optionalString(value.path || meta.path),
591
- sha256: optionalString(value.sha256 || meta.sha256),
592
- fields: value.fields && typeof value.fields === "object" && !Array.isArray(value.fields)
593
- ? value.fields
594
- : value,
595
- };
596
- }
597
-
598
- function normalizeEvidenceDocument(meta, label) {
599
- const value = meta?.value;
600
- if (!value) {
601
- return undefined;
602
- }
603
- if (!value || typeof value !== "object" || Array.isArray(value)) {
604
- throw new Error(`${label} must be a JSON object`);
605
- }
606
- return {
607
- path: optionalString(meta.path),
608
- sha256: optionalString(meta.sha256),
609
- fields: value,
610
- };
611
- }
612
-
613
- function normalizeKfdAgentHubEvidence(meta) {
614
- const value = meta?.value;
615
- if (!value) return undefined;
616
- if (value.contract !== "kungfu-buildchain-kfd-agent-hub-evidence/v1") {
617
- throw new Error("kfdAgentHubEvidence must be kungfu-buildchain-kfd-agent-hub-evidence/v1");
618
- }
619
- if (value.qualifying !== false || value.certification !== false) {
620
- throw new Error("kfdAgentHubEvidence must remain nonqualifying and non-certifying");
621
- }
622
- for (const [label, root] of [
623
- ["report.digest", value.report?.digest],
624
- ["lock.root", value.lock?.root],
625
- ["scope.adapterArtifactDigest", value.scope?.adapterArtifactDigest],
626
- ]) {
627
- if (!/^sha256:[0-9a-f]{64}$/.test(optionalString(root))) {
628
- throw new Error(`kfdAgentHubEvidence.${label} must be a sha256 root`);
629
- }
630
- }
631
- if (value.verification?.valid !== true || value.verification?.contract !== "kungfu-buildchain-kfd-agent-hub-verification/v1") {
632
- throw new Error("kfdAgentHubEvidence.verification must bind a valid Buildchain Agent Hub verification");
633
- }
634
- if (value.kfd?.package?.name !== "@kungfu-tech/kfd" || !value.kfd?.package?.version) {
635
- throw new Error("kfdAgentHubEvidence must bind an exact @kungfu-tech/kfd package version");
636
- }
637
- if (value.kfd?.profile?.id !== "kfd-agent-hub-conformance" || value.kfd?.suite?.id !== "kfd-agent-hub-20") {
638
- throw new Error("kfdAgentHubEvidence must bind the KFD Agent Hub conformance profile and fixed suite");
639
- }
640
- const evidenceDigest = `sha256:${sha256Text(stableJson(value))}`;
641
- return {
642
- schemaVersion: 1,
643
- contract: KFD_AGENT_HUB_RELEASE_EVIDENCE_CONTRACT,
644
- evidenceContract: value.contract,
645
- evidenceDigest,
646
- reportDigest: value.report.digest,
647
- lockRoot: value.lock.root,
648
- sourceCut: value.kfd,
649
- scope: value.scope,
650
- qualifying: false,
651
- certification: false,
652
- claimBoundary: optionalString(value.claimBoundary),
653
- };
654
- }
655
-
656
- function normalizePlatformArtifactManifest(meta, index = 0) {
657
- const normalized = normalizeEvidenceDocument(meta, `platformArtifactManifests[${index}]`);
658
- if (!normalized) {
659
- return undefined;
660
- }
661
- const fields = normalized.fields || {};
662
- return {
663
- ...normalized,
664
- platform: optionalString(fields.platform?.id || fields.platformId || fields.platform || ""),
665
- artifactName: optionalString(fields.artifactName || fields.links?.artifactName || ""),
666
- };
667
- }
668
-
669
- function normalizePublishArtifact(artifact = {}, index = 0) {
670
- const name = nonEmptyString(artifact.name, `publishEvidence.artifacts[${index}].name`);
671
- const normalized = {
672
- group: optionalString(artifact.group),
673
- kind: optionalString(artifact.kind),
674
- name,
675
- ref: optionalString(artifact.ref || artifact.version),
676
- digest: optionalString(artifact.digest || artifact.sha256 || artifact.integrity || artifact.shasum),
677
- evidence: optionalString(artifact.evidence),
678
- };
679
- for (const key of [
680
- "action",
681
- "platform",
682
- "contract_major",
683
- "parent_digest",
684
- "content",
685
- "release",
686
- "verification",
687
- ]) {
688
- if (Object.prototype.hasOwnProperty.call(artifact, key)) {
689
- normalized[key] = structuredClone(artifact[key]);
690
- }
691
- }
692
- return normalized;
693
- }
694
-
695
- function normalizePublishEvidence(value = undefined) {
696
- if (!value) {
697
- return undefined;
698
- }
699
- return {
700
- schema: Number(value.schema || value.schemaVersion || 1),
701
- version: optionalString(value.version),
702
- channel: optionalString(value.channel),
703
- sourceSha: optionalString(value.source_sha || value.sourceSha),
704
- releaseSha: optionalString(value.release_sha || value.releaseSha),
705
- targetRef: optionalString(value.target_ref || value.targetRef),
706
- releaseMaterialSha: optionalString(value.release_material_sha || value.releaseMaterialSha),
707
- publishToolingSha: optionalString(value.publish_tooling_sha || value.publishToolingSha),
708
- artifacts: Array.isArray(value.artifacts)
709
- ? value.artifacts.map((artifact, index) => normalizePublishArtifact(artifact, index))
710
- : [],
711
- };
712
- }
713
-
714
- function normalizeSurfaceImpact(entry = {}, index = 0) {
715
- const id = nonEmptyString(entry.id || entry.surface || entry.surfaceId, `surfaceImpacts[${index}].id`);
716
- const impact = normalizeImpactLevel(entry.impact || entry.classification || entry.versionImpact);
717
- return {
718
- id,
719
- impact,
720
- class: optionalString(entry.class || entry.changeClass || entry.change_class),
721
- rationale: optionalString(entry.rationale || entry.reason),
722
- source: optionalString(entry.source),
723
- };
724
- }
725
-
726
- function normalizeImpactLedger(value = undefined, { tag = "", line = "", decision = "unknown" } = {}) {
727
- if (!value) {
728
- return defaultImpact({ tag, line, decision });
729
- }
730
- if (!value || typeof value !== "object" || Array.isArray(value)) {
731
- throw new Error("impact must be a JSON object");
732
- }
733
- const surfaceImpacts = Array.isArray(value.surfaceImpacts)
734
- ? value.surfaceImpacts.map((entry, index) => normalizeSurfaceImpact(entry, index))
735
- : [];
736
- const finalImpact = normalizeImpactLevel(
737
- value.versionImpact?.final ||
738
- value.versionImpact ||
739
- value.classification ||
740
- decision,
741
- );
742
- return {
743
- ...value,
744
- schemaVersion: Number(value.schemaVersion || 1),
745
- contract: value.contract || IMPACT_LEDGER_CONTRACT,
746
- release: {
747
- tag: optionalString(value.release?.tag || tag),
748
- line: optionalString(value.release?.line || line),
749
- ...(value.release && typeof value.release === "object" && !Array.isArray(value.release) ? value.release : {}),
750
- },
751
- versionImpact: {
752
- final: finalImpact,
753
- source: optionalString(value.versionImpact?.source || value.impactSource || "declared"),
754
- rationale: optionalString(value.versionImpact?.rationale || value.rationale || value.summary),
755
- },
756
- surfaceImpacts,
757
- classification: normalizeImpactLevel(value.classification || finalImpact),
758
- breaking: value.breaking === undefined ? finalImpact === "major" : Boolean(value.breaking),
759
- migrationRequired: value.migrationRequired === undefined ? finalImpact === "major" : Boolean(value.migrationRequired),
760
- };
761
- }
762
-
763
- function packageSetEntries(packageSet = undefined) {
764
- if (!packageSet) {
765
- return [];
766
- }
767
- return [
768
- ...(packageSet.main?.name ? [{ role: "main", ...packageSet.main }] : []),
769
- ...((packageSet.platforms || []).map((entry) => ({ role: "platform", ...entry }))),
770
- ];
771
- }
772
-
773
- function normalizePublishSummary({ packageSet = undefined, publishEvidence = undefined, publish = {} } = {}) {
774
- const packages = packageSetEntries(packageSet);
775
- if (packages.length === 0) {
776
- return undefined;
777
- }
778
- const artifacts = publishEvidence?.artifacts || [];
779
- const artifactByPackage = new Map(artifacts.map((artifact) => [
780
- [artifact.name, artifact.ref || artifact.version || ""].join("\0"),
781
- artifact,
782
- ]));
783
- const normalizedPackages = packages.map((entry) => {
784
- const artifact = artifactByPackage.get([entry.name, entry.version].join("\0")) || {};
785
- return {
786
- role: entry.role,
787
- name: entry.name,
788
- publishedVersion: entry.version,
789
- distTag: entry.distTag,
790
- digest: entry.digest || artifact.digest || "",
791
- registry: entry.registry || packageSet.registry || publish.registry || "",
792
- platform: entry.platform || "",
793
- action: entry.action || artifact.action || "",
794
- };
795
- });
796
- const distTags = [...new Set(normalizedPackages.map((entry) => entry.distTag).filter(Boolean))];
797
- return {
798
- registry: optionalString(packageSet.registry || publish.registry),
799
- channel: optionalString(publishEvidence?.channel || publish.channel),
800
- distTag: distTags.length === 1 ? distTags[0] : "",
801
- source: "packageSet+publishEvidence",
802
- packages: normalizedPackages,
803
- };
804
- }
805
-
806
- function normalizeTrustedPublishing(value = undefined, { workflow = {}, publish = {} } = {}) {
807
- if (!value && publish.auth !== "trusted-publishing") {
808
- return undefined;
809
- }
810
- const raw = value || {};
811
- return {
812
- provider: optionalString(raw.provider || "npm"),
813
- enabled: raw.enabled === undefined ? publish.auth === "trusted-publishing" : Boolean(raw.enabled),
814
- auth: optionalString(raw.auth || publish.auth),
815
- workflowRunId: optionalString(raw.workflowRunId || raw.workflow_run_id || workflow.runId),
816
- workflowRunAttempt: optionalString(raw.workflowRunAttempt || raw.workflow_run_attempt || workflow.runAttempt),
817
- evidence: optionalString(raw.evidence),
818
- };
819
- }
820
-
821
- function arrayOrEmpty(value) {
822
- return Array.isArray(value) ? value : [];
823
- }
824
-
825
- function arrayOrSingleton(value) {
826
- if (Array.isArray(value)) {
827
- return value;
828
- }
829
- return value && typeof value === "object" ? [value] : [];
830
- }
831
-
832
- function normalizeKfd2Claim(raw = {}, index = 0) {
833
- const claim = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
834
- const sourceBindings = arrayOrEmpty(claim.sourceBindings || claim.source_bindings || claim.sources || claim.declaredSources);
835
- const machineEvidence = arrayOrEmpty(claim.machineEvidence || claim.machine_evidence || claim.evidence);
836
- const hashes = claim.hashes && typeof claim.hashes === "object" && !Array.isArray(claim.hashes) ? claim.hashes : {};
837
- const artifacts = arrayOrEmpty(claim.artifacts || claim.artifactCoordinates || claim.artifact_coordinates);
838
- const verification = claim.verification && typeof claim.verification === "object" && !Array.isArray(claim.verification) ? claim.verification : {};
839
- const auditBoundary = claim.auditBoundary && typeof claim.auditBoundary === "object" && !Array.isArray(claim.auditBoundary)
840
- ? claim.auditBoundary
841
- : claim.audit_boundary && typeof claim.audit_boundary === "object" && !Array.isArray(claim.audit_boundary)
842
- ? claim.audit_boundary
843
- : {};
844
- const responsibility = claim.responsibility && typeof claim.responsibility === "object" && !Array.isArray(claim.responsibility) ? claim.responsibility : {};
845
- const residualRisk = arrayOrSingleton(claim.residualRisk || claim.residual_risk).map((entry, riskIndex) => validateKfd2TrustTaxonomyEntry(entry, {
846
- kind: "residualRisk",
847
- label: `kfd-2.claims[${index}].residualRisk[${riskIndex}]`,
848
- }));
849
- const downgradeReasons = arrayOrSingleton(claim.downgradeReasons || claim.downgrade_reasons || claim.downgradeReason || claim.downgrade_reason)
850
- .map((entry, reasonIndex) => validateKfd2TrustTaxonomyEntry(entry, {
851
- kind: "downgradeReason",
852
- label: `kfd-2.claims[${index}].downgradeReasons[${reasonIndex}]`,
853
- }));
854
- const trustProof = claim.trustProof && typeof claim.trustProof === "object" && !Array.isArray(claim.trustProof)
855
- ? claim.trustProof
856
- : undefined;
857
- const missingBindings = [];
858
- if (sourceBindings.length === 0) missingBindings.push("declared-sources");
859
- if (machineEvidence.length === 0) missingBindings.push("machine-readable-evidence");
860
- if (Object.keys(hashes).length === 0) missingBindings.push("hashes");
861
- if (artifacts.length === 0) missingBindings.push("artifact-coordinates");
862
- if (!verification.result && !verification.status) missingBindings.push("verification-result");
863
- if (Object.keys(auditBoundary).length === 0) missingBindings.push("audit-boundary");
864
- if (!responsibility.owner && !responsibility.sourceOwner && !responsibility.sourceContractOwner && !responsibility.releasePassportProofOwner) {
865
- missingBindings.push("responsibility-state");
866
- }
867
- if (!Array.isArray(claim.residualRisk || claim.residual_risk)) missingBindings.push("residual-risk");
868
- const proseOnly = Boolean(claim.proseOnly || claim.prose_only || claim.support === "prose" || claim.supportLevel === "prose");
869
- const explicitStatus = optionalString(claim.status || claim.result);
870
- const status = explicitStatus || (missingBindings.length > 0 ? "failed" : (proseOnly || residualRisk.length > 0) ? "downgraded" : "passed");
871
- return {
872
- id: optionalString(claim.id || `claim-${index + 1}`),
873
- public: claim.public === undefined ? true : Boolean(claim.public),
874
- claim: optionalString(claim.claim || claim.statement || claim.summary),
875
- sourceBindings,
876
- machineEvidence,
877
- hashes,
878
- artifacts,
879
- verification,
880
- auditBoundary,
881
- responsibility,
882
- residualRisk,
883
- downgradeReasons,
884
- ...(trustProof ? { trustProof } : {}),
885
- proseOnly,
886
- missingBindings,
887
- status,
888
- };
889
- }
890
-
891
- function kfd2ClaimFromKfd1World(world = {}, index = 0) {
892
- const sourceSurfaces = arrayOrEmpty(world.sourceVerification?.surfaces);
893
- const artifactSurfaces = arrayOrEmpty(world.artifactVerification?.surfaces);
894
- return normalizeKfd2Claim({
895
- id: `kfd-1:${world.id || index + 1}`,
896
- public: true,
897
- claim: `KFD-1 contract world ${world.id || index + 1} is verified from declared source surfaces to packaged artifact bytes.`,
898
- sourceBindings: sourceSurfaces.map((surface) => ({
899
- id: surface.name,
900
- path: surface.sourcePath,
901
- sha256: surface.actualSha256 || surface.expectedSha256,
902
- })),
903
- machineEvidence: [
904
- { id: "kfd-1-witness", sha256: world.preBuildWitnessSha256 },
905
- { id: "source-verification", status: world.sourceVerification?.status || "" },
906
- { id: "artifact-verification", status: world.artifactVerification?.status || "" },
907
- ],
908
- hashes: {
909
- witnessSha256: world.preBuildWitnessSha256,
910
- sourceSha256: world.sourceHashes?.sha256 || "",
911
- artifactSha256: world.artifactHashes?.sha256 || "",
912
- },
913
- artifacts: artifactSurfaces.map((surface) => ({
914
- id: surface.name,
915
- path: surface.artifactPath,
916
- sha256: surface.actualSha256,
917
- })),
918
- verification: {
919
- result: world.result === "passed" ? "passed" : "failed",
920
- source: world.sourceVerification?.status || "",
921
- artifact: world.artifactVerification?.status || "",
922
- },
923
- auditBoundary: world.selfHostingBoundary,
924
- responsibility: world.responsibility,
925
- residualRisk: world.selfHostingBoundary?.residualRisk || [],
926
- }, index);
927
- }
928
-
929
- function kfd2ClaimFromKfd3Interface(entry = {}, index = 0) {
930
- const witnessHashes = {
931
- prebuildWitnessSha256: entry.preBuildWitnessSha256,
932
- artifactWitnessSha256: entry.artifactWitnessSha256,
933
- prebuildCanonicalSha256: entry.witnessEvidence?.prebuild?.canonicalSha256 || "",
934
- artifactCanonicalSha256: entry.witnessEvidence?.artifact?.canonicalSha256 || "",
935
- };
936
- const reverseAuditBoundary = entry.reverseAudit?.auditBoundary || entry.auditBoundary;
937
- const residualRisk = arrayOrEmpty(entry.residualRisk);
938
- const proofResult = entry.trustProof?.result === "pass"
939
- ? (residualRisk.length > 0 ? "downgraded" : "passed")
940
- : "failed";
941
- return normalizeKfd2Claim({
942
- id: `kfd-3:${entry.id || index + 1}`,
943
- public: true,
944
- claim: `KFD-3 collaboration interface ${entry.id || index + 1} exposes only declared public participant-facing shipped surfaces within its audit boundary.`,
945
- sourceBindings: arrayOrEmpty(entry.declaredSurfaces).map((surface) => ({
946
- id: surface.id,
947
- kind: surface.kind,
948
- sourcePath: surface.sourcePath,
949
- })),
950
- machineEvidence: [
951
- { id: "prebuild-witness", ...entry.witnessEvidence?.prebuild },
952
- { id: "artifact-witness", ...entry.witnessEvidence?.artifact },
953
- { id: "declared-capability-verification", result: entry.declaredCapabilityVerification?.result || "" },
954
- { id: "reverse-audit", result: entry.reverseAudit?.status || "" },
955
- ],
956
- hashes: {
957
- ...witnessHashes,
958
- },
959
- artifacts: entry.artifactWitness?.artifact?.name || entry.artifactWitness?.artifact?.path
960
- ? [entry.artifactWitness.artifact]
961
- : arrayOrEmpty(entry.exposedSurfaces).map((surface) => ({ id: surface.id, kind: surface.kind })),
962
- verification: {
963
- result: entry.comparison?.status === "passed" ? "passed" : "failed",
964
- declaredCapabilityVerification: entry.declaredCapabilityVerification?.result || "",
965
- reverseAudit: entry.reverseAudit?.status || "",
966
- },
967
- auditBoundary: entry.auditBoundary,
968
- responsibility: entry.responsibility,
969
- residualRisk,
970
- trustProof: {
971
- contract: KFD2_TRUST_PROOF_CONTRACT,
972
- source: "kfd-3-collaboration-interface-release-gate",
973
- result: proofResult,
974
- statement: entry.trustProof?.statement || "",
975
- kfd3TrustProof: {
976
- contract: entry.trustProof?.contract || "",
977
- result: entry.trustProof?.result || "",
978
- releaseStatus: entry.trustProof?.releaseStatus || entry.releaseStatus || "",
979
- },
980
- witnessHashes,
981
- declaredCapabilityVerification: entry.declaredCapabilityVerification,
982
- reverseAudit: entry.reverseAudit,
983
- reverseAuditBoundary,
984
- residualRisk,
985
- responsibility: entry.responsibility,
986
- },
987
- status: proofResult,
988
- }, index);
989
- }
990
-
991
- function createKfd2ReleaseTrustPassportAudit({ explicitClaims = [], kfd1Section = undefined, kfd3Section = undefined, verifiedAt = nowIso() } = {}) {
992
- const generatedClaims = [
993
- ...arrayOrEmpty(kfd1Section?.contractWorlds).map((world, index) => kfd2ClaimFromKfd1World(world, index)),
994
- ...arrayOrEmpty(kfd3Section?.collaborationInterfaces).map((entry, index) => kfd2ClaimFromKfd3Interface(entry, index)),
995
- ];
996
- const claims = [
997
- ...generatedClaims,
998
- ...explicitClaims.map((claim, index) => normalizeKfd2Claim(claim, generatedClaims.length + index)),
999
- ];
1000
- if (claims.length === 0) {
1001
- return undefined;
1002
- }
1003
- const failed = claims.filter((claim) => claim.public && claim.status === "failed");
1004
- const downgraded = claims.filter((claim) => claim.public && (claim.status === "downgraded" || claim.proseOnly));
1005
- const downgradeReasons = claims.flatMap((claim) => arrayOrEmpty(claim.downgradeReasons));
1006
- return {
1007
- schemaVersion: 1,
1008
- contract: KFD2_RELEASE_TRUST_PASSPORT_CONTRACT,
1009
- status: failed.length > 0 ? "failed" : downgraded.length > 0 ? "downgraded" : "passed",
1010
- verifiedAt,
1011
- auditBoundary: {
1012
- scope: "public release claims visible to humans or agents",
1013
- policy: "public claims must bind declared sources, machine-readable evidence, hashes, artifact coordinates, verification results, audit boundaries, responsibility state, and residual risk",
1014
- },
1015
- downgradeReasons,
1016
- claims,
1017
- summary: {
1018
- claimCount: claims.length,
1019
- failed: failed.length,
1020
- downgraded: downgraded.length,
1021
- proseOnly: claims.filter((claim) => claim.proseOnly).length,
1022
- },
1023
- };
1024
- }
1025
-
1026
- function normalizeTransactionResult(value = {}) {
1027
- const result = {};
1028
- if (value.command) {
1029
- result.command = optionalString(value.command);
1030
- }
1031
- if (value.validation && typeof value.validation === "object" && !Array.isArray(value.validation)) {
1032
- result.validation = {
1033
- valid: Boolean(value.validation.valid),
1034
- errors: Array.isArray(value.validation.errors) ? value.validation.errors : [],
1035
- };
1036
- }
1037
- if (value.recovery && typeof value.recovery === "object" && !Array.isArray(value.recovery)) {
1038
- result.recovery = value.recovery;
1039
- }
1040
- if (value.publishAction || value.distTag) {
1041
- result.publish = {
1042
- action: optionalString(value.publishAction),
1043
- distTag: optionalString(value.distTag),
1044
- };
1045
- }
1046
- return Object.keys(result).length > 0 ? result : undefined;
1047
- }
1048
-
1049
- function normalizeTransaction(value = undefined) {
1050
- if (!value) {
1051
- return undefined;
1052
- }
1053
- const raw = value.transaction && typeof value.transaction === "object" ? value.transaction : value;
1054
- return {
1055
- id: optionalString(raw.id || value.id),
1056
- version: optionalString(raw.version || value.version),
1057
- state: optionalString(raw.state || value.state),
1058
- previousState: optionalString(raw.previous_state || raw.previousState),
1059
- exactTag: optionalString(raw.exact_tag || raw.exactTag || value.exactTag),
1060
- releaseSha: optionalString(raw.release_sha || raw.releaseSha || value.releaseSha),
1061
- releaseMaterialSha: optionalString(raw.release_material_sha || raw.releaseMaterialSha || value.releaseMaterialSha),
1062
- stateRef: optionalString(raw.state_ref || raw.stateRef || value.stateRef),
1063
- statePath: optionalString(raw.state_path || raw.statePath || value.statePath),
1064
- stateSha: optionalString(value.stateSha || value.state_sha || value.durable?.sha),
1065
- evidencePath: optionalString(raw.evidence_path || raw.evidencePath || value.evidencePath),
1066
- updatedAt: optionalString(raw.updated_at || raw.updatedAt),
1067
- result: normalizeTransactionResult(value),
1068
- };
1069
- }
1070
-
1071
- function prepareBuildEvidence({
1072
- buildSummary,
1073
- buildFacts,
1074
- platformArtifactManifests,
1075
- distTagPromotionEvidence,
1076
- }) {
1077
- return {
1078
- buildSummary: buildSummary
1079
- ? normalizeEvidenceDocument(buildSummary, "buildSummary")
1080
- : undefined,
1081
- buildFacts: (buildFacts || [])
1082
- .map((value, index) =>
1083
- normalizeEvidenceDocument(value, `buildFacts[${index}]`),
1084
- )
1085
- .filter(Boolean),
1086
- platformArtifactManifests: (platformArtifactManifests || [])
1087
- .map((manifest, index) =>
1088
- normalizePlatformArtifactManifest(manifest, index),
1089
- )
1090
- .filter(Boolean),
1091
- distTagPromotionEvidence: distTagPromotionEvidence
1092
- ? normalizeEvidenceDocument(
1093
- distTagPromotionEvidence,
1094
- "distTagPromotionEvidence",
1095
- )
1096
- : undefined,
1097
- };
1098
- }
1099
-
1100
- function preparePromotionBuild(options) {
1101
- return {
1102
- promotion: normalizePromotionEvidence(options),
1103
- buildEvidence: prepareBuildEvidence(options),
1104
- };
1105
- }
1106
-
1107
- function normalizeReleaseSourceFields(release) {
1108
- return {
1109
- builtSourceSha: releaseField(release, "builtSourceSha", "built_source_sha"),
1110
- builtSourceTreeSha: releaseField(
1111
- release,
1112
- "builtSourceTreeSha",
1113
- "built_source_tree_sha",
1114
- ),
1115
- promotionChannelSha: releaseField(
1116
- release,
1117
- "promotionChannelSha",
1118
- "promotion_channel_sha",
1119
- ),
1120
- promotionChannelTreeSha: releaseField(
1121
- release,
1122
- "promotionChannelTreeSha",
1123
- "promotion_channel_tree_sha",
1124
- ),
1125
- };
1126
- }
1127
-
1128
- export function createArtifactEvidence({ assets = [], repository = "", tag = "", sourceSha = "", workflow = {}, kfdAdopter = undefined } = {}) {
1129
- const normalizedAssets = assets.map((asset, index) => normalizeAsset(asset, index));
1130
- return buildReleaseArtifactEvidence({ normalizedAssets, repository, tag, sourceSha, workflow, kfdAdopter });
1131
- }
1132
-
1133
- function firstTruthy(...values) {
1134
- for (const value of values) {
1135
- if (value) return value;
1136
- }
1137
- return values.at(-1);
1138
- }
1139
-
1140
- function releaseField(release, camelKey, snakeKey, ...fallbacks) {
1141
- return optionalString(firstTruthy(release[camelKey], release[snakeKey], ...fallbacks));
1142
- }
1143
-
1144
- export { releasePassportKfdAdopterSourceSha } from "./adopter-delivery-passport.js";
1145
-
1146
- function optionalSections(entries) {
1147
- return Object.fromEntries(entries.filter(([, value]) => value && (!Array.isArray(value) || value.length > 0)));
1148
- }
1149
-
1150
- function acceptedControllerSourceShas(input) {
1151
- const { treeEquivalent, builtSourceSha, promotionChannelSha, sourceSha, recoveryTreeEquivalent } = input;
1152
- return treeEquivalent && builtSourceSha && (promotionChannelSha === sourceSha || recoveryTreeEquivalent)
1153
- ? [builtSourceSha]
1154
- : [];
1155
- }
1156
-
1157
- function prepareReleaseKfdAdopterArtifacts({ kfdAdopter, assets, repository, tag, sourceSha, workflow }) {
1158
- const normalized = kfdAdopter ? structuredClone(kfdAdopter) : undefined;
1159
- return {
1160
- normalized,
1161
- artifactEvidence: createArtifactEvidence({ assets, repository, tag, sourceSha, workflow, kfdAdopter: normalized }),
1162
- };
1163
- }
1164
-
1165
- export function createReleasePassport(options = {}) {
1166
- const {
1167
- cwd = process.cwd(),
1168
- repository = "",
1169
- tag = "",
1170
- sourceSha = "",
1171
- line = "",
1172
- productName = "Buildchain",
1173
- packageName = "@kungfu-tech/buildchain",
1174
- packageVersion = "",
1175
- productMechanismPath = "product-mechanism.json",
1176
- artifactEvidencePath = "artifact-evidence.json",
1177
- impactPath = "impact.json",
1178
- agentIndexPath = "agent-index.json",
1179
- checkReportPath = "check-report.json",
1180
- publishEvidencePath = "",
1181
- transactionStatePath = "",
1182
- assets = [],
1183
- packageSet = undefined,
1184
- anchorManifest = undefined,
1185
- versionMaterial = undefined,
1186
- publishEvidence = undefined,
1187
- trustedPublishing = undefined,
1188
- transaction = undefined,
1189
- buildSummary = undefined,
1190
- buildFacts = [],
1191
- platformArtifactManifests = [],
1192
- distTagPromotionEvidence = undefined,
1193
- release = {},
1194
- publish = {},
1195
- impact = undefined,
1196
- workflow = {},
1197
- kfd1 = undefined,
1198
- kfd2Claims = [],
1199
- kfd3 = undefined,
1200
- kfdAdopter = undefined,
1201
- kfdAdopterManifestEvidencePath = "",
1202
- kfdAdopterGateEvidencePath = "",
1203
- kfdSupport = undefined,
1204
- kfdSupportEvidencePath = "",
1205
- invariantPassports = undefined,
1206
- releaseEvidence = [],
1207
- v4ConsumerPolicyCertification: domainConsumerPolicyCertification = undefined,
1208
- v4ConsumerPolicyCertificationRoot: domainConsumerPolicyCertificationRoot = "",
1209
- domainRuntimeResumeEvidence = undefined,
1210
- kfdAgentHubEvidence = undefined,
1211
- kfdAgentHubEvidencePath = "",
1212
- controllerReceipts = [],
1213
- controllerReceiptReferences = [],
1214
- githubArtifactAttestations = [],
1215
- checkedAt = "",
1216
- } = options;
1217
- const normalizedTag = nonEmptyString(tag, "tag");
1218
- const { normalized: normalizedKfdAdopter, artifactEvidence } = prepareReleaseKfdAdopterArtifacts({
1219
- kfdAdopter, assets, repository, tag: normalizedTag, sourceSha, workflow,
1220
- });
1221
- const normalizedPublishEvidence = normalizePublishEvidence(publishEvidence);
1222
- const normalizedPackageSet = normalizePackageSet(packageSet, { packageName, packageVersion, publish });
1223
- const normalizedTrustedPublishing = normalizeTrustedPublishing(trustedPublishing, { workflow, publish });
1224
- const normalizedTransaction = normalizeTransaction(transaction);
1225
- const { promotion, buildEvidence } = preparePromotionBuild(options);
1226
- const normalizedRuntimeResume = normalizeRuntimeResumeEvidence(domainRuntimeResumeEvidence, {
1227
- repository,
1228
- sourceSha: runtimeResumeSourceSha(release, sourceSha),
1229
- resumeRuntimeSha: promotion.routing?.runtime?.resolvedSha || "",
1230
- consumerPolicyReceiptRoot: promotion.consumerPolicy?.certification?.receiptRoot || "",
1231
- });
1232
- const normalizedImpact = normalizeImpactLedger(impact, { tag: normalizedTag, line });
1233
- const generatedAt = optionalString(checkedAt) || nowIso();
1234
- const kfd1Metadata = resolveKfd1Metadata();
1235
- const normalizedKfdAgentHub = normalizeKfdAgentHubEvidence(kfdAgentHubEvidence);
1236
- const kfdParts = prepareReleasePassportKfdSections({
1237
- kfd1,
1238
- kfd2Claims,
1239
- kfd3,
1240
- kfdAdopter: normalizedKfdAdopter,
1241
- kfdSupport,
1242
- kfd1DefaultKey: kfd1Metadata.key,
1243
- createKfd2: createKfd2ReleaseTrustPassportAudit,
1244
- evidencePaths: {
1245
- manifest: kfdAdopterManifestEvidencePath,
1246
- gate: kfdAdopterGateEvidencePath,
1247
- support: kfdSupportEvidencePath,
1248
- },
1249
- });
1250
- const sourceFields = normalizeReleaseSourceFields(release);
1251
- const treeEquivalent = release.treeEquivalent === true;
1252
- const recoveryTreeEquivalent = Boolean(
1253
- treeEquivalent &&
1254
- sourceFields.builtSourceTreeSha &&
1255
- sourceFields.promotionChannelTreeSha &&
1256
- sourceFields.builtSourceTreeSha === sourceFields.promotionChannelTreeSha,
1257
- );
1258
- const normalizedControllerReceipts = normalizeControllerReceiptReferences({
1259
- receipts: controllerReceipts,
1260
- references: controllerReceiptReferences,
1261
- expectedSourceSha: sourceSha,
1262
- acceptedSourceShas: acceptedControllerSourceShas({
1263
- treeEquivalent,
1264
- builtSourceSha: sourceFields.builtSourceSha,
1265
- promotionChannelSha: sourceFields.promotionChannelSha,
1266
- sourceSha,
1267
- recoveryTreeEquivalent,
1268
- }),
1269
- requirePassed: true,
1270
- });
1271
- const normalizedGitHubArtifactAttestations = (githubArtifactAttestations || [])
1272
- .map(normalizeGitHubArtifactAttestationPolicy);
1273
- const publishArtifacts = normalizedPublishEvidence?.artifacts || [];
1274
- const normalizedPublishSummary = normalizePublishSummary({
1275
- packageSet: normalizedPackageSet,
1276
- publishEvidence: normalizedPublishEvidence,
1277
- publish,
1278
- });
1279
- const releaseMaterialSha = releaseField(release, "releaseMaterialSha", "release_material_sha", normalizedPublishEvidence?.releaseMaterialSha, normalizedTransaction?.releaseMaterialSha);
1280
- const releaseSha = releaseField(release, "releaseSha", "release_sha", normalizedPublishEvidence?.releaseSha, normalizedTransaction?.releaseSha);
1281
- const targetRef = releaseField(release, "targetRef", "target_ref", normalizedPublishEvidence?.targetRef);
1282
- const mainPublishedVersion = normalizedPublishSummary?.packages?.find((entry) => entry.role === "main")?.publishedVersion;
1283
- const packageDisplayVersion = optionalString(firstTruthy(packageVersion, normalizedPackageSet?.main?.version, mainPublishedVersion, normalizedPublishEvidence?.version, normalizedTransaction?.version, readPackageVersion(cwd)));
1284
- const publishedVersion = releaseField(release, "publishedVersion", "published_version", packageDisplayVersion);
1285
- const internalVersion = releaseField(release, "internalVersion", "internal_version", normalizedTransaction?.version);
1286
- return {
1287
- schemaVersion: 1,
1288
- contract: RELEASE_PASSPORT_CONTRACT,
1289
- generatedAt,
1290
- surfaceTimestampPolicy: createSurfaceTimestampPolicy({
1291
- generatedAt,
1292
- publishedAt: optionalString(release.publishedAt || release.published_at || normalizedPublishEvidence?.publishedAt),
1293
- sourceRevision: optionalString(firstTruthy(sourceSha, releaseSha, normalizedTransaction?.releaseSha)),
1294
- timestampPolicy: "ci-injected",
1295
- deterministicInputs: [
1296
- "release.sourceSha",
1297
- "release.releaseSha",
1298
- "release.releaseMaterialSha",
1299
- "artifact-evidence.json",
1300
- "publish evidence",
1301
- "release-state transaction",
1302
- "controller receipt references",
1303
- ],
1304
- timestampFields: ["generatedAt", "publishedAt", "surfaceTimestampPolicy.generatedAt", "surfaceTimestampPolicy.publishedAt"],
1305
- timestampFieldsParticipateInArtifactDigest: true,
1306
- artifactDigestScope: "release passport JSON and release evidence bundle",
1307
- }),
1308
- product: {
1309
- name: optionalString(productName || "Buildchain"),
1310
- repository: optionalString(repository),
1311
- mechanism: productMechanismPath,
1312
- },
1313
- release: {
1314
- tag: normalizedTag,
1315
- publicTag: releaseField(release, "publicTag", "public_tag", normalizedTag),
1316
- internalTag: releaseField(release, "internalTag", "internal_tag", normalizedTag),
1317
- internalVersion,
1318
- publishedVersion,
1319
- versionLabel: releaseField(release, "versionLabel", "version_label", publishedVersion, normalizedTag),
1320
- line: optionalString(line),
1321
- sourceSha: optionalString(sourceSha),
1322
- channel: optionalString(firstTruthy(release.channel, normalizedPublishEvidence?.channel, publish.channel)),
1323
- targetRef,
1324
- releaseSha,
1325
- releaseMaterialSha,
1326
- builtSourceSha: optionalString(release.builtSourceSha || release.built_source_sha),
1327
- builtSourceTreeSha: sourceFields.builtSourceTreeSha,
1328
- promotionChannelSha: optionalString(release.promotionChannelSha || release.promotion_channel_sha),
1329
- promotionChannelTreeSha: sourceFields.promotionChannelTreeSha,
1330
- treeEquivalent: release.treeEquivalent === undefined ? undefined : Boolean(release.treeEquivalent),
1331
- publishToolingSha: optionalString(
1332
- release.publishToolingSha ||
1333
- release.publish_tooling_sha ||
1334
- normalizedPublishEvidence?.publishToolingSha,
1335
- ),
1336
- releaseStateRef: optionalString(
1337
- release.releaseStateRef ||
1338
- release.release_state_ref ||
1339
- normalizedTransaction?.stateRef ||
1340
- (normalizedTag ? `refs/heads/buildchain/release-state/${normalizedTag.replace(/^v/, "").replace(/[^0-9A-Za-z]+/g, "-")}` : ""),
1341
- ),
1342
- releaseStateSha: optionalString(release.releaseStateSha || release.release_state_sha || normalizedTransaction?.stateSha),
1343
- package: {
1344
- name: packageName,
1345
- version: packageDisplayVersion,
1346
- },
1347
- exactRef: normalizedTag ? `refs/tags/${normalizedTag}` : "",
1348
- },
1349
- workflow: {
1350
- name: optionalString(workflow.name),
1351
- runId: optionalString(workflow.runId),
1352
- runAttempt: optionalString(workflow.runAttempt),
1353
- url: optionalString(workflow.url),
1354
- },
1355
- runnerPolicy: {
1356
- productionDefault: "github-hosted",
1357
- compatibilityFixture: "self-hosted",
1358
- note: "Runner facts are recorded in artifact evidence; the protocol does not require self-hosted runners.",
1359
- },
1360
- ...optionalSections([
1361
- ["packageSet", normalizedPackageSet],
1362
- ["publish", normalizedPublishSummary],
1363
- ["anchorManifest", anchorManifest],
1364
- ["versionMaterial", versionMaterial],
1365
- ["trustedPublishing", normalizedTrustedPublishing],
1366
- ["transaction", normalizedTransaction],
1367
- ["promotionRouting", promotion.routing],
1368
- ["buildSummary", buildEvidence.buildSummary],
1369
- ["buildFacts", buildEvidence.buildFacts],
1370
- ["platformArtifactManifests", buildEvidence.platformArtifactManifests],
1371
- ["distTagPromotion", buildEvidence.distTagPromotionEvidence],
1372
- ...kfdParts.sectionEntries,
1373
- ["kfdAgentHub", normalizedKfdAgentHub],
1374
- ["invariantPassports", invariantPassports],
1375
- ["releaseEvidence", releaseEvidence],
1376
- ["v4ConsumerPolicy", promotion.consumerPolicy],
1377
- ["v4RuntimeResume", normalizedRuntimeResume],
1378
- ["controllerReceipts", normalizedControllerReceipts],
1379
- ["githubArtifactAttestations", normalizedGitHubArtifactAttestations],
1380
- ]),
1381
- versionImpact: normalizedImpact.versionImpact,
1382
- surfaceImpacts: normalizedImpact.surfaceImpacts,
1383
- artifacts: [
1384
- ...artifactEvidence.artifacts.map((asset) => ({
1385
- group: "release",
1386
- kind: asset.kind || "release-asset",
1387
- name: asset.name,
1388
- platform: asset.platform,
1389
- ref: normalizedTag,
1390
- sha256: asset.sha256,
1391
- digest: asset.sha256 ? `sha256:${asset.sha256}` : "",
1392
- evidence: artifactEvidencePath,
1393
- url: asset.url,
1394
- })),
1395
- ...publishArtifacts.map((artifact) => ({
1396
- ...artifact,
1397
- evidence: publishEvidencePath || artifact.evidence || artifactEvidencePath,
1398
- })),
1399
- ],
1400
- evidence: {
1401
- artifactEvidence: artifactEvidencePath,
1402
- publishEvidence: publishEvidencePath,
1403
- transactionState: transactionStatePath,
1404
- buildSummary: buildEvidence.buildSummary?.path || "",
1405
- buildFacts: buildEvidence.buildFacts.map((fact) => ({
1406
- path: fact.path || "",
1407
- sha256: fact.sha256 || "",
1408
- contract: fact.fields?.contract || "",
1409
- id: fact.fields?.id || "",
1410
- digest: fact.fields?.digest || "",
1411
- })),
1412
- platformArtifactManifests: buildEvidence.platformArtifactManifests.map((manifest) => ({
1413
- path: manifest.path,
1414
- sha256: manifest.sha256,
1415
- platform: manifest.platform,
1416
- artifactName: manifest.artifactName,
1417
- })),
1418
- distTagPromotionEvidence: buildEvidence.distTagPromotionEvidence?.path || "",
1419
- ...kfdParts.evidence,
1420
- kfdAgentHub: normalizedKfdAgentHub ? optionalString(kfdAgentHubEvidencePath || "kfd-agent-hub-evidence.json") : "",
1421
- invariantPassports: invariantPassports ? "invariantPassports" : "",
1422
- releaseEvidence: releaseEvidence.map((entry) => entry.path),
1423
- impact: impactPath,
1424
- checkReport: checkReportPath,
1425
- agentIndex: agentIndexPath,
1426
- },
1427
- recovery: {
1428
- rollback: "Use the previous exact release tag or previous floating channel ref.",
1429
- verify: `buildchain verify release-passport ${normalizedTag ? "buildchain.release.json" : "<passport>"}`,
1430
- },
1431
- };
1432
- }
1433
-
1434
- function collectKfdAdopterReleaseInputs({ cwd, manifestJson, supportMatrixJson, productGateJsons, repository, sourceSha, checkedAt }) {
1435
- const manifestMeta = parseJsonInputWithMeta(manifestJson, undefined, { cwd, label: "kfdAdopterManifestJson" });
1436
- const supportMatrixMeta = parseJsonInputWithMeta(supportMatrixJson, undefined, { cwd, label: "kfdSupportMatrixJson" });
1437
- const productGateMetas = (productGateJsons || [])
1438
- .filter(Boolean)
1439
- .map((gateJson) => parseJsonInputWithMeta(gateJson, undefined, { cwd, label: "kfdProductGateJsons entry" }))
1440
- .filter((meta) => meta.value);
1441
- return collectKfdAdopterReleaseEvidence({
1442
- manifest: manifestMeta.value,
1443
- gateResults: productGateMetas.map((meta) => meta.value),
1444
- comparisonMatrix: supportMatrixMeta.value,
1445
- expectedAdopterId: repository || "kungfu-systems/buildchain", expectedSourceRepository: repository, sourceSha,
1446
- checkedAt,
1447
- });
1448
- }
1449
-
1450
- function copyReleaseEvidenceAttachments(attachments, outputDir) {
1451
- const ids = new Set();
1452
- for (const { reference } of attachments) {
1453
- if (ids.has(reference.id)) {
1454
- throw new Error(`release evidence attachment id must be unique: ${reference.id}`);
1455
- }
1456
- ids.add(reference.id);
1457
- }
1458
- for (const { inputPath, reference } of attachments) {
1459
- const destinationPath = path.join(outputDir, reference.path);
1460
- fs.mkdirSync(path.dirname(destinationPath), { recursive: true });
1461
- fs.copyFileSync(inputPath, destinationPath);
1462
- }
1463
- }
1464
-
1465
- export function collectGitHubReleasePassport({
1466
- cwd = process.cwd(),
1467
- tag = "",
1468
- repository = process.env.GITHUB_REPOSITORY || "",
1469
- sourceSha = process.env.GITHUB_SHA || "",
1470
- line = "",
1471
- outputDir = ".buildchain/release-passport",
1472
- assetsJson = "",
1473
- assetsDir = "",
1474
- releaseJson = "",
1475
- productName = "Buildchain",
1476
- packageName = "@kungfu-tech/buildchain",
1477
- packageVersion = "",
1478
- packageSetJson = "",
1479
- publishEvidenceJson = "",
1480
- trustedPublishingJson = "",
1481
- transactionJson = "",
1482
- anchorManifestJson = "",
1483
- versionMaterialJson = "",
1484
- impactJson = "",
1485
- buildSummaryJson = "",
1486
- buildFactsJsons = [],
1487
- platformManifestJsons = [],
1488
- distTagEvidenceJson = "",
1489
- kfd1WitnessJsons = [],
1490
- kfd2ClaimJsons = [],
1491
- kfd3PrebuildWitnessJsons = [],
1492
- kfd3ArtifactWitnessJsons = [],
1493
- kfd3ArtifactVerifyCommand = "",
1494
- kfdAdopterManifestJson = "",
1495
- kfdSupportMatrixJson = "",
1496
- kfdProductGateJsons = [],
1497
- invariantPassportJsons = [],
1498
- invariantPassportCommand = "",
1499
- releaseEvidenceJsons = [],
1500
- v4ConsumerPolicyCertificationJson: domainConsumerPolicyCertificationJson = "",
1501
- v4ConsumerPolicyCertificationRoot: domainConsumerPolicyCertificationRoot = "",
1502
- v4RuntimeResumeEvidenceJson: domainRuntimeResumeEvidenceJson = "",
1503
- kfdAgentHubEvidenceJson = "",
1504
- controllerReceiptReferences = [],
1505
- githubArtifactAttestationPolicyJsons = [],
1506
- basePassportJson = "",
1507
- requireBaseKfd = false,
1508
- releaseJsonExtra = "",
1509
- publishJson = "",
1510
- workflow = {},
1511
- checkedAt = "",
1512
- } = {}) {
1513
- const release = parseJsonInput(releaseJson, {}, { cwd, label: "releaseJson" });
1514
- const releaseExtra = parseJsonInput(releaseJsonExtra, {}, { cwd, label: "releaseJsonExtra" });
1515
- const assetsFromJson = parseJsonInput(assetsJson, [], { cwd, label: "assetsJson" });
1516
- const packageSet = parseJsonInput(packageSetJson, undefined, { cwd, label: "packageSetJson" });
1517
- const publishEvidenceMeta = parseJsonInputWithMeta(publishEvidenceJson, undefined, { cwd, label: "publishEvidenceJson" });
1518
- const trustedPublishing = parseJsonInput(trustedPublishingJson, undefined, { cwd, label: "trustedPublishingJson" });
1519
- const transactionMeta = parseJsonInputWithMeta(transactionJson, undefined, { cwd, label: "transactionJson" });
1520
- const anchorManifest = normalizeAnchorManifest(parseJsonInputWithMeta(anchorManifestJson, undefined, { cwd, label: "anchorManifestJson" }));
1521
- const versionMaterial = parseJsonInput(
1522
- versionMaterialJson,
1523
- undefined,
1524
- { cwd, label: "versionMaterialJson" },
1525
- );
1526
- const impactMeta = parseJsonInputWithMeta(impactJson, undefined, { cwd, label: "impactJson" });
1527
- const buildSummaryMeta = parseJsonInputWithMeta(buildSummaryJson, undefined, { cwd, label: "buildSummaryJson" });
1528
- const buildFactMetas = (buildFactsJsons || [])
1529
- .filter(Boolean)
1530
- .map((buildFactsJson) => parseJsonInputWithMeta(buildFactsJson, undefined, { cwd, label: "buildFactsJsons entry" }))
1531
- .filter((meta) => meta.value);
1532
- const platformManifestMetas = (platformManifestJsons || [])
1533
- .filter(Boolean)
1534
- .map((manifestJson) => parseJsonInputWithMeta(manifestJson, undefined, { cwd, label: "platformManifestJsons entry" }));
1535
- const distTagEvidenceMeta = parseJsonInputWithMeta(distTagEvidenceJson, undefined, { cwd, label: "distTagEvidenceJson" });
1536
- const kfd1WitnessMetas = (kfd1WitnessJsons || [])
1537
- .filter(Boolean)
1538
- .map((witnessJson) => parseJsonInputWithMeta(witnessJson, undefined, { cwd, label: "kfd1WitnessJsons entry" }))
1539
- .filter((meta) => meta.value);
1540
- const kfd2ClaimMetas = (kfd2ClaimJsons || [])
1541
- .filter(Boolean)
1542
- .map((claimJson) => parseJsonInputWithMeta(claimJson, undefined, { cwd, label: "kfd2ClaimJsons entry" }))
1543
- .filter((meta) => meta.value);
1544
- const kfd3PrebuildWitnessMetas = (kfd3PrebuildWitnessJsons || [])
1545
- .filter(Boolean)
1546
- .map((witnessJson) => parseJsonInputWithMeta(witnessJson, undefined, { cwd, label: "kfd3PrebuildWitnessJsons entry" }))
1547
- .filter((meta) => meta.value);
1548
- const kfd3ArtifactWitnessMetas = (kfd3ArtifactWitnessJsons || [])
1549
- .filter(Boolean)
1550
- .map((witnessJson) => parseJsonInputWithMeta(witnessJson, undefined, { cwd, label: "kfd3ArtifactWitnessJsons entry" }))
1551
- .filter((meta) => meta.value);
1552
- const basePassportMeta = parseJsonInputWithMeta(basePassportJson, undefined, { cwd, label: "basePassportJson" });
1553
- const kfd3ArtifactCommandMeta = parseJsonCommandOutput({
1554
- command: kfd3ArtifactVerifyCommand,
1555
- cwd,
1556
- label: "KFD-3 artifact verify command",
1557
- });
1558
- const invariantPassportMetas = (invariantPassportJsons || [])
1559
- .filter(Boolean)
1560
- .map((passportJson) => parseJsonInputWithMeta(passportJson, undefined, { cwd, label: "invariantPassportJsons entry" }))
1561
- .filter((meta) => meta.value);
1562
- const invariantPassportCommandMeta = parseJsonCommandOutput({
1563
- command: invariantPassportCommand,
1564
- cwd,
1565
- label: "invariant passport command",
1566
- });
1567
- if (invariantPassportCommandMeta.value) invariantPassportMetas.push(invariantPassportCommandMeta);
1568
- const invariantPassports = createInvariantPassportGate(invariantPassportMetas);
1569
- const releaseEvidenceMetas = (releaseEvidenceJsons || [])
1570
- .filter(Boolean)
1571
- .map((evidenceJson) =>
1572
- parseJsonInputWithMeta(evidenceJson, undefined, {
1573
- cwd,
1574
- label: "releaseEvidenceJsons entry",
1575
- }),
1576
- )
1577
- .filter((meta) => meta.value);
1578
- const consumerPolicyCertificationMeta =
1579
- parseConsumerPolicyCertification(domainConsumerPolicyCertificationJson, cwd);
1580
- const domainRuntimeResumeEvidence = parseJsonInput(domainRuntimeResumeEvidenceJson, undefined, {
1581
- cwd,
1582
- label: "v4RuntimeResumeEvidenceJson",
1583
- });
1584
- const kfdAgentHubEvidenceMeta = parseJsonInputWithMeta(
1585
- kfdAgentHubEvidenceJson,
1586
- undefined,
1587
- { cwd, label: "kfdAgentHubEvidenceJson" },
1588
- );
1589
- const githubArtifactAttestationPolicies = (githubArtifactAttestationPolicyJsons || [])
1590
- .filter(Boolean)
1591
- .map((policyJson) => parseJsonInput(policyJson, undefined, {
1592
- cwd,
1593
- label: "githubArtifactAttestationPolicyJsons entry",
1594
- }))
1595
- .map(normalizeGitHubArtifactAttestationPolicy);
1596
- const kfd3ArtifactWitnesses = [
1597
- ...kfd3ArtifactWitnessMetas.map((meta) => meta.value),
1598
- ...(kfd3ArtifactCommandMeta.value ? [kfd3ArtifactCommandMeta.value] : []),
1599
- ];
1600
- const publish = parseJsonInput(publishJson, {}, { cwd, label: "publishJson" });
1601
- const assets = [
1602
- ...(Array.isArray(release.assets) ? release.assets : []),
1603
- ...(Array.isArray(assetsFromJson) ? assetsFromJson : []),
1604
- ...discoverAssetsFromDir(assetsDir ? path.resolve(cwd, assetsDir) : ""),
1605
- ];
1606
- const resolvedTag = tag || release.tag_name || release.name || "";
1607
- const resolvedOutputDir = path.resolve(cwd, outputDir);
1608
- const resolvedChannel = optionalString(releaseExtra.channel || publish.channel);
1609
- const releaseEvidenceAttachments = releaseEvidenceMetas.map((meta, index) =>
1610
- normalizeReleaseEvidenceAttachment(meta, {
1611
- cwd,
1612
- expectedSourceSha: sourceSha,
1613
- expectedTag: resolvedTag,
1614
- expectedChannel: resolvedChannel,
1615
- index,
1616
- }),
1617
- );
1618
- copyReleaseEvidenceAttachments(releaseEvidenceAttachments, resolvedOutputDir);
1619
- const resolvedCheckedAt = optionalString(checkedAt) || nowIso();
1620
- const productMechanism = defaultProductMechanism({ repository, productName });
1621
- const kfdAdopterEvidence = collectKfdAdopterReleaseInputs({
1622
- cwd, manifestJson: kfdAdopterManifestJson, supportMatrixJson: kfdSupportMatrixJson,
1623
- productGateJsons: kfdProductGateJsons, repository, sourceSha, checkedAt: resolvedCheckedAt,
1624
- });
1625
- const {
1626
- manifest: kfdAdopterManifest,
1627
- manifestGate: kfdAdopterManifestGate,
1628
- legacyProjection: kfdSupport,
1629
- binding: kfdAdopter,
1630
- } = kfdAdopterEvidence;
1631
- const artifactEvidence = createArtifactEvidence({
1632
- assets,
1633
- repository,
1634
- tag: resolvedTag,
1635
- sourceSha,
1636
- workflow,
1637
- kfdAdopter,
1638
- });
1639
- const bundledPublishEvidencePath = publishEvidenceMeta.value ? "evidence.json" : "";
1640
- const impact = mergeAuthoritativeImpactBase(
1641
- normalizeImpactLedger(impactMeta.value, { tag: resolvedTag, line, decision: "unknown" }),
1642
- basePassportMeta.value,
1643
- );
1644
- const agentIndex = defaultAgentIndex({ tag: resolvedTag });
1645
- const kfd1 = createKfd1ReleaseGateEvidence({
1646
- cwd,
1647
- artifactRoot: assetsDir ? path.resolve(cwd, assetsDir) : "",
1648
- artifacts: assets,
1649
- witnesses: kfd1WitnessMetas.map((meta) => meta.value),
1650
- });
1651
- const kfd3 = createKfd3CollaborationInterfaceReleaseGateEvidence({
1652
- prebuildWitnesses: kfd3PrebuildWitnessMetas.map((meta) => meta.value),
1653
- artifactWitnesses: kfd3ArtifactWitnesses,
1654
- prebuildWitnessMetas: kfd3PrebuildWitnessMetas,
1655
- artifactWitnessMetas: kfd3ArtifactWitnessMetas,
1656
- artifactCommandMeta: kfd3ArtifactCommandMeta.value ? kfd3ArtifactCommandMeta : undefined,
1657
- });
1658
- const passport = mergeAuthoritativePassportBase(createReleasePassport({
1659
- cwd,
1660
- repository,
1661
- tag: resolvedTag,
1662
- sourceSha,
1663
- line,
1664
- productName,
1665
- packageName,
1666
- packageVersion,
1667
- assets,
1668
- packageSet,
1669
- anchorManifest,
1670
- versionMaterial,
1671
- publishEvidence: publishEvidenceMeta.value,
1672
- trustedPublishing,
1673
- transaction: transactionMeta.value,
1674
- buildSummary: buildSummaryMeta.value
1675
- ? {
1676
- ...buildSummaryMeta,
1677
- path: buildSummaryMeta.path ? path.relative(resolvedOutputDir, buildSummaryMeta.path).split(path.sep).join("/") : "",
1678
- }
1679
- : undefined,
1680
- buildFacts: buildFactMetas.map((meta) => ({
1681
- ...meta,
1682
- path: meta.path ? path.relative(resolvedOutputDir, meta.path).split(path.sep).join("/") : "",
1683
- })),
1684
- platformArtifactManifests: platformManifestMetas
1685
- .filter((meta) => meta.value)
1686
- .map((meta) => ({
1687
- ...meta,
1688
- path: meta.path ? path.relative(resolvedOutputDir, meta.path).split(path.sep).join("/") : "",
1689
- })),
1690
- distTagPromotionEvidence: distTagEvidenceMeta.value
1691
- ? {
1692
- ...distTagEvidenceMeta,
1693
- path: distTagEvidenceMeta.path ? path.relative(resolvedOutputDir, distTagEvidenceMeta.path).split(path.sep).join("/") : "",
1694
- }
1695
- : undefined,
1696
- release: releaseExtra,
1697
- publish,
1698
- impact,
1699
- kfd1,
1700
- kfd2Claims: kfd2ClaimMetas.map((meta) => meta.value),
1701
- kfd3,
1702
- kfdAdopter,
1703
- kfdAdopterManifestEvidencePath: kfdAdopter ? "kfd-adopter-manifest.json" : "",
1704
- kfdAdopterGateEvidencePath: kfdAdopter ? "kfd-adopter-manifest-gate.json" : "",
1705
- kfdSupport,
1706
- kfdSupportEvidencePath: kfdSupport ? "kfd-support.json" : "",
1707
- invariantPassports,
1708
- releaseEvidence: releaseEvidenceAttachments.map(({ reference }) => reference),
1709
- v4ConsumerPolicyCertification: consumerPolicyCertificationMeta.value,
1710
- v4ConsumerPolicyCertificationRoot: domainConsumerPolicyCertificationRoot,
1711
- domainRuntimeResumeEvidence,
1712
- kfdAgentHubEvidence: kfdAgentHubEvidenceMeta.value
1713
- ? { ...kfdAgentHubEvidenceMeta, path: "kfd-agent-hub-evidence.json" }
1714
- : undefined,
1715
- kfdAgentHubEvidencePath: kfdAgentHubEvidenceMeta.value ? "kfd-agent-hub-evidence.json" : "",
1716
- controllerReceiptReferences,
1717
- githubArtifactAttestations: githubArtifactAttestationPolicies,
1718
- publishEvidencePath: publishEvidenceMeta.path ? path.relative(resolvedOutputDir, publishEvidenceMeta.path).split(path.sep).join("/") : "",
1719
- transactionStatePath: transactionMeta.path ? path.relative(resolvedOutputDir, transactionMeta.path).split(path.sep).join("/") : "",
1720
- workflow,
1721
- checkedAt: resolvedCheckedAt,
1722
- }), basePassportMeta.value, { requireKfd: requireBaseKfd });
1723
- if (bundledPublishEvidencePath) {
1724
- passport.evidence.publishEvidence = bundledPublishEvidencePath;
1725
- }
1726
- const checkReport = createReleaseCheckReport({
1727
- passport,
1728
- artifactEvidence,
1729
- publishEvidence: publishEvidenceMeta.value,
1730
- impact,
1731
- agentIndex,
1732
- productMechanism,
1733
- kfdAgentHubEvidence: kfdAgentHubEvidenceMeta.value,
1734
- kfdSupportEvidence: kfdSupport,
1735
- kfdAdopterManifest,
1736
- kfdAdopterManifestGate,
1737
- releaseEvidenceDocuments: releaseEvidenceAttachments,
1738
- checkedAt: resolvedCheckedAt,
1739
- });
1740
- const files = {
1741
- "product-mechanism.json": productMechanism,
1742
- "artifact-evidence.json": artifactEvidence,
1743
- ...(publishEvidenceMeta.value ? { [bundledPublishEvidencePath]: publishEvidenceMeta.value } : {}),
1744
- "impact.json": impact,
1745
- "agent-index.json": agentIndex,
1746
- ...(kfdAgentHubEvidenceMeta.value ? { "kfd-agent-hub-evidence.json": kfdAgentHubEvidenceMeta.value } : {}),
1747
- ...(kfdAdopterManifest ? { "kfd-adopter-manifest.json": kfdAdopterManifest } : {}),
1748
- ...(kfdAdopterManifestGate ? { "kfd-adopter-manifest-gate.json": kfdAdopterManifestGate } : {}),
1749
- ...(kfdSupport ? { "kfd-support.json": kfdSupport } : {}),
1750
- "buildchain.release.json": passport,
1751
- "check-report.json": checkReport,
1752
- };
1753
- for (const [fileName, value] of Object.entries(files)) {
1754
- writeJsonFile(path.join(resolvedOutputDir, fileName), value);
1755
- }
1756
- writeTextFile(path.join(resolvedOutputDir, "llms.txt"), defaultLlmsText({ tag: resolvedTag }));
1757
- return {
1758
- schemaVersion: 1,
1759
- contract: "kungfu-buildchain-release-passport-collection",
1760
- outputDir: resolvedOutputDir,
1761
- files: Object.keys(files)
1762
- .concat(releaseEvidenceAttachments.map(({ reference }) => reference.path))
1763
- .concat("llms.txt"),
1764
- passport,
1765
- artifactEvidence,
1766
- checkReport,
1767
- };
1768
- }
1769
-
1770
- function issue(level, code, message, details = {}) {
1771
- return { level, code, message, details };
1772
- }
1773
- function validateContract(value, expectedContract, label, issues) {
1774
- if (!value || typeof value !== "object" || Array.isArray(value)) {
1775
- issues.push(issue("error", `${label}.object`, `${label} must be a JSON object`));
1776
- return;
1777
- }
1778
- if (Number(value.schemaVersion) !== 1) {
1779
- issues.push(issue("error", `${label}.schemaVersion`, `${label}.schemaVersion must be 1`));
1780
- }
1781
- if (value.contract !== expectedContract) {
1782
- issues.push(issue("error", `${label}.contract`, `${label}.contract must be ${expectedContract}`));
1783
- }
1784
- }
1785
-
1786
- function validateKfd2ReleaseTrustPassportAudit(section, issues) {
1787
- if (!section) {
1788
- return;
1789
- }
1790
- if (typeof section !== "object" || Array.isArray(section)) {
1791
- issues.push(issue("error", "kfd-2.object", "kfd-2 release trust passport audit must be a JSON object"));
1792
- return;
1793
- }
1794
- if (section.contract !== KFD2_RELEASE_TRUST_PASSPORT_CONTRACT) {
1795
- issues.push(issue("error", "kfd-2.contract", `kfd-2 contract must be ${KFD2_RELEASE_TRUST_PASSPORT_CONTRACT}`));
1796
- }
1797
- const claims = Array.isArray(section.claims) ? section.claims : [];
1798
- if (claims.length === 0) {
1799
- issues.push(issue("error", "kfd-2.claims.empty", "kfd-2 audit must enumerate at least one public release claim"));
1800
- }
1801
- for (const [reasonIndex, reason] of arrayOrEmpty(section.downgradeReasons).entries()) {
1802
- try {
1803
- validateKfd2TrustTaxonomyEntry(reason, {
1804
- kind: "downgradeReason",
1805
- label: `kfd-2.downgradeReasons[${reasonIndex}]`,
1806
- });
1807
- } catch (error) {
1808
- issues.push(issue("error", `kfd-2.downgradeReasons[${reasonIndex}]`, error.message, {
1809
- id: reason?.id || "",
1810
- }));
1811
- }
1812
- }
1813
- for (const [index, claim] of claims.entries()) {
1814
- if (!claim.id || !claim.claim) {
1815
- issues.push(issue("error", `kfd-2.claims[${index}].identity`, "public release claim must include id and statement"));
1816
- }
1817
- if (claim.public === false) {
1818
- continue;
1819
- }
1820
- const missing = Array.isArray(claim.missingBindings) ? claim.missingBindings : [];
1821
- if (missing.length > 0 || claim.status === "failed") {
1822
- issues.push(issue("error", `kfd-2.claims[${index}].bindings`, "public release claim is missing machine-verifiable trust bindings", {
1823
- id: claim.id || "",
1824
- missingBindings: missing,
1825
- }));
1826
- } else if (claim.status === "downgraded" || claim.proseOnly) {
1827
- issues.push(issue("warning", `kfd-2.claims[${index}].downgraded`, "public release claim is downgraded and needs human review", {
1828
- id: claim.id || "",
1829
- proseOnly: Boolean(claim.proseOnly),
1830
- }));
1831
- }
1832
- for (const [riskIndex, risk] of arrayOrSingleton(claim.residualRisk || claim.residual_risk).entries()) {
1833
- try {
1834
- validateKfd2TrustTaxonomyEntry(risk, {
1835
- kind: "residualRisk",
1836
- label: `kfd-2.claims[${index}].residualRisk[${riskIndex}]`,
1837
- });
1838
- } catch (error) {
1839
- issues.push(issue("error", `kfd-2.claims[${index}].residualRisk[${riskIndex}]`, error.message, {
1840
- id: risk?.id || claim.id || "",
1841
- }));
1842
- }
1843
- }
1844
- for (const [reasonIndex, reason] of arrayOrSingleton(claim.downgradeReasons || claim.downgrade_reasons || claim.downgradeReason || claim.downgrade_reason).entries()) {
1845
- try {
1846
- validateKfd2TrustTaxonomyEntry(reason, {
1847
- kind: "downgradeReason",
1848
- label: `kfd-2.claims[${index}].downgradeReasons[${reasonIndex}]`,
1849
- });
1850
- } catch (error) {
1851
- issues.push(issue("error", `kfd-2.claims[${index}].downgradeReasons[${reasonIndex}]`, error.message, {
1852
- id: reason?.id || claim.id || "",
1853
- }));
1854
- }
1855
- }
1856
- if (String(claim.id || "").startsWith("kfd-3:")) {
1857
- const trustProof = claim.trustProof && typeof claim.trustProof === "object" && !Array.isArray(claim.trustProof)
1858
- ? claim.trustProof
1859
- : undefined;
1860
- if (!trustProof || trustProof.contract !== KFD2_TRUST_PROOF_CONTRACT) {
1861
- issues.push(issue("error", `kfd-2.claims[${index}].trustProof`, "KFD-3 generated public claims must include a KFD-2 trust proof", {
1862
- id: claim.id || "",
1863
- expectedContract: KFD2_TRUST_PROOF_CONTRACT,
1864
- }));
1865
- } else {
1866
- if (!trustProof.witnessHashes?.prebuildWitnessSha256 || !trustProof.witnessHashes?.artifactWitnessSha256) {
1867
- issues.push(issue("error", `kfd-2.claims[${index}].trustProof.witnessHashes`, "KFD-2 trust proof must preserve KFD-3 witness hashes", {
1868
- id: claim.id || "",
1869
- }));
1870
- }
1871
- if (!trustProof.declaredCapabilityVerification?.result) {
1872
- issues.push(issue("error", `kfd-2.claims[${index}].trustProof.declaredCapabilityVerification`, "KFD-2 trust proof must preserve declared capability verification", {
1873
- id: claim.id || "",
1874
- }));
1875
- }
1876
- if (!trustProof.reverseAudit?.status) {
1877
- issues.push(issue("error", `kfd-2.claims[${index}].trustProof.reverseAudit`, "KFD-2 trust proof must preserve reverse audit result", {
1878
- id: claim.id || "",
1879
- }));
1880
- }
1881
- if (!trustProof.reverseAuditBoundary || typeof trustProof.reverseAuditBoundary !== "object" || Array.isArray(trustProof.reverseAuditBoundary)) {
1882
- issues.push(issue("error", `kfd-2.claims[${index}].trustProof.reverseAuditBoundary`, "KFD-2 trust proof must preserve the reverse audit boundary", {
1883
- id: claim.id || "",
1884
- }));
1885
- }
1886
- if (!Array.isArray(trustProof.residualRisk)) {
1887
- issues.push(issue("error", `kfd-2.claims[${index}].trustProof.residualRisk`, "KFD-2 trust proof must preserve residual risk as an array", {
1888
- id: claim.id || "",
1889
- }));
1890
- } else {
1891
- for (const [riskIndex, risk] of trustProof.residualRisk.entries()) {
1892
- try {
1893
- validateKfd2TrustTaxonomyEntry(risk, {
1894
- kind: "residualRisk",
1895
- label: `kfd-2.claims[${index}].trustProof.residualRisk[${riskIndex}]`,
1896
- });
1897
- } catch (error) {
1898
- issues.push(issue("error", `kfd-2.claims[${index}].trustProof.residualRisk[${riskIndex}]`, error.message, {
1899
- id: risk?.id || claim.id || "",
1900
- }));
1901
- }
1902
- }
1903
- }
1904
- if (!trustProof.responsibility?.registryFactsOwner || !trustProof.responsibility?.artifactVerificationOwner || !trustProof.responsibility?.releasePassportProofOwner) {
1905
- issues.push(issue("error", `kfd-2.claims[${index}].trustProof.responsibility`, "KFD-2 trust proof must preserve KFD-3 responsibility state", {
1906
- id: claim.id || "",
1907
- }));
1908
- }
1909
- }
1910
- }
1911
- }
1912
- if (section.status === "failed") {
1913
- issues.push(issue("error", "kfd-2.status", "kfd-2 release trust passport audit must not contain failed public claims"));
1914
- } else if (section.status === "downgraded") {
1915
- issues.push(issue("warning", "kfd-2.status", "kfd-2 release trust passport audit is downgraded by prose-only or residual-risk claims"));
1916
- } else if (section.status !== "passed") {
1917
- issues.push(issue("error", "kfd-2.status", "kfd-2 status must be passed, downgraded, or failed"));
1918
- }
1919
- }
1920
-
1921
- function validateKfdAgentHubReleaseEvidence(section, evidence, issues) {
1922
- if (!section && !evidence) return;
1923
- if (!section) {
1924
- issues.push(issue("error", "kfdAgentHub.section.missing", "Agent Hub evidence is present without a release-passport section"));
1925
- return;
1926
- }
1927
- if (!evidence || typeof evidence !== "object" || Array.isArray(evidence)) {
1928
- issues.push(issue("error", "kfdAgentHub.evidence.missing", "release passport must resolve its Agent Hub evidence asset"));
1929
- return;
1930
- }
1931
- let expected;
1932
- try {
1933
- expected = normalizeKfdAgentHubEvidence({ value: evidence });
1934
- } catch (error) {
1935
- issues.push(issue("error", "kfdAgentHub.evidence.invalid", error.message));
1936
- return;
1937
- }
1938
- if (section.contract !== KFD_AGENT_HUB_RELEASE_EVIDENCE_CONTRACT) {
1939
- issues.push(issue("error", "kfdAgentHub.contract", `kfdAgentHub.contract must be ${KFD_AGENT_HUB_RELEASE_EVIDENCE_CONTRACT}`));
1940
- }
1941
- for (const field of ["evidenceDigest", "reportDigest", "lockRoot"]) {
1942
- if (section[field] !== expected[field]) {
1943
- issues.push(issue("error", `kfdAgentHub.${field}`, `kfdAgentHub.${field} does not match the evidence asset`, {
1944
- expected: expected[field],
1945
- actual: section[field],
1946
- }));
1947
- }
1948
- }
1949
- if (stableJson(section.sourceCut) !== stableJson(expected.sourceCut) || stableJson(section.scope) !== stableJson(expected.scope)) {
1950
- issues.push(issue("error", "kfdAgentHub.scope", "Agent Hub package cut or adapter scope does not match the evidence asset"));
1951
- }
1952
- if (section.qualifying !== false || section.certification !== false) {
1953
- issues.push(issue("error", "kfdAgentHub.claimBoundary", "Agent Hub evidence must remain nonqualifying and non-certifying"));
1954
- }
1955
- }
1956
-
1957
- async function resolveSiblingJson(basePath, relativePath) {
1958
- if (!basePath || !relativePath) {
1959
- return undefined;
1960
- }
1961
- if (/^https?:\/\//.test(relativePath)) {
1962
- return readJsonFromLocation(relativePath);
1963
- }
1964
- if (/^https?:\/\//.test(basePath)) {
1965
- return readJsonFromLocation(new URL(relativePath, basePath).toString());
1966
- }
1967
- const candidate = path.resolve(path.dirname(basePath), relativePath);
1968
- if (!fs.existsSync(candidate)) {
1969
- return undefined;
1970
- }
1971
- return readJsonFile(candidate);
1972
- }
1973
-
1974
- function artifactDigestValue(artifact = {}) {
1975
- return optionalString(artifact.digest || artifact.sha256 || artifact.integrity || artifact.shasum);
1976
- }
1977
-
1978
- function equivalentDigest(left, right) {
1979
- if (!left || !right) {
1980
- return false;
1981
- }
1982
- return left === right || left === `sha256:${right}` || `sha256:${left}` === right;
1983
- }
1984
-
1985
- function artifactEvidenceKeys(artifact = {}) {
1986
- const name = optionalString(artifact.name);
1987
- if (!name) {
1988
- return [];
1989
- }
1990
- const group = optionalString(artifact.group);
1991
- const kind = optionalString(artifact.kind);
1992
- const ref = optionalString(artifact.ref || artifact.version);
1993
- const keys = [];
1994
- if (group || kind || ref) {
1995
- keys.push(["structured", group, kind, name, ref].join("\0"));
1996
- }
1997
- if (kind || ref) {
1998
- keys.push(["structured", "", kind, name, ref].join("\0"));
1999
- }
2000
- if (kind) {
2001
- keys.push(["structured", "", kind, name, ""].join("\0"));
2002
- }
2003
- keys.push(["name", name].join("\0"));
2004
- return keys;
2005
- }
2006
-
2007
- function indexEvidenceArtifacts(artifacts = []) {
2008
- const index = new Map();
2009
- for (const artifact of artifacts) {
2010
- for (const key of artifactEvidenceKeys(artifact)) {
2011
- const entries = index.get(key) || [];
2012
- entries.push(artifact);
2013
- index.set(key, entries);
2014
- }
2015
- }
2016
- return index;
2017
- }
2018
-
2019
- function findEvidenceForArtifact(artifact, evidenceIndex) {
2020
- const artifactDigest = artifactDigestValue(artifact);
2021
- for (const key of artifactEvidenceKeys(artifact)) {
2022
- const entries = evidenceIndex.get(key) || [];
2023
- if (entries.length === 0) {
2024
- continue;
2025
- }
2026
- const matchingDigest = entries.find((entry) => equivalentDigest(artifactDigest, artifactDigestValue(entry)));
2027
- if (matchingDigest) {
2028
- return matchingDigest;
2029
- }
2030
- if (!key.startsWith("name\0") || entries.length === 1) {
2031
- return entries[0];
2032
- }
2033
- }
2034
- return undefined;
2035
- }
2036
-
2037
- function validateReleaseEvidenceContracts({
2038
- passport,
2039
- artifactEvidence,
2040
- impact,
2041
- agentIndex,
2042
- productMechanism,
2043
- kfdAgentHubEvidence,
2044
- kfdSupportEvidence,
2045
- kfdAdopterManifest,
2046
- kfdAdopterManifestGate,
2047
- checkedAt,
2048
- issues,
2049
- }) {
2050
- validateContract(passport, RELEASE_PASSPORT_CONTRACT, "passport", issues);
2051
- validateContract(artifactEvidence, ARTIFACT_EVIDENCE_CONTRACT, "artifactEvidence", issues);
2052
- validateContract(impact, IMPACT_LEDGER_CONTRACT, "impact", issues);
2053
- validateContract(agentIndex, AGENT_INDEX_CONTRACT, "agentIndex", issues);
2054
- validateContract(productMechanism, PRODUCT_MECHANISM_CONTRACT, "productMechanism", issues);
2055
- validateKfdAgentHubReleaseEvidence(passport?.kfdAgentHub, kfdAgentHubEvidence, issues);
2056
- for (const entry of validateKfdAdopterReleaseEvidence({
2057
- binding: passport?.kfdAdopter,
2058
- artifactBinding: artifactEvidence?.kfdAdopter,
2059
- manifest: kfdAdopterManifest,
2060
- manifestGate: kfdAdopterManifestGate,
2061
- legacyProjection: kfdSupportEvidence,
2062
- passportLegacyProjection: passport?.kfdSupport,
2063
- expectedAdopterId: optionalString(passport?.product?.repository) || "kungfu-systems/buildchain",
2064
- expectedSourceRepository: optionalString(passport?.product?.repository), expectedSourceSha: optionalString(passport?.release?.sourceSha),
2065
- })) {
2066
- issues.push(issue("error", entry.code, entry.message, entry.details));
2067
- }
2068
- if (!passport?.kfdSupport && kfdSupportEvidence) {
2069
- issues.push(issue("error", "kfdSupport.section", "KFD support evidence is present without a release-passport projection"));
2070
- }
2071
-
2072
- for (const [index, value] of (passport?.githubArtifactAttestations || []).entries()) {
2073
- try {
2074
- const policy = normalizeGitHubArtifactAttestationPolicy(value);
2075
- if (policy.caller.sourceSha !== String(passport?.release?.sourceSha || "").toLowerCase()) {
2076
- issues.push(issue(
2077
- "error",
2078
- `githubArtifactAttestations[${index}].caller.sourceSha`,
2079
- "attestation policy source SHA must match passport.release.sourceSha",
2080
- ));
2081
- }
2082
- const artifact = (passport?.artifacts || []).find((entry) => entry.name === policy.subject.name);
2083
- if (!artifact) {
2084
- issues.push(issue(
2085
- "error",
2086
- `githubArtifactAttestations[${index}].subject.name`,
2087
- `attestation subject ${policy.subject.name} is absent from the Release Passport artifacts`,
2088
- ));
2089
- } else if (artifact.sha256 !== policy.subject.digest.sha256) {
2090
- issues.push(issue(
2091
- "error",
2092
- `githubArtifactAttestations[${index}].subject.digest`,
2093
- `attestation subject ${policy.subject.name} digest differs from the Release Passport artifact`,
2094
- ));
2095
- }
2096
- } catch (error) {
2097
- issues.push(issue(
2098
- "error",
2099
- `githubArtifactAttestations[${index}]`,
2100
- error.message,
2101
- ));
2102
- }
2103
- }
2104
- }
2105
-
2106
- function validateReleaseEvidenceAttachments({
2107
- passport,
2108
- artifactEvidence,
2109
- normalizedPublishEvidence,
2110
- releaseEvidenceDocuments,
2111
- issues,
2112
- }) {
2113
- const evidenceArtifacts = [
2114
- ...(Array.isArray(artifactEvidence?.artifacts) ? artifactEvidence.artifacts : []),
2115
- ...(normalizedPublishEvidence?.artifacts || []),
2116
- ];
2117
- const releaseEvidence = Array.isArray(passport?.releaseEvidence) ? passport.releaseEvidence : [];
2118
- const releaseEvidenceByCoordinate = new Map(
2119
- releaseEvidenceDocuments.map((entry) => [
2120
- `${entry?.reference?.id || ""}\0${entry?.reference?.path || ""}`,
2121
- entry,
2122
- ]),
2123
- );
2124
- const releaseEvidenceIds = new Set();
2125
- const releaseEvidencePaths = new Set();
2126
- for (const [index, reference] of releaseEvidence.entries()) {
2127
- const label = `releaseEvidence[${index}]`;
2128
- if (!reference || typeof reference !== "object" || Array.isArray(reference)) {
2129
- issues.push(issue("error", `${label}.object`, `${label} must be a JSON object`));
2130
- continue;
2131
- }
2132
- if (reference.contract !== RELEASE_EVIDENCE_ATTACHMENT_CONTRACT) {
2133
- issues.push(issue("error", `${label}.contract`, `${label}.contract must be ${RELEASE_EVIDENCE_ATTACHMENT_CONTRACT}`));
2134
- }
2135
- if (!reference.id || !reference.path || !reference.sha256 || !reference.documentContract) {
2136
- issues.push(issue("error", `${label}.identity`, `${label} must include id, path, sha256, and documentContract`));
2137
- continue;
2138
- }
2139
- if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(reference.id)) {
2140
- issues.push(issue("error", `${label}.id`, `${label}.id must use only letters, digits, dot, underscore, or hyphen`));
2141
- }
2142
- const expectedPath = `release-evidence-${reference.id}.json`;
2143
- if (reference.path !== expectedPath) {
2144
- issues.push(issue("error", `${label}.path`, `${label}.path must be ${expectedPath}`));
2145
- }
2146
- if (releaseEvidenceIds.has(reference.id)) {
2147
- issues.push(issue("error", `${label}.id`, `${label}.id must be unique`));
2148
- }
2149
- if (releaseEvidencePaths.has(reference.path)) {
2150
- issues.push(issue("error", `${label}.path`, `${label}.path must be unique`));
2151
- }
2152
- releaseEvidenceIds.add(reference.id);
2153
- releaseEvidencePaths.add(reference.path);
2154
- const loaded = releaseEvidenceByCoordinate.get(`${reference.id}\0${reference.path}`);
2155
- if (!loaded?.document) {
2156
- issues.push(issue("error", `${label}.missing`, `${label} document is not independently retrievable`, {
2157
- id: reference.id,
2158
- path: reference.path,
2159
- }));
2160
- continue;
2161
- }
2162
- const document = loaded.document;
2163
- if (document.contract !== reference.documentContract) {
2164
- issues.push(issue("error", `${label}.documentContract`, `${label} document contract differs from its passport reference`));
2165
- }
2166
- const digest = sha256Text(stableJson(document));
2167
- if (digest !== reference.sha256) {
2168
- issues.push(issue("error", `${label}.sha256`, `${label} document digest differs from its passport reference`));
2169
- }
2170
- for (const field of ["sourceSha", "tag", "channel"]) {
2171
- const expected = passport?.release?.[field] || "";
2172
- const declared = document?.release?.[field] || "";
2173
- if (!declared || declared !== expected || reference?.release?.[field] !== expected) {
2174
- issues.push(issue("error", `${label}.release.${field}`, `${label} ${field} must match the release passport`));
2175
- }
2176
- }
2177
- }
2178
- return { evidenceArtifacts, releaseEvidence };
2179
- }
2180
-
2181
- function validatePublishEvidenceSection({ passport, publishEvidence, normalizedPublishEvidence, issues }) {
2182
- const publishEvidenceSupplied =
2183
- Boolean(passport?.evidence?.publishEvidence) ||
2184
- (publishEvidence && typeof publishEvidence === "object" && Object.keys(publishEvidence).length > 0);
2185
- if (!publishEvidenceSupplied && !passport?.packageSet) {
2186
- return;
2187
- }
2188
- const checkPublishField = (value, label) => {
2189
- if (!value) {
2190
- issues.push(issue("error", `publishEvidence.${label}`, `publishEvidence.${label} is required`));
2191
- }
2192
- };
2193
- if (Number(normalizedPublishEvidence?.schema) !== 1) {
2194
- issues.push(issue("error", "publishEvidence.schema", "publishEvidence.schema must be 1"));
2195
- }
2196
- for (const field of ["version", "channel", "sourceSha", "releaseSha", "targetRef", "releaseMaterialSha", "publishToolingSha"]) {
2197
- checkPublishField(normalizedPublishEvidence?.[field], field);
2198
- }
2199
- if (!Array.isArray(normalizedPublishEvidence?.artifacts) || normalizedPublishEvidence.artifacts.length === 0) {
2200
- issues.push(issue("error", "publishEvidence.artifacts", "publishEvidence.artifacts must include published artifacts"));
2201
- }
2202
- if ((normalizedPublishEvidence?.artifacts || []).some((artifact) => artifact.action)) {
2203
- try {
2204
- const validation = validateTransactionPublishEvidence({
2205
- evidence: publishEvidence,
2206
- version: normalizedPublishEvidence.version,
2207
- channel: normalizedPublishEvidence.channel,
2208
- sourceSha: normalizedPublishEvidence.sourceSha,
2209
- releaseSha: normalizedPublishEvidence.releaseSha,
2210
- targetRef: normalizedPublishEvidence.targetRef,
2211
- releaseMaterialSha: normalizedPublishEvidence.releaseMaterialSha,
2212
- publishToolingSha: normalizedPublishEvidence.publishToolingSha,
2213
- });
2214
- for (const error of validation.errors) {
2215
- issues.push(issue("error", "publishEvidence.artifactProvenance", error));
2216
- }
2217
- } catch (error) {
2218
- issues.push(issue(
2219
- "error",
2220
- "publishEvidence.artifactProvenance",
2221
- `publish artifact provenance is invalid: ${error.message}`,
2222
- ));
2223
- }
2224
- }
2225
- for (const field of ["sourceSha", "releaseSha", "targetRef"]) {
2226
- if (passport?.release?.[field] && normalizedPublishEvidence?.[field] && passport.release[field] !== normalizedPublishEvidence[field]) {
2227
- issues.push(issue(
2228
- "error",
2229
- `publishEvidence.${field}.mismatch`,
2230
- `publishEvidence.${field} must match passport.release.${field}`,
2231
- ));
2232
- }
2233
- }
2234
- }
2235
-
2236
- function validateReleaseArtifacts({ artifacts, evidenceIndex, issues }) {
2237
- if (artifacts.length === 0) {
2238
- issues.push(issue("error", "artifacts.empty", "release passport must list at least one artifact"));
2239
- }
2240
- for (const artifact of artifacts) {
2241
- if (!artifact.name) {
2242
- issues.push(issue("error", "artifact.name", "artifact name is required"));
2243
- continue;
2244
- }
2245
- const evidence = findEvidenceForArtifact(artifact, evidenceIndex);
2246
- if (!evidence) {
2247
- issues.push(issue("error", "artifact.evidence.missing", `artifact ${artifact.name} is missing evidence`));
2248
- continue;
2249
- }
2250
- const evidenceDigest = artifactDigestValue(evidence);
2251
- if (!evidenceDigest) {
2252
- issues.push(issue("error", "artifact.digest", `artifact ${artifact.name} must have a digest`));
2253
- }
2254
- if (artifact.sha256 && evidence.sha256 && artifact.sha256 !== evidence.sha256) {
2255
- issues.push(issue("error", "artifact.sha256.mismatch", `artifact ${artifact.name} digest differs between passport and evidence`));
2256
- }
2257
- if (artifact.digest && evidenceDigest && artifact.digest !== evidenceDigest && artifact.digest !== `sha256:${evidenceDigest}`) {
2258
- issues.push(issue("error", "artifact.digest.mismatch", `artifact ${artifact.name} digest differs between passport and evidence`));
2259
- }
2260
- for (const field of ["action", "platform", "contract_major", "parent_digest", "content", "release", "verification"]) {
2261
- if (
2262
- Object.prototype.hasOwnProperty.call(evidence, field) &&
2263
- stableJson(artifact[field]) !== stableJson(evidence[field])
2264
- ) {
2265
- issues.push(issue(
2266
- "error",
2267
- `artifact.${field}.mismatch`,
2268
- `artifact ${artifact.name} ${field} differs between passport and publish evidence`,
2269
- ));
2270
- }
2271
- }
2272
- }
2273
- }
2274
-
2275
- function validatePackageSet({ passport, evidenceIndex, issues }) {
2276
- if (!passport?.packageSet) {
2277
- return;
2278
- }
2279
- const main = passport.packageSet.main || {};
2280
- const checkPackageEntry = (entry, label, role) => {
2281
- if (!entry.name || !entry.version) {
2282
- issues.push(issue("error", `${label}.identity`, `${label} must include name and version`));
2283
- }
2284
- if (!entry.distTag) {
2285
- issues.push(issue("error", `${label}.distTag`, `${label} must include distTag`));
2286
- }
2287
- if (!entry.digest) {
2288
- issues.push(issue("error", `${label}.digest`, `${label} must include digest`));
2289
- }
2290
- if (entry.name && entry.version) {
2291
- const artifact = findEvidenceForArtifact({
2292
- group: "node",
2293
- kind: "npm",
2294
- name: entry.name,
2295
- ref: entry.version,
2296
- digest: entry.digest,
2297
- }, evidenceIndex);
2298
- if (!artifact) {
2299
- issues.push(issue("error", `${label}.artifact`, `${label} must have matching npm artifact evidence`, {
2300
- role,
2301
- name: entry.name,
2302
- version: entry.version,
2303
- }));
2304
- }
2305
- }
2306
- };
2307
- checkPackageEntry(main, "packageSet.main", "main");
2308
- const platforms = Array.isArray(passport.packageSet.platforms) ? passport.packageSet.platforms : [];
2309
- if (platforms.length < 3) {
2310
- issues.push(issue("error", "packageSet.platforms", "packageSet must include at least three platform packages"));
2311
- }
2312
- for (const [index, entry] of platforms.entries()) {
2313
- checkPackageEntry(entry, `packageSet.platforms[${index}]`, "platform");
2314
- }
2315
- if (!Array.isArray(passport?.publish?.packages) || passport.publish.packages.length !== 1 + platforms.length) {
2316
- issues.push(issue("error", "publish.packages", "publish.packages must summarize main and platform packages"));
2317
- }
2318
- }
2319
-
2320
- function validateReleaseState({ passport, issues }) {
2321
- if (passport?.trustedPublishing) {
2322
- if (!passport.trustedPublishing.provider) {
2323
- issues.push(issue("error", "trustedPublishing.provider", "trustedPublishing.provider is required"));
2324
- }
2325
- if (passport.trustedPublishing.auth !== "trusted-publishing") {
2326
- issues.push(issue("error", "trustedPublishing.auth", "trustedPublishing.auth must be trusted-publishing"));
2327
- }
2328
- if (passport.trustedPublishing.enabled !== true) {
2329
- issues.push(issue("error", "trustedPublishing.enabled", "trusted publishing evidence must be enabled"));
2330
- }
2331
- }
2332
- if (passport?.transaction) {
2333
- if (!passport.transaction.state) {
2334
- issues.push(issue("error", "transaction.state", "transaction.state is required"));
2335
- } else if (passport.transaction.state !== "complete") {
2336
- issues.push(issue("error", "transaction.state", "release passport transaction state must be complete"));
2337
- }
2338
- for (const field of ["exactTag", "releaseSha", "releaseMaterialSha", "stateRef"]) {
2339
- if (!passport.transaction[field]) {
2340
- issues.push(issue("error", `transaction.${field}`, `transaction.${field} is required`));
2341
- }
2342
- }
2343
- }
2344
- if (passport?.anchorManifest) {
2345
- if (!passport.anchorManifest.sha256) {
2346
- issues.push(issue("error", "anchorManifest.sha256", "anchorManifest.sha256 is required"));
2347
- }
2348
- if (!passport.anchorManifest.fields || typeof passport.anchorManifest.fields !== "object" || Array.isArray(passport.anchorManifest.fields)) {
2349
- issues.push(issue("error", "anchorManifest.fields", "anchorManifest.fields must be an object"));
2350
- }
2351
- }
2352
- if (!passport?.runnerPolicy?.productionDefault) {
2353
- issues.push(issue("warning", "runnerPolicy.productionDefault", "runner policy should record the production default"));
2354
- }
2355
- }
2356
-
2357
- function validateVersionMaterial({ passport, issues }) {
2358
- if (!passport?.versionMaterial) {
2359
- return;
2360
- }
2361
- if (passport.versionMaterial.contract !== "kungfu-buildchain-anchored-version-material/v1") {
2362
- issues.push(issue(
2363
- "error",
2364
- "versionMaterial.contract",
2365
- "versionMaterial contract must be kungfu-buildchain-anchored-version-material/v1",
2366
- ));
2367
- }
2368
- if (!passport.versionMaterial.alpha?.tree || !passport.versionMaterial.release?.tree) {
2369
- issues.push(issue(
2370
- "error",
2371
- "versionMaterial.tree",
2372
- "versionMaterial must record alpha and release tree identities",
2373
- ));
2374
- }
2375
- const allowedPaths = Array.isArray(passport.versionMaterial.allowedPaths)
2376
- ? passport.versionMaterial.allowedPaths
2377
- : [];
2378
- const derivedFiles = Array.isArray(passport.versionMaterial.derivedFiles)
2379
- ? passport.versionMaterial.derivedFiles
2380
- : [];
2381
- for (const [index, file] of derivedFiles.entries()) {
2382
- if (!file?.path || !file?.sha256 || !allowedPaths.includes(file.path)) {
2383
- issues.push(issue(
2384
- "error",
2385
- `versionMaterial.derivedFiles[${index}]`,
2386
- "derived version material must have a path, digest, and matching allowed path",
2387
- ));
2388
- }
2389
- }
2390
- for (const side of ["alpha", "release"]) {
2391
- const material = Array.isArray(passport.versionMaterial[side]?.material)
2392
- ? passport.versionMaterial[side].material
2393
- : [];
2394
- for (const [index, file] of material.entries()) {
2395
- if (
2396
- !file?.path ||
2397
- !allowedPaths.includes(file.path) ||
2398
- file.present !== true ||
2399
- !/^sha256:[0-9a-f]{64}$/.test(file.sha256 || "")
2400
- ) {
2401
- issues.push(issue(
2402
- "error",
2403
- `versionMaterial.${side}.material[${index}]`,
2404
- "version material must have an allowed path, present bytes, and sha256 digest",
2405
- ));
2406
- }
2407
- }
2408
- }
2409
- }
2410
-
2411
- function createReleaseImpactContext({ passport, impact }) {
2412
- const surfaceImpacts = Array.isArray(impact?.surfaceImpacts) ? impact.surfaceImpacts : [];
2413
- const passportSurfaceImpacts = Array.isArray(passport?.surfaceImpacts) ? passport.surfaceImpacts : [];
2414
- const impactRelease = impact?.release && typeof impact.release === "object" && !Array.isArray(impact.release)
2415
- ? impact.release
2416
- : {};
2417
- const passportVersion = optionalString(passport?.release?.publishedVersion || passport?.release?.package?.version);
2418
- const passportTargetRef = optionalString(passport?.release?.targetRef || passport?.release?.target_ref);
2419
- const passportTargetLineMatch = passportTargetRef.match(/^(?:alpha|release)\/v(\d+)\/v\1\.(\d+)$/);
2420
- return {
2421
- surfaceImpacts,
2422
- passportSurfaceImpacts,
2423
- impactVersion: optionalString(impactRelease.version),
2424
- impactLine: optionalString(impactRelease.line),
2425
- passportVersion,
2426
- passportLine: optionalString(
2427
- passport?.release?.line ||
2428
- (passportTargetLineMatch ? `v${passportTargetLineMatch[1]}.${passportTargetLineMatch[2]}` : ""),
2429
- ),
2430
- impactClassification: normalizeImpactLevel(impact?.classification),
2431
- declaredFinalImpact: normalizeImpactLevel(impact?.versionImpact?.final || impact?.classification),
2432
- computedFinalImpact: highestImpactLevel(surfaceImpacts.map((entry) => entry.impact)),
2433
- requiredSurfaceImpacts: surfaceImpactRequirement({ passport, impact }),
2434
- };
2435
- }
2436
-
2437
- function validatePassportTrustSections({ passport, issues }) {
2438
- const kfd1Metadata = resolveKfd1Metadata();
2439
- issues.push(...validateKfd1ReleaseGateEvidence(passport?.[kfd1Metadata.key], { metadata: kfd1Metadata }));
2440
- validateKfd2ReleaseTrustPassportAudit(passport?.["kfd-2"], issues);
2441
- const fallbackKfd3Section = passport?.["kfd-3"];
2442
- try {
2443
- const kfd3Metadata = resolveKfd3Metadata();
2444
- const kfd3Section = passport?.[kfd3Metadata.key] || fallbackKfd3Section;
2445
- if (kfd3Section) {
2446
- issues.push(...validateKfd3CollaborationInterfaceReleaseGateEvidence(kfd3Section, { metadata: kfd3Metadata }));
2447
- }
2448
- } catch (error) {
2449
- if (fallbackKfd3Section) {
2450
- issues.push(issue("error", "kfd-3.metadata", error.message));
2451
- }
2452
- }
2453
- if (!passport?.invariantPassports) {
2454
- return;
2455
- }
2456
- const section = passport.invariantPassports;
2457
- if (section.contract !== INVARIANT_PASSPORT_GATE_CONTRACT) {
2458
- issues.push(issue("error", "invariantPassports.contract", `invariantPassports.contract must be ${INVARIANT_PASSPORT_GATE_CONTRACT}`));
2459
- }
2460
- if (section.result !== "passed") {
2461
- issues.push(issue("error", "invariantPassports.result", "invariantPassports.result must be passed"));
2462
- }
2463
- if (!Array.isArray(section.passports) || section.passports.length === 0) {
2464
- issues.push(issue("error", "invariantPassports.empty", "invariantPassports must contain at least one verified passport"));
2465
- }
2466
- const acceptedSourceShas = new Set([
2467
- passport?.release?.sourceSha,
2468
- passport?.release?.builtSourceSha,
2469
- passport?.release?.promotionChannelSha,
2470
- ].filter(Boolean));
2471
- for (const [index, entry] of (section.passports || []).entries()) {
2472
- const prefix = `invariantPassports.passports[${index}]`;
2473
- if (entry.verdict !== "verified") issues.push(issue("error", `${prefix}.verdict`, `${prefix}.verdict must be verified`));
2474
- if (entry.coverage?.complete !== true) issues.push(issue("error", `${prefix}.coverage`, `${prefix}.coverage.complete must be true`));
2475
- if (entry.source?.dirty !== false) issues.push(issue("error", `${prefix}.source.dirty`, `${prefix}.source.dirty must be false`));
2476
- if (acceptedSourceShas.size > 0 && !acceptedSourceShas.has(entry.source?.revision)) {
2477
- issues.push(issue("error", `${prefix}.source.revision`, `${prefix}.source.revision must match a release source identity`));
2478
- }
2479
- if (!/^sha256:[0-9a-f]{64}$/.test(optionalString(entry.passportRoot))) issues.push(issue("error", `${prefix}.passportRoot`, `${prefix}.passportRoot is invalid`));
2480
- if (!Array.isArray(entry.platforms) || entry.platforms.length === 0) issues.push(issue("error", `${prefix}.platforms`, `${prefix}.platforms must be non-empty`));
2481
- if (!Array.isArray(entry.residualRisk)) issues.push(issue("error", `${prefix}.residualRisk`, `${prefix}.residualRisk must be an array`));
2482
- }
2483
- }
2484
-
2485
- function validateReleaseImpact({ passport, impact, context, issues }) {
2486
- const {
2487
- surfaceImpacts,
2488
- passportSurfaceImpacts,
2489
- impactVersion,
2490
- impactLine,
2491
- passportVersion,
2492
- passportLine,
2493
- impactClassification,
2494
- declaredFinalImpact,
2495
- computedFinalImpact,
2496
- requiredSurfaceImpacts,
2497
- } = context;
2498
- if (impactVersion) {
2499
- if (!impactLine) {
2500
- issues.push(issue("error", "impact.release.line", "version-bound impact requires release.line"));
2501
- } else if (passportLine && impactLine !== passportLine) {
2502
- issues.push(issue("error", "impact.release.line", "impact release line must match the release passport line", {
2503
- impactLine,
2504
- passportLine,
2505
- }));
2506
- }
2507
- if (passportVersion && impactVersion !== passportVersion) {
2508
- issues.push(issue("error", "impact.release.version", "impact release version must match the published release version", {
2509
- impactVersion,
2510
- passportVersion,
2511
- }));
2512
- }
2513
- if (!["patch", "minor", "major"].includes(impactClassification)) {
2514
- issues.push(issue("error", "impact.classification", "version-bound impact classification must be patch, minor, or major"));
2515
- } else if (impactClassification !== declaredFinalImpact) {
2516
- issues.push(issue("error", "impact.classification", "version-bound impact classification must match versionImpact.final", {
2517
- classification: impactClassification,
2518
- versionImpact: declaredFinalImpact,
2519
- }));
2520
- }
2521
- if (!optionalString(impact?.summary).trim()) {
2522
- issues.push(issue("error", "impact.summary", "version-bound impact summary is required"));
2523
- }
2524
- if (surfaceImpacts.length === 0) {
2525
- issues.push(issue("error", "impact.surfaceImpacts.required", "version-bound impact requires surfaceImpacts[]", {
2526
- type: "version-bound-release-impact",
2527
- }));
2528
- }
2529
- }
2530
- if (requiredSurfaceImpacts.required && surfaceImpacts.length === 0) {
2531
- issues.push(issue("error", "impact.surfaceImpacts.required", "surfaceImpacts[] is required for this release passport type", requiredSurfaceImpacts));
2532
- }
2533
- if (surfaceImpacts.length > 0) {
2534
- for (const [index, entry] of surfaceImpacts.entries()) {
2535
- if (!entry.id) {
2536
- issues.push(issue("error", `impact.surfaceImpacts[${index}].id`, "surface impact id is required"));
2537
- }
2538
- if (!VERSION_IMPACT_ORDER.has(entry.impact)) {
2539
- issues.push(issue("error", `impact.surfaceImpacts[${index}].impact`, "surface impact must be patch, minor, or major"));
2540
- }
2541
- if (!entry.rationale) {
2542
- issues.push(issue("error", `impact.surfaceImpacts[${index}].rationale`, "surface impact rationale is required"));
2543
- }
2544
- }
2545
- if (!impact?.versionImpact?.rationale) {
2546
- issues.push(issue("error", "impact.versionImpact.rationale", "version impact rationale is required when surface impacts are supplied"));
2547
- }
2548
- if (declaredFinalImpact !== computedFinalImpact) {
2549
- issues.push(issue("error", "impact.versionImpact.final", "versionImpact.final must equal the highest surface impact", {
2550
- declared: declaredFinalImpact,
2551
- computed: computedFinalImpact,
2552
- }));
2553
- }
2554
- if (stableJson(passportSurfaceImpacts) !== stableJson(surfaceImpacts)) {
2555
- issues.push(issue("error", "passport.surfaceImpacts", "passport.surfaceImpacts must mirror impact.surfaceImpacts"));
2556
- }
2557
- }
2558
- if (passport?.versionImpact?.final && impact?.versionImpact?.final && passport.versionImpact.final !== impact.versionImpact.final) {
2559
- issues.push(issue("error", "passport.versionImpact.final", "passport.versionImpact.final must match impact.versionImpact.final"));
2560
- }
2561
- }
2562
-
2563
- function buildReleaseCheckReport({
2564
- checkedAt,
2565
- issues,
2566
- requiredSurfaceImpacts,
2567
- artifacts,
2568
- evidenceArtifacts,
2569
- passport,
2570
- impact,
2571
- agentIndex,
2572
- productMechanism,
2573
- surfaceImpacts,
2574
- releaseEvidence,
2575
- }) {
2576
- const ok = issues.every((entry) => entry.level !== "error");
2577
- return {
2578
- schemaVersion: 1,
2579
- contract: RELEASE_CHECK_REPORT_CONTRACT,
2580
- checkedAt,
2581
- ok,
2582
- trust: ok ? "pass" : "fail",
2583
- surfaceImpactRequirement: requiredSurfaceImpacts,
2584
- completeness: {
2585
- artifactCount: artifacts.length,
2586
- evidenceArtifactCount: evidenceArtifacts.length,
2587
- packageSetPresent: Boolean(passport?.packageSet),
2588
- trustedPublishingPresent: Boolean(passport?.trustedPublishing),
2589
- transactionPresent: Boolean(passport?.transaction),
2590
- anchorManifestPresent: Boolean(passport?.anchorManifest),
2591
- buildSummaryPresent: Boolean(passport?.buildSummary),
2592
- platformArtifactManifestCount: Array.isArray(passport?.platformArtifactManifests)
2593
- ? passport.platformArtifactManifests.length
2594
- : 0,
2595
- distTagPromotionEvidencePresent: Boolean(passport?.distTagPromotion),
2596
- impactPresent: Boolean(impact),
2597
- agentIndexPresent: Boolean(agentIndex),
2598
- productMechanismPresent: Boolean(productMechanism),
2599
- surfaceImpactsRequired: requiredSurfaceImpacts.required,
2600
- surfaceImpactCount: surfaceImpacts.length,
2601
- versionImpact: impact?.versionImpact?.final || "",
2602
- releaseEvidenceCount: releaseEvidence.length,
2603
- },
2604
- issues,
2605
- };
2606
- }
2607
-
2608
- export function createReleaseCheckReport({
2609
- passport,
2610
- artifactEvidence,
2611
- publishEvidence,
2612
- impact,
2613
- agentIndex,
2614
- productMechanism,
2615
- kfdAgentHubEvidence,
2616
- kfdSupportEvidence,
2617
- kfdAdopterManifest,
2618
- kfdAdopterManifestGate,
2619
- releaseEvidenceDocuments = [],
2620
- checkedAt = nowIso(),
2621
- } = {}) {
2622
- const issues = [];
2623
- validateReleaseEvidenceContracts({
2624
- passport,
2625
- artifactEvidence,
2626
- impact,
2627
- agentIndex,
2628
- productMechanism,
2629
- kfdAgentHubEvidence,
2630
- kfdSupportEvidence,
2631
- kfdAdopterManifest,
2632
- kfdAdopterManifestGate,
2633
- checkedAt,
2634
- issues,
2635
- });
2636
-
2637
- const tag = passport?.release?.tag || "";
2638
- if (!tag) {
2639
- issues.push(issue("error", "release.tag", "release.tag is required"));
2640
- }
2641
- if (!passport?.release?.sourceSha) {
2642
- issues.push(issue("warning", "release.sourceSha", "release.sourceSha is recommended"));
2643
- }
2644
- const artifacts = Array.isArray(passport?.artifacts) ? passport.artifacts : [];
2645
- const normalizedPublishEvidence = normalizePublishEvidence(publishEvidence);
2646
- const { evidenceArtifacts, releaseEvidence } = validateReleaseEvidenceAttachments({
2647
- passport,
2648
- artifactEvidence,
2649
- normalizedPublishEvidence,
2650
- releaseEvidenceDocuments,
2651
- issues,
2652
- });
2653
- validateConsumerPolicyPassportSection({ passport, issues });
2654
- validateRuntimeResumePassportSection({ passport, issues });
2655
- validatePublishEvidenceSection({ passport, publishEvidence, normalizedPublishEvidence, issues });
2656
- const evidenceIndex = indexEvidenceArtifacts(evidenceArtifacts);
2657
- validateReleaseArtifacts({ artifacts, evidenceIndex, issues });
2658
- validatePackageSet({ passport, evidenceIndex, issues });
2659
- validateReleaseState({ passport, issues });
2660
- validateVersionMaterial({ passport, issues });
2661
- const impactContext = createReleaseImpactContext({ passport, impact });
2662
- const { requiredSurfaceImpacts, surfaceImpacts } = impactContext;
2663
- validatePassportTrustSections({ passport, issues });
2664
- validateReleaseImpact({ passport, impact, context: impactContext, issues });
2665
- return buildReleaseCheckReport({
2666
- checkedAt,
2667
- issues,
2668
- requiredSurfaceImpacts,
2669
- artifacts,
2670
- evidenceArtifacts,
2671
- passport,
2672
- impact,
2673
- agentIndex,
2674
- productMechanism,
2675
- surfaceImpacts,
2676
- releaseEvidence,
2677
- });
2678
- }
2679
-
2680
- export async function readJsonFromLocation(
2681
- location,
2682
- redirectCount = 0,
2683
- { timeoutMs = 15_000 } = {},
2684
- ) {
2685
- const input = nonEmptyString(location, "location");
2686
- if (!Number.isInteger(timeoutMs) || timeoutMs <= 0) {
2687
- throw new Error("timeoutMs must be a positive integer");
2688
- }
2689
- if (redirectCount > 5) {
2690
- throw new Error(`too many redirects while reading ${input}`);
2691
- }
2692
- if (/^https?:\/\//.test(input)) {
2693
- const client = input.startsWith("https:") ? https : http;
2694
- return new Promise((resolve, reject) => {
2695
- const request = client.get(input, (response) => {
2696
- if ([301, 302, 303, 307, 308].includes(response.statusCode) && response.headers.location) {
2697
- const nextLocation = new URL(response.headers.location, input).toString();
2698
- response.resume();
2699
- readJsonFromLocation(nextLocation, redirectCount + 1, { timeoutMs }).then(resolve, reject);
2700
- return;
2701
- }
2702
- if (response.statusCode < 200 || response.statusCode >= 300) {
2703
- reject(new Error(`HTTP ${response.statusCode} while reading ${input}`));
2704
- response.resume();
2705
- return;
2706
- }
2707
- let body = "";
2708
- response.setEncoding("utf8");
2709
- response.on("data", (chunk) => {
2710
- body += chunk;
2711
- });
2712
- response.on("end", () => {
2713
- try {
2714
- resolve(JSON.parse(body));
2715
- } catch (error) {
2716
- reject(error);
2717
- }
2718
- });
2719
- });
2720
- request.setTimeout(timeoutMs, () => {
2721
- request.destroy(new Error(`timed out after ${timeoutMs}ms while reading ${input}`));
2722
- });
2723
- request.on("error", reject);
2724
- });
2725
- }
2726
- return readJsonFile(input);
2727
- }
2728
-
2729
- export async function verifyReleasePassport({
2730
- passportLocation,
2731
- artifactEvidenceLocation = "",
2732
- publishEvidenceLocation = "",
2733
- impactLocation = "",
2734
- agentIndexLocation = "",
2735
- productMechanismLocation = "",
2736
- kfdAgentHubEvidenceLocation = "",
2737
- kfdAdopterManifestLocation = "",
2738
- kfdAdopterManifestGateLocation = "",
2739
- kfdSupportEvidenceLocation = "",
2740
- checkedAt = nowIso(),
2741
- } = {}) {
2742
- const evidence = await resolveReleasePassportVerificationInputs({
2743
- passportLocation,
2744
- locations: {
2745
- artifactEvidence: artifactEvidenceLocation,
2746
- publishEvidence: publishEvidenceLocation,
2747
- impact: impactLocation,
2748
- agentIndex: agentIndexLocation,
2749
- productMechanism: productMechanismLocation,
2750
- kfdAgentHubEvidence: kfdAgentHubEvidenceLocation,
2751
- kfdAdopterManifest: kfdAdopterManifestLocation,
2752
- kfdAdopterManifestGate: kfdAdopterManifestGateLocation,
2753
- kfdSupportEvidence: kfdSupportEvidenceLocation,
2754
- },
2755
- readJson: readJsonFromLocation,
2756
- resolveSibling: resolveSiblingJson,
2757
- });
2758
- return createReleaseCheckReport({
2759
- ...evidence,
2760
- checkedAt,
2761
- });
2762
- }
2763
-
2764
- export async function explainReleasePassport({ passportLocation, forAudience = "human" } = {}) {
2765
- const report = await verifyReleasePassport({ passportLocation });
2766
- const passport = await readJsonFromLocation(passportLocation);
2767
- const nextAction = report.ok
2768
- ? "install-or-upgrade-after-policy-review"
2769
- : "block-release-and-report-verification-failure";
2770
- return {
2771
- schemaVersion: 1,
2772
- contract: "kungfu-buildchain-release-explanation",
2773
- audience: forAudience,
2774
- release: passport.release,
2775
- trust: report.trust,
2776
- complete: report.ok,
2777
- artifactCount: report.completeness.artifactCount,
2778
- runnerPolicy: passport.runnerPolicy,
2779
- impact: {
2780
- versionImpact: passport.versionImpact || {},
2781
- surfaceImpacts: Array.isArray(passport.surfaceImpacts) ? passport.surfaceImpacts : [],
2782
- surfaceImpactRequirement: report.surfaceImpactRequirement,
2783
- breaking: Boolean(passport.versionImpact?.final === "major"),
2784
- migrationRequired: Boolean(passport.versionImpact?.final === "major"),
2785
- summary: passport.versionImpact?.rationale || "",
2786
- },
2787
- recovery: passport.recovery,
2788
- nextAction,
2789
- issues: report.issues,
2790
- };
2791
- }
2792
-
2793
- export function makeReleasePassportFixtureAssets(dir) {
2794
- fs.mkdirSync(dir, { recursive: true });
2795
- const names = [
2796
- `buildchain-${process.platform}-${process.arch}.tar.gz`,
2797
- "checksums.txt",
2798
- ];
2799
- for (const name of names) {
2800
- fs.writeFileSync(path.join(dir, name), `${name}${os.EOL}`);
2801
- }
2802
- return discoverAssetsFromDir(dir);
2803
- }
2804
-
2805
- export function validateKnownReleasePassportContracts() {
2806
- return [...CONTRACTS];
2807
- }
2808
- function parseConsumerPolicyCertification(input, cwd) {
2809
- return parseJsonInputWithMeta(input, undefined, {
2810
- cwd,
2811
- label: "v4ConsumerPolicyCertificationJson",
2812
- });
2813
- }
2814
-
2815
- function runtimeResumeSourceSha(release, fallback = "") {
2816
- const builtSourceSha = releaseField(
2817
- release || {},
2818
- "builtSourceSha",
2819
- "built_source_sha",
2820
- );
2821
- return release?.treeEquivalent === true && builtSourceSha
2822
- ? builtSourceSha
2823
- : fallback;
2824
- }
2825
-
2826
-
2827
- function validateConsumerPolicyPassportSection({ passport, issues }) {
2828
- const routing = passport?.promotionRouting;
2829
- const evidence = passport?.v4ConsumerPolicy;
2830
- if (isPromotionRouting(routing) && !evidence) {
2831
- issues.push(issue(
2832
- "error",
2833
- "v4ConsumerPolicy.missing",
2834
- "Buildchain v4 Release Passport requires an external floating consumer policy certification",
2835
- ));
2836
- return;
2837
- }
2838
- if (!evidence) return;
2839
- const verification = verifyFloatingConsumerPolicyCertification(
2840
- releasePassportCertificationVerificationOptions({
2841
- evidence,
2842
- passport,
2843
- routing,
2844
- }),
2845
- );
2846
- for (const failure of verification.failures) {
2847
- issues.push(issue("error", `v4ConsumerPolicy.${failure.code}`, failure.message));
2848
- }
2849
- }
2850
-
2851
- function validateRuntimeResumePassportSection({ passport, issues }) {
2852
- const evidence = passport?.v4RuntimeResume;
2853
- if (!evidence) return;
2854
- const consumerPolicyReceiptRoot = passport?.v4ConsumerPolicy?.certification?.receiptRoot || "";
2855
- const authorization = verifyRuntimeAuthorizationReceipt({
2856
- receipt: evidence.authorization,
2857
- receiptRoot: evidence.authorizationRoot,
2858
- repository: passport?.product?.repository || "",
2859
- sourceSha: runtimeResumeSourceSha(passport?.release, passport?.release?.sourceSha || ""),
2860
- runtimeSha: passport?.promotionRouting?.runtime?.resolvedSha || "",
2861
- consumerPolicyReceiptRoot,
2862
- });
2863
- for (const failure of authorization.failures) {
2864
- issues.push(issue("error", `v4RuntimeResume.authorization.${failure}`, failure));
2865
- }
2866
- const lineage = verifyRuntimeResumeLineage({
2867
- lineage: evidence.lineage,
2868
- lineageRoot: evidence.lineageRoot,
2869
- repository: passport?.product?.repository || "",
2870
- sourceSha: runtimeResumeSourceSha(passport?.release, passport?.release?.sourceSha || ""),
2871
- resumeRuntimeSha: passport?.promotionRouting?.runtime?.resolvedSha || "",
2872
- consumerPolicyReceiptRoot,
2873
- });
2874
- for (const failure of lineage.failures) {
2875
- issues.push(issue("error", `v4RuntimeResume.lineage.${failure}`, failure));
2876
- }
2877
- if (evidence.lineage?.authorizationRoot !== evidence.authorizationRoot) {
2878
- issues.push(issue(
2879
- "error",
2880
- "v4RuntimeResume.authorization-root-mismatch",
2881
- "runtime resume lineage must bind the embedded authorization receipt root",
2882
- ));
2883
- }
2884
- }