@outerlayer/cli 0.33.0-next.20261022195547 → 0.33.0-next.20261023003700

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 (119) hide show
  1. package/README.md +5 -0
  2. package/dist/{agent-setup-RJOVRRHK.js → agent-setup-55ZDEXCS.js} +6 -6
  3. package/dist/{bridge-BCG2EB7F.js → bridge-NBCXFTT4.js} +2 -2
  4. package/dist/{build-GKCVFHF4.js → build-SEAQVLD5.js} +5 -5
  5. package/dist/build-disk-JHTMPRAA.js +16 -0
  6. package/dist/build-info.json +1 -1
  7. package/dist/{builder-DPNHJXG3.js → builder-Y4P7QARW.js} +5 -6
  8. package/dist/{check-64UX323V.js → check-MRYFTLOO.js} +36 -40
  9. package/dist/{chunk-D3HRAPNF.js → chunk-2EGCI2VW.js} +3424 -2700
  10. package/dist/{chunk-3MXPS7ED.js → chunk-2N67C6IV.js} +5 -4
  11. package/dist/{chunk-ZQOSIMKU.js → chunk-2WMZPJVE.js} +6 -3
  12. package/dist/{chunk-ZXBQ6E72.js → chunk-3RIFVLPO.js} +15 -10
  13. package/dist/{chunk-UOFBHIOZ.js → chunk-57L2YAJA.js} +1 -1
  14. package/dist/{chunk-6NWS455T.js → chunk-5THSC6BD.js} +1 -1
  15. package/dist/{chunk-QL3LPZ67.js → chunk-6LBSAW6I.js} +1 -1
  16. package/dist/{chunk-WPGBDY73.js → chunk-6RKD7YZ6.js} +1 -1
  17. package/dist/{chunk-77B36F5K.js → chunk-6Z4SZHV2.js} +4 -3
  18. package/dist/chunk-7HHNGZS5.js +146 -0
  19. package/dist/{chunk-DETKDTNL.js → chunk-AU346ENF.js} +3 -2
  20. package/dist/chunk-B2JURP6A.js +41 -0
  21. package/dist/{chunk-BCCI32ME.js → chunk-BALIE3BA.js} +36 -7
  22. package/dist/{chunk-BY36DVJV.js → chunk-BKADJZ7F.js} +3 -2
  23. package/dist/{chunk-CUBIZBMF.js → chunk-DISTLL2Q.js} +3 -3
  24. package/dist/{chunk-GN2R5Z7G.js → chunk-DXJTBU7A.js} +3 -3
  25. package/dist/{chunk-WCELNMXT.js → chunk-EUVE2EAE.js} +2 -2
  26. package/dist/{chunk-DDS2ISML.js → chunk-F5UL23I2.js} +1 -1
  27. package/dist/{chunk-43PV5KDB.js → chunk-FR7HWWCF.js} +37 -6
  28. package/dist/{chunk-JEKENLLA.js → chunk-GH246BGV.js} +1 -1
  29. package/dist/{chunk-ZRRUWNJS.js → chunk-HE4FBF4T.js} +4 -4
  30. package/dist/{chunk-W5DOK7BL.js → chunk-HVRQQOMH.js} +3 -3
  31. package/dist/{chunk-6IKSUAIA.js → chunk-HXA5GIHK.js} +61 -3
  32. package/dist/{chunk-2QT4JUW3.js → chunk-IP7BIBXJ.js} +1 -35
  33. package/dist/{chunk-LWTBE5J6.js → chunk-L26V6ILJ.js} +1 -1
  34. package/dist/{chunk-SK4TWCN3.js → chunk-MZBQTVFG.js} +1 -1
  35. package/dist/{chunk-YKYCE4HY.js → chunk-MZYOUIY5.js} +1 -1
  36. package/dist/{chunk-OWDSO3PE.js → chunk-NBZ7XBT6.js} +1 -1
  37. package/dist/{chunk-TGHBOXKJ.js → chunk-NE63JADS.js} +2 -2
  38. package/dist/{chunk-AGZNCIIJ.js → chunk-PA6CK6WQ.js} +1 -1
  39. package/dist/{chunk-L6JFFP3Q.js → chunk-PWH3BEZF.js} +55 -283
  40. package/dist/{chunk-QDMMW5PC.js → chunk-Q2CMEQV7.js} +2 -2
  41. package/dist/{chunk-DJWKUQLO.js → chunk-QPWFVE3X.js} +1 -1
  42. package/dist/{chunk-5BNWAIHN.js → chunk-RQJMN5TJ.js} +47 -7
  43. package/dist/{chunk-H7A3IQH5.js → chunk-SDU2IE22.js} +72 -28
  44. package/dist/{chunk-AA6LYZC4.js → chunk-SOI6K5DY.js} +1 -1
  45. package/dist/{chunk-35IY5HQY.js → chunk-SVDOA4W2.js} +1 -1
  46. package/dist/{chunk-RBJG5MM4.js → chunk-T5REPMNL.js} +5 -5
  47. package/dist/{chunk-6KLPC4U7.js → chunk-ULBNTSAD.js} +3 -2
  48. package/dist/{chunk-CMKY36NV.js → chunk-VT4TTJPG.js} +6 -5
  49. package/dist/chunk-W2AEL4BJ.js +179 -0
  50. package/dist/{chunk-6C2YWM6N.js → chunk-XHHTMFCX.js} +1 -1
  51. package/dist/{chunk-FAZDYI2D.js → chunk-XL2XWWU7.js} +3 -2
  52. package/dist/{chunk-KLXWS5Z7.js → chunk-YXHKCHWG.js} +4 -4
  53. package/dist/{chunk-GWDS42JC.js → chunk-Z5IW4DHH.js} +1 -1
  54. package/dist/{claude-launcher-66GKNIRZ.js → claude-launcher-NTYHJUJM.js} +1 -1
  55. package/dist/{cli-WICFAKFW.js → cli-K6XGL4EZ.js} +126 -102
  56. package/dist/{command-VGR24IPI.js → command-7FAIIQGF.js} +25 -26
  57. package/dist/{config-DUY2PT7K.js → config-QXMUWJAQ.js} +10 -4
  58. package/dist/{connect-cmd-ADRPR6ES.js → connect-cmd-P5GASVAF.js} +5 -5
  59. package/dist/{container-start-QX53HKXW.js → container-start-CVP3NTDG.js} +23 -26
  60. package/dist/context-show-cmd-3EPJ7CJC.js +115 -0
  61. package/dist/{control-plane-launch-SMHL6MWW.js → control-plane-launch-A3YCHQNQ.js} +5 -5
  62. package/dist/{docker-GGRJHHBP.js → docker-ANW76BNW.js} +5 -6
  63. package/dist/{doctor-N3CDJ66I.js → doctor-GJAHI3KU.js} +32 -39
  64. package/dist/{emit-artifact-cmd-73OWUBH6.js → emit-artifact-cmd-FDPJKGOO.js} +11 -10
  65. package/dist/{emit-criteria-cmd-D7OR356Y.js → emit-criteria-cmd-3SVGCMJN.js} +8 -7
  66. package/dist/{emit-demo-cmd-4AV74GMZ.js → emit-demo-cmd-6DF2QIAS.js} +12 -11
  67. package/dist/{emit-finding-cmd-GEPRJ6KO.js → emit-finding-cmd-TLJWBGQE.js} +8 -7
  68. package/dist/{emit-result-cmd-N52IABK6.js → emit-result-cmd-CJNVDV5V.js} +10 -9
  69. package/dist/{emit-step-cmd-CC6MUJ2S.js → emit-step-cmd-347CZO7Y.js} +8 -7
  70. package/dist/{exec-client-KLI262IX.js → exec-client-7PT4W7JR.js} +3 -3
  71. package/dist/{findings-cmd-7I72XX2H.js → findings-cmd-LHTYEHYB.js} +8 -7
  72. package/dist/{fleet-readiness-EZAGL32M.js → fleet-readiness-KGR5AC2J.js} +5 -5
  73. package/dist/{governing-source-M7ZRJCGY.js → governing-source-JZQZUTMA.js} +10 -9
  74. package/dist/{guest-init-ZJIE6MU3.js → guest-init-J3F3AEEY.js} +4 -4
  75. package/dist/{hook-fast-WNKICZ6E.js → hook-fast-6WDMNZG5.js} +1 -1
  76. package/dist/{pending-I5TY6SQH.js → host-key-UERIQRE6.js} +3 -3
  77. package/dist/{image-tag-MORUQ4LF.js → image-tag-ADSLWXBA.js} +3 -3
  78. package/dist/index.js +4 -4
  79. package/dist/{init-VCWDBOT4.js → init-XDOKWBL2.js} +22 -25
  80. package/dist/{init-XG4NRZX4.js → init-ZQ5B3TJZ.js} +22 -25
  81. package/dist/{init-cmd-2CAMWMRP.js → init-cmd-YMGW2WXJ.js} +11 -10
  82. package/dist/{init-update-NCM4GA3S.js → init-update-X7YLZL6H.js} +8 -8
  83. package/dist/install-QPA7DQHO.js +19 -0
  84. package/dist/{install-cmd-HFGINYEE.js → install-cmd-FV7IZ7XF.js} +5 -5
  85. package/dist/{logs-QSKJ4G6M.js → logs-HI46FO6Z.js} +2 -2
  86. package/dist/{loop-PXALY3VY.js → loop-UJL2UCUM.js} +36 -40
  87. package/dist/{machine-AZRL432D.js → machine-2YPAFFCH.js} +22 -21
  88. package/dist/{mcp-serve-cmd-DQSO6MOL.js → mcp-serve-cmd-7ABBV2QE.js} +4 -4
  89. package/dist/{paths-KHDFSBEI.js → paths-7HVTDE6J.js} +2 -2
  90. package/dist/{host-key-REZADWAM.js → pending-5HZACM2V.js} +3 -3
  91. package/dist/{pidfile-BSY63HIC.js → pidfile-5UDLYPMC.js} +3 -3
  92. package/dist/{record-7CNTGRLD.js → record-PPZEXAVA.js} +3 -3
  93. package/dist/runner-env-HOUXKWIJ.js +20 -0
  94. package/dist/{runner-identity-WGH73DTV.js → runner-identity-KPUVTRLS.js} +5 -6
  95. package/dist/{runner-key-6BIULOR4.js → runner-key-FUJD66R6.js} +22 -25
  96. package/dist/{session-sender-MSHKJSBG.js → session-sender-7B3ZDWMC.js} +11 -10
  97. package/dist/{spec-cmd-AWIMO32E.js → spec-cmd-Q26NE22H.js} +9 -8
  98. package/dist/{status-BILERIXB.js → status-2KNTILGQ.js} +29 -28
  99. package/dist/{sync-cmd-BSUZ65CU.js → sync-cmd-SSUYTMLJ.js} +10 -9
  100. package/dist/{watch-UF6XCGSI.js → watch-L5NCO46E.js} +10 -9
  101. package/dist/{work-claim-cmd-4FXVAZWF.js → work-claim-cmd-NJNOQFQE.js} +16 -13
  102. package/dist/{work-cmd-NCP4637R.js → work-cmd-W7WEHMQJ.js} +8 -7
  103. package/dist/{work-comment-cmd-YNQYVHYS.js → work-comment-cmd-SSUOGVDD.js} +8 -7
  104. package/dist/{work-logs-cmd-HHWVYQBG.js → work-logs-cmd-WPMWMDX6.js} +8 -7
  105. package/dist/{work-open-pr-cmd-ALVD7KLY.js → work-open-pr-cmd-NO5YLOXD.js} +9 -8
  106. package/dist/{work-pr-cmd-KBNFVRB4.js → work-pr-cmd-37B5KECR.js} +8 -7
  107. package/dist/{work-stop-cmd-DBWNHZJO.js → work-stop-cmd-3BJLXUJ3.js} +8 -7
  108. package/package.json +1 -1
  109. package/skill-pack/maintained/outerlayer-build/SKILL.md +4 -2
  110. package/dist/build-disk-6QAXMA2J.js +0 -18
  111. package/dist/chunk-DNKUSXQU.js +0 -241
  112. package/dist/chunk-I5LGKZ4M.js +0 -107
  113. package/dist/chunk-P5FC7VUO.js +0 -111
  114. package/dist/chunk-UXYLWVTQ.js +0 -43
  115. package/dist/chunk-WBZJWVT2.js +0 -146
  116. package/dist/chunk-YJLHUKYS.js +0 -38
  117. package/dist/chunk-YYYRBYWG.js +0 -32
  118. package/dist/install-NLVYISAV.js +0 -14
  119. package/dist/runner-env-26NLQI35.js +0 -15
@@ -1,28 +1,28 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { readsJobState, READ_JOB_STATE_FORMATS, jobStateFormatOf } from './chunk-ZVB57WI6.js';
4
- import { DOCKERD_LOG, HELPER_PATH, HELPER_RECORD } from './chunk-W5DOK7BL.js';
5
- import { writeDockerClientConfig } from './chunk-QL3LPZ67.js';
4
+ import { DOCKERD_LOG, HELPER_PATH, HELPER_RECORD } from './chunk-HVRQQOMH.js';
5
+ import { writeDockerClientConfig } from './chunk-6LBSAW6I.js';
6
6
  import { zodProblem } from './chunk-I3LTIAOR.js';
7
- import { senderPidfile } from './chunk-QDMMW5PC.js';
8
- import { installScrubContext } from './chunk-3MXPS7ED.js';
9
- import { ADDED_USER, shellQuote, GH_CONFIG_YML, ghHostsYml, AssetError, obtainImage, ensureRootfs, makeBuildsDirPrivate, gitRemoteFor, startServicesFor, createLeaseChannel, createBuildDisk, machineConfig, startJailedInto, resolveAgentUser, AgentUserError, runBuildSteps, LEASE_SECONDS, createContainerRuntime, stopContainer, cleanupContainer, outOfMemoryReason, containerSenderCommand, signalInContainer, syncInContainer, copyTranscriptsFromContainer, MANAGED_UNJAILED_REASON, senderAliveScript, helperFirecrackerNote, isLiteralAddress, stopJailed, deleteBuildDisk, startCheckContainer, lifecycleSteps, lifecycleFailureReason, writeEvalInput, DeliveryFailure, EVAL_INPUT_NAME, copyTranscripts, senderSignalScript, containerJudgeEnvironment, ROOT_DISK_ID_PREFIX, copyJudgeTree } from './chunk-D3HRAPNF.js';
10
- import { readBranchHead, fetchCommit, diffBetween } from './chunk-KLXWS5Z7.js';
7
+ import { senderPidfile } from './chunk-Q2CMEQV7.js';
8
+ import { installScrubContext } from './chunk-2N67C6IV.js';
9
+ import { ADDED_USER, shellQuote, GH_CONFIG_YML, ghHostsYml, AssetError, obtainImage, ensureRootfs, makeBuildsDirPrivate, gitRemoteFor, startServicesFor, createLeaseChannel, createBuildDisk, machineConfig, startJailedInto, resolveAgentUser, AgentUserError, runBuildSteps, startHostServices, LEASE_SECONDS, createContainerRuntime, stopContainer, cleanupContainer, outOfMemoryReason, closeHostBuild, containerSenderCommand, hostCommandEnvironment, execArgv, signalInContainer, syncInContainer, copyTranscriptsFromContainer, MANAGED_UNJAILED_REASON, senderAliveScript, helperFirecrackerNote, stopJailed, deleteBuildDisk, startCheckContainer, lifecycleSteps, lifecycleFailureReason, writeEvalInput, DeliveryFailure, EVAL_INPUT_NAME, copyTranscripts, senderSignalScript, containerJudgeEnvironment, ROOT_DISK_ID_PREFIX, copyJudgeTree } from './chunk-2EGCI2VW.js';
10
+ import { readBranchHead, fetchCommit, diffBetween } from './chunk-YXHKCHWG.js';
11
11
  import { isSameProcess, startTimeOf } from './chunk-JBJTC3UU.js';
12
- import { waitForAgent, vmExecArgs } from './chunk-6NWS455T.js';
13
- import { socketPathProblem, vsockLinks, LEASE_LINK, linkVsockSockets } from './chunk-LWTBE5J6.js';
14
- import { describeCallFailure, resolveGoverningSource, prefetchGovernedContext, refusalCode, removeStagedContext, stageGovernedContext, pinnedSourceOf, commandWithShim, logStamp, createRunnerLog, removeKeptContext, formatDuration, retrySend, formatClock, WORKFLOW_PERMISSION_REASON, keptContextTree } from './chunk-RBJG5MM4.js';
15
- import { HASH_ARGV, parseProgramHash, JUDGE_PROGRAM, writeJobFile, readJobFile, childEnvironment, withAnswerProtocol, judgeCommand, MAX_REPORT_BYTES, JUDGE_MAX_TURNS, JUDGE_DIR, COMMAND_DIR, MAX_ITEMS_BYTES } from './chunk-43PV5KDB.js';
16
- import { CLAUDE_CODE_VERSION, FIRECRACKER_VERSION } from './chunk-TGHBOXKJ.js';
17
- import { imageBuildOf, isBuiltinContainer, isBuiltinProcess, isBuiltinVm, DEFAULT_CHECK_TIME_LIMIT_MINUTES } from './chunk-5BNWAIHN.js';
18
- import { parseSize } from './chunk-YJLHUKYS.js';
19
- import { WorkCommandError, postJson, isSignatureRefusal, getJson } from './chunk-CMKY36NV.js';
12
+ import { waitForAgent, vmExecArgs } from './chunk-5THSC6BD.js';
13
+ import { socketPathProblem, vsockLinks, LEASE_LINK, linkVsockSockets } from './chunk-L26V6ILJ.js';
14
+ import { describeCallFailure, resolveGoverningSource, prefetchGovernedContext, refusalCode, removeStagedContext, stageGovernedContext, pinnedSourceOf, commandWithShim, logStamp, createRunnerLog, removeKeptContext, formatDuration, retrySend, formatClock, WORKFLOW_PERMISSION_REASON, keptContextTree } from './chunk-T5REPMNL.js';
15
+ import { imageBuildOf, isBuiltinContainer, isBuiltinProcess, isBuiltinVm, DEFAULT_CHECK_TIME_LIMIT_MINUTES } from './chunk-RQJMN5TJ.js';
16
+ import { DEFAULT_CACHE_DISK, formatBytes, allocatedBytes } from './chunk-W2AEL4BJ.js';
17
+ import { parseSize, HASH_ARGV, parseProgramHash, JUDGE_PROGRAM, writeJobFile, readJobFile, childEnvironment, withAnswerProtocol, judgeCommand, MAX_REPORT_BYTES, JUDGE_MAX_TURNS, JUDGE_DIR, COMMAND_DIR, MAX_ITEMS_BYTES } from './chunk-FR7HWWCF.js';
18
+ import { CLAUDE_CODE_VERSION, FIRECRACKER_VERSION } from './chunk-NE63JADS.js';
19
+ import { WorkCommandError, postJson, isSignatureRefusal, getJson } from './chunk-VT4TTJPG.js';
20
20
  import { planArtifactUpload } from './chunk-EWVYQLD3.js';
21
21
  import { scrubText } from './chunk-5DNCFOXA.js';
22
22
  import { readCloudConfig } from './chunk-PJDQPF5N.js';
23
- import { signerFor } from './chunk-AA6LYZC4.js';
24
- import { RUNNER_FILE_MODE, runnerDir, buildDir, vsockPath, jobConsolePath } from './chunk-AGZNCIIJ.js';
25
- import { JOB_MOUNT, claudeCredential, repositoriesOf, primaryOf, buildEnvironment, CHECKOUT_DIR, parseIsolation, proxyEnvironment, withProxyWarningHidden, containerLocalAddress, destinationEnvironment, CLAUDE_CREDENTIAL_VARIABLES, builtInEnvironment, withHooksPath, startBuildServices, BUILT_IN_NAMES, AGENT_CREDENTIAL_MISSING, sharedUserEnvironment, headerVariables, authorEnvironment, withTunnelRecord, commitIdentityRecord, buildMavenSettingsXml, mavenSettingsXml, namesGlobalSettings, MAVEN_NO_PROXY_NOTE, mavenArgs, MAVEN_SPACE_NOTE, writeMavenSettings, RELAY_PORT, repositoryPath, lifecycleWorkdir, CHECK_ITEMS_FILE, MAVEN_SETTINGS_FILE, currentClaudeCredential, removedClaudeCredentialValues, checkEnvironment, EVAL_INPUT_DIR } from './chunk-BCCI32ME.js';
23
+ import { signerFor } from './chunk-SOI6K5DY.js';
24
+ import { RUNNER_FILE_MODE, runnerDir, buildDir, vsockPath, jobConsolePath } from './chunk-PA6CK6WQ.js';
25
+ import { JOB_MOUNT, claudeCredential, repositoriesOf, primaryOf, buildEnvironment, CHECKOUT_DIR, AGENT_CREDENTIAL_MISSING, sharedUserEnvironment, headerVariables, authorEnvironment, withTunnelRecord, commitIdentityRecord, buildMavenSettingsXml, RELAY_PORT, repositoryPath, lifecycleWorkdir, CHECK_ITEMS_FILE, MAVEN_SETTINGS_FILE, CLAUDE_CREDENTIAL_VARIABLES, currentClaudeCredential, removedClaudeCredentialValues, checkEnvironment, EVAL_INPUT_DIR } from './chunk-BALIE3BA.js';
26
26
  import { resolvePackRoot } from './chunk-G63KT5I5.js';
27
27
  import { MAINTAINED_SKILLS } from './chunk-CDDED64E.js';
28
28
  import { resolveVersion } from './chunk-RA3O54FC.js';
@@ -31,8 +31,8 @@ import { CheckItemsSchema, CHECK_ITEM_REASON_MAX_LENGTH } from './chunk-E6CO3MJE
31
31
  import { homeFromEnv } from './chunk-VNVZDWO3.js';
32
32
  import { fdName } from './chunk-HACGUL52.js';
33
33
  import { RUNNER_WORDED_REASONS, UNKNOWN_TRACKING_REASON } from './chunk-MESOOLF4.js';
34
- import { existsSync, statSync, appendFileSync, rmSync, mkdirSync, chmodSync, writeFileSync, accessSync, constants, openSync, readFileSync, closeSync, readdirSync, lstatSync, fstatSync, readSync, realpathSync } from 'fs';
35
- import { join, isAbsolute, dirname, delimiter, sep } from 'path';
34
+ import { existsSync, statSync, appendFileSync, rmSync, mkdirSync, chmodSync, writeFileSync, openSync, readFileSync, closeSync, readdirSync, lstatSync, fstatSync, readSync, realpathSync } from 'fs';
35
+ import { join, dirname, delimiter, sep } from 'path';
36
36
  import { once } from 'events';
37
37
  import { createServer } from 'net';
38
38
  import { spawn, spawnSync } from 'child_process';
@@ -355,7 +355,7 @@ async function provisionMicroVm(input) {
355
355
  inBuilder: {
356
356
  kernel: assets.kernel,
357
357
  firecracker: assets.firecracker,
358
- limits,
358
+ limits: { ...limits, cacheDiskBytes: parseSize(config.build?.cacheDisk ?? DEFAULT_CACHE_DISK) ?? parseSize(DEFAULT_CACHE_DISK) },
359
359
  memory: config.build?.memory,
360
360
  allowHosts: config.build?.allowHosts,
361
361
  managed: config.managed === true,
@@ -442,7 +442,7 @@ async function provisionMicroVm(input) {
442
442
  let services;
443
443
  try {
444
444
  const gitRemote = gitRemoteFor(runtime, { repositories, tokens, buildDir: buildDir2, log: (line) => log.line(`${tag} ${line}`) });
445
- services = await startServicesFor(runtime, config, buildDir2, jobDir, itemKey, true, gitRemote);
445
+ services = await startServicesFor(runtime, config, buildDir2, jobDir, itemKey, true, gitRemote, "socket", void 0, void 0, (line) => log.line(`${tag} ${line}`));
446
446
  runtime.tunnels.set(buildId, services);
447
447
  } catch (err) {
448
448
  return bail(`the tunnel could not start: ${describeCallFailure(err)}`);
@@ -627,7 +627,8 @@ async function provisionMicroVm(input) {
627
627
  }
628
628
  },
629
629
  removeStagedContext: () => removeStagedContext(buildDir2),
630
- keepIn: jobDir
630
+ keepIn: jobDir,
631
+ ...input.requireBuildSkill === true ? { requireBuildSkill: true } : {}
631
632
  });
632
633
  if (!steps.ok) return bail(steps.reason, steps.aborted === true);
633
634
  state.startCommit = steps.startCommit;
@@ -1049,7 +1050,7 @@ async function stopBuildMicroVm(runtime, state, jobDir) {
1049
1050
  await runtime.vm.firecracker.stop(state.firecracker);
1050
1051
  if (runtime.vm.firecracker.alive(state.firecracker)) throw new Error(`the microVM (pid ${state.firecracker.pid}) is still running after it was stopped`);
1051
1052
  }
1052
- async function cleanupMicroVm(runtime, state, jobDir, warn) {
1053
+ async function cleanupMicroVm(runtime, state, jobDir, warn, onBuildDisk) {
1053
1054
  const failures = [];
1054
1055
  if (jobDir !== void 0) await copyHookErrors(runtime, state, jobDir);
1055
1056
  if (state.jailed !== void 0) {
@@ -1073,6 +1074,13 @@ async function cleanupMicroVm(runtime, state, jobDir, warn) {
1073
1074
  failures.push(`the build's cgroup ${state.cgroup} was not removed: ${describeCallFailure(err)}`);
1074
1075
  }
1075
1076
  }
1077
+ if (state.buildDisk !== void 0 && existsSync(state.buildDisk)) {
1078
+ try {
1079
+ onBuildDisk?.(allocatedBytes(state.buildDisk));
1080
+ } catch (err) {
1081
+ failures.push(`the build disk's peak size was not recorded: ${describeCallFailure(err)}`);
1082
+ }
1083
+ }
1076
1084
  if (state.buildDisk !== void 0) deleteBuildDisk(state.buildDisk);
1077
1085
  runtime.leases.get(state.buildId)?.close();
1078
1086
  runtime.leases.delete(state.buildId);
@@ -1216,262 +1224,6 @@ async function sampleGuest(runtime, state) {
1216
1224
  return void 0;
1217
1225
  }
1218
1226
  }
1219
- function provisionEnvironment(base, input) {
1220
- return {
1221
- ...base,
1222
- OUTERLAYER_BUILD_DIR: input.buildDir,
1223
- ...input.repository === void 0 || input.repository === null || input.repository === "" ? {} : { OUTERLAYER_REPOSITORY: input.repository },
1224
- ...input.recipeCommit === void 0 ? {} : { OUTERLAYER_RECIPE_COMMIT: input.recipeCommit },
1225
- OUTERLAYER_MEMORY: input.limits.memory,
1226
- OUTERLAYER_CPUS: String(input.limits.cpus),
1227
- OUTERLAYER_PIDS: String(input.limits.pids),
1228
- OUTERLAYER_DISK: input.limits.disk
1229
- };
1230
- }
1231
- function unspecified(address) {
1232
- if (!address.includes(":")) return address === "0.0.0.0";
1233
- const normal = new URL(`http://[${address}]/`).hostname;
1234
- return normal === "[::]" || normal === "[::ffff:0:0]";
1235
- }
1236
- function parseBroker(text2) {
1237
- const match = /^(?:\[([0-9a-fA-F:.]+)\]|([0-9.]+)):(\d{1,5})$/.exec(text2);
1238
- if (match === null) return void 0;
1239
- const host = match[1] ?? match[2];
1240
- const port = Number(match[3]);
1241
- if (!isLiteralAddress(host) || unspecified(host) || port < 1 || port > 65535) return void 0;
1242
- return { host, port, text: text2 };
1243
- }
1244
- function readReport(path) {
1245
- const named = `provision.out names recipe ${path}`;
1246
- if (!isAbsolute(path)) return { problem: `${named}, which is not an absolute path` };
1247
- let text2;
1248
- try {
1249
- text2 = readFileSync(path, "utf8");
1250
- } catch {
1251
- return { problem: `${named}, which does not exist` };
1252
- }
1253
- try {
1254
- const parsed = JSON.parse(text2);
1255
- const lifecycle = parsed.apply?.lifecycle;
1256
- if (typeof parsed.sourceCommit === "string" && typeof parsed.recipeKey === "string" && typeof parsed.imageId === "string" && typeof lifecycle === "object" && lifecycle !== null && Object.values(lifecycle).every((entries) => Array.isArray(entries) && entries.every((entry) => typeof entry === "object" && entry !== null))) {
1257
- return { report: { ...parsed, ignored: Array.isArray(parsed.ignored) ? parsed.ignored : [] } };
1258
- }
1259
- } catch {
1260
- }
1261
- return { problem: `${named}, which is not a recipe report` };
1262
- }
1263
- function resolveHostBuild(keys) {
1264
- const build = { isolation: parseIsolation(keys.isolation) };
1265
- if (keys.exec !== void 0) {
1266
- const named = `provision.out names exec ${keys.exec}`;
1267
- if (!isAbsolute(keys.exec)) return { ok: false, reason: `${named}, which is not an absolute path` };
1268
- try {
1269
- if (!statSync(keys.exec).isFile()) return { ok: false, reason: `${named}, which is not an executable file` };
1270
- accessSync(keys.exec, constants.X_OK);
1271
- } catch {
1272
- return { ok: false, reason: `${named}, which is not an executable file` };
1273
- }
1274
- build.exec = keys.exec;
1275
- }
1276
- if (keys.broker !== void 0) {
1277
- const broker = parseBroker(keys.broker);
1278
- if (broker === void 0) {
1279
- return { ok: false, reason: `provision.out names broker ${keys.broker}, which is not <IP>:<port> with a literal address that is not 0.0.0.0 or ::` };
1280
- }
1281
- build.broker = broker;
1282
- }
1283
- if (keys.recipe !== void 0) {
1284
- const read = readReport(keys.recipe);
1285
- if ("problem" in read) return { ok: false, reason: read.problem };
1286
- build.recipe = read.report;
1287
- build.recipePath = keys.recipe;
1288
- }
1289
- return { ok: true, build };
1290
- }
1291
- function hostEnvironment(build, cliVersion) {
1292
- const report = build.recipe;
1293
- return {
1294
- isolation: build.isolation,
1295
- ...report === void 0 ? {} : {
1296
- recipe: { sourceCommit: report.sourceCommit, key: report.recipeKey, path: report.recipe },
1297
- imageId: report.imageId,
1298
- ignoredProperties: report.ignored.map(({ property, source }) => ({ property, source }))
1299
- },
1300
- cliVersion
1301
- };
1302
- }
1303
- var CD_INTO_WORKDIR = 'cd -- "$0" && exec "$@"';
1304
- function execArgv(workdir, argv) {
1305
- return ["/bin/sh", "-c", CD_INTO_WORKDIR, workdir, ...argv];
1306
- }
1307
- function execCommandLine(exec, workdir, cmdline) {
1308
- return [exec, ...execArgv(workdir, ["/bin/sh", "-c", cmdline])].map(shellQuote).join(" ");
1309
- }
1310
- function proxyUrlFor(build) {
1311
- if (build.broker === void 0) return `http://127.0.0.1:${RELAY_PORT}`;
1312
- return `http://${build.broker}`;
1313
- }
1314
- function withMavenArgs(env, settingsFile, note) {
1315
- const team = env.MAVEN_ARGS;
1316
- if (team !== void 0 && namesGlobalSettings(team)) {
1317
- note?.(MAVEN_NO_PROXY_NOTE);
1318
- return;
1319
- }
1320
- if (settingsFile !== void 0) env.MAVEN_ARGS = mavenArgs(settingsFile, team).value;
1321
- }
1322
- function hostMavenSettings(env, buildDir2, note) {
1323
- if (/\s/.test(buildDir2)) {
1324
- note?.(MAVEN_SPACE_NOTE);
1325
- return void 0;
1326
- }
1327
- if (!existsSync(buildDir2)) return void 0;
1328
- try {
1329
- return writeMavenSettings(buildDir2, env.HTTPS_PROXY, env.NO_PROXY);
1330
- } catch (err) {
1331
- note?.(`the build's Maven settings could not be written, so its Maven gets no proxy from the runner: ${describeCallFailure(err)}`);
1332
- return void 0;
1333
- }
1334
- }
1335
- function execProxyEnvironment(build) {
1336
- const brokerHost = build.broker === void 0 ? void 0 : build.broker.slice(0, build.broker.lastIndexOf(":")).replace(/^\[|\]$/g, "");
1337
- return proxyEnvironment(proxyUrlFor(build), brokerHost);
1338
- }
1339
- var WRITE_MAVEN_SETTINGS = 'd=$(git rev-parse --absolute-git-dir) || exit 1; d="$d/outerlayer/maven"; mkdir -p "$d" && printf "%s" "$1" > "$d/settings.xml" && printf "%s\\n" "$d/settings.xml"';
1340
- var MAVEN_WRITE_TIMEOUT_MS = 1e4;
1341
- function runWithSpawn(spawnFn = spawn) {
1342
- return (file, args, env, timeoutMs) => new Promise((resolve) => {
1343
- let stdout = "";
1344
- let stderr = "";
1345
- let timer;
1346
- let settled = false;
1347
- const finish = (result) => {
1348
- if (settled) return;
1349
- settled = true;
1350
- if (timer !== void 0) clearTimeout(timer);
1351
- resolve({ status: null, signal: null, stdout, stderr, ...result });
1352
- };
1353
- let child;
1354
- try {
1355
- child = spawnFn(file, args, { env, stdio: ["ignore", "pipe", "pipe"] });
1356
- } catch (err) {
1357
- finish({ error: err instanceof Error ? err : new Error(String(err)) });
1358
- return;
1359
- }
1360
- timer = setTimeout(() => {
1361
- child.kill("SIGKILL");
1362
- finish({ error: new Error(`it did not finish in ${timeoutMs / 1e3}s`) });
1363
- }, timeoutMs);
1364
- child.stdout?.on("data", (chunk) => {
1365
- stdout += String(chunk);
1366
- });
1367
- child.stderr?.on("data", (chunk) => {
1368
- stderr += String(chunk);
1369
- });
1370
- child.on("error", (err) => finish({ error: err }));
1371
- child.on("close", (status, signal) => finish({ status, signal }));
1372
- });
1373
- }
1374
- async function deliverMavenSettings(build, workdir, base, run, timeoutMs = MAVEN_WRITE_TIMEOUT_MS) {
1375
- if (build.exec === void 0) return { reason: "the build has no exec" };
1376
- const env = { ...base, ...execProxyEnvironment(build) };
1377
- const ran = await run(build.exec, execArgv(workdir, ["/bin/sh", "-c", WRITE_MAVEN_SETTINGS, "sh", mavenSettingsXml(env.HTTPS_PROXY, env.NO_PROXY)]), env, timeoutMs);
1378
- if (ran.error !== void 0) return { reason: describeCallFailure(ran.error) };
1379
- const said = ran.stderr.trim().split("\n")[0];
1380
- if (ran.status !== 0) return { reason: `the write exited ${ran.status ?? ran.signal}${said === "" ? "" : `: ${said}`}` };
1381
- const lines = ran.stdout.trim().split("\n");
1382
- const path = lines[lines.length - 1].trim();
1383
- if (!isAbsolute(path)) return { reason: "the write did not report an absolute path" };
1384
- if (/\s/.test(path)) return { reason: MAVEN_SPACE_REASON };
1385
- return { path };
1386
- }
1387
- var MAVEN_SPACE_REASON = "the settings file's path has whitespace in it, which Maven cannot read from MAVEN_ARGS";
1388
- async function deliverExecMaven(build, workdir, base, run, note) {
1389
- if (build?.exec === void 0) return;
1390
- const delivered = await deliverMavenSettings(build, workdir, base, run);
1391
- if ("path" in delivered) build.mavenSettings = delivered.path;
1392
- else note(`the build's Maven gets no proxy from the runner: ${delivered.reason}`);
1393
- }
1394
- function onceNote(write) {
1395
- const seen = /* @__PURE__ */ new Set();
1396
- return (line) => {
1397
- if (seen.has(line)) return;
1398
- seen.add(line);
1399
- write(line);
1400
- };
1401
- }
1402
- function attemptNote(log, tag) {
1403
- return onceNote((line) => log.line(`${tag} ${line}`));
1404
- }
1405
- function hostCommandEnvironment(base, build, config, hooksPath, note) {
1406
- let env = { ...base };
1407
- if (build.exec !== void 0) {
1408
- Object.assign(env, execProxyEnvironment(build));
1409
- withMavenArgs(env, build.mavenSettings, note);
1410
- } else if (build.proxyPort !== void 0) {
1411
- Object.assign(env, proxyEnvironment(`http://127.0.0.1:${build.proxyPort}`));
1412
- env.NODE_OPTIONS = withProxyWarningHidden(env.NODE_OPTIONS);
1413
- withMavenArgs(env, hostMavenSettings(env, build.buildDir, note), note);
1414
- }
1415
- const ports = build.destinations ?? [];
1416
- const portOf = (name) => ports.find((entry) => entry.name === name)?.port;
1417
- (config.build?.destinations ?? []).forEach((destination, index) => {
1418
- const port = portOf(destination.name);
1419
- const address = build.exec !== void 0 ? containerLocalAddress(index) : port === void 0 ? void 0 : `http://127.0.0.1:${port}/`;
1420
- if (address !== void 0) Object.assign(env, destinationEnvironment([destination], () => address));
1421
- });
1422
- if (build.builtIns === true) {
1423
- const credential = claudeCredential(base);
1424
- for (const name of CLAUDE_CREDENTIAL_VARIABLES) delete env[name];
1425
- Object.assign(env, builtInEnvironment((name) => `http://127.0.0.1:${portOf(name) ?? 0}`, credential));
1426
- }
1427
- if (build.exec === void 0 && hooksPath !== void 0) env = withHooksPath(env, hooksPath);
1428
- return env;
1429
- }
1430
- async function startHostServices(input) {
1431
- const { runtime, config, build } = input;
1432
- const destinations = config.build?.destinations ?? [];
1433
- const services = await startBuildServices({
1434
- startTunnel: runtime.startTunnel,
1435
- tunnelOptions: runtime.tunnelOptions,
1436
- buildDir: build.buildDir,
1437
- jobDir: input.jobDir,
1438
- destinations,
1439
- allowHosts: config.build?.allowHosts,
1440
- serve: input.process ? "tcp" : "both",
1441
- proxy: input.process,
1442
- ...input.process ? { builtIns: { gatewayUrl: config.url, itemKey: input.itemKey, claudeUpstream: runtime.claudeUpstream } } : {},
1443
- ports: {
1444
- proxy: build.proxyPort,
1445
- destinations: build.destinations?.filter((d) => !BUILT_IN_NAMES.includes(d.name)).map((d) => d.port),
1446
- builtIns: Object.fromEntries((build.destinations ?? []).filter((d) => BUILT_IN_NAMES.includes(d.name)).map((d) => [d.name, d.port]))
1447
- },
1448
- hostEnv: runtime.hostEnv,
1449
- destinationOptions: runtime.destinationOptions
1450
- });
1451
- build.proxyPort = services.proxyPort;
1452
- build.destinations = [
1453
- ...destinations.map((destination, index) => ({ name: destination.name, port: services.destinationPorts[index] })),
1454
- ...Object.entries(services.builtInPorts).map(([name, port]) => ({ name, port }))
1455
- ];
1456
- if (input.process) build.builtIns = true;
1457
- runtime.tunnels.set(build.buildId, services);
1458
- if (build.broker !== void 0) await listenOnBroker(services, build.broker);
1459
- return services;
1460
- }
1461
- async function listenOnBroker(tunnel, broker) {
1462
- const parsed = parseBroker(broker);
1463
- if (parsed === void 0) throw new Error(`${broker} is not a broker address`);
1464
- await tunnel.listenTcp({ host: parsed.host, port: parsed.port });
1465
- }
1466
- async function closeHostBuild(runtime, build) {
1467
- const tunnel = runtime.tunnels.get(build.buildId);
1468
- if (tunnel !== void 0) {
1469
- runtime.tunnels.delete(build.buildId);
1470
- await tunnel.close();
1471
- }
1472
- rmSync(build.buildDir, { recursive: true, force: true });
1473
- if (build.workDir !== void 0) rmSync(build.workDir, { recursive: true, force: true });
1474
- }
1475
1227
 
1476
1228
  // src/runner/verdict.ts
1477
1229
  var VERDICT_SETTLE_MS = 5 * 6e4;
@@ -1564,6 +1316,7 @@ function isTailedStage(stage) {
1564
1316
  const tailed = ["provision", "sync", "cleanup", "report"];
1565
1317
  return tailed.includes(stage);
1566
1318
  }
1319
+ var PROVISION_PROBLEM = /\b(warn(ing)?|error|fail(ed|ure)?|refused)\b/i;
1567
1320
  var READ_LIMIT_BYTES = 1048576;
1568
1321
  var ITEM_LINE = /^#(\d+)\b/;
1569
1322
  var AttemptLogBook = class {
@@ -1668,6 +1421,11 @@ function buildReleaseLog(jobDirPath, endStage, scrub) {
1668
1421
  const tail = stage === void 0 ? [] : lastLines(stage);
1669
1422
  if (tail.length > 0) parts.push(`--- the last ${tail.length} lines of ${file} ---`, ...tail);
1670
1423
  }
1424
+ if (endStage !== "provision") {
1425
+ const provision = readEnd(join(jobDirPath, "provision.log"), READ_LIMIT_BYTES);
1426
+ const problems = provision === void 0 ? [] : provision.split("\n").filter((line) => PROVISION_PROBLEM.test(line)).slice(-50);
1427
+ if (problems.length > 0) parts.push(`--- provision problems (${problems.length} lines of provision.log) ---`, ...problems);
1428
+ }
1671
1429
  if (parts.length === 0) return void 0;
1672
1430
  return capRunnerLog(scrub(parts.join("\n")) + "\n");
1673
1431
  }
@@ -1696,7 +1454,7 @@ async function provisionProcess(input) {
1696
1454
  mkdirSync(buildDir2, { recursive: true });
1697
1455
  chmodSync(buildDir2, 493);
1698
1456
  try {
1699
- await startHostServices({ runtime, config, build: state, jobDir, itemKey: input.itemKey, process: true });
1457
+ await startHostServices({ runtime, config, build: state, jobDir, itemKey: input.itemKey, process: true, routeLog: (line) => input.log.line(`#${item.number} ${line}`) });
1700
1458
  } catch (err) {
1701
1459
  return bail(`the tunnel could not start: ${describeCallFailure(err)}`);
1702
1460
  }
@@ -2919,7 +2677,8 @@ function scrubTunnelRecord(record, config) {
2919
2677
  hostsMore: record.hostsMore,
2920
2678
  refusalsMore: record.refusalsMore,
2921
2679
  refusals: record.refusals.map((r) => ({ ...r, host: scrubText(r.host) })),
2922
- destinations: (record.destinations ?? []).map((name) => scrubText(name))
2680
+ destinations: (record.destinations ?? []).map((name) => scrubText(name)),
2681
+ ...record.routes === void 0 ? {} : { routes: Object.fromEntries(Object.entries(record.routes).map(([name, counts]) => [scrubText(name), counts])) }
2923
2682
  };
2924
2683
  }
2925
2684
  function runCommand(cmdline, env, cwd, logPath, spawnFn = spawn) {
@@ -3054,6 +2813,9 @@ async function releaseLease(config, item, outcome, detail, fetchImpl) {
3054
2813
  sent = "ok";
3055
2814
  } else if (log !== void 0 && /\blog\b/.test(err.message)) {
3056
2815
  log = void 0;
2816
+ } else if (environment?.routes !== void 0) {
2817
+ const { routes: _omittedRoutes, ...withoutRoutes } = environment;
2818
+ environment = withoutRoutes;
3057
2819
  } else if (environment?.guestUsage !== void 0) {
3058
2820
  const { guestUsage: _omittedUsage, ...withoutUsage } = environment;
3059
2821
  environment = withoutUsage;
@@ -3324,7 +3086,17 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
3324
3086
  let cleanedUp = true;
3325
3087
  tunnelRecord = vmBuild.runtime.tunnels.get(vmBuild.state.buildId)?.record();
3326
3088
  try {
3327
- await cleanupMicroVm(vmBuild.runtime, vmBuild.state, jobDirPath, (text2) => log.error(`${tag} ${text2}`));
3089
+ await cleanupMicroVm(
3090
+ vmBuild.runtime,
3091
+ vmBuild.state,
3092
+ jobDirPath,
3093
+ (text2) => log.error(`${tag} ${text2}`),
3094
+ (bytes) => {
3095
+ job.buildDiskPeakBytes = bytes;
3096
+ writeJobFile(join(jobDirPath, "job.json"), job);
3097
+ log.line(`${tag} build disk peak ${formatBytes(bytes)}`);
3098
+ }
3099
+ );
3328
3100
  } catch (err) {
3329
3101
  cleanedUp = false;
3330
3102
  log.error(`${tag} cleanup failed: ${describeCallFailure(err)} \xB7 continuing`);
@@ -3775,4 +3547,4 @@ async function stopSender(input) {
3775
3547
  }
3776
3548
  }
3777
3549
 
3778
- export { ALREADY_RELEASED, AttemptLogBook, EXIT_CODE_FILE, GUEST_USAGE_INTERVAL_MS, MICROVM_COMMAND_DIR, RENEW_INTERVAL_SECONDS, appendCommandLog, attemptNote, commandLogOffset, deliverCommitHooks, deliverExecMaven, describeHookEnd, execArgv, execCommandLine, finishJob, foldSample, hookLimitsFor, hostCommandEnvironment, hostEnvironment, inTeardown, isContainerTracked, isGroupAlive, isIdle, isMicroVmTracked, isReadable, isTimedOut, isTracked, isUnfinished, jobEnv, judgeProbe, listAdoptableJobs, listTrackedJobs, listUnreadableJobs, listenOnBroker, microVmCommandLine, microVmOomKills, needsRenew, outcomeFromExitCode, probeCommand, probeMicroVmCommand, provisionEnvironment, provisionMicroVm, provisionProcess, readCpuUsec, readProvisionOut, recoverLostJobs, releaseLease, renewLease, resolveHostBuild, restartSender, retryFailedReleases, runCommand, runHook, runWithSpawn, sampleGuest, serveLease, setStage, startHostServices, startMicroVmCommand, startSender, stopOrphanedMicroVms, unfinishedJobs, vmAlive, workdirProblem, writeGuestGhConfig };
3550
+ export { ALREADY_RELEASED, AttemptLogBook, EXIT_CODE_FILE, GUEST_USAGE_INTERVAL_MS, MICROVM_COMMAND_DIR, RENEW_INTERVAL_SECONDS, appendCommandLog, commandLogOffset, deliverCommitHooks, describeHookEnd, finishJob, foldSample, hookLimitsFor, inTeardown, isContainerTracked, isGroupAlive, isIdle, isMicroVmTracked, isReadable, isTimedOut, isTracked, isUnfinished, jobEnv, judgeProbe, listAdoptableJobs, listTrackedJobs, listUnreadableJobs, microVmCommandLine, microVmOomKills, needsRenew, outcomeFromExitCode, probeCommand, probeMicroVmCommand, provisionMicroVm, provisionProcess, readCpuUsec, readProvisionOut, recoverLostJobs, releaseLease, renewLease, restartSender, retryFailedReleases, runCommand, runHook, sampleGuest, serveLease, setStage, startMicroVmCommand, startSender, stopOrphanedMicroVms, unfinishedJobs, vmAlive, workdirProblem, writeGuestGhConfig };
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { LiveUploader } from './chunk-3MXPS7ED.js';
3
+ import { LiveUploader } from './chunk-2N67C6IV.js';
4
4
  import { CaptureDaemon } from './chunk-5DNCFOXA.js';
5
- import { spoolDir } from './chunk-DJWKUQLO.js';
5
+ import { spoolDir } from './chunk-QPWFVE3X.js';
6
6
  import { parseWorkItemEnv } from './chunk-T2Q7ISPE.js';
7
7
  import { homeFromEnv } from './chunk-VNVZDWO3.js';
8
8
  import { mkdirSync, writeFileSync, rmSync } from 'fs';
@@ -684,7 +684,7 @@ async function missingControlPlane(cwd, sessionId, home, env) {
684
684
  cleanupEarlierCopies(dirs);
685
685
  }
686
686
  if (!contextPossiblyGoverned(cwd, home)) return void 0;
687
- const { governanceOf } = await import('./control-plane-launch-SMHL6MWW.js');
687
+ const { governanceOf } = await import('./control-plane-launch-A3YCHQNQ.js');
688
688
  if (await governanceOf({ cwd, env, home }) !== "governed") return void 0;
689
689
  recordMissingContext(dirs, sessionId, home);
690
690
  const launcher = `${cliInvocation()} claude`;
@@ -1,14 +1,53 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { MAX_ALLOW_HOSTS, allowHostProblem } from './chunk-UXYLWVTQ.js';
4
- import { parseSize } from './chunk-YJLHUKYS.js';
5
- import { isRefusedInConfig, resolveDestinations, isReservedVariable } from './chunk-BCCI32ME.js';
3
+ import { DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK } from './chunk-W2AEL4BJ.js';
4
+ import { parseSize } from './chunk-FR7HWWCF.js';
5
+ import { isRefusedInConfig, resolveDestinations, isReservedVariable } from './chunk-BALIE3BA.js';
6
6
  import { homeFromEnv } from './chunk-VNVZDWO3.js';
7
7
  import { existsSync, statSync, accessSync, constants, readFileSync } from 'fs';
8
8
  import { hostname } from 'os';
9
9
  import { join } from 'path';
10
10
 
11
11
  createRequire(import.meta.url);
12
+
13
+ // src/runner/allow-hosts.ts
14
+ var MAX_ALLOW_HOSTS = 500;
15
+ var LABEL = /^(?!-)[a-z0-9-]{1,63}(?<!-)$/;
16
+ var IPV4 = /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;
17
+ function isAddress(text) {
18
+ if (IPV4.test(text)) return true;
19
+ try {
20
+ new URL(`http://[${text}]/`);
21
+ return true;
22
+ } catch {
23
+ return false;
24
+ }
25
+ }
26
+ function isHostName(text) {
27
+ const labels = text.split(".");
28
+ return text.length <= 253 && labels.every((label) => LABEL.test(label)) && !/^\d+$/.test(labels.at(-1));
29
+ }
30
+ function allowHostProblem(entry) {
31
+ if (typeof entry !== "string") return "is not a string";
32
+ const text = entry.toLowerCase();
33
+ if (isAddress(text)) return void 0;
34
+ if (text.startsWith("*.")) {
35
+ const domain = text.slice(2);
36
+ if (!isHostName(domain)) return "is not a host name after *.";
37
+ if (!domain.includes(".")) return "is too broad: a pattern needs a domain with at least two labels after *.";
38
+ return void 0;
39
+ }
40
+ return isHostName(text) ? void 0 : "is not a host name, a *. pattern or an IP address";
41
+ }
42
+ function hostAllowed(host, allowHosts) {
43
+ const name = host.toLowerCase().replace(/\.$/, "");
44
+ return allowHosts.some((entry) => {
45
+ const pattern = entry.toLowerCase();
46
+ return pattern.startsWith("*.") ? name.endsWith(pattern.slice(1)) : name === pattern;
47
+ });
48
+ }
49
+
50
+ // src/runner/config.ts
12
51
  var BUILTIN_CONTAINER = "builtin:container";
13
52
  var BUILTIN_PROCESS = "builtin:process";
14
53
  var BUILTIN_VM = "builtin:vm";
@@ -34,12 +73,12 @@ var DEFAULT_IDLE_LIMIT_MINUTES = 30;
34
73
  var DEFAULT_CHECK_TIME_LIMIT_MINUTES = 10;
35
74
  var CHECKS_KEYS = ["timeLimitMinutes"];
36
75
  var MAX_CHECK_TIME_LIMIT_MINUTES = 240;
37
- var DEFAULT_BUILD = { memory: "8g", cpus: 4, pids: 4096, disk: "40g", variables: [] };
76
+ var DEFAULT_BUILD = { memory: "8g", cpus: 4, pids: 4096, disk: DEFAULT_BUILD_DISK, cacheDisk: DEFAULT_CACHE_DISK, variables: [] };
38
77
  function imageBuildOf(config) {
39
78
  if (builtinKind(config.hooks.provision) !== "vm") return "host";
40
79
  return config.build?.imageBuild ?? "vm";
41
80
  }
42
- var BUILD_KEYS = ["memory", "cpus", "pids", "disk", "variables", "destinations", "allowHosts", "imageBuild"];
81
+ var BUILD_KEYS = ["memory", "cpus", "pids", "disk", "cacheDisk", "variables", "destinations", "allowHosts", "imageBuild"];
43
82
  var HOUSEKEEPING_KEYS = ["jobsKeepDays", "buildCacheMax", "minFreeDisk"];
44
83
  var DEFAULT_JOBS_KEEP_DAYS = 30;
45
84
  var DEFAULT_BUILD_CACHE_MAX = "20g";
@@ -366,7 +405,7 @@ function resolveBuild(configPath, block) {
366
405
  const near = nearestKey(key, BUILD_KEYS);
367
406
  fail(configPath, `runner.build.${key}`, near ? `is not a key this block accepts; did you mean ${near}?` : "is not a key this block accepts");
368
407
  }
369
- for (const key of ["memory", "disk"]) {
408
+ for (const key of ["memory", "disk", "cacheDisk"]) {
370
409
  const value = given[key];
371
410
  if (value === void 0) continue;
372
411
  if (typeof value !== "string" || parseSize(value) === void 0) fail(configPath, `runner.build.${key}`, 'must be a size such as "8g" or "512m"');
@@ -408,6 +447,7 @@ function resolveBuild(configPath, block) {
408
447
  cpus: given.cpus ?? DEFAULT_BUILD.cpus,
409
448
  pids: given.pids ?? DEFAULT_BUILD.pids,
410
449
  disk: given.disk ?? DEFAULT_BUILD.disk,
450
+ cacheDisk: given.cacheDisk ?? DEFAULT_BUILD.cacheDisk,
411
451
  variables,
412
452
  ...destinations.length === 0 ? {} : { destinations },
413
453
  ...allowHosts === void 0 ? {} : { allowHosts },
@@ -415,4 +455,4 @@ function resolveBuild(configPath, block) {
415
455
  };
416
456
  }
417
457
 
418
- export { DEFAULT_CHECK_TIME_LIMIT_MINUTES, DEFAULT_UPDATE_MAX_WAIT_HOURS, RunnerConfigError, builtinKind, checkHooks, defaultRunnerConfigPath, hasRunnerBlock, imageBuildOf, isBuiltinContainer, isBuiltinProcess, isBuiltinVm, loadRunnerConfig, resolveBuild, resolveHousekeeping, runnerCredentialProblem, runnerVmOf };
458
+ export { DEFAULT_CHECK_TIME_LIMIT_MINUTES, DEFAULT_UPDATE_MAX_WAIT_HOURS, MAX_ALLOW_HOSTS, RunnerConfigError, allowHostProblem, builtinKind, checkHooks, defaultRunnerConfigPath, hasRunnerBlock, hostAllowed, imageBuildOf, isBuiltinContainer, isBuiltinProcess, isBuiltinVm, loadRunnerConfig, resolveBuild, resolveHousekeeping, runnerCredentialProblem, runnerVmOf };