@outerlayer/cli 0.33.0-next.20261022004023 → 0.33.0-next.20261022124145

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 (94) hide show
  1. package/README.md +12 -11
  2. package/dist/{agent-setup-UY5NBT7C.js → agent-setup-2MJXGAZ5.js} +10 -10
  3. package/dist/{artifact-link-cmd-2MBHG3PO.js → artifact-link-cmd-6FF2Y6QI.js} +2 -2
  4. package/dist/build-disk-5GIWYDOB.js +18 -0
  5. package/dist/build-info.json +1 -1
  6. package/dist/{builder-VR55L4PV.js → builder-EELBB7SI.js} +4 -4
  7. package/dist/{check-XGBAFJPP.js → check-EJKRXI2N.js} +36 -34
  8. package/dist/{chunk-N3KK5BKF.js → chunk-2GHI2J26.js} +7 -7
  9. package/dist/{chunk-AKR32WHV.js → chunk-5DNCFOXA.js} +9 -7
  10. package/dist/{chunk-UIBTEDLA.js → chunk-6JNCNHSV.js} +5 -5
  11. package/dist/{chunk-GHQFV3TS.js → chunk-6WUQSARX.js} +11 -10
  12. package/dist/{chunk-EG7KPSSP.js → chunk-72BIONOT.js} +6 -6
  13. package/dist/{chunk-XNGS6LUK.js → chunk-AESNEWYR.js} +1 -1
  14. package/dist/{chunk-LN4WDONI.js → chunk-AVTI3FL5.js} +1 -1
  15. package/dist/{chunk-5RUH3PCG.js → chunk-B3EE7OKK.js} +4 -4
  16. package/dist/{chunk-Y3LIJIRH.js → chunk-BJQ25STI.js} +4 -4
  17. package/dist/{chunk-6TFTRVOA.js → chunk-C3XLVHN6.js} +2 -2
  18. package/dist/{chunk-OEITN64Z.js → chunk-D7ECJX4J.js} +15 -38
  19. package/dist/{chunk-UWEJ6HGB.js → chunk-DY7Y7UT4.js} +2 -2
  20. package/dist/{chunk-AKHGQKNR.js → chunk-E6CO3MJE.js} +34 -2
  21. package/dist/{chunk-DM4EGXDO.js → chunk-EWVYQLD3.js} +1 -1
  22. package/dist/{chunk-BUBMAMIP.js → chunk-FQW7TKIU.js} +2 -2
  23. package/dist/{chunk-KUTZ6XLS.js → chunk-G63KT5I5.js} +1 -1
  24. package/dist/{chunk-Q2D4M3GC.js → chunk-GFYEMCPP.js} +1 -1
  25. package/dist/{chunk-4IG6EZHU.js → chunk-HJYBWJAS.js} +2 -2
  26. package/dist/{chunk-CMTRZC23.js → chunk-HVIYKGK5.js} +79 -12
  27. package/dist/{chunk-TNJXCNQ6.js → chunk-JHTJPQSL.js} +4 -4
  28. package/dist/{chunk-RVWADVBN.js → chunk-JZ4FXSLI.js} +3 -3
  29. package/dist/{chunk-HT7LVCTX.js → chunk-L3DUKDTR.js} +2 -2
  30. package/dist/{chunk-KDM77TVX.js → chunk-LCVR4UIS.js} +2 -2
  31. package/dist/{chunk-OGCG5LOX.js → chunk-LJG6EMLJ.js} +1 -1
  32. package/dist/{chunk-HJEZ3D3E.js → chunk-LWODW66U.js} +16 -16
  33. package/dist/chunk-MBE6FEQ3.js +111 -0
  34. package/dist/{chunk-RW52CUFX.js → chunk-NSPRS7WK.js} +1 -1
  35. package/dist/{chunk-DE7YSNDX.js → chunk-OJ63GRZ2.js} +2 -2
  36. package/dist/{chunk-Q4YVHYHT.js → chunk-QJNFO7TQ.js} +3 -3
  37. package/dist/{chunk-NOXK3QW6.js → chunk-QSSYXK6C.js} +3 -3
  38. package/dist/{chunk-UENWEDZ3.js → chunk-S2IJQER5.js} +255 -255
  39. package/dist/{chunk-RQKQTRXM.js → chunk-THTBXIK5.js} +4 -4
  40. package/dist/{chunk-M5OBRUQE.js → chunk-UIUGTW5C.js} +2 -2
  41. package/dist/{chunk-YH2632RT.js → chunk-V2EUC2MJ.js} +43 -20
  42. package/dist/{chunk-SFJD4MRY.js → chunk-WHRR55PC.js} +14 -7
  43. package/dist/{chunk-CALFNNIY.js → chunk-XTBGPISI.js} +17 -6
  44. package/dist/chunk-YYYRBYWG.js +32 -0
  45. package/dist/{claude-launcher-STSKZNW3.js → claude-launcher-IUDNUD2J.js} +17 -6
  46. package/dist/{cli-BMV37UKQ.js → cli-5JSVOAE5.js} +89 -89
  47. package/dist/{command-35IERXEA.js → command-7IY3XGAG.js} +24 -23
  48. package/dist/{connect-cmd-WFHAPGCZ.js → connect-cmd-AQSJVDQU.js} +8 -8
  49. package/dist/{container-start-3FFBFFNK.js → container-start-BPQHJMNF.js} +25 -24
  50. package/dist/{context-cleanup-UBOJHGQM.js → context-cleanup-BX5Y3AFL.js} +3 -3
  51. package/dist/{control-plane-launch-R4X63DYW.js → control-plane-launch-K7YD6KEN.js} +6 -6
  52. package/dist/{dist-ADFLG3AY.js → dist-ACTRIBVW.js} +2 -2
  53. package/dist/{docker-2NN3EKTR.js → docker-UKJBLZLW.js} +4 -4
  54. package/dist/{doctor-CA5QQ5KS.js → doctor-JUR62PMF.js} +48 -25
  55. package/dist/{emit-artifact-cmd-FR5PUUJR.js → emit-artifact-cmd-HI3EYJA3.js} +13 -13
  56. package/dist/{emit-cmd-JOO6ZTEI.js → emit-cmd-OX6LYS6I.js} +6 -6
  57. package/dist/{emit-criteria-cmd-DKPZJTIN.js → emit-criteria-cmd-IC5OIZX2.js} +9 -9
  58. package/dist/{emit-demo-cmd-G2I4SB7A.js → emit-demo-cmd-HWDC3MAK.js} +211 -101
  59. package/dist/{emit-finding-cmd-VM4KIVEM.js → emit-finding-cmd-A7RBLHTN.js} +10 -10
  60. package/dist/{emit-result-cmd-SEKL6HUU.js → emit-result-cmd-2WVVAGST.js} +12 -12
  61. package/dist/{emit-step-cmd-4YAWK4VE.js → emit-step-cmd-KNVHYSXT.js} +10 -10
  62. package/dist/{findings-cmd-RXYIWXY4.js → findings-cmd-ISP3P3UY.js} +10 -10
  63. package/dist/{fleet-readiness-VIX76RNL.js → fleet-readiness-O2WAJJVT.js} +8 -8
  64. package/dist/{governing-source-APGCKDTS.js → governing-source-PMWZJCXJ.js} +13 -13
  65. package/dist/{guest-init-BI7267TB.js → guest-init-3LNAL3TB.js} +2 -2
  66. package/dist/{hook-fast-NVBMSE3N.js → hook-fast-FJ2PMBML.js} +1 -1
  67. package/dist/index.js +4 -4
  68. package/dist/{init-BZMBUTU4.js → init-YRSKJNSB.js} +25 -24
  69. package/dist/{init-VPK3MDM5.js → init-ZXV6LILS.js} +26 -25
  70. package/dist/{init-cmd-PTQ5WSQ5.js → init-cmd-3F436JBW.js} +18 -18
  71. package/dist/{init-update-HOTJISWA.js → init-update-6OPETOBA.js} +17 -17
  72. package/dist/{layout-ZI4RJ6MT.js → layout-JGF7MJHG.js} +4 -4
  73. package/dist/{login-browser-WUSIVD5E.js → login-browser-3RIZQJY2.js} +2 -2
  74. package/dist/{loop-FDFEXDKA.js → loop-MCR3EUSZ.js} +36 -34
  75. package/dist/{machine-ZL72TS6B.js → machine-35YQ7MGN.js} +23 -22
  76. package/dist/{machine-skills-REHDWINX.js → machine-skills-AGERT2HN.js} +4 -4
  77. package/dist/{runner-identity-DSFLFUR2.js → runner-identity-GO762MHZ.js} +4 -4
  78. package/dist/{runner-key-XJ7YSMOF.js → runner-key-BQSR6MK4.js} +25 -24
  79. package/dist/{session-sender-PLQ5NOEW.js → session-sender-ENL3IBVD.js} +13 -13
  80. package/dist/{spec-cmd-NIAQWMLE.js → spec-cmd-SLJT7MRX.js} +10 -10
  81. package/dist/{starter-pack-OESK7UX2.js → starter-pack-UBEC5LTE.js} +5 -5
  82. package/dist/{status-LJ2UBJCE.js → status-GQEAZBUJ.js} +29 -28
  83. package/dist/{sync-cmd-UTESQMDU.js → sync-cmd-Z4BYKM6K.js} +12 -12
  84. package/dist/{watch-4UC4FGI5.js → watch-MBEA6QB4.js} +12 -12
  85. package/dist/{work-claim-cmd-ODYRE44S.js → work-claim-cmd-TLXRPJWO.js} +12 -12
  86. package/dist/{work-cmd-QQDUI3YX.js → work-cmd-DYM67Z3F.js} +10 -10
  87. package/dist/{work-comment-cmd-FIOMDPIZ.js → work-comment-cmd-CRRWP3AH.js} +10 -10
  88. package/dist/{work-logs-cmd-DA6MPQ6O.js → work-logs-cmd-7LFOEVXI.js} +10 -10
  89. package/dist/{work-open-pr-cmd-QG2FT7OW.js → work-open-pr-cmd-XXQ75PSU.js} +11 -11
  90. package/dist/{work-pr-cmd-XNXWWLS5.js → work-pr-cmd-ZVE7EGSC.js} +10 -10
  91. package/dist/{work-stop-cmd-2KLZ2UH2.js → work-stop-cmd-GVFSTGLK.js} +10 -10
  92. package/package.json +1 -1
  93. package/skill-pack/maintained/outerlayer-evidence/SKILL.md +8 -5
  94. package/dist/{chunk-RJYKTWUP.js → chunk-ELYHDWCC.js} +1 -1
@@ -22277,6 +22277,10 @@ var ARTIFACT_MAX_GIT_BRANCH_LENGTH = 255;
22277
22277
  var ARTIFACT_MAX_COMMIT_SHA_LENGTH = 64;
22278
22278
  var ARTIFACT_MAX_SESSION_ID_LENGTH = 128;
22279
22279
  var Sha256Schema = external_exports.string().regex(/^[0-9a-f]{64}$/);
22280
+ var ArtifactRangeSchema = external_exports.object({
22281
+ start: external_exports.number().finite().min(0),
22282
+ end: external_exports.number().finite()
22283
+ }).refine((range) => range.end > range.start, { message: "end must be after start", path: ["end"] });
22280
22284
  var ArtifactSpoolRecordSchema = external_exports.looseObject({
22281
22285
  rec: external_exports.literal("artifact"),
22282
22286
  artifactId: external_exports.string().min(1).max(64),
@@ -22319,7 +22323,12 @@ var ArtifactSpoolRecordSchema = external_exports.looseObject({
22319
22323
  replacesTargets: external_exports.array(external_exports.string().regex(/^[A-Za-z0-9_.:-]{1,64}$/)).min(2).max(ARTIFACT_MAX_REPLACES_TARGETS).optional(),
22320
22324
  /** The tests `--test` selected from a JUnit results file, with any
22321
22325
  * location the caller gave. Absent when the whole file is bound. */
22322
- tests: TestSelectionListSchema.optional()
22326
+ tests: TestSelectionListSchema.optional(),
22327
+ /** The part of a video this artifact proves, in seconds from its start. */
22328
+ range: ArtifactRangeSchema.optional(),
22329
+ /** True when the bytes may already be stored: `sync` sends the record with
22330
+ * no blob first and sends the blob only when the gateway asks for it. */
22331
+ blobOptional: external_exports.boolean().optional()
22323
22332
  });
22324
22333
  var ArtifactTombstoneRecordSchema = external_exports.looseObject({
22325
22334
  rec: external_exports.literal("artifact-tombstone"),
@@ -22737,7 +22746,30 @@ var DemoRecordV2Schema = external_exports.strictObject({
22737
22746
  schemaVersion: external_exports.literal(2),
22738
22747
  chapters: external_exports.array(DemoRecordChapterV2Schema).min(1).max(DEMO_CHAPTERS_MAX)
22739
22748
  });
22740
- external_exports.discriminatedUnion("schemaVersion", [DemoRecordV1Schema, DemoRecordV2Schema]);
22749
+ var DemoRecordChapterV3Schema = external_exports.strictObject({
22750
+ ...chapterFields,
22751
+ /** The `clientArtifactId` of the chapter's artifact: a range of the whole video, or its own clip. */
22752
+ artifactId: external_exports.string().min(1).max(64),
22753
+ /** The chapter's span in the artifact's video, in seconds from its start. In clip mode the video is the chapter's own clip. */
22754
+ range: ArtifactRangeSchema,
22755
+ bound: external_exports.boolean(),
22756
+ comparable: DemoComparableSchema,
22757
+ stills: external_exports.array(DemoStillSchema.pick({ check: true, sha256: true })).max(DEMO_CHECKS_MAX),
22758
+ difference: external_exports.strictObject({ check: external_exports.number().int().min(0), region: DemoRegionSchema }).optional()
22759
+ }).refine((chapter) => chapter.end > chapter.start, { message: "a chapter must end after it starts", path: ["end"] }).refine((chapter) => chapter.comparable === "no" === (chapter.difference !== void 0), {
22760
+ message: "a chapter has a difference exactly when it is not comparable",
22761
+ path: ["difference"]
22762
+ });
22763
+ var DemoRecordVideoSchema = external_exports.union([
22764
+ external_exports.strictObject({ artifactId: external_exports.string().min(1).max(64) }),
22765
+ external_exports.strictObject({ omitted: external_exports.literal("size"), bytes: external_exports.number().int().nonnegative() })
22766
+ ]);
22767
+ var DemoRecordV3Schema = external_exports.strictObject({
22768
+ schemaVersion: external_exports.literal(3),
22769
+ video: DemoRecordVideoSchema,
22770
+ chapters: external_exports.array(DemoRecordChapterV3Schema).min(1).max(DEMO_CHAPTERS_MAX)
22771
+ });
22772
+ external_exports.discriminatedUnion("schemaVersion", [DemoRecordV1Schema, DemoRecordV2Schema, DemoRecordV3Schema]);
22741
22773
  /*! Bundled license information:
22742
22774
 
22743
22775
  xmlchars/xml/1.0/ed5.js:
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { ArtifactTombstoneRecordSchema, ArtifactSpoolRecordSchema } from './chunk-AKHGQKNR.js';
3
+ import { ArtifactTombstoneRecordSchema, ArtifactSpoolRecordSchema } from './chunk-E6CO3MJE.js';
4
4
  import { homeFromEnv } from './chunk-VNVZDWO3.js';
5
5
  import { mkdirSync, appendFileSync, writeFileSync, renameSync, unlinkSync, existsSync, readdirSync, readFileSync, statSync } from 'fs';
6
6
  import { join, dirname } from 'path';
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { detectMachine, supportsContainerBuilds, reachDockerStep, describeMachineDocker, supportsMicroVmBuilds } from './chunk-XNGS6LUK.js';
4
- import { MIN_ENGINE_MAJOR } from './chunk-OEITN64Z.js';
5
3
  import { hasStoredCredential, AGENT_COMMANDS, storeClaudeCredential, credentialFromStdin, isAgentName } from './chunk-52C3SSNF.js';
4
+ import { detectMachine, supportsContainerBuilds, reachDockerStep, describeMachineDocker, supportsMicroVmBuilds } from './chunk-AESNEWYR.js';
5
+ import { MIN_ENGINE_MAJOR } from './chunk-D7ECJX4J.js';
6
6
  import { runnerCredentialProblem } from './chunk-ALSE7YKX.js';
7
7
  import { runnerDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-ESP5VZBD.js';
8
8
  import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'fs';
@@ -2,7 +2,7 @@
2
2
  import { createRequire } from 'node:module';
3
3
  import { MAINTAINED_SKILLS } from './chunk-CDDED64E.js';
4
4
  import { resolvePackageVersion } from './chunk-RA3O54FC.js';
5
- import { splitRawFile } from './chunk-OGCG5LOX.js';
5
+ import { splitRawFile } from './chunk-LJG6EMLJ.js';
6
6
  import { existsSync, readFileSync, mkdirSync, writeFileSync, readdirSync } from 'fs';
7
7
  import { join, dirname } from 'path';
8
8
  import { fileURLToPath } from 'url';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { loadMachineSkillFiles, resolvePackRoot } from './chunk-KUTZ6XLS.js';
3
+ import { loadMachineSkillFiles, resolvePackRoot } from './chunk-G63KT5I5.js';
4
4
  import { MAINTAINED_SKILLS, maintainedLineVersion } from './chunk-CDDED64E.js';
5
5
  import { resolvePackageVersion } from './chunk-RA3O54FC.js';
6
6
  import { homeFromEnv } from './chunk-VNVZDWO3.js';
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE } from './chunk-KUTZ6XLS.js';
4
- import { normalizePath, CONTEXT_PIN_FILENAME } from './chunk-OGCG5LOX.js';
3
+ import { AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE } from './chunk-G63KT5I5.js';
4
+ import { normalizePath, CONTEXT_PIN_FILENAME } from './chunk-LJG6EMLJ.js';
5
5
  import { existsSync, readdirSync, readFileSync, mkdirSync, writeFileSync, lstatSync, readlinkSync, symlinkSync, rmdirSync } from 'fs';
6
6
  import { relative, sep, join } from 'path';
7
7
 
@@ -1,28 +1,29 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { releaseLease, isUnfinished, setStage, jobEnv, runHook, describeHookEnd, provisionMicroVm, deliverCommitHooks, provisionProcess, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, hostCommandEnvironment, execArgv, MICROVM_COMMAND_DIR, commandLogOffset, startMicroVmCommand, microVmCommandLine, runCommand, execCommandLine, startSender, startHostServices, finishJob, sampleGuest, foldSample, isContainerTracked, isMicroVmTracked, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isTimedOut, readCpuUsec, isIdle, stopOrphanedMicroVms, unfinishedJobs, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, GUEST_USAGE_INTERVAL_MS, hookLimitsFor, AttemptLogBook, microVmOomKills, needsRenew, renewLease, RENEW_INTERVAL_SECONDS, listTrackedJobs, restartSender, serveLease, vmAlive, writeGuestGhConfig, ALREADY_RELEASED, inTeardown } from './chunk-HJEZ3D3E.js';
3
+ import { releaseLease, isUnfinished, setStage, jobEnv, runHook, describeHookEnd, provisionMicroVm, deliverCommitHooks, provisionProcess, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, hostCommandEnvironment, execArgv, MICROVM_COMMAND_DIR, commandLogOffset, startMicroVmCommand, microVmCommandLine, runCommand, execCommandLine, startSender, startHostServices, finishJob, sampleGuest, foldSample, isContainerTracked, isMicroVmTracked, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isTimedOut, readCpuUsec, isIdle, stopOrphanedMicroVms, unfinishedJobs, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, GUEST_USAGE_INTERVAL_MS, hookLimitsFor, AttemptLogBook, microVmOomKills, needsRenew, renewLease, RENEW_INTERVAL_SECONDS, listTrackedJobs, restartSender, serveLease, vmAlive, writeGuestGhConfig, ALREADY_RELEASED, inTeardown } from './chunk-LWODW66U.js';
4
+ import { JOB_STATE_FORMAT, readsJobState, jobStateFormatOf } from './chunk-ZVB57WI6.js';
4
5
  import { readHousekeepingRecord, writeHousekeepingRecord } from './chunk-LH3KULPL.js';
5
6
  import { decideInstalledSwitch } from './chunk-3JVYMD4G.js';
6
7
  import { fetchVersionMeta, npmVersion, npmSupportsProvenance, fetchTarballDigest, fetchProvenance, installVersion, auditSignatures } from './chunk-E7R2GIAW.js';
7
8
  import { fitImageBuildMemory } from './chunk-M5ZXOQYS.js';
8
9
  import { RUNNER_PROTOCOL } from './chunk-YKYCE4HY.js';
9
10
  import { writePendingUpdate } from './chunk-CNRMP6EN.js';
10
- import { JOB_STATE_FORMAT, readsJobState, jobStateFormatOf } from './chunk-ZVB57WI6.js';
11
- import { currentSkillCommand, formerSkillProblem, realBlockedProbes, checkBlocked } from './chunk-CALFNNIY.js';
11
+ import { currentSkillCommand, formerSkillProblem, realBlockedProbes, checkBlocked } from './chunk-XTBGPISI.js';
12
12
  import { writeMarker, readMarker, currentVersion, removeMarker, entryIn, versionDir, startedThroughCurrent, switchCurrent, isInLayout, cleanVersions, stagingDir } from './chunk-3VGDZ23W.js';
13
13
  import { RepoFilter } from './chunk-TBT347UY.js';
14
- import { leaseTimeLeftMs, createContainerRuntime, withTunnelLog, LEASE_SECONDS, provisionContainer, leaseExpiresAtMs, deliverContainerHooks, lifecycleSteps, lifecycleFailureReason, prepareBranch, containerCommandExec, setUpRunnerCgroup, sweepImageBuilders, freeBytes, formatBytes, measureDisk, parseCpuList, ensureTunnel, keepGhConfigCurrent, filesAreCopied, gitRemoteFor, startServicesFor, createLeaseChannel } from './chunk-OEITN64Z.js';
15
- import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, BuildTokens, classifyRefusal, refusalCode, createRunnerLog, formatClock } from './chunk-KDM77TVX.js';
14
+ import { leaseTimeLeftMs, createContainerRuntime, withTunnelLog, LEASE_SECONDS, provisionContainer, leaseExpiresAtMs, deliverContainerHooks, lifecycleSteps, lifecycleFailureReason, prepareBranch, containerCommandExec, setUpRunnerCgroup, sweepImageBuilders, measureDisk, parseCpuList, ensureTunnel, keepGhConfigCurrent, filesAreCopied, gitRemoteFor, startServicesFor, createLeaseChannel } from './chunk-D7ECJX4J.js';
15
+ import { claimPidFile, writePidFile, readPidFile, releasePidFile } from './chunk-IPJ6HR7E.js';
16
+ import { startTimeOf, isSameProcess } from './chunk-JBJTC3UU.js';
17
+ import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, BuildTokens, classifyRefusal, refusalCode, createRunnerLog, formatClock } from './chunk-LCVR4UIS.js';
16
18
  import { tagToPull, pullInstruction, imageTag, writeUpdateStatus } from './chunk-533QGXGZ.js';
17
19
  import { isVersion, compareVersions, satisfiesRange } from './chunk-TQMI335S.js';
20
+ import { freeBytes, formatBytes } from './chunk-YYYRBYWG.js';
21
+ import { writeJobFile, ensureRunnerIdentity, readJobFile, builderName, runnerLabelValue, ensureFailureCount, builderSpec, ensureBuilder, spawnRun, BUILD_LABEL, RUNNER_LABEL, readJobFileChecked } from './chunk-S2IJQER5.js';
18
22
  import { isBuiltinContainer, isBuiltinVm, isBuiltinProcess, loadRunnerConfig, checkHooks, builtinKind, DEFAULT_UPDATE_MAX_WAIT_HOURS } from './chunk-ALSE7YKX.js';
19
- import { claimPidFile, writePidFile, readPidFile, releasePidFile } from './chunk-IPJ6HR7E.js';
20
- import { startTimeOf, isSameProcess } from './chunk-JBJTC3UU.js';
21
- import { writeJobFile, ensureRunnerIdentity, readJobFile, builderName, runnerLabelValue, ensureFailureCount, builderSpec, ensureBuilder, spawnRun, BUILD_LABEL, RUNNER_LABEL, readJobFileChecked } from './chunk-UENWEDZ3.js';
22
23
  import { exceedsDisk } from './chunk-YJLHUKYS.js';
23
- import { isSignatureRefusal, WorkCommandError, getJson, postJson } from './chunk-UIBTEDLA.js';
24
+ import { isSignatureRefusal, WorkCommandError, getJson, postJson } from './chunk-6JNCNHSV.js';
24
25
  import { loadHostKey, ensureHostKey, signerFor } from './chunk-JT3YO5MH.js';
25
- import { RUNNER_DIR_MODE, runnerDir, buildDir, attemptStamp, jobDir, RUNNER_FILE_MODE, jobsDir, pidFilePath, spoolDir, rootfsDir, imagesDir, builderCacheDiskPath } from './chunk-ESP5VZBD.js';
26
+ import { RUNNER_DIR_MODE, runnerDir, buildDir, attemptStamp, jobDir, RUNNER_FILE_MODE, jobsDir, pidFilePath, spoolDir, imagesDir, rootfsDir, builderCacheDiskPath } from './chunk-ESP5VZBD.js';
26
27
  import { parseClaimIdentity, parseClaimedRepositories, parseUnreachable, repositoriesOf, primaryOf, sharedUserEnvironment, JOB_MOUNT, takeClaudeCredential, heldClaudeCredential, currentClaudeCredential } from './chunk-HDSDUTX4.js';
27
28
  import { resolveVersion } from './chunk-RA3O54FC.js';
28
29
  import { fdName } from './chunk-XD4ZCMA4.js';
@@ -537,6 +538,7 @@ function settleUpdate(args) {
537
538
 
538
539
  // src/runner/housekeeping/docker.ts
539
540
  var KIND_LABEL = "ai.outerlayer.kind";
541
+ var RECIPE_KEY_LABEL = "ai.outerlayer.recipe-key";
540
542
  var NO_BUILDER = /no builder .* found/i;
541
543
  function failure(result, what) {
542
544
  return new Error(`${what}: ${result.stderr.trim() || `docker exited ${result.status}`}`);
@@ -624,6 +626,21 @@ function createHousekeepingDocker(deps) {
624
626
  labels: row.Config?.Labels ?? {}
625
627
  }));
626
628
  },
629
+ async listLabelledImages() {
630
+ const listed = await run("docker", ["image", "ls", "--all", "--no-trunc", "--quiet", "--filter", `label=${KIND_LABEL}`]);
631
+ if (listed.status !== 0) throw failure(listed, "docker image ls");
632
+ const ids = [...new Set(listed.stdout.split("\n").map((l) => l.trim()).filter(Boolean))];
633
+ if (ids.length === 0) return [];
634
+ const inspected = await run("docker", ["image", "inspect", ...ids]);
635
+ if (inspected.status !== 0) throw failure(inspected, "docker image inspect");
636
+ return JSON.parse(inspected.stdout).map((row) => ({
637
+ id: row.Id,
638
+ size: row.Size ?? 0,
639
+ labels: row.Config?.Labels ?? {},
640
+ tags: (row.RepoTags ?? []).filter((tag) => tag !== "<none>:<none>"),
641
+ createdMs: Date.parse(row.Created ?? "")
642
+ }));
643
+ },
627
644
  async removeImage(id) {
628
645
  const result = await run("docker", ["rmi", id]);
629
646
  if (result.status !== 0) throw failure(result, `docker rmi ${id}`);
@@ -747,6 +764,46 @@ async function removeDanglingImages(docker, log, live) {
747
764
  }
748
765
  return freed;
749
766
  }
767
+ var UNRECORDED_IMAGE_GRACE_MS = 60 * 60 * 1e3;
768
+ function recordedImages(configPath) {
769
+ const imageIds = /* @__PURE__ */ new Set();
770
+ const recipeKeys = /* @__PURE__ */ new Set();
771
+ const root = imagesDir(configPath);
772
+ for (const owner of listDir(root)) {
773
+ for (const repo of listDir(join(root, owner))) {
774
+ for (const entry of listDir(join(root, owner, repo))) {
775
+ const file = join(root, owner, repo, entry, "image.json");
776
+ if (!existsSync(file)) continue;
777
+ let record;
778
+ try {
779
+ record = JSON.parse(readFileSync(file, "utf8"));
780
+ } catch {
781
+ return void 0;
782
+ }
783
+ if (typeof record.imageId === "string") imageIds.add(record.imageId);
784
+ if (typeof record.recipeKey === "string") recipeKeys.add(record.recipeKey);
785
+ }
786
+ }
787
+ }
788
+ return { imageIds, recipeKeys };
789
+ }
790
+ async function removeUnrecordedImages(docker, log, recorded, live, nowMs) {
791
+ let freed = 0;
792
+ for (const image of await docker.listLabelledImages()) {
793
+ const kind = image.labels[KIND_LABEL];
794
+ if (image.tags.length === 0 || live.has(image.id)) continue;
795
+ if (!(nowMs - image.createdMs >= UNRECORDED_IMAGE_GRACE_MS)) continue;
796
+ if (kind === "build" ? recorded.imageIds.has(image.id) : kind === "recipe" ? recorded.recipeKeys.has(image.labels[RECIPE_KEY_LABEL] ?? "") : true) continue;
797
+ try {
798
+ for (const tag of image.tags) await docker.removeImage(tag);
799
+ freed += image.size;
800
+ log.line(`housekeeping: removed ${kind} image ${image.tags.join(", ")} (${formatBytes(image.size)}), no image record names it`);
801
+ } catch (err) {
802
+ log.error(`housekeeping: could not remove image ${image.tags.join(", ")}: ${describeCallFailure(err)}`);
803
+ }
804
+ }
805
+ return freed;
806
+ }
750
807
  async function runHousekeeping(options) {
751
808
  const { docker, log } = options;
752
809
  const nowMs = options.now().getTime();
@@ -796,6 +853,16 @@ async function runHousekeeping(options) {
796
853
  }
797
854
  }
798
855
  if (canTell && listed !== void 0) {
856
+ const recorded = recordedImages(options.configPath);
857
+ if (recorded === void 0) {
858
+ log.error("housekeeping: an image record does not parse, so no tagged image is removed this pass");
859
+ } else {
860
+ try {
861
+ freed += await removeUnrecordedImages(docker, log, recorded, liveImageIds(jobs.unfinished), nowMs);
862
+ } catch (err) {
863
+ log.error(`housekeeping: the runner's images could not be listed: ${describeCallFailure(err)}`);
864
+ }
865
+ }
799
866
  freed += await removeStaleRootDisks(root, jobs.unfinished, options);
800
867
  try {
801
868
  freed += await removeDanglingImages(docker, log, liveImageIds(jobs.unfinished));
@@ -1770,7 +1837,7 @@ var CLAIM_REFUSAL_CODES = new Set(
1770
1837
  "pull_request_from_fork pull_request_on_default_branch pull_request_ambiguous pull_request_repository_not_connected repository_not_reachable branch_claimed_elsewhere".split(" ")
1771
1838
  );
1772
1839
  async function tryClaimAndStart(state, item, queue) {
1773
- const { postJson: postJson2 } = await import('./work-cmd-QQDUI3YX.js');
1840
+ const { postJson: postJson2 } = await import('./work-cmd-DYM67Z3F.js');
1774
1841
  const log = logOf(state);
1775
1842
  const hostKey = await loadHostKey(state.config.configPath);
1776
1843
  const claim = await retrySend(
@@ -2966,7 +3033,7 @@ async function start(configPath, deps = { fetchImpl: fetch }) {
2966
3033
  check: update.check ? () => update.check(configPath) : async () => {
2967
3034
  const held = heldClaudeCredential();
2968
3035
  const env = held === void 0 ? process.env : { ...process.env, [held.variable]: held.value };
2969
- return (await import('./check-XGBAFJPP.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
3036
+ return (await import('./check-EJKRXI2N.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
2970
3037
  },
2971
3038
  now: () => (deps.now ?? (() => /* @__PURE__ */ new Date()))().getTime(),
2972
3039
  log
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { isAgentsMdLayout, discoverOuterlayerPaths, isForeignTree, toRepoRelative } from './chunk-4IG6EZHU.js';
3
+ import { isAgentsMdLayout, discoverOuterlayerPaths, isForeignTree, toRepoRelative } from './chunk-HJYBWJAS.js';
4
4
  import { C } from './chunk-ANPNT6PM.js';
5
- import { retiredSkillPaths, removeRetiredSkills } from './chunk-M5OBRUQE.js';
6
- import { maintainedFilesForExistingSkills, loadMaintainedFiles, writeMaintainedFiles } from './chunk-KUTZ6XLS.js';
5
+ import { retiredSkillPaths, removeRetiredSkills } from './chunk-UIUGTW5C.js';
6
+ import { maintainedFilesForExistingSkills, loadMaintainedFiles, writeMaintainedFiles } from './chunk-G63KT5I5.js';
7
7
  import { cliInvocation } from './chunk-CRB3POP4.js';
8
- import { emitTree, generatedHeaderSource, parseOuterlayerConfig, classifyTree } from './chunk-OGCG5LOX.js';
8
+ import { emitTree, generatedHeaderSource, parseOuterlayerConfig, classifyTree } from './chunk-LJG6EMLJ.js';
9
9
  import { existsSync, readFileSync, mkdirSync, writeFileSync, copyFileSync, unlinkSync, rmdirSync, readdirSync } from 'fs';
10
10
  import { join, dirname } from 'path';
11
11
 
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { removeRetiredSkills } from './chunk-M5OBRUQE.js';
3
+ import { removeRetiredSkills } from './chunk-UIUGTW5C.js';
4
4
  import { defaultFetch, resolveGatewayCredentials } from './chunk-VQ2JGZSC.js';
5
5
  import { withTokenHeader } from './chunk-HDSDUTX4.js';
6
6
  import { appendContextProvenance } from './chunk-ZJSNLVCE.js';
7
- import { loadMaintainedFiles, writeMaintainedFiles } from './chunk-KUTZ6XLS.js';
7
+ import { loadMaintainedFiles, writeMaintainedFiles } from './chunk-G63KT5I5.js';
8
8
  import { cliInvocation } from './chunk-CRB3POP4.js';
9
9
  import { writeDegraded, writeSourceCache, SOURCE_CACHE_TTL_RETRY_MS, writeContextManifest, SOURCE_CACHE_TTL_SUCCESS_MS, readSourceCache, isSourceCacheFresh, clearDegraded } from './chunk-YQR6E6OV.js';
10
- import { normalizeRepoName, parseOuterlayerConfig, classifyTree, emitTree } from './chunk-OGCG5LOX.js';
10
+ import { normalizeRepoName, parseOuterlayerConfig, classifyTree, emitTree } from './chunk-LJG6EMLJ.js';
11
11
  import { homeFromEnv } from './chunk-VNVZDWO3.js';
12
12
  import { execFileSync } from 'child_process';
13
13
  import { existsSync, mkdirSync, writeFileSync, chmodSync, lstatSync, readFileSync, copyFileSync } from 'fs';
@@ -680,11 +680,11 @@ async function missingControlPlane(cwd, sessionId, home, env) {
680
680
  const dirs = findGitDirs(cwd);
681
681
  if (dirs === void 0) return void 0;
682
682
  if (existsSync(join(dirs.gitCommonDir, "outerlayer", "materialized.json")) || hasExcludeBlock(dirs.gitCommonDir)) {
683
- const { cleanupEarlierCopies } = await import('./context-cleanup-UBOJHGQM.js');
683
+ const { cleanupEarlierCopies } = await import('./context-cleanup-BX5Y3AFL.js');
684
684
  cleanupEarlierCopies(dirs);
685
685
  }
686
686
  if (!contextPossiblyGoverned(cwd, home)) return void 0;
687
- const { governanceOf } = await import('./control-plane-launch-R4X63DYW.js');
687
+ const { governanceOf } = await import('./control-plane-launch-K7YD6KEN.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,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { WorkCommandError, postJson } from './chunk-UIBTEDLA.js';
4
- import { defaultGitRunner, materializeContext, isStagingWriteFault, lookupGoverningSource } from './chunk-RVWADVBN.js';
3
+ import { WorkCommandError, postJson } from './chunk-6JNCNHSV.js';
4
+ import { defaultGitRunner, materializeContext, isStagingWriteFault, lookupGoverningSource } from './chunk-JZ4FXSLI.js';
5
5
  import { signingFetchFor } from './chunk-VQ2JGZSC.js';
6
6
  import { signerFor } from './chunk-JT3YO5MH.js';
7
7
  import { SHIM_DIR, stagedContextDir, contextHomeDir, deliveryDir, keptContextDir } from './chunk-ESP5VZBD.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { RESERVED_EMIT_NAMES, ARTIFACT_KINDS, ArtifactCriterionIdSchema } from './chunk-AKHGQKNR.js';
3
+ import { RESERVED_EMIT_NAMES, ARTIFACT_KINDS, ArtifactCriterionIdSchema } from './chunk-E6CO3MJE.js';
4
4
  import { __commonJS, __require, __toESM } from './chunk-Z5GEFMRW.js';
5
5
 
6
6
  createRequire(import.meta.url);
@@ -1,33 +1,33 @@
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-RJYKTWUP.js';
5
- import { zodProblem } from './chunk-I3LTIAOR.js';
6
- import { senderPidfile } from './chunk-Q4YVHYHT.js';
7
- import { installScrubContext } from './chunk-SFJD4MRY.js';
4
+ import { DOCKERD_LOG, HELPER_PATH, HELPER_RECORD } from './chunk-ELYHDWCC.js';
8
5
  import { writeDockerClientConfig } from './chunk-XTNMIV77.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-OEITN64Z.js';
6
+ import { zodProblem } from './chunk-I3LTIAOR.js';
7
+ import { senderPidfile } from './chunk-QJNFO7TQ.js';
8
+ import { installScrubContext } from './chunk-WHRR55PC.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-D7ECJX4J.js';
10
+ import { readBranchHead, fetchCommit, diffBetween } from './chunk-IK6M37BI.js';
11
+ import { isSameProcess, startTimeOf } from './chunk-JBJTC3UU.js';
10
12
  import { waitForAgent, vmExecArgs } from './chunk-QQGZ5THT.js';
11
13
  import { socketPathProblem, vsockLinks, LEASE_LINK, linkVsockSockets } from './chunk-HIGJTX5U.js';
12
- import { describeCallFailure, resolveGoverningSource, refusalCode, removeStagedContext, stageGovernedContext, pinnedSourceOf, commandWithShim, logStamp, createRunnerLog, removeKeptContext, formatDuration, retrySend, formatClock, WORKFLOW_PERMISSION_REASON, keptContextTree } from './chunk-KDM77TVX.js';
14
+ import { describeCallFailure, resolveGoverningSource, refusalCode, removeStagedContext, stageGovernedContext, pinnedSourceOf, commandWithShim, logStamp, createRunnerLog, removeKeptContext, formatDuration, retrySend, formatClock, WORKFLOW_PERMISSION_REASON, keptContextTree } from './chunk-LCVR4UIS.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-S2IJQER5.js';
16
+ import { CLAUDE_CODE_VERSION, FIRECRACKER_VERSION } from './chunk-R6QCSHKC.js';
13
17
  import { imageBuildOf, isBuiltinContainer, isBuiltinProcess, isBuiltinVm, DEFAULT_CHECK_TIME_LIMIT_MINUTES } from './chunk-ALSE7YKX.js';
14
- import { readBranchHead, fetchCommit, diffBetween } from './chunk-IK6M37BI.js';
15
- import { isSameProcess, startTimeOf } from './chunk-JBJTC3UU.js';
16
- 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-UENWEDZ3.js';
17
18
  import { parseSize } from './chunk-YJLHUKYS.js';
18
- import { CLAUDE_CODE_VERSION, FIRECRACKER_VERSION } from './chunk-R6QCSHKC.js';
19
- import { WorkCommandError, postJson, isSignatureRefusal, getJson } from './chunk-UIBTEDLA.js';
20
- import { planArtifactUpload } from './chunk-DM4EGXDO.js';
21
- import { scrubText } from './chunk-AKR32WHV.js';
19
+ import { WorkCommandError, postJson, isSignatureRefusal, getJson } from './chunk-6JNCNHSV.js';
20
+ import { planArtifactUpload } from './chunk-EWVYQLD3.js';
21
+ import { scrubText } from './chunk-5DNCFOXA.js';
22
22
  import { readCloudConfig } from './chunk-PJDQPF5N.js';
23
23
  import { signerFor } from './chunk-JT3YO5MH.js';
24
24
  import { RUNNER_FILE_MODE, runnerDir, buildDir, vsockPath } from './chunk-ESP5VZBD.js';
25
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, RELAY_PORT, repositoryPath, lifecycleWorkdir, CHECK_ITEMS_FILE, currentClaudeCredential, removedClaudeCredentialValues, checkEnvironment, EVAL_INPUT_DIR } from './chunk-HDSDUTX4.js';
26
- import { resolvePackRoot } from './chunk-KUTZ6XLS.js';
26
+ import { resolvePackRoot } from './chunk-G63KT5I5.js';
27
27
  import { MAINTAINED_SKILLS } from './chunk-CDDED64E.js';
28
28
  import { resolveVersion } from './chunk-RA3O54FC.js';
29
- import { parsePolicy } from './chunk-OGCG5LOX.js';
30
- import { CheckItemsSchema, CHECK_ITEM_REASON_MAX_LENGTH } from './chunk-AKHGQKNR.js';
29
+ import { parsePolicy } from './chunk-LJG6EMLJ.js';
30
+ import { CheckItemsSchema, CHECK_ITEM_REASON_MAX_LENGTH } from './chunk-E6CO3MJE.js';
31
31
  import { homeFromEnv } from './chunk-VNVZDWO3.js';
32
32
  import { fdName } from './chunk-XD4ZCMA4.js';
33
33
  import { RUNNER_WORDED_REASONS, UNKNOWN_TRACKING_REASON } from './chunk-MESOOLF4.js';
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'node:module';
3
+ import { formatBytes, freeBytes } from './chunk-YYYRBYWG.js';
4
+ import { BUILD_LABEL, RUNNER_LABEL, runnerLabelValue } from './chunk-S2IJQER5.js';
5
+ import { parseSize } from './chunk-YJLHUKYS.js';
6
+ import { buildsDir, rootfsDir, runnerDir } from './chunk-ESP5VZBD.js';
7
+ import { spawnSync } from 'child_process';
8
+ import { existsSync, statSync, readdirSync } from 'fs';
9
+ import { join } from 'path';
10
+
11
+ createRequire(import.meta.url);
12
+ function checkDiskFit(input) {
13
+ const limit = parseSize(input.buildDisk);
14
+ if (limit === void 0) return { fits: true };
15
+ const { freeBytes: free, heldBytes: held, rootDiskBytes: root } = input.facts;
16
+ const neededBytes = input.concurrency * (limit + root);
17
+ const availableBytes = free + held;
18
+ if (neededBytes <= availableBytes) return { fits: true };
19
+ const oneBuild = root > 0 ? `runner.build.disk ${input.buildDisk} plus a root disk of ${formatBytes(root)}` : `runner.build.disk ${input.buildDisk}`;
20
+ return {
21
+ fits: false,
22
+ neededBytes,
23
+ availableBytes,
24
+ message: `the builds' disks do not fit: runner.concurrency ${input.concurrency} times the space one build can hold (${oneBuild}) needs ${formatBytes(neededBytes)}, and ${formatBytes(availableBytes)} is available (${formatBytes(free)} free plus ${formatBytes(held)} held by running builds)`
25
+ };
26
+ }
27
+ function allocatedBytes(path) {
28
+ try {
29
+ return statSync(path).blocks * 512;
30
+ } catch {
31
+ return 0;
32
+ }
33
+ }
34
+ function listDir(path) {
35
+ try {
36
+ return readdirSync(path);
37
+ } catch {
38
+ return void 0;
39
+ }
40
+ }
41
+ function microVmFacts(configPath) {
42
+ const builds = buildsDir(configPath);
43
+ const free = freeBytes(builds);
44
+ if (free === void 0) return void 0;
45
+ let held = 0;
46
+ if (existsSync(builds)) {
47
+ const entries = listDir(builds);
48
+ if (entries === void 0) return void 0;
49
+ for (const entry of entries) held += allocatedBytes(join(builds, entry, "build.ext4"));
50
+ }
51
+ let root = 0;
52
+ const roots = rootfsDir(runnerDir(configPath));
53
+ if (existsSync(roots)) {
54
+ const entries = listDir(roots);
55
+ if (entries === void 0) return void 0;
56
+ for (const entry of entries) {
57
+ if (!entry.endsWith(".ext4")) continue;
58
+ try {
59
+ root = Math.max(root, statSync(join(roots, entry)).size);
60
+ } catch {
61
+ }
62
+ }
63
+ }
64
+ return { freeBytes: free, heldBytes: held, rootDiskBytes: root };
65
+ }
66
+ var DOCKER_TIMEOUT_MS = 1e4;
67
+ var DEFAULT_BUILD_DISK = "40g";
68
+ var DOCKER_CACHE_MS = 6e4;
69
+ var DEFAULT_VOLUMES_DIR = "/var/lib/docker/volumes";
70
+ function runDocker(args, spawn = spawnSync) {
71
+ const result = spawn("docker", args, { encoding: "utf8", timeout: DOCKER_TIMEOUT_MS });
72
+ return result.status === 0 ? result.stdout : void 0;
73
+ }
74
+ var SIZE_UNITS = { b: 1, kb: 1e3, mb: 1e6, gb: 1e9, tb: 1e12 };
75
+ function volumeBytes(dfOutput, names) {
76
+ let total = 0;
77
+ for (const line of dfOutput.split("\n")) {
78
+ const [name, , size] = line.trim().split(/\s+/);
79
+ if (name === void 0 || size === void 0 || !names.has(name)) continue;
80
+ const match = /^([\d.]+)([A-Za-z]+)$/.exec(size);
81
+ const unit = match === null ? void 0 : SIZE_UNITS[match[2].toLowerCase()];
82
+ if (match !== null && unit !== void 0) total += Number(match[1]) * unit;
83
+ }
84
+ return total;
85
+ }
86
+ function containerFacts(cache, configPath, docker, now) {
87
+ if (cache.reading === void 0 || cache.reading.configPath !== configPath || now - cache.reading.at > DOCKER_CACHE_MS) {
88
+ const root = docker(["info", "--format", "{{.DockerRootDir}}"])?.trim();
89
+ const listed = docker(["volume", "ls", "--quiet", "--filter", `label=${BUILD_LABEL}`, "--filter", `label=${RUNNER_LABEL}=${runnerLabelValue(configPath)}`]);
90
+ const names = new Set((listed ?? "").split("\n").map((n) => n.trim()).filter((n) => n !== ""));
91
+ const df = listed === void 0 || names.size === 0 ? void 0 : docker(["system", "df", "-v"]);
92
+ const held = listed === void 0 ? void 0 : names.size === 0 ? 0 : df === void 0 ? void 0 : volumeBytes(df, names);
93
+ cache.reading = {
94
+ at: now,
95
+ configPath,
96
+ held,
97
+ volumes: root === void 0 || root === "" ? DEFAULT_VOLUMES_DIR : join(root, "volumes")
98
+ };
99
+ }
100
+ if (cache.reading.held === void 0) return void 0;
101
+ const free = freeBytes(cache.reading.volumes);
102
+ return free === void 0 ? void 0 : { freeBytes: free, heldBytes: cache.reading.held, rootDiskBytes: 0 };
103
+ }
104
+ function realBuildDiskProbe(deps = {}) {
105
+ const cache = {};
106
+ const docker = deps.docker ?? ((args) => runDocker(args));
107
+ const now = deps.now ?? Date.now;
108
+ return (kind, configPath) => kind === "vm" ? microVmFacts(configPath) : containerFacts(cache, configPath, docker, now());
109
+ }
110
+
111
+ export { DEFAULT_BUILD_DISK, DOCKER_CACHE_MS, checkDiskFit, realBuildDiskProbe, runDocker, volumeBytes };
@@ -5,7 +5,7 @@ import { C } from './chunk-ANPNT6PM.js';
5
5
  import { readCloudConfigStrict, CloudConfigError, readCloudConfig, writeCloudConfig, cloudConfigPath } from './chunk-PJDQPF5N.js';
6
6
  import { findGitDirs } from './chunk-BJ3KTMDH.js';
7
7
  import { cliInvocation } from './chunk-CRB3POP4.js';
8
- import { CLI_LOGIN_MACHINE_NAME_MAX, CliLoginPollResponseSchema, CLI_LOGIN_KIND, CliLoginRefusalSchema, CliLoginStartedSchema } from './chunk-AKHGQKNR.js';
8
+ import { CLI_LOGIN_MACHINE_NAME_MAX, CliLoginPollResponseSchema, CLI_LOGIN_KIND, CliLoginRefusalSchema, CliLoginStartedSchema } from './chunk-E6CO3MJE.js';
9
9
  import { homeFromEnv } from './chunk-VNVZDWO3.js';
10
10
  import { generateKeyPairSync, privateDecrypt, constants, createPrivateKey } from 'crypto';
11
11
  import { spawn } from 'child_process';
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { autoConnect, detectActiveSession } from './chunk-6TFTRVOA.js';
4
- import { resolveRepoIdentity } from './chunk-AKR32WHV.js';
3
+ import { autoConnect, detectActiveSession } from './chunk-C3XLVHN6.js';
4
+ import { resolveRepoIdentity } from './chunk-5DNCFOXA.js';
5
5
  import { C } from './chunk-ANPNT6PM.js';
6
6
  import { defaultFetch, unauthorizedMessage, resolveGatewayCredentials } from './chunk-VQ2JGZSC.js';
7
7
  import { parseWorkItemEnv } from './chunk-T2Q7ISPE.js';
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { LiveUploader } from './chunk-SFJD4MRY.js';
4
- import { CaptureDaemon } from './chunk-AKR32WHV.js';
5
- import { spoolDir } from './chunk-HT7LVCTX.js';
3
+ import { LiveUploader } from './chunk-WHRR55PC.js';
4
+ import { CaptureDaemon } from './chunk-5DNCFOXA.js';
5
+ import { spoolDir } from './chunk-L3DUKDTR.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';
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { launchRefusalForSession } from './chunk-ESVW4MJY.js';
4
- import { detectActiveSession, autoConnect, transcriptPathForSession } from './chunk-6TFTRVOA.js';
5
- import { resolveRepoIdentity, defaultProjectsDir, findTranscripts, sessionIdFromPath, scrubText } from './chunk-AKR32WHV.js';
4
+ import { detectActiveSession, autoConnect, transcriptPathForSession } from './chunk-C3XLVHN6.js';
5
+ import { resolveRepoIdentity, defaultProjectsDir, findTranscripts, sessionIdFromPath, scrubText } from './chunk-5DNCFOXA.js';
6
6
  import { C } from './chunk-ANPNT6PM.js';
7
7
  import { resolveGatewayCredentials, defaultFetch, unauthorizedMessage } from './chunk-VQ2JGZSC.js';
8
8
  import { readLatestProvenanceForSession } from './chunk-ZJSNLVCE.js';
9
9
  import { launchedItemForSession } from './chunk-T2Q7ISPE.js';
10
10
  import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
11
11
  import { cliInvocation } from './chunk-CRB3POP4.js';
12
- import { FindingBatchSchema, FindingsResponseSchema, SAME_PROBLEM_RULES } from './chunk-AKHGQKNR.js';
12
+ import { FindingBatchSchema, FindingsResponseSchema, SAME_PROBLEM_RULES } from './chunk-E6CO3MJE.js';
13
13
  import { homeFromEnv } from './chunk-VNVZDWO3.js';
14
14
  import { readFileSync, existsSync } from 'fs';
15
15
  import { join, dirname, basename } from 'path';