@outerlayer/cli 0.38.0-next.20261105132355 → 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.
- package/README.md +5 -0
- package/dist/{agent-setup-RXMEQ7PA.js → agent-setup-THQTFPYB.js} +19 -19
- package/dist/{agent-subcommand-KPQGEOPQ.js → agent-subcommand-H5LKM3HG.js} +4 -4
- package/dist/{bridge-F4BNXRM2.js → bridge-RN5JYY7N.js} +7 -7
- package/dist/{build-ZH5MAZNM.js → build-DJDZXY7M.js} +13 -13
- package/dist/{build-disk-GPCMOIZV.js → build-disk-PN7QBYVR.js} +11 -11
- package/dist/build-info.json +1 -1
- package/dist/{builder-ZMVXHOEJ.js → builder-NJXSBAX3.js} +10 -10
- package/dist/caller-T65G6G3Z.js +23 -0
- package/dist/{check-HXGQQAJS.js → check-QF7RGLUL.js} +56 -56
- package/dist/{chunk-IG7SBYJY.js → chunk-2VUBHRPG.js} +1 -1
- package/dist/{chunk-Y2HVISUN.js → chunk-365EXSFH.js} +1 -1
- package/dist/{chunk-EVFZUFCO.js → chunk-3CN77FDB.js} +4 -4
- package/dist/{chunk-KFJIOCZS.js → chunk-3FKWVYWC.js} +3 -3
- package/dist/{chunk-PMBG7IYE.js → chunk-3YCKLA4N.js} +10 -10
- package/dist/{chunk-64D2YZK5.js → chunk-44332APJ.js} +1 -1
- package/dist/{chunk-J7MMYBBV.js → chunk-5BU252QJ.js} +5 -5
- package/dist/{chunk-3J7F3VGZ.js → chunk-6S4THFJO.js} +2 -2
- package/dist/{chunk-DP6ZOSCR.js → chunk-6UXPXENL.js} +24 -10
- package/dist/{chunk-Y5ZKDLNX.js → chunk-6VCNDRNW.js} +15 -15
- package/dist/{chunk-L25GQH45.js → chunk-6Z5H7JV3.js} +1 -1
- package/dist/{chunk-GYUHWK2N.js → chunk-72DXH6AP.js} +9 -9
- package/dist/{chunk-K7KQCOSM.js → chunk-75D54355.js} +9 -9
- package/dist/{chunk-LFHJZDES.js → chunk-7DHQVVEC.js} +16 -16
- package/dist/{chunk-QJKW4MKH.js → chunk-7PZDPISM.js} +54 -2
- package/dist/{chunk-RM3K57Q7.js → chunk-A5FIUS53.js} +39 -16
- package/dist/{chunk-45UZPTDQ.js → chunk-AGDRXJSZ.js} +1 -1
- package/dist/{chunk-GTJ2WSYI.js → chunk-AUQPAVRV.js} +376 -307
- package/dist/{chunk-XN4A275V.js → chunk-BHATB3L2.js} +23 -13
- package/dist/{chunk-MPGTKJOM.js → chunk-BM25MMUE.js} +3 -3
- package/dist/{chunk-3PR7BPMG.js → chunk-BP3B5R7Y.js} +4 -4
- package/dist/{chunk-K7BI4TLM.js → chunk-DDBCRY3Y.js} +20 -7
- package/dist/{chunk-VV2VLQWG.js → chunk-DSR3VW72.js} +2 -2
- package/dist/{chunk-AWRRWWA7.js → chunk-EJOZNQBE.js} +7 -7
- package/dist/{chunk-MY6T3N3A.js → chunk-EUA3SKPV.js} +1 -1
- package/dist/{chunk-ZEEQB7VM.js → chunk-FIXRXONQ.js} +5 -5
- package/dist/{chunk-2C3XLYO5.js → chunk-G74ZB2V4.js} +1 -1
- package/dist/{chunk-EKRLMOWS.js → chunk-GEC2G3SJ.js} +6 -6
- package/dist/{chunk-JCEJARDB.js → chunk-GUYDCCUH.js} +1 -1
- package/dist/{chunk-2RKPEUGK.js → chunk-HBGVQT33.js} +1 -1
- package/dist/{chunk-GZETHU2Z.js → chunk-HLBN3FLS.js} +3 -3
- package/dist/{chunk-IJN3GP4M.js → chunk-HUMQ4NLZ.js} +1 -1
- package/dist/{chunk-HI5RBFL3.js → chunk-HV44EL6A.js} +14 -9
- package/dist/{chunk-VG524OUD.js → chunk-ID3HBQYZ.js} +5 -5
- package/dist/{chunk-2QIK3JRV.js → chunk-IRFN2ZHJ.js} +1 -1
- package/dist/{chunk-SKV6FO37.js → chunk-KEY5IDTC.js} +4 -4
- package/dist/{chunk-KXCTWOPU.js → chunk-KZG3R5YD.js} +3 -3
- package/dist/{chunk-M4WTELYI.js → chunk-LQJAZ4VK.js} +3 -3
- package/dist/{chunk-DOKFFSOZ.js → chunk-LWHHAZ75.js} +2 -2
- package/dist/{chunk-7TPLWWFN.js → chunk-M53UNEO6.js} +1 -1
- package/dist/{chunk-35RIDLSD.js → chunk-NAGY6ISM.js} +2 -2
- package/dist/{chunk-QDM23DTW.js → chunk-NFKERPLC.js} +10 -10
- package/dist/{chunk-HOCVTWV2.js → chunk-NIUSFUUS.js} +1 -1
- package/dist/{chunk-GEW4TNCL.js → chunk-NYWLOOIL.js} +7 -7
- package/dist/{chunk-GMRIR2MF.js → chunk-O4CWZFC4.js} +7 -7
- package/dist/{chunk-LMT72G74.js → chunk-OD2F225Q.js} +1 -1
- package/dist/{chunk-MB7IX6DO.js → chunk-ORSNYGXN.js} +1 -1
- package/dist/{chunk-TE6GQJRW.js → chunk-OVHBDADU.js} +1 -1
- package/dist/{chunk-IYG543BV.js → chunk-P22JMQJB.js} +3 -3
- package/dist/{chunk-J56SR6X4.js → chunk-P26TVBYV.js} +1 -1
- package/dist/{chunk-HU3POMM4.js → chunk-P64TL3GV.js} +6 -6
- package/dist/{chunk-WWTZLRPH.js → chunk-PLVHIQJN.js} +43 -3
- package/dist/{chunk-OVRLLZPJ.js → chunk-PWCP3YVA.js} +1 -1
- package/dist/{chunk-D5JJQRW7.js → chunk-QNPJ4VZ2.js} +9 -9
- package/dist/{chunk-SUMRSD2Q.js → chunk-QNQS4PET.js} +1 -1
- package/dist/{chunk-6XYKZH3K.js → chunk-R2QIQZ4V.js} +5 -5
- package/dist/{chunk-AWY7ORQ2.js → chunk-RNCCRUT5.js} +1 -1
- package/dist/{chunk-5M3KXOPY.js → chunk-S24KG7NY.js} +2 -2
- package/dist/{chunk-W7LJQ2GU.js → chunk-SCH5S3VW.js} +4 -4
- package/dist/{chunk-OV4XTV5M.js → chunk-SF2TBJBP.js} +7 -4
- package/dist/{chunk-VUSYGNNN.js → chunk-SZKBH2BO.js} +1 -1
- package/dist/{chunk-YU6XPJ5I.js → chunk-SZN3CSEP.js} +3 -3
- package/dist/{chunk-7476RWW6.js → chunk-TTYZDLGW.js} +99 -37
- package/dist/{chunk-XUXDUOJI.js → chunk-UAVBSFHI.js} +5 -5
- package/dist/{chunk-SSSPZ3TB.js → chunk-UEFLAGRW.js} +1 -1
- package/dist/{chunk-KXKVMSHC.js → chunk-UFDJDVZD.js} +1 -1
- package/dist/{chunk-3B5H5MGB.js → chunk-V52EY5UK.js} +1 -1
- package/dist/{chunk-HVUS5WRU.js → chunk-WH4OWQ6T.js} +3 -3
- package/dist/{chunk-BMYIPXBG.js → chunk-WPLNTUS6.js} +3 -3
- package/dist/{chunk-FRQPX2QR.js → chunk-XGQ7ZHNH.js} +3 -3
- package/dist/{chunk-IYUJFAQD.js → chunk-XJPTMZJG.js} +917 -34
- package/dist/{chunk-2FDWTE6F.js → chunk-ZFZ62TU4.js} +5 -5
- package/dist/{chunk-U63SE2NJ.js → chunk-ZOLDM52Z.js} +1 -1
- package/dist/{chunk-H6H5GCM6.js → chunk-ZRYBGZI7.js} +19 -8
- package/dist/{chunk-CUAV3727.js → chunk-ZZZIOKUN.js} +3 -3
- package/dist/{claude-launcher-3O5W5ENW.js → claude-launcher-LIV7LKKT.js} +8 -8
- package/dist/{cli-RU4HLUZP.js → cli-NKKF5PF5.js} +162 -149
- package/dist/{command-HRXMLFOT.js → command-ZQDMVPD4.js} +50 -50
- package/dist/{config-J4NNZ2XO.js → config-6LQKXZNE.js} +12 -12
- package/dist/{connect-cmd-GVIUKK3R.js → connect-cmd-KHOYYXIY.js} +11 -11
- package/dist/{container-start-JNTWQOMK.js → container-start-FGSVYG2T.js} +54 -49
- package/dist/{context-cleanup-7V2ARBSC.js → context-cleanup-WYI3QQBI.js} +4 -4
- package/dist/{context-show-cmd-73E36KAV.js → context-show-cmd-MUSMZ3ZM.js} +12 -12
- package/dist/{control-plane-launch-L744RJ4A.js → control-plane-launch-UGMPLX2S.js} +15 -15
- package/dist/{demo-record-cmd-KGH3WGLY.js → demo-record-cmd-GO4ZIP4J.js} +8 -8
- package/dist/{demo-voice-cmd-CHCS7TQF.js → demo-voice-cmd-YOIL75H3.js} +20 -20
- package/dist/{docker-CAMJXBAJ.js → docker-IWTHGXFC.js} +10 -10
- package/dist/{doctor-2Z224QH4.js → doctor-UUCRZ7JO.js} +55 -55
- package/dist/{emit-artifact-cmd-CGY656UZ.js → emit-artifact-cmd-IG5O5KUV.js} +19 -19
- package/dist/{emit-cmd-AG7HL3YI.js → emit-cmd-KGBGKB56.js} +7 -7
- package/dist/{emit-criteria-cmd-3HYUUSDK.js → emit-criteria-cmd-HV3RXCV5.js} +14 -14
- package/dist/{emit-demo-cmd-GHDL7ZGH.js → emit-demo-cmd-ZKHGJUW7.js} +20 -20
- package/dist/{emit-finding-cmd-KPHWY6ZU.js → emit-finding-cmd-PBTELK66.js} +14 -14
- package/dist/{emit-result-cmd-WOJEHOXH.js → emit-result-cmd-JJUNDXEH.js} +18 -18
- package/dist/{emit-step-cmd-QTNJBTZN.js → emit-step-cmd-5VZQBGLU.js} +14 -14
- package/dist/{exec-client-IPPD3NF4.js → exec-client-PH7FI3Q3.js} +8 -8
- package/dist/find-unit-527IGJNL.js +24 -0
- package/dist/{findings-cmd-LVYAXHQG.js → findings-cmd-PVP6D4ZV.js} +14 -14
- package/dist/{fleet-readiness-F46LOKJ6.js → fleet-readiness-YZZ6YDXZ.js} +14 -14
- package/dist/{governing-source-4XYZYZCD.js → governing-source-UUDIJISJ.js} +20 -20
- package/dist/{guest-init-CFJM25V5.js → guest-init-KXBNS3NA.js} +9 -9
- package/dist/{hook-fast-RNST4WJH.js → hook-fast-CRC7M2YT.js} +4 -4
- package/dist/{hook-install-G3FUCXBE.js → hook-install-3UNSUQVP.js} +4 -4
- package/dist/{hook-wrap-fast-HNY3OGLN.js → hook-wrap-fast-GVS5HF5C.js} +3 -3
- package/dist/host-checks-ISCYYAYB.js +79 -0
- package/dist/host-key-535Z4MV6.js +18 -0
- package/dist/{image-tag-5Z2NKCHC.js → image-tag-S5LR2FDL.js} +8 -8
- package/dist/index.js +7 -7
- package/dist/{init-NCBQ2DOK.js → init-2JDKKCKC.js} +46 -46
- package/dist/init-CGYS6IGX.js +79 -0
- package/dist/{init-agent-CNHQT7YK.js → init-agent-ESCPFY6L.js} +47 -47
- package/dist/{init-cmd-I3BH7SXO.js → init-cmd-RXB7ZCFD.js} +28 -28
- package/dist/{init-update-WYM5WSM7.js → init-update-YIQRJG5U.js} +23 -23
- package/dist/{install-cmd-3NOHEA6E.js → install-cmd-OG4IHLHP.js} +10 -10
- package/dist/{layout-RPYMSWCY.js → layout-ZDD5JMAD.js} +4 -4
- package/dist/{logs-XKEW5EOB.js → logs-LLFBENNJ.js} +7 -7
- package/dist/loop-36JR7RB2.js +90 -0
- package/dist/machine-DGMGTVD7.js +79 -0
- package/dist/{machine-skills-RP2Y5F32.js → machine-skills-G253FBPY.js} +4 -4
- package/dist/{mcp-install-cmd-IZYHXHXG.js → mcp-install-cmd-WLU64HPE.js} +4 -4
- package/dist/{mcp-serve-cmd-HAIJVRR7.js → mcp-serve-cmd-YJX7HUHL.js} +9 -9
- package/dist/{paths-6AMRSXZK.js → paths-5OXE4APD.js} +7 -7
- package/dist/pending-YC4KF2AW.js +18 -0
- package/dist/{pidfile-3BILBCEO.js → pidfile-ID52SG3L.js} +8 -8
- package/dist/{record-MV6WJGZT.js → record-XIM2Z2JO.js} +8 -8
- package/dist/{relay-CO5I2WOV.js → relay-T22SKZ3G.js} +5 -5
- package/dist/{relay-protocol-S2JGOYZZ.js → relay-protocol-64ZEAKJ4.js} +5 -5
- package/dist/runner-agents-AGFDPTJN.js +14 -0
- package/dist/runner-env-W7LASDJX.js +24 -0
- package/dist/{runner-identity-IVP2GW33.js → runner-identity-T7HDG3QU.js} +10 -10
- package/dist/{runner-key-E3ORW6RS.js → runner-key-RXTJDYTI.js} +46 -46
- package/dist/{session-sender-PWYFVWN6.js → session-sender-B6CSWAHX.js} +19 -19
- package/dist/{shell-function-FTY7SSAJ.js → shell-function-RBJR373S.js} +2 -2
- package/dist/{spec-cmd-2WKI4V2T.js → spec-cmd-HIQYYRBQ.js} +15 -15
- package/dist/{starter-pack-W6S3L76K.js → starter-pack-AK7Z6XLF.js} +5 -5
- package/dist/state-ZQN2O2PB.js +18 -0
- package/dist/{status-3RD4MERA.js → status-YD7P337P.js} +46 -46
- package/dist/{statusline-fast-5G2CTPSX.js → statusline-fast-WUXKRABL.js} +3 -3
- package/dist/{sync-cmd-TIDWKW4E.js → sync-cmd-BRP4QE2W.js} +18 -18
- package/dist/update-steps-SBBEBOIJ.js +80 -0
- package/dist/{watch-IA6UDVSF.js → watch-B3NVFDVP.js} +18 -18
- package/dist/{work-claim-cmd-VBRJO6FU.js → work-claim-cmd-H6M5ANKL.js} +21 -21
- package/dist/{work-cmd-2LXE27RX.js → work-cmd-DJNV646Q.js} +14 -14
- package/dist/{work-comment-cmd-ER53OPLH.js → work-comment-cmd-6QZQPRJ7.js} +17 -17
- package/dist/{work-demo-cmd-CSXUA7KH.js → work-demo-cmd-6MZIVYHK.js} +14 -14
- package/dist/{work-logs-cmd-ECF7ZLHO.js → work-logs-cmd-IS4GV5VC.js} +14 -14
- package/dist/{work-open-pr-cmd-SUJEYZ6C.js → work-open-pr-cmd-KZSKJKEQ.js} +15 -15
- package/dist/{work-pr-cmd-FCNFYWUR.js → work-pr-cmd-ARVEEUF3.js} +14 -14
- package/dist/{work-proofs-cmd-6DV35Y2W.js → work-proofs-cmd-YUH3XYQE.js} +16 -16
- package/dist/{work-proofs-record-7YI27TFT.js → work-proofs-record-BDYS2VU2.js} +24 -24
- package/dist/{work-stop-cmd-PBC7SJ7M.js → work-stop-cmd-U67OPSCS.js} +14 -14
- package/package.json +2 -2
- package/dist/caller-J7FR4VBJ.js +0 -23
- package/dist/find-unit-N3OJBFS5.js +0 -24
- package/dist/host-checks-TXG6OTBM.js +0 -79
- package/dist/host-key-QUBI74MS.js +0 -18
- package/dist/init-YENLMMJU.js +0 -79
- package/dist/loop-TIX5JGHS.js +0 -90
- package/dist/machine-62FUJBEK.js +0 -79
- package/dist/pending-C4XQUKWA.js +0 -18
- package/dist/runner-agents-FQ4FODZN.js +0 -14
- package/dist/runner-env-72OTIZV2.js +0 -24
- package/dist/state-C3FRODOO.js +0 -18
- package/dist/update-steps-4AI2DSYF.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-
|
|
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,
|
|
7
|
-
import { upgradedStarterText } from './chunk-
|
|
8
|
-
import { HELPER_PATH, HELPER_RECORD, DOCKERD_LOG } from './chunk-
|
|
9
|
-
import { writeDockerClientConfig } from './chunk-
|
|
10
|
-
import { senderPidfile } from './chunk-
|
|
11
|
-
import { installScrubContext } from './chunk-
|
|
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-
|
|
14
|
-
import { claimCalls, spoolHomeFor, itemCalls, claimItem, leftByRunnerKey } from './chunk-
|
|
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-
|
|
17
|
-
import { FETCHED_DIR, toolsDockerfile, FETCHED_FFMPEG, FETCHED_GH, FETCHED_TINI, FETCHED_HEADLESS_SHELL, FETCHED_PLAYWRIGHT_FFMPEG, FETCHED_VOICE_DIR } from './chunk-
|
|
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-
|
|
21
|
-
import { socketPathProblem, vsockLinks, linkVsockSockets, GUEST_CID, LEASE_LINK } from './chunk-
|
|
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-
|
|
23
|
-
import { postJson, WorkCommandError, getJson, isSignatureRefusal } from './chunk-
|
|
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-
|
|
25
|
-
import { formatBytes, volumeBytes, allocatedBytes, DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK, freeBytes } from './chunk-
|
|
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-
|
|
27
|
-
import { universalImagePending, RecipeError, writeSanitizedRecipe, classifyProperties, DOCKER_FEATURE } from './chunk-
|
|
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-
|
|
29
|
+
import { sharedSkillNames, skillConflictMessage } from './chunk-XGQ7ZHNH.js';
|
|
30
30
|
import { readCloudConfig } from './chunk-HWVMRETT.js';
|
|
31
|
-
import { signerFor } from './chunk-
|
|
32
|
-
import { vmAssetsDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE, runnerDir, jobsDir, storeScopes, spoolDir, orgStoreIn, rootfsDir, imagesDir, sessionsDir, builderCacheDiskPath, buildsDir, buildDir, ghConfigDir, runnerDirOfBuild, mirrorDir, orgHomeDir, jobConsolePath, vsockPath,
|
|
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-
|
|
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-
|
|
35
|
-
import { versionAtLeast } from './chunk-
|
|
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-
|
|
37
|
-
import { sessionFolderIn, legacyAgent, defaultAgents, parsePolicy, AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE, orderSessions, extractFacts, sessionsToTimeline, resolvePackRoot } from './chunk-
|
|
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';
|
|
@@ -42,7 +42,7 @@ import { scrubText, MIN_SCRUBBED_LITERAL, setCustomScrubbers, setLocalIdentity,
|
|
|
42
42
|
import { CheckItemsSchema, CHECK_ITEM_HREF_MAX_LENGTH, downconvertSession } from './chunk-2JIGPSVF.js';
|
|
43
43
|
import { randomUUID, randomBytes, createHash } from 'crypto';
|
|
44
44
|
import { rmSync, mkdirSync, existsSync, readFileSync, mkdtempSync, statSync, appendFileSync, writeFileSync, readdirSync, accessSync, constants, openSync, closeSync, renameSync, rmdirSync, createReadStream, lstatSync, unlinkSync, chmodSync, realpathSync, writeSync, truncateSync, cpSync, fstatSync, readSync, createWriteStream, copyFileSync, linkSync } from 'fs';
|
|
45
|
-
import { join, dirname, isAbsolute, delimiter,
|
|
45
|
+
import { join, dirname, isAbsolute, delimiter, basename, sep, relative, resolve } from 'path';
|
|
46
46
|
import { Readable, PassThrough, Duplex, Transform } from 'stream';
|
|
47
47
|
import { spawn, spawnSync } from 'child_process';
|
|
48
48
|
import { createServer, createConnection, connect, isIP } from 'net';
|
|
@@ -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(
|
|
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(
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
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
|
-
|
|
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(
|
|
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(
|
|
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
|
|
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 =
|
|
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 =
|
|
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(
|
|
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);
|
|
@@ -2974,7 +3205,8 @@ var DISK_REASON_TEXT = {
|
|
|
2974
3205
|
disk_not_restored: "the kept disk could not be copied",
|
|
2975
3206
|
checkout_not_switched: "the kept checkout could not be switched to the branch",
|
|
2976
3207
|
build_type_cannot_restore: "this build type cannot restore a disk",
|
|
2977
|
-
fresh_requested: "a member asked for a fresh disk"
|
|
3208
|
+
fresh_requested: "a member asked for a fresh disk",
|
|
3209
|
+
holder_busy: "the machine that holds its disk was busy"
|
|
2978
3210
|
};
|
|
2979
3211
|
function itemDiskDecision(input) {
|
|
2980
3212
|
if (input.fresh === true) return { state: { restored: false, reason: "fresh_requested" } };
|
|
@@ -2985,7 +3217,7 @@ function itemDiskDecision(input) {
|
|
|
2985
3217
|
} catch {
|
|
2986
3218
|
kept = void 0;
|
|
2987
3219
|
}
|
|
2988
|
-
if (kept === void 0) return { state: { restored: false, reason: "no_kept_disk" } };
|
|
3220
|
+
if (kept === void 0) return { state: { restored: false, reason: input.heldElsewhere === true ? "holder_busy" : "no_kept_disk" } };
|
|
2989
3221
|
if (kept.record.repository !== input.repository) return { state: { restored: false, reason: "no_kept_disk" } };
|
|
2990
3222
|
if (kept.record.imageId !== input.imageId) return { state: { restored: false, reason: "other_image" } };
|
|
2991
3223
|
if (kept.record.diskBytes !== input.diskBytes) return { state: { restored: false, reason: "other_disk_size" } };
|
|
@@ -3239,210 +3471,6 @@ async function saveMicroVmDiskState(input) {
|
|
|
3239
3471
|
return discard(`the state could not be saved: ${describeCallFailure(err)}`);
|
|
3240
3472
|
}
|
|
3241
3473
|
}
|
|
3242
|
-
var EVAL_INPUT_NAME = "eval-input";
|
|
3243
|
-
sessionFolderIn(BUILD_HOME, legacyAgent().descriptor);
|
|
3244
|
-
var MAX_TRANSCRIPT_BYTES = 7 * 1024 * 1024;
|
|
3245
|
-
var MAX_TRANSCRIPTS = 500;
|
|
3246
|
-
var MAX_TOTAL_TRANSCRIPT_BYTES = 64 * 1024 * 1024;
|
|
3247
|
-
var TRANSCRIPT_COPY_MS = 2 * 60 * 1e3;
|
|
3248
|
-
function firstLine4(text2) {
|
|
3249
|
-
return text2.trim().split("\n")[0] ?? "";
|
|
3250
|
-
}
|
|
3251
|
-
async function copyTranscripts(run, now = Date.now, agents = defaultAgents()) {
|
|
3252
|
-
const agent = jobAgent(void 0, agents);
|
|
3253
|
-
if (agent === void 0) return { ok: true, copied: [], missed: [] };
|
|
3254
|
-
const root = sessionFolderIn(BUILD_HOME, agent.descriptor);
|
|
3255
|
-
const deadline = now() + TRANSCRIPT_COPY_MS;
|
|
3256
|
-
let listed;
|
|
3257
|
-
try {
|
|
3258
|
-
listed = await run(["find", root, "-type", "f", "-name", "*.jsonl", "-print0"]);
|
|
3259
|
-
} catch (err) {
|
|
3260
|
-
return { ok: false, reason: describeCallFailure(err) };
|
|
3261
|
-
}
|
|
3262
|
-
if (listed.status !== 0 && !/No such file or directory/.test(listed.stderr)) {
|
|
3263
|
-
return { ok: false, reason: `listing the transcripts failed (exit ${listed.status})${firstLine4(listed.stderr) === "" ? "" : `: ${firstLine4(listed.stderr)}`}` };
|
|
3264
|
-
}
|
|
3265
|
-
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();
|
|
3266
|
-
const copied = [];
|
|
3267
|
-
const missed = [];
|
|
3268
|
-
let total = 0;
|
|
3269
|
-
for (const [index, path] of paths.entries()) {
|
|
3270
|
-
if (index >= MAX_TRANSCRIPTS) {
|
|
3271
|
-
missed.push({ path, reason: `the build wrote more than ${MAX_TRANSCRIPTS} transcripts` });
|
|
3272
|
-
continue;
|
|
3273
|
-
}
|
|
3274
|
-
if (now() >= deadline) {
|
|
3275
|
-
missed.push({ path, reason: `copying the transcripts took longer than ${TRANSCRIPT_COPY_MS / 1e3} seconds` });
|
|
3276
|
-
continue;
|
|
3277
|
-
}
|
|
3278
|
-
try {
|
|
3279
|
-
const read = await run(["head", "-c", String(MAX_TRANSCRIPT_BYTES + 1), `${root}/${path}`]);
|
|
3280
|
-
if (read.status !== 0) missed.push({ path, reason: `reading it failed (exit ${read.status})${firstLine4(read.stderr) === "" ? "" : `: ${firstLine4(read.stderr)}`}` });
|
|
3281
|
-
else if (Buffer.byteLength(read.stdout) > MAX_TRANSCRIPT_BYTES) missed.push({ path, reason: `it is larger than ${MAX_TRANSCRIPT_BYTES / (1024 * 1024)} MiB` });
|
|
3282
|
-
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` });
|
|
3283
|
-
else {
|
|
3284
|
-
total += Buffer.byteLength(read.stdout);
|
|
3285
|
-
copied.push({ path, content: read.stdout });
|
|
3286
|
-
}
|
|
3287
|
-
} catch (err) {
|
|
3288
|
-
missed.push({ path, reason: describeCallFailure(err) });
|
|
3289
|
-
}
|
|
3290
|
-
}
|
|
3291
|
-
return { ok: true, copied, missed };
|
|
3292
|
-
}
|
|
3293
|
-
function traceIdForSession(sessionId) {
|
|
3294
|
-
const stripped = sessionId.replace(/-/g, "").toLowerCase();
|
|
3295
|
-
if (/^[0-9a-f]{32}$/.test(stripped)) return stripped;
|
|
3296
|
-
return createHash("sha256").update(sessionId).digest("hex").slice(0, 32);
|
|
3297
|
-
}
|
|
3298
|
-
function sessionOptionsOf(path) {
|
|
3299
|
-
const segments = path.split("/");
|
|
3300
|
-
const stem = (segments.at(-1) ?? path).replace(/\.jsonl$/, "");
|
|
3301
|
-
const at = segments.lastIndexOf("subagents");
|
|
3302
|
-
if (at <= 0) return { fallbackId: stem };
|
|
3303
|
-
const parent = segments[at - 1];
|
|
3304
|
-
return {
|
|
3305
|
-
fallbackId: stem,
|
|
3306
|
-
isSubagent: true,
|
|
3307
|
-
...parent ? { parentSessionId: parent } : {},
|
|
3308
|
-
ownId: stem,
|
|
3309
|
-
...segments[at + 1] === "workflows" && segments[at + 2] ? { workflowRunId: segments[at + 2] } : {}
|
|
3310
|
-
};
|
|
3311
|
-
}
|
|
3312
|
-
function forkRecordOf(job) {
|
|
3313
|
-
return job.sessionId !== void 0 && job.sessionLaunchedAt !== void 0 ? { sessionId: job.sessionId, launchedAt: job.sessionLaunchedAt } : void 0;
|
|
3314
|
-
}
|
|
3315
|
-
function scrubbing(scrub, author, work) {
|
|
3316
|
-
setCustomScrubbers(scrub, () => void 0);
|
|
3317
|
-
setLocalIdentity({ home: BUILD_HOME, ...author?.name === void 0 ? {} : { name: author.name }, ...author?.email === void 0 ? {} : { email: author.email } });
|
|
3318
|
-
setRepoRoot(CHECKOUT_DIR);
|
|
3319
|
-
try {
|
|
3320
|
-
return work();
|
|
3321
|
-
} finally {
|
|
3322
|
-
setCustomScrubbers(void 0, () => void 0);
|
|
3323
|
-
setLocalIdentity({});
|
|
3324
|
-
setRepoRoot(void 0);
|
|
3325
|
-
}
|
|
3326
|
-
}
|
|
3327
|
-
function scrubLine(line2) {
|
|
3328
|
-
try {
|
|
3329
|
-
return JSON.stringify(scrubDeep(JSON.parse(line2)));
|
|
3330
|
-
} catch {
|
|
3331
|
-
return scrubText(line2);
|
|
3332
|
-
}
|
|
3333
|
-
}
|
|
3334
|
-
function writeReadOnly(path, text2) {
|
|
3335
|
-
writeFileSync(path, text2);
|
|
3336
|
-
chmodSync(path, 292);
|
|
3337
|
-
}
|
|
3338
|
-
function diffBase(job) {
|
|
3339
|
-
const recorded = (job.container ?? job.microvm)?.startCommit;
|
|
3340
|
-
if (recorded !== void 0 && recorded !== "") return { commit: recorded, source: "build" };
|
|
3341
|
-
const recipe = job.environment?.recipe?.sourceCommit;
|
|
3342
|
-
return recipe === void 0 || recipe === "" ? void 0 : { commit: recipe, source: "recipe" };
|
|
3343
|
-
}
|
|
3344
|
-
async function writeEvalInput(request) {
|
|
3345
|
-
const { job, dir, log } = request;
|
|
3346
|
-
const tag = `${itemTag(job)}`;
|
|
3347
|
-
rmSync(dir, { recursive: true, force: true });
|
|
3348
|
-
mkdirSync(join(dir, "sessions"), { recursive: true });
|
|
3349
|
-
chmodSync(dir, 493);
|
|
3350
|
-
chmodSync(join(dir, "sessions"), 493);
|
|
3351
|
-
let workItem;
|
|
3352
|
-
try {
|
|
3353
|
-
const data = await request.readWorkItem();
|
|
3354
|
-
writeReadOnly(join(dir, "work-item.json"), `${JSON.stringify(data, null, 2)}
|
|
3355
|
-
`);
|
|
3356
|
-
workItem = { status: "written" };
|
|
3357
|
-
} catch (err) {
|
|
3358
|
-
workItem = { status: "unavailable", reason: describeCallFailure(err) };
|
|
3359
|
-
log.error(`${tag} the work item could not be read for the checks' input: ${workItem.reason}`);
|
|
3360
|
-
}
|
|
3361
|
-
const patch = join(dir, "diff.patch");
|
|
3362
|
-
const base = diffBase(job);
|
|
3363
|
-
let diff;
|
|
3364
|
-
if (base === void 0) {
|
|
3365
|
-
diff = { status: "unavailable", reason: "the build recorded no commit it started from" };
|
|
3366
|
-
} else {
|
|
3367
|
-
const fetched = await request.fetchDiff({ remote: request.remote, dir: join(request.scratch, "diff"), base: base.commit, head: request.branchHead, token: request.readToken, output: patch });
|
|
3368
|
-
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 };
|
|
3369
|
-
if (!fetched.ok) log.error(`${tag} the diff could not be read for the checks' input: ${fetched.reason}`);
|
|
3370
|
-
}
|
|
3371
|
-
if (diff.status === "unavailable") writeFileSync(patch, "");
|
|
3372
|
-
chmodSync(patch, 292);
|
|
3373
|
-
const sessions = [];
|
|
3374
|
-
const parsed = [];
|
|
3375
|
-
const copiedByTrace = /* @__PURE__ */ new Map();
|
|
3376
|
-
let sessionsUnavailable;
|
|
3377
|
-
const capture = legacyAgent(request.agents).adapter.capture;
|
|
3378
|
-
if (!request.transcripts.ok) {
|
|
3379
|
-
sessionsUnavailable = request.transcripts.reason;
|
|
3380
|
-
log.error(`${tag} the sessions could not be copied for the checks' input: ${sessionsUnavailable}`);
|
|
3381
|
-
} else if (capture === void 0) {
|
|
3382
|
-
sessionsUnavailable = "the legacy agent has no capture part to read the transcripts with";
|
|
3383
|
-
log.error(`${tag} the sessions could not be read for the checks' input: ${sessionsUnavailable}`);
|
|
3384
|
-
} else {
|
|
3385
|
-
const { copied, missed } = request.transcripts;
|
|
3386
|
-
scrubbing(request.scrub, request.job.commitIdentity?.author, () => {
|
|
3387
|
-
for (const transcript of copied) {
|
|
3388
|
-
const options = sessionOptionsOf(transcript.path);
|
|
3389
|
-
const fork = forkFor(forkRecordOf(request.job), { sessionId: options.fallbackId ?? "", parentSessionId: options.parentSessionId });
|
|
3390
|
-
if (fork !== void 0) options.fork = fork;
|
|
3391
|
-
const subagent = options.isSubagent === true;
|
|
3392
|
-
const stem = options.fallbackId ?? transcript.path;
|
|
3393
|
-
let session = null;
|
|
3394
|
-
try {
|
|
3395
|
-
session = capture.parseText(transcript.content, options).session;
|
|
3396
|
-
} catch {
|
|
3397
|
-
}
|
|
3398
|
-
const traceId = traceIdForSession(session?.id ?? stem);
|
|
3399
|
-
if (session === null) {
|
|
3400
|
-
sessions.push({ traceId, subagent, status: "missing", reason: "the transcript holds no session" });
|
|
3401
|
-
log.error(`${tag} the transcript ${transcript.path} holds no session, so the checks' input leaves it out`);
|
|
3402
|
-
continue;
|
|
3403
|
-
}
|
|
3404
|
-
const kept = copiedByTrace.get(traceId);
|
|
3405
|
-
if (kept !== void 0) {
|
|
3406
|
-
kept.duplicates = (kept.duplicates ?? 0) + 1;
|
|
3407
|
-
log.error(`${tag} the transcript ${transcript.path} repeats session ${traceId}, so the checks' input leaves it out`);
|
|
3408
|
-
continue;
|
|
3409
|
-
}
|
|
3410
|
-
const file = `sessions/${traceId}.jsonl`;
|
|
3411
|
-
const text2 = transcript.content.split("\n").filter((line2) => line2.trim() !== "").map(scrubLine).join("\n");
|
|
3412
|
-
writeReadOnly(join(dir, file), `${text2}
|
|
3413
|
-
`);
|
|
3414
|
-
scrubDeep(session);
|
|
3415
|
-
parsed.push({ session: downconvertSession(session, "full"), traceId, subagent });
|
|
3416
|
-
const entry = { traceId, subagent, file, status: "copied" };
|
|
3417
|
-
copiedByTrace.set(traceId, entry);
|
|
3418
|
-
sessions.push(entry);
|
|
3419
|
-
}
|
|
3420
|
-
for (const miss of missed) {
|
|
3421
|
-
const options = sessionOptionsOf(miss.path);
|
|
3422
|
-
sessions.push({ traceId: traceIdForSession(options.fallbackId ?? miss.path), subagent: options.isSubagent === true, status: "missing", reason: miss.reason });
|
|
3423
|
-
log.error(`${tag} the transcript ${miss.path} could not be copied for the checks' input: ${miss.reason}`);
|
|
3424
|
-
}
|
|
3425
|
-
});
|
|
3426
|
-
}
|
|
3427
|
-
const ordered = orderSessions(parsed.map((entry) => entry.session));
|
|
3428
|
-
const traceOf = new Map(parsed.map((entry) => [entry.session.id, entry.traceId]));
|
|
3429
|
-
const facts = extractFacts(sessionsToTimeline(parsed.map((entry) => entry.session)));
|
|
3430
|
-
const traceAt = (index) => traceOf.get(ordered[index].id);
|
|
3431
|
-
const recorded = { commands: facts.coverage.has("commands"), edits: facts.coverage.has("edits") };
|
|
3432
|
-
const activity = {
|
|
3433
|
-
schemaVersion: 1,
|
|
3434
|
-
sessions: sessions.sort((a, b) => a.traceId.localeCompare(b.traceId)),
|
|
3435
|
-
// Left out of the file when undefined.
|
|
3436
|
-
sessionsUnavailable,
|
|
3437
|
-
workItem,
|
|
3438
|
-
diff,
|
|
3439
|
-
recorded,
|
|
3440
|
-
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,
|
|
3441
|
-
edits: recorded.edits ? facts.edits.map((edit) => ({ seq: edit.seq, traceId: traceAt(edit.sessionIndex), turn: edit.turnIndex, file: edit.file, status: edit.status })) : null
|
|
3442
|
-
};
|
|
3443
|
-
writeReadOnly(join(dir, "activity.json"), `${JSON.stringify(activity, null, 2)}
|
|
3444
|
-
`);
|
|
3445
|
-
}
|
|
3446
3474
|
var FILE_MODE = 420;
|
|
3447
3475
|
var DIR_MODE = 493;
|
|
3448
3476
|
function replaceFile(path, text2) {
|
|
@@ -3994,7 +4022,7 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
|
3994
4022
|
const tag = itemTag({ item: item.number, organizationId: input.organizationId, claimId: input.claimId });
|
|
3995
4023
|
const logPath = join(jobDir, "provision.log");
|
|
3996
4024
|
const fail = (reason) => ({ ok: false, reason });
|
|
3997
|
-
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);
|
|
3998
4026
|
const repositories = repositoriesOf({ repositories: input.repositories, repository: item.specRepository, branch: input.branch });
|
|
3999
4027
|
const primary = primaryOf(repositories);
|
|
4000
4028
|
if (primary === void 0) return fail("the work item names no repository to clone");
|
|
@@ -4052,7 +4080,7 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
|
4052
4080
|
if (!obtained.ok) return obtained.aborted === true ? { ok: false, reason: obtained.reason, aborted: true } : fail(obtained.reason);
|
|
4053
4081
|
const { report } = obtained.built;
|
|
4054
4082
|
const tagged = taggedLog(log, tag);
|
|
4055
|
-
const itemDisk = input.workItemId === void 0 ? { state: void 0 } : itemDiskFailed !== void 0 ? { state: { restored: false, reason: itemDiskFailed } } : itemDiskDecision({ fresh: input.fresh, builtin: true, backend: "disk", configPath: config.configPath, organizationId: input.organizationId, workItemId: input.workItemId, repository, imageId: report.imageId, diskBytes: limits2.diskBytes });
|
|
4083
|
+
const itemDisk = input.workItemId === void 0 ? { state: void 0 } : itemDiskFailed !== void 0 ? { state: { restored: false, reason: itemDiskFailed } } : itemDiskDecision({ fresh: input.fresh, heldElsewhere: input.diskHeldElsewhere, builtin: true, backend: "disk", configPath: config.configPath, organizationId: input.organizationId, workItemId: input.workItemId, repository, imageId: report.imageId, diskBytes: limits2.diskBytes });
|
|
4056
4084
|
const keptDisk = itemDisk.kept;
|
|
4057
4085
|
if (itemDisk.state?.restored === false) tagged(`this job starts without a kept disk: ${DISK_REASON_TEXT[itemDisk.state.reason]}`);
|
|
4058
4086
|
const plan = keptDisk !== void 0 ? keptDiskPlan() : await planSavedState({
|
|
@@ -4091,6 +4119,7 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
|
4091
4119
|
repositories,
|
|
4092
4120
|
hostEnv: runtime.hostEnv,
|
|
4093
4121
|
agents: runtime.agents,
|
|
4122
|
+
...input.job === void 0 ? {} : { job: input.job },
|
|
4094
4123
|
containerEnv: report.apply.containerEnv,
|
|
4095
4124
|
builtIns: true,
|
|
4096
4125
|
factoryVariables: factoryVariablesOf(config, jobDir),
|
|
@@ -4339,7 +4368,7 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
|
4339
4368
|
if (changed !== void 0) return giveUpState(changed);
|
|
4340
4369
|
}
|
|
4341
4370
|
const tools = await asRoot(runtime, state, ["cat", "/opt/outerlayer/tools.json"]);
|
|
4342
|
-
const agentVersion = agentVersionOf(tools.status === 0 ? tools.stdout : "", runtime.agents);
|
|
4371
|
+
const agentVersion = agentVersionOf(tools.status === 0 ? tools.stdout : "", runtime.agents, input.job);
|
|
4343
4372
|
environment.agentVersion = agentVersion;
|
|
4344
4373
|
const recorded = await judgeProgramRecord((argv) => asRoot(runtime, state, argv), runtime.agents);
|
|
4345
4374
|
if (recorded !== void 0) state.judgeProgram = recorded;
|
|
@@ -4381,6 +4410,7 @@ async function provisionMicroVmOnce(input, allowRestore, itemDiskFailed) {
|
|
|
4381
4410
|
...governingSource.kind === "governed" ? { governing: { repository: governingSource.repository } } : {},
|
|
4382
4411
|
agentVersion,
|
|
4383
4412
|
agents: runtime.agents,
|
|
4413
|
+
...input.job === void 0 ? {} : { job: input.job },
|
|
4384
4414
|
lifecycle: report.apply.lifecycle,
|
|
4385
4415
|
exec: stepExecFor({ vm, vsockPath: state.vsockPath, request, logPath }),
|
|
4386
4416
|
log,
|
|
@@ -4456,6 +4486,7 @@ function vmExecFor(input, argv) {
|
|
|
4456
4486
|
repositories: input.job.repositories,
|
|
4457
4487
|
hostEnv: input.runtime.hostEnv,
|
|
4458
4488
|
agents: input.runtime.agents,
|
|
4489
|
+
job: input.job,
|
|
4459
4490
|
containerEnv: state.containerEnv ?? {},
|
|
4460
4491
|
unpinnedRuntimes: state.unpinnedRuntimes,
|
|
4461
4492
|
missingSetupScripts: state.missingSetupScripts,
|
|
@@ -4495,6 +4526,7 @@ async function startMicroVmCommand(input) {
|
|
|
4495
4526
|
repositories: input.job.repositories,
|
|
4496
4527
|
hostEnv: input.runtime.hostEnv,
|
|
4497
4528
|
agents: input.runtime.agents,
|
|
4529
|
+
job: input.job,
|
|
4498
4530
|
containerEnv: state.containerEnv ?? {},
|
|
4499
4531
|
unpinnedRuntimes: state.unpinnedRuntimes,
|
|
4500
4532
|
missingSetupScripts: state.missingSetupScripts,
|
|
@@ -4549,6 +4581,7 @@ async function runCliInMicroVm(input, argv, logName, goneReason) {
|
|
|
4549
4581
|
repositories: job.repositories,
|
|
4550
4582
|
hostEnv: runtime.hostEnv,
|
|
4551
4583
|
agents: runtime.agents,
|
|
4584
|
+
job,
|
|
4552
4585
|
containerEnv: state.containerEnv ?? {},
|
|
4553
4586
|
unpinnedRuntimes: state.unpinnedRuntimes,
|
|
4554
4587
|
missingSetupScripts: state.missingSetupScripts,
|
|
@@ -4579,9 +4612,9 @@ async function copyHookErrors(runtime, state, jobDir) {
|
|
|
4579
4612
|
} catch {
|
|
4580
4613
|
}
|
|
4581
4614
|
}
|
|
4582
|
-
async function copyTranscriptsFromMicroVm(runtime, state) {
|
|
4615
|
+
async function copyTranscriptsFromMicroVm(runtime, state, job) {
|
|
4583
4616
|
if (!isRunning(runtime, state)) return { ok: false, reason: "the build's microVM is gone" };
|
|
4584
|
-
return copyTranscripts((argv) => asRoot(runtime, state, argv), void 0, runtime.agents);
|
|
4617
|
+
return copyTranscripts((argv) => asRoot(runtime, state, argv), void 0, runtime.agents, job);
|
|
4585
4618
|
}
|
|
4586
4619
|
function guestStopScript(paths = { proc: "/proc", record: HELPER_RECORD }) {
|
|
4587
4620
|
return [
|
|
@@ -5005,8 +5038,8 @@ function sessionGuestOfMicroVm(runtime, state, as) {
|
|
|
5005
5038
|
stream: (argv, io) => runtime.vm.execStream(state.vsockPath, request(argv), io)
|
|
5006
5039
|
};
|
|
5007
5040
|
}
|
|
5008
|
-
async function restoreSessionIntoMicroVm(runtime, state, keptDir, meta) {
|
|
5009
|
-
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) });
|
|
5010
5043
|
if (!restored.ok) throw new Error(restored.reason);
|
|
5011
5044
|
}
|
|
5012
5045
|
|
|
@@ -6613,6 +6646,7 @@ async function keepEndedSession(input) {
|
|
|
6613
6646
|
const { job, log, tag } = input;
|
|
6614
6647
|
if (job.sessionId === void 0 || job.workItemId === void 0 || job.sessionKept === true) return false;
|
|
6615
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;
|
|
6616
6650
|
const found = await guestOf(job, input.runtime);
|
|
6617
6651
|
if ("reason" in found) {
|
|
6618
6652
|
log.error(`${tag} the session was not kept: ${found.reason} \xB7 continuing`);
|
|
@@ -6632,7 +6666,7 @@ async function keepEndedSession(input) {
|
|
|
6632
6666
|
}
|
|
6633
6667
|
const tarPath = join(input.jobDirPath, SESSION_TAR);
|
|
6634
6668
|
try {
|
|
6635
|
-
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);
|
|
6636
6670
|
if (!copied.ok) {
|
|
6637
6671
|
log.error(`${tag} the session was not kept: ${copied.reason} \xB7 continuing`);
|
|
6638
6672
|
return changed;
|
|
@@ -6644,7 +6678,8 @@ async function keepEndedSession(input) {
|
|
|
6644
6678
|
tar: createReadStream(tarPath),
|
|
6645
6679
|
scrub: input.scrub
|
|
6646
6680
|
},
|
|
6647
|
-
input.runtime.agents
|
|
6681
|
+
input.runtime.agents,
|
|
6682
|
+
job
|
|
6648
6683
|
);
|
|
6649
6684
|
log.line(`${tag} session ${job.sessionId.slice(0, 8)} kept for the next agent job (${formatBytes(statSync(tarPath).size)})`);
|
|
6650
6685
|
job.sessionKept = true;
|
|
@@ -6665,7 +6700,7 @@ var RESULT_LINE = /^result:\s*(pass|fail)\s*$/i;
|
|
|
6665
6700
|
var UNMET_LINE = /^unmet:\s*(\S+)\s*$/i;
|
|
6666
6701
|
function readJudgeReply(run, minutes, agents = defaultAgents()) {
|
|
6667
6702
|
if (run.kind === "timeout") return { kind: "none", reason: `the judge ran out of time after ${minutes}`, limitKey: true };
|
|
6668
|
-
const output =
|
|
6703
|
+
const output = judgeAgent(agents)?.adapter.headless?.readJudgeOutput(run.stdout);
|
|
6669
6704
|
if (output === void 0) {
|
|
6670
6705
|
const said2 = firstLine5(run.stderr);
|
|
6671
6706
|
return { kind: "none", reason: `the judge exited ${run.status} and printed no result${said2 === "" ? "" : `: ${said2}`}` };
|
|
@@ -6856,7 +6891,7 @@ async function runJudge(input) {
|
|
|
6856
6891
|
log.line(`${tag} judge done (${formatDuration(now().getTime() - startedMs)})`);
|
|
6857
6892
|
}
|
|
6858
6893
|
async function judgeOne(check) {
|
|
6859
|
-
const agent =
|
|
6894
|
+
const agent = judgeAgent(runtime.agents);
|
|
6860
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`);
|
|
6861
6896
|
const missing = noAgentProgram(agent.descriptor.label);
|
|
6862
6897
|
const environment = environmentFor(input);
|
|
@@ -7750,7 +7785,18 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
7750
7785
|
log.line(`${tag} build microVM stopped`);
|
|
7751
7786
|
buildVmStopLogged = true;
|
|
7752
7787
|
};
|
|
7753
|
-
const
|
|
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;
|
|
7754
7800
|
if (job.checkContainer !== void 0 && job.checksRan === true) {
|
|
7755
7801
|
try {
|
|
7756
7802
|
const runtime = deps.container ?? createContainerRuntime();
|
|
@@ -8343,6 +8389,7 @@ async function housekeepingDockerIfReachable(deps) {
|
|
|
8343
8389
|
}
|
|
8344
8390
|
var DAY_MS = 864e5;
|
|
8345
8391
|
var STAGING_GRACE_MS = 36e5;
|
|
8392
|
+
var MAX_STATE_IDS = 1e3;
|
|
8346
8393
|
var keptAtOf = (entry) => Date.parse(entry.kept.record.keptAt);
|
|
8347
8394
|
var oldestFirst2 = (entries) => [...entries].sort((a, b) => keptAtOf(a) - keptAtOf(b));
|
|
8348
8395
|
var bytesOf = (entries) => entries.reduce((sum, entry) => sum + entry.kept.record.bytes, 0);
|
|
@@ -8396,7 +8443,23 @@ async function removeItemDisks(input) {
|
|
|
8396
8443
|
}
|
|
8397
8444
|
};
|
|
8398
8445
|
const entries = allEntries(configPath);
|
|
8399
|
-
|
|
8446
|
+
if (input.itemStates !== void 0 && entries.length > 0) {
|
|
8447
|
+
let states = void 0;
|
|
8448
|
+
let threw = false;
|
|
8449
|
+
try {
|
|
8450
|
+
states = await input.itemStates([...new Set(entries.map((entry) => entry.kept.record.workItemId))].slice(0, MAX_STATE_IDS));
|
|
8451
|
+
} catch (err) {
|
|
8452
|
+
threw = true;
|
|
8453
|
+
input.error(`housekeeping: could not ask which kept disks belong to closed work items: ${describeCallFailure(err)}`);
|
|
8454
|
+
}
|
|
8455
|
+
if (states === void 0 && !threw) input.error("housekeeping: could not ask which kept disks belong to closed work items: the gateway gave no answer");
|
|
8456
|
+
if (states !== void 0) {
|
|
8457
|
+
for (const entry of entries) {
|
|
8458
|
+
if (states[entry.kept.record.workItemId] === "closed") await remove(entry, "its pull request closed");
|
|
8459
|
+
}
|
|
8460
|
+
}
|
|
8461
|
+
}
|
|
8462
|
+
for (const entry of entries.filter((candidate) => !gone.has(candidate))) {
|
|
8400
8463
|
const sinceMs = nowMs - keptAtOf(entry);
|
|
8401
8464
|
if (sinceMs >= limits2.keepDays * DAY_MS) await remove(entry, `no job replaced it for ${formatDuration(sinceMs)}, past runner.housekeeping.workspaceKeepDays`);
|
|
8402
8465
|
}
|
|
@@ -8683,6 +8746,7 @@ async function runHousekeeping(options) {
|
|
|
8683
8746
|
limits: { max: options.workspaceMax ?? Number.POSITIVE_INFINITY, orgMax: options.workspaceOrgMax ?? Number.POSITIVE_INFINITY, keepDays: options.workspaceKeepDays ?? DEFAULT_WORKSPACE_KEEP_DAYS },
|
|
8684
8747
|
nowMs,
|
|
8685
8748
|
removeVolume: options.docker === void 0 ? void 0 : (name) => options.docker.removeVolume(name),
|
|
8749
|
+
...options.itemStates === void 0 ? {} : { itemStates: options.itemStates },
|
|
8686
8750
|
log: (line2) => options.log.line(line2),
|
|
8687
8751
|
error: (line2) => options.log.error(line2)
|
|
8688
8752
|
});
|
|
@@ -10532,7 +10596,7 @@ async function provisionContainerOnce(input, allowRestore, itemDiskFailed) {
|
|
|
10532
10596
|
const tag = itemTag({ item: item.number, organizationId: input.organizationId, claimId: input.claimId });
|
|
10533
10597
|
const logPath = join(jobDir, "provision.log");
|
|
10534
10598
|
const fail = (reason) => ({ ok: false, reason });
|
|
10535
|
-
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);
|
|
10536
10600
|
const repositories = repositoriesOf({ repositories: input.repositories, repository: item.specRepository, branch: input.branch });
|
|
10537
10601
|
const primary = primaryOf(repositories);
|
|
10538
10602
|
if (primary === void 0) return fail("the work item names no repository to clone");
|
|
@@ -10587,7 +10651,7 @@ async function provisionContainerOnce(input, allowRestore, itemDiskFailed) {
|
|
|
10587
10651
|
const { report } = built;
|
|
10588
10652
|
const tagged = taggedLog(log, tag);
|
|
10589
10653
|
const diskBytes = parseSize(config.build?.disk ?? DEFAULT_BUILD_DISK) ?? 0;
|
|
10590
|
-
const itemDisk = input.workItemId === void 0 ? { state: void 0 } : itemDiskFailed !== void 0 ? { state: { restored: false, reason: itemDiskFailed } } : itemDiskDecision({ fresh: input.fresh, builtin: true, backend: "volume", configPath: config.configPath, organizationId: input.organizationId, workItemId: input.workItemId, repository, imageId: report.imageId, diskBytes });
|
|
10654
|
+
const itemDisk = input.workItemId === void 0 ? { state: void 0 } : itemDiskFailed !== void 0 ? { state: { restored: false, reason: itemDiskFailed } } : itemDiskDecision({ fresh: input.fresh, heldElsewhere: input.diskHeldElsewhere, builtin: true, backend: "volume", configPath: config.configPath, organizationId: input.organizationId, workItemId: input.workItemId, repository, imageId: report.imageId, diskBytes });
|
|
10591
10655
|
const keptDisk = itemDisk.kept;
|
|
10592
10656
|
if (itemDisk.state?.restored === false) tagged(`this job starts without a kept disk: ${DISK_REASON_TEXT[itemDisk.state.reason]}`);
|
|
10593
10657
|
const plan = keptDisk !== void 0 ? keptDiskPlan() : await planSavedState({
|
|
@@ -10629,6 +10693,7 @@ async function provisionContainerOnce(input, allowRestore, itemDiskFailed) {
|
|
|
10629
10693
|
repositories,
|
|
10630
10694
|
hostEnv: runtime.hostEnv,
|
|
10631
10695
|
agents: runtime.agents,
|
|
10696
|
+
...input.job === void 0 ? {} : { job: input.job },
|
|
10632
10697
|
containerEnv: report.apply.containerEnv,
|
|
10633
10698
|
builtIns: true
|
|
10634
10699
|
};
|
|
@@ -10763,7 +10828,7 @@ async function provisionContainerOnce(input, allowRestore, itemDiskFailed) {
|
|
|
10763
10828
|
const changed = userIdChangedReason(plan.restore?.record.agentUid, agentUid);
|
|
10764
10829
|
if (changed !== void 0) return giveUpState(changed);
|
|
10765
10830
|
const tools = await host.exec({ container: name, user: ADDED_USER, env: NO_ENV, argv: ["cat", "/opt/outerlayer/tools.json"] });
|
|
10766
|
-
const agentVersion = agentVersionOf(tools.status === 0 ? tools.stdout : "", runtime.agents);
|
|
10831
|
+
const agentVersion = agentVersionOf(tools.status === 0 ? tools.stdout : "", runtime.agents, input.job);
|
|
10767
10832
|
environment.agentVersion = agentVersion;
|
|
10768
10833
|
const recorded = await judgeProgramRecord((argv) => host.exec({ container: name, user: ADDED_USER, env: NO_ENV, argv }), runtime.agents);
|
|
10769
10834
|
if (recorded !== void 0) state.judgeProgram = recorded;
|
|
@@ -10798,6 +10863,7 @@ async function provisionContainerOnce(input, allowRestore, itemDiskFailed) {
|
|
|
10798
10863
|
...governingSource.kind === "governed" ? { governing: { repository: governingSource.repository } } : {},
|
|
10799
10864
|
agentVersion,
|
|
10800
10865
|
agents: runtime.agents,
|
|
10866
|
+
...input.job === void 0 ? {} : { job: input.job },
|
|
10801
10867
|
lifecycle: report.apply.lifecycle,
|
|
10802
10868
|
exec,
|
|
10803
10869
|
log,
|
|
@@ -10882,6 +10948,7 @@ function containerCommandExec(input) {
|
|
|
10882
10948
|
repositories: input.job.repositories,
|
|
10883
10949
|
hostEnv: input.runtime.hostEnv,
|
|
10884
10950
|
agents: input.runtime.agents,
|
|
10951
|
+
job: input.job,
|
|
10885
10952
|
containerEnv: state.containerEnv ?? {},
|
|
10886
10953
|
unpinnedRuntimes: state.unpinnedRuntimes,
|
|
10887
10954
|
missingSetupScripts: state.missingSetupScripts,
|
|
@@ -10910,6 +10977,7 @@ function containerSenderCommand(input) {
|
|
|
10910
10977
|
repositories: input.job.repositories,
|
|
10911
10978
|
hostEnv: input.runtime.hostEnv,
|
|
10912
10979
|
agents: input.runtime.agents,
|
|
10980
|
+
job: input.job,
|
|
10913
10981
|
containerEnv: state.containerEnv ?? {},
|
|
10914
10982
|
unpinnedRuntimes: state.unpinnedRuntimes,
|
|
10915
10983
|
missingSetupScripts: state.missingSetupScripts,
|
|
@@ -11058,6 +11126,7 @@ async function runCliInContainer(input, argv, logName) {
|
|
|
11058
11126
|
repositories: job.repositories,
|
|
11059
11127
|
hostEnv: runtime.hostEnv,
|
|
11060
11128
|
agents: runtime.agents,
|
|
11129
|
+
job,
|
|
11061
11130
|
containerEnv: state.containerEnv ?? {},
|
|
11062
11131
|
unpinnedRuntimes: state.unpinnedRuntimes,
|
|
11063
11132
|
missingSetupScripts: state.missingSetupScripts,
|
|
@@ -11074,7 +11143,7 @@ async function runCliInContainer(input, argv, logName) {
|
|
|
11074
11143
|
return { ok: false, reason: describeCallFailure(err) };
|
|
11075
11144
|
}
|
|
11076
11145
|
}
|
|
11077
|
-
async function copyTranscriptsFromContainer(runtime, state) {
|
|
11146
|
+
async function copyTranscriptsFromContainer(runtime, state, job) {
|
|
11078
11147
|
try {
|
|
11079
11148
|
if (state.stopped) {
|
|
11080
11149
|
const network = await ensureNetworkReady(runtime, state);
|
|
@@ -11086,7 +11155,7 @@ async function copyTranscriptsFromContainer(runtime, state) {
|
|
|
11086
11155
|
} catch (err) {
|
|
11087
11156
|
return { ok: false, reason: describeCallFailure(err) };
|
|
11088
11157
|
}
|
|
11089
|
-
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);
|
|
11090
11159
|
}
|
|
11091
11160
|
async function ensureContainerRunning(runtime, state) {
|
|
11092
11161
|
try {
|
|
@@ -11126,8 +11195,8 @@ function sessionGuestOfContainer(runtime, state) {
|
|
|
11126
11195
|
})
|
|
11127
11196
|
};
|
|
11128
11197
|
}
|
|
11129
|
-
async function restoreSessionIntoContainer(runtime, state, keptDir, meta) {
|
|
11130
|
-
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) });
|
|
11131
11200
|
if (!restored.ok) throw new Error(restored.reason);
|
|
11132
11201
|
}
|
|
11133
11202
|
var HOOK_ERRORS_IN_CONTAINER = "/build/home/.outerlayer/spool/hook-errors.log";
|
|
@@ -11880,4 +11949,4 @@ async function runHostChecks(input) {
|
|
|
11880
11949
|
}
|
|
11881
11950
|
}
|
|
11882
11951
|
|
|
11883
|
-
export { ADOPTED_FETCH_RETRY_WINDOW_MS, ALREADY_RELEASED, AttemptLogBook, EXIT_CODE_FILE, GUEST_USAGE_INTERVAL_MS, HELPER_ENV, KIND_LABEL, LEASE_SECONDS, MAX_CHECK_ITEMS_BYTES, MICROVM_COMMAND_DIR, MIN_ENGINE_MAJOR, PLACEHOLDER_MARKER, RENEW_INTERVAL_SECONDS, RunnerInitError, agentCredentialCheck, appendCommandLog, attemptNote, checksIn, claimPermissionProblem, commandItems, commandLogOffset, containerCommandExec, createContainerRuntime, createHousekeepingDocker, createLeaseChannel, currentSkillCommand, decideHostBuildSkill, deliverCommitHooks, deliverContainerHooks, deliverExecMaven, deliverJobFiles, describeHookEnd, describeMachineDocker, detectMachine, ensureFirecrackerAndJailer, ensureNetworkReady, ensureTunnel, execArgv, execCommandLine, fetchManagedBuildSettings, fetchManagedClaudeKey, filesAreCopied, finishJob, foldSample, formerSkillProblem, formerSkillQueues, freeItemDisksUntil, gitRemoteFor, helperFirecrackerNote, helperSocketPath, holdManagedBuildSettings, holdManagedClaudeKey, hookLimitsFor, hostCommandEnvironment, hostEnvironment, housekeepingDockerIfReachable, inTeardown, installTrust, isContainerTracked, isGroupAlive, isIdle, isJudgeCheck, isMicroVmTracked, isPlaceholderCommand, isReadable, isTimedOut, isTracked, isUnfinished, itemScope, itemTag, jobEnv, jobRecordsClaim, judgeProbe, keepGhConfigCurrent, leaseExpiresAtMs, leaseTimeLeftMs, lifecycleFailureReason, lifecycleSteps, listAdoptableJobs, listTrackedJobs, listUnreadableJobs, listenOnBroker, makeRecorder, managedBuildSettingsFor, measureDisk, microVmArchSupported, microVmAssetsPinned, microVmCommandLine, microVmOomKills, missingPermissionFix, missingPermissionOf, modellessProblem, modellessQueues, needsAgentCredential, needsBuildSkill, needsRenew, outcomeFromExitCode, parseCpuList, permissionModeProblem, permissionModeProblems, placeholderProblem, placeholderQueues, prepareBranch, prepareResume, prepareRunnerInit, probeCommand, probeHelper, probeMicroVmCommand, provisionContainer, provisionEnvironment, provisionMicroVm, reachDockerStep, readConfigObject, readCpuUsec, readDefinitions, readProvisionOut, readRecords, recoverLostJobs, releaseLease, removeOldestUntil, renewLease, resolveHostBuild, restartSender, restoreSessionIntoContainer, restoreSessionIntoMicroVm, retryFailedReleases, runCommand, runHook, runHostChecks, runHousekeeping, runRunnerInit, runWithSpawn, sampleGuest, savedStatesDir, scrubReason, serveLease, setStage, setUpRunnerCgroup, shellQuote, startHostServices, startMicroVmCommand, startSender, startServicesFor, stopOrphanedMicroVms, stoppedHelperReason, stripTerminalControls, supportsContainerBuilds, supportsMicroVmBuilds, sweepImageBuilders, testProofIn, timeoutAfter, unfinishedJobs, usableCpus, vmAlive, withTunnelLog, workdirProblem, writeGuestGhConfig, writeRunnerInit };
|
|
11952
|
+
export { ADOPTED_FETCH_RETRY_WINDOW_MS, ALREADY_RELEASED, AttemptLogBook, EXIT_CODE_FILE, GUEST_USAGE_INTERVAL_MS, HELPER_ENV, KIND_LABEL, LEASE_SECONDS, MAX_CHECK_ITEMS_BYTES, MICROVM_COMMAND_DIR, MIN_ENGINE_MAJOR, PLACEHOLDER_MARKER, RENEW_INTERVAL_SECONDS, RunnerInitError, agentCredentialCheck, appendCommandLog, attemptNote, checksIn, claimPermissionProblem, commandItems, commandLogOffset, containerCommandExec, createContainerRuntime, createHousekeepingDocker, createLeaseChannel, currentSkillCommand, decideHostBuildSkill, deliverCommitHooks, deliverContainerHooks, deliverExecMaven, deliverJobFiles, describeHookEnd, describeMachineDocker, detectMachine, ensureFirecrackerAndJailer, ensureNetworkReady, ensureTunnel, execArgv, execCommandLine, fetchManagedBuildSettings, fetchManagedClaudeKey, filesAreCopied, finishJob, foldSample, formerSkillProblem, formerSkillQueues, freeItemDisksUntil, gitRemoteFor, helperFirecrackerNote, helperSocketPath, holdManagedBuildSettings, holdManagedClaudeKey, hookLimitsFor, hostCommandEnvironment, hostEnvironment, housekeepingDockerIfReachable, inTeardown, installTrust, isContainerTracked, isGroupAlive, isIdle, isJudgeCheck, isMicroVmTracked, isPlaceholderCommand, isReadable, isTimedOut, isTracked, isUnfinished, itemScope, itemTag, jobEnv, jobRecordsClaim, judgeProbe, keepGhConfigCurrent, leaseExpiresAtMs, leaseTimeLeftMs, lifecycleFailureReason, lifecycleSteps, listAdoptableJobs, listItemDisks, listTrackedJobs, listUnreadableJobs, listenOnBroker, makeRecorder, managedBuildSettingsFor, measureDisk, microVmArchSupported, microVmAssetsPinned, microVmCommandLine, microVmOomKills, missingPermissionFix, missingPermissionOf, modellessProblem, modellessQueues, needsAgentCredential, needsBuildSkill, needsRenew, outcomeFromExitCode, parseCpuList, permissionModeProblem, permissionModeProblems, placeholderProblem, placeholderQueues, prepareBranch, prepareResume, prepareRunnerInit, probeCommand, probeHelper, probeMicroVmCommand, provisionContainer, provisionEnvironment, provisionMicroVm, reachDockerStep, readConfigObject, readCpuUsec, readDefinitions, readProvisionOut, readRecords, recoverLostJobs, releaseLease, removeOldestUntil, renewLease, resolveHostBuild, restartSender, restoreSessionIntoContainer, restoreSessionIntoMicroVm, retryFailedReleases, runCommand, runHook, runHostChecks, runHousekeeping, runRunnerInit, runWithSpawn, sampleGuest, savedStatesDir, scrubReason, serveLease, setStage, setUpRunnerCgroup, shellQuote, startHostServices, startMicroVmCommand, startSender, startServicesFor, stopOrphanedMicroVms, stoppedHelperReason, stripTerminalControls, supportsContainerBuilds, supportsMicroVmBuilds, sweepImageBuilders, testProofIn, timeoutAfter, unfinishedJobs, usableCpus, vmAlive, withTunnelLog, workdirProblem, writeGuestGhConfig, writeRunnerInit };
|