@outerlayer/cli 0.8.0 → 0.8.1

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 (55) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/{agent-setup-C7PLRXZO.js → agent-setup-K6RD2Z4P.js} +3 -3
  3. package/dist/build-info.json +1 -1
  4. package/dist/{builder-G52A6GW2.js → builder-IG6FNA54.js} +1 -1
  5. package/dist/{check-FOF3PUKI.js → check-GX5ND6RO.js} +16 -15
  6. package/dist/{chunk-5TNS3PL7.js → chunk-2BRSMBBB.js} +2 -1
  7. package/dist/{chunk-3S4P55NE.js → chunk-4FPWKV7L.js} +2 -2
  8. package/dist/{chunk-IJBVPLZZ.js → chunk-5ODHQP6O.js} +24 -139
  9. package/dist/{chunk-AIL2R4SI.js → chunk-BF4KKEFY.js} +3 -3
  10. package/dist/{chunk-5FWNEQNZ.js → chunk-BQFNZOMQ.js} +1 -1
  11. package/dist/{chunk-4A5E2G4E.js → chunk-HSN5QNS5.js} +4 -4
  12. package/dist/chunk-I2UOAV7X.js +133 -0
  13. package/dist/{chunk-OEK4JEB3.js → chunk-I7CJIRMM.js} +13 -3
  14. package/dist/{chunk-JPR2WHHF.js → chunk-KSLNQOOS.js} +1 -1
  15. package/dist/{chunk-5QLNZGAQ.js → chunk-KV47VQJZ.js} +3 -3
  16. package/dist/{chunk-CM5QTKM4.js → chunk-M4ERCYDB.js} +84 -19
  17. package/dist/{chunk-K35RW5HP.js → chunk-PXFEYBDE.js} +1 -1
  18. package/dist/{chunk-IRCBTGWF.js → chunk-Q4432IZT.js} +4 -4
  19. package/dist/{chunk-7VNURP6M.js → chunk-QB5JQH5V.js} +15 -12
  20. package/dist/{chunk-TUUMW4TC.js → chunk-QNRSFEGY.js} +1 -1
  21. package/dist/{chunk-U3GOI2B4.js → chunk-TEKZRTM3.js} +1 -1
  22. package/dist/{chunk-M5POMKKW.js → chunk-V7NIVOFD.js} +5 -5
  23. package/dist/{chunk-BCLJSQCV.js → chunk-YO4PSLVB.js} +1 -1
  24. package/dist/{chunk-NALVDFIS.js → chunk-Z2THOHPP.js} +2 -2
  25. package/dist/{cli-AOJPAVFX.js → cli-X5ONGYNY.js} +80 -56
  26. package/dist/{command-SY3SVLAI.js → command-7NFU3IPO.js} +14 -11
  27. package/dist/{context-adopt-CE4KDXS3.js → context-adopt-D2Z7F7PB.js} +3 -3
  28. package/dist/{context-materialize-QL33HDJN.js → context-materialize-4PMTDS6K.js} +3 -3
  29. package/dist/{docker-676FD3CQ.js → docker-PRHRSJM5.js} +2 -2
  30. package/dist/{doctor-WR6TRPSU.js → doctor-KALLPCRB.js} +10 -10
  31. package/dist/{emit-artifact-cmd-AVM4YXMQ.js → emit-artifact-cmd-D5GMVWNC.js} +4 -4
  32. package/dist/{emit-criteria-cmd-LDBE4YDS.js → emit-criteria-cmd-IE7VIM64.js} +2 -2
  33. package/dist/{emit-finding-cmd-6R5WBPCH.js → emit-finding-cmd-46PTPN3A.js} +2 -2
  34. package/dist/{emit-result-cmd-2DMN6O6U.js → emit-result-cmd-KXHHP6HX.js} +4 -4
  35. package/dist/{hook-fast-XBOZ3N6L.js → hook-fast-5H5QBJKT.js} +1 -1
  36. package/dist/{host-key-KDYZ5ECC.js → host-key-YMLXY6QB.js} +1 -1
  37. package/dist/index.js +3 -3
  38. package/dist/{init-R2FJ5KNS.js → init-B4CECVOX.js} +9 -9
  39. package/dist/{init-KDK5QLQZ.js → init-S4DH6PWW.js} +9 -9
  40. package/dist/{init-cmd-BYZYAJ5P.js → init-cmd-P4MVCBCZ.js} +5 -5
  41. package/dist/{install-cmd-DCF7TVXD.js → install-cmd-BEC7XTNG.js} +2 -1
  42. package/dist/{loop-AG3PLXPO.js → loop-ODMRE3CW.js} +16 -15
  43. package/dist/{machine-LV6WBRRK.js → machine-J4SAB3Z2.js} +8 -8
  44. package/dist/{mcp-serve-cmd-N6UD2KBX.js → mcp-serve-cmd-CT47P4YQ.js} +2 -2
  45. package/dist/{session-sender-Q5HAMOL2.js → session-sender-V46VPWQ5.js} +5 -5
  46. package/dist/{status-HH4OSOHR.js → status-QBKSH3QE.js} +11 -11
  47. package/dist/{sync-cmd-CAEPJR7B.js → sync-cmd-RJR77V4O.js} +4 -4
  48. package/dist/{watch-LAAZFBHH.js → watch-YNZTFLEY.js} +4 -4
  49. package/dist/{work-claim-cmd-ARIYZARE.js → work-claim-cmd-KAD3ZAH7.js} +4 -4
  50. package/dist/{work-cmd-B3FOXZAL.js → work-cmd-CNWPTH7W.js} +3 -3
  51. package/dist/{work-comment-cmd-O5WGRI6K.js → work-comment-cmd-HH45S6UE.js} +3 -3
  52. package/dist/{work-open-pr-cmd-M6CQW7KW.js → work-open-pr-cmd-5KR3KFCN.js} +4 -4
  53. package/dist/{work-pr-cmd-C4YEGKD6.js → work-pr-cmd-TTEGCP76.js} +3 -3
  54. package/package.json +2 -2
  55. package/skill-pack/maintained/amend/SKILL.md +22 -6
@@ -5,9 +5,9 @@ import { detectActiveSession } from './chunk-BFESLKPP.js';
5
5
  import { sanitizeTerminal } from './chunk-ZYHKJKSU.js';
6
6
  import { resolveRepoIdentity } from './chunk-GAYWY4GI.js';
7
7
  import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
8
- import { defaultFetch } from './chunk-BCLJSQCV.js';
8
+ import { defaultFetch } from './chunk-YO4PSLVB.js';
9
9
  import { resolveGatewayCredentials, unauthorizedMessage } from './chunk-BOLTI6LR.js';
10
- import { signRunnerRequest } from './chunk-M5POMKKW.js';
10
+ import { signRunnerRequest } from './chunk-V7NIVOFD.js';
11
11
  import { homeFromEnv } from './chunk-VNVZDWO3.js';
12
12
 
13
13
  createRequire(import.meta.url);
@@ -347,7 +347,7 @@ async function runWorkLinkSession(opts) {
347
347
  return await linkSession(opts);
348
348
  } catch (err) {
349
349
  if (opts.logFailures) {
350
- const { logHookError } = await import('./hook-fast-XBOZ3N6L.js');
350
+ const { logHookError } = await import('./hook-fast-5H5QBJKT.js');
351
351
  const reason = err instanceof Error ? err.message : String(err);
352
352
  logHookError(opts.home ?? homeFromEnv(opts.env ?? process.env), new Error(`work link-session #${opts.number} failed: ${reason}`));
353
353
  }
@@ -3,24 +3,25 @@ import { createRequire } from 'node:module';
3
3
  import { readDefaultBranchHead, cloneRepository, buildRepositoryImage } from './chunk-TTNFGMHO.js';
4
4
  import { startTimeOf, isSameProcess } from './chunk-N5FOE5PS.js';
5
5
  import { currentCliBuild } from './chunk-OGFGZQA3.js';
6
- import { createDockerHost, childEnvironment, spawnRun } from './chunk-U3GOI2B4.js';
6
+ import { createDockerHost, childEnvironment, spawnRun } from './chunk-TEKZRTM3.js';
7
7
  import { RecipeError } from './chunk-QOZKPLVJ.js';
8
- import { builderSpec, runnerLabelValue, RUNNER_LABEL, BUILD_LABEL, prepareRunArgs, containerRunArgs, containerExecArgs } from './chunk-5TNS3PL7.js';
8
+ import { builderSpec, runnerLabelValue, RUNNER_LABEL, BUILD_LABEL, prepareRunArgs, containerRunArgs, containerExecArgs } from './chunk-2BRSMBBB.js';
9
9
  import { CLAUDE_CODE_VERSION, firecrackerArch, MICROVM_ARCHES, DEFAULT_BASE_IMAGE, GUEST_HELPER_SHA256, GUEST_ASSETS_BASE_URL, GUEST_KERNEL_SHA256, FIRECRACKER_BINARY_SHA256, FIRECRACKER_SHA256, FIRECRACKER_VERSION, GUEST_ASSETS_VERSION } from './chunk-CX22S5BA.js';
10
10
  import { execCapture } from './chunk-ZOAEPWGL.js';
11
11
  import { GUEST_CID } from './chunk-R7STSBLC.js';
12
- import { WorkCommandError, postJson } from './chunk-5QLNZGAQ.js';
12
+ import { WorkCommandError, postJson } from './chunk-KV47VQJZ.js';
13
13
  import { hostAllowed } from './chunk-UXYLWVTQ.js';
14
14
  import { parseDuKilobytes } from './chunk-7RQ73DLO.js';
15
15
  import { RELAY_PORT, CHECKOUT_DIR, JOB_MOUNT, claudeCredential, buildEnvironment, startBuildServices, checkEnvironment, AGENT_CREDENTIAL_MISSING } from './chunk-OD2VTIHN.js';
16
- import { defaultGitRunner, materializeContext } from './chunk-5FWNEQNZ.js';
16
+ import { defaultGitRunner, materializeContext } from './chunk-BQFNZOMQ.js';
17
17
  import { readContextManifest, readSourceCache } from './chunk-ZZXLM64C.js';
18
- import { signingFetchFor } from './chunk-BCLJSQCV.js';
19
- import { signerFor } from './chunk-M5POMKKW.js';
18
+ import { signingFetchFor } from './chunk-YO4PSLVB.js';
19
+ import { signerFor } from './chunk-V7NIVOFD.js';
20
20
  import { rootfsPathFor, diskTemplatesDir, RUNNER_FILE_MODE, stagedContextDir, contextHomeDir, ghConfigDir, runnerDirOfBuild, spoolDir, mirrorDir, buildDir, RUNNER_DIR_MODE, vmAssetsDir } from './chunk-ZM2IMMYN.js';
21
21
  import { relative, join, dirname, basename } from 'path';
22
22
  import { readFileSync, existsSync, mkdirSync, chmodSync, truncateSync, rmSync, writeFileSync, accessSync, constants, readdirSync, statSync, rmdirSync, renameSync, lstatSync, unlinkSync, openSync, closeSync, mkdtempSync, createWriteStream, createReadStream } from 'fs';
23
23
  import { spawnSync, spawn } from 'child_process';
24
+ import { availableParallelism, networkInterfaces } from 'os';
24
25
  import { randomBytes, createHash } from 'crypto';
25
26
  import { createServer, request } from 'http';
26
27
  import { request as request$1 } from 'https';
@@ -29,7 +30,6 @@ import { pipeline, finished } from 'stream/promises';
29
30
  import { createGunzip, gunzipSync, constants as constants$1 } from 'zlib';
30
31
  import { isIP, connect, createServer as createServer$1 } from 'net';
31
32
  import { lookup } from 'dns/promises';
32
- import { networkInterfaces } from 'os';
33
33
 
34
34
  createRequire(import.meta.url);
35
35
  function logStamp(at) {
@@ -469,6 +469,63 @@ function lifecycleSteps(lifecycle) {
469
469
  function lifecycleFailureReason(step, exitCode) {
470
470
  return `lifecycle command ${step.name} (${step.source}) exited ${exitCode}`;
471
471
  }
472
+ function parseCpuList(text) {
473
+ const cores = /* @__PURE__ */ new Set();
474
+ for (const part of text.trim().split(",")) {
475
+ const match = /^(\d+)(?:-(\d+))?$/.exec(part.trim());
476
+ if (match === null) return void 0;
477
+ const low = Number(match[1]);
478
+ const high = match[2] === void 0 ? low : Number(match[2]);
479
+ if (high < low) return void 0;
480
+ for (let core = low; core <= high; core++) cores.add(core);
481
+ }
482
+ return [...cores].sort((a, b) => a - b);
483
+ }
484
+ function formatCpuList(cores) {
485
+ const sorted = [...new Set(cores)].sort((a, b) => a - b);
486
+ const parts = [];
487
+ for (let i = 0; i < sorted.length; i++) {
488
+ const start = sorted[i];
489
+ while (sorted[i + 1] === sorted[i] + 1) i++;
490
+ parts.push(start === sorted[i] ? String(start) : `${start}-${sorted[i]}`);
491
+ }
492
+ return parts.join(",");
493
+ }
494
+ function usableCpus(deps = {}) {
495
+ try {
496
+ const status = (deps.readStatus ?? (() => readFileSync("/proc/self/status", "utf8")))();
497
+ const cores = parseCpuList(/^Cpus_allowed_list:\s*(.+)$/m.exec(status)?.[1] ?? "");
498
+ if (cores !== void 0) return cores;
499
+ } catch {
500
+ }
501
+ return Array.from({ length: Math.max(1, (deps.parallelism ?? availableParallelism)()) }, (_unused, core) => core);
502
+ }
503
+ function createCpuAllocator(cores) {
504
+ const usable = [...new Set(cores)].sort((a, b) => a - b);
505
+ const held = /* @__PURE__ */ new Map();
506
+ const holders = (core) => {
507
+ let count = 0;
508
+ for (const set of held.values()) if (set.includes(core)) count++;
509
+ return count;
510
+ };
511
+ return {
512
+ acquire(buildId, cpus) {
513
+ const existing = held.get(buildId);
514
+ if (existing !== void 0) return existing;
515
+ const wanted = Math.min(Math.ceil(cpus), usable.length);
516
+ const ranked = usable.map((core) => ({ core, count: holders(core) })).sort((a, b) => a.count - b.count);
517
+ const chosen = ranked.slice(0, wanted).map(({ core }) => core).sort((a, b) => a - b);
518
+ held.set(buildId, chosen);
519
+ return chosen;
520
+ },
521
+ hold(buildId, set) {
522
+ held.set(buildId, [...set]);
523
+ },
524
+ release(buildId) {
525
+ held.delete(buildId);
526
+ }
527
+ };
528
+ }
472
529
  var AssetError = class extends Error {
473
530
  constructor(file, message) {
474
531
  super(message);
@@ -583,7 +640,7 @@ function templateScript() {
583
640
  ].join("\n");
584
641
  }
585
642
  var ids = () => ({ uid: String(process.getuid?.() ?? 0), gid: String(process.getgid?.() ?? 0) });
586
- function converterArgs(dest, extra, script) {
643
+ function converterArgs(dest, memoryBytes, extra, script) {
587
644
  const { uid, gid } = ids();
588
645
  return [
589
646
  "run",
@@ -591,6 +648,10 @@ function converterArgs(dest, extra, script) {
591
648
  "-i",
592
649
  "--network",
593
650
  "none",
651
+ "--memory",
652
+ String(memoryBytes),
653
+ "--memory-swap",
654
+ String(memoryBytes),
594
655
  "--mount",
595
656
  `type=bind,src=${dirname(dest)},dst=/out`,
596
657
  "-e",
@@ -636,18 +697,18 @@ function exportInto(container, converter) {
636
697
  function createRootfsHost() {
637
698
  const env = () => childEnvironment(process.env);
638
699
  return {
639
- async convert({ imageId, dest }) {
700
+ async convert({ imageId, dest, memoryBytes }) {
640
701
  const created = await spawnRun("docker", ["create", imageId, "none"], { env: env() });
641
702
  if (created.status !== 0) throw new Error(`docker create ${imageId} failed: ${firstLine2(created.stderr)}`);
642
703
  const container = created.stdout.trim();
643
704
  try {
644
- await exportInto(container, converterArgs(dest, [], converterScript()));
705
+ await exportInto(container, converterArgs(dest, memoryBytes, [], converterScript()));
645
706
  } finally {
646
707
  await spawnRun("docker", ["rm", "--force", "--volumes", container], { env: env() });
647
708
  }
648
709
  },
649
- async makeTemplate({ bytes, dest }) {
650
- const made = await spawnRun("docker", converterArgs(dest, ["-e", `BYTES=${bytes}`], templateScript()), { env: env() });
710
+ async makeTemplate({ bytes, dest, memoryBytes }) {
711
+ const made = await spawnRun("docker", converterArgs(dest, memoryBytes, ["-e", `BYTES=${bytes}`], templateScript()), { env: env() });
651
712
  if (made.status !== 0) throw new Error(`making the empty build disk failed: ${firstLine2(made.stderr)}`);
652
713
  },
653
714
  async imageConfig(imageId) {
@@ -696,14 +757,14 @@ async function ensureRootfs(input) {
696
757
  const path = rootfsPathFor(input.runnerDir, input.imageId);
697
758
  if (existsSync(path)) return path;
698
759
  const { uid, gid } = ids();
699
- await madeAtomically(path, (temp) => input.host.convert({ imageId: input.imageId, dest: temp, uid: Number(uid), gid: Number(gid) }));
760
+ await madeAtomically(path, (temp) => input.host.convert({ imageId: input.imageId, dest: temp, uid: Number(uid), gid: Number(gid), memoryBytes: input.memoryBytes }));
700
761
  return path;
701
762
  }
702
763
  async function createBuildDisk(input) {
703
764
  const template = join(diskTemplatesDir(input.runnerDir), `${input.bytes}.ext4`);
704
765
  if (!existsSync(template)) {
705
766
  const { uid, gid } = ids();
706
- await madeAtomically(template, (temp) => input.host.makeTemplate({ bytes: input.bytes, dest: temp, uid: Number(uid), gid: Number(gid) }));
767
+ await madeAtomically(template, (temp) => input.host.makeTemplate({ bytes: input.bytes, dest: temp, uid: Number(uid), gid: Number(gid), memoryBytes: input.memoryBytes }));
707
768
  }
708
769
  mkdirSync(dirname(input.dest), { recursive: true });
709
770
  if (input.host.copyTemplate) input.host.copyTemplate(template, input.dest);
@@ -1880,6 +1941,7 @@ function createContainerRuntime(opts = {}) {
1880
1941
  const { cli, remoteFor } = opts;
1881
1942
  return {
1882
1943
  host: opts.host ?? createContainerHost(),
1944
+ cpus: opts.cpus ?? createCpuAllocator(usableCpus()),
1883
1945
  tunnels: opts.tunnels ?? /* @__PURE__ */ new Map(),
1884
1946
  buildImage: opts.buildImage ?? ((build) => buildRepositoryImage(
1885
1947
  {
@@ -2027,7 +2089,8 @@ async function provisionContainer(input) {
2027
2089
  imageId: report.imageId,
2028
2090
  containerEnv: report.apply.containerEnv,
2029
2091
  builtIns: true,
2030
- lifecycle: report.apply.lifecycle
2092
+ lifecycle: report.apply.lifecycle,
2093
+ cpuset: formatCpuList(runtime.cpus.acquire(buildId, config.build?.cpus ?? 4))
2031
2094
  };
2032
2095
  const env = buildEnvironment({
2033
2096
  config,
@@ -2079,7 +2142,7 @@ async function provisionContainer(input) {
2079
2142
  } catch (err) {
2080
2143
  return bail(`the tunnel could not start: ${describeCallFailure(err)}`);
2081
2144
  }
2082
- const limits2 = { memory: config.build?.memory ?? "8g", cpus: config.build?.cpus ?? 4, pids: config.build?.pids ?? 4096 };
2145
+ const limits2 = { memory: config.build?.memory ?? "8g", cpus: config.build?.cpus ?? 4, pids: config.build?.pids ?? 4096, cpuset: state.cpuset };
2083
2146
  const runnerId = runnerLabelValue(config.configPath);
2084
2147
  const volume = await host.createVolume(name, { [BUILD_LABEL]: buildId, [RUNNER_LABEL]: runnerId });
2085
2148
  if (volume.status !== 0) return dockerFailed("creating the build's volume", volume);
@@ -2310,6 +2373,7 @@ async function cleanupContainer(runtime, state, jobDir) {
2310
2373
  await tunnel.close();
2311
2374
  }
2312
2375
  rmSync(state.buildDir, { recursive: true, force: true });
2376
+ runtime.cpus.release(state.buildId);
2313
2377
  if (failures.length > 0) throw new Error(failures.join("; "));
2314
2378
  }
2315
2379
  async function startCheckContainer(input) {
@@ -2325,7 +2389,8 @@ async function startCheckContainer(input) {
2325
2389
  const name = `outerlayer-check-${buildId}`;
2326
2390
  const buildDir2 = buildDir(config.configPath, buildId);
2327
2391
  const agentUser = built.agentUser ?? ADDED_USER;
2328
- const state = { buildId, container: name, volume: name, buildDir: buildDir2, repository, imageId: built.imageId, agentUser };
2392
+ const cpuset = built.cpuset ?? formatCpuList(runtime.cpus.acquire(buildId, config.build?.cpus ?? 4));
2393
+ const state = { buildId, container: name, volume: name, buildDir: buildDir2, repository, imageId: built.imageId, agentUser, cpuset };
2329
2394
  const checksDir = join(jobDir, "checks");
2330
2395
  mkdirSync(checksDir, { recursive: true });
2331
2396
  const logPath = join(checksDir, "environment.log");
@@ -2347,7 +2412,7 @@ async function startCheckContainer(input) {
2347
2412
  } catch (err) {
2348
2413
  return fail(`the tunnel could not start: ${describeCallFailure(err)}`);
2349
2414
  }
2350
- const limits2 = { memory: config.build?.memory ?? "8g", cpus: config.build?.cpus ?? 4, pids: config.build?.pids ?? 4096 };
2415
+ const limits2 = { memory: config.build?.memory ?? "8g", cpus: config.build?.cpus ?? 4, pids: config.build?.pids ?? 4096, cpuset };
2351
2416
  const runnerId = runnerLabelValue(config.configPath);
2352
2417
  const volume = await host.createVolume(name, { [BUILD_LABEL]: buildId, [RUNNER_LABEL]: runnerId });
2353
2418
  if (volume.status !== 0) return dockerFailed("creating the check environment's volume", volume);
@@ -2383,4 +2448,4 @@ async function startCheckContainer(input) {
2383
2448
  };
2384
2449
  }
2385
2450
 
2386
- export { ADDED_USER, AgentUserError, AssetError, BuildTokens, GH_CONFIG_YML, MIN_ENGINE_MAJOR, classifyRefusal, cleanupContainer, containerCommandLine, containerSenderCommand, createBuildDisk, createContainerRuntime, createRunnerLog, deleteBuildDisk, describeCallFailure, ensureRootfs, ensureTunnel, formatClock, formatDuration, ghHostsYml, gitRemoteFor, isLiteralAddress, keepGhConfigCurrent, lifecycleFailureReason, lifecycleSteps, machineConfig, measureDisk, obtainImage, outOfMemoryReason, prepareBranch, provisionContainer, refusalCode, relativeToRunner, removeStagedContext, resolveAgentUser, retrySend, runBuildSteps, senderSignalScript, setUpRunnerCgroup, shellQuote, shortClaim, signalInContainer, stageGovernedContext, startCheckContainer, startServicesFor, stopContainer, syncInContainer };
2451
+ export { ADDED_USER, AgentUserError, AssetError, BuildTokens, GH_CONFIG_YML, MIN_ENGINE_MAJOR, classifyRefusal, cleanupContainer, containerCommandLine, containerSenderCommand, createBuildDisk, createContainerRuntime, createRunnerLog, deleteBuildDisk, describeCallFailure, ensureRootfs, ensureTunnel, formatClock, formatDuration, ghHostsYml, gitRemoteFor, isLiteralAddress, keepGhConfigCurrent, lifecycleFailureReason, lifecycleSteps, machineConfig, measureDisk, obtainImage, outOfMemoryReason, parseCpuList, prepareBranch, provisionContainer, refusalCode, relativeToRunner, removeStagedContext, resolveAgentUser, retrySend, runBuildSteps, senderSignalScript, setUpRunnerCgroup, shellQuote, shortClaim, signalInContainer, stageGovernedContext, startCheckContainer, startServicesFor, stopContainer, syncInContainer };
@@ -4,7 +4,7 @@ import { autoConnect } from './chunk-4ACZCY4I.js';
4
4
  import { detectActiveSession } from './chunk-BFESLKPP.js';
5
5
  import { resolveRepoIdentity } from './chunk-GAYWY4GI.js';
6
6
  import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
7
- import { defaultFetch } from './chunk-BCLJSQCV.js';
7
+ import { defaultFetch } from './chunk-YO4PSLVB.js';
8
8
  import { unauthorizedMessage, resolveGatewayCredentials } from './chunk-BOLTI6LR.js';
9
9
  import { homeFromEnv } from './chunk-VNVZDWO3.js';
10
10
 
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { isPlaceholderCommand } from './chunk-NALVDFIS.js';
4
- import { describeCallFailure } from './chunk-CM5QTKM4.js';
5
- import { WorkCommandError, getJson } from './chunk-5QLNZGAQ.js';
3
+ import { isPlaceholderCommand } from './chunk-Z2THOHPP.js';
4
+ import { describeCallFailure } from './chunk-M4ERCYDB.js';
5
+ import { WorkCommandError, getJson } from './chunk-KV47VQJZ.js';
6
6
  import { sanitizeTerminal } from './chunk-ZYHKJKSU.js';
7
7
  import { builtinKind } from './chunk-PWBILI5P.js';
8
8
  import { CLAUDE_CREDENTIAL_VARIABLES, claudeCredential } from './chunk-OD2VTIHN.js';
9
- import { signerFor } from './chunk-M5POMKKW.js';
9
+ import { signerFor } from './chunk-V7NIVOFD.js';
10
10
 
11
11
  createRequire(import.meta.url);
12
12
 
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { writeJobFile, readJobFile } from './chunk-T6OIJQRT.js';
4
- import { senderPidfile } from './chunk-3S4P55NE.js';
4
+ import { senderPidfile } from './chunk-4FPWKV7L.js';
5
5
  import { DOCKERD_LOG } from './chunk-WVGSB3Z2.js';
6
- import { installScrubContext } from './chunk-AIL2R4SI.js';
7
- import { AssetError, describeCallFailure, obtainImage, ensureRootfs, gitRemoteFor, startServicesFor, createBuildDisk, machineConfig, refusalCode, resolveAgentUser, AgentUserError, runBuildSteps, removeStagedContext, stageGovernedContext, shellQuote, createRunnerLog, createContainerRuntime, stopContainer, cleanupContainer, outOfMemoryReason, formatDuration, retrySend, formatClock, containerSenderCommand, syncInContainer, GH_CONFIG_YML, ghHostsYml, ADDED_USER, isLiteralAddress, signalInContainer, deleteBuildDisk, startCheckContainer, lifecycleSteps, lifecycleFailureReason, senderSignalScript } from './chunk-CM5QTKM4.js';
6
+ import { installScrubContext } from './chunk-BF4KKEFY.js';
7
+ import { AssetError, describeCallFailure, obtainImage, ensureRootfs, gitRemoteFor, startServicesFor, createBuildDisk, machineConfig, refusalCode, resolveAgentUser, AgentUserError, runBuildSteps, removeStagedContext, stageGovernedContext, shellQuote, createRunnerLog, createContainerRuntime, stopContainer, cleanupContainer, outOfMemoryReason, formatDuration, retrySend, formatClock, containerSenderCommand, syncInContainer, GH_CONFIG_YML, ghHostsYml, ADDED_USER, isLiteralAddress, signalInContainer, deleteBuildDisk, startCheckContainer, lifecycleSteps, lifecycleFailureReason, senderSignalScript } from './chunk-M4ERCYDB.js';
8
8
  import { readBranchHead, fetchCommit } from './chunk-TTNFGMHO.js';
9
9
  import { isSameProcess, startTimeOf } from './chunk-N5FOE5PS.js';
10
- import { childEnvironment } from './chunk-U3GOI2B4.js';
10
+ import { childEnvironment } from './chunk-TEKZRTM3.js';
11
11
  import { CLAUDE_CODE_VERSION } from './chunk-CX22S5BA.js';
12
12
  import { waitForAgent, vmExecArgs } from './chunk-ZOAEPWGL.js';
13
13
  import { socketPathProblem, vsockLinks, linkVsockSockets } from './chunk-R7STSBLC.js';
14
- import { WorkCommandError, postJson, isSignatureRefusal, getJson } from './chunk-5QLNZGAQ.js';
14
+ import { WorkCommandError, postJson, isSignatureRefusal, getJson } from './chunk-KV47VQJZ.js';
15
15
  import { planArtifactUpload } from './chunk-ZYHKJKSU.js';
16
16
  import { scrubText } from './chunk-GAYWY4GI.js';
17
17
  import { isBuiltinContainer, isBuiltinProcess, isBuiltinVm, DEFAULT_CHECK_TIME_LIMIT_MINUTES } from './chunk-PWBILI5P.js';
@@ -21,7 +21,7 @@ import { withHooksPath, authorEnvironment, commitIdentityRecord } from './chunk-
21
21
  import { parsePolicy } from './chunk-7ZR5UPMB.js';
22
22
  import { readCloudConfig } from './chunk-EABW6AJQ.js';
23
23
  import { resolveVersion } from './chunk-RA3O54FC.js';
24
- import { signerFor } from './chunk-M5POMKKW.js';
24
+ import { signerFor } from './chunk-V7NIVOFD.js';
25
25
  import { runnerDir, buildDir, vsockPath, RUNNER_FILE_MODE } from './chunk-ZM2IMMYN.js';
26
26
  import { homeFromEnv } from './chunk-VNVZDWO3.js';
27
27
  import { spawn, spawnSync } from 'child_process';
@@ -43,6 +43,9 @@ var DOCKER_LOG_LINES = 20;
43
43
  var GUEST_GH_DIR = `${JOB_MOUNT}/gh`;
44
44
  var GUEST_HOOKS_DIR = `${JOB_MOUNT}/git-hooks`;
45
45
  var GUEST_CONTEXT_DIR = `${JOB_MOUNT}/context`;
46
+ function buildMemoryBytes(config) {
47
+ return parseSize(config.build?.memory ?? DEFAULT_MEMORY) ?? parseSize(DEFAULT_MEMORY);
48
+ }
46
49
  function firstLine(text2) {
47
50
  return text2.trim().split("\n")[0] ?? "";
48
51
  }
@@ -166,7 +169,7 @@ async function provisionMicroVm(input) {
166
169
  if (input.aborted()) return bail("", true);
167
170
  let imageConfig;
168
171
  try {
169
- state.rootfs = await ensureRootfs({ host: vm.rootfs, runnerDir: runnerDirPath, imageId: report.imageId });
172
+ state.rootfs = await ensureRootfs({ host: vm.rootfs, runnerDir: runnerDirPath, imageId: report.imageId, memoryBytes: buildMemoryBytes(config) });
170
173
  imageConfig = await vm.rootfs.imageConfig(report.imageId);
171
174
  } catch (err) {
172
175
  return bail(`the image could not be converted to a root disk: ${describeCallFailure(err)}`);
@@ -186,14 +189,14 @@ async function provisionMicroVm(input) {
186
189
  }
187
190
  const limits = {
188
191
  cpus: config.build?.cpus ?? DEFAULT_CPUS,
189
- memoryBytes: parseSize(config.build?.memory ?? DEFAULT_MEMORY) ?? parseSize(DEFAULT_MEMORY),
192
+ memoryBytes: buildMemoryBytes(config),
190
193
  diskBytes: parseSize(config.build?.disk ?? DEFAULT_DISK) ?? parseSize(DEFAULT_DISK)
191
194
  };
192
195
  const links = vsockLinks({ destinations: config.build?.destinations?.length ?? 0, builtIns: true });
193
196
  const configPath = join(buildDir2, "vm.json");
194
197
  try {
195
198
  linkVsockSockets({ buildDir: buildDir2, vsockPath: state.vsockPath, links });
196
- await createBuildDisk({ host: vm.rootfs, runnerDir: runnerDirPath, bytes: limits.diskBytes, dest: state.buildDisk });
199
+ await createBuildDisk({ host: vm.rootfs, runnerDir: runnerDirPath, bytes: limits.diskBytes, dest: state.buildDisk, memoryBytes: limits.memoryBytes });
197
200
  writeFileSync(
198
201
  configPath,
199
202
  JSON.stringify(
@@ -455,7 +458,7 @@ async function startCheckMicroVm(input) {
455
458
  }
456
459
  if (abandoned()) return fail(ABANDONED);
457
460
  try {
458
- state.rootfs = await ensureRootfs({ host: vm.rootfs, runnerDir: runnerDirPath, imageId: built.imageId });
461
+ state.rootfs = await ensureRootfs({ host: vm.rootfs, runnerDir: runnerDirPath, imageId: built.imageId, memoryBytes: buildMemoryBytes(config) });
459
462
  } catch (err) {
460
463
  return fail(`the image could not be converted to a root disk: ${describeCallFailure(err)}`);
461
464
  }
@@ -473,14 +476,14 @@ async function startCheckMicroVm(input) {
473
476
  if (abandoned()) return fail(ABANDONED);
474
477
  const limits = {
475
478
  cpus: config.build?.cpus ?? DEFAULT_CPUS,
476
- memoryBytes: parseSize(config.build?.memory ?? DEFAULT_MEMORY) ?? parseSize(DEFAULT_MEMORY),
479
+ memoryBytes: buildMemoryBytes(config),
477
480
  diskBytes: parseSize(config.build?.disk ?? DEFAULT_DISK) ?? parseSize(DEFAULT_DISK)
478
481
  };
479
482
  const links = vsockLinks({ destinations: config.build?.destinations?.length ?? 0, builtIns: false });
480
483
  const configPath = join(buildDir2, "vm.json");
481
484
  try {
482
485
  linkVsockSockets({ buildDir: buildDir2, vsockPath: state.vsockPath, links });
483
- await createBuildDisk({ host: vm.rootfs, runnerDir: runnerDirPath, bytes: limits.diskBytes, dest: state.buildDisk });
486
+ await createBuildDisk({ host: vm.rootfs, runnerDir: runnerDirPath, bytes: limits.diskBytes, dest: state.buildDisk, memoryBytes: limits.memoryBytes });
484
487
  writeFileSync(
485
488
  configPath,
486
489
  JSON.stringify(
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { MIN_ENGINE_MAJOR } from './chunk-CM5QTKM4.js';
3
+ import { MIN_ENGINE_MAJOR } from './chunk-M4ERCYDB.js';
4
4
  import { firecrackerArch, MICROVM_ARCHES, guestAssetsPinned } from './chunk-CX22S5BA.js';
5
5
  import { spawnSync } from 'child_process';
6
6
  import { existsSync, accessSync, constants, statSync, readFileSync } from 'fs';
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { RecipeError } from './chunk-QOZKPLVJ.js';
4
- import { trackImageBuild, isOutOfMemory, ensureBuilder } from './chunk-5TNS3PL7.js';
4
+ import { trackImageBuild, isOutOfMemory, ensureBuilder } from './chunk-2BRSMBBB.js';
5
5
  import { spawn } from 'child_process';
6
6
  import { existsSync, mkdirSync, createWriteStream, rmSync, readFileSync } from 'fs';
7
7
  import { join, dirname } from 'path';
@@ -6,7 +6,7 @@ import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
6
6
 
7
7
  createRequire(import.meta.url);
8
8
 
9
- // ../../node_modules/structured-headers/dist/util.js
9
+ // ../../node_modules/http-message-sig/node_modules/structured-headers/dist/util.js
10
10
  var asciiRe = /^[\x20-\x7E]*$/;
11
11
  var tokenRe = /^[a-zA-Z*][:/!#$%&'*+\-.^_`|~A-Za-z0-9]*$/;
12
12
  var keyRe = /^[a-z*][*\-_.a-z0-9]*$/;
@@ -40,7 +40,7 @@ function base64ToArrayBuffer(b64) {
40
40
  return bytes.buffer;
41
41
  }
42
42
 
43
- // ../../node_modules/structured-headers/dist/token.js
43
+ // ../../node_modules/http-message-sig/node_modules/structured-headers/dist/token.js
44
44
  var Token = class {
45
45
  constructor(value) {
46
46
  if (!isValidTokenStr(value)) {
@@ -53,7 +53,7 @@ var Token = class {
53
53
  }
54
54
  };
55
55
 
56
- // ../../node_modules/structured-headers/dist/displaystring.js
56
+ // ../../node_modules/http-message-sig/node_modules/structured-headers/dist/displaystring.js
57
57
  var DisplayString = class {
58
58
  constructor(value) {
59
59
  this.value = value;
@@ -63,7 +63,7 @@ var DisplayString = class {
63
63
  }
64
64
  };
65
65
 
66
- // ../../node_modules/structured-headers/dist/serializer.js
66
+ // ../../node_modules/http-message-sig/node_modules/structured-headers/dist/serializer.js
67
67
  var SerializeError = class extends Error {
68
68
  };
69
69
  function serializeDictionary(input) {
@@ -186,7 +186,7 @@ function serializeKey(input) {
186
186
  return input;
187
187
  }
188
188
 
189
- // ../../node_modules/structured-headers/dist/parser.js
189
+ // ../../node_modules/http-message-sig/node_modules/structured-headers/dist/parser.js
190
190
  function parseDictionary(input) {
191
191
  const parser = new Parser(input);
192
192
  return parser.parseDictionary();
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { readCloudConfig, cloudConfigPath } from './chunk-EABW6AJQ.js';
4
- import { signRunnerRequest, signerFor } from './chunk-M5POMKKW.js';
4
+ import { signRunnerRequest, signerFor } from './chunk-V7NIVOFD.js';
5
5
  import { homeFromEnv } from './chunk-VNVZDWO3.js';
6
6
 
7
7
  createRequire(import.meta.url);
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { detectMachine, supportsContainerBuilds, reachDockerStep, describeMachineDocker, supportsMicroVmBuilds } from './chunk-TUUMW4TC.js';
4
- import { MIN_ENGINE_MAJOR } from './chunk-CM5QTKM4.js';
3
+ import { detectMachine, supportsContainerBuilds, reachDockerStep, describeMachineDocker, supportsMicroVmBuilds } from './chunk-QNRSFEGY.js';
4
+ import { MIN_ENGINE_MAJOR } from './chunk-M4ERCYDB.js';
5
5
  import { RUNNER_DIR_MODE, runnerDir, RUNNER_FILE_MODE } from './chunk-ZM2IMMYN.js';
6
6
  import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'fs';
7
7
  import { dirname } from 'path';