@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,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { hostKeyPath, runnerDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-WT7J2627.js';
3
+ import { hostKeyPath, runnerDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-DTCTXDJP.js';
4
4
  import { generateKeyPairSync, createPrivateKey, createPublicKey, sign } from 'crypto';
5
5
  import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
6
6
 
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { startTimeOf } from './chunk-JBJTC3UU.js';
4
- import { EXEC_PORT } from './chunk-UZGQT6OF.js';
5
- import { TUNNEL_PORT, BRIDGE_ADDRESS, BRIDGE_CIDR } from './chunk-MKSZHT6S.js';
6
- import { RELAY_PORT } from './chunk-GANAOCHR.js';
4
+ import { EXEC_PORT } from './chunk-H2NJG3TE.js';
5
+ import { TUNNEL_PORT, BRIDGE_ADDRESS, BRIDGE_CIDR } from './chunk-2YC3TXWX.js';
6
+ import { RELAY_PORT } from './chunk-CXJC3JLN.js';
7
7
  import { spawn, spawnSync } from 'child_process';
8
8
  import { symlinkSync, lstatSync, writeFileSync, chmodSync, mkdirSync, existsSync } from 'fs';
9
9
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-WT7J2627.js';
3
+ import { RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-DTCTXDJP.js';
4
4
  import { readFileSync, mkdirSync, writeFileSync, renameSync } from 'fs';
5
5
  import { join } from 'path';
6
6
 
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'node:module';
3
+ import { DEFAULT_UNIT_NAME } from './chunk-CSBW4LGL.js';
4
+ import { RUNNER_FILE_MODE } from './chunk-DTCTXDJP.js';
5
+ import { runnerAgents, credentialAgent, credentialForms, orList, credentialShapes, credentialEnvPath, withoutCredentialLines, parseRunnerEnv, forwardedVariables } from './chunk-DTQPDMHG.js';
6
+ import { defaultAgents } from './chunk-I6U6QPN6.js';
7
+ import { existsSync, readFileSync, writeFileSync, renameSync, rmSync } from 'fs';
8
+ import { join, dirname } from 'path';
9
+
10
+ createRequire(import.meta.url);
11
+ var AGENT_COMMANDS = {
12
+ claude: {
13
+ implement: 'claude -p "/build" --permission-mode bypassPermissions',
14
+ amend: 'claude -p "/outerlayer-amend" --permission-mode bypassPermissions'
15
+ }
16
+ };
17
+ function isAgentName(name) {
18
+ return Object.hasOwn(AGENT_COMMANDS, name);
19
+ }
20
+ var RunnerEnvError = class extends Error {
21
+ };
22
+ function runnerEnvPath(configPath) {
23
+ return join(dirname(configPath), "runner.env");
24
+ }
25
+ function credentialFromStdin(text, agents = defaultAgents()) {
26
+ const value = (text ?? "").trim();
27
+ if (value === "") return void 0;
28
+ for (const agent2 of runnerAgents(agents)) {
29
+ const variable = agent2.credentials.identify(value);
30
+ if (variable !== void 0) return { variable, value };
31
+ }
32
+ const agent = credentialAgent(agents);
33
+ if (agent === void 0) throw new RunnerEnvError("no agent takes a credential on stdin, so nothing was written.");
34
+ throw new RunnerEnvError(`the value on stdin is not a ${credentialForms(agent.descriptor).label} credential, so nothing was written. Pipe one value: ${orList(credentialShapes(agent.descriptor).map((shape) => `${shape.phrase}, which starts ${shape.starts}`))}.`);
35
+ }
36
+ function setsCredential(path, agents) {
37
+ if (!existsSync(path)) return false;
38
+ const env = parseRunnerEnv(readFileSync(path, "utf8"));
39
+ return forwardedVariables(agents).some((name) => env[name]);
40
+ }
41
+ function hasStoredCredential(configPath, agents = defaultAgents()) {
42
+ const own = credentialEnvPath(configPath, agents);
43
+ return own !== void 0 && setsCredential(own, agents) || setsCredential(runnerEnvPath(configPath), agents);
44
+ }
45
+ function replaceFile(path, text) {
46
+ const temporary = `${path}.${process.pid}.tmp`;
47
+ try {
48
+ writeFileSync(temporary, text, { mode: RUNNER_FILE_MODE, flag: "wx" });
49
+ renameSync(temporary, path);
50
+ } catch (err) {
51
+ rmSync(temporary, { force: true });
52
+ throw err;
53
+ }
54
+ }
55
+ function storeAgentCredential(configPath, credential, agents = defaultAgents()) {
56
+ const owner = runnerAgents(agents).find((agent) => agent.descriptor.credentials.forwarded.includes(credential.variable)) ?? credentialAgent(agents);
57
+ if (owner === void 0) throw new RunnerEnvError("no agent takes a credential, so nothing was written.");
58
+ const path = join(dirname(configPath), credentialForms(owner.descriptor).envFile);
59
+ replaceFile(path, `${credential.variable}=${credential.value}
60
+ `);
61
+ const runnerPath = runnerEnvPath(configPath);
62
+ if (existsSync(runnerPath)) {
63
+ const dropped = withoutCredentialLines(readFileSync(runnerPath, "utf8"), agents);
64
+ if (dropped !== void 0) replaceFile(runnerPath, dropped);
65
+ }
66
+ return path;
67
+ }
68
+ function restartForCredential(state, unitName = DEFAULT_UNIT_NAME, agents = defaultAgents()) {
69
+ const agent = credentialAgent(agents);
70
+ const file = agent === void 0 ? "the credential file" : credentialForms(agent.descriptor).envFile;
71
+ if (state === "differs") {
72
+ return `The service ${unitName} was not written by runner init, so it may not load ${file}, the one file that now holds the credential. Add EnvironmentFile=-<config directory>/${file} to it, or run runner install --service --replace. Then restart it: sudo systemctl restart ${unitName}`;
73
+ }
74
+ if (state !== "pending-restart") return void 0;
75
+ return `The service ${unitName} loads ${file} only when it starts. Restart it so it uses the stored credential: sudo systemctl restart ${unitName}`;
76
+ }
77
+
78
+ export { AGENT_COMMANDS, RunnerEnvError, credentialFromStdin, hasStoredCredential, isAgentName, restartForCredential, storeAgentCredential };
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { criteriaOf, loadCitationFinder, hostItemsOf, criterionInputs, NO_CITING_TEST_REASON, NO_TEST_FILES_REASON, NO_VERDICT_REASON, isFoundInReason, uncitedIds, planCriteria, pickSearchable, IdScan, testFileMatcher, foundInReason, MAX_TEST_FILE_BYTES, MAX_TEST_FILES, groupBySize } from './chunk-AH6634HC.js';
4
- import { WorkCommandError, resolveCredentials, getJson } from './chunk-SPXVFFQV.js';
5
- import { C } from './chunk-2AM6Z5BP.js';
3
+ import { criteriaOf, loadCitationFinder, hostItemsOf, criterionInputs, NO_CITING_TEST_REASON, NO_TEST_FILES_REASON, NO_VERDICT_REASON, isFoundInReason, uncitedIds, planCriteria, pickSearchable, IdScan, testFileMatcher, foundInReason, MAX_TEST_FILE_BYTES, MAX_TEST_FILES, groupBySize } from './chunk-FOSYM7TQ.js';
4
+ import { WorkCommandError, resolveCredentials, getJson } from './chunk-AQE6E54X.js';
6
5
  import { sanitizeTerminal } from './chunk-P6PHY33P.js';
7
- import { defaultFetch } from './chunk-YQHEJ5SV.js';
8
- import { resolveRepoIdentity } from './chunk-5GHJFETA.js';
9
- import { parseWorkItemEnv } from './chunk-5WYT3PPE.js';
6
+ import { resolveRepoIdentity } from './chunk-6KH3NMIT.js';
7
+ import { C } from './chunk-2AM6Z5BP.js';
8
+ import { defaultFetch } from './chunk-NXQK2I3G.js';
9
+ import { parseWorkItemEnv } from './chunk-4OD45RBP.js';
10
10
  import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
11
11
  import { readDeliveryRecord } from './chunk-YQR6E6OV.js';
12
12
  import { inferArtifactKind, mediaTypeForArtifactPath, WORK_ITEM_COMMENT_MAX_BODY_LENGTH } from './chunk-WUKLQWGY.js';
@@ -217,14 +217,14 @@ function governingDir(cwd) {
217
217
  async function testProofMode(cwd) {
218
218
  const dir = governingDir(cwd);
219
219
  if (dir === void 0) return "any";
220
- const { testProofIn } = await import('./host-checks-S3B7Z4SY.js');
220
+ const { testProofIn } = await import('./host-checks-WAPO5X7X.js');
221
221
  return testProofIn(dir);
222
222
  }
223
223
  async function judgeCheckName(cwd) {
224
224
  const dir = governingDir(cwd);
225
225
  if (dir === void 0) return {};
226
226
  if (!existsSync(dir)) return { note: `the governed context at ${dir} is not readable` };
227
- const { checksIn, isJudgeCheck } = await import('./host-checks-S3B7Z4SY.js');
227
+ const { checksIn, isJudgeCheck } = await import('./host-checks-WAPO5X7X.js');
228
228
  const quiet = { line: () => void 0, error: () => void 0 };
229
229
  const check = checksIn(dir, quiet, "").checks.find((c) => isJudgeCheck(c) && c.judge.subjects === "criteria");
230
230
  return check === void 0 ? {} : { name: check.name };
@@ -369,7 +369,7 @@ async function runWorkProofs(opts) {
369
369
  async function runWorkProofsCommand(opts) {
370
370
  try {
371
371
  if (opts.record) {
372
- const { runWorkProofsRecord } = await import('./work-proofs-record-6WLMOK53.js');
372
+ const { runWorkProofsRecord } = await import('./work-proofs-record-QPUM6DY4.js');
373
373
  const result2 = await runWorkProofsRecord(opts);
374
374
  process.exitCode = result2.exitCode;
375
375
  return;
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { mcpTargetPath, INIT_STDIO_ENTRY, INIT_DOCS_ENTRY, DOCS_MCP_SERVER_NAME } from './chunk-OHQMGLJP.js';
4
- import { VALIDATOR_FILES, VALIDATORS_DIR, POLICY_PATH, POLICY_CONTENT } from './chunk-B62TYDP2.js';
5
- import { skillsBaseFor } from './chunk-KFUDKFEH.js';
3
+ import { mcpTargetPath, INIT_STDIO_ENTRY, INIT_DOCS_ENTRY, DOCS_MCP_SERVER_NAME } from './chunk-MVPOYQQY.js';
4
+ import { VALIDATOR_FILES, VALIDATORS_DIR, POLICY_PATH, POLICY_CONTENT } from './chunk-B5SWBFVE.js';
5
+ import { skillsBaseFor } from './chunk-D6EXW4EB.js';
6
6
  import { findGitDirs } from './chunk-BJ3KTMDH.js';
7
- import { resolvePackRoot, AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE, restoreSkillPaths, rewriteSkillPaths, skillDir, loadTemplateFiles, TEMPLATE_SKILLS } from './chunk-CXFJOX2C.js';
8
7
  import { cliInvocation } from './chunk-FZKNTIOJ.js';
9
- import { hasSymlinkComponent } from './chunk-B7PYT2BY.js';
8
+ import { hasSymlinkComponent } from './chunk-PBGNX3PS.js';
10
9
  import { cloneIsGoverned } from './chunk-YQR6E6OV.js';
10
+ import { resolvePackRoot, AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE, restoreSkillPaths, rewriteSkillPaths, skillDir, loadTemplateFiles, TEMPLATE_SKILLS } from './chunk-I6U6QPN6.js';
11
11
  import { createHash } from 'crypto';
12
12
  import { existsSync, readFileSync } from 'fs';
13
13
  import { join } from 'path';
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { decodeWrappedCommand } from './chunk-KYDEBGJG.js';
3
+ import { decodeWrappedCommand } from './chunk-ZHQC43NH.js';
4
+ import { hookCodec } from './chunk-T5QBWM6M.js';
4
5
  import { homeFromEnv } from './chunk-352DHUTP.js';
5
6
  import { readFileSync, mkdirSync, appendFileSync, writeFileSync } from 'fs';
6
7
  import { spawn } from 'child_process';
@@ -48,14 +49,6 @@ function logError(home, err) {
48
49
  } catch {
49
50
  }
50
51
  }
51
- function parsePayload(bytes) {
52
- try {
53
- if (bytes.length === 0) return {};
54
- return JSON.parse(bytes.toString("utf8"));
55
- } catch {
56
- return {};
57
- }
58
- }
59
52
  function makeTailCollector(max = MAX_TAIL_BYTES) {
60
53
  let buf = Buffer.alloc(0);
61
54
  return {
@@ -110,6 +103,7 @@ async function runHookWrapFast(id, opts = {}) {
110
103
  const now = opts.now ?? Date.now;
111
104
  const captureOutput = opts.captureOutput ?? false;
112
105
  const proc = opts.proc ?? process;
106
+ const codec = opts.codec ?? hookCodec();
113
107
  if (!id) {
114
108
  logError(home, new Error("hook-wrap: missing --id"));
115
109
  return 0;
@@ -127,20 +121,20 @@ async function runHookWrapFast(id, opts = {}) {
127
121
  } catch {
128
122
  stdinBytes = Buffer.alloc(0);
129
123
  }
130
- const payload = parsePayload(stdinBytes);
131
124
  const execId = randomUUID();
132
125
  const startedAt = now();
133
126
  try {
127
+ const hook = codec.decode(void 0, stdinBytes.toString("utf8"));
134
128
  spool({
135
129
  rec: "started",
136
130
  execId,
137
131
  t: new Date(startedAt).toISOString(),
138
- sessionId: payload.session_id ?? null,
139
- hookEvent: payload.hook_event_name ?? null,
140
- toolUseId: payload.tool_use_id ?? null,
132
+ sessionId: hook.spool.sessionId ?? null,
133
+ hookEvent: hook.spool.payloadEvent ?? null,
134
+ toolUseId: hook.tool?.useId ?? null,
141
135
  // Costs a few bytes; makes an orphaned started-only record
142
136
  // self-describing ("PostToolUse Edit hung" vs. a bare uuid).
143
- toolName: payload.tool_name ?? null,
137
+ toolName: hook.tool?.name ?? null,
144
138
  cmdSha: createHash("sha256").update(original).digest("hex"),
145
139
  cmd: original.slice(0, MAX_CMD_LEN),
146
140
  pid: process.pid
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'node:module';
3
+
4
+ createRequire(import.meta.url);
5
+
6
+ // ../agents/src/claude-code/descriptor.ts
7
+ var CLAUDE_CODE = {
8
+ id: "claude-code",
9
+ label: "Claude Code",
10
+ color: "#D97757",
11
+ program: "claude",
12
+ legacy: {
13
+ subcommand: "claude",
14
+ runnerName: "claude",
15
+ usageEventValue: "claude_code",
16
+ envFile: "claude.env",
17
+ credentialId: "claude",
18
+ imagePaths: ["/opt/outerlayer/claude", "/usr/local/bin/claude", "/etc/claude-code"],
19
+ toolsVersionKey: "claudeCodeVersion",
20
+ handOffKey: "claudeCredential"
21
+ },
22
+ versions: { minimum: "2.1.284", tested: { from: "2.1.0", to: "2.1.255" } },
23
+ providers: ["anthropic"],
24
+ credentials: {
25
+ label: "Claude",
26
+ setupCommand: "claude setup-token",
27
+ forwarded: ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY"],
28
+ stripped: ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"],
29
+ placeholders: {
30
+ CLAUDE_CODE_OAUTH_TOKEN: "sk-ant-oat01-placeholder-not-a-real-token",
31
+ ANTHROPIC_API_KEY: "sk-ant-api03-placeholder-not-a-real-key"
32
+ },
33
+ kinds: {
34
+ CLAUDE_CODE_OAUTH_TOKEN: { pattern: "^sk-ant-oat[0-9]*-[A-Za-z0-9_-]+$", provider: "anthropic", providerKind: "oauth-token", starts: "sk-ant-oat" },
35
+ ANTHROPIC_API_KEY: { pattern: "^sk-ant-api[0-9]*-[A-Za-z0-9_-]+$", provider: "anthropic", providerKind: "api-key", starts: "sk-ant-api" },
36
+ ANTHROPIC_AUTH_TOKEN: { pattern: ".+", provider: "anthropic", providerKind: "oauth-token", starts: "" }
37
+ }
38
+ },
39
+ context: {
40
+ instructionFiles: ["CLAUDE.md"],
41
+ repoSkillFolders: [".claude/skills"],
42
+ userSkillFolder: "~/.claude/skills",
43
+ attach: "additive",
44
+ native: ["agents-md", "skills", "settings-hooks", "subagents", "commands", "mcp"]
45
+ },
46
+ capabilities: {
47
+ sessionId: "assignable",
48
+ resume: true,
49
+ fork: true,
50
+ subagents: { spawnTools: ["Agent", "Task"], transcript: "separate-file" },
51
+ cost: "status-line",
52
+ longCommands: "blocking",
53
+ permission: { unattended: "bypassPermissions", "accept-edits": "acceptEdits", plan: "plan", default: "default" },
54
+ structuredOutput: true,
55
+ mcp: true,
56
+ judge: true
57
+ },
58
+ hooks: { contextCap: 1e4, timeoutCeilingMs: 6e5 }
59
+ };
60
+
61
+ // ../agents/src/native/agents.ts
62
+ var NATIVE_AGENTS = {
63
+ "claude-code": CLAUDE_CODE
64
+ };
65
+ var LEGACY_AGENT = "claude-code";
66
+
67
+ // ../agents/src/providers/index.ts
68
+ var PROVIDERS = {
69
+ anthropic: {
70
+ id: "anthropic",
71
+ label: "Anthropic",
72
+ upstream: "https://api.anthropic.com/",
73
+ credentialKinds: [
74
+ { id: "api-key", label: "API key", header: "x-api-key", prefix: "" },
75
+ { id: "oauth-token", label: "OAuth token", header: "Authorization", prefix: "Bearer " }
76
+ ],
77
+ droppedHeaders: ["x-api-key", "authorization"],
78
+ destination: { name: "claude", port: 3127, socket: "claude.sock" }
79
+ }
80
+ };
81
+
82
+ export { CLAUDE_CODE, LEGACY_AGENT, NATIVE_AGENTS, PROVIDERS };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { loadMachineSkillFiles, resolvePackRoot } from './chunk-CXFJOX2C.js';
3
+ import { contextAgents, defaultAgents, userSkillFolderIn, loadMachineSkillFiles, resolvePackRoot } from './chunk-I6U6QPN6.js';
4
4
  import { MAINTAINED_SKILLS, maintainedLineVersion } from './chunk-CDDED64E.js';
5
5
  import { resolvePackageVersion } from './chunk-RA3O54FC.js';
6
6
  import { homeFromEnv } from './chunk-352DHUTP.js';
@@ -10,7 +10,6 @@ import { join, resolve, dirname, relative } from 'path';
10
10
 
11
11
  createRequire(import.meta.url);
12
12
  var machineSkillsBase = (home) => join(home, ".agents", "skills");
13
- var claudeSkillsBase = (home) => join(home, ".claude", "skills");
14
13
  var errorMessage = (err) => err instanceof Error ? err.message : String(err);
15
14
  var defaultLink = (target, path) => {
16
15
  if (process.platform === "win32") symlinkSync(resolve(realpathSync(dirname(path)), target), path, "junction");
@@ -89,19 +88,18 @@ function linksTo(entry, target) {
89
88
  return false;
90
89
  }
91
90
  }
92
- function reachFromClaude(home, name, version, link, mode) {
93
- const claude = claudeSkillsBase(home);
91
+ function reachFromAgent(agentFolder, home, name, version, link, mode) {
94
92
  const folder = join(machineSkillsBase(home), name);
95
- if (sameFolder(claude, machineSkillsBase(home))) return;
96
- const entry = join(claude, name);
93
+ if (sameFolder(agentFolder, machineSkillsBase(home))) return;
94
+ const entry = join(agentFolder, name);
97
95
  if (mode === "refresh" && !entryExists(entry)) return;
98
96
  if (linksTo(entry, folder)) return;
99
97
  if (folderExists(entry) && installedVersion(entry) === version) return;
100
- mkdirSync(claude, { recursive: true });
98
+ mkdirSync(agentFolder, { recursive: true });
101
99
  try {
102
- const temporary = tempName(claude, "tmp");
100
+ const temporary = tempName(agentFolder, "tmp");
103
101
  try {
104
- link(relative(realpathSync(claude), realpathSync(folder)), temporary);
102
+ link(relative(realpathSync(agentFolder), realpathSync(folder)), temporary);
105
103
  rmSync(entry, { recursive: true, force: true });
106
104
  renameSync(temporary, entry);
107
105
  } finally {
@@ -116,6 +114,7 @@ function installMachineSkills(opts) {
116
114
  const version = opts.version ?? resolvePackageVersion();
117
115
  const base = machineSkillsBase(opts.home);
118
116
  const link = opts.link ?? defaultLink;
117
+ const agentFolders = contextAgents(opts.agents ?? defaultAgents()).map((agent) => userSkillFolderIn(opts.home, agent.descriptor));
119
118
  let files;
120
119
  const filesOf = (name) => {
121
120
  files ??= loadMachineSkillFiles(opts.packRoot ?? resolvePackRoot(), version);
@@ -133,10 +132,12 @@ function installMachineSkills(opts) {
133
132
  result.failures.push(`${folder}: ${errorMessage(err)}`);
134
133
  continue;
135
134
  }
136
- try {
137
- reachFromClaude(opts.home, name, version, link, opts.mode);
138
- } catch (err) {
139
- result.failures.push(`${join(claudeSkillsBase(opts.home), name)}: ${errorMessage(err)}`);
135
+ for (const agentFolder of agentFolders) {
136
+ try {
137
+ reachFromAgent(agentFolder, opts.home, name, version, link, opts.mode);
138
+ } catch (err) {
139
+ result.failures.push(`${join(agentFolder, name)}: ${errorMessage(err)}`);
140
+ }
140
141
  }
141
142
  }
142
143
  return result;
@@ -148,26 +149,28 @@ function machineSkillsState(home, version = resolvePackageVersion()) {
148
149
  return { name, state: installedVersion(folder) === version ? "current" : "stale" };
149
150
  });
150
151
  }
151
- function staleClaudeSkills(home, version = resolvePackageVersion()) {
152
- const claude = claudeSkillsBase(home);
153
- if (sameFolder(claude, machineSkillsBase(home))) return [];
154
- return MAINTAINED_SKILLS.filter((name) => {
155
- const entry = join(claude, name);
156
- if (!entryExists(entry)) return false;
157
- if (linksTo(entry, join(machineSkillsBase(home), name))) return false;
158
- return installedVersion(entry) !== version;
152
+ function staleAgentSkills(home, version = resolvePackageVersion(), agents = defaultAgents()) {
153
+ return contextAgents(agents).flatMap(({ descriptor }) => {
154
+ const agentFolder = userSkillFolderIn(home, descriptor);
155
+ if (sameFolder(agentFolder, machineSkillsBase(home))) return [];
156
+ return MAINTAINED_SKILLS.filter((name) => {
157
+ const entry = join(agentFolder, name);
158
+ if (!entryExists(entry)) return false;
159
+ if (linksTo(entry, join(machineSkillsBase(home), name))) return false;
160
+ return installedVersion(entry) !== version;
161
+ }).map((name) => ({ folder: descriptor.context.userSkillFolder, name }));
159
162
  });
160
163
  }
161
- function setupMachineSkills(home = homeFromEnv()) {
164
+ function setupMachineSkills(home = homeFromEnv(), agents) {
162
165
  try {
163
- return installMachineSkills({ home, mode: "setup" });
166
+ return installMachineSkills({ home, mode: "setup", agents });
164
167
  } catch (err) {
165
168
  return { written: [], failures: [errorMessage(err)] };
166
169
  }
167
170
  }
168
- function refreshMachineSkills(home = homeFromEnv()) {
171
+ function refreshMachineSkills(home = homeFromEnv(), agents) {
169
172
  try {
170
- installMachineSkills({ home, mode: "refresh" });
173
+ installMachineSkills({ home, mode: "refresh", agents });
171
174
  } catch {
172
175
  }
173
176
  }
@@ -179,4 +182,4 @@ function machineRefreshSkipped(commandNames, hidden, argv) {
179
182
  return top === "sync" && argv.includes("--quiet");
180
183
  }
181
184
 
182
- export { installMachineSkills, machineRefreshSkipped, machineSkillsState, refreshMachineSkills, setupMachineSkills, staleClaudeSkills };
185
+ export { installMachineSkills, machineRefreshSkipped, machineSkillsState, refreshMachineSkills, setupMachineSkills, staleAgentSkills };
@@ -0,0 +1,136 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'node:module';
3
+ import { C } from './chunk-2AM6Z5BP.js';
4
+ import { readCloudConfig } from './chunk-HWVMRETT.js';
5
+ import { cliInvocation } from './chunk-FZKNTIOJ.js';
6
+ import { defaultAgents, legacyAgent, contextAgents, McpFileError } from './chunk-I6U6QPN6.js';
7
+ import { mkdirSync, writeFileSync, existsSync, readFileSync } from 'fs';
8
+ import { join, dirname } from 'path';
9
+
10
+ createRequire(import.meta.url);
11
+ var McpInstallError = class extends Error {
12
+ };
13
+ function defaultMcpUrl(home) {
14
+ const origin = readCloudConfig(home).url;
15
+ if (!origin) {
16
+ throw new McpInstallError(
17
+ `no gateway URL: pass --url <your gateway>, or run \`${cliInvocation()} login\` first.`
18
+ );
19
+ }
20
+ return `${origin.replace(/\/+$/, "")}/v1/mcp`;
21
+ }
22
+ var API_KEY_ENV_PLACEHOLDER = "${OUTERLAYER_API_KEY}";
23
+ var DEFAULT_MCP_TRANSPORT = "stdio";
24
+ var DEFAULT_MCP_COMMAND = "outerlayer";
25
+ function buildServerEntry(url, appId) {
26
+ const headers = { Authorization: `Bearer ${API_KEY_ENV_PLACEHOLDER}` };
27
+ if (appId) headers["X-Outerlayer-App-Id"] = appId;
28
+ return { type: "http", url, headers };
29
+ }
30
+ function buildStdioServerEntry(command, url, appId) {
31
+ const args = ["mcp", "serve"];
32
+ if (url) args.push("--url", url);
33
+ if (appId) args.push("--app-id", appId);
34
+ return { type: "stdio", command, args };
35
+ }
36
+ function readMcpText(absPath, relPath) {
37
+ if (!existsSync(absPath)) return void 0;
38
+ try {
39
+ return readFileSync(absPath, "utf8");
40
+ } catch {
41
+ throw new McpInstallError(`${relPath} exists and cannot be read \u2014 fix its permissions or remove it, then run the command again`);
42
+ }
43
+ }
44
+ function installErrorFor(err, relPath) {
45
+ if (!(err instanceof McpFileError)) return err;
46
+ switch (err.problem) {
47
+ case "not-json":
48
+ return new McpInstallError(`${relPath} exists and is not valid JSON \u2014 fix or remove it, then run the command again`);
49
+ case "not-object":
50
+ return new McpInstallError(`${relPath} exists and its top level is not a JSON object \u2014 refusing to overwrite`);
51
+ case "servers-not-object":
52
+ return new McpInstallError(`${relPath} has an "mcpServers" value that is not an object \u2014 refusing to overwrite`);
53
+ }
54
+ }
55
+ function setIn(target, text, name, entry, mode) {
56
+ try {
57
+ return target.mcp.setServer(text, name, entry, mode);
58
+ } catch (err) {
59
+ throw installErrorFor(err, target.relPath);
60
+ }
61
+ }
62
+ function mcpTargets(repoRoot, agents) {
63
+ if (existsSync(join(repoRoot, ".outerlayer", "mcp.json"))) return [{ relPath: ".outerlayer/mcp.json", mcp: legacyAgent(agents).adapter.context.mcp }];
64
+ const seen = /* @__PURE__ */ new Set();
65
+ const targets = [];
66
+ for (const { context } of contextAgents(agents)) {
67
+ if (seen.has(context.mcp.file)) continue;
68
+ seen.add(context.mcp.file);
69
+ targets.push({ relPath: context.mcp.file, mcp: context.mcp });
70
+ }
71
+ return targets;
72
+ }
73
+ function mcpTargetPath(repoRoot, agents = defaultAgents()) {
74
+ return mcpTargets(repoRoot, agents)[0].relPath;
75
+ }
76
+ function addMcpEntryIfAbsent(repoRoot, name, entry, agents) {
77
+ const results = mcpTargets(repoRoot, agents).map((target) => {
78
+ const absPath = join(repoRoot, target.relPath);
79
+ const result = setIn(target, readMcpText(absPath, target.relPath), name, entry, "if-absent");
80
+ if (!result.changed) return { path: target.relPath, added: false };
81
+ mkdirSync(dirname(absPath), { recursive: true });
82
+ writeFileSync(absPath, result.text);
83
+ return { path: target.relPath, added: true };
84
+ });
85
+ const [first, ...others] = results;
86
+ return others.length === 0 ? first : { ...first, others };
87
+ }
88
+ function setMcpEntry(repoRoot, name, entry, agents = defaultAgents()) {
89
+ for (const target of mcpTargets(repoRoot, agents)) {
90
+ const absPath = join(repoRoot, target.relPath);
91
+ const result = setIn(target, readMcpText(absPath, target.relPath), name, entry, "replace");
92
+ mkdirSync(dirname(absPath), { recursive: true });
93
+ writeFileSync(absPath, result.text);
94
+ }
95
+ }
96
+ var INIT_STDIO_ENTRY = { type: "stdio", command: "npx", args: ["-y", "@outerlayer/cli", "mcp", "serve"] };
97
+ function addStdioMcpEntryIfAbsent(repoRoot, name = "outerlayer", agents = defaultAgents()) {
98
+ return addMcpEntryIfAbsent(repoRoot, name, { ...INIT_STDIO_ENTRY, args: [...INIT_STDIO_ENTRY.args] }, agents);
99
+ }
100
+ var DOCS_MCP_SERVER_NAME = "outerlayer-docs";
101
+ var DOCS_MCP_URL = "https://docs.outerlayer.ai/mcp";
102
+ var INIT_DOCS_ENTRY = { type: "http", url: DOCS_MCP_URL };
103
+ function addDocsMcpEntryIfAbsent(repoRoot, agents = defaultAgents()) {
104
+ return addMcpEntryIfAbsent(repoRoot, DOCS_MCP_SERVER_NAME, { ...INIT_DOCS_ENTRY }, agents);
105
+ }
106
+ function runMcpInstall(opts = {}, agents = defaultAgents()) {
107
+ const cwd = opts.cwd ?? process.cwd();
108
+ if (!existsSync(cwd)) throw new McpInstallError(`no such directory: ${cwd}`);
109
+ const name = opts.name ?? "outerlayer";
110
+ const transport = opts.transport ?? DEFAULT_MCP_TRANSPORT;
111
+ const url = transport === "http" ? opts.url ?? defaultMcpUrl(opts.home) : opts.url ?? null;
112
+ const entry = transport === "http" ? buildServerEntry(url, opts.appId) : buildStdioServerEntry(opts.command ?? DEFAULT_MCP_COMMAND, url ?? void 0, opts.appId);
113
+ const written = mcpTargets(cwd, agents).map((target) => {
114
+ const absPath = join(cwd, target.relPath);
115
+ const result = setIn(target, readMcpText(absPath, target.relPath), name, entry, "replace");
116
+ mkdirSync(dirname(absPath), { recursive: true });
117
+ writeFileSync(absPath, result.text);
118
+ return { relPath: target.relPath, changed: result.changed };
119
+ });
120
+ const relPath = written.map((file) => file.relPath).join(", ");
121
+ const changed = written.some((file) => file.changed);
122
+ const where = transport === "http" ? `${url}` : `stdio: ${opts.command ?? DEFAULT_MCP_COMMAND} mcp serve`;
123
+ const keyNote = transport === "http" ? `Set OUTERLAYER_API_KEY in your environment \u2014 the key is referenced as ${API_KEY_ENV_PLACEHOLDER}, never written to this file.` : "The key is read from ~/.outerlayer/config.json (or OUTERLAYER_API_KEY) each time the client connects \u2014 never written to this file.";
124
+ const output = opts.json ? JSON.stringify({ path: written[0].relPath, server: name, transport, url, changed }) : changed ? `${C.green}\u2713${C.reset} Wrote "${name}" MCP server (${where}) to ${relPath}
125
+ ${C.dim} ${keyNote}${C.reset}` : `${C.dim}"${name}" MCP server already configured in ${relPath} (no change)${C.reset}`;
126
+ if (!opts.quiet) process.stdout.write(output + "\n");
127
+ return { path: written[0].relPath, paths: written.map((file) => file.relPath), server: name, transport, url, changed, output };
128
+ }
129
+ function handleMcpInstallError(err) {
130
+ if (!(err instanceof McpInstallError)) throw err;
131
+ process.stderr.write(`${C.red}\u2717${C.reset} ${err.message}
132
+ `);
133
+ process.exitCode = 1;
134
+ }
135
+
136
+ export { DEFAULT_MCP_COMMAND, DOCS_MCP_SERVER_NAME, INIT_DOCS_ENTRY, INIT_STDIO_ENTRY, McpInstallError, addDocsMcpEntryIfAbsent, addStdioMcpEntryIfAbsent, buildServerEntry, buildStdioServerEntry, defaultMcpUrl, handleMcpInstallError, mcpTargetPath, runMcpInstall, setMcpEntry };
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { readCloudConfigStrict, readCloudConfig, cloudConfigPath } from './chunk-HWVMRETT.js';
4
- import { signRunnerRequest, signerFor } from './chunk-4DJZSNVT.js';
4
+ import { signRunnerRequest, signerFor } from './chunk-IKFAJTLZ.js';
5
5
  import { readRepoConnection, findGitDirs } from './chunk-BJ3KTMDH.js';
6
- import { PLAIN_VERSION, recordCliVersion, removeRecordedVersion } from './chunk-OLM2TIOW.js';
7
- import { resolvePackageVersion } from './chunk-RA3O54FC.js';
6
+ import { PLAIN_VERSION, recordCliVersion, removeRecordedVersion } from './chunk-NFZMENCY.js';
8
7
  import { cliInvocation } from './chunk-FZKNTIOJ.js';
8
+ import { resolvePackageVersion } from './chunk-RA3O54FC.js';
9
9
  import { homeFromEnv } from './chunk-352DHUTP.js';
10
10
 
11
11
  createRequire(import.meta.url);