@outerlayer/cli 0.36.0-next.20261101174803 → 0.36.0-next.20261102135508

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 (206) hide show
  1. package/dist/agent-setup-Q3HDN23U.js +39 -0
  2. package/dist/agent-subcommand-Z6SOLWZW.js +25 -0
  3. package/dist/bridge-4KPODDN7.js +15 -0
  4. package/dist/build-KYXFZQ33.js +23 -0
  5. package/dist/build-disk-W6AL5WHI.js +20 -0
  6. package/dist/build-info.json +1 -1
  7. package/dist/builder-IMNOEYV7.js +19 -0
  8. package/dist/caller-NLRE272L.js +22 -0
  9. package/dist/{check-K4RVAP4L.js → check-WWX32IGY.js} +78 -74
  10. package/dist/{chunk-MKSZHT6S.js → chunk-2YC3TXWX.js} +1 -1
  11. package/dist/{chunk-QIOTIQWD.js → chunk-3UFX6KH2.js} +12 -11
  12. package/dist/{chunk-F2LPX2HS.js → chunk-3YEPLVNW.js} +8 -8
  13. package/dist/chunk-4DLJ343I.js +38 -0
  14. package/dist/{chunk-5WYT3PPE.js → chunk-4OD45RBP.js} +4 -1
  15. package/dist/{chunk-H7SKHAUE.js → chunk-4XXBV37R.js} +6 -6
  16. package/dist/{chunk-XNBUZGRO.js → chunk-6B3V6EGQ.js} +11 -9
  17. package/dist/{chunk-O36YAH2G.js → chunk-6HDXRDC5.js} +4 -4
  18. package/dist/chunk-6JLYU322.js +68 -0
  19. package/dist/{chunk-5GHJFETA.js → chunk-6KH3NMIT.js} +3010 -1196
  20. package/dist/{chunk-SPXVFFQV.js → chunk-AQE6E54X.js} +10 -9
  21. package/dist/{chunk-LGV5N5DG.js → chunk-ATKCHMFD.js} +1 -1
  22. package/dist/{chunk-7J7HRYZ3.js → chunk-B2P72DAE.js} +1 -1
  23. package/dist/{chunk-LEHBDEUG.js → chunk-B36NSEUM.js} +4 -5
  24. package/dist/{chunk-B62TYDP2.js → chunk-B5SWBFVE.js} +5 -4
  25. package/dist/chunk-BSPJI5T7.js +28 -0
  26. package/dist/{chunk-VJYSPH2J.js → chunk-BUYXEU7J.js} +26 -21
  27. package/dist/{chunk-CIUD3436.js → chunk-BZSJ77MO.js} +1 -1
  28. package/dist/{chunk-OEBFKPHK.js → chunk-CDG475ZP.js} +11 -11
  29. package/dist/{chunk-AGKQEOFS.js → chunk-CSBW4LGL.js} +54 -31
  30. package/dist/{chunk-D2OTBS47.js → chunk-CSVJGW3I.js} +2 -2
  31. package/dist/{chunk-GANAOCHR.js → chunk-CXJC3JLN.js} +25 -374
  32. package/dist/{chunk-WAZJPDR2.js → chunk-D4VGJQY7.js} +1 -1
  33. package/dist/{chunk-BRUDBWLO.js → chunk-D5I5SSPU.js} +7 -7
  34. package/dist/{chunk-KFUDKFEH.js → chunk-D6EXW4EB.js} +45 -19
  35. package/dist/{chunk-AF6DQJ5W.js → chunk-DG3M5DZU.js} +1 -1
  36. package/dist/{chunk-WT7J2627.js → chunk-DTCTXDJP.js} +1 -1
  37. package/dist/chunk-DTQPDMHG.js +654 -0
  38. package/dist/{chunk-EZRAR5YG.js → chunk-E3TP4QTM.js} +1 -1
  39. package/dist/{chunk-NFZJ5XHP.js → chunk-ENBOAE2W.js} +33 -32
  40. package/dist/{chunk-R3252UTU.js → chunk-ENMX3VQ7.js} +7 -7
  41. package/dist/{chunk-AH6634HC.js → chunk-FOSYM7TQ.js} +1 -2
  42. package/dist/{chunk-HL7UNTXO.js → chunk-FRMAQ3C4.js} +17 -10
  43. package/dist/{chunk-HAWPG7QW.js → chunk-FTP7SE6Y.js} +3 -3
  44. package/dist/{chunk-IP7BIBXJ.js → chunk-FWSVWPMS.js} +16 -7
  45. package/dist/{chunk-GLUQVET2.js → chunk-GFZ7PELR.js} +6 -6
  46. package/dist/{chunk-UZGQT6OF.js → chunk-H2NJG3TE.js} +6 -3
  47. package/dist/{chunk-46OBCATR.js → chunk-HRHWA6TZ.js} +1 -1
  48. package/dist/chunk-HTRDL42C.js +45 -0
  49. package/dist/{chunk-YBAVN6WS.js → chunk-I4DM7SNX.js} +7 -7
  50. package/dist/{chunk-24FEVLX7.js → chunk-I6U6QPN6.js} +1311 -73
  51. package/dist/{chunk-4DJZSNVT.js → chunk-IKFAJTLZ.js} +1 -1
  52. package/dist/{chunk-55PYF6S2.js → chunk-J2OMKFYB.js} +3 -3
  53. package/dist/{chunk-7Y5VW4JG.js → chunk-K2G3VB7W.js} +1 -1
  54. package/dist/chunk-K7N6LAPC.js +78 -0
  55. package/dist/{chunk-ULBVE7MP.js → chunk-KRCU66AM.js} +9 -9
  56. package/dist/{chunk-JU3VU42K.js → chunk-LHHDX7FB.js} +5 -5
  57. package/dist/{chunk-FUJUFLDC.js → chunk-LO4CK734.js} +8 -14
  58. package/dist/chunk-LSLK4RS4.js +82 -0
  59. package/dist/{chunk-ABAVN4RT.js → chunk-LSZUTI6O.js} +29 -26
  60. package/dist/chunk-MVPOYQQY.js +136 -0
  61. package/dist/{chunk-YQHEJ5SV.js → chunk-NXQK2I3G.js} +3 -3
  62. package/dist/{chunk-DJMR4YPG.js → chunk-O3MJAHLI.js} +82 -96
  63. package/dist/{chunk-B7PYT2BY.js → chunk-PBGNX3PS.js} +6 -3
  64. package/dist/{chunk-CJJDJ7AT.js → chunk-PIZA7OG2.js} +5 -3
  65. package/dist/{chunk-RIHB3HA2.js → chunk-PMA67TIN.js} +3 -3
  66. package/dist/{chunk-DJDTL6AY.js → chunk-QKOJ22OV.js} +148 -293
  67. package/dist/{chunk-RDWKRG4K.js → chunk-RF4JHGGB.js} +7 -7
  68. package/dist/{chunk-MOOZJRKM.js → chunk-SJJXDU2J.js} +27 -30
  69. package/dist/chunk-T5QBWM6M.js +113 -0
  70. package/dist/{chunk-W7I65BKE.js → chunk-TJIFYV2Z.js} +12 -12
  71. package/dist/{chunk-EBOQU6QC.js → chunk-TKY3SDXH.js} +6 -6
  72. package/dist/{chunk-ALEUIS35.js → chunk-ULBYRPAP.js} +1 -1
  73. package/dist/{chunk-ZP7F3OHV.js → chunk-URHS76GV.js} +48 -38
  74. package/dist/{chunk-X2XTCGUS.js → chunk-VAYVTUU4.js} +11 -12
  75. package/dist/{chunk-TSYHUUAT.js → chunk-VUH7KKVD.js} +3 -3
  76. package/dist/{chunk-RIIPBJK6.js → chunk-WACPWYMH.js} +4 -4
  77. package/dist/{chunk-AAGU5FJF.js → chunk-WGC7UFRM.js} +1 -1
  78. package/dist/{chunk-2SRQSGPR.js → chunk-WVAXJOWG.js} +30 -24
  79. package/dist/{chunk-KLXECBIE.js → chunk-XEWG4AB2.js} +151 -108
  80. package/dist/{chunk-KDK6AF7B.js → chunk-XIDDJSQU.js} +7 -6
  81. package/dist/{chunk-MXIFRYLA.js → chunk-Y4E7IS7H.js} +2 -2
  82. package/dist/{chunk-DHFNBNC3.js → chunk-YJQ7YA7J.js} +5 -5
  83. package/dist/{chunk-6A2GEFN3.js → chunk-YMVRCSKD.js} +4 -4
  84. package/dist/{chunk-JW5BENE6.js → chunk-YYQ5NOT5.js} +3 -3
  85. package/dist/chunk-ZHQC43NH.js +130 -0
  86. package/dist/{chunk-KB5B6ZT5.js → chunk-ZSRMJOAK.js} +20 -20
  87. package/dist/{claude-launcher-L77BKZOC.js → claude-launcher-LGKJZH33.js} +99 -120
  88. package/dist/{cli-QQY5UECM.js → cli-Q5L64EEG.js} +327 -298
  89. package/dist/{cli-update-notice-T3CXRWNB.js → cli-update-notice-AWYJ4A7R.js} +2 -2
  90. package/dist/{command-QLHQZ32L.js → command-CGEFJZNC.js} +65 -64
  91. package/dist/{config-5GY7FL35.js → config-T22KVOOT.js} +14 -10
  92. package/dist/connect-cmd-RUBP466E.js +28 -0
  93. package/dist/{container-start-OCJODSMB.js → container-start-JRF3SBUA.js} +65 -62
  94. package/dist/{context-cleanup-A7KBEBIO.js → context-cleanup-3K2AOECJ.js} +6 -2
  95. package/dist/{context-show-cmd-MZ74ZIVO.js → context-show-cmd-4UXO5WQJ.js} +18 -16
  96. package/dist/{control-plane-launch-3TZFOSCX.js → control-plane-launch-AAH4YH56.js} +31 -27
  97. package/dist/{demo-record-cmd-Y57UWBCX.js → demo-record-cmd-2OKCGST7.js} +10 -5
  98. package/dist/{demo-voice-cmd-4INIOVTC.js → demo-voice-cmd-GEPX7GIG.js} +27 -27
  99. package/dist/{dist-6KGTCWKR.js → dist-VVZIGSAF.js} +1 -1
  100. package/dist/docker-5VWK335X.js +19 -0
  101. package/dist/{doctor-DB2AJUAO.js → doctor-EQM3JRZI.js} +81 -76
  102. package/dist/emit-artifact-cmd-TA3MPHLU.js +43 -0
  103. package/dist/{emit-cmd-IOWTTZSA.js → emit-cmd-RO4L4PFZ.js} +9 -8
  104. package/dist/emit-criteria-cmd-NMTUV2KM.js +34 -0
  105. package/dist/emit-demo-cmd-Y2Y6LEL7.js +46 -0
  106. package/dist/{emit-finding-cmd-KQIGM5IF.js → emit-finding-cmd-VECM64UR.js} +20 -19
  107. package/dist/{emit-result-cmd-6Q7OU2NY.js → emit-result-cmd-2ERWFDUN.js} +25 -24
  108. package/dist/{emit-step-cmd-GZU5O2FR.js → emit-step-cmd-V2ET66N4.js} +20 -19
  109. package/dist/exec-client-54XKNPTI.js +16 -0
  110. package/dist/find-unit-CNAPU7XQ.js +23 -0
  111. package/dist/{findings-cmd-T7PQAVJG.js → findings-cmd-QJPPF6BY.js} +20 -19
  112. package/dist/{fleet-readiness-PTMOEX6L.js → fleet-readiness-DKAPHAZN.js} +16 -15
  113. package/dist/governing-source-7PZ6DAJU.js +40 -0
  114. package/dist/guest-init-5QZRGP62.js +18 -0
  115. package/dist/{hook-fast-RW7RU3O6.js → hook-fast-VXROB4KF.js} +7 -5
  116. package/dist/hook-install-GDNRMML4.js +14 -0
  117. package/dist/{hook-wrap-fast-545QJSBJ.js → hook-wrap-fast-LWWKKPGK.js} +4 -2
  118. package/dist/host-checks-WAPO5X7X.js +78 -0
  119. package/dist/host-key-HLLV37NV.js +16 -0
  120. package/dist/image-tag-PBWQBATH.js +17 -0
  121. package/dist/index.js +8 -9
  122. package/dist/init-EK3PUU6W.js +78 -0
  123. package/dist/{init-HUQLVUPO.js → init-Y2URPVVY.js} +62 -59
  124. package/dist/{init-cmd-6NQGBVAJ.js → init-cmd-XNANUDIW.js} +38 -33
  125. package/dist/{init-update-MA6QKX46.js → init-update-EFCTKF6D.js} +55 -46
  126. package/dist/install-cmd-RHFUZFV4.js +19 -0
  127. package/dist/layout-7XMC7S6K.js +13 -0
  128. package/dist/{logs-FEITSC2V.js → logs-E7MGQINH.js} +10 -3
  129. package/dist/loop-L6TX6OR4.js +89 -0
  130. package/dist/machine-VJKAY2GX.js +78 -0
  131. package/dist/{machine-skills-237PQFRC.js → machine-skills-HR4RNRNR.js} +5 -4
  132. package/dist/{mcp-install-cmd-23ZY4IBK.js → mcp-install-cmd-SMPLT43Q.js} +7 -1
  133. package/dist/{mcp-serve-cmd-ZINYSLY6.js → mcp-serve-cmd-XXERT673.js} +11 -7
  134. package/dist/{paths-XEYE7OZ2.js → paths-F2ZR2EKC.js} +10 -3
  135. package/dist/pending-VOFQRXP4.js +16 -0
  136. package/dist/pidfile-7M7O2M7T.js +17 -0
  137. package/dist/record-YCJ6DZOY.js +16 -0
  138. package/dist/{relay-IEYNSKAZ.js → relay-I2T43PPB.js} +8 -1
  139. package/dist/relay-protocol-GI2GC2AM.js +13 -0
  140. package/dist/runner-env-YW55JVU7.js +23 -0
  141. package/dist/runner-identity-Y5ZFCC7V.js +19 -0
  142. package/dist/{runner-key-CFZ47PR3.js → runner-key-R47C6374.js} +54 -54
  143. package/dist/session-sender-UPACLRGG.js +43 -0
  144. package/dist/{shell-function-NRD4KVUK.js → shell-function-GYD2ZQQG.js} +2 -1
  145. package/dist/{spec-cmd-CNASSB6L.js → spec-cmd-7QRE2SZK.js} +21 -20
  146. package/dist/{starter-pack-CCVIEY72.js → starter-pack-IMKIUA56.js} +7 -6
  147. package/dist/state-VAHBIMS5.js +16 -0
  148. package/dist/{status-VNHIHQ57.js → status-BQEYEG2V.js} +54 -54
  149. package/dist/{statusline-fast-E7RWVREA.js → statusline-fast-NUVHCNRX.js} +4 -2
  150. package/dist/{sync-cmd-5JLJBODH.js → sync-cmd-NBLYEPQG.js} +25 -24
  151. package/dist/update-steps-VGKNGWTZ.js +79 -0
  152. package/dist/{watch-AEWWTUEK.js → watch-IHV4V3HZ.js} +25 -24
  153. package/dist/{work-claim-cmd-GUYOJYH7.js → work-claim-cmd-WGTSU5IT.js} +24 -24
  154. package/dist/{work-cmd-YRPYMGII.js → work-cmd-HKOJU5FJ.js} +18 -17
  155. package/dist/{work-comment-cmd-U5Z6FKEU.js → work-comment-cmd-H3JCWQ2J.js} +21 -20
  156. package/dist/{work-demo-cmd-OLCWTVWM.js → work-demo-cmd-J4AZAIVP.js} +18 -17
  157. package/dist/{work-launch-TTGSHLY4.js → work-launch-LWDQXLGI.js} +1 -1
  158. package/dist/{work-logs-cmd-2OA7ENDU.js → work-logs-cmd-UOO4JVLG.js} +18 -17
  159. package/dist/{work-open-pr-cmd-6GUCDYVM.js → work-open-pr-cmd-QFRDDBAM.js} +20 -19
  160. package/dist/{work-pr-cmd-KK3VQUQI.js → work-pr-cmd-3Q2D5RQT.js} +19 -18
  161. package/dist/{work-proofs-cmd-BUOS5OJC.js → work-proofs-cmd-7Y3HGT7C.js} +21 -20
  162. package/dist/{work-proofs-record-6WLMOK53.js → work-proofs-record-QPUM6DY4.js} +31 -31
  163. package/dist/{work-stop-cmd-VZJX5X4L.js → work-stop-cmd-SD2ZRMSY.js} +18 -17
  164. package/package.json +1 -1
  165. package/dist/agent-setup-DJRQFPDU.js +0 -33
  166. package/dist/bridge-XM4QLKIX.js +0 -8
  167. package/dist/build-ZE5IG3V6.js +0 -18
  168. package/dist/build-disk-GMXDIZU4.js +0 -15
  169. package/dist/builder-LJ3FSB36.js +0 -14
  170. package/dist/caller-YLNJJPFU.js +0 -18
  171. package/dist/chunk-CXFJOX2C.js +0 -144
  172. package/dist/chunk-FGF52V4V.js +0 -137
  173. package/dist/chunk-HCVLP7XA.js +0 -53
  174. package/dist/chunk-KYDEBGJG.js +0 -402
  175. package/dist/chunk-MESOOLF4.js +0 -45
  176. package/dist/chunk-OHQMGLJP.js +0 -113
  177. package/dist/chunk-OUPQTA7N.js +0 -145
  178. package/dist/chunk-VRMXYQWR.js +0 -74
  179. package/dist/connect-cmd-THV7XBVP.js +0 -27
  180. package/dist/docker-5YVUZ3J2.js +0 -14
  181. package/dist/emit-artifact-cmd-H27MFSKH.js +0 -42
  182. package/dist/emit-criteria-cmd-IOUVMB2Q.js +0 -33
  183. package/dist/emit-demo-cmd-WJSS7KU2.js +0 -46
  184. package/dist/exec-client-FGGPQSYQ.js +0 -9
  185. package/dist/find-unit-PRZIFBIK.js +0 -19
  186. package/dist/governing-source-CND5ZZC3.js +0 -39
  187. package/dist/guest-init-WPUS45IN.js +0 -11
  188. package/dist/host-checks-S3B7Z4SY.js +0 -78
  189. package/dist/host-key-O4DFMOSV.js +0 -9
  190. package/dist/image-tag-WBD57QBN.js +0 -10
  191. package/dist/init-ILTX4V56.js +0 -78
  192. package/dist/install-cmd-JKPXIOEY.js +0 -12
  193. package/dist/layout-2ZMCT2D3.js +0 -11
  194. package/dist/loop-KDWDOSMQ.js +0 -89
  195. package/dist/machine-Z6K5XXI6.js +0 -78
  196. package/dist/pending-D2NNV54J.js +0 -9
  197. package/dist/pidfile-FLFVRKVW.js +0 -10
  198. package/dist/record-JMZOXD4R.js +0 -9
  199. package/dist/relay-protocol-5LSWUJCW.js +0 -6
  200. package/dist/runner-env-W2UMHY7P.js +0 -19
  201. package/dist/runner-identity-IIY5UJL3.js +0 -14
  202. package/dist/session-sender-NO4F2IQ5.js +0 -42
  203. package/dist/settings-XB2HYBKO.js +0 -7
  204. package/dist/state-UWIM42JH.js +0 -9
  205. package/dist/update-steps-XGOXDCOS.js +0 -79
  206. package/dist/{chunk-OLM2TIOW.js → chunk-NFZMENCY.js} +1 -1
@@ -1,371 +1,19 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { TARGET_TUNNEL, TARGET_LEASE, destinationTarget } from './chunk-MESOOLF4.js';
4
- import { spawn, spawnSync } from 'child_process';
5
- import { statSync, readFileSync, existsSync, unlinkSync, chmodSync } from 'fs';
6
- import { join, dirname } from 'path';
3
+ import { builtInNames, TARGET_TUNNEL, TARGET_LEASE, destinationTarget, builtInDestinations, strippedVariables, builtInEnvironment, managedAgentCredential, agentCredential, destinationPort } from './chunk-DTQPDMHG.js';
4
+ import { defaultAgents } from './chunk-I6U6QPN6.js';
5
+ import { PROVIDERS } from './chunk-LSLK4RS4.js';
6
+ import { existsSync, unlinkSync, chmodSync } from 'fs';
7
7
  import { request as request$1, createServer } from 'http';
8
8
  import { request } from 'https';
9
9
  import { createServer as createServer$1 } from 'net';
10
+ import { join } from 'path';
10
11
 
11
12
  createRequire(import.meta.url);
12
- var FD_STORE_ENV = "OUTERLAYER_FD_STORE";
13
- var MIN_SYSTEMD = 254;
14
- var LISTEN_FDS_START = 3;
15
- var FD_SLOTS_PER_BUILD = 64;
16
- function fdName(buildId, socket) {
17
- return `ol-${buildId}-${socket}`;
18
- }
19
- function listenFdOf(server) {
20
- const handle = server._handle;
21
- return typeof handle?.fd === "number" && handle.fd >= 0 ? handle.fd : void 0;
22
- }
23
- function parseListenFds(env, pid) {
24
- const found = /* @__PURE__ */ new Map();
25
- if (env.LISTEN_PID !== String(pid)) return found;
26
- const count = Number(env.LISTEN_FDS);
27
- if (!Number.isInteger(count) || count <= 0) return found;
28
- const names = (env.LISTEN_FDNAMES ?? "").split(":");
29
- for (let index = 0; index < count; index++) {
30
- const name = names[index];
31
- if (name !== void 0 && name !== "" && name !== "stored") found.set(name, LISTEN_FDS_START + index);
32
- }
33
- return found;
34
- }
35
- function listenOnFd(server, fd) {
36
- return new Promise((resolve, reject) => {
37
- server.once("error", reject);
38
- server.listen({ fd }, () => {
39
- server.off("error", reject);
40
- resolve();
41
- });
42
- });
43
- }
44
- function run(spawnFn, command, args, fd) {
45
- return new Promise((resolve) => {
46
- let stdout = "";
47
- let stderr = "";
48
- let child;
49
- try {
50
- child = spawnFn(command, args, { stdio: ["ignore", "pipe", "pipe", ...fd === void 0 ? [] : [fd]] });
51
- } catch (err) {
52
- resolve({ status: null, stdout, stderr: err instanceof Error ? err.message : String(err) });
53
- return;
54
- }
55
- child.stdout?.on("data", (chunk) => stdout += chunk.toString("utf8"));
56
- child.stderr?.on("data", (chunk) => stderr += chunk.toString("utf8"));
57
- child.on("error", (err) => resolve({ status: null, stdout, stderr: err.message }));
58
- child.on("close", (status) => resolve({ status, stdout, stderr }));
59
- });
60
- }
61
- function systemdVersion(ran) {
62
- const match = /^systemd (\d+)/.exec(ran.stdout);
63
- return ran.status === 0 && match !== null ? Number(match[1]) : void 0;
64
- }
65
- function realFdStorePort(options = {}) {
66
- const env = options.env ?? process.env;
67
- const pid = options.pid ?? process.pid;
68
- const command = options.command ?? "systemd-notify";
69
- const spawnFn = options.spawn ?? spawn;
70
- let inherited;
71
- let held2;
72
- let version;
73
- const inheritedNames = () => inherited ??= parseListenFds(env, pid);
74
- const heldNames = () => held2 ??= new Set(inheritedNames().keys());
75
- return {
76
- async status() {
77
- if (env.NOTIFY_SOCKET === void 0 || env.NOTIFY_SOCKET === "") return { ok: false, reason: "NOTIFY_SOCKET is not set, so this runner was not started by a service that accepts descriptors" };
78
- const size = Number(env[FD_STORE_ENV]);
79
- if (!Number.isInteger(size) || size <= 0) return { ok: false, reason: `${FD_STORE_ENV} is not set, so the service's unit keeps no descriptor store` };
80
- version ??= run(spawnFn, command, ["--version"]).then(systemdVersion);
81
- const found = await version;
82
- if (found === void 0) return { ok: false, reason: `${command} could not be run, so no descriptor can be stored` };
83
- if (found < MIN_SYSTEMD) return { ok: false, reason: `systemd ${found} cannot store a descriptor sent from a child process: it needs systemd ${MIN_SYSTEMD} or later` };
84
- return { ok: true };
85
- },
86
- async push(name, server) {
87
- const fd = listenFdOf(server);
88
- if (fd === void 0) throw new Error(`${name} has no descriptor to store`);
89
- const size = Number(env[FD_STORE_ENV]);
90
- const names = heldNames();
91
- if (Number.isInteger(size) && names.size >= size) {
92
- throw new Error(`the descriptor store is full: it holds ${names.size} descriptors, the size the service's unit sets (FileDescriptorStoreMax=${size})`);
93
- }
94
- const ran = await run(spawnFn, command, [`--fd=${LISTEN_FDS_START}`, `--fdname=${name}`, "FDSTORE=1"], fd);
95
- if (ran.status !== 0) throw new Error(`storing ${name} failed${ran.status === null ? "" : ` (exit ${ran.status})`}: ${ran.stderr.trim().split("\n")[0] ?? ""}`);
96
- names.add(name);
97
- },
98
- async remove(name) {
99
- const ran = await run(spawnFn, command, ["FDSTOREREMOVE=1", `FDNAME=${name}`]);
100
- if (ran.status !== 0) throw new Error(`removing ${name} from the store failed${ran.status === null ? "" : ` (exit ${ran.status})`}: ${ran.stderr.trim().split("\n")[0] ?? ""}`);
101
- heldNames().delete(name);
102
- },
103
- inherited() {
104
- return inheritedNames();
105
- },
106
- listenOn: listenOnFd
107
- };
108
- }
109
-
110
- // src/runner/service/slice.ts
111
- var BUILD_SLICE_MEMORY_ENV = "OUTERLAYER_BUILD_SLICE_MEMORY";
112
-
113
- // src/runner/service/inspect.ts
114
- var CREDENTIAL_VARIABLES = ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY"];
115
- function property(shown, name) {
116
- return new RegExp(`^${name}=(.*)$`, "m").exec(shown)?.[1]?.trim();
117
- }
118
- function holdsGroup(status, gid) {
119
- const primary = /^Gid:\s+(\d+)/m.exec(status)?.[1];
120
- const supplementary = /^Groups:[ \t]*(.*)$/m.exec(status)?.[1]?.trim().split(/\s+/).filter((g) => g !== "") ?? [];
121
- return [primary, ...supplementary].some((g) => g !== void 0 && Number(g) === gid);
122
- }
123
- function parseRunnerEnv(text) {
124
- const env = {};
125
- for (const line of text.split("\n")) {
126
- const match = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=(.*)$/.exec(line);
127
- if (match === null) continue;
128
- env[match[1]] = match[2].trim().replace(/^(["'])(.*)\1$/, "$2");
129
- }
130
- return env;
131
- }
132
- function credentialNames(env) {
133
- const set = parseRunnerEnv(env ?? "");
134
- return CREDENTIAL_VARIABLES.filter((name) => (set[name] ?? "").trim() !== "");
135
- }
136
- function startedWithStore(environ) {
137
- const vars = new Map(environ.split("\0").map((entry) => [entry.slice(0, entry.indexOf("=")), entry.slice(entry.indexOf("=") + 1)]));
138
- return (vars.get("NOTIFY_SOCKET") ?? "") !== "" && Number(vars.get(FD_STORE_ENV)) > 0;
139
- }
140
- function inspectService(unit, configDir, probes) {
141
- const shown = probes.show(unit);
142
- if (shown === void 0 || property(shown, "LoadState") !== "loaded") return void 0;
143
- const pid = Number(property(shown, "MainPID") ?? "0");
144
- const mainPid = Number.isInteger(pid) && pid > 0 ? pid : void 0;
145
- const delegate = property(shown, "Delegate");
146
- const storeMax = Number(property(shown, "FileDescriptorStoreMax"));
147
- const status = mainPid === void 0 ? void 0 : probes.readFile(`/proc/${mainPid}/status`);
148
- const environ = mainPid === void 0 ? void 0 : probes.readFile(`/proc/${mainPid}/environ`);
149
- const systemd = Number(/^systemd (\d+)/.exec(probes.systemctlVersion?.() ?? "")?.[1]);
150
- const kvm = probes.kvmGid();
151
- const sliceMemory = Number(new RegExp(`(?:^|\\s)${BUILD_SLICE_MEMORY_ENV}=(\\d+)(?:\\s|$)`).exec(property(shown, "Environment") ?? "")?.[1]);
152
- return {
153
- unit,
154
- ...Number.isSafeInteger(sliceMemory) && sliceMemory > 0 ? { buildSliceMemory: sliceMemory } : {},
155
- mainPid,
156
- delegate: delegate === void 0 ? void 0 : delegate !== "no",
157
- ...Number.isInteger(storeMax) && property(shown, "FileDescriptorStoreMax") !== void 0 ? { fdStoreMax: storeMax } : {},
158
- hasKvmGroup: status === void 0 || kvm === void 0 ? void 0 : holdsGroup(status, kvm),
159
- ...environ === void 0 ? {} : { startedWithStore: startedWithStore(environ) },
160
- ...systemd > 0 ? { systemdVersion: systemd } : {},
161
- // `claude.env` first, where the service loads the credential from; `runner.env` holds one that was never moved.
162
- credentialVariables: [.../* @__PURE__ */ new Set([...credentialNames(probes.readFile(join(configDir, "claude.env"))), ...credentialNames(probes.readFile(join(configDir, "runner.env")))])]
163
- };
164
- }
165
- function realInspectProbes() {
166
- return {
167
- show: (unit) => {
168
- const result = spawnSync("systemctl", ["show", "--property=LoadState,MainPID,Delegate,FileDescriptorStoreMax,Environment", unit], { encoding: "utf8", timeout: 1e4 });
169
- return result.status === 0 ? result.stdout : void 0;
170
- },
171
- readFile: (path) => {
172
- try {
173
- return readFileSync(path, "utf8");
174
- } catch {
175
- return void 0;
176
- }
177
- },
178
- systemctlVersion: () => {
179
- const result = spawnSync("systemctl", ["--version"], { encoding: "utf8", timeout: 1e4 });
180
- return result.status === 0 ? result.stdout : void 0;
181
- },
182
- kvmGid: () => {
183
- try {
184
- return statSync("/dev/kvm").gid;
185
- } catch {
186
- return void 0;
187
- }
188
- }
189
- };
190
- }
191
- var CLAUDE_CREDENTIAL_ID = "claude";
192
- var CLAUDE_ENV_FILE = "claude.env";
193
- function claudeEnvPath(configPath) {
194
- return join(dirname(configPath), CLAUDE_ENV_FILE);
195
- }
196
- var CLAUDE_CREDENTIAL_VARIABLES = ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"];
197
- var FORWARDED_CLAUDE_CREDENTIAL_VARIABLES = ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY"];
198
- var FORWARDED = FORWARDED_CLAUDE_CREDENTIAL_VARIABLES;
199
- function firstOf(values, source) {
200
- for (const variable of FORWARDED) {
201
- const value = values[variable];
202
- if (value !== void 0 && value !== "") return { variable, value, source };
203
- }
204
- return void 0;
205
- }
206
- function readClaudeCredential(env) {
207
- const fromEnvironment = firstOf(env, "environment");
208
- if (fromEnvironment !== void 0) return fromEnvironment;
209
- const directory = env.CREDENTIALS_DIRECTORY;
210
- if (directory === void 0 || directory === "") return void 0;
211
- const path = join(directory, CLAUDE_CREDENTIAL_ID);
212
- try {
213
- const text = readFileSync(path, "utf8");
214
- const found = firstOf(parseRunnerEnv(text), "credentials-directory");
215
- if (found === void 0 && text.trim() !== "") complain(path, "it sets neither CLAUDE_CODE_OAUTH_TOKEN nor ANTHROPIC_API_KEY, each as NAME=value");
216
- return found;
217
- } catch (err) {
218
- if (err.code !== "ENOENT") complain(path, `it could not be read (${err instanceof Error ? err.message : String(err)})`);
219
- return void 0;
220
- }
221
- }
222
- function claudeCredentialVariablesSet(env, options = {}) {
223
- const found = /* @__PURE__ */ new Set();
224
- const add = (values) => {
225
- for (const variable of FORWARDED) if ((values[variable] ?? "") !== "") found.add(variable);
226
- };
227
- add(env);
228
- const directory = env.CREDENTIALS_DIRECTORY;
229
- if (directory) {
230
- try {
231
- add(parseRunnerEnv(readFileSync(join(directory, CLAUDE_CREDENTIAL_ID), "utf8")));
232
- } catch {
233
- }
234
- }
235
- if (options.ignoreHeld !== true && held !== void 0) found.add(held.variable);
236
- return found;
237
- }
238
- var complained = /* @__PURE__ */ new Set();
239
- function complain(path, reason) {
240
- if (complained.has(path)) return;
241
- complained.add(path);
242
- process.stderr.write(`the Claude credential file ${path} holds no usable credential: ${reason}
243
- `);
244
- }
245
- var held;
246
- var removedValues = /* @__PURE__ */ new Set();
247
- function holdClaudeCredential(env = process.env) {
248
- held ??= readClaudeCredential(env);
249
- for (const name of CLAUDE_CREDENTIAL_VARIABLES) {
250
- const value = env[name];
251
- if (value !== void 0 && value !== "") removedValues.add(value);
252
- delete env[name];
253
- }
254
- return held;
255
- }
256
- function takeClaudeCredential(env, hooks) {
257
- return /^builtin:(container|process|vm)$/.test(hooks.provision) ? holdClaudeCredential(env) : void 0;
258
- }
259
- function removedClaudeCredentialValues() {
260
- return [...removedValues];
261
- }
262
- function heldClaudeCredential() {
263
- return held;
264
- }
265
- function currentClaudeCredential(env) {
266
- return held ?? readClaudeCredential(env);
267
- }
268
- var SETS = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=/;
269
- function credentialLineIn(text) {
270
- const set = parseRunnerEnv(text);
271
- const lines = text.split("\n");
272
- for (const variable of FORWARDED) {
273
- if ((set[variable] ?? "") === "") continue;
274
- const line = lines.find((candidate) => (parseRunnerEnv(candidate)[variable] ?? "") !== "");
275
- return line.replace(/^\s*(?:export\s+)?/, "").trimEnd();
276
- }
277
- return void 0;
278
- }
279
- function withoutCredentialLines(text) {
280
- const lines = text.split("\n");
281
- const kept = lines.filter((line) => !CLAUDE_CREDENTIAL_VARIABLES.includes(SETS.exec(line)?.[1] ?? ""));
282
- if (kept.length === lines.length) return void 0;
283
- while (kept[kept.length - 1] === "") kept.pop();
284
- return kept.length === 0 ? "" : `${kept.join("\n")}
285
- `;
286
- }
287
-
288
- // src/runner/builtin-destinations.ts
289
- var GATEWAY_DESTINATION = "gateway";
290
- var CLAUDE_DESTINATION = "claude";
291
- var BUILT_IN_NAMES = [GATEWAY_DESTINATION, CLAUDE_DESTINATION];
292
- var GATEWAY_PORT = 3126;
293
- var CLAUDE_PORT = 3127;
294
- var GATEWAY_SOCKET = "gateway.sock";
295
- var CLAUDE_SOCKET = "claude.sock";
296
- var CLAUDE_UPSTREAM = "https://api.anthropic.com/";
297
- var AGENT_CREDENTIAL_MISSING = "agent_credential_missing";
298
- var OAUTH_PLACEHOLDER = "sk-ant-oat01-placeholder-not-a-real-token";
299
- var API_KEY_PLACEHOLDER = "sk-ant-api03-placeholder-not-a-real-key";
300
- var ITEM_KEY_PLACEHOLDER = "olitem_placeholder-not-a-real-key";
301
- var ITEM_KEY_VARIABLE = "OUTERLAYER_ITEM_KEY";
302
- function claudeCredential(hostEnv, options = {}) {
303
- const credential = options.ignoreHeld === true ? readClaudeCredential(hostEnv) : currentClaudeCredential(hostEnv);
304
- if (credential === void 0) return void 0;
305
- return { variable: credential.variable, placeholder: credential.variable === "CLAUDE_CODE_OAUTH_TOKEN" ? OAUTH_PLACEHOLDER : API_KEY_PLACEHOLDER };
306
- }
307
- function managedClaudeCredential() {
308
- return { variable: "ANTHROPIC_API_KEY", placeholder: API_KEY_PLACEHOLDER };
309
- }
310
- function gatewayUpstream(gatewayUrl) {
311
- return `${new URL(gatewayUrl).origin}/`;
312
- }
313
- function forwardedEnvironment(hostEnv) {
314
- const env = {};
315
- for (const name of ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY"]) {
316
- Object.defineProperty(env, name, {
317
- enumerable: true,
318
- get: () => {
319
- const current = currentClaudeCredential(hostEnv);
320
- return current !== void 0 && current.variable === name ? current.value : hostEnv[name];
321
- }
322
- });
323
- }
324
- return env;
325
- }
326
- function builtInDestinations(input) {
327
- const managedKey = input.claudeApiKey !== void 0 && input.claudeApiKey !== "";
328
- const credential = managedKey ? void 0 : claudeCredential(input.hostEnv);
329
- const apiKeyMode = managedKey || credential?.variable === "ANTHROPIC_API_KEY";
330
- return [
331
- {
332
- destination: {
333
- name: GATEWAY_DESTINATION,
334
- upstream: gatewayUpstream(input.gatewayUrl),
335
- header: { name: "Authorization", value: `Bearer \${${ITEM_KEY_VARIABLE}}`, variables: [ITEM_KEY_VARIABLE] },
336
- env: {}
337
- },
338
- hostEnv: input.itemKey === void 0 ? {} : { [ITEM_KEY_VARIABLE]: input.itemKey },
339
- drop: [],
340
- socket: GATEWAY_SOCKET
341
- },
342
- {
343
- destination: {
344
- name: CLAUDE_DESTINATION,
345
- upstream: input.claudeUpstream ?? CLAUDE_UPSTREAM,
346
- header: apiKeyMode ? { name: "x-api-key", value: "${ANTHROPIC_API_KEY}", variables: ["ANTHROPIC_API_KEY"] } : { name: "Authorization", value: "Bearer ${CLAUDE_CODE_OAUTH_TOKEN}", variables: ["CLAUDE_CODE_OAUTH_TOKEN"] },
347
- env: {}
348
- },
349
- hostEnv: managedKey ? { ANTHROPIC_API_KEY: input.claudeApiKey } : forwardedEnvironment(input.hostEnv),
350
- // A build's own key in either header would sit beside the runner's, and the upstream takes one of them.
351
- drop: ["x-api-key", "authorization"],
352
- socket: CLAUDE_SOCKET
353
- }
354
- ];
355
- }
356
- function builtInEnvironment(localFor, credential) {
357
- return {
358
- OUTERLAYER_URL: localFor(GATEWAY_DESTINATION),
359
- OUTERLAYER_API_KEY: ITEM_KEY_PLACEHOLDER,
360
- ANTHROPIC_BASE_URL: localFor(CLAUDE_DESTINATION),
361
- ...credential === void 0 ? {} : { [credential.variable]: credential.placeholder },
362
- CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1"
363
- };
364
- }
365
-
366
- // src/runner/destinations.ts
367
13
  var MAX_RELEASED_DESTINATIONS = 20;
368
- var MAX_DESTINATIONS = MAX_RELEASED_DESTINATIONS - BUILT_IN_NAMES.length;
14
+ function maxDestinations(agents = defaultAgents(), providers = PROVIDERS) {
15
+ return MAX_RELEASED_DESTINATIONS - builtInNames(agents, providers).length;
16
+ }
369
17
  var DESTINATION_BASE_PORT = 3129;
370
18
  var DESTINATION_NAME = /^[a-z0-9][a-z0-9-]{0,62}$/;
371
19
  var VARIABLE_NAME = /^[A-Za-z_][A-Za-z0-9_]{0,254}$/;
@@ -377,12 +25,14 @@ var UPSTREAM_IDLE_MS = 6e5;
377
25
  function headerVariables(destinations) {
378
26
  return [...new Set((destinations ?? []).flatMap((d) => d.header.variables))];
379
27
  }
380
- function resolveDestinations(given, variables, isReserved, fail) {
28
+ function resolveDestinations(given, variables, isReserved, fail, agents = defaultAgents(), providers = PROVIDERS) {
381
29
  if (!Array.isArray(given)) fail("runner.build.destinations", "must be a list of destinations");
382
- if (given.length > MAX_DESTINATIONS) {
30
+ const builtIns = builtInNames(agents, providers);
31
+ const most = maxDestinations(agents, providers);
32
+ if (given.length > most) {
383
33
  fail(
384
34
  "runner.build.destinations",
385
- `lists ${given.length} destinations; a release records at most ${MAX_RELEASED_DESTINATIONS}, and ${BUILT_IN_NAMES.length} of those are the built-in ${BUILT_IN_NAMES.join(" and ")} destinations, so a host lists at most ${MAX_DESTINATIONS}`
35
+ `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}`
386
36
  );
387
37
  }
388
38
  const resolved = [];
@@ -401,7 +51,7 @@ function resolveDestinations(given, variables, isReserved, fail) {
401
51
  if (typeof name !== "string" || !DESTINATION_NAME.test(name)) {
402
52
  fail(`${at}.name`, "must be 1 to 63 lower-case letters, digits or hyphens, starting with a letter or digit");
403
53
  }
404
- if (BUILT_IN_NAMES.includes(name)) fail(`${at}.name`, `is ${name}, a destination the runner serves itself`);
54
+ if (builtIns.includes(name)) fail(`${at}.name`, `is ${name}, a destination the runner serves itself`);
405
55
  if (names.has(name)) fail(`${at}.name`, `repeats the destination ${name}`);
406
56
  names.add(name);
407
57
  const upstream = parseUpstream(record.upstream, `${at}.upstream`, fail);
@@ -655,7 +305,7 @@ async function startBuildServices(input) {
655
305
  targets.set(destinationTarget(index), (stream) => server.acceptStream(stream));
656
306
  if (server.port !== void 0) destinationPorts.push(server.port);
657
307
  }
658
- const builtIns = input.builtIns === void 0 ? [] : builtInDestinations({ gatewayUrl: input.builtIns.gatewayUrl, itemKey: input.builtIns.itemKey, hostEnv: input.hostEnv, claudeUpstream: input.builtIns.claudeUpstream, claudeApiKey: input.builtIns.claudeApiKey });
308
+ const builtIns = input.builtIns === void 0 ? [] : builtInDestinations({ ...input.builtIns, hostEnv: input.hostEnv }, input.builtIns.agents, input.builtIns.providers);
659
309
  for (const builtIn of builtIns) {
660
310
  const server = await startDestination({
661
311
  destination: builtIn.destination,
@@ -863,8 +513,8 @@ function runnerLiterals(repository, repositories = [], unpinnedRuntimes, missing
863
513
  ...missingSetupScripts === void 0 || missingSetupScripts.length === 0 ? {} : { OUTERLAYER_MISSING_SETUP_SCRIPTS: JSON.stringify(missingSetupScripts) }
864
514
  };
865
515
  }
866
- function containerBuiltInAddress(name) {
867
- return `http://127.0.0.1:${name === GATEWAY_DESTINATION ? GATEWAY_PORT : CLAUDE_PORT}`;
516
+ function containerBuiltInAddress(name, agents) {
517
+ return `http://127.0.0.1:${destinationPort(name, agents)}`;
868
518
  }
869
519
  function reservedNames() {
870
520
  return /* @__PURE__ */ new Set([
@@ -881,8 +531,8 @@ function isReservedVariable(name) {
881
531
  function isRefusedInConfig(name) {
882
532
  return isReservedVariable(name) && !githubVariables().has(name);
883
533
  }
884
- function isMiseVariableAllowed(name) {
885
- return /^[A-Za-z_][A-Za-z0-9_]*$/.test(name) && !isReservedVariable(name) && !CLAUDE_CREDENTIAL_VARIABLES.includes(name);
534
+ function isMiseVariableAllowed(name, agents) {
535
+ return /^[A-Za-z_][A-Za-z0-9_]*$/.test(name) && !isReservedVariable(name) && !strippedVariables(agents).includes(name);
886
536
  }
887
537
  function withMiseVariables(env, variables) {
888
538
  if (variables === void 0) return env;
@@ -906,6 +556,7 @@ function buildEnvironment(input) {
906
556
  if (!isReservedVariable(name) && !(name in authored)) recipe[name] = value;
907
557
  }
908
558
  const builtIns = input.builtIns === true;
559
+ const credentialVariables = strippedVariables(input.agents);
909
560
  const passed = {
910
561
  ...builtIns ? {} : { OUTERLAYER_URL: input.config.url },
911
562
  ...builtIns || input.itemKey === void 0 ? {} : { OUTERLAYER_API_KEY: input.itemKey },
@@ -918,7 +569,7 @@ function buildEnvironment(input) {
918
569
  if (input.factoryVariables !== void 0) {
919
570
  for (const { name, value } of input.factoryVariables) {
920
571
  if (isReservedVariable(name) || name in authored) continue;
921
- if (builtIns && CLAUDE_CREDENTIAL_VARIABLES.includes(name)) continue;
572
+ if (builtIns && credentialVariables.includes(name)) continue;
922
573
  passed[name] = value;
923
574
  variables.push(name);
924
575
  }
@@ -931,13 +582,13 @@ function buildEnvironment(input) {
931
582
  }
932
583
  const value = input.hostEnv[name];
933
584
  if (value === void 0 || isReservedVariable(name) || name in authored) continue;
934
- if (builtIns && CLAUDE_CREDENTIAL_VARIABLES.includes(name)) continue;
585
+ if (builtIns && credentialVariables.includes(name)) continue;
935
586
  passed[name] = value;
936
587
  variables.push(name);
937
588
  }
938
589
  }
939
590
  const destinations = destinationEnvironment(input.config.build?.destinations, containerLocalAddress);
940
- const builtInLiterals = builtIns ? builtInEnvironment(containerBuiltInAddress, input.config.managed === true ? managedClaudeCredential() : claudeCredential(input.hostEnv)) : {};
591
+ const builtInLiterals = builtIns ? builtInEnvironment((name) => containerBuiltInAddress(name, input.agents), input.config.managed === true ? managedAgentCredential(input.agents) : agentCredential(input.hostEnv, {}, input.agents), input.agents) : {};
941
592
  const hooksPath = input.identity?.hooksPath;
942
593
  const hooks = {};
943
594
  if (hooksPath !== void 0) {
@@ -978,7 +629,7 @@ function checkEnvironment(input) {
978
629
  builtIns: false,
979
630
  factoryVariables: input.factoryVariables
980
631
  });
981
- const withheld = /* @__PURE__ */ new Set(["OUTERLAYER_URL", "OUTERLAYER_API_KEY", ...CLAUDE_CREDENTIAL_VARIABLES]);
632
+ const withheld = /* @__PURE__ */ new Set(["OUTERLAYER_URL", "OUTERLAYER_API_KEY", ...strippedVariables()]);
982
633
  const literals = { OUTERLAYER_EVAL_INPUT: EVAL_INPUT_DIR, OUTERLAYER_CHECK_ITEMS: CHECK_ITEMS_FILE };
983
634
  for (const [name, value] of Object.entries(env.literals)) if (!withheld.has(name)) literals[name] = value;
984
635
  const passed = {};
@@ -1026,4 +677,4 @@ function routesOf(counts) {
1026
677
  return routes.length === 0 ? {} : { routes };
1027
678
  }
1028
679
 
1029
- export { AGENT_CREDENTIAL_MISSING, BUILD_HOME, BUILD_SLICE_MEMORY_ENV, BUILT_IN_NAMES, CHECKOUT_DIR, CHECK_ITEMS_FILE, CLAUDE_CREDENTIAL_ID, CLAUDE_CREDENTIAL_VARIABLES, CLAUDE_ENV_FILE, CLAUDE_PORT, CLAUDE_SOCKET, DESTINATION_BASE_PORT, EVAL_INPUT_DIR, FD_SLOTS_PER_BUILD, FD_STORE_ENV, FORWARDED_CLAUDE_CREDENTIAL_VARIABLES, GATEWAY_PORT, GATEWAY_SOCKET, JOB_MOUNT, MIN_SYSTEMD, PROXY_WARNING_FLAG, RELAY_PORT, SCRUB_ENV_VARIABLE, authorEnvironment, buildEnvironment, builtInEnvironment, checkEnvironment, checkoutPath, claudeCredential, claudeCredentialVariablesSet, claudeEnvPath, commitIdentityRecord, containerLocalAddress, credentialLineIn, currentClaudeCredential, destinationEnvironment, fdName, headerVariables, heldClaudeCredential, inspectService, isMiseVariableAllowed, isRefusedInConfig, isReservedVariable, lifecycleWorkdir, managedClaudeCredential, parseClaimIdentity, parseClaimedRepositories, parseIsolation, parseRunnerEnv, parseUnreachable, primaryOf, proxyEnvironment, readClaudeCredential, realFdStorePort, realInspectProbes, removedClaudeCredentialValues, repositoriesOf, repositoryPath, resolveDestinations, sharedUserEnvironment, startBuildServices, takeClaudeCredential, tokenHeader, withGitConfig, withHooksPath, withMiseVariables, withProxyWarningHidden, withTokenHeader, withTunnelRecord, withoutCredentialLines };
680
+ export { BUILD_HOME, CHECKOUT_DIR, CHECK_ITEMS_FILE, DESTINATION_BASE_PORT, EVAL_INPUT_DIR, JOB_MOUNT, PROXY_WARNING_FLAG, RELAY_PORT, SCRUB_ENV_VARIABLE, authorEnvironment, buildEnvironment, checkEnvironment, checkoutPath, commitIdentityRecord, containerLocalAddress, destinationEnvironment, headerVariables, isMiseVariableAllowed, isRefusedInConfig, isReservedVariable, lifecycleWorkdir, parseClaimIdentity, parseClaimedRepositories, parseIsolation, parseUnreachable, primaryOf, proxyEnvironment, repositoriesOf, repositoryPath, resolveDestinations, sharedUserEnvironment, startBuildServices, tokenHeader, withGitConfig, withHooksPath, withMiseVariables, withProxyWarningHidden, withTokenHeader, withTunnelRecord };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { isSameProcess } from './chunk-JBJTC3UU.js';
4
- import { RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-WT7J2627.js';
4
+ import { RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-DTCTXDJP.js';
5
5
  import { existsSync, readFileSync, mkdirSync, writeFileSync, rmSync } from 'fs';
6
6
  import { dirname } from 'path';
7
7
 
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { scrubReason, stripTerminalControls } from './chunk-KLXECBIE.js';
4
- import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-AGKQEOFS.js';
5
- import { RunnerAlreadyRunningError, readPidFile } from './chunk-WAZJPDR2.js';
3
+ import { scrubReason, stripTerminalControls } from './chunk-XEWG4AB2.js';
4
+ import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-CSBW4LGL.js';
5
+ import { RunnerAlreadyRunningError, readPidFile } from './chunk-D4VGJQY7.js';
6
6
  import { isSameProcess } from './chunk-JBJTC3UU.js';
7
- import { keyRunnerFactory } from './chunk-RIIPBJK6.js';
8
- import { isSignatureRefusal, postJson } from './chunk-SPXVFFQV.js';
9
- import { signerFor } from './chunk-4DJZSNVT.js';
10
- import { pidFilePath } from './chunk-WT7J2627.js';
7
+ import { keyRunnerFactory } from './chunk-WACPWYMH.js';
8
+ import { isSignatureRefusal, postJson } from './chunk-AQE6E54X.js';
9
+ import { signerFor } from './chunk-IKFAJTLZ.js';
10
+ import { pidFilePath } from './chunk-DTCTXDJP.js';
11
11
  import { readFileSync } from 'fs';
12
12
 
13
13
  createRequire(import.meta.url);
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE } from './chunk-CXFJOX2C.js';
4
- import { normalizePath, CONTEXT_PIN_FILENAME } from './chunk-24FEVLX7.js';
3
+ import { normalizePath, CONTEXT_PIN_FILENAME, contextAgents, defaultAgents, AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE, legacyAgent, legacySubcommand } from './chunk-I6U6QPN6.js';
4
+ import { LEGACY_AGENT } from './chunk-LSLK4RS4.js';
5
5
  import { existsSync, readdirSync, readFileSync, mkdirSync, writeFileSync, lstatSync, readlinkSync, symlinkSync, rmdirSync } from 'fs';
6
- import { relative, sep, join } from 'path';
6
+ import { relative, sep, join, posix } from 'path';
7
7
 
8
8
  createRequire(import.meta.url);
9
9
  var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git"]);
@@ -41,8 +41,15 @@ function walk(dir, repoRoot, insideOuterlayer, out) {
41
41
  // src/layout.ts
42
42
  var AGENTS_MD_LAYOUT = 2;
43
43
  var FIRST_VERSION_READING_AGENTS_SKILLS = "0.21.0";
44
- var SKILLS_LINK_PATH = ".claude/skills";
45
- var SKILLS_LINK_TARGET = "../.agents/skills";
44
+ function linkTargetFor(folder) {
45
+ return posix.relative(posix.dirname(folder), AGENTS_SKILLS_BASE);
46
+ }
47
+ function mcpFiles(agents = defaultAgents()) {
48
+ return [...new Set(contextAgents(agents).map((agent) => agent.context.mcp.file))];
49
+ }
50
+ function skillLinkFolders(agents = defaultAgents()) {
51
+ return contextAgents(agents).flatMap((agent) => agent.descriptor.context.repoSkillFolders);
52
+ }
46
53
  var CONFIG_PATH = ".outerlayer/config.json";
47
54
  function readConfigObject(repoRoot) {
48
55
  try {
@@ -97,8 +104,9 @@ function filesBelow(repoRoot, rel) {
97
104
  }
98
105
  return out.sort();
99
106
  }
100
- function linkClaudeSkills(repoRoot) {
101
- const abs = join(repoRoot, SKILLS_LINK_PATH);
107
+ function linkFolder(repoRoot, folder) {
108
+ const abs = join(repoRoot, folder);
109
+ const target = linkTargetFor(folder);
102
110
  let stat;
103
111
  try {
104
112
  stat = lstatSync(abs);
@@ -107,45 +115,63 @@ function linkClaudeSkills(repoRoot) {
107
115
  }
108
116
  if (stat?.isSymbolicLink()) {
109
117
  try {
110
- return readlinkSync(abs) === SKILLS_LINK_TARGET ? { status: "present" } : { status: "elsewhere" };
118
+ return readlinkSync(abs) === target ? { status: "present" } : { status: "elsewhere" };
111
119
  } catch {
112
120
  return { status: "elsewhere" };
113
121
  }
114
122
  }
115
123
  if (stat !== void 0) {
116
- if (!stat.isDirectory()) return { status: "blocked", blocking: [SKILLS_LINK_PATH] };
117
- const files = filesBelow(repoRoot, SKILLS_LINK_PATH);
124
+ if (!stat.isDirectory()) return { status: "blocked", blocking: [folder] };
125
+ const files = filesBelow(repoRoot, folder);
118
126
  if (files.length > 0) return { status: "blocked", blocking: files };
119
127
  removeEmptyTree(abs);
120
128
  }
121
129
  try {
122
- mkdirSync(join(repoRoot, ".claude"), { recursive: true });
123
- symlinkSync(SKILLS_LINK_TARGET, abs, "dir");
130
+ mkdirSync(join(repoRoot, posix.dirname(folder)), { recursive: true });
131
+ symlinkSync(target, abs, "dir");
124
132
  return { status: "linked" };
125
133
  } catch (err) {
126
134
  return { status: "failed", reason: err instanceof Error ? err.message : String(err) };
127
135
  }
128
136
  }
137
+ var URGENCY = { failed: 4, blocked: 3, elsewhere: 2, linked: 1, present: 0 };
138
+ function linkAgentSkills(repoRoot, agents = defaultAgents()) {
139
+ const outcomes = contextAgents(agents).flatMap(
140
+ (agent) => agent.descriptor.context.repoSkillFolders.map((folder) => {
141
+ const outcome = linkFolder(repoRoot, folder);
142
+ return agent.descriptor.id === LEGACY_AGENT ? outcome : { ...outcome, folder, agent: agent.descriptor.label };
143
+ })
144
+ );
145
+ const first = outcomes.reduce((pick, outcome) => pick === void 0 || URGENCY[outcome.status] > URGENCY[pick.status] ? outcome : pick, void 0);
146
+ if (first === void 0) return { status: "present" };
147
+ const linkedFolders = contextAgents(agents).flatMap((agent) => agent.descriptor.context.repoSkillFolders.map((folder) => ({ folder, id: agent.descriptor.id })));
148
+ if (first.status !== "linked" || linkedFolders.every((entry) => entry.id === LEGACY_AGENT)) return first;
149
+ return { ...first, folders: outcomes.flatMap((outcome, index) => outcome.status === "linked" ? [linkedFolders[index].folder] : []) };
150
+ }
129
151
  function removeEmptyTree(abs) {
130
152
  for (const entry of readdirSync(abs, { withFileTypes: true })) {
131
153
  if (entry.isDirectory()) removeEmptyTree(join(abs, entry.name));
132
154
  }
133
155
  rmdirSync(abs);
134
156
  }
135
- var WINDOWS_LINK_NOTE = "On Windows, git commits a link only when core.symlinks is true. Without it, git writes a text file and Claude Code finds no skills.";
136
- function describeSkillsLink(outcome) {
157
+ var windowsLinkNote = (agent) => `On Windows, git commits a link only when core.symlinks is true. Without it, git writes a text file and ${agent} finds no skills.`;
158
+ function describeSkillsLink(outcome, agents = defaultAgents()) {
159
+ const fallback = legacyAgent(agents);
160
+ const folder = outcome.folder ?? fallback.descriptor.context.repoSkillFolders[0];
161
+ const agent = outcome.agent ?? fallback.descriptor.label;
162
+ const target = linkTargetFor(folder);
137
163
  switch (outcome.status) {
138
164
  case "linked":
139
- return `Linked ${SKILLS_LINK_PATH} to ${SKILLS_LINK_TARGET}, so Claude Code finds the skills. ${WINDOWS_LINK_NOTE}`;
165
+ return `Linked ${folder} to ${target}, so ${agent} finds the skills. ${windowsLinkNote(agent)}`;
140
166
  case "present":
141
167
  return "";
142
168
  case "blocked":
143
- return `Left ${SKILLS_LINK_PATH}/ as it is and made no link, because it still holds ${outcome.blocking.join(", ")}.`;
169
+ return `Left ${folder}/ as it is and made no link, because it still holds ${outcome.blocking.join(", ")}.`;
144
170
  case "elsewhere":
145
- return `Left ${SKILLS_LINK_PATH} as it is: it is a link to somewhere other than ${SKILLS_LINK_TARGET}.`;
171
+ return `Left ${folder} as it is: it is a link to somewhere other than ${target}.`;
146
172
  case "failed":
147
- return `Could not link ${SKILLS_LINK_PATH} to ${SKILLS_LINK_TARGET}: ${outcome.reason}. On Windows, git needs core.symlinks and a permission to create links. The launcher, \`outerlayer claude\`, does not need the link.`;
173
+ return `Could not link ${folder} to ${target}: ${outcome.reason}. On Windows, git needs core.symlinks and a permission to create links. The launcher, \`outerlayer ${legacySubcommand(agents)}\`, does not need the link.`;
148
174
  }
149
175
  }
150
176
 
151
- export { AGENTS_MD_LAYOUT, FIRST_VERSION_READING_AGENTS_SKILLS, SKILLS_LINK_PATH, declareAgentsMdLayout, describeSkillsLink, discoverOuterlayerPaths, filesBelow, holdsTodaysLayoutSources, isAgentsMdLayout, isForeignTree, linkClaudeSkills, readConfigObject, skillsBaseFor, toRepoRelative };
177
+ export { AGENTS_MD_LAYOUT, FIRST_VERSION_READING_AGENTS_SKILLS, declareAgentsMdLayout, describeSkillsLink, discoverOuterlayerPaths, filesBelow, holdsTodaysLayoutSources, isAgentsMdLayout, isForeignTree, linkAgentSkills, mcpFiles, readConfigObject, skillLinkFolders, skillsBaseFor, toRepoRelative };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { runnerDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-WT7J2627.js';
3
+ import { runnerDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-DTCTXDJP.js';
4
4
  import { readlinkSync, realpathSync, mkdirSync, unlinkSync, symlinkSync, renameSync, readFileSync, writeFileSync, rmSync, existsSync, readdirSync } from 'fs';
5
5
  import { join, basename, sep, resolve } from 'path';
6
6
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { BUILD_HOME } from './chunk-GANAOCHR.js';
3
+ import { BUILD_HOME } from './chunk-CXJC3JLN.js';
4
4
  import { readdirSync } from 'fs';
5
5
  import { join, dirname } from 'path';
6
6