@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.
- package/README.md +10 -18
- package/SPEC.md +499 -238
- package/bin/ab-dispatch-generation.ts +11 -2
- package/docs/accounts.md +119 -0
- package/docs/agent-runtimes.md +4 -4
- package/docs/answering-blocked-builds.md +2 -2
- package/docs/architecture.md +262 -53
- package/docs/assets/headline-wide.png +0 -0
- package/docs/build-store.md +3 -41
- package/docs/builds.md +4 -4
- package/docs/cli.md +18 -4
- package/docs/configuration-overview.md +115 -4
- package/docs/configuration.md +488 -334
- package/docs/dispatcher-hosting.md +19 -34
- package/docs/dispatcher.md +1 -1
- package/docs/forges.md +5 -5
- package/docs/getting-started.md +2 -2
- package/docs/glossary.md +6 -6
- package/docs/intake.md +2 -0
- package/docs/integration-overview.md +15 -15
- package/docs/integration-tree.md +45 -38
- package/docs/integration.md +6 -6
- package/{skills/guide/references/landing-policy.md → docs/merge-policy.md} +40 -24
- package/docs/migration-1.0.md +17 -13
- package/docs/operating.md +41 -19
- package/docs/operator-api.md +180 -51
- package/docs/operator-surfaces.md +5 -18
- package/docs/overview.md +3 -3
- package/docs/plugin-authoring.md +21 -0
- package/docs/remote-store-protocol.md +242 -68
- package/docs/remote-ticket-protocol.md +30 -50
- package/docs/restacking.md +54 -15
- package/docs/seams.md +8 -8
- package/docs/setup.md +59 -119
- package/docs/skills.md +1 -1
- package/docs/spec-standard.md +6 -6
- package/docs/ticket-dependencies.md +7 -7
- package/docs/ticket-sources.md +18 -0
- package/docs/tickets.md +8 -2
- package/docs/troubleshooting.md +8 -12
- package/docs/upgrading.md +9 -4
- package/docs/verification.md +60 -14
- package/docs/workspaces.md +4 -4
- package/package.json +17 -6
- package/packages/core/src/accounts/chatgpt-oauth.ts +216 -0
- package/packages/core/src/accounts/chatgpt-state.ts +41 -0
- package/packages/core/src/accounts/local-credentials.ts +194 -0
- package/packages/core/src/accounts/local-inference.ts +106 -0
- package/packages/core/src/accounts/local-owner.ts +123 -0
- package/packages/core/src/accounts/sensitive.ts +2 -0
- package/packages/core/src/cli/accounts.ts +147 -0
- package/packages/core/src/cli/binary-direct.ts +13 -1
- package/packages/core/src/cli/binary-lifecycle.ts +65 -2
- package/packages/core/src/cli/binary.ts +3 -1
- package/packages/core/src/cli/build-control.ts +83 -28
- package/packages/core/src/cli/connect.ts +3 -3
- package/packages/core/src/cli/context.ts +81 -38
- package/packages/core/src/cli/dashboard/facts.ts +2 -1
- package/packages/core/src/cli/dashboard/integration-detail.ts +8 -8
- package/packages/core/src/cli/dashboard/integration-row.ts +40 -13
- package/packages/core/src/cli/dashboard/landing-display.ts +25 -0
- package/packages/core/src/cli/dashboard/model.ts +56 -33
- package/packages/core/src/cli/dashboard/poll.ts +9 -3
- package/packages/core/src/cli/dashboard/render.ts +59 -37
- package/packages/core/src/cli/dashboard/target-distance.ts +14 -0
- package/packages/core/src/cli/dashboard/tree.ts +3 -2
- package/packages/core/src/cli/dispatch-args.ts +1 -1
- package/packages/core/src/cli/dispatch-frontend.ts +6 -3
- package/packages/core/src/cli/dispatch-handoff.ts +125 -44
- package/packages/core/src/cli/dispatch-launch-contract.ts +187 -0
- package/packages/core/src/cli/dispatch-launcher.ts +54 -21
- package/packages/core/src/cli/dispatch-preflight.ts +6 -1
- package/packages/core/src/cli/dispatch.ts +106 -11
- package/packages/core/src/cli/env.ts +4 -0
- package/packages/core/src/cli/help.ts +46 -23
- package/packages/core/src/cli/init-readiness-remote.ts +22 -1
- package/packages/core/src/cli/init-readiness-shared.ts +5 -1
- package/packages/core/src/cli/init-validation.ts +160 -18
- package/packages/core/src/cli/main.ts +68 -8
- package/packages/core/src/cli/node-verification-provenance.ts +1 -97
- package/packages/core/src/cli/publication-settlement.ts +47 -21
- package/packages/core/src/cli/repository-status.ts +20 -9
- package/packages/core/src/cli/secrets.ts +173 -0
- package/packages/core/src/cli/status.ts +42 -5
- package/packages/core/src/cli/store-opening.ts +17 -2
- package/packages/core/src/cli/terminal.ts +22 -1
- package/packages/core/src/cli/terminals.ts +14 -10
- package/packages/core/src/cli/upgrade-agent.ts +9 -1
- package/packages/core/src/cli/upgrade-landing.ts +70 -30
- package/packages/core/src/cli/upgrade.ts +3 -1
- package/packages/core/src/cli/wait.ts +15 -7
- package/packages/core/src/cli/watch-lifetime.ts +111 -0
- package/packages/core/src/cli/watch.ts +635 -510
- package/packages/core/src/config/accounts.ts +101 -0
- package/packages/core/src/config/effective-artifact.fixture.ts +27 -0
- package/packages/core/src/config/effective-artifact.ts +13 -0
- package/packages/core/src/config/landing.ts +1 -1
- package/packages/core/src/config/live.ts +14 -1
- package/packages/core/src/config/load.ts +21 -1
- package/packages/core/src/config/pipeline-source.ts +28 -0
- package/packages/core/src/config/reference-metadata.ts +2 -0
- package/packages/core/src/config/reference.ts +22 -7
- package/packages/core/src/config/roles.ts +54 -3
- package/packages/core/src/config/schema.ts +146 -162
- package/packages/core/src/context-directory.ts +26 -0
- package/packages/core/src/distribution-packaging.ts +26 -5
- package/packages/core/src/events/catalog.ts +10 -2
- package/packages/core/src/events/compatibility.ts +2 -1
- package/packages/core/src/events/globs.ts +1 -1
- package/packages/core/src/events/payloads.ts +73 -1
- package/packages/core/src/events/policy.ts +7 -0
- package/packages/core/src/events/repository.ts +4 -4
- package/packages/core/src/events/sessions.ts +6 -6
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +574 -0
- package/packages/core/src/kernel/auto-merge.ts +2 -2
- package/packages/core/src/kernel/engine.ts +255 -26
- package/packages/core/src/kernel/generators/leaf-restack-log.ts +10 -0
- package/packages/core/src/kernel/integration-landing.ts +3 -3
- package/packages/core/src/kernel/integration-state.ts +27 -4
- package/packages/core/src/kernel/leaf-restack-state.ts +28 -3
- package/packages/core/src/kernel/log-index.ts +13 -1
- package/packages/core/src/kernel/node-landing.ts +8 -8
- package/packages/core/src/kernel/node-parent.ts +2 -2
- package/packages/core/src/kernel/node-restack-transaction.ts +1 -1
- package/packages/core/src/kernel/node-verification-context.ts +216 -0
- package/packages/core/src/kernel/phases.ts +1 -1
- package/packages/core/src/kernel/plan-verify-selection.ts +16 -0
- package/packages/core/src/kernel/publication-retry.ts +168 -0
- package/packages/core/src/kernel/reconcile-restack.ts +29 -1
- package/packages/core/src/kernel/reducer.ts +85 -5
- package/packages/core/src/kernel/target-distance.ts +45 -0
- package/packages/core/src/kernel/terminal-guard.ts +10 -1
- package/packages/core/src/kernel/verify-stage-state.ts +123 -0
- package/packages/core/src/kernel/verify-stages.ts +39 -0
- package/packages/core/src/ontology.ts +1 -0
- package/packages/core/src/operator/annotations.ts +6 -0
- package/packages/core/src/operator/control.ts +1 -1
- package/packages/core/src/operator/index.ts +3 -7
- package/packages/core/src/operator/landings.ts +5 -1
- package/packages/core/src/operator/presentation.ts +6 -1
- package/packages/core/src/operator/protocol.ts +6 -0
- package/packages/core/src/operator/query.ts +14 -18
- package/packages/core/src/operator/registry.ts +39 -7
- package/packages/core/src/operator/sandbox-host.ts +64 -40
- package/packages/core/src/operator/sandbox.ts +3 -0
- package/packages/core/src/operator/ticket-source-backend.ts +3 -12
- package/packages/core/src/operator/tickets.ts +25 -4
- package/packages/core/src/plugins/manifest.ts +2 -1
- package/packages/core/src/ports/forge/contract.ts +2 -2
- package/packages/core/src/ports/forge/git-rewrite.ts +25 -2
- package/packages/core/src/ports/forge/github-readiness.ts +2 -2
- package/packages/core/src/ports/forge/github.ts +26 -7
- package/packages/core/src/ports/forge/local-git.ts +4 -4
- package/packages/core/src/ports/forge/readiness.ts +1 -1
- package/packages/core/src/ports/forge-failure.ts +24 -0
- package/packages/core/src/ports/runner/account-env.ts +88 -0
- package/packages/core/src/ports/runner/chatgpt-provider.ts +85 -0
- package/packages/core/src/ports/runner/claude.ts +26 -2
- package/packages/core/src/ports/runner/codex.ts +63 -31
- package/packages/core/src/ports/runner/one-shot.ts +2 -0
- package/packages/core/src/ports/runner/provider-error.ts +5 -0
- package/packages/core/src/ports/runner/routing.ts +35 -4
- package/packages/core/src/ports/tickets/contract.ts +58 -0
- package/packages/core/src/ports/tickets/tree.ts +1 -1
- package/packages/core/src/ports/types.ts +28 -7
- package/packages/core/src/ports/workspace/account-policy.ts +72 -0
- package/packages/core/src/ports/workspace/build-execution.ts +9 -2
- package/packages/core/src/ports/workspace/builtin-capabilities.ts +1 -0
- package/packages/core/src/ports/workspace/create.ts +2 -0
- package/packages/core/src/ports/workspace/git-worktree.ts +6 -1
- package/packages/core/src/ports/workspace/phase-scratch.ts +4 -3
- package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -0
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +182 -72
- package/packages/core/src/processes/build-child.ts +6 -8
- package/packages/core/src/processes/build-execution-state.ts +8 -5
- package/packages/core/src/processes/build-runner.ts +554 -99
- package/packages/core/src/processes/dispatcher.ts +209 -101
- package/packages/core/src/processes/execution-no-progress.ts +8 -1
- package/packages/core/src/processes/execution-settlement.ts +21 -3
- package/packages/core/src/processes/harvest-runner.ts +68 -8
- package/packages/core/src/processes/phase-failure-budget.ts +1 -0
- package/packages/core/src/processes/publication-loss.ts +8 -2
- package/packages/core/src/processes/publication-state.ts +42 -4
- package/packages/core/src/processes/repo-view.ts +14 -0
- package/packages/core/src/processes/verify-cycle-config.ts +96 -0
- package/packages/core/src/project-secrets.ts +105 -0
- package/packages/core/src/{integration → scenarios}/harness.ts +330 -317
- package/packages/core/src/secret-name.ts +41 -0
- package/packages/core/src/store/account-redaction.ts +156 -0
- package/packages/core/src/store/adapter.ts +1 -0
- package/packages/core/src/store/build-scope.ts +9 -0
- package/packages/core/src/store/contract.ts +116 -2
- package/packages/core/src/store/local/schema.ts +13 -0
- package/packages/core/src/store/local/store.ts +42 -0
- package/packages/core/src/store/memory.ts +47 -0
- package/packages/core/src/store/operator-presence.ts +21 -0
- package/packages/core/src/store/phase-session.ts +10 -0
- package/packages/core/src/store/reducer-value-shapes.json +5185 -4156
- package/packages/core/src/store/remote/client.ts +89 -48
- package/packages/core/src/store/remote/compatibility.ts +20 -0
- package/packages/core/src/store/remote/protocol.ts +4 -0
- package/packages/core/src/store/remote/version.ts +3 -1
- package/packages/core/src/store/retention.ts +2 -3
- package/packages/core/src/store/session-handle.ts +9 -0
- package/packages/core/src/store/streams/session-writer.ts +1 -1
- package/packages/core/src/store/types.ts +12 -2
- package/packages/core/src/testing/dispatch-read-budget.ts +122 -0
- package/packages/core/src/testing/index.ts +12 -1
- package/packages/core/src/testing/reduced-read-budget.ts +47 -0
- package/packages/core/src/testing/temp-directories.ts +58 -0
- package/skills/code-review/SKILL.md +23 -9
- package/skills/finalize/SKILL.md +15 -7
- package/skills/guide/SKILL.md +373 -148
- package/skills/guide/references/accounts.md +119 -0
- package/skills/guide/references/integration-tree.md +45 -38
- package/{docs/landing-policy.md → skills/guide/references/merge-policy.md} +40 -24
- package/skills/guide/references/migration-1.0.md +17 -13
- package/skills/guide/references/operator-api.md +180 -51
- package/skills/guide/references/plugin-authoring.md +21 -0
- package/skills/guide/references/remote-store-protocol.md +242 -68
- package/skills/guide/references/remote-ticket-protocol.md +30 -50
- package/skills/guide/references/restacking.md +54 -15
- package/skills/guide/references/setup.md +59 -119
- package/skills/guide/references/spec-standard.md +6 -6
- package/skills/guide/references/ticket-dependencies.md +7 -7
- package/skills/harvest/SKILL.md +3 -1
- package/skills/harvest-review/SKILL.md +3 -1
- package/skills/implement/SKILL.md +43 -17
- package/skills/operate/SKILL.md +118 -118
- package/skills/plan/SKILL.md +39 -13
- package/skills/plan-review/SKILL.md +15 -10
- package/skills/reconcile/SKILL.md +22 -3
- package/skills/spec/SKILL.md +20 -20
- package/skills/tickets/SKILL.md +12 -9
- package/templates/autobuild.toml +1 -1
- package/templates/hosted-service/package.json +2 -2
- package/docs/hosted-dispatcher-cutover-validation.md +0 -178
- package/docs/hosted-dispatcher.md +0 -275
- package/docs/hosted-service.md +0 -293
- package/docs/mcp.md +0 -149
- package/packages/core/src/orchestrator/approvals.ts +0 -115
- package/packages/core/src/orchestrator/conversation.ts +0 -167
- package/packages/core/src/orchestrator/model.ts +0 -86
- package/packages/core/src/orchestrator/prompt.ts +0 -63
- package/packages/core/src/orchestrator/tools.ts +0 -117
- package/packages/core/src/orchestrator/turn-runner.ts +0 -457
- 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
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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.
|
|
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: {
|
|
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 = `${
|
|
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(`${
|
|
87
|
-
allocated.add(`${
|
|
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
|