@kungfu-tech/buildchain 4.0.2 → 4.0.3-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 (233) hide show
  1. package/AGENTS.md +4 -4
  2. package/CONTRIBUTING.md +34 -0
  3. package/README.md +1 -1
  4. package/architecture/agent-change-map.md +154 -147
  5. package/architecture/{v4-architecture-constitution.md → architecture-constitution.md} +11 -11
  6. package/architecture/{v3-core-mechanism-inventory.md → baseline-core-mechanism-inventory.md} +1 -1
  7. package/architecture/{v4-bootstrap-authority.json → bootstrap-authority.json} +3 -3
  8. package/architecture/{v3-v4-capability-closure.md → capability-parity-closure.md} +3 -3
  9. package/architecture/{v3-v4-live-capability-inventory.json → capability-parity-live-capability-inventory.json} +4 -4
  10. package/architecture/{v4-capability-state-machine-manifest.json → capability-state-machine-manifest.json} +2 -2
  11. package/architecture/{v4-capability-state-machine-manifest.schema.json → capability-state-machine-manifest.schema.json} +2 -2
  12. package/architecture/ci-lane-change-budget.json +18 -0
  13. package/architecture/{v4-cross-platform-adopter-qualification.json → cross-platform-adopter-qualification.json} +3 -3
  14. package/architecture/{v4-delivery-authority-parity.json → delivery-authority-parity.json} +16 -16
  15. package/architecture/{v4-delivery-warrant-shadow-bootstrap-plan.json → delivery-warrant-shadow-bootstrap-plan.json} +3 -3
  16. package/architecture/{v4-delivery-warrant-shadow-bootstrap-plan.md → delivery-warrant-shadow-bootstrap-plan.md} +7 -7
  17. package/architecture/{v4-floating-consumer-policy.md → floating-consumer-policy.md} +1 -1
  18. package/architecture/implementation-naming.json +1273 -0
  19. package/architecture/internal-capabilities.json +171 -169
  20. package/architecture/maintainability-debt.json +87 -82
  21. package/architecture/maintainability-policy.json +15 -15
  22. package/architecture/{v4-next-development-parity.json → next-development-parity.json} +8 -8
  23. package/architecture/{v4-partial-mutation-recovery-qualification.json → partial-mutation-recovery-qualification.json} +8 -8
  24. package/architecture/{v4-platform-stage-checkpoints.json → platform-stage-checkpoints.json} +2 -2
  25. package/architecture/{v4-provider-operation-journal-contract.json → provider-operation-journal-contract.json} +9 -9
  26. package/architecture/{v4-publication-rehearsal-parity.json → publication-rehearsal-parity.json} +4 -4
  27. package/architecture/{v4-release-activation-shadow-domain.json → release-activation-shadow-domain.json} +8 -8
  28. package/architecture/{v4-release-topology.json → release-topology.json} +112 -56
  29. package/architecture/{v4-release-train-parity.json → release-train-parity.json} +2 -2
  30. package/architecture/{v4-runtime-ref-resume-authority.json → runtime-ref-resume-authority.json} +1 -1
  31. package/architecture/{v4-runtime-semantic-closure.json → runtime-semantic-closure.json} +2 -2
  32. package/architecture/{v4-rust-libnode-bridge-evaluation.json → rust-libnode-bridge-evaluation.json} +3 -3
  33. package/architecture/{v4-rust-libnode-bridge-spike.md → rust-libnode-bridge-spike.md} +6 -6
  34. package/architecture/{v4-rust-wasm-production-authority.json → rust-wasm-production-authority.json} +11 -11
  35. package/architecture/{v4-stable-publication-fence.json → stable-publication-fence.json} +6 -6
  36. package/architecture/{v4-stage-capsule-contract.json → stage-capsule-contract.json} +1 -1
  37. package/architecture/{v4-stage-capsule-qualification.json → stage-capsule-qualification.json} +6 -6
  38. package/architecture/{v4-stage-capsule-resume-planner.json → stage-capsule-resume-planner.json} +2 -2
  39. package/architecture/{v4-stage-capsule-store-contract.json → stage-capsule-store-contract.json} +4 -4
  40. package/architecture/{v4-tail-reseal-parity.json → tail-reseal-parity.json} +28 -28
  41. package/architecture/{v4-universal-workflow-bootstrap.json → universal-workflow-bootstrap.json} +9 -4
  42. package/architecture/{v4-universal-workflow-fault-campaign.json → universal-workflow-fault-campaign.json} +8 -8
  43. package/architecture/{v4-universal-workflow-train-admission.json → universal-workflow-train-admission.json} +8 -8
  44. package/architecture/workflow-taxonomy.json +11 -0
  45. package/bin/buildchain.mjs +3 -3
  46. package/bin/internal/adopter-delivery-cli.mjs +9 -9
  47. package/contracts/fixtures/v4-tail-reseal-v1/valid.json +1 -1
  48. package/crates/{buildchain-v4-bridge → buildchain-host-bridge}/Cargo.lock +1 -1
  49. package/crates/{buildchain-v4-bridge → buildchain-host-bridge}/Cargo.toml +1 -1
  50. package/crates/{buildchain-v4-bridge → buildchain-host-bridge}/src/main.rs +3 -3
  51. package/dist/site/buildchain-contract.json +18 -18
  52. package/dist/site/buildchain-site.json +167 -71
  53. package/dist/site/capability-registry.json +5 -5
  54. package/dist/site/kfd-claims.json +226 -90
  55. package/dist/site/kfd-upstream-aggregate.json +1 -1
  56. package/dist/site/manual-registry.json +7 -7
  57. package/dist/site/node-api-registry.json +12929 -10491
  58. package/dist/site/page-registry.json +155 -59
  59. package/dist/site/public-surface-audit.json +65 -46
  60. package/dist/site/publication-authority-registry.json +27 -17
  61. package/dist/site/publication-registry.json +4 -4
  62. package/dist/site/release-provenance.json +18 -9
  63. package/dist/site/site-manifest.json +11 -11
  64. package/dist/site/workflow-registry.json +86 -52
  65. package/docs/MAP.md +4 -3
  66. package/docs/next-development-transition.md +24 -1
  67. package/docs/node-api-reference.md +435 -175
  68. package/docs/oci-publication.md +173 -0
  69. package/docs/publish-transaction.md +36 -3
  70. package/docs/release-flow.md +1 -1
  71. package/docs/reusable-build-surface.md +1 -1
  72. package/docs/v4-adopter-delivery.md +2 -2
  73. package/docs/v4-canonical-contracts.md +7 -7
  74. package/docs/v4-delivery-warrant-read-candidate.md +3 -3
  75. package/docs/v4-delivery-warrant-semantic-diff.md +3 -3
  76. package/docs/v4-production-release.md +8 -2
  77. package/docs/v4-publication-rehearsal.md +3 -3
  78. package/docs/v4-runtime-ref-resume-authority.md +2 -2
  79. package/docs/v4-rust-wasm-production-authority.md +6 -6
  80. package/docs/v4-stage-capsule.md +7 -7
  81. package/docs/v4-tail-reseal.md +1 -1
  82. package/docs/workflow-catalog.md +1 -0
  83. package/package.json +37 -26
  84. package/packages/compatibility/adopter-delivery.js +16 -0
  85. package/packages/compatibility/cross-platform-adopter-qualification.js +12 -0
  86. package/packages/compatibility/floating-consumer-policy.js +14 -0
  87. package/packages/compatibility/publication-qualification.js +11 -0
  88. package/packages/compatibility/publication-rehearsal.js +18 -0
  89. package/packages/compatibility/runtime-ref-resume-authority.js +13 -0
  90. package/packages/compatibility/tail-reseal-receipt.js +7 -0
  91. package/packages/compatibility/tail-reseal.js +11 -0
  92. package/packages/core/{v4-adopter-delivery-parity.js → adopter-delivery-parity.js} +12 -12
  93. package/packages/core/{v4-adopter-delivery.js → adopter-delivery.js} +24 -24
  94. package/packages/core/buildchain-contract.js +5 -5
  95. package/packages/core/buildchain-domain.wasm +0 -0
  96. package/packages/core/buildchain-publication-authority.js +1 -0
  97. package/packages/core/{v4-canonical-contracts.js → canonical-contracts.js} +32 -31
  98. package/packages/core/{v4-cross-platform-adopter-qualification.js → cross-platform-adopter-qualification.js} +19 -19
  99. package/packages/core/{v4-delivery-warrant-fixture-runner.js → delivery-warrant-fixture-runner.js} +36 -32
  100. package/packages/core/{v4-delivery-warrant-read-candidate.js → delivery-warrant-read-candidate.js} +40 -40
  101. package/packages/core/{v4-delivery-warrant-semantic-diff-gate.js → delivery-warrant-semantic-diff-gate.js} +58 -59
  102. package/packages/core/{v4-delivery-warrant-shadow-adapter.js → delivery-warrant-shadow-adapter.js} +15 -15
  103. package/packages/core/dev-delivery-execution-transfer.js +6 -6
  104. package/packages/core/dev-delivery-native-proof.js +12 -8
  105. package/packages/core/dev-delivery-warrant-legacy-recovery.js +1 -1
  106. package/packages/core/dev-delivery-warrant-native-compatibility.js +4 -4
  107. package/packages/core/dev-delivery-warrant-state.js +11 -11
  108. package/packages/core/dev-delivery-warrant.js +3 -3
  109. package/packages/core/domain-wasm-artifact.js +7 -0
  110. package/packages/core/{v4-domain-wasm.js → domain-wasm.js} +31 -31
  111. package/packages/core/{v4-floating-consumer-evidence.js → floating-consumer-evidence.js} +13 -13
  112. package/packages/core/{v4-floating-consumer-policy.js → floating-consumer-policy.js} +27 -29
  113. package/packages/core/{v4-floating-consumer-release-passport.js → floating-consumer-release-passport.js} +25 -25
  114. package/packages/core/index.js +4 -8
  115. package/packages/core/next-development-projection.js +24 -1
  116. package/packages/core/next-development-transition.js +5 -6
  117. package/packages/core/oci-compose-qualification.js +143 -0
  118. package/packages/core/oci-publication-bundle.js +281 -0
  119. package/packages/core/oci-publication-graph.js +206 -0
  120. package/packages/core/paper-runtime-channels.js +2 -2
  121. package/packages/core/paper.js +3 -3
  122. package/packages/core/partial-mutation-recovery-qualification.js +18 -0
  123. package/packages/core/{v4-platform-stage-checkpoints.js → platform-stage-checkpoints.js} +37 -37
  124. package/packages/core/{v4-product-publication.js → product-publication.js} +11 -9
  125. package/packages/core/{v4-protected-publication-source.js → protected-publication-source.js} +3 -3
  126. package/packages/core/provider-operation-journal.js +62 -0
  127. package/packages/core/{v4-provider-readback-idempotency.js → provider-readback-idempotency.js} +33 -33
  128. package/packages/core/public-export-compatibility.js +33 -0
  129. package/packages/core/publication-development.js +72 -0
  130. package/packages/core/{v4-publication-qualification.js → publication-qualification.js} +17 -17
  131. package/packages/core/{v4-publication-rehearsal-capsule.js → publication-rehearsal-capsule.js} +23 -23
  132. package/packages/core/publication-rehearsal-projection.js +2 -2
  133. package/packages/core/{v4-publication-rehearsal-provider-bindings.js → publication-rehearsal-provider-bindings.js} +4 -4
  134. package/packages/core/publication-rehearsal-runtime.js +21 -21
  135. package/packages/core/{v4-publication-rehearsal.js → publication-rehearsal.js} +33 -33
  136. package/packages/core/publication-sealed-bundle.js +78 -13
  137. package/packages/core/release-activation-shadow.js +32 -0
  138. package/packages/core/release-candidate.js +6 -6
  139. package/packages/core/{v4-release-invocation.js → release-invocation.js} +15 -15
  140. package/packages/core/release-passport.js +36 -36
  141. package/packages/core/release-tail-product-capabilities.js +9 -0
  142. package/packages/core/release-tail-provider-plane.js +10 -10
  143. package/packages/core/{v4-runtime-ref-resume-authority.js → runtime-ref-resume-authority.js} +36 -40
  144. package/packages/core/{v4-runtime-selector-persistence.js → runtime-selector-persistence.js} +7 -7
  145. package/packages/core/stable-publication-fence.js +28 -0
  146. package/packages/core/{v4-stage-capsule-local-store.js → stage-capsule-local-store.js} +56 -54
  147. package/packages/core/{v4-stage-capsule-qualification-campaign.js → stage-capsule-qualification-campaign.js} +37 -38
  148. package/packages/core/{v4-stage-capsule-qualification.js → stage-capsule-qualification.js} +28 -29
  149. package/packages/core/{v4-stage-capsule-resume-planner.js → stage-capsule-resume-planner.js} +29 -29
  150. package/packages/core/{v4-stage-capsule-store.js → stage-capsule-store.js} +59 -56
  151. package/packages/core/{v4-stage-capsule.js → stage-capsule.js} +45 -45
  152. package/packages/core/{v4-tail-reseal-contract.js → tail-reseal-contract.js} +6 -6
  153. package/packages/core/{v4-tail-reseal-github.js → tail-reseal-github.js} +12 -12
  154. package/packages/core/{v4-tail-reseal-receipt.js → tail-reseal-receipt.js} +22 -22
  155. package/packages/core/{v4-tail-reseal.js → tail-reseal.js} +29 -29
  156. package/packages/core/{v4-universal-workflow-bootstrap.js → universal-workflow-bootstrap.js} +23 -23
  157. package/scripts/{v4-architecture.mjs → architecture.mjs} +6 -6
  158. package/scripts/binary-publication-evidence.mjs +1 -1
  159. package/scripts/{v4-bridge-bootstrap.mjs → bridge-bootstrap.mjs} +14 -18
  160. package/scripts/{v4-bridge-evidence.mjs → bridge-evidence.mjs} +8 -8
  161. package/scripts/{build-v4-domain-wasm.mjs → build-domain-wasm.mjs} +6 -18
  162. package/scripts/{v3-v4-capability-catalog.mjs → capability-parity-catalog.mjs} +19 -19
  163. package/scripts/check-action-bundles.mjs +2 -2
  164. package/scripts/{check-v3-v4-capability-inventory.mjs → check-capability-parity-inventory.mjs} +42 -42
  165. package/scripts/check-core-mechanism-inventory.mjs +4 -1
  166. package/scripts/{check-v4-floating-consumer-policy-contract.mjs → check-floating-consumer-policy-contract.mjs} +8 -8
  167. package/scripts/check-implementation-naming.mjs +135 -0
  168. package/scripts/check-inventory.mjs +6 -5
  169. package/scripts/check-maintainability.mjs +9 -2
  170. package/scripts/{check-v4-public-dogfood-contract.mjs → check-public-dogfood-contract.mjs} +15 -15
  171. package/scripts/{check-v4-release-topology.mjs → check-release-topology.mjs} +53 -31
  172. package/scripts/{check-v4-runtime-semantic-closure.mjs → check-runtime-semantic-closure.mjs} +19 -16
  173. package/scripts/{check-v4-universal-workflow-bootstrap.mjs → check-universal-workflow-bootstrap.mjs} +14 -14
  174. package/scripts/{v4-consumer-policy.mjs → consumer-policy.mjs} +15 -15
  175. package/scripts/{copy-v4-domain-wasm.mjs → copy-domain-wasm.mjs} +3 -3
  176. package/scripts/{v4-cross-platform-adopter-qualification.mjs → cross-platform-adopter-qualification.mjs} +9 -9
  177. package/scripts/{v4-declarative-promotion-admission.mjs → declarative-promotion-admission.mjs} +4 -4
  178. package/scripts/dev-delivery-warrant-options.mjs +1 -1
  179. package/scripts/dev-delivery-warrant-store.mjs +29 -10
  180. package/scripts/dev-delivery-warrant.mjs +4 -4
  181. package/scripts/dev-pr-delivery-warrant.mjs +1 -1
  182. package/scripts/generate-channel-build-workflow.mjs +2 -2
  183. package/scripts/generate-channel-promotion-workflow.mjs +14 -31
  184. package/scripts/generate-release-candidate-passport.mjs +23 -23
  185. package/scripts/generate-site-bundle.mjs +17 -17
  186. package/scripts/{generate-v4-universal-workflow-facades.mjs → generate-universal-workflow-facades.mjs} +61 -21
  187. package/scripts/{v4-host-adapter.mjs → host-adapter.mjs} +1 -1
  188. package/scripts/implementation-references.mjs +25 -0
  189. package/scripts/init-repo.mjs +1 -1
  190. package/scripts/next-development-review.mjs +17 -11
  191. package/scripts/oci-compose-preview.mjs +261 -0
  192. package/scripts/{v4-platform-stage-checkpoint-rehearsal.mjs → platform-stage-checkpoint-rehearsal.mjs} +17 -17
  193. package/scripts/{v4-product-publication-intent.mjs → product-publication-intent.mjs} +16 -8
  194. package/scripts/publication-candidate-kind.mjs +93 -0
  195. package/scripts/publication-candidate-sealer.mjs +16 -1
  196. package/scripts/{v4-publication-rehearsal-fixture.mjs → publication-rehearsal-fixture.mjs} +5 -5
  197. package/scripts/{v4-publication-settlement.mjs → publication-settlement.mjs} +8 -8
  198. package/scripts/{v4-release-candidate-adapter.mjs → release-candidate-adapter.mjs} +4 -4
  199. package/scripts/release-candidate-resolver.mjs +15 -26
  200. package/scripts/release-tail.mjs +5 -5
  201. package/scripts/resume-from-candidate-run.mjs +35 -42
  202. package/scripts/site-capability-metadata.mjs +9 -0
  203. package/scripts/source-verification-evidence.mjs +7 -7
  204. package/scripts/{v4-stage-capsule-qualification.mjs → stage-capsule-qualification.mjs} +62 -62
  205. package/scripts/{v4-stage-capsule-resume-rehearsal.mjs → stage-capsule-resume-rehearsal.mjs} +6 -6
  206. package/scripts/{v4-tail-reseal-macos-rehearsal.mjs → tail-reseal-macos-rehearsal.mjs} +9 -9
  207. package/scripts/{v4-tail-reseal.mjs → tail-reseal.mjs} +19 -19
  208. package/scripts/universal-facade-maintainability.mjs +12 -3
  209. package/scripts/{v4-universal-workflow-backflow.mjs → universal-workflow-backflow.mjs} +10 -10
  210. package/scripts/{v4-universal-workflow-engine.mjs → universal-workflow-engine.mjs} +40 -38
  211. package/scripts/{v4-universal-workflow-self-dogfood.mjs → universal-workflow-self-dogfood.mjs} +12 -12
  212. package/scripts/verify-version-state-delta.mjs +4 -2
  213. package/scripts/{v4-warrant-shadow-plan.mjs → warrant-shadow-plan.mjs} +6 -6
  214. package/templates/universal-buildchain-bootstrap-recovery.yml +4 -4
  215. package/packages/core/buildchain-v4-domain.wasm +0 -0
  216. package/packages/core/v4-domain-wasm-artifact.js +0 -7
  217. package/packages/core/v4-partial-mutation-recovery-qualification.js +0 -18
  218. package/packages/core/v4-provider-operation-journal.js +0 -62
  219. package/packages/core/v4-release-activation-shadow.js +0 -32
  220. package/packages/core/v4-stable-publication-fence.js +0 -28
  221. /package/actions/{v4-release-candidate-promote → release-candidate-promote}/README.md +0 -0
  222. /package/architecture/{v4-adopter-delivery-parity.json → adopter-delivery-parity.json} +0 -0
  223. /package/architecture/{v3-core-mechanism-inventory.json → baseline-core-mechanism-inventory.json} +0 -0
  224. /package/architecture/{v4-canonical-contract-fixtures.json → canonical-contract-fixtures.json} +0 -0
  225. /package/architecture/{v4-compatibility-facts-parity.json → compatibility-facts-parity.json} +0 -0
  226. /package/architecture/{v4-delivery-warrant-shadow-bootstrap-plan.schema.json → delivery-warrant-shadow-bootstrap-plan.schema.json} +0 -0
  227. /package/architecture/{v4-delivery-warrant-shadow-fixtures.json → delivery-warrant-shadow-fixtures.json} +0 -0
  228. /package/architecture/{v4-delivery-warrant-shadow-fixtures.schema.json → delivery-warrant-shadow-fixtures.schema.json} +0 -0
  229. /package/architecture/{v4-exception-ledger.json → exception-ledger.json} +0 -0
  230. /package/architecture/{v4-exception-ledger.schema.json → exception-ledger.schema.json} +0 -0
  231. /package/architecture/{v4-floating-consumer-policy.json → floating-consumer-policy.json} +0 -0
  232. /package/architecture/{v4-publication-facade-patches.json → publication-facade-patches.json} +0 -0
  233. /package/architecture/{v4-release-invocation-fixtures.json → release-invocation-fixtures.json} +0 -0
@@ -1,23 +1,23 @@
1
- import { v4ContentRoot, validateV4Root } from "./v4-canonical-contracts.js";
1
+ import { domainContentRoot, validateRoot } from "./canonical-contracts.js";
2
2
  import { validateReleaseCandidatePassport } from "./release-candidate.js";
3
3
  import {
4
- V4_TAIL_RESEAL_PLAN_CONTRACT,
5
- V4_TAIL_RESEAL_PLATFORMS,
6
- V4TailResealFault,
7
- normalizeV4TailResealRequest,
8
- planV4TailReseal,
9
- } from "./v4-tail-reseal.js";
4
+ TAIL_RESEAL_PLAN_CONTRACT,
5
+ TAIL_RESEAL_PLATFORMS,
6
+ TailResealFault,
7
+ normalizeTailResealRequest,
8
+ planTailReseal,
9
+ } from "./tail-reseal.js";
10
10
 
11
- export const V4_TAIL_RESEAL_RECEIPT_CONTRACT =
11
+ export const TAIL_RESEAL_RECEIPT_CONTRACT =
12
12
  "kungfu-buildchain-v4-tail-reseal-receipt/v1";
13
13
 
14
14
  function fault(code, path, message) {
15
- throw new V4TailResealFault(code, path, message);
15
+ throw new TailResealFault(code, path, message);
16
16
  }
17
17
 
18
18
  function root(value, path) {
19
19
  try {
20
- validateV4Root(value, path);
20
+ validateRoot(value, path);
21
21
  } catch (error) {
22
22
  fault("invalid-tail-reseal-root", path, error.message);
23
23
  }
@@ -52,7 +52,7 @@ function positiveInteger(value, path) {
52
52
  function validateReadbacks(readbacks, request) {
53
53
  if (
54
54
  !Array.isArray(readbacks) ||
55
- readbacks.length !== V4_TAIL_RESEAL_PLATFORMS.length
55
+ readbacks.length !== TAIL_RESEAL_PLATFORMS.length
56
56
  )
57
57
  fault(
58
58
  "tail-reseal-readback-mismatch",
@@ -116,7 +116,7 @@ function validateReadbacks(readbacks, request) {
116
116
  return normalized;
117
117
  }
118
118
 
119
- export function createV4TailResealReceipt({
119
+ export function createTailResealReceipt({
120
120
  request,
121
121
  plan,
122
122
  readbacks,
@@ -124,13 +124,13 @@ export function createV4TailResealReceipt({
124
124
  protectedReadbackRoot,
125
125
  currentRun,
126
126
  } = {}) {
127
- const normalized = normalizeV4TailResealRequest(request);
128
- const expectedPlan = planV4TailReseal(normalized);
127
+ const normalized = normalizeTailResealRequest(request);
128
+ const expectedPlan = planTailReseal(normalized);
129
129
  const { planRoot: _planRoot, ...planBody } = plan || {};
130
130
  if (
131
- plan?.schema !== V4_TAIL_RESEAL_PLAN_CONTRACT ||
131
+ plan?.schema !== TAIL_RESEAL_PLAN_CONTRACT ||
132
132
  plan.planRoot !== expectedPlan.planRoot ||
133
- v4ContentRoot("tail-reseal-plan", planBody) !== expectedPlan.planRoot
133
+ domainContentRoot("tail-reseal-plan", planBody) !== expectedPlan.planRoot
134
134
  )
135
135
  fault(
136
136
  "tail-reseal-plan-drift",
@@ -168,7 +168,7 @@ export function createV4TailResealReceipt({
168
168
  positiveInteger(currentRun.id, "$/currentRun/id");
169
169
  positiveInteger(currentRun.attempt, "$/currentRun/attempt");
170
170
  const payload = {
171
- schema: V4_TAIL_RESEAL_RECEIPT_CONTRACT,
171
+ schema: TAIL_RESEAL_RECEIPT_CONTRACT,
172
172
  action: "reused-retained-tail",
173
173
  repository: normalized.repository,
174
174
  source: normalized.source,
@@ -186,22 +186,22 @@ export function createV4TailResealReceipt({
186
186
  passport: {
187
187
  contract: passport.contract,
188
188
  candidateHash: passport.candidateHash,
189
- passportRoot: v4ContentRoot("release-candidate-passport", passport),
189
+ passportRoot: domainContentRoot("release-candidate-passport", passport),
190
190
  },
191
191
  protectedReadbackRoot,
192
192
  currentRun,
193
193
  };
194
194
  return {
195
195
  ...payload,
196
- receiptRoot: v4ContentRoot("tail-reseal-receipt", payload),
196
+ receiptRoot: domainContentRoot("tail-reseal-receipt", payload),
197
197
  };
198
198
  }
199
199
 
200
- export function verifyV4TailResealReceipt({ receipt, request, passport } = {}) {
200
+ export function verifyTailResealReceipt({ receipt, request, passport } = {}) {
201
201
  try {
202
- const expected = createV4TailResealReceipt({
202
+ const expected = createTailResealReceipt({
203
203
  request,
204
- plan: planV4TailReseal(request),
204
+ plan: planTailReseal(request),
205
205
  readbacks: receipt.platformReadbacks,
206
206
  passport,
207
207
  protectedReadbackRoot: receipt.protectedReadbackRoot,
@@ -1,36 +1,36 @@
1
1
  import {
2
- v4ContentRoot,
3
- validateV4Clock,
4
- validateV4Root,
5
- } from "./v4-canonical-contracts.js";
2
+ domainContentRoot,
3
+ validateClock,
4
+ validateRoot,
5
+ } from "./canonical-contracts.js";
6
6
  import {
7
- V4_TAIL_RESEAL_PLAN_CONTRACT,
8
- V4_TAIL_RESEAL_PLATFORMS as PLATFORM_IDS,
9
- V4_TAIL_RESEAL_PLATFORM_RUNNERS as PLATFORM_RUNNERS,
10
- V4_TAIL_RESEAL_REQUEST_CONTRACT,
11
- V4_TAIL_RESEAL_REUSED_STAGE_KEYS as REUSED_STAGE_KEYS,
12
- } from "./v4-tail-reseal-contract.js";
7
+ TAIL_RESEAL_PLAN_CONTRACT,
8
+ TAIL_RESEAL_PLATFORMS as PLATFORM_IDS,
9
+ TAIL_RESEAL_PLATFORM_RUNNERS as PLATFORM_RUNNERS,
10
+ TAIL_RESEAL_REQUEST_CONTRACT,
11
+ TAIL_RESEAL_REUSED_STAGE_KEYS as REUSED_STAGE_KEYS,
12
+ } from "./tail-reseal-contract.js";
13
13
 
14
14
  export {
15
- V4_TAIL_RESEAL_PLAN_CONTRACT,
16
- V4_TAIL_RESEAL_REQUEST_CONTRACT,
17
- } from "./v4-tail-reseal-contract.js";
15
+ TAIL_RESEAL_PLAN_CONTRACT,
16
+ TAIL_RESEAL_REQUEST_CONTRACT,
17
+ } from "./tail-reseal-contract.js";
18
18
 
19
19
  const SHA = /^[0-9a-f]{40}$/u;
20
20
  const TOKEN = /^[A-Za-z0-9][A-Za-z0-9._:/-]*$/u;
21
- const V4_RUNTIME_REF = /^(?:v4-alpha|train\/v4\/v4\.0\/[A-Za-z0-9._/-]+)$/u;
21
+ const DOMAIN_RUNTIME_REF = /^(?:v4-alpha|train\/v4\/v4\.0\/[A-Za-z0-9._/-]+)$/u;
22
22
 
23
- export class V4TailResealFault extends Error {
23
+ export class TailResealFault extends Error {
24
24
  constructor(code, path, message) {
25
25
  super(`${path}: ${message}`);
26
- this.name = "V4TailResealFault";
26
+ this.name = "TailResealFault";
27
27
  this.code = code;
28
28
  this.path = path;
29
29
  }
30
30
  }
31
31
 
32
32
  function fault(code, path, message) {
33
- throw new V4TailResealFault(code, path, message);
33
+ throw new TailResealFault(code, path, message);
34
34
  }
35
35
 
36
36
  function exactKeys(value, expected, path) {
@@ -84,7 +84,7 @@ function sha(value, path) {
84
84
 
85
85
  function root(value, path) {
86
86
  try {
87
- validateV4Root(value, path);
87
+ validateRoot(value, path);
88
88
  } catch (error) {
89
89
  fault("invalid-tail-reseal-root", path, error.message);
90
90
  }
@@ -93,7 +93,7 @@ function root(value, path) {
93
93
 
94
94
  function clock(value, path) {
95
95
  try {
96
- validateV4Clock(value, path);
96
+ validateClock(value, path);
97
97
  } catch (error) {
98
98
  fault("invalid-tail-reseal-clock", path, error.message);
99
99
  }
@@ -183,7 +183,7 @@ function validateRuntime(value) {
183
183
  "$/runtime/repository",
184
184
  "official Buildchain runtime required",
185
185
  );
186
- if (!V4_RUNTIME_REF.test(value.ref))
186
+ if (!DOMAIN_RUNTIME_REF.test(value.ref))
187
187
  fault(
188
188
  "tail-reseal-runtime-mismatch",
189
189
  "$/runtime/ref",
@@ -457,7 +457,7 @@ function validatePlatforms(values) {
457
457
  );
458
458
  }
459
459
 
460
- export function normalizeV4TailResealRequest(request) {
460
+ export function normalizeTailResealRequest(request) {
461
461
  exactKeys(
462
462
  request,
463
463
  [
@@ -477,7 +477,7 @@ export function normalizeV4TailResealRequest(request) {
477
477
  ],
478
478
  "$",
479
479
  );
480
- if (request.schema !== V4_TAIL_RESEAL_REQUEST_CONTRACT)
480
+ if (request.schema !== TAIL_RESEAL_REQUEST_CONTRACT)
481
481
  fault(
482
482
  "unsupported-tail-reseal-version",
483
483
  "$/schema",
@@ -516,10 +516,10 @@ export function normalizeV4TailResealRequest(request) {
516
516
  return structuredClone(request);
517
517
  }
518
518
 
519
- export function planV4TailReseal(request) {
520
- const normalized = normalizeV4TailResealRequest(request);
519
+ export function planTailReseal(request) {
520
+ const normalized = normalizeTailResealRequest(request);
521
521
  const payload = {
522
- schema: V4_TAIL_RESEAL_PLAN_CONTRACT,
522
+ schema: TAIL_RESEAL_PLAN_CONTRACT,
523
523
  mode: "production",
524
524
  productionAuthority: "v4",
525
525
  evaluatedAt: normalized.evaluatedAt,
@@ -584,11 +584,11 @@ export function planV4TailReseal(request) {
584
584
  };
585
585
  return {
586
586
  ...payload,
587
- planRoot: v4ContentRoot("tail-reseal-plan", payload),
587
+ planRoot: domainContentRoot("tail-reseal-plan", payload),
588
588
  };
589
589
  }
590
590
 
591
591
  export {
592
- V4_TAIL_RESEAL_PLATFORMS,
593
- V4_TAIL_RESEAL_REUSED_STAGE_KEYS,
594
- } from "./v4-tail-reseal-contract.js";
592
+ TAIL_RESEAL_PLATFORMS,
593
+ TAIL_RESEAL_REUSED_STAGE_KEYS,
594
+ } from "./tail-reseal-contract.js";
@@ -1,12 +1,12 @@
1
1
  import crypto from "node:crypto";
2
2
 
3
- export const V4_UNIVERSAL_WORKFLOW_REQUEST =
3
+ export const UNIVERSAL_WORKFLOW_REQUEST =
4
4
  "kungfu-buildchain-v4-universal-workflow-request/v1";
5
- export const V4_UNIVERSAL_WORKFLOW_ADMISSION_POLICY =
5
+ export const UNIVERSAL_WORKFLOW_ADMISSION_POLICY =
6
6
  "kungfu-buildchain-v4-universal-workflow-admission-policy/v1";
7
- export const V4_UNIVERSAL_WORKFLOW_ADMISSION =
7
+ export const UNIVERSAL_WORKFLOW_ADMISSION =
8
8
  "kungfu-buildchain-v4-universal-workflow-admission/v1";
9
- export const V4_UNIVERSAL_WORKFLOW_TERMINAL_RECEIPT =
9
+ export const UNIVERSAL_WORKFLOW_TERMINAL_RECEIPT =
10
10
  "kungfu-buildchain-v4-universal-workflow-terminal-receipt/v1";
11
11
  const EXACT_SHA = /^[0-9a-f]{40}$/u;
12
12
  const ROOT = /^sha256:[0-9a-f]{64}$/u;
@@ -166,13 +166,13 @@ function timestamp(value, label) {
166
166
  return normalized;
167
167
  }
168
168
 
169
- export function validateV4UniversalWorkflowRequest(value) {
169
+ export function validateUniversalWorkflowRequest(value) {
170
170
  exactKeys(
171
171
  value,
172
172
  ["schema", "mode", "candidate", "consumer", "capability", "payload"],
173
173
  "request",
174
174
  );
175
- if (value.schema !== V4_UNIVERSAL_WORKFLOW_REQUEST)
175
+ if (value.schema !== UNIVERSAL_WORKFLOW_REQUEST)
176
176
  fail("unsupported-request-schema", "request schema is unsupported");
177
177
  if (!MODES.has(value.mode))
178
178
  fail("unsupported-mode", "request mode is unsupported");
@@ -266,17 +266,17 @@ export function validateV4UniversalWorkflowRequest(value) {
266
266
  payload: canonical(value.payload),
267
267
  };
268
268
  }
269
- export function v4UniversalWorkflowRequestRoot(value) {
269
+ export function universalWorkflowRequestRoot(value) {
270
270
  return documentRoot(
271
271
  "universal-workflow-request",
272
- validateV4UniversalWorkflowRequest(value),
272
+ validateUniversalWorkflowRequest(value),
273
273
  );
274
274
  }
275
- export function v4ProductStateVersion(value, requestedSha) { const sourceSha = exactSha(requestedSha, "requestedSha"), ref = nonEmpty(value?.ref, "productStateRef.ref"), prefix = `refs/heads/buildchain/v4-product-state/${sourceSha}-`; if (!ref.startsWith(prefix)) fail("recovery-state-mismatch", "release recovery product state does not bind the requested source"); const match = ref.slice(prefix.length).match(/^(\d+)-(\d+)-(\d+)(?:-alpha-(\d+))?$/u); if (!match) fail("invalid-recovery-version", "release recovery product state version is invalid"); return `${match[1]}.${match[2]}.${match[3]}${match[4] === undefined ? "" : `-alpha.${match[4]}`}`; }
276
- export function selectV4FinalizedProductPublicationVersion(value) { const requestedSha = exactSha(value.requestedSha, "requestedSha"), requestedTree = exactSha(value.requestedTree, "requestedTree"), lane = nonEmpty(value.targetRef, "targetRef").match(/^(alpha|release)\/v(\d+)\/v(\d+)\.(\d+)$/u); if (!lane || lane[2] !== lane[3]) fail("invalid-finalization-lane", "product publication finalization target is not a release lane"); const expectedAlpha = lane[1] === "alpha", versions = []; for (const row of Array.isArray(value.recoveryStates) ? value.recoveryStates : []) { const stateRef = row?.stateRef, match = String(stateRef?.ref || "").match(/^refs\/heads\/buildchain\/v4-product-state\/([0-9a-f]{40})-(\d+)-(\d+)-(\d+)(?:-alpha-(\d+))?$/u); if (!match || match[2] !== lane[2] || match[3] !== lane[4]) continue; const stateTree = exactSha(row?.stateCommit?.tree?.sha, "productStateCommit.tree.sha"); if (stateTree !== requestedTree || !new Set(["ahead", "identical"]).has(row.headComparisonStatus)) continue; const sourceSha = exactSha(match[1], "productStateRef.sourceSha"), version = v4ProductStateVersion(stateRef, sourceSha), parsed = version.match(/^(\d+)\.(\d+)\.(\d+)(?:-alpha\.(\d+))?$/u); if ((parsed[4] !== undefined) !== expectedAlpha) continue; if (stateRef?.object?.type !== "commit" || exactSha(stateRef?.object?.sha, "productStateRef.object.sha") !== exactSha(row?.stateCommit?.sha, "productStateCommit.sha") || row.stateCommit.parents?.length !== 1 || exactSha(row.stateCommit.parents[0]?.sha, "productStateCommit.parents[0].sha") !== sourceSha) fail("finalization-state-mismatch", "product publication finalization state does not bind its source"); if (row.exactTagRef && (row.exactTagRef.ref !== `refs/tags/v${version}` || row.exactTagRef.object?.type !== "commit" || exactSha(row.exactTagRef.object?.sha, "exactTagRef.object.sha") !== sourceSha)) fail("finalization-tag-mismatch", "product publication finalization tag does not bind its source"); versions.push(version); } const selected = [...new Set(versions)].sort(); if (selected.length > 1) fail("finalization-state-ambiguous", `publication head ${requestedSha} matches multiple product versions`); return selected[0] || ""; }
277
- export function selectV4RecoveredProductPublicationVersion(value) {
278
- if (value.routeDecision !== "Resume") return ""; const version = nonEmpty(value.candidateVersion, "candidateVersion"), sourceSha = exactSha(value.requestedSha, "requestedSha"), candidate = version.match(/^(\d+)\.(\d+)\.(\d+)(?:-alpha\.(\d+))?$/u); if (!candidate) fail("invalid-recovery-version", "release recovery candidate version is invalid"); if (value.explicitResume) return version;
279
- const states = Array.isArray(value.recoveryStates) ? value.recoveryStates : []; if (states.length) { const recovered = [...new Set(states.map(({ stateRef, stateCommit, exactTagRef }) => { const selected = v4ProductStateVersion(stateRef, sourceSha), parsed = selected.match(/^(\d+)\.(\d+)\.(\d+)(?:-alpha\.(\d+))?$/u), parents = stateCommit?.parents || []; if (stateRef?.object?.type !== "commit" || exactSha(stateRef?.object?.sha, "productStateRef.object.sha") !== exactSha(stateCommit?.sha, "productStateCommit.sha") || parents.length !== 1 || exactSha(parents[0]?.sha, "productStateCommit.parents[0].sha") !== sourceSha) fail("recovery-state-mismatch", "release recovery product state commit does not bind the requested source"); if (exactTagRef && (exactTagRef.ref !== `refs/tags/v${selected}` || exactTagRef.object?.type !== "commit" || exactSha(exactTagRef.object?.sha, "exactTagRef.object.sha") !== sourceSha)) fail("recovery-tag-mismatch", "release recovery exact tag does not bind the requested source"); if (parsed[1] !== candidate[1] || parsed[2] !== candidate[2] || parsed[3] !== candidate[3] || (parsed[4] === undefined) !== (candidate[4] === undefined)) fail("recovery-state-mismatch", "release recovery product state is outside the candidate release line"); return selected; }))]; if (recovered.length !== 1) fail("recovery-state-ambiguous", "release recovery requires one exact product publication state; provide an exact transaction identity"); return recovered[0]; }
275
+ export function productStateVersion(value, requestedSha) { const sourceSha = exactSha(requestedSha, "requestedSha"), ref = nonEmpty(value?.ref, "productStateRef.ref"), prefix = `refs/heads/buildchain/v4-product-state/${sourceSha}-`; if (!ref.startsWith(prefix)) fail("recovery-state-mismatch", "release recovery product state does not bind the requested source"); const match = ref.slice(prefix.length).match(/^(\d+)-(\d+)-(\d+)(?:-alpha-(\d+))?$/u); if (!match) fail("invalid-recovery-version", "release recovery product state version is invalid"); return `${match[1]}.${match[2]}.${match[3]}${match[4] === undefined ? "" : `-alpha.${match[4]}`}`; }
276
+ export function selectFinalizedProductPublicationVersion(value) { const requestedSha = exactSha(value.requestedSha, "requestedSha"), requestedTree = exactSha(value.requestedTree, "requestedTree"), lane = nonEmpty(value.targetRef, "targetRef").match(/^(alpha|release)\/v(\d+)\/v(\d+)\.(\d+)$/u); if (!lane || lane[2] !== lane[3]) fail("invalid-finalization-lane", "product publication finalization target is not a release lane"); const expectedAlpha = lane[1] === "alpha", versions = []; for (const row of Array.isArray(value.recoveryStates) ? value.recoveryStates : []) { const stateRef = row?.stateRef, match = String(stateRef?.ref || "").match(/^refs\/heads\/buildchain\/v4-product-state\/([0-9a-f]{40})-(\d+)-(\d+)-(\d+)(?:-alpha-(\d+))?$/u); if (!match || match[2] !== lane[2] || match[3] !== lane[4]) continue; const stateTree = exactSha(row?.stateCommit?.tree?.sha, "productStateCommit.tree.sha"); if (stateTree !== requestedTree || !new Set(["ahead", "identical"]).has(row.headComparisonStatus)) continue; const sourceSha = exactSha(match[1], "productStateRef.sourceSha"), version = productStateVersion(stateRef, sourceSha), parsed = version.match(/^(\d+)\.(\d+)\.(\d+)(?:-alpha\.(\d+))?$/u); if ((parsed[4] !== undefined) !== expectedAlpha) continue; if (stateRef?.object?.type !== "commit" || exactSha(stateRef?.object?.sha, "productStateRef.object.sha") !== exactSha(row?.stateCommit?.sha, "productStateCommit.sha") || row.stateCommit.parents?.length !== 1 || exactSha(row.stateCommit.parents[0]?.sha, "productStateCommit.parents[0].sha") !== sourceSha) fail("finalization-state-mismatch", "product publication finalization state does not bind its source"); if (row.exactTagRef && (row.exactTagRef.ref !== `refs/tags/v${version}` || row.exactTagRef.object?.type !== "commit" || exactSha(row.exactTagRef.object?.sha, "exactTagRef.object.sha") !== sourceSha)) fail("finalization-tag-mismatch", "product publication finalization tag does not bind its source"); versions.push(version); } const selected = [...new Set(versions)].sort(); if (selected.length > 1) fail("finalization-state-ambiguous", `publication head ${requestedSha} matches multiple product versions`); return selected[0] || ""; }
277
+ export function selectRecoveredProductPublicationVersion(value) {
278
+ if (value.routeDecision !== "Resume") return ""; const candidateVersion = nonEmpty(value.candidateVersion, "candidateVersion"), version = value.channel === "stable" ? candidateVersion.replace(/-alpha\.\d+$/u, "") : candidateVersion, sourceSha = exactSha(value.requestedSha, "requestedSha"), candidate = version.match(/^(\d+)\.(\d+)\.(\d+)(?:-alpha\.(\d+))?$/u); if (!candidate) fail("invalid-recovery-version", "release recovery candidate version is invalid"); if (value.explicitResume) return version;
279
+ const states = Array.isArray(value.recoveryStates) ? value.recoveryStates : []; if (states.length) { const recovered = [...new Set(states.map(({ stateRef, stateCommit, exactTagRef }) => { const selected = productStateVersion(stateRef, sourceSha), parsed = selected.match(/^(\d+)\.(\d+)\.(\d+)(?:-alpha\.(\d+))?$/u), parents = stateCommit?.parents || []; if (stateRef?.object?.type !== "commit" || exactSha(stateRef?.object?.sha, "productStateRef.object.sha") !== exactSha(stateCommit?.sha, "productStateCommit.sha") || parents.length !== 1 || exactSha(parents[0]?.sha, "productStateCommit.parents[0].sha") !== sourceSha) fail("recovery-state-mismatch", "release recovery product state commit does not bind the requested source"); if (exactTagRef && (exactTagRef.ref !== `refs/tags/v${selected}` || exactTagRef.object?.type !== "commit" || exactSha(exactTagRef.object?.sha, "exactTagRef.object.sha") !== sourceSha)) fail("recovery-tag-mismatch", "release recovery exact tag does not bind the requested source"); if (parsed[1] !== candidate[1] || parsed[2] !== candidate[2] || parsed[3] !== candidate[3] || (parsed[4] === undefined) !== (candidate[4] === undefined)) fail("recovery-state-mismatch", "release recovery product state is outside the candidate release line"); return selected; }))]; if (recovered.length !== 1) fail("recovery-state-ambiguous", "release recovery requires one exact product publication state; provide an exact transaction identity"); return recovered[0]; }
280
280
  if (!value.exactTagRef) fail("recovery-tag-missing", "release recovery requires an exact partial-publication tag"); if (value.exactTagRef.ref !== `refs/tags/v${version}` || value.exactTagRef.object?.type !== "commit" || exactSha(value.exactTagRef.object?.sha, "exactTagRef.object.sha") !== sourceSha) fail("recovery-tag-mismatch", "release recovery exact tag does not bind the requested source");
281
281
  return version;
282
282
  }
@@ -299,7 +299,7 @@ function validatePolicy(value) {
299
299
  ],
300
300
  "policy",
301
301
  );
302
- if (value.schema !== V4_UNIVERSAL_WORKFLOW_ADMISSION_POLICY)
302
+ if (value.schema !== UNIVERSAL_WORKFLOW_ADMISSION_POLICY)
303
303
  fail("unsupported-policy-schema", "policy schema is unsupported");
304
304
  const consumerAdmission = nonEmpty(
305
305
  value.consumerAdmission,
@@ -394,7 +394,7 @@ function reviewedRuntimeSha(request, policy, evidence, runtimeSha) {
394
394
  return evidence.headSha;
395
395
  }
396
396
 
397
- export function v4UniversalWorkflowAdmissionRoot(value) {
397
+ export function universalWorkflowAdmissionRoot(value) {
398
398
  return documentRoot("universal-workflow-admission", validatePolicy(value));
399
399
  }
400
400
 
@@ -409,7 +409,7 @@ function assertPermissionCeiling(requested, ceiling) {
409
409
  }
410
410
  }
411
411
 
412
- export function admitV4UniversalWorkflow({
412
+ export function admitUniversalWorkflow({
413
413
  request: requestValue,
414
414
  policy: policyValue,
415
415
  observedRefSha,
@@ -419,9 +419,9 @@ export function admitV4UniversalWorkflow({
419
419
  reviewEvidence: reviewEvidenceValue,
420
420
  now,
421
421
  } = {}) {
422
- const request = validateV4UniversalWorkflowRequest(requestValue);
422
+ const request = validateUniversalWorkflowRequest(requestValue);
423
423
  const policy = validatePolicy(policyValue);
424
- const admissionRoot = v4UniversalWorkflowAdmissionRoot(policy);
424
+ const admissionRoot = universalWorkflowAdmissionRoot(policy);
425
425
  if (request.candidate.admissionRoot !== admissionRoot)
426
426
  fail("stale-admission", "request is not bound to the current admission");
427
427
  if (policy.sourceRepository !== request.candidate.repository)
@@ -507,7 +507,7 @@ export function admitV4UniversalWorkflow({
507
507
  "exact-head-checks-incomplete",
508
508
  "candidate exact-head checks are not successful",
509
509
  );
510
- const requestRoot = v4UniversalWorkflowRequestRoot(request);
510
+ const requestRoot = universalWorkflowRequestRoot(request);
511
511
  const discovery = {
512
512
  repository: request.candidate.repository,
513
513
  ref: request.candidate.discoveryRef,
@@ -516,7 +516,7 @@ export function admitV4UniversalWorkflow({
516
516
  observedAt,
517
517
  };
518
518
  return {
519
- schema: V4_UNIVERSAL_WORKFLOW_ADMISSION,
519
+ schema: UNIVERSAL_WORKFLOW_ADMISSION,
520
520
  status: "admitted",
521
521
  requestRoot,
522
522
  admissionRoot,
@@ -536,7 +536,7 @@ export function admitV4UniversalWorkflow({
536
536
  };
537
537
  }
538
538
 
539
- export function completeV4UniversalWorkflow({ admission, resultRoot, status }) {
539
+ export function completeUniversalWorkflow({ admission, resultRoot, status }) {
540
540
  exactKeys(
541
541
  admission,
542
542
  [
@@ -555,14 +555,14 @@ export function completeV4UniversalWorkflow({ admission, resultRoot, status }) {
555
555
  "admission",
556
556
  );
557
557
  if (
558
- admission.schema !== V4_UNIVERSAL_WORKFLOW_ADMISSION ||
558
+ admission.schema !== UNIVERSAL_WORKFLOW_ADMISSION ||
559
559
  admission.status !== "admitted"
560
560
  )
561
561
  fail("invalid-admission", "terminal receipt requires an admitted request");
562
562
  if (!new Set(["succeeded", "failed", "cancelled"]).has(status))
563
563
  fail("invalid-terminal-status", "terminal status is unsupported");
564
564
  const receipt = {
565
- schema: V4_UNIVERSAL_WORKFLOW_TERMINAL_RECEIPT,
565
+ schema: UNIVERSAL_WORKFLOW_TERMINAL_RECEIPT,
566
566
  status,
567
567
  requestRoot: root(admission.requestRoot, "admission.requestRoot"),
568
568
  admissionRoot: root(admission.admissionRoot, "admission.admissionRoot"),
@@ -5,12 +5,12 @@ import fs from "node:fs";
5
5
  import path from "node:path";
6
6
  import { pathToFileURL } from "node:url";
7
7
 
8
- const MANIFEST_PATH = "architecture/v4-capability-state-machine-manifest.json";
8
+ const MANIFEST_PATH = "architecture/capability-state-machine-manifest.json";
9
9
  const MANIFEST_SCHEMA_PATH =
10
- "architecture/v4-capability-state-machine-manifest.schema.json";
11
- const EXCEPTION_PATH = "architecture/v4-exception-ledger.json";
12
- const EXCEPTION_SCHEMA_PATH = "architecture/v4-exception-ledger.schema.json";
13
- const BOOTSTRAP_PATH = "architecture/v4-bootstrap-authority.json";
10
+ "architecture/capability-state-machine-manifest.schema.json";
11
+ const EXCEPTION_PATH = "architecture/exception-ledger.json";
12
+ const EXCEPTION_SCHEMA_PATH = "architecture/exception-ledger.schema.json";
13
+ const BOOTSTRAP_PATH = "architecture/bootstrap-authority.json";
14
14
  const BUDGET_DIMENSIONS = Object.freeze([
15
15
  "authority",
16
16
  "semanticState",
@@ -368,7 +368,7 @@ function loadArchitecture(root = process.cwd()) {
368
368
  const bootstrap = readJson(root, BOOTSTRAP_PATH);
369
369
  const inventory = readJson(
370
370
  root,
371
- "architecture/v3-core-mechanism-inventory.json",
371
+ "architecture/baseline-core-mechanism-inventory.json",
372
372
  );
373
373
  const schemaIssues = [];
374
374
  validateSchemaDocuments(manifestSchema, exceptionSchema, schemaIssues);
@@ -5,7 +5,7 @@ import { pathToFileURL } from "node:url";
5
5
  import {
6
6
  SETTLEMENT_ASSET,
7
7
  verifyPublicationSettlement,
8
- } from "./v4-publication-settlement.mjs";
8
+ } from "./publication-settlement.mjs";
9
9
  import { releaseAssetClient } from "./release-asset-client.mjs";
10
10
 
11
11
  export async function readBinaryPublicationEvidence({
@@ -10,7 +10,7 @@ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
10
10
  const manifestPath = path.join(
11
11
  root,
12
12
  "crates",
13
- "buildchain-v4-bridge",
13
+ "buildchain-host-bridge",
14
14
  "Cargo.toml",
15
15
  );
16
16
 
@@ -18,14 +18,14 @@ function bridgeBinary(profile = "debug", platform = process.platform) {
18
18
  return path.join(
19
19
  root,
20
20
  "crates",
21
- "buildchain-v4-bridge",
21
+ "buildchain-host-bridge",
22
22
  "target",
23
23
  profile,
24
- `buildchain-v4-bridge${platform === "win32" ? ".exe" : ""}`,
24
+ `buildchain-host-bridge${platform === "win32" ? ".exe" : ""}`,
25
25
  );
26
26
  }
27
27
 
28
- function createV4HostRequest({
28
+ function createHostRequest({
29
29
  command,
30
30
  args = [],
31
31
  input = Buffer.alloc(0),
@@ -45,7 +45,7 @@ function createV4HostRequest({
45
45
  };
46
46
  }
47
47
 
48
- function buildV4Bridge({ release = false } = {}) {
48
+ function buildBridge({ release = false } = {}) {
49
49
  return spawnSync(
50
50
  "cargo",
51
51
  [
@@ -59,14 +59,14 @@ function buildV4Bridge({ release = false } = {}) {
59
59
  );
60
60
  }
61
61
 
62
- function runV4Bridge(
62
+ function runBridge(
63
63
  request,
64
64
  { mode = "exchange", profile = "debug", env = {}, encoding = null } = {},
65
65
  ) {
66
66
  const binary = bridgeBinary(profile);
67
67
  if (!fs.existsSync(binary)) {
68
68
  throw new Error(
69
- `Buildchain v4 bridge is not built: ${path.relative(root, binary)}; run pnpm bridge:v4:build`,
69
+ `Buildchain v4 bridge is not built: ${path.relative(root, binary)}; run pnpm bridge:build`,
70
70
  );
71
71
  }
72
72
  return spawnSync(binary, [mode], {
@@ -74,11 +74,7 @@ function runV4Bridge(
74
74
  env: {
75
75
  ...process.env,
76
76
  BUILDCHAIN_V4_HOST_COMMAND: process.execPath,
77
- BUILDCHAIN_V4_HOST_SCRIPT: path.join(
78
- root,
79
- "scripts",
80
- "v4-host-adapter.mjs",
81
- ),
77
+ BUILDCHAIN_V4_HOST_SCRIPT: path.join(root, "scripts", "host-adapter.mjs"),
82
78
  ...env,
83
79
  },
84
80
  input: JSON.stringify(request),
@@ -94,7 +90,7 @@ function parseRunArgs(args) {
94
90
  const command = bridgeArgs[0];
95
91
  if (!command) {
96
92
  throw new Error(
97
- "usage: node scripts/v4-bridge-bootstrap.mjs <run|exchange> <command-id> -- [command-args...]",
93
+ "usage: node scripts/bridge-bootstrap.mjs <run|exchange> <command-id> -- [command-args...]",
98
94
  );
99
95
  }
100
96
  return { command, commandArgs };
@@ -103,7 +99,7 @@ function parseRunArgs(args) {
103
99
  function main(args = process.argv.slice(2)) {
104
100
  const [mode = "", ...rest] = args;
105
101
  if (mode === "build") {
106
- const result = buildV4Bridge({ release: rest.includes("--release") });
102
+ const result = buildBridge({ release: rest.includes("--release") });
107
103
  process.stdout.write(result.stdout || "");
108
104
  process.stderr.write(result.stderr || "");
109
105
  process.exitCode = result.status ?? 1;
@@ -111,13 +107,13 @@ function main(args = process.argv.slice(2)) {
111
107
  }
112
108
  if (!["run", "exchange"].includes(mode)) {
113
109
  throw new Error(
114
- "usage: node scripts/v4-bridge-bootstrap.mjs <build|run|exchange> ...",
110
+ "usage: node scripts/bridge-bootstrap.mjs <build|run|exchange> ...",
115
111
  );
116
112
  }
117
113
  const { command, commandArgs } = parseRunArgs(rest);
118
114
  const input = fs.readFileSync(0);
119
- const request = createV4HostRequest({ command, args: commandArgs, input });
120
- const result = runV4Bridge(request, {
115
+ const request = createHostRequest({ command, args: commandArgs, input });
116
+ const result = runBridge(request, {
121
117
  mode: mode === "run" ? "compat" : "exchange",
122
118
  });
123
119
  if (result.error) throw result.error;
@@ -138,4 +134,4 @@ if (
138
134
  }
139
135
  }
140
136
 
141
- export { bridgeBinary, buildV4Bridge, createV4HostRequest, main, runV4Bridge };
137
+ export { bridgeBinary, buildBridge, createHostRequest, main, runBridge };
@@ -7,13 +7,13 @@ import { fileURLToPath, pathToFileURL } from "node:url";
7
7
 
8
8
  import {
9
9
  bridgeBinary,
10
- buildV4Bridge,
11
- createV4HostRequest,
12
- runV4Bridge,
13
- } from "./v4-bridge-bootstrap.mjs";
10
+ buildBridge,
11
+ createHostRequest,
12
+ runBridge,
13
+ } from "./bridge-bootstrap.mjs";
14
14
 
15
15
  const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
16
- const hostScript = path.join(root, "scripts", "v4-host-adapter.mjs");
16
+ const hostScript = path.join(root, "scripts", "host-adapter.mjs");
17
17
 
18
18
  function flag(args, name, fallback = "") {
19
19
  const index = args.indexOf(`--${name}`);
@@ -51,10 +51,10 @@ function collectEvidence(args = process.argv.slice(2)) {
51
51
  if (!Number.isInteger(iterations) || iterations < 3 || iterations > 50) {
52
52
  throw new Error("--iterations must be between 3 and 50");
53
53
  }
54
- const build = buildV4Bridge({ release: true });
54
+ const build = buildBridge({ release: true });
55
55
  if (build.status !== 0) throw new Error(build.stderr || build.stdout);
56
56
  const binary = bridgeBinary("release");
57
- const request = createV4HostRequest({
57
+ const request = createHostRequest({
58
58
  command: "architecture.list",
59
59
  args: ["--json"],
60
60
  });
@@ -71,7 +71,7 @@ function collectEvidence(args = process.argv.slice(2)) {
71
71
  );
72
72
  const bridge = timed(
73
73
  () =>
74
- runV4Bridge(request, {
74
+ runBridge(request, {
75
75
  mode: "exchange",
76
76
  profile: "release",
77
77
  encoding: "utf8",
@@ -7,19 +7,9 @@ import { fileURLToPath } from "node:url";
7
7
  import { spawnSyncCommand } from "../packages/core/spawn-command.js";
8
8
 
9
9
  const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
10
- const crate = path.join(root, "crates", "buildchain-v4-contracts");
11
- const artifact = path.join(
12
- root,
13
- "packages",
14
- "core",
15
- "buildchain-v4-domain.wasm",
16
- );
17
- const metadata = path.join(
18
- root,
19
- "packages",
20
- "core",
21
- "v4-domain-wasm-artifact.js",
22
- );
10
+ const crate = path.join(root, "crates", "buildchain-domain-contracts");
11
+ const artifact = path.join(root, "packages", "core", "buildchain-domain.wasm");
12
+ const metadata = path.join(root, "packages", "core", "domain-wasm-artifact.js");
23
13
  const check = process.argv.includes("--check");
24
14
  const toolchain = process.env.BUILDCHAIN_RUST_WASM_TOOLCHAIN || "1.96.0";
25
15
  const expectedRustc = "rustc 1.96.0 (ac68faa20 2026-05-25)";
@@ -103,7 +93,7 @@ for (const file of sourceInputs) {
103
93
  }
104
94
  const sourceSha256 = sourceHash.digest("hex");
105
95
  const generatedMetadata = (artifactSha256) =>
106
- `// Generated by scripts/build-v4-domain-wasm.mjs.\nexport const V4_DOMAIN_WASM_ABI_VERSION = 1;\nexport const V4_DOMAIN_WASM_RUSTC = ${JSON.stringify(expectedRustc)};\nexport const V4_DOMAIN_WASM_SOURCE_SHA256 =\n ${JSON.stringify(sourceSha256)};\nexport const V4_DOMAIN_WASM_SHA256 =\n ${JSON.stringify(artifactSha256)};\n`;
96
+ `// Generated by scripts/build-domain-wasm.mjs.\nexport const DOMAIN_WASM_ABI_VERSION = 1;\nexport const DOMAIN_WASM_RUSTC = ${JSON.stringify(expectedRustc)};\nexport const DOMAIN_WASM_SOURCE_SHA256 =\n ${JSON.stringify(sourceSha256)};\nexport const DOMAIN_WASM_SHA256 =\n ${JSON.stringify(artifactSha256)};\n`;
107
97
 
108
98
  if (!canonicalBuildHost && !check) {
109
99
  throw new Error(
@@ -128,9 +118,7 @@ if (!canonicalBuildHost) {
128
118
  } else {
129
119
  const buildEnvironment = rustBuildEnvironment();
130
120
 
131
- const temporary = fs.mkdtempSync(
132
- path.join(os.tmpdir(), "buildchain-v4-wasm-"),
133
- );
121
+ const temporary = fs.mkdtempSync(path.join(os.tmpdir(), "buildchain-wasm-"));
134
122
  try {
135
123
  const build = spawnSyncCommand(
136
124
  "cargo",
@@ -158,7 +146,7 @@ if (!canonicalBuildHost) {
158
146
  temporary,
159
147
  "wasm32-unknown-unknown",
160
148
  "release",
161
- "buildchain_v4_contracts.wasm",
149
+ "buildchain_domain_contracts.wasm",
162
150
  );
163
151
  const built = fs.readFileSync(builtPath);
164
152
  const artifactSha256 = sha256(built);