@outerlayer/cli 0.40.0 → 0.41.0-next.20261117195646

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/README.md +8 -5
  2. package/dist/agent-credential-JN5VDRUX.js +16 -0
  3. package/dist/agent-setup-7A66WE3X.js +43 -0
  4. package/dist/{agent-subcommand-U7TXKOF4.js → agent-subcommand-AE42NSHC.js} +6 -6
  5. package/dist/{artifact-link-cmd-HYEM4X5U.js → artifact-link-cmd-YMMRVRQD.js} +2 -2
  6. package/dist/bridge-PJTQ3XHE.js +19 -0
  7. package/dist/build-75I2U74U.js +28 -0
  8. package/dist/build-disk-Z5YFT47Z.js +23 -0
  9. package/dist/build-info.json +1 -1
  10. package/dist/builder-NNNVIN4P.js +22 -0
  11. package/dist/caller-H3KRGMJH.js +25 -0
  12. package/dist/{check-U5P5FFFB.js → check-KFQCKXHZ.js} +108 -90
  13. package/dist/{chunk-4KCWAP5L.js → chunk-23YVVYQC.js} +1 -1
  14. package/dist/{chunk-J3P4WLJA.js → chunk-26RXLXEX.js} +1 -1
  15. package/dist/{chunk-YYHSGZHO.js → chunk-2RUTYYYA.js} +1 -1
  16. package/dist/{chunk-6IGOHB3O.js → chunk-37WA2LQC.js} +6 -1
  17. package/dist/{chunk-WNX2RR5P.js → chunk-3HH2AQKF.js} +1 -1
  18. package/dist/{chunk-ZHRXINEW.js → chunk-3RXLDGWE.js} +7 -7
  19. package/dist/{chunk-ZCBKVSBK.js → chunk-4I3SN7WG.js} +3 -3
  20. package/dist/{chunk-TWKW3BL3.js → chunk-4RPDWURG.js} +1 -1
  21. package/dist/{chunk-Y34AHK7R.js → chunk-4SMKP5QI.js} +2 -2
  22. package/dist/{chunk-XC2ZN7UA.js → chunk-6SYVSIGA.js} +1 -1
  23. package/dist/{chunk-CQIJVNUB.js → chunk-A2AFTKMN.js} +7 -7
  24. package/dist/{chunk-PKBW4RL7.js → chunk-APVMCKLK.js} +1 -1
  25. package/dist/{chunk-4JUAJVOW.js → chunk-ATXTGXGK.js} +2 -2
  26. package/dist/{chunk-24K3CV6P.js → chunk-B2WCKRMW.js} +6 -6
  27. package/dist/{chunk-LA66NWUO.js → chunk-B3ZKYFBI.js} +1 -1
  28. package/dist/{chunk-HS45JMDJ.js → chunk-B6W2LW7E.js} +1 -1
  29. package/dist/{chunk-3UFBSPHM.js → chunk-BO5TMIRG.js} +4 -4
  30. package/dist/{chunk-5VANIC7Z.js → chunk-BPZ23EMS.js} +7 -7
  31. package/dist/{chunk-CDMNKUFT.js → chunk-CUMLCXFI.js} +2 -2
  32. package/dist/{chunk-YZQDTL3T.js → chunk-D47Z2Z7F.js} +190 -173
  33. package/dist/{chunk-VXL7SLO3.js → chunk-D5TZYUGZ.js} +1 -1
  34. package/dist/{chunk-AE6A5DVR.js → chunk-D5YKSWK3.js} +8 -8
  35. package/dist/{chunk-5GJWIATY.js → chunk-DJCSAWBV.js} +4 -4
  36. package/dist/{chunk-F3J4UKBF.js → chunk-DJK3IK6K.js} +1 -1
  37. package/dist/{chunk-CHIKNMWU.js → chunk-DXZ6QBUJ.js} +1 -1
  38. package/dist/{chunk-7N6MB6NR.js → chunk-EVAK6FAS.js} +6 -6
  39. package/dist/{chunk-WGWIB5JH.js → chunk-EYD5HOQ7.js} +1 -1
  40. package/dist/{chunk-AOAXRPXC.js → chunk-FD42O5SH.js} +13 -4
  41. package/dist/{chunk-FIH3QA4E.js → chunk-FMOGX7RR.js} +5 -5
  42. package/dist/{chunk-EOKIUWXY.js → chunk-FRLGVHJP.js} +1 -1
  43. package/dist/{chunk-7RIWXHSY.js → chunk-G4B473J5.js} +3 -3
  44. package/dist/chunk-GAHP2AI3.js +163 -0
  45. package/dist/{chunk-3KT24F2C.js → chunk-GVGHEQCU.js} +9 -9
  46. package/dist/{chunk-WNPLSKH6.js → chunk-H2NTP6OM.js} +1 -1
  47. package/dist/{chunk-F3P7DP7R.js → chunk-I6G5CO3K.js} +1 -1
  48. package/dist/{chunk-D6CU6N5S.js → chunk-IOSONR7N.js} +2 -2
  49. package/dist/{chunk-SKVA4VMG.js → chunk-J2ADYASG.js} +1 -1
  50. package/dist/{chunk-CVDB3ILT.js → chunk-JMSMNKCK.js} +1 -1
  51. package/dist/{chunk-TTPOEZFE.js → chunk-KTZOD7A3.js} +1 -1
  52. package/dist/{chunk-SGVMC66D.js → chunk-LOWZZ4QA.js} +1 -1
  53. package/dist/{chunk-DCY6QUS6.js → chunk-M4YTSRJI.js} +1 -1
  54. package/dist/chunk-MQ6SKVLA.js +9 -0
  55. package/dist/{chunk-ZZN2TUHE.js → chunk-MYFC3HKP.js} +9 -9
  56. package/dist/{chunk-Q5A5WWZI.js → chunk-NCZNYMTB.js} +23 -21
  57. package/dist/{chunk-R2VUU5TC.js → chunk-NEOM73RW.js} +1 -1
  58. package/dist/{chunk-AQNL3XHS.js → chunk-NPVIEJX6.js} +1 -1
  59. package/dist/{chunk-K5J7AKRL.js → chunk-P7WAAN35.js} +1 -1
  60. package/dist/{chunk-SQIFPWGN.js → chunk-PLVLC7SU.js} +2 -2
  61. package/dist/{chunk-A6DFTKQF.js → chunk-PMJGT7SQ.js} +25 -19
  62. package/dist/{chunk-WVEN3DDJ.js → chunk-PTZF6MC5.js} +6 -6
  63. package/dist/{chunk-OLWDENJZ.js → chunk-Q3QJG2P6.js} +3 -3
  64. package/dist/{chunk-JIMISJV2.js → chunk-Q7Z6ELTL.js} +28 -7
  65. package/dist/{chunk-HHOFP647.js → chunk-QDJBEQCE.js} +1 -1
  66. package/dist/{chunk-BV4I6IIT.js → chunk-QFGKTIPS.js} +3 -3
  67. package/dist/{chunk-2SS737DI.js → chunk-QHGVLLOJ.js} +1 -1
  68. package/dist/{chunk-EOO274OK.js → chunk-QKVOUI56.js} +3 -3
  69. package/dist/{chunk-MUDXPJT6.js → chunk-QPC6OKD2.js} +11 -11
  70. package/dist/{chunk-MRM7CQJ3.js → chunk-QS2O5G64.js} +116 -14
  71. package/dist/{chunk-WKO72EYV.js → chunk-R6ME6MWL.js} +3 -3
  72. package/dist/{chunk-H7IY5B2M.js → chunk-RVUOSR2D.js} +526 -107
  73. package/dist/{chunk-L6UD5LKU.js → chunk-SDCECDBS.js} +5 -5
  74. package/dist/{chunk-P6GTJQMA.js → chunk-SE5ZVVDJ.js} +3 -3
  75. package/dist/{chunk-2ZF62BAK.js → chunk-TLCTOEU5.js} +1 -1
  76. package/dist/{chunk-PG4KH7G6.js → chunk-TVU7AL2Z.js} +6 -6
  77. package/dist/{chunk-XEVGUSP6.js → chunk-UTZULAN6.js} +10 -10
  78. package/dist/{chunk-VIIJAM2R.js → chunk-UYIWLYLX.js} +5 -5
  79. package/dist/{chunk-IGYRJWB4.js → chunk-V5MR6BWR.js} +226 -143
  80. package/dist/{chunk-BEPP2C3U.js → chunk-VATN55FQ.js} +8 -8
  81. package/dist/{chunk-ZCFGRVGX.js → chunk-VYF5BILX.js} +34 -7
  82. package/dist/{chunk-U74YD3WB.js → chunk-W7P5QFRN.js} +7 -7
  83. package/dist/{chunk-QMC2MM2S.js → chunk-WNFITHNX.js} +1 -1
  84. package/dist/{chunk-XMUNNJMO.js → chunk-WOQOZCZZ.js} +4 -4
  85. package/dist/{chunk-UHGU2EAK.js → chunk-WRIQGJKT.js} +225 -17
  86. package/dist/{chunk-DAAZIWK2.js → chunk-X7YMKZ7A.js} +23 -21
  87. package/dist/{chunk-WQRFIWYB.js → chunk-XCAPYFJ3.js} +5 -5
  88. package/dist/{chunk-VUSPSY6N.js → chunk-XDAMSCJG.js} +1 -1
  89. package/dist/{chunk-LAO7LRIR.js → chunk-XMJNIIPM.js} +411 -92
  90. package/dist/{chunk-Q7OOS23E.js → chunk-XNB2VFZI.js} +4 -4
  91. package/dist/{chunk-GBCTYHZ4.js → chunk-YLDCYJRP.js} +15 -13
  92. package/dist/{chunk-YKVFVP4A.js → chunk-YLDHHHBJ.js} +43 -13
  93. package/dist/{chunk-2GAQRL4S.js → chunk-YNZVC7XT.js} +4 -4
  94. package/dist/{chunk-HMW3UCME.js → chunk-YXKZGVUL.js} +36 -8
  95. package/dist/{chunk-YVBJ74GP.js → chunk-YXUSSZAE.js} +23 -21
  96. package/dist/{claude-launcher-ZLZ4UMHJ.js → claude-launcher-HNE36BKE.js} +68 -18
  97. package/dist/{cli-EFLEZPHB.js → cli-NEZV54LS.js} +220 -179
  98. package/dist/{command-22NUIO7Z.js → command-H2R6EFUH.js} +68 -61
  99. package/dist/{config-HZEVAUDO.js → config-DIUO2GQY.js} +16 -14
  100. package/dist/{connect-cmd-IUDF62SX.js → connect-cmd-SXSWOHVT.js} +17 -15
  101. package/dist/{container-start-PQAEL5ZS.js → container-start-B7BACAFN.js} +61 -57
  102. package/dist/{context-cleanup-OT7BL2NG.js → context-cleanup-BUZVQNKC.js} +6 -6
  103. package/dist/{context-show-cmd-JDO6DBBU.js → context-show-cmd-ZWOTXOXV.js} +18 -16
  104. package/dist/{control-plane-launch-M545J63D.js → control-plane-launch-BPJQYN6J.js} +19 -17
  105. package/dist/{demo-record-cmd-DGP3CW3A.js → demo-record-cmd-4H2J2N3X.js} +12 -10
  106. package/dist/{demo-voice-cmd-23BV7L6V.js → demo-voice-cmd-VIOM4SF5.js} +26 -24
  107. package/dist/{dist-AKLRKVET.js → dist-FKOMD5MC.js} +2 -2
  108. package/dist/docker-QQEZWBI3.js +22 -0
  109. package/dist/{doctor-5VN6Q4ZU.js → doctor-Y7CIJZX5.js} +115 -64
  110. package/dist/emit-artifact-cmd-HUAKLOH4.js +46 -0
  111. package/dist/{emit-cmd-RM6FHATP.js → emit-cmd-UDTT7ENT.js} +9 -9
  112. package/dist/emit-criteria-cmd-7LKPQRFE.js +37 -0
  113. package/dist/emit-demo-cmd-7TW5Y3MN.js +49 -0
  114. package/dist/{emit-finding-cmd-E7WKK2A4.js → emit-finding-cmd-T3JBAGS2.js} +20 -18
  115. package/dist/{emit-result-cmd-5LKEMUOD.js → emit-result-cmd-ILRQ6OIL.js} +24 -22
  116. package/dist/emit-step-cmd-4ISFOYRC.js +37 -0
  117. package/dist/exec-client-UJKPJRNK.js +20 -0
  118. package/dist/{find-unit-XKWFS4BL.js → find-unit-OAJKRZI2.js} +17 -15
  119. package/dist/{findings-cmd-5BNDO3YM.js → findings-cmd-37RCXQK2.js} +20 -18
  120. package/dist/fleet-readiness-IVFQSHPL.js +33 -0
  121. package/dist/governing-source-RXJBJHN7.js +45 -0
  122. package/dist/guest-init-EXKSBS7A.js +22 -0
  123. package/dist/{hook-fast-CQ2YCZLB.js → hook-fast-BSH6IHRN.js} +4 -4
  124. package/dist/{hook-install-VWF5C6EL.js → hook-install-NOWMUPSI.js} +6 -6
  125. package/dist/{hook-wrap-fast-Y5KKK67C.js → hook-wrap-fast-7E5LAYEU.js} +3 -3
  126. package/dist/host-checks-GWUYRJXA.js +84 -0
  127. package/dist/host-key-7WPFECOD.js +20 -0
  128. package/dist/{image-tag-VZTFHG6T.js → image-tag-GLR3OAO3.js} +12 -10
  129. package/dist/index.js +6 -6
  130. package/dist/init-4MF5M74X.js +84 -0
  131. package/dist/{init-IXQBYUOM.js → init-BEMNWKES.js} +55 -53
  132. package/dist/{init-agent-BWLBRVNP.js → init-agent-6E3FAOEZ.js} +55 -53
  133. package/dist/init-cmd-R5ICA2LP.js +55 -0
  134. package/dist/{init-update-35IRDVWQ.js → init-update-FAFXM2YE.js} +29 -27
  135. package/dist/install-cmd-HI5OQW5J.js +28 -0
  136. package/dist/launch-agent-JLANNHFC.js +28 -0
  137. package/dist/{layout-F6FDPUC2.js → layout-U2ZTNGVB.js} +6 -6
  138. package/dist/{login-browser-G3NBTYT6.js → login-browser-QAPMBSQA.js} +2 -2
  139. package/dist/{logs-NWVFDJS3.js → logs-RVPQEAYN.js} +11 -9
  140. package/dist/loop-PP7QFT3F.js +94 -0
  141. package/dist/machine-JHWQCYS3.js +84 -0
  142. package/dist/{machine-skills-U7RNJTPH.js → machine-skills-2QFBY2II.js} +6 -6
  143. package/dist/{mcp-install-cmd-QDYJB3RW.js → mcp-install-cmd-KRZJVOND.js} +6 -6
  144. package/dist/{mcp-serve-cmd-JEYAQJPY.js → mcp-serve-cmd-UT3YCM5P.js} +13 -11
  145. package/dist/{paths-DWVALEBM.js → paths-72CWJPND.js} +11 -9
  146. package/dist/pending-ES4EF46B.js +20 -0
  147. package/dist/pidfile-WI6SE35U.js +21 -0
  148. package/dist/record-KX763L6R.js +20 -0
  149. package/dist/{relay-SKBUV4HQ.js → relay-ZZWAUA6P.js} +9 -7
  150. package/dist/{relay-protocol-YSGHT7C4.js → relay-protocol-4GCTOIT4.js} +9 -7
  151. package/dist/{run-cmd-S7IQ6OVY.js → run-cmd-SCXMROKB.js} +20 -18
  152. package/dist/runner-agents-QS3IX55G.js +15 -0
  153. package/dist/runner-env-FU6EWMWW.js +26 -0
  154. package/dist/runner-identity-PUW27LAT.js +22 -0
  155. package/dist/{runner-key-OM2HCEVM.js → runner-key-5G2AJD57.js} +55 -53
  156. package/dist/session-sender-A46R3S66.js +46 -0
  157. package/dist/{setup-cmd-S4ZIVRRF.js → setup-cmd-OZS4QOPI.js} +18 -16
  158. package/dist/{setup-wiring-FRY6CKZ7.js → setup-wiring-G2RLSBQ6.js} +64 -62
  159. package/dist/{shell-function-7N3ILFLG.js → shell-function-6ZFAVOSM.js} +2 -2
  160. package/dist/{spec-cmd-PRGEIOJ7.js → spec-cmd-C4KSLTAD.js} +21 -19
  161. package/dist/{starter-pack-YVBD7AKE.js → starter-pack-G5TQVPMW.js} +7 -7
  162. package/dist/state-TCZAKBBZ.js +20 -0
  163. package/dist/{status-JORNKH3T.js → status-T6WDUAI4.js} +65 -53
  164. package/dist/{statusline-fast-ZWMTN36K.js → statusline-fast-VVJF5W7X.js} +3 -3
  165. package/dist/{sync-cmd-QVSAP72U.js → sync-cmd-ZYTJMWET.js} +24 -22
  166. package/dist/update-steps-PU34FN7N.js +85 -0
  167. package/dist/{watch-F2ELGBST.js → watch-VCKWAILU.js} +24 -22
  168. package/dist/{work-claim-cmd-LEM7P2ME.js → work-claim-cmd-7TR6LNIY.js} +27 -25
  169. package/dist/{work-cmd-M2RCHHKE.js → work-cmd-7KOXRPOJ.js} +20 -18
  170. package/dist/work-comment-cmd-EDXP3K7B.js +41 -0
  171. package/dist/{work-demo-cmd-FQMFCLZ6.js → work-demo-cmd-OYZTKNCG.js} +20 -18
  172. package/dist/{work-logs-cmd-KLPX4TYX.js → work-logs-cmd-P3QS5AFY.js} +20 -18
  173. package/dist/{work-mock-cmd-XJEG6AAT.js → work-mock-cmd-3QEXWV43.js} +20 -18
  174. package/dist/{work-needs-attention-cmd-BOINZLEQ.js → work-needs-attention-cmd-ZTQB2DXB.js} +20 -18
  175. package/dist/{work-no-change-cmd-IINJFYBD.js → work-no-change-cmd-FGHOOPLY.js} +20 -18
  176. package/dist/{work-open-pr-cmd-S2XL6OZV.js → work-open-pr-cmd-WFIPFVQR.js} +21 -19
  177. package/dist/work-pr-cmd-262GWNKI.js +36 -0
  178. package/dist/work-proofs-cmd-PAJSCMJ2.js +39 -0
  179. package/dist/{work-proofs-record-34VAOVND.js → work-proofs-record-A4NZTAME.js} +30 -28
  180. package/dist/{work-stop-cmd-HWG6IUFS.js → work-stop-cmd-CBRWKR4Q.js} +20 -18
  181. package/package.json +1 -1
  182. package/dist/agent-setup-KJVEDAHY.js +0 -41
  183. package/dist/bridge-UIT7F5DZ.js +0 -17
  184. package/dist/build-W2Z43HX5.js +0 -26
  185. package/dist/build-disk-AOY6DOEK.js +0 -21
  186. package/dist/builder-PHD5WM6J.js +0 -20
  187. package/dist/caller-WJVESIHQ.js +0 -23
  188. package/dist/docker-S6XFE42W.js +0 -20
  189. package/dist/emit-artifact-cmd-H3HULADF.js +0 -44
  190. package/dist/emit-criteria-cmd-UM3DXOOD.js +0 -35
  191. package/dist/emit-demo-cmd-BMAXX7M2.js +0 -47
  192. package/dist/emit-step-cmd-6TX7FGWI.js +0 -35
  193. package/dist/exec-client-H2AOUP6U.js +0 -18
  194. package/dist/fleet-readiness-YDRQPUI5.js +0 -31
  195. package/dist/governing-source-CLLOKTZF.js +0 -43
  196. package/dist/guest-init-PDLZDDB4.js +0 -20
  197. package/dist/host-checks-43WBI5JE.js +0 -82
  198. package/dist/host-key-AOUOQNV5.js +0 -18
  199. package/dist/init-IZJENDA6.js +0 -82
  200. package/dist/init-cmd-AL3ODKU6.js +0 -53
  201. package/dist/install-cmd-DMAMD7BD.js +0 -26
  202. package/dist/launch-agent-XAPO3FGT.js +0 -26
  203. package/dist/loop-Q5CTVY7B.js +0 -92
  204. package/dist/machine-55WUTHG3.js +0 -82
  205. package/dist/pending-PA5UWRHN.js +0 -18
  206. package/dist/pidfile-KOM3XD4E.js +0 -19
  207. package/dist/record-S2WGEUIM.js +0 -18
  208. package/dist/runner-agents-ZVIM6XVC.js +0 -14
  209. package/dist/runner-env-WD6CPYTN.js +0 -24
  210. package/dist/runner-identity-LDFFB6YB.js +0 -20
  211. package/dist/session-sender-IZP4E562.js +0 -44
  212. package/dist/state-LAKZKWCJ.js +0 -18
  213. package/dist/update-steps-LM3C7MG6.js +0 -83
  214. package/dist/work-comment-cmd-QGAY3QUN.js +0 -39
  215. package/dist/work-pr-cmd-6YTJRHVC.js +0 -34
  216. package/dist/work-proofs-cmd-OC3O264U.js +0 -37
  217. package/dist/{real-deps-B7NMEDXM.js → real-deps-HNNHF3UN.js} +1 -1
@@ -1,42 +1,44 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { readHousekeepingRecord, writeHousekeepingRecord } from './chunk-CVDB3ILT.js';
4
- import { fetchVersionMeta, npmVersion, npmSupportsProvenance, fetchTarballDigest, fetchProvenance, installVersion, auditSignatures } from './chunk-E7R2GIAW.js';
5
- import { reportFailedStart, fitImageBuildMemory } from './chunk-CQIJVNUB.js';
6
- import { renderUpdateSteps } from './chunk-P6GTJQMA.js';
3
+ import { writePendingUpdate } from './chunk-6SYVSIGA.js';
4
+ import { readHousekeepingRecord, writeHousekeepingRecord } from './chunk-JMSMNKCK.js';
7
5
  import { decideInstalledSwitch } from './chunk-TXKHD4Q6.js';
8
- import { writeFleetState } from './chunk-CHIKNMWU.js';
9
- import { writePendingUpdate } from './chunk-XC2ZN7UA.js';
10
- import { fleetConfigProblem, realBlockedProbes, checkBlockedWithSlots, askFleetMachine } from './chunk-GBCTYHZ4.js';
11
- import { writeMarker, readMarker, currentVersion, removeMarker, isInLayout, startedThroughCurrent, entryIn, versionDir, switchCurrent, cleanVersions, stagingDir } from './chunk-DCY6QUS6.js';
12
- import { leaseTimeLeftMs, createContainerRuntime, heldSandboxClaimsOf, unfinishedJobs, withTunnelLog, itemTag, releaseLease, runDecision, claimRun, LEASE_SECONDS, isUnfinished, prepareResume, restoreSessionIntoMicroVm, restoreSessionIntoContainer, restoreSessionIntoSandbox, restoreWork, keptSessionDir, workRestoredEnv, sessionGuestOfMicroVm, sessionGuestOfContainer, sessionGuestOfSandbox, recordsProofsOnly, itemScope, attemptNote, fetchManagedClaudeKey, holdManagedClaudeKey, fetchManagedBuildSettings, holdManagedBuildSettings, setStage, jobEnv, runHook, describeHookEnd, needsBuildSkill, provisionContainer, leaseExpiresAtMs, withJobTimeLimit, deliverContainerHooks, provisionSandbox, deliverSandboxHooks, provisionMicroVm, deliverCommitHooks, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, deliverExecMaven, runWithSpawn, hostCommandEnvironment, lifecycleSteps, execArgv, lifecycleFailureReason, decideHostBuildSkill, prepareBranch, keptCommitsLine, currentSkillCommand, formerSkillProblem, commandLogOffset, startSandboxCommand, MICROVM_COMMAND_DIR, startMicroVmCommand, microVmCommandLine, runCommand, containerCommandExec, execCommandLine, startSender, startHostServices, finishJob, sampleGuest, foldSample, isSandboxTracked, isContainerTracked, isMicroVmTracked, probeSandboxCommand, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, SandboxGoneError, SandboxContainerStoppedError, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isIsolatedJob, jobTimeLimitMinutes, isTimedOut, readCpuUsec, isIdle, HELPER_ENV, setUpRunnerCgroup, stopOrphanedMicroVms, sweepImageBuilders, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, GUEST_USAGE_INTERVAL_MS, vmAlive, filesAreCopied, inSandbox, listItemDisks, hookLimitsFor, runCommandOf, AttemptLogBook, environmentFor, builtOf, judgeCredential, readWorkItem, makeRecorder, microVmOomKills, needsRenew, renewRun, renewLease, RENEW_INTERVAL_SECONDS, stoppedHelperReason, measureDisk, listTrackedJobs, sweepSandboxes, keptSandboxIds, parseCpuList, ensureTunnel, keepGhConfigCurrent, restartSender, rejoinSandboxBuild, createHousekeepingDocker, housekeepingDockerIfReachable, runHousekeeping, shellQuote, jobRecordsClaim, freeItemDisksUntil, savedStatesDir, readRecords, holdsHostDisk, removeOldestUntil, treeFileText, scrubReason, timeoutAfter, ensureNetworkReady, ADOPTED_FETCH_RETRY_WINDOW_MS, managedBuildSettingsFor, gitRemoteFor, startServicesFor, installTrust, createLeaseChannel, serveLease, writeGuestGhConfig, deliverJobFiles, inTeardown } from './chunk-H7IY5B2M.js';
13
- import { RUNNER_PROTOCOL } from './chunk-HHOFP647.js';
14
- import { criteriaOf, diffLines, loadCitationFinder, wholeItems, itemsSentence, oneLineReason, parseJudgeAnswer, wholeEntries, treePath, lineInDiff } from './chunk-HMW3UCME.js';
15
- import { RepoFilter } from './chunk-MUDXPJT6.js';
16
- import { JOB_STATE_FORMAT, readsJobState, jobStateFormatOf } from './chunk-B4XB5QFD.js';
17
- import { imageTag, writeUpdateStatus, pullInstruction, tagToPull } from './chunk-WNX2RR5P.js';
6
+ import { fetchVersionMeta, npmVersion, npmSupportsProvenance, fetchTarballDigest, fetchProvenance, installVersion, auditSignatures } from './chunk-E7R2GIAW.js';
7
+ import { reportFailedStart, fitImageBuildMemory } from './chunk-A2AFTKMN.js';
8
+ import { renderUpdateSteps } from './chunk-SE5ZVVDJ.js';
9
+ import { writeFleetState } from './chunk-DXZ6QBUJ.js';
10
+ import { fleetConfigProblem, realBlockedProbes, checkBlockedWithSlots, askFleetMachine } from './chunk-YLDCYJRP.js';
11
+ import { writeMarker, readMarker, currentVersion, removeMarker, isInLayout, startedThroughCurrent, entryIn, versionDir, switchCurrent, cleanVersions, stagingDir } from './chunk-M4YTSRJI.js';
12
+ import { leaseTimeLeftMs, createContainerRuntime, heldSandboxClaimsOf, unfinishedJobs, withTunnelLog, itemTag, releaseLease, runDecision, claimRun, LEASE_SECONDS, isUnfinished, prepareResume, restoreSessionIntoMicroVm, restoreSessionIntoContainer, restoreSessionIntoSandbox, restoreWork, keptSessionDir, workRestoredEnv, sessionGuestOfMicroVm, sessionGuestOfContainer, sessionGuestOfSandbox, recordsProofsOnly, itemScope, attemptNote, noteMissingCredential, fetchManagedBuildSettings, holdManagedBuildSettings, setStage, jobEnv, runHook, describeHookEnd, needsBuildSkill, provisionContainer, leaseExpiresAtMs, withJobTimeLimit, deliverContainerHooks, provisionSandbox, deliverSandboxHooks, provisionMicroVm, deliverCommitHooks, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, deliverExecMaven, runWithSpawn, hostCommandEnvironment, lifecycleSteps, execArgv, lifecycleFailureReason, decideHostBuildSkill, prepareBranch, keptCommitsLine, runCommandFor, currentSkillCommand, formerSkillProblem, commandLogOffset, startSandboxCommand, MICROVM_COMMAND_DIR, startMicroVmCommand, microVmCommandLine, runCommand, containerCommandExec, execCommandLine, startSender, commandEndReasonOf, holdManagedKey, startHostServices, finishJob, sampleGuest, foldSample, isSandboxTracked, isContainerTracked, isMicroVmTracked, probeSandboxCommand, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, SandboxGoneError, SandboxContainerStoppedError, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isIsolatedJob, jobTimeLimitMinutes, isTimedOut, readCpuUsec, isIdle, HELPER_ENV, setUpRunnerCgroup, stopOrphanedMicroVms, sweepImageBuilders, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, GUEST_USAGE_INTERVAL_MS, vmAlive, filesAreCopied, inSandbox, listItemDisks, hookLimitsFor, runCommandOf, AttemptLogBook, fetchManagedModelKey, environmentFor, builtOf, judgeCredential, missingJudgeCredential, readWorkItem, makeRecorder, microVmOomKills, needsRenew, renewRun, renewLease, RENEW_INTERVAL_SECONDS, stoppedHelperReason, measureDisk, listTrackedJobs, sweepSandboxes, keptSandboxIds, parseCpuList, ensureTunnel, keepGhConfigCurrent, restartSender, rejoinSandboxBuild, createHousekeepingDocker, housekeepingDockerIfReachable, runHousekeeping, shellQuote, jobRecordsClaim, freeItemDisksUntil, savedStatesDir, readRecords, holdsHostDisk, removeOldestUntil, treeFileText, scrubReason, superviseRuns, NO_LOG, timeoutAfter, ensureNetworkReady, ADOPTED_FETCH_RETRY_WINDOW_MS, managedBuildSettingsFor, gitRemoteFor, startServicesFor, installTrust, createLeaseChannel, serveLease, writeGuestGhConfig, deliverJobFiles, inTeardown } from './chunk-RVUOSR2D.js';
13
+ import { criteriaOf, diffLines, loadCitationFinder, wholeItems, itemsSentence, oneLineReason, parseJudgeAnswer, wholeEntries, treePath, lineInDiff } from './chunk-YXKZGVUL.js';
14
+ import { RUNNER_PROTOCOL } from './chunk-QDJBEQCE.js';
15
+ import { imageTag, writeUpdateStatus, pullInstruction, tagToPull } from './chunk-3HH2AQKF.js';
18
16
  import { isVersion, compareVersions, satisfiesRange } from './chunk-TQMI335S.js';
19
- import { claimCalls, claimItem, spoolHomeFor, leftByRunnerKey, runnerCalls, itemCalls, configForJob } from './chunk-SQIFPWGN.js';
20
- import { fetchCommit, readBranchHead, diffBetween, readDefaultBranchFiles } from './chunk-BEPP2C3U.js';
21
- import { claimPidFile, releasePidFile, writePidFile, readPidFile } from './chunk-AQNL3XHS.js';
17
+ import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, resolveGoverningSource, BuildTokens, classifyRefusal, refusalCode, createRunnerLog, formatClock, readGovernedFiles } from './chunk-MYFC3HKP.js';
18
+ import { RepoFilter } from './chunk-QPC6OKD2.js';
19
+ import { JOB_STATE_FORMAT, readsJobState, jobStateFormatOf } from './chunk-B4XB5QFD.js';
20
+ import { claimCalls, claimItem, spoolHomeFor, leftByRunnerKey, runnerCalls, itemCalls, configForJob } from './chunk-PLVLC7SU.js';
21
+ import { fetchCommit, readBranchHead, diffBetween, readDefaultBranchFiles } from './chunk-VATN55FQ.js';
22
+ import { claimPidFile, releasePidFile, writePidFile, readPidFile } from './chunk-NPVIEJX6.js';
22
23
  import { startTimeOf, isSameProcess } from './chunk-JBJTC3UU.js';
23
- import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, resolveGoverningSource, BuildTokens, classifyRefusal, refusalCode, createRunnerLog, formatClock, readGovernedFiles } from './chunk-ZZN2TUHE.js';
24
- import { WorkCommandError, isSignatureRefusal, getJson, postJson, getBytes } from './chunk-YKVFVP4A.js';
25
- import { keyRunnerFactory, readsOnly, isBuiltinSandbox, isBuiltinContainer, isBuiltinVm, loadRunnerConfig, checkHooks, builtinKind, keepsHostBuilder, runnerDeliversComments, DEFAULT_CHECK_TIME_LIMIT_MINUTES, readOnlyRemoteOf, DEFAULT_SAVED_STATE_MAX_BYTES, DEFAULT_UPDATE_MAX_WAIT_HOURS, readOnlyOption } from './chunk-ZCFGRVGX.js';
26
- import { formatBytes, freeBytes } from './chunk-D6CU6N5S.js';
27
- import { writeJobFile, ensureRunnerIdentity, identityDockerFor, readJobFile, JUDGE_TREE, exceedsDisk, runnerLabelValue, builderName, ensureFailureCount, builderSpec, ensureBuilder, spawnRun, JUDGE_DIR, judgeCommand, JUDGE_MAX_TURNS } from './chunk-YVBJ74GP.js';
28
- import { loadHostKey, ensureHostKey, signerFor } from './chunk-F3P7DP7R.js';
29
- import { jobsDir, RUNNER_DIR_MODE, runnerDir, RUNNER_FILE_MODE, buildDir, attemptStamp, jobDir, pidFilePath, storeScopes } from './chunk-VXL7SLO3.js';
30
- import { parseClaimIdentity, parseBranchlessRepositories, parseClaimedRepositories, parseUnreachable, repositoriesOf, primaryOf, JOB_MOUNT, WORK_DIR } from './chunk-UHGU2EAK.js';
31
- import { jobCredentialProblem, COMMAND_LOST_REASON, takeAgentCredentials, heldAgentCredential, CONTAINER_STOPPED_REASON, currentAgentCredential, fdName } from './chunk-YZQDTL3T.js';
32
- import { cleanAttachmentName } from './chunk-7N6MB6NR.js';
33
- import { jobAgent, jobCommandEnv, runnerAgents, judgeAgent } from './chunk-MRM7CQJ3.js';
34
- import { defaultAgents, resolvePackRoot } from './chunk-LAO7LRIR.js';
24
+ import { WorkCommandError, isSignatureRefusal, getJson, postJson, getBytes } from './chunk-YLDHHHBJ.js';
25
+ import { keyRunnerFactory, readsOnly, isBuiltinSandbox, isBuiltinContainer, isBuiltinVm, loadRunnerConfig, checkHooks, builtinKind, keepsHostBuilder, runnerDeliversComments, DEFAULT_CHECK_TIME_LIMIT_MINUTES, readOnlyRemoteOf, DEFAULT_SAVED_STATE_MAX_BYTES, DEFAULT_UPDATE_MAX_WAIT_HOURS, readOnlyOption } from './chunk-VYF5BILX.js';
26
+ import { formatBytes, freeBytes } from './chunk-IOSONR7N.js';
27
+ import { writeJobFile, ensureRunnerIdentity, identityDockerFor, readJobFile, judgeProgram, JUDGE_TREE, exceedsDisk, runnerLabelValue, builderName, ensureFailureCount, builderSpec, ensureBuilder, spawnRun, JUDGE_DIR, judgeCommand, JUDGE_MAX_TURNS } from './chunk-YXUSSZAE.js';
28
+ import { loadHostKey, ensureHostKey, signerFor } from './chunk-I6G5CO3K.js';
29
+ import { jobsDir, RUNNER_DIR_MODE, runnerDir, RUNNER_FILE_MODE, buildDir, attemptStamp, jobDir, pidFilePath, storeScopes } from './chunk-D5TZYUGZ.js';
30
+ import { parseClaimIdentity, parseBranchlessRepositories, parseClaimedRepositories, parseUnreachable, repositoriesOf, primaryOf, JOB_MOUNT, WORK_DIR } from './chunk-WRIQGJKT.js';
31
+ import { COMMAND_LOST_REASON, AGENT_CREDENTIAL_MISSING, CONTAINER_STOPPED_REASON } from './chunk-GAHP2AI3.js';
32
+ import { reportedAgents, jobCredentialProblem, takeAgentCredentials, heldAgentCredential, currentAgentCredential, fdName } from './chunk-D47Z2Z7F.js';
33
+ import { cleanAttachmentName } from './chunk-EVAK6FAS.js';
34
+ import { jobAgentIdFor, commandAgentId, jobAgent, judgeAgent, commandForJob, withJobModel, jobCommandEnv, jobKeyProviders, agentsToHold, runnerAgents, listedAgents } from './chunk-QS2O5G64.js';
35
+ import { defaultAgents, resolvePackRoot } from './chunk-XMJNIIPM.js';
36
+ import { isModelId, PROVIDERS } from './chunk-Q7Z6ELTL.js';
35
37
  import { resolveVersion } from './chunk-RA3O54FC.js';
36
- import { CheckItemsSchema, CODE_REVIEW_NAME, CHECK_ITEM_HREF_MAX_LENGTH, CHECK_ITEM_REASON_MAX_LENGTH, UNREVIEWED_FILES_ITEM_ID, problemKind, CODE_REVIEW_PROBLEMS_MAX, TEAM_RULES_ITEM_ID, REVIEWED_COMMIT_ITEM_ID, PROBLEM_KINDS, problemSeverity } from './chunk-6IGOHB3O.js';
38
+ import { CheckItemsSchema, CODE_REVIEW_NAME, CHECK_ITEM_HREF_MAX_LENGTH, CHECK_ITEM_REASON_MAX_LENGTH, UNREVIEWED_FILES_ITEM_ID, problemKind, CODE_REVIEW_PROBLEMS_MAX, TEAM_RULES_ITEM_ID, REVIEWED_COMMIT_ITEM_ID, PROBLEM_KINDS, problemSeverity } from './chunk-37WA2LQC.js';
37
39
  import { randomBytes, createHash } from 'crypto';
38
40
  import { mkdirSync, existsSync, writeFileSync, chmodSync, renameSync, statSync, readdirSync, rmSync, readFileSync, lstatSync, closeSync } from 'fs';
39
- import { totalmem, userInfo, constants } from 'os';
41
+ import { totalmem, userInfo } from 'os';
40
42
  import { join, dirname } from 'path';
41
43
 
42
44
  createRequire(import.meta.url);
@@ -177,6 +179,8 @@ async function callFleetRoute(ports, memory, room, images, disks) {
177
179
  claims: ports.claims(),
178
180
  cliVersion: ports.cliVersion,
179
181
  runnerProtocol: RUNNER_PROTOCOL,
182
+ // A fleet machine is a managed runner whatever the config says: it reports the agents a managed runner builds with, Codex among them.
183
+ agents: reportedAgents({ ...config, fleet: true }, process.env),
180
184
  // The first accepted call binds the machine to this host's key; the calls after it are signed and need not repeat it.
181
185
  ...memory.bound ? {} : { hostKey: hostKey.hostKey }
182
186
  };
@@ -433,7 +437,7 @@ function takesBody(takes) {
433
437
  };
434
438
  const include = list(takes.repos.include);
435
439
  const exclude = list(takes.repos.exclude);
436
- return { queues: takes.queues, repos: { include, exclude }, truncated, ...takes.runs === void 0 ? {} : { runs: takes.runs } };
440
+ return { queues: takes.queues, repos: { include, exclude }, truncated, ...takes.runs === void 0 ? {} : { runs: takes.runs }, ...takes.agents === void 0 ? {} : { agents: takes.agents } };
437
441
  }
438
442
  async function sendHeartbeat(args, fetchImpl) {
439
443
  const body = {
@@ -1273,7 +1277,10 @@ var CRITERIA_PROMPT = "/outerlayer-criteria";
1273
1277
  function criteriaCommandOf(config, agents = defaultAgents()) {
1274
1278
  const command = config.commands.implement ?? config.commands.amend;
1275
1279
  if (command === void 0) return void 0;
1276
- return jobAgent({ command }, agents)?.adapter.headless?.commandLine(CRITERIA_PROMPT, "revise");
1280
+ return criteriaCommandFor(jobAgent({ command }, agents));
1281
+ }
1282
+ function criteriaCommandFor(agent) {
1283
+ return agent?.adapter.headless?.commandLine(CRITERIA_PROMPT, "revise");
1277
1284
  }
1278
1285
  var criteriaIsolation = reviseIsolation;
1279
1286
  function takesCriteria(config, agents = defaultAgents()) {
@@ -1915,8 +1922,10 @@ function reviewIsolation(config) {
1915
1922
  function takesReview(config, agents = defaultAgents()) {
1916
1923
  if (reviewIsolation(config) === void 0) return false;
1917
1924
  if (!config.queues.includes("implement") && !config.queues.includes("amend")) return false;
1918
- const agent = judgeAgent(agents);
1919
- return agent?.adapter.headless !== void 0 && agent.adapter.image?.program !== void 0;
1925
+ return listedAgents(config, agents).some((id) => {
1926
+ const judge = judgeAgent(agents, { agent: id });
1927
+ return judge?.adapter.headless?.judge !== void 0 && judge.adapter.image?.program !== void 0;
1928
+ });
1920
1929
  }
1921
1930
  function reviewAnswerProtocol(brief, answer, teamRules = false) {
1922
1931
  const kinds = `"bug"|"security"|"data"|"test"|"docs"|"comment"${teamRules ? '|"rule"' : ""}`;
@@ -1944,15 +1953,17 @@ function parseReviewAnswer(text2) {
1944
1953
  const parsed = parseJudgeAnswer(JSON.stringify({ ...rest, items: problems.map((problem) => ({ ...Object(problem), result: "fail" })) }));
1945
1954
  return parsed?.ok === false ? { ok: false, reason: parsed.reason.replace("the judge's items.json", "the reviewer's answer") } : parsed;
1946
1955
  }
1947
- function readReviewerEnd(run, minutes, agents = defaultAgents()) {
1956
+ function readReviewerEnd(run, minutes, agents = defaultAgents(), job) {
1948
1957
  if (run.kind === "timeout") return { finished: false, reason: `the review ran out of time after ${minutes}` };
1949
- const output = judgeAgent(agents)?.adapter.headless?.readJudgeOutput(run.stdout);
1958
+ if (run.kind === "capped") return { finished: false, reason: `the review reached the turn limit of ${JUDGE_MAX_TURNS} turns` };
1959
+ const output = judgeAgent(agents, job)?.adapter.headless?.readJudgeOutput?.(run.stdout, { status: run.status });
1950
1960
  if (output === void 0) {
1951
1961
  const said = run.stderr.split("\n").find((line) => line.trim() !== "")?.trim() ?? "";
1952
1962
  return { finished: false, reason: `the review exited ${run.status} and printed no reply${said === "" ? "" : `: ${said}`}` };
1953
1963
  }
1954
1964
  const usage = output.usage === void 0 ? {} : { usage: output.usage };
1955
1965
  if (output.kind === "turn-limit") return { finished: false, reason: `the review reached the turn limit of ${JUDGE_MAX_TURNS} turns`, ...usage };
1966
+ if (output.kind === "unfinished") return { finished: false, reason: `the review did not finish: ${output.reason}`, ...usage };
1956
1967
  return { finished: true, ...usage };
1957
1968
  }
1958
1969
  function instructionsHash(shipped, teamRulesText) {
@@ -1985,14 +1996,15 @@ async function runReviewJob(input) {
1985
1996
  const head = job.reviewCommit;
1986
1997
  const repository = job.repository ?? job.repositories?.[0]?.repository;
1987
1998
  if (head === void 0 || repository === void 0) return await notRun("the claim names no commit to review");
1988
- const agent = judgeAgent(runtime.agents);
1999
+ const agent = judgeAgent(runtime.agents, job);
1989
2000
  if (agent?.adapter.headless === void 0) return await notRun(`${agent?.descriptor.label ?? "the agent list"} has no headless part, so it cannot run the review`);
1990
2001
  const environment = environmentFor({ config, job, jobDir: jobDir2, deps });
1991
2002
  if (environment === void 0) return await notRun("the review job has no container, microVM or sandbox to run in");
1992
2003
  const expected = builtOf(job)?.judgeProgram;
1993
2004
  if (expected === void 0) return await notRun(`the image has no ${agent.descriptor.label} for the review`);
1994
- const credential = judgeCredential(config, jobDir2, runtime);
1995
- if (credential === void 0) return await notRun(`the host holds no ${agent.descriptor.credentials.label} credential for the review`);
2005
+ if (expected.path !== judgeProgram(runtime.agents, job)) return await notRun(`the build recorded ${expected.path} as its judge's program, and this runner reviews with ${agent.descriptor.label}; rerun the item`);
2006
+ const credential = judgeCredential(config, jobDir2, runtime, job);
2007
+ if (credential === void 0) return await notRun(missingJudgeCredential(config, runtime, "review", job));
1996
2008
  const tokens = runtime.credentials.get(jobDir2);
1997
2009
  if (tokens === void 0) return await notRun("the job's repository tokens are not held, so the commit cannot be fetched");
1998
2010
  const readToken = await tokens.token("read");
@@ -2051,7 +2063,7 @@ async function runReviewJob(input) {
2051
2063
  const answerName = index === 0 ? "items.json" : `items-${territory.name}.json`;
2052
2064
  return { territory, answerName, logName: index === 0 ? "review.log" : `review-${territory.name}.log`, prompt: reviewAnswerProtocol(withTeamRules(territoryBrief(instructions.brief, territory), rules), `${JUDGE_DIR}/${answerName}`, rules !== void 0) };
2053
2065
  });
2054
- const reviewed = await reviewSideBySide({ environment, files, tree: treeDir, runs: reviewerRuns, credential, limitMinutes, minutes, jobDir: jobDir2, deps, tag });
2066
+ const reviewed = await reviewSideBySide({ environment, files, tree: treeDir, runs: reviewerRuns, credential, limitMinutes, minutes, jobDir: jobDir2, deps, tag, job });
2055
2067
  if (!reviewed.ok) return await notRun(reviewed.reason);
2056
2068
  if (input.ending()) return { kind: "ended" };
2057
2069
  let ownTree = false;
@@ -2110,7 +2122,7 @@ async function runReviewJob(input) {
2110
2122
  name: run.territory.name,
2111
2123
  ...run.end.usage?.turns === void 0 ? {} : { turns: run.end.usage.turns },
2112
2124
  seconds: run.end.usage?.durationMs === void 0 ? run.seconds : run.end.usage.durationMs / 1e3,
2113
- ...run.end.usage?.costUsd === void 0 ? {} : { costUsd: run.end.usage.costUsd },
2125
+ ...(run.end.usage?.costUsd ?? run.costUsd) === void 0 ? {} : { costUsd: run.end.usage?.costUsd ?? run.costUsd },
2114
2126
  // A reviewer that stopped early or wrote no answer proves nothing about a problem that it did not report.
2115
2127
  answered: parseReviewAnswer(run.text)?.ok === true && run.end.finished
2116
2128
  })),
@@ -2167,7 +2179,8 @@ async function runReviewJob(input) {
2167
2179
  minutes,
2168
2180
  jobDir: jobDir2,
2169
2181
  deps,
2170
- tag
2182
+ tag,
2183
+ job
2171
2184
  });
2172
2185
  if (!run.ok) return unchanged("failed", run.reason);
2173
2186
  const { end, text: written } = run.runs[0];
@@ -2193,11 +2206,36 @@ async function reviewSideBySide(input) {
2193
2206
  } catch (err) {
2194
2207
  return { ok: false, reason: `the review could not be prepared: ${describeCallFailure(err)}` };
2195
2208
  }
2196
- const started = input.runs.map(({ territory, prompt, answerName, logName }) => {
2197
- const answer = `${JUDGE_DIR}/${answerName}`;
2198
- const command = judgeCommand({ brief: prompt, credential: input.credential, effort: REVIEW_EFFORT, answer }, deps.runtime.agents);
2209
+ const clear = async () => {
2210
+ await environment.clear?.().catch((err) => deps.log.error(`${tag} what the review left in its folder could not be removed: ${describeCallFailure(err)}`));
2211
+ };
2212
+ const supervised = judgeAgent(deps.runtime.agents, input.job)?.adapter.headless?.judgeSupervised === true;
2213
+ const named = input.runs.map((planned) => ({
2214
+ ...planned,
2215
+ credential: supervised ? { ...input.credential, placeholder: `${input.credential.placeholder}-${planned.territory.name}` } : input.credential
2216
+ }));
2217
+ let supervision;
2218
+ let commands;
2219
+ try {
2220
+ commands = named.map(({ prompt, answerName, credential }) => {
2221
+ const answer = `${JUDGE_DIR}/${answerName}`;
2222
+ return judgeCommand({ brief: prompt, credential, effort: REVIEW_EFFORT, answer, job: input.job }, deps.runtime.agents);
2223
+ });
2224
+ supervision = await superviseRuns({
2225
+ run: (command) => environment.run(command, { logPath: NO_LOG }),
2226
+ tunnels: deps.runtime.tunnels,
2227
+ agents: deps.runtime.agents,
2228
+ job: input.job,
2229
+ runs: Object.fromEntries(named.map(({ territory, answerName, credential }) => [territory.name, { answer: `${JUDGE_DIR}/${answerName}`, subject: `the ${territory.name} review`, key: credential.placeholder }]))
2230
+ });
2231
+ } catch (err) {
2232
+ await clear();
2233
+ return { ok: false, reason: `the review could not be started: ${describeCallFailure(err)}` };
2234
+ }
2235
+ const started = named.map(({ territory, answerName, logName }, index) => {
2236
+ const command = commands[index];
2199
2237
  const began = now().getTime();
2200
- const run = { territory, answerName, began, seconds: void 0, outcome: void 0 };
2238
+ const run = { territory, answerName, began, seconds: void 0, outcome: void 0, checked: void 0 };
2201
2239
  const settled = environment.run(command, { logPath: join(input.jobDir, logName) }).then(
2202
2240
  (result) => result,
2203
2241
  (err) => err instanceof Error ? err : new Error(String(err))
@@ -2205,18 +2243,27 @@ async function reviewSideBySide(input) {
2205
2243
  void settled.then((outcome) => {
2206
2244
  run.outcome = outcome;
2207
2245
  run.seconds = (now().getTime() - began) / 1e3;
2246
+ run.checked = supervision?.ended(territory.name);
2208
2247
  });
2209
2248
  return { run, settled };
2210
2249
  });
2211
2250
  const timer = timeoutAfter(input.limitMinutes * 6e4, deps.sleep);
2212
- let timedOut;
2251
+ let ended;
2252
+ let discarded;
2213
2253
  try {
2214
- timedOut = await Promise.race([Promise.all(started.map((entry) => entry.settled)).then(() => "done"), timer.done]) === "timeout";
2254
+ ended = await Promise.race([Promise.all(started.map((entry) => entry.settled)).then(() => "done"), timer.done, ...supervision === void 0 ? [] : [supervision.capped]]);
2255
+ discarded = await Promise.all(started.map(({ run }) => run.checked ?? supervision?.ended(run.territory.name)));
2256
+ const later = await supervision?.finished() ?? /* @__PURE__ */ new Map();
2257
+ discarded = discarded.map((reason, index) => reason ?? later.get(started[index].run.territory.name));
2258
+ } catch (err) {
2259
+ supervision?.release();
2260
+ throw err;
2215
2261
  } finally {
2216
2262
  timer.cancel();
2217
2263
  }
2218
2264
  const answers = await Promise.all(
2219
- started.map(async ({ run }) => {
2265
+ started.map(async ({ run }, index) => {
2266
+ if (discarded[index] !== void 0) return void 0;
2220
2267
  try {
2221
2268
  return await environment.readItems(run.answerName);
2222
2269
  } catch (err) {
@@ -2225,8 +2272,16 @@ async function reviewSideBySide(input) {
2225
2272
  }
2226
2273
  })
2227
2274
  );
2228
- if (timedOut) await environment.stop().catch((err) => deps.log.error(`${tag} the review could not be stopped after its time ran out: ${describeCallFailure(err)}`));
2229
- await environment.clear?.().catch((err) => deps.log.error(`${tag} what the review left in its folder could not be removed: ${describeCallFailure(err)}`));
2275
+ started.forEach(({ run }, index) => {
2276
+ if (run.outcome === void 0 || run.outcome instanceof Error) return;
2277
+ const changed = supervision?.answerChanged(run.territory.name, answers[index]);
2278
+ if (changed === void 0) return;
2279
+ discarded[index] = changed;
2280
+ answers[index] = void 0;
2281
+ });
2282
+ if (ended !== "done") await environment.stop().catch((err) => deps.log.error(`${tag} the review could not be stopped after ${ended === "timeout" ? "its time ran out" : "it reached its turn limit"}: ${describeCallFailure(err)}`));
2283
+ supervision?.release();
2284
+ await clear();
2230
2285
  const first = started[0].run.outcome;
2231
2286
  if (first instanceof Error) return { ok: false, reason: `the review could not be run: ${describeCallFailure(first)}` };
2232
2287
  return {
@@ -2234,8 +2289,16 @@ async function reviewSideBySide(input) {
2234
2289
  runs: started.map(({ run }, index) => {
2235
2290
  const outcome = run.outcome;
2236
2291
  if (outcome instanceof Error) deps.log.error(`${tag} the ${run.territory.name} review could not be run: ${describeCallFailure(outcome)}`);
2237
- const ran = outcome === void 0 ? { kind: "timeout" } : outcome instanceof Error ? { kind: "exited", status: 1, stdout: "", stderr: outcome.message } : { kind: "exited", status: outcome.status, stdout: outcome.stdout, stderr: outcome.stderr };
2238
- return { territory: run.territory, end: readReviewerEnd(ran, input.minutes, deps.runtime.agents), text: answers[index], seconds: run.seconds ?? (now().getTime() - run.began) / 1e3 };
2292
+ const ran = outcome === void 0 ? ended === "capped" ? { kind: "capped" } : { kind: "timeout" } : outcome instanceof Error ? { kind: "exited", status: 1, stdout: "", stderr: outcome.message } : { kind: "exited", status: outcome.status, stdout: outcome.stdout, stderr: outcome.stderr };
2293
+ const end = discarded[index] === void 0 ? readReviewerEnd(ran, input.minutes, deps.runtime.agents, input.job) : { finished: false, reason: discarded[index] };
2294
+ const costUsd = supervision?.costUsd(run.territory.name);
2295
+ return {
2296
+ territory: run.territory,
2297
+ end,
2298
+ text: supervision !== void 0 && !end.finished ? void 0 : answers[index],
2299
+ seconds: run.seconds ?? (now().getTime() - run.began) / 1e3,
2300
+ ...costUsd === void 0 ? {} : { costUsd }
2301
+ };
2239
2302
  })
2240
2303
  };
2241
2304
  }
@@ -2302,57 +2365,6 @@ function startWaiting(ports) {
2302
2365
  })();
2303
2366
  return { stop: () => controller.abort() };
2304
2367
  }
2305
- function linuxSignalName(number) {
2306
- const names = {
2307
- 1: "SIGHUP",
2308
- 2: "SIGINT",
2309
- 3: "SIGQUIT",
2310
- 4: "SIGILL",
2311
- 5: "SIGTRAP",
2312
- 6: "SIGABRT",
2313
- 7: "SIGBUS",
2314
- 8: "SIGFPE",
2315
- 9: "SIGKILL",
2316
- 10: "SIGUSR1",
2317
- 11: "SIGSEGV",
2318
- 12: "SIGUSR2",
2319
- 13: "SIGPIPE",
2320
- 14: "SIGALRM",
2321
- 15: "SIGTERM",
2322
- 16: "SIGSTKFLT",
2323
- 17: "SIGCHLD",
2324
- 18: "SIGCONT",
2325
- 19: "SIGSTOP",
2326
- 20: "SIGTSTP",
2327
- 21: "SIGTTIN",
2328
- 22: "SIGTTOU",
2329
- 23: "SIGURG",
2330
- 24: "SIGXCPU",
2331
- 25: "SIGXFSZ",
2332
- 26: "SIGVTALRM",
2333
- 27: "SIGPROF",
2334
- 28: "SIGWINCH",
2335
- 29: "SIGIO",
2336
- 30: "SIGPWR",
2337
- 31: "SIGSYS"
2338
- };
2339
- return names[number];
2340
- }
2341
- function hostSignalName(number) {
2342
- return Object.entries(constants.signals).find(([, value]) => value === number)?.[0];
2343
- }
2344
- function notEndedByRunnerReason(exit, isolated) {
2345
- if (exit.signal !== null) {
2346
- return `the command was killed by ${exit.signal} on the host; the runner did not end it`;
2347
- }
2348
- const number = exit.code - 128;
2349
- const name = isolated ? linuxSignalName(number) : hostSignalName(number);
2350
- if (name === void 0) return void 0;
2351
- return `the command exited ${exit.code}, the status of a process killed by ${name}; the runner did not end it`;
2352
- }
2353
- function jobNotEndedByRunnerReason(exit, job) {
2354
- return notEndedByRunnerReason(exit, job.container !== void 0 || job.microvm !== void 0 || job.sandbox !== void 0);
2355
- }
2356
2368
  var HelperInUseError = class extends Error {
2357
2369
  constructor(socketPath, holder) {
2358
2370
  super(
@@ -2490,12 +2502,12 @@ function deriveRepo(item) {
2490
2502
  const repoPart = hash === -1 ? item.trackerKey : item.trackerKey.slice(0, hash);
2491
2503
  return repoPart === "" ? void 0 : `${host}/${repoPart}`;
2492
2504
  }
2493
- async function listStartable(config, queue, fetchImpl, cursor = null) {
2505
+ async function listStartable(config, queue, fetchImpl, cursor = null, agents) {
2494
2506
  const isolation = readsOnly(queue) ? agentJobIsolation(config, queue) : void 0;
2495
2507
  const query = queue === "amend" ? "needs=amend&startable=true" : queue === "revise" ? `needs=revise&startable=true${isolation === void 0 ? "" : `&isolation=${isolation}`}` : queue === "review" || queue === "criteria" ? `needs=${queue}&startable=true&runnerProtocol=${RUNNER_PROTOCOL}${isolation === void 0 ? "" : `&isolation=${isolation}`}` : "startable=true";
2496
2508
  const page = await getJson(
2497
2509
  config.url,
2498
- `/v1/work-items?${query}${cursor === null ? "" : `&cursor=${encodeURIComponent(cursor)}`}`,
2510
+ `/v1/work-items?${query}${agents === void 0 ? "" : `&agents=${encodeURIComponent(agents.join(","))}`}${cursor === null ? "" : `&cursor=${encodeURIComponent(cursor)}`}`,
2499
2511
  config.apiKey,
2500
2512
  keyRunnerFactory(config),
2501
2513
  fetchImpl,
@@ -2584,7 +2596,7 @@ async function sendTickHeartbeat(state, workRequest, wake2 = false) {
2584
2596
  }),
2585
2597
  // Left out unless a draining runner has builds to wait on, so the gateway stores null.
2586
2598
  waitingItems: waitingItems.length > 0 ? waitingItems : void 0,
2587
- takes: { queues: takenQueues(state), repos: { include: state.config.repos?.include, exclude: state.config.repos?.exclude }, runs: runDecision(state.config, state.deps.agents).takes },
2599
+ takes: { queues: takenQueues(state), repos: { include: state.config.repos?.include, exclude: state.config.repos?.exclude }, runs: runDecision(state.config, state.deps.agents).takes, agents: reportedAgents(state.config, process.env, state.deps.agents) },
2588
2600
  selfUpdate: selfUpdateReport(state),
2589
2601
  deliversComments: runnerDeliversComments(state.config)
2590
2602
  },
@@ -3432,7 +3444,7 @@ async function runTick(state) {
3432
3444
  do {
3433
3445
  let page;
3434
3446
  try {
3435
- page = await listStartable(state.config, queue, state.deps.fetchImpl, cursor);
3447
+ page = await listStartable(state.config, queue, state.deps.fetchImpl, cursor, reportedAgents(state.config, process.env, state.deps.agents));
3436
3448
  reportRepeating(state, "the work item list", void 0);
3437
3449
  state.lastWorkRequest = { ok: true };
3438
3450
  } catch (err) {
@@ -3558,7 +3570,7 @@ var CLAIM_REFUSAL_CODES = new Set(
3558
3570
  "pull_request_from_fork pull_request_on_default_branch pull_request_ambiguous pull_request_repository_not_connected repository_not_reachable branch_claimed_elsewhere".split(" ")
3559
3571
  );
3560
3572
  async function tryClaimAndStart(state, item, queue) {
3561
- const { postJson: postJson2 } = await import('./work-cmd-M2RCHHKE.js');
3573
+ const { postJson: postJson2 } = await import('./work-cmd-7KOXRPOJ.js');
3562
3574
  const log = logOf(state);
3563
3575
  const hostKey = await loadHostKey(state.config.configPath);
3564
3576
  const claim = await retrySend(
@@ -3573,6 +3585,7 @@ async function tryClaimAndStart(state, item, queue) {
3573
3585
  seconds: LEASE_SECONDS,
3574
3586
  runnerProtocol: RUNNER_PROTOCOL,
3575
3587
  cliVersion: state.deps.cliVersion ?? resolveVersion(),
3588
+ agents: reportedAgents(state.config, process.env, state.deps.agents),
3576
3589
  ...readsOnly(queue) && agentJobIsolation(state.config, queue) !== void 0 ? { isolation: agentJobIsolation(state.config, queue) } : {},
3577
3590
  ...hostKey === void 0 ? {} : { hostKey: hostKey.hostKey }
3578
3591
  },
@@ -3587,6 +3600,10 @@ async function tryClaimAndStart(state, item, queue) {
3587
3600
  log.line(`#${item.number} skipped: ${claim.code} \xB7 ${claim.message ?? claim.reason}`);
3588
3601
  return { kind: "held" };
3589
3602
  }
3603
+ if (claim.code === "agent_not_offered") {
3604
+ log.line(`#${item.number} skipped: ${claim.message ?? claim.reason}`);
3605
+ return { kind: "held" };
3606
+ }
3590
3607
  if (claim.code === "claim_not_held" || claim.reason.includes("(409)") || /work_item_claimed|held by/i.test(claim.reason)) {
3591
3608
  log.line(`#${item.number} claim refused: ${claim.reason}`);
3592
3609
  return { kind: "held" };
@@ -3596,7 +3613,11 @@ async function tryClaimAndStart(state, item, queue) {
3596
3613
  reportRepeating(state, "the request signature", claim.message ?? claim.reason);
3597
3614
  return { kind: "signature" };
3598
3615
  }
3599
- if (claim.code === "managed_credential_missing" || claim.code === "managed_builds_off") {
3616
+ if (claim.code === "managed_credential_missing") {
3617
+ reportRepeating(state, "the managed build", claim.message ?? claim.reason);
3618
+ return { kind: "held" };
3619
+ }
3620
+ if (claim.code === "managed_builds_off") {
3600
3621
  reportRepeating(state, "the managed build", claim.message ?? claim.reason);
3601
3622
  return { kind: "managed_refused" };
3602
3623
  }
@@ -3707,7 +3728,7 @@ async function startClaimedBuild(state, item, queue, data, fleet) {
3707
3728
  for (const entry of parseUnreachable(data.unreachable)) {
3708
3729
  log.line(`${tag}: ${entry.repository} is left out of this build because its GitHub App installation is suspended`);
3709
3730
  }
3710
- const starting = startJob(state, item, queue, claimId, itemKey, branch, identity, repositories, fleet, data.freshDisk === true, data.diskHeldElsewhere === true, data.codeReview === true, void 0, data.continueSession === true, review);
3731
+ const starting = startJob(state, item, queue, claimId, itemKey, branch, identity, repositories, fleet, data.freshDisk === true, data.diskHeldElsewhere === true, data.codeReview === true, void 0, data.continueSession === true, review, claimedAgentOf(data));
3711
3732
  const endStranded = async (err) => {
3712
3733
  const stranded = [...state.jobs.values()].find((active) => active.job.claimId === claimId);
3713
3734
  if (stranded === void 0) return false;
@@ -3804,7 +3825,13 @@ function buildUserGuestOf(state, job) {
3804
3825
  if (job.sandbox !== void 0) return sessionGuestOfSandbox(runtimeOf(state), job.sandbox);
3805
3826
  return void 0;
3806
3827
  }
3807
- async function startJob(state, item, queue, claimId, itemKey, branch, identity, claimed, fleet, freshDisk, diskHeldElsewhere, codeReview, run, continueSession, review) {
3828
+ function claimedAgentOf(data) {
3829
+ return {
3830
+ ...typeof data.agent === "string" && data.agent !== "" ? { agent: data.agent } : {},
3831
+ ...typeof data.model === "string" && isModelId(data.model) ? { model: data.model } : {}
3832
+ };
3833
+ }
3834
+ async function startJob(state, item, queue, claimId, itemKey, branch, identity, claimed, fleet, freshDisk, diskHeldElsewhere, codeReview, run, continueSession, review, claimedAgent) {
3808
3835
  const log = logOf(state);
3809
3836
  const startedAt = nowOf(state);
3810
3837
  const repositories = repositoriesOf({ repositories: claimed, repository: item.specRepository, branch });
@@ -3814,7 +3841,16 @@ async function startJob(state, item, queue, claimId, itemKey, branch, identity,
3814
3841
  const runnerRoot = runnerDir(state.config.configPath);
3815
3842
  const jobFilePath = join(dirPath, "job.json");
3816
3843
  const configuredCommand = queueCommand(state, queue);
3817
- const jobAgentId = jobAgent({ command: queue === "run" ? state.config.commands.implement : configuredCommand }, state.deps.agents)?.descriptor.id;
3844
+ const reported = reportedAgents(state.config, process.env, state.deps.agents);
3845
+ const jobAgentId = jobAgentIdFor(
3846
+ { queue, claimedAgent: claimedAgent?.agent, config: state.config, reported, command: configuredCommand, managed: state.config.fleet === true, runConfigured: state.config.commands.run !== void 0 },
3847
+ state.deps.agents
3848
+ );
3849
+ const queueAgent = queue === "implement" ? commandAgentId(state.config, state.deps.agents) : jobAgent({ command: configuredCommand }, state.deps.agents)?.descriptor.id;
3850
+ if ((queue === "implement" || queue === "amend" || queue === "revise") && claimedAgent?.agent === void 0 && jobAgentId !== void 0 && queueAgent !== void 0 && jobAgentId !== queueAgent) {
3851
+ log.line(`${itemTag({ item: item.number, claimId })} the item names no agent, and this runner holds no credential for ${queueAgent}, so it builds with ${jobAgentId}`);
3852
+ }
3853
+ const jobModel = queue === "implement" || queue === "amend" || queue === "revise" ? claimedAgent?.model : void 0;
3818
3854
  let job = {
3819
3855
  stateFormat: state.deps.jobStateFormat ?? JOB_STATE_FORMAT,
3820
3856
  item: item.number,
@@ -3835,6 +3871,7 @@ async function startJob(state, item, queue, claimId, itemKey, branch, identity,
3835
3871
  ...fleet === void 0 ? {} : { appId: fleet.appId, organizationId: fleet.organizationId, size: fleet.size },
3836
3872
  ...primary === void 0 ? {} : { repository: primary.repository, repositories },
3837
3873
  ...jobAgentId === void 0 ? {} : { agent: jobAgentId },
3874
+ ...jobModel === void 0 ? {} : { model: jobModel },
3838
3875
  startedAt: startedAt.toISOString(),
3839
3876
  timeLimitMinutes: state.config.timeLimitMinutes
3840
3877
  };
@@ -3877,20 +3914,26 @@ async function startJob(state, item, queue, claimId, itemKey, branch, identity,
3877
3914
  return;
3878
3915
  }
3879
3916
  if (active.ending) return;
3880
- const credentialProblem = state.config.fleet === true ? void 0 : jobCredentialProblem(jobAgent(active.job, state.deps.agents), process.env, state.deps.agents);
3917
+ const credentialOwner = active.job.queue === "review" ? judgeAgent(state.deps.agents, active.job) : jobAgent(active.job, state.deps.agents);
3918
+ const credentialProblem = state.config.fleet === true ? void 0 : jobCredentialProblem(credentialOwner, { ...process.env, ...runtimeOf(state).hostEnv }, state.deps.agents);
3881
3919
  if (credentialProblem !== void 0) {
3882
3920
  log.error(`${tag} ${credentialProblem} \xB7 ending job as failed`);
3883
- await endJob(state, active, "failed", { stage: "provision", reason: credentialProblem });
3921
+ noteMissingCredential(active.dirPath, { ...process.env, ...runtimeOf(state).hostEnv }, state.deps.agents, active.job);
3922
+ await endJob(state, active, "failed", { stage: "provision", reason: AGENT_CREDENTIAL_MISSING });
3884
3923
  return;
3885
3924
  }
3886
3925
  if (state.config.fleet === true) {
3887
- const fetched = await fetchManagedClaudeKey(claimCalls(state.config, active.job), claimItem(state.config, active.job), { fetchImpl: state.deps.fetchImpl, now: state.deps.now, sleep: state.deps.sleep });
3926
+ const held = await holdManagedKeys(state, active.job, dirPath, {});
3888
3927
  if (active.ending) return;
3889
- if (!fetched.ok) {
3890
- await endOnManagedRefusal(state, active, fetched, { what: "Anthropic key", was: "was" });
3928
+ if (!held.ok) {
3929
+ if (held.mismatch !== void 0) {
3930
+ log.error(`${tag} ${held.mismatch} \xB7 ending job as failed`);
3931
+ await endJob(state, active, "failed", { stage: "provision", reason: held.mismatch });
3932
+ return;
3933
+ }
3934
+ await endOnManagedRefusal(state, active, held.refused, { what: held.what, was: "was" });
3891
3935
  return;
3892
3936
  }
3893
- holdManagedClaudeKey(dirPath, fetched.apiKey);
3894
3937
  const settings = await fetchManagedBuildSettings(claimCalls(state.config, active.job), claimItem(state.config, active.job), { fetchImpl: state.deps.fetchImpl, now: state.deps.now, sleep: state.deps.sleep });
3895
3938
  if (active.ending) return;
3896
3939
  if (!settings.ok) {
@@ -4279,9 +4322,13 @@ async function startJob(state, item, queue, claimId, itemKey, branch, identity,
4279
4322
  }).catch((err) => log.error(`${tag} the code review could not be ended cleanly: ${describeCallFailure(err)}`));
4280
4323
  return;
4281
4324
  }
4282
- const configured = queueCommand(state, queue);
4283
- const cmdline = configured === void 0 ? void 0 : currentSkillCommand(configured);
4284
- if (cmdline !== configured) log.line(`${tag} ${formerSkillProblem([queue])}`);
4325
+ const queued = queue === "criteria" ? criteriaCommandFor(jobAgent(active.job, state.deps.agents)) : queue === "run" && state.config.commands.run === void 0 ? runCommandFor(jobAgent(active.job, state.deps.agents)) : queueCommand(state, queue);
4326
+ const configured = commandForJob(queue, queued, jobAgent(active.job, state.deps.agents), state.deps.agents);
4327
+ const skillCommand = configured === void 0 ? void 0 : currentSkillCommand(configured);
4328
+ if (skillCommand !== configured) log.line(`${tag} ${formerSkillProblem([queue])}`);
4329
+ const modelled = skillCommand === void 0 ? void 0 : withJobModel(skillCommand, jobAgent(active.job, state.deps.agents), active.job.model);
4330
+ if (modelled?.reason !== void 0) log.line(`${tag} the job's model ${active.job.model} was not applied: ${modelled.reason}`);
4331
+ const cmdline = modelled?.command;
4285
4332
  if (!cmdline) {
4286
4333
  log.error(`${tag} has no runner.commands.${queue} in the config file \xB7 ending job as failed`);
4287
4334
  await endJob(state, active, "failed", { stage: "command" });
@@ -4371,16 +4418,47 @@ async function startJob(state, item, queue, claimId, itemKey, branch, identity,
4371
4418
  const took = formatDuration(nowOf(state).getTime() - commandStartedMs);
4372
4419
  if (signal !== null) {
4373
4420
  log.error(`${tag} command killed by ${signal} (${took})`);
4374
- active.job.commandEndReason = jobNotEndedByRunnerReason({ code: null, signal }, active.job);
4421
+ active.job.commandEndReason = commandEndReasonOf({ code: null, signal }, active.job, state.deps.agents);
4375
4422
  void endJob(state, active, "failed");
4376
4423
  return;
4377
4424
  }
4378
4425
  log.line(`${tag} command exited ${code ?? 0} (${took})`);
4379
4426
  if (code !== null) active.job.exitCode = code;
4380
- active.job.commandEndReason = jobNotEndedByRunnerReason({ code, signal }, active.job);
4427
+ active.job.commandEndReason = commandEndReasonOf({ code, signal }, active.job, state.deps.agents);
4381
4428
  void endJob(state, active, code === 0 ? "ok" : "failed");
4382
4429
  });
4383
4430
  }
4431
+ async function holdManagedKeys(state, job, dirPath, options) {
4432
+ const log = logOf(state);
4433
+ const tag = itemTag(job);
4434
+ const { required, optional } = jobKeyProviders(job, state.deps.agents);
4435
+ const labelOf = (provider) => PROVIDERS[provider]?.label ?? provider;
4436
+ const ask = (provider) => fetchManagedModelKey(claimCalls(state.config, job), claimItem(state.config, job), {
4437
+ provider,
4438
+ fetchImpl: state.deps.fetchImpl,
4439
+ now: state.deps.now,
4440
+ sleep: state.deps.sleep,
4441
+ ...options.windowMs === void 0 ? {} : { windowMs: options.windowMs }
4442
+ });
4443
+ for (const provider of required) {
4444
+ const fetched = await ask(provider);
4445
+ if (!fetched.ok) {
4446
+ if (fetched.code === "model_key_not_for_claim") {
4447
+ return { ok: false, mismatch: `this build's agent needs the ${labelOf(provider)} key, and the gateway's claim is for an agent that does not use it` };
4448
+ }
4449
+ return { ok: false, refused: fetched, what: `${labelOf(provider)} key` };
4450
+ }
4451
+ if (fetched.provider !== provider) {
4452
+ return { ok: false, mismatch: `the gateway's model key is for ${fetched.provider}, and this build's agent needs ${provider}` };
4453
+ }
4454
+ holdManagedKey(dirPath, provider, fetched.apiKey);
4455
+ }
4456
+ for (const provider of optional) {
4457
+ const judge = judgeAgent(state.deps.agents, job)?.descriptor.label ?? labelOf(provider);
4458
+ log.line(`${tag} the criteria judge and the code review of this job run ${judge}, which needs the ${labelOf(provider)} key, and a managed claim gets only the key of its own agent, so they cannot run`);
4459
+ }
4460
+ return { ok: true };
4461
+ }
4384
4462
  function buildTokensFor(state, active) {
4385
4463
  return new BuildTokens({
4386
4464
  config: claimCalls(state.config, active.job),
@@ -4709,7 +4787,7 @@ function recordCommandExit(state, active, code) {
4709
4787
  const took = active.commandStartedMs === void 0 ? "" : ` (${formatDuration(nowOf(state).getTime() - active.commandStartedMs)})`;
4710
4788
  log.line(`${tag} command exited ${code}${took}`);
4711
4789
  active.job.exitCode = code;
4712
- active.job.commandEndReason = jobNotEndedByRunnerReason({ code, signal: null }, active.job);
4790
+ active.job.commandEndReason = commandEndReasonOf({ code, signal: null }, active.job, state.deps.agents);
4713
4791
  void endJob(state, active, code === 0 ? "ok" : "failed");
4714
4792
  }
4715
4793
  async function watchTick(state, active, nowMs, logMtimeMs) {
@@ -4876,19 +4954,17 @@ async function holdManagedAgain(state, dirPath, job, tag) {
4876
4954
  const config = state.config;
4877
4955
  const log = logOf(state);
4878
4956
  if (config.fleet !== true) return void 0;
4879
- const fetched = await fetchManagedClaudeKey(claimCalls(config, job), claimItem(config, job), {
4880
- fetchImpl: state.deps.fetchImpl,
4881
- now: state.deps.now,
4882
- sleep: state.deps.sleep,
4883
- windowMs: ADOPTED_FETCH_RETRY_WINDOW_MS
4884
- });
4885
- if (!fetched.ok) {
4886
- const code = fetched.code ?? "unavailable";
4887
- log.error(`${tag} the adopted build's Anthropic key could not be had: ${code}`);
4888
- const cause = fetched.retryable ? "the gateway could not be reached for it" : `the gateway refused it (${code})`;
4889
- return { reason: `the adopted build's Anthropic key could not be had after the runner restarted: ${cause}`, why: "the gateway did not give its Anthropic key again" };
4957
+ const held = await holdManagedKeys(state, job, dirPath, { windowMs: ADOPTED_FETCH_RETRY_WINDOW_MS });
4958
+ if (!held.ok) {
4959
+ if (held.mismatch !== void 0) {
4960
+ log.error(`${tag} the adopted build's model key could not be had: ${held.mismatch}`);
4961
+ return { reason: `the adopted build's model key could not be had after the runner restarted: ${held.mismatch}`, why: "the gateway gave a key for another provider" };
4962
+ }
4963
+ const code = held.refused.code ?? "unavailable";
4964
+ log.error(`${tag} the adopted build's ${held.what} could not be had: ${code}`);
4965
+ const cause = held.refused.retryable ? "the gateway could not be reached for it" : `the gateway refused it (${code})`;
4966
+ return { reason: `the adopted build's ${held.what} could not be had after the runner restarted: ${cause}`, why: `the gateway did not give its ${held.what} again` };
4890
4967
  }
4891
- holdManagedClaudeKey(dirPath, fetched.apiKey);
4892
4968
  const settings = await fetchManagedBuildSettings(claimCalls(config, job), claimItem(config, job), {
4893
4969
  fetchImpl: state.deps.fetchImpl,
4894
4970
  now: state.deps.now,
@@ -5081,7 +5157,7 @@ async function finishMicroVmWhileAway(state, dirPath, job, reason, why) {
5081
5157
  let ending = { reason };
5082
5158
  if (recorded !== void 0) {
5083
5159
  job.exitCode = recorded.code;
5084
- job.commandEndReason = jobNotEndedByRunnerReason({ code: recorded.code, signal: null }, job);
5160
+ job.commandEndReason = commandEndReasonOf({ code: recorded.code, signal: null }, job, state.deps.agents);
5085
5161
  outcome = recorded.outcome === "ok" ? "ok" : "failed";
5086
5162
  ending = void 0;
5087
5163
  }
@@ -5142,7 +5218,7 @@ async function finishTrackedWhileAway(state, dirPath, job, where) {
5142
5218
  `, { mode: RUNNER_FILE_MODE });
5143
5219
  renameSync(`${file}.partial`, file);
5144
5220
  job.exitCode = code;
5145
- job.commandEndReason = jobNotEndedByRunnerReason({ code, signal: null }, job);
5221
+ job.commandEndReason = commandEndReasonOf({ code, signal: null }, job, state.deps.agents);
5146
5222
  outcome = code === 0 ? "ok" : "failed";
5147
5223
  ending = void 0;
5148
5224
  }
@@ -5163,6 +5239,13 @@ async function logUnusableHelper(config, runtime, log) {
5163
5239
  if (helper.reason === "unsupported") log.line(helper.detail);
5164
5240
  else if (helper.unreachable === true) log.line(`${helper.detail}, so microVM builds run without the jailer`);
5165
5241
  }
5242
+ function listedOf(configPath, agents) {
5243
+ try {
5244
+ return agentsToHold(loadRunnerConfig(configPath), agents);
5245
+ } catch {
5246
+ return void 0;
5247
+ }
5248
+ }
5166
5249
  function hooksOf(configPath) {
5167
5250
  try {
5168
5251
  return loadRunnerConfig(configPath).hooks;
@@ -5181,7 +5264,7 @@ async function start(configPath, deps = { fetchImpl: fetch }) {
5181
5264
  }
5182
5265
  async function startRunner(configPath, deps, startup) {
5183
5266
  const log = deps.log ??= createRunnerLog(deps.now ?? (() => /* @__PURE__ */ new Date()));
5184
- takeAgentCredentials(process.env, hooksOf(configPath), deps.agents, dirname(configPath));
5267
+ takeAgentCredentials(process.env, hooksOf(configPath), deps.agents, dirname(configPath), listedOf(configPath, deps.agents));
5185
5268
  const update = deps.update;
5186
5269
  if (update !== void 0) {
5187
5270
  const outcome = await onStartUnderMarker({
@@ -5190,7 +5273,7 @@ async function startRunner(configPath, deps, startup) {
5190
5273
  check: update.check ? () => update.check(configPath) : async () => {
5191
5274
  const held = runnerAgents(deps.agents).flatMap((agent) => heldAgentCredential(agent.descriptor.id) ?? []);
5192
5275
  const env = { ...process.env, ...Object.fromEntries(held.map((credential) => [credential.variable, credential.value])) };
5193
- return (await import('./check-U5P5FFFB.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
5276
+ return (await import('./check-KFQCKXHZ.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
5194
5277
  },
5195
5278
  now: () => (deps.now ?? (() => /* @__PURE__ */ new Date()))().getTime(),
5196
5279
  log
@@ -5576,4 +5659,4 @@ function runnerProcessState(configPath) {
5576
5659
  return isSameProcess(entry.pid, entry.start) ? { state: "running", pid: entry.pid } : { state: "stale", pid: entry.pid };
5577
5660
  }
5578
5661
 
5579
- export { LAPSED_REASON, RunnerStartError, applyComments, endWhenStartFails, fleetKeepalive, leaseTimeLeftFor, listJobFiles, logUnusableHelper, prepareSession, probeBuild, probeCredentials, provisionsBesideOthers, requestStop, runnerProcessState, runtimeOf, sampleUsage, start, tick, watchTick };
5662
+ export { LAPSED_REASON, RunnerStartError, applyComments, endWhenStartFails, fleetKeepalive, leaseTimeLeftFor, listJobFiles, listedOf, logUnusableHelper, prepareSession, probeBuild, probeCredentials, provisionsBesideOthers, requestStop, runnerProcessState, runtimeOf, sampleUsage, start, tick, watchTick };