rnxsim 0.1.313 → 0.1.315

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 (297) hide show
  1. package/LICENSE +11 -10
  2. package/README.md +5 -0
  3. package/cli/app-config.ts +65 -0
  4. package/cli/app-fonts.ts +408 -0
  5. package/cli/app-project.ts +231 -0
  6. package/cli/app-splash.ts +185 -0
  7. package/cli/app-state-reset.ts +24 -0
  8. package/cli/auth.ts +155 -0
  9. package/cli/bin.ts +594 -0
  10. package/cli/bridge-diagnostics.ts +226 -0
  11. package/cli/bridge-flow-runner.ts +2830 -0
  12. package/cli/browser-evals.ts +96 -0
  13. package/cli/commands/agent-wrapper.ts +986 -0
  14. package/cli/commands/agent.ts +423 -0
  15. package/cli/commands/app-fonts.ts +98 -0
  16. package/cli/commands/assert.ts +541 -0
  17. package/cli/commands/auth.ts +59 -0
  18. package/cli/commands/camera.ts +266 -0
  19. package/cli/commands/cleanup.ts +169 -0
  20. package/cli/commands/compat.ts +87 -0
  21. package/cli/commands/config.ts +32 -0
  22. package/cli/commands/control.ts +2142 -0
  23. package/cli/commands/cpu-profile.ts +269 -0
  24. package/cli/commands/daemon-mac-app.ts +169 -0
  25. package/cli/commands/daemon.ts +874 -0
  26. package/cli/commands/debug.ts +719 -0
  27. package/cli/commands/desktop.ts +39 -0
  28. package/cli/commands/detect.ts +197 -0
  29. package/cli/commands/detox.ts +385 -0
  30. package/cli/commands/device.ts +133 -0
  31. package/cli/commands/diagnose.ts +589 -0
  32. package/cli/commands/electron.ts +95 -0
  33. package/cli/commands/film.ts +379 -0
  34. package/cli/commands/flow.ts +1124 -0
  35. package/cli/commands/inspect/actions.ts +622 -0
  36. package/cli/commands/inspect/core.ts +2405 -0
  37. package/cli/commands/inspect/count.ts +17 -0
  38. package/cli/commands/inspect/describe.ts +192 -0
  39. package/cli/commands/inspect/env.ts +23 -0
  40. package/cli/commands/inspect/find.ts +171 -0
  41. package/cli/commands/inspect/get-layout.ts +39 -0
  42. package/cli/commands/inspect/keyboard.ts +52 -0
  43. package/cli/commands/inspect/list.ts +58 -0
  44. package/cli/commands/inspect/memory.ts +215 -0
  45. package/cli/commands/inspect/redaction.ts +39 -0
  46. package/cli/commands/inspect/resolve-target.ts +82 -0
  47. package/cli/commands/inspect/screens.ts +78 -0
  48. package/cli/commands/inspect/settle.ts +22 -0
  49. package/cli/commands/inspect/settling.ts +158 -0
  50. package/cli/commands/inspect/shared.ts +353 -0
  51. package/cli/commands/inspect/sleep.ts +14 -0
  52. package/cli/commands/inspect/tree.ts +32 -0
  53. package/cli/commands/inspect/url.ts +17 -0
  54. package/cli/commands/inspect/wait-event.ts +210 -0
  55. package/cli/commands/inspect/wait-idle.ts +24 -0
  56. package/cli/commands/inspect/wait-ready.ts +74 -0
  57. package/cli/commands/inspect/wait-selector.ts +54 -0
  58. package/cli/commands/inspect/wait.ts +31 -0
  59. package/cli/commands/inspect.ts +4519 -0
  60. package/cli/commands/install-desktop.ts +351 -0
  61. package/cli/commands/login.ts +331 -0
  62. package/cli/commands/logout.ts +31 -0
  63. package/cli/commands/maestro-generate.ts +361 -0
  64. package/cli/commands/maestro.ts +453 -0
  65. package/cli/commands/mode.ts +57 -0
  66. package/cli/commands/no-bridge-hint.ts +80 -0
  67. package/cli/commands/perf.ts +66 -0
  68. package/cli/commands/permissions.ts +203 -0
  69. package/cli/commands/profile.ts +108 -0
  70. package/cli/commands/react.ts +353 -0
  71. package/cli/commands/record.ts +1434 -0
  72. package/cli/commands/report-issue.ts +305 -0
  73. package/cli/commands/reset.ts +85 -0
  74. package/cli/commands/runtime.ts +351 -0
  75. package/cli/commands/screenshot-command.ts +106 -0
  76. package/cli/commands/screenshot-layers.ts +143 -0
  77. package/cli/commands/screenshot-mode.ts +37 -0
  78. package/cli/commands/screenshot.ts +488 -0
  79. package/cli/commands/screenshots-capture.ts +607 -0
  80. package/cli/commands/screenshots.ts +127 -0
  81. package/cli/commands/serve.ts +168 -0
  82. package/cli/commands/setup.ts +545 -0
  83. package/cli/commands/shell-boolean-mode.ts +81 -0
  84. package/cli/commands/skills.ts +467 -0
  85. package/cli/commands/slides.ts +361 -0
  86. package/cli/commands/state.ts +87 -0
  87. package/cli/commands/storage.ts +58 -0
  88. package/cli/commands/telemetry.ts +54 -0
  89. package/cli/commands/three-mode.ts +763 -0
  90. package/cli/commands/timeline.ts +122 -0
  91. package/cli/commands/upgrade.ts +208 -0
  92. package/cli/commands/upload.ts +1225 -0
  93. package/cli/commands/version.ts +54 -0
  94. package/cli/commands/what-happened.ts +327 -0
  95. package/cli/current-sim.ts +204 -0
  96. package/cli/desktop-companion.ts +300 -0
  97. package/cli/drivers/electron.ts +70 -0
  98. package/cli/drivers/index.ts +20 -0
  99. package/cli/drivers/playwright-provisioning.ts +180 -0
  100. package/cli/drivers/playwright.ts +698 -0
  101. package/cli/drivers/registry.ts +65 -0
  102. package/cli/drivers/types.ts +102 -0
  103. package/cli/flow-file.ts +142 -0
  104. package/cli/flow-live-status.ts +120 -0
  105. package/cli/flow-session.ts +187 -0
  106. package/cli/help.ts +80 -0
  107. package/cli/hidden-runtime-alias.ts +19 -0
  108. package/cli/hints.ts +216 -0
  109. package/cli/inspect-notice-state.ts +114 -0
  110. package/cli/maestro-js.ts +334 -0
  111. package/cli/open-url.ts +8 -0
  112. package/cli/parent-pid.ts +204 -0
  113. package/cli/parse-args.ts +211 -0
  114. package/cli/prompt.ts +51 -0
  115. package/cli/recording-access.ts +107 -0
  116. package/cli/registry.ts +1 -0
  117. package/cli/resolve-assets.ts +63 -0
  118. package/cli/run-registry.ts +226 -0
  119. package/cli/runtime-notes.ts +66 -0
  120. package/cli/runtime-summary.ts +25 -0
  121. package/cli/setup-repository.ts +187 -0
  122. package/cli/telemetry.ts +187 -0
  123. package/cli/ws-bridge.ts +798 -0
  124. package/dist-cli/bin.js +5 -5
  125. package/dist-cli/chunks/{agent-XZ2KTPCU.js → agent-CBU2WDKV.js} +2 -2
  126. package/dist-cli/chunks/{agent-wrapper-JJYYW2WH.js → agent-wrapper-UNB4R27L.js} +2 -2
  127. package/dist-cli/chunks/{app-fonts-IXRNQG6B.js → app-fonts-YMLRF3JD.js} +2 -2
  128. package/dist-cli/chunks/{assert-54T5SK5F.js → assert-5N6HUCL5.js} +2 -2
  129. package/dist-cli/chunks/{auth-FI5UDI45.js → auth-BHDR3A6G.js} +2 -2
  130. package/dist-cli/chunks/{beta-JV6UKADW.js → beta-LWUVCPYK.js} +2 -2
  131. package/dist-cli/chunks/camera-CNO6B2JZ.js +33 -0
  132. package/dist-cli/chunks/{chunk-ZMJD5GEC.js → chunk-25VCR44B.js} +1 -1
  133. package/dist-cli/chunks/{chunk-WUSWBCWA.js → chunk-26CSIR76.js} +8 -9
  134. package/dist-cli/chunks/{chunk-WINYQ44O.js → chunk-26WMWUH4.js} +1 -1
  135. package/dist-cli/chunks/{chunk-BTWORNNG.js → chunk-2JZ53D4A.js} +1 -1
  136. package/dist-cli/chunks/{chunk-DCEMHR2Y.js → chunk-2POODCTW.js} +2 -2
  137. package/dist-cli/chunks/{chunk-5TEF3ET3.js → chunk-4LTBK3ZN.js} +2 -2
  138. package/dist-cli/chunks/{chunk-NMF2ZMZQ.js → chunk-54MIRTFE.js} +4 -4
  139. package/dist-cli/chunks/{chunk-WEXDAC74.js → chunk-56H6EVO4.js} +2 -2
  140. package/dist-cli/chunks/{chunk-F5ZRSS3C.js → chunk-657SQG4D.js} +1 -1
  141. package/dist-cli/chunks/{chunk-IJ5CAZZC.js → chunk-6ZMRJPKI.js} +1 -1
  142. package/dist-cli/chunks/{chunk-W6K4EFPH.js → chunk-AOGGOC4V.js} +2 -2
  143. package/dist-cli/chunks/chunk-BPCDO7ST.js +15 -0
  144. package/dist-cli/chunks/{chunk-D4FFVGI5.js → chunk-C5O5CTXJ.js} +1 -1
  145. package/dist-cli/chunks/{chunk-RTN5C5RL.js → chunk-CMM64PPR.js} +1 -1
  146. package/dist-cli/chunks/{chunk-BBULZ7CG.js → chunk-D3M36D7O.js} +62 -87
  147. package/dist-cli/chunks/{chunk-5DHC6KHQ.js → chunk-DNCNFZ7V.js} +1 -1
  148. package/dist-cli/chunks/{chunk-YIFT42WN.js → chunk-FNTTIR2P.js} +2 -2
  149. package/dist-cli/chunks/chunk-H362IX2I.js +4 -0
  150. package/dist-cli/chunks/{chunk-IJO63TDP.js → chunk-J6HMTUZH.js} +2 -2
  151. package/dist-cli/chunks/{chunk-RSZWCKNT.js → chunk-JZ6VTZ5B.js} +3 -3
  152. package/dist-cli/chunks/{chunk-MJRLLB4R.js → chunk-KQSJVNFE.js} +4 -4
  153. package/dist-cli/chunks/chunk-L4JZKVCC.js +6 -0
  154. package/dist-cli/chunks/{chunk-VFCMSYZK.js → chunk-LP2BTEJ6.js} +2 -2
  155. package/dist-cli/chunks/{chunk-2YR5BGA5.js → chunk-LT6UC7I3.js} +2 -2
  156. package/dist-cli/chunks/{chunk-OVFJFXUD.js → chunk-MCKQH4AM.js} +2 -2
  157. package/dist-cli/chunks/{chunk-TZFFR3SD.js → chunk-MF7WUHQ3.js} +2 -2
  158. package/dist-cli/chunks/{chunk-46EUUFJ5.js → chunk-MSSY4EEZ.js} +1 -1
  159. package/dist-cli/chunks/{chunk-WMIIKMGK.js → chunk-N5ZCYP5F.js} +2 -2
  160. package/dist-cli/chunks/{chunk-3NV2NCNX.js → chunk-NCKAD3V7.js} +2 -2
  161. package/dist-cli/chunks/{chunk-VNQEB4L7.js → chunk-O2KRHVTU.js} +2 -2
  162. package/dist-cli/chunks/{chunk-OZSSI4WN.js → chunk-OF2HTH25.js} +2 -2
  163. package/dist-cli/chunks/{chunk-GGRX24GF.js → chunk-OXS2IWO2.js} +2 -2
  164. package/dist-cli/chunks/{chunk-WWZIXIRD.js → chunk-PVL7XSPN.js} +1 -1
  165. package/dist-cli/chunks/{chunk-DZS6WPUI.js → chunk-PVPAP3TV.js} +1 -1
  166. package/dist-cli/chunks/{chunk-5YJCOWCH.js → chunk-PXNAZYGV.js} +1 -1
  167. package/dist-cli/chunks/chunk-QR3HTFRB.js +5 -0
  168. package/dist-cli/chunks/{chunk-5TPRP5QT.js → chunk-QR7MWAWE.js} +1 -1
  169. package/dist-cli/chunks/chunk-RJIEZ2NY.js +4 -0
  170. package/dist-cli/chunks/{chunk-UC6U3MML.js → chunk-RVM4EZ4E.js} +2 -2
  171. package/dist-cli/chunks/{chunk-2D2UPBBR.js → chunk-SZKSFMWS.js} +1 -1
  172. package/dist-cli/chunks/{chunk-7GN3LVWB.js → chunk-TEL7G234.js} +2 -2
  173. package/dist-cli/chunks/{chunk-GASE6UBA.js → chunk-U2HNIHBY.js} +1 -1
  174. package/dist-cli/chunks/chunk-UROXJVY3.js +27 -0
  175. package/dist-cli/chunks/{chunk-HI5TFJWN.js → chunk-WM32MGTJ.js} +2 -2
  176. package/dist-cli/chunks/{chunk-VZXWHRUZ.js → chunk-WMZ7NJAO.js} +89 -133
  177. package/dist-cli/chunks/{chunk-XEVZYVIW.js → chunk-WUXCH6WN.js} +10 -9
  178. package/dist-cli/chunks/chunk-XOXGC3EH.js +9 -0
  179. package/dist-cli/chunks/chunk-XSSHENNY.js +4 -0
  180. package/dist-cli/chunks/{chunk-OHAZNXLK.js → chunk-XZ6O67AR.js} +1 -1
  181. package/dist-cli/chunks/{chunk-QKDWYITG.js → chunk-Y2MWQKOS.js} +3 -3
  182. package/dist-cli/chunks/{chunk-YDGQTMQL.js → chunk-YY24QI25.js} +1 -1
  183. package/dist-cli/chunks/{chunk-WF3T4SVI.js → chunk-ZWX6DDIS.js} +2 -2
  184. package/dist-cli/chunks/{cleanup-P27PA6JI.js → cleanup-F3NUJ3SL.js} +2 -2
  185. package/dist-cli/chunks/cli-version-XIW6O3FG.js +4 -0
  186. package/dist-cli/chunks/{compat-ZD65FED3.js → compat-AX2SEPTH.js} +2 -2
  187. package/dist-cli/chunks/{config-XMJRNM2A.js → config-4QQO5JVU.js} +2 -2
  188. package/dist-cli/chunks/{control-KMIQT3QP.js → control-OCKKSOWA.js} +2 -2
  189. package/dist-cli/chunks/daemon-N5VLMYKQ.js +4 -0
  190. package/dist-cli/chunks/{debug-PT4HOP7N.js → debug-T6MWVEVX.js} +5 -5
  191. package/dist-cli/chunks/{desktop-S3FG72AK.js → desktop-NCW7R7CB.js} +3 -3
  192. package/dist-cli/chunks/{detox-B3D4IFCN.js → detox-G6GITO2X.js} +2 -2
  193. package/dist-cli/chunks/{device-XBNDSB2R.js → device-7BTEJCTH.js} +2 -2
  194. package/dist-cli/chunks/{diagnose-HMQXJE5N.js → diagnose-SC5LACE3.js} +2 -2
  195. package/dist-cli/chunks/{disk-cleanup-BLCZ5BSZ.js → disk-cleanup-KK56QQZA.js} +2 -2
  196. package/dist-cli/chunks/drivers-NPGVBWMG.js +4 -0
  197. package/dist-cli/chunks/{film-BJGTBYZB.js → film-WGYEHGIA.js} +3 -3
  198. package/dist-cli/chunks/flow-KQBIBM3N.js +4 -0
  199. package/dist-cli/chunks/help-G7CAKI65.js +4 -0
  200. package/dist-cli/chunks/{hidden-runtime-alias-ANOYADHM.js → hidden-runtime-alias-CWTZWH3L.js} +2 -2
  201. package/dist-cli/chunks/home-paths-EBT4XHAS.js +4 -0
  202. package/dist-cli/chunks/inspect-CCPZXVDU.js +4 -0
  203. package/dist-cli/chunks/install-desktop-NZ3VGTQZ.js +4 -0
  204. package/dist-cli/chunks/{login-FJ737MWG.js → login-GSYOTGVQ.js} +4 -4
  205. package/dist-cli/chunks/{logout-ZCNMMHMY.js → logout-JPRIR7YK.js} +2 -2
  206. package/dist-cli/chunks/{maestro-SZTNKLDF.js → maestro-LXKDNO5M.js} +3 -3
  207. package/dist-cli/chunks/{maestro-generate-DCFAIZ4H.js → maestro-generate-5ZIKOU53.js} +3 -3
  208. package/dist-cli/chunks/{mode-GRMQCRXR.js → mode-N3QHXCES.js} +2 -2
  209. package/dist-cli/chunks/{optional-demo-registry-W36EWFFB.js → optional-demo-registry-XDH6X24N.js} +2 -2
  210. package/dist-cli/chunks/{perf-QYBAAUZG.js → perf-VOPL26FM.js} +2 -2
  211. package/dist-cli/chunks/{permissions-3QCQ6VF4.js → permissions-CZFKM4UD.js} +2 -2
  212. package/dist-cli/chunks/{record-QPPC2S4E.js → record-FODSOGMA.js} +3 -3
  213. package/dist-cli/chunks/{report-issue-7NMFP4HK.js → report-issue-FBPCZKOV.js} +2 -2
  214. package/dist-cli/chunks/reset-3H35GFO3.js +4 -0
  215. package/dist-cli/chunks/runtime-4OVFRXV5.js +4 -0
  216. package/dist-cli/chunks/{screenshot-command-67AECJFB.js → screenshot-command-7S3FYVO7.js} +7 -7
  217. package/dist-cli/chunks/{screenshot-layers-ASWBYPJL.js → screenshot-layers-CDYHPNC3.js} +3 -3
  218. package/dist-cli/chunks/{screenshots-capture-PXA3HFQK.js → screenshots-capture-EBIIY2YU.js} +2 -2
  219. package/dist-cli/chunks/serve-NELNSCZP.js +44 -0
  220. package/dist-cli/chunks/{setup-7DWPMRSB.js → setup-DF5ZDDIV.js} +2 -2
  221. package/dist-cli/chunks/{skills-S3Y22TUA.js → skills-E2QZF6WZ.js} +2 -2
  222. package/dist-cli/chunks/state-MBZDKZ7U.js +14 -0
  223. package/dist-cli/chunks/{storage-XUIMJWAJ.js → storage-J5BMNVXM.js} +6 -6
  224. package/dist-cli/chunks/store-U3DXC7HH.js +4 -0
  225. package/dist-cli/chunks/telemetry-XIPJVT5E.js +4 -0
  226. package/dist-cli/chunks/{timeline-TMPLQPSP.js → timeline-MC6N5BHY.js} +2 -2
  227. package/dist-cli/chunks/{upgrade-7HDSIM7K.js → upgrade-7UTU53DH.js} +2 -2
  228. package/dist-cli/chunks/upload-2M2KOTYI.js +4 -0
  229. package/dist-cli/chunks/version-VNACNYQK.js +6 -0
  230. package/dist-cli/chunks/{web-DG3WBYD3.js → web-MGJ2TUKR.js} +2 -2
  231. package/dist-cli/chunks/{what-happened-XFVUTZR7.js → what-happened-7DLKH3OD.js} +3 -3
  232. package/dist-lib/agent-daemon-client.cjs +1 -1
  233. package/dist-lib/agent-events.cjs +1 -1
  234. package/dist-lib/agent-identity.cjs +1 -1
  235. package/dist-lib/agent-sessions.cjs +1 -1
  236. package/dist-lib/attached-projects.cjs +1 -1
  237. package/dist-lib/auth/shared-session.cjs +1 -1
  238. package/dist-lib/backend-origin.cjs +1 -1
  239. package/dist-lib/beta.cjs +1 -1
  240. package/dist-lib/beta.mjs +1 -1
  241. package/dist-lib/bridge-constants.cjs +1 -1
  242. package/dist-lib/bridge-contract.cjs +20 -0
  243. package/dist-lib/cli-constants.cjs +1 -1
  244. package/dist-lib/config.cjs +1 -1
  245. package/dist-lib/detox/index.cjs +1 -1
  246. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  247. package/dist-lib/home-paths.cjs +67 -28
  248. package/dist-lib/host/bridge-host.cjs +140 -12
  249. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  250. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  251. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  252. package/dist-lib/host/websocket-proxy.cjs +1 -1
  253. package/dist-lib/index.cjs +2815 -40
  254. package/dist-lib/jump-to-source-babel.cjs +1 -1
  255. package/dist-lib/menu.cjs +1 -1
  256. package/dist-lib/menu.mjs +1 -1
  257. package/dist-lib/metro.cjs +1 -1
  258. package/dist-lib/profiles.cjs +1 -1
  259. package/dist-lib/public-brand.cjs +1 -1
  260. package/dist-lib/render-mode.cjs +1 -1
  261. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  262. package/dist-lib/sdk.cjs +2549 -2061
  263. package/dist-lib/sdk.mjs +2543 -2061
  264. package/dist-lib/skills.cjs +480 -280
  265. package/dist-lib/vite.cjs +1 -1
  266. package/package.json +8 -2
  267. package/src/bridge-constants.ts +3 -4
  268. package/src/bridge-contract.ts +251 -0
  269. package/src/connect.ts +83 -0
  270. package/src/disk-cleanup.ts +30 -0
  271. package/src/home-paths.ts +81 -38
  272. package/src/host/bridge-host.ts +134 -6
  273. package/src/index.ts +27 -1
  274. package/src/sdk.ts +8 -0
  275. package/src/sim-client.ts +660 -0
  276. package/dist-cli/chunks/camera-VL73YIKP.js +0 -22
  277. package/dist-cli/chunks/chunk-4NPPOV2N.js +0 -5
  278. package/dist-cli/chunks/chunk-FSUYIVJ6.js +0 -9
  279. package/dist-cli/chunks/chunk-G2WW6L2C.js +0 -23
  280. package/dist-cli/chunks/chunk-KTHV3RUS.js +0 -26
  281. package/dist-cli/chunks/chunk-LF2ZVT7O.js +0 -6
  282. package/dist-cli/chunks/chunk-NFK7T35W.js +0 -4
  283. package/dist-cli/chunks/chunk-TIVZIMMW.js +0 -4
  284. package/dist-cli/chunks/cli-version-WWLPBDQ7.js +0 -4
  285. package/dist-cli/chunks/daemon-G2ME7NLB.js +0 -4
  286. package/dist-cli/chunks/drivers-LDECZGP2.js +0 -4
  287. package/dist-cli/chunks/flow-UEQNVTU7.js +0 -4
  288. package/dist-cli/chunks/help-T5FYSVGB.js +0 -4
  289. package/dist-cli/chunks/home-paths-GT3LFNOR.js +0 -4
  290. package/dist-cli/chunks/inspect-ZA6XF5LD.js +0 -4
  291. package/dist-cli/chunks/install-desktop-TIMUDHPL.js +0 -4
  292. package/dist-cli/chunks/runtime-XOAXMSTU.js +0 -4
  293. package/dist-cli/chunks/serve-BI2NBAXG.js +0 -44
  294. package/dist-cli/chunks/store-JTHEJLAZ.js +0 -4
  295. package/dist-cli/chunks/telemetry-ZYJGD2DB.js +0 -4
  296. package/dist-cli/chunks/upload-GMSZPWM6.js +0 -4
  297. package/dist-cli/chunks/version-HOCHZ37L.js +0 -6
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.315 | (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 ne,b as se,f as ie}from"./chunk-BBULZ7CG.js";import"./chunk-OZSSI4WN.js";import{a as v}from"./chunk-D4FFVGI5.js";import"./chunk-VZXWHRUZ.js";import"./chunk-OHAZNXLK.js";import{a as te}from"./chunk-GGRX24GF.js";import{a as ee}from"./chunk-BTWORNNG.js";import"./chunk-OVFJFXUD.js";import{a as re,b as oe}from"./chunk-WEXDAC74.js";import"./chunk-NMF2ZMZQ.js";import"./chunk-7GN3LVWB.js";import"./chunk-GASE6UBA.js";import"./chunk-MJRLLB4R.js";import{r as K,s as X}from"./chunk-XEVZYVIW.js";import"./chunk-WUSWBCWA.js";import"./chunk-5DHC6KHQ.js";import"./chunk-DCEMHR2Y.js";import"./chunk-WF3T4SVI.js";import"./chunk-YIFT42WN.js";import"./chunk-DZS6WPUI.js";import"./chunk-G2WW6L2C.js";import"./chunk-YDGQTMQL.js";import{h as A,i as J,j as B,k as Z,l as Q,m as M,n as $}from"./chunk-KTHV3RUS.js";import"./chunk-NFK7T35W.js";import"./chunk-IJO63TDP.js";import"./chunk-HI5TFJWN.js";import"./chunk-RTN5C5RL.js";import"./chunk-VFCMSYZK.js";import"./chunk-VNQEB4L7.js";import"./chunk-UC6U3MML.js";import{b as F,e as P,f as j,g as I,h as L,i as U,j as R}from"./chunk-2YR5BGA5.js";import"./chunk-4NPPOV2N.js";import"./chunk-IJ5CAZZC.js";import"./chunk-ZMJD5GEC.js";import"./chunk-FSUYIVJ6.js";import"./chunk-2D2UPBBR.js";import"./chunk-WINYQ44O.js";import{mkdirSync as ce,writeFileSync as ae}from"fs";import{dirname as ue,resolve as de}from"path";async function pe(e,t){let r=Le(e);(r.includes("--help")||r.includes("-h"))&&(console.log(`
4
+ import{a as ne,b as se,f as ie}from"./chunk-D3M36D7O.js";import{a as v}from"./chunk-C5O5CTXJ.js";import"./chunk-OF2HTH25.js";import"./chunk-WMZ7NJAO.js";import"./chunk-XZ6O67AR.js";import{a as ee}from"./chunk-2JZ53D4A.js";import{a as te}from"./chunk-OXS2IWO2.js";import"./chunk-54MIRTFE.js";import"./chunk-TEL7G234.js";import"./chunk-U2HNIHBY.js";import"./chunk-XSSHENNY.js";import"./chunk-26CSIR76.js";import"./chunk-DNCNFZ7V.js";import"./chunk-QR3HTFRB.js";import"./chunk-MCKQH4AM.js";import{a as re,b as oe}from"./chunk-56H6EVO4.js";import"./chunk-2POODCTW.js";import"./chunk-ZWX6DDIS.js";import"./chunk-YY24QI25.js";import"./chunk-FNTTIR2P.js";import"./chunk-KQSJVNFE.js";import{r as Z,s as Q}from"./chunk-WUXCH6WN.js";import"./chunk-PVPAP3TV.js";import"./chunk-RJIEZ2NY.js";import"./chunk-J6HMTUZH.js";import"./chunk-WM32MGTJ.js";import"./chunk-CMM64PPR.js";import"./chunk-LP2BTEJ6.js";import"./chunk-O2KRHVTU.js";import"./chunk-RVM4EZ4E.js";import{b as F,e as P,f as j,g as I,h as L,i as U,j as R}from"./chunk-LT6UC7I3.js";import{q as A,r as K,s as B,t as X,u as J,v as M,w as $}from"./chunk-UROXJVY3.js";import"./chunk-6ZMRJPKI.js";import"./chunk-25VCR44B.js";import"./chunk-XOXGC3EH.js";import"./chunk-SZKSFMWS.js";import"./chunk-26WMWUH4.js";import{mkdirSync as ce,writeFileSync as ae}from"fs";import{dirname as ue,resolve as de}from"path";async function pe(e,t){let r=Le(e);(r.includes("--help")||r.includes("-h"))&&(console.log(`
5
5
  rnxsim screenshot \u2014 capture the canvas as a PNG
6
6
 
7
7
  usage:
@@ -31,15 +31,15 @@ examples:
31
31
  rnxsim screenshot --with-frame --output framed.png
32
32
  rnxsim screenshot --area 0,200,393,400 --output hero.png
33
33
  rnxsim screenshot --id loginButton --output button.png
34
- `),process.exit(0));let i=Ue(r);if(i.length>0){for(let{flag:h,suggestion:w}of i)console.error(w?` unknown flag: ${h} (did you mean ${w}?)`:` unknown flag: ${h}`);console.error(" run `rnxsim screenshot --help` for the list of supported flags"),process.exit(1)}let o=r.includes("--gallery"),s=r.includes("--themes"),n=r.includes("--allow-loading"),a=ze(r),l=_e(r);if(o||s)return a&&(console.error(" --with-frame is not supported with --gallery / --themes"),process.exit(1)),le(r,t);a&&r.some(h=>h==="--area"||h==="--id"||h==="--text")&&(console.error(" --with-frame only supports full-screen capture for now"),console.error(" remove --area / --id / --text, or capture raw and compose later"),process.exit(1));let c=A(r,{port:t.port,stripBooleanFlags:["--with-frame","--no-frame","--no-shell","--shell-only","--allow-loading"],stripValueFlags:["--output","--area","--id","--text"]}),u=he(r),d=await Be(r);if(await Ae(c.wsPort)){try{await Oe(c,u,d,a,l,n)}catch(h){console.error(` screenshot failed: ${h instanceof Error?h.message:String(h)}`),process.exit(1)}return}a&&(console.error(" --with-frame requires a running rnx bridge"),console.error(" open the app in a live sim first, then rerun the command"),process.exit(1)),d&&(console.error(" --area / --id / --text require a running rnx bridge"),console.error(" start one with `rnxsim serve`, `rnxsim desktop`, or your project dev server"),process.exit(1)),await le(r,t)}async function Ae(e){let t=J(e,{commandTimeoutMs:1e3});try{return await t.listSims(),!0}catch{return!1}finally{t.close()}}async function Be(e){let t=e.find((o,s)=>e[s-1]==="--area");if(t){let o=t.split(",").map(c=>Number(c.trim()));if(o.length!==4||o.some(c=>!Number.isFinite(c)))throw new Error(`--area expects x,y,w,h (got "${t}")`);let[s,n,a,l]=o;return{x:s,y:n,w:a,h:l}}let r=e.find((o,s)=>e[s-1]==="--id"),i=e.find((o,s)=>e[s-1]==="--text");return r||i?{__matcher:{id:r,text:i}}:null}async function Oe(e,t,r,i,o,s){let n=B({...e,commandTimeoutMs:45e3});try{if((await Z(n)).hidden&&process.stderr.write(` \u26A0 screenshot will capture the LAST PAINTED canvas \u2014 likely stale.
34
+ `),process.exit(0));let i=Ue(r);if(i.length>0){for(let{flag:h,suggestion:w}of i)console.error(w?` unknown flag: ${h} (did you mean ${w}?)`:` unknown flag: ${h}`);console.error(" run `rnxsim screenshot --help` for the list of supported flags"),process.exit(1)}let o=r.includes("--gallery"),s=r.includes("--themes"),n=r.includes("--allow-loading"),a=ze(r),l=_e(r);if(o||s)return a&&(console.error(" --with-frame is not supported with --gallery / --themes"),process.exit(1)),le(r,t);a&&r.some(h=>h==="--area"||h==="--id"||h==="--text")&&(console.error(" --with-frame only supports full-screen capture for now"),console.error(" remove --area / --id / --text, or capture raw and compose later"),process.exit(1));let c=A(r,{port:t.port,stripBooleanFlags:["--with-frame","--no-frame","--no-shell","--shell-only","--allow-loading"],stripValueFlags:["--output","--area","--id","--text"]}),u=he(r),d=await Be(r);if(await Ae(c.wsPort)){try{await Oe(c,u,d,a,l,n)}catch(h){console.error(` screenshot failed: ${h instanceof Error?h.message:String(h)}`),process.exit(1)}return}a&&(console.error(" --with-frame requires a running rnx bridge"),console.error(" open the app in a live sim first, then rerun the command"),process.exit(1)),d&&(console.error(" --area / --id / --text require a running rnx bridge"),console.error(" start one with `rnxsim serve`, `rnxsim desktop`, or your project dev server"),process.exit(1)),await le(r,t)}async function Ae(e){let t=K(e,{commandTimeoutMs:1e3});try{return await t.listSims(),!0}catch{return!1}finally{t.close()}}async function Be(e){let t=e.find((o,s)=>e[s-1]==="--area");if(t){let o=t.split(",").map(c=>Number(c.trim()));if(o.length!==4||o.some(c=>!Number.isFinite(c)))throw new Error(`--area expects x,y,w,h (got "${t}")`);let[s,n,a,l]=o;return{x:s,y:n,w:a,h:l}}let r=e.find((o,s)=>e[s-1]==="--id"),i=e.find((o,s)=>e[s-1]==="--text");return r||i?{__matcher:{id:r,text:i}}:null}async function Oe(e,t,r,i,o,s){let n=B({...e,commandTimeoutMs:45e3});try{if((await X(n)).hidden&&process.stderr.write(` \u26A0 screenshot will capture the LAST PAINTED canvas \u2014 likely stale.
35
35
  navigation/\`shell\` commands sent before this screenshot may not
36
36
  have repainted yet. focus the tab manually or \`rnxsim --sim <id>\`
37
37
  to target a visible sim before capturing.
38
38
 
39
- `),!s){let f=Number(process.env.CONTRAST_SCREENSHOT_READY_MAX_MS)||9e4,x=await X(n,f);if(!x.ready&&x.externalError)process.stderr.write(` \u26A0 capturing an ERROR screen. the app failed to load: ${x.externalError}
39
+ `),!s){let f=Number(process.env.CONTRAST_SCREENSHOT_READY_MAX_MS)||9e4,x=await Q(n,f);if(!x.ready&&x.externalError)process.stderr.write(` \u26A0 capturing an ERROR screen. the app failed to load: ${x.externalError}
40
40
  this is failure evidence, not app content. never use it as a baseline.
41
41
 
42
- `);else if(!x.ready)throw new Error(`app not ready to capture after ${Math.round(x.elapsedMs/1e3)}s (${K(x)}); refusing to capture the boot/loading card. retry once the app paints.`)}let l=r,c=r?.__matcher;if(c){let f=await n.send({type:"evaluate",code:ee(c)});if(!f)throw new Error(c.id?`no node with id "${c.id}"`:`no node matching text "${c.text}"`);l=f}let u=l?{x:l.x,y:l.y,w:l.w,h:l.h}:void 0,d={type:"screenshot"};o&&(d.layers=o),u&&(d.crop=u);let m=await n.send(d);if(typeof m!="string"||m.length<="data:image/png;base64,".length)throw new Error("screenshot capture returned no image data \u2014 the sim is connected but not painting; check `rnxsim get errors`");let w=m.replace(/^data:image\/png;base64,/,"");u&&console.log(` area: x=${u.x} y=${u.y} w=${u.w} h=${u.h}`),o&&console.log(` layers: ${o}`);let p=de(process.cwd(),t||"/tmp/sootsim-inspect.png");ce(ue(p),{recursive:!0});let y=Buffer.from(w,"base64");if(i){let f=await Te(n);if(!f)throw new Error("could not read current device model from the target sim");let x=await ne(y,f);ae(p,x),console.log(` frame: ${f}`)}else ae(p,y);console.log(` saved: ${p}`)}finally{n.close()}}async function Te(e){let t=await M(e,"SootSim.bridges.settings.get")??{deviceModel:null},r=typeof t.deviceModel=="string"?t.deviceModel:null;return!r||!(r in F)?null:r}function ze(e){let t=!1;for(let r of e)r==="--with-frame"&&(t=!0),r==="--no-frame"&&(t=!1);return t}function _e(e){if(e.includes("--shell-only"))return"shell";if(e.includes("--no-shell"))return"tenant"}var je=new Set(["--help","-h","--verbose","-v","--with-frame","--no-frame","--no-shell","--shell-only","--allow-loading","--gallery","--themes"]),me=new Set(["--output","--area","--id","--text","--url","--port","--timeout","--sim"]),Ie={"--rect":"--area","--crop":"--area","--region":"--area","--bounds":"--area","--box":"--area","--xywh":"--area","--out":"--output","-o":"--output","--file":"--output","--path":"--output","--testid":"--id","--test-id":"--id","--test_id":"--id"};function Le(e){let t=[],r={"-o":"--output","--out":"--output","--file":"--output","--path":"--output","--testid":"--id","--test-id":"--id","--test_id":"--id","--rect":"--area","--crop":"--area","--region":"--area","--bounds":"--area","--box":"--area","--xywh":"--area"};for(let i of e){let o=r[i];t.push(o??i)}return t}function Ue(e){let t=[];for(let r=0;r<e.length;r++){let i=e[r];if(i.startsWith("-")){if(me.has(i)){r++;continue}je.has(i)||t.push({flag:i,suggestion:Ie[i]})}}return t}function he(e){let t=e.find((r,i)=>e[i-1]==="--output");if(t)return t;for(let r=0;r<e.length;r++){let i=e[r];if(i.startsWith("-")){me.has(i)&&r++;continue}return i}}async function le(e,t){let r=he(e)||"sootsim-screenshot.png",i=e.includes("--gallery"),o=e.find((a,l)=>e[l-1]==="--url")||`http://localhost:${t.port||5173}`,{chromium:s}=await import("playwright"),n=await v(a=>s.launch(a),{headless:!0});try{if(i)console.log(" capturing gallery..."),console.log(" (gallery mode not yet implemented)");else{let a=await n.newPage({viewport:{width:500,height:900}});await a.goto(o,{waitUntil:"networkidle"}),await a.waitForTimeout(2e3);let l=de(process.cwd(),r);ce(ue(l),{recursive:!0}),await a.screenshot({path:l}),console.log(` saved: ${l}`),await a.close()}}catch(a){console.error(` screenshot failed: ${a.message}`),process.exitCode=1}finally{await n.close()}}import{mkdirSync as V,readFileSync as et,writeFileSync as Me}from"fs";import{tmpdir as tr}from"os";import z from"path";import{mkdirSync as ge,readFileSync as He,writeFileSync as we}from"fs";import H from"path";function fe(e){return e.replace(/\\/g,"/").replace(/\.png$/i,"").trim().split("/").filter(Boolean).join("--").replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"slide"}function Y(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}function Ye(e){let t=e.trim();return/^#[0-9a-f]{3}$/i.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function O(e,t){let r=Ye(e),i=Math.max(0,Math.min(1,t)),o=r.match(/^#([0-9a-f]{6})$/i);if(o){let s=o[1],n=Number.parseInt(s.slice(0,2),16),a=Number.parseInt(s.slice(2,4),16),l=Number.parseInt(s.slice(4,6),16);return`rgba(${n}, ${a}, ${l}, ${i})`}return r.startsWith("rgb(")?r.replace(/^rgb\((.+)\)$/i,`rgba($1, ${i})`):r}function Ge(e){if(e.type==="solid")return e.color||"#000000";let t=e.direction??180,r=e.stops?.map(i=>`${i.color} ${i.offset}%`).join(", ")||"#000000 0%, #111111 100%";return`linear-gradient(${t}deg, ${r})`}function We(e){let t=e.glow;return t?`radial-gradient(circle at 50% 24%, ${O(t,.46)} 0%, ${O(t,.2)} 24%, rgba(0,0,0,0) 62%)`:"none"}function G(e){switch(e){case"tilted-left":return"perspective(2400px) rotateY(10deg) rotateZ(-2deg)";case"tilted-right":return"perspective(2400px) rotateY(-10deg) rotateZ(2deg)";case"cut-bottom":return"translateY(10%) scale(1.08)";case"cut-top":return"translateY(-16%) scale(1.08)";case"straight":default:return"none"}}function ye(...e){let t=e.map(r=>r.trim()).filter(r=>r.length>0&&r!=="none");return t.length>0?t.join(" "):"none"}function W(e){let t=O(e.color,e.opacity),r=O(e.color,e.opacity*.52);return`drop-shadow(0 34px ${e.spread}px ${r}) drop-shadow(0 0 ${e.blur}px ${t})`}function q(e,t){return!t.glow||e.color&&e.color!==P.color?e:{...e,color:t.glow}}function qe(e,t){if(e==="editorial-left"){let o=Math.round(t.height*.056),s=Math.round(t.height*.022);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.12)}px`,`left:${Math.round(t.width*.085)}px`,`width:${Math.round(t.width*.42)}px`,"text-align:left","z-index:3"].join(";"),titleStyle:`font-size:${o}px;line-height:0.92;`,subStyle:`font-size:${s}px;line-height:1.36;max-width:${Math.round(t.width*.36)}px;`,eyebrowStyle:"align-items:flex-start;",deviceStyle:(n,a,l)=>{let c=Math.round(t.width*.68*(a.scale??n.scale)),u=Math.round(t.height*(.03+n.offsetY+(a.offsetY??0))),d=a.pose||n.pose||"tilted-right",m=q(n.shadow,l);return["position:absolute",`top:${Math.round(t.height*.18)+u}px`,`left:${Math.round(t.width*.56)}px`,`width:${c}px`,"transform-origin:center center",`transform:${G(d)}`,`filter:${W(m)}`,"z-index:2"].join(";")}}}if(e==="minimal-bottom"){let o=Math.round(t.height*.041),s=Math.round(t.height*.019);return{copyStyle:["position:absolute",`left:${Math.round(t.width*.12)}px`,`right:${Math.round(t.width*.12)}px`,`bottom:${Math.round(t.height*.085)}px`,"text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${o}px;line-height:0.96;`,subStyle:`font-size:${s}px;line-height:1.34;max-width:${Math.round(t.width*.56)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(n,a,l)=>{let c=Math.round(t.width*.84*(a.scale??n.scale)),u=Math.round(t.height*(n.offsetY+(a.offsetY??0))),d=a.pose||n.pose,m=q(n.shadow,l);return["position:absolute",`top:${Math.round(t.height*.075)+u}px`,"left:50%",`width:${c}px`,"transform-origin:center center",`transform:${ye("translateX(-50%)",G(d))}`,`filter:${W(m)}`,"z-index:2"].join(";")}}}let r=Math.round(t.height*.04),i=Math.round(t.height*.019);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.084)}px`,"left:50%",`width:${Math.round(t.width*.88)}px`,"transform:translateX(-50%)","text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${r}px;line-height:0.92;`,subStyle:`font-size:${i}px;line-height:1.34;max-width:${Math.round(t.width*.6)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(o,s,n)=>{let a=Math.round(t.width*.64*(s.scale??o.scale)),l=Math.round(t.height*(o.offsetY+(s.offsetY??0))),c=s.pose||o.pose,u=q(o.shadow,n);return["position:absolute",`top:${Math.round(t.height*.28)+l}px`,"left:50%",`width:${a}px`,"transform-origin:center top",`transform:${ye("translateX(-50%)",G(c))}`,`filter:${W(u)}`,"z-index:2"].join(";")}}}function Ve({canvas:e,compose:t,slide:r,imageDataUrl:i}){let o=r.background??t.background,s=qe(t.text.preset,e),n=t.text.preset!=="none"&&!!(r.eyebrow||r.headline||r.subheadline),a=s.deviceStyle(t.frame,r,o),l=r.headline?`<div style="font-weight:780;white-space:pre-line;text-wrap:balance;${s.titleStyle}">${Y(r.headline)}</div>`:"",c=r.subheadline?`<div style="margin-top:${Math.round(e.height*.018)}px;color:${t.text.subColor};white-space:pre-line;text-wrap:balance;${s.subStyle}">${Y(r.subheadline)}</div>`:"",u=r.eyebrow?`<div style="display:flex;${s.eyebrowStyle}margin-bottom:${Math.round(e.height*.016)}px;"><div style="font-size:${Math.round(e.height*.014)}px;font-weight:700;letter-spacing:0.18em;text-transform:uppercase;color:${t.text.eyebrowColor};">${Y(r.eyebrow)}</div></div>`:"";return`<!doctype html>
42
+ `);else if(!x.ready)throw new Error(`app not ready to capture after ${Math.round(x.elapsedMs/1e3)}s (${Z(x)}); refusing to capture the boot/loading card. retry once the app paints.`)}let l=r,c=r?.__matcher;if(c){let f=await n.send({type:"evaluate",code:ee(c)});if(!f)throw new Error(c.id?`no node with id "${c.id}"`:`no node matching text "${c.text}"`);l=f}let u=l?{x:l.x,y:l.y,w:l.w,h:l.h}:void 0,d={type:"screenshot"};o&&(d.layers=o),u&&(d.crop=u);let m=await n.send(d);if(typeof m!="string"||m.length<="data:image/png;base64,".length)throw new Error("screenshot capture returned no image data \u2014 the sim is connected but not painting; check `rnxsim get errors`");let w=m.replace(/^data:image\/png;base64,/,"");u&&console.log(` area: x=${u.x} y=${u.y} w=${u.w} h=${u.h}`),o&&console.log(` layers: ${o}`);let p=de(process.cwd(),t||"/tmp/sootsim-inspect.png");ce(ue(p),{recursive:!0});let y=Buffer.from(w,"base64");if(i){let f=await Te(n);if(!f)throw new Error("could not read current device model from the target sim");let x=await ne(y,f);ae(p,x),console.log(` frame: ${f}`)}else ae(p,y);console.log(` saved: ${p}`)}finally{n.close()}}async function Te(e){let t=await M(e,"SootSim.bridges.settings.get")??{deviceModel:null},r=typeof t.deviceModel=="string"?t.deviceModel:null;return!r||!(r in F)?null:r}function ze(e){let t=!1;for(let r of e)r==="--with-frame"&&(t=!0),r==="--no-frame"&&(t=!1);return t}function _e(e){if(e.includes("--shell-only"))return"shell";if(e.includes("--no-shell"))return"tenant"}var je=new Set(["--help","-h","--verbose","-v","--with-frame","--no-frame","--no-shell","--shell-only","--allow-loading","--gallery","--themes"]),me=new Set(["--output","--area","--id","--text","--url","--port","--timeout","--sim"]),Ie={"--rect":"--area","--crop":"--area","--region":"--area","--bounds":"--area","--box":"--area","--xywh":"--area","--out":"--output","-o":"--output","--file":"--output","--path":"--output","--testid":"--id","--test-id":"--id","--test_id":"--id"};function Le(e){let t=[],r={"-o":"--output","--out":"--output","--file":"--output","--path":"--output","--testid":"--id","--test-id":"--id","--test_id":"--id","--rect":"--area","--crop":"--area","--region":"--area","--bounds":"--area","--box":"--area","--xywh":"--area"};for(let i of e){let o=r[i];t.push(o??i)}return t}function Ue(e){let t=[];for(let r=0;r<e.length;r++){let i=e[r];if(i.startsWith("-")){if(me.has(i)){r++;continue}je.has(i)||t.push({flag:i,suggestion:Ie[i]})}}return t}function he(e){let t=e.find((r,i)=>e[i-1]==="--output");if(t)return t;for(let r=0;r<e.length;r++){let i=e[r];if(i.startsWith("-")){me.has(i)&&r++;continue}return i}}async function le(e,t){let r=he(e)||"sootsim-screenshot.png",i=e.includes("--gallery"),o=e.find((a,l)=>e[l-1]==="--url")||`http://localhost:${t.port||5173}`,{chromium:s}=await import("playwright"),n=await v(a=>s.launch(a),{headless:!0});try{if(i)console.log(" capturing gallery..."),console.log(" (gallery mode not yet implemented)");else{let a=await n.newPage({viewport:{width:500,height:900}});await a.goto(o,{waitUntil:"networkidle"}),await a.waitForTimeout(2e3);let l=de(process.cwd(),r);ce(ue(l),{recursive:!0}),await a.screenshot({path:l}),console.log(` saved: ${l}`),await a.close()}}catch(a){console.error(` screenshot failed: ${a.message}`),process.exitCode=1}finally{await n.close()}}import{mkdirSync as V,readFileSync as et,writeFileSync as Me}from"fs";import{tmpdir as tr}from"os";import z from"path";import{mkdirSync as ge,readFileSync as He,writeFileSync as we}from"fs";import H from"path";function fe(e){return e.replace(/\\/g,"/").replace(/\.png$/i,"").trim().split("/").filter(Boolean).join("--").replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"slide"}function Y(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}function Ye(e){let t=e.trim();return/^#[0-9a-f]{3}$/i.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function O(e,t){let r=Ye(e),i=Math.max(0,Math.min(1,t)),o=r.match(/^#([0-9a-f]{6})$/i);if(o){let s=o[1],n=Number.parseInt(s.slice(0,2),16),a=Number.parseInt(s.slice(2,4),16),l=Number.parseInt(s.slice(4,6),16);return`rgba(${n}, ${a}, ${l}, ${i})`}return r.startsWith("rgb(")?r.replace(/^rgb\((.+)\)$/i,`rgba($1, ${i})`):r}function Ge(e){if(e.type==="solid")return e.color||"#000000";let t=e.direction??180,r=e.stops?.map(i=>`${i.color} ${i.offset}%`).join(", ")||"#000000 0%, #111111 100%";return`linear-gradient(${t}deg, ${r})`}function We(e){let t=e.glow;return t?`radial-gradient(circle at 50% 24%, ${O(t,.46)} 0%, ${O(t,.2)} 24%, rgba(0,0,0,0) 62%)`:"none"}function G(e){switch(e){case"tilted-left":return"perspective(2400px) rotateY(10deg) rotateZ(-2deg)";case"tilted-right":return"perspective(2400px) rotateY(-10deg) rotateZ(2deg)";case"cut-bottom":return"translateY(10%) scale(1.08)";case"cut-top":return"translateY(-16%) scale(1.08)";case"straight":default:return"none"}}function ye(...e){let t=e.map(r=>r.trim()).filter(r=>r.length>0&&r!=="none");return t.length>0?t.join(" "):"none"}function W(e){let t=O(e.color,e.opacity),r=O(e.color,e.opacity*.52);return`drop-shadow(0 34px ${e.spread}px ${r}) drop-shadow(0 0 ${e.blur}px ${t})`}function q(e,t){return!t.glow||e.color&&e.color!==P.color?e:{...e,color:t.glow}}function qe(e,t){if(e==="editorial-left"){let o=Math.round(t.height*.056),s=Math.round(t.height*.022);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.12)}px`,`left:${Math.round(t.width*.085)}px`,`width:${Math.round(t.width*.42)}px`,"text-align:left","z-index:3"].join(";"),titleStyle:`font-size:${o}px;line-height:0.92;`,subStyle:`font-size:${s}px;line-height:1.36;max-width:${Math.round(t.width*.36)}px;`,eyebrowStyle:"align-items:flex-start;",deviceStyle:(n,a,l)=>{let c=Math.round(t.width*.68*(a.scale??n.scale)),u=Math.round(t.height*(.03+n.offsetY+(a.offsetY??0))),d=a.pose||n.pose||"tilted-right",m=q(n.shadow,l);return["position:absolute",`top:${Math.round(t.height*.18)+u}px`,`left:${Math.round(t.width*.56)}px`,`width:${c}px`,"transform-origin:center center",`transform:${G(d)}`,`filter:${W(m)}`,"z-index:2"].join(";")}}}if(e==="minimal-bottom"){let o=Math.round(t.height*.041),s=Math.round(t.height*.019);return{copyStyle:["position:absolute",`left:${Math.round(t.width*.12)}px`,`right:${Math.round(t.width*.12)}px`,`bottom:${Math.round(t.height*.085)}px`,"text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${o}px;line-height:0.96;`,subStyle:`font-size:${s}px;line-height:1.34;max-width:${Math.round(t.width*.56)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(n,a,l)=>{let c=Math.round(t.width*.84*(a.scale??n.scale)),u=Math.round(t.height*(n.offsetY+(a.offsetY??0))),d=a.pose||n.pose,m=q(n.shadow,l);return["position:absolute",`top:${Math.round(t.height*.075)+u}px`,"left:50%",`width:${c}px`,"transform-origin:center center",`transform:${ye("translateX(-50%)",G(d))}`,`filter:${W(m)}`,"z-index:2"].join(";")}}}let r=Math.round(t.height*.04),i=Math.round(t.height*.019);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.084)}px`,"left:50%",`width:${Math.round(t.width*.88)}px`,"transform:translateX(-50%)","text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${r}px;line-height:0.92;`,subStyle:`font-size:${i}px;line-height:1.34;max-width:${Math.round(t.width*.6)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(o,s,n)=>{let a=Math.round(t.width*.64*(s.scale??o.scale)),l=Math.round(t.height*(o.offsetY+(s.offsetY??0))),c=s.pose||o.pose,u=q(o.shadow,n);return["position:absolute",`top:${Math.round(t.height*.28)+l}px`,"left:50%",`width:${a}px`,"transform-origin:center top",`transform:${ye("translateX(-50%)",G(c))}`,`filter:${W(u)}`,"z-index:2"].join(";")}}}function Ve({canvas:e,compose:t,slide:r,imageDataUrl:i}){let o=r.background??t.background,s=qe(t.text.preset,e),n=t.text.preset!=="none"&&!!(r.eyebrow||r.headline||r.subheadline),a=s.deviceStyle(t.frame,r,o),l=r.headline?`<div style="font-weight:780;white-space:pre-line;text-wrap:balance;${s.titleStyle}">${Y(r.headline)}</div>`:"",c=r.subheadline?`<div style="margin-top:${Math.round(e.height*.018)}px;color:${t.text.subColor};white-space:pre-line;text-wrap:balance;${s.subStyle}">${Y(r.subheadline)}</div>`:"",u=r.eyebrow?`<div style="display:flex;${s.eyebrowStyle}margin-bottom:${Math.round(e.height*.016)}px;"><div style="font-size:${Math.round(e.height*.014)}px;font-weight:700;letter-spacing:0.18em;text-transform:uppercase;color:${t.text.eyebrowColor};">${Y(r.eyebrow)}</div></div>`:"";return`<!doctype html>
43
43
  <html>
44
44
  <head>
45
45
  <meta charset="utf-8" />
@@ -145,7 +145,7 @@ examples:
145
145
  rnxsim screenshot slides set 1 --title "The ultimate MMA community." --bg-top cyan --bg-bottom black
146
146
  rnxsim screenshot slides capture 1
147
147
  rnxsim screenshot slides export --out ./exports
148
- `,ht={"--title":"title","--subtitle":"subtitle","--bg-top":"bgTop","--bg-bottom":"bgBottom","--title-color":"titleColor","--title-size":"titleSize","--underlay":"titleUnderlay","--shadow":"titleShadow","--out":"out"};function ft(e){let t=[],r={},i=!1;for(let o=0;o<e.length;o+=1){let s=e[o];if(s==="--json"){i=!0;continue}let n=s.indexOf("="),a=n>0?s.slice(0,n):s,l=ht[a];if(l){n>0?r[l]=s.slice(n+1):(r[l]=e[o+1]??"",o+=1);continue}t.push(s)}return{rest:t,values:r,json:i}}function gt(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:e}async function wt(e){if(!await Q(e,`(async () => {
148
+ `,ht={"--title":"title","--subtitle":"subtitle","--bg-top":"bgTop","--bg-bottom":"bgBottom","--title-color":"titleColor","--title-size":"titleSize","--underlay":"titleUnderlay","--shadow":"titleShadow","--out":"out"};function ft(e){let t=[],r={},i=!1;for(let o=0;o<e.length;o+=1){let s=e[o];if(s==="--json"){i=!0;continue}let n=s.indexOf("="),a=n>0?s.slice(0,n):s,l=ht[a];if(l){n>0?r[l]=s.slice(n+1):(r[l]=e[o+1]??"",o+=1);continue}t.push(s)}return{rest:t,values:r,json:i}}function gt(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:e}async function wt(e){if(!await J(e,`(async () => {
149
149
  if (window.SootSim?.bridges?.settings?.get?.()?.screenshotMode) return true
150
150
  window.dispatchEvent(new CustomEvent('sootsim:shell-command', {
151
151
  detail: { type: 'fire-action', id: 'toggle-screenshot-mode' },
@@ -156,4 +156,4 @@ examples:
156
156
  await new Promise((r) => setTimeout(r, 40))
157
157
  }
158
158
  return false
159
- })()`,{acquireLock:!0}))throw new Error("could not enable screenshot mode \u2014 is this a browser sim with the screenshot plugin? (electron has no screenshot mode)")}function yt(e){console.log(` ${e.projectName} \u2014 canvas ${e.canvas} (${e.exportSize.width}\xD7${e.exportSize.height}), device ${e.deviceModel}`);for(let t of e.slides){let r=[t.focused?"focused":t.active?"active":null,t.captured?`captured${t.captureMode==="3d"?" 3d":""}`:"no capture"].filter(Boolean).join(", "),i=t.title?`"${t.title}"`:"(no title)",o=[`bg ${t.bgTop}\u2192${t.bgBottom}`,t.titleColor?`color ${t.titleColor}`:null,t.titleSize?`size ${t.titleSize}`:null,t.titleUnderlay?`underlay ${t.titleUnderlay}`:null,t.titleShadow?`shadow ${t.titleShadow}`:null].filter(Boolean).join(", ");console.log(` ${t.index}. ${i} \u2014 ${o} [${r}]`),t.subtitle&&console.log(` ${t.subtitle}`)}}function bt(e){let t=e.match(/^data:[^;]+;base64,(.+)$/);if(!t)throw new Error("export returned an unexpected payload");return Buffer.from(t[1],"base64")}async function Fe(e,t){if(e.includes("--help")||e.includes("-h")){console.log(mt);return}let{rest:r,values:i,json:o}=ft(e),s=A(r,{port:t.port,commandTimeoutMs:45e3}),n=s.positional[0]??"list",a=gt(s.positional[1]),l=Number(s.positional[2]),c=B(s),u=d=>{o?console.log(JSON.stringify(d,null,2)):yt(d)};try{switch(await wt(c),n){case"list":{u(await M(c,"SootSim.bridges.screenshotControl.getState"));break}case"set":{if(a==null)throw new Error("usage: rnxsim screenshot slides set <n> --title \u2026 (see --help)");let d={};for(let m of["title","subtitle","bgTop","bgBottom","titleColor","titleSize","titleUnderlay","titleShadow"])i[m]!=null&&(d[m]=i[m]);if(Object.keys(d).length===0)throw new Error("nothing to set \u2014 pass at least one field (see --help)");u(await $(c,"SootSim.bridges.screenshotControl.setSlide",a,d));break}case"add":{u(await $(c,"SootSim.bridges.screenshotControl.addSlide"));break}case"remove":{if(a==null)throw new Error("usage: rnxsim screenshot slides remove <n>");u(await $(c,"SootSim.bridges.screenshotControl.removeSlide",a));break}case"move":{if(a==null||!Number.isInteger(l)||l<1)throw new Error("usage: rnxsim screenshot slides move <n> <position>");u(await $(c,"SootSim.bridges.screenshotControl.moveSlide",a,l));break}case"focus":{if(a==null)throw new Error("usage: rnxsim screenshot slides focus <n>");u(await $(c,"SootSim.bridges.screenshotControl.focusSlide",a));break}case"overview":{u(await $(c,"SootSim.bridges.screenshotControl.overview"));break}case"capture":{let d=await $(c,"SootSim.bridges.screenshotControl.capture",...a!=null?[a]:[]);u(d);break}case"export":{let d=i.out?dt(i.out)?i.out:pt(process.cwd(),i.out):Ee(process.cwd(),"screenshots"),m=await M(c,"SootSim.bridges.screenshotControl.getState"),h=a!=null?m.slides.filter(p=>p.index===a||p.id===a):m.slides.filter(p=>p.captured);if(h.length===0)throw new Error(a!=null?`no slide ${a}`:"no captured slides to export \u2014 capture first");let w=[];for(let p of h){let y=await M(c,"SootSim.bridges.screenshotControl.exportSlide",p.index),f=Ee(d,y.name);lt(ut(f),{recursive:!0}),ct(f,bt(y.dataUrl)),w.push(f),console.log(` saved: ${f} (${y.width}\xD7${y.height})`)}o&&console.log(JSON.stringify({written:w},null,2));break}default:throw new Error(`unknown subcommand "${n}" \u2014 see rnxsim screenshot slides --help`)}}finally{c.close()}}var St=new Set(["--sim","--port","-p","--output","-o","--out","--plan","--app","--device","--org","--repo","--api-origin","--branch","--platform","--slides","--shell-origin","--timeout","--ids","--out-dir"]),xt=new Set(["capture","slides","appstore","layers"]);function Re(e){for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("-")){St.has(r)&&t++;continue}return xt.has(r)?{name:r,index:t}:null}return null}function E(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function Pt(e){let t=[];for(let r=0;r<e.length;r++){if(e[r]==="--sim"){r++;continue}t.push(e[r])}return t}async function xr(e,t){let r=Re(e);if(!r||r.name==="capture"){await pe(r?E(e,r.index):e,t);return}if(r.name==="slides"){await Fe(E(e,r.index),t);return}if(r.name==="layers"){let{runScreenshotLayers:s}=await import("./screenshot-layers-ASWBYPJL.js");await s(E(e,r.index),t);return}let i=E(e,r.index),o=Re(i);if(o?.name==="capture")try{let{runScreenshotsCapture:s}=await import("./screenshots-capture-PXA3HFQK.js");return await s(Pt(E(i,o.index)))}catch(s){if(s instanceof Error&&"code"in s&&s.code==="ERR_MODULE_NOT_FOUND")return console.error("screenshot appstore capture is repo-only tooling \u2014 it needs the rnx workspace (playwright is not shipped with the published CLI)."),1;throw s}return De(i,t)}export{xr as runScreenshotCommand};
159
+ })()`,{acquireLock:!0}))throw new Error("could not enable screenshot mode \u2014 is this a browser sim with the screenshot plugin? (electron has no screenshot mode)")}function yt(e){console.log(` ${e.projectName} \u2014 canvas ${e.canvas} (${e.exportSize.width}\xD7${e.exportSize.height}), device ${e.deviceModel}`);for(let t of e.slides){let r=[t.focused?"focused":t.active?"active":null,t.captured?`captured${t.captureMode==="3d"?" 3d":""}`:"no capture"].filter(Boolean).join(", "),i=t.title?`"${t.title}"`:"(no title)",o=[`bg ${t.bgTop}\u2192${t.bgBottom}`,t.titleColor?`color ${t.titleColor}`:null,t.titleSize?`size ${t.titleSize}`:null,t.titleUnderlay?`underlay ${t.titleUnderlay}`:null,t.titleShadow?`shadow ${t.titleShadow}`:null].filter(Boolean).join(", ");console.log(` ${t.index}. ${i} \u2014 ${o} [${r}]`),t.subtitle&&console.log(` ${t.subtitle}`)}}function bt(e){let t=e.match(/^data:[^;]+;base64,(.+)$/);if(!t)throw new Error("export returned an unexpected payload");return Buffer.from(t[1],"base64")}async function Fe(e,t){if(e.includes("--help")||e.includes("-h")){console.log(mt);return}let{rest:r,values:i,json:o}=ft(e),s=A(r,{port:t.port,commandTimeoutMs:45e3}),n=s.positional[0]??"list",a=gt(s.positional[1]),l=Number(s.positional[2]),c=B(s),u=d=>{o?console.log(JSON.stringify(d,null,2)):yt(d)};try{switch(await wt(c),n){case"list":{u(await M(c,"SootSim.bridges.screenshotControl.getState"));break}case"set":{if(a==null)throw new Error("usage: rnxsim screenshot slides set <n> --title \u2026 (see --help)");let d={};for(let m of["title","subtitle","bgTop","bgBottom","titleColor","titleSize","titleUnderlay","titleShadow"])i[m]!=null&&(d[m]=i[m]);if(Object.keys(d).length===0)throw new Error("nothing to set \u2014 pass at least one field (see --help)");u(await $(c,"SootSim.bridges.screenshotControl.setSlide",a,d));break}case"add":{u(await $(c,"SootSim.bridges.screenshotControl.addSlide"));break}case"remove":{if(a==null)throw new Error("usage: rnxsim screenshot slides remove <n>");u(await $(c,"SootSim.bridges.screenshotControl.removeSlide",a));break}case"move":{if(a==null||!Number.isInteger(l)||l<1)throw new Error("usage: rnxsim screenshot slides move <n> <position>");u(await $(c,"SootSim.bridges.screenshotControl.moveSlide",a,l));break}case"focus":{if(a==null)throw new Error("usage: rnxsim screenshot slides focus <n>");u(await $(c,"SootSim.bridges.screenshotControl.focusSlide",a));break}case"overview":{u(await $(c,"SootSim.bridges.screenshotControl.overview"));break}case"capture":{let d=await $(c,"SootSim.bridges.screenshotControl.capture",...a!=null?[a]:[]);u(d);break}case"export":{let d=i.out?dt(i.out)?i.out:pt(process.cwd(),i.out):Ee(process.cwd(),"screenshots"),m=await M(c,"SootSim.bridges.screenshotControl.getState"),h=a!=null?m.slides.filter(p=>p.index===a||p.id===a):m.slides.filter(p=>p.captured);if(h.length===0)throw new Error(a!=null?`no slide ${a}`:"no captured slides to export \u2014 capture first");let w=[];for(let p of h){let y=await M(c,"SootSim.bridges.screenshotControl.exportSlide",p.index),f=Ee(d,y.name);lt(ut(f),{recursive:!0}),ct(f,bt(y.dataUrl)),w.push(f),console.log(` saved: ${f} (${y.width}\xD7${y.height})`)}o&&console.log(JSON.stringify({written:w},null,2));break}default:throw new Error(`unknown subcommand "${n}" \u2014 see rnxsim screenshot slides --help`)}}finally{c.close()}}var St=new Set(["--sim","--port","-p","--output","-o","--out","--plan","--app","--device","--org","--repo","--api-origin","--branch","--platform","--slides","--shell-origin","--timeout","--ids","--out-dir"]),xt=new Set(["capture","slides","appstore","layers"]);function Re(e){for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("-")){St.has(r)&&t++;continue}return xt.has(r)?{name:r,index:t}:null}return null}function E(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function Pt(e){let t=[];for(let r=0;r<e.length;r++){if(e[r]==="--sim"){r++;continue}t.push(e[r])}return t}async function xr(e,t){let r=Re(e);if(!r||r.name==="capture"){await pe(r?E(e,r.index):e,t);return}if(r.name==="slides"){await Fe(E(e,r.index),t);return}if(r.name==="layers"){let{runScreenshotLayers:s}=await import("./screenshot-layers-CDYHPNC3.js");await s(E(e,r.index),t);return}let i=E(e,r.index),o=Re(i);if(o?.name==="capture")try{let{runScreenshotsCapture:s}=await import("./screenshots-capture-EBIIY2YU.js");return await s(Pt(E(i,o.index)))}catch(s){if(s instanceof Error&&"code"in s&&s.code==="ERR_MODULE_NOT_FOUND")return console.error("screenshot appstore capture is repo-only tooling \u2014 it needs the rnx workspace (playwright is not shipped with the published CLI)."),1;throw s}return De(i,t)}export{xr as runScreenshotCommand};
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.315 | (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 S}from"./chunk-BTWORNNG.js";import"./chunk-GASE6UBA.js";import{r as y,s as v}from"./chunk-XEVZYVIW.js";import"./chunk-YIFT42WN.js";import{h as w,j as b,m as I}from"./chunk-KTHV3RUS.js";import"./chunk-UC6U3MML.js";import{b as m}from"./chunk-2YR5BGA5.js";import"./chunk-4NPPOV2N.js";import"./chunk-IJ5CAZZC.js";import"./chunk-FSUYIVJ6.js";import"./chunk-WINYQ44O.js";import{mkdirSync as B,writeFileSync as R}from"fs";import{resolve as f}from"path";async function L(s,$){(s.includes("--help")||s.includes("-h"))&&(console.log(`
4
+ import{a as S}from"./chunk-2JZ53D4A.js";import"./chunk-U2HNIHBY.js";import"./chunk-FNTTIR2P.js";import{r as b,s as I}from"./chunk-WUXCH6WN.js";import"./chunk-RVM4EZ4E.js";import{b as m}from"./chunk-LT6UC7I3.js";import{q as y,s as v,v as w}from"./chunk-UROXJVY3.js";import"./chunk-6ZMRJPKI.js";import"./chunk-XOXGC3EH.js";import"./chunk-26WMWUH4.js";import{mkdirSync as B,writeFileSync as R}from"fs";import{resolve as f}from"path";async function L(s,$){(s.includes("--help")||s.includes("-h"))&&(console.log(`
5
5
  sootsim screenshot layers \u2014 export a screen as engine-isolated layers
6
6
 
7
7
  usage:
@@ -16,5 +16,5 @@ output:
16
16
  base.png the frame re-rendered with every listed subtree hidden
17
17
  layer-<id>.png each subtree rendered alone on a transparent frame
18
18
  manifest.json device metrics + logical rect per layer
19
- `),process.exit(0));let u=s.find((r,n)=>s[n-1]==="--ids");u||(console.error(" --ids is required (comma-separated testIDs)"),process.exit(1));let i=u.split(",").map(r=>r.trim()).filter(Boolean);i.length===0&&(console.error(" --ids resolved to an empty list"),process.exit(1));let D=s.find((r,n)=>s[n-1]==="--out-dir"),c=f(process.cwd(),D??"/tmp/sootsim-layers"),M=w(s,{port:$.port,stripValueFlags:["--ids","--out-dir"]}),o=b({...M,commandTimeoutMs:45e3});try{let r=await v(o,9e4);if(!r.ready)throw new Error(`app not ready to capture after ${Math.round(r.elapsedMs/1e3)}s (${y(r)})`);let n={};for(let e of i){let t=await o.send({type:"evaluate",code:S({id:e})});if(!t)throw new Error(`no node with testID "${e}"`);n[e]=t}B(c,{recursive:!0});let l=(e,t)=>{if(typeof t!="string"||!t.startsWith("data:image/png;base64,"))throw new Error(`capture for ${e} returned no image data`);let h=f(c,e);R(h,Buffer.from(t.slice(22),"base64")),console.log(` saved: ${h}`)};l("full.png",await o.send({type:"screenshot"})),l("base.png",await o.send({type:"screenshot",captureFilter:{hideTestIds:i}}));for(let e of i)l(`layer-${e}.png`,await o.send({type:"screenshot",captureFilter:{soloTestId:e,hideTestIds:i.filter(t=>t!==e)}}));let p=await I(o,"SootSim.bridges.settings.get")??{deviceModel:null},a=typeof p.deviceModel=="string"&&p.deviceModel in m?p.deviceModel:null,d=a?m[a]:null,x={device:d?{model:a,width:d.width,height:d.height,scale:d.scale}:{model:a},layers:i.map(e=>({testId:e,rect:n[e]}))},g=f(c,"manifest.json");R(g,`${JSON.stringify(x,null,2)}
19
+ `),process.exit(0));let u=s.find((r,n)=>s[n-1]==="--ids");u||(console.error(" --ids is required (comma-separated testIDs)"),process.exit(1));let i=u.split(",").map(r=>r.trim()).filter(Boolean);i.length===0&&(console.error(" --ids resolved to an empty list"),process.exit(1));let D=s.find((r,n)=>s[n-1]==="--out-dir"),c=f(process.cwd(),D??"/tmp/sootsim-layers"),M=y(s,{port:$.port,stripValueFlags:["--ids","--out-dir"]}),o=v({...M,commandTimeoutMs:45e3});try{let r=await I(o,9e4);if(!r.ready)throw new Error(`app not ready to capture after ${Math.round(r.elapsedMs/1e3)}s (${b(r)})`);let n={};for(let e of i){let t=await o.send({type:"evaluate",code:S({id:e})});if(!t)throw new Error(`no node with testID "${e}"`);n[e]=t}B(c,{recursive:!0});let l=(e,t)=>{if(typeof t!="string"||!t.startsWith("data:image/png;base64,"))throw new Error(`capture for ${e} returned no image data`);let h=f(c,e);R(h,Buffer.from(t.slice(22),"base64")),console.log(` saved: ${h}`)};l("full.png",await o.send({type:"screenshot"})),l("base.png",await o.send({type:"screenshot",captureFilter:{hideTestIds:i}}));for(let e of i)l(`layer-${e}.png`,await o.send({type:"screenshot",captureFilter:{soloTestId:e,hideTestIds:i.filter(t=>t!==e)}}));let p=await w(o,"SootSim.bridges.settings.get")??{deviceModel:null},a=typeof p.deviceModel=="string"&&p.deviceModel in m?p.deviceModel:null,d=a?m[a]:null,x={device:d?{model:a,width:d.width,height:d.height,scale:d.scale}:{model:a},layers:i.map(e=>({testId:e,rect:n[e]}))},g=f(c,"manifest.json");R(g,`${JSON.stringify(x,null,2)}
20
20
  `),console.log(` saved: ${g}`)}finally{o.close()}}export{L as runScreenshotLayers};
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.315 | (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 U}from"./chunk-D4FFVGI5.js";import{a as M}from"./chunk-WEXDAC74.js";import"./chunk-HI5TFJWN.js";import"./chunk-FSUYIVJ6.js";import{a as F}from"./chunk-2D2UPBBR.js";import"./chunk-WINYQ44O.js";import{execSync as N}from"node:child_process";import{mkdirSync as O,mkdtempSync as E,rmSync as j,writeFileSync as G}from"node:fs";import{tmpdir as q}from"node:os";import{dirname as B,isAbsolute as L,join as I,resolve as z}from"node:path";import{chromium as W}from"playwright-core";var H=`
4
+ import{b as U}from"./chunk-C5O5CTXJ.js";import{a as M}from"./chunk-56H6EVO4.js";import"./chunk-WM32MGTJ.js";import"./chunk-XOXGC3EH.js";import{a as F}from"./chunk-SZKSFMWS.js";import"./chunk-26WMWUH4.js";import{execSync as N}from"node:child_process";import{mkdirSync as O,mkdtempSync as E,rmSync as j,writeFileSync as G}from"node:fs";import{tmpdir as q}from"node:os";import{dirname as B,isAbsolute as L,join as I,resolve as z}from"node:path";import{chromium as W}from"playwright-core";var H=`
5
5
  rnxsim screenshot appstore capture \u2014 headlessly capture + upload App Store slides
6
6
 
7
7
  usage:
@@ -0,0 +1,44 @@
1
+ /*! rnx v0.1.315 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import{b as ye,c as J,d as ve,e as V,f as be,h as we,i as P,j as Ae,k as Te,l as Ce,m as ke,q as Ie,t as C,u as Ee,v as Pe,w as Re,x as xe}from"./chunk-MF7WUHQ3.js";import"./chunk-PXNAZYGV.js";import{a as pe,b as me,d as he,e as L,f as fe}from"./chunk-TEL7G234.js";import{e as Se}from"./chunk-MCKQH4AM.js";import"./chunk-56H6EVO4.js";import{d as ge}from"./chunk-2POODCTW.js";import{g as _}from"./chunk-ZWX6DDIS.js";import"./chunk-YY24QI25.js";import"./chunk-PVPAP3TV.js";import{a as F,b as G,c as ae,d as ce}from"./chunk-J6HMTUZH.js";import"./chunk-WM32MGTJ.js";import{f as O}from"./chunk-LP2BTEJ6.js";import{c as le,d as ue}from"./chunk-UROXJVY3.js";import"./chunk-6ZMRJPKI.js";import{A as W,B as Y,G as Z,I as x,J as $,K as Q,L as ee,M as te,O as ie,R as re,S as ne,T as se,U as j,V as oe,g as z,h as q,r as X}from"./chunk-XOXGC3EH.js";import{a as de}from"./chunk-NCKAD3V7.js";import"./chunk-SZKSFMWS.js";import"./chunk-26WMWUH4.js";import{spawn as wt}from"child_process";import T from"fs";import{createServer as At}from"http";import b from"path";import{WebSocket as S,WebSocketServer as Tt}from"ws";import _e from"node:fs";import M from"node:path";import{spawn as qe}from"node:child_process";function Xe(a){return typeof a.text=="string"?a.text.trim():""}function Ye(a){let e=a?.trim();return e||"tm"}async function Oe(a){let e=a.sessionId.trim();if(!G(e))throw new Error(`invalid Team Machine session id: ${e||"<empty>"}`);let t=Xe(a.prompt);if(!t)throw new Error("prompt text is empty");let i=Ye(a.command),s=a.timeoutMs??15e3;await new Promise((n,c)=>{let r=qe(i,["send",e,t],{stdio:["ignore","ignore","pipe"],env:process.env}),o="",l=setTimeout(()=>{try{r.kill("SIGTERM")}catch{}c(new Error(`tm send timed out after ${Math.round(s/1e3)}s`))},s);r.stderr?.setEncoding("utf8"),r.stderr?.on("data",d=>{o.length<4e3&&(o+=String(d))}),r.on("error",d=>{clearTimeout(l),c(d)}),r.on("exit",(d,u)=>{if(clearTimeout(l),d===0){n();return}let p=o.trim();c(new Error(p||`tm send exited with ${u?`signal ${u}`:`code ${d??"unknown"}`}`))})})}var B=1,Ze=25;function Qe(){return[Number(process.env.VITE_PORT_WEB||process.env.PORT||3e3),Number(process.env.VITE_PORT_ZERO||7849),Number(process.env.VITE_PORT_R2||9500)].filter(a=>Number.isFinite(a)&&a>0)}var D=class{subscriptions=new Map;sessionsBySocket=new Map;allSockets=new Set;pendingPromptEchoes=new Map;pendingTurns=new Map;pendingSessionStates=new Map;pendingSessionPatches=new Map;sessionStatusPersistTimer=null;opts;constructor(e={}){this.opts=e}registerSocket(e){this.allSockets.add(e)}unregisterSocket(e){let t=this.sessionsBySocket.get(e);if(t){for(let i of t)this.decrementSubscription(i);this.sessionsBySocket.delete(e)}this.allSockets.delete(e)}async handleMessage(e,t){let i=t?.type;if(typeof i!="string"||!i.startsWith("agent:"))return!1;let s=t.id;try{let n=await this.dispatch(e,i,t);this.respond(e,s,n)}catch(n){n instanceof C?this.respondError(e,s,n.message,n.code):this.respondError(e,s,n instanceof Error?n.message:String(n))}return!0}async seedOnBoot(){try{await ke()}catch(e){process.stderr.write(`[sootsim-agent] seedFromDemoAppRegistry failed: ${e instanceof Error?e.message:String(e)}
5
+ `)}}close(){this.sessionStatusPersistTimer&&(clearTimeout(this.sessionStatusPersistTimer),this.sessionStatusPersistTimer=null),this.flushSessionStatuses();for(let e of this.subscriptions.values())try{e.unsubscribe()}catch{}this.subscriptions.clear(),this.sessionsBySocket.clear(),this.allSockets.clear()}async dispatch(e,t,i){switch(t){case"agent:list-projects":return V();case"agent:upsert-project":return J(i.input??{});case"agent:delete-project":return we(String(i.projectId)),{ok:!0};case"agent:auto-attach-for-url":return this.autoAttachForUrl(i.input??{});case"agent:list-sessions":return Ae(i.projectId?String(i.projectId):void 0);case"agent:start-session":return this.doStartSession(i.input??{});case"agent:send-claimed-prompt":return this.sendClaimedPrompt(i);case"agent:send-prompt":{let n=String(i.sessionId),c=P(n);if(!c)throw new C("NO_SESSION",`no session: ${n}`);let r=this.normalizePromptEnvelope(i);return await Pe(n,r),this.notePromptAccepted(n,r,c.status==="working")}case"agent:end-session":this.dropSessionFanout(String(i.sessionId)),await Re(String(i.sessionId));let s=P(String(i.sessionId));return s&&this.broadcastSessionStatus(s),{ok:!0};case"agent:get-transcript":return this.getTranscript(String(i.sessionId));case"agent:get-paths":return this.getPaths();case"agent:subscribe-events":return this.subscribeSocket(e,String(i.sessionId));case"agent:unsubscribe-events":return this.unsubscribeSocket(e,String(i.sessionId));default:throw new C("UNKNOWN_AGENT_MSG",`unknown agent message: ${t}`)}}async sendClaimedPrompt(e){let t=typeof e.simId=="string"?e.simId.trim():"";if(!t)throw new C("NO_SIM","agent:send-claimed-prompt requires simId");let i=this.opts.resolveCliLease?.(t)??null;if(!i||i.kind!=="cli"||i.expiresAt<=Date.now())throw new C("NO_CLAIM",`sim ${t} has no active CLI claim`);let s=F(i.cliIdentityKey);if(!s)throw new C("UNSUPPORTED_CLAIM",`sim ${t} is claimed by a CLI identity that is not promptable`);return await Oe({sessionId:s,prompt:this.normalizePromptEnvelope(e)}),{ok:!0,routed:"team-machine",sessionId:s}}async doStartSession(e){if(!ve(e.projectId))throw new C("NO_PROJECT",`no project: ${e.projectId}`);let i=await Ee(e);return this.broadcastSessionStatus(i.session),i}async autoAttachForUrl(e){let t=e.bundleUrl??"",i=(()=>{try{return new URL(t).port||null}catch{return null}})();if(!i)return{project:null};let s=this.opts.getExcludePorts?.()??Qe(),c=(await _({excludePorts:s})).find(d=>String(d.port)===i);if(!c||!c.cwd)return{project:null};let r=V().find(d=>d.cwd===c.cwd)??null,o=Array.from(new Set([...r?.knownBundleUrls??[],c.bundleUrl,t]));return{project:J({cwd:c.cwd,name:c.projectName??M.basename(c.cwd),preferredProvider:e.provider??r?.preferredProvider,sourceRoots:r?.sourceRoots??[c.cwd],knownBundleUrls:o,framework:r?.framework??et(c.framework),bundleId:c.bundleId??r?.bundleId})}}getTranscript(e){let t=Ie(e);return _e.existsSync(t)?_e.readFileSync(t,"utf8"):{error:"transcript not found",code:"NO_TRANSCRIPT"}}getPaths(){let e=ye();return{userDataDir:e,storeFile:M.join(e,"attached-projects.json"),sessionsDir:M.join(e,"sessions"),transcriptsDir:M.join(e,"transcripts")}}subscribeSocket(e,t){let i=this.sessionsBySocket.get(e);if(i||(i=new Set,this.sessionsBySocket.set(e,i)),i.has(t))return{ok:!0,refCount:this.subscriptions.get(t)?.refCount??1};i.add(t);let s=this.subscriptions.get(t);if(s)return s.refCount++,{ok:!0,refCount:s.refCount};let n=xe(t,c=>{let r=this.coalescePromptEcho(t,c);if(r&&(this.applySessionEvent(t,r),this.fanOutEvent(t,r)),c.type==="turn-completed"){let o=P(t);if(o)try{be(o.projectId,{usd:c.costUsd,ts:c.ts})}catch(l){process.stderr.write(`[sootsim-agent] recordTurnTelemetry failed: ${l instanceof Error?l.message:String(l)}
6
+ `)}}});return this.subscriptions.set(t,{unsubscribe:n,refCount:1}),{ok:!0,refCount:1}}unsubscribeSocket(e,t){let i=this.sessionsBySocket.get(e);return!i||!i.has(t)?{ok:!0,refCount:0}:(i.delete(t),this.decrementSubscription(t))}decrementSubscription(e){let t=this.subscriptions.get(e);if(!t)return{ok:!0,refCount:0};if(t.refCount--,t.refCount<=0){try{t.unsubscribe()}catch{}return this.subscriptions.delete(e),{ok:!0,refCount:0}}return{ok:!0,refCount:t.refCount}}dropSessionFanout(e){let t=this.subscriptions.get(e);if(t){try{t.unsubscribe()}catch{}this.subscriptions.delete(e)}for(let i of this.sessionsBySocket.values())i.delete(e);this.clearPromptTracking(e)}normalizePromptEnvelope(e){if(e?.prompt&&typeof e.prompt=="object"){let t=e.prompt;return{text:String(t.text??""),...typeof t.displayText=="string"?{displayText:t.displayText}:{},...typeof t.inspectSummary=="string"?{inspectSummary:t.inspectSummary}:{},...typeof t.inspectTrace=="string"?{inspectTrace:t.inspectTrace}:{}}}return{text:String(e?.text??""),...typeof e?.displayText=="string"?{displayText:e.displayText}:{},...typeof e?.inspectSummary=="string"?{inspectSummary:e.inspectSummary}:{},...typeof e?.inspectTrace=="string"?{inspectTrace:e.inspectTrace}:{}}}notePromptAccepted(e,t,i){let s=Date.now(),n=this.pendingPromptEchoes.get(e)??[];n.push({sentAt:s}),this.pendingPromptEchoes.set(e,n);let c=Math.max(this.pendingTurns.get(e)??0,i?1:0)+1;this.pendingTurns.set(e,c);let r=t.displayText??t.text;return this.patchSession(e,{lastPrompt:r,status:"working",needsAttention:!1}),this.fanOutEvent(e,{type:"prompt-received",text:r,...t.inspectSummary?{inspectSummary:t.inspectSummary}:{},...t.inspectTrace?{inspectTrace:t.inspectTrace}:{},ts:s}),{ok:!0,queued:c>1,pendingTurns:c,queueDepth:Math.max(0,c-1)}}applySessionEvent(e,t){switch(t.type){case"prompt-received":case"turn-started":this.patchSession(e,{status:"working",needsAttention:!1});return;case"turn-completed":{let i=this.consumeSettledTurn(e);this.patchSession(e,{status:i>0?"working":"idle",needsAttention:!1,lastTurnFiles:t.filesTouched,currentlyEditing:void 0});return}case"approval-needed":this.patchSession(e,{status:"needs-attention",needsAttention:!0});return;case"error":{let i=this.consumeSettledTurn(e);this.patchSession(e,{status:i>0?"working":"needs-attention",needsAttention:i<=0,currentlyEditing:void 0});return}case"exited":this.clearPromptTracking(e),this.patchSession(e,{status:"ended",needsAttention:!1,wrapperPid:void 0,currentlyEditing:void 0});return;case"ready":case"turn-reasoning":case"turn-message":case"turn-plan":case"tool-call":case"file-edited":case"file-diff-delta":return}}patchSession(e,t){let i=this.pendingSessionStates.get(e)??P(e);if(!i)return;let s=Te(i,t);this.pendingSessionStates.set(e,s),this.pendingSessionPatches.set(e,{...this.pendingSessionPatches.get(e),...t}),this.broadcastSessionStatus(s),!this.sessionStatusPersistTimer&&(this.sessionStatusPersistTimer=setTimeout(()=>{this.sessionStatusPersistTimer=null,this.flushSessionStatuses()},Ze))}flushSessionStatuses(){if(this.pendingSessionPatches.size===0)return;let e=this.pendingSessionStates,t=this.pendingSessionPatches;this.pendingSessionStates=new Map,this.pendingSessionPatches=new Map;try{Ce([...t].map(([i,s])=>({id:i,patch:s})))}catch(i){for(let[s,n]of e)this.pendingSessionStates.has(s)||this.pendingSessionStates.set(s,n);for(let[s,n]of t)this.pendingSessionPatches.set(s,{...n,...this.pendingSessionPatches.get(s)});process.stderr.write(`[sootsim-agent] session status persistence failed: ${i instanceof Error?i.message:String(i)}
7
+ `)}}coalescePromptEcho(e,t){if(t.type!=="prompt-received")return t;let i=this.pendingPromptEchoes.get(e);if(!i||i.length===0)return t;for(;i.length>0&&Date.now()-i[0].sentAt>15e3;)i.shift();return i.length===0?(this.pendingPromptEchoes.delete(e),t):(i.shift(),i.length===0?this.pendingPromptEchoes.delete(e):this.pendingPromptEchoes.set(e,i),null)}consumeSettledTurn(e){let t=Math.max(0,(this.pendingTurns.get(e)??1)-1);return t>0?this.pendingTurns.set(e,t):this.pendingTurns.delete(e),t}clearPromptTracking(e){this.pendingPromptEchoes.delete(e),this.pendingTurns.delete(e)}fanOutEvent(e,t){let i=JSON.stringify({type:"agent:event",sessionId:e,event:t});for(let[s,n]of this.sessionsBySocket)if(n.has(e)&&s.readyState===B)try{s.send(i)}catch{}}broadcastSessionStatus(e){let t=JSON.stringify({type:"agent:session-status",session:e});for(let i of this.allSockets)if(i.readyState===B)try{i.send(t)}catch{}}respond(e,t,i){if(e.readyState===B)try{e.send(JSON.stringify({id:t,result:i}))}catch{}}respondError(e,t,i,s){if(e.readyState===B)try{e.send(JSON.stringify({id:t,error:i,...s?{code:s}:{}}))}catch{}}};function et(a){return a==="expo"?"expo":a==="one"||a==="vxrn"?"one":"unknown"}import Me from"http";import Be from"https";import{finished as rt,pipeline as nt}from"stream/promises";var K="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36",tt=[{hostSuffix:"uniswap.org",headers:{origin:"https://app.uniswap.org",referer:"https://app.uniswap.org/"},suppressBrowserUserAgent:!0}];function it(a){let e=a.toLowerCase();for(let t of tt)if(e===t.hostSuffix||e.endsWith(`.${t.hostSuffix}`))return t}function Le(a){let e=it(a.hostname);return{"accept-encoding":"identity",...e?.suppressBrowserUserAgent?{}:{"user-agent":K},...e?.headers}}var st=new Set(["host","origin","referer","user-agent","accept-encoding","cookie","connection","keep-alive","transfer-encoding","upgrade","content-length","sec-fetch-site","sec-fetch-mode","sec-fetch-dest","sec-ch-ua","sec-ch-ua-mobile","sec-ch-ua-platform"]),ot={"access-control-allow-origin":"*","access-control-allow-methods":"GET,POST,PUT,DELETE,PATCH,OPTIONS","access-control-allow-headers":"*","access-control-expose-headers":"*","access-control-max-age":"3600"},at=new Set(["host","origin","referer","sec-fetch-site","sec-fetch-mode","sec-fetch-dest"]);function De(a){return a.protocol!=="https:"?{}:pe(a.hostname)?{rejectUnauthorized:!1}:{}}function R(a){for(let[e,t]of Object.entries(ot))a.setHeader(e,t)}function ct(a,e){let t=[],i=e;i?.code&&t.push(i.code),i?.message&&t.push(i.message),i?.cause?.code&&t.push(i.cause.code),i?.cause?.message&&t.push(i.cause.message);let n=[...new Set(t.filter(Boolean))].join(" | ")||String(e);return a.includes("stored-in-.env.local")?`${n} | upstream url still contains placeholder env values`:n}function dt(a,e){let t={};for(let[i,s]of Object.entries(a))s&&(st.has(i.toLowerCase())||(t[i]=Array.isArray(s)?s.join(", "):s));return Object.assign(t,e?Le(e):{"user-agent":K}),t}function lt(a,e){let t={};for(let[i,s]of Object.entries(a))s&&(at.has(i.toLowerCase())||(t[i]=s));return t.host=e.host,t.origin=e.origin,t.referer=`${e.origin}/`,t}function Ne(a){return a?.startsWith("/__fetch-proxy?")||a?.startsWith("/__proxy?")||!1}function He(a){return a?!!(a.startsWith("/__app-api?")||a.startsWith("/__app-api/")):!1}async function Ue(a,e){if(a.method==="OPTIONS"){R(e),e.writeHead(204),e.end();return}let i=new URLSearchParams((a.url||"").split("?")[1]||"").get("url");if(!i){R(e),e.writeHead(400,{"Content-Type":"text/plain"}),e.end("missing url param");return}let s;try{s=new URL(i)}catch{R(e),e.writeHead(400,{"Content-Type":"text/plain"}),e.end("invalid url param");return}let n;if(a.method!=="GET"&&a.method!=="HEAD"){let o=[];for await(let l of a)o.push(Buffer.isBuffer(l)?l:Buffer.from(l));o.length>0&&(n=Buffer.concat(o))}let c=a.method||"GET",r=async(o,l,d,u)=>{let p=o.protocol==="https:"?Be:Me,m=dt(a.headers,o);o.origin!==s.origin&&(delete m.authorization,delete m["proxy-authorization"]),l==="GET"||l==="HEAD"?(delete m["content-length"],delete m["content-type"]):d&&(m["content-length"]=String(d.byteLength));let f=await new Promise((w,A)=>{let y=p.request({hostname:o.hostname,port:o.port||(o.protocol==="https:"?443:80),path:o.pathname+o.search,method:l,headers:m,...De(o)},w),I=()=>y.destroy(new Error("fetch proxy client disconnected"));a.once("aborted",I),y.once("close",()=>a.off("aborted",I)),y.once("error",A),d===void 0?y.end():y.end(d)}),h=f.statusCode??502,g=f.headers.location;if(g&&(h===301||h===302||h===303||h===307||h===308)){if(u>=10)throw f.destroy(),new Error("too many redirects");let w=(h===301||h===302)&&l==="POST"||h===303&&l!=="GET"&&l!=="HEAD",A=new URL(g,o);f.resume(),await rt(f),await r(A,w?"GET":l,w?void 0:d,u+1);return}for(let[w,A]of Object.entries(f.headers)){let y=w.toLowerCase();A===void 0||y==="set-cookie"||y==="connection"||y==="keep-alive"||y==="proxy-authenticate"||y==="proxy-authorization"||y==="te"||y==="trailer"||y==="transfer-encoding"||y==="upgrade"||y.startsWith("access-control-")||e.setHeader(w,A)}R(e);let v=f.headers["set-cookie"]??[];v.length>0&&e.setHeader("x-sootsim-set-cookie",(Array.isArray(v)?v:[v]).join(", ")),e.statusCode=h,await nt(f,e)};try{await r(s,c,n,0)}catch(o){if(e.headersSent){e.destroy(o instanceof Error?o:new Error(String(o)));return}R(e),e.writeHead(502,{"Content-Type":"text/plain"}),e.end(`fetch proxy error: ${ct(s.href,o)}`)}}function Fe(a,e){let t=a.url||"",i="",s="";if(t.startsWith("/__app-api?")){let l=new URL(t,"http://sootsim.local");i=l.searchParams.get("path")||"",s=l.searchParams.get("origin")?.trim()||""}else if(t.startsWith("/__app-api/"))i=t.slice(10);else return!1;if(!s)return e.writeHead(400,{"Content-Type":"text/plain"}),e.end("app-api: missing origin query param"),!0;if(a.method==="OPTIONS")return e.writeHead(204,{"Access-Control-Allow-Origin":a.headers.origin||"*","Access-Control-Allow-Methods":"GET,POST,PUT,PATCH,DELETE,OPTIONS","Access-Control-Allow-Headers":a.headers["access-control-request-headers"]||"*","Access-Control-Allow-Credentials":"true","Access-Control-Max-Age":"86400"}),e.end(),!0;let n;try{n=new URL(i,s)}catch{return e.writeHead(400,{"Content-Type":"text/plain"}),e.end("app-api: invalid origin or path"),!0}let c=n.protocol==="https:"?Be:Me,r=lt(a.headers,n),o=c.request({hostname:n.hostname,port:n.port||(n.protocol==="https:"?443:80),path:n.pathname+n.search,method:a.method,headers:r,...De(n)},l=>{let d=Object.keys(l.headers).filter(u=>{let p=u.toLowerCase();return!p.startsWith("access-control-")&&p!=="set-cookie"}).join(", ");e.writeHead(l.statusCode??502,{...l.headers,"access-control-allow-origin":a.headers.origin||"*","access-control-allow-credentials":"true","access-control-expose-headers":d}),l.pipe(e)});return o.on("error",l=>{e.statusCode=502,e.end(`app proxy error: ${l.message}`)}),a.pipe(o),!0}import{WebSocket as k,WebSocketServer as ut}from"ws";var pt="/__websocket-proxy",mt=new Set(["host","connection","upgrade","transfer-encoding","content-length","sec-websocket-accept","sec-websocket-extensions","sec-websocket-key","sec-websocket-protocol","sec-websocket-version"]);function E(a,e,t){try{a.write(`HTTP/1.1 ${e} ${t}\r
8
+ Connection: close\r
9
+ Content-Type: text/plain\r
10
+ Content-Length: ${t.length}\r
11
+ \r
12
+ ${t}`)}catch{}a.destroy()}function ht(a){let e=a.headers.origin,t=a.headers.host;if(!e||!t)return!1;try{return new URL(e).host===t}catch{return!1}}function ft(a){if(!a)return{};let e=a.replace(/-/g,"+").replace(/_/g,"/"),t=e+"=".repeat((4-e.length%4)%4),i=JSON.parse(Buffer.from(t,"base64").toString("utf8"));if(!i||typeof i!="object"||Array.isArray(i))return{};let s={};for(let[n,c]of Object.entries(i))c!=null&&(mt.has(n.toLowerCase())||(s[n]=Array.isArray(c)?c.join(", "):String(c)));return s}function gt(a){let e=new URL(a.href);return e.protocol=a.protocol==="wss:"?"https:":"http:",e.origin}function St(a){let e=a.headers["sec-websocket-protocol"];return(Array.isArray(e)?e.join(","):e||"").split(",").map(i=>i.trim()).filter(Boolean)}function N(a,e,t){if(!(a.readyState===k.CLOSED||a.readyState===k.CLOSING))try{a.close(e,t)}catch{a.terminate()}}function yt(a,e){let t=!1,i=(s,n,c,r)=>{t||(t=!0,N(n,c,r.toString()),s.readyState===k.OPEN&&N(s,c,r.toString()))};a.on("message",(s,n)=>{e.readyState===k.OPEN&&e.send(s,{binary:n})}),e.on("message",(s,n)=>{a.readyState===k.OPEN&&a.send(s,{binary:n})}),a.on("close",(s,n)=>i(a,e,s,n)),e.on("close",(s,n)=>i(e,a,s,n)),a.on("error",()=>N(e,1011,"proxy client error")),e.on("error",()=>N(a,1011,"upstream websocket error"))}function vt(a,e,t,i){let s={...t},n=Object.keys(s).filter(c=>c.toLowerCase()==="origin");if(i&&n.length===0)s.origin=gt(a);else if(!i)for(let c of n)delete s[c];return Object.keys(s).length===0?new k(a.href,e):new k(a.href,e,{headers:s})}function bt(a){if(!a)return!1;try{return new URL(a,"http://localhost").pathname===pt}catch{return!1}}function We(a,e,t,i=!0){if(!bt(a.url))return!1;if(!ht(a))return E(e,403,"forbidden websocket proxy origin"),!0;let s,n;try{let l=new URL(a.url||"/","http://localhost"),d=l.searchParams.get("url");if(!d)return E(e,400,"missing websocket proxy url"),!0;if(s=new URL(d),s.protocol!=="ws:"&&s.protocol!=="wss:")return E(e,400,"invalid websocket proxy protocol"),!0;n=ft(l.searchParams.get("headers"))}catch{return E(e,400,"invalid websocket proxy request"),!0}let c=St(a),r=vt(s,c,n,i),o=!1;return e.once("close",()=>{o||r.terminate()}),r.once("open",()=>{if(o)return;o=!0;let l=r.protocol;new ut({noServer:!0,clientTracking:!1,handleProtocols(u){return l||u.values().next().value||!1}}).handleUpgrade(a,e,t,u=>{yt(u,r)})}),r.once("error",()=>{o||(o=!0,E(e,502,"upstream websocket error"))}),r.once("close",()=>{o||(o=!0,E(e,502,"upstream websocket closed"))}),!0}var Ct="require-corp",kt=new Set(["tap","keyboard","longPress","perform","reset","camera"]),It=2e3,Et=1e3;function Pt(a){return!a||typeof a.type!="string"?!1:a.acquireLock===!0?!0:a.readOnly===!0?!1:kt.has(a.type)}var $e=5e3,Rt=3600*1e3,xt="SOOTSIM_RUNTIME_UPDATE_INTERVAL_MS",je={".html":"text/html; charset=utf-8",".js":"application/javascript",".cjs":"application/javascript",".mjs":"application/javascript",".css":"text/css; charset=utf-8",".json":"application/json; charset=utf-8",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".webp":"image/webp",".avif":"image/avif",".ico":"image/x-icon",".wasm":"application/wasm",".ttf":"font/ttf",".otf":"font/otf",".woff":"font/woff",".woff2":"font/woff2",".map":"application/json",".txt":"text/plain; charset=utf-8",".mp4":"video/mp4",".m4v":"video/mp4",".webm":"video/webm",".mov":"video/quicktime"},Je="/__camera-fixtures/",Ot=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;function Ve(a,e,t){let i;try{let o=W();i=JSON.stringify(o)}catch{i="{}"}let s=e>0?`window.__sootsimBridgePort=${e};`:"",n=t?`window.__sootsimContrastOrigin=${JSON.stringify(t)};`:"",c=`<script>window.__sootsimSharedConfig=${i};`+s+n+`window.__sootsimCliVersion=${JSON.stringify(de())};</script>`,r=a.toString("utf8");return r.includes("<head>")?r.replace("<head>",`<head>${c}`):r.includes("</head>")?r.replace("</head>",c+"</head>"):r.includes("</body>")?r.replace("</body>",c+"</body>"):c+r}function Ke(a){typeof a=="object"&&a!==null&&"unref"in a&&a.unref()}var H=class a{port;openUrlHandler;httpServer=null;wss=null;nextCommandId=1;nextSimNumber=161;sims=new Map;primarySimId=null;pendingCommands=new Map;cliBySentId=new Map;cliSimBySocket=new Map;cliLastCommandAt=new Map;cliIdentityKeyBySocket=new Map;cliLabelBySocket=new Map;restorableSims=new Map;nextCliFallbackId=1;cliIdleTimer=null;agentHost;static CLI_IDLE_TIMEOUT_MS=6e4;static CLI_LEASE_TTL_MS=6e5;static USER_ACTIVE_LEASE_TTL_MS=8e3;static USER_BOOT_LEASE_TTL_MS=6e4;static SIM_RECONNECT_TTL_MS=3e4;static SIM_IDLE_REAP_TTL_MS=30*6e4;static AUTOMATION_SIM_IDLE_REAP_TTL_MS=10*6e4;static MAX_CONCURRENT_AUTOMATION_SIMS=6;static AUTOMATION_SIM_ACTIVE_GRACE_MS=6e4;preferredPort;portFallbackCount;simIdleReapTtlMs;automationSimIdleReapTtlMs;maxConcurrentAutomationSims;automationSimActiveGraceMs;shouldWriteLockfile;shouldWriteDevLockfile;getShellPort;contrastOrigin=null;effectivePort=0;startedAt=0;heartbeatTimer=null;devHeartbeatTimer=null;wsHeartbeatTimer=null;wsIsAlive=new WeakMap;static WS_HEARTBEAT_INTERVAL_MS=3e4;runtimeUpdateTimer=null;runtimeUpdateInFlight=null;activeRuntimeVersion=null;activeRuntimeDirPath=null;scanCache=null;scanCacheAt=0;inflightScan=null;static SCAN_FRESH_MS=2e3;constructor(e={}){this.preferredPort=e.port||7668,this.port=this.preferredPort,this.shouldWriteLockfile=e.writeLockfile===!0,this.shouldWriteDevLockfile=e.writeDevLockfile===!0,this.getShellPort=e.getShellPort??null,this.portFallbackCount=Math.max(1,e.portFallbackCount??10),this.openUrlHandler=e.openUrl,this.agentHost=new D({getExcludePorts:e.agentScanExcludes,resolveCliLease:t=>{let i=this.sims.get(t),s=i?this.getActiveLease(i):null;return s?{kind:s.kind,cliIdentityKey:s.cliIdentityKey,expiresAt:s.expiresAt}:null}}),this.contrastOrigin=e.contrastOrigin?.replace(/\/$/,"")||null,this.simIdleReapTtlMs=e.simIdleReapTtlMs??a.SIM_IDLE_REAP_TTL_MS,this.automationSimIdleReapTtlMs=e.automationSimIdleReapTtlMs??a.AUTOMATION_SIM_IDLE_REAP_TTL_MS,this.maxConcurrentAutomationSims=e.maxConcurrentAutomationSims??a.MAX_CONCURRENT_AUTOMATION_SIMS,this.automationSimActiveGraceMs=e.automationSimActiveGraceMs??a.AUTOMATION_SIM_ACTIVE_GRACE_MS}getAgentHost(){return this.agentHost}reapIdleSimsForTest(e=Date.now()){this.reapIdleSims(e)}start(e){this.startAsync(e)}async startAsync(e){if(this.httpServer||this.wss)return this.effectivePort;this.refreshActiveRuntime();for(let t=0;t<this.portFallbackCount;t++){let i=this.preferredPort+t;try{return await this.bindOnce(i,e?.silent===!0),this.effectivePort=i,this.port=i,this.startedAt=Date.now(),t>0&&!e?.silent&&process.stderr.write(`ws bridge bound to port ${i} (preferred ${this.preferredPort} was taken)
13
+ `),this.afterBind(),i}catch(s){if(s?.code!=="EADDRINUSE")throw s;e?.silent||process.stderr.write(`ws bridge port ${i} already in use, trying ${i+1}
14
+ `)}}throw new Error(`could not bind ws bridge after ${this.portFallbackCount} attempts starting at ${this.preferredPort}`)}bindOnce(e,t){return new Promise((i,s)=>{let n=At((o,l)=>this.handleHttpRequest(o,l)),c=!1,r=o=>{if(!c){c=!0;try{n.close()}catch{}this.httpServer=null,this.wss=null,s(o)}};n.once("error",r),n.listen(e,"127.0.0.1",()=>{c||(c=!0,n.removeListener("error",r),n.on("error",o=>{process.stderr.write(`ws bridge http error: ${String(o)}
15
+ `)}),this.httpServer=n,this.wss=new Tt({noServer:!0}),this.wireWebSocketServer(),n.on("upgrade",(o,l,d)=>{We(o,l,d)||this.wss?.handleUpgrade(o,l,d,u=>{this.wss?.emit("connection",u,o)})}),i())})})}wireWebSocketServer(){this.wss&&this.wss.on("connection",(e,t)=>{let i=t.headers.origin,s=i?"sim":"cli",n=null;if(e.on("error",()=>{}),this.wsIsAlive.set(e,!0),e.on("pong",()=>{this.wsIsAlive.set(e,!0)}),this.agentHost.registerSocket(e),s==="sim")n={id:this.allocateSimId(),ws:e,origin:i,connectedAt:Date.now(),lastSeenAt:Date.now(),lastActiveAt:0,recentActions:[]},this.sims.set(n.id,n),this.writeConnectedRuntimeSnapshot(),this.shouldPromoteSim(n)&&(this.primarySimId=n.id),this.broadcastSimAssignments(),this.broadcastSimClientStates();else{let c=`ws-${this.nextCliFallbackId++}`;this.cliIdentityKeyBySocket.set(e,c)}e.on("message",c=>{let r;try{r=JSON.parse(c.toString())}catch{return}if(!(!r||typeof r!="object")){if(typeof r.type=="string"&&r.type.startsWith("agent:")){this.agentHost.handleMessage(e,r);return}if(r.type==="runtime:list"){let o=O.listInstalled(),l=this.getActiveRuntime(),d={type:"runtime:list:ok",id:r.id,installed:o,active:l.version,activeRuntimeDir:l.runtimeDir};try{e.send(JSON.stringify(d))}catch{}return}if(r.type==="runtime:use"){let o=typeof r.version=="string"?r.version:"";if(!O.listInstalled().includes(o)){try{e.send(JSON.stringify({type:"runtime:use:error",id:r.id,error:`runtime ${o||"(missing)"} is not installed`}))}catch{}return}let d=this.setActiveRuntime(o);try{e.send(JSON.stringify({type:"runtime:use:ok",id:r.id,version:d.version,runtimeDir:d.runtimeDir}))}catch{}return}if(r.type==="runtime:get"){let o=this.getActiveRuntime();try{e.send(JSON.stringify({type:"runtime:get:ok",id:r.id,active:o.version,activeRuntimeDir:o.runtimeDir}))}catch{}return}if(s==="sim"&&r.type==="bridge:hello"&&n&&!n.url){let o=n.id;this.sims.delete(o),this.primarySimId===o&&(this.primarySimId=this.getOpenSim()?.id??null),n=null,s="cli",this.cliIdentityKeyBySocket.set(e,`ws-${this.nextCliFallbackId++}`),this.writeConnectedRuntimeSnapshot(),this.broadcastSimAssignments(),this.broadcastSimClientStates()}if(s==="sim"){if(n&&(n.lastSeenAt=Date.now()),r.type==="bridge:register"&&n){let d=r,u=this.tryRestoreSimId(n,d.simId);n.url=d.url,n.title=d.title,n.userAgent=d.userAgent,this.writeConnectedRuntimeSnapshot(),typeof d.kind=="string"&&d.kind.trim()&&(n.kind=d.kind.trim()),d.meta&&typeof d.meta=="object"&&(n.meta=d.meta);let p=this.primarySimId!==n.id&&this.shouldPromoteSim(n);p&&(this.primarySimId=n.id),(u||p)&&(this.broadcastSimAssignments(),this.broadcastSimClientStates());return}if(r.type==="bridge:user-focus-state"&&n){let d=r;this.updateUserFocusLease(n,d);return}if(r.type==="bridge:user-interact"&&n){this.updateUserActivity(n);return}if(r.type==="bridge:write-shared-config"){if(!r.patch||typeof r.patch!="object"||Array.isArray(r.patch))return;let d=Object.fromEntries(Object.entries(r.patch));try{this.writeAndBroadcastSharedConfig(d)}catch(u){process.stderr.write(`sootsim: bridge:write-shared-config failed: ${u instanceof Error?u.message:String(u)}
16
+ `);return}return}if(r.type==="bridge:open-path"){let d=typeof r.path=="string"?r.path:"",u=typeof r.line=="number"&&Number.isFinite(r.line)?r.line:void 0,p=typeof r.column=="number"&&Number.isFinite(r.column)?r.column:void 0;d&&this.openPathInEditor(d,u,p);return}if(r.type==="bridge:boot-clients"&&n){let d=[];for(let[p,m]of this.cliSimBySocket)m===n.id&&d.push(p);for(let p of d){this.cliSimBySocket.delete(p);try{p.close(1e3,"booted by sim")}catch{}}let u=!!n.cliLease;n.cliLease={kind:"user-active",cliIdentityKey:"__user-active__",cliLabel:"active user",expiresAt:Date.now()+a.USER_BOOT_LEASE_TTL_MS},process.stderr.write(`rnx booted ${d.length} cli client(s)${u?" (overrode prior lease)":""}; held sim for user [${n.id}]
17
+ `),this.recordSimAction(n.id,"sim booted cli clients"),this.broadcastSimClientStates();return}let o=this.pendingCommands.get(r.id);if(o){this.pendingCommands.delete(r.id),r.error?o.reject(new Error(r.error)):o.resolve(r.result);return}let l=this.cliBySentId.get(r.id);if(l&&(this.cliBySentId.delete(r.id),l.ws.readyState===S.OPEN)){let d=this.getOtherCliIdentityCount(l.ws,l.simId),u=d>0?{...r,id:l.originalId,_otherCliCount:d}:{...r,id:l.originalId};l.ws.send(JSON.stringify(u))}return}(async()=>{this.cliLastCommandAt.set(e,Date.now());try{if(r.type==="bridge:bye"){let p=this.cliSimBySocket.delete(e);this.cliLastCommandAt.delete(e),this.cliIdentityKeyBySocket.delete(e),this.cliLabelBySocket.delete(e);for(let[m,f]of this.cliBySentId)f.ws===e&&this.cliBySentId.delete(m);p&&this.broadcastSimClientStates();return}if(r.type==="bridge:hello"){let p=typeof r.cliIdentityKey=="string"&&r.cliIdentityKey.trim()?r.cliIdentityKey.trim():this.cliIdentityKeyBySocket.get(e)||`ws-${this.nextCliFallbackId++}`;this.cliIdentityKeyBySocket.set(e,p),typeof r.cliLabel=="string"&&r.cliLabel.trim()&&this.cliLabelBySocket.set(e,r.cliLabel.trim()),e.readyState===S.OPEN&&e.send(JSON.stringify({id:r.id,result:{cliIdentityKey:p,leaseTtlMs:a.CLI_LEASE_TTL_MS,leasing:!0}}));return}if(r.type==="bridge:list-sims"){e.readyState===S.OPEN&&e.send(JSON.stringify({id:r.id,result:this.listSims()}));return}if(r.type==="bridge:claim"){let p=await this.waitForSim(r.simId),m=this.tryAcquireLease(e,p,{force:r.force===!0});if(!m.granted){e.readyState===S.OPEN&&e.send(JSON.stringify({id:r.id,error:`sim ${p.id} is locked by another cli`,_locked:m.lock}));return}this.setCliSimTarget(e,p.id),this.recordSimAction(p.id,m.bootedCount>0?`cli force-claimed sim (booted ${m.bootedCount})`:"cli claimed sim"),e.readyState===S.OPEN&&e.send(JSON.stringify({id:r.id,result:{simId:p.id,lockedBy:m.lease.cliIdentityKey,lockExpiresAt:m.lease.expiresAt,bootedCount:m.bootedCount}}));return}let o=await this.waitForSim(r.simId);if(Pt(r)){let p=this.tryAcquireLease(e,o);if(!p.granted){e.readyState===S.OPEN&&e.send(JSON.stringify({id:r.id,error:`sim ${o.id} is locked by another cli \u2014 use \`rnxsim claim ${o.id} --force\` or \`rnxsim open --new\``,_locked:p.lock}));return}}else this.ensureCliIdentityKey(e);this.setCliSimTarget(e,o.id),this.recordSimAction(o.id,this.describeForwardedCommand(r));let l=this.nextCommandId++;this.cliBySentId.set(l,{simId:o.id,ws:e,originalId:r.id});let{simId:d,...u}=r;if(o.ws.send(JSON.stringify({...u,id:l})),u.type==="close"){this.cliBySentId.delete(l),e.readyState===S.OPEN&&e.send(JSON.stringify({id:r.id,result:{requested:!0,simId:o.id}}));let p=o.ws,m=setTimeout(()=>{this.closeSimSocketFromHost(p)},It);Ke(m)}}catch(o){e.readyState===S.OPEN&&e.send(JSON.stringify({id:r.id,error:o instanceof Error?o.message:String(o)}))}})()}}),e.on("close",()=>{if(this.agentHost.unregisterSocket(e),s==="sim"&&n){this.rememberDisconnectedSim(n),this.primarySimId===n.id&&(this.primarySimId=this.getOpenSim()?.id??null);for(let[c,r]of this.pendingCommands)r.simId===n.id&&(r.reject(new Error("sim disconnected")),this.pendingCommands.delete(c));for(let[c,r]of this.cliBySentId)r.simId===n.id&&(r.ws.readyState===S.OPEN&&r.ws.send(JSON.stringify({id:r.originalId,error:"sim disconnected before responding"})),this.cliBySentId.delete(c));this.broadcastSimAssignments(),this.broadcastSimClientStates()}else if(s==="cli"){let c=this.cliSimBySocket.delete(e);this.cliLastCommandAt.delete(e),this.cliIdentityKeyBySocket.delete(e),this.cliLabelBySocket.delete(e);for(let[r,o]of this.cliBySentId)o.ws===e&&this.cliBySentId.delete(r);c&&this.broadcastSimClientStates()}})})}afterBind(){if(process.stderr.write(`ws bridge listening on port ${this.port}
18
+ `),this.cliIdleTimer=setInterval(()=>this.sweepIdleCliClients(),3e4),this.cliIdleTimer.unref(),this.wsHeartbeatTimer=setInterval(()=>this.sweepDeadWebSockets(),a.WS_HEARTBEAT_INTERVAL_MS),this.wsHeartbeatTimer.unref(),this.shouldWriteLockfile){try{if(x(),!se(this.buildLockfileSnapshot()))throw new Error("another rnx daemon wrote the lockfile during startup \u2014 aborting")}catch(e){throw process.stderr.write(`ws bridge failed to claim daemon lockfile: ${String(e)}
19
+ `),e}this.heartbeatTimer=setInterval(()=>{try{this.writeLockfileSnapshot()}catch{}},$e),this.heartbeatTimer.unref(),this.startRuntimeUpdater()}if(this.shouldWriteDevLockfile){try{this.writeDevLockfileSnapshot()}catch(e){process.stderr.write(`ws bridge failed to write dev bridge lockfile: ${String(e)}
20
+ `)}this.devHeartbeatTimer=setInterval(()=>{try{this.writeDevLockfileSnapshot()}catch{}},$e),this.devHeartbeatTimer.unref()}this.agentHost.seedOnBoot()}bootstrapping=!0;connectedRuntimeVersions(){let e=new Set;for(let t of this.sims.values())try{let i=new URL(t.url||t.origin||"http://localhost"),s=L(i.hostname);s&&e.add(s)}catch{}return[...e].sort()}buildLockfileSnapshot(){return{schema:1,pid:process.pid,platform:process.platform,bridgePort:this.effectivePort,runtimePort:this.effectivePort,activeRuntime:this.activeRuntimeVersion,activeRuntimeDir:this.activeRuntimeDirPath,servedRuntimes:this.connectedRuntimeVersions(),startedAt:this.startedAt,heartbeatAt:Date.now(),bootstrapping:this.bootstrapping}}buildDevLockfileSnapshot(){let e=this.getShellPort?.()??null;return{schema:1,pid:process.pid,platform:process.platform,bridgePort:this.effectivePort,runtimePort:this.effectivePort,...e&&e>0?{shellPort:e}:{},cwd:process.cwd(),startedAt:this.startedAt,heartbeatAt:Date.now(),source:"vite-dev",servedRuntimes:this.connectedRuntimeVersions()}}writeLockfileSnapshot(){re(this.buildLockfileSnapshot())}writeDevLockfileSnapshot(){ne(this.buildDevLockfileSnapshot())}writeConnectedRuntimeSnapshot(){if(this.shouldWriteLockfile&&this.httpServer)try{this.writeLockfileSnapshot()}catch{}if(this.shouldWriteDevLockfile&&this.httpServer)try{this.writeDevLockfileSnapshot()}catch{}}refreshActiveRuntime(){this.activeRuntimeVersion=$(),this.activeRuntimeDirPath=me()??ee()}runServerScan(){if(this.inflightScan)return this.inflightScan;let e=this.effectivePort>0?[this.effectivePort]:[];return this.inflightScan=_({excludePorts:e,buildIconProxyUrl:t=>`/__bundle-proxy?url=${encodeURIComponent(t)}`}).then(t=>(this.scanCache=t,this.scanCacheAt=Date.now(),t)).catch(t=>{let i=t instanceof Error?t.message:String(t);return console.error("[rnx] /__server-scan failed:",i),this.scanCache??[]}).finally(()=>{this.inflightScan=null}),this.inflightScan}handleCameraFixture(e,t,i){let s=(t.method||"GET").toUpperCase(),n={"Access-Control-Allow-Origin":"*","Cache-Control":"no-store"};if(s==="OPTIONS"){i.writeHead(204,{...n,"Access-Control-Allow-Methods":"GET, HEAD, OPTIONS","Access-Control-Allow-Headers":"range"}),i.end();return}if(s!=="GET"&&s!=="HEAD"){i.writeHead(405,n),i.end();return}if(!Ot.test(e)){i.writeHead(400,{...n,"Content-Type":"text/plain; charset=utf-8"}),i.end("bad fixture name");return}let c=X(),r=b.join(c,e),o;try{o=T.lstatSync(r)}catch{i.writeHead(404,{...n,"Content-Type":"text/plain; charset=utf-8"}),i.end("not found");return}if(!o.isFile()){i.writeHead(403,{...n,"Content-Type":"text/plain; charset=utf-8"}),i.end("forbidden");return}let l=je[b.extname(r).toLowerCase()]||"application/octet-stream",d=o.size,u=/^bytes=(\d*)-(\d*)$/.exec(t.headers.range||"");if(u){let[,p,m]=u,f=p?Number(p):0,h=m?Math.min(Number(m),d-1):d-1;if(!Number.isFinite(f)||f>h||f>=d){i.writeHead(416,{...n,"Content-Range":`bytes */${d}`}),i.end();return}if(i.writeHead(206,{...n,"Content-Type":l,"Content-Range":`bytes ${f}-${h}/${d}`,"Accept-Ranges":"bytes","Content-Length":String(h-f+1)}),s==="HEAD"){i.end();return}T.createReadStream(r,{start:f,end:h}).pipe(i);return}if(i.writeHead(200,{...n,"Content-Type":l,"Accept-Ranges":"bytes","Content-Length":String(d)}),s==="HEAD"){i.end();return}T.createReadStream(r).pipe(i)}handleServerScan(e){let t=s=>{e.writeHead(200,{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),e.end(JSON.stringify(s))},i=Date.now()-this.scanCacheAt;if(this.scanCache&&i<a.SCAN_FRESH_MS){t(this.scanCache);return}if(this.scanCache){t(this.scanCache),this.runServerScan().catch(()=>{});return}this.runServerScan().then(s=>t(s))}resolveRuntimeUpdateIntervalMs(){let e=Number(process.env[xt]);return Number.isFinite(e)&&e>0?Math.max(100,Math.round(e)):Rt}startRuntimeUpdater(){if(!this.shouldWriteLockfile||this.runtimeUpdateTimer||T.existsSync(b.join(z(),"runtime-update-disabled"))||process.env.SOOTSIM_HOME&&q()&&!$())return;this.runRuntimeUpdate("startup");let e=this.resolveRuntimeUpdateIntervalMs();this.runtimeUpdateTimer=setInterval(()=>{this.runRuntimeUpdate("periodic")},e),this.runtimeUpdateTimer.unref()}runRuntimeUpdate(e){return this.runtimeUpdateInFlight?this.runtimeUpdateInFlight:(this.runtimeUpdateInFlight=(async()=>{try{e==="startup"&&process.stderr.write(`rnx: checking for runtime updates\u2026
21
+ `);let t=await O.updateToLatest({protectVersions:this.connectedRuntimeVersions()});if(!t.updated||!t.latestVersion){e==="startup"&&process.stderr.write(`rnx: runtime ${this.activeRuntimeVersion??"(none)"} is current
22
+ `);return}let i=this.activeRuntimeVersion,s=this.setActiveRuntime(t.latestVersion);process.stderr.write(`rnx runtime updated to ${s.version} (${e})
23
+ `);try{Z({from:i,to:s.version,at:Date.now()})}catch{}}catch(t){process.stderr.write(`rnx runtime update failed (${e}): ${t instanceof Error?t.message:String(t)}
24
+ `)}finally{if(this.runtimeUpdateInFlight=null,e==="startup"&&this.bootstrapping){if(this.bootstrapping=!1,this.shouldWriteLockfile&&this.httpServer)try{this.writeLockfileSnapshot()}catch{}process.stderr.write(`rnx: ready
25
+ `)}}})(),this.runtimeUpdateInFlight)}setActiveRuntime(e){if(Q(e),this.refreshActiveRuntime(),this.shouldWriteLockfile&&this.httpServer)try{this.writeLockfileSnapshot()}catch{}let t=JSON.stringify({type:"runtime:changed",version:e,runtimeDir:this.activeRuntimeDirPath});for(let i of this.sims.values()){try{let s=new URL(i.url||i.origin||"http://localhost");if(L(s.hostname))continue}catch{}if(i.ws.readyState===S.OPEN)try{i.ws.send(t)}catch{}}return{version:e,runtimeDir:this.activeRuntimeDirPath}}getActiveRuntime(){return{version:this.activeRuntimeVersion,runtimeDir:this.activeRuntimeDirPath}}removeLockfile(){if(this.shouldWriteLockfile)try{j()}catch{}}handleHttpRequest(e,t){if(t.setHeader("Cross-Origin-Opener-Policy","same-origin"),t.setHeader("Cross-Origin-Embedder-Policy",Ct),t.setHeader("Cross-Origin-Resource-Policy","cross-origin"),t.setHeader("Document-Policy","js-profiling"),Ne(e.url)){Ue(e,t);return}if(He(e.url)&&Fe(e,t))return;let i=(e.method||"GET").toUpperCase(),s;try{s=new URL(e.url||"/",`http://${e.headers.host||"localhost"}`)}catch{t.writeHead(400,{"Content-Type":"text/plain; charset=utf-8"}),t.end("invalid request URL or host");return}if(s.pathname==="/__sootsim/shared-config"){if(t.setHeader("Access-Control-Allow-Origin","*"),t.setHeader("Access-Control-Allow-Headers","Content-Type"),t.setHeader("Cache-Control","no-store"),i==="OPTIONS"){t.writeHead(204,{Allow:"GET, HEAD, POST, OPTIONS"}),t.end();return}if(i==="GET"||i==="HEAD"){let u="{}";try{u=JSON.stringify(W())}catch{}t.writeHead(200,{"Content-Type":"application/json"}),i==="HEAD"?t.end():t.end(u);return}if(i==="POST"){(async()=>{try{let u=[],p=0;for await(let g of e){let v=Buffer.isBuffer(g)?g:Buffer.from(g);if(p+=v.byteLength,p>8*1024*1024){t.writeHead(413,{"Content-Type":"text/plain; charset=utf-8"}),t.end("shared config patch is too large");return}u.push(v)}let m=JSON.parse(Buffer.concat(u).toString("utf8"));if(!m||typeof m!="object"||Array.isArray(m))throw new Error("shared config patch must be an object");let f=Object.fromEntries(Object.entries(m)),h=this.writeAndBroadcastSharedConfig(f);t.writeHead(200,{"Content-Type":"application/json"}),t.end(JSON.stringify(h))}catch(u){t.writeHead(400,{"Content-Type":"text/plain; charset=utf-8"}),t.end(`invalid shared config patch: ${u instanceof Error?u.message:String(u)}`)}})();return}t.writeHead(405,{Allow:"GET, HEAD, POST, OPTIONS"}),t.end("method not allowed");return}if(s.pathname.startsWith(Je)){this.handleCameraFixture(s.pathname.slice(Je.length),e,t);return}if(i!=="GET"&&i!=="HEAD"){t.writeHead(405,{Allow:"GET, HEAD"}),t.end("method not allowed");return}if(s.pathname==="/__bundle-proxy"){let u=s.searchParams.get("url");if(!u){t.writeHead(400,{"Content-Type":"text/plain"}),t.end("bundle-proxy: missing url query param");return}let p;try{p=new URL(u)}catch{t.writeHead(400,{"Content-Type":"text/plain"}),t.end("bundle-proxy: invalid url");return}let m=p.hostname;if(!(m==="localhost"||m==="127.0.0.1"||m==="::1"||m.endsWith(".localhost"))){t.writeHead(403,{"Content-Type":"text/plain"}),t.end("bundle-proxy: only loopback targets allowed");return}(async()=>{try{let h=await fetch(p.toString(),{redirect:"follow"}),g={},v=h.headers.get("content-type");if(v&&(g["Content-Type"]=v),g["Cache-Control"]="no-store",t.writeHead(h.status,g),!h.body){t.end();return}let w=h.body.getReader();for(;;){let{done:A,value:y}=await w.read();if(A)break;t.write(Buffer.from(y))}t.end()}catch(h){t.writeHead(502,{"Content-Type":"text/plain"}),t.end(`bundle-proxy: upstream fetch failed: ${h instanceof Error?h.message:String(h)}`)}})();return}if(s.pathname==="/__server-scan"){this.handleServerScan(t);return}if(s.pathname==="/healthz"){t.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),t.end(JSON.stringify({ok:!0,pid:process.pid,platform:process.platform,bridgePort:this.effectivePort,runtimePort:this.effectivePort,activeRuntime:this.activeRuntimeVersion,bridgeSource:this.shouldWriteDevLockfile?"vite-dev":this.shouldWriteLockfile?"daemon":"embedded",startedAt:this.startedAt,uptimeMs:this.startedAt>0?Date.now()-this.startedAt:0}));return}let n=he(s.hostname),c=L(s.hostname);n||this.refreshActiveRuntime();let r=n?fe(s.hostname):this.activeRuntimeDirPath;if(!r){t.writeHead(503,{"Content-Type":"text/plain; charset=utf-8"}),t.end(n?`rnx: runtime ${c??"(invalid version origin)"} is not installed. run \`rnxsim open\` from that app again.`:"rnx: no active runtime installed. run `rnxsim runtime install` to fetch one.");return}let o=s.pathname;if(o==="/runtime"||o==="/runtime/"?o="/":o.startsWith("/runtime/")?o=o.slice(8):o==="/sootsim"||o==="/sootsim/"?o="/":o.startsWith("/sootsim/")&&(o=o.slice(8)),(o===""||o==="/")&&(o="/index.html"),o.includes("\0")){t.writeHead(400),t.end("bad request");return}if(process.platform!=="win32"&&o.includes("\\")){t.writeHead(400),t.end("bad request");return}for(let u of o.split("/"))if(u===".."){t.writeHead(403),t.end("forbidden");return}let l=b.resolve(r,"."+o),d=r.endsWith(b.sep)?r:r+b.sep;if(!l.startsWith(d)&&l!==r){t.writeHead(403),t.end("forbidden");return}T.realpath(l,(u,p)=>{let m=u?l:p,f=m.endsWith(b.sep)?m:m+b.sep;if(!u){let h=(()=>{try{let g=T.realpathSync(r);return g.endsWith(b.sep)?g:g+b.sep}catch{return d}})();if(!f.startsWith(h)&&m+b.sep!==h){t.writeHead(403),t.end("forbidden");return}}T.stat(m,(h,g)=>{if(h||!g?.isFile()){let y=b.extname(o).toLowerCase();if(y&&y!==".html"){t.writeHead(404),t.end("not found");return}if(o.startsWith("/__")||o.startsWith("/api/")||o==="/api"){t.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),t.end("not found");return}let I=b.join(r,"index.html");T.readFile(I,(Ge,ze)=>{if(Ge){t.writeHead(404),t.end("not found");return}if(t.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),i==="HEAD"){t.end();return}t.end(Ve(ze,this.effectivePort,this.contrastOrigin))});return}let v=b.extname(m).toLowerCase(),w=je[v]||"application/octet-stream";if(t.writeHead(200,{"Content-Type":w,"Cache-Control":"no-store"}),i==="HEAD"){t.end();return}if(v===".html"){T.readFile(m,(y,I)=>{if(y){try{t.end()}catch{}return}t.end(Ve(I,this.effectivePort,this.contrastOrigin))});return}let A=T.createReadStream(m);A.pipe(t),A.on("error",()=>{try{t.end()}catch{}})})})}sweepIdleCliClients(){let e=Date.now(),t=!1;for(let[i,s]of this.cliSimBySocket){let n=this.cliLastCommandAt.get(i)??0;if(e-n<a.CLI_IDLE_TIMEOUT_MS)continue;let c=!1;for(let r of this.cliBySentId.values())if(r.ws===i){c=!0;break}if(!c){this.cliSimBySocket.delete(i),this.cliLastCommandAt.delete(i);for(let[r,o]of this.cliBySentId)o.ws===i&&this.cliBySentId.delete(r);try{i.close(1e3,"idle timeout")}catch{}t=!0}}t&&this.broadcastSimClientStates(),this.sweepRestorableSims(e),this.reapIdleSims(e)}isAutomationSim(e){return e.meta?.sootsimHostDriver==="playwright"}automationSimOwnerAlive(e){let t=Number(e.meta?.sootsimHostPid);if(!Number.isInteger(t)||t<=1||t===process.pid)return!1;try{return process.kill(t,0),!0}catch(i){return i.code==="EPERM"}}reapIdleSims(e=Date.now()){let t=new Set(this.cliSimBySocket.values()),i=[];for(let n of this.sims.values()){if(n.id===this.primarySimId||t.has(n.id)||this.getActiveLease(n))continue;let c=Math.max(n.lastActiveAt,n.connectedAt),r=e-c,o=this.isAutomationSim(n);if(o&&this.automationSimOwnerAlive(n))continue;let l=o?this.automationSimIdleReapTtlMs:this.simIdleReapTtlMs;if(r>=l){this.closeSimSocketFromHost(n.ws);continue}o&&i.push({sim:n,idleMs:r})}let s=this.maxConcurrentAutomationSims;if(i.length>s){i.sort((n,c)=>c.idleMs-n.idleMs);for(let{sim:n,idleMs:c}of i.slice(0,i.length-s))c<this.automationSimActiveGraceMs||this.closeSimSocketFromHost(n.ws)}}sweepDeadWebSockets(){if(this.wss)for(let e of this.wss.clients){if(e.readyState!==S.OPEN)continue;if(this.wsIsAlive.get(e)===!1){try{e.terminate()}catch{}continue}this.wsIsAlive.set(e,!1);try{e.ping()}catch{try{e.terminate()}catch{}}}}closeSimSocketFromHost(e){if(e.readyState!==S.OPEN)return;try{e.close(le,ue)}catch{try{e.terminate()}catch{}return}let t=setTimeout(()=>{if(e.readyState!==S.CLOSED)try{e.terminate()}catch{}},Et);Ke(t)}listSims(){return Array.from(this.sims.values()).sort((e,t)=>e.id===this.primarySimId?-1:t.id===this.primarySimId?1:e.connectedAt-t.connectedAt).map(e=>this.describeSim(e))}async sendCommand(e){let t=await this.waitForSim(e.simId),i=this.nextCommandId++;return new Promise((s,n)=>{let c=setTimeout(()=>{this.pendingCommands.delete(i),this.broadcastSimClientStates(),n(new Error("command timed out after 30s"))},3e4);this.pendingCommands.set(i,{simId:t.id,resolve:l=>{clearTimeout(c),this.pendingCommands.delete(i),this.broadcastSimClientStates(),s(l)},reject:l=>{clearTimeout(c),this.pendingCommands.delete(i),this.broadcastSimClientStates(),n(l)}}),this.broadcastSimClientStates();let{simId:r,...o}=e;t.ws.send(JSON.stringify({...o,id:i}))})}async evaluate(e,t){return this.sendCommand({type:"evaluate",code:e,simId:t})}async focusSim(e){return this.sendCommand({type:"focus",simId:e})}async closeSim(e){return this.sendCommand({type:"close",simId:e})}async openPathInEditor(e,t,i){let s=t!=null?`:${t}${i!=null?`:${i}`:""}`:"",n=`${e}${s}`,c=(o,l)=>new Promise(d=>{try{let u=wt(o,l,{detached:!0,stdio:"ignore"}),p=!1;u.on("error",()=>{p||(p=!0,d(!1))}),u.on("spawn",()=>{p||(p=!0,u.unref(),d(!0))})}catch{d(!1)}}),r=process.env.REACT_EDITOR||process.env.EDITOR;if(r){let o=r.split(" ").filter(Boolean);if(o.length&&await c(o[0],[...o.slice(1),"-g",n]))return}await c("cursor",["-g",n])||await c("code",["-g",n])||await this.openUrl(e)}async openUrl(e,t={}){if(this.openUrlHandler){await this.openUrlHandler(e,t);return}await ge(e,t)}async close(){if(this.cliIdleTimer&&(clearInterval(this.cliIdleTimer),this.cliIdleTimer=null),this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null),this.devHeartbeatTimer&&(clearInterval(this.devHeartbeatTimer),this.devHeartbeatTimer=null),this.wsHeartbeatTimer&&(clearInterval(this.wsHeartbeatTimer),this.wsHeartbeatTimer=null),this.runtimeUpdateTimer&&(clearInterval(this.runtimeUpdateTimer),this.runtimeUpdateTimer=null),this.shouldWriteLockfile)try{j()}catch{}if(this.shouldWriteDevLockfile)try{oe({bridgePort:this.effectivePort,pid:process.pid,startedAt:this.startedAt})}catch{}this.effectivePort=0,this.startedAt=0,this.agentHost.close();for(let[i,s]of this.pendingCommands)s.reject(new Error("server closing")),this.pendingCommands.delete(i);for(let i of this.sims.values())i.ws.close();this.sims.clear(),this.primarySimId=null;let e=this.wss,t=this.httpServer;if(this.wss=null,this.httpServer=null,e)try{e.close()}catch{}if(t)try{t.close()}catch{}}describeSim(e){let t;try{t=e.ws.readyState}catch{t=S.CLOSED}let i=this.getActiveLease(e);return{id:e.id,origin:e.origin,url:e.url,title:e.title,userAgent:e.userAgent,connectedAt:e.connectedAt,lastSeenAt:e.lastSeenAt,lastActiveAt:e.lastActiveAt||void 0,isPrimary:e.id===this.primarySimId,readyState:t===S.OPEN?"open":t===S.CLOSING?"closing":"closed",attachedCliCount:this.getAttachedCliCount(e.id),lockedBy:i?i.cliLabel||i.cliIdentityKey:void 0,lockedByKind:i?i.kind:void 0,lockExpiresAt:i?i.expiresAt:void 0,userFocused:e.userFocused||void 0,userVisible:e.userVisible,visibilityState:e.visibilityState,documentFocused:e.documentFocused,kind:e.kind,meta:e.meta}}getActiveLease(e){let t=e.cliLease;return t?Date.now()>=t.expiresAt?(e.cliLease=void 0,null):t:null}tryAcquireLease(e,t,i={}){let s=this.cliIdentityKeyBySocket.get(e)??(()=>{let u=`ws-${this.nextCliFallbackId++}`;return this.cliIdentityKeyBySocket.set(e,u),u})(),n=this.cliLabelBySocket.get(e),c=Date.now(),r=this.getActiveLease(t),o=r&&r.cliIdentityKey===s,l=0;if(r&&!o&&!i.force)return{granted:!1,lease:r,lock:{by:r.cliLabel||r.cliIdentityKey,expiresInMs:Math.max(0,r.expiresAt-c)},bootedCount:0};if(r&&!o&&i.force)for(let[u,p]of this.cliSimBySocket){if(p!==t.id)continue;let m=this.cliIdentityKeyBySocket.get(u);if(m&&m!==s){this.cliSimBySocket.delete(u);try{u.close(1e3,"lease claimed by another cli")}catch{}l++}}let d={kind:"cli",cliIdentityKey:s,cliLabel:n,expiresAt:c+a.CLI_LEASE_TTL_MS};return t.cliLease=d,{granted:!0,lease:d,bootedCount:l}}updateUserFocusLease(e,t){let i=t.focused===!0,s=typeof t.visible=="boolean"?t.visible:void 0,n=typeof t.visibilityState=="string"?t.visibilityState:void 0,c=typeof t.documentFocused=="boolean"?t.documentFocused:void 0;e.userFocused===i&&e.userVisible===s&&e.visibilityState===n&&e.documentFocused===c||(e.userFocused=i,e.userVisible=s,e.visibilityState=n,e.documentFocused=c,this.broadcastSimClientStates())}updateUserActivity(e){let t=this.getActiveLease(e);if(t&&t.kind==="cli")return;let s=Date.now()+a.USER_ACTIVE_LEASE_TTL_MS,n=t&&t.kind==="user-active"?Math.max(t.expiresAt,s):s;e.cliLease={kind:"user-active",cliIdentityKey:"__user-active__",cliLabel:"active user",expiresAt:n},this.broadcastSimClientStates()}ensureCliIdentityKey(e){let t=this.cliIdentityKeyBySocket.get(e);if(t)return t;let i=`ws-${this.nextCliFallbackId++}`;return this.cliIdentityKeyBySocket.set(e,i),i}getOpenSim(e){if(e){let i=this.sims.get(e);return i?.ws.readyState===S.OPEN?i:null}let t=this.getDefaultSimCandidates();return t.find(i=>i.id===this.primarySimId)??t[0]??null}getDefaultSimCandidates(){let e=Array.from(this.sims.values()).filter(i=>i.ws.readyState===S.OPEN),t=e.filter(i=>i.url);return t.length>0?t:e}async waitForSim(e,t={}){let i=t.attempts??10,s=t.intervalMs??200;for(let c=0;c<i;c++){if(e){let r=this.getOpenSim(e);if(r)return r}else{let r=this.getDefaultSimCandidates();if(r.length>1)throw new Error(`multiple sims are connected: ${r.map(l=>l.id).join(", ")}; run \`rnxsim use <sim>\` or pass \`--sim <sim>\``);let o=r[0];if(o)return o}await new Promise(r=>setTimeout(r,s))}if(!e)throw new Error("no sim connected");let n=this.getDefaultSimCandidates().map(c=>c.id);throw new Error(`no sim connected with id ${e}`+(n.length>0?`; connected sims: ${n.join(", ")}`:""))}shouldPromoteSim(e){let t=this.primarySimId?this.sims.get(this.primarySimId):null;if(!e.url)return!t;let i=t?.ws.readyState===S.OPEN;if(!t||!i||!t.url)return!0;let s=e.origin?.includes(":5173"),n=t.origin?.includes(":5173");return!!s||!n}broadcastSimAssignments(){for(let e of this.sims.values())e.ws.readyState===S.OPEN&&e.ws.send(JSON.stringify({type:"bridge:welcome",simId:e.id,isPrimary:e.id===this.primarySimId}))}writeAndBroadcastSharedConfig(e){let t=Y(e),i=JSON.stringify({type:"bridge:shared-config-changed",config:t});for(let s of this.sims.values())if(s.ws.readyState===S.OPEN)try{s.ws.send(i)}catch{}return t}broadcastSimClientStates(){for(let e of this.sims.values()){if(e.ws.readyState!==S.OPEN)continue;let t=this.getActiveLease(e),i={type:"bridge:client-state",attachedCliCount:this.getAttachedCliCount(e.id),activeAgentCommandCount:this.getActiveAgentCommandCount(e.id),recentActions:e.recentActions,lockedBy:t?t.cliLabel||t.cliIdentityKey:void 0,lockedByKind:t?t.kind:void 0,lockExpiresAt:t?t.expiresAt:void 0,userFocused:e.userFocused||void 0,userVisible:e.userVisible,visibilityState:e.visibilityState,documentFocused:e.documentFocused};e.ws.send(JSON.stringify(i))}}setCliSimTarget(e,t){let i=this.cliSimBySocket.get(e);i!==t&&(this.cliSimBySocket.set(e,t),this.recordSimAction(t,i?"cli switched sims":"cli connected",!1),this.broadcastSimClientStates())}recordSimAction(e,t,i=!0){let s=t?.trim();if(!s)return;let n=this.sims.get(e);if(!n)return;let c=Date.now();n.lastActiveAt=c,n.recentActions=[{label:s,at:c},...n.recentActions.filter(r=>r.label!==s)].slice(0,4),i&&this.broadcastSimClientStates()}describeForwardedCommand(e){switch(e?.type){case"evaluate":return"evaluated page state";case"screenshot":return"captured screenshot";case"tap":return"sent tap event";case"keyboard":return e?.action==="type"?"typed text":"used keyboard";case"tree":return"dumped tree";case"focus":return"focused sim";case"close":return"requested close";default:return typeof e?.type=="string"?e.type:null}}getAttachedCliCount(e){let t=new Set;for(let[i,s]of this.cliSimBySocket){if(s!==e||i.readyState!==S.OPEN)continue;let n=this.cliIdentityKeyBySocket.get(i);t.add(n??`ws-unknown-${t.size}`)}return t.size}getOtherCliIdentityCount(e,t){let i=this.cliIdentityKeyBySocket.get(e),s=new Set;for(let[n,c]of this.cliSimBySocket){if(c!==t||n.readyState!==S.OPEN)continue;let r=this.cliIdentityKeyBySocket.get(n);r&&r===i||s.add(r??`ws-unknown-${s.size}`)}return s.size}getActiveAgentCommandCount(e){let t=0;for(let i of this.pendingCommands.values())i.simId===e&&t++;return t}allocateSimId(){for(;;){let e=this.nextSimNumber.toString(16);if(this.nextSimNumber++,!this.sims.has(e)&&!this.restorableSims.has(e))return e}}tryRestoreSimId(e,t){let i=t?.trim();if(!i||i===e.id)return!1;let s=this.sims.get(i);if(s&&s!==e&&s.ws.readyState===S.OPEN)return!1;let n=this.getRestorableSimState(i),c=e.id;this.sims.delete(c),e.id=i,n&&(e.recentActions=n.recentActions.map(r=>({...r})),e.lastActiveAt=n.lastActiveAt,e.cliLease=n.cliLease?{...n.cliLease}:void 0,this.restorableSims.delete(i)),this.sims.set(e.id,e),this.primarySimId===c&&(this.primarySimId=e.id);for(let[r,o]of this.cliSimBySocket)o===c&&this.cliSimBySocket.set(r,e.id);return!0}rememberDisconnectedSim(e){let t=this.getActiveLease(e);this.restorableSims.set(e.id,{recentActions:e.recentActions.map(i=>({...i})),lastActiveAt:e.lastActiveAt,cliLease:t&&t.kind==="cli"?{...t}:void 0,expiresAt:Date.now()+a.SIM_RECONNECT_TTL_MS}),this.sims.delete(e.id),this.writeConnectedRuntimeSnapshot()}getRestorableSimState(e){let t=this.restorableSims.get(e);return t?t.expiresAt<=Date.now()?(this.restorableSims.delete(e),null):(t.cliLease&&t.cliLease.expiresAt<=Date.now()&&(t.cliLease=void 0),t):null}sweepRestorableSims(e=Date.now()){for(let[t,i]of this.restorableSims)if(!(i.expiresAt>e)){this.restorableSims.delete(t);for(let[s,n]of this.cliSimBySocket)n===t&&this.cliSimBySocket.delete(s)}}resetServerState(){this.cliIdleTimer&&(clearInterval(this.cliIdleTimer),this.cliIdleTimer=null),this.wsHeartbeatTimer&&(clearInterval(this.wsHeartbeatTimer),this.wsHeartbeatTimer=null),this.runtimeUpdateTimer&&(clearInterval(this.runtimeUpdateTimer),this.runtimeUpdateTimer=null);let e=this.wss,t=this.httpServer;if(this.wss=null,this.httpServer=null,e)try{e.close()}catch{}if(t)try{t.close()}catch{}}};function _t(){return!!((process.env.XPC_SERVICE_NAME||"").includes("dev.sootsim.daemon")||process.env.INVOCATION_ID)}async function wi(a,e={}){(a.includes("--help")||a.includes("-h"))&&(console.log(`
26
+ rnxsim serve \u2014 run the rnx bridge in the foreground
27
+
28
+ hosts the WS bridge that CLI commands talk to. once running, any rnx
29
+ renderer (browser, electron, headless playwright) that connects to port 7668
30
+ becomes drivable from 'rnxsim describe', 'rnxsim do tap', etc.
31
+
32
+ usage:
33
+ rnxsim serve [options]
34
+
35
+ options:
36
+ --port <n> bridge port (defaults to ${7668})
37
+ --quiet suppress per-connection logging
38
+
39
+ examples:
40
+ rnxsim serve
41
+ rnxsim serve --port 7668 --quiet
42
+ `),process.exit(0));let t=a.indexOf("--port"),i=t>=0&&a[t+1]?Number(a[t+1]):e.port??7668;Number.isNaN(i)&&(console.error(` invalid --port value: ${a[t+1]}`),process.exit(1));let s=a.includes("--quiet")||a.includes("-q"),n=te();n&&ie(n)&&(console.error(` an rnx bridge is already running (pid ${n.pid}, port ${n.bridgePort})`),console.error(" stop it with 'rnxsim daemon stop' first"),process.exit(1)),x();let c=await Se(),r=new H({port:i,writeLockfile:!0,contrastOrigin:c}),o=await r.startAsync({silent:s}),l=Date.now(),d=f=>{s||process.stdout.write(`${f}
43
+ `)},u=new Set,p=setInterval(()=>{let f=r.listSims(),h=new Set(f.map(g=>g.id));for(let g of f)if(!u.has(g.id)){let v=g.title||g.url||g.origin||"(unknown)";d(` + ${g.id} ${v}`)}for(let g of u)h.has(g)||d(` - ${g}`);u.clear();for(let g of h)u.add(g)},500);ae({event:"daemon_heartbeat",properties:{bridge_port:o,under_daemon:_t(),platform:process.platform,subsource:"daemon"}}),ce(),d(`rnx bridge listening on ws://localhost:${o} (runtime http on same port)`),o!==i&&d(` (preferred port ${i} was taken \u2014 fell back to ${o})`),d(" ready for browser, electron, or headless playwright sims to connect"),d(" (ctrl-c to stop)");let m=async f=>{clearInterval(p),d(`
44
+ ${f} received \u2014 shutting down after ${Math.round((Date.now()-l)/1e3)}s`);try{await r.close()}catch{}process.exit(0)};process.on("SIGINT",()=>m("SIGINT")),process.on("SIGTERM",()=>m("SIGTERM")),process.on("SIGHUP",()=>m("SIGHUP")),process.on("exit",()=>{try{r.removeLockfile()}catch{}}),await new Promise(()=>{})}export{wi as runServe};
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.315 | (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 d}from"./chunk-5TPRP5QT.js";import{d as V,f as q,g as J,i as F,j as B}from"./chunk-WWZIXIRD.js";import{b as x,c as L}from"./chunk-5TEF3ET3.js";import{c as k}from"./chunk-IJO63TDP.js";import"./chunk-HI5TFJWN.js";import{f as y}from"./chunk-VFCMSYZK.js";import"./chunk-WMIIKMGK.js";import"./chunk-TIVZIMMW.js";import"./chunk-VNQEB4L7.js";import"./chunk-UC6U3MML.js";import"./chunk-2YR5BGA5.js";import"./chunk-4NPPOV2N.js";import"./chunk-IJ5CAZZC.js";import"./chunk-ZMJD5GEC.js";import{A as R,B as C,H as w,K as N,M as I,l as v}from"./chunk-FSUYIVJ6.js";import{a as T}from"./chunk-3NV2NCNX.js";import{a as s}from"./chunk-2D2UPBBR.js";import"./chunk-46EUUFJ5.js";import"./chunk-WINYQ44O.js";import $ from"node:fs";import z from"node:os";import P from"node:path";import{spawn as re}from"node:child_process";import l from"node:fs";import a from"node:path";function Y(e){let n=a.resolve(e);for(;;){if(l.existsSync(a.join(n,"package.json")))return n;let r=a.dirname(n);if(r===n)return null;n=r}}function j(e){let n=a.resolve(e);for(;;){if(l.existsSync(a.join(n,"bun.lock"))||l.existsSync(a.join(n,"bun.lockb")))return"bun";if(l.existsSync(a.join(n,"pnpm-lock.yaml")))return"pnpm";if(l.existsSync(a.join(n,"package-lock.json")))return"npm";let r=a.dirname(n);if(r===n)return"npm";n=r}}function H(e){let n=a.resolve(e.appDir),r=te(a.join(n,"package.json")),t=`${s.commandName} open`,o=r.scripts?.[s.commandName];if(o&&o!==t)throw new Error(`package.json already defines scripts.${s.commandName} as ${JSON.stringify(o)}; resolve that conflict before setup`);let i=j(n),c=[];return r.devDependencies?.[s.packageName]!==e.cliVersion&&c.push(oe(i,e.cliVersion)),o!==t&&c.push(ae(i)),{appDir:n,packageManager:i,operations:c}}async function U(e,n){for(let r of e.operations)n.dryRun||await se(r,e.appDir,n.json)}function O(e){return e.operations.map(n=>`${n.command} ${n.args.map(ie).join(" ")}`)}function te(e){let n;try{n=JSON.parse(l.readFileSync(e,"utf8"))}catch(o){let i=o instanceof Error?o.message:String(o);throw new Error(`could not read ${e}: ${i}`)}if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`${e} must contain a JSON object`);let r=W(Reflect.get(n,"scripts")),t=W(Reflect.get(n,"devDependencies"));return{...r?{scripts:r}:{},...t?{devDependencies:t}:{}}}function W(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let n=Object.entries(e).filter(r=>typeof r[1]=="string");return Object.fromEntries(n)}function oe(e,n){let r=`${s.packageName}@${n}`;switch(e){case"bun":return{command:"bun",args:["add","--dev","--exact",r],description:`install ${r} as an exact dev dependency`};case"pnpm":return{command:"pnpm",args:["add","--save-dev","--save-exact",r],description:`install ${r} as an exact dev dependency`};case"npm":return{command:"npm",args:["install","--save-dev","--save-exact",r],description:`install ${r} as an exact dev dependency`}}}function ie(e){return/^[a-zA-Z0-9_./@=-]+$/.test(e)?e:JSON.stringify(e)}function se(e,n,r){return new Promise((t,o)=>{let i=re(e.command,e.args,{cwd:n,stdio:r?["ignore",2,"inherit"]:"inherit"});i.once("error",o),i.once("exit",c=>{c===0?t():o(new Error(`${e.command} exited with code ${c??"unknown"}`))})})}function ae(e){return{command:e,args:e==="bun"?["pm","pkg","set",`scripts.${s.commandName}=${s.commandName} open`]:["pkg","set",`scripts.${s.commandName}=${s.commandName} open`],description:`add the \`${s.commandName}\` package script`}}async function Ye(e){if(e.includes("--help")||e.includes("-h")){je();return}let n=ue(e),r="decisions";try{let t=Y(n.appDir),o=x(),i=R(),c=await le(n,o),X=await de(n,t),g=await K(n,"productAnalytics",i.productAnalytics,i.configured),S=await K(n,"crashReports",i.crashReports,i.configured),ee=await y.fetchManifest(),f=y.resolveVersion(ee,{channel:"stable"}).version,A=T();if(A==="0.0.0")throw new Error("could not resolve the installed rnxsim CLI version");let p=null;X&&t&&(p=H({appDir:t,cliVersion:A})),he(n),be(n,o,c,f),ve(n,t,p),Re(n,g,S),r="runtime";let M=!1;if(!n.dryRun){let E=w();M=(await y.install({version:f,channel:"stable",setActive:!0,protectVersions:E?[E]:[]})).installed}r="repository",p&&await U(p,{dryRun:n.dryRun,json:n.json}),r="service";let h=o.installed;c&&!o.installed&&!n.dryRun&&(await L({port:7668,force:!1}),h=!0),r="privacy",n.dryRun||C({productAnalytics:g,crashReports:S}),r="compatibility";let u=t?me(t):null,b=await fe(n,u);b&&u&&t&&!n.dryRun&&await ye(t,u),we(n,u,b);let _={runtimeVersion:f,serviceInstalled:h,repositoryPrepared:p!==null,compatibilityShared:b&&!n.dryRun},ne=Se(f);n.json?console.log(JSON.stringify({..._,runtimeInstalled:n.dryRun?!1:M,dryRun:n.dryRun,cache:ne,repositoryOperations:p?O(p):[]},null,2)):ke(p);let m=u?q(u):null;return k({event:"cli_setup_completed",properties:{service_installed:h,repository_prepared:p!==null,product_analytics:g,crash_reports:S,compat_supported:m?.supported??0,compat_partial:m?.partial??0,compat_unsupported:m?.unsupported??0,compat_not_yet_verified:m?.notYetVerified??0,from_welcome:n.fromWelcome,ci:n.ci,dry_run:n.dryRun}}),_}catch(t){let o=xe(t);throw k({event:"cli_setup_failed",properties:{stage:r,message:o}}),t}}function pe(){let e=x(),n=N(),r=w();return{daemonSupported:e.supported,daemonInstalled:e.installed,daemonRunning:!!(n&&I(n)),runtimeInstalled:!!(r&&$.existsSync(v(r))),privacyConfigured:R().configured}}function He(e=pe()){return!e.runtimeInstalled||!e.privacyConfigured}function ue(e){let n=e.indexOf("--app"),r=n>=0?e[n+1]:void 0;if(n>=0&&(!r||r.startsWith("-")))throw new Error("--app requires a directory");let t=G(e,"--service","--no-service"),o=G(e,"--repo","--no-repo");return{appDir:P.resolve(r??process.cwd()),ci:e.includes("--ci"),dryRun:e.includes("--dry-run"),fromWelcome:e.includes("--from-welcome"),json:e.includes("--json"),yes:e.includes("--yes")||e.includes("-y"),service:t,repository:o,productAnalytics:Z(e,"--analytics"),crashReports:Z(e,"--crash-reports"),shareCompatibility:e.includes("--share-compat")}}function G(e,n,r){if(e.includes(n)&&e.includes(r))throw new Error(`${n} and ${r} cannot be used together`);if(e.includes(n))return!0;if(e.includes(r))return!1}function Z(e,n){let r=e.find(i=>i.startsWith(`${n}=`)),t=e.indexOf(n),o=r?.slice(n.length+1)??(t>=0?e[t+1]:void 0);if(o!==void 0){if(o==="on"||o==="yes"||o==="true")return!0;if(o==="off"||o==="no"||o==="false")return!1;throw new Error(`${n} must be on or off`)}}async function le(e,n){if(e.ci){if(e.service===!0)throw new Error("--ci cannot install a machine service");return!1}return n.supported?n.installed&&e.service===void 0?!0:e.service!==void 0?e.service:e.yes?!0:(D(e,"--service or --no-service"),d("Install the background service and shared managed runtime?",!0)):!1}async function de(e,n){if(!n){if(e.repository===!0)throw new Error("--repo requires a package.json");return!1}return e.repository!==void 0?e.repository:e.yes?!0:(D(e,"--repo or --no-repo"),d(`Prepare ${n} for reproducible rnx runs?`,!0))}async function K(e,n,r,t){let o=n==="productAnalytics"?e.productAnalytics:e.crashReports;return o!==void 0?o:t?r:e.yes?!0:(D(e,n==="productAnalytics"?"--analytics on|off":"--crash-reports on|off"),d(n==="productAnalytics"?"Share bounded product analytics?":"Send bounded crash reports?",!0))}async function fe(e,n){return n?e.shareCompatibility?!0:e.yes||!process.stdin.isTTY?!1:d("Share dependency names, requested versions, framework, and this compatibility result?",!1):!1}function D(e,n){if(!(process.stdin.isTTY&&!e.ci))throw new Error(`non-interactive setup requires ${n}, or --yes to accept defaults`)}function me(e){let n=JSON.parse($.readFileSync(P.join(e,"package.json"),"utf8"));if(!n||typeof n!="object")throw new Error("package.json must contain an object");return V(n)}async function ye(e,n){let r=JSON.parse($.readFileSync(P.join(e,"package.json"),"utf8"));if(!r||typeof r!="object")throw new Error("package.json must be an object");let t=await fetch("https://contrast.dev/api/scan",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(ge(r,n)),signal:AbortSignal.timeout(1e4)});if(!t.ok)throw new Error(`compatibility sharing failed with HTTP ${t.status}`)}function ge(e,n){return{dependencies:Q(Reflect.get(e,"dependencies")),devDependencies:Q(Reflect.get(e,"devDependencies")),framework:n.framework,result:{framework:n.framework,rnVersion:n.rnVersion,packages:n.packages.slice(0,200)},source:"desktop",shared:!0}}function Q(e){if(!e||typeof e!="object")return{};let n={};for(let[r,t]of Object.entries(e).slice(0,200))typeof t=="string"&&(n[r.slice(0,160)]=t.slice(0,80));return n}function Se(e){let n=z.platform(),r=z.arch();return{path:v(e),key:`sootsim-runtime-${n}-${r}-${e}`,inputs:{platform:n,arch:r,runtimeVersion:e}}}function he(e){e.json||console.log(`
4
+ import{a as d}from"./chunk-QR7MWAWE.js";import{d as V,f as q,g as J,i as F,j as B}from"./chunk-PVL7XSPN.js";import{b as x,c as L}from"./chunk-4LTBK3ZN.js";import{c as k}from"./chunk-J6HMTUZH.js";import"./chunk-WM32MGTJ.js";import{f as y}from"./chunk-LP2BTEJ6.js";import"./chunk-N5ZCYP5F.js";import"./chunk-H362IX2I.js";import"./chunk-O2KRHVTU.js";import"./chunk-RVM4EZ4E.js";import"./chunk-LT6UC7I3.js";import"./chunk-UROXJVY3.js";import"./chunk-6ZMRJPKI.js";import"./chunk-25VCR44B.js";import{C as R,D as C,J as w,M as N,O as I,l as v}from"./chunk-XOXGC3EH.js";import{a as T}from"./chunk-NCKAD3V7.js";import{a as s}from"./chunk-SZKSFMWS.js";import"./chunk-MSSY4EEZ.js";import"./chunk-26WMWUH4.js";import $ from"node:fs";import z from"node:os";import P from"node:path";import{spawn as re}from"node:child_process";import l from"node:fs";import a from"node:path";function Y(e){let n=a.resolve(e);for(;;){if(l.existsSync(a.join(n,"package.json")))return n;let r=a.dirname(n);if(r===n)return null;n=r}}function j(e){let n=a.resolve(e);for(;;){if(l.existsSync(a.join(n,"bun.lock"))||l.existsSync(a.join(n,"bun.lockb")))return"bun";if(l.existsSync(a.join(n,"pnpm-lock.yaml")))return"pnpm";if(l.existsSync(a.join(n,"package-lock.json")))return"npm";let r=a.dirname(n);if(r===n)return"npm";n=r}}function H(e){let n=a.resolve(e.appDir),r=te(a.join(n,"package.json")),t=`${s.commandName} open`,o=r.scripts?.[s.commandName];if(o&&o!==t)throw new Error(`package.json already defines scripts.${s.commandName} as ${JSON.stringify(o)}; resolve that conflict before setup`);let i=j(n),c=[];return r.devDependencies?.[s.packageName]!==e.cliVersion&&c.push(oe(i,e.cliVersion)),o!==t&&c.push(ae(i)),{appDir:n,packageManager:i,operations:c}}async function U(e,n){for(let r of e.operations)n.dryRun||await se(r,e.appDir,n.json)}function O(e){return e.operations.map(n=>`${n.command} ${n.args.map(ie).join(" ")}`)}function te(e){let n;try{n=JSON.parse(l.readFileSync(e,"utf8"))}catch(o){let i=o instanceof Error?o.message:String(o);throw new Error(`could not read ${e}: ${i}`)}if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`${e} must contain a JSON object`);let r=W(Reflect.get(n,"scripts")),t=W(Reflect.get(n,"devDependencies"));return{...r?{scripts:r}:{},...t?{devDependencies:t}:{}}}function W(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let n=Object.entries(e).filter(r=>typeof r[1]=="string");return Object.fromEntries(n)}function oe(e,n){let r=`${s.packageName}@${n}`;switch(e){case"bun":return{command:"bun",args:["add","--dev","--exact",r],description:`install ${r} as an exact dev dependency`};case"pnpm":return{command:"pnpm",args:["add","--save-dev","--save-exact",r],description:`install ${r} as an exact dev dependency`};case"npm":return{command:"npm",args:["install","--save-dev","--save-exact",r],description:`install ${r} as an exact dev dependency`}}}function ie(e){return/^[a-zA-Z0-9_./@=-]+$/.test(e)?e:JSON.stringify(e)}function se(e,n,r){return new Promise((t,o)=>{let i=re(e.command,e.args,{cwd:n,stdio:r?["ignore",2,"inherit"]:"inherit"});i.once("error",o),i.once("exit",c=>{c===0?t():o(new Error(`${e.command} exited with code ${c??"unknown"}`))})})}function ae(e){return{command:e,args:e==="bun"?["pm","pkg","set",`scripts.${s.commandName}=${s.commandName} open`]:["pkg","set",`scripts.${s.commandName}=${s.commandName} open`],description:`add the \`${s.commandName}\` package script`}}async function Ye(e){if(e.includes("--help")||e.includes("-h")){je();return}let n=ue(e),r="decisions";try{let t=Y(n.appDir),o=x(),i=R(),c=await le(n,o),X=await de(n,t),g=await K(n,"productAnalytics",i.productAnalytics,i.configured),S=await K(n,"crashReports",i.crashReports,i.configured),ee=await y.fetchManifest(),f=y.resolveVersion(ee,{channel:"stable"}).version,A=T();if(A==="0.0.0")throw new Error("could not resolve the installed rnxsim CLI version");let p=null;X&&t&&(p=H({appDir:t,cliVersion:A})),he(n),be(n,o,c,f),ve(n,t,p),Re(n,g,S),r="runtime";let M=!1;if(!n.dryRun){let E=w();M=(await y.install({version:f,channel:"stable",setActive:!0,protectVersions:E?[E]:[]})).installed}r="repository",p&&await U(p,{dryRun:n.dryRun,json:n.json}),r="service";let h=o.installed;c&&!o.installed&&!n.dryRun&&(await L({port:7668,force:!1}),h=!0),r="privacy",n.dryRun||C({productAnalytics:g,crashReports:S}),r="compatibility";let u=t?me(t):null,b=await fe(n,u);b&&u&&t&&!n.dryRun&&await ye(t,u),we(n,u,b);let _={runtimeVersion:f,serviceInstalled:h,repositoryPrepared:p!==null,compatibilityShared:b&&!n.dryRun},ne=Se(f);n.json?console.log(JSON.stringify({..._,runtimeInstalled:n.dryRun?!1:M,dryRun:n.dryRun,cache:ne,repositoryOperations:p?O(p):[]},null,2)):ke(p);let m=u?q(u):null;return k({event:"cli_setup_completed",properties:{service_installed:h,repository_prepared:p!==null,product_analytics:g,crash_reports:S,compat_supported:m?.supported??0,compat_partial:m?.partial??0,compat_unsupported:m?.unsupported??0,compat_not_yet_verified:m?.notYetVerified??0,from_welcome:n.fromWelcome,ci:n.ci,dry_run:n.dryRun}}),_}catch(t){let o=xe(t);throw k({event:"cli_setup_failed",properties:{stage:r,message:o}}),t}}function pe(){let e=x(),n=N(),r=w();return{daemonSupported:e.supported,daemonInstalled:e.installed,daemonRunning:!!(n&&I(n)),runtimeInstalled:!!(r&&$.existsSync(v(r))),privacyConfigured:R().configured}}function He(e=pe()){return!e.runtimeInstalled||!e.privacyConfigured}function ue(e){let n=e.indexOf("--app"),r=n>=0?e[n+1]:void 0;if(n>=0&&(!r||r.startsWith("-")))throw new Error("--app requires a directory");let t=G(e,"--service","--no-service"),o=G(e,"--repo","--no-repo");return{appDir:P.resolve(r??process.cwd()),ci:e.includes("--ci"),dryRun:e.includes("--dry-run"),fromWelcome:e.includes("--from-welcome"),json:e.includes("--json"),yes:e.includes("--yes")||e.includes("-y"),service:t,repository:o,productAnalytics:Z(e,"--analytics"),crashReports:Z(e,"--crash-reports"),shareCompatibility:e.includes("--share-compat")}}function G(e,n,r){if(e.includes(n)&&e.includes(r))throw new Error(`${n} and ${r} cannot be used together`);if(e.includes(n))return!0;if(e.includes(r))return!1}function Z(e,n){let r=e.find(i=>i.startsWith(`${n}=`)),t=e.indexOf(n),o=r?.slice(n.length+1)??(t>=0?e[t+1]:void 0);if(o!==void 0){if(o==="on"||o==="yes"||o==="true")return!0;if(o==="off"||o==="no"||o==="false")return!1;throw new Error(`${n} must be on or off`)}}async function le(e,n){if(e.ci){if(e.service===!0)throw new Error("--ci cannot install a machine service");return!1}return n.supported?n.installed&&e.service===void 0?!0:e.service!==void 0?e.service:e.yes?!0:(D(e,"--service or --no-service"),d("Install the background service and shared managed runtime?",!0)):!1}async function de(e,n){if(!n){if(e.repository===!0)throw new Error("--repo requires a package.json");return!1}return e.repository!==void 0?e.repository:e.yes?!0:(D(e,"--repo or --no-repo"),d(`Prepare ${n} for reproducible rnx runs?`,!0))}async function K(e,n,r,t){let o=n==="productAnalytics"?e.productAnalytics:e.crashReports;return o!==void 0?o:t?r:e.yes?!0:(D(e,n==="productAnalytics"?"--analytics on|off":"--crash-reports on|off"),d(n==="productAnalytics"?"Share bounded product analytics?":"Send bounded crash reports?",!0))}async function fe(e,n){return n?e.shareCompatibility?!0:e.yes||!process.stdin.isTTY?!1:d("Share dependency names, requested versions, framework, and this compatibility result?",!1):!1}function D(e,n){if(!(process.stdin.isTTY&&!e.ci))throw new Error(`non-interactive setup requires ${n}, or --yes to accept defaults`)}function me(e){let n=JSON.parse($.readFileSync(P.join(e,"package.json"),"utf8"));if(!n||typeof n!="object")throw new Error("package.json must contain an object");return V(n)}async function ye(e,n){let r=JSON.parse($.readFileSync(P.join(e,"package.json"),"utf8"));if(!r||typeof r!="object")throw new Error("package.json must be an object");let t=await fetch("https://contrast.dev/api/scan",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(ge(r,n)),signal:AbortSignal.timeout(1e4)});if(!t.ok)throw new Error(`compatibility sharing failed with HTTP ${t.status}`)}function ge(e,n){return{dependencies:Q(Reflect.get(e,"dependencies")),devDependencies:Q(Reflect.get(e,"devDependencies")),framework:n.framework,result:{framework:n.framework,rnVersion:n.rnVersion,packages:n.packages.slice(0,200)},source:"desktop",shared:!0}}function Q(e){if(!e||typeof e!="object")return{};let n={};for(let[r,t]of Object.entries(e).slice(0,200))typeof t=="string"&&(n[r.slice(0,160)]=t.slice(0,80));return n}function Se(e){let n=z.platform(),r=z.arch();return{path:v(e),key:`sootsim-runtime-${n}-${r}-${e}`,inputs:{platform:n,arch:r,runtimeVersion:e}}}function he(e){e.json||console.log(`
5
5
  ${e.fromWelcome?"welcome to rnx":"rnxsim setup"}`)}function be(e,n,r,t){e.json||(console.log(`
6
6
  1. machine`),console.log(` stable runtime: ${t}`),console.log(` background service: ${n.supported?r?"install":"skip":"unsupported on this platform"}`))}function ve(e,n,r){if(!e.json){if(console.log(`
7
7
  2. repository`),!n){console.log(" no package.json found; repository preparation skipped");return}if(!r){console.log(` skipped for ${n}`);return}console.log(` package manager: ${j(n)}`);for(let t of O(r))console.log(` ${e.dryRun?"would run":"run"}: ${t}`)}}function Re(e,n,r){e.json||(console.log(`
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.315 | (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 h}from"./chunk-2D2UPBBR.js";import"./chunk-WINYQ44O.js";import*as l from"fs";import*as L from"os";import*as a from"path";import{fileURLToPath as x}from"url";function D(){try{let e=x(import.meta.resolve(`${h.packageName}/package.json`));return a.join(a.dirname(e),"skills")}catch{let e=a.dirname(x(import.meta.url));return a.resolve(e,"../../skills")}}var d=D(),j=new Set(["all","codex","claude"]);function S(){console.log(`rnxsim skill
4
+ import{a as h}from"./chunk-SZKSFMWS.js";import"./chunk-26WMWUH4.js";import*as l from"fs";import*as L from"os";import*as a from"path";import{fileURLToPath as x}from"url";function D(){try{let e=x(import.meta.resolve(`${h.packageName}/package.json`));return a.join(a.dirname(e),"skills")}catch{let e=a.dirname(x(import.meta.url));return a.resolve(e,"../../skills")}}var d=D(),j=new Set(["all","codex","claude"]);function S(){console.log(`rnxsim skill
5
5
 
6
6
  install and inspect bundled rnx agent skills.
7
7
 
@@ -0,0 +1,14 @@
1
+ /*! rnx v0.1.315 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import{m as a}from"./chunk-KQSJVNFE.js";import"./chunk-WUXCH6WN.js";import{q as c,s as l}from"./chunk-UROXJVY3.js";import"./chunk-6ZMRJPKI.js";import"./chunk-XOXGC3EH.js";import"./chunk-26WMWUH4.js";function g(t){return!!t&&typeof t=="object"&&typeof Reflect.get(t,"capturedAt")=="number"}function p(){console.log(`
5
+ rnxsim state - capture the current app state in one call
6
+
7
+ usage:
8
+ rnxsim state [--json] [--sim <id>]
9
+
10
+ options:
11
+ --json print the complete structured result, including the screenshot
12
+ --sim <id> target a specific sim
13
+ --port <p> WS bridge port
14
+ `)}async function m(t,u={}){if(t.includes("--help")||t.includes("-h"))return p(),0;let o=c(t,{port:u.port,stripBooleanFlags:["--json"]});if(o.positional.length>0)return console.error(` unexpected state argument: ${o.positional[0]}`),1;let n=l(o);try{let e=await n.send({type:"state"});if(!g(e))throw new Error("state bridge returned an invalid result");if(t.includes("--json"))return console.log(JSON.stringify(e)),0;let r=e.route;if(console.log(` route: ${r?.screen??r?.url??"(unknown)"}`),r?.stack?.length&&console.log(` stack: ${r.stack.join(" > ")}`),console.log(` keyboard: ${e.keyboard?.visible?"visible":"hidden"}`),console.log(""),console.log(typeof e.tree=="string"?e.tree:JSON.stringify(e.tree)),console.log(""),e.recentErrors?.length){console.log(` recent errors (${e.recentErrors.length}):`);for(let i of e.recentErrors)console.log(` [${i.level}] ${i.text}`)}else console.log(" recent errors: none");let s=typeof e.screenshot=="string"?e.screenshot.length:0;return console.log(s>0?` screenshot: captured (${s} characters; use --json to read it)`:" screenshot: unavailable"),0}catch(e){return console.error(` state failed: ${e instanceof Error?e.message:e}`),await a(n),1}finally{n.close()}}export{m as runState};
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.315 | (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{j as f}from"./chunk-VZXWHRUZ.js";import"./chunk-OHAZNXLK.js";import"./chunk-GGRX24GF.js";import"./chunk-BTWORNNG.js";import"./chunk-NMF2ZMZQ.js";import"./chunk-7GN3LVWB.js";import"./chunk-GASE6UBA.js";import"./chunk-MJRLLB4R.js";import"./chunk-XEVZYVIW.js";import{a as s,b as l,c as t,d as c,e as a}from"./chunk-WUSWBCWA.js";import"./chunk-5DHC6KHQ.js";import"./chunk-DCEMHR2Y.js";import"./chunk-WF3T4SVI.js";import"./chunk-YIFT42WN.js";import"./chunk-DZS6WPUI.js";import"./chunk-G2WW6L2C.js";import"./chunk-YDGQTMQL.js";import"./chunk-KTHV3RUS.js";import"./chunk-NFK7T35W.js";import"./chunk-RTN5C5RL.js";import"./chunk-VFCMSYZK.js";import"./chunk-VNQEB4L7.js";import"./chunk-UC6U3MML.js";import"./chunk-2YR5BGA5.js";import"./chunk-4NPPOV2N.js";import"./chunk-IJ5CAZZC.js";import"./chunk-ZMJD5GEC.js";import"./chunk-FSUYIVJ6.js";import"./chunk-2D2UPBBR.js";import"./chunk-WINYQ44O.js";function p(){console.log(`
4
+ import{b as t,c as l,d as c,e as a,f}from"./chunk-QR3HTFRB.js";import{a as s}from"./chunk-BPCDO7ST.js";import"./chunk-KQSJVNFE.js";import"./chunk-WUXCH6WN.js";import"./chunk-UROXJVY3.js";import"./chunk-6ZMRJPKI.js";import"./chunk-XOXGC3EH.js";import"./chunk-26WMWUH4.js";function p(){console.log(`
5
5
  rnxsim storage profile \u2014 manage isolated storage profiles
6
6
 
7
7
  usage:
@@ -21,17 +21,17 @@ examples:
21
21
  rnxsim open 8081 --profile qa --driver playwright
22
22
  rnxsim storage profile clear qa
23
23
  rnxsim storage profile delete qa
24
- `)}async function d(r,n){if(r.includes("--help")||r.includes("-h"))return p(),0;let o=r[0]??"ls";try{switch(o){case"ls":case"list":{let e=s();for(let i of e)console.log(` ${i.id}`);return 0}case"create":{let e=r[1];if(!e)return console.error(" profile create expects <id>"),1;let i=t(e);return console.log(` created profile: ${i.id}`),0}case"ensure":{let e=r[1];if(!e)return console.error(" profile ensure expects <id>"),1;let i=l(e);return console.log(` profile: ${i.id}`),0}case"clear":{let e=r[1];return e?(l(e),a(e),console.log(` cleared profile: ${e}`),0):(console.error(" profile clear expects <id>"),1)}case"delete":case"rm":{let e=r[1];if(!e)return console.error(" profile delete expects <id>"),1;let i=c(e);return console.log(` deleted profile: ${i.id}`),0}default:return console.error(` unknown profile command: ${o}`),p(),1}}catch(e){return console.error(` profile failed: ${e instanceof Error?e.message:String(e)}`),1}}var m=new Set(["--sim","--port","-p"]),g=new Set(["profile","clear"]);function x(r){for(let n=0;n<r.length;n++){let o=r[n];if(o.startsWith("-")){m.has(o)&&n++;continue}return g.has(o)?{name:o,index:n}:null}return null}function u(){console.log(`
24
+ `)}async function d(r,n){if(r.includes("--help")||r.includes("-h"))return p(),0;let o=r[0]??"ls";try{switch(o){case"ls":case"list":{let e=t();for(let i of e)console.log(` ${i.id}`);return 0}case"create":{let e=r[1];if(!e)return console.error(" profile create expects <id>"),1;let i=c(e);return console.log(` created profile: ${i.id}`),0}case"ensure":{let e=r[1];if(!e)return console.error(" profile ensure expects <id>"),1;let i=l(e);return console.log(` profile: ${i.id}`),0}case"clear":{let e=r[1];return e?(l(e),f(e),console.log(` cleared profile: ${e}`),0):(console.error(" profile clear expects <id>"),1)}case"delete":case"rm":{let e=r[1];if(!e)return console.error(" profile delete expects <id>"),1;let i=a(e);return console.log(` deleted profile: ${i.id}`),0}default:return console.error(` unknown profile command: ${o}`),p(),1}}catch(e){return console.error(` profile failed: ${e instanceof Error?e.message:String(e)}`),1}}var m=new Set(["--sim","--port","-p"]),g=new Set(["profile","clear"]);function x(r){for(let n=0;n<r.length;n++){let o=r[n];if(o.startsWith("-")){m.has(o)&&n++;continue}return g.has(o)?{name:o,index:n}:null}return null}function u(){console.log(`
25
25
  rnxsim storage \u2014 manage sim and app storage
26
26
 
27
27
  usage:
28
28
  rnxsim storage profile <subcommand>
29
- rnxsim storage clear [--sim <id>] [--json]
29
+ rnxsim storage clear [--full] [--sim <id>] [--json]
30
30
 
31
31
  subcommands:
32
32
  profile ls
33
33
  profile create <id>
34
34
  profile clear <id>
35
35
  profile delete <id>
36
- clear clear the current guest app storage and reload it
37
- `)}async function w(r,n){if(r.includes("--help")||r.includes("-h"))return u(),0;let o=x(r);return o?.name==="profile"?d([...r.slice(0,o.index),...r.slice(o.index+1)],n):o?.name==="clear"?(await f(["storage-clear",...r.slice(0,o.index),...r.slice(o.index+1)],n),typeof process.exitCode=="number"?process.exitCode:0):(console.error(` unknown storage command: ${o?.name??"(missing)"}`),u(),1)}export{w as runStorage};
36
+ clear clear the current guest app data and relaunch it
37
+ `)}async function w(r,n){if(r.includes("--help")||r.includes("-h"))return u(),0;let o=x(r);return o?.name==="profile"?d([...r.slice(0,o.index),...r.slice(o.index+1)],n):o?.name==="clear"?s([...r.slice(0,o.index),...r.slice(o.index+1)],n):(console.error(` unknown storage command: ${o?.name??"(missing)"}`),u(),1)}export{w as runStorage};
@@ -0,0 +1,4 @@
1
+ /*! rnx v0.1.315 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import{a}from"./chunk-FNTTIR2P.js";import"./chunk-LT6UC7I3.js";import"./chunk-26WMWUH4.js";export{a as settingsStore};
@@ -0,0 +1,4 @@
1
+ /*! rnx v0.1.315 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import{c as a,d as b}from"./chunk-J6HMTUZH.js";import"./chunk-WM32MGTJ.js";import"./chunk-XOXGC3EH.js";import"./chunk-26WMWUH4.js";export{b as flushCliTelemetry,a as trackCliEvent};
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.315 | (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{h as m,j as d,m as i}from"./chunk-KTHV3RUS.js";import"./chunk-4NPPOV2N.js";import"./chunk-IJ5CAZZC.js";import"./chunk-FSUYIVJ6.js";import"./chunk-WINYQ44O.js";import{writeFileSync as g}from"fs";function u(){console.log(`
4
+ import{q as m,s as d,v as i}from"./chunk-UROXJVY3.js";import"./chunk-6ZMRJPKI.js";import"./chunk-XOXGC3EH.js";import"./chunk-26WMWUH4.js";import{writeFileSync as g}from"fs";function u(){console.log(`
5
5
  rnxsim timeline \u2014 control the semantic event timeline
6
6
 
7
7
  usage:
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.315 | (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 h,b as v,c as $}from"./chunk-RSZWCKNT.js";import{b as p}from"./chunk-G2WW6L2C.js";import"./chunk-YDGQTMQL.js";import"./chunk-KTHV3RUS.js";import{b as g}from"./chunk-VFCMSYZK.js";import"./chunk-4NPPOV2N.js";import"./chunk-IJ5CAZZC.js";import{H as a,g as m,h as u,l as d}from"./chunk-FSUYIVJ6.js";import{a as f}from"./chunk-3NV2NCNX.js";import"./chunk-2D2UPBBR.js";import"./chunk-WINYQ44O.js";import{spawn as y}from"node:child_process";import x from"node:fs";import R from"node:os";import s from"node:path";var b="https://registry.npmjs.org/rnxsim/latest";async function W(t){let n=t.indexOf("--channel"),e=n>=0&&t[n+1]?t[n+1]:void 0;console.log(`rnxsim upgrade
4
+ import{a as h,b as v,c as $}from"./chunk-JZ6VTZ5B.js";import{b as p}from"./chunk-XSSHENNY.js";import"./chunk-YY24QI25.js";import{b as g}from"./chunk-LP2BTEJ6.js";import"./chunk-UROXJVY3.js";import"./chunk-6ZMRJPKI.js";import{J as a,g as m,h as u,l as d}from"./chunk-XOXGC3EH.js";import{a as f}from"./chunk-NCKAD3V7.js";import"./chunk-SZKSFMWS.js";import"./chunk-26WMWUH4.js";import{spawn as y}from"node:child_process";import x from"node:fs";import R from"node:os";import s from"node:path";var b="https://registry.npmjs.org/rnxsim/latest";async function W(t){let n=t.indexOf("--channel"),e=n>=0&&t[n+1]?t[n+1]:void 0;console.log(`rnxsim upgrade
5
5
  `),console.log("runtime:");let o=a(),{config:l}=await p(),r=l?.runtimeVersion,c=r?x.existsSync(s.join(d(r),"index.html")):!1;r&&console.log(` project config: v${r}`);let i=(r&&c?null:await $(["install",...r?[r,"--set-active=false"]:[],...e?["--channel",e]:[]],{}))?.version??r??a();i&&console.log(r?c?` result: v${i} already installed for this project`:` result: not installed \u2192 v${i} for this project`:o&&o!==i?` result: v${o} \u2192 v${i}`:o?` result: v${i} already current`:` result: not installed \u2192 v${i}`);let k=i?await h(i):null;console.log(`
6
6
  cli:`),await j(),i&&console.log(`
7
7
  ${v(i,k)}`)}function w(){if(u())return{kind:"dev"};let t=process.argv[1]??"";try{t=x.realpathSync(t)}catch{}let n=s.sep;if(t.includes(`${n}_npx${n}`)||t.includes(`${n}.bunx${n}`))return{kind:"npx"};if(t.includes(`${n}.bun${n}`))return{kind:"global",command:"bun",args:["add","-g","rnxsim@latest"]};if(t.includes(`${n}pnpm${n}`))return{kind:"global",command:"pnpm",args:["add","-g","rnxsim@latest"]};let e=s.join(m(),"cli");if(t.startsWith(`${e}${n}`))return{kind:"global",command:"npm",args:["i","-g","--prefix",e,"rnxsim@latest"]};let o=s.resolve(process.env.SOOTSIM_CLI_PREFIX||s.join(R.homedir(),".local"));return t.startsWith(`${o}${n}`)?{kind:"global",command:"npm",args:["i","-g","--prefix",o,"rnxsim@latest"]}:{kind:"global",command:"npm",args:["i","-g","rnxsim@latest"]}}async function j(){let t=f(),n=await C();if(!n){console.log(` v${t} \u2014 couldn't reach the npm registry, skipped`);return}if(g(n,t)<=0){console.log(` v${t} (latest)`);return}let e=w();if(console.log(` v${t} \u2192 v${n}`),e.kind==="dev"){console.log(" running from the Contrast dev checkout \u2014 pull instead of upgrading");return}if(e.kind==="npx"){console.log(" running from the npx cache \u2014 get the latest with:"),console.log(" npx rnxsim@latest");return}let o=`${e.command} ${e.args.join(" ")}`;console.log(` updating global install (${o})\u2026`),await S(e.command,e.args)?console.log(` updated to v${n}`):(console.log(" update failed \u2014 run it yourself:"),console.log(` ${o}`))}function S(t,n){return new Promise(e=>{let o=y(t,n,{stdio:"inherit"});o.on("error",()=>e(!1)),o.on("exit",l=>e(l===0))})}async function C(){try{let t=await fetch(b,{headers:{accept:"application/json"},signal:AbortSignal.timeout(8e3)});if(!t.ok)return null;let n=await t.json();return typeof n.version=="string"&&n.version?n.version:null}catch{return null}}export{W as runUpgrade};
@@ -0,0 +1,4 @@
1
+ /*! rnx v0.1.315 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import{e as a,f as b,g as c}from"./chunk-MCKQH4AM.js";import"./chunk-56H6EVO4.js";import"./chunk-2POODCTW.js";import"./chunk-ZWX6DDIS.js";import"./chunk-YY24QI25.js";import"./chunk-PVPAP3TV.js";import"./chunk-J6HMTUZH.js";import"./chunk-WM32MGTJ.js";import"./chunk-UROXJVY3.js";import"./chunk-6ZMRJPKI.js";import"./chunk-XOXGC3EH.js";import"./chunk-SZKSFMWS.js";import"./chunk-26WMWUH4.js";export{a as resolveDefaultUploadOrigin,b as resolvePublicPreviewOrigin,c as runUpload};
@@ -0,0 +1,6 @@
1
+ /*! rnx v0.1.315 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import{b as a}from"./chunk-XSSHENNY.js";import"./chunk-YY24QI25.js";import{d as s,f as t}from"./chunk-LP2BTEJ6.js";import{a as m}from"./chunk-H362IX2I.js";import"./chunk-UROXJVY3.js";import"./chunk-6ZMRJPKI.js";import{l as r}from"./chunk-XOXGC3EH.js";import{a as l}from"./chunk-NCKAD3V7.js";import"./chunk-SZKSFMWS.js";import"./chunk-26WMWUH4.js";import g from"node:fs";import d from"node:path";async function R($){let{IS_BETA:c,BETA_LABEL:u}=await import("./beta-LWUVCPYK.js"),f=c?` \xB7 ${u}`:"";console.log(`rnxsim v${l()}${f}`);let o=m(),n=t.resolveChannel();o.isDevBridge?(console.log(o.primary),o.installedRuntime&&console.log(`${o.installedRuntime} \xB7 ${n}`)):o.primary==="runtime not installed"?console.log("runtime not installed \u2014 run `rnxsim runtime install`"):console.log(`${o.primary} \xB7 ${n}`);let{config:i}=await a();if(i?.runtimeVersion){let p=g.existsSync(d.join(r(i.runtimeVersion),"index.html"));console.log(`project runtime v${i.runtimeVersion} \xB7 configured \xB7 ${p?"installed":"installs on open"}`)}let e=await t.checkUpToDate({channel:n});e.outdated&&e.latest&&console.log(`
5
+ \u2191 default runtime v${e.latest} available; run \`rnxsim upgrade\``),console.log(`
6
+ what's new: ${s}`)}export{R as runVersion};
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.315 | (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,b,c,d,e,f,g,h,i,j}from"./chunk-WWZIXIRD.js";import"./chunk-WINYQ44O.js";export{b as COMPAT_CATEGORIES,j as COMPAT_RESULT_CAVEAT,c as POLYFILL_REGISTRY,a as UNSUPPORTABLE,f as countScanResults,i as formatDetailedScanLines,h as formatPackageStatus,g as formatScanCounts,d as scanDeps,e as scanDepsWithData};
4
+ import{a,b,c,d,e,f,g,h,i,j}from"./chunk-PVL7XSPN.js";import"./chunk-26WMWUH4.js";export{b as COMPAT_CATEGORIES,j as COMPAT_RESULT_CAVEAT,c as POLYFILL_REGISTRY,a as UNSUPPORTABLE,f as countScanResults,i as formatDetailedScanLines,h as formatPackageStatus,g as formatScanCounts,d as scanDeps,e as scanDepsWithData};