rnxsim 0.1.355 → 0.1.357

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 (175) hide show
  1. package/cli/bridge-flow-runner.ts +73 -24
  2. package/cli/commands/maestro.ts +9 -4
  3. package/dist-cli/bin.js +5 -5
  4. package/dist-cli/chunks/{agent-2MW7ZKUX.js → agent-25KBHAYX.js} +2 -2
  5. package/dist-cli/chunks/{agent-wrapper-XYQBKV24.js → agent-wrapper-X37YZWQJ.js} +2 -2
  6. package/dist-cli/chunks/{app-fonts-SXIZFMPY.js → app-fonts-WTMGAP6A.js} +2 -2
  7. package/dist-cli/chunks/{assert-R324GCRG.js → assert-ERBO4GF4.js} +2 -2
  8. package/dist-cli/chunks/{auth-INKYLYRZ.js → auth-SGBXZ5FH.js} +2 -2
  9. package/dist-cli/chunks/{beta-BQHBSKA5.js → beta-R7AGWYWM.js} +2 -2
  10. package/dist-cli/chunks/{camera-UPRFBRPF.js → camera-SQOGGHFO.js} +2 -2
  11. package/dist-cli/chunks/{chunk-MKHCGQSF.js → chunk-2Q7NEG5N.js} +1 -1
  12. package/dist-cli/chunks/{chunk-Y3D3DCQV.js → chunk-3L354AJB.js} +2 -2
  13. package/dist-cli/chunks/chunk-457HKQC5.js +4 -0
  14. package/dist-cli/chunks/{chunk-JYQNEVHV.js → chunk-45C2CATW.js} +2 -2
  15. package/dist-cli/chunks/{chunk-247ZSWTI.js → chunk-5ABAY2EO.js} +2 -2
  16. package/dist-cli/chunks/{chunk-VEMZUXVR.js → chunk-5O3YY3ND.js} +1 -1
  17. package/dist-cli/chunks/{chunk-2Z2S3C6A.js → chunk-6B6AUNDN.js} +2 -2
  18. package/dist-cli/chunks/{chunk-JP2YS7LC.js → chunk-6HKVEKUJ.js} +1 -1
  19. package/dist-cli/chunks/{chunk-42LIUAHU.js → chunk-7EF3WPYK.js} +2 -2
  20. package/dist-cli/chunks/{chunk-FDI226G4.js → chunk-7IX7MUYY.js} +2 -2
  21. package/dist-cli/chunks/{chunk-KLVSEUJP.js → chunk-AP4BKCUM.js} +2 -2
  22. package/dist-cli/chunks/{chunk-BUOAYILA.js → chunk-AQ7WM5OT.js} +4 -4
  23. package/dist-cli/chunks/{chunk-X36BQCH5.js → chunk-BH52OY5L.js} +2 -2
  24. package/dist-cli/chunks/{chunk-NCF3QNJG.js → chunk-BMDJOFQ6.js} +2 -2
  25. package/dist-cli/chunks/{chunk-VWPXXB6U.js → chunk-CDKGEP4S.js} +1 -1
  26. package/dist-cli/chunks/{chunk-F6S4Z7N7.js → chunk-CTCFJXNY.js} +1 -1
  27. package/dist-cli/chunks/{chunk-PYSIEEKP.js → chunk-EJHPODIL.js} +1 -1
  28. package/dist-cli/chunks/{chunk-XFPGXEKW.js → chunk-ETRUMVNS.js} +1 -1
  29. package/dist-cli/chunks/{chunk-TADYO7TY.js → chunk-EUQ4DZYZ.js} +2 -2
  30. package/dist-cli/chunks/{chunk-ZNWLFYZK.js → chunk-FFVJI44X.js} +2 -2
  31. package/dist-cli/chunks/{chunk-JE6NXNGL.js → chunk-FR7SP7K5.js} +3 -3
  32. package/dist-cli/chunks/{chunk-FFNFGVGH.js → chunk-GTG7DFS4.js} +2 -2
  33. package/dist-cli/chunks/{chunk-CK3M7MAL.js → chunk-GWCHA7JF.js} +2 -2
  34. package/dist-cli/chunks/{chunk-ZOFRHAGX.js → chunk-H4Z4BNMN.js} +1 -1
  35. package/dist-cli/chunks/{chunk-EQEEPP5A.js → chunk-H527SGF4.js} +2 -2
  36. package/dist-cli/chunks/{chunk-ZQF3PK76.js → chunk-HB7NJOU6.js} +2 -2
  37. package/dist-cli/chunks/{chunk-FF2CEKZF.js → chunk-HDOSUTQZ.js} +2 -2
  38. package/dist-cli/chunks/{chunk-QYIT7H6Q.js → chunk-HSI44CRA.js} +2 -2
  39. package/dist-cli/chunks/{chunk-SJEAA2FW.js → chunk-HVKQHXHS.js} +2 -2
  40. package/dist-cli/chunks/{chunk-LJCBPR7S.js → chunk-HXXKL7NU.js} +2 -2
  41. package/dist-cli/chunks/{chunk-XZJNPATS.js → chunk-IFR5DTTH.js} +2 -2
  42. package/dist-cli/chunks/{chunk-S4K3TDYB.js → chunk-IQVELPAH.js} +2 -2
  43. package/dist-cli/chunks/{chunk-GE7GYFE4.js → chunk-JGZBATDJ.js} +2 -2
  44. package/dist-cli/chunks/{chunk-N532KCKW.js → chunk-JX54MDZ3.js} +2 -2
  45. package/dist-cli/chunks/{chunk-6EC3D5IG.js → chunk-LFHZHHVR.js} +1 -1
  46. package/dist-cli/chunks/{chunk-IJGL6T4M.js → chunk-N3V5KXWQ.js} +2 -2
  47. package/dist-cli/chunks/{chunk-IAVHAWDL.js → chunk-NKJ3KBIE.js} +1 -1
  48. package/dist-cli/chunks/{chunk-23TG7DLH.js → chunk-Q6PIUOKR.js} +1 -1
  49. package/dist-cli/chunks/{chunk-FPWDC2DE.js → chunk-QEZSA6YG.js} +1 -1
  50. package/dist-cli/chunks/chunk-QF32P3FB.js +535 -0
  51. package/dist-cli/chunks/{chunk-Y5BP72QO.js → chunk-RGSHPACG.js} +1 -1
  52. package/dist-cli/chunks/{chunk-W3QLC24Z.js → chunk-RHNPXHEQ.js} +2 -2
  53. package/dist-cli/chunks/{chunk-GWL4KMTK.js → chunk-SNHVPXFJ.js} +2 -2
  54. package/dist-cli/chunks/{chunk-S27I7H2K.js → chunk-SZYAIXGI.js} +1 -1
  55. package/dist-cli/chunks/{chunk-SEWNI4GS.js → chunk-TUA2TD6R.js} +1 -1
  56. package/dist-cli/chunks/{chunk-GFDFVKVW.js → chunk-VGVIM2ES.js} +1 -1
  57. package/dist-cli/chunks/{chunk-MCAQZI3R.js → chunk-VJWXHO4E.js} +1 -1
  58. package/dist-cli/chunks/{chunk-QWJD2CAJ.js → chunk-VSDVVJ7I.js} +1 -1
  59. package/dist-cli/chunks/{chunk-LQEC53JM.js → chunk-W3OQUICE.js} +2 -2
  60. package/dist-cli/chunks/{chunk-AY4OA5UI.js → chunk-WCVSGYRT.js} +2 -2
  61. package/dist-cli/chunks/{chunk-7URIRES5.js → chunk-XX4CRR6G.js} +2 -2
  62. package/dist-cli/chunks/{chunk-WUYI4PVY.js → chunk-YFTFLUVJ.js} +1 -1
  63. package/dist-cli/chunks/{chunk-CRE3V3EG.js → chunk-YKHS3Y3T.js} +1 -1
  64. package/dist-cli/chunks/{chunk-6WCDWBG6.js → chunk-YRCWQST2.js} +2 -2
  65. package/dist-cli/chunks/{chunk-EZXNGHZT.js → chunk-ZMUPTNFI.js} +2 -2
  66. package/dist-cli/chunks/{chunk-CUXVUSZS.js → chunk-ZPOC7RZV.js} +2 -2
  67. package/dist-cli/chunks/{cleanup-5FGGUP6U.js → cleanup-GXRSMHAO.js} +2 -2
  68. package/dist-cli/chunks/cli-version-XAFFRJCZ.js +4 -0
  69. package/dist-cli/chunks/{compat-J4OEALGF.js → compat-XAJSKUFI.js} +2 -2
  70. package/dist-cli/chunks/{config-MCH2R7WG.js → config-VOJFXKDM.js} +2 -2
  71. package/dist-cli/chunks/{control-NPWFRKZS.js → control-24QDU2II.js} +2 -2
  72. package/dist-cli/chunks/daemon-DDPZIQWD.js +4 -0
  73. package/dist-cli/chunks/{debug-7NHPYUX6.js → debug-EZIUTBJM.js} +3 -3
  74. package/dist-cli/chunks/{desktop-EIBJC5EU.js → desktop-LWALKHND.js} +3 -3
  75. package/dist-cli/chunks/{detox-ZFEQKHDT.js → detox-SEOITHO2.js} +2 -2
  76. package/dist-cli/chunks/{device-JM7QMQFQ.js → device-CSFCTE77.js} +2 -2
  77. package/dist-cli/chunks/{diagnose-DCMU2GAD.js → diagnose-LTD2GRQ4.js} +2 -2
  78. package/dist-cli/chunks/{disk-cleanup-RPW5MYGM.js → disk-cleanup-T5B5HVFI.js} +2 -2
  79. package/dist-cli/chunks/drivers-QKUIB32J.js +4 -0
  80. package/dist-cli/chunks/{film-NRGBZSC7.js → film-TTSCLCET.js} +3 -3
  81. package/dist-cli/chunks/flow-IQYYMCWP.js +4 -0
  82. package/dist-cli/chunks/help-3ZWJFCV5.js +4 -0
  83. package/dist-cli/chunks/{hidden-runtime-alias-GSZG7QFD.js → hidden-runtime-alias-S24KDRUW.js} +2 -2
  84. package/dist-cli/chunks/{home-paths-OGXLRRTG.js → home-paths-GG5N4VTM.js} +2 -2
  85. package/dist-cli/chunks/inspect-QQ7FWRVH.js +4 -0
  86. package/dist-cli/chunks/install-desktop-BY43USLI.js +4 -0
  87. package/dist-cli/chunks/{login-A7JSAMON.js → login-U3PVPLJM.js} +2 -2
  88. package/dist-cli/chunks/{logout-EBUWNT63.js → logout-4AUOJIP2.js} +2 -2
  89. package/dist-cli/chunks/{maestro-OEXXVYMW.js → maestro-XUXCXSYO.js} +18 -13
  90. package/dist-cli/chunks/{maestro-generate-DKH6IUTC.js → maestro-generate-2EATF4J6.js} +3 -3
  91. package/dist-cli/chunks/{mode-YKX2UTBX.js → mode-4RCORGOE.js} +2 -2
  92. package/dist-cli/chunks/{optional-demo-registry-W4Z54NYF.js → optional-demo-registry-RZMRX2DF.js} +2 -2
  93. package/dist-cli/chunks/{perf-EJDB2NWH.js → perf-6UOFEML4.js} +2 -2
  94. package/dist-cli/chunks/{permissions-MXUT3YR6.js → permissions-J2NG7LPA.js} +2 -2
  95. package/dist-cli/chunks/privacy-P65QWNCJ.js +4 -0
  96. package/dist-cli/chunks/{record-STFUL6CS.js → record-F4OBLQ6Y.js} +3 -3
  97. package/dist-cli/chunks/{report-issue-TE2QTEMZ.js → report-issue-JC3HV6H5.js} +2 -2
  98. package/dist-cli/chunks/reset-ZFNQEN3I.js +4 -0
  99. package/dist-cli/chunks/runtime-OXOW3KFB.js +4 -0
  100. package/dist-cli/chunks/{screenshot-command-SRW3HXF7.js → screenshot-command-5FL4G6Z7.js} +3 -3
  101. package/dist-cli/chunks/{screenshot-layers-IULR35XJ.js → screenshot-layers-KSIY2HUV.js} +2 -2
  102. package/dist-cli/chunks/{screenshots-capture-54GFQLXS.js → screenshots-capture-ZLPRX5V4.js} +2 -2
  103. package/dist-cli/chunks/{serve-WJAOT43K.js → serve-4W5ORCCK.js} +2 -2
  104. package/dist-cli/chunks/setup-5UJXMNUD.js +4 -0
  105. package/dist-cli/chunks/{skills-DW5GLHAT.js → skills-NBNB72QZ.js} +2 -2
  106. package/dist-cli/chunks/{state-IW4THIPU.js → state-OW2M6SCN.js} +2 -2
  107. package/dist-cli/chunks/{storage-F4RQZFTZ.js → storage-IXBS7SBI.js} +2 -2
  108. package/dist-cli/chunks/store-OPYM5ERB.js +4 -0
  109. package/dist-cli/chunks/telemetry-TIJJ5NZS.js +4 -0
  110. package/dist-cli/chunks/{timeline-IX3HVS22.js → timeline-67CF7CNZ.js} +2 -2
  111. package/dist-cli/chunks/{upgrade-T4LWQ2JA.js → upgrade-BVBMIMZU.js} +2 -2
  112. package/dist-cli/chunks/upload-PK3CH66T.js +4 -0
  113. package/dist-cli/chunks/{version-MNRMHJ64.js → version-IP45ACMK.js} +2 -2
  114. package/dist-cli/chunks/{web-ARKJI3PY.js → web-O3ELBKWC.js} +2 -2
  115. package/dist-cli/chunks/welcome-YVGPT6KK.js +5 -0
  116. package/dist-cli/chunks/{what-happened-EBK5NZFI.js → what-happened-TVWU267R.js} +2 -2
  117. package/dist-lib/agent-daemon-client.cjs +1 -1
  118. package/dist-lib/agent-events.cjs +1 -1
  119. package/dist-lib/agent-identity.cjs +1 -1
  120. package/dist-lib/agent-sessions.cjs +1 -1
  121. package/dist-lib/attached-projects.cjs +1 -1
  122. package/dist-lib/auth/shared-session.cjs +1 -1
  123. package/dist-lib/backend-origin.cjs +1 -1
  124. package/dist-lib/beta.cjs +1 -1
  125. package/dist-lib/beta.mjs +1 -1
  126. package/dist-lib/bridge-constants.cjs +1 -1
  127. package/dist-lib/bridge-contract.cjs +1 -1
  128. package/dist-lib/cli-constants.cjs +1 -1
  129. package/dist-lib/config.cjs +1 -1
  130. package/dist-lib/detox/index.cjs +1 -1
  131. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  132. package/dist-lib/home-paths.cjs +1 -1
  133. package/dist-lib/host/bridge-host.cjs +1 -1
  134. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  135. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  136. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  137. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  138. package/dist-lib/host/websocket-proxy.cjs +1 -1
  139. package/dist-lib/index.cjs +1 -1
  140. package/dist-lib/jump-to-source-babel.cjs +1 -1
  141. package/dist-lib/menu.cjs +1 -1
  142. package/dist-lib/menu.mjs +1 -1
  143. package/dist-lib/metro-production-bundle.cjs +1 -1
  144. package/dist-lib/metro-production-bundle.mjs +1 -1
  145. package/dist-lib/metro.cjs +1 -1
  146. package/dist-lib/profiles.cjs +1 -1
  147. package/dist-lib/public-brand.cjs +1 -1
  148. package/dist-lib/react-native-host-modules.cjs +1 -1
  149. package/dist-lib/react-native-host-modules.mjs +1 -1
  150. package/dist-lib/render-mode.cjs +1 -1
  151. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  152. package/dist-lib/sdk.cjs +1 -1
  153. package/dist-lib/sdk.mjs +1 -1
  154. package/dist-lib/skills.cjs +82 -54
  155. package/dist-lib/vite.cjs +1 -1
  156. package/package.json +1 -1
  157. package/skills/rnx-test/SKILL.md +6 -2
  158. package/src/bridge-contract.ts +8 -2
  159. package/dist-cli/chunks/chunk-2GLEESND.js +0 -535
  160. package/dist-cli/chunks/chunk-UIBR3GXC.js +0 -4
  161. package/dist-cli/chunks/cli-version-JP47UGY6.js +0 -4
  162. package/dist-cli/chunks/daemon-M26NJFNC.js +0 -4
  163. package/dist-cli/chunks/drivers-DW3CQUTK.js +0 -4
  164. package/dist-cli/chunks/flow-76SLGQCI.js +0 -4
  165. package/dist-cli/chunks/help-GUYB5XWH.js +0 -4
  166. package/dist-cli/chunks/inspect-URTBYLXV.js +0 -4
  167. package/dist-cli/chunks/install-desktop-BINBAGSN.js +0 -4
  168. package/dist-cli/chunks/privacy-JIJOFIGM.js +0 -4
  169. package/dist-cli/chunks/reset-LAIGONON.js +0 -4
  170. package/dist-cli/chunks/runtime-ZS3FBQLG.js +0 -4
  171. package/dist-cli/chunks/setup-36ACJ5FT.js +0 -4
  172. package/dist-cli/chunks/store-MTN4TPL6.js +0 -4
  173. package/dist-cli/chunks/telemetry-CJSVYHLI.js +0 -4
  174. package/dist-cli/chunks/upload-LHWECFWH.js +0 -4
  175. package/dist-cli/chunks/welcome-XH657K2V.js +0 -5
@@ -7,7 +7,6 @@ import {
7
7
  framesIdentical,
8
8
  } from '../detox/proof-frame.cjs'
9
9
  import { composeFramedScreenshot } from '../src/screenshots/frame-compose'
10
- import { resetGuestAppStateEval } from './app-state-reset'
11
10
  import {
12
11
  READY_NODE_STABLE_MS,
13
12
  READY_PROBE_POLL_MS,
@@ -23,6 +22,10 @@ import { MaestroJsContext, scriptConditionIsTruthy } from './maestro-js'
23
22
  import { ensureCliRecordingEntitlement } from './recording-access'
24
23
  import type { PerformResult, PerformStep, ResetResult } from '../src/bridge-contract'
25
24
  import type { WsBridge } from './ws-bridge'
25
+ import type {
26
+ SootSimExternalAppLifecycleOptions,
27
+ SootSimLaunchArguments,
28
+ } from '@sootsim/globals'
26
29
 
27
30
  const DEFAULT_TIMEOUT = 10000
28
31
  // hosted-runner previews reach first-render much slower than local dev: the
@@ -411,6 +414,8 @@ export class SootSimBridgeFlowRunner {
411
414
  })
412
415
 
413
416
  private firstLaunchDone = false
417
+ private appStopped = false
418
+ private launchArgumentsActive = false
414
419
  private profilingEnabled = false
415
420
  private recordingEnabled = false
416
421
  private recordingAccessChecked = false
@@ -1967,12 +1972,17 @@ export class SootSimBridgeFlowRunner {
1967
1972
  await this.refreshSimId()
1968
1973
  }
1969
1974
 
1970
- private async resetGuestAppData() {
1975
+ private async resetGuestAppData(
1976
+ launchOptions?: Pick<
1977
+ SootSimExternalAppLifecycleOptions,
1978
+ 'initialUrl' | 'launchArguments'
1979
+ >,
1980
+ ) {
1971
1981
  const reset: ResetResult = await this.bridge.send(
1972
1982
  {
1973
1983
  type: 'reset',
1974
1984
  simId: this.opts.simId,
1975
- resetOptions: { strategy: 'data' },
1985
+ resetOptions: { strategy: 'data', ...launchOptions },
1976
1986
  },
1977
1987
  { timeoutMs: 120000 },
1978
1988
  )
@@ -1987,14 +1997,16 @@ export class SootSimBridgeFlowRunner {
1987
1997
  }
1988
1998
  }
1989
1999
 
1990
- private async softReloadGuestApp(resetStorage: boolean) {
1991
- const reloaded = await this.evaluate<boolean>(
1992
- resetGuestAppStateEval(resetStorage),
1993
- 120000,
2000
+ private async reloadGuestAppRuntime(options: SootSimExternalAppLifecycleOptions) {
2001
+ await this.bridge.send(
2002
+ {
2003
+ type: 'call',
2004
+ simId: this.opts.simId,
2005
+ path: 'SootSim.bridges.hotRemount.reloadExternalApp',
2006
+ args: [options],
2007
+ },
2008
+ { timeoutMs: 120000 },
1994
2009
  )
1995
- if (!reloaded) {
1996
- throw new Error('guest app soft reload bridge unavailable')
1997
- }
1998
2010
  }
1999
2011
 
2000
2012
  private async rearmCaptureAfterRuntimeReload() {
@@ -2021,12 +2033,14 @@ export class SootSimBridgeFlowRunner {
2021
2033
 
2022
2034
  async launchApp(opts: any) {
2023
2035
  await this.refreshSimId()
2024
- if (opts && typeof opts === 'object' && opts.arguments) {
2025
- // real maestro passes process launch arguments to the native app.
2026
- // sootsim has no native process — the bundle boots in-page — so
2027
- // launch arguments have nothing to attach to. say so instead of
2028
- // silently dropping them.
2029
- console.log('[flow] launchApp.arguments ignored (rnx has no native process)')
2036
+ let hasLaunchArguments = false
2037
+ let launchArguments: SootSimLaunchArguments | undefined
2038
+ if (isObjectRecord(opts) && Object.prototype.hasOwnProperty.call(opts, 'arguments')) {
2039
+ if (!isObjectRecord(opts.arguments)) {
2040
+ throw new Error('launchApp.arguments must be a JSON object')
2041
+ }
2042
+ hasLaunchArguments = true
2043
+ launchArguments = opts.arguments
2030
2044
  }
2031
2045
  const wantsClear = !!(opts && typeof opts === 'object' && opts.clearState)
2032
2046
  const wantsResetRuntime = readBooleanKey(opts, 'resetRuntime')
@@ -2036,7 +2050,15 @@ export class SootSimBridgeFlowRunner {
2036
2050
  // Maestro's "launch the app" boundary through the shell. Otherwise the
2037
2051
  // guest app is already booting from the initial sim open, so just wait.
2038
2052
  this.firstLaunchDone = true
2039
- if (wantsResetRuntime) {
2053
+ if (hasLaunchArguments) {
2054
+ const launched = await this.launchShellAppFromHomeIfNeeded(opts)
2055
+ if (launched) await this.waitForTree(120000)
2056
+ await this.reloadGuestAppRuntime({
2057
+ launchArguments,
2058
+ initialUrl: null,
2059
+ })
2060
+ await this.waitForTree(120000)
2061
+ } else if (wantsResetRuntime) {
2040
2062
  // SootSim benchmark flows need app auth/storage kept warm while the
2041
2063
  // guest React runtime starts fresh inside the timed/recorded boundary.
2042
2064
  // the reload re-runs the app entry inside the mounted app surface, so
@@ -2050,7 +2072,14 @@ export class SootSimBridgeFlowRunner {
2050
2072
  // second readiness wait would only pad the measured reset.
2051
2073
  const launched = await this.launchShellAppFromHomeIfNeeded(opts)
2052
2074
  if (launched) await this.waitForTree(120000)
2053
- await this.softReloadGuestApp(false)
2075
+ await this.reloadGuestAppRuntime({})
2076
+ await this.waitForTree(120000)
2077
+ } else if (this.appStopped) {
2078
+ await this.launchShellAppFromHomeIfNeeded(opts)
2079
+ await this.reloadGuestAppRuntime({
2080
+ launchArguments: null,
2081
+ initialUrl: null,
2082
+ })
2054
2083
  await this.waitForTree(120000)
2055
2084
  } else {
2056
2085
  await this.launchShellAppFromHomeIfNeeded(opts)
@@ -2059,7 +2088,15 @@ export class SootSimBridgeFlowRunner {
2059
2088
  } else {
2060
2089
  this.firstLaunchDone = true
2061
2090
  if (wantsClear) {
2062
- await this.resetGuestAppData()
2091
+ await this.resetGuestAppData({
2092
+ launchArguments: hasLaunchArguments ? launchArguments : null,
2093
+ initialUrl: null,
2094
+ })
2095
+ } else if (hasLaunchArguments || this.launchArgumentsActive || this.appStopped) {
2096
+ await this.reloadGuestAppRuntime({
2097
+ launchArguments: hasLaunchArguments ? launchArguments : null,
2098
+ initialUrl: null,
2099
+ })
2063
2100
  } else {
2064
2101
  await this.reloadGuestApp()
2065
2102
  }
@@ -2077,6 +2114,9 @@ export class SootSimBridgeFlowRunner {
2077
2114
  }
2078
2115
  }
2079
2116
 
2117
+ this.appStopped = false
2118
+ this.launchArgumentsActive = hasLaunchArguments
2119
+
2080
2120
  if (this.profilingEnabled) {
2081
2121
  await this.startProfile()
2082
2122
  }
@@ -2181,12 +2221,10 @@ export class SootSimBridgeFlowRunner {
2181
2221
  }
2182
2222
 
2183
2223
  // maestro stopApp: tear down the current app runtime without clearing app
2184
- // data. sootsim has no separate native process, so a hard page reload is the
2185
- // nearest equivalent to killing and later re-launching the tenant runtime.
2186
- // State clearing belongs to clearState / launchApp({ clearState: true }).
2224
+ // data. the next launchApp or openLink creates its replacement worker.
2187
2225
  async stopApp() {
2188
- await this.reloadGuestApp()
2189
- await this.rearmCaptureAfterRuntimeReload()
2226
+ await this.reloadGuestAppRuntime({ relaunch: false })
2227
+ this.appStopped = true
2190
2228
  }
2191
2229
 
2192
2230
  // maestro clearState: wipe app-owned storage and relaunch fresh.
@@ -2258,6 +2296,17 @@ export class SootSimBridgeFlowRunner {
2258
2296
  async openLink(target: string | { link: string }) {
2259
2297
  const link = typeof target === 'string' ? target : target.link
2260
2298
  if (!link) throw new Error('openLink: missing link')
2299
+ if (this.appStopped) {
2300
+ await this.reloadGuestAppRuntime({
2301
+ initialUrl: link,
2302
+ launchArguments: null,
2303
+ })
2304
+ await this.waitForTree(120000)
2305
+ this.appStopped = false
2306
+ this.launchArgumentsActive = false
2307
+ this.firstLaunchDone = true
2308
+ return
2309
+ }
2261
2310
  const result = await this.callTest<{ ok: boolean; error?: string }>(
2262
2311
  'openDeepLink',
2263
2312
  link,
@@ -73,7 +73,7 @@ function printCompatMatrix() {
73
73
  rnx maestro — compatibility matrix
74
74
 
75
75
  supported verbs:
76
- launchApp, stopApp, clearState, clearKeychain (warn-only),
76
+ launchApp (including arguments), stopApp, clearState, clearKeychain (warn-only),
77
77
  tapOn, tapAtCoords, longPressOn,
78
78
  inputText, pressKey, dispatchKey, hideKeyboard, eraseText,
79
79
  assertVisible, assertNotVisible, assertTreeContains,
@@ -92,12 +92,17 @@ workspace mode (directory runs):
92
92
  config.yaml / config.yml discovery, flows: inclusion globs,
93
93
  includeTags / excludeTags against flow frontmatter tags.
94
94
 
95
+ launch behavior:
96
+ launchApp.arguments: a JSON object available before guest app entry through
97
+ react-native-launch-arguments and NativeModules.SettingsManager.settings.
98
+ stopApp: keeps the guest stopped until launchApp or openLink starts it.
99
+ openLink: cold-starts a stopped guest with the initial URL; a running guest
100
+ receives the URL through React Native Linking.
101
+
95
102
  partial:
96
103
  clearKeychain — warn-only, rnx has no keychain surface.
97
104
  when.platform — rnx reports iOS for this runner.
98
- openLink dispatched into the app via the Linking emulation
99
- (react-navigation deep links work); no OS-level Safari fallback.
100
- launchApp.arguments — ignored; rnx has no native process.
105
+ openLink: app routing works; no OS-level Safari fallback.
101
106
  launchApp.resetRuntime — sootsim-only extension for recorded benchmarks:
102
107
  keep tenant storage/auth, but soft-reload the guest app inside launchApp.
103
108
  takeScreenshot — maestro string form works unchanged; rnx also accepts
package/dist-cli/bin.js CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
- /*! rnx v0.1.355 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ /*! rnx v0.1.357 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
3
3
  import { createRequire as __sootsimCreateRequire } from 'node:module'
4
4
  var require = __sootsimCreateRequire(import.meta.url)
5
- import{a as g,b as f}from"./chunks/chunk-GFDFVKVW.js";import{a as m}from"./chunks/chunk-6EC3D5IG.js";import"./chunks/chunk-S27I7H2K.js";function A(a){let t=a instanceof Error?a.message:String(a);(/^command timed out after \d+s$/.test(t)||t.startsWith("sim disconnected:")||t.startsWith("bridge never reconnected")||t.startsWith("multiple sims are connected:")||t.startsWith("saved sim ")||t.startsWith("no sim connected with id ")||t.startsWith("could not connect to ws://")||t.startsWith("rnx bridge daemon is not running")||t.startsWith("rnx bridge lockfile is fresh")||t.startsWith("rnx bridge exited before becoming ready")||t.startsWith(`${m.commandName} open: requested bridge port`)||t.startsWith("background daemon setup is unavailable")||t.startsWith("rnx bridge did not start within"))&&!process.env.SOOTSIM_VERBOSE&&(process.stderr.write(` ${t}
5
+ import{a as g,b as f}from"./chunks/chunk-VGVIM2ES.js";import{a as m}from"./chunks/chunk-LFHZHHVR.js";import"./chunks/chunk-SZYAIXGI.js";function A(a){let t=a instanceof Error?a.message:String(a);(/^command timed out after \d+s$/.test(t)||t.startsWith("sim disconnected:")||t.startsWith("bridge never reconnected")||t.startsWith("multiple sims are connected:")||t.startsWith("saved sim ")||t.startsWith("no sim connected with id ")||t.startsWith("could not connect to ws://")||t.startsWith("rnx bridge daemon is not running")||t.startsWith("rnx bridge lockfile is fresh")||t.startsWith("rnx bridge exited before becoming ready")||t.startsWith(`${m.commandName} open: requested bridge port`)||t.startsWith("background daemon setup is unavailable")||t.startsWith("rnx bridge did not start within"))&&!process.env.SOOTSIM_VERBOSE&&(process.stderr.write(` ${t}
6
6
  `),process.exit(1)),a instanceof Error&&a.stack?process.stderr.write(`${a.stack}
7
7
  `):process.stderr.write(`${t}
8
8
  `),process.exit(1)}process.on("unhandledRejection",A);process.on("uncaughtException",A);var k=typeof __SOOTSIM_STANDALONE__<"u"&&__SOOTSIM_STANDALONE__,S=new Set(["desktop"]);function C(a){!k||!S.has(a)||(process.stderr.write(` ${m.commandName} ${a} isn't available in the standalone binary \u2014
9
9
  it needs vite / electron / playwright from a project's node_modules.
10
10
  run the npm package instead:
11
11
  ${m.commandName} ${a}
12
- `),process.exit(1))}var e=f(process.argv);if(!e.command&&e.commandArgs.length>0){let{resolveHiddenRuntimeAlias:a}=await import("./chunks/hidden-runtime-alias-GSZG7QFD.js");e=a(e)}var $=e.command==="cleanup"&&e.commandArgs.length===1&&e.commandArgs[0]==="--automatic-worker",_=!e.command&&e.commandArgs.length===0;if(!$&&!_&&!e.help&&!e.version&&e.command!=="config"&&e.command!=="setup"&&e.command!=="telemetry"){let{ensurePrivacyChoice:a}=await import("./chunks/privacy-JIJOFIGM.js");await a({prompt:!0})}if(e.command!=="serve"&&e.command!=="daemon"){let{consumeRuntimeUpgradeNotice:a}=await import("./chunks/home-paths-OGXLRRTG.js"),t=a();t&&process.stderr.write(` ${m.name} engine upgraded to v${t.to}`+(t.from?` (from v${t.from})`:"")+` \xB7 what's new: ${m.origin}/changelog
13
- `)}var h=!1;async function v(){if(!h&&(h=!0,!(e.command==="cleanup"||e.command==="serve"||e.command==="agent-wrapper"||e.command==="daemon"&&e.commandArgs[0]==="uninstall")))try{let{isAutomaticSootsimCleanupComplete:a}=await import("./chunks/disk-cleanup-RPW5MYGM.js");if(a())return;let{spawn:t}=await import("node:child_process"),i=["cleanup","--automatic-worker"],d=process.argv[1],p=k?t(process.execPath,i,{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env}):d?t(process.execPath,[d,...i],{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env}):t(m.commandName,i,{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env});p.once("error",u=>{process.stderr.write(` ${m.name} automatic cleanup will retry on the next run: ${u.message}
12
+ `),process.exit(1))}var e=f(process.argv);if(!e.command&&e.commandArgs.length>0){let{resolveHiddenRuntimeAlias:a}=await import("./chunks/hidden-runtime-alias-S24KDRUW.js");e=a(e)}var $=e.command==="cleanup"&&e.commandArgs.length===1&&e.commandArgs[0]==="--automatic-worker",_=!e.command&&e.commandArgs.length===0;if(!$&&!_&&!e.help&&!e.version&&e.command!=="config"&&e.command!=="setup"&&e.command!=="telemetry"){let{ensurePrivacyChoice:a}=await import("./chunks/privacy-P65QWNCJ.js");await a({prompt:!0})}if(e.command!=="serve"&&e.command!=="daemon"){let{consumeRuntimeUpgradeNotice:a}=await import("./chunks/home-paths-GG5N4VTM.js"),t=a();t&&process.stderr.write(` ${m.name} engine upgraded to v${t.to}`+(t.from?` (from v${t.from})`:"")+` \xB7 what's new: ${m.origin}/changelog
13
+ `)}var h=!1;async function v(){if(!h&&(h=!0,!(e.command==="cleanup"||e.command==="serve"||e.command==="agent-wrapper"||e.command==="daemon"&&e.commandArgs[0]==="uninstall")))try{let{isAutomaticSootsimCleanupComplete:a}=await import("./chunks/disk-cleanup-T5B5HVFI.js");if(a())return;let{spawn:t}=await import("node:child_process"),i=["cleanup","--automatic-worker"],d=process.argv[1],p=k?t(process.execPath,i,{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env}):d?t(process.execPath,[d,...i],{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env}):t(m.commandName,i,{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env});p.once("error",u=>{process.stderr.write(` ${m.name} automatic cleanup will retry on the next run: ${u.message}
14
14
  `)}),p.unref()}catch(a){process.stderr.write(` ${m.name} automatic cleanup will retry on the next run: ${a instanceof Error?a.message:String(a)}
15
- `)}}async function o(a){let{flushCliTelemetry:t}=await import("./chunks/telemetry-CJSVYHLI.js");await t(),await v(),process.exit(a)}if(e.version){let{getCliVersion:a}=await import("./chunks/cli-version-JP47UGY6.js"),{IS_BETA:t,BETA_LABEL:i}=await import("./chunks/beta-BQHBSKA5.js"),d=t?` \xB7 ${i}`:"";console.log(`${m.commandName} v${a()}${d}`);let{readActiveRuntime:p}=await import("./chunks/home-paths-OGXLRRTG.js"),u=p();console.log(u?`runtime v${u}`:"runtime not installed"),await o(0)}if(e.help&&!e.command){let{printHelp:a}=await import("./chunks/help-GUYB5XWH.js");a(),await o(0)}var n=e.globalFlags.port,c=e.verbose,w=e.globalFlags.device,l=e.globalFlags.theme,W=e.globalFlags.driver,x=e.globalFlags.headless===!0,b=e.globalFlags.sim??e.globalFlags.session??e.globalFlags.tab,r=b?["--sim",b,...e.commandArgs]:e.commandArgs;if(w||l){let{settingsStore:a}=await import("./chunks/store-MTN4TPL6.js"),t={};w&&(t.deviceModel=w),l&&(t.colorScheme=l),a.apply(t)}if(!e.command&&e.commandArgs.length===0){let{runWelcome:a}=await import("./chunks/welcome-XH657K2V.js");await o(await a())}var s=e.command??"";if(!s){if(e.commandArgs.length>0){let t=e.commandArgs.find(i=>!i.startsWith("-"))??e.commandArgs[0];console.error(` unknown command: ${t}`),console.error(` run \`${m.commandName} --help\` to see the full surface.`),await o(1)}let{printHelp:a}=await import("./chunks/help-GUYB5XWH.js");a(),await o(0)}if(e.help||e.commandArgs.includes("--help")||e.commandArgs.includes("-h")){if(s==="skill"){let{runSkill:i}=await import("./chunks/skills-DW5GLHAT.js");await i(e.commandArgs),await o(0)}if(s==="state"){let{runState:i}=await import("./chunks/state-IW4THIPU.js");await o(await i(r,{port:n}))}if(s==="reset"){let{runReset:i}=await import("./chunks/reset-LAIGONON.js");await o(await i(r,{port:n}))}let a=s==="do"||s==="get"||s==="debug"||s==="shell"||s==="perf"||s==="wait",t=e.commandArgs.find(i=>!i.startsWith("-"));if(!(s==="shell"||s==="perf"))if(a&&!t){let{printGroupHelp:i}=await import("./chunks/help-GUYB5XWH.js");i(s)&&await o(0)}else{let{printCommandHelp:i}=await import("./chunks/help-GUYB5XWH.js");i(a&&t?t:s,{prefer:a&&t?"verb":"command",group:a&&t?s:void 0}),await o(0)}}C(s);if(g.has(s)){let{runInspect:a}=await import("./chunks/inspect-URTBYLXV.js");await a([s,...r],{port:n,verbose:c})}else switch(s){case"assert":{let{runAssert:a}=await import("./chunks/assert-R324GCRG.js");await a(e.commandArgs);break}case"detox":{let{runDetox:a}=await import("./chunks/detox-ZFEQKHDT.js");await a(e.commandArgs,{port:n,verbose:c});break}case"maestro":{let{runMaestro:a}=await import("./chunks/maestro-OEXXVYMW.js"),t=await a(r,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"record":{let{runRecord:a}=await import("./chunks/record-STFUL6CS.js");await a(r,{port:n,verbose:c});break}case"film":{let{runFilm:a}=await import("./chunks/film-NRGBZSC7.js"),t=await a(r,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"storage":{let{runStorage:a}=await import("./chunks/storage-F4RQZFTZ.js"),t=await a(r,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"state":{let{runState:a}=await import("./chunks/state-IW4THIPU.js"),t=await a(r,{port:n});await o(t)}case"reset":{let{runReset:a}=await import("./chunks/reset-LAIGONON.js"),t=await a(r,{port:n});await o(t)}case"perf":{let{runPerf:a}=await import("./chunks/perf-EJDB2NWH.js"),t=await a(r,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"screenshot":{let{runScreenshotCommand:a}=await import("./chunks/screenshot-command-SRW3HXF7.js"),t=await a(r,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"camera":{let{runCamera:a}=await import("./chunks/camera-UPRFBRPF.js"),t=await a(r,{port:n});await o(typeof t=="number"?t:0)}case"mode":{let{runMode:a}=await import("./chunks/mode-YKX2UTBX.js");await a(r,{port:n,verbose:c});break}case"permissions":{let{runPermissions:a}=await import("./chunks/permissions-MXUT3YR6.js"),t=await a(r,{port:n,verbose:c});await o(t)}case"debug":{let{runDebug:a}=await import("./chunks/debug-7NHPYUX6.js");await a(r,{port:n,verbose:c});break}case"timeline":{let{runTimeline:a}=await import("./chunks/timeline-IX3HVS22.js");await a(r,{port:n,verbose:c});break}case"what-happened":{let{runWhatHappened:a}=await import("./chunks/what-happened-EBK5NZFI.js");await a(r,{port:n,verbose:c});break}case"open":{let{runOpenCommand:a}=await import("./chunks/control-NPWFRKZS.js");await a(r,{port:n});break}case"use":{let{runUseCommand:a}=await import("./chunks/control-NPWFRKZS.js");await a(r,{port:n});break}case"claim":{let{runClaimCommand:a}=await import("./chunks/control-NPWFRKZS.js");await a(r,{port:n});break}case"close":{let{runCloseCommand:a}=await import("./chunks/control-NPWFRKZS.js");await a(r,{port:n});break}case"device":{let{runDeviceCommand:a}=await import("./chunks/device-JM7QMQFQ.js");await a(r,{port:n});break}case"compat":{let{runCompat:a}=await import("./chunks/compat-J4OEALGF.js");await a(e.commandArgs);break}case"report-issue":{let{runReportIssue:a}=await import("./chunks/report-issue-TE2QTEMZ.js"),t=await a(e.commandArgs);await o(t)}case"desktop":{let{runDesktop:a}=await import("./chunks/desktop-EIBJC5EU.js");await a(e.commandArgs,{port:n,device:w});break}case"login":{let{runLogin:a}=await import("./chunks/login-A7JSAMON.js");await a(e.commandArgs);break}case"logout":{let{runLogout:a}=await import("./chunks/logout-EBUWNT63.js");await a();break}case"auth":{let{runAuth:a}=await import("./chunks/auth-INKYLYRZ.js");await a(e.commandArgs);break}case"setup":{let{runSetup:a}=await import("./chunks/setup-36ACJ5FT.js");await a(e.commandArgs);break}case"serve":{let{runServe:a}=await import("./chunks/serve-WJAOT43K.js");await a(e.commandArgs,{port:n});break}case"daemon":{let{runDaemon:a}=await import("./chunks/daemon-M26NJFNC.js");await a(e.commandArgs,{port:n});break}case"runtime":{let{runRuntime:a}=await import("./chunks/runtime-ZS3FBQLG.js");await a(e.commandArgs);break}case"upgrade":{let{runUpgrade:a}=await import("./chunks/upgrade-T4LWQ2JA.js");await a(e.commandArgs);break}case"version":{let{runVersion:a}=await import("./chunks/version-MNRMHJ64.js");await a(e.commandArgs);break}case"agent":{let{runAgentCommand:a}=await import("./chunks/agent-2MW7ZKUX.js"),t=await a(e.commandArgs);await o(t)}case"agent-wrapper":{let{runAgentWrapper:a}=await import("./chunks/agent-wrapper-XYQBKV24.js"),t=await a(e.commandArgs);await o(t)}case"skill":{let{runSkill:a}=await import("./chunks/skills-DW5GLHAT.js");await a(e.commandArgs);break}case"app-fonts":{let{runAppFonts:a}=await import("./chunks/app-fonts-SXIZFMPY.js");await a(e.commandArgs);break}case"config":{let{runConfig:a}=await import("./chunks/config-MCH2R7WG.js");await a(e.commandArgs);break}case"cleanup":{let{runCleanup:a}=await import("./chunks/cleanup-5FGGUP6U.js"),t=await a(e.commandArgs);await o(t)}default:console.error(` unknown command: ${s}`),console.error(` run \`${m.commandName} --help\` to see the full surface.`),await o(1)}await v();
15
+ `)}}async function o(a){let{flushCliTelemetry:t}=await import("./chunks/telemetry-TIJJ5NZS.js");await t(),await v(),process.exit(a)}if(e.version){let{getCliVersion:a}=await import("./chunks/cli-version-XAFFRJCZ.js"),{IS_BETA:t,BETA_LABEL:i}=await import("./chunks/beta-R7AGWYWM.js"),d=t?` \xB7 ${i}`:"";console.log(`${m.commandName} v${a()}${d}`);let{readActiveRuntime:p}=await import("./chunks/home-paths-GG5N4VTM.js"),u=p();console.log(u?`runtime v${u}`:"runtime not installed"),await o(0)}if(e.help&&!e.command){let{printHelp:a}=await import("./chunks/help-3ZWJFCV5.js");a(),await o(0)}var n=e.globalFlags.port,c=e.verbose,w=e.globalFlags.device,l=e.globalFlags.theme,W=e.globalFlags.driver,x=e.globalFlags.headless===!0,b=e.globalFlags.sim??e.globalFlags.session??e.globalFlags.tab,r=b?["--sim",b,...e.commandArgs]:e.commandArgs;if(w||l){let{settingsStore:a}=await import("./chunks/store-OPYM5ERB.js"),t={};w&&(t.deviceModel=w),l&&(t.colorScheme=l),a.apply(t)}if(!e.command&&e.commandArgs.length===0){let{runWelcome:a}=await import("./chunks/welcome-YVGPT6KK.js");await o(await a())}var s=e.command??"";if(!s){if(e.commandArgs.length>0){let t=e.commandArgs.find(i=>!i.startsWith("-"))??e.commandArgs[0];console.error(` unknown command: ${t}`),console.error(` run \`${m.commandName} --help\` to see the full surface.`),await o(1)}let{printHelp:a}=await import("./chunks/help-3ZWJFCV5.js");a(),await o(0)}if(e.help||e.commandArgs.includes("--help")||e.commandArgs.includes("-h")){if(s==="skill"){let{runSkill:i}=await import("./chunks/skills-NBNB72QZ.js");await i(e.commandArgs),await o(0)}if(s==="state"){let{runState:i}=await import("./chunks/state-OW2M6SCN.js");await o(await i(r,{port:n}))}if(s==="reset"){let{runReset:i}=await import("./chunks/reset-ZFNQEN3I.js");await o(await i(r,{port:n}))}let a=s==="do"||s==="get"||s==="debug"||s==="shell"||s==="perf"||s==="wait",t=e.commandArgs.find(i=>!i.startsWith("-"));if(!(s==="shell"||s==="perf"))if(a&&!t){let{printGroupHelp:i}=await import("./chunks/help-3ZWJFCV5.js");i(s)&&await o(0)}else{let{printCommandHelp:i}=await import("./chunks/help-3ZWJFCV5.js");i(a&&t?t:s,{prefer:a&&t?"verb":"command",group:a&&t?s:void 0}),await o(0)}}C(s);if(g.has(s)){let{runInspect:a}=await import("./chunks/inspect-QQ7FWRVH.js");await a([s,...r],{port:n,verbose:c})}else switch(s){case"assert":{let{runAssert:a}=await import("./chunks/assert-ERBO4GF4.js");await a(e.commandArgs);break}case"detox":{let{runDetox:a}=await import("./chunks/detox-SEOITHO2.js");await a(e.commandArgs,{port:n,verbose:c});break}case"maestro":{let{runMaestro:a}=await import("./chunks/maestro-XUXCXSYO.js"),t=await a(r,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"record":{let{runRecord:a}=await import("./chunks/record-F4OBLQ6Y.js");await a(r,{port:n,verbose:c});break}case"film":{let{runFilm:a}=await import("./chunks/film-TTSCLCET.js"),t=await a(r,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"storage":{let{runStorage:a}=await import("./chunks/storage-IXBS7SBI.js"),t=await a(r,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"state":{let{runState:a}=await import("./chunks/state-OW2M6SCN.js"),t=await a(r,{port:n});await o(t)}case"reset":{let{runReset:a}=await import("./chunks/reset-ZFNQEN3I.js"),t=await a(r,{port:n});await o(t)}case"perf":{let{runPerf:a}=await import("./chunks/perf-6UOFEML4.js"),t=await a(r,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"screenshot":{let{runScreenshotCommand:a}=await import("./chunks/screenshot-command-5FL4G6Z7.js"),t=await a(r,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"camera":{let{runCamera:a}=await import("./chunks/camera-SQOGGHFO.js"),t=await a(r,{port:n});await o(typeof t=="number"?t:0)}case"mode":{let{runMode:a}=await import("./chunks/mode-4RCORGOE.js");await a(r,{port:n,verbose:c});break}case"permissions":{let{runPermissions:a}=await import("./chunks/permissions-J2NG7LPA.js"),t=await a(r,{port:n,verbose:c});await o(t)}case"debug":{let{runDebug:a}=await import("./chunks/debug-EZIUTBJM.js");await a(r,{port:n,verbose:c});break}case"timeline":{let{runTimeline:a}=await import("./chunks/timeline-67CF7CNZ.js");await a(r,{port:n,verbose:c});break}case"what-happened":{let{runWhatHappened:a}=await import("./chunks/what-happened-TVWU267R.js");await a(r,{port:n,verbose:c});break}case"open":{let{runOpenCommand:a}=await import("./chunks/control-24QDU2II.js");await a(r,{port:n});break}case"use":{let{runUseCommand:a}=await import("./chunks/control-24QDU2II.js");await a(r,{port:n});break}case"claim":{let{runClaimCommand:a}=await import("./chunks/control-24QDU2II.js");await a(r,{port:n});break}case"close":{let{runCloseCommand:a}=await import("./chunks/control-24QDU2II.js");await a(r,{port:n});break}case"device":{let{runDeviceCommand:a}=await import("./chunks/device-CSFCTE77.js");await a(r,{port:n});break}case"compat":{let{runCompat:a}=await import("./chunks/compat-XAJSKUFI.js");await a(e.commandArgs);break}case"report-issue":{let{runReportIssue:a}=await import("./chunks/report-issue-JC3HV6H5.js"),t=await a(e.commandArgs);await o(t)}case"desktop":{let{runDesktop:a}=await import("./chunks/desktop-LWALKHND.js");await a(e.commandArgs,{port:n,device:w});break}case"login":{let{runLogin:a}=await import("./chunks/login-U3PVPLJM.js");await a(e.commandArgs);break}case"logout":{let{runLogout:a}=await import("./chunks/logout-4AUOJIP2.js");await a();break}case"auth":{let{runAuth:a}=await import("./chunks/auth-SGBXZ5FH.js");await a(e.commandArgs);break}case"setup":{let{runSetup:a}=await import("./chunks/setup-5UJXMNUD.js");await a(e.commandArgs);break}case"serve":{let{runServe:a}=await import("./chunks/serve-4W5ORCCK.js");await a(e.commandArgs,{port:n});break}case"daemon":{let{runDaemon:a}=await import("./chunks/daemon-DDPZIQWD.js");await a(e.commandArgs,{port:n});break}case"runtime":{let{runRuntime:a}=await import("./chunks/runtime-OXOW3KFB.js");await a(e.commandArgs);break}case"upgrade":{let{runUpgrade:a}=await import("./chunks/upgrade-BVBMIMZU.js");await a(e.commandArgs);break}case"version":{let{runVersion:a}=await import("./chunks/version-IP45ACMK.js");await a(e.commandArgs);break}case"agent":{let{runAgentCommand:a}=await import("./chunks/agent-25KBHAYX.js"),t=await a(e.commandArgs);await o(t)}case"agent-wrapper":{let{runAgentWrapper:a}=await import("./chunks/agent-wrapper-X37YZWQJ.js"),t=await a(e.commandArgs);await o(t)}case"skill":{let{runSkill:a}=await import("./chunks/skills-NBNB72QZ.js");await a(e.commandArgs);break}case"app-fonts":{let{runAppFonts:a}=await import("./chunks/app-fonts-WTMGAP6A.js");await a(e.commandArgs);break}case"config":{let{runConfig:a}=await import("./chunks/config-VOJFXKDM.js");await a(e.commandArgs);break}case"cleanup":{let{runCleanup:a}=await import("./chunks/cleanup-GXRSMHAO.js"),t=await a(e.commandArgs);await o(t)}default:console.error(` unknown command: ${s}`),console.error(` run \`${m.commandName} --help\` to see the full surface.`),await o(1)}await v();
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.355 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.357 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{a as b,b as E,c as A,d as l,e as S,g as x,h as j,j as T,n as I,o as k,p as D,q as g,r as O,s as C}from"./chunk-QYIT7H6Q.js";import"./chunk-23TG7DLH.js";import{c as $}from"./chunk-LQEC53JM.js";import"./chunk-CK3M7MAL.js";import"./chunk-X36BQCH5.js";import"./chunk-ZNWLFYZK.js";import"./chunk-FF2CEKZF.js";import"./chunk-42LIUAHU.js";import"./chunk-QWJD2CAJ.js";import"./chunk-FPWDC2DE.js";import{j as y}from"./chunk-F6S4Z7N7.js";import"./chunk-GWL4KMTK.js";import"./chunk-6EC3D5IG.js";import"./chunk-IAVHAWDL.js";import"./chunk-S27I7H2K.js";import w from"node:fs";import d from"node:path";import{spawn as _}from"node:child_process";import F from"node:net";import{WebSocket as R}from"ws";var c=class extends Error{code;constructor(e,t){super(e),this.name="AgentDaemonError",this.code=t}},f=class{ws;port;commandTimeoutMs;ready;closed=!1;nextId=1;pending=new Map;eventListeners=new Set;statusListeners=new Set;disconnectListeners=new Set;constructor(e={}){this.port=e.port??7668,this.commandTimeoutMs=e.commandTimeoutMs??15e3,this.ws=new R(`ws://localhost:${this.port}`),this.ready=new Promise((t,r)=>{let s=()=>{this.ws.off("error",o),t()},o=i=>{this.ws.off("open",s),r(new c(`could not connect to rnx daemon on port ${this.port}: ${i.message}`,"NO_DAEMON"))};this.ws.once("open",s),this.ws.once("error",o)}),this.ws.on("message",t=>this.handleMessage(t)),this.ws.on("close",()=>this.handleClose()),this.ws.on("error",()=>{})}async waitReady(){return this.ready}async listProjects(){return this.send("agent:list-projects")}async upsertProject(e){return this.send("agent:upsert-project",{input:e})}async deleteProject(e){return this.send("agent:delete-project",{projectId:e})}async autoAttachForUrl(e){return this.send("agent:auto-attach-for-url",{input:e})}async listSessions(e){return this.send("agent:list-sessions",{projectId:e})}async startSession(e){return this.send("agent:start-session",{input:e})}async sendPrompt(e,t){return this.send("agent:send-prompt",{sessionId:e,prompt:t})}async sendClaimedPrompt(e,t){return this.send("agent:send-claimed-prompt",{simId:e,prompt:t})}async endSession(e){return this.send("agent:end-session",{sessionId:e})}async getTranscript(e){return this.send("agent:get-transcript",{sessionId:e})}async getPaths(){return this.send("agent:get-paths")}async subscribeEvents(e){return this.send("agent:subscribe-events",{sessionId:e})}async unsubscribeEvents(e){return this.send("agent:unsubscribe-events",{sessionId:e})}onAgentEvent(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}onSessionStatusChange(e){return this.statusListeners.add(e),()=>this.statusListeners.delete(e)}onDisconnect(e){return this.disconnectListeners.add(e),()=>this.disconnectListeners.delete(e)}close(){if(!this.closed){this.closed=!0;try{this.ws.close()}catch{}}}async send(e,t={}){if(await this.ready,this.closed||this.ws.readyState!==R.OPEN)throw new c("daemon connection is closed","NO_DAEMON");let r=this.nextId++;return new Promise((s,o)=>{let i=setTimeout(()=>{this.pending.delete(r),o(new c(`${e} timed out after ${Math.round(this.commandTimeoutMs/1e3)}s`,"TIMEOUT"))},this.commandTimeoutMs);this.pending.set(r,{resolve:s,reject:o,timer:i});try{this.ws.send(JSON.stringify({id:r,type:e,...t}))}catch(a){clearTimeout(i),this.pending.delete(r),o(a instanceof Error?a:new Error(String(a)))}})}handleMessage(e){let t;try{t=JSON.parse(String(e))}catch{return}if(!t||typeof t!="object")return;if(t.type==="agent:event"){for(let s of this.eventListeners)try{s({sessionId:t.sessionId,event:t.event})}catch{}return}if(t.type==="agent:session-status"){for(let s of this.statusListeners)try{s(t.session)}catch{}return}if(typeof t.id!="number")return;let r=this.pending.get(t.id);r&&(this.pending.delete(t.id),clearTimeout(r.timer),t.error?r.reject(new c(t.error,t.code)):r.resolve(t.result))}handleClose(){if(!this.closed){this.closed=!0;for(let[,e]of this.pending)clearTimeout(e.timer),e.reject(new c("daemon disconnected","DISCONNECT"));this.pending.clear();for(let e of this.disconnectListeners)try{e()}catch{}}}};function M(n=7668,e=400){return new Promise(t=>{let r=new F.Socket,s=!1,o=i=>{s||(s=!0,r.destroy(),t(i))};r.setTimeout(e),r.once("connect",()=>o(!0)),r.once("timeout",()=>o(!1)),r.once("error",()=>o(!1)),r.connect(n,"127.0.0.1")})}async function B(n={}){let e=n.port??7668;if(await M(e))return{alreadyRunning:!0};if(y())throw new c(`no rnx bridge on port ${e}. run \`rnx daemon install\` to enable the faster background service, or \`rnx serve\` in another shell.`,"DEV_HOST_REFUSED");let{cmd:t,prefixArgs:r}=C(),s=[...r,"serve","--quiet"];e!==7668&&s.push("--port",String(e));let o=_(t,s,{detached:!0,stdio:"ignore",env:process.env,cwd:process.cwd()});o.unref();let i=Date.now()+(n.startupTimeoutMs??5e3);for(;Date.now()<i;){if(await M(e))return{alreadyRunning:!1,pid:o.pid};await new Promise(a=>setTimeout(a,100))}throw new c(`spawned rnx daemon on port ${e} but it did not come up in time. run \`rnx serve\` manually to diagnose.`,"SPAWN_TIMEOUT")}async function h(n={}){await B({port:n.port,startupTimeoutMs:n.startupTimeoutMs});let e=new f(n);try{await e.waitReady()}catch(t){throw e.close(),t}return e}async function ge(n){let[e,...t]=n;try{switch(e){case void 0:case"--help":case"-h":case"help":return L(),0;case"attach":return await W(t);case"projects":return await J();case"project":return await V(t);case"sessions":return await H(t);case"start":return await G(t);case"prompt":return await q(t);case"watch":return await K(t);case"transcript":return await z(t);case"end":return await Q(t);case"paths":return await Y();default:return process.stderr.write(`unknown agent subcommand: ${e}
4
+ import{a as b,b as E,c as A,d as l,e as S,g as x,h as j,j as T,n as I,o as k,p as D,q as g,r as O,s as C}from"./chunk-HSI44CRA.js";import"./chunk-Q6PIUOKR.js";import{c as $}from"./chunk-W3OQUICE.js";import"./chunk-GWCHA7JF.js";import"./chunk-BH52OY5L.js";import"./chunk-FFVJI44X.js";import"./chunk-HDOSUTQZ.js";import"./chunk-7EF3WPYK.js";import"./chunk-VSDVVJ7I.js";import"./chunk-QEZSA6YG.js";import{j as y}from"./chunk-CTCFJXNY.js";import"./chunk-SNHVPXFJ.js";import"./chunk-LFHZHHVR.js";import"./chunk-NKJ3KBIE.js";import"./chunk-SZYAIXGI.js";import w from"node:fs";import d from"node:path";import{spawn as _}from"node:child_process";import F from"node:net";import{WebSocket as R}from"ws";var c=class extends Error{code;constructor(e,t){super(e),this.name="AgentDaemonError",this.code=t}},f=class{ws;port;commandTimeoutMs;ready;closed=!1;nextId=1;pending=new Map;eventListeners=new Set;statusListeners=new Set;disconnectListeners=new Set;constructor(e={}){this.port=e.port??7668,this.commandTimeoutMs=e.commandTimeoutMs??15e3,this.ws=new R(`ws://localhost:${this.port}`),this.ready=new Promise((t,r)=>{let s=()=>{this.ws.off("error",o),t()},o=i=>{this.ws.off("open",s),r(new c(`could not connect to rnx daemon on port ${this.port}: ${i.message}`,"NO_DAEMON"))};this.ws.once("open",s),this.ws.once("error",o)}),this.ws.on("message",t=>this.handleMessage(t)),this.ws.on("close",()=>this.handleClose()),this.ws.on("error",()=>{})}async waitReady(){return this.ready}async listProjects(){return this.send("agent:list-projects")}async upsertProject(e){return this.send("agent:upsert-project",{input:e})}async deleteProject(e){return this.send("agent:delete-project",{projectId:e})}async autoAttachForUrl(e){return this.send("agent:auto-attach-for-url",{input:e})}async listSessions(e){return this.send("agent:list-sessions",{projectId:e})}async startSession(e){return this.send("agent:start-session",{input:e})}async sendPrompt(e,t){return this.send("agent:send-prompt",{sessionId:e,prompt:t})}async sendClaimedPrompt(e,t){return this.send("agent:send-claimed-prompt",{simId:e,prompt:t})}async endSession(e){return this.send("agent:end-session",{sessionId:e})}async getTranscript(e){return this.send("agent:get-transcript",{sessionId:e})}async getPaths(){return this.send("agent:get-paths")}async subscribeEvents(e){return this.send("agent:subscribe-events",{sessionId:e})}async unsubscribeEvents(e){return this.send("agent:unsubscribe-events",{sessionId:e})}onAgentEvent(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}onSessionStatusChange(e){return this.statusListeners.add(e),()=>this.statusListeners.delete(e)}onDisconnect(e){return this.disconnectListeners.add(e),()=>this.disconnectListeners.delete(e)}close(){if(!this.closed){this.closed=!0;try{this.ws.close()}catch{}}}async send(e,t={}){if(await this.ready,this.closed||this.ws.readyState!==R.OPEN)throw new c("daemon connection is closed","NO_DAEMON");let r=this.nextId++;return new Promise((s,o)=>{let i=setTimeout(()=>{this.pending.delete(r),o(new c(`${e} timed out after ${Math.round(this.commandTimeoutMs/1e3)}s`,"TIMEOUT"))},this.commandTimeoutMs);this.pending.set(r,{resolve:s,reject:o,timer:i});try{this.ws.send(JSON.stringify({id:r,type:e,...t}))}catch(a){clearTimeout(i),this.pending.delete(r),o(a instanceof Error?a:new Error(String(a)))}})}handleMessage(e){let t;try{t=JSON.parse(String(e))}catch{return}if(!t||typeof t!="object")return;if(t.type==="agent:event"){for(let s of this.eventListeners)try{s({sessionId:t.sessionId,event:t.event})}catch{}return}if(t.type==="agent:session-status"){for(let s of this.statusListeners)try{s(t.session)}catch{}return}if(typeof t.id!="number")return;let r=this.pending.get(t.id);r&&(this.pending.delete(t.id),clearTimeout(r.timer),t.error?r.reject(new c(t.error,t.code)):r.resolve(t.result))}handleClose(){if(!this.closed){this.closed=!0;for(let[,e]of this.pending)clearTimeout(e.timer),e.reject(new c("daemon disconnected","DISCONNECT"));this.pending.clear();for(let e of this.disconnectListeners)try{e()}catch{}}}};function M(n=7668,e=400){return new Promise(t=>{let r=new F.Socket,s=!1,o=i=>{s||(s=!0,r.destroy(),t(i))};r.setTimeout(e),r.once("connect",()=>o(!0)),r.once("timeout",()=>o(!1)),r.once("error",()=>o(!1)),r.connect(n,"127.0.0.1")})}async function B(n={}){let e=n.port??7668;if(await M(e))return{alreadyRunning:!0};if(y())throw new c(`no rnx bridge on port ${e}. run \`rnx daemon install\` to enable the faster background service, or \`rnx serve\` in another shell.`,"DEV_HOST_REFUSED");let{cmd:t,prefixArgs:r}=C(),s=[...r,"serve","--quiet"];e!==7668&&s.push("--port",String(e));let o=_(t,s,{detached:!0,stdio:"ignore",env:process.env,cwd:process.cwd()});o.unref();let i=Date.now()+(n.startupTimeoutMs??5e3);for(;Date.now()<i;){if(await M(e))return{alreadyRunning:!1,pid:o.pid};await new Promise(a=>setTimeout(a,100))}throw new c(`spawned rnx daemon on port ${e} but it did not come up in time. run \`rnx serve\` manually to diagnose.`,"SPAWN_TIMEOUT")}async function h(n={}){await B({port:n.port,startupTimeoutMs:n.startupTimeoutMs});let e=new f(n);try{await e.waitReady()}catch(t){throw e.close(),t}return e}async function ge(n){let[e,...t]=n;try{switch(e){case void 0:case"--help":case"-h":case"help":return L(),0;case"attach":return await W(t);case"projects":return await J();case"project":return await V(t);case"sessions":return await H(t);case"start":return await G(t);case"prompt":return await q(t);case"watch":return await K(t);case"transcript":return await z(t);case"end":return await Q(t);case"paths":return await Y();default:return process.stderr.write(`unknown agent subcommand: ${e}
5
5
  `),L(),2}}catch(r){if(r instanceof c)return process.stderr.write(`${r.message}
6
6
  `),1;throw r}}async function v(n){let e=await h({clientLabel:"sootsim-agent-cli"});try{return await n(e)}finally{e.close()}}function L(){$("agent")}function P(n,e){let t={},r=[];for(let s=0;s<n.length;s++){let o=n[s],i=e[o];i==="value"?(t[o]=n[s+1]??"",s++):i==="bool"?t[o]=!0:r.push(o)}return{flags:t,positional:r}}function U(n,e="codex"){return n==="codex"||n==="claude"?n:e}async function W(n){let{flags:e,positional:t}=P(n,{"--name":"value","--provider":"value"}),r=t[0];if(!r)return process.stderr.write(`usage: rnx agent attach <dir> [--name X] [--provider codex|claude]
7
7
  `),2;let s=d.resolve(r);if(!w.existsSync(s))return process.stderr.write(`directory does not exist: ${s}
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.355 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.357 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{b as M}from"./chunk-23TG7DLH.js";import"./chunk-S27I7H2K.js";import{execFile as G,spawn as q}from"node:child_process";import{randomUUID as X}from"node:crypto";import{constants as R,createReadStream as Y,createWriteStream as j,existsSync as C,openSync as J}from"node:fs";import V from"node:fs/promises";import z from"node:path";import K from"node:readline";import{promisify as Q}from"node:util";import{spawn as H}from"node:child_process";import L from"node:readline";var b=class extends Error{code;data;constructor(t,r,m){super(t),this.name="CodexRpcError",this.code=r,this.data=m}};function W(d){let t=H(d.bin,["app-server"],{cwd:d.cwd,env:{...process.env,...d.env},stdio:["pipe","pipe","pipe"]}),r=new Map,m=new Map,u=1,f=!1,a=new Promise(s=>{t.on("exit",(o,e)=>{f=!0;let p=new Error(`codex app-server exited (code=${o}, signal=${e??""})`);for(let{reject:y}of r.values())y(p);r.clear(),s({code:o,signal:e})})});L.createInterface({input:t.stdout,crlfDelay:1/0}).on("line",s=>{let o=s.trim();if(!o)return;let e;try{e=JSON.parse(o)}catch{return}if(e.id!=null&&(e.result!==void 0||e.error!==void 0)){let p=typeof e.id=="string"?Number(e.id):e.id,y=p!=null?r.get(p):void 0;if(!y)return;r.delete(p),e.error?y.reject(new b(e.error.message,e.error.code,e.error.data)):y.resolve(e.result);return}if(e.method){let p=m.get(e.method);if(!p)return;for(let y of p)try{y(e.params)}catch(l){console.error(`[codex-client] handler for "${e.method}" threw:`,l instanceof Error?l.stack??l.message:l)}}}),t.stderr.setEncoding("utf8"),t.stderr.on("data",s=>{let o=m.get("__stderr__");if(o)for(let e of o)try{e({text:s})}catch{}});function n(s){if(!f)try{t.stdin.write(JSON.stringify(s)+`
4
+ import{b as M}from"./chunk-Q6PIUOKR.js";import"./chunk-SZYAIXGI.js";import{execFile as G,spawn as q}from"node:child_process";import{randomUUID as X}from"node:crypto";import{constants as R,createReadStream as Y,createWriteStream as j,existsSync as C,openSync as J}from"node:fs";import V from"node:fs/promises";import z from"node:path";import K from"node:readline";import{promisify as Q}from"node:util";import{spawn as H}from"node:child_process";import L from"node:readline";var b=class extends Error{code;data;constructor(t,r,m){super(t),this.name="CodexRpcError",this.code=r,this.data=m}};function W(d){let t=H(d.bin,["app-server"],{cwd:d.cwd,env:{...process.env,...d.env},stdio:["pipe","pipe","pipe"]}),r=new Map,m=new Map,u=1,f=!1,a=new Promise(s=>{t.on("exit",(o,e)=>{f=!0;let p=new Error(`codex app-server exited (code=${o}, signal=${e??""})`);for(let{reject:y}of r.values())y(p);r.clear(),s({code:o,signal:e})})});L.createInterface({input:t.stdout,crlfDelay:1/0}).on("line",s=>{let o=s.trim();if(!o)return;let e;try{e=JSON.parse(o)}catch{return}if(e.id!=null&&(e.result!==void 0||e.error!==void 0)){let p=typeof e.id=="string"?Number(e.id):e.id,y=p!=null?r.get(p):void 0;if(!y)return;r.delete(p),e.error?y.reject(new b(e.error.message,e.error.code,e.error.data)):y.resolve(e.result);return}if(e.method){let p=m.get(e.method);if(!p)return;for(let y of p)try{y(e.params)}catch(l){console.error(`[codex-client] handler for "${e.method}" threw:`,l instanceof Error?l.stack??l.message:l)}}}),t.stderr.setEncoding("utf8"),t.stderr.on("data",s=>{let o=m.get("__stderr__");if(o)for(let e of o)try{e({text:s})}catch{}});function n(s){if(!f)try{t.stdin.write(JSON.stringify(s)+`
5
5
  `)}catch{}}return{exited:a,on(s,o){let e=m.get(s);return e||(e=new Set,m.set(s,e)),e.add(o),()=>{e?.delete(o)}},request(s,o){if(f)return Promise.reject(new Error(`codex app-server closed; cannot call ${s}`));let e=u++;return new Promise((p,y)=>{r.set(e,{resolve:l=>p(l),reject:y,method:s}),n({jsonrpc:"2.0",id:e,method:s,params:o})})},notify(s,o){n({jsonrpc:"2.0",method:s,params:o})},async shutdown(s=1500){if(f)return;try{t.stdin.end()}catch{}let o=setTimeout(()=>{if(!f)try{t.kill("SIGTERM")}catch{}},s);try{await a}finally{clearTimeout(o)}},kill(s="SIGTERM"){if(!f)try{t.kill(s)}catch{}}}}var O="never",F="danger-full-access",Z={type:"dangerFullAccess"},D="fast",ee="medium",te=Q(G);async function ne(d,t){let r=t||d;if(r.includes("/")||r.includes("\\"))return C(r)?{ok:!0,path:r}:{ok:!1,message:`agent binary not found at path: ${r}`};try{let{stdout:m}=await te("which",[r],{timeout:1500}),u=m.trim();return u?{ok:!0,path:u}:{ok:!1,message:`${r} not found on PATH`}}catch{return{ok:!1,message:`${r} not found on PATH. install the ${d} CLI and retry, or pass --${d}-bin /path/to/${d} to agent start.`}}}function re(d){let t={"--session-id":"sessionId","--project-id":"projectId","--provider":"provider","--cwd":"cwd","--prompt-in":"promptIn","--events-out":"eventsOut","--transcript":"transcript","--codex-bin":"codexBin","--claude-bin":"claudeBin","--claude-session-uuid":"claudeSessionUuid"},r={};for(let m=0;m<d.length;m++){let u=d[m];if(u==="--fresh-thread"){r.freshThread=!0;continue}let f=t[u];f&&(r[f]=d[m+1],m++)}return r}async function Ie(d){let t=re(d);if(!t.sessionId||!t.projectId||!t.provider||!t.cwd||!t.promptIn||!t.eventsOut)return process.stderr.write(`usage: rnx agent-wrapper --session-id <id> --project-id <id>
6
6
  --provider codex|claude --cwd <path>
7
7
  --prompt-in <fifo> --events-out <fifo>
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.355 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.357 | (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{o as p}from"./chunk-7URIRES5.js";import"./chunk-XFPGXEKW.js";import"./chunk-PYSIEEKP.js";import"./chunk-S27I7H2K.js";import{existsSync as h,mkdirSync as d,readFileSync as y,writeFileSync as g}from"node:fs";import{join as m}from"node:path";import{gzipSync as w}from"node:zlib";function f(t,e){let o=t.indexOf(`--${e}`);if(o!==-1&&o+1<t.length)return t[o+1];let r=t.find(i=>i.startsWith(`--${e}=`));return r?r.slice(e.length+3):void 0}async function x(t){let e=f(t,"wire")||"",o=f(t,"out-dir"),r=f(t,"manifest");if((!o||!r)&&(console.error(" usage: rnx app-fonts stage --wire <wire> --out-dir <dir> --manifest <path>"),process.exit(1)),!e.trim()){console.log("no app fonts declared \u2014 nothing to stage");return}d(o,{recursive:!0});let i=await p(e,{onStaged:({url:n,byteLength:s})=>console.log(` staged app font: ${n} (${(s/1024).toFixed(1)} KiB)`),onError:(n,s)=>console.error(` warning: failed to fetch app font ${n}: ${s instanceof Error?s.message:s}`)}),a=[];for(let n of i){let s=w(n.bytes);g(m(o,n.urlhash),s),a.push({url:n.url,urlhash:n.urlhash,contentType:n.contentType,encoding:"gzip",sizeBytes:s.length,rawBytes:n.bytes.byteLength})}let c=[];if(h(r))try{let n=JSON.parse(y(r,"utf8"));Array.isArray(n)&&(c=n)}catch{}let u=new Set(c.map(n=>n.urlhash)),l=[...c,...a.filter(n=>!u.has(n.urlhash))];g(r,JSON.stringify(l)),console.log(`staged ${a.length} app font(s); manifest now has ${l.length} file(s)`)}async function E(t){let e=t[0];if(e==="stage"){await x(t.slice(1));return}console.error(` unknown app-fonts subcommand: ${e??"(none)"}`),console.error(" available: stage"),process.exit(1)}export{E as runAppFonts};
4
+ import{o as p}from"./chunk-XX4CRR6G.js";import"./chunk-ETRUMVNS.js";import"./chunk-EJHPODIL.js";import"./chunk-SZYAIXGI.js";import{existsSync as h,mkdirSync as d,readFileSync as y,writeFileSync as g}from"node:fs";import{join as m}from"node:path";import{gzipSync as w}from"node:zlib";function f(t,e){let o=t.indexOf(`--${e}`);if(o!==-1&&o+1<t.length)return t[o+1];let r=t.find(i=>i.startsWith(`--${e}=`));return r?r.slice(e.length+3):void 0}async function x(t){let e=f(t,"wire")||"",o=f(t,"out-dir"),r=f(t,"manifest");if((!o||!r)&&(console.error(" usage: rnx app-fonts stage --wire <wire> --out-dir <dir> --manifest <path>"),process.exit(1)),!e.trim()){console.log("no app fonts declared \u2014 nothing to stage");return}d(o,{recursive:!0});let i=await p(e,{onStaged:({url:n,byteLength:s})=>console.log(` staged app font: ${n} (${(s/1024).toFixed(1)} KiB)`),onError:(n,s)=>console.error(` warning: failed to fetch app font ${n}: ${s instanceof Error?s.message:s}`)}),a=[];for(let n of i){let s=w(n.bytes);g(m(o,n.urlhash),s),a.push({url:n.url,urlhash:n.urlhash,contentType:n.contentType,encoding:"gzip",sizeBytes:s.length,rawBytes:n.bytes.byteLength})}let c=[];if(h(r))try{let n=JSON.parse(y(r,"utf8"));Array.isArray(n)&&(c=n)}catch{}let u=new Set(c.map(n=>n.urlhash)),l=[...c,...a.filter(n=>!u.has(n.urlhash))];g(r,JSON.stringify(l)),console.log(`staged ${a.length} app font(s); manifest now has ${l.length} file(s)`)}async function E(t){let e=t[0];if(e==="stage"){await x(t.slice(1));return}console.error(` unknown app-fonts subcommand: ${e??"(none)"}`),console.error(" available: stage"),process.exit(1)}export{E as runAppFonts};
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.355 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.357 | (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"./chunk-S27I7H2K.js";import{spawn as v}from"child_process";var w=new Set(["describe","find","list","network","logs","count","tree","url","a11y","node","layout","keyboard","errors","warnings","requests","animations","animation","state","sample-color"]),S=new Set(["--exists","--empty","--negate","--quiet","--allow-timeout","!"]),q=new Set(["--count","--count-at-least","--count-at-most","--contains","--not-contains","--matches","--not-matches","--equals","--jq","--has-path","--within"]),P=new Set(["--path-equals"]);function j(s){let r=[],u=[],n=0,e=!1,t=!1,i=!1;for(let o=0;o<s.length;o++){let a=s[o];if(a==="--within"){let c=Number(s[o+1]);if(!Number.isFinite(c)||c<0)return{error:`--within requires a non-negative number, got: ${s[o+1]}`};n=c,o++;continue}if(a==="--negate"||a==="!"){e=!0;continue}if(a==="--quiet"){t=!0;continue}if(a==="--allow-timeout"){i=!0;continue}if(S.has(a)){u.push({kind:a,args:[]});continue}if(q.has(a)){let c=s[o+1];if(c==null)return{error:`${a} requires a value`};u.push({kind:a,args:[c]}),o++;continue}if(P.has(a)){let c=s[o+1],f=s[o+2];if(c==null||f==null)return{error:`${a} requires <path> <value>`};u.push({kind:a,args:[c,f]}),o+=2;continue}r.push(a)}return r.length===0?{error:"assert requires a verb (e.g. find, describe, get errors)"}:{verbArgs:r,predicates:u,withinMs:n,negate:e,quiet:t,allowTimeout:i}}function N(s){return s[0]==="get"||s[0]==="debug"?w.has(s[1])?s[1]:null:s[0]==="do"||s[0]==="wait"?null:w.has(s[0])?s[0]:null}async function R(s){let u=[process.argv[1],...s,"--json"];return new Promise(n=>{let e=v(process.execPath,u,{stdio:["ignore","pipe","pipe"],env:process.env}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",o=>{n({ok:!1,payload:null,reason:`spawn failed: ${o.message}`})}),e.on("close",o=>{if(o!==0){let a=i.trim().split(`
4
+ import"./chunk-SZYAIXGI.js";import{spawn as v}from"child_process";var w=new Set(["describe","find","list","network","logs","count","tree","url","a11y","node","layout","keyboard","errors","warnings","requests","animations","animation","state","sample-color"]),S=new Set(["--exists","--empty","--negate","--quiet","--allow-timeout","!"]),q=new Set(["--count","--count-at-least","--count-at-most","--contains","--not-contains","--matches","--not-matches","--equals","--jq","--has-path","--within"]),P=new Set(["--path-equals"]);function j(s){let r=[],u=[],n=0,e=!1,t=!1,i=!1;for(let o=0;o<s.length;o++){let a=s[o];if(a==="--within"){let c=Number(s[o+1]);if(!Number.isFinite(c)||c<0)return{error:`--within requires a non-negative number, got: ${s[o+1]}`};n=c,o++;continue}if(a==="--negate"||a==="!"){e=!0;continue}if(a==="--quiet"){t=!0;continue}if(a==="--allow-timeout"){i=!0;continue}if(S.has(a)){u.push({kind:a,args:[]});continue}if(q.has(a)){let c=s[o+1];if(c==null)return{error:`${a} requires a value`};u.push({kind:a,args:[c]}),o++;continue}if(P.has(a)){let c=s[o+1],f=s[o+2];if(c==null||f==null)return{error:`${a} requires <path> <value>`};u.push({kind:a,args:[c,f]}),o+=2;continue}r.push(a)}return r.length===0?{error:"assert requires a verb (e.g. find, describe, get errors)"}:{verbArgs:r,predicates:u,withinMs:n,negate:e,quiet:t,allowTimeout:i}}function N(s){return s[0]==="get"||s[0]==="debug"?w.has(s[1])?s[1]:null:s[0]==="do"||s[0]==="wait"?null:w.has(s[0])?s[0]:null}async function R(s){let u=[process.argv[1],...s,"--json"];return new Promise(n=>{let e=v(process.execPath,u,{stdio:["ignore","pipe","pipe"],env:process.env}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",o=>{n({ok:!1,payload:null,reason:`spawn failed: ${o.message}`})}),e.on("close",o=>{if(o!==0){let a=i.trim().split(`
5
5
  `).slice(-2).join(" | ").slice(0,200);n({ok:!1,payload:null,reason:`verb exited ${o}${a?`: ${a}`:""}`});return}if(!t.trim()){n({ok:!1,payload:null,reason:"verb produced no output"});return}try{let a=JSON.parse(t);n({ok:!0,payload:a})}catch{n({ok:!1,payload:null,reason:`verb output was not valid json: ${t.slice(0,120)}`})}})})}function y(s,r){let u=r.split(".").filter(e=>e.length>0),n=s;for(let e of u){if(n==null)return{found:!1};if(Array.isArray(n)){let t=Number(e);if(!Number.isInteger(t)||t<0||t>=n.length)return{found:!1};n=n[t];continue}if(typeof n=="object"){let t=n;if(!(e in t))return{found:!1};n=t[e];continue}return{found:!1}}return{found:!0,value:n}}function d(s){return Array.isArray(s)?s.length:s&&typeof s=="object"?Object.keys(s).length:null}async function A(s,r){let{kind:u,args:n}=s;switch(u){case"--exists":return r==null?{ok:!1,reason:"payload is null"}:d(r)===0?{ok:!1,reason:"payload is empty"}:{ok:!0,reason:"exists"};case"--empty":{if(r==null)return{ok:!0,reason:"payload is null"};let e=d(r);return e===0?{ok:!0,reason:"payload is empty"}:{ok:!1,reason:`payload has ${e} item(s)`}}case"--count":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:`payload not countable (${typeof r})`}:{ok:t===e,reason:`count=${t}, want=${e}`}}case"--count-at-least":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:"payload not countable"}:{ok:t>=e,reason:`count=${t}, want>=${e}`}}case"--count-at-most":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:"payload not countable"}:{ok:t<=e,reason:`count=${t}, want<=${e}`}}case"--contains":{let e=n[0],t=JSON.stringify(r);return{ok:t.includes(e),reason:t.includes(e)?`contains "${e}"`:`missing "${e}"`}}case"--not-contains":{let e=n[0],t=JSON.stringify(r);return{ok:!t.includes(e),reason:t.includes(e)?`unexpected "${e}"`:`not contains "${e}"`}}case"--matches":{let e=new RegExp(n[0]),t=JSON.stringify(r),i=e.test(t);return{ok:i,reason:i?`matches /${n[0]}/`:`no match for /${n[0]}/`}}case"--not-matches":{let e=new RegExp(n[0]),t=JSON.stringify(r),i=!e.test(t);return{ok:i,reason:i?`not matches /${n[0]}/`:`unexpected /${n[0]}/`}}case"--equals":{let e=n[0],t=typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(r):JSON.stringify(r);return{ok:t===e,reason:`got=${JSON.stringify(t)}, want=${JSON.stringify(e)}`}}case"--has-path":{let e=y(r,n[0]);return{ok:e.found,reason:e.found?`path ${n[0]} present`:`path ${n[0]} missing`}}case"--path-equals":{let[e,t]=n,i=y(r,e);if(!i.found)return{ok:!1,reason:`path ${e} missing`};let o=typeof i.value=="string"||typeof i.value=="number"||typeof i.value=="boolean"?String(i.value):JSON.stringify(i.value);return{ok:o===t,reason:`${e}=${o}, want=${t}`}}case"--jq":{let e=n[0];try{let i=(await O(e,r)).trim();return{ok:i.length>0&&i!=="null"&&i!=="false"&&i!=='""',reason:`jq: ${i.slice(0,120)}`}}catch(t){throw new Error(`jq evaluation failed: ${t.message}`)}}default:return{ok:!1,reason:`unknown predicate ${u}`}}}function O(s,r){return new Promise((u,n)=>{let e=v("jq",[s],{stdio:["pipe","pipe","pipe"]}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",n),e.on("close",o=>{if(o!==0){n(new Error(i.trim()||`jq exited ${o}`));return}u(t)}),e.stdin.end(JSON.stringify(r))})}async function T(s){(s[0]==="--help"||s[0]==="-h"||s.length===0)&&(J(),process.exit(s.length===0?2:0));let r=j(s);"error"in r&&(process.stderr.write(` assert: ${r.error}
6
6
  `),process.exit(2));let{verbArgs:u,predicates:n,withinMs:e,negate:t,quiet:i,allowTimeout:o}=r;N(u)||(process.stderr.write(` assert: unknown or non-read verb: ${u.join(" ")}
7
7
  supported: ${Array.from(w).sort().join(", ")}
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.355 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.357 | (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 r}from"./chunk-SJEAA2FW.js";import{d as t}from"./chunk-LJCBPR7S.js";import"./chunk-F6S4Z7N7.js";import"./chunk-S27I7H2K.js";function i(){console.log(`
4
+ import{a as r}from"./chunk-HVKQHXHS.js";import{d as t}from"./chunk-HXXKL7NU.js";import"./chunk-CTCFJXNY.js";import"./chunk-SZYAIXGI.js";function i(){console.log(`
5
5
  rnx auth \u2014 inspect CLI auth
6
6
 
7
7
  usage:
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.355 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.357 | (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}from"./chunk-IAVHAWDL.js";import"./chunk-S27I7H2K.js";export{d as BETA_ASK_HEADLINE,b as BETA_LABEL,c as BETA_TAGLINE,a as IS_BETA};
4
+ import{a,b,c,d}from"./chunk-NKJ3KBIE.js";import"./chunk-SZYAIXGI.js";export{d as BETA_ASK_HEADLINE,b as BETA_LABEL,c as BETA_TAGLINE,a as IS_BETA};
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.355 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.357 | (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{m as O}from"./chunk-JYQNEVHV.js";import"./chunk-VEMZUXVR.js";import{q as E,s as F,u as N}from"./chunk-42LIUAHU.js";import"./chunk-QWJD2CAJ.js";import{r as S}from"./chunk-F6S4Z7N7.js";import"./chunk-S27I7H2K.js";import{createHash as I,randomUUID as q}from"node:crypto";import{createReadStream as D}from"node:fs";import m from"node:fs/promises";import f from"node:path";var T="/__camera-fixtures/",J=new Set([".m4v",".mov",".mp4",".webm"]);function _(){console.log(`
4
+ import{m as O}from"./chunk-45C2CATW.js";import"./chunk-5O3YY3ND.js";import{q as E,s as F,u as N}from"./chunk-7EF3WPYK.js";import"./chunk-VSDVVJ7I.js";import{r as S}from"./chunk-CTCFJXNY.js";import"./chunk-SZYAIXGI.js";import{createHash as I,randomUUID as q}from"node:crypto";import{createReadStream as D}from"node:fs";import m from"node:fs/promises";import f from"node:path";var T="/__camera-fixtures/",J=new Set([".m4v",".mov",".mp4",".webm"]);function _(){console.log(`
5
5
  rnx camera \u2014 control the simulator camera source
6
6
 
7
7
  usage:
@@ -1,3 +1,3 @@
1
- /*! rnx v0.1.355 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.357 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
@@ -1,6 +1,6 @@
1
- /*! rnx v0.1.355 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.357 | (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 C}from"./chunk-Y5BP72QO.js";import{f as h}from"./chunk-IJGL6T4M.js";import{L as B,T as b,g as S}from"./chunk-F6S4Z7N7.js";import o from"node:fs";import c from"node:path";var g=1,k=`automatic-cleanup-v${g}.json`,x=`automatic-cleanup-v${g}.lock`,A=360*60*1e3;function w(){let i=c.join(S(),k);try{return JSON.parse(o.readFileSync(i,"utf8")).generation===g}catch{return!1}}function $(i){if(i<1024)return`${i} B`;let e=["KiB","MiB","GiB","TiB"],n=i/1024,r=e[0];for(let s=1;s<e.length&&n>=1024;s++)n/=1024,r=e[s];return`${n.toFixed(n>=10?1:2)} ${r}`}function p(i){let e;try{e=o.lstatSync(i)}catch{return 0}let n=e.blocks>0?e.blocks*512:e.size;if(!e.isDirectory()||e.isSymbolicLink())return n;let r=n;try{for(let s of o.readdirSync(i))r+=p(c.join(i,s))}catch{}return r}function E(i){for(let e of["SingletonLock","SingletonSocket","lockfile"])try{if(o.lstatSync(c.join(i,e)))return!0}catch{}return!1}function v(i,e){let n;try{n=o.readdirSync(i,{withFileTypes:!0})}catch{return[]}let r=E(e),s=[];for(let t of n){if(!t.isDirectory()||t.isSymbolicLink())continue;let a=c.join(i,t.name);if(C(t.name)){s.push({path:a,bytes:p(a),kind:"browser-cache",state:r?"in-use":"safe",selected:!r,detail:r?"browser profile is open; close it before cleanup":"disposable browser HTTP, bytecode, or GPU cache"});continue}s.push(...v(a,e))}return s}function P(i){let e=c.join(i,"profiles","playwright"),n;try{n=o.readdirSync(e,{withFileTypes:!0})}catch{return[]}return n.flatMap(r=>{if(!r.isDirectory()||r.isSymbolicLink())return[];let s=c.join(e,r.name);return v(s,s)})}function L(i){let e=c.join(i,"electron","userData");return v(e,e)}function R(i,e){let n=c.join(i,"recordings"),r;try{r=o.readdirSync(n,{withFileTypes:!0})}catch{return[]}return r.map(s=>{let t=c.join(n,s.name);return{path:t,bytes:p(t),kind:"recording",state:"aggressive",selected:e,detail:"user-created recording or captured-frame output"}})}function T(i,e){let n=c.join(i,"camera-fixtures"),r;try{r=o.readdirSync(n,{withFileTypes:!0})}catch{return[]}return r.map(s=>{let t=c.join(n,s.name);return{path:t,bytes:p(t),kind:"camera-fixture",state:"aggressive",selected:e,detail:"staged camera fixture video"}})}function U(i){let e=new Set(b()),n=[...e],r=h.planLocalRetention({retainVersions:2,protectVersions:n}),s=h.planLocalRetention({retainVersions:1,protectVersions:n}),t=new Set(r.removeVersions),a=new Set(s.removeVersions),l=new Set([...r.keepVersions,...r.removeVersions,...s.keepVersions,...s.removeVersions]),m=[];for(let u of[...l].sort()){let d=h.product.runtimeDir(u),y="retained",f="retained runtime";e.has(u)&&u!==r.activeVersion?(y="in-use",f="runtime is serving a connected simulator"):t.has(u)?(y="safe",f="inactive runtime outside the two-version rollback window"):a.has(u)?(y="aggressive",f="most recent rollback runtime"):u===r.activeVersion&&(f="active runtime; always protected"),m.push({path:d,bytes:p(d),kind:"runtime-version",state:y,selected:y==="safe"||y==="aggressive"&&i,detail:f})}for(let u of r.removeCacheFiles)m.push({path:u,bytes:p(u),kind:"runtime-archive",state:"safe",selected:!0,detail:"downloaded archive is unnecessary after successful extraction"});return{activeRuntime:r.activeVersion,entries:m}}function D(i={}){let e=i.aggressive===!0,n=S(),r=U(e),s=[...r.entries,...P(n),...L(n),...R(n,e),...T(n,e)].sort((t,a)=>a.bytes-t.bytes||t.path.localeCompare(a.path));return{home:n,activeRuntime:r.activeRuntime,entries:s,reclaimableBytes:s.reduce((t,a)=>t+(a.selected?a.bytes:0),0),protectedBytes:s.reduce((t,a)=>t+(a.selected?0:a.bytes),0),totalBytes:p(n)}}function I(i,e){let n=c.relative(i,e);if(!n||n.startsWith("..")||c.isAbsolute(n))throw new Error(`refusing cleanup target outside the rnx data home: ${e}`)}function V(i={}){let e=D(i),n=i.aggressive===!0?1:2;h.pruneLocalRetention({retainVersions:n,protectVersions:b()});for(let t of e.entries)if(t.selected&&!(t.kind==="runtime-archive"||t.kind==="runtime-version")){if(t.kind==="browser-cache"){let l=c.relative(e.home,t.path).split(c.sep),m=l[0]==="profiles"&&l[1]==="playwright"&&l[2]?c.join(e.home,"profiles","playwright",l[2]):l[0]==="electron"&&l[1]==="userData"?c.join(e.home,"electron","userData"):null;if(m&&E(m)){t.state="in-use",t.selected=!1,t.detail="browser profile opened while cleanup was starting";continue}}I(e.home,t.path),o.rmSync(t.path,{recursive:!0,force:!0})}let r=e.entries.filter(t=>t.selected&&!o.existsSync(t.path)).map(t=>t.path),s=p(e.home);return{...e,removedPaths:r,reclaimedBytes:Math.max(0,e.totalBytes-s),remainingBytes:s}}function M(){B();let i=S(),e=c.join(i,k),n=c.join(i,x);if(w())return{status:"already-complete",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};let r=null;for(let s=0;s<2&&r===null;s++)try{let t=o.openSync(n,"wx");try{o.writeFileSync(t,`${JSON.stringify({pid:process.pid,startedAt:Date.now()})}
4
+ import{b as C}from"./chunk-RGSHPACG.js";import{f as h}from"./chunk-N3V5KXWQ.js";import{L as B,T as b,g as S}from"./chunk-CTCFJXNY.js";import o from"node:fs";import c from"node:path";var g=1,k=`automatic-cleanup-v${g}.json`,x=`automatic-cleanup-v${g}.lock`,A=360*60*1e3;function w(){let i=c.join(S(),k);try{return JSON.parse(o.readFileSync(i,"utf8")).generation===g}catch{return!1}}function $(i){if(i<1024)return`${i} B`;let e=["KiB","MiB","GiB","TiB"],n=i/1024,r=e[0];for(let s=1;s<e.length&&n>=1024;s++)n/=1024,r=e[s];return`${n.toFixed(n>=10?1:2)} ${r}`}function p(i){let e;try{e=o.lstatSync(i)}catch{return 0}let n=e.blocks>0?e.blocks*512:e.size;if(!e.isDirectory()||e.isSymbolicLink())return n;let r=n;try{for(let s of o.readdirSync(i))r+=p(c.join(i,s))}catch{}return r}function E(i){for(let e of["SingletonLock","SingletonSocket","lockfile"])try{if(o.lstatSync(c.join(i,e)))return!0}catch{}return!1}function v(i,e){let n;try{n=o.readdirSync(i,{withFileTypes:!0})}catch{return[]}let r=E(e),s=[];for(let t of n){if(!t.isDirectory()||t.isSymbolicLink())continue;let a=c.join(i,t.name);if(C(t.name)){s.push({path:a,bytes:p(a),kind:"browser-cache",state:r?"in-use":"safe",selected:!r,detail:r?"browser profile is open; close it before cleanup":"disposable browser HTTP, bytecode, or GPU cache"});continue}s.push(...v(a,e))}return s}function P(i){let e=c.join(i,"profiles","playwright"),n;try{n=o.readdirSync(e,{withFileTypes:!0})}catch{return[]}return n.flatMap(r=>{if(!r.isDirectory()||r.isSymbolicLink())return[];let s=c.join(e,r.name);return v(s,s)})}function L(i){let e=c.join(i,"electron","userData");return v(e,e)}function R(i,e){let n=c.join(i,"recordings"),r;try{r=o.readdirSync(n,{withFileTypes:!0})}catch{return[]}return r.map(s=>{let t=c.join(n,s.name);return{path:t,bytes:p(t),kind:"recording",state:"aggressive",selected:e,detail:"user-created recording or captured-frame output"}})}function T(i,e){let n=c.join(i,"camera-fixtures"),r;try{r=o.readdirSync(n,{withFileTypes:!0})}catch{return[]}return r.map(s=>{let t=c.join(n,s.name);return{path:t,bytes:p(t),kind:"camera-fixture",state:"aggressive",selected:e,detail:"staged camera fixture video"}})}function U(i){let e=new Set(b()),n=[...e],r=h.planLocalRetention({retainVersions:2,protectVersions:n}),s=h.planLocalRetention({retainVersions:1,protectVersions:n}),t=new Set(r.removeVersions),a=new Set(s.removeVersions),l=new Set([...r.keepVersions,...r.removeVersions,...s.keepVersions,...s.removeVersions]),m=[];for(let u of[...l].sort()){let d=h.product.runtimeDir(u),y="retained",f="retained runtime";e.has(u)&&u!==r.activeVersion?(y="in-use",f="runtime is serving a connected simulator"):t.has(u)?(y="safe",f="inactive runtime outside the two-version rollback window"):a.has(u)?(y="aggressive",f="most recent rollback runtime"):u===r.activeVersion&&(f="active runtime; always protected"),m.push({path:d,bytes:p(d),kind:"runtime-version",state:y,selected:y==="safe"||y==="aggressive"&&i,detail:f})}for(let u of r.removeCacheFiles)m.push({path:u,bytes:p(u),kind:"runtime-archive",state:"safe",selected:!0,detail:"downloaded archive is unnecessary after successful extraction"});return{activeRuntime:r.activeVersion,entries:m}}function D(i={}){let e=i.aggressive===!0,n=S(),r=U(e),s=[...r.entries,...P(n),...L(n),...R(n,e),...T(n,e)].sort((t,a)=>a.bytes-t.bytes||t.path.localeCompare(a.path));return{home:n,activeRuntime:r.activeRuntime,entries:s,reclaimableBytes:s.reduce((t,a)=>t+(a.selected?a.bytes:0),0),protectedBytes:s.reduce((t,a)=>t+(a.selected?0:a.bytes),0),totalBytes:p(n)}}function I(i,e){let n=c.relative(i,e);if(!n||n.startsWith("..")||c.isAbsolute(n))throw new Error(`refusing cleanup target outside the rnx data home: ${e}`)}function V(i={}){let e=D(i),n=i.aggressive===!0?1:2;h.pruneLocalRetention({retainVersions:n,protectVersions:b()});for(let t of e.entries)if(t.selected&&!(t.kind==="runtime-archive"||t.kind==="runtime-version")){if(t.kind==="browser-cache"){let l=c.relative(e.home,t.path).split(c.sep),m=l[0]==="profiles"&&l[1]==="playwright"&&l[2]?c.join(e.home,"profiles","playwright",l[2]):l[0]==="electron"&&l[1]==="userData"?c.join(e.home,"electron","userData"):null;if(m&&E(m)){t.state="in-use",t.selected=!1,t.detail="browser profile opened while cleanup was starting";continue}}I(e.home,t.path),o.rmSync(t.path,{recursive:!0,force:!0})}let r=e.entries.filter(t=>t.selected&&!o.existsSync(t.path)).map(t=>t.path),s=p(e.home);return{...e,removedPaths:r,reclaimedBytes:Math.max(0,e.totalBytes-s),remainingBytes:s}}function M(){B();let i=S(),e=c.join(i,k),n=c.join(i,x);if(w())return{status:"already-complete",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};let r=null;for(let s=0;s<2&&r===null;s++)try{let t=o.openSync(n,"wx");try{o.writeFileSync(t,`${JSON.stringify({pid:process.pid,startedAt:Date.now()})}
5
5
  `,"utf8"),r=t}catch(a){o.closeSync(t);try{o.unlinkSync(n)}catch{}throw a}}catch(t){if((t instanceof Error&&"code"in t?t.code:null)!=="EEXIST")throw t;let l=0,m=0,u=null;try{u=o.lstatSync(n);let d=JSON.parse(o.readFileSync(n,"utf8"));l=typeof d.pid=="number"?d.pid:0,m=typeof d.startedAt=="number"?d.startedAt:0}catch{}if(l>0&&m>0&&Date.now()-m<A)try{return process.kill(l,0),{status:"busy",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0}}catch{}if(!u)continue;try{let d=o.lstatSync(n);if(d.dev!==u.dev||d.ino!==u.ino)return{status:"busy",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};o.unlinkSync(n)}catch{}}if(r===null)return{status:"busy",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};try{if(w())return{status:"already-complete",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};let s=V(),t=s.entries.reduce((l,m)=>l+(m.state==="in-use"?m.bytes:0),0);if(t>0)return{status:"deferred",reclaimedBytes:s.reclaimedBytes,remainingBytes:s.remainingBytes,deferredInUseBytes:t};let a=`${e}.${process.pid}.tmp`;return o.writeFileSync(a,`${JSON.stringify({generation:g,completedAt:Date.now(),reclaimedBytes:s.reclaimedBytes})}
6
6
  `,"utf8"),o.renameSync(a,e),{status:"complete",reclaimedBytes:s.reclaimedBytes,remainingBytes:s.remainingBytes,deferredInUseBytes:0}}finally{o.closeSync(r);try{o.unlinkSync(n)}catch{}}}export{w as a,$ as b,D as c,V as d,M as e};