@kungfu-tech/buildchain 3.0.4-alpha.0 → 3.0.4-alpha.10

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 (74) hide show
  1. package/AGENTS.md +14 -5
  2. package/README.md +18 -0
  3. package/bin/buildchain.mjs +136 -73
  4. package/bin/internal/trust-release-cli.mjs +15 -537
  5. package/bin/internal/trust-release-command-handlers.mjs +14 -0
  6. package/bin/internal/trust-release-inspection-handlers.mjs +175 -0
  7. package/bin/internal/trust-release-release-handlers.mjs +317 -0
  8. package/bin/internal/trust-release-verification-handlers.mjs +306 -0
  9. package/dist/site/buildchain-contract.json +36 -25
  10. package/dist/site/buildchain-site.json +1474 -61
  11. package/dist/site/capability-registry.json +8 -5
  12. package/dist/site/cli-registry.json +1869 -0
  13. package/dist/site/controller-registry.json +16 -3
  14. package/dist/site/kfd-claims.json +84 -10
  15. package/dist/site/kfd-upstream-aggregate.json +1 -1
  16. package/dist/site/manual-registry.json +49 -6
  17. package/dist/site/node-api-registry.json +17802 -11
  18. package/dist/site/page-registry.json +1441 -59
  19. package/dist/site/public-surface-audit.json +2863 -358
  20. package/dist/site/publication-registry.json +4 -4
  21. package/dist/site/release-model.json +7 -0
  22. package/dist/site/site-manifest.json +34 -10
  23. package/dist/site/workflow-registry.json +13 -5
  24. package/docs/MAP.md +21 -6
  25. package/docs/cli-reference.md +1936 -0
  26. package/docs/cli.md +15 -1
  27. package/docs/getting-started.md +167 -0
  28. package/docs/install.md +7 -8
  29. package/docs/node-api-reference.md +1952 -0
  30. package/docs/release-propagation.md +166 -8
  31. package/docs/site-bundle-contract.md +10 -4
  32. package/docs/versioning.md +5 -4
  33. package/package.json +8 -5
  34. package/packages/core/buildchain-agent-manuals.js +37 -0
  35. package/packages/core/buildchain-kfd-claims.js +4 -37
  36. package/packages/core/controller-evidence.js +8 -1
  37. package/packages/core/index.js +1 -13
  38. package/packages/core/paper-agent-entry.js +14 -11
  39. package/packages/core/paper-fleet.js +34 -7
  40. package/packages/core/paper-npm-bootstrap.js +492 -0
  41. package/packages/core/paper-repository.js +1 -0
  42. package/packages/core/paper.js +356 -674
  43. package/packages/core/public-surface-cli.js +12 -1
  44. package/packages/core/publication-package.js +7 -0
  45. package/packages/core/release-passport.js +67 -71
  46. package/packages/core/release-propagation-common.js +64 -0
  47. package/packages/core/release-propagation-execution-profile.js +59 -0
  48. package/packages/core/release-propagation-release.js +196 -0
  49. package/packages/core/release-propagation-stage-evidence.js +364 -0
  50. package/packages/core/release-propagation-work-capture.js +64 -0
  51. package/packages/core/release-propagation-work-constants.js +34 -0
  52. package/packages/core/release-propagation-work-control.js +203 -0
  53. package/packages/core/release-propagation-work-transitions.js +145 -0
  54. package/packages/core/release-propagation-work.js +517 -0
  55. package/packages/core/release-propagation.js +34 -158
  56. package/scripts/aggregate-build-summary.mjs +67 -4
  57. package/scripts/auditable-demo-renditions.mjs +131 -0
  58. package/scripts/auditable-demo.mjs +88 -91
  59. package/scripts/aws-windows-jit-controller-core.mjs +269 -0
  60. package/scripts/aws-windows-jit-controller.mjs +502 -0
  61. package/scripts/check-internal-architecture.mjs +178 -52
  62. package/scripts/check-inventory.mjs +2 -2
  63. package/scripts/check-maintainability.mjs +76 -17
  64. package/scripts/generate-public-reference.mjs +68 -0
  65. package/scripts/generate-site-bundle.mjs +35 -41
  66. package/scripts/maintainability-metrics.mjs +24 -4
  67. package/scripts/paper-work-fleet-cli.mjs +22 -3
  68. package/scripts/public-reference.mjs +557 -0
  69. package/scripts/release-propagation.mjs +126 -0
  70. package/scripts/resolve-artifact-transfer-mode.mjs +117 -0
  71. package/scripts/site-reference-registry.mjs +174 -0
  72. package/scripts/verify-golden-path.mjs +169 -0
  73. package/scripts/web-surface-core.mjs +46 -207
  74. package/scripts/web-surface-routing.mjs +286 -0
@@ -67,10 +67,12 @@ The upstream release envelope is the post-finalization fact set:
67
67
  "channel": "alpha",
68
68
  "tag": "v1.4.0-alpha.3",
69
69
  "sourceSha": "1111111111111111111111111111111111111111",
70
+ "tagTargetSha": "1111111111111111111111111111111111111111",
70
71
  "package": {
71
72
  "name": "@kungfu-tech/kfd",
72
73
  "version": "1.4.0-alpha.3",
73
- "integrity": "sha512-..."
74
+ "integrity": "sha512-...",
75
+ "gitHead": "1111111111111111111111111111111111111111"
74
76
  },
75
77
  "releasePassport": {
76
78
  "url": "https://github.com/kungfu-systems/kfd/releases/download/v1.4.0-alpha.3/buildchain.release.json",
@@ -82,8 +84,10 @@ The upstream release envelope is the post-finalization fact set:
82
84
  }
83
85
  ```
84
86
 
85
- The package version and integrity must be exact. Downstream build logic should
86
- install that version directly, not resolve `alpha` or `latest` again.
87
+ The package version, integrity, and npm `gitHead` must be exact. The exact tag
88
+ must be `v<version>`, and `gitHead`, tag target, and `sourceSha` must describe
89
+ the same source commit before propagation is admitted. Downstream build logic
90
+ installs that version directly and never resolves `alpha` or `latest` again.
87
91
 
88
92
  Publication repositories can propagate immutable publication archive evidence
89
93
  without npm package facts. The upstream envelope then includes
@@ -95,6 +99,7 @@ without npm package facts. The upstream envelope then includes
95
99
  "channel": "alpha",
96
100
  "tag": "v0.1.0-alpha.1",
97
101
  "sourceSha": "4444444444444444444444444444444444444444",
102
+ "tagTargetSha": "4444444444444444444444444444444444444444",
98
103
  "releasePassport": {
99
104
  "url": "https://github.com/kungfu-systems/paper-observer-declared-timelines/releases/download/v0.1.0-alpha.1/buildchain.release.json",
100
105
  "sha256": "5555555555555555555555555555555555555555555555555555555555555555"
@@ -200,6 +205,157 @@ The receipt keeps four machine states separate:
200
205
 
201
206
  Package publication or alpha completion never implies either visibility state.
202
207
 
208
+ ## Agent-native work envelope
209
+
210
+ Setting `agent-work-mode: capture-only` makes a finalized release emit a
211
+ resumable delivery handoff without mutating the downstream repository. Passing
212
+ an exact `agent-work-context-json` instead emits an already-authorized unit.
213
+ Buildchain emits one
214
+ `kungfu-buildchain-release-propagation-work` v1 envelope per exact release and
215
+ downstream target. This is a Buildchain domain execution contract, not another
216
+ Work Control database or authority.
217
+
218
+ The envelope binds:
219
+
220
+ - the exact normalized upstream release and release-lock roots;
221
+ - the downstream repository, channel, base ref, expected base SHA, managed
222
+ branch, lock path, and propagation key;
223
+ - exact parent and child `kungfu.assignment-graph.work-ref/v1` values derived
224
+ from the immutable release and downstream plan;
225
+ - either a pending Family binding or one exact
226
+ `kungfu.work-control.initiative-family-state/v2` coordinate;
227
+ - capture-only or end-to-end execution authority, including an active typed
228
+ execution-Warrant reference for execution;
229
+ - explicit publish-to-production intent, deterministic commands, canonical
230
+ ordered stages, a recovery cursor, stage receipts, supersession policy, and
231
+ a content root.
232
+
233
+ The ordered stages are:
234
+
235
+ ```text
236
+ materialize -> verify-release -> push-branch -> pull-request -> preview
237
+ -> independent-review -> protected-merge -> staging -> production-release
238
+ -> production-deploy -> online-readback -> complete
239
+ ```
240
+
241
+ `pull-request` and `protected-merge` are intermediate states. Only exact online
242
+ readback followed by an accepted Work Control Decision can record `complete`.
243
+ Every state transition uses expected-old fencing against the current work
244
+ content root. An identical initial envelope has the same work id and root;
245
+ newer releases receive distinct propagation keys and must name an explicit
246
+ superseded work root when they replace unfinished work.
247
+
248
+ The context has this shape (roots abbreviated here only for readability):
249
+
250
+ ```json
251
+ {
252
+ "parentWorkRef": {
253
+ "schema": "kungfu.assignment-graph.work-ref/v1",
254
+ "workspace_identity_root": "sha256:<64 hex>",
255
+ "object_kind": "initiative",
256
+ "subject": "paper-publication",
257
+ "version_root": "sha256:<64 hex>",
258
+ "cut_root": "sha256:<64 hex>"
259
+ },
260
+ "childWorkRef": {
261
+ "schema": "kungfu.assignment-graph.work-ref/v1",
262
+ "workspace_identity_root": "sha256:<64 hex>",
263
+ "object_kind": "assignment",
264
+ "subject": "site-propagation",
265
+ "version_root": "sha256:<64 hex>",
266
+ "cut_root": "sha256:<64 hex>"
267
+ },
268
+ "familyState": {
269
+ "schema": "kungfu.work-control.initiative-family-state/v2",
270
+ "stateRoot": "sha256:<64 hex>",
271
+ "v1ProjectionRoot": "sha256:<64 hex>",
272
+ "typedBindingRoot": "sha256:<64 hex>",
273
+ "factWorld": "<owning fact world>",
274
+ "cutRoot": "sha256:<64 hex>"
275
+ },
276
+ "authority": {
277
+ "mode": "capture-only",
278
+ "publishToProduction": false,
279
+ "allowedActions": [],
280
+ "executionPrincipal": null,
281
+ "sourceControlPrincipal": null,
282
+ "executionWarrant": null
283
+ },
284
+ "supersedesWorkRoot": ""
285
+ }
286
+ ```
287
+
288
+ Automatic capture emits deterministic Buildchain-owned release and propagation
289
+ WorkRefs, leaves `workControl.bindingState` as `pending`, emits no Family State
290
+ or Warrant, and performs no downstream write. Claiming that unit supplies the
291
+ exact Family State v2 coordinate and active Warrant while preserving the work
292
+ identity. An executing input must carry an active Warrant at the same Family
293
+ State fact world and cut, explicit production intent, and the complete supported
294
+ action set. It also binds the acting Agent principal and the source-control
295
+ principal that authors the PR. Buildchain never invents external Work Control
296
+ authority.
297
+
298
+ A managed Paper opts into automatic capture with a thin, source-controlled
299
+ `.buildchain/release-propagation.json`. The sealed release workflow reads that
300
+ exact file from the released Paper SHA only after npm, tag, Passport, and
301
+ publication evidence agree. It emits one paused work artifact per declared
302
+ target; publication itself does not open a Site PR.
303
+
304
+ ```json
305
+ {
306
+ "schemaVersion": 1,
307
+ "contract": "kungfu-buildchain-paper-release-propagation",
308
+ "sourceNode": "paper-example",
309
+ "graph": {
310
+ "schemaVersion": 1,
311
+ "contract": "kungfu-buildchain-release-propagation-graph",
312
+ "nodes": [],
313
+ "edges": []
314
+ },
315
+ "targets": ["site-libkungfu-dev"]
316
+ }
317
+ ```
318
+
319
+ Each graph target owns an exact GitHub web-surface execution profile: workflow,
320
+ base and managed branch, lock path, consumer commands, production status URL,
321
+ and production artifact readback URLs. The sealed workflow rejects extra config
322
+ fields, unknown targets, or a target whose base revision cannot be resolved.
323
+
324
+ The reusable workflow keeps its prior behavior when `agent-work-mode` is
325
+ `legacy` (the default). Managed Paper callers set `capture-only`; an Agent later
326
+ claims the emitted artifact and resumes from its machine-readable `next_action`.
327
+
328
+ Agent entrypoints are machine-readable and restart-safe:
329
+
330
+ ```bash
331
+ buildchain release-propagation work create ... --output work.json --json
332
+ buildchain release-propagation work status --work work.json --json
333
+ buildchain release-propagation work resume --work work.json --json
334
+ buildchain release-propagation work claim ... --output successor.json --json
335
+ buildchain release-propagation work receipt ... --output receipt.json --json
336
+ buildchain release-propagation work record ... --output successor.json --json
337
+ buildchain release-propagation work repair ... --output successor.json --json
338
+ buildchain release-propagation work complete ... --output successor.json --json
339
+ ```
340
+
341
+ Known operational races (`stale-branch`, `expected-old-mismatch`,
342
+ `lockfile-drift`, `failed-check`, `interrupted-execution`, and `ci-delay`) return
343
+ a retryable repair action. Semantic ambiguity, missing credentials, policy
344
+ expansion, and unknown failures stop at `needs-decision`. Release-contract
345
+ mismatch, immutable-artifact conflict, and destructive recovery stop at a hard
346
+ safety gate. Evidence locators containing signed or credential parameters are
347
+ rejected.
348
+
349
+ Successful stage receipts are typed, not generic progress notes. In particular,
350
+ the pushed-branch receipt hashes the full expected-old branch reconciliation;
351
+ review binds an approved GitHub review and must come from an identity distinct
352
+ from both the acting Agent and PR author; production deployment carries release,
353
+ lock, deployed artifact, expected readback digest, and rollback coordinates; and
354
+ online readback must cover the exact execution-profile URLs with HTTP 200,
355
+ observed non-zero bytes, exact deployed Git revision, and matching release and
356
+ artifact digests. The final receipt binds the accepted Work Control Decision
357
+ root.
358
+
203
359
  ## Reusable Workflow
204
360
 
205
361
  Upstream repositories can call
@@ -257,11 +413,13 @@ can disable that step with `refresh-managed-readme-badges: false`.
257
413
  push, so consumers can use the same check as their PR workflow. Update,
258
414
  preparation, badge refresh, and verification failures all fail closed. The
259
415
  workflow stages the complete deterministic result, signs the propagation
260
- commit with DCO, and then opens or updates the PR. It does not publish the
261
- downstream release directly. The downstream repository keeps its normal
262
- Buildchain governance: the PR updates source-of-truth facts, then downstream
263
- alpha or release publication runs through its own protected channel. A
264
- byte-identical rerun is an explicit successful no-op.
416
+ commit with DCO, and then opens or updates the PR. With no agent work context,
417
+ the reusable workflow retains this backward-compatible PR boundary. With an
418
+ executing work context, it records materialization, verification, branch, and
419
+ PR receipts and returns `preview` as the next action; the authorized Agent then
420
+ continues through the downstream repository's normal protected review,
421
+ publication, deployment, and readback entrypoints. A byte-identical rerun is an
422
+ explicit successful no-op, never a synthetic completion.
265
423
 
266
424
  For unreleased runtime validation, keep the caller's reusable workflow reference
267
425
  on `@v3` and pass a temporary train ref through `buildchain-ref`.
@@ -58,8 +58,13 @@ those surfaces.
58
58
  `manual-registry.json` enumerates the packaged Markdown manuals with source
59
59
  digests so an agent can find complete operating documentation from the npm
60
60
  artifact. `node-api-registry.json` enumerates public Node import surfaces from
61
- `package.json#exports`, so agents do not have to infer supported APIs from
62
- internal paths.
61
+ `package.json#exports` and closes each JavaScript subpath over its exact exported
62
+ symbols. Each symbol includes its source-derived signature and parameters,
63
+ conservative return/error contract, detected side effects, maturity, example
64
+ import, and source location, so agents do not have to infer supported APIs from
65
+ internal paths. `cli-registry.json` similarly retains every governed command
66
+ path, syntax, option, alias, and side-effect-free help command projected from
67
+ the runtime registry and usage authority.
63
68
  `kfd-claims.json` is the Buildchain-owned KFD claim registry. It is generated
64
69
  from `packages/core/buildchain-kfd-claims.js` and enumerates the public release
65
70
  claims plus the KFD-3 collaboration surfaces that Buildchain self-verifies
@@ -130,6 +135,7 @@ import siteManifest from "@kungfu-tech/buildchain/site/site-manifest.json" with
130
135
  ## Generation
131
136
 
132
137
  ```bash
138
+ pnpm run generate:reference
133
139
  pnpm run generate:site
134
140
  pnpm run check:site
135
141
  ```
@@ -148,9 +154,9 @@ The P0 bundle includes:
148
154
  Node API overview, and fixtures;
149
155
  - site manifest;
150
156
  - publication archive registry for downstream papers surfaces;
151
- - CLI command registry;
157
+ - CLI command registry plus full-path generated human reference;
152
158
  - manual registry for packaged agent-facing documentation;
153
- - Node API registry for public package exports;
159
+ - Node API registry plus per-symbol generated human reference for public package exports;
154
160
  - workflow/action registry;
155
161
  - release model facts;
156
162
  - artifact and evidence schema index;
@@ -8,7 +8,7 @@ confidence: high
8
8
  sensitivity: public
9
9
  evidence_grade: A
10
10
  review_state: unreviewed
11
- last_reviewed: 2026-07-31
11
+ last_reviewed: 2026-08-01
12
12
  ai_provenance:
13
13
  model_family: GPT-5
14
14
  product: Codex
@@ -79,9 +79,10 @@ repository changes are patch".
79
79
 
80
80
  | Date | Action | Line | Faces | Class | Rationale | PR |
81
81
  | ---------- | ------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
82
- | 2026-07-31 | extend-minor | `v3.0` | auditable-demo-workflow, auditable-demo-media-profile, auditable-demo-media-receipt | additive | Add an opt-in responsive profile that binds source-resolution and exact 1280x720 MP4/WebM/GIF renditions to one Gate and receipt while rejecting upscales, aspect-ratio drift, and profile changes between Gate-only and full-render paths. | |
83
- | 2026-07-31 | extend-minor | `v3.0` | release-candidate-family-evidence, release-passport-evidence-attachment, promotion-action, release-passport-cli | additive | Restore all-ref v2 parity for optional Initiative-family candidate binding and typed product-owned release evidence attachments while retaining Kungfu native Family State authority and the newer v3 post-activation released-evidence stage. | #2089 |
84
- | 2026-07-30 | extend-minor | `v3.0` | reusable-build-workflow, observed-evidence-bundle, release-passport-json-reader, web-surface-release-governance | additive | Add bounded artifact compression and remote-read controls plus transactional derived evidence projections while repairing release-PR runtime handoff so production remains protected-main-only. | |
82
+ | 2026-08-01 | extend-minor | `v3.0` | cli-reference-registry, node-api-symbol-registry, golden-path-manual | additive | Add generated, drift-checked CLI and Node API reference registries to the public site bundle, plus a package-tested first-user Golden Path; existing command execution and import semantics remain unchanged. | |
83
+ | 2026-07-31 | extend-minor | `v3.0` | auditable-demo-workflow, auditable-demo-media-profile, auditable-demo-media-receipt | additive | Add an opt-in responsive profile that binds source-resolution and exact 1280x720 MP4/WebM/GIF renditions to one Gate and receipt while rejecting upscales, aspect-ratio drift, and profile changes between Gate-only and full-render paths. | |
84
+ | 2026-07-31 | extend-minor | `v3.0` | release-candidate-family-evidence, release-passport-evidence-attachment, promotion-action, release-passport-cli | additive | Restore all-ref v2 parity for optional Initiative-family candidate binding and typed product-owned release evidence attachments while retaining Kungfu native Family State authority and the newer v3 post-activation released-evidence stage. | #2089 |
85
+ | 2026-07-30 | extend-minor | `v3.0` | reusable-build-workflow, observed-evidence-bundle, release-passport-json-reader, web-surface-release-governance | additive | Add bounded artifact compression and remote-read controls plus transactional derived evidence projections while repairing release-PR runtime handoff so production remains protected-main-only. | |
85
86
  | 2026-07-29 | extend-minor | `v3.0` | artifact-signing-config, apple-developer-id-authority, artifact-signing-evidence | additive | Extend the consumer-neutral signing declaration to macOS compound archives, including nested wheel Mach-O signing, PEP 427 RECORD repair, safe archive reconstruction, and whole-product notarization under the same protected authority. | |
86
87
  | 2026-07-28 | extend-minor | `v3.0` | auditable-demo-workflow, auditable-demo-media-profile, auditable-demo-media-receipt | additive | Add opt-in archive, web-delivery, and site-hero profiles; independently bind codec, container, audio, layout, byte-budget, role, and fast-start facts into a v2 media receipt while preserving the existing archive default. | |
87
88
  | 2026-07-26 | extend-minor | `v3.0` | auditable-demo-workflow, auditable-demo-evidence | additive | Forward-port the consumer-neutral reusable Gate that binds exact same-run GitHub Artifacts to checked-in adapters and immutable renderer evidence, with optional media rendering only from the exact passing Gate bundle. | #1862 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungfu-tech/buildchain",
3
- "version": "3.0.4-alpha.0",
3
+ "version": "3.0.4-alpha.10",
4
4
  "private": false,
5
5
  "description": "Buildchain Release Passport, release governance, CLI toolkit, and site facts.",
6
6
  "repository": "https://github.com/kungfu-systems/buildchain",
@@ -108,11 +108,14 @@
108
108
  },
109
109
  "packageManager": "pnpm@11.7.0",
110
110
  "scripts": {
111
- "check": "pnpm run check:static && node scripts/check-maintainability.mjs && node scripts/check-internal-architecture.mjs && node scripts/check-inventory.mjs && pnpm run check:site && pnpm run check:workflows && pnpm run test:unit && node scripts/check-action-bundles.mjs",
112
- "check:static": "node scripts/check-javascript-syntax.mjs && prettier --check architecture/*.json bin/internal/command-registry.mjs scripts/authorize-promotion-runtime-override.cjs scripts/check-javascript-syntax.mjs scripts/check-maintainability.mjs scripts/maintainability-metrics.mjs tests/authorize-promotion-runtime-override.test.mjs tests/command-registry.test.mjs tests/maintainability.test.mjs tests/promotion-responsibilities.test.mjs",
111
+ "check": "pnpm run check:static && node scripts/check-maintainability.mjs && node scripts/check-internal-architecture.mjs && node scripts/check-inventory.mjs && pnpm run check:site && pnpm run check:workflows && pnpm run test:unit && pnpm run check:golden-path && node scripts/check-action-bundles.mjs",
112
+ "check:static": "node scripts/check-javascript-syntax.mjs && prettier --check architecture/*.json bin/internal/command-registry.mjs scripts/authorize-promotion-runtime-override.cjs scripts/check-javascript-syntax.mjs scripts/check-maintainability.mjs scripts/maintainability-metrics.mjs scripts/public-reference.mjs scripts/site-reference-registry.mjs scripts/generate-public-reference.mjs scripts/verify-golden-path.mjs tests/authorize-promotion-runtime-override.test.mjs tests/command-registry.test.mjs tests/maintainability.test.mjs tests/promotion-responsibilities.test.mjs tests/public-reference.test.mjs",
113
113
  "check:workflows": "bash scripts/check-workflows.sh",
114
- "generate:site": "node scripts/generate-site-bundle.mjs",
115
- "check:site": "node scripts/generate-site-bundle.mjs --check",
114
+ "generate:reference": "node scripts/generate-public-reference.mjs",
115
+ "check:reference": "node scripts/generate-public-reference.mjs --check",
116
+ "generate:site": "pnpm run generate:reference && node scripts/generate-site-bundle.mjs",
117
+ "check:site": "pnpm run check:reference && node scripts/generate-site-bundle.mjs --check",
118
+ "check:golden-path": "node scripts/verify-golden-path.mjs",
116
119
  "test:unit": "node --test tests/*.test.mjs",
117
120
  "build": "pnpm -r --filter \"./actions/**\" build",
118
121
  "binary:build": "node scripts/build-standalone-binary.mjs",
@@ -0,0 +1,37 @@
1
+ export const BUILDCHAIN_AGENT_MANUALS = Object.freeze([
2
+ { id: "map", title: "Buildchain documentation map", path: "docs/MAP.md", plane: "use" },
3
+ { id: "getting-started", title: "Golden Path", path: "docs/getting-started.md", plane: "use" },
4
+ { id: "auditable-demo", title: "Auditable demo artifact pipeline", path: "docs/auditable-demo.md", plane: "verify" },
5
+ { id: "install", title: "Install and verify Buildchain", path: "docs/install.md", plane: "use" },
6
+ { id: "release-passport", title: "Release Passport protocol", path: "docs/release-passport.md", plane: "verify" },
7
+ { id: "github-artifact-attestation", title: "GitHub-native Linux artifact attestation", path: "docs/github-artifact-attestation.md", plane: "verify" },
8
+ { id: "controller-evidence", title: "Controller evidence contract", path: "docs/controller-evidence.md", plane: "verify" },
9
+ { id: "publication-authority", title: "Sealed publication authority", path: "docs/publication-authority.md", plane: "verify" },
10
+ { id: "github-governance-authority", title: "GitHub governance authority", path: "docs/github-governance-authority.md", plane: "verify" },
11
+ { id: "release-candidate", title: "Release Candidate Passport", path: "docs/release-candidate.md", plane: "verify" },
12
+ { id: "release-propagation", title: "Release propagation", path: "docs/release-propagation.md", plane: "use" },
13
+ { id: "readme-badges", title: "README badge blocks", path: "docs/readme-badges.md", plane: "use" },
14
+ { id: "homebrew", title: "Homebrew distribution indexes", path: "docs/homebrew.md", plane: "use" },
15
+ { id: "binary-distribution", title: "Binary distribution contract", path: "docs/binary-distribution.md", plane: "verify" },
16
+ { id: "consumer-issue-reporting", title: "Consumer issue reporting", path: "docs/consumer-issue-reporting.md", plane: "use" },
17
+ { id: "infra-contract", title: "Infra Contract", path: "docs/infra-contract.md", plane: "use" },
18
+ { id: "toolkit-observability", title: "Toolkit observability", path: "docs/toolkit-observability.md", plane: "use" },
19
+ { id: "site-bundle-contract", title: "Site bundle contract", path: "docs/site-bundle-contract.md", plane: "use" },
20
+ { id: "migration-inventory", title: "Migration inventory", path: "docs/migration-inventory.md", plane: "verify" },
21
+ { id: "ownership", title: "Ownership", path: "docs/ownership.md", plane: "why" },
22
+ { id: "product-mechanism", title: "Product mechanism", path: "docs/product-mechanism.md", plane: "why" },
23
+ { id: "cli", title: "CLI and npm package", path: "docs/cli.md", plane: "use" },
24
+ { id: "cli-reference", title: "Generated CLI reference", path: "docs/cli-reference.md", plane: "use" },
25
+ { id: "node-api-reference", title: "Generated Node API reference", path: "docs/node-api-reference.md", plane: "use" },
26
+ { id: "build-facts", title: "Build Facts", path: "docs/build-facts.md", plane: "use" },
27
+ { id: "kfd-support", title: "KFD support and KFD-3 surface registration", path: "docs/kfd-support.md", plane: "verify" },
28
+ { id: "kfd-agent-hub", title: "KFD Agent Hub Builder flow", path: "docs/kfd-agent-hub.md", plane: "use" },
29
+ { id: "lifecycle-protocol", title: "Lifecycle protocol", path: "docs/lifecycle-protocol.md", plane: "use" },
30
+ { id: "reusable-build-surface", title: "Reusable build surface", path: "docs/reusable-build-surface.md", plane: "use" },
31
+ { id: "publish-transaction", title: "Publish transaction", path: "docs/publish-transaction.md", plane: "verify" },
32
+ { id: "release-governance", title: "Release governance", path: "docs/release-governance.md", plane: "why" },
33
+ { id: "release-flow", title: "Release flow", path: "docs/release-flow.md", plane: "verify" },
34
+ { id: "runtime-train-validation", title: "Runtime train validation", path: "docs/runtime-train-validation.md", plane: "verify" },
35
+ { id: "versioning", title: "Versioning", path: "docs/versioning.md", plane: "why" },
36
+ { id: "web-surface-deployments", title: "Web surface deployments", path: "docs/web-surface-deployments.md", plane: "use" },
37
+ ]);
@@ -7,45 +7,13 @@ import {
7
7
  collectPublicSurfaceReverseAudit,
8
8
  } from "./public-surface-audit.js";
9
9
  import { normalizeKfd3DistributionDeclaration } from "./kfd3-surface-register.js";
10
+ import { BUILDCHAIN_AGENT_MANUALS } from "./buildchain-agent-manuals.js";
11
+
12
+ export { BUILDCHAIN_AGENT_MANUALS } from "./buildchain-agent-manuals.js";
10
13
 
11
14
  export const BUILDCHAIN_KFD_CLAIM_REGISTRY_CONTRACT = "kungfu-buildchain-kfd-claim-registry";
12
15
  export const BUILDCHAIN_KFD_COLLABORATION_INTERFACE_CONTRACT = "kungfu-buildchain-kfd-collaboration-interface";
13
16
 
14
- export const BUILDCHAIN_AGENT_MANUALS = Object.freeze([
15
- { id: "map", title: "Buildchain documentation map", path: "docs/MAP.md", plane: "use" },
16
- { id: "auditable-demo", title: "Auditable demo artifact pipeline", path: "docs/auditable-demo.md", plane: "verify" },
17
- { id: "install", title: "Install and verify Buildchain", path: "docs/install.md", plane: "use" },
18
- { id: "release-passport", title: "Release Passport protocol", path: "docs/release-passport.md", plane: "verify" },
19
- { id: "github-artifact-attestation", title: "GitHub-native Linux artifact attestation", path: "docs/github-artifact-attestation.md", plane: "verify" },
20
- { id: "controller-evidence", title: "Controller evidence contract", path: "docs/controller-evidence.md", plane: "verify" },
21
- { id: "publication-authority", title: "Sealed publication authority", path: "docs/publication-authority.md", plane: "verify" },
22
- { id: "github-governance-authority", title: "GitHub governance authority", path: "docs/github-governance-authority.md", plane: "verify" },
23
- { id: "release-candidate", title: "Release Candidate Passport", path: "docs/release-candidate.md", plane: "verify" },
24
- { id: "release-propagation", title: "Release propagation", path: "docs/release-propagation.md", plane: "use" },
25
- { id: "readme-badges", title: "README badge blocks", path: "docs/readme-badges.md", plane: "use" },
26
- { id: "homebrew", title: "Homebrew distribution indexes", path: "docs/homebrew.md", plane: "use" },
27
- { id: "binary-distribution", title: "Binary distribution contract", path: "docs/binary-distribution.md", plane: "verify" },
28
- { id: "consumer-issue-reporting", title: "Consumer issue reporting", path: "docs/consumer-issue-reporting.md", plane: "use" },
29
- { id: "infra-contract", title: "Infra Contract", path: "docs/infra-contract.md", plane: "use" },
30
- { id: "toolkit-observability", title: "Toolkit observability", path: "docs/toolkit-observability.md", plane: "use" },
31
- { id: "site-bundle-contract", title: "Site bundle contract", path: "docs/site-bundle-contract.md", plane: "use" },
32
- { id: "migration-inventory", title: "Migration inventory", path: "docs/migration-inventory.md", plane: "verify" },
33
- { id: "ownership", title: "Ownership", path: "docs/ownership.md", plane: "why" },
34
- { id: "product-mechanism", title: "Product mechanism", path: "docs/product-mechanism.md", plane: "why" },
35
- { id: "cli", title: "CLI and npm package", path: "docs/cli.md", plane: "use" },
36
- { id: "build-facts", title: "Build Facts", path: "docs/build-facts.md", plane: "use" },
37
- { id: "kfd-support", title: "KFD support and KFD-3 surface registration", path: "docs/kfd-support.md", plane: "verify" },
38
- { id: "kfd-agent-hub", title: "KFD Agent Hub Builder flow", path: "docs/kfd-agent-hub.md", plane: "use" },
39
- { id: "lifecycle-protocol", title: "Lifecycle protocol", path: "docs/lifecycle-protocol.md", plane: "use" },
40
- { id: "reusable-build-surface", title: "Reusable build surface", path: "docs/reusable-build-surface.md", plane: "use" },
41
- { id: "publish-transaction", title: "Publish transaction", path: "docs/publish-transaction.md", plane: "verify" },
42
- { id: "release-governance", title: "Release governance", path: "docs/release-governance.md", plane: "why" },
43
- { id: "release-flow", title: "Release flow", path: "docs/release-flow.md", plane: "verify" },
44
- { id: "runtime-train-validation", title: "Runtime train validation", path: "docs/runtime-train-validation.md", plane: "verify" },
45
- { id: "versioning", title: "Versioning", path: "docs/versioning.md", plane: "why" },
46
- { id: "web-surface-deployments", title: "Web surface deployments", path: "docs/web-surface-deployments.md", plane: "use" },
47
- ]);
48
-
49
17
  const SITE_CONTRACT_FILES = Object.freeze([
50
18
  "dist/site/buildchain-site.json",
51
19
  "dist/site/site-manifest.json",
@@ -203,7 +171,6 @@ function uniqueById(entries) {
203
171
  return true;
204
172
  });
205
173
  }
206
-
207
174
  function uniquePaths(paths) {
208
175
  return [...new Set(paths.filter(Boolean))].sort();
209
176
  }
@@ -411,7 +378,7 @@ export function createBuildchainPublicClaimDefinitions() {
411
378
  },
412
379
  {
413
380
  id: "claim:buildchain-release-propagation",
414
- claim: "Buildchain can propagate upstream alpha or stable releases to downstream repositories while preserving release channels through exact release locks.",
381
+ claim: "Buildchain can propagate exact upstream releases as Family State v2 and WorkRef-bound, resumable downstream work that preserves protected review and completes only after production readback.",
415
382
  sourcePaths: [
416
383
  "packages/core/release-propagation.js",
417
384
  "scripts/release-propagation.mjs",
@@ -103,10 +103,16 @@ const CONTROLLER_SPECS = [
103
103
  id: "release-propagation",
104
104
  workflowId: "release-propagation",
105
105
  version: 1,
106
- capabilities: ["release-propagation-plan", "downstream-lock", "pull-request-handoff"],
106
+ capabilities: [
107
+ "release-propagation-plan",
108
+ "downstream-lock",
109
+ "agent-native-work-envelope",
110
+ "resumable-production-handoff",
111
+ ],
107
112
  stages: [
108
113
  "resolve-runtime",
109
114
  "plan",
115
+ "emit-work",
110
116
  "write-lock",
111
117
  "prepare-consumer",
112
118
  "refresh-badges",
@@ -119,6 +125,7 @@ const CONTROLLER_SPECS = [
119
125
  "refresh-badges",
120
126
  "verify-consumer",
121
127
  "open-pr",
128
+ "emit-work",
122
129
  ],
123
130
  evidence: ["propagation-plan", "propagation-lock", "controller-receipt"],
124
131
  },
@@ -590,19 +590,7 @@ export {
590
590
  writeKfd3SurfaceRegistry,
591
591
  } from "./kfd3-surface-register.js";
592
592
 
593
- export {
594
- RELEASE_PROPAGATION_GRAPH_CONTRACT,
595
- RELEASE_PROPAGATION_LOCK_CONTRACT,
596
- RELEASE_PROPAGATION_PLAN_CONTRACT,
597
- RELEASE_PROPAGATION_RECEIPT_CONTRACT,
598
- createReleasePropagationReceipt,
599
- createReleasePropagationLock,
600
- normalizeReleasePropagationGraph,
601
- planReleasePropagation,
602
- readReleasePropagationJson,
603
- resolvePropagationChannel,
604
- writeReleasePropagationLock,
605
- } from "./release-propagation.js";
593
+ export * from "./release-propagation.js";
606
594
 
607
595
  export {
608
596
  RELEASE_ACTIVATION_CONTRACT,
@@ -181,12 +181,8 @@ export function resolvePaperBuildchainSha(buildchainRoot, buildchainSha = "") {
181
181
  return GIT_SHA_PATTERN.test(observed) ? observed : "";
182
182
  }
183
183
 
184
- function expectedCiBranches(developmentRef) {
185
- return [
186
- developmentRef,
187
- developmentRef.replace(/^dev\//, "alpha/"),
188
- developmentRef.replace(/^dev\//, "release/"),
189
- ];
184
+ function expectedCiBranches(ref) {
185
+ return ["dev", "alpha", "release"].map((c) => ref.replace(/^dev/, c));
190
186
  }
191
187
 
192
188
  function ciContext({ env, developmentRef }) {
@@ -201,10 +197,17 @@ function ciContext({ env, developmentRef }) {
201
197
  env.GITHUB_REF_NAME || env.BUILDCHAIN_PAPER_REF_NAME || "",
202
198
  );
203
199
  const pullRequest = ["pull_request", "pull_request_target"].includes(event);
200
+ const channelBranches = expectedCiBranches(developmentRef);
201
+ const channelIndex = channelBranches.indexOf(targetBranch);
202
+ const versionStatePrefix = `buildchain/version-state/${targetBranch.replaceAll("/", "-")}/`;
203
+ const generatedVersionState =
204
+ channelBranches.includes(targetBranch) &&
205
+ sourceBranch.startsWith(versionStatePrefix) &&
206
+ /^[0-9a-f]{12}$/i.test(sourceBranch.slice(versionStatePrefix.length));
204
207
  const branchOk = pullRequest
205
- ? PAPER_WORK_BRANCH_PATTERN.test(sourceBranch) &&
206
- targetBranch === developmentRef
207
- : expectedCiBranches(developmentRef).includes(refName);
208
+ ? (PAPER_WORK_BRANCH_PATTERN.test(sourceBranch) && targetBranch === developmentRef) ||
209
+ (channelIndex > 0 && sourceBranch === channelBranches[channelIndex - 1]) || generatedVersionState
210
+ : channelBranches.includes(refName);
208
211
  return {
209
212
  mode: "ci",
210
213
  event,
@@ -214,8 +217,8 @@ function ciContext({ env, developmentRef }) {
214
217
  pullRequest,
215
218
  ok: branchOk,
216
219
  message: pullRequest
217
- ? `Pull requests must use an allowed work branch and target ${developmentRef}.`
218
- : `Channel checks must run on ${expectedCiBranches(developmentRef).join(", ")}.`,
220
+ ? `Pull requests must target ${developmentRef} from an allowed work branch, promote adjacent protected channels, or carry an exact target-bound generated version state.`
221
+ : `Channel checks must run on ${channelBranches.join(", ")}.`,
219
222
  };
220
223
  }
221
224
 
@@ -1,10 +1,13 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
- import { planPaperMigration, writePaperMigration } from "./paper.js";
3
+ import {
4
+ planPaperMigration,
5
+ resolvePaperRuntimeGitSha,
6
+ writePaperMigration,
7
+ } from "./paper.js";
4
8
  import {
5
9
  PAPER_PATHS,
6
10
  PAPER_WORK_BRANCH_PATTERN,
7
- gitValue,
8
11
  paperWorkSource,
9
12
  readJson,
10
13
  rootedPlan,
@@ -51,10 +54,7 @@ function legacyBuildchainWorkflowRefs(cwd) {
51
54
  if (!fs.existsSync(workflowRoot)) return [];
52
55
  return fs
53
56
  .readdirSync(workflowRoot, { withFileTypes: true })
54
- .filter(
55
- (entry) =>
56
- entry.isFile() && /\.ya?ml$/i.test(entry.name),
57
- )
57
+ .filter((entry) => entry.isFile() && /\.ya?ml$/i.test(entry.name))
58
58
  .filter((entry) =>
59
59
  /uses:\s*kungfu-systems\/buildchain\/[^\s]+@v2(?:[-.][^\s]+)?/i.test(
60
60
  fs.readFileSync(path.join(workflowRoot, entry.name), "utf8"),
@@ -188,7 +188,9 @@ export function collectPaperFleetAudit({
188
188
  root: resolvedRoot,
189
189
  runtime: {
190
190
  version: buildchainVersion,
191
- sha: buildchainSha || gitValue(buildchainRoot, ["rev-parse", "HEAD"]),
191
+ sha:
192
+ buildchainSha ||
193
+ resolvePaperRuntimeGitSha(buildchainRoot, buildchainVersion),
192
194
  },
193
195
  summary: {
194
196
  repositories: entries.length,
@@ -284,3 +286,28 @@ export function writePaperFleetUpdate(plan) {
284
286
  results,
285
287
  };
286
288
  }
289
+
290
+ export function paperFleetTransitionWorkspace(workspaceText, lockText) {
291
+ const source = String(workspaceText || "");
292
+ if (!/@kungfu-tech\/buildchain@[0-9A-Za-z]/.test(String(lockText || ""))) {
293
+ return source;
294
+ }
295
+ const lines = source.replace(/\r\n/g, "\n").split("\n");
296
+ const keyIndex = lines.findIndex((line) =>
297
+ /^minimumReleaseAgeExclude:\s*(?:#.*)?$/.test(line),
298
+ );
299
+ if (keyIndex < 0) {
300
+ throw new Error(
301
+ "paper fleet lock refresh requires a generated minimumReleaseAgeExclude block",
302
+ );
303
+ }
304
+ const retained = lines.filter(
305
+ (line, index) =>
306
+ index <= keyIndex ||
307
+ !/^\s*-\s+['"]?@kungfu-tech\/buildchain(?:@[^'"\s]+)?['"]?\s*(?:#.*)?$/.test(
308
+ line,
309
+ ),
310
+ );
311
+ retained.splice(keyIndex + 1, 0, " - '@kungfu-tech/buildchain'");
312
+ return retained.join("\n");
313
+ }