@outerlayer/cli 0.38.0-next.20261112002049 → 0.38.0-next.20261112043334

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 (47) hide show
  1. package/README.md +7 -0
  2. package/dist/{build-SD44TP2B.js → build-FNUOBMFG.js} +1 -1
  3. package/dist/build-info.json +1 -1
  4. package/dist/{check-JNQVYVHI.js → check-6JV4M2U6.js} +8 -8
  5. package/dist/{chunk-T4FSZ7LA.js → chunk-2PJO6QS2.js} +2 -2
  6. package/dist/{chunk-C4R6LMPQ.js → chunk-37WGI6GZ.js} +6 -5
  7. package/dist/{chunk-Q7J4T2VP.js → chunk-5AVYYNGU.js} +21 -1
  8. package/dist/{chunk-ZU6LNR3G.js → chunk-6M3GJTGE.js} +1 -1
  9. package/dist/{chunk-OTWTUHWY.js → chunk-BBIFZCCB.js} +142 -29
  10. package/dist/{chunk-VRDHLSR2.js → chunk-C5NJHYLO.js} +4 -4
  11. package/dist/{chunk-5OSY3LK3.js → chunk-DNXYI22V.js} +1 -1
  12. package/dist/{chunk-ZUUA6ZGD.js → chunk-KRYTOYH5.js} +104 -40
  13. package/dist/{chunk-3VWX5BYV.js → chunk-LM2MCACJ.js} +2 -2
  14. package/dist/{chunk-OYRAQXRQ.js → chunk-LSU3LXDM.js} +1 -1
  15. package/dist/{chunk-VV445Q2R.js → chunk-RTMIEV5N.js} +1 -1
  16. package/dist/{chunk-VBSKVGWP.js → chunk-SFN7K33S.js} +1 -1
  17. package/dist/{cli-2FFCAE62.js → cli-7MJFFRYI.js} +59 -59
  18. package/dist/{command-ASXZLHXU.js → command-XLJ75AS5.js} +5 -5
  19. package/dist/{container-start-6FHPPHMU.js → container-start-F6T3JPRM.js} +6 -6
  20. package/dist/{doctor-FATFZWEA.js → doctor-F7TCZO3O.js} +6 -6
  21. package/dist/{governing-source-C7MY7KB2.js → governing-source-R64FW4CP.js} +2 -2
  22. package/dist/{host-checks-CZGNR4VC.js → host-checks-VWWXDWV2.js} +4 -4
  23. package/dist/index.js +1 -1
  24. package/dist/{init-WDYDTJW2.js → init-OIHCYS4S.js} +4 -4
  25. package/dist/{init-5S6A2SYN.js → init-W4X47BR5.js} +4 -4
  26. package/dist/{init-agent-PJFH7OFD.js → init-agent-QQF3VGIJ.js} +4 -4
  27. package/dist/{init-cmd-5SCU7AVL.js → init-cmd-QXAL75UY.js} +2 -2
  28. package/dist/{init-update-6EJKXKFH.js → init-update-G5MKJ7RO.js} +4 -3
  29. package/dist/{loop-Q76PDO7L.js → loop-U5AUIWQG.js} +8 -8
  30. package/dist/{machine-GI6SZMEK.js → machine-6DFKQ3LQ.js} +4 -4
  31. package/dist/{run-cmd-M5THCWDD.js → run-cmd-U3MPDIT5.js} +1 -1
  32. package/dist/{runner-key-ZXNXWBSP.js → runner-key-WZXU64C7.js} +4 -4
  33. package/dist/{spec-cmd-4EB45ELL.js → spec-cmd-DHCZHM2L.js} +1 -1
  34. package/dist/{status-R4JD34DO.js → status-QBQAN35R.js} +4 -4
  35. package/dist/{update-steps-CGWJJ2IA.js → update-steps-QRRCMRL4.js} +5 -5
  36. package/dist/{work-claim-cmd-4KQYRNRC.js → work-claim-cmd-QDNRGX2N.js} +2 -2
  37. package/dist/{work-cmd-GNYWSA2O.js → work-cmd-3BDBBKGG.js} +1 -1
  38. package/dist/{work-comment-cmd-7D3DHQ3O.js → work-comment-cmd-2HI4FP5R.js} +2 -2
  39. package/dist/{work-demo-cmd-PDILNMRF.js → work-demo-cmd-RXV5DRM3.js} +1 -1
  40. package/dist/{work-logs-cmd-ER3AYV62.js → work-logs-cmd-Q7YA3AHY.js} +1 -1
  41. package/dist/{work-needs-attention-cmd-MAFPEANV.js → work-needs-attention-cmd-WAWSJIHS.js} +1 -1
  42. package/dist/{work-no-change-cmd-GDN5EE6N.js → work-no-change-cmd-NTXYEPEW.js} +1 -1
  43. package/dist/{work-open-pr-cmd-56TRIE5I.js → work-open-pr-cmd-GFIMFDAR.js} +1 -1
  44. package/dist/{work-proofs-cmd-Y2OMM37N.js → work-proofs-cmd-DSDVAM6V.js} +2 -2
  45. package/dist/{work-proofs-record-I2VLOMRD.js → work-proofs-record-AC5UQ2ME.js} +3 -3
  46. package/dist/{work-stop-cmd-PREZOSNY.js → work-stop-cmd-UGFPCTRT.js} +1 -1
  47. package/package.json +1 -1
package/README.md CHANGED
@@ -378,6 +378,13 @@ content:
378
378
  request closes, or after `runner.housekeeping.workspaceKeepDays`, which is
379
379
  one day on a runner with these hooks. It never ends a sandbox that a job
380
380
  runs in.
381
+ Before a build, the runner fetches the devcontainer file of the control
382
+ plane that governs it, or of the repository itself, into its own
383
+ directory, with the claim's read token. It builds no image from the file.
384
+ A runner that starts again after a crash adopts each build whose sandbox
385
+ still runs. It asks the provider for the sandbox again, reads the join
386
+ secret back from the sandbox through the data plane, starts a new tunnel
387
+ and opens a new WebSocket to the relay.
381
388
  When a build ends, the runner reads the build's agent session out of the
382
389
  sandbox through the data plane, as base64 text, and keeps it on its own
383
390
  host. It puts the kept session into the sandbox of the work item's next
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- export { KEY_PREFIX, SHARED_NAME, SHARED_OWNER, SHARED_REPOSITORY, TAG_HOST, UNIVERSAL_SOURCE_LABEL, baseLines, buildRepositoryImage, metadataFromLabels, prepareImageBuild, universalBase, writeRecord } from './chunk-Q7J4T2VP.js';
3
+ export { KEY_PREFIX, SHARED_NAME, SHARED_OWNER, SHARED_REPOSITORY, TAG_HOST, UNIVERSAL_SOURCE_LABEL, baseLines, buildRepositoryImage, metadataFromLabels, prepareImageBuild, readRepositoryRecipe, universalBase, writeRecord } from './chunk-5AVYYNGU.js';
4
4
  import './chunk-NO4N4D32.js';
5
5
  import './chunk-NDQC2WUJ.js';
6
6
  import './chunk-JBJTC3UU.js';
@@ -1 +1 @@
1
- {"id":"2026-11-12T00:28:13.899Z","root":"/home/runner/work/outerlayer/outerlayer","pkg":"outerlayer"}
1
+ {"id":"2026-11-12T04:40:51.675Z","root":"/home/runner/work/outerlayer/outerlayer","pkg":"outerlayer"}
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { probeCredentials } from './chunk-ZUUA6ZGD.js';
3
+ import { probeCredentials } from './chunk-KRYTOYH5.js';
4
4
  import './chunk-3JVYMD4G.js';
5
- import './chunk-T4FSZ7LA.js';
5
+ import './chunk-2PJO6QS2.js';
6
6
  import './chunk-E7R2GIAW.js';
7
7
  import './chunk-6X2BSMRM.js';
8
8
  import './chunk-WFYKTAXZ.js';
9
- import './chunk-VV445Q2R.js';
9
+ import './chunk-RTMIEV5N.js';
10
10
  import './chunk-2UCTMANO.js';
11
- import { fleetConfigProblem, managedProblems, managedFactsOf, askFleetMachine } from './chunk-C4R6LMPQ.js';
11
+ import { fleetConfigProblem, managedProblems, managedFactsOf, askFleetMachine } from './chunk-37WGI6GZ.js';
12
12
  import './chunk-POBH5YCG.js';
13
13
  import { findServiceUnit } from './chunk-OAPWDSBW.js';
14
- import { placeholderQueues, placeholderProblem, permissionModeProblems, permissionModeProblem, HELPER_ENV, helperSocketPath, probeHelper, needsAgentCredential, agentCredentialCheck, claimPermissionProblem, formerSkillQueues, modellessQueues, formerSkillProblem, modellessProblem } from './chunk-OTWTUHWY.js';
14
+ import { placeholderQueues, placeholderProblem, permissionModeProblems, permissionModeProblem, HELPER_ENV, helperSocketPath, probeHelper, needsAgentCredential, agentCredentialCheck, claimPermissionProblem, formerSkillQueues, modellessQueues, formerSkillProblem, modellessProblem } from './chunk-BBIFZCCB.js';
15
15
  import './chunk-722KABMV.js';
16
16
  import './chunk-KVWFAAAQ.js';
17
17
  import './chunk-2PGI6RDE.js';
@@ -30,15 +30,15 @@ import './chunk-UXARYJQ4.js';
30
30
  import './chunk-TQMI335S.js';
31
31
  import './chunk-RCK2MJRG.js';
32
32
  import './chunk-NN33FYXG.js';
33
- import './chunk-Q7J4T2VP.js';
33
+ import './chunk-5AVYYNGU.js';
34
34
  import './chunk-NO4N4D32.js';
35
35
  import './chunk-NDQC2WUJ.js';
36
36
  import './chunk-JBJTC3UU.js';
37
37
  import './chunk-OGFGZQA3.js';
38
38
  import './chunk-BBRXFXBB.js';
39
39
  import './chunk-NRDFBOKE.js';
40
- import './chunk-VBSKVGWP.js';
41
- import './chunk-5OSY3LK3.js';
40
+ import './chunk-SFN7K33S.js';
41
+ import './chunk-DNXYI22V.js';
42
42
  import './chunk-2VJVPP5Y.js';
43
43
  import './chunk-5UFAWMET.js';
44
44
  import { loadRunnerConfig, RunnerConfigError, checkHooks, keyRunnerFactory } from './chunk-EUHUIIGT.js';
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { scrubReason, stripTerminalControls } from './chunk-OTWTUHWY.js';
3
+ import { scrubReason, stripTerminalControls } from './chunk-BBIFZCCB.js';
4
4
  import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-WG5OBUIZ.js';
5
5
  import { RunnerAlreadyRunningError, readPidFile } from './chunk-NDQC2WUJ.js';
6
6
  import { isSameProcess } from './chunk-JBJTC3UU.js';
7
- import { isSignatureRefusal, postJson } from './chunk-5OSY3LK3.js';
7
+ import { isSignatureRefusal, postJson } from './chunk-DNXYI22V.js';
8
8
  import { keyRunnerFactory } from './chunk-EUHUIIGT.js';
9
9
  import { signerFor } from './chunk-I5U6CFH4.js';
10
10
  import { pidFilePath } from './chunk-JIANCWJ3.js';
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { placeholderQueues, placeholderProblem } from './chunk-OTWTUHWY.js';
3
+ import { placeholderQueues, placeholderProblem } from './chunk-BBIFZCCB.js';
4
4
  import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-WG5OBUIZ.js';
5
- import { getJson, WorkCommandError } from './chunk-5OSY3LK3.js';
5
+ import { getJson, WorkCommandError } from './chunk-DNXYI22V.js';
6
6
  import { isBuiltinVm, builtinKind, EGRESS_SWITCHABLE_KEYS, imageBuildOf, keepsHostBuilder } from './chunk-EUHUIIGT.js';
7
7
  import { realBuildDiskProbe, checkDiskFit, DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK } from './chunk-3C23ZPWR.js';
8
8
  import { ensureHostKey } from './chunk-I5U6CFH4.js';
@@ -73,10 +73,11 @@ function sliceMemoryOf(env) {
73
73
  }
74
74
  function managedProblems(facts, agents = defaultAgents()) {
75
75
  const problems = [];
76
- if (builtinKind(facts.provision) !== "vm") {
76
+ const kind = builtinKind(facts.provision);
77
+ if (kind === "sandbox") ; else if (kind !== "vm") {
77
78
  problems.push({
78
79
  condition: "jailer",
79
- reason: `a managed runner needs builtin:vm hooks, and runner.hooks.provision is ${facts.provision}. Without them builds would run without the jailer. Set runner.hooks.provision and runner.hooks.cleanup to builtin:vm`
80
+ reason: `a managed runner needs builtin:vm or builtin:sandbox hooks, and runner.hooks.provision is ${facts.provision}. Without them a build would not run in a machine of its own. Set runner.hooks.provision and runner.hooks.cleanup to builtin:vm or to builtin:sandbox`
80
81
  });
81
82
  } else if (facts.jailer === "usable") ; else if (facts.jailer === "unknown") {
82
83
  problems.push({ condition: "jailer", reason: "the runner has not yet asked the root helper whether builds run under the jailer, so builds would run without the jailer until it answers" });
@@ -107,7 +108,7 @@ function managedProblems(facts, agents = defaultAgents()) {
107
108
  reason: `${off.map((key) => `runner.build.egress.${key}`).join(" and ")} ${off.length === 1 ? "is" : "are"} 0, which turns ${off.length === 1 ? "that limit" : "those limits"} off. A managed runner limits how fast a build opens connections and sends bytes, because every organization on the host shares one address. Remove ${off.length === 1 ? "the key" : "the keys"} to use the default, or set a value above 0`
108
109
  });
109
110
  }
110
- if (builtinKind(facts.provision) === "vm") {
111
+ if (kind === "vm") {
111
112
  if (facts.imageBuild === "host") {
112
113
  problems.push({
113
114
  condition: "imageBuild",
@@ -370,6 +370,26 @@ async function prepareImageBuild(opts) {
370
370
  throw err;
371
371
  }
372
372
  }
373
+ var recipeReads = /* @__PURE__ */ new Map();
374
+ async function readRepositoryRecipe(opts) {
375
+ const { full: repository, owner, name } = splitRepository(opts.repository);
376
+ const cacheDir = repoCacheDir(opts.configPath, owner, name, opts.organizationId);
377
+ const read = async () => {
378
+ const remote = opts.remote ?? `https://github.com/${owner}/${name}.git`;
379
+ const checkout = opts.pinned === void 0 ? await fetchDefaultBranch({ remote, dir: cacheDir, token: opts.readToken, repository }) : await fetchPinnedCommit({ remote, dir: cacheDir, token: opts.readToken, repository, ...opts.pinned });
380
+ const location = locateRecipe(checkout.dir);
381
+ const recipe = readRecipe(checkout.dir, location);
382
+ return {
383
+ sourceCommit: checkout.commit,
384
+ path: location.kind === "default" ? "default" : location.path,
385
+ key: recipeKey(checkout.dir, location, UNIVERSAL_IMAGE),
386
+ classification: classifyProperties(recipe, [])
387
+ };
388
+ };
389
+ const next = (recipeReads.get(cacheDir) ?? Promise.resolve()).catch(() => void 0).then(read);
390
+ recipeReads.set(cacheDir, next);
391
+ return next;
392
+ }
373
393
  async function buildRepositoryImage(opts, ports) {
374
394
  const { host } = ports;
375
395
  const now = opts.now ?? (() => /* @__PURE__ */ new Date());
@@ -525,4 +545,4 @@ async function prune(host, repository, repoRecords, keep, runnerDirPath, runnerL
525
545
  return removed;
526
546
  }
527
547
 
528
- export { KEY_PREFIX, SHARED_NAME, SHARED_OWNER, SHARED_REPOSITORY, TAG_HOST, UNIVERSAL_SOURCE_LABEL, baseLines, buildRepositoryImage, diffBetween, fetchCommit, metadataFromLabels, prepareImageBuild, readBranchHead, readDefaultBranchFiles, readDefaultBranchHead, universalBase, writeRecord };
548
+ export { KEY_PREFIX, SHARED_NAME, SHARED_OWNER, SHARED_REPOSITORY, TAG_HOST, UNIVERSAL_SOURCE_LABEL, baseLines, buildRepositoryImage, diffBetween, fetchCommit, metadataFromLabels, prepareImageBuild, readBranchHead, readDefaultBranchFiles, readDefaultBranchHead, readRepositoryRecipe, universalBase, writeRecord };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { helperSocketPath } from './chunk-OTWTUHWY.js';
3
+ import { helperSocketPath } from './chunk-BBIFZCCB.js';
4
4
  import { UNIT_MARKER } from './chunk-WG5OBUIZ.js';
5
5
  import { runnerDir } from './chunk-JIANCWJ3.js';
6
6
  import { createHash } from 'crypto';
@@ -14,25 +14,25 @@ import { readsJobState, READ_JOB_STATE_FORMATS, jobStateFormatOf } from './chunk
14
14
  import { runnerImageVersion } from './chunk-UXARYJQ4.js';
15
15
  import { claimCalls, spoolHomeFor, itemCalls, claimItem, leftByRunnerKey, configForJob } from './chunk-RCK2MJRG.js';
16
16
  import { receiveFiles } from './chunk-NN33FYXG.js';
17
- import { readDefaultBranchFiles, readDefaultBranchHead, buildRepositoryImage, fetchCommit, readBranchHead, diffBetween, prepareImageBuild, KEY_PREFIX, TAG_HOST, SHARED_OWNER, SHARED_NAME, universalBase, metadataFromLabels, writeRecord } from './chunk-Q7J4T2VP.js';
17
+ import { readDefaultBranchFiles, readDefaultBranchHead, buildRepositoryImage, readRepositoryRecipe, fetchCommit, readBranchHead, diffBetween, prepareImageBuild, KEY_PREFIX, TAG_HOST, SHARED_OWNER, SHARED_NAME, universalBase, metadataFromLabels, writeRecord } from './chunk-5AVYYNGU.js';
18
18
  import { FETCHED_DIR, toolsDockerfile, FETCHED_FFMPEG, FETCHED_GH, FETCHED_TINI, FETCHED_HEADLESS_SHELL, FETCHED_PLAYWRIGHT_FFMPEG, FETCHED_VOICE_DIR } from './chunk-NO4N4D32.js';
19
19
  import { isSameProcess, startTimeOf } from './chunk-JBJTC3UU.js';
20
20
  import { currentCliBuild } from './chunk-OGFGZQA3.js';
21
21
  import { vmExecArgs, runExec, execCapture, waitForAgent } from './chunk-BBRXFXBB.js';
22
22
  import { socketPathProblem, vsockLinks, linkVsockSockets, GUEST_CID, LEASE_LINK } from './chunk-NRDFBOKE.js';
23
- import { describeCallFailure, shortClaim, retrySend, commandWithShim, logStamp, createRunnerLog, formatDuration, removeKeptContext, formatClock, stageGovernedContext, keptContextTree, removeStagedContext, WORKFLOW_PERMISSION_REASON, refusalCode, SELF_GOVERNED, resolveGoverningSource, prefetchGovernedContext, controlPlaneTokenFailure, keepStagedContext, pinnedSourceOf, shimScript } from './chunk-VBSKVGWP.js';
24
- import { postJson, WorkCommandError, isSignatureRefusal, getJson } from './chunk-5OSY3LK3.js';
25
- import { isBuiltinContainer, isBuiltinVm, isBuiltinSandbox, keyRunnerFactory, runnerCredentialProblem, builtinKind, optionalEgress, egressSummary, DEFAULT_WORKSPACE_KEEP_DAYS, readOnlyRemoteOf, DEFAULT_CHECK_TIME_LIMIT_MINUTES, DEFAULT_SETUP_MINUTES, allowHostProblem, systemClock, emptyEgressCounts, hostAllowed, sandboxSizeOf, readOnlyOption, sandboxTimeLimitMinutes, networkOf, imageBuildOf, DEFAULT_SAVED_STATE_MAX_BYTES } from './chunk-EUHUIIGT.js';
23
+ import { describeCallFailure, shortClaim, retrySend, commandWithShim, logStamp, createRunnerLog, formatDuration, removeKeptContext, formatClock, stageGovernedContext, keptContextTree, removeStagedContext, WORKFLOW_PERMISSION_REASON, refusalCode, SELF_GOVERNED, resolveGoverningSource, prefetchGovernedContext, controlPlaneTokenFailure, keepStagedContext, pinnedSourceOf, shimScript } from './chunk-SFN7K33S.js';
24
+ import { postJson, WorkCommandError, isSignatureRefusal, getJson } from './chunk-DNXYI22V.js';
25
+ import { isBuiltinContainer, isBuiltinVm, isBuiltinSandbox, keyRunnerFactory, runnerCredentialProblem, builtinKind, readOnlyOption, optionalEgress, egressSummary, DEFAULT_WORKSPACE_KEEP_DAYS, readOnlyRemoteOf, DEFAULT_CHECK_TIME_LIMIT_MINUTES, DEFAULT_SETUP_MINUTES, allowHostProblem, systemClock, emptyEgressCounts, hostAllowed, sandboxTimeLimitMinutes, networkOf, imageBuildOf, sandboxSizeOf, DEFAULT_SAVED_STATE_MAX_BYTES } from './chunk-EUHUIIGT.js';
26
26
  import { formatBytes, volumeBytes, allocatedBytes, DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK, freeBytes } from './chunk-3C23ZPWR.js';
27
- import { firstLine, writeJobFile, readJobFile, spawnRun, RUNNER_LABEL, BUILD_LABEL, said, NETWORK_HELPER_MEMORY, createDockerHost, builderSpec, childEnvironment, containerExecArgs, readDu, withAnswerProtocol, JUDGE_TREE, MAX_REPORT_BYTES, runnerLabelValue, parseSize, readJobFileChecked, NETWORK_READY_FILE, networkHelperName, prepareRunArgs, containerRunArgs, judgeCommand, JUDGE_DIR, WORKSPACE_LABEL, homeCopyRunArgs, networkHelperRunArgs, JUDGE_MAX_TURNS, JUDGE_ITEMS, answerFileName, hashJudgeProgram, identityScript, identityArgs, parseIdentity, mountableHome, homeCopyScript, homeCopyArgs, COMMAND_DIR, judgeProgramRecord, MAX_ITEMS_BYTES, JUDGE_REPORT, identityRunArgs, SAVED_STATE_LABEL } from './chunk-ERG3WCEC.js';
27
+ import { said, firstLine, writeJobFile, readJobFile, spawnRun, RUNNER_LABEL, BUILD_LABEL, NETWORK_HELPER_MEMORY, createDockerHost, builderSpec, childEnvironment, containerExecArgs, readDu, withAnswerProtocol, JUDGE_TREE, MAX_REPORT_BYTES, runnerLabelValue, parseSize, readJobFileChecked, NETWORK_READY_FILE, networkHelperName, prepareRunArgs, containerRunArgs, judgeCommand, JUDGE_DIR, WORKSPACE_LABEL, homeCopyRunArgs, networkHelperRunArgs, JUDGE_MAX_TURNS, JUDGE_ITEMS, answerFileName, hashJudgeProgram, identityScript, identityArgs, parseIdentity, mountableHome, homeCopyScript, homeCopyArgs, COMMAND_DIR, judgeProgramRecord, MAX_ITEMS_BYTES, JUDGE_REPORT, identityRunArgs, SAVED_STATE_LABEL } from './chunk-ERG3WCEC.js';
28
28
  import { universalImagePending, RecipeError, writeSanitizedRecipe, classifyProperties, DOCKER_FEATURE } from './chunk-FUZEOWF4.js';
29
29
  import { sanitizeTerminal, planArtifactUpload } from './chunk-26BFN6DH.js';
30
30
  import { sharedSkillNames, skillConflictMessage } from './chunk-I62FX622.js';
31
31
  import { readCloudConfig } from './chunk-HWVMRETT.js';
32
32
  import { signerFor } from './chunk-I5U6CFH4.js';
33
33
  import { vmAssetsDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE, runnerDir, workspacesDir, jobsDir, storeScopes, spoolDir, orgStoreIn, rootfsDir, imagesDir, sessionsDir, builderCacheDiskPath, buildsDir, buildDir, ghConfigDir, runnerDirOfBuild, mirrorDir, orgHomeDir, jobConsolePath, vsockPath, builderConsolePath, rootfsPathFor, diskTemplatesDir, deliveryDir, SHIM_DIR } from './chunk-JIANCWJ3.js';
34
- import { BUILD_HOME, SandboxError, JOB_MOUNT, heldBuildAuthority, IMAGE_BUNDLES, writeTrustFiles, buildEnvironment, trustEnvironment, CHECKOUT_DIR, parseIsolation, containerLocalAddress, destinationEnvironment, withHooksPath, startBuildServices, headerVariables, authorEnvironment, sharedUserEnvironment, withTunnelRecord, commitIdentityRecord, repositoriesOf, RELAY_PORT, repositoryPath, lifecycleWorkdir, CHECK_ITEMS_FILE, parseProxied, readBundleScript, applyTrust, STAND_IN, proxyEnvironment, describeSandboxError, dropBuildAuthority, sandboxSettingsFrom, createSandboxClient, hostKeyOf, buildAuthorityFor, checkEnvironment, withMiseVariables, checkoutPath, primaryOf, variablesFor, carried6to4, classifyAddress, EVAL_INPUT_DIR, isMiseVariableAllowed, variableForPath, droppedRequestHeaders, hasDotDotSegment, routeNameOf, toolProxyEnvironment } from './chunk-4FHDVWKO.js';
35
- import { agentCredential, RUNNER_WORDED_REASONS, UNKNOWN_TRACKING_REASON, UNKNOWN_TRANSPORT_REASON, RELAY_USER, currentAgentCredential, removedAgentCredentialValues, managedAgentCredential, realFdStorePort, builtInNames, MAX_MALFORMED_SESSIONS, MALFORMED_REASON, JOIN_WAIT_MS, MAX_OPEN_STREAMS, STREAM_RESET_RATE, STREAM_RESET_BURST, STREAM_WINDOW, SESSION_WINDOW, targetOfPath, AGENT_CREDENTIAL_MISSING, fdName, RELAY_ID, DOCKER_DESKTOP_REASON } from './chunk-EJ7ZXBXS.js';
34
+ import { BUILD_HOME, repositoriesOf, SandboxError, JOB_MOUNT, heldBuildAuthority, IMAGE_BUNDLES, writeTrustFiles, buildEnvironment, trustEnvironment, CHECKOUT_DIR, parseIsolation, containerLocalAddress, destinationEnvironment, withHooksPath, startBuildServices, headerVariables, authorEnvironment, sharedUserEnvironment, withTunnelRecord, commitIdentityRecord, RELAY_PORT, repositoryPath, lifecycleWorkdir, CHECK_ITEMS_FILE, parseProxied, readBundleScript, applyTrust, STAND_IN, proxyEnvironment, describeSandboxError, dropBuildAuthority, sandboxSettingsFrom, createSandboxClient, hostKeyOf, buildAuthorityFor, checkEnvironment, withMiseVariables, checkoutPath, primaryOf, variablesFor, carried6to4, classifyAddress, EVAL_INPUT_DIR, isMiseVariableAllowed, variableForPath, droppedRequestHeaders, hasDotDotSegment, routeNameOf, toolProxyEnvironment } from './chunk-4FHDVWKO.js';
35
+ import { agentCredential, RUNNER_WORDED_REASONS, UNKNOWN_TRACKING_REASON, UNKNOWN_TRANSPORT_REASON, RELAY_USER, builtInNames, currentAgentCredential, removedAgentCredentialValues, managedAgentCredential, realFdStorePort, MAX_MALFORMED_SESSIONS, MALFORMED_REASON, JOIN_WAIT_MS, MAX_OPEN_STREAMS, STREAM_RESET_RATE, STREAM_RESET_BURST, STREAM_WINDOW, SESSION_WINDOW, targetOfPath, AGENT_CREDENTIAL_MISSING, fdName, RELAY_ID, DOCKER_DESKTOP_REASON } from './chunk-EJ7ZXBXS.js';
36
36
  import { versionAtLeast } from './chunk-SF2TBJBP.js';
37
37
  import { jobAgent, firecrackerArch, MICROVM_ARCHES, FIRECRACKER_VERSION, hostHelperPinned, builderDiskPinned, guestAssetsPinned, runnerAgentNamed, credentialForms, orList, credentialShapes, agentCommands, defaultCommandLine, credentialAgent, GUEST_HELPER_SHA256, GUEST_ASSETS_BASE_URL, GUEST_KERNEL_SHA256, JAILER_BINARY_SHA256, FIRECRACKER_BINARY_SHA256, FIRECRACKER_SHA256, GUEST_ASSETS_VERSION, BUILDER_DISK_VERSION, credentialHandOffKey, strippedVariables, runnerAgents, judgeAgent, networkHelperPinned, NETWORK_HELPER_SHA256, universalImagePinned, UNIVERSAL_IMAGE, FFMPEG_STATIC, FFMPEG_BUILD_TAG, GH_SHA256, GH_VERSION, TINI_SHA256, TINI_VERSION, HEADLESS_SHELL, HEADLESS_SHELL_BASE_URL, PLAYWRIGHT_FFMPEG, PLAYWRIGHT_FFMPEG_BASE_URL, VOICE_PACK_FILES, BUILDER_DISK_SHA256, BUILDER_DISK_BASE_URL, DEFAULT_BASE_IMAGE, agentVersionOf } from './chunk-J6KKJGR7.js';
38
38
  import { sessionFolderIn, legacyAgent, defaultAgents, parsePolicy, AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE, orderSessions, extractFacts, sessionsToTimeline, resolvePackRoot } from './chunk-QYLBGMTA.js';
@@ -44,7 +44,7 @@ import { CheckItemsSchema, CODE_REVIEW_NAME, JUDGE_NOT_RUN_ITEM_ID, REVIEWED_COM
44
44
  import { randomUUID, randomBytes, createHash } from 'crypto';
45
45
  import { rmSync, mkdirSync, existsSync, readFileSync, mkdtempSync, statSync, appendFileSync, writeFileSync, readdirSync, accessSync, constants, openSync, closeSync, renameSync, rmdirSync, createReadStream, lstatSync, unlinkSync, chmodSync, realpathSync, writeSync, truncateSync, cpSync, fstatSync, readSync, createWriteStream, copyFileSync, linkSync } from 'fs';
46
46
  import { join, dirname, isAbsolute, delimiter, basename, sep, relative, resolve } from 'path';
47
- import { Readable, PassThrough, Duplex, Transform, Writable } from 'stream';
47
+ import { Readable, PassThrough, Writable, Duplex, Transform } from 'stream';
48
48
  import { spawn, spawnSync } from 'child_process';
49
49
  import { createServer, createConnection, connect, isIP } from 'net';
50
50
  import { availableParallelism, networkInterfaces, tmpdir } from 'os';
@@ -477,6 +477,11 @@ function managedBuildSettingValuesFor(jobDir) {
477
477
  const settings = held2.get(jobDir);
478
478
  return [...new Set([...settings?.variables ?? [], ...settings?.proxied ?? []].map(({ value }) => value))];
479
479
  }
480
+ function factoryVariablesOf(config, jobDir) {
481
+ const variables = held2.get(jobDir)?.variables;
482
+ if (variables !== void 0) return variables;
483
+ return config.managed === true ? [] : void 0;
484
+ }
480
485
  function managedMachineLimits(settings) {
481
486
  const { vcpus, memoryGiB, diskGB } = settings.machine;
482
487
  return { cpus: vcpus, memoryBytes: Math.round(memoryGiB * GIB), diskBytes: Math.round(diskGB * GB) };
@@ -4310,6 +4315,48 @@ async function cleanupSandbox(runtime, state, keepDisk) {
4310
4315
  if (failures.length > 0) throw new Error(failures.join("; "));
4311
4316
  return kept;
4312
4317
  }
4318
+ var PROXIED_IN_SANDBOX_REASON = "the factory has a proxied variable, and a sandbox build cannot use one yet. Remove the proxied variable from the factory's build settings, or build on a runner with builtin:vm hooks";
4319
+ function sandboxSizeFor(config, jobDir) {
4320
+ const settings = managedBuildSettingsFor(jobDir);
4321
+ if (settings === void 0) {
4322
+ const sized2 = sandboxSizeOf(config.build);
4323
+ return sized2.ok ? sized2 : { ok: false, reason: `${sized2.field} ${sized2.problem}` };
4324
+ }
4325
+ const limits2 = managedMachineLimits(settings);
4326
+ const sized = sandboxSizeOf({ cpus: limits2.cpus, memory: String(limits2.memoryBytes), disk: String(limits2.diskBytes) });
4327
+ return sized.ok ? sized : { ok: false, reason: `the factory's ${settings.machine.size} machine does not fit a sandbox: ${sized.field.replace("runner.build.", "its ")} ${sized.problem}` };
4328
+ }
4329
+ var UNAPPLIED_IN_SANDBOX = ["image", "build", "features"];
4330
+ function ignoredInSandbox(recipe, docker2) {
4331
+ const { classification } = recipe;
4332
+ const ignored = classification.ignored.map(({ property, source }) => ({ property, source }));
4333
+ for (const property of UNAPPLIED_IN_SANDBOX) if (classification.honoured.includes(property)) ignored.push({ property, source: "file" });
4334
+ if (classification.docker && !docker2) ignored.push({ property: "docker daemon", source: `feature ${DOCKER_FEATURE}` });
4335
+ return ignored;
4336
+ }
4337
+ async function readSandboxRecipe(input) {
4338
+ const { tokens, repository } = input;
4339
+ const governed = input.governingSource.kind === "governed" ? input.governingSource : void 0;
4340
+ const recipeRepository = governed?.repository ?? repository;
4341
+ let readToken;
4342
+ try {
4343
+ readToken = governed === void 0 ? await tokens.token("read") : await controlPlaneReadToken(tokens, recipeRepository);
4344
+ } catch (err) {
4345
+ return { ok: false, reason: governed === void 0 ? `the build's read token could not be had: ${refusalCode(err)}` : controlPlaneTokenFailure(err, repository) };
4346
+ }
4347
+ try {
4348
+ const recipe = await input.runtime.readRecipe({
4349
+ repository: recipeRepository,
4350
+ configPath: input.config.configPath,
4351
+ ...input.organizationId === void 0 ? {} : { organizationId: input.organizationId },
4352
+ readToken,
4353
+ ...governed === void 0 ? {} : { pinned: { commit: governed.sha, ref: governed.ref } }
4354
+ });
4355
+ return { ok: true, recipe, repository: recipeRepository };
4356
+ } catch (err) {
4357
+ return { ok: false, reason: err instanceof RecipeError ? err.message : `the devcontainer file of ${recipeRepository} could not be read: ${describeCallFailure(err)}` };
4358
+ }
4359
+ }
4313
4360
  async function provisionSandbox(input) {
4314
4361
  const tag = itemTag({ item: input.item.number, organizationId: input.organizationId, claimId: input.claimId });
4315
4362
  return provisionWithFreshFallback({
@@ -4328,8 +4375,9 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
4328
4375
  const primary = primaryOf(repositories);
4329
4376
  if (primary === void 0) return fail("the work item names no repository to clone");
4330
4377
  const repository = primary.repository;
4331
- const sized = sandboxSizeOf(config.build);
4332
- if (!sized.ok) return fail(`${sized.field} ${sized.problem}`);
4378
+ if ((managedBuildSettingsFor(jobDir)?.proxied?.length ?? 0) > 0) return fail(PROXIED_IN_SANDBOX_REASON);
4379
+ const sized = sandboxSizeFor(config, jobDir);
4380
+ if (!sized.ok) return fail(sized.reason);
4333
4381
  let sandboxClient;
4334
4382
  try {
4335
4383
  sandboxClient = client(runtime);
@@ -4352,6 +4400,15 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
4352
4400
  });
4353
4401
  if (unfetched !== void 0) return fail(unfetched);
4354
4402
  }
4403
+ const read = await readSandboxRecipe({ runtime, config, tokens, repository, governingSource, organizationId: input.organizationId });
4404
+ if (!read.ok) return fail(read.reason);
4405
+ const recipe = read.recipe;
4406
+ const recipeRepository = read.repository;
4407
+ const apply = recipe.classification.apply;
4408
+ const ignoredProperties = ignoredInSandbox(recipe, own.docker === true);
4409
+ if (ignoredProperties.length > 0) {
4410
+ log.line(`${tag} not applied from ${recipe.path} of ${recipeRepository}: ${ignoredProperties.map(({ property }) => property).join(", ")} \xB7 a sandbox build runs the image runner.sandbox.image names`);
4411
+ }
4355
4412
  const diskKey = { imageId: diskImageOf(own, sized.size), diskBytes: sized.size.diskGib * GIB2 };
4356
4413
  const itemDisk = input.workItemId === void 0 ? { state: void 0 } : itemDiskFailed !== void 0 ? { state: { restored: false, reason: itemDiskFailed } } : itemDiskDecision({ fresh: input.fresh, heldElsewhere: input.diskHeldElsewhere, builtin: true, backend: "sandbox", configPath: config.configPath, organizationId: input.organizationId, workItemId: input.workItemId, repository, ...diskKey });
4357
4414
  const keptDisk = itemDisk.kept;
@@ -4370,7 +4427,9 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
4370
4427
  buildDir: buildDir2,
4371
4428
  repository,
4372
4429
  imageId: image,
4430
+ containerEnv: apply.containerEnv,
4373
4431
  builtIns: true,
4432
+ lifecycle: apply.lifecycle,
4374
4433
  ...governingSource.kind === "governed" ? { governing: { repository: governingSource.repository, ref: governingSource.ref, commit: governingSource.sha } } : {},
4375
4434
  transport: "exec",
4376
4435
  jobFiles: "copied"
@@ -4387,15 +4446,18 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
4387
4446
  hostEnv: runtime.hostEnv,
4388
4447
  agents: runtime.agents,
4389
4448
  ...input.job === void 0 ? {} : { job: input.job },
4390
- containerEnv: {},
4391
- builtIns: true
4449
+ containerEnv: apply.containerEnv,
4450
+ builtIns: true,
4451
+ factoryVariables: factoryVariablesOf(config, jobDir)
4392
4452
  });
4393
4453
  if (env.skippedTokenVariables.length > 0) {
4394
4454
  log.line(`${tag} not passing ${env.skippedTokenVariables.join(", ")} from runner.build.variables into the build: its repository token comes from the runner`);
4395
4455
  }
4396
4456
  const environment = {
4397
4457
  isolation: "vm",
4458
+ recipe: { sourceCommit: recipe.sourceCommit, key: recipe.key, path: recipe.path },
4398
4459
  imageId: image,
4460
+ ignoredProperties,
4399
4461
  variables: env.variables,
4400
4462
  cliVersion: input.cliVersion
4401
4463
  };
@@ -4532,7 +4594,7 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
4532
4594
  if (group.exitCode !== 0 || !/^\d+$/.test(dockerGroup)) return bail(`reading the group of the Docker socket in the sandbox failed (exit ${group.exitCode ?? "none"})${said(group.stderr)}`);
4533
4595
  }
4534
4596
  const imageConfig = await host.imageConfig(image);
4535
- const resolved = await resolveBuildUser(sandboxed, runInput, { imageUser: imageConfig.user }, logPath);
4597
+ const resolved = await resolveBuildUser(sandboxed, runInput, { remoteUser: apply.remoteUser, imageUser: imageConfig.user }, logPath);
4536
4598
  if (!resolved.ok) return bail(resolved.reason);
4537
4599
  containerState.agentUser = resolved.user;
4538
4600
  if (resolved.home !== void 0) containerState.home = resolved.home;
@@ -4572,7 +4634,7 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
4572
4634
  agentVersion,
4573
4635
  agents: runtime.agents,
4574
4636
  ...input.job === void 0 ? {} : { job: input.job },
4575
- lifecycle: {},
4637
+ lifecycle: apply.lifecycle,
4576
4638
  exec: stepExec,
4577
4639
  log,
4578
4640
  tag,
@@ -4612,6 +4674,39 @@ async function provisionSandboxOnce(input, itemDiskFailed) {
4612
4674
  function asContainerJob(job) {
4613
4675
  return { ...job, container: job.sandbox.container };
4614
4676
  }
4677
+ var READ_SECRET_LINE = `sudo cat ${SECRET_FILE} | base64 | tr -d '\\n'`;
4678
+ async function rejoinSandboxBuild(input) {
4679
+ const { runtime, own, log } = input;
4680
+ const state = own.container;
4681
+ const sandbox = await sandboxOfBuild(runtime, own);
4682
+ if (sandbox === void 0) return "gone";
4683
+ const sandboxed = runtimeInSandbox(runtime, sandbox);
4684
+ const where = await sandboxed.host.state(state.container);
4685
+ if (where === "stopped" || where === "missing") return where;
4686
+ if (runtime.tunnels.has(state.buildId)) return "joined";
4687
+ const read = await client(runtime).command(sandbox, READ_SECRET_LINE);
4688
+ const joinSecret = Buffer.from(read.stdout, "base64");
4689
+ if (read.exitCode !== 0 || joinSecret.length === 0) throw new Error(`the build's join secret could not be read from its sandbox (exit ${read.exitCode ?? "none"})${said(read.stderr)}`);
4690
+ const repositories = repositoriesOf({ repositories: input.repositories, repository: state.repository, branch: input.branch });
4691
+ const gitRemote = gitRemoteFor(runtime, { repositories, tokens: input.tokens, buildDir: state.buildDir, log, ...readOnlyOption(input.queue) });
4692
+ const lease = leaseFor(runtime, state.buildId, input.leaseExpiryMs);
4693
+ const services = await startServicesFor(runtime, input.config, state.buildDir, input.jobDir, input.itemKey, true, gitRemote, "stream", lease, void 0, log);
4694
+ runtime.tunnels.set(state.buildId, services);
4695
+ runtime.sandbox.joinSecrets.set(state.buildId, joinSecret);
4696
+ joinRelay(runtime, sandbox, { buildId: state.buildId, container: state.container }, services.streams, joinSecret, log);
4697
+ try {
4698
+ await input.tokens.token("read");
4699
+ keepGhConfigCurrent(input.tokens, state.buildDir, (err) => input.warn(`the read token could not be written for gh: ${describeCallFailure(err)}`), {
4700
+ runtime: sandboxed,
4701
+ state,
4702
+ secrets: secretsOf(runtime, input.jobDir),
4703
+ onFailure: (reason) => input.warn(reason)
4704
+ });
4705
+ } catch (err) {
4706
+ input.warn(`could not give the adopted build a read token: ${describeCallFailure(err)}`);
4707
+ }
4708
+ return "joined";
4709
+ }
4615
4710
  async function leaveRelay(runtime, buildId) {
4616
4711
  runtime.leases.get(buildId)?.stop();
4617
4712
  const relay = runtime.relays.get(buildId);
@@ -4673,7 +4768,7 @@ async function deliverSandboxHooks(runtime, state, jobDir) {
4673
4768
  async function startSandboxCommand(input) {
4674
4769
  const own = input.job.sandbox;
4675
4770
  const runtime = await inSandbox(input.runtime, own);
4676
- const exec = containerCommandExec({ job: asContainerJob(input.job), cmdline: input.cmdline, runtime, config: input.config, ...input.extraEnv === void 0 ? {} : { extraEnv: input.extraEnv } });
4771
+ const exec = containerCommandExec({ job: asContainerJob(input.job), cmdline: input.cmdline, runtime, config: input.config, extraEnv: input.extraEnv, factoryVariables: factoryVariablesOf(input.config, input.jobDir) });
4677
4772
  const started = await runtime.host.execDetached(exec);
4678
4773
  if (started.status !== 0) {
4679
4774
  const first = started.stderr.trim().split("\n")[0] ?? "";
@@ -4683,7 +4778,7 @@ async function startSandboxCommand(input) {
4683
4778
  var SANDBOX_SENDER_LOG = "/tmp/outerlayer-session-sender.log";
4684
4779
  async function startSandboxSender(input) {
4685
4780
  const runtime = await inSandbox(input.runtime, input.job.sandbox);
4686
- const exec = containerSenderExec({ job: asContainerJob(input.job), runtime, config: input.config });
4781
+ const exec = containerSenderExec({ job: asContainerJob(input.job), runtime, config: input.config, factoryVariables: factoryVariablesOf(input.config, input.jobDir) });
4687
4782
  const started = await runtime.host.execDetached({ ...exec, argv: ["/bin/sh", "-c", `exec outerlayer session-sender >> ${SANDBOX_SENDER_LOG} 2>&1`] });
4688
4783
  if (started.status !== 0) {
4689
4784
  const first = started.stderr.trim().split("\n")[0] ?? "";
@@ -4803,6 +4898,7 @@ async function runCliInSandbox(input, argv, logName) {
4803
4898
  const state = own.container;
4804
4899
  if (state.stopped === true) await startSandboxContainerAgain(input.runtime, own, await rejoinOf(input.runtime, own), input.jobDir, input.log);
4805
4900
  const env = buildEnvironment({
4901
+ factoryVariables: factoryVariablesOf(input.config, input.jobDir),
4806
4902
  config: claimCalls(input.config, job),
4807
4903
  item: job.item,
4808
4904
  ...job.queue === "run" ? { run: true } : {},
@@ -5268,11 +5364,6 @@ function builderMachineFor(config, jobDir, assets, limits2) {
5268
5364
  timeLimitMinutes: config.timeLimitMinutes
5269
5365
  };
5270
5366
  }
5271
- function factoryVariablesOf(config, jobDir) {
5272
- const held3 = managedBuildSettingsFor(jobDir)?.variables;
5273
- if (held3 !== void 0) return held3;
5274
- return config.managed === true ? [] : void 0;
5275
- }
5276
5367
  function execEnvironment(image, given) {
5277
5368
  const env = applyTrust(given, image);
5278
5369
  const merged = { ...image, ...env.literals };
@@ -7528,7 +7619,7 @@ async function startSender(input) {
7528
7619
  if (job.itemKey === void 0) return void 0;
7529
7620
  if (job.sandbox !== void 0) {
7530
7621
  try {
7531
- await startSandboxSender({ config, job, runtime: deps.runtime ?? createContainerRuntime() });
7622
+ await startSandboxSender({ config, job, jobDir, runtime: deps.runtime ?? createContainerRuntime() });
7532
7623
  deps.log.line(`${tag} session sender started \xB7 in sandbox ${job.sandbox.sandboxId}`);
7533
7624
  } catch (err) {
7534
7625
  deps.log.error(`${tag} session sender did not start: ${describeCallFailure(err)} \xB7 continuing`);
@@ -8567,8 +8658,24 @@ async function runJudge(input) {
8567
8658
  if (repository === void 0) return;
8568
8659
  const repo = repository;
8569
8660
  const remoteOf = () => runtime.remoteFor?.(repo) ?? `${runtime.github.gitUrl}/${repo}.git`;
8661
+ const readItemWithRetry = async () => {
8662
+ let lastError;
8663
+ const read = await retrySend(
8664
+ async () => {
8665
+ try {
8666
+ return await readWorkItem(itemCalls(config, job), job.item, deps.fetchImpl);
8667
+ } catch (err) {
8668
+ lastError = err;
8669
+ throw err;
8670
+ }
8671
+ },
8672
+ { now: deps.now }
8673
+ );
8674
+ if (read.ok) return read.value;
8675
+ throw lastError;
8676
+ };
8570
8677
  let itemRead;
8571
- const readItem = () => itemRead ??= readWorkItem(itemCalls(config, job), job.item, deps.fetchImpl).catch((err) => {
8678
+ const readItem = () => itemRead ??= readItemWithRetry().catch((err) => {
8572
8679
  itemRead = void 0;
8573
8680
  throw err;
8574
8681
  });
@@ -10134,7 +10241,10 @@ function isIsolatedJob(job) {
10134
10241
  return job.container !== void 0 || job.microvm !== void 0 || job.sandbox !== void 0;
10135
10242
  }
10136
10243
  function trackingOf(job) {
10137
- return job.container?.tracking ?? job.microvm?.tracking;
10244
+ return job.container?.tracking ?? job.microvm?.tracking ?? job.sandbox?.tracking;
10245
+ }
10246
+ function isAdoptedTracking(tracking) {
10247
+ return tracking === "container" || tracking === "microvm" || tracking === "sandbox";
10138
10248
  }
10139
10249
  function isReadable(job) {
10140
10250
  return readsJobState(job, READ_JOB_STATE_FORMATS);
@@ -10147,8 +10257,8 @@ function listTrackedJobs(jobsDirPath) {
10147
10257
  if (!isReadable(job)) return [];
10148
10258
  const tracking = trackingOf(job);
10149
10259
  if (tracking === void 0) return [];
10150
- if ((tracking === "container" || tracking === "microvm") && inTeardown(job)) return [];
10151
- return [{ dirPath, job, known: tracking === "container" || tracking === "microvm" }];
10260
+ if (isAdoptedTracking(tracking) && inTeardown(job)) return [];
10261
+ return [{ dirPath, job, known: isAdoptedTracking(tracking) }];
10152
10262
  });
10153
10263
  }
10154
10264
  function listAdoptableJobs(jobsDirPath) {
@@ -10172,11 +10282,11 @@ async function recoverLostJobs(jobsDirPath, config, deps) {
10172
10282
  continue;
10173
10283
  }
10174
10284
  const tracking = trackingOf(job);
10175
- if (tracking !== void 0 && tracking !== "container" && tracking !== "microvm") {
10285
+ if (tracking !== void 0 && !isAdoptedTracking(tracking)) {
10176
10286
  recovered.push(await finishJob(job, dirPath, "interrupted", config, deps, { reason: UNKNOWN_TRACKING_REASON }));
10177
10287
  continue;
10178
10288
  }
10179
- if ((tracking === "container" || tracking === "microvm") && !inTeardown(job)) continue;
10289
+ if (isAdoptedTracking(tracking) && !inTeardown(job)) continue;
10180
10290
  const alive = job.pid !== void 0 && job.start !== void 0 && isSameProcess(job.pid, job.start);
10181
10291
  if (alive) continue;
10182
10292
  const recorded = outcomeFromExitCode(dirPath);
@@ -12134,6 +12244,7 @@ function createContainerRuntime(opts = {}) {
12134
12244
  relays: opts.relays ?? /* @__PURE__ */ new Map(),
12135
12245
  relayFatal: opts.relayFatal ?? /* @__PURE__ */ new Map(),
12136
12246
  leases: opts.leases ?? /* @__PURE__ */ new Map(),
12247
+ readRecipe: opts.readRecipe ?? ((read) => readRepositoryRecipe({ ...read, remote: remoteFor?.(read.repository) })),
12137
12248
  buildImage: opts.buildImage ?? ((build) => buildRepositoryImage(
12138
12249
  {
12139
12250
  repository: build.repository,
@@ -12695,6 +12806,7 @@ function shellQuote(word) {
12695
12806
  function containerCommandExec(input) {
12696
12807
  const state = input.job.container;
12697
12808
  const built = buildEnvironment({
12809
+ factoryVariables: input.factoryVariables,
12698
12810
  config: claimCalls(input.config, input.job),
12699
12811
  item: input.job.item,
12700
12812
  ...input.job.queue === "run" ? { run: true } : {},
@@ -12725,6 +12837,7 @@ function containerCommandExec(input) {
12725
12837
  function containerSenderExec(input) {
12726
12838
  const state = input.job.container;
12727
12839
  const env = buildEnvironment({
12840
+ factoryVariables: input.factoryVariables,
12728
12841
  config: claimCalls(input.config, input.job),
12729
12842
  item: input.job.item,
12730
12843
  ...input.job.queue === "run" ? { run: true } : {},
@@ -13713,4 +13826,4 @@ async function runHostChecks(input) {
13713
13826
  }
13714
13827
  }
13715
13828
 
13716
- export { ADOPTED_FETCH_RETRY_WINDOW_MS, ALREADY_RELEASED, AttemptLogBook, CRITERIA_CHECK, EXIT_CODE_FILE, GUEST_USAGE_INTERVAL_MS, HELPER_ENV, KIND_LABEL, LEASE_SECONDS, MAX_CHECK_ITEMS_BYTES, MICROVM_COMMAND_DIR, MIN_ENGINE_MAJOR, PLACEHOLDER_MARKER, RENEW_INTERVAL_SECONDS, RunnerInitError, SandboxGoneError, agentCredentialCheck, appendCommandLog, attemptNote, builtOf, checksIn, claimPermissionProblem, claimRun, commandItems, commandLogOffset, containerCommandExec, createContainerRuntime, createHousekeepingDocker, createLeaseChannel, currentSkillCommand, decideHostBuildSkill, deliverCommitHooks, deliverContainerHooks, deliverExecMaven, deliverJobFiles, deliverSandboxHooks, describeHookEnd, describeMachineDocker, detectMachine, ensureFirecrackerAndJailer, ensureNetworkReady, ensureTunnel, execArgv, execCommandLine, fetchManagedBuildSettings, fetchManagedClaudeKey, filesAreCopied, finishJob, foldSample, formerSkillProblem, formerSkillQueues, freeItemDisksUntil, gitRemoteFor, helperFirecrackerNote, helperSocketPath, holdManagedBuildSettings, holdManagedClaudeKey, hookLimitsFor, hostCommandEnvironment, hostEnvironment, housekeepingDockerIfReachable, inSandbox, inTeardown, installTrust, isContainerTracked, isGroupAlive, isIdle, isIsolatedJob, isJudgeCheck, isMicroVmTracked, isPlaceholderCommand, isReadable, isSandboxTracked, isTimedOut, isTracked, isUnfinished, itemScope, itemTag, jobEnv, jobRecordsClaim, judgeProbe, keepGhConfigCurrent, keptCommitsLine, keptSandboxIds, leaseExpiresAtMs, leaseTimeLeftMs, lifecycleFailureReason, lifecycleSteps, listAdoptableJobs, listItemDisks, listTrackedJobs, listUnreadableJobs, listenOnBroker, makeRecorder, managedBuildSettingsFor, measureDisk, microVmArchSupported, microVmAssetsPinned, microVmCommandLine, microVmOomKills, missingPermissionFix, missingPermissionOf, modellessProblem, modellessQueues, needsAgentCredential, needsBuildSkill, needsRenew, outcomeFromExitCode, parseCpuList, permissionModeProblem, permissionModeProblems, placeholderProblem, placeholderQueues, prepareBranch, prepareResume, prepareRunnerInit, probeCommand, probeHelper, probeMicroVmCommand, probeSandboxCommand, provisionContainer, provisionEnvironment, provisionMicroVm, provisionSandbox, reachDockerStep, readConfigObject, readCpuUsec, readDefinitions, readProvisionOut, readRecords, recordsProofsOnly, recoverLostJobs, releaseLease, removeOldestUntil, renewLease, renewRun, resolveHostBuild, restartSender, restoreSessionIntoContainer, restoreSessionIntoMicroVm, restoreSessionIntoSandbox, retryFailedReleases, runCommand, runCommandOf, runHook, runHostChecks, runHousekeeping, runIsolation, runRunnerInit, runWithSpawn, sampleGuest, savedStatesDir, scrubReason, serveLease, setStage, setUpRunnerCgroup, shellQuote, startHostServices, startMicroVmCommand, startSandboxCommand, startSender, startServicesFor, stopOrphanedMicroVms, stoppedHelperReason, stripTerminalControls, supportsContainerBuilds, supportsMicroVmBuilds, sweepImageBuilders, sweepSandboxes, testProofIn, timeoutAfter, unfinishedJobs, usableCpus, vmAlive, withTunnelLog, workdirProblem, writeGuestGhConfig, writeRunnerInit };
13829
+ export { ADOPTED_FETCH_RETRY_WINDOW_MS, ALREADY_RELEASED, AttemptLogBook, CRITERIA_CHECK, EXIT_CODE_FILE, GUEST_USAGE_INTERVAL_MS, HELPER_ENV, KIND_LABEL, LEASE_SECONDS, MAX_CHECK_ITEMS_BYTES, MICROVM_COMMAND_DIR, MIN_ENGINE_MAJOR, PLACEHOLDER_MARKER, RENEW_INTERVAL_SECONDS, RunnerInitError, SandboxGoneError, agentCredentialCheck, appendCommandLog, attemptNote, builtOf, checksIn, claimPermissionProblem, claimRun, commandItems, commandLogOffset, containerCommandExec, createContainerRuntime, createHousekeepingDocker, createLeaseChannel, currentSkillCommand, decideHostBuildSkill, deliverCommitHooks, deliverContainerHooks, deliverExecMaven, deliverJobFiles, deliverSandboxHooks, describeHookEnd, describeMachineDocker, detectMachine, ensureFirecrackerAndJailer, ensureNetworkReady, ensureTunnel, execArgv, execCommandLine, fetchManagedBuildSettings, fetchManagedClaudeKey, filesAreCopied, finishJob, foldSample, formerSkillProblem, formerSkillQueues, freeItemDisksUntil, gitRemoteFor, helperFirecrackerNote, helperSocketPath, holdManagedBuildSettings, holdManagedClaudeKey, hookLimitsFor, hostCommandEnvironment, hostEnvironment, housekeepingDockerIfReachable, inSandbox, inTeardown, installTrust, isContainerTracked, isGroupAlive, isIdle, isIsolatedJob, isJudgeCheck, isMicroVmTracked, isPlaceholderCommand, isReadable, isSandboxTracked, isTimedOut, isTracked, isUnfinished, itemScope, itemTag, jobEnv, jobRecordsClaim, judgeProbe, keepGhConfigCurrent, keptCommitsLine, keptSandboxIds, leaseExpiresAtMs, leaseTimeLeftMs, lifecycleFailureReason, lifecycleSteps, listAdoptableJobs, listItemDisks, listTrackedJobs, listUnreadableJobs, listenOnBroker, makeRecorder, managedBuildSettingsFor, measureDisk, microVmArchSupported, microVmAssetsPinned, microVmCommandLine, microVmOomKills, missingPermissionFix, missingPermissionOf, modellessProblem, modellessQueues, needsAgentCredential, needsBuildSkill, needsRenew, outcomeFromExitCode, parseCpuList, permissionModeProblem, permissionModeProblems, placeholderProblem, placeholderQueues, prepareBranch, prepareResume, prepareRunnerInit, probeCommand, probeHelper, probeMicroVmCommand, probeSandboxCommand, provisionContainer, provisionEnvironment, provisionMicroVm, provisionSandbox, reachDockerStep, readConfigObject, readCpuUsec, readDefinitions, readProvisionOut, readRecords, recordsProofsOnly, recoverLostJobs, rejoinSandboxBuild, releaseLease, removeOldestUntil, renewLease, renewRun, resolveHostBuild, restartSender, restoreSessionIntoContainer, restoreSessionIntoMicroVm, restoreSessionIntoSandbox, retryFailedReleases, runCommand, runCommandOf, runHook, runHostChecks, runHousekeeping, runIsolation, runRunnerInit, runWithSpawn, sampleGuest, savedStatesDir, scrubReason, serveLease, setStage, setUpRunnerCgroup, shellQuote, startHostServices, startMicroVmCommand, startSandboxCommand, startSender, startServicesFor, stopOrphanedMicroVms, stoppedHelperReason, stripTerminalControls, supportsContainerBuilds, supportsMicroVmBuilds, sweepImageBuilders, sweepSandboxes, testProofIn, timeoutAfter, unfinishedJobs, usableCpus, vmAlive, withTunnelLog, workdirProblem, writeGuestGhConfig, writeRunnerInit };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { criteriaOf, loadCitationFinder, testFileMatcher, hostItemsOf, runnerMatcher, NO_VERDICT_REASON } from './chunk-722KABMV.js';
4
- import { WorkCommandError, resolveCredentials, getJson } from './chunk-5OSY3LK3.js';
4
+ import { WorkCommandError, resolveCredentials, getJson } from './chunk-DNXYI22V.js';
5
5
  import { sanitizeTerminal } from './chunk-26BFN6DH.js';
6
6
  import { C } from './chunk-2AM6Z5BP.js';
7
7
  import { defaultFetch } from './chunk-PCGU6T7J.js';
@@ -129,14 +129,14 @@ function governingDir(cwd) {
129
129
  async function testProofMode(cwd) {
130
130
  const dir = governingDir(cwd);
131
131
  if (dir === void 0) return "any";
132
- const { testProofIn } = await import('./host-checks-CZGNR4VC.js');
132
+ const { testProofIn } = await import('./host-checks-VWWXDWV2.js');
133
133
  return testProofIn(dir);
134
134
  }
135
135
  async function judgeCheckName(cwd) {
136
136
  const dir = governingDir(cwd);
137
137
  if (dir === void 0) return {};
138
138
  if (!existsSync(dir)) return { note: `the governed context at ${dir} is not readable` };
139
- const { checksIn, isJudgeCheck } = await import('./host-checks-CZGNR4VC.js');
139
+ const { checksIn, isJudgeCheck } = await import('./host-checks-VWWXDWV2.js');
140
140
  const quiet = { line: () => void 0, error: () => void 0 };
141
141
  const check = checksIn(dir, quiet, "").checks.find((c) => isJudgeCheck(c) && c.judge.subjects === "criteria");
142
142
  return check === void 0 ? {} : { name: check.name };
@@ -372,7 +372,7 @@ async function runWorkProofs(opts) {
372
372
  async function runWorkProofsCommand(opts) {
373
373
  try {
374
374
  if (opts.record || opts.check) {
375
- const { runWorkProofsRecord } = await import('./work-proofs-record-I2VLOMRD.js');
375
+ const { runWorkProofsRecord } = await import('./work-proofs-record-AC5UQ2ME.js');
376
376
  const result2 = await runWorkProofsRecord(opts);
377
377
  process.exitCode = result2.exitCode;
378
378
  return;
@@ -294,7 +294,7 @@ async function getJson(url, path, apiKey, appId, fetchImpl, signer, limits) {
294
294
  ...ends.length === 0 ? {} : { signal: AbortSignal.any(ends) }
295
295
  });
296
296
  } catch (err) {
297
- throw new WorkCommandError(`network error reaching ${endpoint}: ${String(err)}`);
297
+ throw new WorkCommandError(`network error reaching ${endpoint}: ${String(err)}`, true);
298
298
  }
299
299
  if (response.status === 401) {
300
300
  throw await signatureRefusalOf(response) ?? new WorkCommandError(