@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,9 +1,9 @@
1
- import { V4DomainWasmFault, invokeV4DomainWasm } from "./v4-domain-wasm.js";
1
+ import { DomainWasmFault, invokeDomainWasm } from "./domain-wasm.js";
2
2
 
3
- export const V4_CANONICAL_JSON_CONTRACT = "buildchain-canonical-json/v1";
4
- export const V4_EVENT_ENVELOPE_CONTRACT = "buildchain-v4-event-envelope/v1";
5
- export const V4_RECEIPT_ENVELOPE_CONTRACT = "buildchain-v4-receipt-envelope/v1";
6
- export const V4_CONTRACT_FAULT_CONTRACT = "buildchain-v4-contract-fault/v1";
3
+ export const CANONICAL_JSON_CONTRACT = "buildchain-canonical-json/v1";
4
+ export const EVENT_ENVELOPE_CONTRACT = "buildchain-v4-event-envelope/v1";
5
+ export const RECEIPT_ENVELOPE_CONTRACT = "buildchain-v4-receipt-envelope/v1";
6
+ export const CONTRACT_FAULT_CONTRACT = "buildchain-v4-contract-fault/v1";
7
7
 
8
8
  const ROOT_PATTERN = /^sha256:[0-9a-f]{64}$/u;
9
9
  const CLOCK_PATTERN = /^(?!0000)\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u;
@@ -58,6 +58,7 @@ const ROOT_DOMAINS = new Set([
58
58
  "partial-mutation-recovery-checkpoint",
59
59
  "partial-mutation-recovery-plan",
60
60
  "v4-product-required-artifacts",
61
+ "oci-publication-family",
61
62
  "v4-product-publication-intent",
62
63
  "v4-product-publication-operation",
63
64
  "v4-product-publication-plan",
@@ -86,17 +87,17 @@ const FAULT_CLASSES = new Set([
86
87
  const RETRY_DECISIONS = new Set(["stop", "reread", "redecide", "reselect"]);
87
88
  const RECEIPT_OUTCOMES = new Set(["accepted", "rejected", "noop"]);
88
89
 
89
- export class V4ContractFault extends Error {
90
+ export class ContractFault extends Error {
90
91
  constructor(code, path, message) {
91
92
  super(message);
92
- this.name = "V4ContractFault";
93
+ this.name = "ContractFault";
93
94
  this.code = code;
94
95
  this.path = path;
95
96
  }
96
97
  }
97
98
 
98
99
  function fault(code, path, message) {
99
- throw new V4ContractFault(code, path, message);
100
+ throw new ContractFault(code, path, message);
100
101
  }
101
102
 
102
103
  function exactKeys(value, keys, path) {
@@ -113,30 +114,30 @@ function exactKeys(value, keys, path) {
113
114
 
114
115
  function wasm(operation, payload) {
115
116
  try {
116
- return invokeV4DomainWasm(operation, payload);
117
+ return invokeDomainWasm(operation, payload);
117
118
  } catch (error) {
118
- if (error instanceof V4DomainWasmFault) {
119
+ if (error instanceof DomainWasmFault) {
119
120
  fault(error.code, error.path, error.message);
120
121
  }
121
122
  throw error;
122
123
  }
123
124
  }
124
125
 
125
- export function v4CanonicalBytes(value) {
126
+ export function domainCanonicalBytes(value) {
126
127
  return Buffer.from(wasm("canonical-json", value).canonicalUtf8, "utf8");
127
128
  }
128
129
 
129
- export function v4ContentRoot(domain, value) {
130
+ export function domainContentRoot(domain, value) {
130
131
  return wasm("content-root", { domain, value }).root;
131
132
  }
132
133
 
133
- export function validateV4Root(value, path = "$.root") {
134
+ export function validateRoot(value, path = "$.root") {
134
135
  if (typeof value !== "string" || !ROOT_PATTERN.test(value))
135
136
  fault("invalid-root", path, `${path} must be a lowercase sha256 root`);
136
137
  return value;
137
138
  }
138
139
 
139
- export function validateV4Clock(value, path = "$.clock") {
140
+ export function validateClock(value, path = "$.clock") {
140
141
  if (typeof value !== "string" || !CLOCK_PATTERN.test(value))
141
142
  fault(
142
143
  "invalid-clock",
@@ -149,13 +150,13 @@ export function validateV4Clock(value, path = "$.clock") {
149
150
  return value;
150
151
  }
151
152
 
152
- export function validateV4ContractFault(value, path = "$.fault") {
153
+ export function validateContractFault(value, path = "$.fault") {
153
154
  exactKeys(
154
155
  value,
155
156
  ["schema", "code", "class", "path", "message", "retry"],
156
157
  path,
157
158
  );
158
- if (value.schema !== V4_CONTRACT_FAULT_CONTRACT)
159
+ if (value.schema !== CONTRACT_FAULT_CONTRACT)
159
160
  fault("invalid-fault", `${path}/schema`, "unsupported fault schema");
160
161
  if (!ASCII_TOKEN_PATTERN.test(value.code))
161
162
  fault("invalid-fault", `${path}/code`, "fault code must be an ASCII token");
@@ -171,28 +172,28 @@ export function validateV4ContractFault(value, path = "$.fault") {
171
172
  `${path}/retry`,
172
173
  "fault retry decision is unsupported",
173
174
  );
174
- v4CanonicalBytes(value);
175
+ domainCanonicalBytes(value);
175
176
  return value;
176
177
  }
177
178
 
178
- export function validateV4EventEnvelope(value) {
179
+ export function validateEventEnvelope(value) {
179
180
  exactKeys(
180
181
  value,
181
182
  ["schema", "eventId", "eventType", "occurredAt", "subjectRoot", "payload"],
182
183
  "$",
183
184
  );
184
- if (value.schema !== V4_EVENT_ENVELOPE_CONTRACT)
185
+ if (value.schema !== EVENT_ENVELOPE_CONTRACT)
185
186
  fault("invalid-event", "$/schema", "unsupported event schema");
186
- validateV4Root(value.eventId, "$/eventId");
187
- validateV4Root(value.subjectRoot, "$/subjectRoot");
188
- validateV4Clock(value.occurredAt, "$/occurredAt");
187
+ validateRoot(value.eventId, "$/eventId");
188
+ validateRoot(value.subjectRoot, "$/subjectRoot");
189
+ validateClock(value.occurredAt, "$/occurredAt");
189
190
  if (!ASCII_TOKEN_PATTERN.test(value.eventType))
190
191
  fault("invalid-event", "$/eventType", "event type must be an ASCII token");
191
- v4CanonicalBytes(value.payload);
192
+ domainCanonicalBytes(value.payload);
192
193
  return value;
193
194
  }
194
195
 
195
- export function validateV4ReceiptEnvelope(value) {
196
+ export function validateReceiptEnvelope(value) {
196
197
  exactKeys(
197
198
  value,
198
199
  [
@@ -207,7 +208,7 @@ export function validateV4ReceiptEnvelope(value) {
207
208
  ],
208
209
  "$",
209
210
  );
210
- if (value.schema !== V4_RECEIPT_ENVELOPE_CONTRACT)
211
+ if (value.schema !== RECEIPT_ENVELOPE_CONTRACT)
211
212
  fault("invalid-receipt", "$/schema", "unsupported receipt schema");
212
213
  if (!ASCII_TOKEN_PATTERN.test(value.receiptType))
213
214
  fault(
@@ -215,15 +216,15 @@ export function validateV4ReceiptEnvelope(value) {
215
216
  "$/receiptType",
216
217
  "receipt type must be an ASCII token",
217
218
  );
218
- validateV4Clock(value.recordedAt, "$/recordedAt");
219
- validateV4Root(value.eventRoot, "$/eventRoot");
219
+ validateClock(value.recordedAt, "$/recordedAt");
220
+ validateRoot(value.eventRoot, "$/eventRoot");
220
221
  if (value.priorStateRoot !== null)
221
- validateV4Root(value.priorStateRoot, "$/priorStateRoot");
222
+ validateRoot(value.priorStateRoot, "$/priorStateRoot");
222
223
  if (value.nextStateRoot !== null)
223
- validateV4Root(value.nextStateRoot, "$/nextStateRoot");
224
+ validateRoot(value.nextStateRoot, "$/nextStateRoot");
224
225
  if (!RECEIPT_OUTCOMES.has(value.outcome))
225
226
  fault("invalid-receipt", "$/outcome", "receipt outcome is unsupported");
226
- if (value.fault !== null) validateV4ContractFault(value.fault);
227
+ if (value.fault !== null) validateContractFault(value.fault);
227
228
  if ((value.outcome === "rejected") !== (value.fault !== null))
228
229
  fault(
229
230
  "invalid-receipt",
@@ -233,6 +234,6 @@ export function validateV4ReceiptEnvelope(value) {
233
234
  return value;
234
235
  }
235
236
 
236
- export function v4ContractDomains() {
237
+ export function contractDomains() {
237
238
  return [...ROOT_DOMAINS];
238
239
  }
@@ -1,15 +1,15 @@
1
1
  import { adopterDeliveryGateDigest } from "./adopter-delivery-json.js";
2
2
 
3
- export const V4_CROSS_PLATFORM_ADOPTER_REPORT_CONTRACT =
3
+ export const CROSS_PLATFORM_ADOPTER_REPORT_CONTRACT =
4
4
  "kungfu-buildchain-v4-cross-platform-adopter-report/v1";
5
- export const V4_CROSS_PLATFORM_ADOPTER_QUALIFICATION_CONTRACT =
5
+ export const CROSS_PLATFORM_ADOPTER_QUALIFICATION_CONTRACT =
6
6
  "kungfu-buildchain-v4-cross-platform-adopter-qualification/v1";
7
- export const V4_CROSS_PLATFORM_ADOPTER_PLATFORMS = Object.freeze([
7
+ export const CROSS_PLATFORM_ADOPTER_PLATFORMS = Object.freeze([
8
8
  "linux-x64",
9
9
  "macos-arm64",
10
10
  "windows-x64",
11
11
  ]);
12
- export const V4_CROSS_PLATFORM_NEUTRAL_DRIVER = "ledger-specification-driver";
12
+ export const CROSS_PLATFORM_NEUTRAL_DRIVER = "ledger-specification-driver";
13
13
 
14
14
  const SHA = /^[0-9a-f]{40}$/u;
15
15
  const ROOT = /^sha256:[0-9a-f]{64}$/u;
@@ -36,7 +36,7 @@ function same(left, right) {
36
36
  return adopterDeliveryGateDigest(left) === adopterDeliveryGateDigest(right);
37
37
  }
38
38
 
39
- export function summarizeV3V4CapabilityInventory(inventory) {
39
+ export function summarizeBaselineCapabilityInventory(inventory) {
40
40
  exactKeys(
41
41
  inventory,
42
42
  [
@@ -197,7 +197,7 @@ function validateExecutionEvidence(execution) {
197
197
  execution.retryRun.readbackRoot &&
198
198
  execution.bootstrap?.status === "passed" &&
199
199
  ROOT.test(execution.bootstrap?.resultRoot || "") &&
200
- execution.neutralDriver?.id === V4_CROSS_PLATFORM_NEUTRAL_DRIVER &&
200
+ execution.neutralDriver?.id === CROSS_PLATFORM_NEUTRAL_DRIVER &&
201
201
  execution.neutralDriver?.status === "passed" &&
202
202
  execution.neutralDriver?.kfdDependencyPresent === false;
203
203
  if (!complete)
@@ -219,7 +219,7 @@ function validateAuthorityCeiling(authority) {
219
219
  fail("qualification report must not grant production or release authority");
220
220
  }
221
221
 
222
- export function validateV4CrossPlatformAdopterReport(report) {
222
+ export function validateCrossPlatformAdopterReport(report) {
223
223
  exactKeys(
224
224
  report,
225
225
  [
@@ -237,10 +237,10 @@ export function validateV4CrossPlatformAdopterReport(report) {
237
237
  );
238
238
  if (
239
239
  report.schemaVersion !== 1 ||
240
- report.contract !== V4_CROSS_PLATFORM_ADOPTER_REPORT_CONTRACT
240
+ report.contract !== CROSS_PLATFORM_ADOPTER_REPORT_CONTRACT
241
241
  )
242
242
  fail("platform report contract is unsupported");
243
- if (!V4_CROSS_PLATFORM_ADOPTER_PLATFORMS.includes(report.platform))
243
+ if (!CROSS_PLATFORM_ADOPTER_PLATFORMS.includes(report.platform))
244
244
  fail(`undeclared platform ${report.platform}`);
245
245
  if (!CONSUMER.test(report.consumer || ""))
246
246
  fail("consumer must be a stable lowercase identity");
@@ -256,18 +256,18 @@ export function validateV4CrossPlatformAdopterReport(report) {
256
256
  return structuredClone(report);
257
257
  }
258
258
 
259
- export function createV4CrossPlatformAdopterReport(input) {
259
+ export function createCrossPlatformAdopterReport(input) {
260
260
  const body = structuredClone(input);
261
261
  const report = {
262
262
  schemaVersion: 1,
263
- contract: V4_CROSS_PLATFORM_ADOPTER_REPORT_CONTRACT,
263
+ contract: CROSS_PLATFORM_ADOPTER_REPORT_CONTRACT,
264
264
  ...body,
265
265
  };
266
266
  report.reportRoot = adopterDeliveryGateDigest(report);
267
- return validateV4CrossPlatformAdopterReport(report);
267
+ return validateCrossPlatformAdopterReport(report);
268
268
  }
269
269
 
270
- export function qualifyV4CrossPlatformAdopters({ reports, consumers }) {
270
+ export function qualifyCrossPlatformAdopters({ reports, consumers }) {
271
271
  if (!Array.isArray(reports) || reports.length === 0)
272
272
  fail("at least one raw platform report is required");
273
273
  if (
@@ -277,9 +277,9 @@ export function qualifyV4CrossPlatformAdopters({ reports, consumers }) {
277
277
  new Set(consumers).size !== consumers.length
278
278
  )
279
279
  fail("required consumers must be unique stable lowercase identities");
280
- const normalized = reports.map(validateV4CrossPlatformAdopterReport);
280
+ const normalized = reports.map(validateCrossPlatformAdopterReport);
281
281
  const expectedKeys = consumers.flatMap((consumer) =>
282
- V4_CROSS_PLATFORM_ADOPTER_PLATFORMS.map(
282
+ CROSS_PLATFORM_ADOPTER_PLATFORMS.map(
283
283
  (platform) => `${consumer}:${platform}`,
284
284
  ),
285
285
  );
@@ -310,14 +310,14 @@ export function qualifyV4CrossPlatformAdopters({ reports, consumers }) {
310
310
  const orderedReports = expectedKeys.map((key) => reportByKey.get(key));
311
311
  const body = {
312
312
  schemaVersion: 1,
313
- contract: V4_CROSS_PLATFORM_ADOPTER_QUALIFICATION_CONTRACT,
313
+ contract: CROSS_PLATFORM_ADOPTER_QUALIFICATION_CONTRACT,
314
314
  sourceBinding: {
315
315
  runtimeSha: reference.runtimeSha,
316
316
  inventoryRoot: reference.inventoryRoot,
317
317
  sourceCuts: structuredClone(reference.sourceCuts),
318
318
  },
319
319
  consumers: [...consumers],
320
- platforms: [...V4_CROSS_PLATFORM_ADOPTER_PLATFORMS],
320
+ platforms: [...CROSS_PLATFORM_ADOPTER_PLATFORMS],
321
321
  capabilityMatrix: structuredClone(normalized[0].capabilityMatrix),
322
322
  reports: orderedReports.map(({ consumer, platform, reportRoot }) => ({
323
323
  consumer,
@@ -325,8 +325,8 @@ export function qualifyV4CrossPlatformAdopters({ reports, consumers }) {
325
325
  reportRoot,
326
326
  })),
327
327
  neutralDriver: {
328
- id: V4_CROSS_PLATFORM_NEUTRAL_DRIVER,
329
- platformCoverage: [...V4_CROSS_PLATFORM_ADOPTER_PLATFORMS],
328
+ id: CROSS_PLATFORM_NEUTRAL_DRIVER,
329
+ platformCoverage: [...CROSS_PLATFORM_ADOPTER_PLATFORMS],
330
330
  status: "passed",
331
331
  },
332
332
  authority: {
@@ -1,27 +1,27 @@
1
1
  import { TextDecoder } from "node:util";
2
2
 
3
3
  import {
4
- V4ContractFault,
5
- v4CanonicalBytes,
6
- v4ContentRoot,
7
- validateV4ContractFault,
8
- validateV4EventEnvelope,
9
- validateV4ReceiptEnvelope,
10
- validateV4Root,
11
- } from "./v4-canonical-contracts.js";
4
+ ContractFault,
5
+ domainCanonicalBytes,
6
+ domainContentRoot,
7
+ validateContractFault,
8
+ validateEventEnvelope,
9
+ validateReceiptEnvelope,
10
+ validateRoot,
11
+ } from "./canonical-contracts.js";
12
12
 
13
- export const V4_DELIVERY_WARRANT_TRACE_CONTRACT =
13
+ export const DELIVERY_WARRANT_TRACE_CONTRACT =
14
14
  "buildchain-v4-delivery-warrant-trace-fixture/v1";
15
- export const V4_DELIVERY_WARRANT_RUNNER_CONTRACT =
15
+ export const DELIVERY_WARRANT_RUNNER_CONTRACT =
16
16
  "buildchain-v4-delivery-warrant-fixture-runner/v1";
17
- export const V4_DELIVERY_WARRANT_PROJECTION_CONTRACT =
17
+ export const DELIVERY_WARRANT_PROJECTION_CONTRACT =
18
18
  "buildchain-v4-delivery-warrant-semantic-projection/v1";
19
19
 
20
20
  const ASCII_TOKEN_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
21
21
  const UTF8 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: false });
22
22
 
23
23
  function fail(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, keys, path) {
@@ -53,11 +53,11 @@ function nonNegativeInteger(value, path) {
53
53
  }
54
54
 
55
55
  function equalCanonical(left, right) {
56
- return v4CanonicalBytes(left).equals(v4CanonicalBytes(right));
56
+ return domainCanonicalBytes(left).equals(domainCanonicalBytes(right));
57
57
  }
58
58
 
59
59
  function declaredRoot(value, expected, path, code) {
60
- validateV4Root(value, path);
60
+ validateRoot(value, path);
61
61
  if (value !== expected)
62
62
  fail(code, path, `${path} does not match the retained canonical bytes`);
63
63
  return value;
@@ -113,7 +113,7 @@ function validateOrderedEntries(entries, path) {
113
113
  `${path} sequence must be contiguous and ordered`,
114
114
  );
115
115
  token(entry.type, `${path}/${index}/type`);
116
- v4CanonicalBytes(entry.payload);
116
+ domainCanonicalBytes(entry.payload);
117
117
  return entry;
118
118
  });
119
119
  }
@@ -141,12 +141,12 @@ function validateState(state, path) {
141
141
  `${path}/candidates`,
142
142
  "state candidates must be an array",
143
143
  );
144
- const canonicalUtf8 = v4CanonicalBytes(state).toString("utf8");
144
+ const canonicalUtf8 = domainCanonicalBytes(state).toString("utf8");
145
145
  return {
146
146
  generation,
147
147
  fencingCounter,
148
148
  canonicalUtf8,
149
- root: v4ContentRoot("queue-state", state),
149
+ root: domainContentRoot("queue-state", state),
150
150
  };
151
151
  }
152
152
 
@@ -169,7 +169,7 @@ function validateDecision(decision, receipt, path) {
169
169
  "an action cannot bind a rejected receipt",
170
170
  );
171
171
  } else {
172
- validateV4ContractFault(decision.fault, `${path}/fault`);
172
+ validateContractFault(decision.fault, `${path}/fault`);
173
173
  if (
174
174
  receipt.outcome !== "rejected" ||
175
175
  receipt.fault === null ||
@@ -219,14 +219,14 @@ function projectStep(step, index, priorStateRoot) {
219
219
  "stale-prior-root",
220
220
  );
221
221
 
222
- validateV4EventEnvelope(step.event);
222
+ validateEventEnvelope(step.event);
223
223
  if (step.event.subjectRoot !== priorStateRoot)
224
224
  fail(
225
225
  "stale-prior-root",
226
226
  `${path}/event/subjectRoot`,
227
227
  "event subjectRoot must bind the exact prior state",
228
228
  );
229
- const eventRoot = v4ContentRoot("observation", step.event);
229
+ const eventRoot = domainContentRoot("observation", step.event);
230
230
 
231
231
  const successor = validateState(
232
232
  step.successorState,
@@ -239,7 +239,7 @@ function projectStep(step, index, priorStateRoot) {
239
239
  "stale-successor-root",
240
240
  );
241
241
 
242
- validateV4ReceiptEnvelope(step.receipt);
242
+ validateReceiptEnvelope(step.receipt);
243
243
  if (
244
244
  step.receipt.eventRoot !== eventRoot ||
245
245
  step.receipt.priorStateRoot !== priorStateRoot ||
@@ -266,10 +266,12 @@ function projectStep(step, index, priorStateRoot) {
266
266
  step.observations,
267
267
  `${path}/observations`,
268
268
  );
269
- const receiptCanonicalUtf8 = v4CanonicalBytes(step.receipt).toString("utf8");
269
+ const receiptCanonicalUtf8 = domainCanonicalBytes(step.receipt).toString(
270
+ "utf8",
271
+ );
270
272
  const receiptRoot = declaredRoot(
271
273
  step.receiptRoot,
272
- v4ContentRoot("transition-receipt", step.receipt),
274
+ domainContentRoot("transition-receipt", step.receipt),
273
275
  `${path}/receiptRoot`,
274
276
  "stale-receipt-root",
275
277
  );
@@ -288,13 +290,15 @@ function projectStep(step, index, priorStateRoot) {
288
290
  effects: effects.map((effect) => ({
289
291
  sequence: effect.sequence,
290
292
  type: effect.type,
291
- canonicalUtf8: v4CanonicalBytes(effect.payload).toString("utf8"),
293
+ canonicalUtf8: domainCanonicalBytes(effect.payload).toString("utf8"),
292
294
  })),
293
295
  observations: observations.map((observation) => ({
294
296
  sequence: observation.sequence,
295
297
  type: observation.type,
296
- canonicalUtf8: v4CanonicalBytes(observation.payload).toString("utf8"),
297
- root: v4ContentRoot("observation", observation.payload),
298
+ canonicalUtf8: domainCanonicalBytes(observation.payload).toString(
299
+ "utf8",
300
+ ),
301
+ root: domainContentRoot("observation", observation.payload),
298
302
  })),
299
303
  receiptCanonicalUtf8,
300
304
  receiptRoot,
@@ -303,7 +307,7 @@ function projectStep(step, index, priorStateRoot) {
303
307
  };
304
308
  }
305
309
 
306
- export function runV4DeliveryWarrantTraceFixture(
310
+ export function runDeliveryWarrantTraceFixture(
307
311
  bytes,
308
312
  { verifyExpectedRoot = true } = {},
309
313
  ) {
@@ -315,8 +319,8 @@ export function runV4DeliveryWarrantTraceFixture(
315
319
  );
316
320
  if (
317
321
  fixture.schemaVersion !== 1 ||
318
- fixture.contract !== V4_DELIVERY_WARRANT_TRACE_CONTRACT ||
319
- fixture.runner !== V4_DELIVERY_WARRANT_RUNNER_CONTRACT
322
+ fixture.contract !== DELIVERY_WARRANT_TRACE_CONTRACT ||
323
+ fixture.runner !== DELIVERY_WARRANT_RUNNER_CONTRACT
320
324
  )
321
325
  fail(
322
326
  "unsupported-trace-version",
@@ -354,13 +358,13 @@ export function runV4DeliveryWarrantTraceFixture(
354
358
  return result.projection;
355
359
  });
356
360
  const projection = {
357
- schema: V4_DELIVERY_WARRANT_PROJECTION_CONTRACT,
361
+ schema: DELIVERY_WARRANT_PROJECTION_CONTRACT,
358
362
  traceId: fixture.trace.id,
359
363
  traceKind: fixture.trace.kind,
360
364
  steps,
361
365
  };
362
- const projectionRoot = v4ContentRoot("semantic-diff", projection);
363
- validateV4Root(fixture.expectedProjectionRoot, "$/expectedProjectionRoot");
366
+ const projectionRoot = domainContentRoot("semantic-diff", projection);
367
+ validateRoot(fixture.expectedProjectionRoot, "$/expectedProjectionRoot");
364
368
  if (verifyExpectedRoot && fixture.expectedProjectionRoot !== projectionRoot)
365
369
  fail(
366
370
  "stale-projection-root",