@defrex/autobuild 0.14.0 → 1.0.0-beta.1

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 (173) hide show
  1. package/README.md +13 -6
  2. package/SPEC.md +657 -100
  3. package/docs/architecture.md +230 -5
  4. package/docs/assets/headline-wide.png +0 -0
  5. package/docs/configuration.md +118 -14
  6. package/docs/hosted-service.md +18 -0
  7. package/docs/integration-tree.md +117 -0
  8. package/docs/landing-policy.md +150 -0
  9. package/docs/mcp.md +24 -0
  10. package/docs/migration-1.0.md +68 -0
  11. package/docs/operator-api.md +19 -8
  12. package/docs/remote-store-protocol.md +30 -7
  13. package/docs/remote-ticket-protocol.md +26 -5
  14. package/docs/restacking.md +79 -0
  15. package/docs/setup.md +53 -6
  16. package/docs/ticket-dependencies.md +69 -0
  17. package/docs/ticket-migration.md +8 -0
  18. package/package.json +3 -3
  19. package/packages/core/src/cli/attention.ts +25 -2
  20. package/packages/core/src/cli/build-control.ts +65 -41
  21. package/packages/core/src/cli/context.ts +54 -2
  22. package/packages/core/src/cli/dashboard/actions.ts +6 -3
  23. package/packages/core/src/cli/dashboard/landing-display.ts +6 -0
  24. package/packages/core/src/cli/dashboard/live.ts +5 -0
  25. package/packages/core/src/cli/dashboard/model.ts +142 -18
  26. package/packages/core/src/cli/dashboard/poll.ts +15 -9
  27. package/packages/core/src/cli/dashboard/refresh.ts +183 -0
  28. package/packages/core/src/cli/dashboard/render.ts +78 -28
  29. package/packages/core/src/cli/dashboard/repository-poll.ts +57 -0
  30. package/packages/core/src/cli/dashboard/selection.ts +7 -1
  31. package/packages/core/src/cli/dashboard/tree.ts +107 -0
  32. package/packages/core/src/cli/dispatch-frontend.ts +156 -105
  33. package/packages/core/src/cli/dispatch.ts +257 -139
  34. package/packages/core/src/cli/dispatcher-liveness.ts +15 -2
  35. package/packages/core/src/cli/help.ts +52 -33
  36. package/packages/core/src/cli/init-validation.ts +43 -2
  37. package/packages/core/src/cli/keyboard.ts +6 -0
  38. package/packages/core/src/cli/landings.ts +18 -0
  39. package/packages/core/src/cli/main.ts +49 -15
  40. package/packages/core/src/cli/mcp.ts +9 -0
  41. package/packages/core/src/cli/publication-settlement.ts +168 -2
  42. package/packages/core/src/cli/repository-status.ts +11 -0
  43. package/packages/core/src/cli/status.ts +72 -5
  44. package/packages/core/src/cli/terminal-restore.ts +54 -0
  45. package/packages/core/src/cli/terminal.ts +16 -2
  46. package/packages/core/src/cli/terminals.ts +98 -79
  47. package/packages/core/src/cli/ticket-editor.ts +10 -3
  48. package/packages/core/src/cli/ticket.ts +113 -18
  49. package/packages/core/src/cli/upgrade-commit.ts +4 -0
  50. package/packages/core/src/cli/upgrade-compatibility.ts +2 -2
  51. package/packages/core/src/cli/upgrade-landing.ts +69 -0
  52. package/packages/core/src/cli/upgrade.ts +16 -0
  53. package/packages/core/src/cli/wait.ts +115 -19
  54. package/packages/core/src/cli/watch.ts +51 -12
  55. package/packages/core/src/config/landing.ts +22 -0
  56. package/packages/core/src/config/live.ts +1 -0
  57. package/packages/core/src/config/schema.ts +3 -0
  58. package/packages/core/src/events/catalog.ts +48 -3
  59. package/packages/core/src/events/payloads.ts +295 -6
  60. package/packages/core/src/events/repository.ts +31 -0
  61. package/packages/core/src/integration/harness.ts +10 -0
  62. package/packages/core/src/kernel/__snapshots__/reducer-registry.test.ts.snap +1030 -239
  63. package/packages/core/src/kernel/auto-merge-default.ts +1 -0
  64. package/packages/core/src/kernel/auto-merge.ts +12 -3
  65. package/packages/core/src/kernel/build-identity.ts +94 -0
  66. package/packages/core/src/kernel/change-presence.ts +179 -0
  67. package/packages/core/src/kernel/dispatch-status.ts +17 -1
  68. package/packages/core/src/kernel/engine.ts +89 -2
  69. package/packages/core/src/kernel/generators/build-log.ts +23 -0
  70. package/packages/core/src/kernel/generators/leaf-restack-log.ts +110 -0
  71. package/packages/core/src/kernel/generators/node-restack-log.ts +94 -0
  72. package/packages/core/src/kernel/generators/repository-journals.ts +11 -0
  73. package/packages/core/src/kernel/integration-completeness.ts +81 -0
  74. package/packages/core/src/kernel/integration-landing.ts +263 -0
  75. package/packages/core/src/kernel/integration-stack.ts +36 -0
  76. package/packages/core/src/kernel/integration-state.ts +135 -0
  77. package/packages/core/src/kernel/landing-policy.ts +47 -0
  78. package/packages/core/src/kernel/landing-publication.ts +41 -0
  79. package/packages/core/src/kernel/landing-readiness.ts +67 -0
  80. package/packages/core/src/kernel/landing-state.ts +96 -0
  81. package/packages/core/src/kernel/leaf-restack-completion.ts +24 -0
  82. package/packages/core/src/kernel/leaf-restack-state.ts +73 -0
  83. package/packages/core/src/kernel/log-index.ts +35 -5
  84. package/packages/core/src/kernel/node-landing.ts +439 -0
  85. package/packages/core/src/kernel/node-parent.ts +184 -0
  86. package/packages/core/src/kernel/node-restack-state.ts +191 -0
  87. package/packages/core/src/kernel/node-restack-transaction.ts +210 -0
  88. package/packages/core/src/kernel/node-restack.ts +274 -0
  89. package/packages/core/src/kernel/read-facts.ts +70 -3
  90. package/packages/core/src/kernel/reconcile-head.ts +51 -0
  91. package/packages/core/src/kernel/reconcile-restack.ts +560 -0
  92. package/packages/core/src/kernel/reducer-registry.ts +16 -0
  93. package/packages/core/src/kernel/reducer.ts +121 -6
  94. package/packages/core/src/kernel/snapshot-parent.ts +33 -0
  95. package/packages/core/src/ontology.ts +9 -1
  96. package/packages/core/src/operator/annotations.ts +12 -0
  97. package/packages/core/src/operator/control.ts +6 -0
  98. package/packages/core/src/operator/index.ts +4 -0
  99. package/packages/core/src/operator/landings.ts +35 -0
  100. package/packages/core/src/operator/presentation.ts +1 -0
  101. package/packages/core/src/operator/protocol.ts +12 -3
  102. package/packages/core/src/operator/query.ts +3 -1
  103. package/packages/core/src/operator/registry.ts +48 -19
  104. package/packages/core/src/operator/requests.ts +1 -8
  105. package/packages/core/src/operator/tickets.ts +55 -9
  106. package/packages/core/src/plugins/load.ts +3 -4
  107. package/packages/core/src/ports/forge/contract.ts +91 -3
  108. package/packages/core/src/ports/forge/fake.ts +142 -4
  109. package/packages/core/src/ports/forge/git-rewrite.ts +232 -0
  110. package/packages/core/src/ports/forge/github-readiness.ts +421 -0
  111. package/packages/core/src/ports/forge/github.ts +631 -35
  112. package/packages/core/src/ports/forge/local-git.ts +119 -5
  113. package/packages/core/src/ports/forge/readiness.ts +99 -0
  114. package/packages/core/src/ports/tickets/contract.ts +41 -0
  115. package/packages/core/src/ports/tickets/create.ts +8 -1
  116. package/packages/core/src/ports/tickets/fake.ts +32 -1
  117. package/packages/core/src/ports/tickets/file-codec.ts +7 -0
  118. package/packages/core/src/ports/tickets/file.ts +18 -1
  119. package/packages/core/src/ports/tickets/hosted-index.ts +2 -0
  120. package/packages/core/src/ports/tickets/linear.ts +124 -4
  121. package/packages/core/src/ports/tickets/migration.ts +25 -1
  122. package/packages/core/src/ports/tickets/operations.ts +7 -2
  123. package/packages/core/src/ports/tickets/remote-protocol.ts +19 -0
  124. package/packages/core/src/ports/tickets/remote.ts +10 -1
  125. package/packages/core/src/ports/tickets/revision.ts +3 -1
  126. package/packages/core/src/ports/tickets/tree.ts +148 -0
  127. package/packages/core/src/ports/tickets/update.ts +15 -2
  128. package/packages/core/src/ports/types.ts +135 -5
  129. package/packages/core/src/ports/workspace/git-worktree.ts +2 -1
  130. package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -1
  131. package/packages/core/src/ports/workspace/vercel-sandbox.ts +60 -3
  132. package/packages/core/src/processes/build-runner.ts +530 -23
  133. package/packages/core/src/processes/dispatcher-selectors.ts +15 -9
  134. package/packages/core/src/processes/dispatcher.ts +2145 -203
  135. package/packages/core/src/processes/execution-no-progress.ts +46 -1
  136. package/packages/core/src/processes/publication-state.ts +30 -5
  137. package/packages/core/src/processes/repo-view.ts +21 -2
  138. package/packages/core/src/store/build-scope.ts +18 -0
  139. package/packages/core/src/store/contract.ts +658 -0
  140. package/packages/core/src/store/digest.ts +52 -4
  141. package/packages/core/src/store/local/schema.ts +25 -13
  142. package/packages/core/src/store/local/store.ts +117 -1
  143. package/packages/core/src/store/memory.ts +62 -1
  144. package/packages/core/src/store/phase-session.ts +17 -0
  145. package/packages/core/src/store/reduced-reads.ts +2 -1
  146. package/packages/core/src/store/reducer-value-shapes.json +10707 -6440
  147. package/packages/core/src/store/remote/client.ts +45 -0
  148. package/packages/core/src/store/remote/compatibility.ts +25 -9
  149. package/packages/core/src/store/remote/protocol.ts +11 -0
  150. package/packages/core/src/store/repo-state-events.ts +2 -0
  151. package/packages/core/src/store/session-handle.ts +15 -0
  152. package/packages/core/src/store/subscribe.ts +1 -1
  153. package/packages/core/src/store/types.ts +34 -4
  154. package/packages/core/src/testing/index.ts +2 -0
  155. package/packages/core/src/testing/reduced-read-budget.ts +48 -8
  156. package/packages/core/src/testing/refresh-scheduler.ts +32 -0
  157. package/skills/guide/SKILL.md +117 -64
  158. package/skills/guide/references/integration-tree.md +117 -0
  159. package/skills/guide/references/landing-policy.md +150 -0
  160. package/skills/guide/references/migration-1.0.md +68 -0
  161. package/skills/guide/references/operator-api.md +12 -5
  162. package/skills/guide/references/plugin-authoring.md +42 -3
  163. package/skills/guide/references/remote-store-protocol.md +30 -7
  164. package/skills/guide/references/remote-ticket-protocol.md +26 -5
  165. package/skills/guide/references/restacking.md +79 -0
  166. package/skills/guide/references/setup.md +53 -6
  167. package/skills/guide/references/ticket-dependencies.md +69 -0
  168. package/skills/guide/references/ticket-migration.md +8 -0
  169. package/skills/operate/SKILL.md +55 -5
  170. package/skills/reconcile/SKILL.md +55 -48
  171. package/skills/spec/SKILL.md +67 -1
  172. package/skills/tickets/SKILL.md +55 -2
  173. package/templates/autobuild.toml +3 -0
@@ -0,0 +1,68 @@
1
+ # Migrating from 0.x to 1.0
2
+
3
+ The integration tree changes replay and landing authorization. It does not cut a
4
+ release or rename `baseBranch`: that setting now names the tree root. Existing
5
+ tickets default to work with no target and continue targeting the root. Adopt
6
+ nodes only when useful; see [integration trees](integration-tree.md).
7
+
8
+ ## Configuration and installed skills
9
+
10
+ Run `ab upgrade` against the intended repository. It updates the recognized
11
+ installation and three-way merges vendored skills with their pristine defaults;
12
+ review local conflicts. `--no-self-update` skips installation update while still
13
+ performing repository migration and skill merging. Preserve local customizations
14
+ and use the installed [setup reference](setup.md) to review verification and roles.
15
+
16
+ When `landing` is absent, upgrade reads the target repository's configured
17
+ BuildStore journal, ignoring ambient `AB_STORE` for that choice, and appends:
18
+
19
+ | Legacy repository default | Leaf rule | Node rule |
20
+ |---|---|---|
21
+ | ON | auto | consent |
22
+ | OFF or no fact | consent | consent |
23
+
24
+ A genuinely absent local journal counts as no fact. An unreadable or unavailable
25
+ journal fails migration with guidance: restore store access and retry, or write
26
+ explicit rules after deciding the desired policy. Existing valid landing arrays
27
+ are preserved byte-for-byte, including root-level `landing = []`, which selects
28
+ the new leaf-auto/node-consent defaults. Fresh init uses those new defaults.
29
+ See [landing policy](landing-policy.md) for complete worked configurations.
30
+
31
+ The repository auto-merge default, its fan-out and old CLI/default controls are
32
+ retired. Use `ab land` and `ab hold`, not an old repository switch. Historical
33
+ explicit per-build `build.auto-merge-requested`/`cancelled` facts map to land/hold
34
+ until a new landing command supersedes them; historical default-seeded requests
35
+ confer no consent. New claims do not materialize old defaults.
36
+
37
+ ## Builds already in flight
38
+
39
+ Historical events and merge reconciliations keep their replay/display meaning;
40
+ old merge commits remain valid history. Later replay uses the promoted historical
41
+ contribution base. The current engine can restack resumed builds at newly reached
42
+ verification or waiting-for-landing boundaries, and current landing rules govern
43
+ new readiness decisions. There is no claim-version switch promising every old
44
+ build finishes with the old merge standard. Drain old work before switching
45
+ versions if retaining old execution behavior is required. Simultaneous old and
46
+ new writers are not a supported migration strategy.
47
+
48
+ Execution pipeline configuration stays pinned to the build; live dispatcher
49
+ landing policy is separate. A recorded readiness decision retains its rule
50
+ snapshot despite configuration edits; a new candidate receives a new decision.
51
+ Explicit consent persists through replay and re-verification until hold or
52
+ completion, except accepted node reparenting revokes it.
53
+
54
+ ## The reversed rebase ban
55
+
56
+ The old ban protected event-recorded SHAs and avoided resolving the same conflict
57
+ for every WIP commit. The new standard replays one net leaf change or ordered
58
+ node contributions, retains displaced history through immutable archive refs and
59
+ durable rewrite facts, and resolves each conflicted item once. Ordinary agent
60
+ rebase of WIP history is still inappropriate. Agents resolve kernel-prepared
61
+ replay; the kernel owns branch replacement with expected-head guards.
62
+
63
+ Root leaves squash; node destinations and local-git root nodes fast-forward;
64
+ GitHub root nodes use guarded rebase merge with recorded fencing/audit limits.
65
+ Check [forge requirements](landing-policy.md#forge-requirements) and
66
+ [restacking](restacking.md) before enabling nodes on a plugin forge. Ensure
67
+ archive publication/read permissions, tree capabilities and required merge
68
+ methods are available; legacy read compatibility is insufficient.
@@ -112,17 +112,15 @@ JSON bodies are strict: unknown fields are rejected.
112
112
 
113
113
  | Method and path | Body |
114
114
  |---|---|
115
- | `POST …/builds/{slug}/control` | `{"action":"pause"\|"cancel-pause"\|"resume"\|"abort"\|"discard"\|"auto-merge-on"\|"auto-merge-off"}` |
115
+ | `POST …/builds/{slug}/control` | `{"action":"pause"\|"cancel-pause"\|"resume"\|"abort"\|"discard"\|"land"\|"hold"}` |
116
116
  | `POST …/builds/{slug}/answer` | One answer variant described below. |
117
117
  | `PUT …/settings/intake` | `{"enabled":boolean}` |
118
118
  | `POST …/settings/intake/toggle` | Empty body. |
119
- | `PUT …/settings/auto-merge-default` | `{"enabled":boolean}` |
120
- | `POST …/settings/auto-merge-default/toggle` | Empty body. |
121
119
  | `POST …/bulk-control` | `{"action":"pause"\|"resume"}`. The hold fact, intake fact, then eligible build events are written in that order. |
122
120
  | `POST …/harvest/control` | `{"action":"toggle-gate"}` or `{"action":"run","run":"…"}`. A run action is bound to that concrete projected run. |
123
121
  | `POST …/tickets/states` | `{name,about?}` → `{state,created}`; requires attributed operator identity (`tickets.state.create` in MCP). Hosted duplicate names are refused case-insensitively. |
124
- | `POST …/tickets` | `{"title":"…","body":"…","labels"?:[],"state"?:"…","blockedBy"?:[]}`; omitted state preserves the backend default. |
125
- | `PATCH …/tickets/{id}` | Any nonempty subset of `title`, `body`, and complete-replacement `labels`. Body bytes are not normalized. |
122
+ | `POST …/tickets` | `{"title":"…","body":"…","labels"?:[],"state"?:"…","blockedBy"?:[],"kind"?:"work"|"node","target"?:"id"|null}`; omitted state preserves the backend default. |
123
+ | `PATCH …/tickets/{id}` | Any nonempty subset of `title`, `body`, complete-replacement `labels`, `kind` (`work` or `node`), and nullable `target` (null clears). Body bytes are not normalized. |
126
124
  | `POST …/tickets/{id}/move` | `{"state":"backend state name"}`. |
127
125
  | `POST …/tickets/{id}/block` | `{"blockerIds":["…"]}`. |
128
126
  | `POST …/tickets/{id}/unblock` | `{"blockerIds":["…"]}`. |
@@ -291,3 +289,12 @@ Hosted ticket tools resolve independent project ticket policy before legacy uplo
291
289
  configuration. Queue, detail, state discovery and mutations work before any build
292
290
  or dispatcher run; detail reports a null matching build. Ticket policy publication
293
291
  never creates synthetic build or repository history.
292
+
293
+ Ticket results include kind (default work) and optional same-source node target.
294
+ Metadata-only patches are accepted. Target validation and demotion guards apply
295
+ to CLI, HTTP and MCP alike; unsupported sources refuse even explicit defaults
296
+ or clears before changing other fields. Dispatch routing is unchanged.
297
+
298
+ Landing controls use `land` and `hold` with acknowledged durable state. Land
299
+ requires readiness and survives restacks; hold persists until land. Repository
300
+ auto-merge settings are retired; configure ordered `[[landing]]` rules.
@@ -1,5 +1,9 @@
1
1
  # Authoring Autobuild plugins
2
2
 
3
+ Install Autobuild in the target repository with `bun add -d --exact @defrex/autobuild`.
4
+ Here, `ab <command>` means the repository-installed CLI; run it as
5
+ `bun ab <command>`, for example `bun ab init`.
6
+
3
7
  Use this reference when asked to connect Autobuild to another ticket tracker,
4
8
  agent runtime, workspace system, or forge. A plugin is a trusted Bun module
5
9
  loaded in-process from the consuming repository. **Definition of done for an
@@ -18,6 +22,23 @@ paths are not API.
18
22
  | `workspace-provider` | `workspaceProviders` | `WorkspaceProvider` | Provision an absolute, writable working copy for the requested branch, return durable base evidence, resume an intact branch non-destructively, rematerialize a lost copy, and make release idempotent. Never silently re-cut resumed work from a newer base. |
19
23
  | `forge` | `forges` | `Forge` | Implement kernel-owned regular pushes, idempotent PR opening, PR-state projection, gated/ungated auto-merge behavior, head-guarded squash merge, and comments. API 1.2 adds optional idempotent `closePr` and `deleteBranch` abort-cleanup capabilities; `closePr` must preserve a racing merge. Without them abort cleanup remains visibly pending. Agents never receive forge credentials or push. `prAttachments` is an optional image-hosting capability; absence must preserve the supported text-only path. |
20
24
 
25
+ Reconcile requires the optional grouped `Forge.rewrite` capability: snapshot the
26
+ actual build branch into a build-private ref, publish immutable exact-SHA refs
27
+ under `refs/autobuild/archive/<slug>/<sha>`, and replace the explicit branch with
28
+ an explicit expected remote head. Return `lease-mismatch` separately from
29
+ transport, auth and policy failures. If the CAS succeeds but another writer
30
+ advances it before readback, return `lease-mismatch` with `rewritten: true` and the
31
+ observed `actual` head. The kernel records that write and retries the observed
32
+ history without claiming completion. After an acknowledged replacement, reattach
33
+ the matching detached workspace HEAD to the build branch so later implementation
34
+ publication remains usable. Never overwrite unknown work or silently
35
+ fall back to merging, ordinary pushes, archive branches or tags. Older forge
36
+ plugins remain loadable and receive an actionable refusal at reconcile time.
37
+ Remote workspace providers additionally need trusted `WorkspacePublication.rewrite`
38
+ after guest execution teardown; ordinary `publish` cannot publish a restack.
39
+ A local-ref acknowledgement has its own `localExpected` guard, separate from
40
+ the authoritative remote lease when another writer advanced the remote branch.
41
+
21
42
  Plugin API 1.3 adds the optional AgentRunner failure `cause` and the
22
43
  `exhaustion-failure` shared-contract scenario. Legacy failures without `cause`
23
44
  remain supported: `permanent: false` is eligible for a configured alternate,
@@ -135,9 +156,10 @@ Add the module specifier at the TOML root, before any table. Repository-path
135
156
  specifiers resolve from the config-bearing root, which is the immutable build
136
157
  worktree in scoped phases. npm package specifiers resolve from the consuming
137
158
  main checkout's installed dependencies first, then from the Autobuild
138
- installation the CLI runs from (so `bun add -g @defrex/autobuild-<extension>`
139
- next to the CLI is enough); a repository copy wins over an installed one, and
140
- missing packages fail and are never installed automatically:
159
+ installation the CLI runs from as a fallback. Install extensions in the
160
+ consuming repository with `bun add -d --exact @defrex/autobuild-<extension>`;
161
+ a repository copy wins over an installed one, and missing packages fail and
162
+ are never installed automatically:
141
163
 
142
164
  ```toml
143
165
  plugins = ["./autobuild-plugin.ts"]
@@ -377,3 +399,20 @@ and is never supplied; factory environments also exclude `AB_TOKEN`. Launch
377
399
  credentials travel through the separate transient execution-auth argument, never
378
400
  through serialized execution identity. Existing plugins that forwarded
379
401
  `storeToken` must migrate to this callback and fail closed if it is unavailable.
402
+
403
+ ## Optional ticket tree capability
404
+
405
+ Existing ticket-source factories remain compatible without new methods or fields.
406
+ Raw `Ticket.kind` is optional for source compatibility; public projections normalize
407
+ it to `work`. An adapter opts in with `integrationTree: true` and implements
408
+ `listAll(): Promise<TicketListing>` over every state, independently of ready filters.
409
+ It must persist `kind?: 'work' | 'node'` and `target?: string | null` on drafts
410
+ and updates: omitted preserves/defaults, explicit work resets kind, null clears
411
+ target. Read targets are source-local canonical ticket ids. Validate same-source
412
+ existence, node kind, self/ancestor cycles, corrupt chains and demotion with any
413
+ children before writing any mixed patch, including revision-checked writes.
414
+ Expose kind/target in revisions. Exhaust provider pagination and propagate
415
+ infrastructure failures. Do not opt in if the source cannot preserve these semantics.
416
+ Legacy sources receive ordinary CRUD unchanged; metadata writes are refused by
417
+ the compatibility facade before legacy methods run. Unsupported sources should
418
+ also refuse metadata explicitly at their own direct write boundary.
@@ -12,21 +12,24 @@ persistence requirements, and conformance bar for the protocol shipped in this
12
12
  distribution are all defined here. Protocol implementations must retain contracts for every supported client line;
13
13
  protocol changes update this document and executable contracts together.
14
14
 
15
- A service accepts stable clients from its own `major.minor` release line and
16
- the two preceding minor lines in the same major. A major starts a new family:
15
+ A service accepts stable and prerelease clients from its own `major.minor`
16
+ release line and the two preceding minor lines in the same major. A major starts a new family:
17
17
  X.0 accepts only X.0, X.1 accepts X.0/X.1, and X.2 onward accepts three lines.
18
18
  Patch versions are interchangeable in both directions and must never change
19
19
  the protocol. Upgrade the service first, then projects independently within
20
20
  its window. Supported release lines retain their wire handlers and known
21
21
  protocol identities; an unknown protocol is refused independently of version.
22
- Malformed, missing, and prerelease identities are refused with HTTP 409.
22
+ Stable and prerelease service and client identities share their numeric major/minor
23
+ line. Malformed or missing identities, build metadata (`+…`), prefixes and
24
+ whitespace are refused with HTTP 409.
23
25
  A newer client is told to upgrade the service; a client below the window is
24
26
  told to upgrade the project's Autobuild. Diagnostics name the service version
25
27
  and supported range.
26
28
 
27
29
  Unauthenticated `GET /health` publishes `ok`, `autobuildVersion`,
28
30
  `protocolVersion`, and `supportedClientRange: { minVersion, maxVersionExclusive }`.
29
- The range is inclusive at the minimum and exclusive at the maximum; a 0.11.x
31
+ Range endpoints remain stable versions. The range is inclusive at the minimum
32
+ and exclusive at the maximum; a 0.11.x
30
33
  service publishes `>=0.9.0 <0.12.0`. Health needs no credentials, version
31
34
  headers, or available backend.
32
35
 
@@ -510,22 +513,37 @@ creation operation and must not reset timestamps, events, artifacts, or lease
510
513
  state when the repository already exists. Event sequence numbering starts at 1
511
514
  for each repository independently of every build and other repository.
512
515
 
513
- A `BuildDigest` is the projection of one build's log onto its terminal fact
514
- and its `observation.recorded` occurrences:
516
+ A `BuildDigest` projects terminal, observation, and compact landing evidence
517
+ from one build's log:
515
518
 
516
519
  ```jsonc
517
520
  // BuildDigest
518
521
  {
522
+ "integrationAuditPending": true, // optional: kernel landing audit requested, not yet settled
519
523
  "slug": "ab-fix-login-3",
520
524
  "terminal": "done", // optional: "done" | "aborted", omitted while the log has neither
521
525
  "observations": [ // ascending-seq pairs for the log's observation.recorded events
522
526
  { "seq": 1, "ts": "2026-07-15T12:00:01.000Z" },
523
527
  { "seq": 4, "ts": "2026-07-15T12:00:04.000Z" }
524
528
  ],
525
- "merged": "2026-07-15T12:00:06.000Z" // optional: ts of the log's latest pr.merged, omitted when none
529
+ "merged": "2026-07-15T12:00:06.000Z", // optional: ts of the log's latest pr.merged, omitted when none
530
+ "mergedSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", // optional: that merge's actual landing SHA
531
+ "nodeContribution": { // optional: latest node.contribution-recorded payload
532
+ "landing": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
533
+ "head": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
534
+ "base": "cccccccccccccccccccccccccccccccccccccccc",
535
+ "identities": ["build:child"]
536
+ }
526
537
  }
527
538
  ```
528
539
 
540
+ The optional `mergedSha` and `nodeContribution` fields let admission index
541
+ confirmed landing evidence without fetching every historical build's full facts.
542
+ A node contribution is usable only when its `landing` matches `mergedSha`;
543
+ recording or recovering a contribution advances `readinessChangeSeq`. These
544
+ members are additive: older peers can omit them, leaving presence unproven rather
545
+ than substituting source completion. They do not change the protocol version.
546
+
529
547
  The digest is derived from the event log on every call — the server persists
530
548
  nothing and there is no refresh step. Protocol version `3` reshaped the
531
549
  digest's `observations` from bare sequence numbers to `{seq, ts}` pairs and
@@ -1295,3 +1313,8 @@ These operations never renew the lease. Repository records optionally expose
1295
1313
  `tick: {run, open?: {startedAt}, finished?: {run, startedAt, completedAt, ...completion}}`.
1296
1314
  They retain the previous completion while a new tick is open and after lease
1297
1315
  release. Build and session credentials cannot mutate repository ticks.
1316
+
1317
+ The optional `integrationAuditPending` digest fact is introduced on the 0.14
1318
+ release line without changing protocol identity 4. It survives build completion
1319
+ and is cleared by audit settlement. Services omit it for historical 0.12/0.13
1320
+ clients, retaining their decoders and the supported three-line window.
@@ -6,21 +6,24 @@ version headers with the remote BuildStore. The version must be in the
6
6
  published service window and the protocol must
7
7
  match its known release-line identity (`3` for 0.9, 0.10, and 0.11).
8
8
 
9
- A service accepts stable clients from its own `major.minor` release line and
10
- the two preceding minor lines in the same major. A major starts a new family:
9
+ A service accepts stable and prerelease clients from its own `major.minor`
10
+ release line and the two preceding minor lines in the same major. A major starts a new family:
11
11
  X.0 accepts only X.0, X.1 accepts X.0/X.1, and X.2 onward accepts three lines.
12
12
  Patch versions are interchangeable in both directions and must never change
13
13
  the protocol. Upgrade the service first, then projects independently within
14
14
  its window. Supported release lines retain their wire handlers and known
15
15
  protocol identities; an unknown protocol is refused independently of version.
16
- Malformed, missing, and prerelease identities are refused with HTTP 409.
16
+ Stable and prerelease service and client identities share their numeric major/minor
17
+ line. Malformed or missing identities, build metadata (`+…`), prefixes and
18
+ whitespace are refused with HTTP 409.
17
19
  A newer client is told to upgrade the service; a client below the window is
18
20
  told to upgrade the project's Autobuild. Diagnostics name the service version
19
21
  and supported range.
20
22
 
21
23
  Unauthenticated `GET /health` publishes `ok`, `autobuildVersion`,
22
24
  `protocolVersion`, and `supportedClientRange: { minVersion, maxVersionExclusive }`.
23
- The range is inclusive at the minimum and exclusive at the maximum; a 0.11.x
25
+ Range endpoints remain stable versions. The range is inclusive at the minimum
26
+ and exclusive at the maximum; a 0.11.x
24
27
  service publishes `>=0.9.0 <0.12.0`. Health needs no credentials, version
25
28
  headers, or available backend.
26
29
 
@@ -273,7 +276,7 @@ snapshot of fields, blockers and revision.
273
276
 
274
277
  `POST /tickets/mutate-if-revision` accepts the usual authenticated context and
275
278
  `input: { id, expectedRevision, mutation }`. Mutation is one of
276
- `{ kind: "update", patch: { title?, body?, labels? } }`,
279
+ `{ kind: "update", patch: { title?, body?, labels?, kind?, target? } }`,
277
280
  `{ kind: "transition", state }`, or
278
281
  `{ kind: "blockers", operation: "block" | "unblock", ids: string[] }`.
279
282
  Unknown keys and empty patches are refused. Success returns `{ ok: true }`.
@@ -312,3 +315,21 @@ before source construction. Their ordinary create grants remain unchanged.
312
315
 
313
316
  See the [migration procedure](ticket-migration.md) for preflight, state mapping,
314
317
  resumption and portable file records.
318
+
319
+ ## Integration tree metadata
320
+
321
+ Hosted tickets store `kind` (`work` or `node`, default `work`) and optional
322
+ `target`, the canonical readable id of a node in the same project. Create accepts
323
+ both fields; update and guarded update preserve omitted fields and accept
324
+ `target: null` to clear an edge. Targets must exist and be nodes. Self-targets,
325
+ ancestor cycles, and demoting a node with targeting tickets (including completed
326
+ work) are rejected before any part of a mixed patch is written. Graph mutations
327
+ serialize per project in the same transaction as validation and revision checks.
328
+ Effective metadata changes increment the revision; equivalent aliases are no-ops.
329
+
330
+ Ticket responses include these fields only with `x-autobuild-ticket-tree: 1`.
331
+ This capability is independent of revision and comment capabilities and of the
332
+ client version. Without it, both fields are projected away, preserving historical
333
+ strict decoders. Current hosted clients send all three capability headers and
334
+ default absent kind to `work`. Unfiltered listing includes all ticket states and
335
+ empty nodes for `ab ticket tree`; dispatch and landing behavior are unchanged.
@@ -0,0 +1,79 @@
1
+ # Restacking and change identity
2
+
3
+ A leaf contributes one net change, independent of its WIP commit count. Before
4
+ verification the kernel collapses its contribution relative to the effective
5
+ diff base and replays it onto the sampled destination. Implementation and review
6
+ do not rewrite history. Verification failures return to implementation; later
7
+ commits append until the next approved cycle. Later reviews use the effective
8
+ base from the preceding successful restack; the original cut remains provenance.
9
+
10
+ The terminal `Autobuild-Build: <slug>` trailer identifies a change across SHA
11
+ rewrites. Reachable identities determine presence, including blockers; old SHAs
12
+ alone do not. Each canonical leaf replay has one parent and one identity,
13
+ including an empty resolved change. Root leaf squash retains that identity;
14
+ node fast-forwards preserve ordered contributing identities.
15
+
16
+ ## Timing and evidence
17
+
18
+ Destination observations are durable `target.moved` facts, including while an
19
+ agent runs. Verify-entry restack freezes a current base before verification;
20
+ path selection excludes upstream-only paths. After finalize and post-steps,
21
+ waiting leaves restack when the target moves. Node-target finalize contributions
22
+ are canonicalized before guarded landing even when the target SHA is unchanged.
23
+ Clean replay starts no agent. A clean waiting leaf rewrite preserves prior
24
+ verification; reports retain their actual cycle base/head. Conflicted replay
25
+ runs reconcile and verification, and initial verification cannot be skipped
26
+ through post-reconcile policy.
27
+
28
+ Every open node observes its parent and cascades movement to descendants,
29
+ including empty nodes without PRs. Movement coalesces onto the newest sample
30
+ after an active frozen transaction finishes; no separate throttle is configured.
31
+ Unlike clean waiting leaves, nodes must reverify any changed head or parent.
32
+
33
+ Before replacement the kernel publishes retained tips, displaced heads and the
34
+ temporary change under immutable exact archive refs. `restack.*` facts record
35
+ preparation, replay, intent, archived replacement, contention and completion.
36
+ Unpublished request/loss records alone cannot preserve objects from a released
37
+ sandbox. Publication uses exact expected-head CAS; contention retains evidence
38
+ and retries without overwriting another writer. Remote guests park for trusted
39
+ publication after teardown. Historical merge reconciliations keep their original
40
+ interpretation and supply a promoted contribution base for later replay.
41
+
42
+ ## Node contributions and recovery
43
+
44
+ Node replay enumerates oldest-first first-parent contributions above the last
45
+ completed boundary (initially the opening SHA). Inherited foreign history is
46
+ excluded from node ownership; the boundary advances only on confirmed completion.
47
+ Ordered source identities survive, and identities already reachable upstream
48
+ are dropped. Untagged commits, including empty ones, are foreign.
49
+
50
+ A separate node writer lease and durable reservation serialize restacks and
51
+ child landings. Reservations freeze expected head, parent, contribution boundary,
52
+ archives, changes and merge proofs. Lease expiry recovers the same operation,
53
+ not a competing one. Prepared/conflicted/replayed item receipts, publication
54
+ intent, proven replacement and settlement distinguish each recovery boundary.
55
+ Inventory exposes source identities, node-owned foreign commits, active operation,
56
+ conflict item and unsafe merge evidence.
57
+
58
+ Only a conflicted item attaches a reconcile runner. It receives the original
59
+ source build's pinned spec, approved plan and implement-notes, with the integration
60
+ owner identified separately. Missing artifacts or invalid identity escalate.
61
+ Foreign conflicts receive commit metadata and a diff; unclear intent escalates.
62
+ Completion validates exactly one commit on the item's replay base, preserving
63
+ identity or foreign status. The agent never publishes the stack; dispatcher
64
+ publication waits for session and execution settlement.
65
+
66
+ ## Foreign merges
67
+
68
+ Before any replay or publication, inspect every merge's non-first-parent history,
69
+ including nested side history, against identities reachable in the frozen parent.
70
+ Flattening is safe only when the merge has no own identity and every side-history
71
+ identity is already present upstream. It becomes one foreign first-parent delta,
72
+ including resolution content or an empty result; side identities stay inherited.
73
+ An identity-bearing merge, absent upstream side identity, malformed or ambiguous
74
+ identity refuses the whole restack. The branch and contribution boundary remain
75
+ untouched and the integration build escalates with offending evidence. The kernel
76
+ never preserves merge topology or decomposes an unsafe merge automatically.
77
+
78
+ See [integration trees](integration-tree.md), [landing](landing-policy.md), and
79
+ [migration](migration-1.0.md).
@@ -1,5 +1,9 @@
1
1
  # Repository setup
2
2
 
3
+ Install Autobuild in the target repository with `bun add -d --exact @defrex/autobuild`.
4
+ Here, `ab <command>` means the repository-installed CLI; run it as
5
+ `bun ab <command>`, for example `bun ab init`.
6
+
3
7
  Configure Autobuild outside the build pipeline. This conversation is not a
4
8
  build or phase. Work directly in the repository and involve the maintainer in
5
9
  choices that cannot be derived from source. Secrets belong in the environment
@@ -119,8 +123,8 @@ exits nonzero on failure. Then:
119
123
  5. Commit the config, setup files, lockfiles, and installed reference changes,
120
124
  then push them to `baseBranch`. A remote sandbox clones the authoritative
121
125
  GitHub revision; it cannot acquire local-only edits.
122
- 6. Run `ab init --validate`. Fix every named failure and rerun until every check
123
- passes. Only then use the installed grooming/ticket skills to create the
126
+ 6. Run `ab init --validate`. Fix every named failure, review warnings and unknowns, and rerun
127
+ validation. Only then use the installed grooming/ticket skills to create the
124
128
  first groomed Ready ticket and start `ab dispatch`.
125
129
 
126
130
  Validation is explicit and noninteractive. It does not dispatch, claim a
@@ -208,21 +212,24 @@ sources agree with the running system by construction:
208
212
  **running dispatcher's version** (read from the deployed distribution's
209
213
  `package.json`), so the guest runs the dispatcher's own release.
210
214
 
211
- A service accepts stable clients from its own `major.minor` release line and
212
- the two preceding minor lines in the same major. A major starts a new family:
215
+ A service accepts stable and prerelease clients from its own `major.minor`
216
+ release line and the two preceding minor lines in the same major. A major starts a new family:
213
217
  X.0 accepts only X.0, X.1 accepts X.0/X.1, and X.2 onward accepts three lines.
214
218
  Patch versions are interchangeable in both directions and must never change
215
219
  the protocol. Upgrade the service first, then projects independently within
216
220
  its window. Supported release lines retain their wire handlers and known
217
221
  protocol identities; an unknown protocol is refused independently of version.
218
- Malformed, missing, and prerelease identities are refused with HTTP 409.
222
+ Stable and prerelease service and client identities share their numeric major/minor
223
+ line. Malformed or missing identities, build metadata (`+…`), prefixes and
224
+ whitespace are refused with HTTP 409.
219
225
  A newer client is told to upgrade the service; a client below the window is
220
226
  told to upgrade the project's Autobuild. Diagnostics name the service version
221
227
  and supported range.
222
228
 
223
229
  Unauthenticated `GET /health` publishes `ok`, `autobuildVersion`,
224
230
  `protocolVersion`, and `supportedClientRange: { minVersion, maxVersionExclusive }`.
225
- The range is inclusive at the minimum and exclusive at the maximum; a 0.11.x
231
+ Range endpoints remain stable versions. The range is inclusive at the minimum
232
+ and exclusive at the maximum; a 0.11.x
226
233
  service publishes `>=0.9.0 <0.12.0`. Health needs no credentials, version
227
234
  headers, or available backend.
228
235
 
@@ -473,3 +480,43 @@ To retain earlier names configure `triageState = "Backlog"`,
473
480
  `claimedState = "Doing"`, `doneState = "Done"`, and the desired `readyState`.
474
481
  Existing ticket rows are never renamed. Older combined-service clients continue
475
482
  using the uploaded dispatcher configuration until independent policy is published.
483
+
484
+ ## Forge readiness
485
+
486
+ Validation inspects the configured forge once on the host, including when builds
487
+ run in Vercel Sandbox. Forge credentials never enter the guest. Each setting is
488
+ PASS, FAIL, WARN, or UNKNOWN; unknown never means permission was proved.
489
+
490
+ For GitHub, enable **Allow squash merging** and **Allow rebase merging** in
491
+ Settings → General. The kernel needs direct publication and force-push permission
492
+ throughout `refs/heads/ab/` and `refs/heads/ab-node/`, including future branch
493
+ names. It also publishes immutable `refs/autobuild/archive/` refs, a non-head
494
+ namespace. Review protection rules, inherited organization rulesets, push rules,
495
+ and actor restrictions for all three namespaces. GitHub's branch APIs cannot
496
+ prove archive-domain access: manually verify it with your administrator without
497
+ creating probe refs or overwriting archives. Autobuild never changes settings or
498
+ performs test pushes.
499
+
500
+ Require **linear history** on protected root and node target branches to prevent
501
+ merge commits from GitHub's update-branch action. On the configured root, enable
502
+ **Require branches to be up to date before merging**, with nonempty required
503
+ checks enforced for all merge actors. This makes root node landings fenced;
504
+ without it they are best-effort. Both are recommendations, so missing settings
505
+ produce warnings rather than hard failures.
506
+
507
+ Inspection needs **Metadata:read** for rulesets and **Administration:read** for
508
+ classic protection; classic private-repository tokens need `repo` access.
509
+ Publication separately needs **Contents:write**. Read access never proves write
510
+ access. Insufficient scope, incomplete inventories, ambiguous patterns, or
511
+ unproven actor bypass produce UNKNOWN with access/remediation guidance. Plugins
512
+ without the optional readiness capability report UNKNOWN and need an adapter
513
+ upgrade; local Git passes these hosted-policy checks trivially.
514
+
515
+ Known hard failures make `ab init --validate` exit unsuccessfully. Warnings and
516
+ unknowns preserve the workspace validation result and require operator review.
517
+ Dispatch reports known hard failures once per invocation as durable
518
+ `dispatcher.forge-readiness-failed` repository notices without adding an admission
519
+ gate. External orchestrators follow these through `ab watch` with no slugs or an
520
+ explicit repository watch; `ab wait` remains build-only. The dashboard and operator
521
+ repository query retain all failures for that run. After correcting settings or
522
+ access, revalidate and restart dispatch to refresh its startup diagnostics.
@@ -57,3 +57,72 @@ or repair the blocker set, and only then move the ticket back to ready. Moving
57
57
  the ticket before cleanup finishes can be overwritten by cleanup. Ready with
58
58
  unresolved blockers is the normal waiting state: dispatch rechecks dependencies
59
59
  and claims the ticket only after they resolve and other readiness gates pass.
60
+
61
+ ## Node tickets and targets
62
+
63
+ Tickets have `kind = "work"` by default, or `kind = "node"` for a named
64
+ integration point. The optional `target` is a node ticket id in the same source;
65
+ omission means the configured `baseBranch` root. Nodes may target other nodes.
66
+ A ready node opens an integration branch; a targeting build freezes that node
67
+ as its base and landing destination. The existing cascade restacks descendants
68
+ when a parent moves. Blockers remain a separate graph.
69
+
70
+ Use `ab ticket create "Integration" --body spec.md --kind node`, then
71
+ `ab ticket update <id> --target <node-id>`. Clear a target with `--no-target`;
72
+ reset kind with `--kind work`. Omitted fields preserve existing values.
73
+ `ab ticket show <id> [--json]` exposes both fields; `ab ticket tree [--json]`
74
+ shows the configured root and every ticket, including completed work and empty
75
+ nodes, nested by target with state. Siblings are sorted by id. Invalid external
76
+ graphs and listing diagnostics are reported explicitly.
77
+
78
+ Targets must exist and be nodes in the configured source. Self-targeting,
79
+ ancestor cycles and demoting a node with targeting tickets are refused before
80
+ any part of the requested update is written, regardless of ticket state.
81
+ Clear or reparent its children before demotion. File frontmatter persists the
82
+ fields; `ab ticket edit` displays them read-only. Change them through update.
83
+ Kind and target participate in content revisions and revision-checked writes.
84
+ File writes retain their existing best-effort, unlocked concurrency semantics.
85
+
86
+ Linear uses the exact `node` issue label for kind and the parent relation for
87
+ target, only when the parent carries that label. Ordinary grouping parents do
88
+ not impose targets and survive unrelated updates. Explicit target clear clears
89
+ the parent relation. Label replacements can demote nodes and receive the same
90
+ guards; explicit kind and label instructions must agree about `node`. Label
91
+ and parent connections are fully paginated. Linear still refuses guarded writes.
92
+
93
+ Hosted sources support kind and target with project-scoped transactional validation.
94
+ Existing tickets default to work with no target. Metadata changes increment the
95
+ revision once; equivalent aliases and unchanged values do not. Node demotion
96
+ checks all targeting tickets, including completed work. Legacy plugins without
97
+ integrationTree support read as work with no target and refuse metadata writes.
98
+
99
+
100
+ A node remains incomplete while any ticket targeting it is unresolved, including
101
+ triage and backlog tickets. Done and cancelled tickets are terminal. A complete
102
+ node with landed contributions verifies its exact head before explicit per-build
103
+ landing consent can publish it. If node verification fails, file a repair child
104
+ with that node as its target; landing the repair triggers a fresh cycle. Human
105
+ forge merges are recorded escape hatches from these gates.
106
+
107
+ ## When a blocker resolves
108
+
109
+ In a repository with nodes, a blocker that has a build resolves when its change
110
+ is present in the dependent's target head (or the configured root branch).
111
+ Source done state and aggregate blocker flags do not bypass this gate. A
112
+ confirmed landing SHA reachable from the sampled target proves presence even
113
+ without a build trailer. A node blocker requires its entire completed owned
114
+ contribution, including nested changes and foreign commits, excluding inherited
115
+ parent history. An empty completed contribution is satisfied; missing evidence,
116
+ an open or aborted node, or ambiguous newest build generations remain queued.
117
+ Older successful generations are never substituted for the newest build.
118
+
119
+ - Same node: the blocking change lands directly into the target.
120
+ - Ancestor: the change lands into an ancestor, then the cascade restacks the target.
121
+ - Sibling: the blocking node lands into their common ancestor, then the cascade reaches the target.
122
+ - Descendant: the blocking node lands into the dependent's target ancestor.
123
+
124
+ Blockers that never had a build, and repositories without nodes, retain the
125
+ source's done-state rule. Waiting tickets stay source work; diagnostics identify
126
+ the missing blocker and destination. Presence is checked only when claiming,
127
+ against an exact sampled head revalidated before claim. Changing presence later
128
+ never stops an existing build.
@@ -62,3 +62,11 @@ Legacy records without `comments` retain their Markdown comment append behavior;
62
62
  export never interprets Markdown headings as structured history. New file tickets
63
63
  use structured comments and preserve their body when a comment is added. There is
64
64
  no continuous sync, assignee migration, state history or build-history migration.
65
+
66
+ Integration-tree `kind` and `target` are preserved in portable frontmatter.
67
+ Import validates the complete target graph before changing the destination and
68
+ refuses a destination that cannot preserve metadata. It creates or adopts every
69
+ identity, establishes node kinds, then applies targets using the durable id map,
70
+ just like blockers. Input order does not matter. Resuming also restores edges on
71
+ adopted tickets; normal destination validation still guards existing graphs and
72
+ node demotion. Older work-only exports remain valid.