@defrex/autobuild 1.0.1 → 1.2.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 (247) hide show
  1. package/README.md +10 -18
  2. package/SPEC.md +499 -238
  3. package/bin/ab-dispatch-generation.ts +11 -2
  4. package/docs/accounts.md +119 -0
  5. package/docs/agent-runtimes.md +4 -4
  6. package/docs/answering-blocked-builds.md +2 -2
  7. package/docs/architecture.md +262 -53
  8. package/docs/assets/headline-wide.png +0 -0
  9. package/docs/build-store.md +3 -41
  10. package/docs/builds.md +4 -4
  11. package/docs/cli.md +18 -4
  12. package/docs/configuration-overview.md +115 -4
  13. package/docs/configuration.md +488 -334
  14. package/docs/dispatcher-hosting.md +19 -34
  15. package/docs/dispatcher.md +1 -1
  16. package/docs/forges.md +5 -5
  17. package/docs/getting-started.md +2 -2
  18. package/docs/glossary.md +6 -6
  19. package/docs/intake.md +2 -0
  20. package/docs/integration-overview.md +15 -15
  21. package/docs/integration-tree.md +45 -38
  22. package/docs/integration.md +6 -6
  23. package/{skills/guide/references/landing-policy.md → docs/merge-policy.md} +40 -24
  24. package/docs/migration-1.0.md +17 -13
  25. package/docs/operating.md +41 -19
  26. package/docs/operator-api.md +180 -51
  27. package/docs/operator-surfaces.md +5 -18
  28. package/docs/overview.md +3 -3
  29. package/docs/plugin-authoring.md +21 -0
  30. package/docs/remote-store-protocol.md +242 -68
  31. package/docs/remote-ticket-protocol.md +30 -50
  32. package/docs/restacking.md +54 -15
  33. package/docs/seams.md +8 -8
  34. package/docs/setup.md +59 -119
  35. package/docs/skills.md +1 -1
  36. package/docs/spec-standard.md +6 -6
  37. package/docs/ticket-dependencies.md +7 -7
  38. package/docs/ticket-sources.md +18 -0
  39. package/docs/tickets.md +8 -2
  40. package/docs/troubleshooting.md +8 -12
  41. package/docs/upgrading.md +9 -4
  42. package/docs/verification.md +60 -14
  43. package/docs/workspaces.md +4 -4
  44. package/package.json +17 -6
  45. package/packages/core/src/accounts/chatgpt-oauth.ts +216 -0
  46. package/packages/core/src/accounts/chatgpt-state.ts +41 -0
  47. package/packages/core/src/accounts/local-credentials.ts +194 -0
  48. package/packages/core/src/accounts/local-inference.ts +106 -0
  49. package/packages/core/src/accounts/local-owner.ts +123 -0
  50. package/packages/core/src/accounts/sensitive.ts +2 -0
  51. package/packages/core/src/cli/accounts.ts +147 -0
  52. package/packages/core/src/cli/binary-direct.ts +13 -1
  53. package/packages/core/src/cli/binary-lifecycle.ts +65 -2
  54. package/packages/core/src/cli/binary.ts +3 -1
  55. package/packages/core/src/cli/build-control.ts +83 -28
  56. package/packages/core/src/cli/connect.ts +3 -3
  57. package/packages/core/src/cli/context.ts +81 -38
  58. package/packages/core/src/cli/dashboard/facts.ts +2 -1
  59. package/packages/core/src/cli/dashboard/integration-detail.ts +8 -8
  60. package/packages/core/src/cli/dashboard/integration-row.ts +40 -13
  61. package/packages/core/src/cli/dashboard/landing-display.ts +25 -0
  62. package/packages/core/src/cli/dashboard/model.ts +56 -33
  63. package/packages/core/src/cli/dashboard/poll.ts +9 -3
  64. package/packages/core/src/cli/dashboard/render.ts +59 -37
  65. package/packages/core/src/cli/dashboard/target-distance.ts +14 -0
  66. package/packages/core/src/cli/dashboard/tree.ts +3 -2
  67. package/packages/core/src/cli/dispatch-args.ts +1 -1
  68. package/packages/core/src/cli/dispatch-frontend.ts +6 -3
  69. package/packages/core/src/cli/dispatch-handoff.ts +125 -44
  70. package/packages/core/src/cli/dispatch-launch-contract.ts +187 -0
  71. package/packages/core/src/cli/dispatch-launcher.ts +54 -21
  72. package/packages/core/src/cli/dispatch-preflight.ts +6 -1
  73. package/packages/core/src/cli/dispatch.ts +106 -11
  74. package/packages/core/src/cli/env.ts +4 -0
  75. package/packages/core/src/cli/help.ts +46 -23
  76. package/packages/core/src/cli/init-readiness-remote.ts +22 -1
  77. package/packages/core/src/cli/init-readiness-shared.ts +5 -1
  78. package/packages/core/src/cli/init-validation.ts +160 -18
  79. package/packages/core/src/cli/main.ts +68 -8
  80. package/packages/core/src/cli/node-verification-provenance.ts +1 -97
  81. package/packages/core/src/cli/publication-settlement.ts +47 -21
  82. package/packages/core/src/cli/repository-status.ts +20 -9
  83. package/packages/core/src/cli/secrets.ts +173 -0
  84. package/packages/core/src/cli/status.ts +42 -5
  85. package/packages/core/src/cli/store-opening.ts +17 -2
  86. package/packages/core/src/cli/terminal.ts +22 -1
  87. package/packages/core/src/cli/terminals.ts +14 -10
  88. package/packages/core/src/cli/upgrade-agent.ts +9 -1
  89. package/packages/core/src/cli/upgrade-landing.ts +70 -30
  90. package/packages/core/src/cli/upgrade.ts +3 -1
  91. package/packages/core/src/cli/wait.ts +15 -7
  92. package/packages/core/src/cli/watch-lifetime.ts +111 -0
  93. package/packages/core/src/cli/watch.ts +635 -510
  94. package/packages/core/src/config/accounts.ts +101 -0
  95. package/packages/core/src/config/effective-artifact.fixture.ts +27 -0
  96. package/packages/core/src/config/effective-artifact.ts +13 -0
  97. package/packages/core/src/config/landing.ts +1 -1
  98. package/packages/core/src/config/live.ts +14 -1
  99. package/packages/core/src/config/load.ts +21 -1
  100. package/packages/core/src/config/pipeline-source.ts +28 -0
  101. package/packages/core/src/config/reference-metadata.ts +2 -0
  102. package/packages/core/src/config/reference.ts +22 -7
  103. package/packages/core/src/config/roles.ts +54 -3
  104. package/packages/core/src/config/schema.ts +146 -162
  105. package/packages/core/src/context-directory.ts +26 -0
  106. package/packages/core/src/distribution-packaging.ts +26 -5
  107. package/packages/core/src/events/catalog.ts +10 -2
  108. package/packages/core/src/events/compatibility.ts +2 -1
  109. package/packages/core/src/events/globs.ts +1 -1
  110. package/packages/core/src/events/payloads.ts +73 -1
  111. package/packages/core/src/events/policy.ts +7 -0
  112. package/packages/core/src/events/repository.ts +4 -4
  113. package/packages/core/src/events/sessions.ts +6 -6
  114. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +574 -0
  115. package/packages/core/src/kernel/auto-merge.ts +2 -2
  116. package/packages/core/src/kernel/engine.ts +255 -26
  117. package/packages/core/src/kernel/generators/leaf-restack-log.ts +10 -0
  118. package/packages/core/src/kernel/integration-landing.ts +3 -3
  119. package/packages/core/src/kernel/integration-state.ts +27 -4
  120. package/packages/core/src/kernel/leaf-restack-state.ts +28 -3
  121. package/packages/core/src/kernel/log-index.ts +13 -1
  122. package/packages/core/src/kernel/node-landing.ts +8 -8
  123. package/packages/core/src/kernel/node-parent.ts +2 -2
  124. package/packages/core/src/kernel/node-restack-transaction.ts +1 -1
  125. package/packages/core/src/kernel/node-verification-context.ts +216 -0
  126. package/packages/core/src/kernel/phases.ts +1 -1
  127. package/packages/core/src/kernel/plan-verify-selection.ts +16 -0
  128. package/packages/core/src/kernel/publication-retry.ts +168 -0
  129. package/packages/core/src/kernel/reconcile-restack.ts +29 -1
  130. package/packages/core/src/kernel/reducer.ts +85 -5
  131. package/packages/core/src/kernel/target-distance.ts +45 -0
  132. package/packages/core/src/kernel/terminal-guard.ts +10 -1
  133. package/packages/core/src/kernel/verify-stage-state.ts +123 -0
  134. package/packages/core/src/kernel/verify-stages.ts +39 -0
  135. package/packages/core/src/ontology.ts +1 -0
  136. package/packages/core/src/operator/annotations.ts +6 -0
  137. package/packages/core/src/operator/control.ts +1 -1
  138. package/packages/core/src/operator/index.ts +3 -7
  139. package/packages/core/src/operator/landings.ts +5 -1
  140. package/packages/core/src/operator/presentation.ts +6 -1
  141. package/packages/core/src/operator/protocol.ts +6 -0
  142. package/packages/core/src/operator/query.ts +14 -18
  143. package/packages/core/src/operator/registry.ts +39 -7
  144. package/packages/core/src/operator/sandbox-host.ts +64 -40
  145. package/packages/core/src/operator/sandbox.ts +3 -0
  146. package/packages/core/src/operator/ticket-source-backend.ts +3 -12
  147. package/packages/core/src/operator/tickets.ts +25 -4
  148. package/packages/core/src/plugins/manifest.ts +2 -1
  149. package/packages/core/src/ports/forge/contract.ts +2 -2
  150. package/packages/core/src/ports/forge/git-rewrite.ts +25 -2
  151. package/packages/core/src/ports/forge/github-readiness.ts +2 -2
  152. package/packages/core/src/ports/forge/github.ts +26 -7
  153. package/packages/core/src/ports/forge/local-git.ts +4 -4
  154. package/packages/core/src/ports/forge/readiness.ts +1 -1
  155. package/packages/core/src/ports/forge-failure.ts +24 -0
  156. package/packages/core/src/ports/runner/account-env.ts +88 -0
  157. package/packages/core/src/ports/runner/chatgpt-provider.ts +85 -0
  158. package/packages/core/src/ports/runner/claude.ts +26 -2
  159. package/packages/core/src/ports/runner/codex.ts +63 -31
  160. package/packages/core/src/ports/runner/one-shot.ts +2 -0
  161. package/packages/core/src/ports/runner/provider-error.ts +5 -0
  162. package/packages/core/src/ports/runner/routing.ts +35 -4
  163. package/packages/core/src/ports/tickets/contract.ts +58 -0
  164. package/packages/core/src/ports/tickets/tree.ts +1 -1
  165. package/packages/core/src/ports/types.ts +28 -7
  166. package/packages/core/src/ports/workspace/account-policy.ts +72 -0
  167. package/packages/core/src/ports/workspace/build-execution.ts +9 -2
  168. package/packages/core/src/ports/workspace/builtin-capabilities.ts +1 -0
  169. package/packages/core/src/ports/workspace/create.ts +2 -0
  170. package/packages/core/src/ports/workspace/git-worktree.ts +6 -1
  171. package/packages/core/src/ports/workspace/phase-scratch.ts +4 -3
  172. package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -0
  173. package/packages/core/src/ports/workspace/vercel-sandbox.ts +182 -72
  174. package/packages/core/src/processes/build-child.ts +6 -8
  175. package/packages/core/src/processes/build-execution-state.ts +8 -5
  176. package/packages/core/src/processes/build-runner.ts +554 -99
  177. package/packages/core/src/processes/dispatcher.ts +209 -101
  178. package/packages/core/src/processes/execution-no-progress.ts +8 -1
  179. package/packages/core/src/processes/execution-settlement.ts +21 -3
  180. package/packages/core/src/processes/harvest-runner.ts +68 -8
  181. package/packages/core/src/processes/phase-failure-budget.ts +1 -0
  182. package/packages/core/src/processes/publication-loss.ts +8 -2
  183. package/packages/core/src/processes/publication-state.ts +42 -4
  184. package/packages/core/src/processes/repo-view.ts +14 -0
  185. package/packages/core/src/processes/verify-cycle-config.ts +96 -0
  186. package/packages/core/src/project-secrets.ts +105 -0
  187. package/packages/core/src/{integration → scenarios}/harness.ts +330 -317
  188. package/packages/core/src/secret-name.ts +41 -0
  189. package/packages/core/src/store/account-redaction.ts +156 -0
  190. package/packages/core/src/store/adapter.ts +1 -0
  191. package/packages/core/src/store/build-scope.ts +9 -0
  192. package/packages/core/src/store/contract.ts +116 -2
  193. package/packages/core/src/store/local/schema.ts +13 -0
  194. package/packages/core/src/store/local/store.ts +42 -0
  195. package/packages/core/src/store/memory.ts +47 -0
  196. package/packages/core/src/store/operator-presence.ts +21 -0
  197. package/packages/core/src/store/phase-session.ts +10 -0
  198. package/packages/core/src/store/reducer-value-shapes.json +5185 -4156
  199. package/packages/core/src/store/remote/client.ts +89 -48
  200. package/packages/core/src/store/remote/compatibility.ts +20 -0
  201. package/packages/core/src/store/remote/protocol.ts +4 -0
  202. package/packages/core/src/store/remote/version.ts +3 -1
  203. package/packages/core/src/store/retention.ts +2 -3
  204. package/packages/core/src/store/session-handle.ts +9 -0
  205. package/packages/core/src/store/streams/session-writer.ts +1 -1
  206. package/packages/core/src/store/types.ts +12 -2
  207. package/packages/core/src/testing/dispatch-read-budget.ts +122 -0
  208. package/packages/core/src/testing/index.ts +12 -1
  209. package/packages/core/src/testing/reduced-read-budget.ts +47 -0
  210. package/packages/core/src/testing/temp-directories.ts +58 -0
  211. package/skills/code-review/SKILL.md +23 -9
  212. package/skills/finalize/SKILL.md +15 -7
  213. package/skills/guide/SKILL.md +373 -148
  214. package/skills/guide/references/accounts.md +119 -0
  215. package/skills/guide/references/integration-tree.md +45 -38
  216. package/{docs/landing-policy.md → skills/guide/references/merge-policy.md} +40 -24
  217. package/skills/guide/references/migration-1.0.md +17 -13
  218. package/skills/guide/references/operator-api.md +180 -51
  219. package/skills/guide/references/plugin-authoring.md +21 -0
  220. package/skills/guide/references/remote-store-protocol.md +242 -68
  221. package/skills/guide/references/remote-ticket-protocol.md +30 -50
  222. package/skills/guide/references/restacking.md +54 -15
  223. package/skills/guide/references/setup.md +59 -119
  224. package/skills/guide/references/spec-standard.md +6 -6
  225. package/skills/guide/references/ticket-dependencies.md +7 -7
  226. package/skills/harvest/SKILL.md +3 -1
  227. package/skills/harvest-review/SKILL.md +3 -1
  228. package/skills/implement/SKILL.md +43 -17
  229. package/skills/operate/SKILL.md +118 -118
  230. package/skills/plan/SKILL.md +39 -13
  231. package/skills/plan-review/SKILL.md +15 -10
  232. package/skills/reconcile/SKILL.md +22 -3
  233. package/skills/spec/SKILL.md +20 -20
  234. package/skills/tickets/SKILL.md +12 -9
  235. package/templates/autobuild.toml +1 -1
  236. package/templates/hosted-service/package.json +2 -2
  237. package/docs/hosted-dispatcher-cutover-validation.md +0 -178
  238. package/docs/hosted-dispatcher.md +0 -275
  239. package/docs/hosted-service.md +0 -293
  240. package/docs/mcp.md +0 -149
  241. package/packages/core/src/orchestrator/approvals.ts +0 -115
  242. package/packages/core/src/orchestrator/conversation.ts +0 -167
  243. package/packages/core/src/orchestrator/model.ts +0 -86
  244. package/packages/core/src/orchestrator/prompt.ts +0 -63
  245. package/packages/core/src/orchestrator/tools.ts +0 -117
  246. package/packages/core/src/orchestrator/turn-runner.ts +0 -457
  247. package/packages/core/src/processes/orchestrator-tick.ts +0 -360
@@ -1,6 +1,7 @@
1
1
  # Remote BuildStore protocol
2
2
 
3
- This document is the complete normative HTTP contract for Autobuild's remote
3
+ A conforming hosted instance implements this complete normative HTTP contract
4
+ for Autobuild's remote
4
5
  `BuildStore`. Implement this protocol to provide build storage on any database,
5
6
  blob store, or service stack; Autobuild does not load in-process `BuildStore`
6
7
  plugins. Compatibility means that an Autobuild remote client can use the server
@@ -16,13 +17,12 @@ A service accepts stable and prerelease clients from its own `major.minor`
16
17
  release line and the two preceding minor lines in the same major. A major starts a new family:
17
18
  X.0 accepts only X.0, X.1 accepts X.0/X.1, and X.2 onward accepts three lines.
18
19
  Patch versions are interchangeable in both directions and must never change
19
- the protocol. Upgrade the service first, then projects independently within
20
- its window. Supported release lines retain their wire handlers and known
20
+ the protocol. Clients must remain within the instance’s published compatibility window. Supported release lines retain their wire handlers and known
21
21
  protocol identities; an unknown protocol is refused independently of version.
22
22
  Stable and prerelease service and client identities share their numeric major/minor
23
23
  line. Malformed or missing identities, build metadata (`+…`), prefixes and
24
24
  whitespace are refused with HTTP 409.
25
- A newer client is told to upgrade the service; a client below the window is
25
+ A newer client receives an instance-upgrade diagnostic; a client below the window is
26
26
  told to upgrade the project's Autobuild. Diagnostics name the service version
27
27
  and supported range.
28
28
 
@@ -40,7 +40,7 @@ headers, or available backend.
40
40
  `[store] url` (in that precedence order, before the local default); the shipped client appends the routes below.
41
41
  - Every `/builds`, `/repos`, and `/sessions` request sends
42
42
  `X-Autobuild-Version` with the exact client package version and
43
- `X-Autobuild-Protocol-Version` with the remote protocol version (`4` in this
43
+ `X-Autobuild-Protocol-Version` with the remote protocol version (`6` in this
44
44
  distribution). Before authentication,
45
45
  body parsing, or resource lookup, the server validates the release-line window and known protocol identity.
46
46
  Unsupported or missing values receive `409 {"kind":"conflict","error":"…"}`;
@@ -56,8 +56,7 @@ headers, or available backend.
56
56
  padded standard base64 (not base64url). A server may impose a documented
57
57
  decoded-byte ceiling. It decodes and checks every standalone or bundled
58
58
  artifact before any backing mutation; excess content receives `413
59
- {"kind":"validation","error":"…"}` naming the byte ceiling. The shipped
60
- hosted service ceiling is 1,048,576 decoded bytes (1 MiB).
59
+ {"kind":"validation","error":"…"}` naming the byte ceiling. An implementation-dependent example ceiling is 1,048,576 decoded bytes (1 MiB).
61
60
  - Store-assigned times are ISO-8601 UTC strings in JavaScript
62
61
  `Date.toISOString()` form, for example `2026-07-15T12:00:00.000Z`.
63
62
  - Event sequence numbers and artifact revisions are integers assigned by the
@@ -340,7 +339,7 @@ one caller can succeed for a given current sequence. A comparison miss returns
340
339
  timestamps. An unknown build remains `404 not-found`; malformed or negative
341
340
  `expectedSeq` is `400 validation`.
342
341
 
343
- For a present `since` or `rev`, the shipped server applies JavaScript
342
+ For a present `since` or `rev`, the server applies JavaScript
344
343
  `Number(rawValue)` and accepts the result only when `Number.isInteger` is true.
345
344
  Consequently hexadecimal and exponent forms such as `0x10` and `1e1`,
346
345
  whitespace-padded values, and empty or whitespace-only values are accepted;
@@ -373,8 +372,16 @@ finished JSON answer is returned, with no accumulator or raw-log bundle. `cursor
373
372
  is the authoritative prefix included in the answer, not a guarantee to include
374
373
  appends concurrent with the request. Every call checks durable progress and
375
374
  persisted state; parallel instances may safely advance the same checkpoint.
376
- Snapshots are disposable caches: deletion, corruption, wrong versions and
377
- unreadable cache storage cause replay. Log read failures remain errors.
375
+ Server-owned snapshots are disposable caches: deletion, corruption, wrong versions
376
+ and unreadable cache storage cause server-side replay. Log read failures remain errors.
377
+ The server answer is canonical for remote clients, regardless of missing, malformed
378
+ or different `x-autobuild-catalog-identity` headers. The strict body stays exactly
379
+ `{version, cursor, value}`. A reducer version mismatch, invalid envelope or invalid
380
+ finished value raises `ReducerValueIncompatibilityError`, naming the reducer,
381
+ client/server versions and validation detail. Clients never reconstruct named
382
+ answers from raw events. Repository build-digest batches are likewise canonical:
383
+ one repo-scoped GET returns the batch without client build discovery or per-build
384
+ reducer requests. This does not change the explicit snapshot or event APIs.
378
385
 
379
386
  The executable catalog is `kernel/reducer-registry.ts`. All requests reject
380
387
  unknown names, excluded reducers, wrong scopes and invalid/extra arguments with
@@ -466,14 +473,12 @@ elapses, whichever comes first; at the bound it answers `200 []`. Omitting
466
473
  digits — deliberately stricter than the lenient `since`/`rev` conversion above:
467
474
  empty, whitespace-padded, hexadecimal, signed, and non-integral values are `400
468
475
  validation`, not coerced. Values above the server's documented ceiling are
469
- clamped to it, never rejected; the shipped self-hosted server's ceiling is 30
470
- seconds (the stream/session wait ceiling) and the shipped hosted service's is
471
- 25 seconds, stated in its README together with the route `maxDuration` the hold
472
- requires. A held request's authentication, token scope, and version-skew rules
476
+ clamped to it, never rejected; implementation-dependent examples are 30
477
+ seconds (the stream/session wait ceiling) and 25 seconds. A held request's authentication, token scope, and version-skew rules
473
478
  are identical to the immediate form: a `401`, `403`, or `409` identity failure
474
479
  is answered immediately, never held.
475
480
 
476
- The parameter is purely additive in the version it landed in (protocol `2`,
481
+ The parameter is purely additive in the version it merged in (protocol `2`,
477
482
  where the event-wait rules were introduced): a server
478
483
  that ignores `wait` remains conforming — its immediate empty answers only raise
479
484
  the client's request rate — and a client that sends `wait` to such a server
@@ -514,13 +519,13 @@ creation operation and must not reset timestamps, events, artifacts, or lease
514
519
  state when the repository already exists. Event sequence numbering starts at 1
515
520
  for each repository independently of every build and other repository.
516
521
 
517
- A `BuildDigest` projects terminal, observation, and compact landing evidence
522
+ A `BuildDigest` projects terminal, observation, and compact merge evidence
518
523
  from one build's log:
519
524
 
520
525
  ```jsonc
521
526
  // BuildDigest
522
527
  {
523
- "integrationAuditPending": true, // optional: kernel landing audit requested, not yet settled
528
+ "integrationAuditPending": true, // optional: kernel merge audit requested, not yet settled
524
529
  "slug": "ab-fix-login-3",
525
530
  "terminal": "done", // optional: "done" | "aborted", omitted while the log has neither
526
531
  "observations": [ // ascending-seq pairs for the log's observation.recorded events
@@ -528,7 +533,7 @@ from one build's log:
528
533
  { "seq": 4, "ts": "2026-07-15T12:00:04.000Z" }
529
534
  ],
530
535
  "merged": "2026-07-15T12:00:06.000Z", // optional: ts of the log's latest pr.merged, omitted when none
531
- "mergedSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", // optional: that merge's actual landing SHA
536
+ "mergedSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", // optional: that merge's actual merge SHA
532
537
  "nodeContribution": { // optional: latest node.contribution-recorded payload
533
538
  "landing": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
534
539
  "head": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
@@ -539,7 +544,7 @@ from one build's log:
539
544
  ```
540
545
 
541
546
  The optional `mergedSha` and `nodeContribution` fields let admission index
542
- confirmed landing evidence without fetching every historical build's full facts.
547
+ confirmed merge evidence without fetching every historical build's full facts.
543
548
  A node contribution is usable only when its `landing` matches `mergedSha`;
544
549
  recording or recovering a contribution advances `readinessChangeSeq`. These
545
550
  members are additive: older peers can omit them, leaving presence unproven rather
@@ -659,8 +664,7 @@ together with the effective `maxBytes`, computed from it as follows. Paths and
659
664
  entry counts are bounded, so the worst-case wire overhead is a constant:
660
665
  `overhead = 1024 + 1000 × 320 = 321024` bytes, and
661
666
  `maxBytes = min(26214400, max(0, floor((maxRequestBytes − overhead) × 3 / 4)))`
662
- (base64 inflates content by 4/3); `maxEntries` stays 1000. The hosted service
663
- sets `maxRequestBytes` to 4 MiB, giving an effective per-asset limit of 2904960
667
+ (base64 inflates content by 4/3); `maxEntries` stays 1000. For example, an instance with `maxRequestBytes` of 4 MiB has an effective per-asset limit of 2904960
664
668
  bytes (about 2.8 MiB). The formula is a safe lower bound, not the final
665
669
  authority:
666
670
 
@@ -687,9 +691,12 @@ authority:
687
691
 
688
692
  ## 5. Operator-session operations
689
693
 
694
+ Operator HTTP writes record facts only; they never start or resume an agent
695
+ turn. Historical turn events and streams retain their validation and read
696
+ contracts. External operator harnesses own execution and scheduling.
697
+
690
698
  Operator sessions are a third resource kind: durable orchestrator-conversation
691
- state keyed by repository and session owner (the human account in `operator`). They are hosted-only — local installs
692
- interact through the CLI and dashboard and never create one — but the resource
699
+ state keyed by repository and session owner (the human account in `operator`). Local CLI workflows do not create these resources; the resource
693
700
  contract is uniform, and a conforming server implements it the same way it
694
701
  implements the repository journal. A session record is:
695
702
 
@@ -739,10 +746,8 @@ section 6 apply to session-scoped streams unchanged.
739
746
  Event reads honor the bounded wait: when no newer event exists, the server may
740
747
  hold the request up to the parsed `wait` bound in whole seconds, returning as
741
748
  soon as an event is appended and no later than the bound; a `wait` above the
742
- event-wait ceiling of section 3 — 30 seconds on the shipped self-hosted server,
743
- 25 on the shipped hosted service — is clamped to it. Held session-event reads poll at the hosted
744
- one-second budget (`EVENT_WAIT_POLL_MS = 1000`), matching the build and
745
- repository event reads, so append-to-wake is typically under one second. The
749
+ event-wait ceiling of section 3 — for example 30 or 25 seconds depending on the instance — is clamped to it. An implementation may poll at a
750
+ one-second budget (1000 ms) for session, build and repository event reads. The
746
751
  clamp and early-return semantics are exactly the
747
752
  stream read's, so a poll loop cannot drift between the two.
748
753
 
@@ -832,7 +837,7 @@ session-attribution dimension — stream parts have no actor.
832
837
  | `readStream` | `GET /builds/{slug}/streams/{id}/chunks?since={n}&wait={n}` and the `/repos/{repo}` form | optional `since` (default `0`) parsed leniently like the `since` of section 3; `wait` (whole seconds) parsed by the digits-only grammar of section 3's event-wait rules — one or more ASCII digits, anything else `400 validation` per section 9 — and clamped to the 30-second stream ceiling below | `200` + read response: chunks with `seq >` parsed `since`, in increasing order |
833
838
  | `closeStream` | `POST /builds/{slug}/streams/{id}/close` and `POST /repos/{repo}/streams/{id}/close` | `{"outcome": "completed" \| "aborted"}` | `200` + the closed `StreamRecord` |
834
839
 
835
- Because a stream id is globally unique but names no scope, the shipped server
840
+ Because a stream id is globally unique but names no scope, a conforming server
836
841
  and client additionally expose the four addressed operations as top-level
837
842
  routes, which resolve the stream's own scope and then authorize against it:
838
843
 
@@ -892,7 +897,7 @@ by this rule (their retention belongs to the open archival thread), and open
892
897
  streams are never pruned. A read of a stream whose chunks were pruned returns
893
898
  no chunks, `status: "closed"`, and the artifact reference.
894
899
 
895
- These additions were purely additive in the version they landed in (protocol
900
+ These additions were purely additive in the version they merged in (protocol
896
901
  `2`, where the stream routes were introduced), and a
897
902
  conforming server implements the stream routes together with this document's
898
903
  rules exactly as it does for the event and artifact routes.
@@ -903,32 +908,33 @@ Project credentials are opaque `abp_1_<id>_<secret>` bearer values bound to one
903
908
  registered normalized repository. The service stores only a SHA-256 digest of
904
909
  the random secret, plus project, creator, creation time, last use, expiry and
905
910
  revocation metadata. It checks credential status and project registration on
906
- every request. Revocation takes effect on the next request without affecting
911
+ every request. Within one HTTP invocation, registry, authentication and adapter
912
+ operations share at most one full registration/deletion admission per repository.
913
+ The next request always admits afresh. Reads use that admitted identity; each
914
+ mutation transaction locks and checks its generation before writing. Deletion
915
+ waits for an active mutation transaction, then invalidates the generation with
916
+ the initial purge. A later mutation in the same request may receive `403 project
917
+ not registered`; its transaction rolls back, while earlier committed operations
918
+ remain committed. No connection or transaction is held for the whole request.
919
+ Revocation takes effect on the next request without affecting
907
920
  other credentials. Unknown, expired or revoked credentials receive `401 auth`;
908
- removed projects receive `403 auth` with `project not registered`.
909
-
910
- The deployment owner runs these commands locally with database access:
911
-
912
- ```sh
913
- ab-hosted-store credentials issue https://github.com/acme/app --user owner@example.com
914
- ab-hosted-store credentials list https://github.com/acme/app
915
- ab-hosted-store credentials revoke https://github.com/acme/app --id ID --user owner@example.com
916
- ```
917
-
918
- Issue prints the secret once; list contains metadata only. Issue optionally
919
- accepts `--ttl-seconds N` or `--expires-at ISO-8601`. For administrative/non-interactive issuance, set the returned token as
920
- `AB_TOKEN`. Interactive project onboarding uses `ab connect <service-url>`;
921
- it saves the credential outside the repository and commits no secret. Previous `AB_TOKEN` values and `mint operator` / `mint build` are
922
- retired: the service responds that the credential format changed and points
923
- to `credentials issue`. Supported old protocol shapes still work with a new
924
- credential; protocol compatibility does not restore retired authentication.
925
-
926
- `mint admin --ttl-seconds N` creates an explicit versioned, attributed owner
927
- break-glass credential. It can cross project boundaries. Keep it owner-only:
928
- never give it or `AB_STORE_SECRET` to a dispatcher or build agent.
921
+ removed projects receive `403 auth` with `project not registered` when the
922
+ repository is established independently. Permanent project deletion removes
923
+ credentials, so old credentials receive `401` unknown or revoked credential,
924
+ including on `/connect/v1/status`, and remain invalid after reconnection.
925
+ See [permanent project deletion](operator-api.md#permanent-project-deletion)
926
+ for purge, retry and generation-bound confirmation semantics.
927
+
928
+ Obtain a project credential with `ab connect <instance-url>` or from the
929
+ instance, and use `AB_TOKEN` on non-interactive clients. Interactive connection
930
+ saves the credential outside the repository. Retired credential formats are
931
+ refused with a credential-format-changed diagnostic; supported old protocol
932
+ shapes still require current credentials. Compatibility does not restore retired
933
+ authentication. Versioned, attributed owner-admin credentials are an explicit
934
+ cross-project exception and must never be supplied to build agents.
929
935
 
930
936
  Service-owned signatures use `base64url(JSON scope) + "." +
931
- base64url(HMAC-SHA256(AB_STORE_SECRET, payloadSegment))`. Signatures are checked
937
+ base64url(HMAC-SHA256(instanceSigningKey, payloadSegment))`. Signatures are checked
932
938
  in constant time. Current strict scope shapes are:
933
939
 
934
940
  ```jsonc
@@ -967,10 +973,13 @@ project; phase CLI scoped handles still constrain build and session access.
967
973
  Authenticated raw writes cannot claim a delegated `via`. Owner-project
968
974
  credentials also use their recorded creator for operator writes. Dispatcher
969
975
  credentials have an immutable server-side purpose: raw store and tickets only,
970
- never operator controls. The hosted dispatcher issues one per project
971
- invocation, expiring at its configured TTL, and does not revoke at tick return
972
- for dispatcher plumbing. Spawned builds receive independent delegated grants. Shared content-addressed blobs
973
- remain deduplicated; this is resource authorization, not blob partitioning.
976
+ never operator controls. Each hosted cron repository tick deletes its exact issued
977
+ dispatcher-purpose credential row on success or failure. Its crash-safety expiry
978
+ is the earlier of the configured token TTL and the invocation deadline plus
979
+ 60 seconds. Spawned builds receive independent delegated grants whose authority
980
+ continues according to their durable lifecycle after the parent row is deleted
981
+ or expires. Shared content-addressed blobs remain deduplicated; this is resource
982
+ authorization, not blob partitioning.
974
983
 
975
984
 
976
985
  ### Delegated build and harvest credentials
@@ -1104,7 +1113,7 @@ These rules apply identically to build, repository, and session deposits.
1104
1113
  ## 9. Errors and validation
1105
1114
 
1106
1115
  Every non-success response is exactly the JSON error shape from section 2.
1107
- The shipped server maps failures as follows:
1116
+ Conforming servers map failures as follows:
1108
1117
 
1109
1118
  | Status | `kind` | Meaning |
1110
1119
  |---:|---|---|
@@ -1189,12 +1198,10 @@ For streams, the backing store must additionally maintain:
1189
1198
  30-second clamp and no wait on closed streams;
1190
1199
  - the bounded wait on the build, repository, and session event reads exactly
1191
1200
  as specified in section 3, with no per-request database poll faster than once
1192
- per second (the shipped PostgreSQL adapter polls held reads at
1193
- `EVENT_WAIT_POLL_MS = 1000`, so an append by another connection is observed
1194
- at the next poll — typically within about one second, worst case one poll
1195
- interval plus the query round-trip; a hard ≤1 s worst case would need
1196
- LISTEN/NOTIFY wake-on-append at a dedicated connection per held request on
1197
- a pooled provider, a cost considered and declined);
1201
+ per second (a 1000 ms polling implementation observes an append by another
1202
+ connection at the next poll, typically within about one second, with a worst
1203
+ case of one poll interval plus the query round-trip; the protocol does not
1204
+ promise a hard ≤1 s worst case);
1198
1205
  - the atomic close — document assembly, artifact deposit, and the closed
1199
1206
  record visible together or not at all, with the stream left open and
1200
1207
  unwritten when the deposit fails;
@@ -1235,10 +1242,10 @@ Four shipped behaviors do not add `BuildStore` routes:
1235
1242
  - `RemoteBuildStore.close()` is a no-op. The remote server owns its backing
1236
1243
  store lifecycle; there is no close endpoint.
1237
1244
  - `GET /health` is outside the `BuildStore` interface. It is always open and
1238
- returns exactly `200 {"ok":true,"autobuildVersion":"<package>",
1239
- "protocolVersion":"4", "supportedClientRange":{"minVersion":"0.9.0",
1240
- "maxVersionExclusive":"0.12.0"}}`. It reports HTTP-process availability and identity,
1241
- not a deeper backing-store transaction or migration check.
1245
+ returns `200 {"ok":true,"autobuildVersion":"1.1.0",
1246
+ "protocolVersion":"6", "supportedClientRange":{"minVersion":"1.0.0",
1247
+ "maxVersionExclusive":"1.2.0"}}`. It reports HTTP-process availability and identity,
1248
+ not a deeper backing-store transaction or migration check. The example shows the 1.1 release identity.
1242
1249
 
1243
1250
  There is no push/WebSocket subscription protocol, repository listing, artifact
1244
1251
  deletion, or server deployment API. The one repo-scoped batch read is the
@@ -1304,7 +1311,7 @@ and credential id, never the secret. Cancel denies pending work or revokes
1304
1311
  only that request's already approved credential. Polling and authenticated
1305
1312
  browser code lookup have durable limits; 429 includes Retry-After.
1306
1313
 
1307
- The web-enabled origin serves `/connect` and cookie-authenticated JSON
1314
+ The instance provides `/connect` and cookie-authenticated JSON
1308
1315
  `POST /connect/v1/browser/lookup` and `/decide`. Decisions read the saved
1309
1316
  proposal, require an allowed live Better Auth session and exact Origin, and
1310
1317
  atomically register the project, install the digest and record the outcome.
@@ -1337,3 +1344,170 @@ clients, retaining their decoders and the supported three-line window.
1337
1344
  fact: `{ identity, from, to, mapping }`, where mapping contains source ticket IDs
1338
1345
  and destination IDs. All migration facts survive dispatcher-run turnover.
1339
1346
  Conflicting identity reuse or source-qualified mappings fail replay closed.
1347
+
1348
+
1349
+ Browser lookup returns `{connection,assignment,organizations,assignedOrganization}`.
1350
+ `connection` may be null. `assignment` is `new` for any unassigned project,
1351
+ regardless of registry history, and `fixed` for an assigned project.
1352
+ `assignedOrganization` is its current `{id,name}`, or null for unassigned or
1353
+ unknown projects. Organizations are eligible `{id,name,membershipRole}`
1354
+ destinations for unassigned projects (all for super users, actual memberships
1355
+ otherwise), empty for fixed reconnects or unknown codes. Context uses the same
1356
+ lookup limits, expiry, admission and foreign-project masking; it assigns nothing.
1357
+
1358
+ Valid code links open approval directly, showing a checking status during lookup.
1359
+ Signed-out users return from sign-in to that approval. Missing or malformed codes
1360
+ retain manual entry. The approval screen always shows the organization: a
1361
+ read-only name for assigned projects, or destination choices for unassigned ones.
1362
+ A sole option is visibly selected and its ID explicitly submitted. Multiple
1363
+ options require a choice; zero destinations prevent approval and explain that
1364
+ a super user must create an organization.
1365
+
1366
+ Browser approval requires `organizationId` for every unassigned project,
1367
+ including fresh, legacy active and removed projects, even for super users or
1368
+ single-membership approvers. Members can select their own orgs; super users can
1369
+ select any org. Missing IDs return 400; ineligible or nonexistent IDs return 403.
1370
+ Registration, assignment, credential insertion and the approval decision commit
1371
+ atomically; refusal changes none of them. Current access and assignment are
1372
+ rechecked under the access lock. Assigned reconnects keep their organization;
1373
+ a different supplied ID is refused, and moves use organization management.
1374
+ Previously registered unassigned projects remain accessible only to super users
1375
+ until management assignment or an authorized reconnect approval assigns them.
1376
+ Denial requires no destination and changes no assignment.
1377
+ Browser lookup and decisions hide foreign projects as unknown connections, even
1378
+ after resolution. Machine request/poll/cancel/status/revoke contracts and existing
1379
+ credentials are unchanged.
1380
+
1381
+ ## Operator presence
1382
+
1383
+ The presence collection uses `POST /repos/:repo/operator-presence` and `GET` of that collection.
1384
+ These require repository operator/admin authority; build, harvest and conversation
1385
+ credentials are rejected before presence lookup or mutation. No MCP tools are added.
1386
+
1387
+ POST accepts a strict `{id, host, pid, startedAt}` object: ID and host are nonblank
1388
+ strings of at most 256 characters, PID a positive safe integer, and startedAt a
1389
+ valid ISO timestamp. It atomically upserts `(repo,id)`, preserving the original
1390
+ start time, updating host/PID and stamping heartbeatAt from the adapter clock.
1391
+ Heartbeat never moves backward. The response is `{repo,id,host,pid,startedAt,heartbeatAt}`.
1392
+ GET returns those records ordered by ID, only where heartbeat age is less than
1393
+ 300,000ms; an unknown repository returns `[]` without creating anything. Neither
1394
+ collection operation appends events, claims leases or requires a repository journal. Expired
1395
+ rows can be renewed under the same ID. Multiple concurrent registrations coexist;
1396
+ this is advisory liveness, with no election, lock or singleton semantics.
1397
+
1398
+ Protocol 6 adds `DELETE /repos/:repo/operator-presence/:id`, with the same
1399
+ repository operator/admin authority and delegated credential refusal before lookup
1400
+ or mutation. The ID is one encoded segment with the same validation as POST.
1401
+ It returns `{ok:true}` even for an absent/expired ID or absent repository, removes
1402
+ only that repository/ID, and creates no journal, event or lease. A later POST
1403
+ re-registers the same ID. Watch withdrawal treats only 404/405 as an unsupported
1404
+ route and silently retains TTL expiry; authorization, transport and malformed
1405
+ success errors are diagnosed without failing the watch.
1406
+
1407
+ Release line 1.1 uses protocol 6. Published v1.0.0/v1.0.1 use protocol 4;
1408
+ protocol 5 never shipped. The release identity table retains `1.0 -> 4`, and
1409
+ a 1.1/protocol-6 instance admits those published clients. A 1.0 instance does
1410
+ not admit 1.1 clients; route fallback never bypasses peer admission. Patches
1411
+ within a published release line must keep its protocol identity.
1412
+
1413
+
1414
+ ## Project secrets (v1)
1415
+
1416
+ The web app's **Settings** tab also manages project secrets. Its separate
1417
+ cookie-session routes are `GET /api/web/repos/<encoded repo>/secrets`,
1418
+ `POST .../secrets/set` with strict `{name,value}`, and
1419
+ `POST .../secrets/remove` with strict `{name}`. An unexpired signed-in session
1420
+ and fresh project organization membership or super-user authority authorize each
1421
+ request. Browser mutations require the configured same-origin Origin and JSON.
1422
+ The normalized signed-in email is the owner and audit actor. Reads return only
1423
+ allowlisted secret metadata and account name, kind, credentialEnv and readiness
1424
+ from recorded effective configuration; absent or unavailable configuration does
1425
+ not prevent secret management. Browser set/replace atomically refuses existing
1426
+ non-static credentials. Renew ChatGPT credentials with
1427
+ `ab accounts login <account> --project`. Values are write-only, cleared after
1428
+ acknowledgment and never returned in responses. Removal confirms in the shared
1429
+ dialog before writing. The machine routes below retain their project-owner
1430
+ credential requirement and CLI replacement semantics.
1431
+
1432
+ Project secrets are separate from BuildStore artifacts and machine credentials.
1433
+ They are write-only: no CLI, store method, operator tool, MCP tool or web route
1434
+ returns a value, ciphertext, access token or refresh state. The only plaintext
1435
+ consumer is the hosted dispatcher's internal resolver. Local dispatchers use
1436
+ their own environment.
1437
+
1438
+ The machine routes below require the standard client/version headers and bearer authorization,
1439
+ return JSON with `Cache-Control: no-store`, and require a saved `project-owner`
1440
+ credential issued through `ab connect`. The project must match the credential,
1441
+ remain registered, and its creator must still have project membership. Dispatcher,
1442
+ build, delegated, internal and administrative credentials are refused.
1443
+
1444
+ | Route | Input | Response |
1445
+ | --- | --- | --- |
1446
+ | `GET /secrets/v1/list?repo=<encoded repository identity>` | Project identity | `{version: 1, secrets: [...]}` |
1447
+ | `POST /secrets/v1/set` | `{version: 1, repo, name, value}` | `{version: 1, ok: true}` |
1448
+ | `GET /secrets/v1/chatgpt-host?repo=<encoded repository identity>` | Project identity | `{version: 1, hostId}` (nonsecret destination identity) |
1449
+ | `POST /secrets/v1/chatgpt` | `{version: 1, repo, name, state}` (validated ChatGPT registration) | `{version: 1, ok: true}` |
1450
+ | `POST /secrets/v1/remove` | `{version: 1, repo, name}` | `{version: 1, ok: true}` |
1451
+
1452
+ The ChatGPT write accepts a strict versioned registration containing its destination
1453
+ host ID, issued client ID, validated subject, granted scopes, access/refresh/ID
1454
+ tokens and expiry/refresh window. It validates destination identity and stores
1455
+ only an encrypted refreshing payload. No response exposes tokens or provider
1456
+ state; browser authorization completes on the operator's machine.
1457
+
1458
+ Writes accept only the listed fields. Static values are nonempty strings, at most
1459
+ 64 KiB in UTF-8, without NUL. Names are case-sensitive environment identifiers
1460
+ `[A-Z_][A-Z0-9_]*`, at most 128 characters. Dispatcher authority and process-control
1461
+ names are reserved: store, forge, Vercel, cron, database, object-storage, loader,
1462
+ proxy and runtime-control variables cannot be overridden. This includes `AB_*`,
1463
+ `GITHUB_*`, `GH_*`, `VERCEL_*`, `CRON_*`, `DATABASE_*`, `POSTGRES_*`, `PG*`,
1464
+ `AWS_*`, `BLOB_*`, `PATH`, `HOME`, `NODE_*` and `BUN_*`.
1465
+ Subscription names such as `ANTHROPIC_API_KEY`, `CLAUDE_CODE_OAUTH_TOKEN` and
1466
+ `KIMI_API_KEY` are accepted.
1467
+
1468
+ Each metadata entry contains `name`, `kind`, `owner` (the member who set the
1469
+ current value), `setAt` (ISO timestamp), `fingerprint` (16 hexadecimal characters,
1470
+ keyed and non-reversible), `status` (`ready`, `refreshing`, `failed`), `failureCode`
1471
+ (null, `refresh-failed` or `refresh-expired`) and `lastSuppliedAt` (ISO timestamp
1472
+ or null). A refreshing secret may also include typed `warnings`, currently
1473
+ `["refresh-window-too-short"]` when its permitted refresh window is shorter than
1474
+ the five-minute tick interval plus a one-minute safety margin. This is advisory;
1475
+ missing warnings do not establish a sufficient window when encrypted state is
1476
+ unavailable for diagnosis. Set/replace resets delivery and failure metadata.
1477
+ Every set/remove records actor and time without material. Supply means the environment was handed
1478
+ to a kernel, not that a build completed.
1479
+
1480
+ On each hosted tick the complete current project set overrides the deployment
1481
+ environment for that project only. Replacement/removal applies on the next tick.
1482
+ Resolution failure suppresses intake and all new execution launches. When the
1483
+ ready subset can be read, a revision-fenced observation-only pass repairs running
1484
+ execution policies: unavailable names are withheld, their transforms are revoked,
1485
+ and unrelated ready account transforms remain active. It performs no janitor,
1486
+ resume, lease-sweep, or harvest launch work. If encryption or decryption prevents
1487
+ reading that subset, the project is skipped. Resolution and handoff validate the
1488
+ complete generation/revision set, including unavailable rows; a stale handoff
1489
+ runs no observation or dispatch. Normal dispatch still requires the complete
1490
+ usable secret set; other projects can continue. Projects without saved secrets resolve and supply an
1491
+ empty set without encryption configuration, including when another project has
1492
+ secrets. All secret mutations still require valid encryption configuration, even
1493
+ on an empty project. An empty snapshot becomes stale if a secret is added before
1494
+ handoff. Metadata remains available for diagnosis.
1495
+
1496
+ Refreshing kinds are internal provider integrations, not arbitrary endpoint URLs
1497
+ or CLI write formats. The five-minute hosted cadence is unchanged. A token that
1498
+ is valid now but not yet refreshable is supplied unchanged; a caller’s future
1499
+ validity horizon cannot reject it. The first tick at or after the provider’s
1500
+ earliest-refresh time rotates the credential and commits encrypted replacement
1501
+ state before supply. Providers omitting that time use a ten-minute pre-expiry
1502
+ refresh margin to tolerate a delayed five-minute tick. After downtime, expired
1503
+ access state is refreshed before supply while its durable status remains ready.
1504
+ Failed or uncertain refresh attempts prevent supply and require replacement. A valid
1505
+ credential is never revoked merely because its refresh window is short. A durable
1506
+ attempt permits only one refresh caller across overlapping ticks. An abandoned attempt expires to failed without reusing the
1507
+ possibly consumed refresh token; explicit replacement is required. Errors use
1508
+ fixed safe codes and never reflect provider responses or submitted values.
1509
+
1510
+ Use `ab secrets list [--json]`, `ab secrets set NAME` or `ab secrets remove NAME`
1511
+ from a connected checkout outside build/harvest sessions. Set reads hidden terminal
1512
+ input or redirected stdin. There is no value argument and values are never printed.
1513
+ The commands use the saved owner credential, even if an ambient build token exists.
@@ -1,6 +1,7 @@
1
1
  # Hosted ticket protocol
2
2
 
3
- The hosted ticket protocol exposes the complete `TicketSource` port without
3
+ A conforming hosted instance implements this normative remote ticket contract
4
+ for the complete `TicketSource` port without
4
5
  exposing backend credentials. It shares the Autobuild and remote protocol
5
6
  version headers with the remote BuildStore. The version must be in the
6
7
  published service window and the protocol must
@@ -10,13 +11,12 @@ A service accepts stable and prerelease clients from its own `major.minor`
10
11
  release line and the two preceding minor lines in the same major. A major starts a new family:
11
12
  X.0 accepts only X.0, X.1 accepts X.0/X.1, and X.2 onward accepts three lines.
12
13
  Patch versions are interchangeable in both directions and must never change
13
- the protocol. Upgrade the service first, then projects independently within
14
- its window. Supported release lines retain their wire handlers and known
14
+ the protocol. Clients must remain within the instance’s published compatibility window. Supported release lines retain their wire handlers and known
15
15
  protocol identities; an unknown protocol is refused independently of version.
16
16
  Stable and prerelease service and client identities share their numeric major/minor
17
17
  line. Malformed or missing identities, build metadata (`+…`), prefixes and
18
18
  whitespace are refused with HTTP 409.
19
- A newer client is told to upgrade the service; a client below the window is
19
+ A newer client receives an instance-upgrade diagnostic; a client below the window is
20
20
  told to upgrade the project's Autobuild. Diagnostics name the service version
21
21
  and supported range.
22
22
 
@@ -39,29 +39,28 @@ Project credentials are opaque `abp_1_<id>_<secret>` bearer values bound to one
39
39
  registered normalized repository. The service stores only a SHA-256 digest of
40
40
  the random secret, plus project, creator, creation time, last use, expiry and
41
41
  revocation metadata. It checks credential status and project registration on
42
- every request. Revocation takes effect on the next request without affecting
42
+ every request. Registry, grant authentication and adapters share one full
43
+ registration/deletion admission per repository within that request; the next
44
+ request admits afresh. Each mutation transaction checks and locks the admitted
45
+ generation before writing. Deletion invalidates that generation with its initial
46
+ purge, so a later transaction in the same request may be refused atomically;
47
+ earlier committed operations remain committed. Reads need no further admission.
48
+ Revocation takes effect on the next request without affecting
43
49
  other credentials. Unknown, expired or revoked credentials receive `401 auth`;
44
- removed projects receive `403 auth` with `project not registered`.
45
-
46
- The deployment owner runs these commands locally with database access:
47
-
48
- ```sh
49
- ab-hosted-store credentials issue https://github.com/acme/app --user owner@example.com
50
- ab-hosted-store credentials list https://github.com/acme/app
51
- ab-hosted-store credentials revoke https://github.com/acme/app --id ID --user owner@example.com
52
- ```
53
-
54
- Issue prints the secret once; list contains metadata only. Issue optionally
55
- accepts `--ttl-seconds N` or `--expires-at ISO-8601`. For administrative/non-interactive issuance, set the returned token as
56
- `AB_TOKEN`. Interactive project onboarding uses `ab connect <service-url>`;
57
- it saves the credential outside the repository and commits no secret. Previous `AB_TOKEN` values and `mint operator` / `mint build` are
58
- retired: the service responds that the credential format changed and points
59
- to `credentials issue`. Supported old protocol shapes still work with a new
60
- credential; protocol compatibility does not restore retired authentication.
61
-
62
- `mint admin --ttl-seconds N` creates an explicit versioned, attributed owner
63
- break-glass credential. It can cross project boundaries. Keep it owner-only:
64
- never give it or `AB_STORE_SECRET` to a dispatcher or build agent.
50
+ removed projects receive `403 auth` with `project not registered` when the
51
+ repository is established independently. Permanent project deletion removes
52
+ credentials, so old credentials receive `401` unknown or revoked credential,
53
+ including on `/connect/v1/status`, and remain invalid after reconnection.
54
+ See [permanent project deletion](operator-api.md#permanent-project-deletion)
55
+ for purge, retry and generation-bound confirmation semantics.
56
+
57
+ Obtain a project credential with `ab connect <instance-url>` or from the
58
+ instance, and use `AB_TOKEN` on non-interactive clients. Interactive connection
59
+ saves the credential outside the repository. Retired credential formats are
60
+ refused with a credential-format-changed diagnostic; supported old protocol
61
+ shapes still require current credentials. Compatibility does not restore retired
62
+ authentication. Versioned, attributed owner-admin credentials are an explicit
63
+ cross-project exception and must never be supplied to build agents.
65
64
 
66
65
  Hosted tickets, comments, blockers, creation-key deduplication and assets belong
67
66
  to exactly one registered project, even when projects use the same team key.
@@ -133,12 +132,6 @@ MCP ticket surfaces refuse with a message naming that project and source: its
133
132
  tickets live in its own source, accessed directly by its dispatcher. This is a
134
133
  409 conflict, not an empty queue. The dispatcher's direct adapters are unchanged.
135
134
 
136
- `AB_TICKET_BACKEND` and `LINEAR_API_KEY` are removed service settings. Their
137
- presence (even blank or unknown values) is ignored and emits one startup removal
138
- message. `AB_TICKET_TRIAGE_STATE`, `AB_TICKET_READY_STATE`,
139
- `AB_TICKET_DOING_STATE` and `AB_TICKET_DONE_STATE` are removed and ignored,
140
- including malformed values. These retired settings do not prevent startup.
141
-
142
135
  ## Operations
143
136
 
144
137
  The operation names and `input` values are:
@@ -173,7 +166,7 @@ lines, or trailing whitespace.
173
166
  New hosted tickets use `<teamKey>-<n>`, for example `ENG-1`. The effective
174
167
  project configuration supplies the literal prefix; the request's `teamKey`
175
168
  does not choose it. Numbers start at 1 in each project, increase atomically
176
- across concurrent creates, and are never reused after deletion. Projects sharing
169
+ across concurrent creates, and are never reused after individual ticket deletion. Permanent project deletion removes the counter; an approved reconnection starts at 1. Projects sharing
177
170
  a team key have independent counters. Changing `teamKey` affects only future
178
171
  ids and continues the same numbering; existing ids retain their captured prefix.
179
172
 
@@ -185,18 +178,6 @@ is `dependency-states`: each result's `id` echoes the requested id for correlati
185
178
  while its `blockedBy` edges are canonical. Raw historical events and artifacts
186
179
  remain unchanged. These rules apply only to hosted tickets, not file or Linear ids.
187
180
 
188
- Upgrade the service with its environment-aware migration command before serving
189
- requests. The transactional migration preserves storage keys and assigns existing
190
- tickets numbers in `(created_at, id)` order within each project. It first resolves
191
- legacy team ownership, then reads each populated project's current independent
192
- ticket policy. Projects without that policy use their selected effective
193
- configuration through the configured blob backend. Independent-policy projects
194
- need no uploaded config or blob access. Missing or invalid fallback config,
195
- missing `teamKey`, or inaccessible required blobs abort the entire migration
196
- unchanged with a project diagnostic. Restore that config/blob access and rerun;
197
- an ownership assignment alone cannot supply a readable prefix. Empty projects
198
- need no config lookup. Re-running a completed migration does not renumber tickets.
199
-
200
181
  ## Errors and conformance
201
182
 
202
183
  Errors are JSON `{ "error": string, "kind": "validation" | "not-found" |
@@ -205,10 +186,9 @@ or backend construction. Responses never include exception causes, stacks,
205
186
  environment values, or credentials. Client 401/403 responses become
206
187
  `AuthError`; other backend messages remain actionable.
207
188
 
208
- The shared `TicketSource` contract is normative for the database adapter and
209
- the hosted client/server pair. PostgreSQL migration and isolation tests prove
210
- project partitions. The direct Linear client retains its separate opt-in
211
- GraphQL contract; no Linear adapter ships through the hosted ticket entry point.
189
+ The shared `TicketSource` contract is normative for protocol implementations.
190
+ Project partitions must be isolated. The direct Linear client retains its
191
+ separate opt-in GraphQL contract; this protocol does not proxy Linear.
212
192
 
213
193
  Every ticket returned by list, get, or create requires a boolean `resolved`,
214
194
  with the same source-native completion semantics as `DependencyState.resolved`.
@@ -332,7 +312,7 @@ This capability is independent of revision and comment capabilities and of the
332
312
  client version. Without it, both fields are projected away, preserving historical
333
313
  strict decoders. Current hosted clients send all three capability headers and
334
314
  default absent kind to `work`. Unfiltered listing includes all ticket states and
335
- empty nodes for `ab ticket tree`; dispatch and landing behavior are unchanged.
315
+ empty nodes for `ab ticket tree`; dispatch and merge behavior are unchanged.
336
316
 
337
317
  Completed ticket imports record `tickets.migration-recorded` in the selected
338
318
  BuildStore repository journal, with export identity, origin/destination adapter