@defrex/autobuild 1.1.0 → 1.3.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 (157) hide show
  1. package/README.md +5 -13
  2. package/SPEC.md +249 -15
  3. package/bin/ab-dispatch-generation.ts +11 -2
  4. package/docs/accounts.md +130 -0
  5. package/docs/agent-runtimes.md +4 -4
  6. package/docs/answering-blocked-builds.md +4 -1
  7. package/docs/architecture.md +224 -12
  8. package/docs/build-store.md +3 -41
  9. package/docs/builds.md +2 -0
  10. package/docs/cli.md +14 -0
  11. package/docs/configuration-overview.md +117 -0
  12. package/docs/configuration.md +266 -141
  13. package/docs/dispatcher-hosting.md +18 -33
  14. package/docs/intake.md +2 -0
  15. package/docs/integration-tree.md +16 -5
  16. package/docs/merge-policy.md +1 -3
  17. package/docs/operating.md +1 -2
  18. package/docs/operator-api.md +144 -53
  19. package/docs/operator-surfaces.md +32 -20
  20. package/docs/overview.md +1 -1
  21. package/docs/plugin-authoring.md +27 -1
  22. package/docs/remote-store-protocol.md +259 -91
  23. package/docs/remote-ticket-protocol.md +29 -49
  24. package/docs/restacking.md +45 -0
  25. package/docs/seams.md +8 -8
  26. package/docs/setup.md +34 -129
  27. package/docs/spec-standard.md +4 -2
  28. package/docs/ticket-dependencies.md +8 -0
  29. package/docs/ticket-sources.md +18 -0
  30. package/docs/troubleshooting.md +7 -11
  31. package/docs/upgrading.md +1 -1
  32. package/docs/workspaces.md +4 -4
  33. package/package.json +14 -5
  34. package/packages/core/src/accounts/chatgpt-oauth.ts +216 -0
  35. package/packages/core/src/accounts/chatgpt-state.ts +41 -0
  36. package/packages/core/src/accounts/local-credentials.ts +194 -0
  37. package/packages/core/src/accounts/local-inference.ts +106 -0
  38. package/packages/core/src/accounts/local-owner.ts +123 -0
  39. package/packages/core/src/accounts/sensitive.ts +2 -0
  40. package/packages/core/src/cli/accounts.ts +147 -0
  41. package/packages/core/src/cli/binary.ts +3 -1
  42. package/packages/core/src/cli/connect.ts +3 -3
  43. package/packages/core/src/cli/dispatch-frontend.ts +1 -0
  44. package/packages/core/src/cli/dispatch-handoff.ts +125 -44
  45. package/packages/core/src/cli/dispatch-launch-contract.ts +187 -0
  46. package/packages/core/src/cli/dispatch-launcher.ts +54 -21
  47. package/packages/core/src/cli/dispatch-preflight.ts +6 -1
  48. package/packages/core/src/cli/dispatch-repository-feed.ts +107 -26
  49. package/packages/core/src/cli/dispatch.ts +135 -27
  50. package/packages/core/src/cli/dispatcher-liveness.ts +6 -1
  51. package/packages/core/src/cli/forge-clear.ts +30 -0
  52. package/packages/core/src/cli/help.ts +17 -0
  53. package/packages/core/src/cli/init-readiness-remote.ts +22 -1
  54. package/packages/core/src/cli/init-readiness-shared.ts +5 -1
  55. package/packages/core/src/cli/init-validation.ts +160 -18
  56. package/packages/core/src/cli/main.ts +72 -0
  57. package/packages/core/src/cli/publication-settlement.ts +4 -1
  58. package/packages/core/src/cli/secrets.ts +173 -0
  59. package/packages/core/src/cli/store-opening.ts +11 -1
  60. package/packages/core/src/cli/upgrade-agent.ts +9 -1
  61. package/packages/core/src/cli/watch.ts +12 -14
  62. package/packages/core/src/config/accounts.ts +101 -0
  63. package/packages/core/src/config/live.ts +14 -1
  64. package/packages/core/src/config/roles.ts +54 -3
  65. package/packages/core/src/config/schema.ts +60 -0
  66. package/packages/core/src/events/catalog.ts +1 -0
  67. package/packages/core/src/events/compatibility.ts +2 -1
  68. package/packages/core/src/events/forge-degradation-policy.ts +11 -0
  69. package/packages/core/src/events/payloads.ts +13 -0
  70. package/packages/core/src/events/policy.ts +9 -0
  71. package/packages/core/src/events/repository.ts +75 -2
  72. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +278 -0
  73. package/packages/core/src/kernel/change-presence.ts +74 -8
  74. package/packages/core/src/kernel/engine.ts +8 -0
  75. package/packages/core/src/kernel/generators/node-restack-log.ts +14 -0
  76. package/packages/core/src/kernel/node-polling.ts +40 -7
  77. package/packages/core/src/kernel/node-restack-demand.ts +74 -0
  78. package/packages/core/src/kernel/node-restack-state.ts +5 -1
  79. package/packages/core/src/kernel/node-restack-transaction.ts +33 -1
  80. package/packages/core/src/kernel/read-facts.ts +6 -0
  81. package/packages/core/src/kernel/reducer-registry.ts +3 -0
  82. package/packages/core/src/kernel/reducer.ts +4 -1
  83. package/packages/core/src/kernel/ticket-preparation.ts +66 -0
  84. package/packages/core/src/operator/annotations.ts +6 -0
  85. package/packages/core/src/operator/control.ts +20 -0
  86. package/packages/core/src/operator/index.ts +4 -0
  87. package/packages/core/src/operator/protocol.ts +6 -0
  88. package/packages/core/src/operator/registry.ts +42 -1
  89. package/packages/core/src/operator/tickets.ts +25 -4
  90. package/packages/core/src/plugins/manifest.ts +2 -1
  91. package/packages/core/src/ports/runner/account-env.ts +139 -0
  92. package/packages/core/src/ports/runner/chatgpt-provider.ts +85 -0
  93. package/packages/core/src/ports/runner/claude.ts +70 -42
  94. package/packages/core/src/ports/runner/codex.ts +63 -31
  95. package/packages/core/src/ports/runner/one-shot.ts +2 -0
  96. package/packages/core/src/ports/runner/provider-error.ts +5 -0
  97. package/packages/core/src/ports/runner/routing.ts +35 -4
  98. package/packages/core/src/ports/tickets/contract.ts +58 -0
  99. package/packages/core/src/ports/tickets/tree.ts +1 -1
  100. package/packages/core/src/ports/types.ts +28 -7
  101. package/packages/core/src/ports/workspace/account-policy.ts +72 -0
  102. package/packages/core/src/ports/workspace/build-execution.ts +6 -1
  103. package/packages/core/src/ports/workspace/builtin-capabilities.ts +1 -0
  104. package/packages/core/src/ports/workspace/create.ts +2 -0
  105. package/packages/core/src/ports/workspace/git-worktree.ts +6 -1
  106. package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -0
  107. package/packages/core/src/ports/workspace/vercel-sandbox.ts +125 -35
  108. package/packages/core/src/processes/build-runner.ts +32 -1
  109. package/packages/core/src/processes/dispatcher.ts +493 -121
  110. package/packages/core/src/processes/execution-no-progress.ts +1 -0
  111. package/packages/core/src/processes/execution-settlement.ts +21 -3
  112. package/packages/core/src/processes/harvest-runner.ts +68 -8
  113. package/packages/core/src/processes/harvest.ts +11 -16
  114. package/packages/core/src/processes/repo-view.ts +3 -0
  115. package/packages/core/src/project-secrets.ts +105 -0
  116. package/packages/core/src/secret-name.ts +41 -0
  117. package/packages/core/src/store/account-redaction.ts +156 -0
  118. package/packages/core/src/store/artifact-meta.ts +7 -0
  119. package/packages/core/src/store/contract.ts +60 -1
  120. package/packages/core/src/store/memory.ts +4 -0
  121. package/packages/core/src/store/reducer-value-shapes.json +7389 -6647
  122. package/packages/core/src/store/reducer-value-validation.ts +106 -6
  123. package/packages/core/src/store/remote/client.ts +85 -50
  124. package/packages/core/src/store/remote/compatibility.ts +57 -0
  125. package/packages/core/src/store/remote/index.ts +6 -0
  126. package/packages/core/src/store/remote/protocol.ts +8 -1
  127. package/packages/core/src/store/remote/released-reducer-values/1.2.0.json +8129 -0
  128. package/packages/core/src/store/remote/version.ts +4 -0
  129. package/packages/core/src/store/repo-state-events.ts +4 -2
  130. package/packages/core/src/store/snapshots.ts +16 -3
  131. package/packages/core/src/store/types.ts +2 -0
  132. package/packages/core/src/testing/dispatch-read-budget.ts +266 -5
  133. package/packages/core/src/testing/index.ts +2 -1
  134. package/packages/core/src/testing/reduced-read-budget.ts +560 -5
  135. package/skills/guide/SKILL.md +164 -37
  136. package/skills/guide/references/accounts.md +130 -0
  137. package/skills/guide/references/integration-tree.md +16 -5
  138. package/skills/guide/references/merge-policy.md +1 -3
  139. package/skills/guide/references/operator-api.md +144 -53
  140. package/skills/guide/references/plugin-authoring.md +27 -1
  141. package/skills/guide/references/remote-store-protocol.md +259 -91
  142. package/skills/guide/references/remote-ticket-protocol.md +29 -49
  143. package/skills/guide/references/restacking.md +45 -0
  144. package/skills/guide/references/setup.md +34 -129
  145. package/skills/guide/references/spec-standard.md +4 -2
  146. package/skills/guide/references/ticket-dependencies.md +8 -0
  147. package/skills/harvest/SKILL.md +3 -1
  148. package/skills/harvest-review/SKILL.md +3 -1
  149. package/skills/operate/SKILL.md +26 -11
  150. package/skills/reconcile/SKILL.md +6 -0
  151. package/skills/spec/SKILL.md +1 -1
  152. package/skills/tickets/SKILL.md +10 -5
  153. package/templates/hosted-service/package.json +2 -2
  154. package/docs/hosted-dispatcher-cutover-validation.md +0 -178
  155. package/docs/hosted-dispatcher.md +0 -278
  156. package/docs/hosted-service.md +0 -304
  157. package/docs/mcp.md +0 -150
@@ -1,6 +1,7 @@
1
1
  # Operator API v1
2
2
 
3
- The hosted service exposes the polling-oriented operator surface at
3
+ A conforming hosted instance implements this normative polling-oriented operator
4
+ contract at
4
5
  `/operator/v1/repos/{repo}`. It is versioned with remote store protocol **6**.
5
6
  Every request must send `X-Autobuild-Version`,
6
7
  `X-Autobuild-Protocol-Version: 6`, and `Authorization: Bearer …`. Identity is
@@ -14,29 +15,26 @@ every request. Revocation takes effect on the next request without affecting
14
15
  other credentials. Unknown, expired or revoked credentials receive `401 auth`;
15
16
  removed projects receive `403 auth` with `project not registered`.
16
17
 
17
- The deployment owner runs these commands locally with database access:
18
-
19
- ```sh
20
- ab-hosted-store credentials issue https://github.com/acme/app --user owner@example.com
21
- ab-hosted-store credentials list https://github.com/acme/app
22
- ab-hosted-store credentials revoke https://github.com/acme/app --id ID --user owner@example.com
23
- ```
24
-
25
- Issue prints the secret once; list contains metadata only. Issue optionally
26
- accepts `--ttl-seconds N` or `--expires-at ISO-8601`. For administrative/non-interactive issuance, set the returned token as
27
- `AB_TOKEN`. Interactive project onboarding uses `ab connect <service-url>`;
28
- it saves the credential outside the repository and commits no secret. Previous `AB_TOKEN` values and `mint operator` / `mint build` are
29
- retired: the service responds that the credential format changed and points
30
- to `credentials issue`. Supported old protocol shapes still work with a new
31
- credential; protocol compatibility does not restore retired authentication.
32
-
33
- `mint admin --ttl-seconds N` creates an explicit versioned, attributed owner
34
- break-glass credential. It can cross project boundaries. Keep it owner-only:
35
- never give it or `AB_STORE_SECRET` to a dispatcher or build agent.
18
+ The hosted cron dispatcher issues a dispatcher-purpose credential per repository
19
+ tick, then deletes that exact row on completion or failure. Its crash-safety
20
+ expiry is capped at the invocation deadline plus 60 seconds and the configured
21
+ `AB_DISPATCHER_TOKEN_TTL_SECONDS` upper bound. Each served tick removes at most
22
+ 100 expired or revoked dispatcher rows through indexed probes. Legacy unexpired
23
+ rows keep their recorded expiry and are pruned afterward. Owner lifetimes are
24
+ unchanged. Build and harvest grants are independent signed authority, governed
25
+ by durable lifecycle facts and the existing evidence grace, not parent credential
26
+ storage or TTL; agents never receive the cron credential.
27
+
28
+ Obtain a project credential with `ab connect <instance-url>` or from the
29
+ instance, and use `AB_TOKEN` on non-interactive clients. Interactive connection
30
+ saves the credential outside the repository. Retired credential formats are
31
+ refused with a credential-format-changed diagnostic; supported old protocol
32
+ shapes still require current credentials. Compatibility does not restore retired
33
+ authentication. Versioned, attributed owner-admin credentials are an explicit
34
+ cross-project exception and must never be supplied to build agents.
36
35
 
37
36
  Owner-purpose project credentials attribute every write to their recorded creator.
38
- Dispatcher-purpose credentials are refused. Signed-in owners in the dashboard
39
- and MCP receive short-lived internal signatures with an explicit version,
37
+ Dispatcher-purpose credentials are refused. Internal operator credentials use short-lived internal signatures with an explicit version,
40
38
  selected repository, signed user, expiry and MCP `via`. Only the service holds
41
39
  the signing key. These signatures authorize operator routes only and require a
42
40
  registered project; replay against another project is refused.
@@ -46,13 +44,12 @@ tool execution. Body repositories and secondary build/session identifiers are
46
44
  also checked inside that project. Explicit project mismatches return `403 auth:
47
45
  wrong project`; removal returns `403 auth: project not registered`. Encode each
48
46
  repository, build, session and artifact kind as a separate URL path segment.
49
- Registration changes use the database-local `projects list|add|remove` owner
50
- commands; see [owner workflow](setup.md#connected-projects).
47
+ Registration is instance-owned; project credentials cannot administer it.
51
48
 
52
49
  ## Operator sessions
53
50
 
54
51
  Operator sessions are the signed-in user's durable orchestrator
55
- conversations: a hosted-only third store resource. A session
52
+ conversations: a third store resource. A session
56
53
  belongs to the user who created it; other members of the same repository
57
54
  can read it and cannot write to it (`403 auth` on non-owner writes). Every
58
55
  write is attributed to the token's signed user — never a client-supplied
@@ -91,7 +88,7 @@ raw session-event append. External operator harnesses own agent execution.
91
88
  | `GET …/status` | Repository intake, pause, and default-auto-merge projection. |
92
89
  | `GET …/harvest/status` | Harvest gate, runs, steps, recovery, and attention projection. |
93
90
  | `GET …/builds/{slug}/artifacts/{kind}?rev=N` | Raw bytes (`application/octet-stream`) plus content-disposition and `X-Autobuild-Artifact-*` metadata headers. Omit `rev` for latest. |
94
- | `GET …/tickets?state=S&label=L` | `{states,tickets,diagnostics,criteria,triageState,readyState}`. The two lifecycle names come from effective repository configuration (including provider fallback). With no `state`, `criteria.state` is `triageState`; repeated `label` parameters narrow that state with AND filters. An explicit `state` selects that exact backend workflow state. |
91
+ | `GET …/tickets?state=S&label=L&limit=N&offset=K&order=O` | `{states,tickets,diagnostics,criteria,triageState,readyState,doneState,total}`. The three lifecycle names come from effective repository configuration (including provider fallback). With no `state`, `criteria.state` is `triageState`; repeated `label` parameters narrow that state with AND filters. An explicit `state` selects that exact backend workflow state. `limit` (0–200) returns one page, after skipping `offset`, in `order` `oldest` (the source order, the default) or `newest`; `total` counts every match before paging. |
95
92
  | `GET …/tickets/states` | Full state metadata `{name,tickets,about?}[]`, including empty states (`tickets.states` in MCP). |
96
93
  | `GET …/tickets/{id}` | `{ticket,blockers,build}`. Blockers include native `exists`/`resolved` status; `build` prefers an active matching repository build, otherwise the most recently updated one. |
97
94
 
@@ -110,7 +107,7 @@ MCP presence registration is deferred. `ab watch`
110
107
  streams build and repository events by polling the same event logs client-side
111
108
  (the store protocol's `GET /builds/{slug}/events` and `GET /repos/{repo}/events`
112
109
  reads), not as a transport on this API. `triageState`, `readyState`,
113
- and every entry in `states` are backend state names and must be sent back verbatim
110
+ `doneState`, and every entry in `states` are backend state names and must be sent back verbatim
114
111
  when used with the move control.
115
112
 
116
113
  ## Controls
@@ -148,7 +145,7 @@ The retry object is deliberately bare: adding `text` is a `400 validation`
148
145
  rather than silently changing the resolution to guidance. A revision object may
149
146
  also carry `ceiling` only to receive the shared `incompatible-answer-options`
150
147
  refusal; a ceiling and spec revision cannot be performed together.
151
- The hosted service has no ticket-provider credentials. For ticket-origin
148
+ The protocol does not supply ticket-provider credentials. For ticket-origin
152
149
  revision, a trusted caller fetches the current ticket body and supplies it; the
153
150
  build must still have a recorded ticket. Revision conformance, lazy retry,
154
151
  artifact metadata, event ordering, and refusal rules are the same as the CLI.
@@ -169,13 +166,13 @@ Active verification/reconcile or writer work, restack/reparent work, pause,
169
166
  pending controls, merge intent and ended PRs refuse the no-escalation path.
170
167
  A concurrent state change refuses publication with a retry explanation;
171
168
  uncited artifacts are inert. Leaves still require an open escalation and
172
- restart from `plan`.
169
+ restart from `plan` after any unfinished reconcile resumes under the revised
170
+ spec and its publication is confirmed.
173
171
 
174
172
  ## The registry's protocol face: `POST …/tools/{tool}`
175
173
 
176
174
  One generic route executes any entry of the agent tool registry (the same
177
- closed table `ab mcp` serves over stdio and the hosted `/mcp` endpoint serves
178
- over Streamable HTTP): the body is the tool's validated input — `repo`
175
+ closed table `ab mcp` serves over stdio): the body is the tool's validated input — `repo`
179
176
  included and required to equal the URL's repository — and the response is the
180
177
  registry result verbatim. The verified operator token supplies the acting
181
178
  identity and, when minted with one, the `via` attribution marker; the body
@@ -222,18 +219,16 @@ progress and unattempted builds. Unexpected failures are `500 internal`.
222
219
 
223
220
  ## Browser gateway
224
221
 
225
- The same deployment serves the web dashboard through `/api/web/repos/{repo}/…`.
222
+ The cookie-authenticated gateway contract uses `/api/web/repos/{repo}/…`.
226
223
  That route is not a second public bearer-token API: it requires a current
227
- Better Auth HTTP-only cookie, rechecks the deployment current organization membership and project registration, rejects cross-origin JSON controls, and delegates only the dashboard,
224
+ Better Auth HTTP-only cookie, rechecks the instance’s current organization membership and project registration, rejects cross-origin JSON controls, and delegates only the dashboard,
228
225
  build, settings, and harvest operator suffixes listed above. It replaces caller-supplied authorization/version
229
226
  headers with a server-minted token that expires after 30 seconds and carries
230
227
  the normalized signed-in email. Consequently every durable control event has
231
228
  the browser user's human actor while no token or signing secret reaches client
232
- code. Responses are private/no-store; a 401 sends the application back to sign
233
- in. Browser clients poll the visible dashboard every two seconds; the browser
234
- surface offers no streaming of its own — live transcript streaming remains
235
- absent here, and the streaming read surface is the CLI's `ab watch`, which
236
- polls the store's event reads client-side. Delegated bearer tokens remain
229
+ code. Responses are private/no-store; 401 requires reauthentication.
230
+ Polling clients may use a two-second interval. The gateway provides no
231
+ streaming transport; `ab watch` polls store event reads client-side. Delegated bearer tokens remain
237
232
  server-side.
238
233
 
239
234
  The API does not expose phase-session commands, runner startup, a push or
@@ -247,18 +242,23 @@ Dispatcher liveness is also visible through `ab repository status --json`:
247
242
  of `latestRun`. Each run includes its recorded `runtime` (version, commit, and
248
243
  source kind/location), or null for unrecorded historical starts. Heartbeat age measures attributable renewals; tick age measures
249
244
  durable progress. Missing historical evidence is null. The liveness query uses
250
- bounded repository facts first, with a full-history fallback when a later
251
- invocation hides the holder start or the latest stop. Other state reads retain
252
- their bounded semantics.
245
+ persisted repository and exact per-run reduced values, including when newer
246
+ invocations hide an older holder or stop. Missing facts never trigger a full-log
247
+ fallback.
253
248
 
254
249
  Repository-following `ab watch` additionally emits a read-only `dispatcher.lost`
255
250
  observation when an observed lease expires without a matching stop or validated
256
- successor takeover. A completed ownership transfer suppresses predecessor loss
251
+ successor takeover. Any recorded stop, normal or abnormal, suppresses loss;
252
+ abnormal stops retain their own default attention event. A completed ownership transfer suppresses predecessor loss
257
253
  even while its sessions drain; a handoff without takeover still reports loss on
258
254
  expiry. Successor loss and upgrade-failure/rollback attention remain independent. JSON carries
259
255
  `observation` instead of `event`, with run, observedAt, leaseExpiresAt and available
260
256
  identity, plus the usual repo/build/state/cursor fields. It invents no durable
261
257
  sequence or actor. Retain the cursor to avoid repeat reports across invocations.
258
+ A watch retains sampled owners after authoritative lease release. Once-run teardown
259
+ stops heartbeat and releases only its own lease; release is best effort because
260
+ expiry fences ambiguous ownership. A retained sample or failed release cannot
261
+ override a persisted stop.
262
262
  No lease alone is not evidence of death. SIGINT, SIGHUP and SIGTERM drain dispatch,
263
263
  record the first signal in the stop fact, and release its lease before exit.
264
264
 
@@ -290,7 +290,10 @@ The default watch reports actionable conditions only:
290
290
  for five minutes in one run. A successful tick, new run, or matching stop
291
291
  ends the episode. Source grace and cooldown-driven failures do not start
292
292
  this clock; after grace, the first qualifying failure starts a new five-minute
293
- interval. Each persistence episode is reported once.
293
+ interval. Each persistence episode is reported once. Unavailable failure writes delay durable visibility:
294
+ watch keeps running, warns locally and reports one bounded unreported window
295
+ on recovery. These local warnings do not start the durable attention clock
296
+ retroactively. Explicit stops still stop dispatch.
294
297
 
295
298
  Repository conditions are included with no slugs or with `--repository`.
296
299
  Routine outcomes and self-healing failures are silent. Repeatable
@@ -387,12 +390,12 @@ ignores old holds. Preflight failure suppression above remains separate.
387
390
  ## Organization management (browser)
388
391
 
389
392
  These same-origin cookie-session routes are the management contract. Mutations
390
- require the exact `BETTER_AUTH_URL` Origin and `application/json`, accept at most
393
+ require the exact configured instance origin as Origin and `application/json`, accept at most
391
394
  8192 characters of JSON, and reject unsupported fields. Responses are private,
392
395
  no-store. No client-supplied actor or role is trusted. Raw Better Auth
393
396
  `/api/auth/organization/*` routes are disabled, including invitations.
394
397
 
395
- ### Discovery and bootstrap
398
+ ### Discovery and creation
396
399
 
397
400
  `GET /api/web/orgs` returns
398
401
  `{isSuperUser,organizations:[{id,name,slug,ownerEmail,membershipRole}]}`.
@@ -403,14 +406,10 @@ Results sort by slug then ID. Members may inspect and read rosters in their own
403
406
  organizations, including member emails. Foreign organizations return 403 before
404
407
  resource detail. A multi-org member uses these IDs for explicit connect selection.
405
408
 
406
- To bootstrap, sign in as a super user configured by
407
- `AB_WEB_SUPER_USER_EMAILS`, then POST `{name,slug}` to `/api/web/orgs`.
409
+ Only super users may POST `{name,slug}` to `/api/web/orgs`.
408
410
  The response is 201 `{organization}` in the discovery shape. Names are nonblank
409
411
  and at most 100 characters; slugs are unique lowercase kebab strings of at most
410
- 100 characters. Creation grants no membership. The account menu links every
411
- operator to `/members`, and super users to `/organizations` and `/projects`.
412
- These separate pages show acknowledged reads, refresh after writes, and confirm
413
- member removal and project moves inline before writing.
412
+ 100 characters. Creation grants no membership.
414
413
 
415
414
  Super users and the organization’s members can GET `/api/web/orgs/:orgId` for
416
415
  `{organization,projects:[repo]}` with active owned projects and the caller’s actual
@@ -447,5 +446,97 @@ the inactive project; re-registration restores that assignment.
447
446
  Status codes are 401 for absent, malformed or expired sessions; 403 for admission
448
447
  or role refusal; 400 for invalid inputs; 404 for missing resources after role
449
448
  checks; 409 for duplicate slugs; and sanitized 503 for store outages. Foreign
450
- projects return the same unknown-repository result as absent projects. Machine
451
- credentials and the hosted-store administration CLI keep their existing behavior.
449
+ projects return the same unknown-repository result as absent projects. Machine credentials retain their separate authority.
450
+
451
+
452
+ ### Permanent project deletion
453
+
454
+ Super users and the owner of a project's organization can delete it from the
455
+ Projects page. Owners see only projects in organizations they own; Move and
456
+ Assign remain super-user operations. The shared confirmation dialog names the project,
457
+ shows current build, hosted ticket, secret and subscription-account counts, and
458
+ requires a second, destructive action. Local files and configuration are unaffected.
459
+
460
+ Authenticated human sessions can use `GET /api/web/projects/deletion?repo=<encoded repository>`
461
+ for the authorized preview. It returns `repo`, an opaque `token`, `builds`,
462
+ `tickets`, `secrets`, and `subscriptionAccounts`. Send that token unchanged in
463
+ `If-Match` to `DELETE /api/web/projects/deletion`, with exactly `{repo}` as JSON.
464
+ The write requires the configured same origin. Missing tokens return 428;
465
+ a token for another live generation returns 412 without changing anything.
466
+ A token for an already-deleted generation is an idempotent no-op, including after
467
+ reconnection, for the initiating actor or a super user. Success returns
468
+ `{deleted:true}` only after cleanup completes. Unauthorized callers receive no counts.
469
+
470
+ Deletion cuts off access before purging builds, events, sessions, streams,
471
+ artifacts, hosted tickets and assets, secrets, subscription accounts, credentials,
472
+ connections, presence and organization assignment. Blobs another project references
473
+ or reserves survive. The only retained project record contains the repository,
474
+ initiating actor, deletion time and one opaque generation id. Provider failure
475
+ leaves access refused and durable cleanup pending. The Projects page lists
476
+ unfinished deletions with a **Finish deletion…** action, including after reloading,
477
+ opening another tab or restarting the service. Reopen its confirmation dialog to
478
+ retry cleanup with the original operation's preview token, even though the live
479
+ generation was invalidated at the initial purge. A pending preview returns that
480
+ same original token. Deletion waits only for mutation transactions already holding
481
+ the project generation row, never for an entire HTTP request. Subsequent mutation
482
+ transactions in an admitted request fail with `403 project not registered` and
483
+ roll back; operations committed before the purge remain permissible.
484
+ Cancel only closes the confirmation and does not undo the cutoff.
485
+ `GET /api/web/projects/deletions` returns `{projects: string[]}` for pending
486
+ cleanup authorized to the current owner or super user, including unassigned
487
+ projects for super users. Members and outsiders receive no pending project names.
488
+ This management-only list does not restore projects to builds selectors or normal
489
+ organization discovery. Cleanup commits progress in batches of at most 32 blobs,
490
+ using provider batch deletion where supported; a failed batch remains retryable. Registration is blocked until cleanup
491
+ finishes. Legacy untraceable orphan blobs with no ownership record or retained
492
+ project reference are excluded from deletion.
493
+
494
+ Old credentials return `401` as unknown or revoked, including repository-free
495
+ connection status calls; routes that otherwise establish the repository return
496
+ `403 project not registered`. No credential tombstones are retained. Browser
497
+ approval of a fresh `ab connect` registers an empty project; proposing a connection
498
+ alone does not register it. Old credentials and grants remain invalid. Hosted
499
+ ticket numbering starts again at 1.
500
+
501
+ `ab disconnect` only revokes the saved credential and retains project data.
502
+ The admin `projects remove` command only unregisters access and retains data;
503
+ it is a separate operation from permanent web project deletion.
504
+
505
+
506
+ S3 cleanup requires `s3:DeleteObject`, `s3:ListBucketVersions` and
507
+ `s3:DeleteObjectVersion` for the configured bucket and exact prefixed content
508
+ keys. It removes stored versions and delete markers as well as current objects;
509
+ permission or retention failures leave deletion pending. Vercel Blob cleanup uses
510
+ the same store identity, token and prefixed pathname as uploads. Missing objects
511
+ are successful cleanup; provider errors never count as completed deletion.
512
+
513
+ Paged ticket listings use the source's optional native `listPage(criteria, page)` capability when present, otherwise read the full listing and reverse/slice it. Native errors propagate. PostgreSQL counts matches without bodies and reads only the requested window. Zero limits and offsets past the end still report the full matching total. Unpaged listings remain exhaustive; the wire payload is the same for both paths.
514
+
515
+
516
+ ### Forge cooldown admission and explicit recovery
517
+
518
+ Hosted repository event appends and atomic artifact deposits validate
519
+ `dispatcher.forge-degraded` before any durable mutation. The payload must match
520
+ its event schema, with a finite ISO `resetAt` at most 24 hours after server time
521
+ (inclusive). Already-expired deadlines are accepted. Invalid or out-of-horizon
522
+ writes return `400 validation` (the remote adapter exposes `EventValidationError`);
523
+ the server never clamps or invents a provider reset. Historical decoding has no clock-relative restriction.
524
+
525
+ Build-runner and build-phase grants may POST only the kernel-authored
526
+ `dispatcher.forge-degraded` repository fact through the events route. The
527
+ preceding `requireProject` check binds this exception to the exact repository
528
+ in the delegated claim. A hosted project identifies one repository. Delegates
529
+ cannot write recovery, deposits or other repository facts, regardless of the
530
+ actor claimed in an envelope.
531
+
532
+ An authorized operator can explicitly clear erroneous state through
533
+ `repository.forge_clear {repo, forge, reason}` or
534
+ `ab repository forge-clear --forge <name> --reason <text> [--json] [--store <ref>]`.
535
+ The reason is required and nonblank. The result contains the durable recovery
536
+ `event`, attributed to the authenticated human with normal `via` attribution.
537
+ Build and harvest delegates cannot invoke this operator mutation. CLI use
538
+ requires an operator outside build/harvest sessions. This is an override, not
539
+ proof of provider success. A clear appends once without reading history, even
540
+ when already healthy; later degradation wins by ordinary journal order.
541
+ Existing dispatcher/kernel automatic recovery and old payloads remain valid;
542
+ the recovered payload additionally accepts an optional nonblank `reason`.
@@ -27,7 +27,7 @@ Import public types only from `@defrex/autobuild/plugin-sdk`; internal module pa
27
27
 
28
28
  All four manifest maps have production selectors. Omitted forge and workspace selectors default to builtin `github` and `git-worktree`; roles keep normal runtime inheritance.
29
29
 
30
- `BuildStore` and `BlobStore` contract types are exported for remote-server authors, but BuildStore is **not** an in-process manifest map: implement the language-neutral remote store protocol and run its conformance path. `TelemetrySource` is a frozen port type with no plugin registration surface in this release.
30
+ `BuildStore` and `BlobStore` contract types are exported for remote-server authors, but BuildStore is **not** an in-process manifest map: implement the language-neutral remote store protocol and run its conformance path. The optional `BuildStore.getLatestArtifactMeta` capability must return only the latest metadata in constant-size reads without loading blob content or listing revisions; omit it when unsupported. `TelemetrySource` is a frozen port type with no plugin registration surface in this release.
31
31
 
32
32
  ### `ticket-source`
33
33
 
@@ -139,6 +139,7 @@ A plugin relying on a capability declares an `apiVersion` range containing its v
139
139
  - **1.5** `path` is the path in the workspace environment; set optional `localPath` only when the dispatcher can reach that same copy directly. Workspace-owned executors receive the durable provider locator as `BuildExecutionStart.workspaceRef`; local PID supervision stays host-owned.
140
140
  - **1.7** Workspace factory seams.
141
141
  - **1.8** Forge failure classification and request observers.
142
+ - **1.9** Optional native ticket-source paging (`listPage`); older sources retain operator slicing.
142
143
 
143
144
  ## 2. Create a repository-local module
144
145
 
@@ -424,3 +425,28 @@ An adapter opts in with `integrationTree: true` and must:
424
425
  - expose kind and target in revisions
425
426
 
426
427
  Don't opt in unless the source preserves these semantics. Legacy sources get ordinary CRUD; the compatibility facade refuses metadata writes before legacy methods run, and unsupported sources should also refuse metadata at their own write boundary.
428
+
429
+ ## Optional ticket paging capability
430
+
431
+ Native paging is an optional API 1.9 ticket-source capability:
432
+ `listPage?(criteria: TicketCriteria, page: TicketPage): Promise<TicketPageListing>`.
433
+ The SDK exports these types; the result is `TicketListing & { total: number }`.
434
+ Criteria retain state, labels (AND), and assignee semantics. The page has a
435
+ nonnegative integer `limit`, optional nonnegative integer `offset` (default 0),
436
+ and optional `order: 'oldest' | 'newest'` (default oldest). Newest reverses the
437
+ entire source order before offset and limit. Total counts all matches, even
438
+ with limit zero or an offset past the end. Records, diagnostics and errors
439
+ match the exhaustive listing. The shared `describeTicketSourceContract` suite
440
+ automatically compares declared native paging with full-read windows.
441
+
442
+ Only paged operator listings select this capability. Sources without it retain
443
+ the full-read/reverse/slice fallback; native errors propagate. Unpaged operator
444
+ listings, CLI ticket lists and dispatcher ready scans remain exhaustive through
445
+ `listReady`/`listAll`. The hosted PostgreSQL source counts matches without
446
+ bodies and reads only the SQL-bounded window. File, Linear and the remote
447
+ `HostedTicketSource` retain fallback; the POST list-ready protocol stays exhaustive.
448
+
449
+ Hosted cooldown recording rejects observed reset deadlines beyond the 24-hour
450
+ admission horizon explicitly; adapters must not shorten or invent a provider
451
+ reset to evade this validation. Operator forge-clear is an audited override,
452
+ not a successful provider observation.