@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
@@ -20,6 +20,201 @@ example](#complete-example) is valid on its own.
20
20
 
21
21
  An **acceptance check** is a repository-owned agent verify step that runs the built software, exercises each acceptance criterion in the spec, attaches evidence, and returns a typed verdict. Every repository must configure one. It is not a test suite and leaves no test files behind.
22
22
 
23
+ ## `[accounts]`
24
+
25
+ Named accounts select billing for Claude Code or Codex using the user's own
26
+ subscription or membership. Provision Claude and Kimi credentials manually on
27
+ the dispatcher host; Autobuild never runs `claude setup-token` or collects its
28
+ output. ChatGPT subscription accounts use OpenAI's browser authorization through
29
+ `ab accounts login NAME`; see [ChatGPT subscriptions](accounts.md#chatgpt-subscriptions)
30
+ for destinations, protected storage and the single-refresher rule.
31
+
32
+ <!-- config-fragment:accounts -->
33
+ ```toml
34
+ [accounts.personal]
35
+ kind = "claude-subscription"
36
+ credentialEnv = "CLAUDE_CODE_OAUTH_TOKEN"
37
+
38
+ [accounts.kimi]
39
+ kind = "kimi-code"
40
+ credentialEnv = "KIMI_CODE_KEY"
41
+ region = "overseas"
42
+
43
+ [accounts.kimi-china]
44
+ kind = "kimi-code"
45
+ credentialEnv = "KIMI_CHINA_KEY"
46
+ region = "china"
47
+
48
+ [roles.implement]
49
+ runtime = "claude"
50
+ account = "kimi"
51
+ model = "kimi-for-coding"
52
+ ```
53
+
54
+ `account` inherits independently on roles and alternates. Without an explicit
55
+ selection, a Claude route chooses the sole Claude subscription account; multiple
56
+ Claude subscription accounts require an explicit selection. ChatGPT accounts
57
+ require explicit selection on Codex; Claude and Kimi accounts require Claude Code.
58
+ Incompatible runtime selections are rejected. Repositories with no accounts
59
+ retain legacy authentication.
60
+ Locally a Claude subscription can use its named token or the host login; Kimi
61
+ requires its membership key. Invalid Claude/Kimi credentials need renewal
62
+ (`claude setup-token` for Claude, replacement membership key for Kimi). Invalid
63
+ ChatGPT credentials require `ab accounts login NAME` for the owning destination;
64
+ quota and overload failures retain alternate fallback.
65
+
66
+ Selected Claude/Kimi credentials stay out of process arguments: each invocation
67
+ uses a private 0700 directory and a regular 0600 settings file, removed after
68
+ normal exit, launch failure or cancellation. The settings preserve selected-account
69
+ authentication precedence over saved user/project settings. Remote settings and
70
+ environments continue to contain placeholders only.
71
+
72
+ Choose the region of your Kimi membership. The default `overseas` selects
73
+ `https://api.kimi.ai/coding/`; `china` selects `https://api.kimi.com/coding/`.
74
+ The base URL and egress hostname are fixed together and cannot be overridden
75
+ independently. There is no cross-region retry or assertion that keys work across
76
+ regions. Claude Code keeps its native User-Agent.
77
+
78
+ In Vercel Sandbox the guest holds stable nonsecret placeholders, including when
79
+ credential variables are explicitly allowlisted. The host egress policy replaces
80
+ an exact account placeholder header only on its provider's exact hostname.
81
+ The next dispatcher observation tick refreshes credentials for subsequent
82
+ requests without reprovisioning. Changing a local dispatcher's `.env` still needs
83
+ a restart. Accounts are deployment-owned descriptors; configuration artifacts
84
+ contain variable names, never values. ChatGPT accounts must use credential slots
85
+ distinct from every other account. Existing ChatGPT descriptors cannot be
86
+ replaced or removed during live configuration reload: stop dispatch first, or
87
+ introduce a new account name. This restriction qualifies the hot-reload entries
88
+ below.
89
+
90
+ Validation reports credential readiness and makes one minimal model request per
91
+ declared account, including unused accounts, through its runtime (Claude Code
92
+ for Claude/Kimi, Codex for ChatGPT) in the disposable sandbox. Hosted ChatGPT
93
+ project secrets report readiness from write-only status metadata instead; the
94
+ first hosted build is the live check. See
95
+ [ChatGPT subscriptions](accounts.md#chatgpt-subscriptions).
96
+
97
+ <!-- configuration-reference:accounts -->
98
+
99
+ #### `accounts`
100
+
101
+ **TOML key:** `accounts`
102
+
103
+ - **Type:** `table`
104
+ - **Default:** `{}`
105
+ - **Required:** Optional
106
+ - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
107
+
108
+ **Description:** Named Claude subscription, Kimi Code, or ChatGPT subscription billing accounts. Descriptors contain credential variable names only.
109
+
110
+ **Constraints:** Entry names: nonempty
111
+
112
+ #### `accounts.<name>`
113
+
114
+ **TOML key:** `accounts.<name>`
115
+
116
+ - **Type:** `strict table | strict table | strict table`
117
+ - **Default:** `omitted`
118
+ - **Required:** Required
119
+ - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
120
+
121
+ **Description:** Named nonsecret billing account descriptor.
122
+
123
+ **Constraints:** None beyond the input type.
124
+
125
+ #### `accounts.<name>.kind` (kind = "chatgpt-subscription")
126
+
127
+ **TOML key:** `accounts.<name>.kind`
128
+
129
+ - **Type:** `"chatgpt-subscription"`
130
+ - **Default:** `omitted`
131
+ - **Required:** Required when kind = "chatgpt-subscription"
132
+ - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
133
+
134
+ **Description:** Claude subscription, Kimi Code membership, or ChatGPT subscription (Codex only).
135
+
136
+ **Constraints:** None beyond the input type.
137
+
138
+ #### `accounts.<name>.credentialEnv` (kind = "chatgpt-subscription")
139
+
140
+ **TOML key:** `accounts.<name>.credentialEnv`
141
+
142
+ - **Type:** `string`
143
+ - **Default:** `omitted`
144
+ - **Required:** Required when kind = "chatgpt-subscription"
145
+ - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
146
+
147
+ **Description:** Host credential variable name; ChatGPT names a host-resolved access-token slot, never a credential value.
148
+
149
+ **Constraints:** matches /^[A-Za-z_][A-Za-z0-9_]*$/; Autobuild control variables cannot hold account credentials; Portable environment variable identifier; AB_ control variables are reserved.
150
+
151
+ #### `accounts.<name>.kind` (kind = "claude-subscription")
152
+
153
+ **TOML key:** `accounts.<name>.kind`
154
+
155
+ - **Type:** `"claude-subscription"`
156
+ - **Default:** `omitted`
157
+ - **Required:** Required when kind = "claude-subscription"
158
+ - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
159
+
160
+ **Description:** Claude subscription, Kimi Code membership, or ChatGPT subscription (Codex only).
161
+
162
+ **Constraints:** None beyond the input type.
163
+
164
+ #### `accounts.<name>.credentialEnv` (kind = "claude-subscription")
165
+
166
+ **TOML key:** `accounts.<name>.credentialEnv`
167
+
168
+ - **Type:** `string`
169
+ - **Default:** `omitted`
170
+ - **Required:** Required when kind = "claude-subscription"
171
+ - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
172
+
173
+ **Description:** Host credential variable name; ChatGPT names a host-resolved access-token slot, never a credential value.
174
+
175
+ **Constraints:** matches /^[A-Za-z_][A-Za-z0-9_]*$/; Autobuild control variables cannot hold account credentials; Portable environment variable identifier; AB_ control variables are reserved.
176
+
177
+ #### `accounts.<name>.kind` (kind = "kimi-code")
178
+
179
+ **TOML key:** `accounts.<name>.kind`
180
+
181
+ - **Type:** `"kimi-code"`
182
+ - **Default:** `omitted`
183
+ - **Required:** Required when kind = "kimi-code"
184
+ - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
185
+
186
+ **Description:** Claude subscription, Kimi Code membership, or ChatGPT subscription (Codex only).
187
+
188
+ **Constraints:** None beyond the input type.
189
+
190
+ #### `accounts.<name>.credentialEnv` (kind = "kimi-code")
191
+
192
+ **TOML key:** `accounts.<name>.credentialEnv`
193
+
194
+ - **Type:** `string`
195
+ - **Default:** `omitted`
196
+ - **Required:** Required when kind = "kimi-code"
197
+ - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
198
+
199
+ **Description:** Host credential variable name; ChatGPT names a host-resolved access-token slot, never a credential value.
200
+
201
+ **Constraints:** matches /^[A-Za-z_][A-Za-z0-9_]*$/; Autobuild control variables cannot hold account credentials; Portable environment variable identifier; AB_ control variables are reserved.
202
+
203
+ #### `accounts.<name>.region` (kind = "kimi-code")
204
+
205
+ **TOML key:** `accounts.<name>.region`
206
+
207
+ - **Type:** `"overseas" | "china"`
208
+ - **Default:** `"overseas"`
209
+ - **Required:** Optional when kind = "kimi-code"
210
+ - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
211
+
212
+ **Description:** Membership region: overseas (default) or china. Selects the base URL and exact egress host together.
213
+
214
+ **Constraints:** None beyond the input type.
215
+
216
+ <!-- configuration-reference:/accounts -->
217
+
23
218
  ## `[store]`
24
219
 
25
220
  <!-- configuration-reference:store -->
@@ -55,100 +250,14 @@ An **acceptance check** is a repository-owned agent verify step that runs the bu
55
250
  Selection is explicit `--store` > nonblank `AB_STORE` > `[store] url` > the main
56
251
  checkout's `.autobuild/`. A configured service without a user credential fails
57
252
  with `ab connect` guidance. `AB_TOKEN` overrides the saved service/project
58
- credential. See [connecting a project](hosted-service.md#connect-a-project).
253
+ credential. See [connecting a project](setup.md#connect-a-project).
59
254
  Changing the store requires restarting dispatch.
60
255
 
61
- ## Hosted service and PostgreSQL BuildStore environment
62
-
63
- The optional `@defrex/autobuild-hosted-store-service` and its
64
- `@defrex/autobuild-postgres-store` adapter are configured entirely through the
65
- environment. They are published to npm as separate packages alongside the
66
- `@defrex/autobuild` CLI, so a CLI install never acquires the service,
67
- PostgreSQL, or blob-provider dependencies; a project that embeds the adapter
68
- or the service adds the package it needs (`bun add
69
- @defrex/autobuild-postgres-store` or `bun add
70
- @defrex/autobuild-hosted-store-service`). The cron-driven hosted dispatcher is
71
- separately published as `@defrex/autobuild-hosted-dispatcher`; a deployment
72
- opts into building by installing that package, and its `AB_DISPATCHER_*`
73
- variables are documented in the [hosted-dispatcher runbook](hosted-dispatcher.md),
74
- not here. The deployable web application still
75
- runs from a release checkout: choose the compatible tag shown in
76
- [GitHub Releases](https://github.com/defrex/autobuild/releases), clone that exact
77
- revision into a dedicated checkout, and run the idempotent migration there:
78
-
79
- ```sh
80
- git clone --depth 1 --branch v0.6.0 --single-branch https://github.com/defrex/autobuild.git autobuild-v0.6.0
81
- cd autobuild-v0.6.0
82
- bun install --frozen-lockfile
83
- DATABASE_URL=postgres://… bun run postgres:migrate
84
- ```
85
-
86
- Replace `v0.6.0` with the selected release tag. Schema diagnostics' root
87
- `postgres:migrate` script is relative to that pinned checkout. A hosted build
88
- can run the same step itself: `bun run deploy:build` — run from the hosted
89
- store service package directory (`packages/hosted-store-service`), the Next.js
90
- project directory — migrates against the
91
- deployment's database URL, logs the host it prepared, and then builds the web
92
- application, failing the build when no database URL is configured or the
93
- schema is incompatible. The database
94
- identity needs permission to create tables during migration and to select,
95
- insert, and update those tables at runtime. The complete run, deployment, and
96
- token procedure is in the [hosted service
97
- guide](../packages/hosted-store-service/README.md); clients use the
98
- separate signed-user token described by the [operator API](operator-api.md).
99
-
100
- | Variable | Required when | Values / purpose |
101
- |---|---|---|
102
- | `AB_STORE_SECRET` | Hosted service | Nonblank HMAC signing secret. Service-side only; never give it to clients. |
103
- | `AB_HOST` | Optional, ordinary Bun host | Bind hostname; defaults to `0.0.0.0`. Vercel supplies its own listener. |
104
- | `PORT` | Optional, ordinary Bun host | Integer 1–65535; defaults to `3000`. Vercel supplies its own listener. |
105
- | `AB_STORE` | Remote client | Hosted service base URL used by the kernel, phase commands, and dashboard. |
106
- | `AB_TOKEN` | Authenticated remote client | Explicit project bearer credential override for CI; otherwise use ab connect. This is not the signing secret. |
107
- | `BETTER_AUTH_SECRET` | Web dashboard | Independent server-only session secret with at least 32 high-entropy characters. |
108
- | `BETTER_AUTH_URL` | Web dashboard | Exact HTTP(S) origin, without credentials or a path; HTTPS is mandatory in production. |
109
- | `GITHUB_CLIENT_ID` | GitHub sign-in | OAuth application client id. |
110
- | `GITHUB_CLIENT_SECRET` | GitHub sign-in | Server-only OAuth application secret. |
111
- | `AB_WEB_AUTH_PROVIDERS` | Web dashboard | Comma-separated provider set; currently exactly `github`. |
112
- | `AB_WEB_SUPER_USER_EMAILS` | Web dashboard | Nonempty comma-separated super-user emails; matching is case-insensitive. Ordinary users require organization membership. |
113
- | `AB_WEB_REPOSITORIES` | Hosted service | Deprecated once-per-database bootstrap CSV for the durable project registry. Use owner commands thereafter; see [connected projects](setup.md#connected-projects). |
114
-
115
- GitHub's callback is `{BETTER_AUTH_URL}/api/auth/callback/github`; the app needs
116
- the `user:email` scope (or GitHub App read-only email permission). Sessions are
117
- database-backed and represented in the browser only by an HTTP-only cookie.
118
- Membership or super-user removal takes effect on the next web API request or MCP tool call. Never expose these
119
- secrets, `AB_STORE_SECRET`, database/blob credentials, machine tokens, or OAuth
120
- account tokens through a `NEXT_PUBLIC_` variable.
121
-
122
- The following variables configure the service-side durable adapter (or a direct
123
- use of `@defrex/autobuild-postgres-store`).
124
-
125
- | Variable | Required when | Values / purpose |
126
- |---|---|---|
127
- | `DATABASE_URL` | Always, unless `AB_POSTGRES_URL` is set | Nonblank PostgreSQL connection URL under its conventional name, as Vercel's Neon and Postgres storage integrations inject it. |
128
- | `AB_POSTGRES_URL` | Optional override | Explicit Autobuild-specific connection URL; a nonblank value wins over `DATABASE_URL`. No other ambient variable is consulted. |
129
- | `AB_BLOB_BACKEND` | Always | `s3` or `vercel`. |
130
- | `AB_BLOB_PREFIX` | Optional | Object pathname prefix; redundant `/` characters are normalized. |
131
- | `AB_S3_BUCKET` | S3 | Bucket name. |
132
- | `AB_S3_REGION` | S3 | S3 signing region. |
133
- | `AB_S3_ENDPOINT` | Optional, S3 | Endpoint URL for an S3-compatible service. |
134
- | `AB_S3_ACCESS_KEY_ID` | S3 | Explicit access key; ambient AWS credential lookup is not used. |
135
- | `AB_S3_SECRET_ACCESS_KEY` | S3 | Explicit secret key. |
136
- | `AB_S3_SESSION_TOKEN` | Optional, S3 | Explicit temporary-credential session token. |
137
- | `AB_S3_FORCE_PATH_STYLE` | Optional, S3 | Exact boolean `true` or `false`. |
138
- | `AB_VERCEL_BLOB_ACCESS` | Vercel | `public` or `private`. |
139
- | `BLOB_READ_WRITE_TOKEN` | Vercel auth option | Blob read-write token. |
140
- | `VERCEL_OIDC_TOKEN` | Vercel OIDC option | Must be paired with `BLOB_STORE_ID` when no read-write token is supplied. |
141
- | `BLOB_STORE_ID` | Vercel OIDC option | Must be paired with `VERCEL_OIDC_TOKEN`. |
142
-
143
- S3 identities need `GetObject` and `PutObject` on the bucket/prefix. The adapter
144
- maps only a provider 404 to absence and propagates authorization/service errors.
145
- Vercel object names are deterministic and overwritten idempotently.
146
-
147
256
  ## Strict parsing and validation
148
257
 
149
258
  Parsing is strict. Unknown top-level keys or tables, unknown fields in a known
150
259
  table, fields from the wrong step variant, malformed values, and dangling
151
- command references are errors. The open maps are `[commands]`, `[roles]`,
260
+ command references are errors. The open maps are `[accounts]`, `[commands]`, `[roles]`,
152
261
  `[workspace.config]`, `[workspace.config.runtimeProvisioning]`,
153
262
  `[verify.<step>]`, and `[finalize.<step>]`. Autobuild
154
263
  validates repository-defined command, role, and step entries.
@@ -188,7 +297,7 @@ instead: a push to the base branch is honored by a later tick without
188
297
  restarting anything. Hot fields apply immediately; restart-classified fields
189
298
  keep the startup-built adapters and file the existing restart-required notice
190
299
  (a long-lived origin-mode watch picks them up on its next process restart;
191
- the hosted cron entry point re-reads them on every invocation).
300
+ origin-mode dispatch reads configuration from the forge).
192
301
  Each dispatch, build, check, or agent action captures the accepted configuration
193
302
  snapshot at its start boundary: work already running is not interrupted, while
194
303
  the next setup or pipeline step of the same in-flight build uses the new
@@ -209,8 +318,8 @@ the worktree file has uncommitted edits, because the clean/dirty comparison
209
318
  could not be performed (non-git workspace or a transient git error), or because
210
319
  the branch head never carried the file — the deposit records the source
211
320
  `worktree-dirty` with no commit. The build still runs the worktree bytes, but
212
- provenance declines to attribute them to any commit. **Deployment-owned** sections — `[roles]`
213
- (runtime, model, args, alternates, per-role `sessionBudgetSeconds`) and
321
+ provenance declines to attribute them to any commit. **Deployment-owned** sections — `[accounts]` and `[roles]`
322
+ (runtime, model, account, args, alternates, per-role `sessionBudgetSeconds`) and
214
323
  `[policy]` — keep flowing live. **Dispatcher-owned** sections (`baseBranch`,
215
324
  `capacity`, `ticketScanIntervalSeconds`, `forge`, `plugins`, `pr`, `tickets`, `orchestrator`) configure the
216
325
  dispatcher itself and are never interpreted by the build runner.
@@ -271,6 +380,7 @@ These fields hot-reload:
271
380
  | `[commands]` | Next setup, verify check, or finalize check selected for a build whose OWN branch carries it. Dispatcher readiness, resume, and recovery use the same pin. A base-branch reload does not retarget an in-flight build. |
272
381
  | `[verify]` and `[finalize]` | Next engine step selection for a build whose OWN branch carries it. Dispatcher readiness, resume, and recovery use the same pin. An approved plan's selection applies unless unknown names require default-all fallback, and a base-branch reload does not retarget an in-flight build. |
273
382
  | `[workspace]` provider and config (including `provisioning`) | Next launch of a build whose OWN branch carries it. A base-branch reload never re-provisions an in-flight build. |
383
+ | `[accounts]` | Descriptors are adopted atomically with roles at the next session boundary, except existing ChatGPT descriptors require stopped dispatch before replacement or removal (see [accounts](#accounts)); credentials refresh on observation ticks. |
274
384
  | `[roles]` | Next agent invocation for that role. Runtime, model, args, alternates, and the session budget are captured together and delivered live. |
275
385
  | `[upgrade]` | Cancels preparation when disabled; automatic target checks every 60 seconds. |
276
386
  | `[policy]` | Next policy, convergence, or agent-session boundary, delivered live. A running session keeps its captured budget. |
@@ -857,7 +967,7 @@ before claims and list every available builtin and plugin provider.
857
967
 
858
968
  ### Vercel Sandbox
859
969
 
860
- Remote execution is explicit and requires the hosted HTTPS BuildStore plus its
970
+ Remote execution is explicit and requires an HTTPS remote store that speaks the remote BuildStore protocol plus its
861
971
  scoped token, an HTTPS `github.com/owner/repository` origin, `forge = "github"`,
862
972
  and Vercel authentication. Use either `VERCEL_OIDC_TOKEN`, or all of
863
973
  `VERCEL_TOKEN`, `VERCEL_TEAM_ID`, and `VERCEL_PROJECT_ID`. The dispatcher also
@@ -1197,7 +1307,7 @@ by reinstalling the archive before reuse, so an upgraded dispatcher retrofits
1197
1307
  its persistent guests. Cached registry generations deliver their own manifest
1198
1308
  version’s validated GitHub release asset, resolved on first guest use and cached
1199
1309
  separately from the normalized host archive. Local launches need no asset fetch; source generations deliver exact packed source bytes (see "Guest distribution version selection and delivery"
1200
- in docs/setup.md for the release-and-upgrade delivery path and the hosted
1310
+ in docs/setup.md for the release-and-upgrade delivery path and the instance
1201
1311
  store's supported client window). Immediately
1202
1312
  before every build-child launch, the adapter verifies the
1203
1313
  provisioned absolute Bun executable and every referenced runtime again. A
@@ -1273,12 +1383,11 @@ Vercel images or package managers.
1273
1383
  Vercel workspaces return an absolute guest `path` plus an opaque sandbox-name
1274
1384
  `ref`; they omit dispatcher-local path evidence. Branch config, relative/package
1275
1385
  plugins, installed skills, setup, runtimes, checks, and phase CLI commands all
1276
- resolve in the guest checkout. Only names in `environmentVariables` plus scoped `AB_STORE`/`AB_TOKEN` enter
1386
+ resolve in the guest checkout. Only names in `environmentVariables`, declared account placeholders, and scoped `AB_STORE`/`AB_TOKEN` enter
1277
1387
  commands—dispatcher environment variables are never copied wholesale. Pi in a
1278
1388
  sandbox should use an API-key provider such as `vercel-ai-gateway/...` with
1279
- `AI_GATEWAY_API_KEY`; never copy dispatcher `~/.pi` state, OAuth refresh tokens,
1280
- or attempt an interactive login. The same API-key-only rule applies to Codex,
1281
- Claude Code, and plugin runtimes.
1389
+ `AI_GATEWAY_API_KEY`; never copy dispatcher `~/.pi` state, Pi OAuth refresh tokens,
1390
+ or attempt an interactive login. Plugin runtimes retain their existing API authentication. Claude Code can select a subscription or Kimi billing account. Codex can explicitly select a ChatGPT subscription authorized with `bun ab accounts login NAME`; one local dispatcher or hosted refreshing secret owns renewal, and the real tokens stay on the host.
1282
1391
 
1283
1392
  The opt-in live lifecycle suite is
1284
1393
  `packages/core/src/scenarios/vercel-sandbox.live.test.ts`. Set
@@ -1940,8 +2049,9 @@ failures become failure-tolerant follow-up observations.
1940
2049
 
1941
2050
  ## `[roles]`
1942
2051
 
1943
- An open map from a nonempty role name to three primary agent axes, one
1944
- wall-clock session budget, and an ordered alternate list. All five live fields
2052
+ An open map from a nonempty role name to four primary agent axes (runtime,
2053
+ model, account, and args), one wall-clock session budget, and an ordered
2054
+ alternate list. All six live fields
1945
2055
  inherit independently. The reserved
1946
2056
  `default` entry is required to name a runtime, is the raw base for every other
1947
2057
  role, and is never dispatched itself. Missing it fails eagerly before any
@@ -1975,6 +2085,19 @@ session starts, with a copyable table and all registered runtime names.
1975
2085
 
1976
2086
  **Constraints:** None beyond the input type.
1977
2087
 
2088
+ #### `roles.<name>.account`
2089
+
2090
+ **TOML key:** `roles.<name>.account`
2091
+
2092
+ - **Type:** `string`
2093
+ - **Default:** `omitted`
2094
+ - **Required:** Optional
2095
+ - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
2096
+
2097
+ **Description:** Named billing account; inherits independently. Claude selects the sole subscription account when omitted.
2098
+
2099
+ **Constraints:** minimum length 1; matches /\S/
2100
+
1978
2101
  #### `roles.<name>.runtime`
1979
2102
 
1980
2103
  **TOML key:** `roles.<name>.runtime`
@@ -2053,6 +2176,19 @@ session starts, with a copyable table and all registered runtime names.
2053
2176
 
2054
2177
  **Constraints:** Omission inherits the base alternate list, otherwise resolves to an empty list; each alternate overlays the resolved primary axes.
2055
2178
 
2179
+ #### `roles.<name>.alternates[].account`
2180
+
2181
+ **TOML key:** `roles.<name>.alternates[].account`
2182
+
2183
+ - **Type:** `string`
2184
+ - **Default:** `omitted`
2185
+ - **Required:** Optional
2186
+ - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
2187
+
2188
+ **Description:** Named billing account; inherits independently. Claude selects the sole subscription account when omitted.
2189
+
2190
+ **Constraints:** minimum length 1; matches /\S/
2191
+
2056
2192
  #### `roles.<name>.alternates[].runtime`
2057
2193
 
2058
2194
  **TOML key:** `roles.<name>.alternates[].runtime`
@@ -2132,15 +2268,24 @@ runtime does not discard a model inherited from `default`; the resulting exact
2132
2268
  pair must be compatible. Autobuild never searches for a runtime that happens
2133
2269
  to serve a configured model and never substitutes a different model to repair
2134
2270
  an invalid pair. The only implicit fill is when neither the role nor `default`
2135
- names a model, in which case the selected runtime uses its own default. Every
2136
- alternate overlays that concrete role's effective primary runtime, model, and
2137
- args, then undergoes the same exact-pair validation. Each configured string is
2271
+ names a model: a `claude` route selecting a Kimi Code account defaults to
2272
+ `kimi-for-coding`, while every other route uses its runtime's own default. Every
2273
+ alternate overlays that concrete role's effective primary runtime, model, account,
2274
+ and args, then undergoes the same exact-pair validation. Model defaults are applied
2275
+ after these axes are merged, so an alternate without an explicit or inherited
2276
+ model uses the default for its own selected account and runtime. Each configured string is
2138
2277
  one argv token; Autobuild does not shell-expand it. The narrow rejected set is
2139
2278
  derived from the model and machine-readable protocol options each adapter emits:
2140
2279
  Claude rejects `-p`/`--print`, `--output-format`, and `--model`; Codex rejects
2141
2280
  `--json` and `--model`/`-m`; Pi rejects `--mode` and `--model`. Claude and Codex
2142
2281
  also reject a standalone `--` because Autobuild owns and appends that structural
2143
- separator immediately before their positional prompt. Those option spellings,
2282
+ separator immediately before their positional prompt. Claude routes with a selected
2283
+ account additionally reject `--settings`, `--setting-sources`, and `--bare`
2284
+ because Autobuild owns their authentication settings. Codex routes selecting a
2285
+ ChatGPT subscription account additionally reject `-c`, `--config`, `--profile`,
2286
+ `-p`, `--enable`, and `--disable` because Autobuild owns their provider and
2287
+ configuration routing. This includes using `-c` to set reasoning effort. Routes
2288
+ without an account retain the existing argument behavior. Those option spellings,
2144
2289
  `--option=value` forms, compact documented short aliases, and the exact affected
2145
2290
  prompt separator join the eager aggregated startup error with a
2146
2291
  role/runtime-specific diagnostic. Every other option passes through without
@@ -2159,9 +2304,10 @@ Autobuild does not install Pi. `ab init` reports a missing or older executable
2159
2304
  as unusable, and `pi` must be logged in for every configured model. `ab models`
2160
2305
  lists this local catalog, while `ab models --available` limits it to models with
2161
2306
  configured credentials. Builtin and plugin runtimes use the same exact-pair
2162
- validation and event attribution. With no configured model, the selected runtime uses its declared
2163
- default when present: Claude and Codex delegate to their local CLI's selected
2164
- default, while Pi declares `kimi-coding/k3`. Codex accepts unqualified `gpt-*`
2307
+ validation and event attribution. With no configured or inherited model, a Claude
2308
+ route selecting a Kimi Code account uses `kimi-for-coding`. Other routes use their
2309
+ runtime's declared default when present: Claude and Codex delegate to their local
2310
+ CLI's selected default, while Pi declares `kimi-coding/k3`. Codex accepts unqualified `gpt-*`
2165
2311
  ids. Pi ids remain provider-qualified—including the independent
2166
2312
  `openai-codex/*` route—and `ab models [query]` looks them up. Pi always passes
2167
2313
  `--no-extensions` to disable ambient package discovery and loads the Autobuild
@@ -3279,13 +3425,15 @@ the existing text-download projection.
3279
3425
  - for `forge = "github"`, either export a `GITHUB_TOKEN` or `GH_TOKEN` or run `gh auth login`:
3280
3426
  the kernel speaks the GitHub REST API directly, taking `GITHUB_TOKEN`, then `GH_TOKEN`, then the
3281
3427
  gh CLI's stored login (`gh auth token`) — so a local dispatcher needs only the gh login, while a
3282
- host without gh (hosted or sandboxed dispatchers) must export a token. Separately make sure the
3428
+ host without gh (including sandboxed dispatchers) must export a token. Separately make sure the
3283
3429
  Git remote can fetch/push with the process's Git credentials;
3284
3430
  - Claude sessions invoke the local `claude` CLI and use its configured login;
3285
3431
  install Claude Code, launch `claude`, and complete login before dispatching;
3286
- - Codex sessions invoke the local `codex` CLI and use its configured login;
3287
- install Codex, run `codex login`, and complete authentication before
3288
- dispatching;
3432
+ - Codex sessions invoke the local `codex` CLI. Without a named ChatGPT account,
3433
+ run `codex login` before dispatching. Named ChatGPT accounts use
3434
+ `ab accounts login NAME --local` for a local dispatcher or `--project` for a
3435
+ connected project; they preserve the user's ambient Codex login. See
3436
+ [ChatGPT subscriptions](accounts.md#chatgpt-subscriptions);
3289
3437
  - Pi sessions use Pi's provider authentication: start `pi` and run `/login`
3290
3438
  inside the interactive session, or, for non-interactive use, supply the
3291
3439
  provider credentials Pi supports (such as provider API keys in the environment).
@@ -3373,7 +3521,10 @@ progress is not shown. Harvest does not consume build capacity.
3373
3521
  and Contents write permission.
3374
3522
  - **Agent runtime/provider:** authenticate the runtime selected by the merged
3375
3523
  role. A missing Codex adapter diagnostic names both `codex runtime` and the
3376
- `codex` executable; install it and run `codex login`. A 401/402/403,
3524
+ `codex` executable; install it. For legacy Codex authentication, run
3525
+ `codex login`. For a named ChatGPT account, sign in again with
3526
+ `ab accounts login NAME --local` or `--project` for the owning destination; see
3527
+ [ChatGPT subscriptions](accounts.md#chatgpt-subscriptions). A 401/402/403,
3377
3528
  permission, quota, or billing rejection is treated as a permanent provider
3378
3529
  failure rather than retried indefinitely. For Pi, confirm the
3379
3530
  provider-qualified model and provider login.
@@ -3381,26 +3532,13 @@ progress is not shown. Harvest does not consume build capacity.
3381
3532
  A protected store reports 401 for a missing, invalid, or expired token and
3382
3533
  403 when the token is valid but scoped to another build/session.
3383
3534
 
3384
- ### Hosted project selection
3385
-
3386
- The durable PostgreSQL project registry controls dashboard, MCP and operator
3387
- API access. Super users see every active entry; members see only their organizations’ projects. Administer it with
3388
- `ab-hosted-store projects list|add|remove` using deployment database credentials;
3389
- mutations require `--user IDENTITY` for declared attribution. See
3390
- [connected projects](setup.md#connected-projects) for migration and retention.
3391
- `AB_DISPATCHER_REPOSITORIES` optionally selects an ordered subset of current
3392
- registrations. When unset, each authorized tick queries all active entries.
3393
- Removed credential override keys are inert in dynamic mode; explicit-list
3394
- configuration still rejects unknown override keys.
3395
-
3396
3535
  ## Hosted service client compatibility
3397
3536
 
3398
3537
  A service accepts stable and prerelease clients from its own `major.minor`
3399
3538
  release line and the two preceding minor lines in the same major. A major starts a new family:
3400
3539
  X.0 accepts only X.0, X.1 accepts X.0/X.1, and X.2 onward accepts three lines.
3401
3540
  Patch versions are interchangeable in both directions and must never change
3402
- the protocol. Upgrade the service first, then projects independently within
3403
- its window. Supported release lines retain their wire handlers and known
3541
+ the protocol. Keep project clients within the instance’s published window. Supported release lines retain their wire handlers and known
3404
3542
  protocol identities; an unknown protocol is refused independently of version.
3405
3543
  Stable and prerelease service and client identities share their numeric major/minor
3406
3544
  line. Malformed or missing identities, build metadata (`+…`), prefixes and
@@ -3440,9 +3578,7 @@ Commands and acknowledgements are sequence-correlated; hold acknowledgement
3440
3578
  requires confirmed native cancellation, while merge acknowledgement accepts
3441
3579
  consent without claiming that merge gates passed. The same actions are available
3442
3580
  through the MCP/operator build-control tools. The terminal uses `l` for merge and
3443
- `o` for hold on the selected merge. The hosted web app offers **Merge** and
3444
- **Hold** on a merge awaiting consent, with the same durable acknowledgements
3445
- and merge gates. It does not provide a merge-policy editor.
3581
+ `o` for hold on the selected merge.
3446
3582
 
3447
3583
  The repository auto-merge default and its fan-out are retired. Historical events
3448
3584
  still replay; explicit old per-build commands map to consent/hold until a new
@@ -3518,7 +3654,7 @@ still use the checkout. A launcher freezes the currently installed distribution
3518
3654
  and production dependencies offline; all later local runners and agent CLIs use
3519
3655
  that same snapshot. Automatic adoption is enabled by default through `[upgrade]`
3520
3656
  below; a manual restart is required when automatic upgrades are disabled or the
3521
- launcher contract changes. `--once`, origin mode and hosted cron retain their
3657
+ launcher contract changes. `--once` and origin mode retain their
3522
3658
  direct execution paths.
3523
3659
 
3524
3660
  ## `[upgrade]`
@@ -3659,20 +3795,9 @@ retry failed installs. Operator stop always wins over replacement startup.
3659
3795
  Set `automatic = false` to cancel pending preparation and retain manual restart
3660
3796
  behavior. A launcher contract change also requires a manual restart. A legacy v1 launcher
3661
3797
  without overlap supervision requires restart before another automatic adoption. `--once`,
3662
- origin/hosted dispatch and direct development presentation modes do not auto-upgrade.
3798
+ origin-mode dispatch and direct development presentation modes do not auto-upgrade.
3663
3799
  `ab upgrade` still updates the pin/installation and merges skills locally, commits
3664
3800
  when eligible, and never pushes. Pinned dispatchers follow after that commit
3665
3801
  reaches the base branch; installed-mode dispatchers follow their replaced install.
3666
3802
  Source-mode dispatchers follow changes to packaged inputs merged to the base,
3667
3803
  including shipped canonical skills, without a version bump.
3668
-
3669
-
3670
- The retired `AB_WEB_ALLOWED_EMAILS` variable is refused at startup, even if empty.
3671
- Replace it with `AB_WEB_SUPER_USER_EMAILS`; review the list because these identities
3672
- are deployment maintainers. Bootstrap the first organization through the
3673
- [browser management contract](operator-api.md#organization-management-browser),
3674
- then add members by email and assign legacy unassigned projects. Super users alone
3675
- create orgs, set or clear the single owner, and assign or move projects. Owners
3676
- manage their org's members. Removing the last membership or super-user designation
3677
- revokes human access on the next request without re-login; existing project
3678
- credentials remain valid until revoked.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "Dispatcher hosting"
3
3
  group: "reference"
4
- description: "Run the dispatcher locally or through bounded hosted invocations over durable state."
4
+ description: "Run a local dispatcher with local or remote workspaces over durable state."
5
5
  label: "Dispatcher hosting"
6
6
  order: 11
7
7
  ---
@@ -10,7 +10,7 @@ order: 11
10
10
 
11
11
  ## Responsibility
12
12
 
13
- The dispatcher claims eligible tickets, starts and observes build runners, settles publication and merge, and recovers durable work. Local and hosted arrangements run the same kernel. Your operator agent acts through the CLI or MCP; Autobuild never starts it.
13
+ The dispatcher claims eligible tickets, starts and observes build runners, settles publication and merge, and recovers durable work. Local and origin-mode arrangements run the same kernel. Your operator agent acts through the CLI or MCP; Autobuild never starts it.
14
14
 
15
15
  ## Shipped arrangements
16
16
 
@@ -40,7 +40,7 @@ The host needs:
40
40
 
41
41
  A service manager may own the process under an identity with the same configuration and credentials. To restart, stop gracefully and let drain and suspension finish; work resumes from durable state. A restart never answers escalations or grants merge consent. See [the dispatcher lifecycle](dispatcher.md).
42
42
 
43
- ### Hosted scheduled dispatcher
43
+ ### Origin-mode dispatcher with remote workspaces
44
44
 
45
45
  Commit a remote-compatible configuration to the base branch:
46
46
 
@@ -73,40 +73,25 @@ model = "vercel-ai-gateway/anthropic/claude-sonnet-4.6"
73
73
  ```
74
74
  <!-- seam-config:end -->
75
75
 
76
- - **Required:** hosted HTTP Store, GitHub forge, remote ticket source, remote workspace. Hosted tickets need the registered project's team key.
77
- - **Install the Sandbox plugin** in the project and make it available to the dispatcher deployment.
78
- - **Replace the example** runtime, model and provisioning commands with values for your account.
79
-
80
- Deploy `@defrex/autobuild-hosted-dispatcher` and mount its `dispatcherEndpoint()` at `/api/dispatch`; a store-only deployment never dispatches. Server-only environment includes:
76
+ Run the supported CLI from an HTTPS GitHub origin:
81
77
 
82
78
  ```sh
83
- export AB_DISPATCHER_ORIGIN='https://builds.example.com'
84
- export CRON_SECRET='<schedule secret>'
85
- export GITHUB_TOKEN='<repository publication token>'
86
- export DATABASE_URL='<postgres connection URL>'
87
- export AI_GATEWAY_API_KEY='<runtime API credential>'
79
+ bun ab dispatch --repository https://github.com/acme/app --plain --store https://builds.example.com
88
80
  ```
89
81
 
90
- Plus the Store's signing, blob and auth secrets, and registered projects.
91
-
92
- - **Authority.** A hosted invocation mints project-scoped authority; a separately launched origin-mode CLI uses its saved project credential or `AB_TOKEN`.
93
- - **Origin dispatch** reads configuration from the forge, needs exported forge credentials, and can't load checkout-relative plugins.
94
- - **Sandbox provisioning.** On Vercel, the invocation's OIDC identity authenticates; don't add `VERCEL_TOKEN`. Elsewhere, it needs a durable token, team and project, or short-lived OIDC credentials ([Workspaces](workspaces.md)).
95
- - **Guests** get only the declared runtime API credentials, never Store or forge secrets.
96
-
97
- Schedule authenticated invocations:
98
-
99
- ```json
100
- {
101
- "crons": [{ "path": "/api/dispatch", "schedule": "* * * * *" }]
102
- }
103
- ```
104
-
105
- Build the distribution's guest archive into the function bundle before deploying; the function can't pack it at runtime.
106
-
107
- - **Bounded ticks:** a 240-second default work budget inside a 300-second route. Unfinished work resumes on later ticks; guests run independently.
108
- - **Overlap:** the repository supervisor lease makes overlapping invocations yield.
109
- - Selecting Postgres alone never moves dispatch here.
82
+ Use a remote store that speaks the remote BuildStore protocol.
83
+ Connect the project with `ab connect` or supply `AB_TOKEN`. Hosted tickets use
84
+ that registered project's team key. Install the Sandbox plugin on the dispatcher
85
+ host and replace the example runtime and model with your account's values.
86
+ Origin mode reads configuration from the forge and cannot load checkout-relative
87
+ plugins. Export push-capable `GITHUB_TOKEN` or `GH_TOKEN`; forge credentials stay
88
+ on the host. Sandbox provisioning needs `VERCEL_OIDC_TOKEN` or the durable
89
+ `VERCEL_TOKEN`/`VERCEL_TEAM_ID`/`VERCEL_PROJECT_ID` tuple. Guests receive runtime
90
+ API credentials allowlisted through `environmentVariables`, nonsecret billing
91
+ account placeholders, and scoped Store execution authority. Real account
92
+ credentials stay on the host and are applied by provider-scoped egress header
93
+ transforms.
94
+ See [origin-mode setup](setup.md#running-the-dispatcher-without-a-checkout-origin-mode) and [Workspaces](workspaces.md).
110
95
 
111
96
  ## Writing your own
112
97