@defrex/autobuild 1.1.0 → 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 (114) hide show
  1. package/README.md +5 -13
  2. package/SPEC.md +140 -10
  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/architecture.md +107 -8
  7. package/docs/build-store.md +3 -41
  8. package/docs/cli.md +14 -0
  9. package/docs/configuration-overview.md +111 -0
  10. package/docs/configuration.md +260 -141
  11. package/docs/dispatcher-hosting.md +18 -33
  12. package/docs/intake.md +2 -0
  13. package/docs/merge-policy.md +1 -3
  14. package/docs/operating.md +1 -2
  15. package/docs/operator-api.md +100 -47
  16. package/docs/operator-surfaces.md +3 -20
  17. package/docs/overview.md +1 -1
  18. package/docs/plugin-authoring.md +21 -0
  19. package/docs/remote-store-protocol.md +198 -89
  20. package/docs/remote-ticket-protocol.md +29 -49
  21. package/docs/seams.md +8 -8
  22. package/docs/setup.md +34 -129
  23. package/docs/ticket-sources.md +18 -0
  24. package/docs/troubleshooting.md +7 -11
  25. package/docs/upgrading.md +1 -1
  26. package/docs/workspaces.md +4 -4
  27. package/package.json +14 -5
  28. package/packages/core/src/accounts/chatgpt-oauth.ts +216 -0
  29. package/packages/core/src/accounts/chatgpt-state.ts +41 -0
  30. package/packages/core/src/accounts/local-credentials.ts +194 -0
  31. package/packages/core/src/accounts/local-inference.ts +106 -0
  32. package/packages/core/src/accounts/local-owner.ts +123 -0
  33. package/packages/core/src/accounts/sensitive.ts +2 -0
  34. package/packages/core/src/cli/accounts.ts +147 -0
  35. package/packages/core/src/cli/binary.ts +3 -1
  36. package/packages/core/src/cli/connect.ts +3 -3
  37. package/packages/core/src/cli/dispatch-handoff.ts +125 -44
  38. package/packages/core/src/cli/dispatch-launch-contract.ts +187 -0
  39. package/packages/core/src/cli/dispatch-launcher.ts +54 -21
  40. package/packages/core/src/cli/dispatch-preflight.ts +6 -1
  41. package/packages/core/src/cli/dispatch.ts +71 -2
  42. package/packages/core/src/cli/help.ts +16 -0
  43. package/packages/core/src/cli/init-readiness-remote.ts +22 -1
  44. package/packages/core/src/cli/init-readiness-shared.ts +5 -1
  45. package/packages/core/src/cli/init-validation.ts +160 -18
  46. package/packages/core/src/cli/main.ts +44 -0
  47. package/packages/core/src/cli/publication-settlement.ts +4 -1
  48. package/packages/core/src/cli/secrets.ts +173 -0
  49. package/packages/core/src/cli/store-opening.ts +11 -1
  50. package/packages/core/src/cli/upgrade-agent.ts +9 -1
  51. package/packages/core/src/cli/watch.ts +3 -1
  52. package/packages/core/src/config/accounts.ts +101 -0
  53. package/packages/core/src/config/live.ts +14 -1
  54. package/packages/core/src/config/roles.ts +54 -3
  55. package/packages/core/src/config/schema.ts +60 -0
  56. package/packages/core/src/events/compatibility.ts +2 -1
  57. package/packages/core/src/events/payloads.ts +3 -0
  58. package/packages/core/src/events/repository.ts +2 -0
  59. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +3 -0
  60. package/packages/core/src/kernel/reducer.ts +4 -1
  61. package/packages/core/src/operator/index.ts +2 -0
  62. package/packages/core/src/operator/protocol.ts +6 -0
  63. package/packages/core/src/operator/registry.ts +22 -1
  64. package/packages/core/src/operator/tickets.ts +25 -4
  65. package/packages/core/src/plugins/manifest.ts +2 -1
  66. package/packages/core/src/ports/runner/account-env.ts +88 -0
  67. package/packages/core/src/ports/runner/chatgpt-provider.ts +85 -0
  68. package/packages/core/src/ports/runner/claude.ts +26 -2
  69. package/packages/core/src/ports/runner/codex.ts +63 -31
  70. package/packages/core/src/ports/runner/one-shot.ts +2 -0
  71. package/packages/core/src/ports/runner/provider-error.ts +5 -0
  72. package/packages/core/src/ports/runner/routing.ts +35 -4
  73. package/packages/core/src/ports/tickets/contract.ts +58 -0
  74. package/packages/core/src/ports/tickets/tree.ts +1 -1
  75. package/packages/core/src/ports/types.ts +28 -7
  76. package/packages/core/src/ports/workspace/account-policy.ts +72 -0
  77. package/packages/core/src/ports/workspace/build-execution.ts +6 -1
  78. package/packages/core/src/ports/workspace/builtin-capabilities.ts +1 -0
  79. package/packages/core/src/ports/workspace/create.ts +2 -0
  80. package/packages/core/src/ports/workspace/git-worktree.ts +6 -1
  81. package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -0
  82. package/packages/core/src/ports/workspace/vercel-sandbox.ts +125 -35
  83. package/packages/core/src/processes/build-runner.ts +32 -1
  84. package/packages/core/src/processes/dispatcher.ts +23 -0
  85. package/packages/core/src/processes/execution-settlement.ts +21 -3
  86. package/packages/core/src/processes/harvest-runner.ts +68 -8
  87. package/packages/core/src/project-secrets.ts +105 -0
  88. package/packages/core/src/secret-name.ts +41 -0
  89. package/packages/core/src/store/account-redaction.ts +156 -0
  90. package/packages/core/src/store/contract.ts +3 -1
  91. package/packages/core/src/store/reducer-value-shapes.json +2889 -2781
  92. package/packages/core/src/store/remote/client.ts +42 -47
  93. package/packages/core/src/store/remote/compatibility.ts +18 -0
  94. package/packages/core/src/testing/dispatch-read-budget.ts +122 -0
  95. package/packages/core/src/testing/index.ts +1 -0
  96. package/packages/core/src/testing/reduced-read-budget.ts +47 -0
  97. package/skills/guide/SKILL.md +120 -30
  98. package/skills/guide/references/accounts.md +119 -0
  99. package/skills/guide/references/merge-policy.md +1 -3
  100. package/skills/guide/references/operator-api.md +100 -47
  101. package/skills/guide/references/plugin-authoring.md +21 -0
  102. package/skills/guide/references/remote-store-protocol.md +198 -89
  103. package/skills/guide/references/remote-ticket-protocol.md +29 -49
  104. package/skills/guide/references/setup.md +34 -129
  105. package/skills/harvest/SKILL.md +3 -1
  106. package/skills/harvest-review/SKILL.md +3 -1
  107. package/skills/operate/SKILL.md +5 -6
  108. package/skills/spec/SKILL.md +1 -1
  109. package/skills/tickets/SKILL.md +3 -2
  110. package/templates/hosted-service/package.json +2 -2
  111. package/docs/hosted-dispatcher-cutover-validation.md +0 -178
  112. package/docs/hosted-dispatcher.md +0 -278
  113. package/docs/hosted-service.md +0 -304
  114. package/docs/mcp.md +0 -150
@@ -152,7 +152,11 @@ repository-scoped workflow: deterministic `scan`, agent `synthesize`
152
152
  ⇄ fresh adversarial `review`, then deterministic `file`. Only approved
153
153
  spec-standard proposals are created, in `[tickets].proposalState` — the triage
154
154
  state unless this repository has named another one. The scan context exposes
155
- existence and resolution for each distinct observation-origin ticket. At filing,
155
+ existence and resolution for each distinct observation-origin ticket. Ledger
156
+ lifecycle is also scan-time context: filing refreshes existence and resolution
157
+ before allowing a join. Each same-source ledger ticket uses one fresh lookup;
158
+ hosted alias resolution shares that response. Missing, resolved, and foreign-source
159
+ ledger tickets cannot be joined. At filing,
156
160
  matching-source origins are refreshed and every still-existing unresolved one
157
161
  is unioned with the agent-declared `blockedBy` ids; missing, resolved, foreign,
158
162
  and absent origins are dropped. Filing records declared and origin-derived
@@ -225,8 +229,19 @@ The distinctions that change an administrator's answer:
225
229
  launcher that snapshots the invoking installation and its installed production
226
230
  dependencies offline into `.autobuild/runtime/`. The generation's frontend,
227
231
  kernel, later local runners and agent PATH CLI execute from that immutable
228
- root. The launcher owns no Store/lease and uses only the versioned v1 process
229
- contract. Automatic upgrades default on: the kernel checks immediately and every
232
+ root. The launcher owns no Store/lease and uses the versioned v1 process
233
+ contract with an optional independently versioned conditional `--read-upgrade`
234
+ environment extension. Its current successful answer and pre-read repository
235
+ change position are scoped to the exact reader runtime, journal, run, lineage
236
+ and recovery context. An unchanged runtime helper makes one position request,
237
+ with zero metadata/reducer/event reads; it revalidates target cache identity
238
+ and rollback retention locally on every check. Full refresh samples position
239
+ before projection reads, so concurrent appends invalidate the following check.
240
+ Errors discard conditional state; unloadable targets retain the healthy
241
+ predecessor reader fallback with the active query. Old peers still exchange
242
+ full v1 answers. Polling remains 1 second idle / 250 ms pending, and cached
243
+ answers still drive pending actions, child exits and recovery expiry.
244
+ Automatic upgrades default on: the kernel checks immediately and every
230
245
  60 seconds, resolving a declared Autobuild dependency and Bun lock from the same
231
246
  authoritative base-branch commit. Unpinned repositories reread the original
232
247
  installation pathname, retained across handoffs. Launching from a source root
@@ -304,7 +319,7 @@ The distinctions that change an administrator's answer:
304
319
  Current, distinct previous, held and live-process runtimes survive pruning.
305
320
  Cached Bun entries disable auto-install and explicitly pin a neutral compiler
306
321
  config. Third-party files remain as installed. `--plain`/non-TTY run directly
307
- within the generation; `--once`, origin/hosted and hot development paths bypass
322
+ within the generation; `--once`, origin-mode and hot development paths bypass
308
323
  the launcher. `--once` remains one tick plus drain.
309
324
  - **Live configuration** has two explicit contexts. A running dispatcher owns
310
325
  the last valid snapshot from the **main checkout**; dispatch, setup, and each
@@ -380,7 +395,7 @@ evaluated as config logic.
380
395
 
381
396
  **Strictness:** unknown top-level keys/tables and unknown keys inside known
382
397
  tables are **errors**, not warnings — a typo must not silently disable a
383
- verifier. The open maps are `[commands]`, `[roles]`, `[workspace.config]`,
398
+ verifier. The open maps are `[accounts]`, `[commands]`, `[roles]`, `[workspace.config]`,
384
399
  `[workspace.config.runtimeProvisioning]`, `[verify.<step>]`, and
385
400
  `[finalize.<step>]`. Autobuild strictly validates the
386
401
  repository-defined command, role, and step entries. `[workspace.config]` is
@@ -436,7 +451,7 @@ and `[roles.*].runtime`. BuildStore uses the remote HTTP protocol, not this
436
451
  manifest, and TelemetrySource has no registration map.
437
452
 
438
453
  For the complete author workflow—from choosing one of the four open ports,
439
- through the strict versioned manifest and environment-only secrets, to the
454
+ through the strict versioned manifest and secrets supplied through the environment, to the
440
455
  unchanged shared contract suite and optional npm publication—read
441
456
  [`references/plugin-authoring.md`](references/plugin-authoring.md).
442
457
 
@@ -539,7 +554,7 @@ available providers. A handle's `path` is absolute in its execution environment,
539
554
  reachability.
540
555
 
541
556
  `provider = "vercel-sandbox"` runs the complete build in a persistent Vercel VM
542
- and requires an HTTPS hosted Store/scoped token, GitHub HTTPS origin, GitHub
557
+ and requires a remote store that speaks the remote BuildStore protocol over HTTPS and a scoped token, GitHub HTTPS origin, GitHub
543
558
  forge, a dispatcher-side push-capable `GITHUB_TOKEN` or `GH_TOKEN`, and either
544
559
  `VERCEL_OIDC_TOKEN` or the `VERCEL_TOKEN`/`VERCEL_TEAM_ID`/
545
560
  `VERCEL_PROJECT_ID` tuple. These credentials are validated before claims:
@@ -563,7 +578,7 @@ preflight = "test \"$(pi --version)\" = \"0.84.4\" && pi update --models"
563
578
 
564
579
  `timeoutSeconds` is required (60–86400; Hobby currently caps at 2700), `vcpus`
565
580
  is 1–32, and optional `region`/unique `failoverRegions` select placement. Only
566
- the named runtime variables and scoped `AB_STORE`/`AB_TOKEN` enter guest
581
+ the named runtime variables, declared account placeholders, and scoped `AB_STORE`/`AB_TOKEN` enter guest
567
582
  commands. Never list Store, Forge, Vercel, or private-clone credentials there.
568
583
  Every effective primary/alternate runtime needs a strict
569
584
  `runtimeProvisioning` entry with pinned `install` and exact-version `preflight`
@@ -571,8 +586,7 @@ commands; runtime names remain open for plugins. Install/preflight runs before
571
586
  the marker in every fresh/replacement/readiness sandbox, and preflight reruns
572
587
  before every child. Failures name the runtime, role/alternate, and field and
573
588
  start no agent. Keep runtime installation out of `commands.setup`. Pi over
574
- `vercel-ai-gateway/...` uses `AI_GATEWAY_API_KEY`; never copy OAuth tokens,
575
- `~/.pi`, or interactive login state. The clone identity is upload-pack-only and
589
+ `vercel-ai-gateway/...` uses `AI_GATEWAY_API_KEY`; never copy Pi state or Pi OAuth refresh tokens. Claude Code can select named [accounts](references/accounts.md): subscription tokens or region-bound Kimi Code keys stay on the dispatcher, with placeholders in the guest and exact-host/header egress transforms. Use the unmodified runtime, your own subscription and ordinary individual usage. Provision Claude/Kimi credentials manually; Autobuild never invokes `claude setup-token`. Codex can explicitly select a ChatGPT Plus/Pro account authorized with `bun ab accounts login NAME [--local|--project]`; exactly one dispatcher or hosted refreshing secret owns its renewal. The clone identity is upload-pack-only and
576
590
  scrubbed from Git config before an agent starts. Agents cannot push. Remote phase terminals deposit a durable
577
591
  publication request and park; that successful `ab done` is the one terminal and
578
592
  must not be repeated. After VM stop and lease release, the local kernel
@@ -921,20 +935,41 @@ the agent never pushes. An unchanged `HEAD` creates and pushes no commit. Dirty
921
935
  output, rewritten history, Git errors, and publication failures record the
922
936
  step as failed and file an observation while the green build continues.
923
937
 
938
+ ### `[accounts]`
939
+
940
+ An open map of account name to a strict, nonsecret descriptor. Claude and Kimi
941
+ accounts use Claude Code; ChatGPT subscriptions require explicit Codex selection.
942
+ Provision Claude/Kimi credentials manually; authorize ChatGPT with
943
+ `bun ab accounts login NAME [--local|--project]`. Exactly one local dispatcher
944
+ or hosted refreshing secret owns renewal; guests only hold placeholders. Full
945
+ examples, remedies and regional routing are in [billing accounts](references/accounts.md).
946
+
947
+ | Field | Meaning |
948
+ |---|---|
949
+ | `kind` | `claude-subscription` for a setup token, `kimi-code` for a membership key, or `chatgpt-subscription` for a Plus/Pro plan through OpenAI sign-in. |
950
+ | `credentialEnv` | Portable dispatcher environment variable identifier, excluding reserved `AB_` control names. |
951
+ | `region` | Kimi only: `overseas` (default) or `china`; endpoint and egress host are selected together. |
952
+
924
953
  ### `[roles]`
925
954
 
926
- An **open map** of role name → `{ runtime?, model?, args?, extensions?, sessionBudgetSeconds?, alternates? }`.
927
- The three primary axes, session budget, and ordered alternate list inherit independently. The reserved `default` role must explicitly name a
955
+ An **open map** of role name → `{ runtime?, model?, account?, args?, extensions?, sessionBudgetSeconds?, alternates? }`.
956
+ The four primary axes, session budget, and ordered alternate list inherit independently. The reserved `default` role must explicitly name a
928
957
  runtime, is the raw inheritance base for every other role, and is **never
929
958
  dispatched as a phase**. Its absence fails eager resolution before a session,
930
959
  with a copyable fix and all registered runtime names. Three runtimes ship:
960
+ Named `[accounts]` are deployment-owned nonsecret descriptors, adopted atomically
961
+ with `[roles]`. The `account` axis inherits independently on primary and alternate
962
+ routes. A Claude route defaults to the sole Claude subscription account, and
963
+ ambiguity or incompatible runtimes fail validation. See [billing accounts](references/accounts.md)
964
+ for provisioning, ChatGPT sign-in destinations, Kimi regions, placeholders, single-owner renewal and metadata-only hosted readiness.
965
+
931
966
  **`claude`** (local Claude Code CLI), **`codex`** (local Codex CLI; unqualified
932
967
  `gpt-*` ids), and **`pi`** (local Pi CLI 0.84.3 or newer; provider-qualified ids
933
968
  such as the independent `openai-codex/gpt-5.6-sol` route). Pi runs headlessly
934
969
  through RPC and uses that local installation's login and model catalog;
935
970
  Autobuild does not install it. `ab models [query]` lists the local catalog, and
936
971
  `ab models --available` filters it to configured credentials. Claude and Codex
937
- delegate an omitted model to their CLI default; Pi declares `kimi-coding/k3`.
972
+ delegate an omitted model to their CLI default; a Claude route selecting a Kimi Code account defaults to `kimi-for-coding`; Pi declares `kimi-coding/k3`.
938
973
  Trusted plugins may register additional runtime names;
939
974
  they use the same role inheritance, default-model compatibility validation,
940
975
  session event attribution, and optional one-shot capability path as builtins.
@@ -947,7 +982,7 @@ release. The repository workflow resolves `harvest` and `harvest-review`. Two
947
982
  non-phase judgments use the same runtime/model/args resolver: `slug` optionally
948
983
  proposes pre-build naming, and `upgrade` proposes a resolution only when a
949
984
  vendored skill merge conflicts. Both are tool-free one-shots and receive the
950
- role's effective `args`. Missing slug capability uses the deterministic title fallback;
985
+ role's effective `args` and selected account. Missing slug capability uses the deterministic title fallback;
951
986
  unavailable upgrade judgment retains the conflict for manual resolution.
952
987
 
953
988
  A declared key that none of those routes requests is resolved and validated
@@ -963,24 +998,35 @@ consumed by the core `plan` phase, and nothing is reported.
963
998
  | Field | Default | Allowed / constraints | Effect |
964
999
  |---|---|---|---|
965
1000
  | `runtime` | — | required on `default`; otherwise optional, nonempty string | Runtime for this role. A child that omits it inherits `[roles.default].runtime`. Must name a registered runtime. |
966
- | `model` | — | optional, nonempty string | Model for this role. A role that omits it inherits `[roles.default].model`; only when neither names a model does the merged runtime supply its own default. |
967
- | `args` | `[]` | optional, array of nonempty strings | Ordered extra CLI argv tokens for every phase and tool-free one-shot invocation. Omitted ⇒ inherit `[roles.default].args`; a set list, including `[]`, replaces it wholesale. Each string is one token, without shell parsing. Only model and parsed protocol/output-mode spellings are rejected eagerly. |
1001
+ | `account` | Named billing account; inherits independently on primaries and alternates. Omission selects the sole Claude subscription account for a Claude route. |
1002
+ | `model` | — | optional, nonempty string | Model for this role. A role that omits it inherits `[roles.default].model`; when neither names a model, a Claude route selecting a Kimi Code account uses `kimi-for-coding`, and every other route uses its runtime's own default. |
1003
+ | `args` | `[]` | optional, array of nonempty strings | Ordered extra CLI argv tokens for every phase and tool-free one-shot invocation. Omitted ⇒ inherit `[roles.default].args`; a set list, including `[]`, replaces it wholesale. Each string is one token, without shell parsing. Model and parsed protocol/output-mode spellings are rejected eagerly; Claude routes with a selected account additionally reject `--settings`, `--setting-sources`, and `--bare` because Autobuild owns their authentication settings. Codex routes selecting a ChatGPT subscription account additionally reject `-c`, `--config`, `--profile`, `-p`, `--enable`, and `--disable` because Autobuild owns their provider and configuration routing. |
968
1004
  | `extensions` | no effect | deprecated optional array of nonempty strings | Compatibility-only field. Dispatch warns for each declaring role and directs migration to `args`. |
969
1005
  | `sessionBudgetSeconds` | policy fallback | optional positive integer | Active-time budget for each build phase session on this logical role; suspended intervals are excluded and native continuation retains the original ceiling. Omitted ⇒ inherit `[roles.default].sessionBudgetSeconds`; absent there too ⇒ `[policy].sessionBudgetSeconds`. One value covers the primary and every alternate. |
970
- | `alternates` | `[]` | optional ordered array of strict `{ runtime?, model?, args?, extensions? }` entries | Failure-triggered targets. Omitted ⇒ inherit `[roles.default].alternates`; a role list, including `[]`, replaces it wholesale. Each entry overlays that role's effective primary axes and is eagerly validated. `extensions` remains only the deprecated no-op. |
1006
+ | `alternates` | `[]` | optional ordered array of strict `{ runtime?, model?, account?, args?, extensions? }` entries | Failure-triggered targets. Omitted ⇒ inherit `[roles.default].alternates`; a role list, including `[]`, replaces it wholesale. Each entry overlays that role's effective primary axes and is eagerly validated. `extensions` remains only the deprecated no-op. |
971
1007
 
972
1008
  Inheritance is mechanical and **independent per field**: merge each configured
973
1009
  role over the raw `default` entry, then validate the exact runtime/model pair.
974
1010
  The named runtime must serve the named model. A model-only role never searches
975
1011
  for another runtime, and an incompatible inherited model is never replaced by
976
1012
  the selected runtime's default. The one implicit fill-in is benign: if neither
977
- the phase role nor `default` names a model, the merged runtime uses its own
978
- default model. Compatibility failures name the role, runtime, model, and served
1013
+ the phase role nor `default` names a model, a Claude route selecting a Kimi Code
1014
+ account uses `kimi-for-coding`; every other route uses its runtime's own default.
1015
+ Alternates overlay the primary runtime, model, account, and args before model
1016
+ defaults are applied, so an alternate without an explicit or inherited model uses
1017
+ the default for its own selected account and runtime. Compatibility failures name the role, runtime, model, and served
979
1018
  model families; all problems in `default` and every declared role are
980
1019
  aggregated by one eager resolver construction before judgment runs. Runtime
981
- adapters reject only the model and parsed protocol/output-mode options they
1020
+ adapters reject the model and parsed protocol/output-mode options they
982
1021
  emit: Claude rejects `-p`/`--print`, `--output-format`, and `--model`; Codex
983
- rejects `--json` and `--model`/`-m`; Pi rejects `--mode` and `--model`. Exact
1022
+ rejects `--json` and `--model`/`-m`; Pi rejects `--mode` and `--model`. Claude
1023
+ routes with a selected account additionally reject `--settings`,
1024
+ `--setting-sources`, and `--bare` because Autobuild owns their authentication
1025
+ settings. Codex routes selecting a ChatGPT subscription account additionally
1026
+ reject `-c`, `--config`, `--profile`, `-p`, `--enable`, and `--disable`
1027
+ because Autobuild owns their provider and configuration routing. This includes
1028
+ using `-c` to set reasoning effort. Routes without an account retain the existing
1029
+ argument behavior. Exact
984
1030
  spellings, `--option=value` forms, and documented compact short aliases join
985
1031
  that same role-naming aggregate. Every other option passes through without
986
1032
  Autobuild validation, including sandbox, approval, session, tool, skill,
@@ -1257,7 +1303,7 @@ Exact changed targets can include downgrades. Missing or inconsistent declared-p
1257
1303
  metadata never falls back to installed mode. Self-hosting source launches follow
1258
1304
  the authoritative base commit using packaged-content and production-lock equality,
1259
1305
  without modifying operator or build worktrees. Equal-content advances still record
1260
- the latest resolved target SHA. Compatible generations overlap through the durable draining handoff described above. `--once`, origin/hosted and direct hot
1306
+ the latest resolved target SHA. Compatible generations overlap through the durable draining handoff described above. `--once`, origin-mode and direct hot
1261
1307
  presentation modes bypass automatic adoption. Operator stop wins over cutover.
1262
1308
  Repository status exposes per-run resolved target, upgrade target, failure and handoff facts, both
1263
1309
  generations, takeover, outstanding draining builds and deadline;
@@ -1292,7 +1338,7 @@ repo path, needs no `AB_*` environment, and is safe to re-run. It:
1292
1338
  setup prompt for the user to run in a coding agent.
1293
1339
  - The setup agent inspects the repository, configures real commands and verify
1294
1340
  steps, independently chooses pipeline role runtimes/models, configures the
1295
- ticket source and environment-only credentials, arranges
1341
+ ticket source and credentials supplied through the environment, arranges
1296
1342
  an acceptance check through a repository-owned agent verify skill in every
1297
1343
  repository. Wire an existing maintained end-to-end or browser test suite into an ordinary `check` step. If none exists, do not create one during setup. The acceptance check neither substitutes for nor seeds a suite. It completes `bun ab init --validate`, fixing failures
1298
1344
  and reviewing warnings. The human then starts `bun ab dispatch` and opens
@@ -1480,11 +1526,16 @@ every agent session as `AB_STORE`.
1480
1526
 
1481
1527
  From a checkout with an origin remote, run `ab connect https://YOUR_ORIGIN`.
1482
1528
  The CLI prints a verification URL and short code and attempts to open a browser.
1483
- Sign in as an allowed owner, check the full repository identity and code, and
1484
- approve or deny. Another device can open the printed URL, or visit `/connect`
1485
- and enter the code. Approval requires the web-enabled service origin; a
1486
- standalone machine-only listener cannot present browser consent. Requests
1487
- expire after ten minutes. Denial and timeout leave local configuration unchanged.
1529
+ The code link opens approval directly; if sign-in is needed, it returns there.
1530
+ Check the full repository identity and code, and approve or deny. For an
1531
+ unassigned project, choose an eligible organization; a sole option is visibly
1532
+ selected. Approval requires that destination even for previously registered
1533
+ unassigned projects. Assigned projects show their organization as read-only;
1534
+ moving them uses project management. With no eligible organization, approval is
1535
+ unavailable until a super user creates one. Another device can open the printed
1536
+ URL, or visit `/connect` and enter the code. Approval uses the instance’s browser
1537
+ consent endpoint. Requests expire after ten minutes. Denial requires no
1538
+ organization choice; denial and timeout leave local configuration unchanged.
1488
1539
 
1489
1540
  On approval the service registers the project and issues a project credential.
1490
1541
  The CLI keeps it in `$XDG_CONFIG_HOME/autobuild/credentials` (or
@@ -1495,6 +1546,22 @@ absent; review and commit that change yourself. An existing different URL
1495
1546
  must be changed explicitly before connecting. Reconnecting replaces the saved
1496
1547
  credential only after approval and revokes the previous credential.
1497
1548
 
1549
+ Connected project members can manage write-only project secrets in the web **Settings** tab (also available to super users), or with
1550
+ `ab secrets list [--json]`, `ab secrets set NAME` and `ab secrets remove NAME`.
1551
+ Set reads hidden terminal input or redirected stdin; values never appear in
1552
+ arguments or responses. These sessionless commands use the saved owner
1553
+ credential and recheck current membership. The current setter owns the value,
1554
+ which serves every hosted build of that project. Hosted ticks resolve a fresh,
1555
+ complete encrypted set and override matching deployment variables for that
1556
+ project only; local dispatchers keep using their own environment. For projects
1557
+ with saved secrets, failed configuration, decryption or refresh prevents dispatch.
1558
+ Projects without secrets continue with an empty set without encryption
1559
+ configuration. Every secret write still requires valid encryption configuration.
1560
+ List exposes only status, owner, timestamps and a keyed fingerprint. See the
1561
+ [write-only protocol](references/remote-store-protocol.md#project-secrets-v1).
1562
+ Sandbox forwarding rules remain separate; saving a secret does not grant
1563
+ credential forwarding into an operator sandbox.
1564
+
1498
1565
  All worktrees share the main checkout's configuration and the user's saved
1499
1566
  credential. A service manager running as that user uses the same HOME and
1500
1567
  XDG_CONFIG_HOME, with no AB_STORE or AB_TOKEN exports. A fresh clone with
@@ -1607,7 +1674,7 @@ assets are not moved and are not a fallback. Each has a kind and a name.
1607
1674
  - `ab ticket attach <id> <kind> <path> [--name <name>] [--json]` stores `<path>`
1608
1675
  (default name: its basename). Attaching the same kind and name again makes a
1609
1676
  new revision; earlier ones stay retrievable. Over the store's size limit
1610
- (25 MiB by default, lower on a hosted deployment) it is refused. Attach and
1677
+ (25 MiB by default, lower when the instance advertises a request ceiling) it is refused. Attach and
1611
1678
  remove leave a note on the ticket naming the asset.
1612
1679
  - `ab ticket show <id>` lists the current assets; with `--json` the ticket
1613
1680
  gains an `assets` array.
@@ -1695,7 +1762,7 @@ restack state and conflicting files remain in detail, along with every child's
1695
1762
  ticket id, title and live phase (or queued/merged), open-first counts, verification
1696
1763
  steps and current outcomes, repair instructions, and the merge rule. Cancelled
1697
1764
  children are omitted; historical missing titles or filenames are explicit.
1698
- The operator web app uses the same facts as text, without a graphical bar.
1765
+
1699
1766
 
1700
1767
  On a TTY, `ab dispatch` renders one fixed interactive frame anchored at the
1701
1768
  terminal's first row. Its header remains on that top row as frame height changes
@@ -2651,3 +2718,26 @@ automatic and explicit demand points, minimal presence paths and upgrade behavio
2651
2718
  Deprecated config spelling for `[merge]` / `[[merge]]`; see the
2652
2719
  [compatibility notes](references/merge-policy.md#deprecated-spellings). Never
2653
2720
  declare both spellings, including empty arrays. `ab upgrade` migrates this key.
2721
+
2722
+
2723
+ ### Permanent hosted project deletion
2724
+
2725
+ Super users and organization owners can permanently delete an authorized project
2726
+ from the web Projects page after a warning and count preview in the shared confirmation dialog. This removes
2727
+ hosted state, tickets, blobs, secrets and accounts, revokes all credentials and
2728
+ retains only repository, actor, deletion time and an opaque generation id as audit.
2729
+ `ab disconnect` only revokes the saved credential; admin `projects remove` only
2730
+ unregisters access and retains data. Failed deletion leaves access refused and
2731
+ supports retry with the original preview token from the Projects page’s unfinished deletions list, including after a
2732
+ reload or service restart; registration waits for cleanup. Each request shares one
2733
+ full admission per project. Deletion invalidates admitted generations during the
2734
+ initial purge and waits only for active mutation transactions; a later mutation
2735
+ in the same request is refused atomically, while earlier commits remain allowed. Legacy untraceable orphan blobs
2736
+ with no ownership record or retained project reference are excluded from deletion.
2737
+ A fresh connection requires browser approval and starts empty, including hosted
2738
+ ticket numbering from 1. Old credentials remain invalid with 401; independently
2739
+ repository-established requests receive 403 project not registered. See
2740
+ [project deletion](references/operator-api.md#permanent-project-deletion) for
2741
+ generation-bound preview tokens and API semantics.
2742
+
2743
+ Paged operator ticket listings may use the optional API 1.9 `TicketSource.listPage(criteria, page)` capability; without it, the operator reads the full listing and slices it. Native errors propagate. CLI ticket lists and dispatcher ready scans remain exhaustive through `listReady`/`listAll`. PostgreSQL pages natively; file, Linear and remote `HostedTicketSource` retain fallback. The POST list-ready protocol stays exhaustive. See the [custom source contract](references/plugin-authoring.md) for types and contract coverage.
@@ -0,0 +1,119 @@
1
+ # Billing accounts
2
+
3
+ Named accounts select billing for Claude Code or Codex, using the user's own
4
+ subscription within ordinary individual usage. Claude and Kimi credentials are
5
+ provisioned manually; Autobuild never runs `claude setup-token`. ChatGPT
6
+ accounts use OpenAI's browser authorization through the CLI.
7
+
8
+ ```toml
9
+ [accounts.personal]
10
+ kind = "claude-subscription"
11
+ credentialEnv = "CLAUDE_CODE_OAUTH_TOKEN"
12
+
13
+ [accounts.kimi]
14
+ kind = "kimi-code"
15
+ credentialEnv = "KIMI_CODE_KEY"
16
+ region = "overseas"
17
+
18
+ [accounts.kimi-china]
19
+ kind = "kimi-code"
20
+ credentialEnv = "KIMI_CHINA_KEY"
21
+ region = "china"
22
+
23
+ [roles.implement]
24
+ runtime = "claude"
25
+ account = "kimi"
26
+ model = "kimi-for-coding"
27
+ ```
28
+
29
+ `account` inherits independently on roles and alternates. Without an explicit
30
+ selection, a Claude route chooses the sole Claude subscription account; multiple
31
+ subscription accounts require an explicit selection. ChatGPT accounts require explicit selection on Codex; Claude and Kimi accounts
32
+ require Claude Code. Incompatible runtime selections are rejected. Repositories with no accounts retain legacy authentication.
33
+ Locally a Claude subscription can use its named token or the host login; Kimi
34
+ requires its membership key. Invalid credentials need renewal (`claude setup-token`
35
+ for Claude, replacement membership key for Kimi); quota and overload failures
36
+ retain alternate fallback.
37
+
38
+ Choose the region of your Kimi membership. The default `overseas` selects
39
+ `https://api.kimi.ai/coding/`; `china` selects `https://api.kimi.com/coding/`.
40
+ The base URL and egress hostname are fixed together and cannot be overridden
41
+ independently. There is no cross-region retry or assertion that keys work across
42
+ regions. Claude Code keeps its native User-Agent.
43
+
44
+ In Vercel Sandbox the guest holds stable nonsecret placeholders, including when
45
+ credential variables are explicitly allowlisted. The host egress policy replaces
46
+ an exact account placeholder header only on its provider's exact hostname.
47
+ The next dispatcher observation tick refreshes credentials for subsequent
48
+ requests without reprovisioning. Changing a local dispatcher's `.env` still needs
49
+ a restart. Accounts are deployment-owned descriptors; configuration artifacts
50
+ contain variable names, never values. Validation reports host credential presence
51
+ and makes one minimal request using each account's actual runtime, including
52
+ unused accounts, in the disposable sandbox. Hosted ChatGPT credentials use the
53
+ metadata readiness boundary described below.
54
+
55
+
56
+ ## ChatGPT subscriptions
57
+
58
+ ChatGPT Plus and Pro are eligible for [Sign in with ChatGPT](https://developers.openai.com/siwc/quickstart).
59
+ Authorization grants plan usage for eligible Responses requests; it does not
60
+ grant access to ChatGPT conversations. Included usage is shared with the plan
61
+ and other authorized apps. Plan exhaustion retains configured alternate fallback.
62
+
63
+ ```toml
64
+ [accounts.chatgpt]
65
+ kind = "chatgpt-subscription"
66
+ credentialEnv = "CHATGPT_ACCESS_TOKEN"
67
+
68
+ [roles.implement]
69
+ runtime = "codex"
70
+ account = "chatgpt"
71
+ ```
72
+
73
+ Run `bun ab accounts login chatgpt --local` on your own machine for a local
74
+ dispatcher, or `bun ab accounts login chatgpt --project` for a connected
75
+ project. Without a destination flag, connected projects choose project storage;
76
+ others choose local storage. The destination is shown before the browser opens.
77
+ OpenAI handles consent and authorization. No token is printed.
78
+
79
+ Local credentials live in protected, ignored main-checkout
80
+ `.autobuild/accounts/` state shared by worktrees. Project sign-in transfers
81
+ credentials directly to the encrypted refreshing project secret named by
82
+ `credentialEnv`; it retains no renewable credential locally. This name
83
+ identifies a host access-token slot, not a refresh token supplied in TOML.
84
+ ChatGPT accounts must use slots distinct from every other account. Existing
85
+ ChatGPT descriptors cannot change during live configuration reload; stop dispatch
86
+ before replacing a descriptor, or introduce a new account name.
87
+
88
+ The stable opaque host identifier belongs to the destination; the issued
89
+ client identifier belongs to the authorized ChatGPT registration. Reauthorization
90
+ keeps identity and registration associated. Never copy the ambient Codex login.
91
+
92
+ Exactly one owner refreshes each connection: the local dispatcher or the
93
+ hosted refreshing secret. Credentials rotate atomically before delivery. Expired access tokens remain
94
+ refreshable after dispatcher downtime; a live validator or dispatcher claim
95
+ cannot be displaced. Only a proven dead process or a released claim permits
96
+ a successor to own renewal.
97
+ Sandboxes hold stable placeholders; only an exact bearer match on
98
+ `api.openai.com` receives the current access token at egress. Local Codex uses
99
+ an isolated CODEX_HOME and a capability-protected loopback Responses forwarder which
100
+ reads current durable state and never refreshes. The shell HOME stays intact
101
+ for Git identity and other operator tools. Missing sandbox credentials revoke
102
+ only their egress transforms; unrelated routes keep running. If hosted secret
103
+ resolution fails, intake and new execution launches wait for recovery. A
104
+ revision-fenced observation-only pass uses ready credentials to repair running
105
+ policies; if those credentials cannot be read, the project is skipped. A failed policy
106
+ update stops the sandbox because revocation could not be confirmed.
107
+
108
+ A failed or uncertain refresh is terminal for that credential generation.
109
+ Sign in again with `bun ab accounts login chatgpt` for the same destination;
110
+ do not retry the old refresh token. Token rejection raises account-specific
111
+ attention rather than an alternate or retry loop.
112
+
113
+ For local credentials, `bun ab init --validate` checks the owner and current
114
+ credential and makes a minimal Codex request. Validation uses a temporary
115
+ exclusive ownership claim only when no dispatcher owns the record. For hosted
116
+ project credentials it uses write-only metadata: presence, owner, set time,
117
+ refresh status and any refresh-window warning. It never downloads tokens.
118
+ **The first hosted build is the live check.** A short refresh-window warning is
119
+ advisory and does not revoke a still-valid credential.
@@ -29,9 +29,7 @@ and re-finalization until hold or completion; it approves the merge rather than
29
29
  an immutable diff. Accepted node reparenting revokes it. Commands and receipts
30
30
  are sequence-correlated: hold acknowledgement confirms native cancellation;
31
31
  merge acknowledgement does not claim gates passed. MCP/operator tools offer the
32
- same actions; the terminal uses `l`/`o`. The hosted web app offers **Merge** and
33
- **Hold** on a merge awaiting consent. These controls record the same durable
34
- actions; **Merge** does not mean the merge gates have passed.
32
+ same actions; the terminal uses `l`/`o`. These controls record durable actions; merge consent does not mean the merge gates have passed.
35
33
 
36
34
  ## Worked configurations
37
35