@outerlayer/cli 0.38.0-next.20261105155912 → 0.38.0-next.20261105195352

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 (172) hide show
  1. package/dist/{agent-setup-RXMEQ7PA.js → agent-setup-THQTFPYB.js} +19 -19
  2. package/dist/{agent-subcommand-KPQGEOPQ.js → agent-subcommand-H5LKM3HG.js} +4 -4
  3. package/dist/{bridge-F4BNXRM2.js → bridge-RN5JYY7N.js} +7 -7
  4. package/dist/{build-ZH5MAZNM.js → build-DJDZXY7M.js} +13 -13
  5. package/dist/{build-disk-GPCMOIZV.js → build-disk-PN7QBYVR.js} +11 -11
  6. package/dist/build-info.json +1 -1
  7. package/dist/{builder-ZMVXHOEJ.js → builder-NJXSBAX3.js} +10 -10
  8. package/dist/caller-T65G6G3Z.js +23 -0
  9. package/dist/{check-CZM3LZ7Y.js → check-QF7RGLUL.js} +55 -55
  10. package/dist/{chunk-IG7SBYJY.js → chunk-2VUBHRPG.js} +1 -1
  11. package/dist/{chunk-Y2HVISUN.js → chunk-365EXSFH.js} +1 -1
  12. package/dist/{chunk-EVFZUFCO.js → chunk-3CN77FDB.js} +4 -4
  13. package/dist/{chunk-RVIZRXBK.js → chunk-3FKWVYWC.js} +3 -3
  14. package/dist/{chunk-PMBG7IYE.js → chunk-3YCKLA4N.js} +10 -10
  15. package/dist/{chunk-64D2YZK5.js → chunk-44332APJ.js} +1 -1
  16. package/dist/{chunk-J7MMYBBV.js → chunk-5BU252QJ.js} +5 -5
  17. package/dist/{chunk-3J7F3VGZ.js → chunk-6S4THFJO.js} +2 -2
  18. package/dist/{chunk-DP6ZOSCR.js → chunk-6UXPXENL.js} +24 -10
  19. package/dist/{chunk-Y5ZKDLNX.js → chunk-6VCNDRNW.js} +15 -15
  20. package/dist/{chunk-L25GQH45.js → chunk-6Z5H7JV3.js} +1 -1
  21. package/dist/{chunk-OCDG3ZWH.js → chunk-72DXH6AP.js} +9 -9
  22. package/dist/{chunk-K7KQCOSM.js → chunk-75D54355.js} +9 -9
  23. package/dist/{chunk-WHPMCF7R.js → chunk-7DHQVVEC.js} +16 -16
  24. package/dist/{chunk-QJKW4MKH.js → chunk-7PZDPISM.js} +54 -2
  25. package/dist/{chunk-RM3K57Q7.js → chunk-A5FIUS53.js} +39 -16
  26. package/dist/{chunk-45UZPTDQ.js → chunk-AGDRXJSZ.js} +1 -1
  27. package/dist/{chunk-GLJX2CZY.js → chunk-AUQPAVRV.js} +350 -300
  28. package/dist/{chunk-XN4A275V.js → chunk-BHATB3L2.js} +23 -13
  29. package/dist/{chunk-MPGTKJOM.js → chunk-BM25MMUE.js} +3 -3
  30. package/dist/{chunk-3PR7BPMG.js → chunk-BP3B5R7Y.js} +4 -4
  31. package/dist/{chunk-K7BI4TLM.js → chunk-DDBCRY3Y.js} +20 -7
  32. package/dist/{chunk-VV2VLQWG.js → chunk-DSR3VW72.js} +2 -2
  33. package/dist/{chunk-5YWOGS66.js → chunk-EJOZNQBE.js} +7 -7
  34. package/dist/{chunk-MY6T3N3A.js → chunk-EUA3SKPV.js} +1 -1
  35. package/dist/{chunk-ZEEQB7VM.js → chunk-FIXRXONQ.js} +5 -5
  36. package/dist/{chunk-2C3XLYO5.js → chunk-G74ZB2V4.js} +1 -1
  37. package/dist/{chunk-EKRLMOWS.js → chunk-GEC2G3SJ.js} +6 -6
  38. package/dist/{chunk-JCEJARDB.js → chunk-GUYDCCUH.js} +1 -1
  39. package/dist/{chunk-2RKPEUGK.js → chunk-HBGVQT33.js} +1 -1
  40. package/dist/{chunk-GZETHU2Z.js → chunk-HLBN3FLS.js} +3 -3
  41. package/dist/{chunk-IJN3GP4M.js → chunk-HUMQ4NLZ.js} +1 -1
  42. package/dist/{chunk-HI5RBFL3.js → chunk-HV44EL6A.js} +14 -9
  43. package/dist/{chunk-VG524OUD.js → chunk-ID3HBQYZ.js} +5 -5
  44. package/dist/{chunk-2QIK3JRV.js → chunk-IRFN2ZHJ.js} +1 -1
  45. package/dist/{chunk-SKV6FO37.js → chunk-KEY5IDTC.js} +4 -4
  46. package/dist/{chunk-KXCTWOPU.js → chunk-KZG3R5YD.js} +3 -3
  47. package/dist/{chunk-M4WTELYI.js → chunk-LQJAZ4VK.js} +3 -3
  48. package/dist/{chunk-DOKFFSOZ.js → chunk-LWHHAZ75.js} +2 -2
  49. package/dist/{chunk-7TPLWWFN.js → chunk-M53UNEO6.js} +1 -1
  50. package/dist/{chunk-35RIDLSD.js → chunk-NAGY6ISM.js} +2 -2
  51. package/dist/{chunk-QDM23DTW.js → chunk-NFKERPLC.js} +10 -10
  52. package/dist/{chunk-HOCVTWV2.js → chunk-NIUSFUUS.js} +1 -1
  53. package/dist/{chunk-EOVVSXRH.js → chunk-NYWLOOIL.js} +7 -7
  54. package/dist/{chunk-GMRIR2MF.js → chunk-O4CWZFC4.js} +7 -7
  55. package/dist/{chunk-LMT72G74.js → chunk-OD2F225Q.js} +1 -1
  56. package/dist/{chunk-MB7IX6DO.js → chunk-ORSNYGXN.js} +1 -1
  57. package/dist/{chunk-XQSTN7NG.js → chunk-P22JMQJB.js} +3 -3
  58. package/dist/{chunk-J56SR6X4.js → chunk-P26TVBYV.js} +1 -1
  59. package/dist/{chunk-HU3POMM4.js → chunk-P64TL3GV.js} +6 -6
  60. package/dist/{chunk-WWTZLRPH.js → chunk-PLVHIQJN.js} +43 -3
  61. package/dist/{chunk-OVRLLZPJ.js → chunk-PWCP3YVA.js} +1 -1
  62. package/dist/{chunk-D5JJQRW7.js → chunk-QNPJ4VZ2.js} +9 -9
  63. package/dist/{chunk-SUMRSD2Q.js → chunk-QNQS4PET.js} +1 -1
  64. package/dist/{chunk-6XYKZH3K.js → chunk-R2QIQZ4V.js} +5 -5
  65. package/dist/{chunk-AWY7ORQ2.js → chunk-RNCCRUT5.js} +1 -1
  66. package/dist/{chunk-5M3KXOPY.js → chunk-S24KG7NY.js} +2 -2
  67. package/dist/{chunk-W7LJQ2GU.js → chunk-SCH5S3VW.js} +4 -4
  68. package/dist/{chunk-OV4XTV5M.js → chunk-SF2TBJBP.js} +7 -4
  69. package/dist/{chunk-VUSYGNNN.js → chunk-SZKBH2BO.js} +1 -1
  70. package/dist/{chunk-YU6XPJ5I.js → chunk-SZN3CSEP.js} +3 -3
  71. package/dist/{chunk-TOH7FJH3.js → chunk-TTYZDLGW.js} +42 -31
  72. package/dist/{chunk-XUXDUOJI.js → chunk-UAVBSFHI.js} +5 -5
  73. package/dist/{chunk-SSSPZ3TB.js → chunk-UEFLAGRW.js} +1 -1
  74. package/dist/{chunk-KXKVMSHC.js → chunk-UFDJDVZD.js} +1 -1
  75. package/dist/{chunk-3B5H5MGB.js → chunk-V52EY5UK.js} +1 -1
  76. package/dist/{chunk-HVUS5WRU.js → chunk-WH4OWQ6T.js} +3 -3
  77. package/dist/{chunk-BMYIPXBG.js → chunk-WPLNTUS6.js} +3 -3
  78. package/dist/{chunk-FRQPX2QR.js → chunk-XGQ7ZHNH.js} +3 -3
  79. package/dist/{chunk-IYUJFAQD.js → chunk-XJPTMZJG.js} +917 -34
  80. package/dist/{chunk-2FDWTE6F.js → chunk-ZFZ62TU4.js} +5 -5
  81. package/dist/{chunk-U63SE2NJ.js → chunk-ZOLDM52Z.js} +1 -1
  82. package/dist/{chunk-H6H5GCM6.js → chunk-ZRYBGZI7.js} +19 -8
  83. package/dist/{chunk-CUAV3727.js → chunk-ZZZIOKUN.js} +3 -3
  84. package/dist/{claude-launcher-3O5W5ENW.js → claude-launcher-LIV7LKKT.js} +8 -8
  85. package/dist/{cli-YMSYVF7O.js → cli-NKKF5PF5.js} +162 -149
  86. package/dist/{command-ZOWMTOWA.js → command-ZQDMVPD4.js} +50 -50
  87. package/dist/{config-J4NNZ2XO.js → config-6LQKXZNE.js} +12 -12
  88. package/dist/{connect-cmd-GVIUKK3R.js → connect-cmd-KHOYYXIY.js} +11 -11
  89. package/dist/{container-start-RZSGWDZG.js → container-start-FGSVYG2T.js} +54 -49
  90. package/dist/{context-cleanup-7V2ARBSC.js → context-cleanup-WYI3QQBI.js} +4 -4
  91. package/dist/{context-show-cmd-73E36KAV.js → context-show-cmd-MUSMZ3ZM.js} +12 -12
  92. package/dist/{control-plane-launch-L744RJ4A.js → control-plane-launch-UGMPLX2S.js} +15 -15
  93. package/dist/{demo-record-cmd-KGH3WGLY.js → demo-record-cmd-GO4ZIP4J.js} +8 -8
  94. package/dist/{demo-voice-cmd-CHCS7TQF.js → demo-voice-cmd-YOIL75H3.js} +20 -20
  95. package/dist/{docker-CAMJXBAJ.js → docker-IWTHGXFC.js} +10 -10
  96. package/dist/{doctor-NILQ2RUT.js → doctor-UUCRZ7JO.js} +55 -55
  97. package/dist/{emit-artifact-cmd-CGY656UZ.js → emit-artifact-cmd-IG5O5KUV.js} +19 -19
  98. package/dist/{emit-cmd-AG7HL3YI.js → emit-cmd-KGBGKB56.js} +7 -7
  99. package/dist/{emit-criteria-cmd-3HYUUSDK.js → emit-criteria-cmd-HV3RXCV5.js} +14 -14
  100. package/dist/{emit-demo-cmd-GHDL7ZGH.js → emit-demo-cmd-ZKHGJUW7.js} +20 -20
  101. package/dist/{emit-finding-cmd-KPHWY6ZU.js → emit-finding-cmd-PBTELK66.js} +14 -14
  102. package/dist/{emit-result-cmd-WOJEHOXH.js → emit-result-cmd-JJUNDXEH.js} +18 -18
  103. package/dist/{emit-step-cmd-QTNJBTZN.js → emit-step-cmd-5VZQBGLU.js} +14 -14
  104. package/dist/{exec-client-IPPD3NF4.js → exec-client-PH7FI3Q3.js} +8 -8
  105. package/dist/find-unit-527IGJNL.js +24 -0
  106. package/dist/{findings-cmd-LVYAXHQG.js → findings-cmd-PVP6D4ZV.js} +14 -14
  107. package/dist/{fleet-readiness-F46LOKJ6.js → fleet-readiness-YZZ6YDXZ.js} +14 -14
  108. package/dist/{governing-source-4XYZYZCD.js → governing-source-UUDIJISJ.js} +20 -20
  109. package/dist/{guest-init-CFJM25V5.js → guest-init-KXBNS3NA.js} +9 -9
  110. package/dist/{hook-fast-RNST4WJH.js → hook-fast-CRC7M2YT.js} +4 -4
  111. package/dist/{hook-install-G3FUCXBE.js → hook-install-3UNSUQVP.js} +4 -4
  112. package/dist/{hook-wrap-fast-HNY3OGLN.js → hook-wrap-fast-GVS5HF5C.js} +3 -3
  113. package/dist/host-checks-ISCYYAYB.js +79 -0
  114. package/dist/host-key-535Z4MV6.js +18 -0
  115. package/dist/{image-tag-5Z2NKCHC.js → image-tag-S5LR2FDL.js} +8 -8
  116. package/dist/index.js +7 -7
  117. package/dist/{init-7OHFUQBV.js → init-2JDKKCKC.js} +46 -46
  118. package/dist/init-CGYS6IGX.js +79 -0
  119. package/dist/{init-agent-B5ADPZIB.js → init-agent-ESCPFY6L.js} +47 -47
  120. package/dist/{init-cmd-ZT2PXGPD.js → init-cmd-RXB7ZCFD.js} +28 -28
  121. package/dist/{init-update-WYM5WSM7.js → init-update-YIQRJG5U.js} +23 -23
  122. package/dist/{install-cmd-3NOHEA6E.js → install-cmd-OG4IHLHP.js} +10 -10
  123. package/dist/{layout-RPYMSWCY.js → layout-ZDD5JMAD.js} +4 -4
  124. package/dist/{logs-XKEW5EOB.js → logs-LLFBENNJ.js} +7 -7
  125. package/dist/loop-36JR7RB2.js +90 -0
  126. package/dist/machine-DGMGTVD7.js +79 -0
  127. package/dist/{machine-skills-RP2Y5F32.js → machine-skills-G253FBPY.js} +4 -4
  128. package/dist/{mcp-install-cmd-IZYHXHXG.js → mcp-install-cmd-WLU64HPE.js} +4 -4
  129. package/dist/{mcp-serve-cmd-HAIJVRR7.js → mcp-serve-cmd-YJX7HUHL.js} +9 -9
  130. package/dist/{paths-6AMRSXZK.js → paths-5OXE4APD.js} +7 -7
  131. package/dist/pending-YC4KF2AW.js +18 -0
  132. package/dist/{pidfile-3BILBCEO.js → pidfile-ID52SG3L.js} +8 -8
  133. package/dist/{record-MV6WJGZT.js → record-XIM2Z2JO.js} +8 -8
  134. package/dist/{relay-CO5I2WOV.js → relay-T22SKZ3G.js} +5 -5
  135. package/dist/{relay-protocol-S2JGOYZZ.js → relay-protocol-64ZEAKJ4.js} +5 -5
  136. package/dist/runner-agents-AGFDPTJN.js +14 -0
  137. package/dist/runner-env-W7LASDJX.js +24 -0
  138. package/dist/{runner-identity-IVP2GW33.js → runner-identity-T7HDG3QU.js} +10 -10
  139. package/dist/{runner-key-VCWF2EN7.js → runner-key-RXTJDYTI.js} +46 -46
  140. package/dist/{session-sender-PWYFVWN6.js → session-sender-B6CSWAHX.js} +19 -19
  141. package/dist/{shell-function-FTY7SSAJ.js → shell-function-RBJR373S.js} +2 -2
  142. package/dist/{spec-cmd-2WKI4V2T.js → spec-cmd-HIQYYRBQ.js} +15 -15
  143. package/dist/{starter-pack-W6S3L76K.js → starter-pack-AK7Z6XLF.js} +5 -5
  144. package/dist/state-ZQN2O2PB.js +18 -0
  145. package/dist/{status-HHM6TH6J.js → status-YD7P337P.js} +46 -46
  146. package/dist/{statusline-fast-5G2CTPSX.js → statusline-fast-WUXKRABL.js} +3 -3
  147. package/dist/{sync-cmd-TIDWKW4E.js → sync-cmd-BRP4QE2W.js} +18 -18
  148. package/dist/update-steps-SBBEBOIJ.js +80 -0
  149. package/dist/{watch-IA6UDVSF.js → watch-B3NVFDVP.js} +18 -18
  150. package/dist/{work-claim-cmd-7TLC4DKU.js → work-claim-cmd-H6M5ANKL.js} +20 -20
  151. package/dist/{work-cmd-2LXE27RX.js → work-cmd-DJNV646Q.js} +14 -14
  152. package/dist/{work-comment-cmd-ER53OPLH.js → work-comment-cmd-6QZQPRJ7.js} +17 -17
  153. package/dist/{work-demo-cmd-CSXUA7KH.js → work-demo-cmd-6MZIVYHK.js} +14 -14
  154. package/dist/{work-logs-cmd-ECF7ZLHO.js → work-logs-cmd-IS4GV5VC.js} +14 -14
  155. package/dist/{work-open-pr-cmd-SUJEYZ6C.js → work-open-pr-cmd-KZSKJKEQ.js} +15 -15
  156. package/dist/{work-pr-cmd-FCNFYWUR.js → work-pr-cmd-ARVEEUF3.js} +14 -14
  157. package/dist/{work-proofs-cmd-UQU6SSFD.js → work-proofs-cmd-YUH3XYQE.js} +16 -16
  158. package/dist/{work-proofs-record-MKCYQLS2.js → work-proofs-record-BDYS2VU2.js} +24 -24
  159. package/dist/{work-stop-cmd-PBC7SJ7M.js → work-stop-cmd-U67OPSCS.js} +14 -14
  160. package/package.json +2 -2
  161. package/dist/caller-J7FR4VBJ.js +0 -23
  162. package/dist/find-unit-N3OJBFS5.js +0 -24
  163. package/dist/host-checks-PPTMNHRA.js +0 -79
  164. package/dist/host-key-QUBI74MS.js +0 -18
  165. package/dist/init-5ERGXSUD.js +0 -79
  166. package/dist/loop-HTKTSGBA.js +0 -90
  167. package/dist/machine-RBYGRRSM.js +0 -79
  168. package/dist/pending-C4XQUKWA.js +0 -18
  169. package/dist/runner-agents-FQ4FODZN.js +0 -14
  170. package/dist/runner-env-72OTIZV2.js +0 -24
  171. package/dist/state-C3FRODOO.js +0 -18
  172. package/dist/update-steps-WD25IX2R.js +0 -80
@@ -1,40 +1,40 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { itemsSentence, criteriaOf, hostItemsOf, loadCitationFinder, testFileMatcher, planCriteria, judgeGroups, failedItems, inCriteriaOrder, testsByCriterion, oneLineReason, criterionInputs, parseJudgeAnswer, judgedItems, MAX_TEST_FILE_BYTES } from './chunk-3B5H5MGB.js';
3
+ import { itemsSentence, criteriaOf, hostItemsOf, loadCitationFinder, testFileMatcher, planCriteria, judgeGroups, failedItems, inCriteriaOrder, testsByCriterion, oneLineReason, criterionInputs, parseJudgeAnswer, judgedItems, MAX_TEST_FILE_BYTES } from './chunk-V52EY5UK.js';
4
4
  import { sha256OfFile, downloadPinned, VoiceDownloadError } from './chunk-2PGI6RDE.js';
5
5
  import { zodProblem } from './chunk-I3LTIAOR.js';
6
- import { hasStoredCredential, storeAgentCredential, credentialFromStdin, isAgentName } from './chunk-XN4A275V.js';
7
- import { upgradedStarterText } from './chunk-2FDWTE6F.js';
8
- import { HELPER_PATH, HELPER_RECORD, DOCKERD_LOG } from './chunk-KXCTWOPU.js';
9
- import { writeDockerClientConfig } from './chunk-MY6T3N3A.js';
10
- import { senderPidfile } from './chunk-M4WTELYI.js';
11
- import { installScrubContext } from './chunk-H6H5GCM6.js';
6
+ import { hasStoredCredential, storedCredentialVariables, storeAgentCredential, isAgentName, credentialFromStdin } from './chunk-BHATB3L2.js';
7
+ import { upgradedStarterText } from './chunk-ZFZ62TU4.js';
8
+ import { HELPER_PATH, HELPER_RECORD, DOCKERD_LOG } from './chunk-KZG3R5YD.js';
9
+ import { writeDockerClientConfig } from './chunk-EUA3SKPV.js';
10
+ import { senderPidfile } from './chunk-LQJAZ4VK.js';
11
+ import { installScrubContext } from './chunk-ZRYBGZI7.js';
12
12
  import { readsJobState, READ_JOB_STATE_FORMATS, jobStateFormatOf } from './chunk-ZVB57WI6.js';
13
- import { runnerImageVersion } from './chunk-2RKPEUGK.js';
14
- import { claimCalls, spoolHomeFor, itemCalls, claimItem, leftByRunnerKey } from './chunk-VV2VLQWG.js';
13
+ import { runnerImageVersion } from './chunk-HBGVQT33.js';
14
+ import { claimCalls, spoolHomeFor, itemCalls, claimItem, leftByRunnerKey } from './chunk-DSR3VW72.js';
15
15
  import { receiveFiles } from './chunk-NN33FYXG.js';
16
- import { readDefaultBranchFiles, readDefaultBranchHead, buildRepositoryImage, fetchCommit, readBranchHead, diffBetween, prepareImageBuild, KEY_PREFIX, TAG_HOST, SHARED_OWNER, SHARED_NAME, universalBase, metadataFromLabels, writeRecord } from './chunk-D5JJQRW7.js';
17
- import { FETCHED_DIR, toolsDockerfile, FETCHED_FFMPEG, FETCHED_GH, FETCHED_TINI, FETCHED_HEADLESS_SHELL, FETCHED_PLAYWRIGHT_FFMPEG, FETCHED_VOICE_DIR } from './chunk-Y5ZKDLNX.js';
16
+ import { readDefaultBranchFiles, readDefaultBranchHead, buildRepositoryImage, fetchCommit, readBranchHead, diffBetween, prepareImageBuild, KEY_PREFIX, TAG_HOST, SHARED_OWNER, SHARED_NAME, universalBase, metadataFromLabels, writeRecord } from './chunk-QNPJ4VZ2.js';
17
+ import { FETCHED_DIR, toolsDockerfile, FETCHED_FFMPEG, FETCHED_GH, FETCHED_TINI, FETCHED_HEADLESS_SHELL, FETCHED_PLAYWRIGHT_FFMPEG, FETCHED_VOICE_DIR } from './chunk-6VCNDRNW.js';
18
18
  import { isSameProcess, startTimeOf } from './chunk-JBJTC3UU.js';
19
19
  import { currentCliBuild } from './chunk-OGFGZQA3.js';
20
- import { vmExecArgs, runExec, execCapture, waitForAgent } from './chunk-LMT72G74.js';
21
- import { socketPathProblem, vsockLinks, linkVsockSockets, GUEST_CID, LEASE_LINK } from './chunk-W7LJQ2GU.js';
22
- import { describeCallFailure, shortClaim, retrySend, commandWithShim, logStamp, createRunnerLog, formatDuration, removeKeptContext, formatClock, stageGovernedContext, keptContextTree, removeStagedContext, WORKFLOW_PERMISSION_REASON, refusalCode, resolveGoverningSource, prefetchGovernedContext, controlPlaneTokenFailure, keepStagedContext, pinnedSourceOf, shimScript } from './chunk-QDM23DTW.js';
23
- import { postJson, WorkCommandError, getJson, isSignatureRefusal } from './chunk-GMRIR2MF.js';
24
- import { runnerCredentialProblem, builtinKind, keyRunnerFactory, optionalEgress, isBuiltinContainer, isBuiltinVm, egressSummary, DEFAULT_WORKSPACE_KEEP_DAYS, DEFAULT_CHECK_TIME_LIMIT_MINUTES, DEFAULT_SETUP_MINUTES, allowHostProblem, systemClock, emptyEgressCounts, hostAllowed, imageBuildOf, DEFAULT_SAVED_STATE_MAX_BYTES } from './chunk-SKV6FO37.js';
25
- import { formatBytes, volumeBytes, allocatedBytes, DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK, freeBytes } from './chunk-3J7F3VGZ.js';
26
- import { firstLine, writeJobFile, readJobFile, spawnRun, RUNNER_LABEL, BUILD_LABEL, said, NETWORK_HELPER_MEMORY, createDockerHost, builderSpec, containerExecArgs, childEnvironment, readDu, withAnswerProtocol, MAX_REPORT_BYTES, parseSize, runnerLabelValue, readJobFileChecked, NETWORK_READY_FILE, networkHelperName, prepareRunArgs, containerRunArgs, judgeCommand, JUDGE_TREE, WORKSPACE_LABEL, homeCopyRunArgs, networkHelperRunArgs, JUDGE_MAX_TURNS, JUDGE_DIR, hashJudgeProgram, identityScript, identityArgs, parseIdentity, mountableHome, homeCopyScript, homeCopyArgs, COMMAND_DIR, judgeProgramRecord, MAX_ITEMS_BYTES, JUDGE_ITEMS, JUDGE_REPORT, identityRunArgs, SAVED_STATE_LABEL } from './chunk-PMBG7IYE.js';
27
- import { universalImagePending, RecipeError, writeSanitizedRecipe, classifyProperties, DOCKER_FEATURE } from './chunk-KXKVMSHC.js';
20
+ import { vmExecArgs, runExec, execCapture, waitForAgent } from './chunk-OD2F225Q.js';
21
+ import { socketPathProblem, vsockLinks, linkVsockSockets, GUEST_CID, LEASE_LINK } from './chunk-SCH5S3VW.js';
22
+ import { describeCallFailure, shortClaim, retrySend, commandWithShim, logStamp, createRunnerLog, formatDuration, removeKeptContext, formatClock, stageGovernedContext, keptContextTree, removeStagedContext, WORKFLOW_PERMISSION_REASON, refusalCode, resolveGoverningSource, prefetchGovernedContext, controlPlaneTokenFailure, keepStagedContext, pinnedSourceOf, shimScript } from './chunk-NFKERPLC.js';
23
+ import { postJson, WorkCommandError, getJson, isSignatureRefusal } from './chunk-O4CWZFC4.js';
24
+ import { runnerCredentialProblem, builtinKind, keyRunnerFactory, optionalEgress, isBuiltinContainer, isBuiltinVm, egressSummary, DEFAULT_WORKSPACE_KEEP_DAYS, DEFAULT_CHECK_TIME_LIMIT_MINUTES, DEFAULT_SETUP_MINUTES, allowHostProblem, systemClock, emptyEgressCounts, hostAllowed, imageBuildOf, DEFAULT_SAVED_STATE_MAX_BYTES } from './chunk-KEY5IDTC.js';
25
+ import { formatBytes, volumeBytes, allocatedBytes, DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK, freeBytes } from './chunk-6S4THFJO.js';
26
+ import { firstLine, writeJobFile, readJobFile, spawnRun, RUNNER_LABEL, BUILD_LABEL, said, NETWORK_HELPER_MEMORY, createDockerHost, builderSpec, containerExecArgs, childEnvironment, readDu, withAnswerProtocol, MAX_REPORT_BYTES, parseSize, runnerLabelValue, readJobFileChecked, NETWORK_READY_FILE, networkHelperName, prepareRunArgs, containerRunArgs, judgeCommand, JUDGE_TREE, WORKSPACE_LABEL, homeCopyRunArgs, networkHelperRunArgs, JUDGE_MAX_TURNS, JUDGE_DIR, hashJudgeProgram, identityScript, identityArgs, parseIdentity, mountableHome, homeCopyScript, homeCopyArgs, COMMAND_DIR, judgeProgramRecord, MAX_ITEMS_BYTES, JUDGE_ITEMS, JUDGE_REPORT, identityRunArgs, SAVED_STATE_LABEL } from './chunk-3YCKLA4N.js';
27
+ import { universalImagePending, RecipeError, writeSanitizedRecipe, classifyProperties, DOCKER_FEATURE } from './chunk-UFDJDVZD.js';
28
28
  import { sanitizeTerminal, planArtifactUpload } from './chunk-VVZIFOAN.js';
29
- import { sharedSkillNames, skillConflictMessage } from './chunk-FRQPX2QR.js';
29
+ import { sharedSkillNames, skillConflictMessage } from './chunk-XGQ7ZHNH.js';
30
30
  import { readCloudConfig } from './chunk-HWVMRETT.js';
31
- import { signerFor } from './chunk-U63SE2NJ.js';
32
- import { vmAssetsDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE, runnerDir, workspacesDir, jobsDir, storeScopes, spoolDir, orgStoreIn, rootfsDir, imagesDir, sessionsDir, builderCacheDiskPath, buildsDir, buildDir, ghConfigDir, runnerDirOfBuild, mirrorDir, orgHomeDir, jobConsolePath, vsockPath, builderConsolePath, rootfsPathFor, diskTemplatesDir, deliveryDir, SHIM_DIR } from './chunk-2C3XLYO5.js';
33
- import { BUILD_HOME, JOB_MOUNT, heldBuildAuthority, IMAGE_BUNDLES, writeTrustFiles, buildEnvironment, trustEnvironment, CHECKOUT_DIR, parseIsolation, containerLocalAddress, destinationEnvironment, withHooksPath, startBuildServices, headerVariables, authorEnvironment, sharedUserEnvironment, withTunnelRecord, commitIdentityRecord, repositoriesOf, RELAY_PORT, repositoryPath, lifecycleWorkdir, CHECK_ITEMS_FILE, parseProxied, readBundleScript, applyTrust, STAND_IN, proxyEnvironment, dropBuildAuthority, hostKeyOf, buildAuthorityFor, checkEnvironment, withMiseVariables, checkoutPath, primaryOf, variablesFor, carried6to4, classifyAddress, EVAL_INPUT_DIR, isMiseVariableAllowed, variableForPath, droppedRequestHeaders, hasDotDotSegment, routeNameOf } from './chunk-XUXDUOJI.js';
34
- import { agentCredential, RUNNER_WORDED_REASONS, UNKNOWN_TRACKING_REASON, UNKNOWN_TRANSPORT_REASON, RELAY_USER, currentAgentCredential, removedAgentCredentialValues, managedAgentCredential, realFdStorePort, builtInNames, MAX_MALFORMED_SESSIONS, MALFORMED_REASON, JOIN_WAIT_MS, MAX_OPEN_STREAMS, STREAM_RESET_RATE, STREAM_RESET_BURST, STREAM_WINDOW, SESSION_WINDOW, targetOfPath, AGENT_CREDENTIAL_MISSING, fdName, RELAY_ID, DOCKER_DESKTOP_REASON } from './chunk-DP6ZOSCR.js';
35
- import { versionAtLeast } from './chunk-OV4XTV5M.js';
36
- import { jobAgent, firecrackerArch, MICROVM_ARCHES, FIRECRACKER_VERSION, hostHelperPinned, builderDiskPinned, guestAssetsPinned, runnerAgentNamed, credentialForms, orList, credentialShapes, agentCommands, defaultCommandLine, credentialAgent, GUEST_HELPER_SHA256, GUEST_ASSETS_BASE_URL, GUEST_KERNEL_SHA256, JAILER_BINARY_SHA256, FIRECRACKER_BINARY_SHA256, FIRECRACKER_SHA256, GUEST_ASSETS_VERSION, BUILDER_DISK_VERSION, credentialHandOffKey, strippedVariables, runnerAgents, networkHelperPinned, NETWORK_HELPER_SHA256, universalImagePinned, UNIVERSAL_IMAGE, FFMPEG_STATIC, FFMPEG_BUILD_TAG, GH_SHA256, GH_VERSION, TINI_SHA256, TINI_VERSION, HEADLESS_SHELL, HEADLESS_SHELL_BASE_URL, PLAYWRIGHT_FFMPEG, PLAYWRIGHT_FFMPEG_BASE_URL, VOICE_PACK_FILES, BUILDER_DISK_SHA256, BUILDER_DISK_BASE_URL, DEFAULT_BASE_IMAGE, agentVersionOf } from './chunk-RM3K57Q7.js';
37
- import { sessionFolderIn, legacyAgent, defaultAgents, parsePolicy, AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE, orderSessions, extractFacts, sessionsToTimeline, resolvePackRoot } from './chunk-IYUJFAQD.js';
31
+ import { signerFor } from './chunk-ZOLDM52Z.js';
32
+ import { vmAssetsDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE, runnerDir, workspacesDir, jobsDir, storeScopes, spoolDir, orgStoreIn, rootfsDir, imagesDir, sessionsDir, builderCacheDiskPath, buildsDir, buildDir, ghConfigDir, runnerDirOfBuild, mirrorDir, orgHomeDir, jobConsolePath, vsockPath, builderConsolePath, rootfsPathFor, diskTemplatesDir, deliveryDir, SHIM_DIR } from './chunk-G74ZB2V4.js';
33
+ import { BUILD_HOME, JOB_MOUNT, heldBuildAuthority, IMAGE_BUNDLES, writeTrustFiles, buildEnvironment, trustEnvironment, CHECKOUT_DIR, parseIsolation, containerLocalAddress, destinationEnvironment, withHooksPath, startBuildServices, headerVariables, authorEnvironment, sharedUserEnvironment, withTunnelRecord, commitIdentityRecord, repositoriesOf, RELAY_PORT, repositoryPath, lifecycleWorkdir, CHECK_ITEMS_FILE, parseProxied, readBundleScript, applyTrust, STAND_IN, proxyEnvironment, dropBuildAuthority, hostKeyOf, buildAuthorityFor, checkEnvironment, withMiseVariables, checkoutPath, primaryOf, variablesFor, carried6to4, classifyAddress, EVAL_INPUT_DIR, isMiseVariableAllowed, variableForPath, droppedRequestHeaders, hasDotDotSegment, routeNameOf } from './chunk-UAVBSFHI.js';
34
+ import { agentCredential, RUNNER_WORDED_REASONS, UNKNOWN_TRACKING_REASON, UNKNOWN_TRANSPORT_REASON, RELAY_USER, currentAgentCredential, removedAgentCredentialValues, managedAgentCredential, realFdStorePort, builtInNames, MAX_MALFORMED_SESSIONS, MALFORMED_REASON, JOIN_WAIT_MS, MAX_OPEN_STREAMS, STREAM_RESET_RATE, STREAM_RESET_BURST, STREAM_WINDOW, SESSION_WINDOW, targetOfPath, AGENT_CREDENTIAL_MISSING, fdName, RELAY_ID, DOCKER_DESKTOP_REASON } from './chunk-6UXPXENL.js';
35
+ import { versionAtLeast } from './chunk-SF2TBJBP.js';
36
+ import { jobAgent, firecrackerArch, MICROVM_ARCHES, FIRECRACKER_VERSION, hostHelperPinned, builderDiskPinned, guestAssetsPinned, runnerAgentNamed, credentialForms, orList, credentialShapes, agentCommands, defaultCommandLine, credentialAgent, GUEST_HELPER_SHA256, GUEST_ASSETS_BASE_URL, GUEST_KERNEL_SHA256, JAILER_BINARY_SHA256, FIRECRACKER_BINARY_SHA256, FIRECRACKER_SHA256, GUEST_ASSETS_VERSION, BUILDER_DISK_VERSION, credentialHandOffKey, strippedVariables, runnerAgents, judgeAgent, networkHelperPinned, NETWORK_HELPER_SHA256, universalImagePinned, UNIVERSAL_IMAGE, FFMPEG_STATIC, FFMPEG_BUILD_TAG, GH_SHA256, GH_VERSION, TINI_SHA256, TINI_VERSION, HEADLESS_SHELL, HEADLESS_SHELL_BASE_URL, PLAYWRIGHT_FFMPEG, PLAYWRIGHT_FFMPEG_BASE_URL, VOICE_PACK_FILES, BUILDER_DISK_SHA256, BUILDER_DISK_BASE_URL, DEFAULT_BASE_IMAGE, agentVersionOf } from './chunk-A5FIUS53.js';
37
+ import { sessionFolderIn, legacyAgent, defaultAgents, parsePolicy, AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE, orderSessions, extractFacts, sessionsToTimeline, resolvePackRoot } from './chunk-XJPTMZJG.js';
38
38
  import { MAINTAINED_SKILLS } from './chunk-CDDED64E.js';
39
39
  import { resolveVersion } from './chunk-RA3O54FC.js';
40
40
  import { homeFromEnv } from './chunk-352DHUTP.js';
@@ -79,8 +79,8 @@ var REASON_TEXT = {
79
79
  session_not_loaded: "the saved session could not be loaded",
80
80
  build_type_cannot_resume: "this build type cannot resume"
81
81
  };
82
- function sessionFilesOf(sessionId, agents) {
83
- const agent = jobAgent(void 0, agents);
82
+ function sessionFilesOf(sessionId, agents, job) {
83
+ const agent = jobAgent(job, agents);
84
84
  const capture = agent?.adapter.capture;
85
85
  if (capture === void 0) throw new Error(`${agent?.descriptor.label ?? "the agent list"} keeps no session files`);
86
86
  return capture.sessionFiles({ home: BUILD_HOME, cwd: CHECKOUT_DIR, sessionId });
@@ -102,11 +102,11 @@ function scrubFilesUnder(dir, scrub) {
102
102
  } else throw new Error(`${name} is not a regular file, so it cannot be scrubbed`);
103
103
  }
104
104
  }
105
- async function keepSession(input, agents = defaultAgents()) {
105
+ async function keepSession(input, agents = defaultAgents(), job) {
106
106
  const { dir } = input;
107
107
  const meta = input.scrub === void 0 ? input.meta : { ...input.meta, scrubbed: true };
108
108
  if (!SESSION_ID.test(meta.sessionId)) throw new Error(`cannot keep the session ${JSON.stringify(meta.sessionId)}`);
109
- const transcriptName = sessionFilesOf(meta.sessionId, agents).entries[0];
109
+ const transcriptName = sessionFilesOf(meta.sessionId, agents, job).entries[0];
110
110
  const parent = dirname(dir);
111
111
  mkdirSync(parent, { recursive: true, mode: 448 });
112
112
  const tag = randomBytes(4).toString("hex");
@@ -141,7 +141,7 @@ async function keepSession(input, agents = defaultAgents()) {
141
141
  rmSync(incoming, { recursive: true, force: true });
142
142
  }
143
143
  }
144
- function readKeptSession(dir, agents = defaultAgents()) {
144
+ function readKeptSession(dir, agents = defaultAgents(), job) {
145
145
  let parsed;
146
146
  try {
147
147
  parsed = JSON.parse(readFileSync(join(dir, META_FILE), "utf8"));
@@ -151,7 +151,7 @@ function readKeptSession(dir, agents = defaultAgents()) {
151
151
  if (typeof parsed.sessionId !== "string" || !SESSION_ID.test(parsed.sessionId) || typeof parsed.claimId !== "string" || typeof parsed.queue !== "string" || typeof parsed.keptAt !== "string") return void 0;
152
152
  let transcript;
153
153
  try {
154
- transcript = join(dir, sessionFilesOf(parsed.sessionId, agents).entries[0]);
154
+ transcript = join(dir, sessionFilesOf(parsed.sessionId, agents, job).entries[0]);
155
155
  if (!statSync(transcript).isFile()) return void 0;
156
156
  } catch {
157
157
  return void 0;
@@ -193,8 +193,8 @@ function filesUnder(root, relative2) {
193
193
  }
194
194
  return stat.isFile() ? [{ path: relative2, type: "0", size: stat.size, mtimeMs: stat.mtimeMs }] : [];
195
195
  }
196
- function packKeptSession(dir, meta, agents = defaultAgents()) {
197
- const names = sessionFilesOf(meta.sessionId, agents).entries;
196
+ function packKeptSession(dir, meta, agents = defaultAgents(), job) {
197
+ const names = sessionFilesOf(meta.sessionId, agents, job).entries;
198
198
  async function* pack() {
199
199
  for (const name of names) {
200
200
  let entries;
@@ -225,7 +225,7 @@ function packKeptSession(dir, meta, agents = defaultAgents()) {
225
225
  }
226
226
  function resumeDecision(input, agents = defaultAgents()) {
227
227
  if (input.queue !== "amend") return void 0;
228
- if (!input.builtin || jobAgent(void 0, agents)?.adapter.launch?.session === void 0) return { resumed: false, reason: "build_type_cannot_resume" };
228
+ if (!input.builtin || jobAgent(input.job, agents)?.adapter.launch?.session === void 0) return { resumed: false, reason: "build_type_cannot_resume" };
229
229
  if (input.kept === void 0) return { resumed: false, reason: "no_saved_session" };
230
230
  return { resumed: true, fromSessionId: input.kept.sessionId, fromClaimId: input.kept.claimId };
231
231
  }
@@ -234,13 +234,13 @@ async function prepareResume(input, agents = defaultAgents()) {
234
234
  const fresh = (resume) => ({ sessionId, resume, env: { [SESSION_ID_VARIABLE]: sessionId } });
235
235
  if (input.queue !== "amend") return fresh(void 0);
236
236
  const dir = keptSessionDir(input.configPath, input.organizationId, input.workItemId);
237
- let kept = readKeptSession(dir, agents);
237
+ let kept = readKeptSession(dir, agents, input.job);
238
238
  if (kept !== void 0 && input.requireScrubNote === true && kept.meta.scrubbed !== true) {
239
239
  rmSync(dir, { recursive: true, force: true });
240
240
  input.log("the saved session was kept before the runner scrubbed sessions, so it is removed");
241
241
  kept = void 0;
242
242
  }
243
- const decision = resumeDecision({ queue: input.queue, builtin: input.builtin, kept: kept?.meta }, agents);
243
+ const decision = resumeDecision({ queue: input.queue, builtin: input.builtin, kept: kept?.meta, job: input.job }, agents);
244
244
  if (!decision.resumed) {
245
245
  input.log(`agent job starts fresh because ${REASON_TEXT[decision.reason]}`);
246
246
  return fresh(decision);
@@ -253,7 +253,7 @@ async function prepareResume(input, agents = defaultAgents()) {
253
253
  return fresh({ resumed: false, reason: "session_not_loaded" });
254
254
  }
255
255
  input.log(`agent job continues session ${meta.sessionId.slice(0, 8)} of claim ${shortClaim(meta.claimId)}`);
256
- return { sessionId, resume: decision, env: { [SESSION_ID_VARIABLE]: sessionId, [RESUME_SESSION_VARIABLE]: `${RESUME_DIR}/${sessionFilesOf(meta.sessionId, agents).entries[0]}` } };
256
+ return { sessionId, resume: decision, env: { [SESSION_ID_VARIABLE]: sessionId, [RESUME_SESSION_VARIABLE]: `${RESUME_DIR}/${sessionFilesOf(meta.sessionId, agents, input.job).entries[0]}` } };
257
257
  }
258
258
  var COPY_OUT_SCRIPT = 'cd "$1" 2>/dev/null && [ -f "$2" ] || exit 3; shift; for entry in "$@"; do if [ -e "$entry" ]; then set -- "$@" "$entry"; fi; shift; done; exec tar -cf - "$@"';
259
259
  var SESSION_COPY_MS = 15 * 6e4;
@@ -268,7 +268,7 @@ async function copyOutSession(input, agents = defaultAgents()) {
268
268
  const out = fd;
269
269
  const maxBytes = input.maxBytes ?? MAX_SESSION_COPY_BYTES;
270
270
  const stop = new AbortController();
271
- const files = sessionFilesOf(input.sessionId, agents);
271
+ const files = sessionFilesOf(input.sessionId, agents, input.job);
272
272
  let written = 0;
273
273
  let overCap = false;
274
274
  const result = await input.guest.stream(["/bin/sh", "-c", COPY_OUT_SCRIPT, "sh", files.dir, ...files.entries], {
@@ -376,8 +376,8 @@ function managedClaudeKeyValuesFor(jobDir) {
376
376
  const key = everHeldBy.get(jobDir);
377
377
  return key === void 0 ? [] : [key];
378
378
  }
379
- function hasClaudeCredential(config, hostEnv, jobDir, agents) {
380
- if (jobAgent(void 0, agents)?.adapter.credentials === void 0) return true;
379
+ function hasClaudeCredential(config, hostEnv, jobDir, agents, job) {
380
+ if (jobAgent(job, agents)?.adapter.credentials === void 0) return true;
381
381
  return config.managed === true ? managedClaudeKeyFor(jobDir) !== void 0 : agentCredential(hostEnv, {}, agents) !== void 0;
382
382
  }
383
383
 
@@ -1630,6 +1630,228 @@ function judgeProbe(probe, missedBefore) {
1630
1630
  if (probe.alive) return { kind: "running" };
1631
1631
  return missedBefore ? { kind: "lost" } : { kind: "recheck" };
1632
1632
  }
1633
+ var EVAL_INPUT_NAME = "eval-input";
1634
+ sessionFolderIn(BUILD_HOME, legacyAgent().descriptor);
1635
+ var MAX_TRANSCRIPT_BYTES = 7 * 1024 * 1024;
1636
+ var MAX_TRANSCRIPTS = 500;
1637
+ var MAX_TOTAL_TRANSCRIPT_BYTES = 64 * 1024 * 1024;
1638
+ var TRANSCRIPT_COPY_MS = 2 * 60 * 1e3;
1639
+ function firstLine3(text2) {
1640
+ return text2.trim().split("\n")[0] ?? "";
1641
+ }
1642
+ function transcriptExtension(agent) {
1643
+ const name = agent.adapter.capture?.sessionFiles({ home: BUILD_HOME, cwd: "/", sessionId: "id" }).entries[0];
1644
+ const dot = name === void 0 ? -1 : name.lastIndexOf(".");
1645
+ return dot < 0 ? ".jsonl" : name.slice(dot);
1646
+ }
1647
+ async function copyTranscripts(run, now = Date.now, agents = defaultAgents(), job) {
1648
+ const agent = jobAgent(job, agents);
1649
+ if (agent === void 0) return { ok: true, copied: [], missed: [] };
1650
+ const root = sessionFolderIn(BUILD_HOME, agent.descriptor);
1651
+ const deadline = now() + TRANSCRIPT_COPY_MS;
1652
+ let listed;
1653
+ try {
1654
+ listed = await run(["find", root, "-type", "f", "-name", `*${transcriptExtension(agent)}`, "-print0"]);
1655
+ } catch (err) {
1656
+ return { ok: false, reason: describeCallFailure(err) };
1657
+ }
1658
+ if (listed.status !== 0 && !/No such file or directory/.test(listed.stderr)) {
1659
+ return { ok: false, reason: `listing the transcripts failed (exit ${listed.status})${firstLine3(listed.stderr) === "" ? "" : `: ${firstLine3(listed.stderr)}`}` };
1660
+ }
1661
+ const paths = listed.stdout.split("\0").filter((entry) => entry.startsWith(`${root}/`) && !entry.includes("\n") && !entry.slice(root.length + 1).split("/").includes("..")).map((entry) => entry.slice(root.length + 1)).sort();
1662
+ const copied = [];
1663
+ const missed = [];
1664
+ let total = 0;
1665
+ for (const [index, path] of paths.entries()) {
1666
+ if (index >= MAX_TRANSCRIPTS) {
1667
+ missed.push({ path, reason: `the build wrote more than ${MAX_TRANSCRIPTS} transcripts` });
1668
+ continue;
1669
+ }
1670
+ if (now() >= deadline) {
1671
+ missed.push({ path, reason: `copying the transcripts took longer than ${TRANSCRIPT_COPY_MS / 1e3} seconds` });
1672
+ continue;
1673
+ }
1674
+ try {
1675
+ const read = await run(["head", "-c", String(MAX_TRANSCRIPT_BYTES + 1), `${root}/${path}`]);
1676
+ if (read.status !== 0) missed.push({ path, reason: `reading it failed (exit ${read.status})${firstLine3(read.stderr) === "" ? "" : `: ${firstLine3(read.stderr)}`}` });
1677
+ else if (Buffer.byteLength(read.stdout) > MAX_TRANSCRIPT_BYTES) missed.push({ path, reason: `it is larger than ${MAX_TRANSCRIPT_BYTES / (1024 * 1024)} MiB` });
1678
+ else if (total + Buffer.byteLength(read.stdout) > MAX_TOTAL_TRANSCRIPT_BYTES) missed.push({ path, reason: `copying it would take the transcripts past ${MAX_TOTAL_TRANSCRIPT_BYTES / (1024 * 1024)} MiB` });
1679
+ else {
1680
+ total += Buffer.byteLength(read.stdout);
1681
+ copied.push({ path, content: read.stdout });
1682
+ }
1683
+ } catch (err) {
1684
+ missed.push({ path, reason: describeCallFailure(err) });
1685
+ }
1686
+ }
1687
+ return { ok: true, copied, missed };
1688
+ }
1689
+ function collectsOwnSessions(job, agents = defaultAgents()) {
1690
+ return jobAgent(job, agents)?.adapter.capture?.collect !== void 0;
1691
+ }
1692
+ async function copyAfterCollect(collect, copy, log) {
1693
+ if (collect !== void 0) {
1694
+ try {
1695
+ await collect();
1696
+ } catch (err) {
1697
+ log?.(`the sessions could not be collected before the copy: ${describeCallFailure(err)} \xB7 continuing`);
1698
+ }
1699
+ }
1700
+ return copy();
1701
+ }
1702
+ function traceIdForSession(sessionId) {
1703
+ const stripped = sessionId.replace(/-/g, "").toLowerCase();
1704
+ if (/^[0-9a-f]{32}$/.test(stripped)) return stripped;
1705
+ return createHash("sha256").update(sessionId).digest("hex").slice(0, 32);
1706
+ }
1707
+ function sessionOptionsOf(path) {
1708
+ const segments = path.split("/");
1709
+ const stem = (segments.at(-1) ?? path).replace(/\.jsonl?$/, "");
1710
+ const at = segments.lastIndexOf("subagents");
1711
+ if (at <= 0) return { fallbackId: stem };
1712
+ const parent = segments[at - 1];
1713
+ return {
1714
+ fallbackId: stem,
1715
+ isSubagent: true,
1716
+ ...parent ? { parentSessionId: parent } : {},
1717
+ ownId: stem,
1718
+ ...segments[at + 1] === "workflows" && segments[at + 2] ? { workflowRunId: segments[at + 2] } : {}
1719
+ };
1720
+ }
1721
+ function forkRecordOf(job) {
1722
+ return job.sessionId !== void 0 && job.sessionLaunchedAt !== void 0 ? { sessionId: job.sessionId, launchedAt: job.sessionLaunchedAt } : void 0;
1723
+ }
1724
+ function scrubbing(scrub, author, work) {
1725
+ setCustomScrubbers(scrub, () => void 0);
1726
+ setLocalIdentity({ home: BUILD_HOME, ...author?.name === void 0 ? {} : { name: author.name }, ...author?.email === void 0 ? {} : { email: author.email } });
1727
+ setRepoRoot(CHECKOUT_DIR);
1728
+ try {
1729
+ return work();
1730
+ } finally {
1731
+ setCustomScrubbers(void 0, () => void 0);
1732
+ setLocalIdentity({});
1733
+ setRepoRoot(void 0);
1734
+ }
1735
+ }
1736
+ function scrubLine(line2) {
1737
+ try {
1738
+ return JSON.stringify(scrubDeep(JSON.parse(line2)));
1739
+ } catch {
1740
+ return scrubText(line2);
1741
+ }
1742
+ }
1743
+ function writeReadOnly(path, text2) {
1744
+ writeFileSync(path, text2);
1745
+ chmodSync(path, 292);
1746
+ }
1747
+ function diffBase(job) {
1748
+ const recorded = (job.container ?? job.microvm)?.startCommit;
1749
+ if (recorded !== void 0 && recorded !== "") return { commit: recorded, source: "build" };
1750
+ const recipe = job.environment?.recipe?.sourceCommit;
1751
+ return recipe === void 0 || recipe === "" ? void 0 : { commit: recipe, source: "recipe" };
1752
+ }
1753
+ async function writeEvalInput(request) {
1754
+ const { job, dir, log } = request;
1755
+ const tag = `${itemTag(job)}`;
1756
+ rmSync(dir, { recursive: true, force: true });
1757
+ mkdirSync(join(dir, "sessions"), { recursive: true });
1758
+ chmodSync(dir, 493);
1759
+ chmodSync(join(dir, "sessions"), 493);
1760
+ let workItem;
1761
+ try {
1762
+ const data = await request.readWorkItem();
1763
+ writeReadOnly(join(dir, "work-item.json"), `${JSON.stringify(data, null, 2)}
1764
+ `);
1765
+ workItem = { status: "written" };
1766
+ } catch (err) {
1767
+ workItem = { status: "unavailable", reason: describeCallFailure(err) };
1768
+ log.error(`${tag} the work item could not be read for the checks' input: ${workItem.reason}`);
1769
+ }
1770
+ const patch = join(dir, "diff.patch");
1771
+ const base = diffBase(job);
1772
+ let diff;
1773
+ if (base === void 0) {
1774
+ diff = { status: "unavailable", reason: "the build recorded no commit it started from" };
1775
+ } else {
1776
+ const fetched = await request.fetchDiff({ remote: request.remote, dir: join(request.scratch, "diff"), base: base.commit, head: request.branchHead, token: request.readToken, output: patch });
1777
+ diff = fetched.ok ? { status: "written", base: base.commit, head: request.branchHead, baseSource: base.source } : { status: "unavailable", base: base.commit, head: request.branchHead, baseSource: base.source, reason: fetched.reason };
1778
+ if (!fetched.ok) log.error(`${tag} the diff could not be read for the checks' input: ${fetched.reason}`);
1779
+ }
1780
+ if (diff.status === "unavailable") writeFileSync(patch, "");
1781
+ chmodSync(patch, 292);
1782
+ const sessions = [];
1783
+ const parsed = [];
1784
+ const copiedByTrace = /* @__PURE__ */ new Map();
1785
+ let sessionsUnavailable;
1786
+ const capture = jobAgent(request.job, request.agents)?.adapter.capture;
1787
+ if (!request.transcripts.ok) {
1788
+ sessionsUnavailable = request.transcripts.reason;
1789
+ log.error(`${tag} the sessions could not be copied for the checks' input: ${sessionsUnavailable}`);
1790
+ } else if (capture === void 0) {
1791
+ sessionsUnavailable = "the job agent has no capture part to read the transcripts with";
1792
+ log.error(`${tag} the sessions could not be read for the checks' input: ${sessionsUnavailable}`);
1793
+ } else {
1794
+ const { copied, missed } = request.transcripts;
1795
+ scrubbing(request.scrub, request.job.commitIdentity?.author, () => {
1796
+ for (const transcript of copied) {
1797
+ const options = sessionOptionsOf(transcript.path);
1798
+ const fork = forkFor(forkRecordOf(request.job), { sessionId: options.fallbackId ?? "", parentSessionId: options.parentSessionId });
1799
+ if (fork !== void 0) options.fork = fork;
1800
+ const subagent = options.isSubagent === true;
1801
+ const stem = options.fallbackId ?? transcript.path;
1802
+ let session = null;
1803
+ try {
1804
+ session = capture.parseText(transcript.content, options).session;
1805
+ } catch {
1806
+ }
1807
+ const traceId = traceIdForSession(session?.id ?? stem);
1808
+ if (session === null) {
1809
+ sessions.push({ traceId, subagent, status: "missing", reason: "the transcript holds no session" });
1810
+ log.error(`${tag} the transcript ${transcript.path} holds no session, so the checks' input leaves it out`);
1811
+ continue;
1812
+ }
1813
+ const kept = copiedByTrace.get(traceId);
1814
+ if (kept !== void 0) {
1815
+ kept.duplicates = (kept.duplicates ?? 0) + 1;
1816
+ log.error(`${tag} the transcript ${transcript.path} repeats session ${traceId}, so the checks' input leaves it out`);
1817
+ continue;
1818
+ }
1819
+ const file = `sessions/${traceId}.jsonl`;
1820
+ const text2 = transcript.content.split("\n").filter((line2) => line2.trim() !== "").map(scrubLine).join("\n");
1821
+ writeReadOnly(join(dir, file), `${text2}
1822
+ `);
1823
+ scrubDeep(session);
1824
+ parsed.push({ session: downconvertSession(session, "full"), traceId, subagent });
1825
+ const entry = { traceId, subagent, file, status: "copied" };
1826
+ copiedByTrace.set(traceId, entry);
1827
+ sessions.push(entry);
1828
+ }
1829
+ for (const miss of missed) {
1830
+ const options = sessionOptionsOf(miss.path);
1831
+ sessions.push({ traceId: traceIdForSession(options.fallbackId ?? miss.path), subagent: options.isSubagent === true, status: "missing", reason: miss.reason });
1832
+ log.error(`${tag} the transcript ${miss.path} could not be copied for the checks' input: ${miss.reason}`);
1833
+ }
1834
+ });
1835
+ }
1836
+ const ordered = orderSessions(parsed.map((entry) => entry.session));
1837
+ const traceOf = new Map(parsed.map((entry) => [entry.session.id, entry.traceId]));
1838
+ const facts = extractFacts(sessionsToTimeline(parsed.map((entry) => entry.session)));
1839
+ const traceAt = (index) => traceOf.get(ordered[index].id);
1840
+ const recorded = { commands: facts.coverage.has("commands"), edits: facts.coverage.has("edits") };
1841
+ const activity = {
1842
+ schemaVersion: 1,
1843
+ sessions: sessions.sort((a, b) => a.traceId.localeCompare(b.traceId)),
1844
+ // Left out of the file when undefined.
1845
+ sessionsUnavailable,
1846
+ workItem,
1847
+ diff,
1848
+ recorded,
1849
+ commands: recorded.commands ? facts.runs.map((run) => ({ seq: run.seq, traceId: traceAt(run.sessionIndex), turn: run.turnIndex, command: run.normalized, kind: run.kind, status: run.status })) : null,
1850
+ edits: recorded.edits ? facts.edits.map((edit) => ({ seq: edit.seq, traceId: traceAt(edit.sessionIndex), turn: edit.turnIndex, file: edit.file, status: edit.status })) : null
1851
+ };
1852
+ writeReadOnly(join(dir, "activity.json"), `${JSON.stringify(activity, null, 2)}
1853
+ `);
1854
+ }
1633
1855
  function groupName(gid) {
1634
1856
  try {
1635
1857
  for (const line2 of readFileSync("/etc/group", "utf8").split("\n")) {
@@ -1754,11 +1976,11 @@ function readConfigObject(configPath) {
1754
1976
  throw new RunnerInitError(`${configPath}: not valid JSON (${err instanceof Error ? err.message : String(err)})`);
1755
1977
  }
1756
1978
  }
1757
- function handedCredential(value, agents) {
1979
+ function handedCredential(value, agents, agent) {
1758
1980
  if (value === void 0) return void 0;
1759
1981
  const key = credentialHandOffKey(agents);
1760
1982
  if (typeof value !== "string") throw new RunnerInitError(`the config on stdin carries a ${key} that is not text.`);
1761
- return credentialFromStdin(value, agents);
1983
+ return credentialFromStdin(value, agents, agent);
1762
1984
  }
1763
1985
  function handedAgent(value, agents) {
1764
1986
  if (value === void 0) return void 0;
@@ -1781,8 +2003,8 @@ function parseStdinConfig(configPath, text2, agents) {
1781
2003
  if (problem !== void 0) throw new RunnerInitError(`the config on stdin: ${problem.field} ${problem.reason}.`);
1782
2004
  const carried = config.runner;
1783
2005
  const key = credentialHandOffKey(agents);
1784
- const credential = handedCredential(config[key], agents);
1785
2006
  const agent = handedAgent(config.agent, agents);
2007
+ const credential = handedCredential(config[key], agents, agent);
1786
2008
  delete config.runner;
1787
2009
  delete config[key];
1788
2010
  delete config.agent;
@@ -1821,11 +2043,20 @@ function prepareRunnerInit(configPath, opts = {}) {
1821
2043
  if (hooks === void 0) throw new RunnerInitError(isolationRefusal(machine));
1822
2044
  const named = agent === void 0 ? void 0 : runnerAgentNamed(agent, agents);
1823
2045
  if (named !== void 0 && credential === void 0 && opts.credentialInEnvironment !== true && !hasStoredCredential(configPath, agents)) {
1824
- const forms = credentialForms(named.descriptor);
2046
+ const forms = credentialForms(named.descriptor, agents);
1825
2047
  throw new RunnerInitError(
1826
2048
  `--agent ${forms.runnerName} needs ${forms.possessive} credential, and none was piped on stdin or is in the ${forms.envFile} beside the config. Pipe ${orList(credentialShapes(named.descriptor).map((shape) => shape.phrase))}: printf '%s' "$${forms.variables[0]}" | outerlayer runner init --agent ${forms.runnerName}`
1827
2049
  );
1828
2050
  }
2051
+ if (named !== void 0 && credential === void 0 && opts.credentialInEnvironment !== true) {
2052
+ const stored = storedCredentialVariables(configPath, agents);
2053
+ if (!stored.some((variable) => named.descriptor.credentials.forwarded.includes(variable))) {
2054
+ const forms = credentialForms(named.descriptor, agents);
2055
+ throw new RunnerInitError(
2056
+ `--agent ${forms.runnerName} needs ${forms.possessive} credential in ${forms.variables.join(" or ")}, and the ${forms.envFile} beside the config holds ${stored.join(" and ")}. Pipe ${orList(credentialShapes(named.descriptor).map((shape) => shape.phrase))}: printf '%s' "$${forms.variables[0]}" | outerlayer runner init --agent ${forms.runnerName}`
2057
+ );
2058
+ }
2059
+ }
1829
2060
  return { configPath, config, carried, credential, agent, agents, machine, hooks, needsKey, host: opts.host };
1830
2061
  }
1831
2062
  function writeRunnerInit(prepared, runnerKey) {
@@ -1881,14 +2112,12 @@ function permissionFlagPattern(flag) {
1881
2112
  return new RegExp(`${escapeForPattern(flag)}(?:=|\\s+)(?:"([^"]*)"|'([^']*)'|([^\\s;&|()]+))`, "g");
1882
2113
  }
1883
2114
  function permissionModeProblems(config, agents = defaultAgents()) {
1884
- const agent = jobAgent(void 0, agents);
1885
- const mode = agent?.adapter.headless?.permissionMode;
1886
- if (agent === void 0 || mode === void 0) return [];
1887
- const program = programPattern(agent.descriptor.program);
1888
2115
  const problems = [];
1889
2116
  for (const queue of config.queues) {
1890
2117
  const command = config.commands[queue];
1891
- if (command === void 0 || !program.test(command)) continue;
2118
+ const agent = jobAgent({ command }, agents);
2119
+ const mode = agent?.adapter.headless?.permissionMode;
2120
+ if (agent === void 0 || mode === void 0 || command === void 0 || !programPattern(agent.descriptor.program).test(command)) continue;
1892
2121
  for (const match of command.matchAll(permissionFlagPattern(mode.flag))) {
1893
2122
  const value = match[1] ?? match[2] ?? match[3] ?? "";
1894
2123
  if (value.includes("$") || value.includes("`") || mode.accepted.includes(value)) continue;
@@ -1898,10 +2127,12 @@ function permissionModeProblems(config, agents = defaultAgents()) {
1898
2127
  return problems;
1899
2128
  }
1900
2129
  function permissionModeProblem(problems, agents = defaultAgents()) {
1901
- const agent = jobAgent(void 0, agents);
1902
- const label = agent?.descriptor.label ?? "the agent";
1903
- const accepted = agent?.adapter.headless?.permissionMode?.accepted ?? [];
1904
- return problems.map(({ queue, command, value }) => `runner.commands.${queue} is \`${command}\`, and \`${value}\` is not a permission mode ${label} accepts (${accepted.join(", ")}). The command would fail only when a build ran it`).join(". ");
2130
+ return problems.map(({ queue, command, value }) => {
2131
+ const agent = jobAgent({ command }, agents);
2132
+ const label = agent?.descriptor.label ?? "the agent";
2133
+ const accepted = agent?.adapter.headless?.permissionMode?.accepted ?? [];
2134
+ return `runner.commands.${queue} is \`${command}\`, and \`${value}\` is not a permission mode ${label} accepts (${accepted.join(", ")}). The command would fail only when a build ran it`;
2135
+ }).join(". ");
1905
2136
  }
1906
2137
  var FORMER_AMEND_COMMAND = /(^|["'\s])\/amend(?=["'\s]|$)/g;
1907
2138
  function currentSkillCommand(command) {
@@ -1918,13 +2149,13 @@ function formerSkillProblem(queues) {
1918
2149
  return `${keys} ${queues.length === 1 ? "starts" : "start"} /amend, which is now /outerlayer-amend. The runner runs /outerlayer-amend in its place; edit the config to say so`;
1919
2150
  }
1920
2151
  function modellessQueues(config, agents = defaultAgents()) {
1921
- const agent = jobAgent(void 0, agents);
1922
- if (agent?.adapter.headless?.modelFlag === void 0) return [];
1923
- const program = programPattern(agent.descriptor.program);
1924
- const named = new RegExp(`(?:^|\\s)${escapeForPattern(agent.adapter.headless.modelFlag)}(?:=|\\s)`);
1925
2152
  return config.queues.filter((queue) => {
1926
2153
  const command = String(config.commands[queue]);
1927
- return program.test(command) && !named.test(command);
2154
+ const agent = jobAgent({ command }, agents);
2155
+ const flag = agent?.adapter.headless?.modelFlag;
2156
+ if (agent === void 0 || flag === void 0) return false;
2157
+ const named = new RegExp(`(?:^|\\s)${escapeForPattern(flag)}(?:=|\\s)`);
2158
+ return programPattern(agent.descriptor.program).test(command) && !named.test(command);
1928
2159
  });
1929
2160
  }
1930
2161
  function modellessProblem(queues, agents = defaultAgents()) {
@@ -2006,14 +2237,14 @@ async function claimPermissionProblem(config, fetchImpl = fetch) {
2006
2237
 
2007
2238
  // src/runner/build-skill-check.ts
2008
2239
  var SHARED_SKILLS = ".agents/skills";
2009
- function buildSkillPaths(agents = defaultAgents()) {
2010
- const folders = jobAgent(void 0, agents)?.descriptor.context.repoSkillFolders ?? [];
2240
+ function buildSkillPaths(agents = defaultAgents(), job) {
2241
+ const folders = jobAgent(job, agents)?.descriptor.context.repoSkillFolders ?? [];
2011
2242
  return [SHARED_SKILLS, ...folders].map((folder) => `${folder}/build/SKILL.md`);
2012
2243
  }
2013
2244
  buildSkillPaths();
2014
2245
  var escapeForPattern2 = (text2) => text2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2015
- function buildCommandPattern(agents) {
2016
- const agent = jobAgent(void 0, agents);
2246
+ function buildCommandPattern(agents, job) {
2247
+ const agent = jobAgent(job, agents);
2017
2248
  if (agent === void 0) return new RegExp(`(?:^|["'])\\/build(?=["'\\s]|$)`);
2018
2249
  const words = [agent.descriptor.program, ...agent.adapter.headless?.promptFlags ?? []];
2019
2250
  return new RegExp(`(?:^|["']|(?:^|\\s)(?:${words.map(escapeForPattern2).join("|")})\\s+)\\/build(?=["'\\s]|$)`);
@@ -2021,23 +2252,23 @@ function buildCommandPattern(agents) {
2021
2252
  var BUILD_DIRECTORY_USE = /(?:^|[\s;&|])(?:cd|pushd|--add-dir|--cwd|-C)\s+["']?\/build(?=["'\s;&|]|$)/g;
2022
2253
  function needsBuildSkill(queue, command, agents = defaultAgents()) {
2023
2254
  if (queue !== "implement" || command === void 0) return false;
2024
- return buildCommandPattern(agents).test(currentSkillCommand(command).replace(BUILD_DIRECTORY_USE, " "));
2255
+ return buildCommandPattern(agents, { command }).test(currentSkillCommand(command).replace(BUILD_DIRECTORY_USE, " "));
2025
2256
  }
2026
- function missingBuildSkillReason(governed, lookupFailure, agents = defaultAgents()) {
2027
- const paths = buildSkillPaths(agents);
2257
+ function missingBuildSkillReason(governed, lookupFailure, agents = defaultAgents(), job) {
2258
+ const paths = buildSkillPaths(agents, job);
2028
2259
  const checked = governed === void 0 ? paths.join(" and ") : `${paths.join(", ")} and the governed context from ${governed.repository}@${governed.commit.slice(0, 7)}`;
2029
2260
  const lookup3 = lookupFailure === void 0 ? "" : `, and the lookup of the governing repository failed (${lookupFailure})`;
2030
2261
  return `the build has no \`build\` skill, so /build would load nothing${lookup3}: checked ${checked}`;
2031
2262
  }
2032
- function cloneHasBuildSkill(checkout, agents = defaultAgents()) {
2033
- return buildSkillPaths(agents).some((path) => existsSync(join(checkout, path)));
2263
+ function cloneHasBuildSkill(checkout, agents = defaultAgents(), job) {
2264
+ return buildSkillPaths(agents, job).some((path) => existsSync(join(checkout, path)));
2034
2265
  }
2035
- async function decideHostBuildSkill(input, agents = defaultAgents()) {
2266
+ async function decideHostBuildSkill(input, agents = defaultAgents(), job) {
2036
2267
  const { requireBuildSkill, containerMode, vmMode, workdir, repository } = input;
2037
- if (!requireBuildSkill || containerMode || vmMode || !existsSync(join(workdir, ".git")) || cloneHasBuildSkill(workdir, agents)) return { kind: "start" };
2268
+ if (!requireBuildSkill || containerMode || vmMode || !existsSync(join(workdir, ".git")) || cloneHasBuildSkill(workdir, agents, job)) return { kind: "start" };
2038
2269
  const governing = repository === void 0 ? void 0 : await input.lookup(repository);
2039
2270
  if (governing?.ok === true && governing.source.kind !== "self") return { kind: "warn" };
2040
- const reason = missingBuildSkillReason(void 0, governing?.ok === false ? governing.reason : void 0, agents);
2271
+ const reason = missingBuildSkillReason(void 0, governing?.ok === false ? governing.reason : void 0, agents, job);
2041
2272
  return { kind: "refuse", reason };
2042
2273
  }
2043
2274
  var BranchPrepareError = class extends Error {
@@ -2061,13 +2292,13 @@ function localGit(cwd, args) {
2061
2292
  }
2062
2293
  return Promise.resolve({ status: result.status, stdout: result.stdout.trim(), stderr: result.stderr.trim() });
2063
2294
  }
2064
- function firstLine3(stderr) {
2295
+ function firstLine4(stderr) {
2065
2296
  return (stderr.split("\n")[0] ?? "").replace(/\/\/[^/@\s]+@/g, "//");
2066
2297
  }
2067
2298
  async function mustGit(git2, cwd, step, args) {
2068
2299
  const result = await git2(cwd, args);
2069
2300
  if (result.status !== 0) {
2070
- const detail = firstLine3(result.stderr);
2301
+ const detail = firstLine4(result.stderr);
2071
2302
  throw new BranchPrepareError(`${step} failed${detail === "" ? "" : `: ${detail}`}`);
2072
2303
  }
2073
2304
  return result.stdout;
@@ -2112,7 +2343,7 @@ async function isMerged(git2, workdir, branch, defaultBranch) {
2112
2343
  const result = await git2(workdir, ["merge-base", "--is-ancestor", `origin/${branch}`, `origin/${defaultBranch}`]);
2113
2344
  if (result.status === 0) return true;
2114
2345
  if (result.status === 1) return false;
2115
- const detail = firstLine3(result.stderr);
2346
+ const detail = firstLine4(result.stderr);
2116
2347
  throw new BranchPrepareError(`comparing ${branch} with ${defaultBranch} failed${detail === "" ? "" : `: ${detail}`}`);
2117
2348
  }
2118
2349
 
@@ -2492,7 +2723,7 @@ async function repositorySkills(input, folder) {
2492
2723
  return new Set(listed.stdout.split("\n").map((name) => name.trim()));
2493
2724
  }
2494
2725
  function agentOf(input) {
2495
- return jobAgent(void 0, input.agents ?? defaultAgents());
2726
+ return jobAgent(input.job, input.agents ?? defaultAgents());
2496
2727
  }
2497
2728
  async function deliveryRefusal(input, staged, agent) {
2498
2729
  const { label, versions } = agent.descriptor;
@@ -2507,7 +2738,7 @@ async function deliveryRefusal(input, staged, agent) {
2507
2738
  return `context_skill_conflict: ${skillConflictMessage({ skill: clash, folder, repository: input.repository, controlPlane: staged.repository })}, and would replace it in this build; rename or remove it from the repository`;
2508
2739
  }
2509
2740
  async function checkoutHasBuildSkill(input) {
2510
- for (const path of buildSkillPaths(input.agents)) {
2741
+ for (const path of buildSkillPaths(input.agents, input.job)) {
2511
2742
  const probe = await input.exec(["test", "-f", path], CHECKOUT_DIR, { quiet: true });
2512
2743
  if (probe.status === 0) return true;
2513
2744
  if (probe.status !== 1) return { failed: failure(`checking for ${path} failed`, probe) };
@@ -2524,7 +2755,7 @@ var NO_AGENT = "context_delivery_failed: the agent list holds no agent to run th
2524
2755
  async function writeShim(input, agent) {
2525
2756
  const program = agent.descriptor.program;
2526
2757
  if (!SHELL_SAFE_NAME.test(program)) return { ok: false, reason: `context_delivery_failed: the agent's program name ${JSON.stringify(program)} cannot name a shim` };
2527
- const shim = await input.exec(["sh", "-c", writeShimScript(program), "shim", SHIM_DIR, shimScript()], "/build/work");
2758
+ const shim = await input.exec(["sh", "-c", writeShimScript(program), "shim", SHIM_DIR, shimScript(agent.descriptor.legacy?.subcommand ?? agent.descriptor.id)], "/build/work");
2528
2759
  if (shim.status !== 0) return { ok: false, reason: failure(`writing the ${program} shim failed`, shim) };
2529
2760
  return { ok: true };
2530
2761
  }
@@ -2683,7 +2914,7 @@ async function runBuildSteps(input) {
2683
2914
  if (held3 !== true) {
2684
2915
  if (staged.kind === "staged") input.removeStagedContext();
2685
2916
  if (held3 !== false) return { ok: false, reason: held3.failed };
2686
- return { ok: false, reason: missingBuildSkillReason(staged.kind === "staged" ? { repository: staged.repository, commit: staged.sha } : void 0, void 0, input.agents) };
2917
+ return { ok: false, reason: missingBuildSkillReason(staged.kind === "staged" ? { repository: staged.repository, commit: staged.sha } : void 0, void 0, input.agents, input.job) };
2687
2918
  }
2688
2919
  }
2689
2920
  const agent = agentOf(input);
@@ -3240,210 +3471,6 @@ async function saveMicroVmDiskState(input) {
3240
3471
  return discard(`the state could not be saved: ${describeCallFailure(err)}`);
3241
3472
  }
3242
3473
  }
3243
- var EVAL_INPUT_NAME = "eval-input";
3244
- sessionFolderIn(BUILD_HOME, legacyAgent().descriptor);
3245
- var MAX_TRANSCRIPT_BYTES = 7 * 1024 * 1024;
3246
- var MAX_TRANSCRIPTS = 500;
3247
- var MAX_TOTAL_TRANSCRIPT_BYTES = 64 * 1024 * 1024;
3248
- var TRANSCRIPT_COPY_MS = 2 * 60 * 1e3;
3249
- function firstLine4(text2) {
3250
- return text2.trim().split("\n")[0] ?? "";
3251
- }
3252
- async function copyTranscripts(run, now = Date.now, agents = defaultAgents()) {
3253
- const agent = jobAgent(void 0, agents);
3254
- if (agent === void 0) return { ok: true, copied: [], missed: [] };
3255
- const root = sessionFolderIn(BUILD_HOME, agent.descriptor);
3256
- const deadline = now() + TRANSCRIPT_COPY_MS;
3257
- let listed;
3258
- try {
3259
- listed = await run(["find", root, "-type", "f", "-name", "*.jsonl", "-print0"]);
3260
- } catch (err) {
3261
- return { ok: false, reason: describeCallFailure(err) };
3262
- }
3263
- if (listed.status !== 0 && !/No such file or directory/.test(listed.stderr)) {
3264
- return { ok: false, reason: `listing the transcripts failed (exit ${listed.status})${firstLine4(listed.stderr) === "" ? "" : `: ${firstLine4(listed.stderr)}`}` };
3265
- }
3266
- const paths = listed.stdout.split("\0").filter((entry) => entry.startsWith(`${root}/`) && !entry.includes("\n") && !entry.slice(root.length + 1).split("/").includes("..")).map((entry) => entry.slice(root.length + 1)).sort();
3267
- const copied = [];
3268
- const missed = [];
3269
- let total = 0;
3270
- for (const [index, path] of paths.entries()) {
3271
- if (index >= MAX_TRANSCRIPTS) {
3272
- missed.push({ path, reason: `the build wrote more than ${MAX_TRANSCRIPTS} transcripts` });
3273
- continue;
3274
- }
3275
- if (now() >= deadline) {
3276
- missed.push({ path, reason: `copying the transcripts took longer than ${TRANSCRIPT_COPY_MS / 1e3} seconds` });
3277
- continue;
3278
- }
3279
- try {
3280
- const read = await run(["head", "-c", String(MAX_TRANSCRIPT_BYTES + 1), `${root}/${path}`]);
3281
- if (read.status !== 0) missed.push({ path, reason: `reading it failed (exit ${read.status})${firstLine4(read.stderr) === "" ? "" : `: ${firstLine4(read.stderr)}`}` });
3282
- else if (Buffer.byteLength(read.stdout) > MAX_TRANSCRIPT_BYTES) missed.push({ path, reason: `it is larger than ${MAX_TRANSCRIPT_BYTES / (1024 * 1024)} MiB` });
3283
- else if (total + Buffer.byteLength(read.stdout) > MAX_TOTAL_TRANSCRIPT_BYTES) missed.push({ path, reason: `copying it would take the transcripts past ${MAX_TOTAL_TRANSCRIPT_BYTES / (1024 * 1024)} MiB` });
3284
- else {
3285
- total += Buffer.byteLength(read.stdout);
3286
- copied.push({ path, content: read.stdout });
3287
- }
3288
- } catch (err) {
3289
- missed.push({ path, reason: describeCallFailure(err) });
3290
- }
3291
- }
3292
- return { ok: true, copied, missed };
3293
- }
3294
- function traceIdForSession(sessionId) {
3295
- const stripped = sessionId.replace(/-/g, "").toLowerCase();
3296
- if (/^[0-9a-f]{32}$/.test(stripped)) return stripped;
3297
- return createHash("sha256").update(sessionId).digest("hex").slice(0, 32);
3298
- }
3299
- function sessionOptionsOf(path) {
3300
- const segments = path.split("/");
3301
- const stem = (segments.at(-1) ?? path).replace(/\.jsonl$/, "");
3302
- const at = segments.lastIndexOf("subagents");
3303
- if (at <= 0) return { fallbackId: stem };
3304
- const parent = segments[at - 1];
3305
- return {
3306
- fallbackId: stem,
3307
- isSubagent: true,
3308
- ...parent ? { parentSessionId: parent } : {},
3309
- ownId: stem,
3310
- ...segments[at + 1] === "workflows" && segments[at + 2] ? { workflowRunId: segments[at + 2] } : {}
3311
- };
3312
- }
3313
- function forkRecordOf(job) {
3314
- return job.sessionId !== void 0 && job.sessionLaunchedAt !== void 0 ? { sessionId: job.sessionId, launchedAt: job.sessionLaunchedAt } : void 0;
3315
- }
3316
- function scrubbing(scrub, author, work) {
3317
- setCustomScrubbers(scrub, () => void 0);
3318
- setLocalIdentity({ home: BUILD_HOME, ...author?.name === void 0 ? {} : { name: author.name }, ...author?.email === void 0 ? {} : { email: author.email } });
3319
- setRepoRoot(CHECKOUT_DIR);
3320
- try {
3321
- return work();
3322
- } finally {
3323
- setCustomScrubbers(void 0, () => void 0);
3324
- setLocalIdentity({});
3325
- setRepoRoot(void 0);
3326
- }
3327
- }
3328
- function scrubLine(line2) {
3329
- try {
3330
- return JSON.stringify(scrubDeep(JSON.parse(line2)));
3331
- } catch {
3332
- return scrubText(line2);
3333
- }
3334
- }
3335
- function writeReadOnly(path, text2) {
3336
- writeFileSync(path, text2);
3337
- chmodSync(path, 292);
3338
- }
3339
- function diffBase(job) {
3340
- const recorded = (job.container ?? job.microvm)?.startCommit;
3341
- if (recorded !== void 0 && recorded !== "") return { commit: recorded, source: "build" };
3342
- const recipe = job.environment?.recipe?.sourceCommit;
3343
- return recipe === void 0 || recipe === "" ? void 0 : { commit: recipe, source: "recipe" };
3344
- }
3345
- async function writeEvalInput(request) {
3346
- const { job, dir, log } = request;
3347
- const tag = `${itemTag(job)}`;
3348
- rmSync(dir, { recursive: true, force: true });
3349
- mkdirSync(join(dir, "sessions"), { recursive: true });
3350
- chmodSync(dir, 493);
3351
- chmodSync(join(dir, "sessions"), 493);
3352
- let workItem;
3353
- try {
3354
- const data = await request.readWorkItem();
3355
- writeReadOnly(join(dir, "work-item.json"), `${JSON.stringify(data, null, 2)}
3356
- `);
3357
- workItem = { status: "written" };
3358
- } catch (err) {
3359
- workItem = { status: "unavailable", reason: describeCallFailure(err) };
3360
- log.error(`${tag} the work item could not be read for the checks' input: ${workItem.reason}`);
3361
- }
3362
- const patch = join(dir, "diff.patch");
3363
- const base = diffBase(job);
3364
- let diff;
3365
- if (base === void 0) {
3366
- diff = { status: "unavailable", reason: "the build recorded no commit it started from" };
3367
- } else {
3368
- const fetched = await request.fetchDiff({ remote: request.remote, dir: join(request.scratch, "diff"), base: base.commit, head: request.branchHead, token: request.readToken, output: patch });
3369
- diff = fetched.ok ? { status: "written", base: base.commit, head: request.branchHead, baseSource: base.source } : { status: "unavailable", base: base.commit, head: request.branchHead, baseSource: base.source, reason: fetched.reason };
3370
- if (!fetched.ok) log.error(`${tag} the diff could not be read for the checks' input: ${fetched.reason}`);
3371
- }
3372
- if (diff.status === "unavailable") writeFileSync(patch, "");
3373
- chmodSync(patch, 292);
3374
- const sessions = [];
3375
- const parsed = [];
3376
- const copiedByTrace = /* @__PURE__ */ new Map();
3377
- let sessionsUnavailable;
3378
- const capture = legacyAgent(request.agents).adapter.capture;
3379
- if (!request.transcripts.ok) {
3380
- sessionsUnavailable = request.transcripts.reason;
3381
- log.error(`${tag} the sessions could not be copied for the checks' input: ${sessionsUnavailable}`);
3382
- } else if (capture === void 0) {
3383
- sessionsUnavailable = "the legacy agent has no capture part to read the transcripts with";
3384
- log.error(`${tag} the sessions could not be read for the checks' input: ${sessionsUnavailable}`);
3385
- } else {
3386
- const { copied, missed } = request.transcripts;
3387
- scrubbing(request.scrub, request.job.commitIdentity?.author, () => {
3388
- for (const transcript of copied) {
3389
- const options = sessionOptionsOf(transcript.path);
3390
- const fork = forkFor(forkRecordOf(request.job), { sessionId: options.fallbackId ?? "", parentSessionId: options.parentSessionId });
3391
- if (fork !== void 0) options.fork = fork;
3392
- const subagent = options.isSubagent === true;
3393
- const stem = options.fallbackId ?? transcript.path;
3394
- let session = null;
3395
- try {
3396
- session = capture.parseText(transcript.content, options).session;
3397
- } catch {
3398
- }
3399
- const traceId = traceIdForSession(session?.id ?? stem);
3400
- if (session === null) {
3401
- sessions.push({ traceId, subagent, status: "missing", reason: "the transcript holds no session" });
3402
- log.error(`${tag} the transcript ${transcript.path} holds no session, so the checks' input leaves it out`);
3403
- continue;
3404
- }
3405
- const kept = copiedByTrace.get(traceId);
3406
- if (kept !== void 0) {
3407
- kept.duplicates = (kept.duplicates ?? 0) + 1;
3408
- log.error(`${tag} the transcript ${transcript.path} repeats session ${traceId}, so the checks' input leaves it out`);
3409
- continue;
3410
- }
3411
- const file = `sessions/${traceId}.jsonl`;
3412
- const text2 = transcript.content.split("\n").filter((line2) => line2.trim() !== "").map(scrubLine).join("\n");
3413
- writeReadOnly(join(dir, file), `${text2}
3414
- `);
3415
- scrubDeep(session);
3416
- parsed.push({ session: downconvertSession(session, "full"), traceId, subagent });
3417
- const entry = { traceId, subagent, file, status: "copied" };
3418
- copiedByTrace.set(traceId, entry);
3419
- sessions.push(entry);
3420
- }
3421
- for (const miss of missed) {
3422
- const options = sessionOptionsOf(miss.path);
3423
- sessions.push({ traceId: traceIdForSession(options.fallbackId ?? miss.path), subagent: options.isSubagent === true, status: "missing", reason: miss.reason });
3424
- log.error(`${tag} the transcript ${miss.path} could not be copied for the checks' input: ${miss.reason}`);
3425
- }
3426
- });
3427
- }
3428
- const ordered = orderSessions(parsed.map((entry) => entry.session));
3429
- const traceOf = new Map(parsed.map((entry) => [entry.session.id, entry.traceId]));
3430
- const facts = extractFacts(sessionsToTimeline(parsed.map((entry) => entry.session)));
3431
- const traceAt = (index) => traceOf.get(ordered[index].id);
3432
- const recorded = { commands: facts.coverage.has("commands"), edits: facts.coverage.has("edits") };
3433
- const activity = {
3434
- schemaVersion: 1,
3435
- sessions: sessions.sort((a, b) => a.traceId.localeCompare(b.traceId)),
3436
- // Left out of the file when undefined.
3437
- sessionsUnavailable,
3438
- workItem,
3439
- diff,
3440
- recorded,
3441
- commands: recorded.commands ? facts.runs.map((run) => ({ seq: run.seq, traceId: traceAt(run.sessionIndex), turn: run.turnIndex, command: run.normalized, kind: run.kind, status: run.status })) : null,
3442
- edits: recorded.edits ? facts.edits.map((edit) => ({ seq: edit.seq, traceId: traceAt(edit.sessionIndex), turn: edit.turnIndex, file: edit.file, status: edit.status })) : null
3443
- };
3444
- writeReadOnly(join(dir, "activity.json"), `${JSON.stringify(activity, null, 2)}
3445
- `);
3446
- }
3447
3474
  var FILE_MODE = 420;
3448
3475
  var DIR_MODE = 493;
3449
3476
  function replaceFile(path, text2) {
@@ -3995,7 +4022,7 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
3995
4022
  const tag = itemTag({ item: item.number, organizationId: input.organizationId, claimId: input.claimId });
3996
4023
  const logPath = join(jobDir, "provision.log");
3997
4024
  const fail = (reason) => ({ ok: false, reason });
3998
- if (!hasClaudeCredential(config, runtime.hostEnv, jobDir, runtime.agents)) return fail(AGENT_CREDENTIAL_MISSING);
4025
+ if (!hasClaudeCredential(config, runtime.hostEnv, jobDir, runtime.agents, input.job)) return fail(AGENT_CREDENTIAL_MISSING);
3999
4026
  const repositories = repositoriesOf({ repositories: input.repositories, repository: item.specRepository, branch: input.branch });
4000
4027
  const primary = primaryOf(repositories);
4001
4028
  if (primary === void 0) return fail("the work item names no repository to clone");
@@ -4092,6 +4119,7 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
4092
4119
  repositories,
4093
4120
  hostEnv: runtime.hostEnv,
4094
4121
  agents: runtime.agents,
4122
+ ...input.job === void 0 ? {} : { job: input.job },
4095
4123
  containerEnv: report.apply.containerEnv,
4096
4124
  builtIns: true,
4097
4125
  factoryVariables: factoryVariablesOf(config, jobDir),
@@ -4340,7 +4368,7 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
4340
4368
  if (changed !== void 0) return giveUpState(changed);
4341
4369
  }
4342
4370
  const tools = await asRoot(runtime, state, ["cat", "/opt/outerlayer/tools.json"]);
4343
- const agentVersion = agentVersionOf(tools.status === 0 ? tools.stdout : "", runtime.agents);
4371
+ const agentVersion = agentVersionOf(tools.status === 0 ? tools.stdout : "", runtime.agents, input.job);
4344
4372
  environment.agentVersion = agentVersion;
4345
4373
  const recorded = await judgeProgramRecord((argv) => asRoot(runtime, state, argv), runtime.agents);
4346
4374
  if (recorded !== void 0) state.judgeProgram = recorded;
@@ -4382,6 +4410,7 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
4382
4410
  ...governingSource.kind === "governed" ? { governing: { repository: governingSource.repository } } : {},
4383
4411
  agentVersion,
4384
4412
  agents: runtime.agents,
4413
+ ...input.job === void 0 ? {} : { job: input.job },
4385
4414
  lifecycle: report.apply.lifecycle,
4386
4415
  exec: stepExecFor({ vm, vsockPath: state.vsockPath, request, logPath }),
4387
4416
  log,
@@ -4457,6 +4486,7 @@ function vmExecFor(input, argv) {
4457
4486
  repositories: input.job.repositories,
4458
4487
  hostEnv: input.runtime.hostEnv,
4459
4488
  agents: input.runtime.agents,
4489
+ job: input.job,
4460
4490
  containerEnv: state.containerEnv ?? {},
4461
4491
  unpinnedRuntimes: state.unpinnedRuntimes,
4462
4492
  missingSetupScripts: state.missingSetupScripts,
@@ -4496,6 +4526,7 @@ async function startMicroVmCommand(input) {
4496
4526
  repositories: input.job.repositories,
4497
4527
  hostEnv: input.runtime.hostEnv,
4498
4528
  agents: input.runtime.agents,
4529
+ job: input.job,
4499
4530
  containerEnv: state.containerEnv ?? {},
4500
4531
  unpinnedRuntimes: state.unpinnedRuntimes,
4501
4532
  missingSetupScripts: state.missingSetupScripts,
@@ -4550,6 +4581,7 @@ async function runCliInMicroVm(input, argv, logName, goneReason) {
4550
4581
  repositories: job.repositories,
4551
4582
  hostEnv: runtime.hostEnv,
4552
4583
  agents: runtime.agents,
4584
+ job,
4553
4585
  containerEnv: state.containerEnv ?? {},
4554
4586
  unpinnedRuntimes: state.unpinnedRuntimes,
4555
4587
  missingSetupScripts: state.missingSetupScripts,
@@ -4580,9 +4612,9 @@ async function copyHookErrors(runtime, state, jobDir) {
4580
4612
  } catch {
4581
4613
  }
4582
4614
  }
4583
- async function copyTranscriptsFromMicroVm(runtime, state) {
4615
+ async function copyTranscriptsFromMicroVm(runtime, state, job) {
4584
4616
  if (!isRunning(runtime, state)) return { ok: false, reason: "the build's microVM is gone" };
4585
- return copyTranscripts((argv) => asRoot(runtime, state, argv), void 0, runtime.agents);
4617
+ return copyTranscripts((argv) => asRoot(runtime, state, argv), void 0, runtime.agents, job);
4586
4618
  }
4587
4619
  function guestStopScript(paths = { proc: "/proc", record: HELPER_RECORD }) {
4588
4620
  return [
@@ -5006,8 +5038,8 @@ function sessionGuestOfMicroVm(runtime, state, as) {
5006
5038
  stream: (argv, io) => runtime.vm.execStream(state.vsockPath, request(argv), io)
5007
5039
  };
5008
5040
  }
5009
- async function restoreSessionIntoMicroVm(runtime, state, keptDir, meta) {
5010
- const restored = await restoreSession({ guest: sessionGuestOfMicroVm(runtime, state, "agent"), tar: packKeptSession(keptDir, meta, runtime.agents) });
5041
+ async function restoreSessionIntoMicroVm(runtime, state, keptDir, meta, job) {
5042
+ const restored = await restoreSession({ guest: sessionGuestOfMicroVm(runtime, state, "agent"), tar: packKeptSession(keptDir, meta, runtime.agents, job) });
5011
5043
  if (!restored.ok) throw new Error(restored.reason);
5012
5044
  }
5013
5045
 
@@ -6614,6 +6646,7 @@ async function keepEndedSession(input) {
6614
6646
  const { job, log, tag } = input;
6615
6647
  if (job.sessionId === void 0 || job.workItemId === void 0 || job.sessionKept === true) return false;
6616
6648
  if (job.microvm === void 0 && job.container === void 0) return false;
6649
+ if (jobAgent(job, input.runtime.agents)?.adapter.launch?.session === void 0) return false;
6617
6650
  const found = await guestOf(job, input.runtime);
6618
6651
  if ("reason" in found) {
6619
6652
  log.error(`${tag} the session was not kept: ${found.reason} \xB7 continuing`);
@@ -6633,7 +6666,7 @@ async function keepEndedSession(input) {
6633
6666
  }
6634
6667
  const tarPath = join(input.jobDirPath, SESSION_TAR);
6635
6668
  try {
6636
- const copied = await copyOutSession({ guest: found.guest, sessionId: job.sessionId, tarPath }, input.runtime.agents);
6669
+ const copied = await copyOutSession({ guest: found.guest, sessionId: job.sessionId, tarPath, job }, input.runtime.agents);
6637
6670
  if (!copied.ok) {
6638
6671
  log.error(`${tag} the session was not kept: ${copied.reason} \xB7 continuing`);
6639
6672
  return changed;
@@ -6645,7 +6678,8 @@ async function keepEndedSession(input) {
6645
6678
  tar: createReadStream(tarPath),
6646
6679
  scrub: input.scrub
6647
6680
  },
6648
- input.runtime.agents
6681
+ input.runtime.agents,
6682
+ job
6649
6683
  );
6650
6684
  log.line(`${tag} session ${job.sessionId.slice(0, 8)} kept for the next agent job (${formatBytes(statSync(tarPath).size)})`);
6651
6685
  job.sessionKept = true;
@@ -6666,7 +6700,7 @@ var RESULT_LINE = /^result:\s*(pass|fail)\s*$/i;
6666
6700
  var UNMET_LINE = /^unmet:\s*(\S+)\s*$/i;
6667
6701
  function readJudgeReply(run, minutes, agents = defaultAgents()) {
6668
6702
  if (run.kind === "timeout") return { kind: "none", reason: `the judge ran out of time after ${minutes}`, limitKey: true };
6669
- const output = jobAgent(void 0, agents)?.adapter.headless?.readJudgeOutput(run.stdout);
6703
+ const output = judgeAgent(agents)?.adapter.headless?.readJudgeOutput(run.stdout);
6670
6704
  if (output === void 0) {
6671
6705
  const said2 = firstLine5(run.stderr);
6672
6706
  return { kind: "none", reason: `the judge exited ${run.status} and printed no result${said2 === "" ? "" : `: ${said2}`}` };
@@ -6857,7 +6891,7 @@ async function runJudge(input) {
6857
6891
  log.line(`${tag} judge done (${formatDuration(now().getTime() - startedMs)})`);
6858
6892
  }
6859
6893
  async function judgeOne(check) {
6860
- const agent = jobAgent(void 0, runtime.agents);
6894
+ const agent = judgeAgent(runtime.agents);
6861
6895
  if (agent?.adapter.headless === void 0) return await fail(check, `${agent?.descriptor.label ?? "the agent list"} has no headless part, so it cannot run the judge`);
6862
6896
  const missing = noAgentProgram(agent.descriptor.label);
6863
6897
  const environment = environmentFor(input);
@@ -7751,7 +7785,18 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
7751
7785
  log.line(`${tag} build microVM stopped`);
7752
7786
  buildVmStopLogged = true;
7753
7787
  };
7754
- const collectSessions = build !== void 0 ? () => copyTranscriptsFromContainer(build.runtime, build.state) : vmBuild !== void 0 ? () => copyTranscriptsFromMicroVm(vmBuild.runtime, vmBuild.state) : void 0;
7788
+ const sessionsCopier = (runtime, copy) => () => copyAfterCollect(
7789
+ job.workdir && job.sessionsSynced !== true && collectsOwnSessions(job, runtime.agents) ? async () => {
7790
+ await uploadSessions(job.workdir);
7791
+ if (vmBuild !== void 0) {
7792
+ job.sessionsSynced = true;
7793
+ writeJobFile(jobFilePath, job);
7794
+ }
7795
+ } : void 0,
7796
+ copy,
7797
+ (line2) => log.error(`${tag} ${line2}`)
7798
+ );
7799
+ const collectSessions = build !== void 0 ? sessionsCopier(build.runtime, () => copyTranscriptsFromContainer(build.runtime, build.state, job)) : vmBuild !== void 0 ? sessionsCopier(vmBuild.runtime, () => copyTranscriptsFromMicroVm(vmBuild.runtime, vmBuild.state, job)) : void 0;
7755
7800
  if (job.checkContainer !== void 0 && job.checksRan === true) {
7756
7801
  try {
7757
7802
  const runtime = deps.container ?? createContainerRuntime();
@@ -10551,7 +10596,7 @@ async function provisionContainerOnce(input, allowRestore, itemDiskFailed) {
10551
10596
  const tag = itemTag({ item: item.number, organizationId: input.organizationId, claimId: input.claimId });
10552
10597
  const logPath = join(jobDir, "provision.log");
10553
10598
  const fail = (reason) => ({ ok: false, reason });
10554
- if (!hasClaudeCredential(config, runtime.hostEnv, jobDir, runtime.agents)) return fail(AGENT_CREDENTIAL_MISSING);
10599
+ if (!hasClaudeCredential(config, runtime.hostEnv, jobDir, runtime.agents, input.job)) return fail(AGENT_CREDENTIAL_MISSING);
10555
10600
  const repositories = repositoriesOf({ repositories: input.repositories, repository: item.specRepository, branch: input.branch });
10556
10601
  const primary = primaryOf(repositories);
10557
10602
  if (primary === void 0) return fail("the work item names no repository to clone");
@@ -10648,6 +10693,7 @@ async function provisionContainerOnce(input, allowRestore, itemDiskFailed) {
10648
10693
  repositories,
10649
10694
  hostEnv: runtime.hostEnv,
10650
10695
  agents: runtime.agents,
10696
+ ...input.job === void 0 ? {} : { job: input.job },
10651
10697
  containerEnv: report.apply.containerEnv,
10652
10698
  builtIns: true
10653
10699
  };
@@ -10782,7 +10828,7 @@ async function provisionContainerOnce(input, allowRestore, itemDiskFailed) {
10782
10828
  const changed = userIdChangedReason(plan.restore?.record.agentUid, agentUid);
10783
10829
  if (changed !== void 0) return giveUpState(changed);
10784
10830
  const tools = await host.exec({ container: name, user: ADDED_USER, env: NO_ENV, argv: ["cat", "/opt/outerlayer/tools.json"] });
10785
- const agentVersion = agentVersionOf(tools.status === 0 ? tools.stdout : "", runtime.agents);
10831
+ const agentVersion = agentVersionOf(tools.status === 0 ? tools.stdout : "", runtime.agents, input.job);
10786
10832
  environment.agentVersion = agentVersion;
10787
10833
  const recorded = await judgeProgramRecord((argv) => host.exec({ container: name, user: ADDED_USER, env: NO_ENV, argv }), runtime.agents);
10788
10834
  if (recorded !== void 0) state.judgeProgram = recorded;
@@ -10817,6 +10863,7 @@ async function provisionContainerOnce(input, allowRestore, itemDiskFailed) {
10817
10863
  ...governingSource.kind === "governed" ? { governing: { repository: governingSource.repository } } : {},
10818
10864
  agentVersion,
10819
10865
  agents: runtime.agents,
10866
+ ...input.job === void 0 ? {} : { job: input.job },
10820
10867
  lifecycle: report.apply.lifecycle,
10821
10868
  exec,
10822
10869
  log,
@@ -10901,6 +10948,7 @@ function containerCommandExec(input) {
10901
10948
  repositories: input.job.repositories,
10902
10949
  hostEnv: input.runtime.hostEnv,
10903
10950
  agents: input.runtime.agents,
10951
+ job: input.job,
10904
10952
  containerEnv: state.containerEnv ?? {},
10905
10953
  unpinnedRuntimes: state.unpinnedRuntimes,
10906
10954
  missingSetupScripts: state.missingSetupScripts,
@@ -10929,6 +10977,7 @@ function containerSenderCommand(input) {
10929
10977
  repositories: input.job.repositories,
10930
10978
  hostEnv: input.runtime.hostEnv,
10931
10979
  agents: input.runtime.agents,
10980
+ job: input.job,
10932
10981
  containerEnv: state.containerEnv ?? {},
10933
10982
  unpinnedRuntimes: state.unpinnedRuntimes,
10934
10983
  missingSetupScripts: state.missingSetupScripts,
@@ -11077,6 +11126,7 @@ async function runCliInContainer(input, argv, logName) {
11077
11126
  repositories: job.repositories,
11078
11127
  hostEnv: runtime.hostEnv,
11079
11128
  agents: runtime.agents,
11129
+ job,
11080
11130
  containerEnv: state.containerEnv ?? {},
11081
11131
  unpinnedRuntimes: state.unpinnedRuntimes,
11082
11132
  missingSetupScripts: state.missingSetupScripts,
@@ -11093,7 +11143,7 @@ async function runCliInContainer(input, argv, logName) {
11093
11143
  return { ok: false, reason: describeCallFailure(err) };
11094
11144
  }
11095
11145
  }
11096
- async function copyTranscriptsFromContainer(runtime, state) {
11146
+ async function copyTranscriptsFromContainer(runtime, state, job) {
11097
11147
  try {
11098
11148
  if (state.stopped) {
11099
11149
  const network = await ensureNetworkReady(runtime, state);
@@ -11105,7 +11155,7 @@ async function copyTranscriptsFromContainer(runtime, state) {
11105
11155
  } catch (err) {
11106
11156
  return { ok: false, reason: describeCallFailure(err) };
11107
11157
  }
11108
- return copyTranscripts((argv) => runtime.host.exec({ container: state.container, user: state.agentUser ?? ADDED_USER, env: NO_ENV, argv }), void 0, runtime.agents);
11158
+ return copyTranscripts((argv) => runtime.host.exec({ container: state.container, user: state.agentUser ?? ADDED_USER, env: NO_ENV, argv }), void 0, runtime.agents, job);
11109
11159
  }
11110
11160
  async function ensureContainerRunning(runtime, state) {
11111
11161
  try {
@@ -11145,8 +11195,8 @@ function sessionGuestOfContainer(runtime, state) {
11145
11195
  })
11146
11196
  };
11147
11197
  }
11148
- async function restoreSessionIntoContainer(runtime, state, keptDir, meta) {
11149
- const restored = await restoreSession({ guest: sessionGuestOfContainer(runtime, state), tar: packKeptSession(keptDir, meta, runtime.agents) });
11198
+ async function restoreSessionIntoContainer(runtime, state, keptDir, meta, job) {
11199
+ const restored = await restoreSession({ guest: sessionGuestOfContainer(runtime, state), tar: packKeptSession(keptDir, meta, runtime.agents, job) });
11150
11200
  if (!restored.ok) throw new Error(restored.reason);
11151
11201
  }
11152
11202
  var HOOK_ERRORS_IN_CONTAINER = "/build/home/.outerlayer/spool/hook-errors.log";