rnxsim 0.1.368 → 0.1.370

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 (256) hide show
  1. package/cli/auth.ts +2 -1
  2. package/cli/bin.ts +283 -273
  3. package/cli/commands/app-fonts.ts +3 -2
  4. package/cli/commands/assert.ts +8 -7
  5. package/cli/commands/auth.ts +2 -1
  6. package/cli/commands/box/checkout-plane.ts +49 -16
  7. package/cli/commands/compat.ts +93 -4
  8. package/cli/commands/config.ts +2 -1
  9. package/cli/commands/control.ts +37 -33
  10. package/cli/commands/daemon.ts +22 -21
  11. package/cli/commands/debug.ts +17 -15
  12. package/cli/commands/detect.ts +11 -7
  13. package/cli/commands/detox.ts +5 -4
  14. package/cli/commands/device.ts +6 -5
  15. package/cli/commands/electron.ts +6 -5
  16. package/cli/commands/flow.ts +12 -11
  17. package/cli/commands/inspect/find.ts +2 -1
  18. package/cli/commands/inspect/keyboard.ts +2 -1
  19. package/cli/commands/inspect/sleep.ts +2 -1
  20. package/cli/commands/inspect/wait-event.ts +4 -3
  21. package/cli/commands/inspect/wait-idle.ts +2 -1
  22. package/cli/commands/inspect/wait-ready.ts +3 -2
  23. package/cli/commands/inspect/wait-selector.ts +4 -3
  24. package/cli/commands/inspect/wait.ts +2 -1
  25. package/cli/commands/inspect.ts +82 -80
  26. package/cli/commands/install-desktop.ts +5 -4
  27. package/cli/commands/login.ts +3 -2
  28. package/cli/commands/mode.ts +2 -1
  29. package/cli/commands/record.ts +38 -37
  30. package/cli/commands/runtime.ts +9 -8
  31. package/cli/commands/screenshot-layers.ts +4 -3
  32. package/cli/commands/screenshot-mode.ts +2 -1
  33. package/cli/commands/screenshot.ts +8 -7
  34. package/cli/commands/screenshots-capture.ts +2 -1
  35. package/cli/commands/serve.ts +5 -4
  36. package/cli/commands/shell-boolean-mode.ts +2 -1
  37. package/cli/commands/skills.ts +11 -10
  38. package/cli/commands/telemetry.ts +2 -1
  39. package/cli/commands/three-mode.ts +2 -1
  40. package/cli/commands/timeline.ts +4 -3
  41. package/cli/commands/upload.ts +14 -13
  42. package/cli/commands/what-happened.ts +2 -1
  43. package/cli/recording-access.ts +6 -5
  44. package/cli/run-rnx.ts +140 -0
  45. package/dist-cli/bin.js +6 -6
  46. package/dist-cli/chunks/{agent-GXCQMYV4.js → agent-3R4424LW.js} +2 -2
  47. package/dist-cli/chunks/{agent-wrapper-Y3PQAL6I.js → agent-wrapper-4PPWZWSY.js} +2 -2
  48. package/dist-cli/chunks/app-fonts-KYXB6CXQ.js +4 -0
  49. package/dist-cli/chunks/{assert-BSRQBRH7.js → assert-7EZOWGYQ.js} +11 -11
  50. package/dist-cli/chunks/auth-L7M36H6C.js +12 -0
  51. package/dist-cli/chunks/{beta-R4IZ5SWO.js → beta-FKAF6YWJ.js} +2 -2
  52. package/dist-cli/chunks/{box-2NQYYY3B.js → box-5Y5VBMHV.js} +62 -62
  53. package/dist-cli/chunks/{camera-ER66WWAX.js → camera-XHF2RPFG.js} +2 -2
  54. package/dist-cli/chunks/{chunk-UBH2BWCY.js → chunk-2FOGXVOK.js} +2 -2
  55. package/dist-cli/chunks/{chunk-7B22IPSC.js → chunk-3BG6UCQY.js} +2 -2
  56. package/dist-cli/chunks/{chunk-IXRVFQMT.js → chunk-3SOPYG7S.js} +2 -2
  57. package/dist-cli/chunks/{chunk-7V3S2DY2.js → chunk-3UXXYJVD.js} +1 -1
  58. package/dist-cli/chunks/{chunk-3MPFC3DS.js → chunk-5BR33NAZ.js} +1 -1
  59. package/dist-cli/chunks/{chunk-BWJOLJOK.js → chunk-5RKRVS5A.js} +2 -2
  60. package/dist-cli/chunks/{chunk-WVVAYLWZ.js → chunk-64JAEJ6N.js} +1 -1
  61. package/dist-cli/chunks/{chunk-GXHCJRKE.js → chunk-6A6L3VJR.js} +2 -2
  62. package/dist-cli/chunks/chunk-6GPS7U4X.js +74 -0
  63. package/dist-cli/chunks/{chunk-JHYXRORU.js → chunk-6S5LJV2O.js} +2 -2
  64. package/dist-cli/chunks/{chunk-TOE5O6JE.js → chunk-6W4HIWC7.js} +2 -2
  65. package/dist-cli/chunks/{chunk-ESVUVW3R.js → chunk-72S5FCBY.js} +2 -2
  66. package/dist-cli/chunks/{chunk-TC6DNQL6.js → chunk-7C7TJYZ3.js} +2 -2
  67. package/dist-cli/chunks/{chunk-M7COA4BE.js → chunk-AALKIAUZ.js} +1 -1
  68. package/dist-cli/chunks/{chunk-CKNNO6ZG.js → chunk-ARMXC3C3.js} +25 -25
  69. package/dist-cli/chunks/chunk-AVJBT5LF.js +4 -0
  70. package/dist-cli/chunks/chunk-BMIJZNKD.js +28 -0
  71. package/dist-cli/chunks/{chunk-FSPZY4AI.js → chunk-C7BA5CCM.js} +2 -2
  72. package/dist-cli/chunks/{chunk-EHA65UVJ.js → chunk-CMVRTZ5G.js} +2 -2
  73. package/dist-cli/chunks/chunk-D24EOJ4C.js +24 -0
  74. package/dist-cli/chunks/{chunk-3XMEIZEV.js → chunk-D2GZASRV.js} +1 -1
  75. package/dist-cli/chunks/{chunk-3S2J6IVC.js → chunk-DHYTRCIP.js} +2 -2
  76. package/dist-cli/chunks/{chunk-QMVBWZH2.js → chunk-DMHSD6YJ.js} +2 -2
  77. package/dist-cli/chunks/{chunk-NGWUGNPV.js → chunk-DUXHYPBP.js} +2 -2
  78. package/dist-cli/chunks/{chunk-4FLQYRGN.js → chunk-DXV37CJN.js} +1 -1
  79. package/dist-cli/chunks/{chunk-T2MGLXY5.js → chunk-EOIBLKZO.js} +2 -2
  80. package/dist-cli/chunks/{chunk-PNBQBBG5.js → chunk-EQ3OE2AV.js} +1 -1
  81. package/dist-cli/chunks/{chunk-WFAFAGMG.js → chunk-EWSWOWXK.js} +2 -2
  82. package/dist-cli/chunks/{chunk-HKQXGCQT.js → chunk-FA75F34Z.js} +1 -1
  83. package/dist-cli/chunks/{chunk-NERY6HGZ.js → chunk-FK4JSTZ3.js} +2 -2
  84. package/dist-cli/chunks/{chunk-NPSPWMBO.js → chunk-GJRLPJQL.js} +2 -2
  85. package/dist-cli/chunks/{chunk-TPIPKXJL.js → chunk-GRO74J2X.js} +1 -1
  86. package/dist-cli/chunks/chunk-H5X5FJ63.js +99 -0
  87. package/dist-cli/chunks/chunk-HEKHLQ3B.js +497 -0
  88. package/dist-cli/chunks/chunk-HQQTS2CB.js +30 -0
  89. package/dist-cli/chunks/{chunk-Q65KH25G.js → chunk-I52NT6VG.js} +1 -1
  90. package/dist-cli/chunks/{chunk-AUPJX4KI.js → chunk-IDLFVRPN.js} +1 -1
  91. package/dist-cli/chunks/{chunk-LAKWOJ5Y.js → chunk-JZLDHPB7.js} +2 -2
  92. package/dist-cli/chunks/{chunk-WJQB6AXZ.js → chunk-LIMWG54N.js} +1 -1
  93. package/dist-cli/chunks/{chunk-TE645QCO.js → chunk-LUOHRBJG.js} +1 -1
  94. package/dist-cli/chunks/{chunk-DJSPNOF6.js → chunk-LXPHL6FO.js} +2 -2
  95. package/dist-cli/chunks/{chunk-ECXDCED5.js → chunk-MDCY532E.js} +2 -2
  96. package/dist-cli/chunks/{chunk-4VA2ISWX.js → chunk-NJMU5BN6.js} +1 -1
  97. package/dist-cli/chunks/{chunk-RRALQ4WM.js → chunk-NR2V2ONN.js} +2 -2
  98. package/dist-cli/chunks/{chunk-SHMLYTNH.js → chunk-NTC46LSA.js} +2 -2
  99. package/dist-cli/chunks/{chunk-X5MXQB3L.js → chunk-O6QLKSAM.js} +10 -10
  100. package/dist-cli/chunks/{chunk-LPAOOJIW.js → chunk-OJZHECGH.js} +1 -1
  101. package/dist-cli/chunks/chunk-OTFTMGAL.js +7 -0
  102. package/dist-cli/chunks/{chunk-QKOY7UW5.js → chunk-PAUEZO6F.js} +2 -2
  103. package/dist-cli/chunks/{chunk-WXRDFUR7.js → chunk-PIZXOXBL.js} +2 -2
  104. package/dist-cli/chunks/{chunk-WF2CRNYF.js → chunk-PNOENVMJ.js} +1 -1
  105. package/dist-cli/chunks/{chunk-FDAFSRQE.js → chunk-Q4MRJ6PO.js} +2 -2
  106. package/dist-cli/chunks/{chunk-SSUPPM6K.js → chunk-RRX52O37.js} +1 -1
  107. package/dist-cli/chunks/{chunk-E6XYIIJK.js → chunk-U63T6LIQ.js} +1 -1
  108. package/dist-cli/chunks/{chunk-OZJMWTGA.js → chunk-UFVAAWGZ.js} +1 -1
  109. package/dist-cli/chunks/{chunk-GS5VUDCF.js → chunk-VVQCZ42C.js} +1 -1
  110. package/dist-cli/chunks/{chunk-MCO7V4VN.js → chunk-WFQHT4QD.js} +2 -2
  111. package/dist-cli/chunks/{chunk-JFGW75UL.js → chunk-WPV4H5S4.js} +2 -2
  112. package/dist-cli/chunks/{chunk-OXCDE3DD.js → chunk-X6WQ4YWE.js} +1 -1
  113. package/dist-cli/chunks/{chunk-FVODUDPS.js → chunk-YIZGNT7A.js} +1 -1
  114. package/dist-cli/chunks/{chunk-MGOAQHMO.js → chunk-Z2VBSNFI.js} +2 -2
  115. package/dist-cli/chunks/{chunk-GFWUIGGY.js → chunk-Z3DENGXW.js} +2 -2
  116. package/dist-cli/chunks/{cleanup-WHGLBAJ2.js → cleanup-MXMMJ7JW.js} +2 -2
  117. package/dist-cli/chunks/cli-version-MLS55UTY.js +4 -0
  118. package/dist-cli/chunks/compat-E6KE5KDI.js +23 -0
  119. package/dist-cli/chunks/config-QSLLVZDS.js +13 -0
  120. package/dist-cli/chunks/{connect-N4FV3DDV.js → connect-QE4VU6GB.js} +2 -2
  121. package/dist-cli/chunks/control-XD5F6K5T.js +4 -0
  122. package/dist-cli/chunks/daemon-UN5SE2JO.js +4 -0
  123. package/dist-cli/chunks/{debug-AHEK43AJ.js → debug-5FG3MBJS.js} +20 -20
  124. package/dist-cli/chunks/desktop-5EZX7NX5.js +31 -0
  125. package/dist-cli/chunks/detox-WJGQP5TM.js +52 -0
  126. package/dist-cli/chunks/device-D7LKCAMS.js +18 -0
  127. package/dist-cli/chunks/{diagnose-WDP3CVIX.js → diagnose-A3W6ZTGA.js} +2 -2
  128. package/dist-cli/chunks/{disk-cleanup-JRT5MKFW.js → disk-cleanup-BDRHX5ZG.js} +2 -2
  129. package/dist-cli/chunks/{do-chain-7FDMO56C.js → do-chain-RUJNRPPF.js} +2 -2
  130. package/dist-cli/chunks/drivers-3NJ5RL6X.js +4 -0
  131. package/dist-cli/chunks/{env-YIBOMB24.js → env-U67SQVTV.js} +2 -2
  132. package/dist-cli/chunks/{film-R3EQADMG.js → film-XC6UAQ3V.js} +3 -3
  133. package/dist-cli/chunks/flow-FHZZD3P6.js +4 -0
  134. package/dist-cli/chunks/help-BYYDUSXF.js +4 -0
  135. package/dist-cli/chunks/{hidden-runtime-alias-6M4UERRQ.js → hidden-runtime-alias-7S2TNZXG.js} +2 -2
  136. package/dist-cli/chunks/{home-paths-QJNOHZJO.js → home-paths-LMO5LB4F.js} +2 -2
  137. package/dist-cli/chunks/inspect-RQCTWDCC.js +4 -0
  138. package/dist-cli/chunks/install-desktop-GOWXCQUE.js +4 -0
  139. package/dist-cli/chunks/login-JIU42S4C.js +26 -0
  140. package/dist-cli/chunks/{logout-VNJX2IEW.js → logout-JTAWQXZO.js} +2 -2
  141. package/dist-cli/chunks/{maestro-SQS2OS2D.js → maestro-TYBQYOGB.js} +3 -3
  142. package/dist-cli/chunks/{maestro-generate-GWVPISG5.js → maestro-generate-YLAGWVKE.js} +3 -3
  143. package/dist-cli/chunks/mode-DV24ZRZ6.js +26 -0
  144. package/dist-cli/chunks/{optional-demo-registry-L3LRBQHG.js → optional-demo-registry-JZH66VIM.js} +2 -2
  145. package/dist-cli/chunks/{perf-XLPC4UKR.js → perf-LXXJ4EAX.js} +2 -2
  146. package/dist-cli/chunks/{permissions-QRHWVMDP.js → permissions-KAOVZUPW.js} +2 -2
  147. package/dist-cli/chunks/{platform-F47URZNB.js → platform-KW35446W.js} +3 -3
  148. package/dist-cli/chunks/privacy-MIFE72CG.js +4 -0
  149. package/dist-cli/chunks/record-EK3ETFHZ.js +72 -0
  150. package/dist-cli/chunks/report-issue-NW5PCAZF.js +29 -0
  151. package/dist-cli/chunks/reset-RZ4O5AFJ.js +4 -0
  152. package/dist-cli/chunks/resolve-target-7R5BNYMM.js +4 -0
  153. package/dist-cli/chunks/runtime-MZHLSRS6.js +4 -0
  154. package/dist-cli/chunks/{screenshot-command-RK7IJHVK.js → screenshot-command-TQSPTFT2.js} +11 -11
  155. package/dist-cli/chunks/screenshot-layers-IZP3L3AQ.js +20 -0
  156. package/dist-cli/chunks/screenshots-capture-K7LJOVAE.js +42 -0
  157. package/dist-cli/chunks/{serve-UBXNGLNP.js → serve-MMX4WXXG.js} +18 -18
  158. package/dist-cli/chunks/setup-YFP3KEQZ.js +4 -0
  159. package/dist-cli/chunks/{sim-client-VTKFEDJX.js → sim-client-KLAYIFOC.js} +2 -2
  160. package/dist-cli/chunks/skills-N4D3POIS.js +50 -0
  161. package/dist-cli/chunks/{state-273XJPUE.js → state-ES6TFQZF.js} +2 -2
  162. package/dist-cli/chunks/{storage-RTDFWIY7.js → storage-52DR5V2C.js} +2 -2
  163. package/dist-cli/chunks/store-HOL45WCI.js +4 -0
  164. package/dist-cli/chunks/telemetry-BV6OTYPF.js +4 -0
  165. package/dist-cli/chunks/timeline-NRVNB5JR.js +24 -0
  166. package/dist-cli/chunks/{upgrade-R74NVHKG.js → upgrade-LNED5YQ2.js} +2 -2
  167. package/dist-cli/chunks/upload-RXKHFIBU.js +4 -0
  168. package/dist-cli/chunks/{version-RTFCYQZ7.js → version-VEF2DYGG.js} +2 -2
  169. package/dist-cli/chunks/{web-35SSKBRU.js → web-CGDE6S73.js} +2 -2
  170. package/dist-cli/chunks/welcome-FT2AMUWW.js +5 -0
  171. package/dist-cli/chunks/what-happened-FSIDWL32.js +25 -0
  172. package/dist-cli/chunks/{ws-bridge-JXQUAWFA.js → ws-bridge-QXFQLRE7.js} +2 -2
  173. package/dist-lib/agent-daemon-client.cjs +1 -1
  174. package/dist-lib/agent-events.cjs +1 -1
  175. package/dist-lib/agent-identity.cjs +1 -1
  176. package/dist-lib/agent-sessions.cjs +1 -1
  177. package/dist-lib/attached-projects.cjs +1 -1
  178. package/dist-lib/auth/shared-session.cjs +1 -1
  179. package/dist-lib/backend-origin.cjs +1 -1
  180. package/dist-lib/beta.cjs +1 -1
  181. package/dist-lib/beta.mjs +1 -1
  182. package/dist-lib/bridge-constants.cjs +1 -1
  183. package/dist-lib/bridge-contract-input.cjs +1 -1
  184. package/dist-lib/bridge-contract-input.mjs +1 -1
  185. package/dist-lib/bridge-contract.cjs +1 -1
  186. package/dist-lib/bridge-contract.mjs +1 -1
  187. package/dist-lib/cli-constants.cjs +1 -1
  188. package/dist-lib/config.cjs +1 -1
  189. package/dist-lib/detox/index.cjs +1 -1
  190. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  191. package/dist-lib/home-paths.cjs +1 -1
  192. package/dist-lib/host/bridge-host.cjs +1 -1
  193. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  194. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  195. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  196. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  197. package/dist-lib/host/websocket-proxy.cjs +1 -1
  198. package/dist-lib/index.cjs +1 -1
  199. package/dist-lib/jump-to-source-babel.cjs +1 -1
  200. package/dist-lib/menu.cjs +1 -1
  201. package/dist-lib/menu.mjs +1 -1
  202. package/dist-lib/metro-production-bundle.cjs +1 -1
  203. package/dist-lib/metro-production-bundle.mjs +1 -1
  204. package/dist-lib/metro.cjs +1 -1
  205. package/dist-lib/profiles.cjs +1 -1
  206. package/dist-lib/public-brand.cjs +1 -1
  207. package/dist-lib/react-native-host-modules.cjs +2 -1
  208. package/dist-lib/react-native-host-modules.mjs +2 -1
  209. package/dist-lib/render-mode.cjs +1 -1
  210. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  211. package/dist-lib/sdk.cjs +1 -1
  212. package/dist-lib/sdk.mjs +1 -1
  213. package/dist-lib/skills.cjs +560 -48
  214. package/dist-lib/vite.cjs +1 -1
  215. package/package.json +1 -1
  216. package/src/react-native-host-modules.ts +1 -0
  217. package/dist-cli/chunks/app-fonts-MDD3W4VN.js +0 -4
  218. package/dist-cli/chunks/auth-SLPHDPCF.js +0 -12
  219. package/dist-cli/chunks/chunk-2YK5J2D2.js +0 -24
  220. package/dist-cli/chunks/chunk-42TLK75A.js +0 -497
  221. package/dist-cli/chunks/chunk-57LITN73.js +0 -7
  222. package/dist-cli/chunks/chunk-T4ZZ26A2.js +0 -28
  223. package/dist-cli/chunks/chunk-UXROQPIN.js +0 -30
  224. package/dist-cli/chunks/chunk-YSHJ3LMQ.js +0 -74
  225. package/dist-cli/chunks/chunk-YYPTSF6W.js +0 -99
  226. package/dist-cli/chunks/cli-version-DMXIXBIM.js +0 -4
  227. package/dist-cli/chunks/compat-MGBKGYGQ.js +0 -20
  228. package/dist-cli/chunks/config-TRDOMP4T.js +0 -13
  229. package/dist-cli/chunks/control-5GRBZVYK.js +0 -4
  230. package/dist-cli/chunks/daemon-MBT5E3ZC.js +0 -4
  231. package/dist-cli/chunks/desktop-LDRIXOVV.js +0 -31
  232. package/dist-cli/chunks/detox-6HAKYISO.js +0 -52
  233. package/dist-cli/chunks/device-QM3S7OVU.js +0 -18
  234. package/dist-cli/chunks/drivers-AJL2EVXH.js +0 -4
  235. package/dist-cli/chunks/flow-BDAA6BWL.js +0 -4
  236. package/dist-cli/chunks/help-5EJD6LJF.js +0 -4
  237. package/dist-cli/chunks/inspect-S3LR3R2A.js +0 -4
  238. package/dist-cli/chunks/install-desktop-GXE6K7BJ.js +0 -4
  239. package/dist-cli/chunks/login-ISWDW4WU.js +0 -26
  240. package/dist-cli/chunks/mode-3URDGBZB.js +0 -26
  241. package/dist-cli/chunks/privacy-BF23T67T.js +0 -4
  242. package/dist-cli/chunks/record-2DN3OUE5.js +0 -72
  243. package/dist-cli/chunks/report-issue-D3BQPSLU.js +0 -29
  244. package/dist-cli/chunks/reset-T5CNZ7D3.js +0 -4
  245. package/dist-cli/chunks/resolve-target-KAAS274S.js +0 -4
  246. package/dist-cli/chunks/runtime-AQJDBR3X.js +0 -4
  247. package/dist-cli/chunks/screenshot-layers-DP2QKSMN.js +0 -20
  248. package/dist-cli/chunks/screenshots-capture-MA7P3FUT.js +0 -42
  249. package/dist-cli/chunks/setup-GH7OW4GC.js +0 -4
  250. package/dist-cli/chunks/skills-HPK25R4B.js +0 -50
  251. package/dist-cli/chunks/store-DLKNNM4L.js +0 -4
  252. package/dist-cli/chunks/telemetry-7CWDXEOO.js +0 -4
  253. package/dist-cli/chunks/timeline-IF2PGK7C.js +0 -24
  254. package/dist-cli/chunks/upload-3JFFVCZ4.js +0 -4
  255. package/dist-cli/chunks/welcome-N5V352SE.js +0 -5
  256. package/dist-cli/chunks/what-happened-WXTP6EPR.js +0 -25
@@ -10,6 +10,7 @@ import * as os from 'os'
10
10
  import * as path from 'path'
11
11
  import { fileURLToPath } from 'url'
12
12
  import { rnxPublicBrand } from '../../src/public-brand'
13
+ import { rnxExit } from '../run-rnx'
13
14
 
14
15
  function getSkillsDir(): string {
15
16
  try {
@@ -102,7 +103,7 @@ function agentTarget(target: string): InstallTarget[] {
102
103
  }
103
104
  console.error(` unknown skill install target: ${target}`)
104
105
  console.error(' expected all, codex, or claude')
105
- process.exit(1)
106
+ rnxExit(1)
106
107
  }
107
108
 
108
109
  function parseSkillFrontmatter(
@@ -182,7 +183,7 @@ function matchSkills(skills: SkillInfo[], filters: string[]): SkillInfo[] {
182
183
  if (matched.length === 0) {
183
184
  console.error(` no skills matched: ${filters.join(', ')}`)
184
185
  console.error(' available: ' + skills.map((skill) => skill.name).join(', '))
185
- process.exit(1)
186
+ rnxExit(1)
186
187
  }
187
188
  return matched
188
189
  }
@@ -347,7 +348,7 @@ function parseInstallArgs(args: string[]): {
347
348
  const arg = args[index]
348
349
  if (arg === '--help' || arg === '-h') {
349
350
  printInstallHelp()
350
- process.exit(0)
351
+ rnxExit(0)
351
352
  }
352
353
  if (arg === '--force' || arg === '-f') {
353
354
  force = true
@@ -357,11 +358,11 @@ function parseInstallArgs(args: string[]): {
357
358
  const dir = args[index + 1]
358
359
  if (!dir || dir.startsWith('-')) {
359
360
  console.error(' --target requires a directory')
360
- process.exit(1)
361
+ rnxExit(1)
361
362
  }
362
363
  if (targets) {
363
364
  console.error(' pass only one install target')
364
- process.exit(1)
365
+ rnxExit(1)
365
366
  }
366
367
  targets = [{ label: 'target', dir }]
367
368
  index++
@@ -370,7 +371,7 @@ function parseInstallArgs(args: string[]): {
370
371
  if (arg.startsWith('-')) {
371
372
  console.error(` unknown option: ${arg}`)
372
373
  printInstallHelp()
373
- process.exit(1)
374
+ rnxExit(1)
374
375
  }
375
376
  if (!targets && AGENT_TARGET_IDS.has(arg)) {
376
377
  targets = agentTarget(arg)
@@ -386,7 +387,7 @@ async function runInstall(args: string[]) {
386
387
  const skills = listSkills()
387
388
  if (skills.length === 0) {
388
389
  console.error(' no skills found in rnx package')
389
- process.exit(1)
390
+ rnxExit(1)
390
391
  }
391
392
 
392
393
  const parsed = parseInstallArgs(args)
@@ -399,7 +400,7 @@ async function runInstall(args: string[]) {
399
400
  fs.mkdirSync(target.dir, { recursive: true })
400
401
  if (!fs.statSync(target.dir).isDirectory()) {
401
402
  console.error(` target is not a directory: ${target.dir}`)
402
- process.exit(1)
403
+ rnxExit(1)
403
404
  }
404
405
  removeLegacyBundledSkills(target.dir)
405
406
  }
@@ -429,7 +430,7 @@ async function runInstall(args: string[]) {
429
430
  console.error(
430
431
  ` ${conflicts} conflict(s); rerun with --force only if replacing them is intended.\n`,
431
432
  )
432
- process.exit(1)
433
+ rnxExit(1)
433
434
  }
434
435
  console.log(' done. restart the agent session to load newly installed skills.\n')
435
436
  }
@@ -463,5 +464,5 @@ export async function runSkill(args: string[]) {
463
464
 
464
465
  console.error(` unknown skill command: ${command}`)
465
466
  printSkillHelp()
466
- process.exit(1)
467
+ rnxExit(1)
467
468
  }
@@ -10,6 +10,7 @@ import {
10
10
  readPrivacyPreferences,
11
11
  writePrivacyPreferences,
12
12
  } from '../../src/home-paths'
13
+ import { rnxExit } from '../run-rnx'
13
14
 
14
15
  function printStatus(): void {
15
16
  const preferences = readPrivacyPreferences()
@@ -49,6 +50,6 @@ export async function runTelemetry(args: string[]): Promise<void> {
49
50
  default:
50
51
  console.error(` unknown telemetry action: ${sub}`)
51
52
  console.error(' usage: rnx config telemetry [on|off|status]')
52
- process.exit(1)
53
+ rnxExit(1)
53
54
  }
54
55
  }
@@ -6,6 +6,7 @@
6
6
  import { createHash } from 'node:crypto'
7
7
  import { mkdirSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from 'node:fs'
8
8
  import { dirname, extname, resolve } from 'node:path'
9
+ import { rnxExit } from '../run-rnx'
9
10
  import {
10
11
  callInBridgeWrite,
11
12
  createBridgeFromParsed,
@@ -100,7 +101,7 @@ examples:
100
101
  rnx mode three measure ./cinematic.json --width 450 --height 900 --at 0,1200
101
102
  rnx mode three off
102
103
  `)
103
- process.exit(0)
104
+ rnxExit(0)
104
105
  }
105
106
 
106
107
  const timelineAction = findTimelineAction(args)
@@ -16,6 +16,7 @@
16
16
  // see `sootsim what-happened` for the read side.
17
17
 
18
18
  import { writeFileSync } from 'fs'
19
+ import { rnxExit } from '../run-rnx'
19
20
  import { callInBridge, createBridgeFromParsed, parseBridgeCliArgs } from '../ws-bridge'
20
21
 
21
22
  interface TimelineOptions {
@@ -54,7 +55,7 @@ export async function runTimeline(args: string[], opts: TimelineOptions) {
54
55
  const sub = parsed.positional[0]
55
56
  if (!sub || args.includes('--help') || args.includes('-h')) {
56
57
  printHelp()
57
- process.exit(0)
58
+ rnxExit(0)
58
59
  }
59
60
  const json = args.includes('--json')
60
61
  const bridge = createBridgeFromParsed(parsed)
@@ -97,7 +98,7 @@ export async function runTimeline(args: string[], opts: TimelineOptions) {
97
98
  const outPath = rest[0]
98
99
  if (!outPath) {
99
100
  console.error(' usage: rnx timeline dump <file>')
100
- process.exit(1)
101
+ rnxExit(1)
101
102
  }
102
103
  const result = await callInBridge<{ events: unknown[] }>(
103
104
  bridge,
@@ -111,7 +112,7 @@ export async function runTimeline(args: string[], opts: TimelineOptions) {
111
112
  default: {
112
113
  console.error(` unknown subcommand: ${sub}`)
113
114
  printHelp()
114
- process.exit(1)
115
+ rnxExit(1)
115
116
  }
116
117
  }
117
118
  } finally {
@@ -27,6 +27,7 @@ import { fetchAppSplashImages } from '../app-splash'
27
27
  import { authHeaderValue, githubUploadIdentity, resolveCliAuth } from '../auth'
28
28
  import { openUrl } from '../open-url'
29
29
  import { resolveRunProvenance } from '../run-registry'
30
+ import { rnxExit } from '../run-rnx'
30
31
  import { createBridgeFromParsed, evalInBridge, parseBridgeCliArgs } from '../ws-bridge'
31
32
  import type { SootSimTimelineEvent } from '@sootsim/globals'
32
33
 
@@ -239,7 +240,7 @@ function parsePositiveMs(raw: string | undefined, name: string): number | undefi
239
240
  const value = Number(raw)
240
241
  if (!Number.isFinite(value) || value <= 0) {
241
242
  console.error(` invalid ${name}: ${raw}`)
242
- process.exit(1)
243
+ rnxExit(1)
243
244
  }
244
245
  return Math.round(value)
245
246
  }
@@ -432,7 +433,7 @@ export async function runUpload(
432
433
  ): Promise<UploadResult> {
433
434
  if (args.includes('--help') || args.includes('-h')) {
434
435
  printHelp()
435
- process.exit(0)
436
+ rnxExit(0)
436
437
  }
437
438
 
438
439
  const mutableArgs = [...args]
@@ -466,11 +467,11 @@ export async function runUpload(
466
467
  const openResult = extractBoolFlag(mutableArgs, '--open')
467
468
  if ((owner && !repo) || (!owner && repo)) {
468
469
  console.error(' --owner and --repo must be provided together')
469
- process.exit(1)
470
+ rnxExit(1)
470
471
  }
471
472
  if (billingKind && billingKind !== 'test_run') {
472
473
  console.error(` invalid --billing-kind: ${billingKind}`)
473
- process.exit(1)
474
+ rnxExit(1)
474
475
  }
475
476
  if (!eventsPath && !videoPath) {
476
477
  console.error(
@@ -478,7 +479,7 @@ export async function runUpload(
478
479
  ' for a normal local preview, use `rnx record --mode combined --open`\n' +
479
480
  ' or `rnx maestro test --preview` instead of uploading a bundle-only snapshot.',
480
481
  )
481
- process.exit(1)
482
+ rnxExit(1)
482
483
  }
483
484
  // assets-only filters captured cross-origin responses to just image/font/
484
485
  // css/js/binary records before upload — API responses (JSON, HTML) hit the
@@ -678,14 +679,14 @@ export async function runUpload(
678
679
  console.error(
679
680
  ' could not read bundle snapshot — is rnx running and is the bundle loaded?',
680
681
  )
681
- process.exit(2)
682
+ rnxExit(2)
682
683
  }
683
684
  if (!snapshot.bundleUrl) {
684
685
  console.error(
685
686
  ' no ?bundle= URL on the current rnx tab.\n' +
686
687
  ' open the app you want to share first (e.g. rnx open 8082), then run upload.',
687
688
  )
688
- process.exit(2)
689
+ rnxExit(2)
689
690
  }
690
691
 
691
692
  // prefer the post-transform bundle captured from the running tab. this
@@ -830,13 +831,13 @@ export async function runUpload(
830
831
  : undefined
831
832
  if (!videoContentType) {
832
833
  console.error(' preview flow videos must be mp4 or gif')
833
- process.exit(1)
834
+ rnxExit(1)
834
835
  }
835
836
  if (videoDurationMsRaw) {
836
837
  const parsed = Number(videoDurationMsRaw)
837
838
  if (!Number.isFinite(parsed) || parsed <= 0) {
838
839
  console.error(` invalid --video-duration-ms: ${videoDurationMsRaw}`)
839
- process.exit(1)
840
+ rnxExit(1)
840
841
  }
841
842
  videoDurationMs = Math.round(parsed)
842
843
  }
@@ -856,7 +857,7 @@ export async function runUpload(
856
857
  console.error(
857
858
  ' set RNX_API_KEY=sk_rnx_..., run `rnx login`, or use the Contrast github runner.',
858
859
  )
859
- process.exit(1)
860
+ rnxExit(1)
860
861
  }
861
862
  const resolvedAuthHeader = authHeaderValue(cliAuth)
862
863
 
@@ -1151,19 +1152,19 @@ export async function runUpload(
1151
1152
  if (e.phase === 'init' && e.status === 401) {
1152
1153
  console.error(' preview upload requires a valid login.')
1153
1154
  console.error(' run `rnx login` and retry.')
1154
- process.exit(1)
1155
+ rnxExit(1)
1155
1156
  }
1156
1157
  if (e.status === 402) {
1157
1158
  // billing gate — surface the server's own `message`, not raw JSON.
1158
1159
  console.error(
1159
1160
  ` ${parseServerMessage(e.responseText) ?? 'preview uploads require Personal, Team, or an active trial — upgrade from the billing dialog.'}`,
1160
1161
  )
1161
- process.exit(1)
1162
+ rnxExit(1)
1162
1163
  }
1163
1164
  // PresignedUploadError.message already carries the "<phase> failed:"
1164
1165
  // prefix — don't re-prefix it (that produced "init failed: init failed:").
1165
1166
  console.error(` ${e.message ?? `${e.phase ?? 'upload'} failed: ${String(err)}`}`)
1166
- process.exit(1)
1167
+ rnxExit(1)
1167
1168
  }
1168
1169
 
1169
1170
  const previewUrl = `${publicOrigin}${finalize.url}`
@@ -15,6 +15,7 @@
15
15
  // sootsim what-happened --limit 50 # cap (default 200)
16
16
 
17
17
  import { getCliIdentityKey } from '../current-sim'
18
+ import { rnxExit } from '../run-rnx'
18
19
  import { createBridgeFromParsed, parseBridgeCliArgs } from '../ws-bridge'
19
20
  import {
20
21
  formatTimelineEvent,
@@ -183,7 +184,7 @@ note: react-commit, layout, and scroll are opt-in/noisy events. enable them
183
184
  with "rnx timeline start <kind>", then pass --noisy or include them in
184
185
  --kinds to see them.
185
186
  `)
186
- process.exit(0)
187
+ rnxExit(0)
187
188
  }
188
189
 
189
190
  const summaryMode = args.includes('--summary')
@@ -1,6 +1,7 @@
1
1
  import { readSharedDesktopAuthSession } from '../src/auth/shared-session'
2
2
  import { authHeaderValue, resolveCliAuth, type CliAuth } from './auth'
3
3
  import { resolveDefaultUploadOrigin } from './commands/upload'
4
+ import { rnxExit } from './run-rnx'
4
5
 
5
6
  type BillingSubscriptionSnapshot = {
6
7
  plan?: 'free' | 'personal' | 'team'
@@ -58,7 +59,7 @@ export async function ensureCliRecordingEntitlement(
58
59
  ` • run \`rnx login\`\n` +
59
60
  ` • set RNX_API_KEY=sk_rnx_... (recommended for CI)\n\n`,
60
61
  )
61
- process.exit(1)
62
+ rnxExit(1)
62
63
  }
63
64
 
64
65
  if (auth.kind === 'github' && opts.allowGitHubAuth) return
@@ -74,7 +75,7 @@ export async function ensureCliRecordingEntitlement(
74
75
  `\n rnx ${commandLabel} couldn't verify recording access.\n` +
75
76
  ` ${error instanceof Error ? error.message : String(error)}\n\n`,
76
77
  )
77
- process.exit(1)
78
+ rnxExit(1)
78
79
  }
79
80
 
80
81
  if (res.status === 401) {
@@ -82,7 +83,7 @@ export async function ensureCliRecordingEntitlement(
82
83
  `\n rnx ${commandLabel} couldn't verify recording access with the current auth against ${billingOrigin}.\n` +
83
84
  ` sign in again for that origin, or provide a valid RNX_API_KEY.\n\n`,
84
85
  )
85
- process.exit(1)
86
+ rnxExit(1)
86
87
  }
87
88
 
88
89
  if (!res.ok) {
@@ -91,7 +92,7 @@ export async function ensureCliRecordingEntitlement(
91
92
  `\n rnx ${commandLabel} couldn't verify recording access (${res.status}).\n` +
92
93
  ` ${text || 'unexpected billing response'}\n\n`,
93
94
  )
94
- process.exit(1)
95
+ rnxExit(1)
95
96
  }
96
97
 
97
98
  const data = (await res.json()) as BillingSubscriptionSnapshot
@@ -103,5 +104,5 @@ export async function ensureCliRecordingEntitlement(
103
104
  ` current plan: ${plan}.\n` +
104
105
  ` free keeps basic 3d mode; the trial unlocks the full Personal surface.\n\n`,
105
106
  )
106
- process.exit(1)
107
+ rnxExit(1)
107
108
  }
package/cli/run-rnx.ts ADDED
@@ -0,0 +1,140 @@
1
+ // the in-process rnx entry. one implementation serves three placements: the
2
+ // host CLI (bin.ts is a thin wrapper over it), the local box shell, and a
3
+ // cloud box. the box shells cannot use the child process `rnx-command.ts`
4
+ // spawns today, and in workerd there is no process to spawn and no exit to
5
+ // call: RAN under miniflare, `process.exit()` cancels the whole request.
6
+ //
7
+ // two things stand between the command modules and an in-process call, and
8
+ // this module owns both:
9
+ //
10
+ // output — the modules write to console.* and process.std*.write, ~1,777
11
+ // sites. they are not rewritten to take a writer. instead the sinks are
12
+ // resolved from async context, so two commands running concurrently in one
13
+ // isolate keep their output separate. RAN: a global current-sink instead of
14
+ // AsyncLocalStorage interleaves them, which is what makes the context
15
+ // version necessary rather than merely tidy.
16
+ //
17
+ // exit — a command that calls process.exit ends the host process instead of
18
+ // returning a code to its caller. `rnxExit` throws instead, and `runRnx`
19
+ // turns it back into a code at the boundary.
20
+ //
21
+ // AsyncLocalStorage is why this module is node/workerd only. a browser
22
+ // placement (the Contrast IDE is also a client of this API) has no equivalent
23
+ // and will need the command modules to take an explicit writer. that is a real
24
+ // remaining seam, named here rather than discovered later.
25
+
26
+ import { AsyncLocalStorage } from 'node:async_hooks'
27
+
28
+ export interface RnxRunResult {
29
+ stdout: string
30
+ stderr: string
31
+ exitCode: number
32
+ }
33
+
34
+ interface RnxSinks {
35
+ stdout: string[]
36
+ stderr: string[]
37
+ }
38
+
39
+ // thrown by `rnxExit` in place of process.exit. every catch that reports an
40
+ // error must re-throw this before reporting, or it turns a deliberate exit
41
+ // into a spurious "command failed" line with the sentinel's own text.
42
+ export class RnxExit extends Error {
43
+ readonly code: number
44
+
45
+ constructor(code: number) {
46
+ super(`rnx exited with code ${code}`)
47
+ this.name = 'RnxExit'
48
+ this.code = code
49
+ }
50
+ }
51
+
52
+ const sinks = new AsyncLocalStorage<RnxSinks>()
53
+
54
+ // stop a command's deliberate exit from being reported as a failure. the
55
+ // guard every reporting catch needs, in one place so the call sites stay one
56
+ // line.
57
+ export function rethrowIfExit(error: unknown): void {
58
+ if (error instanceof RnxExit) throw error
59
+ }
60
+
61
+ // the in-process replacement for process.exit. returns `never` exactly as
62
+ // process.exit does, so it substitutes without changing any call site's types.
63
+ export function rnxExit(code: number): never {
64
+ throw new RnxExit(code)
65
+ }
66
+
67
+ function write(stream: 'stdout' | 'stderr', text: string): boolean {
68
+ const current = sinks.getStore()
69
+ if (!current) return false
70
+ current[stream].push(text)
71
+ return true
72
+ }
73
+
74
+ let installed = false
75
+
76
+ // replace the process-wide writers once. each resolves its destination from
77
+ // async context, so a call made outside any `runRnx` still reaches the real
78
+ // terminal and the host CLI keeps behaving exactly as it did.
79
+ function installCapture(): void {
80
+ if (installed) return
81
+ installed = true
82
+
83
+ const realLog = console.log.bind(console)
84
+ const realError = console.error.bind(console)
85
+ const realWarn = console.warn.bind(console)
86
+ const realStdout = process.stdout.write.bind(process.stdout)
87
+ const realStderr = process.stderr.write.bind(process.stderr)
88
+
89
+ const line = (args: unknown[]): string => `${args.map(String).join(' ')}\n`
90
+
91
+ console.log = (...args: unknown[]) => {
92
+ if (!write('stdout', line(args))) realLog(...args)
93
+ }
94
+ console.error = (...args: unknown[]) => {
95
+ if (!write('stderr', line(args))) realError(...args)
96
+ }
97
+ console.warn = (...args: unknown[]) => {
98
+ if (!write('stderr', line(args))) realWarn(...args)
99
+ }
100
+ process.stdout.write = (chunk: string | Uint8Array, ...rest: unknown[]) => {
101
+ if (
102
+ write('stdout', typeof chunk === 'string' ? chunk : new TextDecoder().decode(chunk))
103
+ ) {
104
+ return true
105
+ }
106
+ return Reflect.apply(realStdout, process.stdout, [chunk, ...rest])
107
+ }
108
+ process.stderr.write = (chunk: string | Uint8Array, ...rest: unknown[]) => {
109
+ if (
110
+ write('stderr', typeof chunk === 'string' ? chunk : new TextDecoder().decode(chunk))
111
+ ) {
112
+ return true
113
+ }
114
+ return Reflect.apply(realStderr, process.stderr, [chunk, ...rest])
115
+ }
116
+ }
117
+
118
+ // run one rnx invocation and return what it wrote plus its exit code, instead
119
+ // of writing to the terminal and ending the process. `argv` is the command and
120
+ // its arguments with no node/script prefix, e.g. ['describe', '--json'].
121
+ export async function runRnx(
122
+ argv: string[],
123
+ dispatch: (argv: string[]) => Promise<number>,
124
+ ): Promise<RnxRunResult> {
125
+ installCapture()
126
+ const current: RnxSinks = { stdout: [], stderr: [] }
127
+ const exitCode = await sinks.run(current, async () => {
128
+ try {
129
+ return await dispatch(argv)
130
+ } catch (error) {
131
+ if (error instanceof RnxExit) return error.code
132
+ throw error
133
+ }
134
+ })
135
+ return {
136
+ stdout: current.stdout.join(''),
137
+ stderr: current.stderr.join(''),
138
+ exitCode,
139
+ }
140
+ }
package/dist-cli/bin.js CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
- /*! rnx v0.1.368 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ /*! rnx v0.1.370 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
3
3
  import { createRequire as __sootsimCreateRequire } from 'node:module'
4
4
  var require = __sootsimCreateRequire(import.meta.url)
5
- import{a as g,b as f}from"./chunks/chunk-FVODUDPS.js";import{a as m}from"./chunks/chunk-WVVAYLWZ.js";import"./chunks/chunk-Q65KH25G.js";function A(a){let t=a instanceof Error?a.message:String(a);(/^command timed out after \d+s$/.test(t)||t.startsWith("sim disconnected:")||t.startsWith("bridge never reconnected")||t.startsWith("multiple sims are connected:")||t.startsWith("saved sim ")||t.startsWith("no sim connected with id ")||t.startsWith("could not connect to ws://")||t.startsWith("rnx bridge daemon is not running")||t.startsWith("rnx bridge lockfile is fresh")||t.startsWith("rnx bridge exited before becoming ready")||t.startsWith(`${m.commandName} open: requested bridge port`)||t.startsWith("background daemon setup is unavailable")||t.startsWith("rnx bridge did not start within"))&&!process.env.SOOTSIM_VERBOSE&&(process.stderr.write(` ${t}
5
+ import{a as g,b as f}from"./chunks/chunk-YIZGNT7A.js";import{a as h}from"./chunks/chunk-AVJBT5LF.js";import{a as m}from"./chunks/chunk-64JAEJ6N.js";import"./chunks/chunk-I52NT6VG.js";function k(a){let t=a instanceof Error?a.message:String(a);(/^command timed out after \d+s$/.test(t)||t.startsWith("sim disconnected:")||t.startsWith("bridge never reconnected")||t.startsWith("multiple sims are connected:")||t.startsWith("saved sim ")||t.startsWith("no sim connected with id ")||t.startsWith("could not connect to ws://")||t.startsWith("rnx bridge daemon is not running")||t.startsWith("rnx bridge lockfile is fresh")||t.startsWith("rnx bridge exited before becoming ready")||t.startsWith(`${m.commandName} open: requested bridge port`)||t.startsWith("background daemon setup is unavailable")||t.startsWith("rnx bridge did not start within"))&&!process.env.SOOTSIM_VERBOSE&&(process.stderr.write(` ${t}
6
6
  `),process.exit(1)),a instanceof Error&&a.stack?process.stderr.write(`${a.stack}
7
7
  `):process.stderr.write(`${t}
8
- `),process.exit(1)}process.on("unhandledRejection",A);process.on("uncaughtException",A);var k=typeof __SOOTSIM_STANDALONE__<"u"&&__SOOTSIM_STANDALONE__,S=new Set(["desktop"]);function C(a){!k||!S.has(a)||(process.stderr.write(` ${m.commandName} ${a} isn't available in the standalone binary \u2014
8
+ `),process.exit(1)}process.on("unhandledRejection",k);process.on("uncaughtException",k);var v=typeof __SOOTSIM_STANDALONE__<"u"&&__SOOTSIM_STANDALONE__,C=new Set(["desktop"]);function $(a){!v||!C.has(a)||(process.stderr.write(` ${m.commandName} ${a} isn't available in the standalone binary \u2014
9
9
  it needs vite / electron / playwright from a project's node_modules.
10
10
  run the npm package instead:
11
11
  ${m.commandName} ${a}
12
- `),process.exit(1))}var e=f(process.argv);if(!e.command&&e.commandArgs.length>0){let{resolveHiddenRuntimeAlias:a}=await import("./chunks/hidden-runtime-alias-6M4UERRQ.js");e=a(e)}var $=e.command==="cleanup"&&e.commandArgs.length===1&&e.commandArgs[0]==="--automatic-worker",_=!e.command&&e.commandArgs.length===0;if(!$&&!_&&!e.help&&!e.version&&e.command!=="config"&&e.command!=="setup"&&e.command!=="telemetry"){let{ensurePrivacyChoice:a}=await import("./chunks/privacy-BF23T67T.js");await a({prompt:!0})}if(e.command!=="serve"&&e.command!=="daemon"){let{consumeRuntimeUpgradeNotice:a}=await import("./chunks/home-paths-QJNOHZJO.js"),t=a();t&&process.stderr.write(` ${m.name} engine upgraded to v${t.to}`+(t.from?` (from v${t.from})`:"")+` \xB7 what's new: ${m.origin}/changelog
13
- `)}var h=!1;async function v(){if(!h&&(h=!0,!(e.command==="cleanup"||e.command==="serve"||e.command==="agent-wrapper"||e.command==="daemon"&&e.commandArgs[0]==="uninstall")))try{let{isAutomaticSootsimCleanupComplete:a}=await import("./chunks/disk-cleanup-JRT5MKFW.js");if(a())return;let{spawn:t}=await import("node:child_process"),r=["cleanup","--automatic-worker"],d=process.argv[1],p=k?t(process.execPath,r,{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env}):d?t(process.execPath,[d,...r],{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env}):t(m.commandName,r,{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env});p.once("error",w=>{process.stderr.write(` ${m.name} automatic cleanup will retry on the next run: ${w.message}
12
+ `),process.exit(1))}var e=f(process.argv);if(!e.command&&e.commandArgs.length>0){let{resolveHiddenRuntimeAlias:a}=await import("./chunks/hidden-runtime-alias-7S2TNZXG.js");e=a(e)}var _=e.command==="cleanup"&&e.commandArgs.length===1&&e.commandArgs[0]==="--automatic-worker",x=!e.command&&e.commandArgs.length===0;if(!_&&!x&&!e.help&&!e.version&&e.command!=="config"&&e.command!=="setup"&&e.command!=="telemetry"){let{ensurePrivacyChoice:a}=await import("./chunks/privacy-MIFE72CG.js");await a({prompt:!0})}if(e.command!=="serve"&&e.command!=="daemon"){let{consumeRuntimeUpgradeNotice:a}=await import("./chunks/home-paths-LMO5LB4F.js"),t=a();t&&process.stderr.write(` ${m.name} engine upgraded to v${t.to}`+(t.from?` (from v${t.from})`:"")+` \xB7 what's new: ${m.origin}/changelog
13
+ `)}var b=!1;async function S(){if(!b&&(b=!0,!(e.command==="cleanup"||e.command==="serve"||e.command==="agent-wrapper"||e.command==="daemon"&&e.commandArgs[0]==="uninstall")))try{let{isAutomaticSootsimCleanupComplete:a}=await import("./chunks/disk-cleanup-BDRHX5ZG.js");if(a())return;let{spawn:t}=await import("node:child_process"),r=["cleanup","--automatic-worker"],d=process.argv[1],p=v?t(process.execPath,r,{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env}):d?t(process.execPath,[d,...r],{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env}):t(m.commandName,r,{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env});p.once("error",w=>{process.stderr.write(` ${m.name} automatic cleanup will retry on the next run: ${w.message}
14
14
  `)}),p.unref()}catch(a){process.stderr.write(` ${m.name} automatic cleanup will retry on the next run: ${a instanceof Error?a.message:String(a)}
15
- `)}}async function o(a){let{flushCliTelemetry:t}=await import("./chunks/telemetry-7CWDXEOO.js");await t(),await v(),process.exit(a)}if(e.version){let{getCliVersion:a}=await import("./chunks/cli-version-DMXIXBIM.js"),{IS_BETA:t,BETA_LABEL:r}=await import("./chunks/beta-R4IZ5SWO.js"),d=t?` \xB7 ${r}`:"";console.log(`${m.commandName} v${a()}${d}`);let{readActiveRuntime:p}=await import("./chunks/home-paths-QJNOHZJO.js"),w=p();console.log(w?`runtime v${w}`:"runtime not installed"),await o(0)}if(e.help&&!e.command){let{printHelp:a}=await import("./chunks/help-5EJD6LJF.js");a(),await o(0)}var n=e.globalFlags.port,c=e.verbose,u=e.globalFlags.device,l=e.globalFlags.theme,y=e.globalFlags.driver,W=e.globalFlags.headless===!0,b=e.globalFlags.sim??e.globalFlags.session??e.globalFlags.tab,i=b?["--sim",b,...e.commandArgs]:e.commandArgs;if(u||l){let{settingsStore:a}=await import("./chunks/store-DLKNNM4L.js"),t={};u&&(t.deviceModel=u),l&&(t.colorScheme=l),a.apply(t)}if(!e.command&&e.commandArgs.length===0){let{runWelcome:a}=await import("./chunks/welcome-N5V352SE.js");await o(await a())}var s=e.command??"";if(!s){if(e.commandArgs.length>0){let t=e.commandArgs.find(r=>!r.startsWith("-"))??e.commandArgs[0];console.error(` unknown command: ${t}`),console.error(` run \`${m.commandName} --help\` to see the full surface.`),await o(1)}let{printHelp:a}=await import("./chunks/help-5EJD6LJF.js");a(),await o(0)}if(e.help||e.commandArgs.includes("--help")||e.commandArgs.includes("-h")){if(s==="skill"){let{runSkill:r}=await import("./chunks/skills-HPK25R4B.js");await r(e.commandArgs),await o(0)}if(s==="state"){let{runState:r}=await import("./chunks/state-273XJPUE.js");await o(await r(i,{port:n}))}if(s==="reset"){let{runReset:r}=await import("./chunks/reset-T5CNZ7D3.js");await o(await r(i,{port:n}))}let a=s==="do"||s==="get"||s==="debug"||s==="shell"||s==="perf"||s==="wait",t=e.commandArgs.find(r=>!r.startsWith("-"));if(!(s==="shell"||s==="perf"))if(a&&!t){let{printGroupHelp:r}=await import("./chunks/help-5EJD6LJF.js");r(s)&&await o(0)}else{let{printCommandHelp:r}=await import("./chunks/help-5EJD6LJF.js");r(a&&t?t:s,{prefer:a&&t?"verb":"command",group:a&&t?s:void 0}),await o(0)}}C(s);if(g.has(s)){if(s==="do"){let{hasDoChain:t,runDoChain:r}=await import("./chunks/do-chain-7FDMO56C.js");t(i)&&await o(await r(i,{port:n}))}let{runInspect:a}=await import("./chunks/inspect-S3LR3R2A.js");await a([s,...i],{port:n,verbose:c})}else switch(s){case"assert":{let{runAssert:a}=await import("./chunks/assert-BSRQBRH7.js");await a(e.commandArgs);break}case"detox":{let{runDetox:a}=await import("./chunks/detox-6HAKYISO.js");await a(e.commandArgs,{port:n,verbose:c});break}case"maestro":{let{runMaestro:a}=await import("./chunks/maestro-SQS2OS2D.js"),t=await a(i,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"record":{let{runRecord:a}=await import("./chunks/record-2DN3OUE5.js");await a(i,{port:n,verbose:c});break}case"film":{let{runFilm:a}=await import("./chunks/film-R3EQADMG.js"),t=await a(i,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"storage":{let{runStorage:a}=await import("./chunks/storage-RTDFWIY7.js"),t=await a(i,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"state":{let{runState:a}=await import("./chunks/state-273XJPUE.js"),t=await a(i,{port:n});await o(t)}case"reset":{let{runReset:a}=await import("./chunks/reset-T5CNZ7D3.js"),t=await a(i,{port:n});await o(t)}case"perf":{let{runPerf:a}=await import("./chunks/perf-XLPC4UKR.js"),t=await a(i,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"screenshot":{let{runScreenshotCommand:a}=await import("./chunks/screenshot-command-RK7IJHVK.js"),t=await a(i,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"camera":{let{runCamera:a}=await import("./chunks/camera-ER66WWAX.js"),t=await a(i,{port:n});await o(typeof t=="number"?t:0)}case"mode":{let{runMode:a}=await import("./chunks/mode-3URDGBZB.js");await a(i,{port:n,verbose:c});break}case"permissions":{let{runPermissions:a}=await import("./chunks/permissions-QRHWVMDP.js"),t=await a(i,{port:n,verbose:c});await o(t)}case"debug":{let{runDebug:a}=await import("./chunks/debug-AHEK43AJ.js");await a(i,{port:n,verbose:c});break}case"timeline":{let{runTimeline:a}=await import("./chunks/timeline-IF2PGK7C.js");await a(i,{port:n,verbose:c});break}case"what-happened":{let{runWhatHappened:a}=await import("./chunks/what-happened-WXTP6EPR.js");await a(i,{port:n,verbose:c});break}case"open":{let{runOpenCommand:a}=await import("./chunks/control-5GRBZVYK.js");await a(i,{port:n});break}case"ios":case"android":{let{runPlatformCommand:a}=await import("./chunks/platform-F47URZNB.js"),t=await a(s,i,{port:n});await o(typeof t=="number"?t:0)}case"box":{let{runBox:a}=await import("./chunks/box-2NQYYY3B.js");await o(await a(i,{port:n,verbose:c}))}case"use":{let{runUseCommand:a}=await import("./chunks/control-5GRBZVYK.js");await a(i,{port:n});break}case"claim":{let{runClaimCommand:a}=await import("./chunks/control-5GRBZVYK.js");await a(i,{port:n});break}case"close":{let{runCloseCommand:a}=await import("./chunks/control-5GRBZVYK.js");await a(i,{port:n});break}case"device":{let{runDeviceCommand:a}=await import("./chunks/device-QM3S7OVU.js");await a(i,{port:n});break}case"compat":{let{runCompat:a}=await import("./chunks/compat-MGBKGYGQ.js");await a(e.commandArgs);break}case"report-issue":{let{runReportIssue:a}=await import("./chunks/report-issue-D3BQPSLU.js"),t=await a(e.commandArgs);await o(t)}case"desktop":{let{runDesktop:a}=await import("./chunks/desktop-LDRIXOVV.js");await a(e.commandArgs,{port:n,device:u});break}case"login":{let{runLogin:a}=await import("./chunks/login-ISWDW4WU.js");await a(e.commandArgs);break}case"logout":{let{runLogout:a}=await import("./chunks/logout-VNJX2IEW.js");await a();break}case"auth":{let{runAuth:a}=await import("./chunks/auth-SLPHDPCF.js");await a(e.commandArgs);break}case"setup":{let{runSetup:a}=await import("./chunks/setup-GH7OW4GC.js");await a(e.commandArgs);break}case"serve":{let{runServe:a}=await import("./chunks/serve-UBXNGLNP.js");await a(e.commandArgs,{port:n});break}case"daemon":{let{runDaemon:a}=await import("./chunks/daemon-MBT5E3ZC.js");await a(e.commandArgs,{port:n});break}case"runtime":{let{runRuntime:a}=await import("./chunks/runtime-AQJDBR3X.js");await a(e.commandArgs);break}case"upgrade":{let{runUpgrade:a}=await import("./chunks/upgrade-R74NVHKG.js");await a(e.commandArgs);break}case"version":{let{runVersion:a}=await import("./chunks/version-RTFCYQZ7.js");await a(e.commandArgs);break}case"agent":{let{runAgentCommand:a}=await import("./chunks/agent-GXCQMYV4.js"),t=await a(e.commandArgs);await o(t)}case"agent-wrapper":{let{runAgentWrapper:a}=await import("./chunks/agent-wrapper-Y3PQAL6I.js"),t=await a(e.commandArgs);await o(t)}case"skill":{let{runSkill:a}=await import("./chunks/skills-HPK25R4B.js");await a(e.commandArgs);break}case"app-fonts":{let{runAppFonts:a}=await import("./chunks/app-fonts-MDD3W4VN.js");await a(e.commandArgs);break}case"config":{let{runConfig:a}=await import("./chunks/config-TRDOMP4T.js");await a(e.commandArgs);break}case"cleanup":{let{runCleanup:a}=await import("./chunks/cleanup-WHGLBAJ2.js"),t=await a(e.commandArgs);await o(t)}default:console.error(` unknown command: ${s}`),console.error(` run \`${m.commandName} --help\` to see the full surface.`),await o(1)}await v();
15
+ `)}}async function n(a){let{flushCliTelemetry:t}=await import("./chunks/telemetry-BV6OTYPF.js");await t(),await S(),process.exit(a)}if(e.version){let{getCliVersion:a}=await import("./chunks/cli-version-MLS55UTY.js"),{IS_BETA:t,BETA_LABEL:r}=await import("./chunks/beta-FKAF6YWJ.js"),d=t?` \xB7 ${r}`:"";console.log(`${m.commandName} v${a()}${d}`);let{readActiveRuntime:p}=await import("./chunks/home-paths-LMO5LB4F.js"),w=p();console.log(w?`runtime v${w}`:"runtime not installed"),await n(0)}if(e.help&&!e.command){let{printHelp:a}=await import("./chunks/help-BYYDUSXF.js");a(),await n(0)}var o=e.globalFlags.port,c=e.verbose,u=e.globalFlags.device,l=e.globalFlags.theme,E=e.globalFlags.driver,O=e.globalFlags.headless===!0,A=e.globalFlags.sim??e.globalFlags.session??e.globalFlags.tab,i=A?["--sim",A,...e.commandArgs]:e.commandArgs;if(u||l){let{settingsStore:a}=await import("./chunks/store-HOL45WCI.js"),t={};u&&(t.deviceModel=u),l&&(t.colorScheme=l),a.apply(t)}if(!e.command&&e.commandArgs.length===0){let{runWelcome:a}=await import("./chunks/welcome-FT2AMUWW.js");await n(await a())}var s=e.command??"";if(!s){if(e.commandArgs.length>0){let t=e.commandArgs.find(r=>!r.startsWith("-"))??e.commandArgs[0];console.error(` unknown command: ${t}`),console.error(` run \`${m.commandName} --help\` to see the full surface.`),await n(1)}let{printHelp:a}=await import("./chunks/help-BYYDUSXF.js");a(),await n(0)}if(e.help||e.commandArgs.includes("--help")||e.commandArgs.includes("-h")){if(s==="skill"){let{runSkill:r}=await import("./chunks/skills-N4D3POIS.js");await r(e.commandArgs),await n(0)}if(s==="state"){let{runState:r}=await import("./chunks/state-ES6TFQZF.js");await n(await r(i,{port:o}))}if(s==="reset"){let{runReset:r}=await import("./chunks/reset-RZ4O5AFJ.js");await n(await r(i,{port:o}))}let a=s==="do"||s==="get"||s==="debug"||s==="shell"||s==="perf"||s==="wait",t=e.commandArgs.find(r=>!r.startsWith("-"));if(!(s==="shell"||s==="perf"))if(a&&!t){let{printGroupHelp:r}=await import("./chunks/help-BYYDUSXF.js");r(s)&&await n(0)}else{let{printCommandHelp:r}=await import("./chunks/help-BYYDUSXF.js");r(a&&t?t:s,{prefer:a&&t?"verb":"command",group:a&&t?s:void 0}),await n(0)}}$(s);try{if(g.has(s)){if(s==="do"){let{hasDoChain:t,runDoChain:r}=await import("./chunks/do-chain-RUJNRPPF.js");t(i)&&await n(await r(i,{port:o}))}let{runInspect:a}=await import("./chunks/inspect-RQCTWDCC.js");await a([s,...i],{port:o,verbose:c})}else switch(s){case"assert":{let{runAssert:a}=await import("./chunks/assert-7EZOWGYQ.js");await a(e.commandArgs);break}case"detox":{let{runDetox:a}=await import("./chunks/detox-WJGQP5TM.js");await a(e.commandArgs,{port:o,verbose:c});break}case"maestro":{let{runMaestro:a}=await import("./chunks/maestro-TYBQYOGB.js"),t=await a(i,{port:o,verbose:c});await n(typeof t=="number"?t:0)}case"record":{let{runRecord:a}=await import("./chunks/record-EK3ETFHZ.js");await a(i,{port:o,verbose:c});break}case"film":{let{runFilm:a}=await import("./chunks/film-XC6UAQ3V.js"),t=await a(i,{port:o,verbose:c});await n(typeof t=="number"?t:0)}case"storage":{let{runStorage:a}=await import("./chunks/storage-52DR5V2C.js"),t=await a(i,{port:o,verbose:c});await n(typeof t=="number"?t:0)}case"state":{let{runState:a}=await import("./chunks/state-ES6TFQZF.js"),t=await a(i,{port:o});await n(t)}case"reset":{let{runReset:a}=await import("./chunks/reset-RZ4O5AFJ.js"),t=await a(i,{port:o});await n(t)}case"perf":{let{runPerf:a}=await import("./chunks/perf-LXXJ4EAX.js"),t=await a(i,{port:o,verbose:c});await n(typeof t=="number"?t:0)}case"screenshot":{let{runScreenshotCommand:a}=await import("./chunks/screenshot-command-TQSPTFT2.js"),t=await a(i,{port:o,verbose:c});await n(typeof t=="number"?t:0)}case"camera":{let{runCamera:a}=await import("./chunks/camera-XHF2RPFG.js"),t=await a(i,{port:o});await n(typeof t=="number"?t:0)}case"mode":{let{runMode:a}=await import("./chunks/mode-DV24ZRZ6.js");await a(i,{port:o,verbose:c});break}case"permissions":{let{runPermissions:a}=await import("./chunks/permissions-KAOVZUPW.js"),t=await a(i,{port:o,verbose:c});await n(t)}case"debug":{let{runDebug:a}=await import("./chunks/debug-5FG3MBJS.js");await a(i,{port:o,verbose:c});break}case"timeline":{let{runTimeline:a}=await import("./chunks/timeline-NRVNB5JR.js");await a(i,{port:o,verbose:c});break}case"what-happened":{let{runWhatHappened:a}=await import("./chunks/what-happened-FSIDWL32.js");await a(i,{port:o,verbose:c});break}case"open":{let{runOpenCommand:a}=await import("./chunks/control-XD5F6K5T.js");await a(i,{port:o});break}case"ios":case"android":{let{runPlatformCommand:a}=await import("./chunks/platform-KW35446W.js"),t=await a(s,i,{port:o});await n(typeof t=="number"?t:0)}case"box":{let{runBox:a}=await import("./chunks/box-5Y5VBMHV.js");await n(await a(i,{port:o,verbose:c}))}case"use":{let{runUseCommand:a}=await import("./chunks/control-XD5F6K5T.js");await a(i,{port:o});break}case"claim":{let{runClaimCommand:a}=await import("./chunks/control-XD5F6K5T.js");await a(i,{port:o});break}case"close":{let{runCloseCommand:a}=await import("./chunks/control-XD5F6K5T.js");await a(i,{port:o});break}case"device":{let{runDeviceCommand:a}=await import("./chunks/device-D7LKCAMS.js");await a(i,{port:o});break}case"compat":{let{runCompat:a}=await import("./chunks/compat-E6KE5KDI.js");await a(e.commandArgs);break}case"report-issue":{let{runReportIssue:a}=await import("./chunks/report-issue-NW5PCAZF.js"),t=await a(e.commandArgs);await n(t)}case"desktop":{let{runDesktop:a}=await import("./chunks/desktop-5EZX7NX5.js");await a(e.commandArgs,{port:o,device:u});break}case"login":{let{runLogin:a}=await import("./chunks/login-JIU42S4C.js");await a(e.commandArgs);break}case"logout":{let{runLogout:a}=await import("./chunks/logout-JTAWQXZO.js");await a();break}case"auth":{let{runAuth:a}=await import("./chunks/auth-L7M36H6C.js");await a(e.commandArgs);break}case"setup":{let{runSetup:a}=await import("./chunks/setup-YFP3KEQZ.js");await a(e.commandArgs);break}case"serve":{let{runServe:a}=await import("./chunks/serve-MMX4WXXG.js");await a(e.commandArgs,{port:o});break}case"daemon":{let{runDaemon:a}=await import("./chunks/daemon-UN5SE2JO.js");await a(e.commandArgs,{port:o});break}case"runtime":{let{runRuntime:a}=await import("./chunks/runtime-MZHLSRS6.js");await a(e.commandArgs);break}case"upgrade":{let{runUpgrade:a}=await import("./chunks/upgrade-LNED5YQ2.js");await a(e.commandArgs);break}case"version":{let{runVersion:a}=await import("./chunks/version-VEF2DYGG.js");await a(e.commandArgs);break}case"agent":{let{runAgentCommand:a}=await import("./chunks/agent-3R4424LW.js"),t=await a(e.commandArgs);await n(t)}case"agent-wrapper":{let{runAgentWrapper:a}=await import("./chunks/agent-wrapper-4PPWZWSY.js"),t=await a(e.commandArgs);await n(t)}case"skill":{let{runSkill:a}=await import("./chunks/skills-N4D3POIS.js");await a(e.commandArgs);break}case"app-fonts":{let{runAppFonts:a}=await import("./chunks/app-fonts-KYXB6CXQ.js");await a(e.commandArgs);break}case"config":{let{runConfig:a}=await import("./chunks/config-QSLLVZDS.js");await a(e.commandArgs);break}case"cleanup":{let{runCleanup:a}=await import("./chunks/cleanup-MXMMJ7JW.js"),t=await a(e.commandArgs);await n(t)}default:console.error(` unknown command: ${s}`),console.error(` run \`${m.commandName} --help\` to see the full surface.`),await n(1)}}catch(a){throw a instanceof h&&await n(a.code),a}await S();
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.368 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.370 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{a as b,b as E,c as A,d as l,e as S,g as x,h as j,j as T,n as I,o as k,p as D,q as g,r as O,s as C}from"./chunk-GFWUIGGY.js";import"./chunk-4FLQYRGN.js";import{c as $}from"./chunk-BWJOLJOK.js";import"./chunk-WXRDFUR7.js";import"./chunk-FSPZY4AI.js";import"./chunk-4VA2ISWX.js";import"./chunk-LAKWOJ5Y.js";import"./chunk-EHA65UVJ.js";import"./chunk-T2MGLXY5.js";import"./chunk-LPAOOJIW.js";import"./chunk-SSUPPM6K.js";import{j as y}from"./chunk-E6XYIIJK.js";import"./chunk-ECXDCED5.js";import"./chunk-WVVAYLWZ.js";import"./chunk-Q65KH25G.js";import w from"node:fs";import d from"node:path";import{spawn as _}from"node:child_process";import F from"node:net";import{WebSocket as R}from"ws";var c=class extends Error{code;constructor(e,t){super(e),this.name="AgentDaemonError",this.code=t}},f=class{ws;port;commandTimeoutMs;ready;closed=!1;nextId=1;pending=new Map;eventListeners=new Set;statusListeners=new Set;disconnectListeners=new Set;constructor(e={}){this.port=e.port??7668,this.commandTimeoutMs=e.commandTimeoutMs??15e3,this.ws=new R(`ws://localhost:${this.port}`),this.ready=new Promise((t,r)=>{let s=()=>{this.ws.off("error",o),t()},o=i=>{this.ws.off("open",s),r(new c(`could not connect to rnx daemon on port ${this.port}: ${i.message}`,"NO_DAEMON"))};this.ws.once("open",s),this.ws.once("error",o)}),this.ws.on("message",t=>this.handleMessage(t)),this.ws.on("close",()=>this.handleClose()),this.ws.on("error",()=>{})}async waitReady(){return this.ready}async listProjects(){return this.send("agent:list-projects")}async upsertProject(e){return this.send("agent:upsert-project",{input:e})}async deleteProject(e){return this.send("agent:delete-project",{projectId:e})}async autoAttachForUrl(e){return this.send("agent:auto-attach-for-url",{input:e})}async listSessions(e){return this.send("agent:list-sessions",{projectId:e})}async startSession(e){return this.send("agent:start-session",{input:e})}async sendPrompt(e,t){return this.send("agent:send-prompt",{sessionId:e,prompt:t})}async sendClaimedPrompt(e,t){return this.send("agent:send-claimed-prompt",{simId:e,prompt:t})}async endSession(e){return this.send("agent:end-session",{sessionId:e})}async getTranscript(e){return this.send("agent:get-transcript",{sessionId:e})}async getPaths(){return this.send("agent:get-paths")}async subscribeEvents(e){return this.send("agent:subscribe-events",{sessionId:e})}async unsubscribeEvents(e){return this.send("agent:unsubscribe-events",{sessionId:e})}onAgentEvent(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}onSessionStatusChange(e){return this.statusListeners.add(e),()=>this.statusListeners.delete(e)}onDisconnect(e){return this.disconnectListeners.add(e),()=>this.disconnectListeners.delete(e)}close(){if(!this.closed){this.closed=!0;try{this.ws.close()}catch{}}}async send(e,t={}){if(await this.ready,this.closed||this.ws.readyState!==R.OPEN)throw new c("daemon connection is closed","NO_DAEMON");let r=this.nextId++;return new Promise((s,o)=>{let i=setTimeout(()=>{this.pending.delete(r),o(new c(`${e} timed out after ${Math.round(this.commandTimeoutMs/1e3)}s`,"TIMEOUT"))},this.commandTimeoutMs);this.pending.set(r,{resolve:s,reject:o,timer:i});try{this.ws.send(JSON.stringify({id:r,type:e,...t}))}catch(a){clearTimeout(i),this.pending.delete(r),o(a instanceof Error?a:new Error(String(a)))}})}handleMessage(e){let t;try{t=JSON.parse(String(e))}catch{return}if(!t||typeof t!="object")return;if(t.type==="agent:event"){for(let s of this.eventListeners)try{s({sessionId:t.sessionId,event:t.event})}catch{}return}if(t.type==="agent:session-status"){for(let s of this.statusListeners)try{s(t.session)}catch{}return}if(typeof t.id!="number")return;let r=this.pending.get(t.id);r&&(this.pending.delete(t.id),clearTimeout(r.timer),t.error?r.reject(new c(t.error,t.code)):r.resolve(t.result))}handleClose(){if(!this.closed){this.closed=!0;for(let[,e]of this.pending)clearTimeout(e.timer),e.reject(new c("daemon disconnected","DISCONNECT"));this.pending.clear();for(let e of this.disconnectListeners)try{e()}catch{}}}};function M(n=7668,e=400){return new Promise(t=>{let r=new F.Socket,s=!1,o=i=>{s||(s=!0,r.destroy(),t(i))};r.setTimeout(e),r.once("connect",()=>o(!0)),r.once("timeout",()=>o(!1)),r.once("error",()=>o(!1)),r.connect(n,"127.0.0.1")})}async function B(n={}){let e=n.port??7668;if(await M(e))return{alreadyRunning:!0};if(y())throw new c(`no rnx bridge on port ${e}. run \`rnx daemon install\` to enable the faster background service, or \`rnx serve\` in another shell.`,"DEV_HOST_REFUSED");let{cmd:t,prefixArgs:r}=C(),s=[...r,"serve","--quiet"];e!==7668&&s.push("--port",String(e));let o=_(t,s,{detached:!0,stdio:"ignore",env:process.env,cwd:process.cwd()});o.unref();let i=Date.now()+(n.startupTimeoutMs??5e3);for(;Date.now()<i;){if(await M(e))return{alreadyRunning:!1,pid:o.pid};await new Promise(a=>setTimeout(a,100))}throw new c(`spawned rnx daemon on port ${e} but it did not come up in time. run \`rnx serve\` manually to diagnose.`,"SPAWN_TIMEOUT")}async function h(n={}){await B({port:n.port,startupTimeoutMs:n.startupTimeoutMs});let e=new f(n);try{await e.waitReady()}catch(t){throw e.close(),t}return e}async function ge(n){let[e,...t]=n;try{switch(e){case void 0:case"--help":case"-h":case"help":return L(),0;case"attach":return await W(t);case"projects":return await J();case"project":return await V(t);case"sessions":return await H(t);case"start":return await G(t);case"prompt":return await q(t);case"watch":return await K(t);case"transcript":return await z(t);case"end":return await Q(t);case"paths":return await Y();default:return process.stderr.write(`unknown agent subcommand: ${e}
4
+ import{a as b,b as E,c as A,d as l,e as S,g as x,h as j,j as T,n as I,o as k,p as D,q as g,r as O,s as C}from"./chunk-Z3DENGXW.js";import"./chunk-DXV37CJN.js";import{c as $}from"./chunk-5RKRVS5A.js";import"./chunk-PIZXOXBL.js";import"./chunk-C7BA5CCM.js";import"./chunk-NJMU5BN6.js";import"./chunk-JZLDHPB7.js";import"./chunk-CMVRTZ5G.js";import"./chunk-EOIBLKZO.js";import"./chunk-OJZHECGH.js";import"./chunk-RRX52O37.js";import{j as y}from"./chunk-U63T6LIQ.js";import"./chunk-MDCY532E.js";import"./chunk-64JAEJ6N.js";import"./chunk-I52NT6VG.js";import w from"node:fs";import d from"node:path";import{spawn as _}from"node:child_process";import F from"node:net";import{WebSocket as R}from"ws";var c=class extends Error{code;constructor(e,t){super(e),this.name="AgentDaemonError",this.code=t}},f=class{ws;port;commandTimeoutMs;ready;closed=!1;nextId=1;pending=new Map;eventListeners=new Set;statusListeners=new Set;disconnectListeners=new Set;constructor(e={}){this.port=e.port??7668,this.commandTimeoutMs=e.commandTimeoutMs??15e3,this.ws=new R(`ws://localhost:${this.port}`),this.ready=new Promise((t,r)=>{let s=()=>{this.ws.off("error",o),t()},o=i=>{this.ws.off("open",s),r(new c(`could not connect to rnx daemon on port ${this.port}: ${i.message}`,"NO_DAEMON"))};this.ws.once("open",s),this.ws.once("error",o)}),this.ws.on("message",t=>this.handleMessage(t)),this.ws.on("close",()=>this.handleClose()),this.ws.on("error",()=>{})}async waitReady(){return this.ready}async listProjects(){return this.send("agent:list-projects")}async upsertProject(e){return this.send("agent:upsert-project",{input:e})}async deleteProject(e){return this.send("agent:delete-project",{projectId:e})}async autoAttachForUrl(e){return this.send("agent:auto-attach-for-url",{input:e})}async listSessions(e){return this.send("agent:list-sessions",{projectId:e})}async startSession(e){return this.send("agent:start-session",{input:e})}async sendPrompt(e,t){return this.send("agent:send-prompt",{sessionId:e,prompt:t})}async sendClaimedPrompt(e,t){return this.send("agent:send-claimed-prompt",{simId:e,prompt:t})}async endSession(e){return this.send("agent:end-session",{sessionId:e})}async getTranscript(e){return this.send("agent:get-transcript",{sessionId:e})}async getPaths(){return this.send("agent:get-paths")}async subscribeEvents(e){return this.send("agent:subscribe-events",{sessionId:e})}async unsubscribeEvents(e){return this.send("agent:unsubscribe-events",{sessionId:e})}onAgentEvent(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}onSessionStatusChange(e){return this.statusListeners.add(e),()=>this.statusListeners.delete(e)}onDisconnect(e){return this.disconnectListeners.add(e),()=>this.disconnectListeners.delete(e)}close(){if(!this.closed){this.closed=!0;try{this.ws.close()}catch{}}}async send(e,t={}){if(await this.ready,this.closed||this.ws.readyState!==R.OPEN)throw new c("daemon connection is closed","NO_DAEMON");let r=this.nextId++;return new Promise((s,o)=>{let i=setTimeout(()=>{this.pending.delete(r),o(new c(`${e} timed out after ${Math.round(this.commandTimeoutMs/1e3)}s`,"TIMEOUT"))},this.commandTimeoutMs);this.pending.set(r,{resolve:s,reject:o,timer:i});try{this.ws.send(JSON.stringify({id:r,type:e,...t}))}catch(a){clearTimeout(i),this.pending.delete(r),o(a instanceof Error?a:new Error(String(a)))}})}handleMessage(e){let t;try{t=JSON.parse(String(e))}catch{return}if(!t||typeof t!="object")return;if(t.type==="agent:event"){for(let s of this.eventListeners)try{s({sessionId:t.sessionId,event:t.event})}catch{}return}if(t.type==="agent:session-status"){for(let s of this.statusListeners)try{s(t.session)}catch{}return}if(typeof t.id!="number")return;let r=this.pending.get(t.id);r&&(this.pending.delete(t.id),clearTimeout(r.timer),t.error?r.reject(new c(t.error,t.code)):r.resolve(t.result))}handleClose(){if(!this.closed){this.closed=!0;for(let[,e]of this.pending)clearTimeout(e.timer),e.reject(new c("daemon disconnected","DISCONNECT"));this.pending.clear();for(let e of this.disconnectListeners)try{e()}catch{}}}};function M(n=7668,e=400){return new Promise(t=>{let r=new F.Socket,s=!1,o=i=>{s||(s=!0,r.destroy(),t(i))};r.setTimeout(e),r.once("connect",()=>o(!0)),r.once("timeout",()=>o(!1)),r.once("error",()=>o(!1)),r.connect(n,"127.0.0.1")})}async function B(n={}){let e=n.port??7668;if(await M(e))return{alreadyRunning:!0};if(y())throw new c(`no rnx bridge on port ${e}. run \`rnx daemon install\` to enable the faster background service, or \`rnx serve\` in another shell.`,"DEV_HOST_REFUSED");let{cmd:t,prefixArgs:r}=C(),s=[...r,"serve","--quiet"];e!==7668&&s.push("--port",String(e));let o=_(t,s,{detached:!0,stdio:"ignore",env:process.env,cwd:process.cwd()});o.unref();let i=Date.now()+(n.startupTimeoutMs??5e3);for(;Date.now()<i;){if(await M(e))return{alreadyRunning:!1,pid:o.pid};await new Promise(a=>setTimeout(a,100))}throw new c(`spawned rnx daemon on port ${e} but it did not come up in time. run \`rnx serve\` manually to diagnose.`,"SPAWN_TIMEOUT")}async function h(n={}){await B({port:n.port,startupTimeoutMs:n.startupTimeoutMs});let e=new f(n);try{await e.waitReady()}catch(t){throw e.close(),t}return e}async function ge(n){let[e,...t]=n;try{switch(e){case void 0:case"--help":case"-h":case"help":return L(),0;case"attach":return await W(t);case"projects":return await J();case"project":return await V(t);case"sessions":return await H(t);case"start":return await G(t);case"prompt":return await q(t);case"watch":return await K(t);case"transcript":return await z(t);case"end":return await Q(t);case"paths":return await Y();default:return process.stderr.write(`unknown agent subcommand: ${e}
5
5
  `),L(),2}}catch(r){if(r instanceof c)return process.stderr.write(`${r.message}
6
6
  `),1;throw r}}async function v(n){let e=await h({clientLabel:"sootsim-agent-cli"});try{return await n(e)}finally{e.close()}}function L(){$("agent")}function P(n,e){let t={},r=[];for(let s=0;s<n.length;s++){let o=n[s],i=e[o];i==="value"?(t[o]=n[s+1]??"",s++):i==="bool"?t[o]=!0:r.push(o)}return{flags:t,positional:r}}function U(n,e="codex"){return n==="codex"||n==="claude"?n:e}async function W(n){let{flags:e,positional:t}=P(n,{"--name":"value","--provider":"value"}),r=t[0];if(!r)return process.stderr.write(`usage: rnx agent attach <dir> [--name X] [--provider codex|claude]
7
7
  `),2;let s=d.resolve(r);if(!w.existsSync(s))return process.stderr.write(`directory does not exist: ${s}
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.368 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.370 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{b as M}from"./chunk-4FLQYRGN.js";import"./chunk-Q65KH25G.js";import{execFile as G,spawn as q}from"node:child_process";import{randomUUID as X}from"node:crypto";import{constants as R,createReadStream as Y,createWriteStream as j,existsSync as C,openSync as J}from"node:fs";import V from"node:fs/promises";import z from"node:path";import K from"node:readline";import{promisify as Q}from"node:util";import{spawn as H}from"node:child_process";import L from"node:readline";var b=class extends Error{code;data;constructor(t,r,m){super(t),this.name="CodexRpcError",this.code=r,this.data=m}};function W(d){let t=H(d.bin,["app-server"],{cwd:d.cwd,env:{...process.env,...d.env},stdio:["pipe","pipe","pipe"]}),r=new Map,m=new Map,u=1,f=!1,a=new Promise(s=>{t.on("exit",(o,e)=>{f=!0;let p=new Error(`codex app-server exited (code=${o}, signal=${e??""})`);for(let{reject:y}of r.values())y(p);r.clear(),s({code:o,signal:e})})});L.createInterface({input:t.stdout,crlfDelay:1/0}).on("line",s=>{let o=s.trim();if(!o)return;let e;try{e=JSON.parse(o)}catch{return}if(e.id!=null&&(e.result!==void 0||e.error!==void 0)){let p=typeof e.id=="string"?Number(e.id):e.id,y=p!=null?r.get(p):void 0;if(!y)return;r.delete(p),e.error?y.reject(new b(e.error.message,e.error.code,e.error.data)):y.resolve(e.result);return}if(e.method){let p=m.get(e.method);if(!p)return;for(let y of p)try{y(e.params)}catch(l){console.error(`[codex-client] handler for "${e.method}" threw:`,l instanceof Error?l.stack??l.message:l)}}}),t.stderr.setEncoding("utf8"),t.stderr.on("data",s=>{let o=m.get("__stderr__");if(o)for(let e of o)try{e({text:s})}catch{}});function n(s){if(!f)try{t.stdin.write(JSON.stringify(s)+`
4
+ import{b as M}from"./chunk-DXV37CJN.js";import"./chunk-I52NT6VG.js";import{execFile as G,spawn as q}from"node:child_process";import{randomUUID as X}from"node:crypto";import{constants as R,createReadStream as Y,createWriteStream as j,existsSync as C,openSync as J}from"node:fs";import V from"node:fs/promises";import z from"node:path";import K from"node:readline";import{promisify as Q}from"node:util";import{spawn as H}from"node:child_process";import L from"node:readline";var b=class extends Error{code;data;constructor(t,r,m){super(t),this.name="CodexRpcError",this.code=r,this.data=m}};function W(d){let t=H(d.bin,["app-server"],{cwd:d.cwd,env:{...process.env,...d.env},stdio:["pipe","pipe","pipe"]}),r=new Map,m=new Map,u=1,f=!1,a=new Promise(s=>{t.on("exit",(o,e)=>{f=!0;let p=new Error(`codex app-server exited (code=${o}, signal=${e??""})`);for(let{reject:y}of r.values())y(p);r.clear(),s({code:o,signal:e})})});L.createInterface({input:t.stdout,crlfDelay:1/0}).on("line",s=>{let o=s.trim();if(!o)return;let e;try{e=JSON.parse(o)}catch{return}if(e.id!=null&&(e.result!==void 0||e.error!==void 0)){let p=typeof e.id=="string"?Number(e.id):e.id,y=p!=null?r.get(p):void 0;if(!y)return;r.delete(p),e.error?y.reject(new b(e.error.message,e.error.code,e.error.data)):y.resolve(e.result);return}if(e.method){let p=m.get(e.method);if(!p)return;for(let y of p)try{y(e.params)}catch(l){console.error(`[codex-client] handler for "${e.method}" threw:`,l instanceof Error?l.stack??l.message:l)}}}),t.stderr.setEncoding("utf8"),t.stderr.on("data",s=>{let o=m.get("__stderr__");if(o)for(let e of o)try{e({text:s})}catch{}});function n(s){if(!f)try{t.stdin.write(JSON.stringify(s)+`
5
5
  `)}catch{}}return{exited:a,on(s,o){let e=m.get(s);return e||(e=new Set,m.set(s,e)),e.add(o),()=>{e?.delete(o)}},request(s,o){if(f)return Promise.reject(new Error(`codex app-server closed; cannot call ${s}`));let e=u++;return new Promise((p,y)=>{r.set(e,{resolve:l=>p(l),reject:y,method:s}),n({jsonrpc:"2.0",id:e,method:s,params:o})})},notify(s,o){n({jsonrpc:"2.0",method:s,params:o})},async shutdown(s=1500){if(f)return;try{t.stdin.end()}catch{}let o=setTimeout(()=>{if(!f)try{t.kill("SIGTERM")}catch{}},s);try{await a}finally{clearTimeout(o)}},kill(s="SIGTERM"){if(!f)try{t.kill(s)}catch{}}}}var O="never",F="danger-full-access",Z={type:"dangerFullAccess"},D="fast",ee="medium",te=Q(G);async function ne(d,t){let r=t||d;if(r.includes("/")||r.includes("\\"))return C(r)?{ok:!0,path:r}:{ok:!1,message:`agent binary not found at path: ${r}`};try{let{stdout:m}=await te("which",[r],{timeout:1500}),u=m.trim();return u?{ok:!0,path:u}:{ok:!1,message:`${r} not found on PATH`}}catch{return{ok:!1,message:`${r} not found on PATH. install the ${d} CLI and retry, or pass --${d}-bin /path/to/${d} to agent start.`}}}function re(d){let t={"--session-id":"sessionId","--project-id":"projectId","--provider":"provider","--cwd":"cwd","--prompt-in":"promptIn","--events-out":"eventsOut","--transcript":"transcript","--codex-bin":"codexBin","--claude-bin":"claudeBin","--claude-session-uuid":"claudeSessionUuid"},r={};for(let m=0;m<d.length;m++){let u=d[m];if(u==="--fresh-thread"){r.freshThread=!0;continue}let f=t[u];f&&(r[f]=d[m+1],m++)}return r}async function Ie(d){let t=re(d);if(!t.sessionId||!t.projectId||!t.provider||!t.cwd||!t.promptIn||!t.eventsOut)return process.stderr.write(`usage: rnx agent-wrapper --session-id <id> --project-id <id>
6
6
  --provider codex|claude --cwd <path>
7
7
  --prompt-in <fifo> --events-out <fifo>
@@ -0,0 +1,4 @@
1
+ /*! rnx v0.1.370 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import{p as g}from"./chunk-3BG6UCQY.js";import"./chunk-PNOENVMJ.js";import"./chunk-EQ3OE2AV.js";import{c as f}from"./chunk-AVJBT5LF.js";import"./chunk-I52NT6VG.js";import{existsSync as d,mkdirSync as y,readFileSync as m,writeFileSync as u}from"node:fs";import{join as w}from"node:path";import{gzipSync as x}from"node:zlib";function l(t,e){let r=t.indexOf(`--${e}`);if(r!==-1&&r+1<t.length)return t[r+1];let s=t.find(i=>i.startsWith(`--${e}=`));return s?s.slice(e.length+3):void 0}async function S(t){let e=l(t,"wire")||"",r=l(t,"out-dir"),s=l(t,"manifest");if((!r||!s)&&(console.error(" usage: rnx app-fonts stage --wire <wire> --out-dir <dir> --manifest <path>"),f(1)),!e.trim()){console.log("no app fonts declared \u2014 nothing to stage");return}y(r,{recursive:!0});let i=await g(e,{onStaged:({url:n,byteLength:o})=>console.log(` staged app font: ${n} (${(o/1024).toFixed(1)} KiB)`),onError:(n,o)=>console.error(` warning: failed to fetch app font ${n}: ${o instanceof Error?o.message:o}`)}),a=[];for(let n of i){let o=x(n.bytes);u(w(r,n.urlhash),o),a.push({url:n.url,urlhash:n.urlhash,contentType:n.contentType,encoding:"gzip",sizeBytes:o.length,rawBytes:n.bytes.byteLength})}let c=[];if(d(s))try{let n=JSON.parse(m(s,"utf8"));Array.isArray(n)&&(c=n)}catch{}let h=new Set(c.map(n=>n.urlhash)),p=[...c,...a.filter(n=>!h.has(n.urlhash))];u(s,JSON.stringify(p)),console.log(`staged ${a.length} app font(s); manifest now has ${p.length} file(s)`)}async function B(t){let e=t[0];if(e==="stage"){await S(t.slice(1));return}console.error(` unknown app-fonts subcommand: ${e??"(none)"}`),console.error(" available: stage"),f(1)}export{B as runAppFonts};