@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
  # 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
 
@@ -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
@@ -322,6 +321,7 @@ it to exist. An unknown build returns `404 not-found`.
322
321
  | `putReducerSnapshot` | `PUT /builds/{slug}/snapshots/{reducer}` | `{"version": int >= 1, "cursor": int >= 0, "state": JSON}`, at most 16 MiB (`413` above) | `200 {"written": boolean}`; the stored cursor never decreases, so a write at an equal or lower cursor (or an equal cursor at an equal or lower version) and one past the log's tail answer `written: false` |
323
322
  | `putArtifact` | `POST /builds/{slug}/artifacts` | artifact input | `201` + build artifact metadata |
324
323
  | `getArtifact` | `GET /builds/{slug}/artifacts?kind={kind}&rev={n}` | `kind` is required and nonempty; optional `rev` is parsed below | `200` + artifact read; an absent `rev` parameter selects the latest revision; a missing kind/revision is `200 null` |
324
+ | `getLatestArtifactMeta?` | `GET /builds/{slug}/artifact-meta?kind={kind}` | required nonblank `kind` | `200` + latest validated artifact metadata or `null`; no blob content |
325
325
  | `listArtifacts` | `GET /builds/{slug}/artifact-list?kind={kind}` | optional `kind`; absence means all kinds | `200` + metadata ordered by kind and then increasing revision |
326
326
  | `claimLease` | `POST /builds/{slug}/lease/claim` | claim request | `200 {"ok": boolean}` |
327
327
  | `heartbeat` | `POST /builds/{slug}/lease/heartbeat` | holder request | `200 {"ok": boolean}` |
@@ -340,7 +340,7 @@ one caller can succeed for a given current sequence. A comparison miss returns
340
340
  timestamps. An unknown build remains `404 not-found`; malformed or negative
341
341
  `expectedSeq` is `400 validation`.
342
342
 
343
- For a present `since` or `rev`, the shipped server applies JavaScript
343
+ For a present `since` or `rev`, the server applies JavaScript
344
344
  `Number(rawValue)` and accepts the result only when `Number.isInteger` is true.
345
345
  Consequently hexadecimal and exponent forms such as `0x10` and `1e1`,
346
346
  whitespace-padded values, and empty or whitespace-only values are accepted;
@@ -353,6 +353,26 @@ revisions are nonnegative; a requested revision that does not exist, including
353
353
  a negative one, produces `null`. A missing or empty `kind` on the artifact-read
354
354
  route is `400 validation`.
355
355
 
356
+ The optional `BuildStore.getLatestArtifactMeta(slug, kind)` returns
357
+ `Promise<ArtifactMeta | null>`, with the same unknown-build behavior as
358
+ `getArtifact`. Implement it as a constant-size latest-revision lookup, never
359
+ by listing revisions or loading blob content. Memory and PostgreSQL stores
360
+ support it; PostgreSQL uses the existing `(build, kind, revision)` primary key
361
+ in descending revision order with `LIMIT 1`. The route uses the same build
362
+ authorization and project scope as artifact reads. Unsupported backings return
363
+ `501 {kind: "unsupported-operation", error: "latest artifact metadata is unsupported"}`.
364
+
365
+ This additive route does not change the protocol identity. Older servers
366
+ answer `404 {kind: "not-found", error: "no route: GET /builds/:slug/artifact-meta"}`
367
+ from the store router, or the same envelope with the actual requested URL
368
+ pathname from the hosted service router. Only these explicit route-miss responses
369
+ (the literal route pattern or the exact requested metadata pathname) or the
370
+ explicit 501 operation response disable metadata probing for the lifetime of a
371
+ remote client. An unknown-build 404 remains a failure.
372
+ The dispatcher then uses ordinary full artifact reads. Authentication,
373
+ transport, malformed responses and other server errors remain failures; they
374
+ never trigger event downloads or reconstruction of server-reduced values.
375
+
356
376
  The artifact-list `kind` is optional and is normally a nonempty stored kind.
357
377
  No pagination, deletion, retention, range request, or streaming endpoint is
358
378
  part of this protocol. Retention is enforced server-side inside the store at
@@ -373,8 +393,23 @@ finished JSON answer is returned, with no accumulator or raw-log bundle. `cursor
373
393
  is the authoritative prefix included in the answer, not a guarantee to include
374
394
  appends concurrent with the request. Every call checks durable progress and
375
395
  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.
396
+ Server-owned snapshots are disposable caches: deletion, corruption, wrong versions
397
+ and unreadable cache storage cause server-side replay. Log read failures remain errors.
398
+ The server answer is canonical for remote clients, regardless of missing, malformed
399
+ or different `x-autobuild-catalog-identity` headers. The strict body stays exactly
400
+ `{version, cursor, value}`. The reducer `version` is the server's cache identity, not
401
+ a compatibility gate. A client accepts any value its own finished shape can
402
+ represent and drops object properties that shape does not know. An invalid envelope
403
+ or a value the client cannot represent, such as a missing field or an unknown
404
+ variant, raises `ReducerValueIncompatibilityError`, naming the reducer,
405
+ client/server versions and validation detail. Clients send
406
+ `x-autobuild-reducer-value-projection: 1`. A 1.2.0 client predates that capability
407
+ and accepts only its own reducer version and shape. The service answers it with the
408
+ value projected onto the frozen 1.2.0 shape and the 1.2.0 reducer version, or with
409
+ the unprojected answer when that shape cannot represent it. Clients never reconstruct named
410
+ answers from raw events. Repository build-digest batches are likewise canonical:
411
+ one repo-scoped GET returns the batch without client build discovery or per-build
412
+ reducer requests. This does not change the explicit snapshot or event APIs.
378
413
 
379
414
  The executable catalog is `kernel/reducer-registry.ts`. All requests reject
380
415
  unknown names, excluded reducers, wrong scopes and invalid/extra arguments with
@@ -388,7 +423,7 @@ client version window are unchanged.
388
423
  | Scope | Reducers with no arguments |
389
424
  | --- | --- |
390
425
  | Build | `executionNoProgress`, `summaryRequests`, `build`, `buildDigest`, `currentPrAttachments`, `pendingPrAttachmentReclaims`, `openExecution`, `lastExecutionOutcome`, `infrastructureFailureReset`, `openWorkspace`, `setupStreak`, `openBuildWorkspace`, `currentDeferralObservation`, `dashboardFacts`, `pinnedAssets`, `buildDelegation` |
391
- | Repository | `harvest`, `dispatchSettings`, `sandboxStates`, `openHarvestExecutions`, `autoMergeDefault`, `effectiveConfig`, `harvestDelegation` |
426
+ | Repository | `ticketPreparation`, `harvest`, `dispatchSettings`, `sandboxStates`, `openHarvestExecutions`, `autoMergeDefault`, `effectiveConfig`, `harvestDelegation` |
392
427
 
393
428
  | Reducer | Scope | Required arguments |
394
429
  | --- | --- | --- |
@@ -466,10 +501,8 @@ elapses, whichever comes first; at the bound it answers `200 []`. Omitting
466
501
  digits — deliberately stricter than the lenient `since`/`rev` conversion above:
467
502
  empty, whitespace-padded, hexadecimal, signed, and non-integral values are `400
468
503
  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
504
+ clamped to it, never rejected; implementation-dependent examples are 30
505
+ seconds (the stream/session wait ceiling) and 25 seconds. A held request's authentication, token scope, and version-skew rules
473
506
  are identical to the immediate form: a `401`, `403`, or `409` identity failure
474
507
  is answered immediately, never held.
475
508
 
@@ -497,7 +530,7 @@ without a journal record, or a repository without builds.
497
530
  | `getRepo` | `GET /repos/{repo}` | none | `200` + `RepositoryRecord`; absent is `404` (the shipped client maps this to `null`) |
498
531
  | `appendRepo` | `POST /repos/{repo}/events` | event write | `201` + repository event envelope |
499
532
  | `getRepoEvents` | `GET /repos/{repo}/events?since={n}&wait={s}` | optional `since` query value, parsed as in section 3; absence defaults to `0`. Optional `wait` in whole seconds, per the event-wait rules of section 3 | `200` + envelopes with `seq >` parsed `since`, in increasing sequence order |
500
- | `getRepoStateEvents` | `GET /repos/{repo}/state-events` | none | `200` + the bounded repository-journal subset (AUT-489): every durable event type (`harvest.*`, `orchestrator.sandbox.*`, the three dispatcher setting types, and cross-generation handoff correlation facts: target-prepared, yield-requested, upgrade-failed, handoff-started, terminal-released, takeover, drain-deadline, drain-settled and handoff-completed) plus, when the journal has one, the tail from the latest `dispatcher.run-started`, in increasing sequence order; served inside the repository-existence gate like `GET events`, so an unknown repository is `404` |
533
+ | `getRepoStateEvents` | `GET /repos/{repo}/state-events` | none | `200` + the bounded repository-journal subset (AUT-489): every durable event type (`ticket-preparation.*`, `harvest.*`, `orchestrator.sandbox.*`, the three dispatcher setting types, and cross-generation handoff correlation facts: target-prepared, yield-requested, upgrade-failed, handoff-started, terminal-released, takeover, drain-deadline, drain-settled and handoff-completed) plus, when the journal has one, the tail from the latest `dispatcher.run-started`, in increasing sequence order; served inside the repository-existence gate like `GET events`, so an unknown repository is `404` |
501
534
  | `getReducerSnapshot` (repo scope) | `GET /repos/{repo}/snapshots/{reducer}?version={n}` | required `version` query value, a positive integer; `reducer` is a registry name (`^[A-Za-z][A-Za-z0-9._-]{0,63}$`) | `200` + `{"version", "cursor", "state"}` or `200 null` when absent, written by another reducer version, ahead of the journal's tail, or the repository has no journal record; an unknown repository is `404`, which the shipped client also maps to `null` |
502
535
  | `putReducerSnapshot` (repo scope) | `PUT /repos/{repo}/snapshots/{reducer}` | `{"version": int >= 1, "cursor": int >= 0, "state": JSON}`, at most 16 MiB (`413` above) | `200 {"written": boolean}`; the stored cursor never decreases, so a write at an equal or lower cursor (or an equal cursor at an equal or lower version) and one past the journal's tail answer `written: false` |
503
536
  | `appendRepoWithArtifacts` | `POST /repos/{repo}/deposits` | atomic deposit request | `201` + `{event, artifacts}` using repository shapes |
@@ -659,8 +692,7 @@ together with the effective `maxBytes`, computed from it as follows. Paths and
659
692
  entry counts are bounded, so the worst-case wire overhead is a constant:
660
693
  `overhead = 1024 + 1000 × 320 = 321024` bytes, and
661
694
  `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
695
+ (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
696
  bytes (about 2.8 MiB). The formula is a safe lower bound, not the final
665
697
  authority:
666
698
 
@@ -692,8 +724,7 @@ turn. Historical turn events and streams retain their validation and read
692
724
  contracts. External operator harnesses own execution and scheduling.
693
725
 
694
726
  Operator sessions are a third resource kind: durable orchestrator-conversation
695
- state keyed by repository and session owner (the human account in `operator`). They are hosted-only — local installs
696
- interact through the CLI and dashboard and never create one — but the resource
727
+ state keyed by repository and session owner (the human account in `operator`). Local CLI workflows do not create these resources; the resource
697
728
  contract is uniform, and a conforming server implements it the same way it
698
729
  implements the repository journal. A session record is:
699
730
 
@@ -743,10 +774,8 @@ section 6 apply to session-scoped streams unchanged.
743
774
  Event reads honor the bounded wait: when no newer event exists, the server may
744
775
  hold the request up to the parsed `wait` bound in whole seconds, returning as
745
776
  soon as an event is appended and no later than the bound; a `wait` above the
746
- event-wait ceiling of section 3 — 30 seconds on the shipped self-hosted server,
747
- 25 on the shipped hosted service — is clamped to it. Held session-event reads poll at the hosted
748
- one-second budget (`EVENT_WAIT_POLL_MS = 1000`), matching the build and
749
- repository event reads, so append-to-wake is typically under one second. The
777
+ 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
778
+ one-second budget (1000 ms) for session, build and repository event reads. The
750
779
  clamp and early-return semantics are exactly the
751
780
  stream read's, so a poll loop cannot drift between the two.
752
781
 
@@ -836,7 +865,7 @@ session-attribution dimension — stream parts have no actor.
836
865
  | `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 |
837
866
  | `closeStream` | `POST /builds/{slug}/streams/{id}/close` and `POST /repos/{repo}/streams/{id}/close` | `{"outcome": "completed" \| "aborted"}` | `200` + the closed `StreamRecord` |
838
867
 
839
- Because a stream id is globally unique but names no scope, the shipped server
868
+ Because a stream id is globally unique but names no scope, a conforming server
840
869
  and client additionally expose the four addressed operations as top-level
841
870
  routes, which resolve the stream's own scope and then authorize against it:
842
871
 
@@ -907,32 +936,33 @@ Project credentials are opaque `abp_1_<id>_<secret>` bearer values bound to one
907
936
  registered normalized repository. The service stores only a SHA-256 digest of
908
937
  the random secret, plus project, creator, creation time, last use, expiry and
909
938
  revocation metadata. It checks credential status and project registration on
910
- every request. Revocation takes effect on the next request without affecting
939
+ every request. Within one HTTP invocation, registry, authentication and adapter
940
+ operations share at most one full registration/deletion admission per repository.
941
+ The next request always admits afresh. Reads use that admitted identity; each
942
+ mutation transaction locks and checks its generation before writing. Deletion
943
+ waits for an active mutation transaction, then invalidates the generation with
944
+ the initial purge. A later mutation in the same request may receive `403 project
945
+ not registered`; its transaction rolls back, while earlier committed operations
946
+ remain committed. No connection or transaction is held for the whole request.
947
+ Revocation takes effect on the next request without affecting
911
948
  other credentials. Unknown, expired or revoked credentials receive `401 auth`;
912
- removed projects receive `403 auth` with `project not registered`.
913
-
914
- The deployment owner runs these commands locally with database access:
915
-
916
- ```sh
917
- ab-hosted-store credentials issue https://github.com/acme/app --user owner@example.com
918
- ab-hosted-store credentials list https://github.com/acme/app
919
- ab-hosted-store credentials revoke https://github.com/acme/app --id ID --user owner@example.com
920
- ```
921
-
922
- Issue prints the secret once; list contains metadata only. Issue optionally
923
- accepts `--ttl-seconds N` or `--expires-at ISO-8601`. For administrative/non-interactive issuance, set the returned token as
924
- `AB_TOKEN`. Interactive project onboarding uses `ab connect <service-url>`;
925
- it saves the credential outside the repository and commits no secret. Previous `AB_TOKEN` values and `mint operator` / `mint build` are
926
- retired: the service responds that the credential format changed and points
927
- to `credentials issue`. Supported old protocol shapes still work with a new
928
- credential; protocol compatibility does not restore retired authentication.
929
-
930
- `mint admin --ttl-seconds N` creates an explicit versioned, attributed owner
931
- break-glass credential. It can cross project boundaries. Keep it owner-only:
932
- never give it or `AB_STORE_SECRET` to a dispatcher or build agent.
949
+ removed projects receive `403 auth` with `project not registered` when the
950
+ repository is established independently. Permanent project deletion removes
951
+ credentials, so old credentials receive `401` unknown or revoked credential,
952
+ including on `/connect/v1/status`, and remain invalid after reconnection.
953
+ See [permanent project deletion](operator-api.md#permanent-project-deletion)
954
+ for purge, retry and generation-bound confirmation semantics.
955
+
956
+ Obtain a project credential with `ab connect <instance-url>` or from the
957
+ instance, and use `AB_TOKEN` on non-interactive clients. Interactive connection
958
+ saves the credential outside the repository. Retired credential formats are
959
+ refused with a credential-format-changed diagnostic; supported old protocol
960
+ shapes still require current credentials. Compatibility does not restore retired
961
+ authentication. Versioned, attributed owner-admin credentials are an explicit
962
+ cross-project exception and must never be supplied to build agents.
933
963
 
934
964
  Service-owned signatures use `base64url(JSON scope) + "." +
935
- base64url(HMAC-SHA256(AB_STORE_SECRET, payloadSegment))`. Signatures are checked
965
+ base64url(HMAC-SHA256(instanceSigningKey, payloadSegment))`. Signatures are checked
936
966
  in constant time. Current strict scope shapes are:
937
967
 
938
968
  ```jsonc
@@ -971,10 +1001,13 @@ project; phase CLI scoped handles still constrain build and session access.
971
1001
  Authenticated raw writes cannot claim a delegated `via`. Owner-project
972
1002
  credentials also use their recorded creator for operator writes. Dispatcher
973
1003
  credentials have an immutable server-side purpose: raw store and tickets only,
974
- never operator controls. The hosted dispatcher issues one per project
975
- invocation, expiring at its configured TTL, and does not revoke at tick return
976
- for dispatcher plumbing. Spawned builds receive independent delegated grants. Shared content-addressed blobs
977
- remain deduplicated; this is resource authorization, not blob partitioning.
1004
+ never operator controls. Each hosted cron repository tick deletes its exact issued
1005
+ dispatcher-purpose credential row on success or failure. Its crash-safety expiry
1006
+ is the earlier of the configured token TTL and the invocation deadline plus
1007
+ 60 seconds. Spawned builds receive independent delegated grants whose authority
1008
+ continues according to their durable lifecycle after the parent row is deleted
1009
+ or expires. Shared content-addressed blobs remain deduplicated; this is resource
1010
+ authorization, not blob partitioning.
978
1011
 
979
1012
 
980
1013
  ### Delegated build and harvest credentials
@@ -1108,7 +1141,7 @@ These rules apply identically to build, repository, and session deposits.
1108
1141
  ## 9. Errors and validation
1109
1142
 
1110
1143
  Every non-success response is exactly the JSON error shape from section 2.
1111
- The shipped server maps failures as follows:
1144
+ Conforming servers map failures as follows:
1112
1145
 
1113
1146
  | Status | `kind` | Meaning |
1114
1147
  |---:|---|---|
@@ -1119,6 +1152,7 @@ The shipped server maps failures as follows:
1119
1152
  | `409` | `conflict` | Missing/mismatched package or protocol identity, duplicate build creation, appending to a closed stream (`stream "…" is closed`), or a backing conflict reported as already existing |
1120
1153
  | `413` | `validation` | Decoded artifact or serialized stream batch exceeds the configured ceiling; a ticket-asset request or response exceeds the deployment's request ceiling; the message names the ceiling |
1121
1154
  | `422` | `validation` | `EventValidationError` from build, repository, or session catalog validation, or a ticket-asset validation failure (including the 25 MiB limit); its message is preserved verbatim |
1155
+ | `501` | `unsupported-operation` | Optional latest artifact metadata capability is unavailable on the backing adapter |
1122
1156
  | `500` | `internal` | Any other unexpected backing or server failure; the thrown error message is returned |
1123
1157
 
1124
1158
  Authentication runs before resource lookup, and session authorization runs
@@ -1193,12 +1227,10 @@ For streams, the backing store must additionally maintain:
1193
1227
  30-second clamp and no wait on closed streams;
1194
1228
  - the bounded wait on the build, repository, and session event reads exactly
1195
1229
  as specified in section 3, with no per-request database poll faster than once
1196
- per second (the shipped PostgreSQL adapter polls held reads at
1197
- `EVENT_WAIT_POLL_MS = 1000`, so an append by another connection is observed
1198
- at the next poll — typically within about one second, worst case one poll
1199
- interval plus the query round-trip; a hard ≤1 s worst case would need
1200
- LISTEN/NOTIFY wake-on-append at a dedicated connection per held request on
1201
- a pooled provider, a cost considered and declined);
1230
+ per second (a 1000 ms polling implementation observes an append by another
1231
+ connection at the next poll, typically within about one second, with a worst
1232
+ case of one poll interval plus the query round-trip; the protocol does not
1233
+ promise a hard ≤1 s worst case);
1202
1234
  - the atomic close — document assembly, artifact deposit, and the closed
1203
1235
  record visible together or not at all, with the stream left open and
1204
1236
  unwritten when the deposit fails;
@@ -1242,8 +1274,7 @@ Four shipped behaviors do not add `BuildStore` routes:
1242
1274
  returns `200 {"ok":true,"autobuildVersion":"1.1.0",
1243
1275
  "protocolVersion":"6", "supportedClientRange":{"minVersion":"1.0.0",
1244
1276
  "maxVersionExclusive":"1.2.0"}}`. It reports HTTP-process availability and identity,
1245
- not a deeper backing-store transaction or migration check. The example shows
1246
- the target 1.1 release identity; the checkout still uses its installed package version.
1277
+ not a deeper backing-store transaction or migration check. The example shows the 1.1 release identity.
1247
1278
 
1248
1279
  There is no push/WebSocket subscription protocol, repository listing, artifact
1249
1280
  deletion, or server deployment API. The one repo-scoped batch read is the
@@ -1309,7 +1340,7 @@ and credential id, never the secret. Cancel denies pending work or revokes
1309
1340
  only that request's already approved credential. Polling and authenticated
1310
1341
  browser code lookup have durable limits; 429 includes Retry-After.
1311
1342
 
1312
- The web-enabled origin serves `/connect` and cookie-authenticated JSON
1343
+ The instance provides `/connect` and cookie-authenticated JSON
1313
1344
  `POST /connect/v1/browser/lookup` and `/decide`. Decisions read the saved
1314
1345
  proposal, require an allowed live Better Auth session and exact Origin, and
1315
1346
  atomically register the project, install the digest and record the outcome.
@@ -1344,30 +1375,37 @@ and destination IDs. All migration facts survive dispatcher-run turnover.
1344
1375
  Conflicting identity reuse or source-qualified mappings fail replay closed.
1345
1376
 
1346
1377
 
1347
- Browser lookup returns `{connection,assignment,organizations}`. `connection` may
1348
- be null; `assignment` is `new` only when neither registry history nor retained
1349
- assignment exists, otherwise `fixed`. Organizations are eligible `{id,name,membershipRole}`
1350
- destinations for a new project (all for super users, actual memberships otherwise),
1351
- empty for fixed reconnects or unknown codes. Context uses the same lookup limits,
1352
- expiry, admission and foreign-project masking; it does not assign anything.
1353
- The browser shows a chooser only with multiple destinations, disables approval
1354
- with zero, and sends no destination for fixed reconnects. For one actual
1355
- membership it preserves implicit selection; a super user with a sole eligible
1356
- organization but no membership sends that ID explicitly.
1357
-
1358
- Browser connection approval accepts optional `organizationId` in the decide JSON.
1359
- A new project defaults to the approver's only actual membership; zero or multiple
1360
- memberships require an explicit org, including for super users. Members can select
1361
- their own orgs; super users can select any org. Registration, assignment and
1362
- credential insertion commit atomically. Reconnect requires current project access
1363
- and preserves its assignment; moving projects uses organization management only.
1364
- Previously registered unassigned projects, whether active or removed, can be
1365
- reconnected only by super users and remain unassigned. Any registry history
1366
- distinguishes an existing project from a new one. Assigning its retained history
1367
- to an organization requires the super-user management route after re-registration.
1368
- Browser lookup and decisions hide foreign projects as unknown
1369
- connections, even after resolution. Machine request/poll/cancel/status/revoke
1370
- contracts and existing credentials are unchanged.
1378
+ Browser lookup returns `{connection,assignment,organizations,assignedOrganization}`.
1379
+ `connection` may be null. `assignment` is `new` for any unassigned project,
1380
+ regardless of registry history, and `fixed` for an assigned project.
1381
+ `assignedOrganization` is its current `{id,name}`, or null for unassigned or
1382
+ unknown projects. Organizations are eligible `{id,name,membershipRole}`
1383
+ destinations for unassigned projects (all for super users, actual memberships
1384
+ otherwise), empty for fixed reconnects or unknown codes. Context uses the same
1385
+ lookup limits, expiry, admission and foreign-project masking; it assigns nothing.
1386
+
1387
+ Valid code links open approval directly, showing a checking status during lookup.
1388
+ Signed-out users return from sign-in to that approval. Missing or malformed codes
1389
+ retain manual entry. The approval screen always shows the organization: a
1390
+ read-only name for assigned projects, or destination choices for unassigned ones.
1391
+ A sole option is visibly selected and its ID explicitly submitted. Multiple
1392
+ options require a choice; zero destinations prevent approval and explain that
1393
+ a super user must create an organization.
1394
+
1395
+ Browser approval requires `organizationId` for every unassigned project,
1396
+ including fresh, legacy active and removed projects, even for super users or
1397
+ single-membership approvers. Members can select their own orgs; super users can
1398
+ select any org. Missing IDs return 400; ineligible or nonexistent IDs return 403.
1399
+ Registration, assignment, credential insertion and the approval decision commit
1400
+ atomically; refusal changes none of them. Current access and assignment are
1401
+ rechecked under the access lock. Assigned reconnects keep their organization;
1402
+ a different supplied ID is refused, and moves use organization management.
1403
+ Previously registered unassigned projects remain accessible only to super users
1404
+ until management assignment or an authorized reconnect approval assigns them.
1405
+ Denial requires no destination and changes no assignment.
1406
+ Browser lookup and decisions hide foreign projects as unknown connections, even
1407
+ after resolution. Machine request/poll/cancel/status/revoke contracts and existing
1408
+ credentials are unchanged.
1371
1409
 
1372
1410
  ## Operator presence
1373
1411
 
@@ -1395,10 +1433,140 @@ re-registers the same ID. Watch withdrawal treats only 404/405 as an unsupported
1395
1433
  route and silently retains TTL expiry; authorization, transport and malformed
1396
1434
  success errors are diagnosed without failing the watch.
1397
1435
 
1398
- This checkout prepares protocol 6 for the next minor line, 1.1. Published
1399
- v1.0.0/v1.0.1 shipped protocol 4; protocol 5 never shipped. The release identity
1400
- table retains `1.0 -> 4`, and a 1.1/protocol-6 service admits those published
1401
- clients. A 1.0 service does not admit 1.1 clients; route fallback never bypasses
1402
- peer admission. Package versions remain unchanged during feature preparation;
1403
- the maintainer's later minor release command owns the version bump. Patches
1436
+ Release line 1.1 uses protocol 6. Published v1.0.0/v1.0.1 use protocol 4;
1437
+ protocol 5 never shipped. The release identity table retains `1.0 -> 4`, and
1438
+ a 1.1/protocol-6 instance admits those published clients. A 1.0 instance does
1439
+ not admit 1.1 clients; route fallback never bypasses peer admission. Patches
1404
1440
  within a published release line must keep its protocol identity.
1441
+
1442
+
1443
+ ## Project secrets (v1)
1444
+
1445
+ The web app's **Settings** tab also manages project secrets. Its separate
1446
+ cookie-session routes are `GET /api/web/repos/<encoded repo>/secrets`,
1447
+ `POST .../secrets/set` with strict `{name,value}`, and
1448
+ `POST .../secrets/remove` with strict `{name}`. An unexpired signed-in session
1449
+ and fresh project organization membership or super-user authority authorize each
1450
+ request. Browser mutations require the configured same-origin Origin and JSON.
1451
+ The normalized signed-in email is the owner and audit actor. Reads return only
1452
+ allowlisted secret metadata and account name, kind, credentialEnv and readiness
1453
+ from recorded effective configuration; absent or unavailable configuration does
1454
+ not prevent secret management. Browser set/replace atomically refuses existing
1455
+ non-static credentials. Renew ChatGPT credentials with
1456
+ `ab accounts login <account> --project`. Values are write-only, cleared after
1457
+ acknowledgment and never returned in responses. Removal confirms in the shared
1458
+ dialog before writing. The machine routes below retain their project-owner
1459
+ credential requirement and CLI replacement semantics.
1460
+
1461
+ Project secrets are separate from BuildStore artifacts and machine credentials.
1462
+ They are write-only: no CLI, store method, operator tool, MCP tool or web route
1463
+ returns a value, ciphertext, access token or refresh state. The only plaintext
1464
+ consumer is the hosted dispatcher's internal resolver. Local dispatchers use
1465
+ their own environment.
1466
+
1467
+ The machine routes below require the standard client/version headers and bearer authorization,
1468
+ return JSON with `Cache-Control: no-store`, and require a saved `project-owner`
1469
+ credential issued through `ab connect`. The project must match the credential,
1470
+ remain registered, and its creator must still have project membership. Dispatcher,
1471
+ build, delegated, internal and administrative credentials are refused.
1472
+
1473
+ | Route | Input | Response |
1474
+ | --- | --- | --- |
1475
+ | `GET /secrets/v1/list?repo=<encoded repository identity>` | Project identity | `{version: 1, secrets: [...]}` |
1476
+ | `POST /secrets/v1/set` | `{version: 1, repo, name, value}` | `{version: 1, ok: true}` |
1477
+ | `GET /secrets/v1/chatgpt-host?repo=<encoded repository identity>` | Project identity | `{version: 1, hostId}` (nonsecret destination identity) |
1478
+ | `POST /secrets/v1/chatgpt` | `{version: 1, repo, name, state}` (validated ChatGPT registration) | `{version: 1, ok: true}` |
1479
+ | `POST /secrets/v1/remove` | `{version: 1, repo, name}` | `{version: 1, ok: true}` |
1480
+
1481
+ The ChatGPT write accepts a strict versioned registration containing its destination
1482
+ host ID, issued client ID, validated subject, granted scopes, access/refresh/ID
1483
+ tokens and expiry/refresh window. It validates destination identity and stores
1484
+ only an encrypted refreshing payload. No response exposes tokens or provider
1485
+ state; browser authorization completes on the operator's machine.
1486
+
1487
+ Writes accept only the listed fields. Static values are nonempty strings, at most
1488
+ 64 KiB in UTF-8, without NUL. Names are case-sensitive environment identifiers
1489
+ `[A-Z_][A-Z0-9_]*`, at most 128 characters. Dispatcher authority and process-control
1490
+ names are reserved: store, forge, Vercel, cron, database, object-storage, loader,
1491
+ proxy and runtime-control variables cannot be overridden. This includes `AB_*`,
1492
+ `GITHUB_*`, `GH_*`, `VERCEL_*`, `CRON_*`, `DATABASE_*`, `POSTGRES_*`, `PG*`,
1493
+ `AWS_*`, `BLOB_*`, `PATH`, `HOME`, `NODE_*` and `BUN_*`.
1494
+ Subscription names such as `ANTHROPIC_API_KEY`, `CLAUDE_CODE_OAUTH_TOKEN` and
1495
+ `KIMI_API_KEY` are accepted.
1496
+
1497
+ Each metadata entry contains `name`, `kind`, `owner` (the member who set the
1498
+ current value), `setAt` (ISO timestamp), `fingerprint` (16 hexadecimal characters,
1499
+ keyed and non-reversible), `status` (`ready`, `refreshing`, `failed`), `failureCode`
1500
+ (null, `refresh-failed` or `refresh-expired`) and `lastSuppliedAt` (ISO timestamp
1501
+ or null). A refreshing secret may also include typed `warnings`, currently
1502
+ `["refresh-window-too-short"]` when its permitted refresh window is shorter than
1503
+ the five-minute tick interval plus a one-minute safety margin. This is advisory;
1504
+ missing warnings do not establish a sufficient window when encrypted state is
1505
+ unavailable for diagnosis. Set/replace resets delivery and failure metadata.
1506
+ Every set/remove records actor and time without material. Supply means the environment was handed
1507
+ to a kernel, not that a build completed.
1508
+
1509
+ On each hosted tick the complete current project set overrides the deployment
1510
+ environment for that project only. Replacement/removal applies on the next tick.
1511
+ Resolution failure suppresses intake and all new execution launches. When the
1512
+ ready subset can be read, a revision-fenced observation-only pass repairs running
1513
+ execution policies: unavailable names are withheld, their transforms are revoked,
1514
+ and unrelated ready account transforms remain active. It performs no janitor,
1515
+ resume, lease-sweep, or harvest launch work. If encryption or decryption prevents
1516
+ reading that subset, the project is skipped. Resolution and handoff validate the
1517
+ complete generation/revision set, including unavailable rows; a stale handoff
1518
+ runs no observation or dispatch. Normal dispatch still requires the complete
1519
+ usable secret set; other projects can continue. Projects without saved secrets resolve and supply an
1520
+ empty set without encryption configuration, including when another project has
1521
+ secrets. All secret mutations still require valid encryption configuration, even
1522
+ on an empty project. An empty snapshot becomes stale if a secret is added before
1523
+ handoff. Metadata remains available for diagnosis.
1524
+
1525
+ Refreshing kinds are internal provider integrations, not arbitrary endpoint URLs
1526
+ or CLI write formats. The five-minute hosted cadence is unchanged. A token that
1527
+ is valid now but not yet refreshable is supplied unchanged; a caller’s future
1528
+ validity horizon cannot reject it. The first tick at or after both the ten-minute pre-expiry threshold and any
1529
+ provider earliest-refresh floor rotates the credential and commits encrypted
1530
+ replacement state before supply. Equality is eligible; an absent floor retains
1531
+ the ten-minute margin, which tolerates a delayed five-minute tick. After downtime,
1532
+ expired access state is refreshed before supply while its durable status remains
1533
+ ready and both gates hold. Expired access behind a future floor is never supplied.
1534
+ Failed or uncertain refresh attempts prevent supply and require replacement. A valid
1535
+ credential is never revoked merely because its refresh window is short. A durable
1536
+ attempt permits only one refresh caller across overlapping ticks. An abandoned attempt expires to failed without reusing the
1537
+ possibly consumed refresh token; explicit replacement is required. Errors use
1538
+ fixed safe codes and never reflect provider responses or submitted values.
1539
+
1540
+ Use `ab secrets list [--json]`, `ab secrets set NAME` or `ab secrets remove NAME`
1541
+ from a connected checkout outside build/harvest sessions. Set reads hidden terminal
1542
+ input or redirected stdin. There is no value argument and values are never printed.
1543
+ The commands use the saved owner credential, even if an ambient build token exists.
1544
+
1545
+
1546
+ ### Forge cooldown admission and explicit recovery
1547
+
1548
+ Hosted repository event appends and atomic artifact deposits validate
1549
+ `dispatcher.forge-degraded` before any durable mutation. The payload must match
1550
+ its event schema, with a finite ISO `resetAt` at most 24 hours after server time
1551
+ (inclusive). Already-expired deadlines are accepted. Invalid or out-of-horizon
1552
+ writes return `400 validation` (the remote adapter exposes `EventValidationError`);
1553
+ the server never clamps or invents a provider reset. Historical decoding has no clock-relative restriction.
1554
+
1555
+ Build-runner and build-phase grants may POST only the kernel-authored
1556
+ `dispatcher.forge-degraded` repository fact through the events route. The
1557
+ preceding `requireProject` check binds this exception to the exact repository
1558
+ in the delegated claim. A hosted project identifies one repository. Delegates
1559
+ cannot write recovery, deposits or other repository facts, regardless of the
1560
+ actor claimed in an envelope.
1561
+
1562
+ An authorized operator can explicitly clear erroneous state through
1563
+ `repository.forge_clear {repo, forge, reason}` or
1564
+ `ab repository forge-clear --forge <name> --reason <text> [--json] [--store <ref>]`.
1565
+ The reason is required and nonblank. The result contains the durable recovery
1566
+ `event`, attributed to the authenticated human with normal `via` attribution.
1567
+ Build and harvest delegates cannot invoke this operator mutation. CLI use
1568
+ requires an operator outside build/harvest sessions. This is an override, not
1569
+ proof of provider success. A clear appends once without reading history, even
1570
+ when already healthy; later degradation wins by ordinary journal order.
1571
+ Existing dispatcher/kernel automatic recovery and old payloads remain valid;
1572
+ the recovered payload additionally accepts an optional nonblank `reason`.