@defrex/autobuild 1.10.0 → 1.11.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 (255) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +745 -69
  3. package/bin/ab-dispatch-generation.ts +3 -1
  4. package/docs/accounts.md +2 -1
  5. package/docs/answering-blocked-builds.md +20 -0
  6. package/docs/architecture.md +165 -29
  7. package/docs/build-store.md +10 -7
  8. package/docs/cli.md +33 -1
  9. package/docs/configuration-overview.md +4 -1
  10. package/docs/configuration.md +381 -29
  11. package/docs/dispatcher.md +64 -4
  12. package/docs/forges.md +7 -0
  13. package/docs/integration-tree.md +2 -2
  14. package/docs/operating.md +4 -2
  15. package/docs/operator-api.md +134 -6
  16. package/docs/operator-surfaces.md +85 -0
  17. package/docs/optimization-nodes.md +69 -11
  18. package/docs/plugin-authoring.md +37 -1
  19. package/docs/remote-store-protocol.md +94 -13
  20. package/docs/remote-ticket-protocol.md +40 -0
  21. package/docs/restacking.md +20 -4
  22. package/docs/setup.md +14 -2
  23. package/docs/ticket-dependencies.md +10 -3
  24. package/docs/ticket-sources.md +24 -2
  25. package/docs/tickets.md +7 -1
  26. package/docs/troubleshooting.md +8 -0
  27. package/docs/verification.md +4 -3
  28. package/docs/workspaces.md +3 -0
  29. package/package.json +9 -5
  30. package/packages/core/src/cli/accounts.ts +7 -2
  31. package/packages/core/src/cli/attention.ts +3 -1
  32. package/packages/core/src/cli/binary-direct.ts +2 -0
  33. package/packages/core/src/cli/binary-lifecycle.ts +2 -1
  34. package/packages/core/src/cli/build-control.ts +79 -1
  35. package/packages/core/src/cli/context.ts +4 -0
  36. package/packages/core/src/cli/dashboard/facts.ts +49 -53
  37. package/packages/core/src/cli/dashboard/header.ts +111 -0
  38. package/packages/core/src/cli/dashboard/model.ts +31 -39
  39. package/packages/core/src/cli/dashboard/objective-row.ts +46 -14
  40. package/packages/core/src/cli/dashboard/poll.ts +179 -76
  41. package/packages/core/src/cli/dashboard/render.ts +159 -230
  42. package/packages/core/src/cli/dashboard/row-text.ts +538 -0
  43. package/packages/core/src/cli/dashboard/timeline.ts +288 -0
  44. package/packages/core/src/cli/dashboard/vocabulary.ts +188 -0
  45. package/packages/core/src/cli/dispatch-args.ts +44 -1
  46. package/packages/core/src/cli/dispatch-frontend.ts +40 -40
  47. package/packages/core/src/cli/dispatch-launch-stop.ts +18 -0
  48. package/packages/core/src/cli/dispatch-launcher.ts +20 -7
  49. package/packages/core/src/cli/dispatch-web.ts +155 -0
  50. package/packages/core/src/cli/dispatch.ts +202 -38
  51. package/packages/core/src/cli/help.ts +87 -3
  52. package/packages/core/src/cli/init-validation.ts +3 -3
  53. package/packages/core/src/cli/main.ts +70 -6
  54. package/packages/core/src/cli/mcp.ts +35 -3
  55. package/packages/core/src/cli/objective.ts +1 -1
  56. package/packages/core/src/cli/operator-preference.ts +57 -0
  57. package/packages/core/src/cli/repo-lease.ts +2 -0
  58. package/packages/core/src/cli/repo-state.ts +56 -6
  59. package/packages/core/src/cli/repository-status.ts +105 -49
  60. package/packages/core/src/cli/status.ts +82 -1
  61. package/packages/core/src/cli/terminal-restore.ts +32 -7
  62. package/packages/core/src/cli/ticket.ts +98 -36
  63. package/packages/core/src/cli/wait.ts +14 -6
  64. package/packages/core/src/cli/watch.ts +20 -4
  65. package/packages/core/src/cli/web.ts +139 -0
  66. package/packages/core/src/config/live.ts +99 -14
  67. package/packages/core/src/config/load.ts +61 -20
  68. package/packages/core/src/config/local.ts +212 -0
  69. package/packages/core/src/config/pipeline-source.ts +2 -0
  70. package/packages/core/src/config/reference.ts +18 -0
  71. package/packages/core/src/config/schema.ts +45 -10
  72. package/packages/core/src/events/catalog.ts +4 -0
  73. package/packages/core/src/events/payloads.ts +97 -0
  74. package/packages/core/src/events/policy.ts +10 -0
  75. package/packages/core/src/events/repository.ts +46 -3
  76. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +381 -30
  77. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/017d8dd5bb6dd80b.json.gz +0 -0
  78. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/178e12f1759b7552.json.gz +0 -0
  79. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4932c70a2af97faf.json.gz +0 -0
  80. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/536085773daf6b58.json.gz +0 -0
  81. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6bd6275061aaffa5.json.gz +0 -0
  82. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/89625654b02e9ac1.json.gz +0 -0
  83. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a98af134be2da8a9.json.gz +0 -0
  84. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d5d5ccca80a893d8.json.gz +0 -0
  85. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f8155387eb5f375c.json.gz +0 -0
  86. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/3c27f918b194e3b3.json +465 -0
  87. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/46196d8f0076496a.json +97 -0
  88. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/79f0e0f4ccd43ba2.json +455 -0
  89. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/859c09edac738823.json +1086 -0
  90. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a283c1f3462b1cc1.json +81 -0
  91. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a6e570fb126991ff.json +36 -0
  92. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a8acf22c968b6e3d.json +81 -0
  93. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/ba7b85895bf6698e.json +1153 -0
  94. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/fc66408cde0b6b04.json +637 -0
  95. package/packages/core/src/kernel/build-roster.ts +230 -0
  96. package/packages/core/src/kernel/dispatch-capacity.ts +4 -2
  97. package/packages/core/src/kernel/dispatch-status.ts +139 -0
  98. package/packages/core/src/kernel/engine.ts +43 -5
  99. package/packages/core/src/kernel/execution-intervals.ts +61 -0
  100. package/packages/core/src/kernel/generators/optimization-log.ts +101 -0
  101. package/packages/core/src/kernel/generators/repository-journals.ts +13 -0
  102. package/packages/core/src/kernel/leaf-restack-base.ts +33 -7
  103. package/packages/core/src/kernel/leaf-restack-state.ts +82 -3
  104. package/packages/core/src/kernel/log-index.ts +19 -0
  105. package/packages/core/src/kernel/optimization-admission.ts +244 -3
  106. package/packages/core/src/kernel/optimization.ts +183 -4
  107. package/packages/core/src/kernel/phase-failures.ts +121 -0
  108. package/packages/core/src/kernel/published-branch-head.ts +60 -0
  109. package/packages/core/src/kernel/read-facts.ts +15 -13
  110. package/packages/core/src/kernel/reducer-registry.ts +27 -8
  111. package/packages/core/src/kernel/reducer-revisions.ts +27 -0
  112. package/packages/core/src/kernel/reducer.ts +63 -4
  113. package/packages/core/src/kernel/rollup.ts +61 -0
  114. package/packages/core/src/kernel/setup-streak.ts +38 -0
  115. package/packages/core/src/kernel/step-durations.ts +257 -0
  116. package/packages/core/src/kernel/target-observation.ts +6 -1
  117. package/packages/core/src/kernel/target-rewrite-recovery.ts +116 -0
  118. package/packages/core/src/kernel/verify-diff-base.ts +5 -0
  119. package/packages/core/src/kernel/verify-stages.ts +13 -3
  120. package/packages/core/src/ontology.ts +5 -0
  121. package/packages/core/src/operator/agent-context-serve.ts +631 -0
  122. package/packages/core/src/operator/annotations.ts +75 -5
  123. package/packages/core/src/operator/attention.ts +470 -0
  124. package/packages/core/src/operator/canonical-skills.ts +35 -0
  125. package/packages/core/src/operator/cli-equivalents.ts +270 -0
  126. package/packages/core/src/operator/context-prompts.ts +61 -0
  127. package/packages/core/src/operator/index.ts +49 -1
  128. package/packages/core/src/operator/landings.ts +28 -19
  129. package/packages/core/src/operator/optimization.ts +7 -0
  130. package/packages/core/src/operator/protocol.ts +3 -0
  131. package/packages/core/src/operator/query.ts +129 -74
  132. package/packages/core/src/operator/read-view.ts +5 -2
  133. package/packages/core/src/operator/registry.ts +406 -46
  134. package/packages/core/src/operator/requests.ts +20 -18
  135. package/packages/core/src/operator/sandbox-host.ts +107 -11
  136. package/packages/core/src/operator/sandbox-resolver.ts +253 -0
  137. package/packages/core/src/operator/sandbox.ts +778 -82
  138. package/packages/core/src/operator/ticket-asset-list.ts +77 -0
  139. package/packages/core/src/operator/ticket-assets.ts +167 -0
  140. package/packages/core/src/operator/tickets.ts +33 -2
  141. package/packages/core/src/plugin-sdk/index.ts +22 -0
  142. package/packages/core/src/plugins/manifest.ts +1 -1
  143. package/packages/core/src/ports/forge/fake.ts +92 -1
  144. package/packages/core/src/ports/forge/git-blob.ts +15 -0
  145. package/packages/core/src/ports/forge/github.ts +82 -0
  146. package/packages/core/src/ports/forge/local-git.ts +61 -1
  147. package/packages/core/src/ports/forge-failure.ts +24 -0
  148. package/packages/core/src/ports/runner/antigravity-test.fixture.ts +149 -0
  149. package/packages/core/src/ports/runner/claude-test.fixture.ts +71 -0
  150. package/packages/core/src/ports/runner/codex-test.fixture.ts +63 -0
  151. package/packages/core/src/ports/tickets/contract.ts +71 -0
  152. package/packages/core/src/ports/tickets/fake.ts +11 -0
  153. package/packages/core/src/ports/tickets/file.ts +18 -0
  154. package/packages/core/src/ports/tickets/github-fake.ts +136 -4
  155. package/packages/core/src/ports/tickets/github.ts +387 -30
  156. package/packages/core/src/ports/tickets/hosted-index.ts +10 -0
  157. package/packages/core/src/ports/tickets/linear.ts +130 -0
  158. package/packages/core/src/ports/tickets/priority.ts +9 -0
  159. package/packages/core/src/ports/tickets/remote-protocol.ts +34 -0
  160. package/packages/core/src/ports/tickets/remote.ts +70 -6
  161. package/packages/core/src/ports/tickets/search.ts +139 -0
  162. package/packages/core/src/ports/types.ts +104 -2
  163. package/packages/core/src/ports/workspace/builtin-capabilities.ts +9 -0
  164. package/packages/core/src/ports/workspace/create.ts +15 -1
  165. package/packages/core/src/ports/workspace/fake.ts +340 -12
  166. package/packages/core/src/ports/workspace/git-worktree.ts +833 -42
  167. package/packages/core/src/ports/workspace/operator-sandbox.ts +129 -12
  168. package/packages/core/src/ports/workspace/process-group.ts +48 -0
  169. package/packages/core/src/ports/workspace/vercel-sandbox.ts +1260 -123
  170. package/packages/core/src/processes/agent-context-assemble.ts +576 -0
  171. package/packages/core/src/processes/agent-context.ts +469 -0
  172. package/packages/core/src/processes/build-runner.ts +387 -236
  173. package/packages/core/src/processes/dispatcher.ts +211 -55
  174. package/packages/core/src/processes/execution-no-progress.ts +4 -0
  175. package/packages/core/src/processes/optimization-activity.ts +120 -0
  176. package/packages/core/src/processes/phase-failure-budget.ts +1 -0
  177. package/packages/core/src/processes/repo-view.ts +78 -2
  178. package/packages/core/src/processes/sandbox-state.ts +53 -6
  179. package/packages/core/src/processes/tick-publication.ts +2 -0
  180. package/packages/core/src/processes/workspace-preparation.ts +76 -0
  181. package/packages/core/src/scenarios/harness.ts +0 -5
  182. package/packages/core/src/store/account-redaction.ts +1 -0
  183. package/packages/core/src/store/adapter.ts +52 -1
  184. package/packages/core/src/store/agent-context.ts +432 -0
  185. package/packages/core/src/store/build-feed.ts +291 -0
  186. package/packages/core/src/store/build-scope.ts +19 -1
  187. package/packages/core/src/store/contract.ts +911 -14
  188. package/packages/core/src/store/digest.ts +19 -6
  189. package/packages/core/src/store/histogram.ts +113 -0
  190. package/packages/core/src/store/local/schema.ts +62 -0
  191. package/packages/core/src/store/local/store.ts +628 -22
  192. package/packages/core/src/store/local/ticket-asset-heads.ts +23 -0
  193. package/packages/core/src/store/memory.ts +461 -69
  194. package/packages/core/src/store/open-builds.ts +19 -0
  195. package/packages/core/src/store/phase-session.ts +32 -4
  196. package/packages/core/src/store/reduced-reads.ts +14 -4
  197. package/packages/core/src/store/reducer-value-shapes.json +7027 -5751
  198. package/packages/core/src/store/reducer-values.ts +6 -1
  199. package/packages/core/src/store/remote/client.ts +208 -2
  200. package/packages/core/src/store/remote/compatibility.ts +1 -1
  201. package/packages/core/src/store/remote/index.ts +33 -0
  202. package/packages/core/src/store/remote/protocol.ts +69 -0
  203. package/packages/core/src/store/remote/released-clients.json +22 -0
  204. package/packages/core/src/store/remote/released-reducer-values/1.11.0.json +35680 -0
  205. package/packages/core/src/store/remote/released-reducer-values/1.11.1.json +35718 -0
  206. package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
  207. package/packages/core/src/store/retention.ts +23 -1
  208. package/packages/core/src/store/rollups.ts +337 -0
  209. package/packages/core/src/store/session-handle.ts +20 -2
  210. package/packages/core/src/store/snapshots.ts +10 -0
  211. package/packages/core/src/store/types.ts +108 -9
  212. package/packages/core/src/testing/dispatch-journals.ts +117 -0
  213. package/packages/core/src/testing/dispatch-read-budget.ts +1092 -2
  214. package/packages/core/src/testing/git-config-isolation.ts +7 -5
  215. package/packages/core/src/testing/index.ts +27 -0
  216. package/packages/core/src/testing/memory-operator-sandbox.ts +346 -0
  217. package/packages/core/src/testing/reduced-read-budget.ts +1873 -98
  218. package/packages/core/src/web/analytics-source.ts +303 -0
  219. package/packages/core/src/web/assets/Atkinson-OFL.txt +93 -0
  220. package/packages/core/src/web/assets/AtkinsonHyperlegibleNext.latin.woff2 +0 -0
  221. package/packages/core/src/web/assets/JetBrains-OFL.txt +93 -0
  222. package/packages/core/src/web/assets/JetBrainsMono.latin.woff2 +0 -0
  223. package/packages/core/src/web/assets/app.css +1 -0
  224. package/packages/core/src/web/assets/app.js +9 -0
  225. package/packages/core/src/web/assets/manifest.json +31 -0
  226. package/packages/core/src/web/assets/theme.js +1 -0
  227. package/packages/core/src/web/bounded.ts +31 -0
  228. package/packages/core/src/web/http.ts +315 -0
  229. package/packages/core/src/web/hub.ts +160 -0
  230. package/packages/core/src/web/options.ts +38 -0
  231. package/packages/core/src/web/overview-source.ts +322 -0
  232. package/packages/core/src/web/page.ts +56 -0
  233. package/packages/core/src/web/protocol.ts +151 -0
  234. package/packages/core/src/web/read-only.ts +23 -0
  235. package/packages/core/src/web/repository-source.ts +39 -0
  236. package/packages/core/src/web/server.ts +97 -0
  237. package/skills/code-review/SKILL.md +10 -2
  238. package/skills/guide/SKILL.md +376 -54
  239. package/skills/guide/references/accounts.md +2 -1
  240. package/skills/guide/references/integration-tree.md +2 -2
  241. package/skills/guide/references/operator-api.md +134 -6
  242. package/skills/guide/references/optimization-nodes.md +69 -11
  243. package/skills/guide/references/plugin-authoring.md +37 -1
  244. package/skills/guide/references/remote-store-protocol.md +94 -13
  245. package/skills/guide/references/remote-ticket-protocol.md +40 -0
  246. package/skills/guide/references/restacking.md +20 -4
  247. package/skills/guide/references/setup.md +14 -2
  248. package/skills/guide/references/ticket-dependencies.md +10 -3
  249. package/skills/implement/SKILL.md +23 -4
  250. package/skills/operate/SKILL.md +134 -32
  251. package/skills/plan/SKILL.md +10 -4
  252. package/skills/plan-review/SKILL.md +9 -2
  253. package/skills/spec/SKILL.md +34 -8
  254. package/skills/tickets/SKILL.md +51 -5
  255. package/templates/hosted-service/package.json +2 -2
@@ -86,7 +86,9 @@ try {
86
86
  )
87
87
  try {
88
88
  const { runDirectBinary } = await import('../packages/core/src/cli/binary-direct')
89
- const result = await runDirectBinary(process.argv.slice(2))
89
+ // Supervised: a drained SIGQUIT returns here and exits
90
+ // GENERATION_EXITS.stopped, which every v1 launcher reads as a stop.
91
+ const result = await runDirectBinary(process.argv.slice(2), undefined, { supervised: true })
90
92
  holdDrainedStop(() => process.exit(result === 0 ? GENERATION_EXITS.stopped : result))
91
93
  code =
92
94
  result === 0
package/docs/accounts.md CHANGED
@@ -130,7 +130,8 @@ others choose local storage. The destination is shown before the browser opens.
130
130
  OpenAI handles consent and authorization. No token is printed.
131
131
 
132
132
  Local credentials live in protected, ignored main-checkout
133
- `.autobuild/accounts/` state shared by worktrees. Project sign-in transfers
133
+ `.autobuild/accounts/` state. Worktrees reach it through the main checkout,
134
+ wherever they live. Project sign-in transfers
134
135
  credentials directly to the encrypted refreshing project secret named by
135
136
  `credentialEnv`; it retains no renewable credential locally. This name
136
137
  identifies a host access-token slot, not a refresh token supplied in TOML.
@@ -13,6 +13,7 @@ Every action below is sessionless, records a human-authored fact, and accepts
13
13
  | Retire a review disagreement | `ab answer <slug> --dismiss` | Records `dismiss-finding` for each escalation that cites a real finding id. The next reviewer is told not to re-raise that chain. |
14
14
  | Replace the build contract from a file | `ab answer <slug> --revise-spec <file>` | Records the replacement as the next spec revision and restarts leaves at `plan`; nodes recollect and verify. |
15
15
  | Re-import an amended ticket | `ab answer <slug> --revise-spec-from-ticket` | Reads the build's recorded ticket and performs the same revision. |
16
+ | Accept a rewritten target | `ab answer <slug> --accept-target` | Answers only a `target-rewritten` escalation; the build's own commits restack onto the current target. See [A rewritten target](#a-rewritten-target). |
16
17
  | Abandon the build | `ab abort <slug> [--to ready] [--reason <text>]` | Irrevocably requests abort; cleanup returns the ticket to Triage, or with `--to ready` to Ready with its blockers kept, and then reports `ticket.handed-back`. Ready requires the current ticket to meet the spec standard; otherwise cleanup returns it to Triage, and the comment and event name the requested destination and the missing parts. An [optimization attempt](optimization-nodes.md#landing-and-settlement) is the exception: its abort settles `aborted`, ignores `--to`, reports no `ticket.handed-back`, and the node moves the ticket to Rejected after cleanup. |
17
18
 
18
19
  The dashboard's blocked-build `r` shortcut requests an inline answer step that
@@ -44,6 +45,25 @@ startup, a successful attempt closes it unanswered, and a bare retry only brings
44
45
  the next attempt forward. Startup still recovers unblocked work and acknowledges
45
46
  pending operator commands.
46
47
 
48
+ ## A rewritten target
49
+
50
+ When a leaf's target branch is force-pushed so that it no longer descends
51
+ from the build's base, Autobuild never adopts it on top of the build's work by
52
+ itself:
53
+
54
+ - A build with no work of its own (no published head, no PR, no commits beyond
55
+ its base) is reprovisioned from the current target by its next runner and
56
+ continues without an answer.
57
+ - A build with work raises one escalation whose question begins `target main
58
+ was rewritten`, naming the rejected base, the new target head and the build's
59
+ own commits. Later rewrites of the same base raise nothing new.
60
+
61
+ Answer it with `ab answer <slug> --accept-target` to restack those commits onto
62
+ the current target before any further verification, or abort the build. Other
63
+ answer forms skip this escalation. If the accept finds unpublished local
64
+ commits that no open phase owns, it is refused with a fresh escalation listing
65
+ them.
66
+
47
67
  ## Ending a ticket wait
48
68
 
49
69
  A build whose agent ran `ab wait-on` asks to wait on other tickets. Until the
@@ -88,6 +88,7 @@ remote-store protocol requires matching client and server versions.
88
88
  | `packages/core/src/harvest/` | Structured occurrence, scan packet, proposal, and ledger schemas | §12 |
89
89
  | `packages/core/src/store/session-reducer.ts` | The operator-session reducer: status, open turn, pending approval, wake settings and cursors, and the turn list, reduced purely from the session event log | §7.1.1 |
90
90
  | `packages/core/src/store/` | BuildStore contract spanning builds, the repository journal, and operator sessions; interface-enforced build, operator-session, and local ambient-session scope wrappers; memory, SQLite/blob, and remote HTTP adapters | §7 |
91
+ | `packages/core/src/store/agent-context.ts` | The repository agent-context record, pointer and continuation-slot codecs, their size bounds, and the latest-revision reader | §12 |
91
92
  | `packages/core/src/store/streams/` | The stream primitive's shared core (§7.6): record/chunk types and the `ai-ui-message-stream/v1` constants, SDK-backed close-time `UIMessage[]` assembly, and the uniform bounded-wait read loop | §7.6 |
92
93
  | `packages/hosted-store-service/` | Environment-only hosted Fetch handler, lazy PostgreSQL/blob composition, offline token binary, the Next.js operator web app (`app/`, `server.ts`, `next.config.ts`, `vercel.json`), tests, and deployment guide | §7.2, §18 |
93
94
  | `packages/hosted-dispatcher/` | The optional cron-driven hosted dispatcher: endpoint driver, deploy-time `pack-distribution` and `ship-deployment` binary, packed-distribution trace helper, Git stager (`ship-git.ts`, `elf.ts`) and runtime locator (`shipped-git.ts`), provider plugin shipper, tests, and operator guide | §7.2, §12, §18 |
@@ -97,11 +98,11 @@ remote-store protocol requires matching client and server versions.
97
98
  | `packages/core/src/ports/` | TicketSource / Workspace / Forge / AgentRunner / Telemetry interfaces, adapters, and fakes; registry-aware builtin/plugin construction; eager primary/alternate runtime routing and provider-failure classification, awaited native identity observation and optional fresh-process native resume under `ports/runner/` | §3.2, §9, §13 |
98
99
  | `packages/core/src/plugins/` | Strict versioned plugin manifests, dual-root repository/package Bun loading, owner-aware adapter registration, contract/credential metadata, and runtime-factory materialization | §3.2.1, §9 |
99
100
  | `packages/core/src/plugin-sdk/` | The sole supported `@defrex/autobuild/plugin-sdk` barrel: port/manifest types, contract suites, and reference fakes | §3.2.1 |
100
- | `packages/core/src/processes/` | build-runner and standalone child composition, durable execution config/diagnostics, dispatcher (+ janitor duty, sandbox idle settlement and harvest trigger), harvest deterministic core + runner, configured hook delivery (`hooks.ts`, `hook-command.ts`, `hook-webhook.ts`) | §3.3, §7.1.2, §12, §15.7, §16.1 |
101
- | `packages/core/src/cli/` and `bin/` | The `ab` CLI — the only agent↔store channel — plus the shared presentation-only durable-progress projection, init/upgrade, the filesystem-only dispatch launcher and immutable generation cache, the dispatch frontend (Store-backed, plus the viewer's ticket-source triage count), its private supervised kernel entry, and `bin/ab-build-runner.ts` (one child per build) | §8, §14, §16.3 |
101
+ | `packages/core/src/processes/` | build-runner and standalone child composition, durable execution config/diagnostics, dispatcher (+ janitor duty, sandbox idle settlement and harvest trigger), harvest deterministic core + runner, configured hook delivery (`hooks.ts`, `hook-command.ts`, `hook-webhook.ts`), repository agent-context capture (`agent-context.ts`, pure selection in `agent-context-assemble.ts`) | §3.3, §7.1.2, §12, §15.7, §16.1 |
102
+ | `packages/core/src/cli/` and `bin/` | The `ab` CLI — the only agent↔store channel — plus the shared presentation-only durable-progress projection, init/upgrade, the filesystem-only dispatch launcher and immutable generation cache, the dispatch frontend (Store-backed, plus the viewer's ticket-source triage count) and its in-process web server, its private supervised kernel entry, and `bin/ab-build-runner.ts` (one child per build) | §8, §14, §16.3 |
102
103
  | `packages/core/src/cli/dashboard/` | `ab dispatch`'s fixed live frame: pure projection, renderer, poll cache, and deterministic image renderer | §14 |
103
104
  | `bin/agent/ab` | Private launcher placed first on agent-session `PATH`; delegates to the canonical `bin/ab.ts` | §8.1 |
104
- | `packages/core/src/config/` | `autobuild.toml` parsing and strict validation, plus the pure role-key consumability diagnostics `ab dispatch` reports at startup (`roles.ts`); user reference in `docs/configuration.md` | §9, §16.1 |
105
+ | `packages/core/src/config/` | `autobuild.toml` parsing and strict validation, the allowlisted `.autobuild/local.toml` override layer (`local.ts`), plus the pure role-key consumability diagnostics `ab dispatch` reports at startup (`roles.ts`); user reference in `docs/configuration.md` | §9, §16.1 |
105
106
  | `packages/core/src/scenarios/` | End-to-end harness over a temporary Git origin and worktrees (integration tests) and product scenarios | — |
106
107
  | `tools/` | This repository's local maintainer tooling, including verification, dashboard capture, and release cutting; not shipped product behavior | — |
107
108
  | `skills/` | Canonical defaults; `ab init` vendors them to `.agents/skills/ab-*` and links `.claude/skills/ab-*` | §16.3 |
@@ -277,6 +278,24 @@ wrong-version or ahead-of-log rows are repaired only by comparing the exact row
277
278
  observed, atomically with the log boundary. A losing writer still returns its
278
279
  correct prefix. Missing or unreadable cache state replays; log failures propagate.
279
280
 
281
+ **Derived reducers.** A `{kind: 'rollup', repo}` scope answers a value across a
282
+ repository's builds (SPEC §7.7). `kernel/rollup.ts` defines the three parts (a
283
+ registered build reducer, a pure invertible contribution, an accumulator with
284
+ `add` and `subtract`); `ROLLUPS` in `kernel/reducer-registry.ts` registers them.
285
+ `kernel/step-durations.ts` is the first rollup, folding
286
+ `cli/dashboard/timeline.ts`'s `buildTimeline` segments into the log-scale
287
+ histograms of `store/histogram.ts`. `kernel/build-roster.ts` is the second:
288
+ its `buildRosterEntry` build reducer feeds `buildRoster`, the live builds plus
289
+ a capped history of the newest finished ones, which `ab web`'s overview starts
290
+ from. `store/rollups.ts` is the one engine every
291
+ adapter runs over a narrow `RollupStorage` port: fast path on an unchanged
292
+ change position, otherwise an advance by the changed-builds feed, serialized
293
+ per key and committed atomically with each build's absorbed contribution in
294
+ `reducer_snapshots`. The memory adapter serializes with a keyed mutex, SQLite
295
+ with a `rollup-lease` row, and Postgres with a transaction-scoped advisory lock
296
+ whose transaction runs every query of the advance. Remote clients make one
297
+ `rollup-values` request and require an equal version.
298
+
280
299
  The remote adapter makes one value request; only the finished answer crosses the
281
300
  wire. The service uses named effective-configuration references for hosted ticket
282
301
  operations (including policy publication) and semantic build/harvest lifecycle
@@ -293,8 +312,10 @@ source promise chains. Its build and journal facts come from persisted reduced
293
312
  values. Reads after an append or lost conditional append consult that boundary
294
313
  again, so no process-local memo suppresses a required delta. The adapter owns
295
314
  cache persistence and recovery; the view neither writes work bundles nor hydrates
296
- whole logs for decisions. Discovery uses persisted build digests, including for
297
- settled builds. Raw methods forward actual cursor event output.
315
+ whole logs for decisions. The dispatcher's discovery (`refresh`) uses persisted
316
+ build digests, including for settled builds. Operator passes discover through
317
+ `refreshOpen` and the store's `listOpenBuilds`, which never reads a settled
318
+ build. Raw methods forward actual cursor event output.
298
319
 
299
320
  JSON-safe companion projections preserve collection and optional-value contracts.
300
321
  The build facts projection returns one prefix for engine routing; its log-index
@@ -304,7 +325,10 @@ control, Harvest, and dispatcher run correlations. Lease metadata and clocks sta
304
325
  outside event reducers: liveness combines durable run facts with the current
305
326
  repository record and observation time, including an older lease holder hidden
306
327
  by a newer run. The shared repository value keeps a bounded recent-run window, including the
307
- latest started and stopped runs. Fresh invocations use those shared facts for
328
+ latest started and stopped runs. Its dispatch status (`foldReportedDispatch` in
329
+ `kernel/dispatch-status.ts`) describes the run holding authority rather than the
330
+ latest started: a start waits as one of at most 16 pending runs while a live,
331
+ ticked run is reported, and replaces it only by recording a tick boundary. Fresh invocations use those shared facts for
308
332
  first-tick publication, liveness and supervision without creating a cold
309
333
  parameterized cache. Older holder correlations can use `dispatcherRunFacts` for
310
334
  the requested historical run. A never-started fresh invocation does not request
@@ -646,8 +670,10 @@ identical observations append nothing. `dispatch-frontend.ts` owns only terminal
646
670
  `dispatch-process.ts` owns child supervision. SIGINT, SIGHUP, SIGQUIT, and
647
671
  SIGTERM restore terminal modes immediately and begin one supervised drain;
648
672
  persistent frontend and child handlers keep repeated signals graceful until the
649
- kernel child is reaped, after which a non-SIGINT terminating signal is replayed
650
- in the frontend. A parent-liveness watch remains the detached-kernel fallback.
673
+ kernel child is reaped, after which SIGHUP and SIGTERM are replayed in the
674
+ frontend, while a drained SIGQUIT exits 131 rather than dumping core. A
675
+ supervised generation returns SIGQUIT through `GENERATION_EXITS.stopped` and
676
+ the launcher exits 131. A parent-liveness watch remains the detached-kernel fallback.
651
677
  The repository record carries constant-size, lease-holder-fenced tick telemetry:
652
678
  `beginRepoTick` opens the unsafe boundary, and `finishRepoTick` atomically closes
653
679
  it and appends selected tick facts. Unchanged standing ticket counts and diagnostics do
@@ -765,7 +791,8 @@ raise `BuildScopeError`. The shared Store suite applies these checks to memory,
765
791
  SQLite, and remote clients, while HTTP token scope remains defense in depth.
766
792
 
767
793
  **Live configuration.** `packages/core/src/config/live.ts` owns the running dispatcher's
768
- immutable last-valid main-checkout snapshot, exhaustive hot/restart field
794
+ immutable last-valid main-checkout snapshot (`autobuild.toml` layered with
795
+ `.autobuild/local.toml` through `config/local.ts`), exhaustive hot/restart field
769
796
  classification, and eager role resolver. The watch loop refreshes it before
770
797
  each tick and publishes the exact accepted TOML and the composed effective JSON
771
798
  atomically with a run-correlated `dispatcher.config-reloaded` repository fact
@@ -880,7 +907,7 @@ dispatch is tolerated. `Ticket.creationKey` is the optional stable external
880
907
  create/adoption correlation, distinct from `Ticket.ref.id`; Linear projects its
881
908
  issue UUID and file/fake preserve their idempotency metadata through create,
882
909
  adoption, get, and list paths. Legacy/plugin tickets may omit it and dispatch
883
- unchanged. The ticket-source port optionally exposes `listPage(criteria, page)` for paged operator reads. PostgreSQL counts matches and applies SQL LIMIT/OFFSET; the remote hosted client forwards pages over the `list-page` ticket operation; other sources retain exhaustive-read slicing. CLI and dispatcher reads stay exhaustive. See [ticket source contract](ticket-sources.md#writing-your-own).
910
+ unchanged. The ticket-source port optionally exposes `listPage(criteria, page)` for paged operator reads. PostgreSQL counts matches and applies SQL LIMIT/OFFSET; the remote hosted client forwards pages over the `list-page` ticket operation; other sources retain exhaustive-read slicing. CLI and dispatcher reads stay exhaustive. The optional `search(query)` serves `tickets.search` and `ab ticket search`; PostgreSQL answers it with one keyset-paged bounded statement, the remote hosted client forwards it over the `search` ticket operation, and the Linear source answers it with one team-filtered GraphQL `issues` request per page; the GitHub source answers it with one GitHub issue-search request per page on GitHub's separate search quota; `ports/tickets/search.ts` holds the shared matcher and cursor pager, the `TicketSearchUnsupported` refusal for sources without it, and `searchTickets`, the caller entry point. See [ticket source contract](ticket-sources.md#writing-your-own).
884
911
 
885
912
  The `github` source spans four modules. `ports/tickets/github.ts` is the
886
913
  adapter: REST over the forge's `GitHubRequest` transport and credential order,
@@ -912,7 +939,11 @@ environment, and absolute repository root. `WorkspaceHandle.ref` remains a
912
939
  provider identifier, `path` is absolute inside the execution environment, and
913
940
  optional `localPath` explicitly identifies dispatcher reachability. Local Forge
914
941
  operations fall back to the main checkout when `localPath` is absent.
915
- `packages/core/src/ports/workspace/git-worktree.ts` selects the branch-cut base once
942
+ `packages/core/src/ports/workspace/git-worktree.ts` chooses between those
943
+ candidates on canonical paths, so build worktrees never sit inside the
944
+ checkout's package ancestry, validates the choice before each fresh provision
945
+ (`WorktreeIsolationError` otherwise), and adopts legacy in-checkout
946
+ registrations in place. It selects the branch-cut base once
916
947
  at first creation, fetching into a build-scoped private ref; re-provisioning
917
948
  resumes at the branch tip, so the first provisioning fact remains immutable
918
949
  original provenance. Both providers record the verified checked-out commit as
@@ -990,13 +1021,27 @@ dispatcher — requires an exported token before any side effect and never consu
990
1021
  a checkout-less host has neither gh nor a keyring, and `vercel-sandbox` publication
991
1022
  injects that same token.
992
1023
 
1024
+ **Vercel operator sandbox lifecycle (#1246).** `vercel-sandbox.ts` implements
1025
+ `open`/`status`/`close`/`refresh` with provisioning state in the guest under
1026
+ `VERCEL_OPERATOR_PROVISION_DIR` (`host` heartbeat, stage scripts, `tail.sh`,
1027
+ `pid`, `log`, `failed`), classified by one read-only probe in which a `failed`
1028
+ record outranks the marker. The host phase runs as a background attempt that
1029
+ the hosted service keeps alive through its `background` seam (Next's
1030
+ `after()` in `web/runtime.ts`); the tail runs detached. Sandboxes use the
1031
+ `idleMinutes` provider timeout and `sandboxHandle` extends it per tool call.
1032
+ The service (`operator/sandbox.ts`) settles outcomes through `settleOnce` and
1033
+ `recordFailure`, both bounded loops over the store's `appendRepoIfCurrent`.
1034
+
993
1035
  **Hosted sandbox lifetime.** `createHostedOperatorSandboxService` owns its default
994
1036
  local scratch root and removes it on construction failure or asynchronous,
995
1037
  idempotent `dispose()`. Explicit caller scratch remains caller-owned. Disposal
996
1038
  cleans local composition resources, independently of durable remote sandbox
997
- `release`. The operator archive handler disposes a backend acquired through
998
- `sandboxFor` after each request, including failure; a static backend retains its
999
- caller's lifetime. Distribution packing likewise protects both temporary roots
1039
+ `release`. The hosted service's `OperatorSandboxResolver`
1040
+ (`packages/core/src/operator/sandbox-resolver.ts`) owns every backend it
1041
+ composes: it caches one per repository, effective-config revision and
1042
+ credential key, and disposes a superseded one on replacement. The operator
1043
+ archive handler reuses that cached backend and no longer disposes per request;
1044
+ a static backend retains its caller's lifetime. Distribution packing likewise protects both temporary roots
1000
1045
  from allocation onward and awaits both cleanup attempts before returning bytes
1001
1046
  or reporting failure.
1002
1047
 
@@ -1166,7 +1211,9 @@ slug routing. Upgrade performs the same composition lazily at its first merge
1166
1211
  conflict.
1167
1212
 
1168
1213
  `packages/core/src/cli/repo-state.ts` owns repository identity and store precedence
1169
- (`--store` > `AB_STORE` > `[store] url` > `.autobuild/`); `packages/core/src/cli/store-opening.ts` is the
1214
+ (`--store` > `AB_STORE` > `[store] url` > `.autobuild/`), and supplies the two
1215
+ build worktree candidates: the state tree's `worktrees/` and a per-checkout
1216
+ root under the host state home; `packages/core/src/cli/store-opening.ts` is the
1170
1217
  production store composition boundary shared by finite sessionless queries and
1171
1218
  phase sessions. Its shared scoping primitive preserves remote token composition
1172
1219
  and adds local ambient authority only for filesystem stores. The dedicated
@@ -1245,9 +1292,12 @@ It follows one dispatch run's repository facts incrementally through
1245
1292
  facts for their replay reducers, validates/caches its effective-config artifact,
1246
1293
  and polls build streams independently while elapsed paints continue from cached
1247
1294
  intervals. In local execution mode the header's triage count comes from the
1248
- reduced `DispatchStatus` (`status.triage`), exactly like the queue depth, so a
1249
- frontend refresh reads neither the ticket source nor any extra store value for
1250
- it; viewer mode differs, as described below. The supervised
1295
+ reduced `DispatchStatus` (`status.triage`); viewer mode differs, as described
1296
+ below. The queue depth in every mode comes from the reduced repository facts'
1297
+ latest ticket scan (`facts.scan.queued`, via `repositoryQueueDepth` in
1298
+ `packages/core/src/cli/dashboard/header.ts`), whichever run recorded it, so a
1299
+ run that starts and yields cannot displace it. In both cases a frontend
1300
+ refresh reads neither the ticket source nor any extra store value. The supervised
1251
1301
  kernel child (`frontendStatus`) samples the count through
1252
1302
  `TriageCountSampler` (`packages/core/src/cli/triage-count-sampler.ts`): the
1253
1303
  watch loop pokes it at startup and after each tick returns, so it reads at
@@ -1356,6 +1406,31 @@ acknowledges it only after complete admitted reads, and reuses unchanged snapsho
1356
1406
  for up to ten seconds. Scoped discovery uses `listBuildsForRepo`; unchanged focused
1357
1407
  frames make one counter request. Session feeds remain independent.
1358
1408
 
1409
+ Both dashboard frontends render one vocabulary. `cli/dashboard/vocabulary.ts`
1410
+ holds the browser-safe terms: status words and tones, step marks, and the
1411
+ clock-dependent step timers. Its only value import is `cells.ts`.
1412
+ `cli/dashboard/row-text.ts` projects the model into plain-data row, harvest,
1413
+ header, dispatcher-mode, attention-list, finished-row and overview text. The
1414
+ terminal renderer paints those values, and `web/protocol.ts` aliases the same
1415
+ types for the web frame, so a term changes in one place.
1416
+ `web/overview-source.ts` builds `ab web`'s overview from `buildRoster` and the
1417
+ changed-builds feed, through the poll cache's shared row and header helpers
1418
+ (`readRowEnrichment`, `projectRowWithEnrichment`, `repositoryDashboardHeader`
1419
+ in `cli/dashboard/poll.ts`), so the terminal and the web project rows the same
1420
+ way.
1421
+ `web/analytics-source.ts` answers the `/api/analytics` and
1422
+ `/api/builds/<slug>/timeline` routes in `web/http.ts` from the `stepDurations`
1423
+ rollup, one filtered `listBuildsPage` page and saved `buildTimeline` values,
1424
+ evicting its in-memory timelines by the changed-builds feed.
1425
+ The `ab web` pages in
1426
+ `packages/ui/src/app/` render the frame's projection values, import browser-safe
1427
+ values from `vocabulary.ts` (step timers and the verified progress label) so
1428
+ both frontends share those terms, use the page's embedded frame as
1429
+ a masked skeleton, and apply each frame through `StableFlow`'s layout
1430
+ transactions. `packages/ui/src/app/analytics.tsx` is the analytics page; it and
1431
+ the build page's timeline fetch the JSON routes when the frame's change
1432
+ position moves.
1433
+
1359
1434
  The memory adapter maintains independent bigint counters; SQLite and PostgreSQL
1360
1435
  increment `repo_change_positions` transactionally through triggers on build,
1361
1436
  build-event, repository-event insertion and null-safe repository lease holder
@@ -1365,6 +1440,37 @@ its own repository-authorized route before the journal-existence gate. PostgreSQ
1365
1440
  counter DDL is additive, outside the guarded core schema/checksum, and must be
1366
1441
  explicitly migrated before the service rollout. Existing writers use the same
1367
1442
  triggers; rerunning migration preserves positions without replaying old events.
1443
+
1444
+ `listOpenBuilds` is served the same way. The memory adapter keeps a per-repository
1445
+ set at each build-event write; SQLite and PostgreSQL keep an additive
1446
+ `open_builds` table maintained by triggers on build insertion and on
1447
+ `build.completed`, `build.aborted` and `build.reopened` appends. Each SQL adapter
1448
+ backfills the table once, when its bootstrap or migration creates it. Like the
1449
+ counter DDL, it sits outside the guarded core schema and must be migrated before
1450
+ a hosted rollout serves `open-builds`; until then the route fails rather than
1451
+ listing every build.
1452
+
1453
+ Positions are ordered. `packages/core/src/store/build-feed.ts` holds the shared
1454
+ changed-builds feed and paged-listing vocabulary (`listBuildsChangedSince`,
1455
+ `listBuildsPage`, cursor and position codecs). Each build's latest position
1456
+ lives in `build_change_positions`, written by the same trigger that advances
1457
+ the counter (memory: a one-node-per-build linked list); its first creation
1458
+ backfills existing builds once at a bumped head. The paged listing's filters
1459
+ read `build_listing_facts`: one row per build holding `created_at`, a mirror of
1460
+ `updated_at`, `node` and `merged`, kept by triggers in the writing transaction
1461
+ (a build insert seeds it, `build.created` sets `node`, `build.completed` sets
1462
+ `merged`, `build.reopened` clears it, and each `builds.updated_at` change is
1463
+ copied). Seven indexes, one per filter class (kind, merged, kind and merged,
1464
+ plus all builds for update order) and order (creation or update), make every
1465
+ filtered page one backward range scan of its own index. SQLite names that
1466
+ index with `INDEXED BY`. PostgreSQL has no hints, so each index leads with its
1467
+ class's columns and the statement bounds and orders by the row `(class
1468
+ columns, key, slug)`; any other index would need a full sort, so no plan can
1469
+ walk a wider index and discard rows when classes cluster in time. The memory
1470
+ adapter keeps the same classes as sorted slug lists, moved in the step that
1471
+ writes the fact or `updatedAt`. Its first creation backfills existing builds
1472
+ once from their latest relevant events. The PostgreSQL DDL is additive, like
1473
+ the counter's, and must be migrated before the service rollout.
1368
1474
  `detail.ts` projects chronological session history from the same retained log,
1369
1475
  including a distinct transcriptless `reclaimed` ending, and `transcript.ts`
1370
1476
  heuristically presents ordinary opaque transcript artifacts with a raw
@@ -1396,8 +1502,14 @@ proven per tool by `operator/registry.contract.test.ts`. Every binding is genera
1396
1502
  from the table and never widens beyond the operator services: the shipped one is
1397
1503
  `packages/core/src/cli/mcp.ts` (`ab mcp`, a stdio MCP server over the registry that
1398
1504
  fails closed inside a phase, exactly as repository-wide `ab builds` does); the
1399
- hosted HTTP and MCP transports register from the same table. Checked-in
1400
- risk classes live in `operator/annotations.ts` (SPEC §8.9).
1505
+ hosted HTTP and MCP transports register from the same table. The hosted MCP
1506
+ binding registers the service's `operatorTools`, computed by the same
1507
+ `operatorToolTable` the operator server dispatches through, so advertisement
1508
+ equals dispatch. Its per-repository mode (`/mcp/<host><path>`, in
1509
+ `web/mcp.ts`) serves the same table for one repository, converting each
1510
+ schema exactly as the SDK's `McpServer` does and then removing `repo`; both
1511
+ modes share one per-call closure. Checked-in risk classes live in
1512
+ `operator/annotations.ts` (SPEC §8.9).
1401
1513
 
1402
1514
  **Init and upgrade.** `packages/core/src/cli/init.ts` owns deterministic skill vendoring,
1403
1515
  ignore maintenance, runtime probes, and the stack-neutral first config. It then
@@ -1479,7 +1591,10 @@ BuildStore for other sources. `packages/core/src/store/ticket-assets.ts`
1479
1591
  holds the types, the limits, and the one validator every adapter calls;
1480
1592
  `packages/core/src/cli/ticket-assets.ts` holds the filesystem walk, the download
1481
1593
  writer, and the note builder; `ab ticket attach`, `asset get`, and `asset rm`
1482
- live in `packages/core/src/cli/ticket.ts`. The optional hosted source asset
1594
+ live in `packages/core/src/cli/ticket.ts`. `packages/core/src/operator/ticket-assets.ts`
1595
+ is the operator half behind the `tickets.asset.*` registry tools, sharing the
1596
+ listing projection and id keying in `operator/ticket-asset-list.ts` with the CLI.
1597
+ The optional hosted source asset
1483
1598
  capability reuses RemoteBuildStore transport with the ticket URL and credential.
1484
1599
  Other sources retain the existing store path.
1485
1600
  A claim freezes the ticket's current assets into the build (SPEC §6.3):
@@ -1574,10 +1689,12 @@ The two remote clients get client-only coverage in core itself, against an
1574
1689
  injected `fetchFn` with responses built from the protocol's wire schemas.
1575
1690
  `HostedTicketSource` (`ports/tickets/remote.test.ts`) is in-memory unit
1576
1691
  coverage that runs in `bun run test`. `RemoteBuildStore`
1577
- (`store/remote/client.integration.test.ts`, which also pins scoped-token
1578
- minting/verification) is integration coverage. The full over-the-wire seam
1692
+ (`store/remote/client.test.ts`, which also pins scoped-token
1693
+ minting/verification) is also in-memory unit coverage running in `bun run test`.
1694
+ Its remaining timed subscription paging test lives in
1695
+ `store/remote/client.integration.test.ts`. The full over-the-wire seam
1579
1696
  suites (client → HTTP → server) live in `packages/hosted-store-service`
1580
- (`*.seam.integration.test.ts`) and run with the `RemoteBuildStore` client tests
1697
+ (`*.seam.integration.test.ts`) and run alongside that timed subscription test
1581
1698
  in `bun run test:integration`.
1582
1699
 
1583
1700
  To run the Linear contract manually against a destructive scratch target:
@@ -2196,10 +2313,26 @@ heads require immutable commit ancestry proof against the accepted target and
2196
2313
  the destination base already used by replay. Missing capability or failed proof
2197
2314
  defers new replay. A non-descendant without kernel lineage records
2198
2315
  `target.rewritten` with branch,
2199
- previous SHA and observed SHA, retains the accepted target, and raises watch/wait
2200
- attention. Repeated rewrite pairs are deduplicated. Returning to a safe target
2201
- clears attention (`target.rewrite-cleared` when the accepted tip is unchanged).
2202
- Upstream force-pushes are never adopted automatically. Accepted node reparenting
2316
+ previous SHA and observed SHA, and retains the accepted target. Repeated rewrite
2317
+ pairs are deduplicated. Returning to a safe target clears the wait
2318
+ (`target.rewrite-cleared` when the accepted tip is unchanged). Upstream
2319
+ force-pushes are never adopted on top of existing work automatically:
2320
+
2321
+ - A leaf with no work of its own (no published head, no PR, no commits beyond
2322
+ its base in use) is reprovisioned from the current target by its next runner,
2323
+ without operator action: `target.rewrite-reprovision-prepared`, a branch
2324
+ reset, then `target.rewrite-recovered` (`reprovisioned`). A runner that dies
2325
+ mid-reset completes it forward.
2326
+ - A leaf with work raises one `policy/target-rewritten` escalation per episode
2327
+ (a run of rewrites of the same rejected base), naming that base, the new
2328
+ target head and its own commits. `ab answer <slug> --accept-target` waives
2329
+ the rejected base (`target.rewrite-recovered`, `accepted`) and restacks its
2330
+ own commits onto the target at the next replay boundary; `ab abort` is the
2331
+ other way out.
2332
+ - A node waits, and raises watch/wait attention once per episode.
2333
+
2334
+ `ab build status` names a leaf's recovery state, and the base when the build's
2335
+ first provision adopted it from a pre-existing branch. Accepted node reparenting
2203
2336
  starts a new branch scope; frozen transactions recover their retained inputs.
2204
2337
 
2205
2338
  Kernel restacks of a node are admitted through durable guarded publication
@@ -2461,7 +2594,10 @@ Successful identity persistence materializes grants into member rows without
2461
2594
  placeholder users or invitations. Mutations and connection decisions serialize
2462
2595
  through the project registry singleton (after the connection row where relevant).
2463
2596
  Admission and project filtering read durable state on each browser request and
2464
- MCP callback; session claims and activeOrganizationId confer no authority.
2597
+ MCP callback; session claims and activeOrganizationId confer no authority. Each
2598
+ MCP callback also checks the token's RFC 8707 resource binding
2599
+ (`web/mcp-resource-binding.ts`, one `verification` row read): a token bound to
2600
+ one per-repository URL is refused everywhere else.
2465
2601
 
2466
2602
  ## Operator presence
2467
2603
 
@@ -37,7 +37,7 @@ History lives in `.autobuild/`. To move it, pass a filesystem path or set a nonb
37
37
  bun ab builds --store /srv/autobuild/project-store
38
38
  ```
39
39
 
40
- Keep the database and blob directory together, durable and writable by the dispatcher identity.
40
+ Keep the database and blob directory together, durable and writable by the dispatcher identity. Build worktrees follow a store outside the checkout; otherwise they live under `$XDG_STATE_HOME/autobuild/worktrees/` (default `~/.local/state/…`).
41
41
 
42
42
  ### Remote HTTP client and protocol
43
43
 
@@ -125,9 +125,12 @@ local stores each see only their own builds:
125
125
  API show only the local store's builds.
126
126
  - **Branch collisions are only partly guarded.** A dispatcher skips any slug
127
127
  whose `ab/` or `ab-node/` branch already exists on the remote (when its forge
128
- supports `remoteBranchExists`), but two stores that claim the same name before
129
- either pushes can still collide. The check is a safety step, not a best
130
- effort: if the branch lookup fails, or the base slug and its `-2` … `-100`
131
- suffixes are all taken, the claim fails at the naming stage. No build is
132
- created, the ticket is handed back to its ready state, and a later tick
133
- retries it.
128
+ supports `remoteBranchExists`) or locally in its checkout (when its workspace
129
+ provider supports `localBranchExists`), but two stores that claim the same
130
+ name before either pushes can still collide. The check is a safety step, not
131
+ a best effort: if the branch lookup fails, or the base slug and its `-2` …
132
+ `-100` suffixes are all taken, the claim fails at the naming stage. No build
133
+ is created, the ticket is handed back to its ready state, and a later tick
134
+ retries it. With the [git-worktree](workspaces.md) provider, a new leaf
135
+ build's first provision also cuts a fresh branch rather than adopting a stale
136
+ one; a node reuses the branch the kernel already opened for it.
package/docs/cli.md CHANGED
@@ -13,18 +13,20 @@ Run `bun ab <command>`; `bun ab help <command>` lists flags and subcommands. See
13
13
 
14
14
  - `accounts` — Authorize a ChatGPT subscription for a local dispatcher or connected project.
15
15
 
16
- - `dispatch` — Run the dispatcher and dashboard; missing selected account credentials refuse local startup before the lease. See [account admission](accounts.md#dispatcher-admission).
16
+ - `dispatch` — Run the dispatcher and dashboard; `--web` also serves the [web UI](operator-surfaces.md). Missing selected account credentials refuse local startup before the lease. See [account admission](accounts.md#dispatcher-admission).
17
17
  - `init` — Install skills and hand setup to a coding agent.
18
18
  - `upgrade` — Update Autobuild and merge default skills.
19
19
  - `connect` — Connect to a hosted service with browser approval.
20
20
  - `disconnect` — Revoke and remove the saved credential.
21
21
  - `secrets` — List metadata, set or remove write-only project secrets. Project members and super users can also use the web Settings tab; renewing refreshing ChatGPT credentials stays in `ab accounts login <account> --project`.
22
+ - `web` — Serve a read-only web UI of this repository's builds on loopback. See [Operator surfaces](operator-surfaces.md).
22
23
 
23
24
  ## For your operator agent
24
25
 
25
26
  - `help` — Show the overview or one command's help.
26
27
  - `ticket` — Create, groom, inspect, and move tickets.
27
28
  - `repository` — Inspect durable dispatcher settings.
29
+ - `operator` — Read or save the local dispatcher ownership preference.
28
30
  - `merges` — List merges awaiting consent.
29
31
  - `builds` — List builds and status.
30
32
  - `build` — Inspect one build's state and events.
@@ -68,3 +70,33 @@ change local files or configuration. Failed cleanup is retryable with access
68
70
  already refused. Reconnecting requires fresh browser approval and starts empty,
69
71
  with hosted ticket numbering reset to 1. See
70
72
  [permanent project deletion](operator-api.md#permanent-project-deletion).
73
+
74
+ ## Dispatcher ownership
75
+
76
+ Read `ab repository status --json` before starting a dispatcher. The shared
77
+ `dispatcherRunning` field (also in the `repository.status` operator tool) is true
78
+ when a holder, expired holder or unfinished handoff names a draining predecessor.
79
+ An empty drain map does not prove retirement. Missing or unreadable running
80
+ status fails closed: never start while running or while that fact is unknown.
81
+
82
+ `ab operator dispatcher --json` reads the checkout's preference; save a choice
83
+ with `ab operator dispatcher human` or `ab operator dispatcher agent`. The optional
84
+ `[operator] dispatcher = "human" | "agent"` lives only in `.autobuild/local.toml`;
85
+ no choice is assumed when unset. Even an empty `[operator]` is rejected in
86
+ `autobuild.toml`. Saving preserves other settings semantically and may normalize
87
+ TOML formatting. It needs no store or credential, writes no event, and is refused
88
+ inside build or harvest sessions. Reading a missing local file creates nothing.
89
+
90
+ Repository instructions take precedence. With none running, follow the saved
91
+ preference or ask who should run it and offer to save the answer. For human
92
+ ownership, give startup instructions and wait. For agent ownership, start
93
+ `ab dispatch --web --plain --json` under the harness's managed background lifetime
94
+ and give the person its URL. Stop only a dispatcher this session started, only
95
+ when requested, using a clean stop with drain. Never adopt, restart, kill or manage
96
+ another session's process; a preference does not authorize takeover.
97
+
98
+ `ab web [--json]` is always allowed, even while a dispatcher exists: it serves a
99
+ read-only UI without acquiring a dispatcher lease. `ab dispatch --web` serves the
100
+ same UI alongside dispatch; `--plain` keeps the URL on stdout and diagnostics on
101
+ stderr; a TTY dashboard keeps it on its top line. Both default to loopback. Serving beyond loopback has no access control;
102
+ see [operator surfaces](operator-surfaces.md) for binding and refresh details.
@@ -11,6 +11,8 @@ slug: "configuration"
11
11
 
12
12
  `autobuild.toml` declares your repository's infrastructure, commands, agent roles, checks and operating limits.
13
13
 
14
+ The file is committed and shared. Personal settings — capacity, scan cadence, upgrades, hooks, roles and accounts — can be overridden per checkout in an uncommitted `.autobuild/local.toml`; see [local overrides](configuration.md#local-overrides-autobuildlocaltoml).
15
+
14
16
 
15
17
  ## Commands and extension steps
16
18
 
@@ -169,7 +171,8 @@ others choose local storage. The destination is shown before the browser opens.
169
171
  OpenAI handles consent and authorization. No token is printed.
170
172
 
171
173
  Local credentials live in protected, ignored main-checkout
172
- `.autobuild/accounts/` state shared by worktrees. Project sign-in transfers
174
+ `.autobuild/accounts/` state. Worktrees reach it through the main checkout,
175
+ wherever they live. Project sign-in transfers
173
176
  credentials directly to the encrypted refreshing project secret named by
174
177
  `credentialEnv`; it retains no renewable credential locally. This name
175
178
  identifies a host access-token slot, not a refresh token supplied in TOML.