@defrex/autobuild 1.0.1 → 1.1.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 (186) hide show
  1. package/README.md +6 -6
  2. package/SPEC.md +360 -229
  3. package/docs/answering-blocked-builds.md +2 -2
  4. package/docs/architecture.md +155 -45
  5. package/docs/assets/headline-wide.png +0 -0
  6. package/docs/builds.md +4 -4
  7. package/docs/cli.md +4 -4
  8. package/docs/configuration-overview.md +4 -4
  9. package/docs/configuration.md +245 -210
  10. package/docs/dispatcher-hosting.md +2 -2
  11. package/docs/dispatcher.md +1 -1
  12. package/docs/forges.md +5 -5
  13. package/docs/getting-started.md +2 -2
  14. package/docs/glossary.md +6 -6
  15. package/docs/hosted-dispatcher.md +6 -3
  16. package/docs/hosted-service.md +16 -5
  17. package/docs/integration-overview.md +15 -15
  18. package/docs/integration-tree.md +45 -38
  19. package/docs/integration.md +6 -6
  20. package/docs/mcp.md +16 -15
  21. package/docs/{landing-policy.md → merge-policy.md} +42 -24
  22. package/docs/migration-1.0.md +17 -13
  23. package/docs/operating.md +41 -18
  24. package/docs/operator-api.md +91 -15
  25. package/docs/operator-surfaces.md +8 -4
  26. package/docs/overview.md +3 -3
  27. package/docs/remote-store-protocol.md +76 -11
  28. package/docs/remote-ticket-protocol.md +1 -1
  29. package/docs/restacking.md +54 -15
  30. package/docs/setup.md +41 -6
  31. package/docs/skills.md +1 -1
  32. package/docs/spec-standard.md +6 -6
  33. package/docs/ticket-dependencies.md +7 -7
  34. package/docs/tickets.md +8 -2
  35. package/docs/troubleshooting.md +2 -2
  36. package/docs/upgrading.md +8 -3
  37. package/docs/verification.md +60 -14
  38. package/package.json +7 -5
  39. package/packages/core/src/cli/binary-direct.ts +13 -1
  40. package/packages/core/src/cli/binary-lifecycle.ts +65 -2
  41. package/packages/core/src/cli/build-control.ts +83 -28
  42. package/packages/core/src/cli/context.ts +81 -38
  43. package/packages/core/src/cli/dashboard/facts.ts +2 -1
  44. package/packages/core/src/cli/dashboard/integration-detail.ts +8 -8
  45. package/packages/core/src/cli/dashboard/integration-row.ts +40 -13
  46. package/packages/core/src/cli/dashboard/landing-display.ts +25 -0
  47. package/packages/core/src/cli/dashboard/model.ts +56 -33
  48. package/packages/core/src/cli/dashboard/poll.ts +9 -3
  49. package/packages/core/src/cli/dashboard/render.ts +59 -37
  50. package/packages/core/src/cli/dashboard/target-distance.ts +14 -0
  51. package/packages/core/src/cli/dashboard/tree.ts +3 -2
  52. package/packages/core/src/cli/dispatch-args.ts +1 -1
  53. package/packages/core/src/cli/dispatch-frontend.ts +6 -3
  54. package/packages/core/src/cli/dispatch.ts +35 -9
  55. package/packages/core/src/cli/env.ts +4 -0
  56. package/packages/core/src/cli/help.ts +30 -23
  57. package/packages/core/src/cli/main.ts +24 -8
  58. package/packages/core/src/cli/node-verification-provenance.ts +1 -97
  59. package/packages/core/src/cli/publication-settlement.ts +43 -20
  60. package/packages/core/src/cli/repository-status.ts +20 -9
  61. package/packages/core/src/cli/status.ts +42 -5
  62. package/packages/core/src/cli/store-opening.ts +6 -1
  63. package/packages/core/src/cli/terminal.ts +22 -1
  64. package/packages/core/src/cli/terminals.ts +14 -10
  65. package/packages/core/src/cli/upgrade-landing.ts +70 -30
  66. package/packages/core/src/cli/upgrade.ts +3 -1
  67. package/packages/core/src/cli/wait.ts +15 -7
  68. package/packages/core/src/cli/watch-lifetime.ts +111 -0
  69. package/packages/core/src/cli/watch.ts +634 -511
  70. package/packages/core/src/config/effective-artifact.fixture.ts +27 -0
  71. package/packages/core/src/config/effective-artifact.ts +13 -0
  72. package/packages/core/src/config/landing.ts +1 -1
  73. package/packages/core/src/config/load.ts +21 -1
  74. package/packages/core/src/config/pipeline-source.ts +28 -0
  75. package/packages/core/src/config/reference-metadata.ts +2 -0
  76. package/packages/core/src/config/reference.ts +22 -7
  77. package/packages/core/src/config/schema.ts +86 -162
  78. package/packages/core/src/context-directory.ts +26 -0
  79. package/packages/core/src/distribution-packaging.ts +26 -5
  80. package/packages/core/src/events/catalog.ts +10 -2
  81. package/packages/core/src/events/globs.ts +1 -1
  82. package/packages/core/src/events/payloads.ts +70 -1
  83. package/packages/core/src/events/policy.ts +7 -0
  84. package/packages/core/src/events/repository.ts +2 -4
  85. package/packages/core/src/events/sessions.ts +6 -6
  86. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +571 -0
  87. package/packages/core/src/kernel/auto-merge.ts +2 -2
  88. package/packages/core/src/kernel/engine.ts +255 -26
  89. package/packages/core/src/kernel/generators/leaf-restack-log.ts +10 -0
  90. package/packages/core/src/kernel/integration-landing.ts +3 -3
  91. package/packages/core/src/kernel/integration-state.ts +27 -4
  92. package/packages/core/src/kernel/leaf-restack-state.ts +28 -3
  93. package/packages/core/src/kernel/log-index.ts +13 -1
  94. package/packages/core/src/kernel/node-landing.ts +8 -8
  95. package/packages/core/src/kernel/node-parent.ts +2 -2
  96. package/packages/core/src/kernel/node-restack-transaction.ts +1 -1
  97. package/packages/core/src/kernel/node-verification-context.ts +216 -0
  98. package/packages/core/src/kernel/phases.ts +1 -1
  99. package/packages/core/src/kernel/plan-verify-selection.ts +16 -0
  100. package/packages/core/src/kernel/publication-retry.ts +168 -0
  101. package/packages/core/src/kernel/reconcile-restack.ts +29 -1
  102. package/packages/core/src/kernel/reducer.ts +82 -5
  103. package/packages/core/src/kernel/target-distance.ts +45 -0
  104. package/packages/core/src/kernel/terminal-guard.ts +10 -1
  105. package/packages/core/src/kernel/verify-stage-state.ts +123 -0
  106. package/packages/core/src/kernel/verify-stages.ts +39 -0
  107. package/packages/core/src/ontology.ts +1 -0
  108. package/packages/core/src/operator/annotations.ts +6 -0
  109. package/packages/core/src/operator/control.ts +1 -1
  110. package/packages/core/src/operator/index.ts +1 -7
  111. package/packages/core/src/operator/landings.ts +5 -1
  112. package/packages/core/src/operator/presentation.ts +6 -1
  113. package/packages/core/src/operator/query.ts +14 -18
  114. package/packages/core/src/operator/registry.ts +17 -6
  115. package/packages/core/src/operator/sandbox-host.ts +64 -40
  116. package/packages/core/src/operator/sandbox.ts +3 -0
  117. package/packages/core/src/operator/ticket-source-backend.ts +3 -12
  118. package/packages/core/src/ports/forge/contract.ts +2 -2
  119. package/packages/core/src/ports/forge/git-rewrite.ts +25 -2
  120. package/packages/core/src/ports/forge/github-readiness.ts +2 -2
  121. package/packages/core/src/ports/forge/github.ts +26 -7
  122. package/packages/core/src/ports/forge/local-git.ts +4 -4
  123. package/packages/core/src/ports/forge/readiness.ts +1 -1
  124. package/packages/core/src/ports/forge-failure.ts +24 -0
  125. package/packages/core/src/ports/workspace/build-execution.ts +3 -1
  126. package/packages/core/src/ports/workspace/phase-scratch.ts +4 -3
  127. package/packages/core/src/ports/workspace/vercel-sandbox.ts +59 -39
  128. package/packages/core/src/processes/build-child.ts +6 -8
  129. package/packages/core/src/processes/build-execution-state.ts +8 -5
  130. package/packages/core/src/processes/build-runner.ts +522 -98
  131. package/packages/core/src/processes/dispatcher.ts +186 -101
  132. package/packages/core/src/processes/execution-no-progress.ts +8 -1
  133. package/packages/core/src/processes/phase-failure-budget.ts +1 -0
  134. package/packages/core/src/processes/publication-loss.ts +8 -2
  135. package/packages/core/src/processes/publication-state.ts +42 -4
  136. package/packages/core/src/processes/repo-view.ts +14 -0
  137. package/packages/core/src/processes/verify-cycle-config.ts +96 -0
  138. package/packages/core/src/{integration → scenarios}/harness.ts +330 -317
  139. package/packages/core/src/store/adapter.ts +1 -0
  140. package/packages/core/src/store/build-scope.ts +9 -0
  141. package/packages/core/src/store/contract.ts +113 -1
  142. package/packages/core/src/store/local/schema.ts +13 -0
  143. package/packages/core/src/store/local/store.ts +42 -0
  144. package/packages/core/src/store/memory.ts +47 -0
  145. package/packages/core/src/store/operator-presence.ts +21 -0
  146. package/packages/core/src/store/phase-session.ts +10 -0
  147. package/packages/core/src/store/reducer-value-shapes.json +5081 -4160
  148. package/packages/core/src/store/remote/client.ts +47 -1
  149. package/packages/core/src/store/remote/compatibility.ts +2 -0
  150. package/packages/core/src/store/remote/protocol.ts +4 -0
  151. package/packages/core/src/store/remote/version.ts +3 -1
  152. package/packages/core/src/store/retention.ts +2 -3
  153. package/packages/core/src/store/session-handle.ts +9 -0
  154. package/packages/core/src/store/streams/session-writer.ts +1 -1
  155. package/packages/core/src/store/types.ts +12 -2
  156. package/packages/core/src/testing/index.ts +11 -1
  157. package/packages/core/src/testing/temp-directories.ts +58 -0
  158. package/skills/code-review/SKILL.md +23 -9
  159. package/skills/finalize/SKILL.md +15 -7
  160. package/skills/guide/SKILL.md +253 -118
  161. package/skills/guide/references/integration-tree.md +45 -38
  162. package/skills/guide/references/{landing-policy.md → merge-policy.md} +42 -24
  163. package/skills/guide/references/migration-1.0.md +17 -13
  164. package/skills/guide/references/operator-api.md +91 -15
  165. package/skills/guide/references/remote-store-protocol.md +76 -11
  166. package/skills/guide/references/remote-ticket-protocol.md +1 -1
  167. package/skills/guide/references/restacking.md +54 -15
  168. package/skills/guide/references/setup.md +41 -6
  169. package/skills/guide/references/spec-standard.md +6 -6
  170. package/skills/guide/references/ticket-dependencies.md +7 -7
  171. package/skills/implement/SKILL.md +43 -17
  172. package/skills/operate/SKILL.md +117 -116
  173. package/skills/plan/SKILL.md +39 -13
  174. package/skills/plan-review/SKILL.md +15 -10
  175. package/skills/reconcile/SKILL.md +22 -3
  176. package/skills/spec/SKILL.md +19 -19
  177. package/skills/tickets/SKILL.md +9 -7
  178. package/templates/autobuild.toml +1 -1
  179. package/templates/hosted-service/package.json +2 -2
  180. package/packages/core/src/orchestrator/approvals.ts +0 -115
  181. package/packages/core/src/orchestrator/conversation.ts +0 -167
  182. package/packages/core/src/orchestrator/model.ts +0 -86
  183. package/packages/core/src/orchestrator/prompt.ts +0 -63
  184. package/packages/core/src/orchestrator/tools.ts +0 -117
  185. package/packages/core/src/orchestrator/turn-runner.ts +0 -457
  186. package/packages/core/src/processes/orchestrator-tick.ts +0 -360
@@ -1,6 +1,6 @@
1
- # Landing policy
1
+ # Merge policy
2
2
 
3
- Landing authorization is an ordered, strict `[[landing]]` array in
3
+ Merge authorization is an ordered, strict `[[merge]]` array in
4
4
  `autobuild.toml`. Rules require `mode = "auto"` or `"consent"`; optional
5
5
  predicates are ANDed, omissions are wildcards, and the first match wins.
6
6
 
@@ -22,14 +22,16 @@ Editing configuration does not revise that decision. A replacement candidate
22
22
  gets a fresh decision. Policy is live dispatcher configuration, separate from
23
23
  the pinned execution pipeline.
24
24
 
25
- `ab hold <slug>` suppresses landing and revokes consent, even before readiness.
26
- `ab land <slug>` requires readiness, clears hold and consents to this landing
25
+ `ab hold <slug>` suppresses merge and revokes consent, even before readiness.
26
+ `ab merge <slug>` requires readiness, clears hold and consents to this merge
27
27
  into its destination. Consent survives head replacement, restacking, verification
28
- and re-finalization until hold or completion; it approves the landing rather than
28
+ and re-finalization until hold or completion; it approves the merge rather than
29
29
  an immutable diff. Accepted node reparenting revokes it. Commands and receipts
30
30
  are sequence-correlated: hold acknowledgement confirms native cancellation;
31
- land acknowledgement does not claim gates passed. MCP/operator tools offer the
32
- same actions; the terminal uses `l`/`o`, and the web has no consent controls.
31
+ merge acknowledgement does not claim gates passed. MCP/operator tools offer the
32
+ same actions; the terminal uses `l`/`o`. The hosted web app offers **Merge** and
33
+ **Hold** on a merge awaiting consent. These controls record the same durable
34
+ actions; **Merge** does not mean the merge gates have passed.
33
35
 
34
36
  ## Worked configurations
35
37
 
@@ -40,7 +42,7 @@ repository's commands, roles and verification before operating it.
40
42
 
41
43
  ```toml
42
44
  baseBranch = "main"
43
- landing = []
45
+ merge = []
44
46
 
45
47
  [tickets]
46
48
  source = "file"
@@ -55,11 +57,11 @@ consent. No special rule is needed for a repository without integration nodes.
55
57
  ```toml
56
58
  baseBranch = "main"
57
59
 
58
- [[landing]]
60
+ [[merge]]
59
61
  into = "root"
60
62
  mode = "consent"
61
63
 
62
- [[landing]]
64
+ [[merge]]
63
65
  into = "node"
64
66
  mode = "auto"
65
67
 
@@ -69,7 +71,7 @@ readyState = "ready"
69
71
  ```
70
72
 
71
73
  Leaves and nodes entering the root match rule 1 and require consent. Leaves and
72
- nested nodes entering any node match rule 2 and land automatically when ready.
74
+ nested nodes entering any node match rule 2 and merge automatically when ready.
73
75
  A specific destination can replace `"node"` with its ticket id, such as
74
76
  `"REL-1"`; it matches that frozen destination only.
75
77
 
@@ -78,15 +80,15 @@ A specific destination can replace `"node"` with its ticket id, such as
78
80
  ```toml
79
81
  baseBranch = "main"
80
82
 
81
- [[landing]]
83
+ [[merge]]
82
84
  label = "review"
83
85
  mode = "consent"
84
86
 
85
- [[landing]]
87
+ [[merge]]
86
88
  from = "node"
87
89
  mode = "consent"
88
90
 
89
- [[landing]]
91
+ [[merge]]
90
92
  mode = "auto"
91
93
 
92
94
  [tickets]
@@ -99,14 +101,14 @@ other leaves match rule 3. `Review` does not match `review`. Moving the catch-al
99
101
  to the front would shadow both safeguards and automatically authorize nodes too.
100
102
  Authorization never bypasses verification, checks, protection or merge gates.
101
103
 
102
- ## Landing methods
104
+ ## Merge methods
103
105
 
104
106
  Root-target leaves squash into one identity-bearing commit per build.
105
107
  Node-target children use serialized, exact-parent guarded fast-forwards;
106
- node-to-local-git-root landing also fast-forwards, preserving the contributions.
107
- Node-to-GitHub-root landing uses PR rebase merge guarded on verified head after
108
+ node-to-local-git-root merge also fast-forwards, preserving the contributions.
109
+ Node-to-GitHub-root merge uses PR rebase merge guarded on verified head after
108
110
  a final parent freshness read. Enforced up-to-date protection provides a fenced
109
- landing; uncertainty is recorded as unfenced and requires immutable landed-tree
111
+ merge; uncertainty is recorded as unfenced and requires immutable merged-tree
110
112
  audit. A mismatch raises operator attention without rewriting the shared parent.
111
113
  Pending audits survive completion and retry until settled.
112
114
 
@@ -115,15 +117,15 @@ authoritatively ungated root permits an inspected-head guarded direct squash;
115
117
  unknown gate state defers. Node targets instead require authoritative proof of
116
118
  an ungated destination, cancel native auto-merge and serialize the guarded push.
117
119
  Gated or unproven node destinations stay open with actionable diagnostics.
118
- Successful push proves landing; forge acknowledgement is best-effort, including
119
- a landed-SHA comment and closing an unacknowledged open review.
120
+ Successful push proves merge; forge acknowledgement is best-effort, including
121
+ a merged-SHA comment and closing an unacknowledged open review.
120
122
 
121
123
  Native application receipts bind to exact candidates; consent does not. Every
122
124
  replacement confirms cancellation first; the next poll reconciles native state
123
125
  before other actions. Stale enables are repaired by polling. This bounded model
124
126
  requires replacement-head checks to take far longer than a poll interval. It
125
127
  has no durable native-effect reservation. Human forge merges record whether a
126
- hold was overridden; possible stale-enable landings raise operator attention.
128
+ hold was overridden; possible stale-enable merges raise operator attention.
127
129
  No result is undone by rewriting the target.
128
130
 
129
131
  ## Forge requirements
@@ -136,7 +138,7 @@ retention policy. See [restacking](restacking.md).
136
138
 
137
139
  Tree admission requires node branch creation, authoritative branch-head reads
138
140
  and comparison. Reparenting additionally requires PR retargeting. Controlled
139
- landing requires exact-parent guarded publication and authoritative gate proof;
141
+ merge requires exact-parent guarded publication and authoritative gate proof;
140
142
  GitHub root nodes also need rebase merge support. Root leaves require squash
141
143
  support. Readiness inspection reports method/publication hard failures and
142
144
  linear-history/freshness recommendations without changing provider settings or
@@ -145,7 +147,7 @@ pushing probes. Unknown permission never proves permission.
145
147
  Legacy plugins can remain readable without supporting tree operations: old
146
148
  ticket sources read as work/root and refuse tree metadata writes. This read
147
149
  compatibility does not grant forge tree capabilities. Upgrade adapters before
148
- admitting nodes or requesting unsupported retargeting or landing operations.
150
+ admitting nodes or requesting unsupported retargeting or merge operations.
149
151
  For the lifecycle see [integration trees](integration-tree.md); for old controls
150
152
  and upgrade conversion see [migration](migration-1.0.md).
151
153
 
@@ -157,5 +159,21 @@ Local-git's shared database retains authoritative CAS.
157
159
 
158
160
  Native cancellation receipts are candidate- and operation-specific. Publication
159
161
  retries confirm forge state before reusing a receipt; external re-enables require
160
- another confirmed cancellation. Classified transient landing failures retain
162
+ another confirmed cancellation. Classified transient merge failures retain
161
163
  retry eligibility and recheck authorization after repository forge cooldown.
164
+
165
+ ## Deprecated spellings
166
+
167
+ `ab land` and `ab landings` remain callable aliases for `ab merge` and `ab merges`,
168
+ with one deprecation notice on stderr. `node-landed` remains an alias for the
169
+ `ab wait --for node-merged` condition. Ordinary help lists only the current names.
170
+
171
+ The deprecated `[[landing]]` config array has the same semantics as `[[merge]]`
172
+ and warns after validation. Declare only one spelling, including empty arrays.
173
+ `ab upgrade` renames the old root key and table headers while preserving policy;
174
+ unsupported spellings require the reported manual edit before retrying.
175
+
176
+ MCP discovery offers `merges.list` and its deprecated alias `landings.list`.
177
+ `builds.control` accepts canonical `merge` and deprecated `land` actions through
178
+ both MCP bindings. HTTP control bodies and durable event fields retain their
179
+ existing wire names, including `land`, `landing.decided`, and `integration.landed`.
@@ -1,6 +1,6 @@
1
1
  # Migrating from 0.x to 1.0
2
2
 
3
- The integration tree changes replay and landing authorization. It does not cut a
3
+ The integration tree changes replay and merge authorization. It does not cut a
4
4
  release or rename `baseBranch`: that setting now names the tree root. Existing
5
5
  tickets default to work with no target and continue targeting the root. Adopt
6
6
  nodes only when useful; see [integration trees](integration-tree.md).
@@ -13,7 +13,7 @@ review local conflicts. `--no-self-update` skips installation update while still
13
13
  performing repository migration and skill merging. Preserve local customizations
14
14
  and use the installed [setup reference](setup.md) to review verification and roles.
15
15
 
16
- When `landing` is absent, upgrade reads the target repository's configured
16
+ When neither `merge` nor its deprecated `landing` alias is declared, upgrade reads the target repository's configured
17
17
  BuildStore journal, ignoring ambient `AB_STORE` for that choice, and appends:
18
18
 
19
19
  | Legacy repository default | Leaf rule | Node rule |
@@ -23,15 +23,18 @@ BuildStore journal, ignoring ambient `AB_STORE` for that choice, and appends:
23
23
 
24
24
  A genuinely absent local journal counts as no fact. An unreadable or unavailable
25
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
26
+ explicit rules after deciding the desired policy. Existing valid merge arrays
27
+ are preserved byte-for-byte, including root-level `merge = []`, which selects
28
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.
29
+ An explicit deprecated `landing` array is renamed to `merge`, preserving values,
30
+ selectors, order and surrounding comments without reading the legacy journal.
31
+ Declaring both spellings is an error, including empty arrays.
32
+ See [merge policy](merge-policy.md) for complete worked configurations.
30
33
 
31
34
  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
+ retired. Use `ab merge` and `ab hold`, not an old repository switch. Historical
36
+ explicit per-build `build.auto-merge-requested`/`cancelled` facts map to merge/hold
37
+ until a new merge command supersedes them; historical default-seeded requests
35
38
  confer no consent. New claims do not materialize old defaults.
36
39
 
37
40
  ## Builds already in flight
@@ -39,14 +42,15 @@ confer no consent. New claims do not materialize old defaults.
39
42
  Historical events and merge reconciliations keep their replay/display meaning;
40
43
  old merge commits remain valid history. Later replay uses the promoted historical
41
44
  contribution base. The current engine can restack resumed builds at newly reached
42
- verification or waiting-for-landing boundaries, and current landing rules govern
45
+ verification or waiting-for-merge boundaries, and current merge rules govern
43
46
  new readiness decisions. There is no claim-version switch promising every old
44
47
  build finishes with the old merge standard. Drain old work before switching
45
48
  versions if retaining old execution behavior is required. Simultaneous old and
46
49
  new writers are not a supported migration strategy.
47
50
 
48
- Execution pipeline configuration stays pinned to the build; live dispatcher
49
- landing policy is separate. A recorded readiness decision retains its rule
51
+ Execution pipeline configuration stays owned by the build and is re-pinned
52
+ from its checkout at each verify cycle; live dispatcher
53
+ merge policy is separate. A recorded readiness decision retains its rule
50
54
  snapshot despite configuration edits; a new candidate receives a new decision.
51
55
  Explicit consent persists through replay and re-verification until hold or
52
56
  completion, except accepted node reparenting revokes it.
@@ -62,7 +66,7 @@ replay; the kernel owns branch replacement with expected-head guards.
62
66
 
63
67
  Root leaves squash; node destinations and local-git root nodes fast-forward;
64
68
  GitHub root nodes use guarded rebase merge with recorded fencing/audit limits.
65
- Check [forge requirements](landing-policy.md#forge-requirements) and
69
+ Check [forge requirements](merge-policy.md#forge-requirements) and
66
70
  [restacking](restacking.md) before enabling nodes on a plugin forge. Ensure
67
71
  archive publication/read permissions, tree capabilities and required merge
68
72
  methods are available; legacy read compatibility is insufficient.
@@ -71,7 +75,7 @@ methods are available; legacy read compatibility is insufficient.
71
75
 
72
76
  Parent movement is now observed without starting a node replay. Existing frozen
73
77
  transactions finish after upgrade; subsequent replay needs completeness before
74
- verification, freshness before landing, dependency presence, operator demand
78
+ verification, freshness before merge, dependency presence, operator demand
75
79
  (`ab restack <node>`), or accepted re-parenting. Nested nodes need independent
76
80
  demand. Leaves keep their existing timing. There is no eager compatibility mode.
77
81
  See [restacking](restacking.md) for durable requests and parent commit distance.
package/docs/operating.md CHANGED
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  title: "Working with your operator agent"
3
3
  group: "guides"
4
- description: "Delegate specs, tickets, monitoring, and landing to your agent while keeping product decisions and authority with you."
4
+ description: "Delegate specs, tickets, monitoring, and merge to your agent while keeping product decisions and authority with you."
5
5
  label: "Working with your operator agent"
6
6
  order: 6
7
7
  ---
8
8
 
9
9
  # Working with your operator agent
10
10
 
11
- Your operator agent keeps work moving through `ab` or MCP. Under your instructions it writes specs, files and grooms tickets, watches builds, answers bounded escalations, pauses or aborts work, and authorizes landing.
11
+ Your operator agent keeps work moving through `ab` or MCP. Under your instructions it writes specs, files and grooms tickets, operates the builds the repository's dispatcher dispatches, answers bounded escalations, pauses or aborts work, and authorizes merge.
12
12
 
13
13
  - **You own** goals, scope, tradeoffs and authority, and you run the dispatcher and upgrades.
14
14
  - **The agent never** starts, stops or restarts dispatch; it reports dispatcher trouble to you.
@@ -27,23 +27,46 @@ Autobuild ships no agent memory. Keep goals, decisions, constraints and monitor
27
27
 
28
28
  ## Give steering that sticks
29
29
 
30
- Give the agent your scope, priorities, acceptance boundaries, escalation thresholds and landing authority. For example:
30
+ Give the agent your scope, priorities, acceptance boundaries, escalation thresholds and merge authority. For example:
31
31
 
32
- > Keep this change API-compatible. Prioritize the retry budget over diagnostics. You may answer questions already settled by this spec, but ask me about scope changes and before granting landing consent.
32
+ > Keep this change API-compatible. Prioritize the retry budget over diagnostics. You may answer questions already settled by this spec, but ask me about scope changes and before granting merge consent.
33
33
 
34
- Agree on boundaries before the agent acts: moving a ticket to ready can start a build immediately, and granting consent can let it land once gates pass.
34
+ Agree on boundaries before the agent acts: moving a ticket to ready can start a build immediately, and granting consent can let it merge once gates pass.
35
35
 
36
36
  The agent answers questions your instructions settle and escalates ambiguous goals, scope or compatibility tradeoffs, consequential or destructive choices, missing authority or access, and dispatcher trouble.
37
37
 
38
38
  ## Watch for attention
39
39
 
40
40
  ```
41
- bun ab watch --json
41
+ bun ab repository status --json
42
+ bun ab watch --operator --json
42
43
  ```
43
44
 
44
- `watch` monitors active builds, new builds and the repository journal.
45
-
46
- - **Default filter:** actionable attention only, such as escalations and ready landings awaiting consent. Add `--event` globs for routine lifecycle events.
45
+ Before registering, inspect `operator.registrations` in repository status. If
46
+ another live operator is present, the agent tells you and stops unless you direct
47
+ otherwise. Filing sessions preserve intent, rejected alternatives and out-of-scope
48
+ reasons in ticket bodies so that operator can answer escalations.
49
+
50
+ `watch --operator` monitors active builds, new builds and the repository journal.
51
+ It writes advisory mutable presence, never events or a lease. Multiple operators
52
+ may register; presence is no lock. Unflagged watches write nothing. Repository
53
+ status lists live registrations with host, PID, start time and heartbeat age.
54
+ Heartbeats run every 30 seconds; presence expires five minutes after the last
55
+ successful heartbeat, including a final best-effort heartbeat on orderly timeout
56
+ or count completion. SIGINT, SIGTERM, SIGHUP and stdout EPIPE attempt withdrawal
57
+ within about two seconds. Failures leave TTL expiry as the fallback; older services
58
+ without withdrawal support fall back silently. SIGKILL still relies on TTL expiry.
59
+
60
+ Re-arm with `bun ab watch --operator --json --since <watch-cursor>` using only
61
+ the standing watch's own cursor. This preserves one ID and original start time
62
+ across a re-arm gap of up to five minutes. After termination withdraws presence,
63
+ the same cursor re-registers the same ID and start time. Reconcile current and
64
+ newly dispatched builds after arming and on timeout. Keep operating after the initial work ends,
65
+ until you end or hand off the role. `wait` does not heartbeat or carry registration
66
+ identity: a separate unflagged diagnostic wait/watch must never replace the
67
+ standing monitor or supply its resume cursor. MCP presence is deferred.
68
+
69
+ - **Default filter:** actionable attention only, such as escalations and ready merges awaiting consent. Add `--event` globs for routine lifecycle events.
47
70
  - **Starts now:** a fresh watch ignores history, so check current status too.
48
71
  - **Resumable:** pass the opaque cursor from the JSON output back with `--since` to receive events recorded while away. The final JSON line always carries one.
49
72
  - **Duration:** 30 minutes by default; `--timeout 0` keeps it open.
@@ -80,29 +103,29 @@ bun ab resume my-build
80
103
  - **`pause --all`** holds queued work, turns intake off and requests pauses on running builds.
81
104
  - **`resume --all`** releases the hold, turns intake on and resumes cleanly paused builds.
82
105
 
83
- Intake off only stops new ticket claims; a repository pause also holds queued builds. Neither withdraws landing consent; use `hold`.
106
+ Intake off only stops new ticket claims; a repository pause also holds queued builds. Neither withdraws merge consent; use `hold`.
84
107
 
85
- ## Authorize landing
108
+ ## Authorize merge
86
109
 
87
- Ordered landing rules choose automatic authorization or explicit consent. With no matching rule, leaves default to auto and integration nodes to consent. Verification, checks, protection and merge gates still apply.
110
+ Ordered merge rules choose automatic authorization or explicit consent. With no matching rule, leaves default to auto and integration nodes to consent. Verification, checks, protection and merge gates still apply.
88
111
 
89
112
  ```
90
- bun ab land my-build
113
+ bun ab merge my-build
91
114
  bun ab hold my-build
92
115
  ```
93
116
 
94
- - **`land`** requires a ready build, clears its hold and grants consent to land into its destination.
95
- - **`hold`** suppresses landing and revokes consent, even before the build is ready.
117
+ - **`merge`** requires a ready build, clears its hold and grants consent to merge into its destination.
118
+ - **`hold`** suppresses merge and revokes consent, even before the build is ready.
96
119
  - **Persistence:** consent survives head changes, restacks, verification and re-finalization until a hold or completion. Accepted node reparenting revokes it.
97
120
 
98
121
  ## Choose an operator surface
99
122
 
100
123
  Every surface reads the same durable state; [Operator surfaces](operator-surfaces.md) covers remote access.
101
124
 
102
- | Surface | Progress, escalations, pause/resume | Landing consent and hold |
125
+ | Surface | Progress, escalations, pause/resume | Merge consent and hold |
103
126
  |---|---|---|
104
- | Terminal dashboard (`bun ab dispatch`) | Yes | Keys `l` (land) and `o` (hold) |
105
- | Hosted web app | Yes, plus sessions and transcripts | No |
127
+ | Terminal dashboard (`bun ab dispatch`) | Yes | Keys `l` (merge) and `o` (hold) |
128
+ | Hosted web app | Yes, plus sessions and transcripts | Merge/Hold on a merge awaiting consent |
106
129
  | CLI and MCP operator tools | Yes | Yes |
107
130
 
108
131
  ## An example session
@@ -1,9 +1,9 @@
1
1
  # Operator API v1
2
2
 
3
3
  The hosted service exposes the polling-oriented operator surface at
4
- `/operator/v1/repos/{repo}`. It is versioned with remote store protocol **4**.
4
+ `/operator/v1/repos/{repo}`. It is versioned with remote store protocol **6**.
5
5
  Every request must send `X-Autobuild-Version`,
6
- `X-Autobuild-Protocol-Version: 3`, and `Authorization: Bearer …`. Identity is
6
+ `X-Autobuild-Protocol-Version: 6`, and `Authorization: Bearer …`. Identity is
7
7
  checked before authentication or resource lookup.
8
8
 
9
9
  Project credentials are opaque `abp_1_<id>_<secret>` bearer values bound to one
@@ -73,8 +73,13 @@ archived status is terminal.
73
73
 
74
74
  Session state is a reduction of the session's event log, never a stored
75
75
  column; a `GET …/sessions/{sid}` response therefore always reflects the
76
- session's full history. The API never exposes raw session-event append: the
77
- turn runner (a later ticket) is the only producer of turn facts.
76
+ session's full history. Message, explicit wake and approval writes return
77
+ `{ok:true}` without turn or stream ids. They record facts only: the service
78
+ never starts or resumes an agent, executes an approved call, or reaps a turn.
79
+ New sessions have no inherited wake settings. Historical turn events and
80
+ streams remain readable; an approval answer clears the matching pending
81
+ approval without changing its suspended turn or stream. The API never exposes
82
+ raw session-event append. External operator harnesses own agent execution.
78
83
 
79
84
  ## Reads
80
85
 
@@ -99,7 +104,9 @@ Dashboard reads use the latest durable, run-correlated `effectiveConfig`
99
104
  repository artifact. Missing, corrupt, or invalid configuration returns a typed
100
105
  `409 effective-config-unavailable`; the service never guesses from a checkout.
101
106
  Clients poll these reads — the operator HTTP API exposes no push or long-poll
102
- event transport. Streaming is provided as a CLI read surface: `ab watch`
107
+ event transport. Streaming is provided by `ab watch`; unflagged watches are read-only.
108
+ Only CLI `--operator` watches write advisory liveness, never events or authority;
109
+ MCP presence registration is deferred. `ab watch`
103
110
  streams build and repository events by polling the same event logs client-side
104
111
  (the store protocol's `GET /builds/{slug}/events` and `GET /repos/{repo}/events`
105
112
  reads), not as a transport on this API. `triageState`, `readyState`,
@@ -156,10 +163,10 @@ Each kernel `spec.revised` records the exact artifact and operator identity
156
163
  Ticket-origin revisions re-pin assets; supplied bodies preserve asset pins.
157
164
  The node recollects and verifies the new revision, including on the same head
158
165
  and parent after a failed cycle. Earlier cycles remain historical evidence
159
- and cannot block or authorize landing under the replacement. Children keep
166
+ and cannot block or authorize merge under the replacement. Children keep
160
167
  their specs, claims and targets; contributions are not restarted.
161
168
  Active verification/reconcile or writer work, restack/reparent work, pause,
162
- pending controls, landing intent and ended PRs refuse the no-escalation path.
169
+ pending controls, merge intent and ended PRs refuse the no-escalation path.
163
170
  A concurrent state change refuses publication with a retry explanation;
164
171
  uncited artifacts are inert. Leaves still require an open escalation and
165
172
  restart from `plan`.
@@ -217,8 +224,7 @@ progress and unattempted builds. Unexpected failures are `500 internal`.
217
224
 
218
225
  The same deployment serves the web dashboard through `/api/web/repos/{repo}/…`.
219
226
  That route is not a second public bearer-token API: it requires a current
220
- Better Auth HTTP-only cookie, rechecks the deployment email and repository
221
- allowlists, rejects cross-origin JSON controls, and delegates only the dashboard,
227
+ Better Auth HTTP-only cookie, rechecks the deployment current organization membership and project registration, rejects cross-origin JSON controls, and delegates only the dashboard,
222
228
  build, settings, and harvest operator suffixes listed above. It replaces caller-supplied authorization/version
223
229
  headers with a server-minted token that expires after 30 seconds and carries
224
230
  the normalized signed-in email. Consequently every durable control event has
@@ -246,7 +252,10 @@ invocation hides the holder start or the latest stop. Other state reads retain
246
252
  their bounded semantics.
247
253
 
248
254
  Repository-following `ab watch` additionally emits a read-only `dispatcher.lost`
249
- observation when an observed lease expires without a matching stop. JSON carries
255
+ observation when an observed lease expires without a matching stop or validated
256
+ successor takeover. A completed ownership transfer suppresses predecessor loss
257
+ even while its sessions drain; a handoff without takeover still reports loss on
258
+ expiry. Successor loss and upgrade-failure/rollback attention remain independent. JSON carries
250
259
  `observation` instead of `event`, with run, observedAt, leaseExpiresAt and available
251
260
  identity, plus the usual repo/build/state/cursor fields. It invents no durable
252
261
  sequence or actor. Retain the cursor to avoid repeat reports across invocations.
@@ -264,7 +273,7 @@ The default watch reports actionable conditions only:
264
273
 
265
274
  - Build `escalation.raised`, `integration.landed`, `node.item-conflicted`, or
266
275
  conflicted `restack.replayed` events. `build.consent-ready` is the single
267
- signal for a ready consent or held landing, including first repository-wide
276
+ signal for a ready consent or held merge, including first repository-wide
268
277
  discovery. Its target has the queue entry shape `{kind, branch, ticket?, build?}`.
269
278
  Unready and stale candidates stay silent. `build.merge-decision` remains for
270
279
  current actionable merge-gate deferrals and unsafe forge outcomes, once per
@@ -309,7 +318,7 @@ learn their outcomes from status reconciliation at exit.
309
318
 
310
319
  `ab wait --for attention` is build-only and uses the same build conditions:
311
320
  current failed node verification, an open escalation, janitor failure attention,
312
- consent readiness, landing/conflict attention or a merge decision. Current failed
321
+ consent readiness, merge/conflict attention or a merge decision. Current failed
313
322
  verification satisfies attention even before its notification is written. Existing conditions return immediately,
314
323
  even with `--since`; live and backlog matches ignore routine outcomes and
315
324
  self-healing failures. A merge match uses the watch observation with
@@ -326,9 +335,9 @@ Metadata-only patches are accepted. Target validation and demotion guards apply
326
335
  to CLI, HTTP and MCP alike; unsupported sources refuse even explicit defaults
327
336
  or clears before changing other fields. Dispatch routing is unchanged.
328
337
 
329
- Landing controls use `land` and `hold` with acknowledged durable state. Land
330
- requires readiness and survives restacks; hold persists until land. Repository
331
- auto-merge settings are retired; configure ordered `[[landing]]` rules.
338
+ HTTP merge controls retain the wire actions `land` and `hold` with acknowledged durable state. Merge
339
+ requires readiness and survives restacks; hold persists until merge. Repository
340
+ auto-merge settings are retired; configure ordered `[[merge]]` rules.
332
341
 
333
342
  Default attention includes `build.janitor-failing` and
334
343
  `dispatcher.forge-persistent`. Raw `dispatcher.forge-degraded` and
@@ -373,3 +382,70 @@ repository attention. `dispatcher.rollback-hold-cleared` records a different
373
382
  successfully resolved target. The rollback hold survives store compatibility
374
383
  changes, resolution errors and upgrade opt-out; a new operator-launch lineage
375
384
  ignores old holds. Preflight failure suppression above remains separate.
385
+
386
+
387
+ ## Organization management (browser)
388
+
389
+ These same-origin cookie-session routes are the management contract. Mutations
390
+ require the exact `BETTER_AUTH_URL` Origin and `application/json`, accept at most
391
+ 8192 characters of JSON, and reject unsupported fields. Responses are private,
392
+ no-store. No client-supplied actor or role is trusted. Raw Better Auth
393
+ `/api/auth/organization/*` routes are disabled, including invitations.
394
+
395
+ ### Discovery and bootstrap
396
+
397
+ `GET /api/web/orgs` returns
398
+ `{isSuperUser,organizations:[{id,name,slug,ownerEmail,membershipRole}]}`.
399
+ Every admitted operator can discover their own organizations. Super users see
400
+ all organizations; their membershipRole is null where they are not members.
401
+ Roles are `owner` and `member`; ownerEmail is null for an ownerless organization.
402
+ Results sort by slug then ID. Members may inspect and read rosters in their own
403
+ organizations, including member emails. Foreign organizations return 403 before
404
+ resource detail. A multi-org member uses these IDs for explicit connect selection.
405
+
406
+ To bootstrap, sign in as a super user configured by
407
+ `AB_WEB_SUPER_USER_EMAILS`, then POST `{name,slug}` to `/api/web/orgs`.
408
+ The response is 201 `{organization}` in the discovery shape. Names are nonblank
409
+ and at most 100 characters; slugs are unique lowercase kebab strings of at most
410
+ 100 characters. Creation grants no membership. The account menu links every
411
+ operator to `/members`, and super users to `/organizations` and `/projects`.
412
+ These separate pages show acknowledged reads, refresh after writes, and confirm
413
+ member removal and project moves inline before writing.
414
+
415
+ Super users and the organization’s members can GET `/api/web/orgs/:orgId` for
416
+ `{organization,projects:[repo]}` with active owned projects and the caller’s actual
417
+ membershipRole. Only super users can GET `/api/web/projects/unassigned` for `{projects:[repo]}`. The latter
418
+ contains every active registered project without an assignment, including legacy
419
+ registrations; removed entries are excluded. Projects sort lexically.
420
+
421
+ ### Members and owner
422
+
423
+ Super users and the organization's members can GET
424
+ `/api/web/orgs/:orgId/members` for `{members:[{email,role,name,status}]}`.
425
+ `name` is a known persisted identity name or null; `status` is `joined` when a
426
+ normalized-email auth identity exists, otherwise `pending`. Grants are the roster
427
+ source; identities enrich them without duplicating rows. An existing identity
428
+ added to another organization is joined immediately.
429
+ Only super users and owners may POST `{email}` to that path for `{member}` or
430
+ DELETE `{email}` for `{removed:true}`.
431
+ Emails normalize before matching, grants work before first sign-in, and duplicate
432
+ adds preserve the existing role. An owner cannot remove themselves. Ordinary
433
+ members can read their own rosters but cannot mutate membership.
434
+
435
+ Only super users can PUT `{email:string|null}` to
436
+ `/api/web/orgs/:orgId/owner`, returning `{organization}`. A non-null owner must
437
+ already be a member. Transfer demotes the previous owner; null clears ownership.
438
+ Removing an owner as a super user also clears ownership. An org can have no owner.
439
+
440
+ ### Project assignment and errors
441
+
442
+ Only super users can PUT `{repo}` to `/api/web/orgs/:orgId/projects`, returning
443
+ `{repo,organizationId}`. The repo must be actively registered. This atomically
444
+ assigns or moves it. Registry removal retains assignment and history, but hides
445
+ the inactive project; re-registration restores that assignment.
446
+
447
+ Status codes are 401 for absent, malformed or expired sessions; 403 for admission
448
+ or role refusal; 400 for invalid inputs; 404 for missing resources after role
449
+ checks; 409 for duplicate slugs; and sanitized 503 for store outages. Foreign
450
+ projects return the same unknown-repository result as absent projects. Machine
451
+ credentials and the hosted-store administration CLI keep their existing behavior.
@@ -10,7 +10,7 @@ order: 12
10
10
 
11
11
  ## Responsibility
12
12
 
13
- Operator surfaces are where you and your operator agent inspect tickets and builds, answer escalations, pause work and authorize landing. Autobuild never hosts or starts your agent; it runs anywhere.
13
+ Operator surfaces are where you and your operator agent inspect tickets and builds, answer escalations, pause work and authorize merge. Autobuild never hosts or starts your agent; it runs anywhere.
14
14
 
15
15
  ## Shipped arrangements
16
16
 
@@ -34,6 +34,8 @@ bun ab build status example-build --json
34
34
 
35
35
  - Interactive `dispatch` shows the terminal dashboard.
36
36
  - A shell-capable agent follows progress and acts through the CLI, including `bun ab watch` and `bun ab wait`.
37
+ - A standing CLI operator uses `bun ab watch --operator --json` after checking `bun ab repository status --json` for existing presence. It operates the builds the repository's dispatcher dispatches and adopts new ones.
38
+ - Presence is advisory, allows multiple registrations, and is not exposed by MCP or the web app. Termination attempts withdrawal; routine timeout/count re-arms keep the five-minute grace. SIGKILL and failed withdrawal rely on TTL expiry.
37
39
  - Dashboard and API share one lifecycle vocabulary.
38
40
 
39
41
  A local CLI can use a remote Store:
@@ -55,8 +57,10 @@ readyState = "ready"
55
57
 
56
58
  The hosted web app shows registered repositories and their builds.
57
59
 
58
- - **Sign-in** uses the deployment's GitHub authentication and email allowlist, independent of CLI credentials.
59
- - **Secrets** (database, blob, signing, OAuth, allowlist) stay on the service, never in TOML or browser bundles.
60
+ - **Sign-in** uses the deployment's GitHub authentication and organization membership policy, independent of CLI credentials.
61
+ - **Merge consent:** a merge awaiting consent offers **Merge** and **Hold**. These record durable actions; readiness and merge gates still apply. See [Authorize merge](operating.md#authorize-merge).
62
+ - **Appearance:** open the account menu and choose **System**, **Light** or **Dark** under **Theme**. System is the default and follows the OS preference. Your choice is saved for this browser.
63
+ - **Secrets** (database, blob, signing, OAuth, super-user list) stay on the service, never in TOML or browser bundles.
60
64
 
61
65
  ### Local stdio MCP
62
66
 
@@ -75,7 +79,7 @@ bun ab mcp
75
79
 
76
80
  A remote agent connects its MCP client to `https://builds.example.com/mcp` over Streamable HTTP.
77
81
 
78
- - **Authentication:** OAuth with discovery, dynamic registration, PKCE and rotating refresh tokens, authorized through the deployment's sign-in and allowlist. `AB_TOKEN` doesn't substitute.
82
+ - **Authentication:** OAuth with discovery, dynamic registration, PKCE and rotating refresh tokens, authorized through the deployment's sign-in and organization membership. `AB_TOKEN` doesn't substitute.
79
83
  - **Every call** rechecks access and repository scope.
80
84
  - **Writes** record the authorizing identity and MCP client.
81
85
 
package/docs/overview.md CHANGED
@@ -12,7 +12,7 @@ slug: ""
12
12
  Autobuild runs coding agents through a fixed pipeline that takes a groomed ticket to a verified pull request, with a separate workspace for each build. Three actors keep that work moving:
13
13
 
14
14
  - **You** decide goals, scope, tradeoffs, and how much authority to delegate.
15
- - **Your operator agent** is an external agent that writes specs, files and grooms tickets, watches builds, and answers questions within your instructions. The `ab` CLI is primarily its interface; remote agents use MCP.
15
+ - **Your operator agent** is an external agent that writes specs, files and grooms tickets, operates the builds the repository's dispatcher dispatches, and answers questions within your instructions. The `ab` CLI is primarily its interface; remote agents use MCP.
16
16
  - **The dispatcher** claims ready work and runs the durable pipeline, including isolated agent sessions, checks, and publication.
17
17
 
18
18
 
@@ -25,10 +25,10 @@ The dispatcher claims ready tickets up to your configured capacity and runs each
25
25
  1. **Spec.** The ticket's spec becomes the build's contract.
26
26
  2. **Plan and plan review.** An agent proposes a plan; an independent reviewer checks it against the spec and can request revisions.
27
27
  3. **Implement and code review.** An agent commits the change; a fresh reviewer's findings send it back for another round.
28
- 4. **Verify.** Your configured checks, commands or agent verifiers, run in order; a failure returns the build to implementation. This effectively replaces CI.
28
+ 4. **Verify.** Your configured checks, commands or agent verifiers, run in ordered stages whose members may run concurrently. A failed stage settles, then returns every failed report to implementation. See [Verification](verification.md). This effectively replaces CI.
29
29
  5. **Finalize.** An agent writes the pull request description and Autobuild opens the PR.
30
30
 
31
- Landing depends on the configured policy and merge gates. Conflicts are reconciled, then verified again. Related work can be collected into an integration tree before landing.
31
+ Merge depends on the configured policy and merge gates. Conflicts are reconciled, then verified again. Related work can be collected into an integration tree before merge.
32
32
 
33
33
 
34
34
  ## Where it fits