@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
@@ -2,23 +2,23 @@ import fs from "node:fs";
2
2
  import path from "node:path";
3
3
 
4
4
  import {
5
- V4ContractFault,
6
- v4CanonicalBytes,
7
- v4ContentRoot,
8
- } from "./v4-canonical-contracts.js";
9
- import { emitV4PlatformStageCheckpoint } from "./v4-platform-stage-checkpoints.js";
10
- import { V4_STAGE_CAPSULE_QUALIFICATION_FAULTS } from "./v4-stage-capsule-qualification.js";
11
- import { planV4StageCapsuleResume } from "./v4-stage-capsule-resume-planner.js";
12
- import { v4StageCapsuleBlobRoot } from "./v4-stage-capsule-store.js";
5
+ ContractFault,
6
+ domainCanonicalBytes,
7
+ domainContentRoot,
8
+ } from "./canonical-contracts.js";
9
+ import { emitPlatformStageCheckpoint } from "./platform-stage-checkpoints.js";
10
+ import { STAGE_CAPSULE_QUALIFICATION_FAULTS } from "./stage-capsule-qualification.js";
11
+ import { planStageCapsuleResume } from "./stage-capsule-resume-planner.js";
12
+ import { stageCapsuleBlobRoot } from "./stage-capsule-store.js";
13
13
 
14
- export const V4_STAGE_CAPSULE_CAMPAIGN_RECORDED_AT = "2026-08-08T00:00:00.000Z";
15
- export const V4_STAGE_CAPSULE_CAMPAIGN_STAGES = Object.freeze([
14
+ export const STAGE_CAPSULE_CAMPAIGN_RECORDED_AT = "2026-08-08T00:00:00.000Z";
15
+ export const STAGE_CAPSULE_CAMPAIGN_STAGES = Object.freeze([
16
16
  "install",
17
17
  "build",
18
18
  "verify",
19
19
  "package",
20
20
  ]);
21
- export const V4_STAGE_CAPSULE_CAMPAIGN_DEPENDENCIES = Object.freeze({
21
+ export const STAGE_CAPSULE_CAMPAIGN_DEPENDENCIES = Object.freeze({
22
22
  install: [],
23
23
  build: ["install"],
24
24
  verify: ["build"],
@@ -39,18 +39,18 @@ const EXTERNAL_CONSUMER_EXCLUSIONS = Object.freeze({
39
39
  });
40
40
 
41
41
  function rootOf(label) {
42
- return v4StageCapsuleBlobRoot(
42
+ return stageCapsuleBlobRoot(
43
43
  Buffer.isBuffer(label)
44
44
  ? label
45
45
  : typeof label === "string"
46
46
  ? Buffer.from(`${label}\n`, "utf8")
47
- : v4CanonicalBytes(label),
47
+ : domainCanonicalBytes(label),
48
48
  );
49
49
  }
50
50
 
51
51
  function outputBytes(context, stageId, outputName) {
52
52
  const evidence = context.campaignProfile?.stageEvidence?.[stageId];
53
- if (evidence) return v4CanonicalBytes(evidence);
53
+ if (evidence) return domainCanonicalBytes(evidence);
54
54
  return Buffer.from(
55
55
  `${context.consumer}:${context.consumerSourceRevision}:${context.platform}:${stageId}:${outputName}:qualified-bytes\n`,
56
56
  "utf8",
@@ -66,15 +66,14 @@ function inputRoot(context, stageId, name) {
66
66
  "verification-report": ["verify", "verification-report"],
67
67
  "package-archive": ["package", "package-archive"],
68
68
  }[name];
69
- if (producer)
70
- return v4StageCapsuleBlobRoot(outputBytes(context, ...producer));
69
+ if (producer) return stageCapsuleBlobRoot(outputBytes(context, ...producer));
71
70
  return rootOf(
72
71
  `${context.consumer}:${context.consumerSourceRevision}:${context.platform}:input:${name}`,
73
72
  );
74
73
  }
75
74
 
76
75
  function campaignFault(code, location, message) {
77
- throw new V4ContractFault(code, location, message);
76
+ throw new ContractFault(code, location, message);
78
77
  }
79
78
 
80
79
  function readJson(file, label) {
@@ -157,7 +156,7 @@ function lifecycleStageEvidence({ stageId, manifest, summary, command }) {
157
156
  };
158
157
  }
159
158
 
160
- export function createV4StageCapsuleCampaignProfile(context) {
159
+ export function createStageCapsuleCampaignProfile(context) {
161
160
  const loaded = context.lifecycleConfig;
162
161
  if (!loaded?.filePath || !loaded?.config)
163
162
  campaignFault(
@@ -226,11 +225,11 @@ export function createV4StageCapsuleCampaignProfile(context) {
226
225
  configRoot: rootOf(configBytes),
227
226
  sourceRevision: context.consumerSourceRevision,
228
227
  });
229
- const installOutputRoot = v4StageCapsuleBlobRoot(
230
- v4CanonicalBytes(stageEvidence.install),
228
+ const installOutputRoot = stageCapsuleBlobRoot(
229
+ domainCanonicalBytes(stageEvidence.install),
231
230
  );
232
231
  const buildOutputRoot = stageEvidence.build
233
- ? v4StageCapsuleBlobRoot(v4CanonicalBytes(stageEvidence.build))
232
+ ? stageCapsuleBlobRoot(domainCanonicalBytes(stageEvidence.build))
234
233
  : installOutputRoot;
235
234
  const lifecycleDeclarations = stageNames.map((name) => ({
236
235
  name,
@@ -275,18 +274,18 @@ export function createV4StageCapsuleCampaignProfile(context) {
275
274
  };
276
275
  }
277
276
 
278
- export function v4StageCapsuleCampaignStages(context) {
279
- return context.campaignProfile?.stages || V4_STAGE_CAPSULE_CAMPAIGN_STAGES;
277
+ export function stageCapsuleCampaignStages(context) {
278
+ return context.campaignProfile?.stages || STAGE_CAPSULE_CAMPAIGN_STAGES;
280
279
  }
281
280
 
282
- export function v4StageCapsuleCampaignDependencies(context, stageId) {
281
+ export function stageCapsuleCampaignDependencies(context, stageId) {
283
282
  return (
284
283
  context.campaignProfile?.dependencies?.[stageId] ||
285
- V4_STAGE_CAPSULE_CAMPAIGN_DEPENDENCIES[stageId]
284
+ STAGE_CAPSULE_CAMPAIGN_DEPENDENCIES[stageId]
286
285
  );
287
286
  }
288
287
 
289
- export function createV4StageCapsuleCampaignCheckpointRequest(
288
+ export function createStageCapsuleCampaignCheckpointRequest(
290
289
  context,
291
290
  stageId,
292
291
  store,
@@ -305,7 +304,7 @@ export function createV4StageCapsuleCampaignCheckpointRequest(
305
304
  platformId: context.platform,
306
305
  stageId,
307
306
  stageOutcome,
308
- recordedAt: V4_STAGE_CAPSULE_CAMPAIGN_RECORDED_AT,
307
+ recordedAt: STAGE_CAPSULE_CAMPAIGN_RECORDED_AT,
309
308
  overheadMs: 0,
310
309
  inputs: Object.fromEntries(
311
310
  stage.inputs.map((name) => [name, inputRoot(context, stageId, name)]),
@@ -314,7 +313,7 @@ export function createV4StageCapsuleCampaignCheckpointRequest(
314
313
  productionOutputRoots: Object.fromEntries(
315
314
  Object.entries(outputs).map(([name, bytes]) => [
316
315
  name,
317
- v4StageCapsuleBlobRoot(bytes),
316
+ stageCapsuleBlobRoot(bytes),
318
317
  ]),
319
318
  ),
320
319
  productionLifecycleResult: { outcome: stageOutcome, stage: stageId },
@@ -357,14 +356,14 @@ export function createV4StageCapsuleCampaignCheckpointRequest(
357
356
  };
358
357
  }
359
358
 
360
- export function emitV4StageCapsuleCampaignCheckpoint(
359
+ export function emitStageCapsuleCampaignCheckpoint(
361
360
  context,
362
361
  stageId,
363
362
  store,
364
363
  stageOutcome = "success",
365
364
  ) {
366
- return emitV4PlatformStageCheckpoint(
367
- createV4StageCapsuleCampaignCheckpointRequest(
365
+ return emitPlatformStageCheckpoint(
366
+ createStageCapsuleCampaignCheckpointRequest(
368
367
  context,
369
368
  stageId,
370
369
  store,
@@ -373,7 +372,7 @@ export function emitV4StageCapsuleCampaignCheckpoint(
373
372
  );
374
373
  }
375
374
 
376
- export function v4StageCapsuleCampaignAggregateRoots(entries) {
375
+ export function stageCapsuleCampaignAggregateRoots(entries) {
377
376
  const manifests = entries.map(({ stage, manifest }) => ({
378
377
  stage,
379
378
  manifestRoot: manifest.manifestRoot,
@@ -387,11 +386,11 @@ export function v4StageCapsuleCampaignAggregateRoots(entries) {
387
386
  })),
388
387
  );
389
388
  return {
390
- artifactManifestRoot: v4ContentRoot(
389
+ artifactManifestRoot: domainContentRoot(
391
390
  "stage-capsule-artifact-manifest",
392
391
  manifests,
393
392
  ),
394
- contentRoot: v4ContentRoot("stage-capsule-artifact-content", content),
393
+ contentRoot: domainContentRoot("stage-capsule-artifact-content", content),
395
394
  };
396
395
  }
397
396
 
@@ -479,9 +478,9 @@ function faultDefinitions() {
479
478
  };
480
479
  }
481
480
 
482
- export function runV4StageCapsuleFaultCampaign(baseRequest) {
481
+ export function runStageCapsuleFaultCampaign(baseRequest) {
483
482
  const definitions = faultDefinitions();
484
- return V4_STAGE_CAPSULE_QUALIFICATION_FAULTS.map((id) => {
483
+ return STAGE_CAPSULE_QUALIFICATION_FAULTS.map((id) => {
485
484
  const request = structuredClone(baseRequest);
486
485
  const faultNode =
487
486
  request.nodes.find(({ key }) => key === "build") ||
@@ -494,11 +493,11 @@ export function runV4StageCapsuleFaultCampaign(baseRequest) {
494
493
  let actual = "contract-fault";
495
494
  let reasonCode = "unknown-fault";
496
495
  try {
497
- const decision = planV4StageCapsuleResume(request).decisions[0];
496
+ const decision = planStageCapsuleResume(request).decisions[0];
498
497
  actual = decision.decision;
499
498
  reasonCode = decision.reasonCode;
500
499
  } catch (error) {
501
- if (!(error instanceof V4ContractFault)) throw error;
500
+ if (!(error instanceof ContractFault)) throw error;
502
501
  reasonCode = error.code;
503
502
  }
504
503
  return {
@@ -1,14 +1,14 @@
1
1
  import {
2
- V4ContractFault,
3
- v4ContentRoot,
4
- validateV4Root,
5
- } from "./v4-canonical-contracts.js";
2
+ ContractFault,
3
+ domainContentRoot,
4
+ validateRoot,
5
+ } from "./canonical-contracts.js";
6
6
 
7
- export const V4_STAGE_CAPSULE_PLATFORM_QUALIFICATION_CONTRACT =
7
+ export const STAGE_CAPSULE_PLATFORM_QUALIFICATION_CONTRACT =
8
8
  "buildchain-v4-stage-capsule-platform-qualification/v1";
9
- export const V4_STAGE_CAPSULE_QUALIFICATION_CONTRACT =
9
+ export const STAGE_CAPSULE_QUALIFICATION_CONTRACT =
10
10
  "buildchain-v4-stage-capsule-qualification/v1";
11
- export const V4_STAGE_CAPSULE_WAVE_RECONCILIATION_CONTRACT =
11
+ export const STAGE_CAPSULE_WAVE_RECONCILIATION_CONTRACT =
12
12
  "buildchain-v4-stage-capsule-wave-reconciliation/v1";
13
13
 
14
14
  const PLATFORMS = ["linux-x64", "macos-arm64", "windows-x64"];
@@ -37,7 +37,7 @@ const TOKEN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
37
37
  const REVISION = /^[0-9a-f]{40}$/u;
38
38
 
39
39
  function fault(code, location, message) {
40
- throw new V4ContractFault(code, location, message);
40
+ throw new ContractFault(code, location, message);
41
41
  }
42
42
 
43
43
  function object(value, location) {
@@ -94,7 +94,7 @@ function string(value, location) {
94
94
 
95
95
  function roots(value, names, location) {
96
96
  exactKeys(value, names, location);
97
- for (const name of names) validateV4Root(value[name], `${location}/${name}`);
97
+ for (const name of names) validateRoot(value[name], `${location}/${name}`);
98
98
  }
99
99
 
100
100
  function validateFaults(entries, location) {
@@ -123,7 +123,7 @@ function validateFaults(entries, location) {
123
123
 
124
124
  function validateAuthorityAndRuns(value) {
125
125
  if (
126
- value.schema !== V4_STAGE_CAPSULE_PLATFORM_QUALIFICATION_CONTRACT ||
126
+ value.schema !== STAGE_CAPSULE_PLATFORM_QUALIFICATION_CONTRACT ||
127
127
  value.mode !== "shadow-only" ||
128
128
  value.productionAuthority !== "v3" ||
129
129
  value.providerEffects !== false ||
@@ -163,7 +163,7 @@ function validateAuthorityAndRuns(value) {
163
163
  `$/processRuns/${index}`,
164
164
  "run order or outcome differs",
165
165
  );
166
- validateV4Root(run.evidenceRoot, `$/processRuns/${index}/evidenceRoot`);
166
+ validateRoot(run.evidenceRoot, `$/processRuns/${index}/evidenceRoot`);
167
167
  }
168
168
  }
169
169
 
@@ -188,7 +188,7 @@ function validateBuildAndPlan(value) {
188
188
  ["planRoot", "requiredRestores", "requiredStages"],
189
189
  "$/resumePlan",
190
190
  );
191
- validateV4Root(value.resumePlan.planRoot, "$/resumePlan/planRoot");
191
+ validateRoot(value.resumePlan.planRoot, "$/resumePlan/planRoot");
192
192
  for (const name of ["requiredRestores", "requiredStages"])
193
193
  if (
194
194
  !Array.isArray(value.resumePlan[name]) ||
@@ -252,7 +252,7 @@ function validateMetricsAndRollback(value) {
252
252
  );
253
253
  }
254
254
 
255
- export function validateV4StageCapsulePlatformQualification(value) {
255
+ export function validateStageCapsulePlatformQualification(value) {
256
256
  exactKeys(
257
257
  value,
258
258
  [
@@ -277,13 +277,13 @@ export function validateV4StageCapsulePlatformQualification(value) {
277
277
  "$",
278
278
  );
279
279
  validateAuthorityAndRuns(value);
280
- validateV4Root(value.campaignProfileRoot, "$/campaignProfileRoot");
280
+ validateRoot(value.campaignProfileRoot, "$/campaignProfileRoot");
281
281
  validateBuildAndPlan(value);
282
282
  validateFaults(value.faultCampaign, "$/faultCampaign");
283
283
  validateMetricsAndRollback(value);
284
284
  const payload = structuredClone(value);
285
285
  delete payload.reportRoot;
286
- const expectedRoot = v4ContentRoot(
286
+ const expectedRoot = domainContentRoot(
287
287
  "stage-capsule-platform-qualification",
288
288
  payload,
289
289
  );
@@ -296,7 +296,7 @@ export function validateV4StageCapsulePlatformQualification(value) {
296
296
  return value;
297
297
  }
298
298
 
299
- export function qualifyV4StageCapsuleCampaign(
299
+ export function qualifyStageCapsuleCampaign(
300
300
  platformEvidence,
301
301
  expectedConsumers = CONSUMERS,
302
302
  ) {
@@ -323,7 +323,7 @@ export function qualifyV4StageCapsuleCampaign(
323
323
  "every expected consumer must qualify on all three platforms",
324
324
  );
325
325
  const evidence = platformEvidence.map((entry) =>
326
- structuredClone(validateV4StageCapsulePlatformQualification(entry)),
326
+ structuredClone(validateStageCapsulePlatformQualification(entry)),
327
327
  );
328
328
  const expectedPairs = requiredConsumers.flatMap((consumer) =>
329
329
  PLATFORMS.map((platform) => `${consumer}/${platform}`),
@@ -349,7 +349,7 @@ export function qualifyV4StageCapsuleCampaign(
349
349
  "the exact expected consumer set is required",
350
350
  );
351
351
  const body = {
352
- schema: V4_STAGE_CAPSULE_QUALIFICATION_CONTRACT,
352
+ schema: STAGE_CAPSULE_QUALIFICATION_CONTRACT,
353
353
  mode: "shadow-only",
354
354
  productionAuthority: "v3",
355
355
  platforms: evidence.map(({ platform, reportRoot }) => ({
@@ -370,23 +370,23 @@ export function qualifyV4StageCapsuleCampaign(
370
370
  };
371
371
  return {
372
372
  ...body,
373
- qualificationRoot: v4ContentRoot("stage-capsule-qualification", body),
373
+ qualificationRoot: domainContentRoot("stage-capsule-qualification", body),
374
374
  };
375
375
  }
376
376
 
377
- export function reconcileV4StageCapsuleWave(request) {
377
+ export function reconcileStageCapsuleWave(request) {
378
378
  exactKeys(
379
379
  request,
380
380
  ["schema", "qualificationRoot", "protectedDeliveryDrained", "children"],
381
381
  "$",
382
382
  );
383
- if (request.schema !== V4_STAGE_CAPSULE_WAVE_RECONCILIATION_CONTRACT)
383
+ if (request.schema !== STAGE_CAPSULE_WAVE_RECONCILIATION_CONTRACT)
384
384
  fault(
385
385
  "unsupported-stage-capsule-wave-reconciliation",
386
386
  "$/schema",
387
387
  "unsupported reconciliation contract",
388
388
  );
389
- validateV4Root(request.qualificationRoot, "$/qualificationRoot");
389
+ validateRoot(request.qualificationRoot, "$/qualificationRoot");
390
390
  if (request.protectedDeliveryDrained !== true)
391
391
  fault(
392
392
  "stage-capsule-protected-delivery-not-drained",
@@ -428,10 +428,10 @@ export function reconcileV4StageCapsuleWave(request) {
428
428
  "child identity or terminal delivery is incomplete",
429
429
  );
430
430
  for (const name of ["nativeGateRoot", "reviewRoot", "warrantRoot"])
431
- validateV4Root(child[name], `$/children/${index}/${name}`);
431
+ validateRoot(child[name], `$/children/${index}/${name}`);
432
432
  }
433
433
  const body = {
434
- schema: V4_STAGE_CAPSULE_WAVE_RECONCILIATION_CONTRACT,
434
+ schema: STAGE_CAPSULE_WAVE_RECONCILIATION_CONTRACT,
435
435
  wave: 2,
436
436
  qualificationRoot: request.qualificationRoot,
437
437
  protectedDeliveryDrained: true,
@@ -443,14 +443,13 @@ export function reconcileV4StageCapsuleWave(request) {
443
443
  };
444
444
  return {
445
445
  ...body,
446
- reconciliationRoot: v4ContentRoot(
446
+ reconciliationRoot: domainContentRoot(
447
447
  "stage-capsule-wave-reconciliation",
448
448
  body,
449
449
  ),
450
450
  };
451
451
  }
452
452
 
453
- export const V4_STAGE_CAPSULE_QUALIFICATION_PLATFORMS =
454
- Object.freeze(PLATFORMS);
455
- export const V4_STAGE_CAPSULE_QUALIFICATION_FAULTS = Object.freeze(FAULTS);
456
- export const V4_STAGE_CAPSULE_WAVE_CHILDREN = Object.freeze(CHILDREN);
453
+ export const STAGE_CAPSULE_QUALIFICATION_PLATFORMS = Object.freeze(PLATFORMS);
454
+ export const STAGE_CAPSULE_QUALIFICATION_FAULTS = Object.freeze(FAULTS);
455
+ export const STAGE_CAPSULE_WAVE_CHILDREN = Object.freeze(CHILDREN);
@@ -1,27 +1,27 @@
1
1
  import {
2
- V4ContractFault,
3
- v4ContentRoot,
4
- validateV4Clock,
5
- validateV4Root,
6
- } from "./v4-canonical-contracts.js";
2
+ ContractFault,
3
+ domainContentRoot,
4
+ validateClock,
5
+ validateRoot,
6
+ } from "./canonical-contracts.js";
7
7
  import {
8
- V4_STAGE_CAPSULE_REUSE_CONTRACT,
9
- evaluateV4StageCapsuleReuse,
10
- v4StageCapsuleAvailabilityRoot,
11
- validateV4StageCapsule,
12
- validateV4StageCapsuleAvailability,
13
- validateV4StageCapsuleIdentity,
14
- } from "./v4-stage-capsule.js";
8
+ STAGE_CAPSULE_REUSE_CONTRACT,
9
+ evaluateStageCapsuleReuse,
10
+ stageCapsuleAvailabilityRoot,
11
+ validateStageCapsule,
12
+ validateStageCapsuleAvailability,
13
+ validateStageCapsuleIdentity,
14
+ } from "./stage-capsule.js";
15
15
 
16
- export const V4_STAGE_CAPSULE_RESUME_REQUEST_CONTRACT =
16
+ export const STAGE_CAPSULE_RESUME_REQUEST_CONTRACT =
17
17
  "buildchain-v4-stage-capsule-resume-request/v1";
18
- export const V4_STAGE_CAPSULE_RESUME_PLAN_CONTRACT =
18
+ export const STAGE_CAPSULE_RESUME_PLAN_CONTRACT =
19
19
  "buildchain-v4-stage-capsule-resume-plan/v1";
20
20
 
21
21
  const TOKEN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
22
22
 
23
23
  function fault(code, path, message) {
24
- throw new V4ContractFault(code, path, message);
24
+ throw new ContractFault(code, path, message);
25
25
  }
26
26
 
27
27
  function exactKeys(value, expected, location) {
@@ -68,16 +68,16 @@ function orderedTokens(values, location) {
68
68
  function validateRetentionPromise(value, location) {
69
69
  exactKeys(value, ["class", "retainUntil"], location);
70
70
  token(value.class, `${location}/class`);
71
- validateV4Clock(value.retainUntil, `${location}/retainUntil`);
71
+ validateClock(value.retainUntil, `${location}/retainUntil`);
72
72
  }
73
73
 
74
74
  function observationRoot(value) {
75
- return v4ContentRoot("stage-capsule-resume-observation", value);
75
+ return domainContentRoot("stage-capsule-resume-observation", value);
76
76
  }
77
77
 
78
78
  function rootOrObservationRoot(value) {
79
79
  try {
80
- validateV4Root(value, "$/resumeObservation");
80
+ validateRoot(value, "$/resumeObservation");
81
81
  return value;
82
82
  } catch {
83
83
  return observationRoot(value);
@@ -103,7 +103,7 @@ function validateRequest(request) {
103
103
  "$",
104
104
  );
105
105
  if (
106
- request.schema !== V4_STAGE_CAPSULE_RESUME_REQUEST_CONTRACT ||
106
+ request.schema !== STAGE_CAPSULE_RESUME_REQUEST_CONTRACT ||
107
107
  !Array.isArray(request.nodes) ||
108
108
  request.nodes.length === 0
109
109
  )
@@ -112,7 +112,7 @@ function validateRequest(request) {
112
112
  "$/schema",
113
113
  "unsupported or empty Stage Capsule resume request",
114
114
  );
115
- validateV4Clock(request.evaluatedAt, "$/evaluatedAt");
115
+ validateClock(request.evaluatedAt, "$/evaluatedAt");
116
116
  const positions = new Map();
117
117
  for (const [index, node] of request.nodes.entries()) {
118
118
  const location = `$/nodes/${index}`;
@@ -147,7 +147,7 @@ function validateRequest(request) {
147
147
  `${location}/dependencies`,
148
148
  "dependencies must name an earlier node in topological order",
149
149
  );
150
- validateV4StageCapsuleIdentity(node.expectedIdentity);
150
+ validateStageCapsuleIdentity(node.expectedIdentity);
151
151
  validateRetentionPromise(
152
152
  node.expectedRetentionPromise,
153
153
  `${location}/expectedRetentionPromise`,
@@ -158,8 +158,8 @@ function validateRequest(request) {
158
158
  ["capsule", "availability"],
159
159
  `${location}/candidate`,
160
160
  );
161
- validateV4StageCapsule(node.candidate.capsule);
162
- validateV4StageCapsuleAvailability(node.candidate.availability);
161
+ validateStageCapsule(node.candidate.capsule);
162
+ validateStageCapsuleAvailability(node.candidate.availability);
163
163
  }
164
164
  }
165
165
  orderedTokens(request.targets, "$/targets");
@@ -299,11 +299,11 @@ function changedDecision(node, candidate, availabilityRoot) {
299
299
  function candidateDecision(node, evaluatedAt) {
300
300
  if (node.candidate === null) return decision(node, "rebuild", "unavailable");
301
301
  const { capsule, availability } = node.candidate;
302
- const availabilityRoot = v4StageCapsuleAvailabilityRoot(availability);
302
+ const availabilityRoot = stageCapsuleAvailabilityRoot(availability);
303
303
  const changed = changedDecision(node, node.candidate, availabilityRoot);
304
304
  if (changed) return changed;
305
- const reuse = evaluateV4StageCapsuleReuse({
306
- schema: V4_STAGE_CAPSULE_REUSE_CONTRACT,
305
+ const reuse = evaluateStageCapsuleReuse({
306
+ schema: STAGE_CAPSULE_REUSE_CONTRACT,
307
307
  capsule,
308
308
  availability,
309
309
  evaluatedAt,
@@ -355,7 +355,7 @@ function candidateDecision(node, evaluatedAt) {
355
355
  });
356
356
  }
357
357
 
358
- export function planV4StageCapsuleResume(request) {
358
+ export function planStageCapsuleResume(request) {
359
359
  const positions = validateRequest(request);
360
360
  const decisions = request.nodes.map((node) =>
361
361
  candidateDecision(node, request.evaluatedAt),
@@ -381,7 +381,7 @@ export function planV4StageCapsuleResume(request) {
381
381
  )
382
382
  .map(({ key }) => key);
383
383
  const payload = {
384
- schema: V4_STAGE_CAPSULE_RESUME_PLAN_CONTRACT,
384
+ schema: STAGE_CAPSULE_RESUME_PLAN_CONTRACT,
385
385
  mode: "shadow-only",
386
386
  productionAuthority: "v3",
387
387
  evaluatedAt: request.evaluatedAt,
@@ -392,6 +392,6 @@ export function planV4StageCapsuleResume(request) {
392
392
  };
393
393
  return {
394
394
  ...payload,
395
- planRoot: v4ContentRoot("stage-capsule-resume-plan", payload),
395
+ planRoot: domainContentRoot("stage-capsule-resume-plan", payload),
396
396
  };
397
397
  }