@defrex/autobuild 1.15.0 → 1.17.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 +1 -1
- package/SPEC.md +110 -10
- package/docs/answering-blocked-builds.md +34 -1
- package/docs/architecture.md +41 -7
- package/docs/configuration.md +41 -7
- package/docs/dispatcher-hosting.md +3 -0
- package/docs/operator-api.md +15 -5
- package/docs/plugin-authoring.md +1 -0
- package/docs/remote-store-protocol.md +13 -3
- package/docs/remote-ticket-protocol.md +3 -1
- package/docs/restacking.md +41 -1
- package/docs/setup.md +15 -6
- package/docs/troubleshooting.md +51 -3
- package/docs/workspaces.md +4 -1
- package/package.json +3 -3
- package/packages/core/src/cli/accounts.ts +3 -0
- package/packages/core/src/cli/binary-direct.ts +14 -1
- package/packages/core/src/cli/binary.ts +10 -7
- package/packages/core/src/cli/dispatch.ts +610 -356
- package/packages/core/src/cli/secrets.ts +2 -0
- package/packages/core/src/config/schema.ts +15 -2
- package/packages/core/src/events/payloads.ts +8 -5
- package/packages/core/src/events/repository.ts +12 -6
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/e28c68e63cbd265f.json +108 -0
- package/packages/core/src/kernel/engine.ts +118 -0
- package/packages/core/src/kernel/reconcile-restack.ts +72 -9
- package/packages/core/src/kernel/reducer-revisions.ts +1 -0
- package/packages/core/src/kernel/tracked-dirt.ts +173 -0
- package/packages/core/src/ontology.ts +1 -0
- package/packages/core/src/operator/index.ts +10 -0
- package/packages/core/src/operator/merged-builds.ts +51 -0
- package/packages/core/src/operator/registry.ts +190 -101
- package/packages/core/src/operator/repo-argument.ts +43 -0
- package/packages/core/src/ports/tickets/grants.ts +2 -0
- package/packages/core/src/ports/tickets/remote.ts +2 -0
- package/packages/core/src/ports/types.ts +25 -4
- package/packages/core/src/ports/workspace/vercel-command-diagnostics.ts +144 -0
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +811 -169
- package/packages/core/src/processes/build-child.ts +15 -1
- package/packages/core/src/processes/build-runner.ts +349 -20
- package/packages/core/src/processes/dispatcher.ts +509 -104
- package/packages/core/src/processes/harvest-child.ts +21 -1
- package/packages/core/src/processes/harvest-runner.ts +82 -35
- package/packages/core/src/processes/invocation-budget.ts +6 -0
- package/packages/core/src/processes/launch-cut.ts +37 -0
- package/packages/core/src/processes/phase-failure-budget.ts +1 -0
- package/packages/core/src/processes/provisioning-progress.ts +23 -0
- package/packages/core/src/processes/repo-view.ts +25 -4
- package/packages/core/src/processes/workspace-preparation.ts +1 -0
- package/packages/core/src/store/adapter.ts +34 -5
- package/packages/core/src/store/build-feed.ts +148 -22
- package/packages/core/src/store/build-scope.ts +12 -3
- package/packages/core/src/store/caller-attribution.ts +170 -0
- package/packages/core/src/store/contract.ts +1038 -165
- package/packages/core/src/store/local/schema.ts +12 -1
- package/packages/core/src/store/local/store.ts +260 -25
- package/packages/core/src/store/memory.ts +156 -9
- package/packages/core/src/store/phase-session.ts +23 -3
- package/packages/core/src/store/reducer-value-shapes.json +5351 -5338
- package/packages/core/src/store/remote/client.ts +90 -11
- package/packages/core/src/store/remote/credentials.ts +2 -0
- package/packages/core/src/store/remote/index.ts +31 -5
- package/packages/core/src/store/remote/protocol.ts +45 -8
- package/packages/core/src/store/remote/released-clients.json +22 -0
- package/packages/core/src/store/remote/released-reducer-values/1.16.0.json +36358 -0
- package/packages/core/src/store/remote/released-reducer-values/1.17.0.json +36367 -0
- package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
- package/packages/core/src/store/remote/released-value-policy.ts +7 -0
- package/packages/core/src/store/session-handle.ts +12 -3
- package/packages/core/src/store/types.ts +48 -3
- package/packages/core/src/testing/reduced-read-budget.ts +310 -12
- package/skills/guide/SKILL.md +58 -9
- package/skills/guide/references/operator-api.md +15 -5
- package/skills/guide/references/plugin-authoring.md +1 -0
- package/skills/guide/references/remote-store-protocol.md +13 -3
- package/skills/guide/references/remote-ticket-protocol.md +3 -1
- package/skills/guide/references/restacking.md +41 -1
- package/skills/guide/references/setup.md +15 -6
- package/skills/operate/SKILL.md +31 -7
- package/templates/hosted-service/package.json +2 -2
|
@@ -35,7 +35,9 @@ Every request is `POST /tickets/<operation>`, has `Content-Type: application/jso
|
|
|
35
35
|
and requires `Authorization: Bearer <project credential>`. Authentication and
|
|
36
36
|
registration checks precede body parsing and source construction. Owner admin
|
|
37
37
|
is the explicit cross-project exception; internal operator signatures have no
|
|
38
|
-
ticket authority.
|
|
38
|
+
ticket authority. Clients may also send the optional, diagnostic
|
|
39
|
+
`X-Autobuild-Caller` attribution header described in the remote store
|
|
40
|
+
protocol's transport conventions; the service never authorizes on it.
|
|
39
41
|
|
|
40
42
|
Project credentials are opaque `abp_1_<id>_<secret>` bearer values bound to one
|
|
41
43
|
registered normalized repository. The service stores only a SHA-256 digest of
|
package/docs/restacking.md
CHANGED
|
@@ -159,7 +159,8 @@ applies to nodes: a stale node cannot verify or merge; inventory and child merge
|
|
|
159
159
|
continue while it collects.
|
|
160
160
|
|
|
161
161
|
Restack and reconcile publication reject tracked modifications with the existing
|
|
162
|
-
clean-worktree error.
|
|
162
|
+
clean-worktree error. Before a replay, preparation handles them as described in
|
|
163
|
+
[Tracked dirt before preparation](#tracked-dirt-before-preparation). Nonignored untracked files do not block publication and
|
|
163
164
|
remain unpublished and untouched; each publication that encounters them records
|
|
164
165
|
a path-bearing `observation.recorded` followup, deduplicated by operation,
|
|
165
166
|
transaction, candidate SHA and exact path list on recovery. The phase-terminal
|
|
@@ -342,6 +343,45 @@ and `· N regenerated` or `· regeneration failed` to a node's restack lines.
|
|
|
342
343
|
`ab watch --event 'restack.*'` or `--event 'node.item-*'` shows each outcome.
|
|
343
344
|
Repositories that declare nothing restack exactly as before.
|
|
344
345
|
|
|
346
|
+
## Tracked dirt before preparation
|
|
347
|
+
|
|
348
|
+
Uncommitted changes to tracked files, typically left by `[commands].setup` on
|
|
349
|
+
a relaunch, never strand a restack or reconcile preparation:
|
|
350
|
+
|
|
351
|
+
| Dirt | Outcome |
|
|
352
|
+
|---|---|
|
|
353
|
+
| Only declared `[[generated]]` paths | Restored to `HEAD`, one `followup` observation recorded, replay proceeds |
|
|
354
|
+
| Any undeclared path | Preparation refuses, touches nothing, raises `policy/dirty-worktree` naming the undeclared paths |
|
|
355
|
+
|
|
356
|
+
The same classification runs again just before a completed automatic replay
|
|
357
|
+
or an intended candidate publishes, so a relaunch or crash at any point of the
|
|
358
|
+
replay cannot reach publication with dirt. A fresh automatic restack and a
|
|
359
|
+
fresh epilogue reconcile check before
|
|
360
|
+
`restack.prepared` or `reconcile.started`, so a refusal freezes nothing and
|
|
361
|
+
spends no phase-failure budget. Answering the escalation with guidance or a
|
|
362
|
+
bare retry returns the build to `implement`:
|
|
363
|
+
|
|
364
|
+
- **Nothing frozen.** `implement` runs with the question, its paths and the
|
|
365
|
+
answer as feedback.
|
|
366
|
+
- **Frozen, no publish intent.** The kernel records `reconcile.superseded
|
|
367
|
+
{cause: dirty-worktree}`, returns a workspace the replay left detached to
|
|
368
|
+
the build branch with the changes intact, then runs `implement`. If the
|
|
369
|
+
target also changed a dirty file, so Git cannot carry it, the changes are
|
|
370
|
+
first set aside as artifact `dirty-worktree-<escalation>`, as below. The
|
|
371
|
+
abandoned restack is decided again from the new head.
|
|
372
|
+
- **Frozen, publish intent recorded.** The candidate settles first: the
|
|
373
|
+
undeclared changes are stored as artifact `dirty-worktree-<escalation>` (a
|
|
374
|
+
byte-exact binary patch, captured without textconv or external diff
|
|
375
|
+
drivers) with observation `dirty-worktree:<escalation>:set-aside`,
|
|
376
|
+
restored, and the frozen candidate publishes as recorded. The `implement`
|
|
377
|
+
feedback names the artifact and how to re-apply it. If the set-aside runs
|
|
378
|
+
again before the restore (after a stop, or when relaunch setup rewrote a
|
|
379
|
+
path), a changed tree is stored as a new artifact revision first; it keeps
|
|
380
|
+
every file an earlier revision held, so the latest revision is complete.
|
|
381
|
+
|
|
382
|
+
Autobuild never commits or discards undeclared changes on its own, and the
|
|
383
|
+
escalation never needs an abort.
|
|
384
|
+
|
|
345
385
|
## Foreign merges
|
|
346
386
|
|
|
347
387
|
Before any replay or publication, inspect every merge's non-first-parent history,
|
package/docs/setup.md
CHANGED
|
@@ -101,10 +101,12 @@ Use the supported `vercel/sandbox/universal` image. Other managed images and
|
|
|
101
101
|
custom VCR images are rejected. Autobuild remains stack-neutral. For Vercel,
|
|
102
102
|
put repository-specific operating-system packages and machine-level tooling in
|
|
103
103
|
the ordered `[workspace.config].provisioning` list. Each strict `{ name,
|
|
104
|
-
command }` entry runs from the checkout through `sh -c` with
|
|
105
|
-
authority after pinned Bun is verified and before dependency
|
|
106
|
-
`[commands].setup`, or an agent. It runs once per fresh environment
|
|
107
|
-
on every replacement.
|
|
104
|
+
command, timeoutSeconds? }` entry runs from the checkout through `sh -c` with
|
|
105
|
+
provider root authority after pinned Bun is verified and before dependency
|
|
106
|
+
bootstrap, `[commands].setup`, or an agent. It runs once per fresh environment
|
|
107
|
+
and repeats on every replacement. A step runs under `timeoutSeconds` (default
|
|
108
|
+
600, at most 840); one that fails reports its name, redacted command and
|
|
109
|
+
output tails, and one that overruns also reports its elapsed time. Commands are declarative TOML string data, not evaluated
|
|
108
110
|
configuration logic. Local git worktrees never run this list; ensure their host
|
|
109
111
|
already has required system tooling.
|
|
110
112
|
|
|
@@ -121,7 +123,14 @@ allowlist entry; their real credentials remain on the dispatcher host.
|
|
|
121
123
|
|
|
122
124
|
Keep package-level and checkout-level bootstrap in an idempotent
|
|
123
125
|
`[commands].setup`. It runs after system provisioning and must remain safe to
|
|
124
|
-
rerun on attachment and after every restack onto a new base.
|
|
126
|
+
rerun on attachment and after every restack onto a new base. It must not modify
|
|
127
|
+
tracked files: tracked paths it newly changes outside `[[generated]]` block the
|
|
128
|
+
build with `policy/dirty-worktree` before the next phase runs, naming the paths.
|
|
129
|
+
The check is skipped when that phase is a `reconcile`, whose resolver works on
|
|
130
|
+
its own in-progress replay, and while an answered dirty-worktree recovery is
|
|
131
|
+
pending. A restack or reconcile preparation still classifies any tracked dirt
|
|
132
|
+
before it replays. Declare tracked codegen outputs it rewrites in
|
|
133
|
+
`[[generated]]`; those are tolerated and discarded before any replay. Do not repeatedly install OS packages there. Expose only
|
|
125
134
|
required runtime credentials through
|
|
126
135
|
`[workspace.config].environmentVariables`, keep generated caches disposable,
|
|
127
136
|
and lock dependencies in the repository. A browser-capable repository should
|
|
@@ -162,7 +171,7 @@ For Vercel it identifies and permanently deletes a fresh unnamed sandbox, even
|
|
|
162
171
|
when system or runtime provisioning, setup, or a probe fails; cleanup failures
|
|
163
172
|
name the environment for manual deletion. Its `system provisioning` check lists
|
|
164
173
|
completed step names (or says none were declared) before guest setup checks. A
|
|
165
|
-
failed step reports its name, command, status,
|
|
174
|
+
failed step reports its name, command, status or timeout, stderr/stdout tails, and
|
|
166
175
|
remediation without marking the environment ready. It provisions/preflights
|
|
167
176
|
every effective primary and alternate runtime, then runs `commands.setup`, loads
|
|
168
177
|
repository plugins, and checks every
|
package/docs/troubleshooting.md
CHANGED
|
@@ -131,20 +131,50 @@ See [answering blocked builds](operating.md#answer-and-pause). Preserve event lo
|
|
|
131
131
|
A step the invocation deadline defers is not a failure:
|
|
132
132
|
|
|
133
133
|
- It charges no infrastructure attempt.
|
|
134
|
-
- The dispatch log names it: `build <slug>: <step> deferred by the invocation budget`.
|
|
134
|
+
- The dispatch log names it: `build <slug>: <step> deferred by the invocation budget`. The step is `provision`, `launch` or a recovery step.
|
|
135
135
|
- The tick counts it as `recoveryDeferred` (or `provisioningDeferred`) and never reports `tick: idle`.
|
|
136
|
-
- The next invocation runs
|
|
136
|
+
- The build keeps its slot, and the next invocation runs it first.
|
|
137
|
+
- A `launch` the deadline cut never waits on a lease TTL. Teardown fences the sandbox when the start was requested, then releases the lease; the next invocation's first stage finishes whatever teardown couldn't.
|
|
137
138
|
|
|
138
139
|
See [Vercel sandbox recovery](configuration.md#vercel-sandbox).
|
|
139
140
|
|
|
140
141
|
## A build stays STARTING with repeated deferral lines
|
|
141
142
|
|
|
142
|
-
**Symptom.** The same build logs `resume
|
|
143
|
+
**Symptom.** The same build logs `resume`, `provision` or `launch deferred by the invocation budget` on several invocations in a row, and stays STARTING.
|
|
143
144
|
|
|
144
145
|
**Cause.** Even with the build served first, the hosted invocation budget can't fit the work. A provision needs about 150 s; a resume needs about 105 s by default (a realistic resume plus the cleanup reserve).
|
|
145
146
|
|
|
146
147
|
**Action.** Report it to the instance operator: the invocation budget is too small for this work. Retrying the build doesn't help.
|
|
147
148
|
|
|
149
|
+
A repeating `fence deferred by the invocation budget` line with an infrastructure failure at step `fence` is different: the provider can't confirm the sandbox stopped, so the cut launch's lease is kept and nothing relaunches. Check the sandbox in the provider.
|
|
150
|
+
|
|
151
|
+
## A provision is cut off at teardown on several invocations
|
|
152
|
+
|
|
153
|
+
**Symptom.** A STARTING build records `provisioning abandoned at dispatcher teardown during <stage> after <N>s` on more than one invocation.
|
|
154
|
+
|
|
155
|
+
**Cause.** The provision is longer than one invocation. That is normal: each invocation resumes the same sandbox after its last completed stage, at the commit it cloned, so the provision still finishes.
|
|
156
|
+
|
|
157
|
+
**Action.** If the same stage repeats, it outlasts the invocation or hangs, for example a `provisioning` step stuck on an unreachable package mirror:
|
|
158
|
+
|
|
159
|
+
1. Set that step's `timeoutSeconds` below the invocation budget. A hang then fails promptly as a charged infrastructure failure with its output, and escalates after `maxInfrastructureAttempts`.
|
|
160
|
+
2. Report the stage to the instance operator.
|
|
161
|
+
|
|
162
|
+
## A sandbox provisioning command fails or times out
|
|
163
|
+
|
|
164
|
+
**Symptom.** `bun ab build status`, `dispatch.failed`, a `requires dispatcher-authorized cleanup` message, an infrastructure failure, or a setup escalation quotes `sandbox command <cmd> exited <N>` or `sandbox command <cmd> exceeded its <T>s provisioning timeout after <E>s`.
|
|
165
|
+
|
|
166
|
+
**Reading it.** The message carries:
|
|
167
|
+
|
|
168
|
+
- `stage:` the provisioning stage, such as `checkout`, `bun install`, `system provisioning step <name>`, `dependency install` or `runtime bootstrap <runtime> preflight`
|
|
169
|
+
- `argv:` the command line, with tokens, passwords and authorization headers redacted
|
|
170
|
+
- `cwd:` the guest working directory
|
|
171
|
+
- `stderr (tail):` and `stdout (tail):` the last lines of output, or `output: unavailable (…)` when it could not be read
|
|
172
|
+
|
|
173
|
+
**Action.**
|
|
174
|
+
|
|
175
|
+
- **Exit status:** fix the cause the stderr tail names. For a `provisioning` step, reproduce with `bun ab init --validate`.
|
|
176
|
+
- **Timeout:** check the upstream service the step depends on. Raise its `timeoutSeconds` (at most 840) only when it is genuinely that slow.
|
|
177
|
+
|
|
148
178
|
## A stage keeps stopping at the work deadline
|
|
149
179
|
|
|
150
180
|
**Symptom.** Hosted invocations log `tick: work deadline reached during <stage>`, or `ab repository status` shows `last pass stages: … stopped by the work deadline during …` on pass after pass.
|
|
@@ -163,6 +193,24 @@ stages: settlement 3.1s 6/11 (executions 5/9, harvest 1/2, sandboxes 0/0) · jan
|
|
|
163
193
|
|
|
164
194
|
**Action.** Report the stage and part to the instance operator with the `stages:` lines from several invocations. A stage stopped by `share` alone is normal under load.
|
|
165
195
|
|
|
196
|
+
## Store traffic burst or database pressure
|
|
197
|
+
|
|
198
|
+
**Symptom.** The store's database is saturated, store requests answer `503`, or request volume jumps with no obvious cause.
|
|
199
|
+
|
|
200
|
+
**Reading the lines.** Every Autobuild client names itself on store and ticket requests with the [`X-Autobuild-Caller` header](remote-store-protocol.md#1-transport-and-conventions). The hosted store service logs one `"type":"autobuild.store-request"` line per request:
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{"type":"autobuild.store-request","method":"GET","path":"/repos/…/events","backend":"store","status":200,"ms":41,"caller":{"kind":"dispatcher","run":"host-dispatch-a1","stage":"janitor"},"principal":{"kind":"project","purpose":"dispatcher","credential":"…"}}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
- **`caller.kind`:** `dispatcher` (with `invocation`, `run` and pass `stage`), `runner` (`build` or `harvest`, with the build slug or harvest run), or `operator` (`cli`, `mcp` or `web`).
|
|
207
|
+
- **`caller.stage`:** the pass stage that made the request, `setup` before a hosted run starts, or `teardown`. Work a stage starts, such as provisioning or a harvest trigger, carries that stage.
|
|
208
|
+
- **`caller: null`:** an older client or a non-Autobuild caller. `principal` still names the credential kind.
|
|
209
|
+
|
|
210
|
+
**Cause.** Usually one caller polling or replaying: a stage revisiting many builds, an operator watch, or an older client.
|
|
211
|
+
|
|
212
|
+
**Action.** Count a window of lines by `caller.kind` and `caller.stage` (or `caller.run`, `caller.build`), and report the callers and stages that dominate to the instance operator with a few sample lines.
|
|
213
|
+
|
|
166
214
|
## Remote project access
|
|
167
215
|
|
|
168
216
|
**Symptom.** Remote requests refuse a project despite a configured URL.
|
package/docs/workspaces.md
CHANGED
|
@@ -115,6 +115,8 @@ Sandbox preparation order:
|
|
|
115
115
|
|
|
116
116
|
- **Runtimes.** Every primary and alternate runtime needs a pinned install and exact-version preflight, and gets only the credentials named in `environmentVariables`, except declared [accounts](configuration-overview.md#accounts), whose credentials remain on the host and are brokered by egress policy using guest placeholders.
|
|
117
117
|
- **Repetition.** New sandboxes repeat provisioning and preflights rerun before each build-runner; keep setup idempotent.
|
|
118
|
+
- **Resumption.** A provision cut off by a dispatcher teardown resumes in place on the next invocation, at the commit it cloned. Stages already completed with unchanged inputs (checkout, Bun, each `provisioning` step, distribution, dependencies, runtime installs) are skipped; a stage whose inputs changed reruns with every stage after it.
|
|
119
|
+
- **Timeouts.** Each `provisioning` step runs under its `timeoutSeconds` (default 600 s, at most 840 s); Bun, distribution, dependency and runtime stages have fixed bounds. The sandbox kills a step that overruns, and provisioning fails with the stage, command, elapsed time and output so far, charged like any infrastructure failure. A dispatcher teardown instead abandons the stage uncharged and names it, with its elapsed time, in `dispatch.failed`.
|
|
118
120
|
- **Validation.** `bun ab init --validate` runs named provisioning, setup, runtime and Store checks in a disposable environment, deletes it even on failure, and starts no build. For every declared account, including unused accounts, it runs a tool-free model probe through the account's runtime (Claude Code for Claude/Kimi, Codex for ChatGPT); these probes create no ordinary build phase or persistent agent session. Hosted ChatGPT, Claude and Kimi project secrets report readiness from write-only status metadata instead; the first hosted build is the live check.
|
|
119
121
|
- **Lifetime.** `timeoutSeconds` bounds a sandbox; provider operations have their own timeouts. An intact sandbox resumes. Before replacement, the dispatcher fences it, preserves reachable unpublished commits to build-private archive refs or, where the forge refuses them, BuildStore copies, and records a receipt; the next workspace restores those commits. Loss is limited to already absent or unrecoverable work and uncommitted files; known loss appears in the next session's recovery context. See the [workspace recovery contract](architecture.md#key-boundaries).
|
|
120
122
|
|
|
@@ -154,4 +156,5 @@ The suite certifies only the basic working copy. Remote execution adds trusted s
|
|
|
154
156
|
- Publication reports confirmed SHA and cache tips and supports the required guarded rewrites.
|
|
155
157
|
- Store grants go through the host's `delegateCredential` callback; never serialize host tokens into execution identity.
|
|
156
158
|
- An optional `provisionEstimateMs` declares the expected wall time of one `provision`; a bounded dispatcher invocation does not start provisioning with less budget left.
|
|
157
|
-
- `provision` may receive `
|
|
159
|
+
- `provision` may receive `signal`, the invocation's teardown token: abort in-flight work promptly and record nothing, since the dispatcher records the abandonment. It may also receive `onProgress`: report each stage just before it runs, so a teardown can name it; never throw from it.
|
|
160
|
+
- `provision` may receive `adoptAbandoned` when the previous attempt at the same generation was cut off by a recorded dispatcher teardown. Finish that environment in place only after verifying it, resuming from verified progress and keeping the commit it already holds; otherwise throw `WorkspaceCleanupRequired`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defrex/autobuild",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "Agent-driven software delivery from groomed ticket to merged PR",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -162,8 +162,8 @@
|
|
|
162
162
|
},
|
|
163
163
|
"devDependencies": {
|
|
164
164
|
"@biomejs/biome": "2.5.5",
|
|
165
|
-
"@defrex/autobuild-postgres-store": "1.
|
|
166
|
-
"@defrex/autobuild-vercel-sandbox": "1.
|
|
165
|
+
"@defrex/autobuild-postgres-store": "1.17.0",
|
|
166
|
+
"@defrex/autobuild-vercel-sandbox": "1.17.0",
|
|
167
167
|
"@resvg/resvg-js": "2.6.2",
|
|
168
168
|
"@types/bun": "^1.3.14",
|
|
169
169
|
"@types/node": "^24.0.0",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { storeCallerHeaders } from '../store/caller-attribution'
|
|
1
2
|
import { join } from 'node:path'
|
|
2
3
|
import { connectedProject } from './connect'
|
|
3
4
|
import { parseLayeredConfig, readLocalConfig } from '../config/local'
|
|
@@ -55,6 +56,7 @@ export async function abAccountsLogin(
|
|
|
55
56
|
{
|
|
56
57
|
headers: {
|
|
57
58
|
authorization: `Bearer ${credential!.token}`,
|
|
59
|
+
...storeCallerHeaders(),
|
|
58
60
|
[AUTOBUILD_VERSION_HEADER]: AUTOBUILD_VERSION,
|
|
59
61
|
[REMOTE_STORE_PROTOCOL_VERSION_HEADER]: REMOTE_STORE_PROTOCOL_VERSION,
|
|
60
62
|
},
|
|
@@ -125,6 +127,7 @@ export async function abAccountsLogin(
|
|
|
125
127
|
headers: {
|
|
126
128
|
'content-type': 'application/json',
|
|
127
129
|
authorization: `Bearer ${credential!.token}`,
|
|
130
|
+
...storeCallerHeaders(),
|
|
128
131
|
[AUTOBUILD_VERSION_HEADER]: AUTOBUILD_VERSION,
|
|
129
132
|
[REMOTE_STORE_PROTOCOL_VERSION_HEADER]: REMOTE_STORE_PROTOCOL_VERSION,
|
|
130
133
|
},
|
|
@@ -10,6 +10,7 @@ import { openProductionStore } from './store-opening'
|
|
|
10
10
|
*/
|
|
11
11
|
import { join } from 'node:path'
|
|
12
12
|
import { isSessionlessInvocation, runCli } from './main'
|
|
13
|
+
import { cliStoreCaller, withStoreCaller } from '../store/caller-attribution'
|
|
13
14
|
import { createUpgradeAgentResolver } from './upgrade-agent'
|
|
14
15
|
import { loadDotEnv } from './dotenv'
|
|
15
16
|
import {
|
|
@@ -43,10 +44,22 @@ import {
|
|
|
43
44
|
withDispatchTerminalRestore,
|
|
44
45
|
} from './binary-lifecycle'
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
/** Every hosted request this invocation makes is attributed to the command
|
|
48
|
+
* that made it (a runner session, an operator command, or a dispatcher). */
|
|
49
|
+
export function runDirectBinary(
|
|
47
50
|
argv: string[],
|
|
48
51
|
resolveDashboardRenderer?: DashboardRendererResolver,
|
|
49
52
|
options: { supervised?: boolean } = {},
|
|
53
|
+
): Promise<number> {
|
|
54
|
+
return withStoreCaller(cliStoreCaller(argv, process.env), () =>
|
|
55
|
+
runDirectBinaryInScope(argv, resolveDashboardRenderer, options),
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function runDirectBinaryInScope(
|
|
60
|
+
argv: string[],
|
|
61
|
+
resolveDashboardRenderer: DashboardRendererResolver | undefined,
|
|
62
|
+
options: { supervised?: boolean },
|
|
50
63
|
): Promise<number> {
|
|
51
64
|
const command = argv[0]
|
|
52
65
|
// Version identity is installation-local and offline; do not inspect even a
|
|
@@ -3,6 +3,7 @@ import { join } from 'node:path'
|
|
|
3
3
|
import type { DashboardRendererResolver } from './dashboard/render'
|
|
4
4
|
import { loadDotEnv } from './dotenv'
|
|
5
5
|
import { parseDispatchArgs } from './dispatch-args'
|
|
6
|
+
import { withStoreCaller } from '../store/caller-attribution'
|
|
6
7
|
import { DISPATCH_GENERATION_ENV, DISPATCH_CONDITIONAL_ENV } from './dispatch-launch-contract'
|
|
7
8
|
export {
|
|
8
9
|
usesGenericSessionlessSigintHandler,
|
|
@@ -29,13 +30,15 @@ export async function runBinary(
|
|
|
29
30
|
const args = parseDispatchArgs(argv.slice(1), process.env)
|
|
30
31
|
if (!args.viewer && !args.once && !args.repository) {
|
|
31
32
|
const { selectDispatchMode } = await import('./dispatch-mode')
|
|
32
|
-
const mode = await
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
const mode = await withStoreCaller({ kind: 'dispatcher' }, () =>
|
|
34
|
+
selectDispatchMode({
|
|
35
|
+
...args,
|
|
36
|
+
targetRepo: process.cwd(),
|
|
37
|
+
env: process.env,
|
|
38
|
+
exec: spawnExec,
|
|
39
|
+
stderr: console.error,
|
|
40
|
+
}),
|
|
41
|
+
)
|
|
39
42
|
if (!mode.viewer) {
|
|
40
43
|
const { launchDispatcher } = await import('./dispatch-launcher')
|
|
41
44
|
return await launchDispatcher(argv)
|