@defrex/autobuild 1.0.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/README.md +10 -18
  2. package/SPEC.md +499 -238
  3. package/bin/ab-dispatch-generation.ts +11 -2
  4. package/docs/accounts.md +119 -0
  5. package/docs/agent-runtimes.md +4 -4
  6. package/docs/answering-blocked-builds.md +2 -2
  7. package/docs/architecture.md +262 -53
  8. package/docs/assets/headline-wide.png +0 -0
  9. package/docs/build-store.md +3 -41
  10. package/docs/builds.md +4 -4
  11. package/docs/cli.md +18 -4
  12. package/docs/configuration-overview.md +115 -4
  13. package/docs/configuration.md +488 -334
  14. package/docs/dispatcher-hosting.md +19 -34
  15. package/docs/dispatcher.md +1 -1
  16. package/docs/forges.md +5 -5
  17. package/docs/getting-started.md +2 -2
  18. package/docs/glossary.md +6 -6
  19. package/docs/intake.md +2 -0
  20. package/docs/integration-overview.md +15 -15
  21. package/docs/integration-tree.md +45 -38
  22. package/docs/integration.md +6 -6
  23. package/{skills/guide/references/landing-policy.md → docs/merge-policy.md} +40 -24
  24. package/docs/migration-1.0.md +17 -13
  25. package/docs/operating.md +41 -19
  26. package/docs/operator-api.md +180 -51
  27. package/docs/operator-surfaces.md +5 -18
  28. package/docs/overview.md +3 -3
  29. package/docs/plugin-authoring.md +21 -0
  30. package/docs/remote-store-protocol.md +242 -68
  31. package/docs/remote-ticket-protocol.md +30 -50
  32. package/docs/restacking.md +54 -15
  33. package/docs/seams.md +8 -8
  34. package/docs/setup.md +59 -119
  35. package/docs/skills.md +1 -1
  36. package/docs/spec-standard.md +6 -6
  37. package/docs/ticket-dependencies.md +7 -7
  38. package/docs/ticket-sources.md +18 -0
  39. package/docs/tickets.md +8 -2
  40. package/docs/troubleshooting.md +8 -12
  41. package/docs/upgrading.md +9 -4
  42. package/docs/verification.md +60 -14
  43. package/docs/workspaces.md +4 -4
  44. package/package.json +17 -6
  45. package/packages/core/src/accounts/chatgpt-oauth.ts +216 -0
  46. package/packages/core/src/accounts/chatgpt-state.ts +41 -0
  47. package/packages/core/src/accounts/local-credentials.ts +194 -0
  48. package/packages/core/src/accounts/local-inference.ts +106 -0
  49. package/packages/core/src/accounts/local-owner.ts +123 -0
  50. package/packages/core/src/accounts/sensitive.ts +2 -0
  51. package/packages/core/src/cli/accounts.ts +147 -0
  52. package/packages/core/src/cli/binary-direct.ts +13 -1
  53. package/packages/core/src/cli/binary-lifecycle.ts +65 -2
  54. package/packages/core/src/cli/binary.ts +3 -1
  55. package/packages/core/src/cli/build-control.ts +83 -28
  56. package/packages/core/src/cli/connect.ts +3 -3
  57. package/packages/core/src/cli/context.ts +81 -38
  58. package/packages/core/src/cli/dashboard/facts.ts +2 -1
  59. package/packages/core/src/cli/dashboard/integration-detail.ts +8 -8
  60. package/packages/core/src/cli/dashboard/integration-row.ts +40 -13
  61. package/packages/core/src/cli/dashboard/landing-display.ts +25 -0
  62. package/packages/core/src/cli/dashboard/model.ts +56 -33
  63. package/packages/core/src/cli/dashboard/poll.ts +9 -3
  64. package/packages/core/src/cli/dashboard/render.ts +59 -37
  65. package/packages/core/src/cli/dashboard/target-distance.ts +14 -0
  66. package/packages/core/src/cli/dashboard/tree.ts +3 -2
  67. package/packages/core/src/cli/dispatch-args.ts +1 -1
  68. package/packages/core/src/cli/dispatch-frontend.ts +6 -3
  69. package/packages/core/src/cli/dispatch-handoff.ts +125 -44
  70. package/packages/core/src/cli/dispatch-launch-contract.ts +187 -0
  71. package/packages/core/src/cli/dispatch-launcher.ts +54 -21
  72. package/packages/core/src/cli/dispatch-preflight.ts +6 -1
  73. package/packages/core/src/cli/dispatch.ts +106 -11
  74. package/packages/core/src/cli/env.ts +4 -0
  75. package/packages/core/src/cli/help.ts +46 -23
  76. package/packages/core/src/cli/init-readiness-remote.ts +22 -1
  77. package/packages/core/src/cli/init-readiness-shared.ts +5 -1
  78. package/packages/core/src/cli/init-validation.ts +160 -18
  79. package/packages/core/src/cli/main.ts +68 -8
  80. package/packages/core/src/cli/node-verification-provenance.ts +1 -97
  81. package/packages/core/src/cli/publication-settlement.ts +47 -21
  82. package/packages/core/src/cli/repository-status.ts +20 -9
  83. package/packages/core/src/cli/secrets.ts +173 -0
  84. package/packages/core/src/cli/status.ts +42 -5
  85. package/packages/core/src/cli/store-opening.ts +17 -2
  86. package/packages/core/src/cli/terminal.ts +22 -1
  87. package/packages/core/src/cli/terminals.ts +14 -10
  88. package/packages/core/src/cli/upgrade-agent.ts +9 -1
  89. package/packages/core/src/cli/upgrade-landing.ts +70 -30
  90. package/packages/core/src/cli/upgrade.ts +3 -1
  91. package/packages/core/src/cli/wait.ts +15 -7
  92. package/packages/core/src/cli/watch-lifetime.ts +111 -0
  93. package/packages/core/src/cli/watch.ts +635 -510
  94. package/packages/core/src/config/accounts.ts +101 -0
  95. package/packages/core/src/config/effective-artifact.fixture.ts +27 -0
  96. package/packages/core/src/config/effective-artifact.ts +13 -0
  97. package/packages/core/src/config/landing.ts +1 -1
  98. package/packages/core/src/config/live.ts +14 -1
  99. package/packages/core/src/config/load.ts +21 -1
  100. package/packages/core/src/config/pipeline-source.ts +28 -0
  101. package/packages/core/src/config/reference-metadata.ts +2 -0
  102. package/packages/core/src/config/reference.ts +22 -7
  103. package/packages/core/src/config/roles.ts +54 -3
  104. package/packages/core/src/config/schema.ts +146 -162
  105. package/packages/core/src/context-directory.ts +26 -0
  106. package/packages/core/src/distribution-packaging.ts +26 -5
  107. package/packages/core/src/events/catalog.ts +10 -2
  108. package/packages/core/src/events/compatibility.ts +2 -1
  109. package/packages/core/src/events/globs.ts +1 -1
  110. package/packages/core/src/events/payloads.ts +73 -1
  111. package/packages/core/src/events/policy.ts +7 -0
  112. package/packages/core/src/events/repository.ts +4 -4
  113. package/packages/core/src/events/sessions.ts +6 -6
  114. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +574 -0
  115. package/packages/core/src/kernel/auto-merge.ts +2 -2
  116. package/packages/core/src/kernel/engine.ts +255 -26
  117. package/packages/core/src/kernel/generators/leaf-restack-log.ts +10 -0
  118. package/packages/core/src/kernel/integration-landing.ts +3 -3
  119. package/packages/core/src/kernel/integration-state.ts +27 -4
  120. package/packages/core/src/kernel/leaf-restack-state.ts +28 -3
  121. package/packages/core/src/kernel/log-index.ts +13 -1
  122. package/packages/core/src/kernel/node-landing.ts +8 -8
  123. package/packages/core/src/kernel/node-parent.ts +2 -2
  124. package/packages/core/src/kernel/node-restack-transaction.ts +1 -1
  125. package/packages/core/src/kernel/node-verification-context.ts +216 -0
  126. package/packages/core/src/kernel/phases.ts +1 -1
  127. package/packages/core/src/kernel/plan-verify-selection.ts +16 -0
  128. package/packages/core/src/kernel/publication-retry.ts +168 -0
  129. package/packages/core/src/kernel/reconcile-restack.ts +29 -1
  130. package/packages/core/src/kernel/reducer.ts +85 -5
  131. package/packages/core/src/kernel/target-distance.ts +45 -0
  132. package/packages/core/src/kernel/terminal-guard.ts +10 -1
  133. package/packages/core/src/kernel/verify-stage-state.ts +123 -0
  134. package/packages/core/src/kernel/verify-stages.ts +39 -0
  135. package/packages/core/src/ontology.ts +1 -0
  136. package/packages/core/src/operator/annotations.ts +6 -0
  137. package/packages/core/src/operator/control.ts +1 -1
  138. package/packages/core/src/operator/index.ts +3 -7
  139. package/packages/core/src/operator/landings.ts +5 -1
  140. package/packages/core/src/operator/presentation.ts +6 -1
  141. package/packages/core/src/operator/protocol.ts +6 -0
  142. package/packages/core/src/operator/query.ts +14 -18
  143. package/packages/core/src/operator/registry.ts +39 -7
  144. package/packages/core/src/operator/sandbox-host.ts +64 -40
  145. package/packages/core/src/operator/sandbox.ts +3 -0
  146. package/packages/core/src/operator/ticket-source-backend.ts +3 -12
  147. package/packages/core/src/operator/tickets.ts +25 -4
  148. package/packages/core/src/plugins/manifest.ts +2 -1
  149. package/packages/core/src/ports/forge/contract.ts +2 -2
  150. package/packages/core/src/ports/forge/git-rewrite.ts +25 -2
  151. package/packages/core/src/ports/forge/github-readiness.ts +2 -2
  152. package/packages/core/src/ports/forge/github.ts +26 -7
  153. package/packages/core/src/ports/forge/local-git.ts +4 -4
  154. package/packages/core/src/ports/forge/readiness.ts +1 -1
  155. package/packages/core/src/ports/forge-failure.ts +24 -0
  156. package/packages/core/src/ports/runner/account-env.ts +88 -0
  157. package/packages/core/src/ports/runner/chatgpt-provider.ts +85 -0
  158. package/packages/core/src/ports/runner/claude.ts +26 -2
  159. package/packages/core/src/ports/runner/codex.ts +63 -31
  160. package/packages/core/src/ports/runner/one-shot.ts +2 -0
  161. package/packages/core/src/ports/runner/provider-error.ts +5 -0
  162. package/packages/core/src/ports/runner/routing.ts +35 -4
  163. package/packages/core/src/ports/tickets/contract.ts +58 -0
  164. package/packages/core/src/ports/tickets/tree.ts +1 -1
  165. package/packages/core/src/ports/types.ts +28 -7
  166. package/packages/core/src/ports/workspace/account-policy.ts +72 -0
  167. package/packages/core/src/ports/workspace/build-execution.ts +9 -2
  168. package/packages/core/src/ports/workspace/builtin-capabilities.ts +1 -0
  169. package/packages/core/src/ports/workspace/create.ts +2 -0
  170. package/packages/core/src/ports/workspace/git-worktree.ts +6 -1
  171. package/packages/core/src/ports/workspace/phase-scratch.ts +4 -3
  172. package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -0
  173. package/packages/core/src/ports/workspace/vercel-sandbox.ts +182 -72
  174. package/packages/core/src/processes/build-child.ts +6 -8
  175. package/packages/core/src/processes/build-execution-state.ts +8 -5
  176. package/packages/core/src/processes/build-runner.ts +554 -99
  177. package/packages/core/src/processes/dispatcher.ts +209 -101
  178. package/packages/core/src/processes/execution-no-progress.ts +8 -1
  179. package/packages/core/src/processes/execution-settlement.ts +21 -3
  180. package/packages/core/src/processes/harvest-runner.ts +68 -8
  181. package/packages/core/src/processes/phase-failure-budget.ts +1 -0
  182. package/packages/core/src/processes/publication-loss.ts +8 -2
  183. package/packages/core/src/processes/publication-state.ts +42 -4
  184. package/packages/core/src/processes/repo-view.ts +14 -0
  185. package/packages/core/src/processes/verify-cycle-config.ts +96 -0
  186. package/packages/core/src/project-secrets.ts +105 -0
  187. package/packages/core/src/{integration → scenarios}/harness.ts +330 -317
  188. package/packages/core/src/secret-name.ts +41 -0
  189. package/packages/core/src/store/account-redaction.ts +156 -0
  190. package/packages/core/src/store/adapter.ts +1 -0
  191. package/packages/core/src/store/build-scope.ts +9 -0
  192. package/packages/core/src/store/contract.ts +116 -2
  193. package/packages/core/src/store/local/schema.ts +13 -0
  194. package/packages/core/src/store/local/store.ts +42 -0
  195. package/packages/core/src/store/memory.ts +47 -0
  196. package/packages/core/src/store/operator-presence.ts +21 -0
  197. package/packages/core/src/store/phase-session.ts +10 -0
  198. package/packages/core/src/store/reducer-value-shapes.json +5185 -4156
  199. package/packages/core/src/store/remote/client.ts +89 -48
  200. package/packages/core/src/store/remote/compatibility.ts +20 -0
  201. package/packages/core/src/store/remote/protocol.ts +4 -0
  202. package/packages/core/src/store/remote/version.ts +3 -1
  203. package/packages/core/src/store/retention.ts +2 -3
  204. package/packages/core/src/store/session-handle.ts +9 -0
  205. package/packages/core/src/store/streams/session-writer.ts +1 -1
  206. package/packages/core/src/store/types.ts +12 -2
  207. package/packages/core/src/testing/dispatch-read-budget.ts +122 -0
  208. package/packages/core/src/testing/index.ts +12 -1
  209. package/packages/core/src/testing/reduced-read-budget.ts +47 -0
  210. package/packages/core/src/testing/temp-directories.ts +58 -0
  211. package/skills/code-review/SKILL.md +23 -9
  212. package/skills/finalize/SKILL.md +15 -7
  213. package/skills/guide/SKILL.md +373 -148
  214. package/skills/guide/references/accounts.md +119 -0
  215. package/skills/guide/references/integration-tree.md +45 -38
  216. package/{docs/landing-policy.md → skills/guide/references/merge-policy.md} +40 -24
  217. package/skills/guide/references/migration-1.0.md +17 -13
  218. package/skills/guide/references/operator-api.md +180 -51
  219. package/skills/guide/references/plugin-authoring.md +21 -0
  220. package/skills/guide/references/remote-store-protocol.md +242 -68
  221. package/skills/guide/references/remote-ticket-protocol.md +30 -50
  222. package/skills/guide/references/restacking.md +54 -15
  223. package/skills/guide/references/setup.md +59 -119
  224. package/skills/guide/references/spec-standard.md +6 -6
  225. package/skills/guide/references/ticket-dependencies.md +7 -7
  226. package/skills/harvest/SKILL.md +3 -1
  227. package/skills/harvest-review/SKILL.md +3 -1
  228. package/skills/implement/SKILL.md +43 -17
  229. package/skills/operate/SKILL.md +118 -118
  230. package/skills/plan/SKILL.md +39 -13
  231. package/skills/plan-review/SKILL.md +15 -10
  232. package/skills/reconcile/SKILL.md +22 -3
  233. package/skills/spec/SKILL.md +20 -20
  234. package/skills/tickets/SKILL.md +12 -9
  235. package/templates/autobuild.toml +1 -1
  236. package/templates/hosted-service/package.json +2 -2
  237. package/docs/hosted-dispatcher-cutover-validation.md +0 -178
  238. package/docs/hosted-dispatcher.md +0 -275
  239. package/docs/hosted-service.md +0 -293
  240. package/docs/mcp.md +0 -149
  241. package/packages/core/src/orchestrator/approvals.ts +0 -115
  242. package/packages/core/src/orchestrator/conversation.ts +0 -167
  243. package/packages/core/src/orchestrator/model.ts +0 -86
  244. package/packages/core/src/orchestrator/prompt.ts +0 -63
  245. package/packages/core/src/orchestrator/tools.ts +0 -117
  246. package/packages/core/src/orchestrator/turn-runner.ts +0 -457
  247. package/packages/core/src/processes/orchestrator-tick.ts +0 -360
@@ -1,3 +1,4 @@
1
+ import type { SelectedAccount } from '../config/accounts'
1
2
  export type { ForgeReadinessCheck, ForgeReadinessInput } from './forge/readiness'
2
3
  import type { ForgeReadinessCheck, ForgeReadinessInput } from './forge/readiness'
3
4
  import type { BuildStore } from '../store/types'
@@ -90,6 +91,25 @@ export interface Ticket {
90
91
  blockedBy?: string[]
91
92
  }
92
93
 
94
+ export interface TicketCriteria {
95
+ labels?: string[]
96
+ state?: string
97
+ /** `me` (the API key's owner) or a user's email; only sources that can honour it
98
+ * accept it — others reject `[tickets].readyAssignee` at config parse. */
99
+ assignee?: string
100
+ }
101
+
102
+ export interface TicketPage {
103
+ limit: number
104
+ offset?: number
105
+ order?: 'oldest' | 'newest'
106
+ }
107
+
108
+ export interface TicketPageListing extends TicketListing {
109
+ /** Matching count before ordering and slicing. No operator-specific limit cap. */
110
+ total: number
111
+ }
112
+
93
113
  /** A partial source scan. Diagnostics name source records that were excluded
94
114
  * from eligibility; infrastructure failures and source-wide invariants still
95
115
  * reject `listReady` rather than appearing here. */
@@ -214,13 +234,13 @@ export interface TicketSource {
214
234
  /** Ready tickets matching the dispatch criteria (label/state — §3.3), plus
215
235
  * actionable diagnostics for individual source records excluded as invalid.
216
236
  * Fatal source failures and invariants still reject the call. */
217
- listReady(criteria: {
218
- labels?: string[]
219
- state?: string
220
- /** `me` (the API key's owner) or a user's email; only sources that can honour it
221
- * accept it — others reject `[tickets].readyAssignee` at config parse. */
222
- assignee?: string
223
- }): Promise<TicketListing>
237
+ listReady(criteria: TicketCriteria): Promise<TicketListing>
238
+ /** Optional native window, equivalent to listReady then reverse/slice.
239
+ * Defaults: offset 0, order oldest. Arguments are nonnegative integers;
240
+ * zero limit returns no tickets with the full matching total. Diagnostics
241
+ * and failures match listReady; a failure must not trigger a full-read fallback.
242
+ * listReady and listAll remain exhaustive. */
243
+ listPage?(criteria: TicketCriteria, page: TicketPage): Promise<TicketPageListing>
224
244
  get(id: string): Promise<Ticket | null>
225
245
  /** Claim-before-launch (§12): acquires nonterminal work and returns true.
226
246
  * Returns false for an unknown, already-claimed/contested, or terminal ticket.
@@ -733,6 +753,7 @@ export interface Transcript {
733
753
  }
734
754
 
735
755
  export interface AgentStartOpts {
756
+ account?: SelectedAccount
736
757
  /** Await before further native output/prompt processing. Rejections are
737
758
  * infrastructure failures and must propagate to the caller. */
738
759
  onNativeSession?: NativeSessionObserver
@@ -0,0 +1,72 @@
1
+ import { sensitiveAccountValues } from '../../accounts/sensitive'
2
+ import type { NetworkPolicy, NetworkPolicyRule } from '@vercel/sandbox'
3
+ import {
4
+ accountPlaceholder,
5
+ accountRemedy,
6
+ kimiEndpoint,
7
+ type Accounts,
8
+ } from '../../config/accounts'
9
+
10
+ /** Only exact provider + account-specific header matches receive credentials. */
11
+ export function accountPolicy(
12
+ base: NetworkPolicy,
13
+ accounts: Accounts,
14
+ env: Readonly<Record<string, string | undefined>>,
15
+ ): { policy: NetworkPolicy; missing: string[] } {
16
+ if (Object.keys(accounts).length === 0) return { policy: base, missing: [] }
17
+ if (base === 'deny-all' || (typeof base === 'object' && Array.isArray(base.allow)))
18
+ throw new Error('Account policy requires a rule-based network policy')
19
+ const allow: Record<string, NetworkPolicyRule[]> =
20
+ typeof base === 'object'
21
+ ? { ...(base.allow as Record<string, NetworkPolicyRule[]>) }
22
+ : { '*': [] }
23
+ const missing: string[] = []
24
+ for (const [name, descriptor] of Object.entries(accounts)) {
25
+ const credential = env[descriptor.credentialEnv]
26
+ if (!credential) {
27
+ missing.push(accountRemedy({ name, descriptor }))
28
+ continue
29
+ }
30
+ const claude = descriptor.kind !== 'kimi-code'
31
+ const host =
32
+ descriptor.kind === 'chatgpt-subscription'
33
+ ? 'api.openai.com'
34
+ : descriptor.kind === 'kimi-code'
35
+ ? kimiEndpoint(descriptor.region).host
36
+ : 'api.anthropic.com'
37
+ const key = claude ? 'authorization' : 'x-api-key'
38
+ const prefix = claude ? 'Bearer ' : ''
39
+ allow[host] = [
40
+ ...(allow[host] ?? []),
41
+ {
42
+ match: {
43
+ headers: [{ key: { exact: key }, value: { exact: prefix + accountPlaceholder(name) } }],
44
+ },
45
+ transform: [{ headers: { [key]: prefix + credential } }],
46
+ },
47
+ ]
48
+ }
49
+ return { policy: { ...(typeof base === 'object' ? base : {}), allow }, missing }
50
+ }
51
+
52
+ /** Declared credential variables and aliases containing their values never cross
53
+ * into the guest. Placeholders let sessions choose accounts without host RPC. */
54
+ export function accountGuestEnvironment(
55
+ forwarded: Record<string, string>,
56
+ accounts: Accounts,
57
+ host: Readonly<Record<string, string | undefined>>,
58
+ ): Record<string, string> {
59
+ const env = { ...forwarded }
60
+ if (Object.keys(accounts).length) env.AB_ACCOUNT_PLACEHOLDERS = '1'
61
+ const secrets = [
62
+ ...sensitiveAccountValues,
63
+ ...Object.values(accounts)
64
+ .map((a) => host[a.credentialEnv])
65
+ .filter((v): v is string => !!v),
66
+ ]
67
+ for (const [key, value] of Object.entries(env))
68
+ if (secrets.some((secret) => value.includes(secret))) delete env[key]
69
+ for (const [name, account] of Object.entries(accounts))
70
+ env[account.credentialEnv] = accountPlaceholder(name)
71
+ return env
72
+ }
@@ -102,13 +102,20 @@ export interface BuildExecutionHandle {
102
102
  }
103
103
 
104
104
  /** Provider liveness observation of one recorded execution, derived from
105
- * provider state rather than process memory. `ended` carries the observed
105
+ * provider state rather than process memory. Terminal observations also confirm
106
+ * that the whole execution environment has stopped, including descendants.
107
+ * A command exit without confirmed teardown is not terminal. `ended` carries the observed
106
108
  * exit code; `lost` means the provider proved the environment/command no
107
109
  * longer exists without an exit code. */
108
- export type ExecutionObservation =
110
+ export type ExecutionObservation = (
109
111
  | { state: 'running' }
110
112
  | { state: 'ended'; exitCode?: number }
111
113
  | { state: 'lost' }
114
+ ) & {
115
+ /** Actionable host diagnosis, independent of command liveness. Callers must
116
+ * persist attention without suppressing observation or terminal settlement. */
117
+ attention?: string
118
+ }
112
119
 
113
120
  /** The substitutable seam at the workspace boundary. A remote workspace
114
121
  * provider may implement this by starting the fixed build process beside its
@@ -77,6 +77,7 @@ const BUILTINS: Record<string, BuiltinWorkspaceProviderDeclaration> = {
77
77
  storeToken: opts.storeToken!,
78
78
  repo: resolve(opts.repoRoot),
79
79
  runtimeReferences: opts.runtimeReferences ?? [],
80
+ accounts: opts.accounts,
80
81
  setupCommand: opts.sandboxSetupCommand,
81
82
  sandboxEnvironmentVariables: opts.sandboxEnvironmentVariables,
82
83
  ...(opts.origin !== undefined ? { origin: opts.origin } : {}),
@@ -25,6 +25,7 @@ export interface CreateWorkspaceProviderOptions {
25
25
  storeRef?: string
26
26
  storeToken?: string
27
27
  /** Host-derived effective routes; consumed only by the built-in sandbox. */
28
+ accounts?: () => import('../../config/accounts').Accounts
28
29
  runtimeReferences?: RuntimeReferencesSource
29
30
  /** Checkout-less seams for the built-in sandbox: the repository's HTTPS
30
31
  * origin, and a remote branch-head reader returning `undefined` for an
@@ -148,6 +149,7 @@ export async function createWorkspaceProvider(
148
149
  ) => delegateCredential(opts.storeRef!, opts.storeToken, target),
149
150
  }
150
151
  : {}),
152
+ ...(opts.accounts !== undefined ? { accounts: opts.accounts } : {}),
151
153
  ...(opts.runtimeReferences !== undefined
152
154
  ? { runtimeReferences: opts.runtimeReferences }
153
155
  : {}),
@@ -45,7 +45,12 @@ export const spawnExec: Exec = async (cmd, opts) => {
45
45
  stdin: 'ignore',
46
46
  stdout: 'pipe',
47
47
  stderr: 'pipe',
48
- env: { ...process.env, ...opts.env, AB_DISPATCH_GENERATION: undefined },
48
+ env: {
49
+ ...process.env,
50
+ ...opts.env,
51
+ AB_DISPATCH_GENERATION: undefined,
52
+ AB_PROJECT_SECRETS_KEY: undefined,
53
+ },
49
54
  ...(opts.signal === undefined ? {} : { signal: opts.signal }),
50
55
  })
51
56
  const [stdout, stderr, exitCode] = await Promise.all([
@@ -74,17 +74,18 @@ export function allocateScratchPath(
74
74
  desired: string,
75
75
  tracked: ReadonlySet<string>,
76
76
  allocated: Set<string>,
77
+ prefix = PHASE_SCRATCH_PREFIX,
77
78
  ): string {
78
79
  const unavailable = new Set([...tracked, ...allocated])
79
- const conventional = `${PHASE_SCRATCH_PREFIX}${desired}`
80
+ const conventional = `${prefix}${desired}`
80
81
  if (!collides(conventional, unavailable)) {
81
82
  allocated.add(conventional)
82
83
  return desired
83
84
  }
84
85
  for (let index = 1; ; index += 1) {
85
86
  const candidate = `generated/${index}/${desired}`
86
- if (!collides(`${PHASE_SCRATCH_PREFIX}${candidate}`, unavailable)) {
87
- allocated.add(`${PHASE_SCRATCH_PREFIX}${candidate}`)
87
+ if (!collides(`${prefix}${candidate}`, unavailable)) {
88
+ allocated.add(`${prefix}${candidate}`)
88
89
  return candidate
89
90
  }
90
91
  }
@@ -163,6 +163,7 @@ export interface WorkspaceReadinessContext {
163
163
  configBytes: string
164
164
  exec: Exec
165
165
  redact: (value: unknown) => string
166
+ accounts?: import('../../config/accounts').Accounts
166
167
  runtimeReferences: readonly RuntimeReferenceGroup[]
167
168
  stdout: (line: string) => void
168
169
  signal?: AbortSignal