@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,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { toolsDockerfile } from './chunk-AOAXRPXC.js';
4
- import { claimPidFile, RunnerAlreadyRunningError, releasePidFile } from './chunk-AQNL3XHS.js';
5
- import { startTimeOf } from './chunk-JBJTC3UU.js';
3
+ import { toolsDockerfile } from './chunk-FD42O5SH.js';
6
4
  import { withNewTokenRetry, REFUSED_BY_REMOTE } from './chunk-FJGYU2EK.js';
7
- import { runnerLabelValue } from './chunk-YVBJ74GP.js';
8
- import { RecipeError, locateRecipe, readRecipe, assertBuildable, writeSanitizedRecipe, classifyProperties, SANITIZED_NAME } from './chunk-WGWIB5JH.js';
5
+ import { claimPidFile, RunnerAlreadyRunningError, releasePidFile } from './chunk-NPVIEJX6.js';
6
+ import { startTimeOf } from './chunk-JBJTC3UU.js';
7
+ import { runnerLabelValue } from './chunk-YXUSSZAE.js';
8
+ import { RecipeError, locateRecipe, readRecipe, assertBuildable, writeSanitizedRecipe, classifyProperties, SANITIZED_NAME } from './chunk-EYD5HOQ7.js';
9
9
  import { removeLeftoverGitLocks } from './chunk-A2WPWZJA.js';
10
- import { RUNNER_DIR_MODE, RUNNER_FILE_MODE, repoCacheDir, imagesDir, imageBuildLogsDir, attemptStamp, orgStore, rootfsPathFor } from './chunk-VXL7SLO3.js';
11
- import { withGitConfig, tokenHeader } from './chunk-UHGU2EAK.js';
12
- import { UNIVERSAL_IMAGE_DIGEST, UNIVERSAL_IMAGE_REPOSITORY, UNIVERSAL_IMAGE_SOURCE, buildAgentPin, NODE_IMAGE, UNIVERSAL_IMAGE, MEDIA_PINS, TINI_VERSION, GH_VERSION, imageAgentPins } from './chunk-MRM7CQJ3.js';
10
+ import { RUNNER_DIR_MODE, RUNNER_FILE_MODE, repoCacheDir, imagesDir, imageBuildLogsDir, attemptStamp, orgStore, rootfsPathFor } from './chunk-D5TZYUGZ.js';
11
+ import { withGitConfig, tokenHeader } from './chunk-WRIQGJKT.js';
12
+ import { UNIVERSAL_IMAGE_DIGEST, UNIVERSAL_IMAGE_REPOSITORY, UNIVERSAL_IMAGE_SOURCE, buildAgentPin, NODE_IMAGE, UNIVERSAL_IMAGE, MEDIA_PINS, TINI_VERSION, GH_VERSION, imageAgentPins } from './chunk-QS2O5G64.js';
13
13
  import { mkdirSync, writeFileSync, existsSync, mkdtempSync, rmSync, cpSync, readFileSync, readdirSync, lstatSync, readlinkSync } from 'fs';
14
14
  import { tmpdir } from 'os';
15
15
  import { join, dirname } from 'path';
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK } from './chunk-D6CU6N5S.js';
4
- import { parseSize } from './chunk-YVBJ74GP.js';
5
- import { isRefusedInConfig, resolveDestinations, isReservedVariable } from './chunk-UHGU2EAK.js';
6
- import { builderDiskPinned } from './chunk-MRM7CQJ3.js';
3
+ import { DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK } from './chunk-IOSONR7N.js';
4
+ import { parseSize } from './chunk-YXUSSZAE.js';
5
+ import { isRefusedInConfig, resolveDestinations, isReservedVariable } from './chunk-WRIQGJKT.js';
6
+ import { builderDiskPinned, agentIdOfCommand, defaultCommandFor, headlessAgentIds } from './chunk-QS2O5G64.js';
7
7
  import { homeFromEnv } from './chunk-352DHUTP.js';
8
8
  import { existsSync, statSync, accessSync, constants, readFileSync } from 'fs';
9
9
  import { hostname } from 'os';
@@ -293,6 +293,7 @@ var RUNNER_KEYS = [
293
293
  "timeLimitMinutes",
294
294
  "idleLimitMinutes",
295
295
  "commands",
296
+ "agents",
296
297
  "hooks",
297
298
  "build",
298
299
  "sandbox",
@@ -429,12 +430,24 @@ function loadRunnerConfig(configPath) {
429
430
  if (runner.name !== void 0 && runner.host !== void 0 && runner.name !== runner.host) {
430
431
  fail(configPath, "runner.name", `is "${runner.name}" and runner.host is "${runner.host}"; set runner.name only, since runner.host is its earlier name`);
431
432
  }
433
+ const agents = resolveAgents(configPath, runner.agents);
434
+ const commands = { ...runner.commands };
435
+ if (agents !== void 0) {
436
+ const named = agentIdOfCommand(commands.implement || commands.amend);
437
+ const from = named ?? agents[0];
438
+ for (const queue of RUNNER_QUEUES) {
439
+ if (!commands[queue]) {
440
+ const derived = defaultCommandFor(from, queue);
441
+ if (derived !== void 0) commands[queue] = derived;
442
+ }
443
+ }
444
+ }
432
445
  const queues = runner.queues && runner.queues.length > 0 ? runner.queues : [...RUNNER_QUEUES];
433
446
  for (const queue of queues) {
434
447
  if (!RUNNER_QUEUES.includes(queue)) {
435
448
  fail(configPath, "runner.queues", `names an unknown queue "${queue}" \u2014 must be implement or amend`);
436
449
  }
437
- if (!runner.commands?.[queue]) {
450
+ if (!commands[queue]) {
438
451
  fail(configPath, `runner.commands.${queue}`, "is required for an enabled queue");
439
452
  }
440
453
  }
@@ -446,7 +459,7 @@ function loadRunnerConfig(configPath) {
446
459
  }
447
460
  if (fleet) {
448
461
  for (const queue of RUNNER_QUEUES) {
449
- if (!runner.commands?.[queue]) {
462
+ if (!commands[queue]) {
450
463
  fail(configPath, `runner.commands.${queue}`, "is required, because a fleet runner takes both implement and amend builds");
451
464
  }
452
465
  }
@@ -481,7 +494,8 @@ function loadRunnerConfig(configPath) {
481
494
  pollSeconds: runner.pollSeconds ?? (fleet ? DEFAULT_FLEET_POLL_SECONDS : DEFAULT_POLL_SECONDS),
482
495
  timeLimitMinutes: runner.timeLimitMinutes ?? DEFAULT_TIME_LIMIT_MINUTES,
483
496
  idleLimitMinutes: runner.idleLimitMinutes ?? DEFAULT_IDLE_LIMIT_MINUTES,
484
- commands: runner.commands ?? {},
497
+ commands,
498
+ ...agents === void 0 ? {} : { agents },
485
499
  hooks: {
486
500
  provision: runner.hooks.provision,
487
501
  cleanup: runner.hooks.cleanup,
@@ -502,6 +516,19 @@ function loadRunnerConfig(configPath) {
502
516
  deliverComments: runner.deliverComments ?? true
503
517
  };
504
518
  }
519
+ function resolveAgents(configPath, value) {
520
+ if (value === void 0) return void 0;
521
+ const known = headlessAgentIds();
522
+ if (!Array.isArray(value) || value.length === 0 || value.some((entry) => typeof entry !== "string")) {
523
+ fail(configPath, "runner.agents", `must be a list of agent ids, from: ${known.join(", ")}`);
524
+ }
525
+ const ids = value;
526
+ for (const id of ids) {
527
+ if (!known.includes(id)) fail(configPath, "runner.agents", `names "${id}", which builds cannot use; the agents that exist are ${known.join(", ")}`);
528
+ }
529
+ if (new Set(ids).size !== ids.length) fail(configPath, "runner.agents", "names an agent twice");
530
+ return ids;
531
+ }
505
532
  function checkBuiltinHooks(configPath, hooks) {
506
533
  for (const key of ["provision", "cleanup", "report"]) {
507
534
  const value = hooks[key];
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { readNewestDemo } from './chunk-ER6KQCVJ.js';
4
- import { runEmitArtifact } from './chunk-AE6A5DVR.js';
4
+ import { runEmitArtifact } from './chunk-D5YKSWK3.js';
5
5
  import { VoiceDownloadError, downloadPinned, sha256OfFile } from './chunk-2PGI6RDE.js';
6
- import { detectActiveSession } from './chunk-J3P4WLJA.js';
7
- import { autoConnect } from './chunk-ZCBKVSBK.js';
6
+ import { detectActiveSession } from './chunk-26RXLXEX.js';
7
+ import { autoConnect } from './chunk-4I3SN7WG.js';
8
8
  import { C } from './chunk-2AM6Z5BP.js';
9
- import { defaultFetch, resolveGatewayCredentials } from './chunk-EOKIUWXY.js';
9
+ import { defaultFetch, resolveGatewayCredentials } from './chunk-FRLGVHJP.js';
10
10
  import { launchedItemForSession } from './chunk-LGJ56FCM.js';
11
- import { VOICE_PACK_FILES, VOICE_PACK_VERSION } from './chunk-MRM7CQJ3.js';
11
+ import { VOICE_PACK_FILES, VOICE_PACK_VERSION } from './chunk-QS2O5G64.js';
12
12
  import { homeFromEnv } from './chunk-352DHUTP.js';
13
- import { resolveRepoIdentity } from './chunk-TTPOEZFE.js';
14
- import { ARTIFACT_MAX_BYTES, ARTIFACT_MAX_CAPTION_LENGTH, DEMO_RECORD_MEDIA_TYPE, ARTIFACT_MAX_REPLACES_TARGETS, DEMO_MANIFEST_LATEST_VERSION, DemoManifestSchema, ARTIFACT_KINDS } from './chunk-6IGOHB3O.js';
13
+ import { resolveRepoIdentity } from './chunk-KTZOD7A3.js';
14
+ import { ARTIFACT_MAX_BYTES, ARTIFACT_MAX_CAPTION_LENGTH, DEMO_RECORD_MEDIA_TYPE, ARTIFACT_MAX_REPLACES_TARGETS, DEMO_MANIFEST_LATEST_VERSION, DemoManifestSchema, ARTIFACT_KINDS } from './chunk-37WA2LQC.js';
15
15
  import { __commonJS, __require, __toESM } from './chunk-Z5GEFMRW.js';
16
16
  import { createHash } from 'crypto';
17
17
  import { readFileSync, mkdtempSync, writeFileSync, statSync, rmSync, mkdirSync, existsSync, copyFileSync, accessSync, constants, realpathSync, createReadStream, createWriteStream } from 'fs';
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { homeFromEnv } from './chunk-352DHUTP.js';
4
- import { ArtifactTombstoneRecordSchema, ArtifactSpoolRecordSchema } from './chunk-6IGOHB3O.js';
4
+ import { ArtifactTombstoneRecordSchema, ArtifactSpoolRecordSchema } from './chunk-37WA2LQC.js';
5
5
  import { mkdirSync, appendFileSync, writeFileSync, renameSync, unlinkSync, existsSync, readdirSync, readFileSync, statSync } from 'fs';
6
6
  import { join, dirname } from 'path';
7
7
 
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { RELAY_PORT, DESTINATION_BASE_PORT } from './chunk-UHGU2EAK.js';
4
- import { GATEWAY_SOCKET, GATEWAY_PORT, providerDestinations } from './chunk-YZQDTL3T.js';
5
- import { defaultAgents } from './chunk-LAO7LRIR.js';
6
- import { PROVIDERS } from './chunk-JIMISJV2.js';
3
+ import { RELAY_PORT, DESTINATION_BASE_PORT } from './chunk-WRIQGJKT.js';
4
+ import { GATEWAY_SOCKET, GATEWAY_PORT, providerDestinations } from './chunk-GAHP2AI3.js';
5
+ import { defaultAgents } from './chunk-XMJNIIPM.js';
6
+ import { PROVIDERS } from './chunk-Q7Z6ELTL.js';
7
7
  import { symlinkSync, unlinkSync } from 'fs';
8
8
  import { join } from 'path';
9
9
 
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { builtInEnvironment, managedAgentCredential, agentCredential, builtInNames, TARGET_TUNNEL, TARGET_LEASE, destinationTarget, builtInDestinations, destinationPort } from './chunk-YZQDTL3T.js';
4
- import { strippedVariables } from './chunk-MRM7CQJ3.js';
5
- import { defaultAgents } from './chunk-LAO7LRIR.js';
6
- import { PROVIDERS } from './chunk-JIMISJV2.js';
7
- import { MIN_SCRUBBED_LITERAL } from './chunk-TTPOEZFE.js';
3
+ import { builtInEnvironment, managedAgentCredential, agentCredential, builtInNames, TARGET_TUNNEL, TARGET_LEASE, destinationTarget, builtInDestinations, destinationPort } from './chunk-GAHP2AI3.js';
4
+ import { strippedVariables, jobAgent, judgeAgent, agentsToHold, runnerAgents } from './chunk-QS2O5G64.js';
5
+ import { defaultAgents } from './chunk-XMJNIIPM.js';
6
+ import { PROVIDERS } from './chunk-Q7Z6ELTL.js';
7
+ import { MIN_SCRUBBED_LITERAL, costOfUsage } from './chunk-KTZOD7A3.js';
8
8
  import { mkdirSync, writeFileSync, existsSync, unlinkSync, chmodSync } from 'fs';
9
9
  import { request as request$1, createServer } from 'http';
10
10
  import { request } from 'https';
11
11
  import { isIP, createServer as createServer$1 } from 'net';
12
12
  import { join } from 'path';
13
+ import { StringDecoder } from 'string_decoder';
13
14
  import { generateKeyPairSync, randomBytes, X509Certificate, createHash, sign } from 'crypto';
14
15
  import { rootCertificates } from 'tls';
15
16
 
@@ -183,6 +184,150 @@ function createSandboxClient(opts) {
183
184
  ...dataPlaneOf(call, () => opts.tokenHeader)
184
185
  };
185
186
  }
187
+ var MAX_TEXT_CHARS = 16 * 1024 * 1024;
188
+ function count(value) {
189
+ return typeof value === "number" && Number.isInteger(value) && value >= 0 ? value : void 0;
190
+ }
191
+ function readUsage(parsed) {
192
+ if (typeof parsed !== "object" || parsed === null) return void 0;
193
+ const top = parsed;
194
+ const body = typeof top.response === "object" && top.response !== null ? top.response : top;
195
+ const usage = body.usage;
196
+ if (typeof body.model !== "string" || body.model === "" || typeof usage !== "object" || usage === null) return void 0;
197
+ const fields = usage;
198
+ const input = count(fields.input_tokens);
199
+ const output = count(fields.output_tokens);
200
+ if (input === void 0 || output === void 0) return void 0;
201
+ const cachedInput = count(fields.input_tokens_details?.cached_tokens) ?? 0;
202
+ return { model: body.model, input, cachedInput: Math.min(cachedInput, input), output };
203
+ }
204
+ var EVENT_FIELDS = ["data:", "event:", "id:", "retry:", ":"];
205
+ function usageReader(contentType) {
206
+ const decoder = new StringDecoder("utf8");
207
+ let found;
208
+ let pieces = [];
209
+ let kept = 0;
210
+ let overflow = false;
211
+ let stream = contentType === void 0 || contentType.trim() === "" ? void 0 : contentType.toLowerCase().startsWith("text/event-stream");
212
+ const line = (text) => {
213
+ const data = text.startsWith("data:") ? text.slice(5).trim() : void 0;
214
+ if (data === void 0 || !data.includes('"usage"')) return;
215
+ try {
216
+ found = readUsage(JSON.parse(data)) ?? found;
217
+ } catch {
218
+ }
219
+ };
220
+ const keep = (text) => {
221
+ if (overflow) return;
222
+ kept += text.length;
223
+ if (kept > MAX_TEXT_CHARS) {
224
+ pieces = [];
225
+ overflow = true;
226
+ } else pieces.push(text);
227
+ };
228
+ const endLine = () => {
229
+ if (!overflow) line(pieces.join("").replace(/\r$/, ""));
230
+ pieces = [];
231
+ kept = 0;
232
+ overflow = false;
233
+ };
234
+ const add = (text) => {
235
+ if (stream === void 0) {
236
+ keep(text);
237
+ const head = pieces.join("").trimStart();
238
+ if (head === "" || EVENT_FIELDS.some((field) => field.startsWith(head) && field !== head)) return;
239
+ stream = EVENT_FIELDS.some((field) => head.startsWith(field));
240
+ if (!stream) return;
241
+ const held2 = pieces.join("");
242
+ pieces = [];
243
+ kept = 0;
244
+ overflow = false;
245
+ add(held2);
246
+ return;
247
+ }
248
+ if (!stream) {
249
+ keep(text);
250
+ return;
251
+ }
252
+ let from = 0;
253
+ for (let end = text.indexOf("\n", from); end !== -1; end = text.indexOf("\n", from)) {
254
+ keep(text.slice(from, end));
255
+ endLine();
256
+ from = end + 1;
257
+ }
258
+ keep(text.slice(from));
259
+ };
260
+ return {
261
+ write: (chunk) => add(typeof chunk === "string" ? chunk : decoder.write(chunk)),
262
+ finish: () => {
263
+ add(decoder.end());
264
+ if (stream) {
265
+ endLine();
266
+ return found;
267
+ }
268
+ if (overflow) return void 0;
269
+ try {
270
+ return readUsage(JSON.parse(pieces.join("")));
271
+ } catch {
272
+ return void 0;
273
+ }
274
+ }
275
+ };
276
+ }
277
+ var UsageTally = class {
278
+ constructor() {
279
+ this.total = 0;
280
+ this.open = 0;
281
+ this.unknown = false;
282
+ }
283
+ /** A request that the upstream may bill started. `done` ends it with the usage its response held, and `free` ends it when nothing is billed. */
284
+ begin() {
285
+ this.open += 1;
286
+ let ended = false;
287
+ const end = () => {
288
+ if (ended) return false;
289
+ ended = true;
290
+ this.open -= 1;
291
+ return true;
292
+ };
293
+ return {
294
+ done: (usage) => {
295
+ if (!end()) return;
296
+ const cost = usage === void 0 ? null : costOfUsage(usage.model, { in: usage.input - usage.cachedInput, out: usage.output, cacheRead: usage.cachedInput, cacheCreate: 0 });
297
+ if (cost === null) this.unknown = true;
298
+ else this.total += cost;
299
+ },
300
+ free: () => void end()
301
+ };
302
+ }
303
+ /** The cost in USD, or undefined when it is unknown: a request without a usage or with an unpriced model, or one still open. */
304
+ costUsd() {
305
+ return this.unknown || this.open > 0 ? void 0 : this.total;
306
+ }
307
+ };
308
+ function keyOf(authorization) {
309
+ return /^Bearer\s+(.+)$/i.exec(authorization ?? "")?.[1];
310
+ }
311
+ var UsageLedger = class {
312
+ constructor(keys) {
313
+ this.tallies = /* @__PURE__ */ new Map();
314
+ this.stray = new UsageTally();
315
+ this.strays = 0;
316
+ for (const key of keys) this.tallies.set(key, new UsageTally());
317
+ }
318
+ /** Starts a request that carried `authorization`, in the tally of its key. */
319
+ begin(authorization) {
320
+ const key = keyOf(authorization);
321
+ const tally = key === void 0 ? void 0 : this.tallies.get(key);
322
+ if (tally !== void 0) return tally.begin();
323
+ this.strays += 1;
324
+ return this.stray.begin();
325
+ }
326
+ /** The cost of the run that holds `key`, or undefined when it is unknown. */
327
+ costUsd(key) {
328
+ return this.strays > 0 ? void 0 : this.tallies.get(key)?.costUsd();
329
+ }
330
+ };
186
331
 
187
332
  // src/scrub-env.ts
188
333
  var SCRUB_ENV_VARIABLE = "OUTERLAYER_SCRUB_ENV";
@@ -588,6 +733,9 @@ function applyTrust(env, image) {
588
733
  }
589
734
  return { ...env, literals, passed };
590
735
  }
736
+ function withheldCredentialLine(name2) {
737
+ return `not passing ${name2} into the build: the runner holds this agent credential and gives the build a placeholder`;
738
+ }
591
739
  function tokenVariables() {
592
740
  return ["GH_TOKEN", "GITHUB_TOKEN", "GH_ENTERPRISE_TOKEN", "GITHUB_ENTERPRISE_TOKEN"];
593
741
  }
@@ -686,15 +834,26 @@ function withMiseVariables(env, variables) {
686
834
  }
687
835
  return { ...env, literals, passed };
688
836
  }
837
+ function agentNamesOf(agents) {
838
+ const names = /* @__PURE__ */ new Set();
839
+ for (const agent of runnerAgents(agents)) {
840
+ for (const name2 of agent.descriptor.credentials.forwarded) names.add(name2);
841
+ for (const name2 of Object.keys(builtInEnvironment((destination) => containerBuiltInAddress(destination, agents), void 0, agents, void 0, { agent: agent.descriptor.id }))) names.add(name2);
842
+ }
843
+ return names;
844
+ }
689
845
  var NO_VARIABLES = [];
690
846
  function buildEnvironment(input) {
691
847
  const authored = authorEnvironment(input.identity?.author);
848
+ const builtIns = input.builtIns === true;
849
+ const agentNames = new Set(builtIns ? Object.keys(builtInEnvironment((name2) => containerBuiltInAddress(name2, input.agents), void 0, input.agents, void 0, input.job, input.run === true)) : []);
850
+ const everyAgentName = builtIns ? agentNamesOf(input.agents) : /* @__PURE__ */ new Set();
692
851
  const recipe = {};
693
852
  for (const [name2, value] of Object.entries(input.containerEnv)) {
694
- if (!isReservedVariable(name2) && !(name2 in authored)) recipe[name2] = value;
853
+ if (!isReservedVariable(name2) && !agentNames.has(name2) && !(name2 in authored)) recipe[name2] = value;
695
854
  }
696
- const builtIns = input.builtIns === true;
697
- const credentialVariables = strippedVariables(input.agents);
855
+ const ownAgents = input.job === void 0 ? [] : [jobAgent(input.job, input.agents)?.descriptor.id, judgeAgent(input.agents, input.job)?.descriptor.id].filter((id) => id !== void 0);
856
+ const credentialVariables = strippedVariables(input.agents, [...agentsToHold(input.config, input.agents), ...ownAgents]);
698
857
  const passed = {
699
858
  ...builtIns ? {} : { OUTERLAYER_URL: input.config.url },
700
859
  ...builtIns || input.itemKey === void 0 ? {} : { OUTERLAYER_API_KEY: input.itemKey },
@@ -706,8 +865,12 @@ function buildEnvironment(input) {
706
865
  const skippedTokenVariables = [];
707
866
  if (input.factoryVariables !== void 0) {
708
867
  for (const { name: name2, value } of input.factoryVariables) {
709
- if (isReservedVariable(name2) || name2 in authored) continue;
710
- if (builtIns && credentialVariables.includes(name2)) continue;
868
+ if (isReservedVariable(name2) || agentNames.has(name2) || name2 in authored) continue;
869
+ if (builtIns && credentialVariables.includes(name2)) {
870
+ input.onWithheld?.(name2);
871
+ continue;
872
+ }
873
+ if (everyAgentName.has(name2)) continue;
711
874
  passed[name2] = value;
712
875
  variables.push(name2);
713
876
  }
@@ -719,14 +882,17 @@ function buildEnvironment(input) {
719
882
  continue;
720
883
  }
721
884
  const value = input.hostEnv[name2];
722
- if (value === void 0 || isReservedVariable(name2) || name2 in authored) continue;
723
- if (builtIns && credentialVariables.includes(name2)) continue;
885
+ if (value === void 0 || isReservedVariable(name2) || agentNames.has(name2) || name2 in authored) continue;
886
+ if (builtIns && credentialVariables.includes(name2)) {
887
+ input.onWithheld?.(name2);
888
+ continue;
889
+ }
724
890
  passed[name2] = value;
725
891
  variables.push(name2);
726
892
  }
727
893
  }
728
894
  const destinations = destinationEnvironment(input.config.build?.destinations, containerLocalAddress);
729
- const builtInLiterals = builtIns ? builtInEnvironment((name2) => containerBuiltInAddress(name2, input.agents), input.config.fleet === true ? managedAgentCredential(input.agents) : agentCredential(input.hostEnv, {}, input.agents), input.agents, void 0, input.job, input.run === true) : {};
895
+ const builtInLiterals = builtIns ? builtInEnvironment((name2) => containerBuiltInAddress(name2, input.agents), input.config.fleet === true ? managedAgentCredential(input.agents, void 0, input.job) : agentCredential(input.hostEnv, {}, input.agents, input.job), input.agents, void 0, input.job, input.run === true) : {};
730
896
  const hooksPath = input.identity?.hooksPath;
731
897
  const hooks = {};
732
898
  if (hooksPath !== void 0) {
@@ -1033,7 +1199,7 @@ function resolveDestinations(given, variables, isReserved, fail, agents = defaul
1033
1199
  if (given.length > most) {
1034
1200
  fail(
1035
1201
  "runner.build.destinations",
1036
- `lists ${given.length} destinations; a release records at most ${MAX_RELEASED_DESTINATIONS}, and ${builtIns.length} of those are the built-in ${builtIns.join(" and ")} destinations, so a host lists at most ${most}`
1202
+ `lists ${given.length} destinations; a release records at most ${MAX_RELEASED_DESTINATIONS}, and ${builtIns.length} of those are the built-in ${builtIns.length <= 2 ? builtIns.join(" and ") : `${builtIns.slice(0, -1).join(", ")} and ${builtIns.at(-1)}`} destinations, so a host lists at most ${most}`
1037
1203
  );
1038
1204
  }
1039
1205
  const resolved = [];
@@ -1157,6 +1323,7 @@ async function startDestination(input) {
1157
1323
  const send = input.request ?? (secure ? request : request$1);
1158
1324
  const headerName = destination.header.name.toLowerCase();
1159
1325
  const dropped = droppedRequestHeaders(input.drop);
1326
+ let cap;
1160
1327
  const handle = (req, res) => {
1161
1328
  let finished = false;
1162
1329
  const finish = (ok) => {
@@ -1166,7 +1333,9 @@ async function startDestination(input) {
1166
1333
  };
1167
1334
  res.on("finish", () => finish(true));
1168
1335
  res.on("close", () => finish(false));
1336
+ let billing;
1169
1337
  const fail = (status, body) => {
1338
+ billing?.free();
1170
1339
  finish(false);
1171
1340
  respond(res, status, body);
1172
1341
  };
@@ -1175,6 +1344,16 @@ async function startDestination(input) {
1175
1344
  fail(400, "send an origin-form request path\n");
1176
1345
  return;
1177
1346
  }
1347
+ if (cap !== void 0 && req.method === "POST") {
1348
+ cap.used += 1;
1349
+ if (cap.used > cap.max) {
1350
+ if (cap.used === cap.max + 1) cap.exceeded();
1351
+ fail(429, `the destination ${destination.name} refused the request: the run reached its limit of ${cap.max} requests
1352
+ `);
1353
+ return;
1354
+ }
1355
+ billing = cap.ledger?.begin(req.headers.authorization);
1356
+ }
1178
1357
  const expanded = expandHeader(destination.header, hostEnv);
1179
1358
  if ("missing" in expanded) {
1180
1359
  fail(502, `the destination ${destination.name} cannot be reached: ${expanded.missing} is not set in the runner's environment
@@ -1185,6 +1364,7 @@ async function startDestination(input) {
1185
1364
  for (const [name2, value] of Object.entries(req.headers)) {
1186
1365
  if (!dropped.has(name2)) headers[name2] = value;
1187
1366
  }
1367
+ if (billing !== void 0) delete headers["accept-encoding"];
1188
1368
  headers.host = upstream.host;
1189
1369
  headers[headerName] = expanded.value;
1190
1370
  let forwarded;
@@ -1201,6 +1381,18 @@ async function startDestination(input) {
1201
1381
  },
1202
1382
  (answer) => {
1203
1383
  res.writeHead(answer.statusCode ?? 502, answer.headers);
1384
+ if (billing !== void 0) {
1385
+ const counted = billing;
1386
+ if ((answer.statusCode ?? 502) >= 300) counted.free();
1387
+ else {
1388
+ const reader = usageReader(answer.headers["content-type"]);
1389
+ answer.on("data", (chunk) => reader.write(chunk));
1390
+ answer.on("end", () => counted.done(reader.finish()));
1391
+ answer.on("close", () => {
1392
+ if (!answer.complete) counted.done(reader.finish());
1393
+ });
1394
+ }
1395
+ }
1204
1396
  answer.on("error", () => res.destroy());
1205
1397
  answer.on("close", () => {
1206
1398
  if (!answer.complete) {
@@ -1220,6 +1412,7 @@ async function startDestination(input) {
1220
1412
  forwarded.setTimeout(UPSTREAM_IDLE_MS, () => forwarded.destroy());
1221
1413
  res.on("close", () => forwarded.destroy());
1222
1414
  forwarded.on("error", (err) => {
1415
+ billing?.done(void 0);
1223
1416
  input.onUpstreamError?.(destination.name, typeof err.code === "string" ? err.code : "unknown");
1224
1417
  fail(502, `the upstream of the destination ${destination.name} could not be reached
1225
1418
  `);
@@ -1264,7 +1457,15 @@ async function startDestination(input) {
1264
1457
  for (const socket of sockets) socket.destroy();
1265
1458
  await Promise.all(listeners.map((listener) => new Promise((resolve) => listener.close(() => resolve()))));
1266
1459
  };
1267
- return { ...served, acceptStream: (stream) => void server.emit("connection", stream), listener: () => input.socketPath === void 0 ? void 0 : server, close };
1460
+ return {
1461
+ ...served,
1462
+ acceptStream: (stream) => void server.emit("connection", stream),
1463
+ listener: () => input.socketPath === void 0 ? void 0 : server,
1464
+ capRequests: (next) => {
1465
+ cap = next;
1466
+ },
1467
+ close
1468
+ };
1268
1469
  }
1269
1470
  async function startBuildServices(input) {
1270
1471
  const streamed = input.serve === "stream";
@@ -1283,6 +1484,7 @@ async function startBuildServices(input) {
1283
1484
  recordPath: join(input.jobDir, "tunnel.json")
1284
1485
  });
1285
1486
  const servers = [];
1487
+ const byName = /* @__PURE__ */ new Map();
1286
1488
  const targets = /* @__PURE__ */ new Map();
1287
1489
  const tunnelListener = tunnel.listener?.();
1288
1490
  if (tunnelListener !== void 0) listeners["tunnel.sock"] = tunnelListener;
@@ -1308,6 +1510,7 @@ async function startBuildServices(input) {
1308
1510
  ...input.destinationOptions
1309
1511
  });
1310
1512
  servers.push(server);
1513
+ byName.set(destination.name, server);
1311
1514
  tunnel.routeServed(destination.name);
1312
1515
  input.log?.(`route ${destination.name} served to the build`);
1313
1516
  const listener = server.listener?.();
@@ -1336,6 +1539,7 @@ async function startBuildServices(input) {
1336
1539
  ...input.destinationOptions
1337
1540
  });
1338
1541
  servers.push(server);
1542
+ byName.set(builtIn.destination.name, server);
1339
1543
  tunnel.routeServed(builtIn.destination.name);
1340
1544
  input.log?.(`route ${builtIn.destination.name} served to the build`);
1341
1545
  const listener = server.listener?.();
@@ -1350,11 +1554,15 @@ async function startBuildServices(input) {
1350
1554
  serve(stream);
1351
1555
  return true;
1352
1556
  }
1353
- }, destinationPorts, builtInPorts, listeners, close: closeAll };
1557
+ }, destinationPorts, builtInPorts, listeners, capRequests: (name2, cap) => {
1558
+ const server = byName.get(name2);
1559
+ server?.capRequests(cap);
1560
+ return server !== void 0;
1561
+ }, close: closeAll };
1354
1562
  } catch (err) {
1355
1563
  await closeAll();
1356
1564
  throw err;
1357
1565
  }
1358
1566
  }
1359
1567
 
1360
- export { BUILD_HOME, CHECKOUT_DIR, CHECK_ITEMS_FILE, DESTINATION_BASE_PORT, EVAL_INPUT_DIR, IMAGE_BUNDLES, JOB_MOUNT, PROXY_WARNING_FLAG, RELAY_PORT, SANDBOX_VARIABLES, SCRUB_ENV_VARIABLE, SandboxError, WORK_DIR, applyTrust, authorEnvironment, buildAuthorityFor, buildEnvironment, carried6to4, checkEnvironment, checkoutPath, classifyAddress, commitIdentityRecord, containerLocalAddress, createSandboxClient, dataPlaneOf, describeSandboxError, destinationEnvironment, dropBuildAuthority, droppedRequestHeaders, hasDotDotSegment, headerVariables, heldBuildAuthority, hostKeyOf, isMiseVariableAllowed, isRefusedInConfig, isReservedVariable, lifecycleWorkdir, parseBranchlessRepositories, parseClaimIdentity, parseClaimedRepositories, parseIsolation, parseProxied, parseUnreachable, primaryOf, providerMayAnswerLater, proxyEnvironment, readBundleScript, repositoriesOf, repositoryPath, resolveDestinations, retryAfterMsOf, routeNameOf, sandboxCallOf, sandboxSettingsFrom, sharedUserEnvironment, startBuildServices, tokenHeader, toolProxyEnvironment, trustEnvironment, variableForPath, variablesFor, withGitConfig, withHooksPath, withMiseVariables, withTokenHeader, withTunnelRecord, writeTrustFiles };
1568
+ export { BUILD_HOME, CHECKOUT_DIR, CHECK_ITEMS_FILE, DESTINATION_BASE_PORT, EVAL_INPUT_DIR, IMAGE_BUNDLES, JOB_MOUNT, PROXY_WARNING_FLAG, RELAY_PORT, SANDBOX_VARIABLES, SCRUB_ENV_VARIABLE, SandboxError, UsageLedger, WORK_DIR, applyTrust, authorEnvironment, buildAuthorityFor, buildEnvironment, carried6to4, checkEnvironment, checkoutPath, classifyAddress, commitIdentityRecord, containerLocalAddress, createSandboxClient, dataPlaneOf, describeSandboxError, destinationEnvironment, dropBuildAuthority, droppedRequestHeaders, hasDotDotSegment, headerVariables, heldBuildAuthority, hostKeyOf, isMiseVariableAllowed, isRefusedInConfig, isReservedVariable, lifecycleWorkdir, parseBranchlessRepositories, parseClaimIdentity, parseClaimedRepositories, parseIsolation, parseProxied, parseUnreachable, primaryOf, providerMayAnswerLater, proxyEnvironment, readBundleScript, repositoriesOf, repositoryPath, resolveDestinations, retryAfterMsOf, routeNameOf, sandboxCallOf, sandboxSettingsFrom, sharedUserEnvironment, startBuildServices, tokenHeader, toolProxyEnvironment, trustEnvironment, variableForPath, variablesFor, withGitConfig, withHooksPath, withMiseVariables, withTokenHeader, withTunnelRecord, withheldCredentialLine, writeTrustFiles };
@@ -1,27 +1,27 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { checkStarterFiles, contextIsGoverned } from './chunk-FIH3QA4E.js';
4
- import { resolveCredentials, getJson, WorkCommandError } from './chunk-YKVFVP4A.js';
5
- import { fleetCheck, checkBuildSkill, checkSpecSkill, checkMachineSkills, checkCommittedMaintainedSkills, checkMaintainedReferences, checkIgnoredSkillFolders } from './chunk-5VANIC7Z.js';
6
- import { withInjectedPrograms } from './chunk-YYHSGZHO.js';
7
- import { isLinkedRepository } from './chunk-24K3CV6P.js';
8
- import { sanitizeTerminal } from './chunk-QMC2MM2S.js';
3
+ import { checkStarterFiles, contextIsGoverned } from './chunk-FMOGX7RR.js';
4
+ import { resolveCredentials, getJson, WorkCommandError } from './chunk-YLDHHHBJ.js';
5
+ import { isLinkedRepository } from './chunk-B2WCKRMW.js';
6
+ import { fleetCheck, checkBuildSkill, checkSpecSkill, checkMachineSkills, checkCommittedMaintainedSkills, checkMaintainedReferences, checkIgnoredSkillFolders } from './chunk-BPZ23EMS.js';
7
+ import { sanitizeTerminal } from './chunk-WNFITHNX.js';
8
+ import { withInjectedPrograms } from './chunk-2RUTYYYA.js';
9
9
  import { C } from './chunk-2AM6Z5BP.js';
10
- import { checkFormerSkillNames } from './chunk-TWKW3BL3.js';
11
- import { resolveGatewayCredentials, defaultFetch } from './chunk-EOKIUWXY.js';
12
- import { sanitizeForContext, spoolDir, assessSyncHealth, readSyncStatus, SYNC_STALE_AFTER_MS, formatAgo, checkInstalledCliStaleness, workspaceRootOf, hookFiredMarkerPath, refreshCommand } from './chunk-7N6MB6NR.js';
13
- import { CONTROL_PLANE_DIR_VARIABLE } from './chunk-F3J4UKBF.js';
10
+ import { checkFormerSkillNames } from './chunk-4RPDWURG.js';
11
+ import { resolveGatewayCredentials, defaultFetch } from './chunk-FRLGVHJP.js';
12
+ import { sanitizeForContext, spoolDir, assessSyncHealth, readSyncStatus, SYNC_STALE_AFTER_MS, formatAgo, checkInstalledCliStaleness, workspaceRootOf, hookFiredMarkerPath, refreshCommand } from './chunk-EVAK6FAS.js';
13
+ import { CONTROL_PLANE_DIR_VARIABLE } from './chunk-DJK3IK6K.js';
14
14
  import { findGitDirs } from './chunk-BJ3KTMDH.js';
15
- import { readStatuslineState, STATE_FRESH_MS } from './chunk-LA66NWUO.js';
15
+ import { readStatuslineState, STATE_FRESH_MS } from './chunk-B3ZKYFBI.js';
16
16
  import { cliInvocation } from './chunk-FZKNTIOJ.js';
17
- import { installAgents, withSettingsText } from './chunk-SKVA4VMG.js';
17
+ import { installAgents, withSettingsText } from './chunk-J2ADYASG.js';
18
18
  import { cliForInstall, cliBinResolvable } from './chunk-ZHQC43NH.js';
19
19
  import { readDeliveryRecord, readDegraded, readSourceCache } from './chunk-YQR6E6OV.js';
20
20
  import { deadHooksState, preparePackageManagerCommand } from './chunk-CJPTUU2E.js';
21
- import { defaultAgents, legacyAgent, contextAgents } from './chunk-LAO7LRIR.js';
21
+ import { defaultAgents, legacyAgent, contextAgents } from './chunk-XMJNIIPM.js';
22
22
  import { homeFromEnv } from './chunk-352DHUTP.js';
23
- import { SUPPORTED_VERSIONS, resolveRepoIdentity } from './chunk-TTPOEZFE.js';
24
- import { CRITERIA_JUDGE_NAME } from './chunk-6IGOHB3O.js';
23
+ import { SUPPORTED_VERSIONS, resolveRepoIdentity } from './chunk-KTZOD7A3.js';
24
+ import { CRITERIA_JUDGE_NAME } from './chunk-37WA2LQC.js';
25
25
  import { readFileSync, mkdirSync, writeFileSync, renameSync, existsSync, accessSync, constants, statSync, readdirSync, lstatSync } from 'fs';
26
26
  import { sep, join, dirname, resolve, delimiter } from 'path';
27
27
  import { execFileSync } from 'child_process';
@@ -1094,8 +1094,9 @@ function doctorExitCode(checks) {
1094
1094
 
1095
1095
  // src/doctor-report.ts
1096
1096
  async function gatherDoctorChecks(options = {}) {
1097
- const { DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK } = await import('./build-disk-AOY6DOEK.js');
1098
- const { defaultRunnerConfigPath, hasRunnerBlock, keyRunnerFactory, loadRunnerConfig, runnerVmOf } = await import('./config-HZEVAUDO.js');
1097
+ const { DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK } = await import('./build-disk-Z5YFT47Z.js');
1098
+ const { listedAgents } = await import('./runner-agents-QS3IX55G.js');
1099
+ const { defaultRunnerConfigPath, hasRunnerBlock, keyRunnerFactory, loadRunnerConfig, runnerVmOf } = await import('./config-DIUO2GQY.js');
1099
1100
  const configPath = options.configPath ?? defaultRunnerConfigPath();
1100
1101
  const runnerHost = hasRunnerBlock(configPath);
1101
1102
  const hooks = (() => {
@@ -1123,7 +1124,7 @@ async function gatherDoctorChecks(options = {}) {
1123
1124
  const { runnerVmCheck } = await import('./doctor-53F2PYY7.js');
1124
1125
  checks.push(runnerVmCheck(configPath, { lima: realLima(), home: homeFromEnv(), instance: runnerVm.instance }));
1125
1126
  } else if (hasRunnerBlock(configPath)) {
1126
- const { runnerHostChecks } = await import('./doctor-5VN6Q4ZU.js');
1127
+ const { runnerHostChecks } = await import('./doctor-Y7CIJZX5.js');
1127
1128
  const gateway = (() => {
1128
1129
  try {
1129
1130
  const loaded = loadRunnerConfig(configPath);
@@ -1142,8 +1143,9 @@ async function gatherDoctorChecks(options = {}) {
1142
1143
  })();
1143
1144
  const runner = (() => {
1144
1145
  try {
1145
- const { concurrency, build, housekeeping, fleet } = loadRunnerConfig(configPath);
1146
- return { concurrency, buildMemory: build?.memory ?? "8g", buildDisk: build?.disk ?? DEFAULT_BUILD_DISK, cacheDisk: build?.cacheDisk ?? DEFAULT_CACHE_DISK, minFreeDisk: housekeeping?.minFreeDisk, allowHosts: build?.allowHosts, ...build?.egress === void 0 ? {} : { egress: build.egress }, ...build?.imageBuild === void 0 ? {} : { imageBuild: build.imageBuild }, ...fleet === true ? { fleet } : {} };
1146
+ const loaded = loadRunnerConfig(configPath);
1147
+ const { concurrency, build, housekeeping, fleet } = loaded;
1148
+ return { agents: listedAgents(loaded), concurrency, buildMemory: build?.memory ?? "8g", buildDisk: build?.disk ?? DEFAULT_BUILD_DISK, cacheDisk: build?.cacheDisk ?? DEFAULT_CACHE_DISK, minFreeDisk: housekeeping?.minFreeDisk, allowHosts: build?.allowHosts, ...build?.egress === void 0 ? {} : { egress: build.egress }, ...build?.imageBuild === void 0 ? {} : { imageBuild: build.imageBuild }, ...fleet === true ? { fleet } : {} };
1147
1149
  } catch {
1148
1150
  return void 0;
1149
1151
  }
@@ -1151,7 +1153,7 @@ async function gatherDoctorChecks(options = {}) {
1151
1153
  const service = await (async () => {
1152
1154
  const { existsSync: existsSync3 } = await import('fs');
1153
1155
  if (process.platform !== "linux" || !existsSync3("/run/systemd/system")) return void 0;
1154
- const { inspectRunnerService } = await import('./find-unit-XKWFS4BL.js');
1156
+ const { inspectRunnerService } = await import('./find-unit-OAJKRZI2.js');
1155
1157
  return inspectRunnerService(configPath);
1156
1158
  })();
1157
1159
  checks.push(...await runnerHostChecks({ configPath, hooks, gateway, repos, runner, service }));
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { RemovedTargetError, removedTargetError } from './chunk-4JUAJVOW.js';
4
- import { removeRetiredSkills } from './chunk-TWKW3BL3.js';
3
+ import { RemovedTargetError, removedTargetError } from './chunk-ATXTGXGK.js';
4
+ import { removeRetiredSkills } from './chunk-4RPDWURG.js';
5
5
  import { removeLeftoverGitLocks } from './chunk-A2WPWZJA.js';
6
- import { defaultFetch, resolveGatewayCredentials } from './chunk-EOKIUWXY.js';
7
- import { withTokenHeader } from './chunk-UHGU2EAK.js';
6
+ import { defaultFetch, resolveGatewayCredentials } from './chunk-FRLGVHJP.js';
7
+ import { withTokenHeader } from './chunk-WRIQGJKT.js';
8
8
  import { appendContextProvenance } from './chunk-545P7JY7.js';
9
9
  import { cliInvocation } from './chunk-FZKNTIOJ.js';
10
10
  import { writeDegraded, writeSourceCache, SOURCE_CACHE_TTL_RETRY_MS, writeContextManifest, SOURCE_CACHE_TTL_SUCCESS_MS, readSourceCache, isSourceCacheFresh, clearDegraded } from './chunk-YQR6E6OV.js';
11
- import { normalizeRepoName, loadMaintainedFiles, writeMaintainedFiles, parseOuterlayerConfig, targetIds, classifyTree, emitTree, emitBuilders, defaultAgents, agentRootFolders } from './chunk-LAO7LRIR.js';
11
+ import { normalizeRepoName, loadMaintainedFiles, writeMaintainedFiles, parseOuterlayerConfig, targetIds, classifyTree, emitTree, emitBuilders, defaultAgents, agentRootFolders } from './chunk-XMJNIIPM.js';
12
12
  import { homeFromEnv } from './chunk-352DHUTP.js';
13
13
  import { execFileSync } from 'child_process';
14
14
  import { existsSync, mkdirSync, writeFileSync, chmodSync, lstatSync, readFileSync, copyFileSync } from 'fs';