sootsim 0.1.64 → 0.1.65

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 (137) hide show
  1. package/dist-cli/bin.js +3 -3
  2. package/dist-cli/chunks/{agent-SHMN3LWB.js → agent-44BHCTZA.js} +2 -2
  3. package/dist-cli/chunks/{agent-wrapper-ESDQSMYX.js → agent-wrapper-BEP5WHZR.js} +2 -2
  4. package/dist-cli/chunks/{assert-X3GQJUDI.js → assert-SKDEGGRD.js} +2 -2
  5. package/dist-cli/chunks/auto-bootstrap-SMQMN7WS.js +2 -0
  6. package/dist-cli/chunks/beta-DEQZ2J7G.js +2 -0
  7. package/dist-cli/chunks/{chunk-ALDKVFW3.js → chunk-2EBGZC4A.js} +2 -2
  8. package/dist-cli/chunks/chunk-3HC3F7CO.js +3 -0
  9. package/dist-cli/chunks/{chunk-RRGCQNVD.js → chunk-46OKLW3Z.js} +1 -1
  10. package/dist-cli/chunks/{chunk-R6ZTREB6.js → chunk-5MMRIGC3.js} +2 -2
  11. package/dist-cli/chunks/chunk-5MRRLWSD.js +1 -0
  12. package/dist-cli/chunks/{chunk-DJIQVKM6.js → chunk-5ZB5ZN5Z.js} +47 -10
  13. package/dist-cli/chunks/{chunk-DSLBZC6J.js → chunk-6GZS5TCL.js} +2 -2
  14. package/dist-cli/chunks/chunk-B32KMMQV.js +2 -0
  15. package/dist-cli/chunks/chunk-CBRKFAOD.js +1 -0
  16. package/dist-cli/chunks/chunk-DLSOZVYM.js +1 -0
  17. package/dist-cli/chunks/chunk-E6CRWOWO.js +2 -0
  18. package/dist-cli/chunks/{chunk-2GAZ3JW7.js → chunk-ELZHT3LB.js} +2 -2
  19. package/dist-cli/chunks/{chunk-LKJI7RRW.js → chunk-FPOQPEGK.js} +4 -4
  20. package/dist-cli/chunks/{chunk-OBL6OIK5.js → chunk-FRANP4PR.js} +1 -1
  21. package/dist-cli/chunks/{chunk-X3QWOTLT.js → chunk-FU33BTPL.js} +1 -1
  22. package/dist-cli/chunks/{chunk-YXZFG3ZY.js → chunk-GHFA4O5B.js} +1 -1
  23. package/dist-cli/chunks/{chunk-34PKFCEI.js → chunk-GHTXP5R7.js} +3 -3
  24. package/dist-cli/chunks/{chunk-PXRELDJJ.js → chunk-GZCZ4GCS.js} +2 -2
  25. package/dist-cli/chunks/{chunk-VGD57MTN.js → chunk-HNXQ2JP6.js} +2 -2
  26. package/dist-cli/chunks/{chunk-3R3BQDKC.js → chunk-JC5L5ZJX.js} +2 -2
  27. package/dist-cli/chunks/{chunk-J6TCNU6W.js → chunk-KKOOZPQP.js} +1 -1
  28. package/dist-cli/chunks/{chunk-6X3I2LF4.js → chunk-L2SDB6G5.js} +2 -2
  29. package/dist-cli/chunks/{chunk-ZV2TI6OH.js → chunk-M4HI2THN.js} +2 -2
  30. package/dist-cli/chunks/{chunk-L3MRXOBW.js → chunk-MLPLYQGK.js} +3 -3
  31. package/dist-cli/chunks/{chunk-YGMHOMAJ.js → chunk-MSBMGQJE.js} +2 -2
  32. package/dist-cli/chunks/{chunk-VE4QTDAY.js → chunk-NJ2ACA36.js} +2 -2
  33. package/dist-cli/chunks/{chunk-HERZHQFG.js → chunk-NTEZEQSB.js} +2 -2
  34. package/dist-cli/chunks/{chunk-RKUDWRIN.js → chunk-O56DABNK.js} +2 -2
  35. package/dist-cli/chunks/{chunk-G4GM43A7.js → chunk-OTWUZRFZ.js} +2 -2
  36. package/dist-cli/chunks/{chunk-XHDHG6YH.js → chunk-P2C3JX3D.js} +1 -1
  37. package/dist-cli/chunks/{chunk-N63QYSHT.js → chunk-PTUCXL7Y.js} +3 -3
  38. package/dist-cli/chunks/{chunk-GKUKCZBA.js → chunk-R2QEABGZ.js} +1 -1
  39. package/dist-cli/chunks/{chunk-SMYSG4VE.js → chunk-S46M5JZP.js} +1 -1
  40. package/dist-cli/chunks/{chunk-T5TDH2UO.js → chunk-TRHZBTPF.js} +1 -1
  41. package/dist-cli/chunks/{chunk-WKVIKFMU.js → chunk-TWKWXGN5.js} +1 -1
  42. package/dist-cli/chunks/{chunk-BT6IVKHN.js → chunk-U5EQ5RWL.js} +2 -2
  43. package/dist-cli/chunks/{chunk-YJIQYIHM.js → chunk-UH4H5HXN.js} +1 -1
  44. package/dist-cli/chunks/{chunk-UVDVALC7.js → chunk-UHYZO26V.js} +2 -2
  45. package/dist-cli/chunks/chunk-UXFF7AEE.js +73 -0
  46. package/dist-cli/chunks/{chunk-346HJVD6.js → chunk-VGQXIMEX.js} +1 -1
  47. package/dist-cli/chunks/{chunk-RQHWF2OD.js → chunk-X2IIAIAP.js} +2 -2
  48. package/dist-cli/chunks/{chunk-FFVJK2R7.js → chunk-X75XFMI4.js} +2 -2
  49. package/dist-cli/chunks/{chunk-SVT7H2QF.js → chunk-ZW3HKMLQ.js} +2 -2
  50. package/dist-cli/chunks/cli-version-HH7DAYBK.js +2 -0
  51. package/dist-cli/chunks/{compat-SOHG4UE5.js → compat-MDZTV64M.js} +3 -3
  52. package/dist-cli/chunks/{config-JQF6TGCG.js → config-DRGNQOYL.js} +2 -2
  53. package/dist-cli/chunks/control-NCUWAXPH.js +2 -0
  54. package/dist-cli/chunks/{cpu-profile-3C7LHLJE.js → cpu-profile-JQAGHLDS.js} +2 -2
  55. package/dist-cli/chunks/{daemon-SD773LNY.js → daemon-3RT7EABW.js} +2 -2
  56. package/dist-cli/chunks/{debug-MNWVCAAF.js → debug-CYINYNWV.js} +3 -3
  57. package/dist-cli/chunks/demo-app-registry-JGIZ7NN7.js +2 -0
  58. package/dist-cli/chunks/{detox-VOWHHVNU.js → detox-DUABQYC6.js} +2 -2
  59. package/dist-cli/chunks/{device-TFKPS72A.js → device-KSSSQOQC.js} +2 -2
  60. package/dist-cli/chunks/{diagnose-J2BTJTGW.js → diagnose-NUDACXIR.js} +2 -2
  61. package/dist-cli/chunks/drivers-CKGMOVM4.js +2 -0
  62. package/dist-cli/chunks/{electron-NHJHQAOJ.js → electron-LC3Y74FA.js} +3 -3
  63. package/dist-cli/chunks/flow-3AHNNHF7.js +2 -0
  64. package/dist-cli/chunks/{hints-XONGBPNI.js → hints-EOARRVNB.js} +2 -2
  65. package/dist-cli/chunks/{home-paths-KK7NZVIK.js → home-paths-HOBR3K3B.js} +2 -2
  66. package/dist-cli/chunks/{inspect-7AINMWI2.js → inspect-QCZVODE6.js} +13 -13
  67. package/dist-cli/chunks/install-747G2O4S.js +2 -0
  68. package/dist-cli/chunks/{install-desktop-CRFW4MDL.js → install-desktop-W2OOILJG.js} +3 -3
  69. package/dist-cli/chunks/{keys-PLJITE2X.js → keys-RR43E2O3.js} +2 -2
  70. package/dist-cli/chunks/{launch-FHMTFUI3.js → launch-GAPSA5HQ.js} +3 -3
  71. package/dist-cli/chunks/{login-DCFVFSY3.js → login-IADXSJEW.js} +4 -4
  72. package/dist-cli/chunks/{logout-55UH67FS.js → logout-AT33MGA7.js} +2 -2
  73. package/dist-cli/chunks/{maestro-HNNW73KG.js → maestro-G36ATKHQ.js} +2 -2
  74. package/dist-cli/chunks/{preview-EYIZWAEJ.js → preview-BJUMMDBL.js} +2 -2
  75. package/dist-cli/chunks/{profile-UOG2ET7W.js → profile-CEQNS53P.js} +2 -2
  76. package/dist-cli/chunks/{react-MRICF5YD.js → react-BPEDK3TN.js} +2 -2
  77. package/dist-cli/chunks/{record-33ZECMTQ.js → record-73CGQ3EP.js} +2 -2
  78. package/dist-cli/chunks/runtime-QR5IHGKJ.js +2 -0
  79. package/dist-cli/chunks/{runtime-delivery-KYEJ3C24.js → runtime-delivery-IYK2HNPG.js} +2 -2
  80. package/dist-cli/chunks/{screenshot-B6B3CE2W.js → screenshot-GUM2U2PN.js} +2 -2
  81. package/dist-cli/chunks/{screenshot-mode-QVII6GH6.js → screenshot-mode-VUBCO7T2.js} +2 -2
  82. package/dist-cli/chunks/{screenshots-GYQ3JHAW.js → screenshots-JENURQSV.js} +2 -2
  83. package/dist-cli/chunks/{server-G4WPXKFR.js → server-PVAO3OA2.js} +2 -2
  84. package/dist-cli/chunks/setup-repo-ECVECJZQ.js +2 -0
  85. package/dist-cli/chunks/{skills-RF27H27Y.js → skills-4JI327YS.js} +2 -2
  86. package/dist-cli/chunks/{start-EBOUYGAP.js → start-7YB4I5V5.js} +4 -4
  87. package/dist-cli/chunks/store-2MXXL4QE.js +2 -0
  88. package/dist-cli/chunks/telemetry-GIA7FIKW.js +2 -0
  89. package/dist-cli/chunks/{test-SATSKLC6.js → test-5C6NYF62.js} +3 -3
  90. package/dist-cli/chunks/{three-mode-XLTSGRVJ.js → three-mode-C6TE63VR.js} +2 -2
  91. package/dist-cli/chunks/{timeline-ELOCAU3S.js → timeline-NFYS6IPO.js} +2 -2
  92. package/dist-cli/chunks/{upgrade-2OZLYETX.js → upgrade-KROEHYG2.js} +2 -2
  93. package/dist-cli/chunks/upload-OS3J5ZOS.js +2 -0
  94. package/dist-cli/chunks/{web-YOKL7JUD.js → web-UTOZ7MRF.js} +2 -2
  95. package/dist-cli/chunks/{what-happened-YGFJR2TI.js → what-happened-FCP2U43H.js} +2 -2
  96. package/dist-cli/chunks/{whoami-GKH3GF3H.js → whoami-O6XVOJBF.js} +2 -2
  97. package/dist-lib/agent-daemon-client.cjs +1 -1
  98. package/dist-lib/agent-events.cjs +1 -1
  99. package/dist-lib/agent-sessions.cjs +1 -1
  100. package/dist-lib/attached-projects.cjs +1 -1
  101. package/dist-lib/auth/shared-session.cjs +1 -1
  102. package/dist-lib/backend-origin.cjs +1 -1
  103. package/dist-lib/bridge-constants.cjs +1 -1
  104. package/dist-lib/cli-constants.cjs +1 -1
  105. package/dist-lib/config.cjs +1 -1
  106. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  107. package/dist-lib/home-paths.cjs +1 -1
  108. package/dist-lib/host/bridge-host.cjs +1 -1
  109. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  110. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  111. package/dist-lib/index.cjs +1 -1
  112. package/dist-lib/metro.cjs +1 -1
  113. package/dist-lib/profiles.cjs +1 -1
  114. package/dist-lib/render-mode.cjs +1 -1
  115. package/dist-lib/vite-base.cjs +1 -1
  116. package/dist-lib/vite.cjs +1 -1
  117. package/package.json +1 -1
  118. package/dist-cli/chunks/auto-bootstrap-PH4II3F2.js +0 -2
  119. package/dist-cli/chunks/beta-YKR6YRXH.js +0 -2
  120. package/dist-cli/chunks/chunk-CETSCOUK.js +0 -1
  121. package/dist-cli/chunks/chunk-E5EWHEA5.js +0 -3
  122. package/dist-cli/chunks/chunk-KY2VMN66.js +0 -1
  123. package/dist-cli/chunks/chunk-M4CADRP5.js +0 -66
  124. package/dist-cli/chunks/chunk-OBSMT5TS.js +0 -2
  125. package/dist-cli/chunks/chunk-WN4XOOK5.js +0 -2
  126. package/dist-cli/chunks/chunk-XHD3XCT5.js +0 -1
  127. package/dist-cli/chunks/cli-version-32VNOX3F.js +0 -2
  128. package/dist-cli/chunks/control-GIAGLNPG.js +0 -2
  129. package/dist-cli/chunks/demo-app-registry-JUKLYD4R.js +0 -2
  130. package/dist-cli/chunks/drivers-HVKRY4MB.js +0 -2
  131. package/dist-cli/chunks/flow-D6MKC5NH.js +0 -2
  132. package/dist-cli/chunks/install-YPSDICK4.js +0 -2
  133. package/dist-cli/chunks/runtime-OG4HGCYH.js +0 -2
  134. package/dist-cli/chunks/setup-repo-2TQURG52.js +0 -2
  135. package/dist-cli/chunks/store-FRMH2SYG.js +0 -2
  136. package/dist-cli/chunks/telemetry-EZIRTFFL.js +0 -2
  137. package/dist-cli/chunks/upload-SJCUW6BT.js +0 -2
package/dist-cli/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- /*! sootsim v0.1.64 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
3
- import{a as l}from"./chunks/chunk-PXRELDJJ.js";import{a as A,b as k,c as S,d as L,e as u,f as T}from"./chunks/chunk-GKUKCZBA.js";import{a as d}from"./chunks/chunk-WN4XOOK5.js";import{a as v,d as _}from"./chunks/chunk-RRGCQNVD.js";import{a as E}from"./chunks/chunk-XHDHG6YH.js";import"./chunks/chunk-BT6IVKHN.js";import"./chunks/chunk-OBSMT5TS.js";import{z as C}from"./chunks/chunk-WKVIKFMU.js";import"./chunks/chunk-J6TCNU6W.js";function y(){let t=C();return`sootsim CLI v${E()} \xB7 runtime ${t?`v${t}`:"not installed"}`}function g(){let t=k({bridgePort:7668,defaultShellUrl:d},l()),e=`
2
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
3
+ import{a as l}from"./chunks/chunk-GZCZ4GCS.js";import{a as A,b as k,c as S,d as L,e as u,f as T}from"./chunks/chunk-R2QEABGZ.js";import{a as d}from"./chunks/chunk-B32KMMQV.js";import{a as v,d as _}from"./chunks/chunk-46OKLW3Z.js";import{a as E}from"./chunks/chunk-P2C3JX3D.js";import"./chunks/chunk-U5EQ5RWL.js";import"./chunks/chunk-E6CRWOWO.js";import{z as C}from"./chunks/chunk-TWKWXGN5.js";import"./chunks/chunk-KKOOZPQP.js";function y(){let t=C();return`sootsim CLI v${E()} \xB7 runtime ${t?`v${t}`:"not installed"}`}function g(){let t=k({bridgePort:7668,defaultShellUrl:d},l()),e=`
4
4
  ${_}
5
5
  `;console.log(`${y()}
6
6
  ${e}${t}
@@ -28,4 +28,4 @@ show the current shared desktop account used by the CLI and electron.
28
28
  it needs vite / electron / playwright from a project's node_modules.
29
29
  install the npm package and run via bun or node instead:
30
30
  npm i -g sootsim && sootsim ${t}
31
- `),process.exit(1))}var o=T(process.argv);{let{trackCliEvent:t}=await import("./chunks/telemetry-EZIRTFFL.js");t({event:"cli_command_invoked",properties:{command:o.command||(o.version?"version":o.help?"help":"none"),arg_count:o.commandArgs.length,platform:process.platform,arch:process.arch,node_version:process.versions.node}})}async function c(t){let{flushCliTelemetry:e}=await import("./chunks/telemetry-EZIRTFFL.js");await e(),process.exit(t)}if(o.version){let{getCliVersion:t}=await import("./chunks/cli-version-32VNOX3F.js"),{IS_BETA:e,BETA_LABEL:i}=await import("./chunks/beta-YKR6YRXH.js"),m=e?` \xB7 ${i}`:"";console.log(`sootsim v${t()}${m}`);let{readActiveRuntime:I}=await import("./chunks/home-paths-KK7NZVIK.js"),b=I();console.log(b?`runtime v${b}`:"runtime not installed"),await c(0)}o.help&&!o.command&&(g(),await c(0));var a=o.globalFlags.port,n=o.verbose,p=o.globalFlags.device,f=o.globalFlags.theme,R=o.globalFlags.driver,q=o.globalFlags.headless===!0,O=o.globalFlags.sim,s=O?["--sim",O,...o.commandArgs]:o.commandArgs;if(p||f){let{settingsStore:t}=await import("./chunks/store-FRMH2SYG.js"),e={};p&&(e.deviceModel=p),f&&(e.colorScheme=f),t.apply(e)}if(!o.command&&o.commandArgs.length===0){let{runStart:t}=await import("./chunks/start-EBOUYGAP.js");await t([],{port:a}),await c(0)}var r=o.command??"";if(!r){if(o.commandArgs.length>0){let t=o.commandArgs.find(e=>!e.startsWith("-"))??o.commandArgs[0];console.error(` unknown command: ${t}`),console.error(" run `sootsim --help` to see the full surface."),await c(1)}g(),await c(0)}if(r in u){let t=u[r],e=o.commandArgs.length>0?` ${o.commandArgs.join(" ")}`:"";console.error(` \`sootsim ${r}\` was removed. use \`${t}\` instead.`),e&&console.error(` \u2192 ${t}${e}`),console.error(" run `sootsim --help` to see the new verb groups."),await c(1)}if(o.help||o.commandArgs.includes("--help")||o.commandArgs.includes("-h")){let t=r==="do"||r==="get"||r==="debug"||r==="shell"||r==="wait",e=o.commandArgs.find(i=>!i.startsWith("-"));r==="shell"||(t&&!e?$(r)&&await c(0):(h(t&&e?e:r),await c(0)))}N(r);if(L.has(r)){let{ensureSootsimReady:t,resolveBootstrapPort:e}=await import("./chunks/auto-bootstrap-PH4II3F2.js"),i=e(s,a);await t(i);let{runInspect:m}=await import("./chunks/inspect-7AINMWI2.js");await m([r,...s],{port:i,verbose:n})}else switch(r){case"assert":{let{runAssert:t}=await import("./chunks/assert-X3GQJUDI.js");await t(o.commandArgs);break}case"flow":{let{runFlow:t}=await import("./chunks/flow-D6MKC5NH.js"),e=await t(s);process.exit(typeof e=="number"?e:0)}case"test":{let{runTest:t}=await import("./chunks/test-SATSKLC6.js");await t(o.commandArgs,{port:a,verbose:n});break}case"detox":{let{runDetox:t}=await import("./chunks/detox-VOWHHVNU.js");await t(o.commandArgs,{port:a,verbose:n});break}case"maestro":{let{runMaestro:t}=await import("./chunks/maestro-HNNW73KG.js"),e=await t(s,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"preview":{let{runPreview:t}=await import("./chunks/preview-EYIZWAEJ.js");await t(o.commandArgs,{port:a,verbose:n});break}case"record":{let{runRecord:t}=await import("./chunks/record-33ZECMTQ.js");await t(s,{port:a,verbose:n});break}case"profile":{let{runProfile:t}=await import("./chunks/profile-UOG2ET7W.js"),e=await t(o.commandArgs,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"cpu-profile":{let{runCpuProfile:t}=await import("./chunks/cpu-profile-3C7LHLJE.js"),e=await t(s,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"react":{let{runReact:t}=await import("./chunks/react-MRICF5YD.js"),e=await t(s,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"screenshot":{let{runScreenshot:t}=await import("./chunks/screenshot-B6B3CE2W.js");await t(s,{port:a,verbose:n});break}case"screenshots":{let{runScreenshots:t}=await import("./chunks/screenshots-GYQ3JHAW.js"),e=await t(s,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"screenshot-mode":{let{runScreenshotMode:t}=await import("./chunks/screenshot-mode-QVII6GH6.js");await t(o.commandArgs,{port:a,verbose:n});break}case"three-mode":case"3d-mode":{let{runThreeMode:t}=await import("./chunks/three-mode-XLTSGRVJ.js");await t(o.commandArgs,{port:a,verbose:n});break}case"inspect":{let{runInspect:t}=await import("./chunks/inspect-7AINMWI2.js");await t(s,{port:a,verbose:n});break}case"debug":{let{runDebug:t}=await import("./chunks/debug-MNWVCAAF.js");await t(s,{port:a,verbose:n});break}case"timeline":{let{runTimeline:t}=await import("./chunks/timeline-ELOCAU3S.js");await t(s,{port:a,verbose:n});break}case"what-happened":{let{runWhatHappened:t}=await import("./chunks/what-happened-YGFJR2TI.js");await t(s,{port:a,verbose:n});break}case"diagnose":{let{runDiagnose:t}=await import("./chunks/diagnose-J2BTJTGW.js"),e=await t(s,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"open":{let{ensureSootsimReady:t,resolveBootstrapPort:e}=await import("./chunks/auto-bootstrap-PH4II3F2.js"),i=e(s,a);await t(i);let{runOpenCommand:m}=await import("./chunks/control-GIAGLNPG.js");await m(s,{port:i});break}case"use":case"focus":{let{runUseCommand:t}=await import("./chunks/control-GIAGLNPG.js");await t(s,{port:a});break}case"claim":{let{runClaimCommand:t}=await import("./chunks/control-GIAGLNPG.js");await t(s,{port:a});break}case"close":{let{runCloseCommand:t}=await import("./chunks/control-GIAGLNPG.js");await t(s,{port:a});break}case"config":{let{runConfig:t}=await import("./chunks/config-JQF6TGCG.js");await t(o.commandArgs);break}case"device":{let{runDeviceCommand:t}=await import("./chunks/device-TFKPS72A.js");await t(s,{port:a});break}case"scan":case"compat":{let{runCompat:t}=await import("./chunks/compat-SOHG4UE5.js");await t(o.commandArgs);break}case"electron":{let{runElectron:t}=await import("./chunks/electron-NHJHQAOJ.js");await t(o.commandArgs,{port:a,device:p,driver:R});break}case"login":{let{runLogin:t}=await import("./chunks/login-DCFVFSY3.js");await t(o.commandArgs);break}case"logout":{let{runLogout:t}=await import("./chunks/logout-55UH67FS.js");await t();break}case"whoami":{let{runWhoami:t}=await import("./chunks/whoami-GKH3GF3H.js");await t();break}case"keys":{let{runKeys:t}=await import("./chunks/keys-PLJITE2X.js");await t(o.commandArgs);break}case"setup-repo":{let{runSetupRepo:t}=await import("./chunks/setup-repo-2TQURG52.js");await t(o.commandArgs);break}case"install":{let{runInstall:t}=await import("./chunks/install-YPSDICK4.js");await t(o.commandArgs);break}case"install-desktop":{let{runInstallDesktop:t}=await import("./chunks/install-desktop-CRFW4MDL.js");await t(o.commandArgs);break}case"server":{let{runServer:t}=await import("./chunks/server-G4WPXKFR.js");await t(o.commandArgs,{port:a});break}case"daemon":{let{runDaemon:t}=await import("./chunks/daemon-SD773LNY.js");await t(o.commandArgs,{port:a});break}case"runtime":{let{runRuntime:t}=await import("./chunks/runtime-OG4HGCYH.js");await t(o.commandArgs);break}case"upgrade":{let{runUpgrade:t}=await import("./chunks/upgrade-2OZLYETX.js");await t(o.commandArgs);break}case"launch":{let{runLaunch:t}=await import("./chunks/launch-FHMTFUI3.js");await t(o.commandArgs);break}case"start":{let{runStart:t}=await import("./chunks/start-EBOUYGAP.js");await t(o.commandArgs,{port:a});break}case"agent":{let{runAgentCommand:t}=await import("./chunks/agent-SHMN3LWB.js"),e=await t(o.commandArgs);process.exit(e)}case"agent-wrapper":{let{runAgentWrapper:t}=await import("./chunks/agent-wrapper-ESDQSMYX.js"),e=await t(o.commandArgs);process.exit(e)}case"skills":{let{runSkills:t}=await import("./chunks/skills-RF27H27Y.js");await t(o.commandArgs);break}case"upload":{let{runUpload:t}=await import("./chunks/upload-SJCUW6BT.js");await t(o.commandArgs,{port:a,verbose:n});break}case"hints":{let{runHints:t}=await import("./chunks/hints-XONGBPNI.js");t(o.commandArgs);break}default:console.error(` unknown command: ${r}`),console.error(" run `sootsim --help` to see the full surface."),process.exit(1)}
31
+ `),process.exit(1))}var o=T(process.argv);{let{trackCliEvent:t}=await import("./chunks/telemetry-GIA7FIKW.js");t({event:"cli_command_invoked",properties:{command:o.command||(o.version?"version":o.help?"help":"none"),arg_count:o.commandArgs.length,platform:process.platform,arch:process.arch,node_version:process.versions.node}})}async function c(t){let{flushCliTelemetry:e}=await import("./chunks/telemetry-GIA7FIKW.js");await e(),process.exit(t)}if(o.version){let{getCliVersion:t}=await import("./chunks/cli-version-HH7DAYBK.js"),{IS_BETA:e,BETA_LABEL:i}=await import("./chunks/beta-DEQZ2J7G.js"),m=e?` \xB7 ${i}`:"";console.log(`sootsim v${t()}${m}`);let{readActiveRuntime:I}=await import("./chunks/home-paths-HOBR3K3B.js"),b=I();console.log(b?`runtime v${b}`:"runtime not installed"),await c(0)}o.help&&!o.command&&(g(),await c(0));var a=o.globalFlags.port,n=o.verbose,p=o.globalFlags.device,f=o.globalFlags.theme,R=o.globalFlags.driver,q=o.globalFlags.headless===!0,O=o.globalFlags.sim,s=O?["--sim",O,...o.commandArgs]:o.commandArgs;if(p||f){let{settingsStore:t}=await import("./chunks/store-2MXXL4QE.js"),e={};p&&(e.deviceModel=p),f&&(e.colorScheme=f),t.apply(e)}if(!o.command&&o.commandArgs.length===0){let{runStart:t}=await import("./chunks/start-7YB4I5V5.js");await t([],{port:a}),await c(0)}var r=o.command??"";if(!r){if(o.commandArgs.length>0){let t=o.commandArgs.find(e=>!e.startsWith("-"))??o.commandArgs[0];console.error(` unknown command: ${t}`),console.error(" run `sootsim --help` to see the full surface."),await c(1)}g(),await c(0)}if(r in u){let t=u[r],e=o.commandArgs.length>0?` ${o.commandArgs.join(" ")}`:"";console.error(` \`sootsim ${r}\` was removed. use \`${t}\` instead.`),e&&console.error(` \u2192 ${t}${e}`),console.error(" run `sootsim --help` to see the new verb groups."),await c(1)}if(o.help||o.commandArgs.includes("--help")||o.commandArgs.includes("-h")){let t=r==="do"||r==="get"||r==="debug"||r==="shell"||r==="wait",e=o.commandArgs.find(i=>!i.startsWith("-"));r==="shell"||(t&&!e?$(r)&&await c(0):(h(t&&e?e:r),await c(0)))}N(r);if(L.has(r)){let{ensureSootsimReady:t,resolveBootstrapPort:e}=await import("./chunks/auto-bootstrap-SMQMN7WS.js"),i=e(s,a);await t(i);let{runInspect:m}=await import("./chunks/inspect-QCZVODE6.js");await m([r,...s],{port:i,verbose:n})}else switch(r){case"assert":{let{runAssert:t}=await import("./chunks/assert-SKDEGGRD.js");await t(o.commandArgs);break}case"flow":{let{runFlow:t}=await import("./chunks/flow-3AHNNHF7.js"),e=await t(s);process.exit(typeof e=="number"?e:0)}case"test":{let{runTest:t}=await import("./chunks/test-5C6NYF62.js");await t(o.commandArgs,{port:a,verbose:n});break}case"detox":{let{runDetox:t}=await import("./chunks/detox-DUABQYC6.js");await t(o.commandArgs,{port:a,verbose:n});break}case"maestro":{let{runMaestro:t}=await import("./chunks/maestro-G36ATKHQ.js"),e=await t(s,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"preview":{let{runPreview:t}=await import("./chunks/preview-BJUMMDBL.js");await t(o.commandArgs,{port:a,verbose:n});break}case"record":{let{runRecord:t}=await import("./chunks/record-73CGQ3EP.js");await t(s,{port:a,verbose:n});break}case"profile":{let{runProfile:t}=await import("./chunks/profile-CEQNS53P.js"),e=await t(o.commandArgs,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"cpu-profile":{let{runCpuProfile:t}=await import("./chunks/cpu-profile-JQAGHLDS.js"),e=await t(s,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"react":{let{runReact:t}=await import("./chunks/react-BPEDK3TN.js"),e=await t(s,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"screenshot":{let{runScreenshot:t}=await import("./chunks/screenshot-GUM2U2PN.js");await t(s,{port:a,verbose:n});break}case"screenshots":{let{runScreenshots:t}=await import("./chunks/screenshots-JENURQSV.js"),e=await t(s,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"screenshot-mode":{let{runScreenshotMode:t}=await import("./chunks/screenshot-mode-VUBCO7T2.js");await t(o.commandArgs,{port:a,verbose:n});break}case"three-mode":case"3d-mode":{let{runThreeMode:t}=await import("./chunks/three-mode-C6TE63VR.js");await t(o.commandArgs,{port:a,verbose:n});break}case"inspect":{let{runInspect:t}=await import("./chunks/inspect-QCZVODE6.js");await t(s,{port:a,verbose:n});break}case"debug":{let{runDebug:t}=await import("./chunks/debug-CYINYNWV.js");await t(s,{port:a,verbose:n});break}case"timeline":{let{runTimeline:t}=await import("./chunks/timeline-NFYS6IPO.js");await t(s,{port:a,verbose:n});break}case"what-happened":{let{runWhatHappened:t}=await import("./chunks/what-happened-FCP2U43H.js");await t(s,{port:a,verbose:n});break}case"diagnose":{let{runDiagnose:t}=await import("./chunks/diagnose-NUDACXIR.js"),e=await t(s,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"open":{let{ensureSootsimReady:t,resolveBootstrapPort:e}=await import("./chunks/auto-bootstrap-SMQMN7WS.js"),i=e(s,a);await t(i);let{runOpenCommand:m}=await import("./chunks/control-NCUWAXPH.js");await m(s,{port:i});break}case"use":case"focus":{let{runUseCommand:t}=await import("./chunks/control-NCUWAXPH.js");await t(s,{port:a});break}case"claim":{let{runClaimCommand:t}=await import("./chunks/control-NCUWAXPH.js");await t(s,{port:a});break}case"close":{let{runCloseCommand:t}=await import("./chunks/control-NCUWAXPH.js");await t(s,{port:a});break}case"config":{let{runConfig:t}=await import("./chunks/config-DRGNQOYL.js");await t(o.commandArgs);break}case"device":{let{runDeviceCommand:t}=await import("./chunks/device-KSSSQOQC.js");await t(s,{port:a});break}case"scan":case"compat":{let{runCompat:t}=await import("./chunks/compat-MDZTV64M.js");await t(o.commandArgs);break}case"electron":{let{runElectron:t}=await import("./chunks/electron-LC3Y74FA.js");await t(o.commandArgs,{port:a,device:p,driver:R});break}case"login":{let{runLogin:t}=await import("./chunks/login-IADXSJEW.js");await t(o.commandArgs);break}case"logout":{let{runLogout:t}=await import("./chunks/logout-AT33MGA7.js");await t();break}case"whoami":{let{runWhoami:t}=await import("./chunks/whoami-O6XVOJBF.js");await t();break}case"keys":{let{runKeys:t}=await import("./chunks/keys-RR43E2O3.js");await t(o.commandArgs);break}case"setup-repo":{let{runSetupRepo:t}=await import("./chunks/setup-repo-ECVECJZQ.js");await t(o.commandArgs);break}case"install":{let{runInstall:t}=await import("./chunks/install-747G2O4S.js");await t(o.commandArgs);break}case"install-desktop":{let{runInstallDesktop:t}=await import("./chunks/install-desktop-W2OOILJG.js");await t(o.commandArgs);break}case"server":{let{runServer:t}=await import("./chunks/server-PVAO3OA2.js");await t(o.commandArgs,{port:a});break}case"daemon":{let{runDaemon:t}=await import("./chunks/daemon-3RT7EABW.js");await t(o.commandArgs,{port:a});break}case"runtime":{let{runRuntime:t}=await import("./chunks/runtime-QR5IHGKJ.js");await t(o.commandArgs);break}case"upgrade":{let{runUpgrade:t}=await import("./chunks/upgrade-KROEHYG2.js");await t(o.commandArgs);break}case"launch":{let{runLaunch:t}=await import("./chunks/launch-GAPSA5HQ.js");await t(o.commandArgs);break}case"start":{let{runStart:t}=await import("./chunks/start-7YB4I5V5.js");await t(o.commandArgs,{port:a});break}case"agent":{let{runAgentCommand:t}=await import("./chunks/agent-44BHCTZA.js"),e=await t(o.commandArgs);process.exit(e)}case"agent-wrapper":{let{runAgentWrapper:t}=await import("./chunks/agent-wrapper-BEP5WHZR.js"),e=await t(o.commandArgs);process.exit(e)}case"skills":{let{runSkills:t}=await import("./chunks/skills-4JI327YS.js");await t(o.commandArgs);break}case"upload":{let{runUpload:t}=await import("./chunks/upload-OS3J5ZOS.js");await t(o.commandArgs,{port:a,verbose:n});break}case"hints":{let{runHints:t}=await import("./chunks/hints-EOARRVNB.js");t(o.commandArgs);break}default:console.error(` unknown command: ${r}`),console.error(" run `sootsim --help` to see the full surface."),process.exit(1)}
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.64 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as y,b as $,c as b,d as l,e as E,g as A,h as j,j as S,m as I,n as T,o as x,p as g,q as k,r as D}from"./chunk-VE4QTDAY.js";import"./chunk-YXZFG3ZY.js";import"./chunk-OBSMT5TS.js";import"./chunk-WKVIKFMU.js";import"./chunk-J6TCNU6W.js";import w from"node:fs";import d from"node:path";import{spawn as N}from"node:child_process";import U from"node:net";import{WebSocket as O}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 O(`ws://localhost:${this.port}`),this.ready=new Promise((t,s)=>{let r=()=>{this.ws.off("error",o),t()},o=i=>{this.ws.off("open",r),s(new c(`could not connect to sootsim daemon on port ${this.port}: ${i.message}`,"NO_DAEMON"))};this.ws.once("open",r),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 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!==O.OPEN)throw new c("daemon connection is closed","NO_DAEMON");let s=this.nextId++;return new Promise((r,o)=>{let i=setTimeout(()=>{this.pending.delete(s),o(new c(`${e} timed out after ${Math.round(this.commandTimeoutMs/1e3)}s`,"TIMEOUT"))},this.commandTimeoutMs);this.pending.set(s,{resolve:r,reject:o,timer:i});try{this.ws.send(JSON.stringify({id:s,type:e,...t}))}catch(a){clearTimeout(i),this.pending.delete(s),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 r of this.eventListeners)try{r({sessionId:t.sessionId,event:t.event})}catch{}return}if(t.type==="agent:session-status"){for(let r of this.statusListeners)try{r(t.session)}catch{}return}if(typeof t.id!="number")return;let s=this.pending.get(t.id);s&&(this.pending.delete(t.id),clearTimeout(s.timer),t.error?s.reject(new c(t.error,t.code)):s.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 R(n=7668,e=400){return new Promise(t=>{let s=new U.Socket,r=!1,o=i=>{r||(r=!0,s.destroy(),t(i))};s.setTimeout(e),s.once("connect",()=>o(!0)),s.once("timeout",()=>o(!1)),s.once("error",()=>o(!1)),s.connect(n,"127.0.0.1")})}async function _(n={}){let e=n.port??7668;if(await R(e))return{alreadyRunning:!0};let{cmd:t,prefixArgs:s}=D(),r=[...s,"server","--quiet"];e!==7668&&r.push("--port",String(e));let o=N(t,r,{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 R(e))return{alreadyRunning:!1,pid:o.pid};await new Promise(a=>setTimeout(a,100))}throw new c(`spawned sootsim daemon on port ${e} but it did not come up in time. run \`sootsim server\` manually to diagnose.`,"SPAWN_TIMEOUT")}async function h(n={}){await _({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 ue(n){let[e,...t]=n;try{switch(e){case void 0:case"--help":case"-h":case"help":return C(),0;case"attach":return await F(t);case"projects":return await B();case"project":return await W(t);case"sessions":return await J(t);case"start":return await V(t);case"prompt":return await q(t);case"watch":return await G(t);case"transcript":return await H(t);case"end":return await K(t);case"paths":return await z();default:return process.stderr.write(`unknown agent subcommand: ${e}
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as y,b as $,c as b,d as l,e as E,g as A,h as j,j as S,m as I,n as T,o as x,p as g,q as k,r as D}from"./chunk-NJ2ACA36.js";import"./chunk-GHFA4O5B.js";import"./chunk-E6CRWOWO.js";import"./chunk-TWKWXGN5.js";import"./chunk-KKOOZPQP.js";import w from"node:fs";import d from"node:path";import{spawn as N}from"node:child_process";import U from"node:net";import{WebSocket as O}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 O(`ws://localhost:${this.port}`),this.ready=new Promise((t,s)=>{let r=()=>{this.ws.off("error",o),t()},o=i=>{this.ws.off("open",r),s(new c(`could not connect to sootsim daemon on port ${this.port}: ${i.message}`,"NO_DAEMON"))};this.ws.once("open",r),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 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!==O.OPEN)throw new c("daemon connection is closed","NO_DAEMON");let s=this.nextId++;return new Promise((r,o)=>{let i=setTimeout(()=>{this.pending.delete(s),o(new c(`${e} timed out after ${Math.round(this.commandTimeoutMs/1e3)}s`,"TIMEOUT"))},this.commandTimeoutMs);this.pending.set(s,{resolve:r,reject:o,timer:i});try{this.ws.send(JSON.stringify({id:s,type:e,...t}))}catch(a){clearTimeout(i),this.pending.delete(s),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 r of this.eventListeners)try{r({sessionId:t.sessionId,event:t.event})}catch{}return}if(t.type==="agent:session-status"){for(let r of this.statusListeners)try{r(t.session)}catch{}return}if(typeof t.id!="number")return;let s=this.pending.get(t.id);s&&(this.pending.delete(t.id),clearTimeout(s.timer),t.error?s.reject(new c(t.error,t.code)):s.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 R(n=7668,e=400){return new Promise(t=>{let s=new U.Socket,r=!1,o=i=>{r||(r=!0,s.destroy(),t(i))};s.setTimeout(e),s.once("connect",()=>o(!0)),s.once("timeout",()=>o(!1)),s.once("error",()=>o(!1)),s.connect(n,"127.0.0.1")})}async function _(n={}){let e=n.port??7668;if(await R(e))return{alreadyRunning:!0};let{cmd:t,prefixArgs:s}=D(),r=[...s,"server","--quiet"];e!==7668&&r.push("--port",String(e));let o=N(t,r,{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 R(e))return{alreadyRunning:!1,pid:o.pid};await new Promise(a=>setTimeout(a,100))}throw new c(`spawned sootsim daemon on port ${e} but it did not come up in time. run \`sootsim server\` manually to diagnose.`,"SPAWN_TIMEOUT")}async function h(n={}){await _({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 ue(n){let[e,...t]=n;try{switch(e){case void 0:case"--help":case"-h":case"help":return C(),0;case"attach":return await F(t);case"projects":return await B();case"project":return await W(t);case"sessions":return await J(t);case"start":return await V(t);case"prompt":return await q(t);case"watch":return await G(t);case"transcript":return await H(t);case"end":return await K(t);case"paths":return await z();default:return process.stderr.write(`unknown agent subcommand: ${e}
3
3
  `),C(),2}}catch(s){if(s instanceof c)return process.stderr.write(`${s.message}
4
4
  `),1;throw s}}async function v(n){let e=await h({clientLabel:"sootsim-agent-cli"});try{return await n(e)}finally{e.close()}}function C(){process.stdout.write(`sootsim agent \u2014 attached projects + local agent sessions
5
5
 
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.64 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{b as M}from"./chunk-YXZFG3ZY.js";import"./chunk-J6TCNU6W.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 I,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,g=!1,a=new Promise(s=>{t.on("exit",(i,e)=>{g=!0;let p=new Error(`codex app-server exited (code=${i}, signal=${e??""})`);for(let{reject:f}of r.values())f(p);r.clear(),s({code:i,signal:e})})});L.createInterface({input:t.stdout,crlfDelay:1/0}).on("line",s=>{let i=s.trim();if(!i)return;let e;try{e=JSON.parse(i)}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,f=p!=null?r.get(p):void 0;if(!f)return;r.delete(p),e.error?f.reject(new b(e.error.message,e.error.code,e.error.data)):f.resolve(e.result);return}if(e.method){let p=m.get(e.method);if(!p)return;for(let f of p)try{f(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 i=m.get("__stderr__");if(i)for(let e of i)try{e({text:s})}catch{}});function n(s){if(!g)try{t.stdin.write(JSON.stringify(s)+`
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as M}from"./chunk-GHFA4O5B.js";import"./chunk-KKOOZPQP.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 I,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,g=!1,a=new Promise(s=>{t.on("exit",(i,e)=>{g=!0;let p=new Error(`codex app-server exited (code=${i}, signal=${e??""})`);for(let{reject:f}of r.values())f(p);r.clear(),s({code:i,signal:e})})});L.createInterface({input:t.stdout,crlfDelay:1/0}).on("line",s=>{let i=s.trim();if(!i)return;let e;try{e=JSON.parse(i)}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,f=p!=null?r.get(p):void 0;if(!f)return;r.delete(p),e.error?f.reject(new b(e.error.message,e.error.code,e.error.data)):f.resolve(e.result);return}if(e.method){let p=m.get(e.method);if(!p)return;for(let f of p)try{f(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 i=m.get("__stderr__");if(i)for(let e of i)try{e({text:s})}catch{}});function n(s){if(!g)try{t.stdin.write(JSON.stringify(s)+`
3
3
  `)}catch{}}return{exited:a,on(s,i){let e=m.get(s);return e||(e=new Set,m.set(s,e)),e.add(i),()=>{e?.delete(i)}},request(s,i){if(g)return Promise.reject(new Error(`codex app-server closed; cannot call ${s}`));let e=u++;return new Promise((p,f)=>{r.set(e,{resolve:l=>p(l),reject:f,method:s}),n({jsonrpc:"2.0",id:e,method:s,params:i})})},notify(s,i){n({jsonrpc:"2.0",method:s,params:i})},async shutdown(s=1500){if(g)return;try{t.stdin.end()}catch{}let i=setTimeout(()=>{if(!g)try{t.kill("SIGTERM")}catch{}},s);try{await a}finally{clearTimeout(i)}},kill(s="SIGTERM"){if(!g)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 I(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 g=t[u];g&&(r[g]=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: sootsim agent-wrapper --session-id <id> --project-id <id>
4
4
  --provider codex|claude --cwd <path>
5
5
  --prompt-in <fifo> --events-out <fifo>
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.64 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import"./chunk-J6TCNU6W.js";import{spawn as x}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=x(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(`
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import"./chunk-KKOOZPQP.js";import{spawn as x}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=x(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(`
3
3
  `).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=x("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}
4
4
  `),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(" ")}
5
5
  supported: ${Array.from(w).sort().join(", ")}
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a,b,c,d}from"./chunk-PTUCXL7Y.js";import"./chunk-ZW3HKMLQ.js";import"./chunk-VGQXIMEX.js";import"./chunk-E6CRWOWO.js";import"./chunk-TWKWXGN5.js";import"./chunk-KKOOZPQP.js";export{c as ensureDaemonRunning,a as ensureRuntimeInstalled,d as ensureSootsimReady,b as resolveBootstrapPort};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a,b,c,d,e}from"./chunk-46OKLW3Z.js";import"./chunk-KKOOZPQP.js";export{e as BETA_ASK_HEADLINE,c as BETA_LABEL,d as BETA_TAGLINE,b as BETA_VERSION_TARGET,a as IS_BETA};
@@ -1,3 +1,3 @@
1
- /*! sootsim v0.1.64 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{l as c}from"./chunk-WKVIKFMU.js";import{chmodSync as m,existsSync as g,mkdirSync as k,readFileSync as A,rmSync as i,writeFileSync as y}from"node:fs";import{dirname as l,join as D,resolve as p}from"node:path";var s=1,S="SOOTSIM_SHARED_AUTH_FILE",u="https://sootbean.com";function v(){let t=process.env[S];return t?.trim()?l(p(t)):c()}function a(){let t=process.env[S];return t?.trim()?p(t):D(v(),"desktop-auth.json")}function f(t){if(!t||typeof t!="object")return null;let e=t;return typeof e.id!="string"||!e.id.trim()?null:{id:e.id.trim(),name:typeof e.name=="string"?e.name:void 0,email:typeof e.email=="string"?e.email:void 0,image:typeof e.image=="string"?e.image:void 0}}function w(t){if(!t||typeof t!="object")return null;let e=t;if(e.version!==s||typeof e.token!="string"||!e.token.trim())return null;let r=typeof e.origin=="string"&&e.origin.trim()?e.origin.trim():u,n=e.source==="cli"||e.source==="electron"||e.source==="browser"||e.source==="unknown"?e.source:"unknown",o=typeof e.updatedAt=="string"&&e.updatedAt?e.updatedAt:new Date().toISOString(),h=typeof e.validatedAt=="string"&&e.validatedAt?e.validatedAt:void 0;return{version:s,token:e.token.trim(),user:f(e.user),origin:r,source:n,updatedAt:o,validatedAt:h}}function O(){let t=a();if(!g(t))return null;try{let e=JSON.parse(A(t,"utf8")),r=w(e);return r||(i(t,{force:!0}),null)}catch{return i(t,{force:!0}),null}}function I(t){let e=a();k(l(e),{recursive:!0});let r={version:s,token:t.token.trim(),user:t.user?f(t.user):null,origin:t.origin?.trim()||u,source:t.source,updatedAt:t.updatedAt||new Date().toISOString(),validatedAt:t.validatedAt};y(e,JSON.stringify(r,null,2)+`
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{l as c}from"./chunk-TWKWXGN5.js";import{chmodSync as m,existsSync as g,mkdirSync as k,readFileSync as A,rmSync as i,writeFileSync as y}from"node:fs";import{dirname as l,join as D,resolve as p}from"node:path";var s=1,S="SOOTSIM_SHARED_AUTH_FILE",u="https://sootbean.com";function v(){let t=process.env[S];return t?.trim()?l(p(t)):c()}function a(){let t=process.env[S];return t?.trim()?p(t):D(v(),"desktop-auth.json")}function f(t){if(!t||typeof t!="object")return null;let e=t;return typeof e.id!="string"||!e.id.trim()?null:{id:e.id.trim(),name:typeof e.name=="string"?e.name:void 0,email:typeof e.email=="string"?e.email:void 0,image:typeof e.image=="string"?e.image:void 0}}function w(t){if(!t||typeof t!="object")return null;let e=t;if(e.version!==s||typeof e.token!="string"||!e.token.trim())return null;let r=typeof e.origin=="string"&&e.origin.trim()?e.origin.trim():u,n=e.source==="cli"||e.source==="electron"||e.source==="browser"||e.source==="unknown"?e.source:"unknown",o=typeof e.updatedAt=="string"&&e.updatedAt?e.updatedAt:new Date().toISOString(),h=typeof e.validatedAt=="string"&&e.validatedAt?e.validatedAt:void 0;return{version:s,token:e.token.trim(),user:f(e.user),origin:r,source:n,updatedAt:o,validatedAt:h}}function O(){let t=a();if(!g(t))return null;try{let e=JSON.parse(A(t,"utf8")),r=w(e);return r||(i(t,{force:!0}),null)}catch{return i(t,{force:!0}),null}}function I(t){let e=a();k(l(e),{recursive:!0});let r={version:s,token:t.token.trim(),user:t.user?f(t.user):null,origin:t.origin?.trim()||u,source:t.source,updatedAt:t.updatedAt||new Date().toISOString(),validatedAt:t.validatedAt};y(e,JSON.stringify(r,null,2)+`
3
3
  `);try{m(e,384)}catch{}return r}function d(){i(a(),{force:!0})}async function N(t){let e=O();if(!e?.token)return null;let r=t||e.origin||u;try{let n=await fetch(`${r.replace(/\/$/,"")}/api/auth/me`,{headers:{authorization:`Bearer ${e.token}`}});if(n.status===401)return d(),null;if(!n.ok)return e;let o=await n.json();return o.user?.id?I({token:e.token,user:o.user,origin:r,source:e.source,validatedAt:new Date().toISOString()}):(d(),null)}catch{return e}}export{O as a,I as b,d as c,N as d};
@@ -0,0 +1,3 @@
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{B as E,j as B,k as b,l as I,m as S}from"./chunk-5ZB5ZN5Z.js";import{d as y,h as T,i as v}from"./chunk-ZW3HKMLQ.js";var C={timeoutMs:1800,settleMs:48,startWindowMs:64};function p(e){return new Promise(t=>setTimeout(t,e))}function A(e){return e.includes("--json")}function k(e){process.stdout.write(`${JSON.stringify(e??null,null,2)}
3
+ `)}async function P(e,t,...r){return T(e,`__sootsimTest.${t}`,...r)}async function W(e,t,...r){return v(e,`SootSim.bridges.mainShell.${t}`,...r)}async function F(e,t={}){try{let r=await P(e,"waitForScreenTransitions",C);if(!t.verbose||!r?.started)return;if(r.timedOut){console.log(` screen transition still active after ${r.waitedMs}ms; continuing`);return}r.waitedMs>0&&console.log(` waited ${r.waitedMs}ms for screen transition settle`)}catch{}}async function O(e,t,r,...n){let a=Date.now()+Math.max(0,r);for(;;)try{return await W(e,t,...n)}catch(o){if(!E(o)||Date.now()>=a)throw o;await p(50)}}async function $(e,t,r,n={}){let a=n.attempts??30,o=n.intervalMs??500,m=n.minNodeCount??10;for(let s=0;s<a;s++){let u=y(e,{commandTimeoutMs:t,simId:r,simIdSource:n.simIdSource});try{let c=await u.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof c=="number"&&c>m)return{bridge:u,count:c}}catch{}u.close(),await p(o)}return null}async function G(e,t,r,n={}){let a=n.timeoutMs??8e3,o=n.intervalMs??250,m=Date.now()+a;for(;Date.now()<m;){let s=y(e,{commandTimeoutMs:t,simId:r,simIdSource:n.simIdSource});try{return await s.send({type:"evaluate",code:"1"}),s}catch{s.close()}await p(o)}return null}async function H(e,t={}){let r=t.timeoutMs??1e4,n=t.errorGraceMs??3e3,a=t.pollIntervalMs??200,o=Date.now(),m=o+r,s=-1,u=o,c=null,M=!1,w={ready:!1,source:"timeout",elapsedMs:0,nodes:0,targets:0,errors:0};for(;Date.now()<m;){try{let i=await e.send({type:"evaluate",code:B}),d=Date.now()-o,l=Number(i?.nodes)||0,g=Number(i?.targets)||0,f=Number(i?.errors)||0,R=i?.flag===!0,h=i?.externalReady,x=typeof i?.externalError=="string"&&i.externalError.trim().length>0;if(c=h,M=x,l!==s&&(s=l,u=d),w={ready:!1,source:"timeout",elapsedMs:d,nodes:l,targets:g,errors:f},R&&h!==!1&&!x&&l>=b&&S({nodes:l,targets:g})&&d-u>=I)return{ready:!0,source:"flag",elapsedMs:d,nodes:l,targets:g,errors:f};if(d>=n&&f>0&&!R)return{ready:!1,source:"error-bail",elapsedMs:d,nodes:l,targets:g,errors:f}}catch{}await p(a)}return c!==!1&&!M&&w.nodes>=b&&S(w)?{...w,ready:!0,source:"nodes-fallback"}:{...w,ready:!1,source:"timeout",elapsedMs:Date.now()-o}}export{p as a,A as b,k as c,P as d,F as e,O as f,$ as g,G as h,H as i};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.64 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  var t=!0,e="1.0.0",o="public beta",n=`${o} \xB7 free until ${e}`,r="free for everyone until 1.0 \u2014 we send anonymous error and dependency data while you use it";export{t as a,e as b,o as c,n as d,r as e};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.64 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{A as R,C as w,i as p,r as S,t as O,y as v,z as f}from"./chunk-WKVIKFMU.js";import{spawn as I}from"child_process";import C from"crypto";import s from"fs";import l from"path";import{Readable as k}from"stream";import{pipeline as M}from"stream/promises";var N="https://sootbean.com",D="SOOTSIM_CDN_ORIGIN",E="SOOTSIM_RUNTIME_CHANNEL";function $(){try{let e=JSON.parse(s.readFileSync(O(),"utf8"));return e&&typeof e=="object"?e:{}}catch{return{}}}function d(e){let t=$();return(e||process.env[D]||t.cdnOrigin||N).replace(/\/+$/,"")}function x(e){let t=$();return e||process.env[E]||t.runtimeChannel||"stable"}function T(e){let t=new URL(`${d(e)}/runtimes/manifest.json`);return t.searchParams.set("t",String(Date.now())),t.toString()}function P(e,t){return`${d(t)}/runtimes/sootsim-runtime-${e}.tar.gz`}async function y(e){let t=T(e),r=await fetch(t,{headers:{Accept:"application/json"}});if(!r.ok)throw new Error(`manifest fetch failed: ${r.status} ${r.statusText} (${t})`);return await r.json()}function U(e,t={}){let r=x(t.channel),n=t.version||e.channels[r]?.latest;if(!n)throw new Error(`no version specified and channel '${r}' has no latest entry in the manifest`);let i=e.versions[n];if(!i)throw new Error(`version ${n} not found in manifest; available: ${Object.keys(e.versions).slice(-10).join(", ")||"(none)"}`);return{version:n,channel:r,entry:i}}async function V(e={}){v();let t=d(e.cdnOrigin),r=await y(t),{version:n,channel:i,entry:o}=U(r,e),a=p(n),c=e.setActive!==!1;if(!e.force&&s.existsSync(l.join(a,"index.html")))return c&&R(n),{version:n,channel:i,cdnOrigin:t,runtimeDir:a,installed:!1,activated:c,manifest:r};let g=o.tarball||P(n,t),m=l.join(S(),`sootsim-runtime-${n}.tar.gz`);process.stderr.write(`sootsim: downloading runtime ${n}\u2026
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{A as R,C as w,i as p,r as S,t as O,y as v,z as f}from"./chunk-TWKWXGN5.js";import{spawn as I}from"child_process";import C from"crypto";import s from"fs";import l from"path";import{Readable as k}from"stream";import{pipeline as M}from"stream/promises";var N="https://sootbean.com",D="SOOTSIM_CDN_ORIGIN",E="SOOTSIM_RUNTIME_CHANNEL";function $(){try{let e=JSON.parse(s.readFileSync(O(),"utf8"));return e&&typeof e=="object"?e:{}}catch{return{}}}function d(e){let t=$();return(e||process.env[D]||t.cdnOrigin||N).replace(/\/+$/,"")}function x(e){let t=$();return e||process.env[E]||t.runtimeChannel||"stable"}function T(e){let t=new URL(`${d(e)}/runtimes/manifest.json`);return t.searchParams.set("t",String(Date.now())),t.toString()}function P(e,t){return`${d(t)}/runtimes/sootsim-runtime-${e}.tar.gz`}async function y(e){let t=T(e),r=await fetch(t,{headers:{Accept:"application/json"}});if(!r.ok)throw new Error(`manifest fetch failed: ${r.status} ${r.statusText} (${t})`);return await r.json()}function U(e,t={}){let r=x(t.channel),n=t.version||e.channels[r]?.latest;if(!n)throw new Error(`no version specified and channel '${r}' has no latest entry in the manifest`);let i=e.versions[n];if(!i)throw new Error(`version ${n} not found in manifest; available: ${Object.keys(e.versions).slice(-10).join(", ")||"(none)"}`);return{version:n,channel:r,entry:i}}async function V(e={}){v();let t=d(e.cdnOrigin),r=await y(t),{version:n,channel:i,entry:o}=U(r,e),a=p(n),c=e.setActive!==!1;if(!e.force&&s.existsSync(l.join(a,"index.html")))return c&&R(n),{version:n,channel:i,cdnOrigin:t,runtimeDir:a,installed:!1,activated:c,manifest:r};let g=o.tarball||P(n,t),m=l.join(S(),`sootsim-runtime-${n}.tar.gz`);process.stderr.write(`sootsim: downloading runtime ${n}\u2026
3
3
  `),await _(g,m),process.stderr.write(`sootsim: extracting runtime ${n}\u2026
4
4
  `);let h=await j(m);if(h!==o.sha256)throw s.rmSync(m,{force:!0}),new Error(`sha256 mismatch for runtime ${n}: expected ${o.sha256}, actual ${h}`);let u=l.join(l.dirname(a),`.installing-${n}-${process.pid}`);s.rmSync(u,{recursive:!0,force:!0}),s.mkdirSync(u,{recursive:!0});try{if(await A(m,u),!s.existsSync(l.join(u,"index.html")))throw new Error(`extracted tarball for runtime ${n} is missing index.html`);s.rmSync(a,{recursive:!0,force:!0}),s.renameSync(u,a)}catch(b){throw s.rmSync(u,{recursive:!0,force:!0}),b}return c&&R(n),{version:n,channel:i,cdnOrigin:t,runtimeDir:a,installed:!0,activated:c,manifest:r}}async function q(e={}){v();let t=d(e.cdnOrigin),r=x(e.channel),n=await y(t),i=n.channels[r]?.latest;if(!i)return{checked:!0,updated:!1,reason:`channel '${r}' has no latest runtime`,activeVersion:f()};if(!n.versions[i])return{checked:!0,updated:!1,reason:`manifest is missing version ${i}`,activeVersion:f(),latestVersion:i};let a=f(),c=a?p(a):null,g=c?s.existsSync(l.join(c,"index.html")):!1;if(!(!a||!g||w(i,a)>0))return{checked:!0,updated:!1,reason:"active runtime is current",activeVersion:a,latestVersion:i};let h=await V({version:i,channel:r,cdnOrigin:t,setActive:!1});return{checked:!0,updated:!0,activeVersion:i,latestVersion:i,install:h}}async function B(e={}){let t=f();try{let r=await y(d(e.cdnOrigin)),n=x(e.channel),i=r.channels[n]?.latest??null,o=!!(i&&(!t||w(i,t)>0));return{active:t,latest:i,outdated:o}}catch{return{active:t,latest:null,outdated:!1}}}async function _(e,t){let r=await fetch(e);if(!r.ok||!r.body)throw new Error(`download failed: ${r.status} ${r.statusText} (${e})`);s.mkdirSync(l.dirname(t),{recursive:!0});let n=`${t}.partial`;try{await M(k.fromWeb(r.body),s.createWriteStream(n)),s.renameSync(n,t)}catch(i){try{s.unlinkSync(n)}catch{}throw i}}function j(e){return new Promise((t,r)=>{let n=C.createHash("sha256"),i=s.createReadStream(e);i.on("data",o=>n.update(o)),i.on("error",r),i.on("end",()=>t(n.digest("hex")))})}function A(e,t){return new Promise((r,n)=>{let i=I("tar",["-xzf",e,"-C",t],{stdio:["ignore","inherit","inherit"]});i.on("error",n),i.on("exit",o=>{o===0?r():n(new Error(`tar exited with code ${o}`))})})}export{N as a,D as b,E as c,d,x as e,T as f,P as g,y as h,U as i,V as j,q as k,B as l};
@@ -0,0 +1 @@
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.64 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- function T(e,t){let n=["--max-ms","--maxMs","--maxms","--max_ms"];for(let s of n){let r=e.indexOf(s);if(r>=0&&e[r+1]){let i=Number(e[r+1]);if(Number.isFinite(i))return Math.max(100,i)}}return t}async function v(e){let t=await e.send({type:"evaluate",code:"(async () => await window.__sootsimTest.getNodeCount())()"});return{nodes:typeof t=="number"?t:0}}async function I(e,t=5){let n=await e.send({type:"evaluate",code:`(async () => await window.__sootsimTest.dumpTree(${t}))()`});return{depth:t,tree:n}}async function _(e){let t=await e.send({type:"evaluate",code:"window.location.href"});return{url:typeof t=="string"?t:""}}async function k(e,t){let n=`(async () => {
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ function T(e,t){let n=["--max-ms","--maxMs","--maxms","--max_ms"];for(let r of n){let s=e.indexOf(r);if(s>=0&&e[s+1]){let i=Number(e[s+1]);if(Number.isFinite(i))return Math.max(100,i)}}return t}async function v(e){let t=await e.send({type:"evaluate",code:"(async () => await window.__sootsimTest.getNodeCount())()"});return{nodes:typeof t=="number"?t:0}}async function I(e,t=5){let n=await e.send({type:"evaluate",code:`(async () => await window.__sootsimTest.dumpTree(${t}))()`});return{depth:t,tree:n}}async function _(e){let t=await e.send({type:"evaluate",code:"window.location.href"});return{url:typeof t=="string"?t:""}}async function k(e,t){let n=`(async () => {
3
3
  const t = window.__sootsimTest
4
4
  const mainShell = window.SootSim?.bridges?.mainShell
5
5
  const kb = window.__sootsimKeyboard
@@ -87,7 +87,7 @@ function T(e,t){let n=["--max-ms","--maxMs","--maxms","--max_ms"];for(let s of n
87
87
  return all
88
88
  .filter(n => isVisibleTarget(n) && hasAccessibleSignal(n))
89
89
  .map(normalize)
90
- })()`;async function L(e){let t=await e.send({type:"evaluate",code:y});return Array.isArray(t)?t:[]}var l=`
90
+ })()`;async function E(e){let t=await e.send({type:"evaluate",code:y});return Array.isArray(t)?t:[]}var l=`
91
91
  const fromInspectable = async () => {
92
92
  if (typeof t.listInspectable !== 'function') return null
93
93
  const list = await t.listInspectable({})
@@ -181,7 +181,7 @@ ${l}
181
181
  })()`}:e.visible?{mode:"visible",code:`(async () => {
182
182
  const all = await window.__sootsimTest.queryAll({ pruneHidden: true })
183
183
  return all.filter(n => n.layout && n.layout.width > 0 && n.layout.height > 0)
184
- })()`}:e.text?{mode:"text",code:`(async () => await window.__sootsimTest.findByText(${JSON.stringify(e.text)}))()`}:null}async function P(e,t){let n=p(t);if(!n)return null;let s=await e.send({type:"evaluate",code:n.code});return{mode:n.mode,result:s}}function A(e){return[...e].sort((t,n)=>c(n)-c(t))}function c(e){let t=0;e.testID&&(t+=100),typeof e.text=="string"&&e.text.trim().length>0&&(t+=60),typeof e.accessibilityLabel=="string"&&e.accessibilityLabel.trim().length>0&&(t+=30),e.accessibilityRole&&(t+=15);let n=e.layout?.width??0,s=e.layout?.height??0,r=n*s;return r>=400&&r<=6e4?t+=25:r>6e4&&(t-=20),(e.absolutePosition?.y??0)<0&&(t-=30),t}function D(e){if(e.testID)return`sootsim do tap-id ${u(e.testID)}`;let t=typeof e.text=="string"?e.text.trim():"";if(t.length>0&&t.length<=80)return`sootsim do tap-text ${u(t)}`;let n=Math.round(((e.absolutePosition?.x??0)+(e.layout?.width??0)/2)*10)/10,s=Math.round(((e.absolutePosition?.y??0)+(e.layout?.height??0)/2)*10)/10;return`sootsim do tap ${n} ${s}`}function u(e){return/^[A-Za-z0-9_./@:-]+$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}var b=`(async () => {
184
+ })()`}:e.text?{mode:"text",code:`(async () => await window.__sootsimTest.findByText(${JSON.stringify(e.text)}))()`}:null}async function R(e,t){let n=p(t);if(!n)return null;let r=await e.send({type:"evaluate",code:n.code});return{mode:n.mode,result:r}}function P(e){return[...e].sort((t,n)=>c(n)-c(t))}function c(e){let t=0;e.testID&&(t+=100),typeof e.text=="string"&&e.text.trim().length>0&&(t+=60),typeof e.accessibilityLabel=="string"&&e.accessibilityLabel.trim().length>0&&(t+=30),e.accessibilityRole&&(t+=15);let n=e.layout?.width??0,r=e.layout?.height??0,s=n*r;return s>=400&&s<=6e4?t+=25:s>6e4&&(t-=20),(e.absolutePosition?.y??0)<0&&(t-=30),t}function A(e){if(e.testID)return`sootsim do tap-id ${u(e.testID)}`;let t=typeof e.text=="string"?e.text.trim():"";if(t.length>0&&t.length<=80)return`sootsim do tap-text ${u(t)}`;let n=Math.round(((e.absolutePosition?.x??0)+(e.layout?.width??0)/2)*10)/10,r=Math.round(((e.absolutePosition?.y??0)+(e.layout?.height??0)/2)*10)/10;return`sootsim do tap ${n} ${r}`}function u(e){return/^[A-Za-z0-9_./@:-]+$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}var b=`(async () => {
185
185
  const t = window.__sootsimTest
186
186
  let nodes = 0
187
187
  try { nodes = (await t?.getNodeCount?.()) || 0 } catch {}
@@ -229,6 +229,40 @@ ${l}
229
229
  }
230
230
  }
231
231
  } catch {}
232
+ let externalReady = null
233
+ let externalStatus = ''
234
+ let externalError = ''
235
+ try {
236
+ const getExternalAppState = t?.getExternalAppState
237
+ const external = typeof getExternalAppState === 'function'
238
+ ? await Promise.race([
239
+ getExternalAppState(),
240
+ new Promise((resolve) => setTimeout(
241
+ () => resolve({
242
+ state: {
243
+ ready: false,
244
+ loading: true,
245
+ status: 'waiting for tenant worker...',
246
+ },
247
+ }),
248
+ 1000,
249
+ )),
250
+ ])
251
+ : null
252
+ const state = external?.state
253
+ if (state && typeof state === 'object') {
254
+ externalReady = state.ready === true
255
+ if (typeof state.status === 'string') externalStatus = state.status
256
+ if (typeof state.error === 'string') externalError = state.error
257
+ }
258
+ if (!externalError && Array.isArray(external?.entryErrors)) {
259
+ const entry = external.entryErrors.find((item) => {
260
+ return item && typeof item.message === 'string' && item.message.trim()
261
+ })
262
+ if (entry) externalError = entry.message
263
+ }
264
+ if (externalReady === false && externalStatus) loadingText = externalStatus
265
+ } catch {}
232
266
  let errors = 0
233
267
  try { errors = window.__sootsimConsole?.count?.()?.errors ?? 0 } catch {}
234
268
  return {
@@ -238,8 +272,11 @@ ${l}
238
272
  targets,
239
273
  errors,
240
274
  loadingText,
275
+ externalReady,
276
+ externalStatus,
277
+ externalError,
241
278
  }
242
- })()`,g=50,m=100,f=750;function w(e){return e.targets>0||e.nodes>=m}async function R(e,t=2e4){let n=Date.now(),s=n+t,r=-1,i=n,o={flag:void 0,at:0,nodes:0,targets:0,errors:0,loadingText:""};for(;Date.now()<s;){try{o=await e.send({type:"evaluate",code:b})??o}catch{}let a=Date.now();if(o.nodes!==r&&(r=o.nodes,i=a),o.flag===!0&&!o.loadingText&&o.nodes>=g&&w(o)&&a-i>=f)return{ready:!0,elapsedMs:a-n,nodes:o.nodes,targets:o.targets,flag:o.flag,loadingText:o.loadingText,errors:o.errors};await new Promise(d=>setTimeout(d,150))}return{ready:!1,elapsedMs:Date.now()-n,nodes:o.nodes,targets:o.targets,flag:o.flag,loadingText:o.loadingText,errors:o.errors}}async function N(e,t,n=5e3){return await e.send({type:"evaluate",code:`(async () => {
279
+ })()`,g=50,m=100,f=750;function w(e){return e.targets>0||e.nodes>=m}async function L(e,t=2e4){let n=Date.now(),r=n+t,s=-1,i=n,o={flag:void 0,at:0,nodes:0,targets:0,errors:0,loadingText:"",externalReady:null,externalStatus:"",externalError:""};for(;Date.now()<r;){try{o=await e.send({type:"evaluate",code:b})??o}catch{}let a=Date.now();if(o.nodes!==s&&(s=o.nodes,i=a),o.flag===!0&&o.externalReady!==!1&&!o.externalError&&!o.loadingText&&o.nodes>=g&&w(o)&&a-i>=f)return{ready:!0,elapsedMs:a-n,nodes:o.nodes,targets:o.targets,flag:o.flag,loadingText:o.loadingText,externalReady:o.externalReady,externalStatus:o.externalStatus,externalError:o.externalError,errors:o.errors};await new Promise(d=>setTimeout(d,150))}return{ready:!1,elapsedMs:Date.now()-n,nodes:o.nodes,targets:o.targets,flag:o.flag,loadingText:o.loadingText,externalReady:o.externalReady,externalStatus:o.externalStatus,externalError:o.externalError,errors:o.errors}}async function D(e,t,n=5e3){return await e.send({type:"evaluate",code:`(async () => {
243
280
  const start = Date.now()
244
281
  const deadline = start + ${n}
245
282
  const t = window.__sootsimTest
@@ -258,17 +295,17 @@ ${l}
258
295
  await new Promise((r) => setTimeout(r, 80))
259
296
  }
260
297
  return { found: false, elapsed: Date.now() - start }
261
- })()`})??{found:!1,elapsed:n}}async function E(e,t=20){let n=await e.send({type:"evaluate",code:`window.__sootsimConsole?.getErrors(${t}) || []`});return Array.isArray(n)?n:[]}async function H(e,t=20){let n=await e.send({type:"evaluate",code:`window.__sootsimConsole?.getWarnings(${t}) || []`});return Array.isArray(n)?n:[]}async function B(e){await e.send({type:"evaluate",code:'window.__sootsimConsole?.clear(); "cleared"'})}async function C(e,t={}){let n=t.limit??20,s=t.failed===!1?"getRequests":"getFailedRequests",r=await e.send({type:"call",path:`__sootsimTest.${s}`,args:[n]});return Array.isArray(r)?r:[]}async function M(e){await e.send({type:"call",path:"__sootsimTest.clearRequests",args:[]})}async function $(e){let t=await e.send({type:"evaluate",code:`(() => {
298
+ })()`})??{found:!1,elapsed:n}}async function N(e,t=20){let n=await e.send({type:"evaluate",code:`window.__sootsimConsole?.getErrors(${t}) || []`});return Array.isArray(n)?n:[]}async function H(e,t=20){let n=await e.send({type:"evaluate",code:`window.__sootsimConsole?.getWarnings(${t}) || []`});return Array.isArray(n)?n:[]}async function B(e){await e.send({type:"evaluate",code:'window.__sootsimConsole?.clear(); "cleared"'})}async function C(e,t={}){let n=t.limit??20,r=t.failed===!1?"getRequests":"getFailedRequests",s=await e.send({type:"call",path:`__sootsimTest.${r}`,args:[n]});return Array.isArray(s)?s:[]}async function M(e){await e.send({type:"call",path:"__sootsimTest.clearRequests",args:[]})}async function $(e){let t=await e.send({type:"evaluate",code:`(() => {
262
299
  const obs = window.__sootsimObservability;
263
300
  if (!obs) return { ok: false };
264
301
  return { ok: true, entries: obs.logs.getSnapshot() };
265
- })()`});if(!t||!t.ok)throw new Error("observability bridge not installed \u2014 is the engine running?");return t.entries??[]}async function O(e){await e.send({type:"evaluate",code:'window.__sootsimObservability?.logs.clear(); "cleared"'})}function h(e,t){if(e.source===t.source||e.level!==t.level||Math.abs(e.ts-t.ts)>1e3||e.args.length!==t.args.length)return!1;let n=new Set([e.source,t.source]);return!n.has("sootsim-worker")||!n.has("render-worker")&&!n.has("forwarded-render-worker")?!1:e.args.every((s,r)=>s===t.args[r])}function F(e,t={}){let n=[];for(let s of e)n.some(r=>h(r,s))||n.push(s);if(t.showInternal||(n=n.filter(s=>{let r=s.args[0];return!(typeof r=="string"&&r.startsWith("[sootsim]"))})),t.level&&(n=n.filter(s=>t.level.has(s.level))),t.filter){let s=t.filter.toLowerCase();n=n.filter(r=>r.args.join(" ").toLowerCase().includes(s))}return n}async function W(e,t){return await e.send({type:"call",path:"SootSim.bridges.timeline.summary",args:[t]})}async function z(e,t){return await e.send({type:"call",path:"SootSim.bridges.timeline.recent",args:[t]})}async function K(e,t,n){await e.send({type:"call",path:"SootSim.bridges.timeline.cursorAdvance",args:[t,n]})}async function J(e){return await e.send({type:"evaluate",code:`(() => {
302
+ })()`});if(!t||!t.ok)throw new Error("observability bridge not installed \u2014 is the engine running?");return t.entries??[]}async function O(e){await e.send({type:"evaluate",code:'window.__sootsimObservability?.logs.clear(); "cleared"'})}function h(e,t){if(e.source===t.source||e.level!==t.level||Math.abs(e.ts-t.ts)>1e3||e.args.length!==t.args.length)return!1;let n=new Set([e.source,t.source]);return!n.has("sootsim-worker")||!n.has("render-worker")&&!n.has("forwarded-render-worker")?!1:e.args.every((r,s)=>r===t.args[s])}function F(e,t={}){let n=[];for(let r of e)n.some(s=>h(s,r))||n.push(r);if(t.showInternal||(n=n.filter(r=>{let s=r.args[0];return!(typeof s=="string"&&s.startsWith("[sootsim]"))})),t.level&&(n=n.filter(r=>t.level.has(r.level))),t.filter){let r=t.filter.toLowerCase();n=n.filter(s=>s.args.join(" ").toLowerCase().includes(r))}return n}async function W(e,t){return await e.send({type:"call",path:"SootSim.bridges.timeline.summary",args:[t]})}async function z(e,t){return await e.send({type:"call",path:"SootSim.bridges.timeline.recent",args:[t]})}async function K(e,t,n){await e.send({type:"call",path:"SootSim.bridges.timeline.cursorAdvance",args:[t,n]})}async function J(e){return await e.send({type:"evaluate",code:`(() => {
266
303
  const kb = window.__sootsimKeyboard
267
304
  if (!kb || typeof kb.getLayout !== 'function') {
268
305
  return { error: 'keyboard bridge getLayout() not available' }
269
306
  }
270
307
  return kb.getLayout()
271
- })()`})??{error:"keyboard bridge returned no result"}}function x(e){let t=e instanceof Error?e.message:String(e);return t.includes("call target not found: SootSim.bridges.mainShell")||t.includes("test bridge unavailable before app-in-worker boot")}async function S(e,t=0){let n=Date.now()+Math.max(0,t);for(;;)try{return await e.send({type:"call",path:"SootSim.bridges.mainShell.getState",args:[]})}catch(s){if(!x(s)||Date.now()>=n)throw s;await new Promise(r=>setTimeout(r,50))}}async function V(e){let t=await e.send({type:"evaluate",code:`(async () => {
308
+ })()`})??{error:"keyboard bridge returned no result"}}function x(e){let t=e instanceof Error?e.message:String(e);return t.includes("call target not found: SootSim.bridges.mainShell")||t.includes("test bridge unavailable before app-in-worker boot")}async function S(e,t=0){let n=Date.now()+Math.max(0,t);for(;;)try{return await e.send({type:"call",path:"SootSim.bridges.mainShell.getState",args:[]})}catch(r){if(!x(r)||Date.now()>=n)throw r;await new Promise(s=>setTimeout(s,50))}}async function V(e){let t=await e.send({type:"evaluate",code:`(async () => {
272
309
  const test = window.__sootsimTest
273
310
  const kb = window.__sootsimKeyboard
274
311
  const navSnap =
@@ -292,7 +329,7 @@ ${l}
292
329
  })()
293
330
  : null
294
331
  return { nav: navSnap, keyboard }
295
- })()`});return{shell:await S(e,500).catch(()=>null),nav:t?.nav??null,keyboard:t?.keyboard??null}}async function Q(e){return e.send({type:"evaluate",code:"window.__sootsimDebug.status()"})}async function j(e){return e.send({type:"evaluate",code:"window.__sootsimDebug.flags()"})}async function Y(e,t){let n=t==="sheets"?"findSheets":"findPortals";return e.send({type:"evaluate",code:`window.__sootsimDebug.${n}()`})}async function q(e,t,n=50){let s=t&&t!=="all"?`window.__sootsimDebug.recent(${JSON.stringify(t)}, ${n})`:`window.__sootsimDebug.recent(undefined, ${n})`;return e.send({type:"evaluate",code:s})}async function U(e,t,n){let s=n.length>0?n.map(r=>JSON.stringify(r)).join(", "):t==="disable"?"'all'":"";return e.send({type:"evaluate",code:`window.__sootsimDebug.${t}(${s})`})}async function G(e){return await e.send({type:"evaluate",code:`(async () => {
332
+ })()`});return{shell:await S(e,500).catch(()=>null),nav:t?.nav??null,keyboard:t?.keyboard??null}}async function j(e){return e.send({type:"evaluate",code:"window.__sootsimDebug.status()"})}async function Q(e){return e.send({type:"evaluate",code:"window.__sootsimDebug.flags()"})}async function Y(e,t){let n=t==="sheets"?"findSheets":"findPortals";return e.send({type:"evaluate",code:`window.__sootsimDebug.${n}()`})}async function q(e,t,n=50){let r=t&&t!=="all"?`window.__sootsimDebug.recent(${JSON.stringify(t)}, ${n})`:`window.__sootsimDebug.recent(undefined, ${n})`;return e.send({type:"evaluate",code:r})}async function U(e,t,n){let r=n.length>0?n.map(s=>JSON.stringify(s)).join(", "):t==="disable"?"'all'":"";return e.send({type:"evaluate",code:`window.__sootsimDebug.${t}(${r})`})}async function G(e){return await e.send({type:"evaluate",code:`(async () => {
296
333
  const host = window.__sootsimRenderHost
297
334
  const stats = host?.queryStats ? await host.queryStats() : null
298
335
  const hostMem = performance.memory
@@ -307,4 +344,4 @@ ${l}
307
344
  workerHeap: stats?.memory?.workerHeap ?? null,
308
345
  hostHeap: hostMem,
309
346
  }
310
- })()`})??{imageLoader:null,workerHeap:null,hostHeap:null}}function X(e){if(e.total===0)return"nothing recorded";let t=[],n=["error","warning","console","fetch","toast","alert","actionsheet","picker","notification","screen","route","keyboard","app-launch","shell","scroll","gesture","text-input","react-commit","animation","reanimated"],s=new Set;for(let r of n){let i=e.byKind[r];i&&(t.push(`${i} ${r}${i===1?"":"s"}`),s.add(r))}for(let[r,i]of Object.entries(e.byKind))!s.has(r)&&i&&t.push(`${i} ${r}${i===1?"":"s"}`);return t.join(" \xB7 ")}export{T as a,v as b,I as c,_ as d,k as e,L as f,P as g,A as h,D as i,b as j,g as k,f as l,w as m,R as n,N as o,E as p,H as q,B as r,C as s,M as t,$ as u,O as v,F as w,W as x,z as y,K as z,J as A,x as B,S as C,V as D,Q as E,j as F,Y as G,q as H,U as I,G as J,X as K};
347
+ })()`})??{imageLoader:null,workerHeap:null,hostHeap:null}}function X(e){if(e.total===0)return"nothing recorded";let t=[],n=["error","warning","console","fetch","toast","alert","actionsheet","picker","notification","screen","route","keyboard","app-launch","shell","scroll","gesture","text-input","react-commit","animation","reanimated"],r=new Set;for(let s of n){let i=e.byKind[s];i&&(t.push(`${i} ${s}${i===1?"":"s"}`),r.add(s))}for(let[s,i]of Object.entries(e.byKind))!r.has(s)&&i&&t.push(`${i} ${s}${i===1?"":"s"}`);return t.join(" \xB7 ")}export{T as a,v as b,I as c,_ as d,k as e,E as f,R as g,P as h,A as i,b as j,g as k,f as l,w as m,L as n,D as o,N as p,H as q,B as r,C as s,M as t,$ as u,O as v,F as w,W as x,z as y,K as z,J as A,x as B,S as C,V as D,j as E,Q as F,Y as G,q as H,U as I,G as J,X as K};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.64 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as L}from"./chunk-J6TCNU6W.js";import{existsSync as o,readFileSync as p,writeFileSync as d}from"node:fs";import{homedir as j}from"node:os";import{dirname as $,join as s,resolve as P}from"node:path";var _=j();function Q(e){let t=e;for(;;){if(o(s(t,"pnpm-workspace.yaml"))||o(s(t,"turbo.json"))||o(s(t,"nx.json"))||o(s(t,"lerna.json")))return t;let r=s(t,"package.json");if(o(r))try{if(JSON.parse(p(r,"utf8")).workspaces)return t}catch{}let n=$(t);if(n===t)return null;t=n}}function S(e,t){let r=Q(process.cwd()),n=[r?P(r,e):null,P(process.cwd(),e),P(process.cwd(),t)].filter(a=>!!a);for(let a of n)if(o(a))return a;return n[0]??P(process.cwd(),e)}var X=()=>S("packages/sootsim-engine/scripts/expensify-web-proxy.ts","scripts/expensify-web-proxy.ts"),z=()=>S("packages/sootsim-engine/scripts/rainbow-metadata-proxy.ts","scripts/rainbow-metadata-proxy.ts"),Z=()=>S("packages/compat/src/stubs/mattermost-rnutils-native.ts","../compat/src/stubs/mattermost-rnutils-native.ts"),ee=()=>S("packages/compat/src/stubs/native-seams/react-native-keychain-manager.ts","../compat/src/stubs/native-seams/react-native-keychain-manager.ts"),v=()=>S("packages/compat/src/stubs/mattermost-network-client-native.ts","../compat/src/stubs/mattermost-network-client-native.ts"),D={USE_NGROK:"true",NGROK_URL:"http://localhost:9000/",SECURE_NGROK_URL:"http://localhost:9000/"},te=s(_,"github/mattermost-mobile"),I=s(_,"github/uniswap-interface"),ne=s(I,"apps/mobile"),T=s(I,".env.defaults.local"),re="stored-in-.env.local",W="# sootsim demo env overrides",se=s(I,"packages/uniswap/src/features/forceUpgrade/hooks/useForceUpgradeStatus.ts"),oe=s(I,"apps/mobile/src/notification-service/data-sources/createForceUpgradeNotificationDataSource.ts"),M="SOOTSIM_DEMO_DISABLE_FORCE_UPGRADE";function B(e){if(!o(e))return{};let t={},r=p(e,"utf8");for(let n of r.split(/\r?\n/)){let a=n.trim();if(!a||a.startsWith("#"))continue;let u=a.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);if(!u)continue;let i=u[2].trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),t[u[1]]=i}return t}function k(e){if(!e)return!1;let t=e.trim();return!(!t||t.includes(re)||t==="TRADING_API_KEY"||t==="UNISWAP_API_KEY")}function Y(e,t){for(let r of e)for(let n of t){let a=r[n];if(k(a))return a.trim()}}function J(){let e=B(T),t=B(s(I,"apps/web/.env")),r=[process.env,e,t],n={},a=[["AMPLITUDE_PROXY_URL_OVERRIDE",["REACT_APP_AMPLITUDE_PROXY_URL"]],["QUICKNODE_ENDPOINT_NAME",["REACT_APP_QUICKNODE_ENDPOINT_NAME"]],["QUICKNODE_ENDPOINT_TOKEN",["REACT_APP_QUICKNODE_ENDPOINT_TOKEN"]],["INFURA_KEY",["REACT_APP_INFURA_KEY"]],["STATSIG_API_KEY",["REACT_APP_STATSIG_API_KEY"]],["STATSIG_PROXY_URL_OVERRIDE",["REACT_APP_STATSIG_PROXY_URL"]],["WALLETCONNECT_PROJECT_ID",["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],["WALLETCONNECT_PROJECT_ID_BETA",["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],["WALLETCONNECT_PROJECT_ID_DEV",["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],["TRADING_API_KEY",["REACT_APP_TRADING_API_KEY"]],["UNISWAP_API_KEY",[]]];for(let[i,l]of a){let R=Y(r,[i,...l]);if(R){n[i]=R;for(let m of l)n[m]=R}}if(!(k(n.TRADING_API_KEY)&&k(n.UNISWAP_API_KEY))){let i=Y(r,["GRAPHQL_URL_OVERRIDE","REACT_APP_AWS_API_ENDPOINT"])||"https://interface.gateway.uniswap.org/v1/graphql";n.API_BASE_URL_OVERRIDE="https://interface.gateway.uniswap.org",n.API_BASE_URL_V2_OVERRIDE="https://interface.gateway.uniswap.org/v2",n.GRAPHQL_URL_OVERRIDE=i,n.TRADING_API_URL_OVERRIDE="https://trading-api-labs.interface.gateway.uniswap.org",n.FOR_API_URL_OVERRIDE="https://for.interface.gateway.uniswap.org/v2/FOR.v1.FORService"}return n}function ae(){let e=o(T)?p(T,"utf8"):"";if(e&&!e.includes(W))return;let t=J(),r=[W];for(let[n,a]of Object.entries(t).sort(([u],[i])=>u.localeCompare(i)))r.push(`${n}=${JSON.stringify(a)}`);r.push(""),d(T,`${r.join(`
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as L}from"./chunk-KKOOZPQP.js";import{existsSync as o,readFileSync as p,writeFileSync as d}from"node:fs";import{homedir as j}from"node:os";import{dirname as $,join as s,resolve as P}from"node:path";var _=j();function Q(e){let t=e;for(;;){if(o(s(t,"pnpm-workspace.yaml"))||o(s(t,"turbo.json"))||o(s(t,"nx.json"))||o(s(t,"lerna.json")))return t;let r=s(t,"package.json");if(o(r))try{if(JSON.parse(p(r,"utf8")).workspaces)return t}catch{}let n=$(t);if(n===t)return null;t=n}}function S(e,t){let r=Q(process.cwd()),n=[r?P(r,e):null,P(process.cwd(),e),P(process.cwd(),t)].filter(a=>!!a);for(let a of n)if(o(a))return a;return n[0]??P(process.cwd(),e)}var X=()=>S("packages/sootsim-engine/scripts/expensify-web-proxy.ts","scripts/expensify-web-proxy.ts"),z=()=>S("packages/sootsim-engine/scripts/rainbow-metadata-proxy.ts","scripts/rainbow-metadata-proxy.ts"),Z=()=>S("packages/compat/src/stubs/mattermost-rnutils-native.ts","../compat/src/stubs/mattermost-rnutils-native.ts"),ee=()=>S("packages/compat/src/stubs/native-seams/react-native-keychain-manager.ts","../compat/src/stubs/native-seams/react-native-keychain-manager.ts"),v=()=>S("packages/compat/src/stubs/mattermost-network-client-native.ts","../compat/src/stubs/mattermost-network-client-native.ts"),D={USE_NGROK:"true",NGROK_URL:"http://localhost:9000/",SECURE_NGROK_URL:"http://localhost:9000/"},te=s(_,"github/mattermost-mobile"),I=s(_,"github/uniswap-interface"),ne=s(I,"apps/mobile"),T=s(I,".env.defaults.local"),re="stored-in-.env.local",W="# sootsim demo env overrides",se=s(I,"packages/uniswap/src/features/forceUpgrade/hooks/useForceUpgradeStatus.ts"),oe=s(I,"apps/mobile/src/notification-service/data-sources/createForceUpgradeNotificationDataSource.ts"),M="SOOTSIM_DEMO_DISABLE_FORCE_UPGRADE";function B(e){if(!o(e))return{};let t={},r=p(e,"utf8");for(let n of r.split(/\r?\n/)){let a=n.trim();if(!a||a.startsWith("#"))continue;let u=a.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);if(!u)continue;let i=u[2].trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),t[u[1]]=i}return t}function k(e){if(!e)return!1;let t=e.trim();return!(!t||t.includes(re)||t==="TRADING_API_KEY"||t==="UNISWAP_API_KEY")}function Y(e,t){for(let r of e)for(let n of t){let a=r[n];if(k(a))return a.trim()}}function J(){let e=B(T),t=B(s(I,"apps/web/.env")),r=[process.env,e,t],n={},a=[["AMPLITUDE_PROXY_URL_OVERRIDE",["REACT_APP_AMPLITUDE_PROXY_URL"]],["QUICKNODE_ENDPOINT_NAME",["REACT_APP_QUICKNODE_ENDPOINT_NAME"]],["QUICKNODE_ENDPOINT_TOKEN",["REACT_APP_QUICKNODE_ENDPOINT_TOKEN"]],["INFURA_KEY",["REACT_APP_INFURA_KEY"]],["STATSIG_API_KEY",["REACT_APP_STATSIG_API_KEY"]],["STATSIG_PROXY_URL_OVERRIDE",["REACT_APP_STATSIG_PROXY_URL"]],["WALLETCONNECT_PROJECT_ID",["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],["WALLETCONNECT_PROJECT_ID_BETA",["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],["WALLETCONNECT_PROJECT_ID_DEV",["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],["TRADING_API_KEY",["REACT_APP_TRADING_API_KEY"]],["UNISWAP_API_KEY",[]]];for(let[i,l]of a){let R=Y(r,[i,...l]);if(R){n[i]=R;for(let m of l)n[m]=R}}if(!(k(n.TRADING_API_KEY)&&k(n.UNISWAP_API_KEY))){let i=Y(r,["GRAPHQL_URL_OVERRIDE","REACT_APP_AWS_API_ENDPOINT"])||"https://interface.gateway.uniswap.org/v1/graphql";n.API_BASE_URL_OVERRIDE="https://interface.gateway.uniswap.org",n.API_BASE_URL_V2_OVERRIDE="https://interface.gateway.uniswap.org/v2",n.GRAPHQL_URL_OVERRIDE=i,n.TRADING_API_URL_OVERRIDE="https://trading-api-labs.interface.gateway.uniswap.org",n.FOR_API_URL_OVERRIDE="https://for.interface.gateway.uniswap.org/v2/FOR.v1.FORService"}return n}function ae(){let e=o(T)?p(T,"utf8"):"";if(e&&!e.includes(W))return;let t=J(),r=[W];for(let[n,a]of Object.entries(t).sort(([u],[i])=>u.localeCompare(i)))r.push(`${n}=${JSON.stringify(a)}`);r.push(""),d(T,`${r.join(`
3
3
  `)}
4
4
  `)}function ie(){let e=`export function useForceUpgradeStatus(): ForceUpgradeStatus {
5
5
  `,t=` // sootsim demo: bypass the force-upgrade gate during local engine demos.
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ var t="http://localhost:5173/";export{t as a};
@@ -0,0 +1 @@
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
@@ -0,0 +1 @@
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ var O="sootsim close";export{O as a};
@@ -1,3 +1,3 @@
1
- /*! sootsim v0.1.64 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{l as P,n as a,y as m}from"./chunk-WKVIKFMU.js";import l from"fs";import c from"path";var s="default",S="profiles.json",i=1;function o(e){let r=e.trim();if(!r)throw new Error("profile id is required");if(!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(r))throw new Error("profile ids must start with a letter or number and contain only letters, numbers, dot, dash, or underscore");if(r==="."||r==="..")throw new Error(`invalid profile id: ${r}`);return r}function d(){return c.join(a(),S)}function I(e){return`sootsim-profile-${o(e)}`}function h(e){return c.join(P(),"Partitions",I(e))}function A(e){return c.join(a(),"playwright",o(e))}function u(){try{let e=JSON.parse(l.readFileSync(d(),"utf8"));if(!e||e.version!==i)return{version:i,profiles:[]};let r=Array.isArray(e.profiles)?e.profiles.filter(t=>!!t&&typeof t.id=="string"&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string").map(t=>({id:o(t.id),createdAt:t.createdAt,updatedAt:t.updatedAt})):[];return{version:i,profiles:r}}catch{return{version:i,profiles:[]}}}function x(e){return[...e].sort((r,t)=>r.id===s?-1:t.id===s?1:r.id.localeCompare(t.id))}function p(e){if(e.profiles.some(t=>t.id===s))return{...e,profiles:x(e.profiles)};let r=new Date().toISOString();return{version:i,profiles:x([{id:s,createdAt:r,updatedAt:r},...e.profiles])}}function g(e){m();let r=p(e),t=`${d()}.tmp`;return l.writeFileSync(t,`${JSON.stringify(r,null,2)}
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{l as P,n as a,y as m}from"./chunk-TWKWXGN5.js";import l from"fs";import c from"path";var s="default",S="profiles.json",i=1;function o(e){let r=e.trim();if(!r)throw new Error("profile id is required");if(!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(r))throw new Error("profile ids must start with a letter or number and contain only letters, numbers, dot, dash, or underscore");if(r==="."||r==="..")throw new Error(`invalid profile id: ${r}`);return r}function d(){return c.join(a(),S)}function I(e){return`sootsim-profile-${o(e)}`}function h(e){return c.join(P(),"Partitions",I(e))}function A(e){return c.join(a(),"playwright",o(e))}function u(){try{let e=JSON.parse(l.readFileSync(d(),"utf8"));if(!e||e.version!==i)return{version:i,profiles:[]};let r=Array.isArray(e.profiles)?e.profiles.filter(t=>!!t&&typeof t.id=="string"&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string").map(t=>({id:o(t.id),createdAt:t.createdAt,updatedAt:t.updatedAt})):[];return{version:i,profiles:r}}catch{return{version:i,profiles:[]}}}function x(e){return[...e].sort((r,t)=>r.id===s?-1:t.id===s?1:r.id.localeCompare(t.id))}function p(e){if(e.profiles.some(t=>t.id===s))return{...e,profiles:x(e.profiles)};let r=new Date().toISOString();return{version:i,profiles:x([{id:s,createdAt:r,updatedAt:r},...e.profiles])}}function g(e){m();let r=p(e),t=`${d()}.tmp`;return l.writeFileSync(t,`${JSON.stringify(r,null,2)}
3
3
  `,"utf8"),l.renameSync(t,d()),r}function y(){return g(u()).profiles}function E(e){let r=o(e);return y().find(t=>t.id===r)??null}function _(e=s){let r=o(e),t=E(r);return t||D(r)}function D(e){let r=o(e),t=p(u());if(t.profiles.some(w=>w.id===r))throw new Error(`profile already exists: ${r}`);let f=new Date().toISOString(),n={id:r,createdAt:f,updatedAt:f};return g({version:i,profiles:[...t.profiles,n]}),n}function F(e){let r=o(e);if(r===s)throw new Error("the default profile cannot be deleted; clear it instead");let t=p(u()),f=t.profiles.find(n=>n.id===r);if(!f)throw new Error(`profile not found: ${r}`);return g({version:i,profiles:t.profiles.filter(n=>n.id!==r)}),v(r),f}function v(e){let r=o(e);for(let t of[h(r),A(r)])try{l.rmSync(t,{recursive:!0,force:!0})}catch{}}export{A as a,y as b,_ as c,D as d,F as e,v as f};
@@ -1,6 +1,6 @@
1
- /*! sootsim v0.1.64 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as _,b as z,c as le,d as ce}from"./chunk-RKUDWRIN.js";import{b as E}from"./chunk-T5TDH2UO.js";import{j as se,k as ie,m as ae}from"./chunk-DJIQVKM6.js";import{g as q}from"./chunk-HERZHQFG.js";import{a as C,b as j}from"./chunk-X3QWOTLT.js";import{c as de}from"./chunk-2GAZ3JW7.js";import{d as ne}from"./chunk-YJIQYIHM.js";import{a as ee}from"./chunk-WN4XOOK5.js";import{b as re,c as v,d as S,e as I}from"./chunk-SVT7H2QF.js";import{c as k,d as w,e as P}from"./chunk-346HJVD6.js";import{E as te,F as oe}from"./chunk-WKVIKFMU.js";import Te from"node:fs";import Me from"node:os";import G from"node:path";function ve(t){return t.replace(/^\[|\]$/g,"").toLowerCase()}function W(t){let o=ve(t);return o==="localhost"||o.endsWith(".localhost")||o==="0.0.0.0"||o==="::1"||/^127(?:\.\d{1,3}){3}$/.test(o)}function me(t){return new Error(`could not resolve a native bundle for ${t}. pass an explicit bundle URL or open Connect and choose the app there.`)}function Ie(t,o){return t?.includes("/one/metro-entry.bundle")?"one":typeof o=="string"&&o?"expo":"unknown"}function pe(t,o,e){return`${t}//${o}:${e}`}function xe(t){if(typeof window>"u")return!1;try{let o=new URL(t);return W(o.hostname)&&W(window.location.hostname)&&o.origin!==window.location.origin}catch{return!1}}async function ue(t,o){let e={...o,cache:o?.cache??"no-store"};return xe(t)?fetch(`/__fetch-proxy?url=${encodeURIComponent(t)}`,e):fetch(t,e)}function ke(t){return t==="https:"?443:80}function Pe(t){let o=t.pathname||"/";return(o==="/"||o==="")&&!t.search&&!t.hash}async function fe(t,o){let e=t.replace(/\/+$/,"");try{let n=await ue(`${e}/`,{headers:{"expo-platform":"ios"}});if(n.ok){let r=await n.json(),s=r?.extra?.expoClient||r?.extra||{},a=typeof r?.launchAsset?.url=="string"?r.launchAsset.url:void 0;if(a||s.name)return{bundleUrl:le(a||`${e}${z}`),port:o,framework:Ie(a,s.sdkVersion),projectName:s.name}}}catch{}try{let n=await ue(`${e}/status`);if(n.ok&&(await n.text()).includes("packager-status:running"))return{bundleUrl:`${e}${z}`,port:o,framework:"metro"}}catch{}return null}async function Ce(t){return fe(pe("http:","localhost",t),t)}async function ge(t){let o=t.trim();if(/^\d+$/.test(o)){let i=parseInt(o,10),l=await Ce(i);if(l)return l;throw me(`localhost:${i}`)}let e=o.startsWith("http")?o:`http://${o}`,n;try{n=new URL(e)}catch{throw new Error(`could not parse "${t}". pass a dev-server port, a dev-server base URL, or a full bundle URL.`)}let r=n.protocol||"http:",s=n.port?parseInt(n.port,10):ke(r),a=pe(r,n.hostname,s);if(Pe(n)){let i=await fe(a,s);if(i)return i;throw me(a)}return{bundleUrl:n.toString(),port:s,framework:"unknown"}}function Ze(){console.error(" no sootsim desktop companion found."),console.error(""),console.error(" install the desktop app:"),console.error(" sootsim install-desktop"),console.error(""),console.error(" or wire sootsim into your own project so your dev server hosts the bridge:"),console.error(" sootsim setup-repo"),console.error("")}function he(t){let o=C();if(console.log(` note: no sootsim bridge detected on port ${t}`),o){console.log(" launch the installed companion with:"),console.log(" sootsim electron");return}console.log(""),console.log(" to get a bridge running, either:"),console.log(" sootsim install-desktop # download the electron app"),console.log(" sootsim setup-repo # wire sootsim into your own project")}function Be(t){console.error(""),console.error(` no sim is connected to the sootsim bridge on port ${t}.`),console.error(""),console.error(" start your app dev server, then open it in sootsim:"),console.error(" npx expo start --localhost --port 8081"),console.error(" sootsim open 8081"),console.error(""),console.error(" then inspect the live app:"),console.error(" sootsim describe")}async function et(t,o,e){let n=[];try{n=await t.listSims()}catch{}if(console.error(""),n.length===0){Be(o);return}console.error(` no sim with id "${e}" is connected to the bridge on port ${o}.`),console.error(""),console.error(" connected sims:");for(let r of n){let s=[r.isPrimary?"primary":null,r.readyState].filter(Boolean).join(", ");console.error(` ${r.id} (${s})`)}console.error(""),console.error(" pass a valid --sim id, or run `sootsim list` to see all sessions.")}var Ue={rn:"/rn",connectrn:"/rn","connect-rn":"/rn",clock:"/app/clock","native-ui":"/app/native-ui",tamagui:"/app/tamagui",settings:"/app/settings",photos:"/app/photos",camera:"/app/camera"};function x(t){return new Promise(o=>setTimeout(o,t))}function A(t){return t.trim()}function J(t){try{let o=new URL(t),e=o.pathname.replace(/\/+$/,"")||"/";return o.searchParams.has("open")||o.searchParams.has("port")||o.searchParams.has("bundle")||o.searchParams.has("demo")||o.pathname.includes("/sootsim/index.html")||e==="/sootsim"||o.pathname==="/__soot"||o.pathname==="/__soot/"||e==="/rn"||/^\/rn\/[^/]+$/i.test(e)||/^\/app\/[^/]+$/i.test(e)||e==="/__soot/rn"||/^\/__soot\/rn\/[^/]+$/i.test(e)||/^\/__soot\/app\/[^/]+$/i.test(e)}catch{return!1}}async function bt(t){let o=A(t);return(await ye(o)).bundleUrl}function Re(t){try{let o=new URL(t.startsWith("http")?t:`http://${t}`),e=o.pathname||"/";if(e!=="/"&&e!==""||o.search||o.hash||!/^(localhost|127\.0\.0\.1|\[::1\]|::1)$/i.test(o.hostname))return null;let n=o.port?Number(o.port):o.protocol==="https:"?443:80;return Number.isFinite(n)&&n>0?n:null}catch{return null}}async function ye(t){let o=A(t),e=/^\d+$/.test(o)?Number(o):Re(o);if(e&&e>0){let n=await ce(e);if(n)return{bundleUrl:n.bundleUrl,port:n.port,framework:n.framework,projectName:n.projectName}}return ge(o)}function V(t){let o=t.replace(/\/+$/,"")||"/";return o==="/__soot"||o.startsWith("/__soot/")?"/__soot":""}function Oe(t,o){let e=A(t),n=new URL(o),r=V(n.pathname);return n.pathname=`${r}/rn`,n.searchParams.delete("bundle"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.delete("open"),n.searchParams.delete("port"),/^\d+$/.test(e)?n.pathname=`${r}/rn/${e}`:(n.pathname=`${r}/rn`,n.searchParams.set("open",e)),n.toString()}function Ee(t){let o=A(t);return/^\d+$/.test(o)||/^https?:\/\//i.test(o)?!0:/^(localhost|127\.0\.0\.1|\[::1\]|[^/]+\.localhost):\d+(?:\/.*)?$/i.test(o)}async function _e(t,o){let e=await ye(t),n=new URL(o),r=V(n.pathname);return n.pathname=`${r}/rn`,n.searchParams.delete("open"),n.searchParams.delete("port"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.set("bundle",e.bundleUrl),n.toString()}function Le(t){return t.startsWith("~/")?G.join(Me.homedir(),t.slice(2)):G.isAbsolute(t)?t:G.resolve(process.cwd(),t)}function De(t){let o={};for(let e=0;e<t.length;e++){if(t[e]!=="--replace")continue;let n=t[e+1];n||(console.error(" sootsim open: --replace expects <module>=<file>"),process.exit(1));let r=n.indexOf("=");(r<=0||r===n.length-1)&&(console.error(" sootsim open: --replace expects <module>=<file>"),process.exit(1));let s=n.slice(0,r).trim(),a=Le(n.slice(r+1).trim());Te.existsSync(a)||(console.error(` sootsim open: replacement file not found: ${a}`),process.exit(1)),o[s]={file:a},e++}return Object.keys(o).length>0?{modules:o}:void 0}function be(){let t=te();return oe(t)&&t.runtimePort>0?`http://localhost:${t.runtimePort}/`:ee}async function D(t,o=be()){if(!t)return new URL(o).toString();if(J(t))return new URL(t).toString();let e=Ue[t.toLowerCase()];if(e){let n=new URL(o),r=V(n.pathname);return n.pathname=`${r}${e}`,n.toString()}return Ee(t)?_e(t,o):Oe(t,o)}function we(t,o){let e=t?.url||t?.origin||o;try{let n=new URL(e);return n.searchParams.delete("bundle"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.delete("open"),n.searchParams.delete("port"),n.searchParams.delete("inspectOpen"),n.toString()}catch{return o}}async function Ae(t,o,e){let n=new URL(await D(t,o));return n.searchParams.set("inspectOpen",e),n.toString()}async function Ne(t,o,e,n={}){let r=n.attempts??30,s=n.intervalMs??500,a=n.minNodeCount??10;for(let i=0;i<r;i++){let l=S(t,{commandTimeoutMs:o,simId:e,simIdSource:"flag"});try{let c=await l.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof c=="number"&&c>a)return{bridge:l,count:c}}catch{}l.close(),await x(s)}return null}function Fe(t){if(!t)return null;try{let o=new URL(t);if(o.searchParams.has("bundle")){let e=o.searchParams.get("bundle")||"";try{let n=new URL(e),r=n.pathname.length>36?`...${n.pathname.slice(-36)}`:n.pathname;return`bundle ${n.host}${r}`}catch{return"bundle"}}return o.searchParams.has("port")?`connect :${o.searchParams.get("port")||""}`:o.searchParams.has("open")?`connect ${o.searchParams.get("open")||""}`:o.searchParams.has("demo")?`demo ${o.searchParams.get("demo")||"default"}`:o.pathname.includes("/sootsim/index.html")||o.pathname==="/sootsim/"||o.pathname==="/sootsim"?"embedded sootsim":null}catch{return null}}function He(t,o){if(t.length===0){console.log(" no sims connected");return}console.log(` connected sims (${t.length}):
3
- `);for(let e of t){let n=e.lockedBy&&e.lockExpiresAt?`locked by ${e.lockedBy} (${Math.max(0,Math.round((e.lockExpiresAt-Date.now())/1e3))}s)`:"",r=[e.isPrimary?"primary":"",e.id===o?"selected":"",e.readyState,e.attachedCliCount&&e.attachedCliCount>0?"in use":"",e.userFocused?"focused":"",n].filter(Boolean);console.log(` ${e.id}${r.length?` [${r.join(", ")}]`:""}`);let s=Fe(e.url);if(s&&console.log(` loaded: ${s}`),e.url?console.log(` url: ${e.url}`):e.origin&&console.log(` origin: ${e.origin}`),e.title&&console.log(` title: ${e.title}`),console.log(` connected: ${new Date(e.connectedAt).toISOString()}`),e.lastActiveAt&&e.lastActiveAt>0){let a=Math.round((Date.now()-e.lastActiveAt)/1e3),i=a<60?`${a}s ago`:a<3600?`${Math.round(a/60)}m ago`:`${Math.round(a/3600)}h ago`;console.log(` last active: ${i}`)}}}async function L(t,o,e,n={}){let r=n.attempts??30,s=n.intervalMs??500;for(let a=0;a<r;a++){let i=S(t,{commandTimeoutMs:o});try{let c=(await i.listSims()).find(e);if(c)return c}catch{}finally{i.close()}await x(s)}return null}async function Ke(t,o,e,n={}){let r=n.attempts??20,s=n.intervalMs??250;for(let a=0;a<r;a++){let i=S(t,{commandTimeoutMs:o});try{let c=(await i.listSims()).find(d=>d.id===e);if(!c||c.readyState!=="open")return!0}catch{return!0}finally{i.close()}await x(s)}return!1}function ze(t){let o=t.meta;if(!o||o.sootsimHostDriver!=="playwright")return null;let e=Number(o.sootsimHostPid);return!Number.isInteger(e)||e<=1||e===process.pid?null:e}function Q(t,o){let e=new Set(o),n=new Set;for(let r of t){if(!e.has(r.id))continue;let s=ze(r);s&&n.add(s)}for(let r of n)try{process.kill(r,"SIGTERM"),console.log(` closed playwright host process ${r}`)}catch{}}function N(t,o){if(o){let r=o.trim(),s=t.find(a=>a.id===r);if(!s)throw new Error(`no sim connected with id ${r}`);return s}let e=t.find(r=>r.isPrimary&&r.readyState==="open");if(e)return e;let n=t.find(r=>r.readyState==="open");if(n)return n;throw new Error("no sim connected")}function B(t,o,e){console.log(` ${e==="current sim"?"loaded":"opened"}: ${t} [${e}]`),console.log(` current sim: ${o.id}`),console.log(JSON.stringify({simId:o.id,url:o.url},null,2))}async function T(t,o,e){if(e.includes("--no-describe"))return;let n=process.env.SOOTSIM_QUIET_TARGET_NOTICE;process.env.SOOTSIM_QUIET_TARGET_NOTICE="1";try{await je(t,o,{stableMs:150,maxMs:400});let r=S(t,{commandTimeoutMs:3e3,simId:o,cliLabel:"open --describe",simIdSource:"flag"});try{let s=null;try{s=await r.send({type:"evaluate",code:se})}catch{}if(s&&!(s.flag===!0&&!s.loadingText&&s.nodes>=ie&&ae(s))){let d=s.loadingText?`still showing "${s.loadingText}"`:s.flag!==!0?"guest ready event has not fired":s.targets<=0?"no visible app content is inspectable yet":"app tree is still stabilizing";console.log(` app still loading: ${d} (nodes: ${s.nodes}, targets: ${s.targets})`),console.log(" before interacting, run: sootsim wait ready --max-ms 120000")}let i=`(async () => {
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as _,b as z,c as le,d as ce}from"./chunk-O56DABNK.js";import{b as O}from"./chunk-TRHZBTPF.js";import{j as se,k as ie,m as ae}from"./chunk-5ZB5ZN5Z.js";import{g as q}from"./chunk-NTEZEQSB.js";import{a as C,b as j}from"./chunk-FU33BTPL.js";import{c as de}from"./chunk-ELZHT3LB.js";import{d as ne}from"./chunk-UH4H5HXN.js";import{a as ee}from"./chunk-B32KMMQV.js";import{b as re,c as I,d as S,e as x}from"./chunk-ZW3HKMLQ.js";import{c as P,d as w,e as k}from"./chunk-VGQXIMEX.js";import{E as te,F as oe}from"./chunk-TWKWXGN5.js";import Me from"node:fs";import Ue from"node:os";import G from"node:path";function Ie(t){return t.replace(/^\[|\]$/g,"").toLowerCase()}function W(t){let o=Ie(t);return o==="localhost"||o.endsWith(".localhost")||o==="0.0.0.0"||o==="::1"||/^127(?:\.\d{1,3}){3}$/.test(o)}function me(t){return new Error(`could not resolve a native bundle for ${t}. pass an explicit bundle URL or open Connect and choose the app there.`)}function xe(t,o){return t?.includes("/one/metro-entry.bundle")?"one":typeof o=="string"&&o?"expo":"unknown"}function pe(t,o,e){return`${t}//${o}:${e}`}function Pe(t){if(typeof window>"u")return!1;try{let o=new URL(t);return W(o.hostname)&&W(window.location.hostname)&&o.origin!==window.location.origin}catch{return!1}}async function ue(t,o){let e={...o,cache:o?.cache??"no-store"};return Pe(t)?fetch(`/__fetch-proxy?url=${encodeURIComponent(t)}`,e):fetch(t,e)}function ke(t){return t==="https:"?443:80}function Ce(t){let o=t.pathname||"/";return(o==="/"||o==="")&&!t.search&&!t.hash}async function fe(t,o){let e=t.replace(/\/+$/,"");try{let n=await ue(`${e}/`,{headers:{"expo-platform":"ios"}});if(n.ok){let r=await n.json(),s=r?.extra?.expoClient||r?.extra||{},a=typeof r?.launchAsset?.url=="string"?r.launchAsset.url:void 0;if(a||s.name)return{bundleUrl:le(a||`${e}${z}`),port:o,framework:xe(a,s.sdkVersion),projectName:s.name}}}catch{}try{let n=await ue(`${e}/status`);if(n.ok&&(await n.text()).includes("packager-status:running"))return{bundleUrl:`${e}${z}`,port:o,framework:"metro"}}catch{}return null}async function Be(t){return fe(pe("http:","localhost",t),t)}async function ge(t){let o=t.trim();if(/^\d+$/.test(o)){let i=parseInt(o,10),l=await Be(i);if(l)return l;throw me(`localhost:${i}`)}let e=o.startsWith("http")?o:`http://${o}`,n;try{n=new URL(e)}catch{throw new Error(`could not parse "${t}". pass a dev-server port, a dev-server base URL, or a full bundle URL.`)}let r=n.protocol||"http:",s=n.port?parseInt(n.port,10):ke(r),a=pe(r,n.hostname,s);if(Ce(n)){let i=await fe(a,s);if(i)return i;throw me(a)}return{bundleUrl:n.toString(),port:s,framework:"unknown"}}function tt(){console.error(" no sootsim desktop companion found."),console.error(""),console.error(" install the desktop app:"),console.error(" sootsim install-desktop"),console.error(""),console.error(" or wire sootsim into your own project so your dev server hosts the bridge:"),console.error(" sootsim setup-repo"),console.error("")}function he(t){let o=C();if(console.log(` note: no sootsim bridge detected on port ${t}`),o){console.log(" launch the installed companion with:"),console.log(" sootsim electron");return}console.log(""),console.log(" to get a bridge running, either:"),console.log(" sootsim install-desktop # download the electron app"),console.log(" sootsim setup-repo # wire sootsim into your own project")}function Te(t){console.error(""),console.error(` no sim is connected to the sootsim bridge on port ${t}.`),console.error(""),console.error(" start your app dev server, then open it in sootsim:"),console.error(" npx expo start --localhost --port 8081"),console.error(" sootsim open 8081"),console.error(""),console.error(" then inspect the live app:"),console.error(" sootsim describe")}async function ot(t,o,e){let n=[];try{n=await t.listSims()}catch{}if(console.error(""),n.length===0){Te(o);return}console.error(` no sim with id "${e}" is connected to the bridge on port ${o}.`),console.error(""),console.error(" connected sims:");for(let r of n){let s=[r.isPrimary?"primary":null,r.readyState].filter(Boolean).join(", ");console.error(` ${r.id} (${s})`)}console.error(""),console.error(" pass a valid --sim id, or run `sootsim list` to see all sessions.")}var Re={rn:"/rn",connectrn:"/rn","connect-rn":"/rn",clock:"/app/clock","native-ui":"/app/native-ui",tamagui:"/app/tamagui",settings:"/app/settings",photos:"/app/photos",camera:"/app/camera"};function $(t){return new Promise(o=>setTimeout(o,t))}function A(t){return t.trim()}function J(t){try{let o=new URL(t),e=o.pathname.replace(/\/+$/,"")||"/";return o.searchParams.has("open")||o.searchParams.has("port")||o.searchParams.has("bundle")||o.searchParams.has("demo")||o.pathname.includes("/sootsim/index.html")||e==="/sootsim"||o.pathname==="/__soot"||o.pathname==="/__soot/"||e==="/rn"||/^\/rn\/[^/]+$/i.test(e)||/^\/app\/[^/]+$/i.test(e)||e==="/__soot/rn"||/^\/__soot\/rn\/[^/]+$/i.test(e)||/^\/__soot\/app\/[^/]+$/i.test(e)}catch{return!1}}async function $t(t){let o=A(t);return(await be(o)).bundleUrl}function Ee(t){try{let o=new URL(t.startsWith("http")?t:`http://${t}`),e=o.pathname||"/";if(e!=="/"&&e!==""||o.search||o.hash||!/^(localhost|127\.0\.0\.1|\[::1\]|::1)$/i.test(o.hostname))return null;let n=o.port?Number(o.port):o.protocol==="https:"?443:80;return Number.isFinite(n)&&n>0?n:null}catch{return null}}async function be(t){let o=A(t),e=/^\d+$/.test(o)?Number(o):Ee(o);if(e&&e>0){let n=await ce(e);if(n)return{bundleUrl:n.bundleUrl,port:n.port,framework:n.framework,projectName:n.projectName}}return ge(o)}function V(t){let o=t.replace(/\/+$/,"")||"/";return o==="/__soot"||o.startsWith("/__soot/")?"/__soot":""}function Oe(t,o){let e=A(t),n=new URL(o),r=V(n.pathname);return n.pathname=`${r}/rn`,n.searchParams.delete("bundle"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.delete("open"),n.searchParams.delete("port"),/^\d+$/.test(e)?n.pathname=`${r}/rn/${e}`:(n.pathname=`${r}/rn`,n.searchParams.set("open",e)),n.toString()}function _e(t){let o=A(t);return/^\d+$/.test(o)||/^https?:\/\//i.test(o)?!0:/^(localhost|127\.0\.0\.1|\[::1\]|[^/]+\.localhost):\d+(?:\/.*)?$/i.test(o)}async function Le(t,o){let e=await be(t),n=new URL(o),r=V(n.pathname);return n.pathname=`${r}/rn`,n.searchParams.delete("open"),n.searchParams.delete("port"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.set("bundle",e.bundleUrl),n.toString()}function De(t){return t.startsWith("~/")?G.join(Ue.homedir(),t.slice(2)):G.isAbsolute(t)?t:G.resolve(process.cwd(),t)}function Ae(t){let o={};for(let e=0;e<t.length;e++){if(t[e]!=="--replace")continue;let n=t[e+1];n||(console.error(" sootsim open: --replace expects <module>=<file>"),process.exit(1));let r=n.indexOf("=");(r<=0||r===n.length-1)&&(console.error(" sootsim open: --replace expects <module>=<file>"),process.exit(1));let s=n.slice(0,r).trim(),a=De(n.slice(r+1).trim());Me.existsSync(a)||(console.error(` sootsim open: replacement file not found: ${a}`),process.exit(1)),o[s]={file:a},e++}return Object.keys(o).length>0?{modules:o}:void 0}function Se(){let t=te();return oe(t)&&t.runtimePort>0?`http://localhost:${t.runtimePort}/`:ee}async function D(t,o=Se()){if(!t)return new URL(o).toString();if(J(t))return new URL(t).toString();let e=Re[t.toLowerCase()];if(e){let n=new URL(o),r=V(n.pathname);return n.pathname=`${r}${e}`,n.toString()}return _e(t)?Le(t,o):Oe(t,o)}function we(t,o){let e=t?.url||t?.origin||o;try{let n=new URL(e);return n.searchParams.delete("bundle"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.delete("open"),n.searchParams.delete("port"),n.searchParams.delete("inspectOpen"),n.toString()}catch{return o}}async function Ne(t,o,e){let n=new URL(await D(t,o));return n.searchParams.set("inspectOpen",e),n.toString()}async function Fe(t,o,e,n={}){let r=n.attempts??30,s=n.intervalMs??500,a=n.minNodeCount??10;for(let i=0;i<r;i++){let l=S(t,{commandTimeoutMs:o,simId:e,simIdSource:"flag"});try{let c=await l.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof c=="number"&&c>a)return{bridge:l,count:c}}catch{}l.close(),await $(s)}return null}function He(t){if(!t)return null;try{let o=new URL(t);if(o.searchParams.has("bundle")){let e=o.searchParams.get("bundle")||"";try{let n=new URL(e),r=n.pathname.length>36?`...${n.pathname.slice(-36)}`:n.pathname;return`bundle ${n.host}${r}`}catch{return"bundle"}}return o.searchParams.has("port")?`connect :${o.searchParams.get("port")||""}`:o.searchParams.has("open")?`connect ${o.searchParams.get("open")||""}`:o.searchParams.has("demo")?`demo ${o.searchParams.get("demo")||"default"}`:o.pathname.includes("/sootsim/index.html")||o.pathname==="/sootsim/"||o.pathname==="/sootsim"?"embedded sootsim":null}catch{return null}}function Ke(t,o){if(t.length===0){console.log(" no sims connected");return}console.log(` connected sims (${t.length}):
3
+ `);for(let e of t){let n=e.lockedBy&&e.lockExpiresAt?`locked by ${e.lockedBy} (${Math.max(0,Math.round((e.lockExpiresAt-Date.now())/1e3))}s)`:"",r=[e.isPrimary?"primary":"",e.id===o?"selected":"",e.readyState,e.attachedCliCount&&e.attachedCliCount>0?"in use":"",e.userFocused?"focused":"",n].filter(Boolean);console.log(` ${e.id}${r.length?` [${r.join(", ")}]`:""}`);let s=He(e.url);if(s&&console.log(` loaded: ${s}`),e.url?console.log(` url: ${e.url}`):e.origin&&console.log(` origin: ${e.origin}`),e.title&&console.log(` title: ${e.title}`),console.log(` connected: ${new Date(e.connectedAt).toISOString()}`),e.lastActiveAt&&e.lastActiveAt>0){let a=Math.round((Date.now()-e.lastActiveAt)/1e3),i=a<60?`${a}s ago`:a<3600?`${Math.round(a/60)}m ago`:`${Math.round(a/3600)}h ago`;console.log(` last active: ${i}`)}}}async function L(t,o,e,n={}){let r=n.attempts??30,s=n.intervalMs??500;for(let a=0;a<r;a++){let i=S(t,{commandTimeoutMs:o});try{let c=(await i.listSims()).find(e);if(c)return c}catch{}finally{i.close()}await $(s)}return null}async function ze(t,o,e,n={}){let r=n.attempts??20,s=n.intervalMs??250;for(let a=0;a<r;a++){let i=S(t,{commandTimeoutMs:o});try{let c=(await i.listSims()).find(d=>d.id===e);if(!c||c.readyState!=="open")return!0}catch{return!0}finally{i.close()}await $(s)}return!1}function je(t){let o=t.meta;if(!o||o.sootsimHostDriver!=="playwright")return null;let e=Number(o.sootsimHostPid);return!Number.isInteger(e)||e<=1||e===process.pid?null:e}function ye(t){try{return process.kill(t,0),!0}catch(o){return o?.code==="EPERM"}}async function qe(t,o=2500){let e=Date.now()+o;for(;Date.now()<e;){if(!ye(t))return!0;await $(100)}return!ye(t)}async function Q(t,o){let e=new Set(o),n=new Set;for(let r of t){if(!e.has(r.id))continue;let s=je(r);s&&n.add(s)}for(let r of n){try{process.kill(r,"SIGTERM")}catch{}if(await qe(r)){console.log(` closed playwright host process ${r}`);continue}try{process.kill(r,"SIGKILL"),console.log(` force-closed playwright host process ${r}`)}catch{}}}function N(t,o){if(o){let r=o.trim(),s=t.find(a=>a.id===r);if(!s)throw new Error(`no sim connected with id ${r}`);return s}let e=t.find(r=>r.isPrimary&&r.readyState==="open");if(e)return e;let n=t.find(r=>r.readyState==="open");if(n)return n;throw new Error("no sim connected")}function B(t,o,e){console.log(` ${e==="current sim"?"loaded":"opened"}: ${t} [${e}]`),console.log(` current sim: ${o.id}`),console.log(JSON.stringify({simId:o.id,url:o.url},null,2))}async function T(t,o,e){if(e.includes("--no-describe"))return;let n=process.env.SOOTSIM_QUIET_TARGET_NOTICE;process.env.SOOTSIM_QUIET_TARGET_NOTICE="1";try{await We(t,o,{stableMs:150,maxMs:400});let r=S(t,{commandTimeoutMs:3e3,simId:o,cliLabel:"open --describe",simIdSource:"flag"});try{let s=null;try{s=await r.send({type:"evaluate",code:se})}catch{}if(s&&!(s.flag===!0&&!s.loadingText&&s.nodes>=ie&&ae(s))){let d=s.loadingText?`still showing "${s.loadingText}"`:s.flag!==!0?"guest ready event has not fired":s.targets<=0?"no visible app content is inspectable yet":"app tree is still stabilizing";console.log(` app still loading: ${d} (nodes: ${s.nodes}, targets: ${s.targets})`),console.log(" before interacting, run: sootsim wait ready --max-ms 120000")}let i=`(async () => {
4
4
  const t = window.__sootsimTest
5
5
  const ms = window.SootSim?.bridges?.mainShell
6
6
  if (!t) return null
@@ -8,4 +8,4 @@ import{a as _,b as z,c as le,d as ce}from"./chunk-RKUDWRIN.js";import{b as E}fro
8
8
  try { shell = ms?.getState ? await ms.getState() : null } catch {}
9
9
  const tree = await t.dumpTree(12, ${JSON.stringify({describe:!0,verbose:!1,filter:""})})
10
10
  return { tree, shell }
11
- })()`,l=await r.send({type:"evaluate",code:i});if(!l?.tree)return;if(console.log(""),l.shell?.state){let c=[`state=${l.shell.state}`,l.shell.activeApp?`app=${l.shell.activeApp}`:null].filter(Boolean);console.log(` shell: ${c.join(" ")}`)}console.log(l.tree)}finally{r.close()}}catch{}finally{n===void 0?delete process.env.SOOTSIM_QUIET_TARGET_NOTICE:process.env.SOOTSIM_QUIET_TARGET_NOTICE=n}}async function je(t,o,e){let n=Date.now()+e.maxMs,r="(async () => (await window.__sootsimTest?.getNodeCount?.()) || 0)()",s=S(t,{commandTimeoutMs:2e3,simId:o,simIdSource:"flag"});try{let a=-1,i=0;for(;Date.now()<n;){let l=-1;try{let c=await s.send({type:"evaluate",code:r});typeof c=="number"&&(l=c)}catch{}if(l>=0&&l===a){if(Date.now()-i>=e.stableMs)return}else a=l,i=Date.now();await x(50)}}finally{s.close()}}async function St(t,o={}){let e=v(t,{port:o.port,commandTimeoutMs:o.timeoutMs}),n=I(e);try{let r=await n.listSims();He(r,e.simId)}finally{n.close()}}async function $t(t,o={}){let e=v(t,{port:o.port,commandTimeoutMs:o.timeoutMs,stripBooleanFlags:["--new","--headless","--ephemeral"],stripValueFlags:["--base-url","--replace","--driver","--profile"]}),n=t.find((m,u)=>t[u-1]==="--profile"),r=t.includes("--ephemeral");n&&r&&(console.error(" sootsim open: --profile cannot be combined with --ephemeral"),process.exit(1));let s=n?de(n).id:void 0,a=!!s||r,i=t.includes("--new")||a,l=De(t);i&&e.simIdSource==="flag"&&(console.error(" sootsim open: --new, --profile, and --ephemeral cannot be combined with --sim"),process.exit(1));let c=e.positional[0]||"",d=t.find((m,u)=>t[u-1]==="--driver")||"",p=t.includes("--headless"),h=t.find((m,u)=>t[u-1]==="--base-url")||be(),M=t.includes("--base-url"),Y=k();if(!d&&!i&&(e.simIdSource==="flag"||e.simIdSource==="saved"&&!!Y)){let m=I(e),u=e.simId?` --sim ${e.simId}`:"",f=!1;try{let g=null;try{let b=await m.listSims();if(e.simIdSource==="saved"?(g=b.find($=>$.id===Y&&$.readyState==="open")??null,g||P()):g=N(b,e.simId),!g)if(e.simIdSource==="saved")f=!0;else throw new Error("no sim connected");if(!f&&g){let $=M||J(c)?h:we(g,h),O=await D(c,_($,l));m.send({type:"evaluate",simId:g.id,code:`window.location.href = ${JSON.stringify(O)}`}).catch(()=>{})}}catch(b){console.error(` open failed: ${b instanceof Error?b.message:String(b)}`),await E(m,{errorsCommand:`sootsim get errors 5${u}`,warningsCommand:`sootsim get warnings 5${u}`,requestsCommand:`sootsim get requests 5${u}`}),process.exit(1)}if(!f&&g){await x(1500);let b=await Ne(e.wsPort,e.commandTimeoutMs,g.id);b||(console.error(" timed out waiting for current sim to load target"),process.exit(1)),b.bridge.close(),w(g.id);let $=M||J(c)?h:we(g,h),O=await D(c,_($,l));B(O,{...g,url:O},"current sim"),await T(e.wsPort,g.id,t);return}}finally{m.close()}}let X=_(h,l),$e=await D(c,X),Z=`cli-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,y=await Ae(c,X,Z),F={newWindow:!0},U=m=>m.url?.includes(`inspectOpen=${Z}`)??!1;if(d){let m=q(d);m||(console.error(` unknown driver "${d}" \u2014 run \`sootsim list --drivers\``),process.exit(1));let u=await m.launch({url:y,headless:p,newWindow:F.newWindow,profileId:s,ephemeralProfile:r});u.launched||(console.error(` ${m.name} driver: ${u.message}`),process.exit(1));let f=await L(e.wsPort,e.commandTimeoutMs,U,{attempts:60,intervalMs:500});if(!f){if(u.pid)try{process.kill(u.pid,"SIGTERM"),console.error(` closed ${m.name} host process ${u.pid}`)}catch{}console.error(" timed out waiting for opened sim to connect"),process.exit(1)}w(f.id),B(y,f,`${m.name} driver`),await T(e.wsPort,f.id,t);return}if(a){let m=C();m||(console.error(" profiles require electron or playwright; install the desktop companion or use `--driver playwright`"),process.exit(1));try{(await j(y,m,{profileId:s,ephemeralProfile:r})).launched||(console.error(" desktop companion failed to start"),process.exit(1))}catch(f){console.error(` desktop companion failed: ${f instanceof Error?f.message:String(f)}`),process.exit(1)}let u=await L(e.wsPort,e.commandTimeoutMs,U,{attempts:40,intervalMs:500});u||(console.error(" timed out waiting for profiled sim to connect"),process.exit(1)),w(u.id),B(y,u,"desktop companion"),await T(e.wsPort,u.id,t);return}let H=!1,K=!1;try{let m=S(e.wsPort,{commandTimeoutMs:2e3});try{await m.listSims(),H=!0}finally{m.close()}}catch{}if(H)try{let m=S(e.wsPort,{commandTimeoutMs:3e3});try{await m.openUrl(y,F),K=!0}finally{m.close()}}catch{}if(!K){let m=C();if(m)try{if((await j(y,m)).launched){let f=await L(e.wsPort,e.commandTimeoutMs,U,{attempts:20,intervalMs:500});if(f){w(f.id),B(y,f,"desktop companion"),await T(e.wsPort,f.id,t);return}}}catch{}try{await ne(y,F)}catch(u){console.error(` open failed: ${u instanceof Error?u.message:String(u)}`),q("playwright")?.availability().available?console.error(" no system browser found \u2014 retry with `sootsim open \u2026 --driver playwright` for a headless sim."):console.error(" run `sootsim list --drivers` to see available drivers."),process.exit(1)}if(!H){console.log(` opened: ${$e}`),he(e.wsPort);return}}let R=await L(e.wsPort,e.commandTimeoutMs,U,{attempts:30,intervalMs:500});R||(console.error(" timed out waiting for opened sim to connect"),process.exit(1)),w(R.id),B(y,R,K?"bridge":"direct shell open"),await T(e.wsPort,R.id,t)}async function Se(t,o={}){let e=v(t,{port:o.port,commandTimeoutMs:o.timeoutMs,stripBooleanFlags:["--force"]}),n=t.includes("--force"),r=I(e),s=e.simId?` --sim ${e.simId}`:"";try{try{let a=await r.listSims(),i=N(a,e.positional[0]||e.simId);if(i.lockedBy&&i.lockExpiresAt&&i.lockExpiresAt>Date.now()){let l=Math.max(0,Math.round((i.lockExpiresAt-Date.now())/1e3));i.lockedByKind==="user-active"&&(console.error(` refused: ${i.id} is locked by the active user (${l}s) \u2014 that's a live human tab`),console.error(" run `sootsim open --new` for a fresh investigation sim"),process.exit(1)),n||(console.error(` refused: ${i.id} is leased by ${i.lockedBy} (${l}s)`),console.error(` \`sootsim use ${i.id} --force\` to take it, or \`sootsim open --new\` for a fresh sim`),process.exit(1))}await r.focusSim(i.id),w(i.id),console.log(` using: ${i.id}`)}catch(a){console.error(` use failed: ${a instanceof Error?a.message:String(a)}`),await E(r,{errorsCommand:`sootsim get errors 5${s}`,warningsCommand:`sootsim get warnings 5${s}`,requestsCommand:`sootsim get requests 5${s}`}),process.exit(1)}}finally{r.close()}}async function vt(t,o={}){await Se(t,o)}async function It(t,o={}){await Se(t,o)}async function xt(t,o={}){let e=v(t,{port:o.port,commandTimeoutMs:o.timeoutMs,stripBooleanFlags:["--force"]}),n=t.includes("--force"),r=I(e);try{try{let s=await r.listSims(),a=N(s,e.positional[0]||e.simId),i=n&&a.lockedBy&&a.lockedByKind!=="user-active"?a.lockedBy:null,l=await r.claim(a.id,{force:n});w(a.id);let c=Math.max(0,Math.round((l.lockExpiresAt-Date.now())/1e3)),d=l.bootedCount>0?` (booted ${l.bootedCount})`:"";console.log(` claimed: ${l.simId} [${c}s]${d}`),i&&console.log(` took over from: ${i}`)}catch(s){if(s instanceof re){let a=Math.max(0,Math.round(s.lock.expiresInMs/1e3));console.error(` claim failed: locked by ${s.lock.by} for ${a}s more`),console.error(" use --force to take it, or `sootsim open --new` for a fresh sim"),process.exit(1)}console.error(` claim failed: ${s instanceof Error?s.message:String(s)}`),process.exit(1)}}finally{r.close()}}async function qe(t,o,e,n){if(n.length===0)return{closed:[],remaining:[]};await Promise.all(n.map(s=>t.closeSim(s).catch(()=>{})));let r=new Set(n);for(let s=0;s<40;s++){let a=[];try{let i=S(o,{commandTimeoutMs:e});try{a=(await i.listSims()).filter(c=>r.has(c.id)&&c.readyState==="open").map(c=>c.id)}finally{i.close()}}catch{a=[]}if(a.length===0)return{closed:[...r],remaining:[]};if(s===39)return{closed:[...r].filter(i=>!a.includes(i)),remaining:a};await x(250)}return{closed:[...r],remaining:[]}}function We(t,o){let e=t.filter(p=>p.readyState==="open"),n=e.map(p=>p.id),r=o.explicitKeepId?.trim()||"",s=o.savedKeepId?.trim()||"",a=s?e.some(p=>p.id===s):!1,i=s&&!a?s:null,l=null,c=null,d=null;if(o.closeOthers)if(r){let p=e.find(h=>h.id===r);p?l=p.id:c=r}else if(s&&a)l=s;else{let p=e.find(h=>h.isPrimary)??e[0]??null;p&&(l=p.id,s&&!a&&(d=p.id))}return{openIds:n,keepId:l,targets:c?[]:n.filter(p=>p!==l),staleSavedId:i,missingExplicitKeepId:c,fallbackKeepId:d}}async function kt(t,o={}){let e=v(t,{port:o.port,commandTimeoutMs:o.timeoutMs,stripBooleanFlags:["--all","--others"]}),n=I(e),r=e.simId?` --sim ${e.simId}`:"",s=t.includes("--all"),a=t.includes("--others");if(s||a){try{let i=await n.listSims(),l=k(),c=e.positional[0]||(e.simIdSource==="flag"?e.simId:void 0),d=We(i,{closeOthers:a,explicitKeepId:c,savedKeepId:l});if(d.staleSavedId&&P(),d.fallbackKeepId&&(w(d.fallbackKeepId),console.log(` saved sim ${d.staleSavedId} is gone \u2014 keeping primary ${d.fallbackKeepId}`)),d.missingExplicitKeepId&&(console.error(` close failed: keep sim ${d.missingExplicitKeepId} is not connected; not closing other sims`),process.exit(1)),d.targets.length===0){console.log(d.keepId?` nothing to close \u2014 only the kept sim ${d.keepId} is connected`:d.staleSavedId?` nothing to close \u2014 no sims connected (cleared stale current sim ${d.staleSavedId})`:" nothing to close \u2014 no sims connected");return}let p=await qe(n,e.wsPort,e.commandTimeoutMs,d.targets);Q(i,d.targets);let h=k();h&&p.closed.includes(h)&&(d.keepId?w(d.keepId):P());let M=` closed ${p.closed.length} sim(s)${d.keepId?` (kept ${d.keepId})`:""}`;console.log(M),p.remaining.length>0&&(console.error(` close failed: still connected: ${p.remaining.join(", ")}`),process.exit(1))}catch(i){console.error(` close failed: ${i instanceof Error?i.message:String(i)}`),process.exit(1)}finally{n.close()}return}try{try{let i=await n.listSims(),l=N(i,e.positional[0]||e.simId),c=i.find(p=>p.id!==l.id&&p.readyState==="open");await n.closeSim(l.id),await Ke(e.wsPort,e.commandTimeoutMs,l.id)||(Q(i,[l.id]),console.error(` close failed: ${l.id} is still connected`),process.exit(1)),Q(i,[l.id]),k()===l.id&&(c?w(c.id):P()),console.log(` closed: ${l.id}`)}catch(i){console.error(` close failed: ${i instanceof Error?i.message:String(i)}`),await E(n,{errorsCommand:`sootsim get errors 5${r}`,warningsCommand:`sootsim get warnings 5${r}`,requestsCommand:`sootsim get requests 5${r}`}),process.exit(1)}}finally{n.close()}}export{Ze as a,Be as b,et as c,bt as d,be as e,D as f,Ae as g,Fe as h,He as i,L as j,ze as k,St as l,$t as m,vt as n,It as o,xt as p,We as q,kt as r};
11
+ })()`,l=await r.send({type:"evaluate",code:i});if(!l?.tree)return;if(console.log(""),l.shell?.state){let c=[`state=${l.shell.state}`,l.shell.activeApp?`app=${l.shell.activeApp}`:null].filter(Boolean);console.log(` shell: ${c.join(" ")}`)}console.log(l.tree)}finally{r.close()}}catch{}finally{n===void 0?delete process.env.SOOTSIM_QUIET_TARGET_NOTICE:process.env.SOOTSIM_QUIET_TARGET_NOTICE=n}}async function We(t,o,e){let n=Date.now()+e.maxMs,r="(async () => (await window.__sootsimTest?.getNodeCount?.()) || 0)()",s=S(t,{commandTimeoutMs:2e3,simId:o,simIdSource:"flag"});try{let a=-1,i=0;for(;Date.now()<n;){let l=-1;try{let c=await s.send({type:"evaluate",code:r});typeof c=="number"&&(l=c)}catch{}if(l>=0&&l===a){if(Date.now()-i>=e.stableMs)return}else a=l,i=Date.now();await $(50)}}finally{s.close()}}async function vt(t,o={}){let e=I(t,{port:o.port,commandTimeoutMs:o.timeoutMs}),n=x(e);try{let r=await n.listSims();Ke(r,e.simId)}finally{n.close()}}async function It(t,o={}){let e=I(t,{port:o.port,commandTimeoutMs:o.timeoutMs,stripBooleanFlags:["--new","--headless","--ephemeral"],stripValueFlags:["--base-url","--replace","--driver","--profile"]}),n=t.find((m,u)=>t[u-1]==="--profile"),r=t.includes("--ephemeral");n&&r&&(console.error(" sootsim open: --profile cannot be combined with --ephemeral"),process.exit(1));let s=n?de(n).id:void 0,a=!!s||r,i=t.includes("--new")||a,l=Ae(t);i&&e.simIdSource==="flag"&&(console.error(" sootsim open: --new, --profile, and --ephemeral cannot be combined with --sim"),process.exit(1));let c=e.positional[0]||"",d=t.find((m,u)=>t[u-1]==="--driver")||"",p=t.includes("--headless"),h=t.find((m,u)=>t[u-1]==="--base-url")||Se(),M=t.includes("--base-url"),Y=P();if(!d&&!i&&(e.simIdSource==="flag"||e.simIdSource==="saved"&&!!Y)){let m=x(e),u=e.simId?` --sim ${e.simId}`:"",f=!1;try{let g=null;try{let b=await m.listSims();if(e.simIdSource==="saved"?(g=b.find(v=>v.id===Y&&v.readyState==="open")??null,g||k()):g=N(b,e.simId),!g)if(e.simIdSource==="saved")f=!0;else throw new Error("no sim connected");if(!f&&g){let v=M||J(c)?h:we(g,h),E=await D(c,_(v,l));m.send({type:"evaluate",simId:g.id,code:`window.location.href = ${JSON.stringify(E)}`}).catch(()=>{})}}catch(b){console.error(` open failed: ${b instanceof Error?b.message:String(b)}`),await O(m,{errorsCommand:`sootsim get errors 5${u}`,warningsCommand:`sootsim get warnings 5${u}`,requestsCommand:`sootsim get requests 5${u}`}),process.exit(1)}if(!f&&g){await $(1500);let b=await Fe(e.wsPort,e.commandTimeoutMs,g.id);b||(console.error(" timed out waiting for current sim to load target"),process.exit(1)),b.bridge.close(),w(g.id);let v=M||J(c)?h:we(g,h),E=await D(c,_(v,l));B(E,{...g,url:E},"current sim"),await T(e.wsPort,g.id,t);return}}finally{m.close()}}let X=_(h,l),ve=await D(c,X),Z=`cli-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,y=await Ne(c,X,Z),F={newWindow:!0},U=m=>m.url?.includes(`inspectOpen=${Z}`)??!1;if(d){let m=q(d);m||(console.error(` unknown driver "${d}" \u2014 run \`sootsim list --drivers\``),process.exit(1));let u=await m.launch({url:y,headless:p,newWindow:F.newWindow,profileId:s,ephemeralProfile:r});u.launched||(console.error(` ${m.name} driver: ${u.message}`),process.exit(1));let f=await L(e.wsPort,e.commandTimeoutMs,U,{attempts:60,intervalMs:500});if(!f){if(u.pid)try{process.kill(u.pid,"SIGTERM"),console.error(` closed ${m.name} host process ${u.pid}`)}catch{}console.error(" timed out waiting for opened sim to connect"),process.exit(1)}w(f.id),B(y,f,`${m.name} driver`),await T(e.wsPort,f.id,t);return}if(a){let m=C();m||(console.error(" profiles require electron or playwright; install the desktop companion or use `--driver playwright`"),process.exit(1));try{(await j(y,m,{profileId:s,ephemeralProfile:r})).launched||(console.error(" desktop companion failed to start"),process.exit(1))}catch(f){console.error(` desktop companion failed: ${f instanceof Error?f.message:String(f)}`),process.exit(1)}let u=await L(e.wsPort,e.commandTimeoutMs,U,{attempts:40,intervalMs:500});u||(console.error(" timed out waiting for profiled sim to connect"),process.exit(1)),w(u.id),B(y,u,"desktop companion"),await T(e.wsPort,u.id,t);return}let H=!1,K=!1;try{let m=S(e.wsPort,{commandTimeoutMs:2e3});try{await m.listSims(),H=!0}finally{m.close()}}catch{}if(H)try{let m=S(e.wsPort,{commandTimeoutMs:3e3});try{await m.openUrl(y,F),K=!0}finally{m.close()}}catch{}if(!K){let m=C();if(m)try{if((await j(y,m)).launched){let f=await L(e.wsPort,e.commandTimeoutMs,U,{attempts:20,intervalMs:500});if(f){w(f.id),B(y,f,"desktop companion"),await T(e.wsPort,f.id,t);return}}}catch{}try{await ne(y,F)}catch(u){console.error(` open failed: ${u instanceof Error?u.message:String(u)}`),q("playwright")?.availability().available?console.error(" no system browser found \u2014 retry with `sootsim open \u2026 --driver playwright` for a headless sim."):console.error(" run `sootsim list --drivers` to see available drivers."),process.exit(1)}if(!H){console.log(` opened: ${ve}`),he(e.wsPort);return}}let R=await L(e.wsPort,e.commandTimeoutMs,U,{attempts:30,intervalMs:500});R||(console.error(" timed out waiting for opened sim to connect"),process.exit(1)),w(R.id),B(y,R,K?"bridge":"direct shell open"),await T(e.wsPort,R.id,t)}async function $e(t,o={}){let e=I(t,{port:o.port,commandTimeoutMs:o.timeoutMs,stripBooleanFlags:["--force"]}),n=t.includes("--force"),r=x(e),s=e.simId?` --sim ${e.simId}`:"";try{try{let a=await r.listSims(),i=N(a,e.positional[0]||e.simId);if(i.lockedBy&&i.lockExpiresAt&&i.lockExpiresAt>Date.now()){let l=Math.max(0,Math.round((i.lockExpiresAt-Date.now())/1e3));i.lockedByKind==="user-active"&&(console.error(` refused: ${i.id} is locked by the active user (${l}s) \u2014 that's a live human tab`),console.error(" run `sootsim open --new` for a fresh investigation sim"),process.exit(1)),n||(console.error(` refused: ${i.id} is leased by ${i.lockedBy} (${l}s)`),console.error(` \`sootsim use ${i.id} --force\` to take it, or \`sootsim open --new\` for a fresh sim`),process.exit(1))}await r.focusSim(i.id),w(i.id),console.log(` using: ${i.id}`)}catch(a){console.error(` use failed: ${a instanceof Error?a.message:String(a)}`),await O(r,{errorsCommand:`sootsim get errors 5${s}`,warningsCommand:`sootsim get warnings 5${s}`,requestsCommand:`sootsim get requests 5${s}`}),process.exit(1)}}finally{r.close()}}async function xt(t,o={}){await $e(t,o)}async function Pt(t,o={}){await $e(t,o)}async function kt(t,o={}){let e=I(t,{port:o.port,commandTimeoutMs:o.timeoutMs,stripBooleanFlags:["--force"]}),n=t.includes("--force"),r=x(e);try{try{let s=await r.listSims(),a=N(s,e.positional[0]||e.simId),i=n&&a.lockedBy&&a.lockedByKind!=="user-active"?a.lockedBy:null,l=await r.claim(a.id,{force:n});w(a.id);let c=Math.max(0,Math.round((l.lockExpiresAt-Date.now())/1e3)),d=l.bootedCount>0?` (booted ${l.bootedCount})`:"";console.log(` claimed: ${l.simId} [${c}s]${d}`),i&&console.log(` took over from: ${i}`)}catch(s){if(s instanceof re){let a=Math.max(0,Math.round(s.lock.expiresInMs/1e3));console.error(` claim failed: locked by ${s.lock.by} for ${a}s more`),console.error(" use --force to take it, or `sootsim open --new` for a fresh sim"),process.exit(1)}console.error(` claim failed: ${s instanceof Error?s.message:String(s)}`),process.exit(1)}}finally{r.close()}}async function Ge(t,o,e,n){if(n.length===0)return{closed:[],remaining:[]};await Promise.all(n.map(s=>t.closeSim(s).catch(()=>{})));let r=new Set(n);for(let s=0;s<40;s++){let a=[];try{let i=S(o,{commandTimeoutMs:e});try{a=(await i.listSims()).filter(c=>r.has(c.id)&&c.readyState==="open").map(c=>c.id)}finally{i.close()}}catch{a=[]}if(a.length===0)return{closed:[...r],remaining:[]};if(s===39)return{closed:[...r].filter(i=>!a.includes(i)),remaining:a};await $(250)}return{closed:[...r],remaining:[]}}function Qe(t,o){let e=t.filter(p=>p.readyState==="open"),n=e.map(p=>p.id),r=o.explicitKeepId?.trim()||"",s=o.savedKeepId?.trim()||"",a=s?e.some(p=>p.id===s):!1,i=s&&!a?s:null,l=null,c=null,d=null;if(o.closeOthers)if(r){let p=e.find(h=>h.id===r);p?l=p.id:c=r}else if(s&&a)l=s;else{let p=e.find(h=>h.isPrimary)??e[0]??null;p&&(l=p.id,s&&!a&&(d=p.id))}return{openIds:n,keepId:l,targets:c?[]:n.filter(p=>p!==l),staleSavedId:i,missingExplicitKeepId:c,fallbackKeepId:d}}async function Ct(t,o={}){let e=I(t,{port:o.port,commandTimeoutMs:o.timeoutMs,stripBooleanFlags:["--all","--others"]}),n=x(e),r=e.simId?` --sim ${e.simId}`:"",s=t.includes("--all"),a=t.includes("--others");if(s||a){try{let i=await n.listSims(),l=P(),c=e.positional[0]||(e.simIdSource==="flag"?e.simId:void 0),d=Qe(i,{closeOthers:a,explicitKeepId:c,savedKeepId:l});if(d.staleSavedId&&k(),d.fallbackKeepId&&(w(d.fallbackKeepId),console.log(` saved sim ${d.staleSavedId} is gone \u2014 keeping primary ${d.fallbackKeepId}`)),d.missingExplicitKeepId&&(console.error(` close failed: keep sim ${d.missingExplicitKeepId} is not connected; not closing other sims`),process.exit(1)),d.targets.length===0){console.log(d.keepId?` nothing to close \u2014 only the kept sim ${d.keepId} is connected`:d.staleSavedId?` nothing to close \u2014 no sims connected (cleared stale current sim ${d.staleSavedId})`:" nothing to close \u2014 no sims connected");return}let p=await Ge(n,e.wsPort,e.commandTimeoutMs,d.targets);await Q(i,d.targets);let h=P();h&&p.closed.includes(h)&&(d.keepId?w(d.keepId):k());let M=` closed ${p.closed.length} sim(s)${d.keepId?` (kept ${d.keepId})`:""}`;console.log(M),p.remaining.length>0&&(console.error(` close failed: still connected: ${p.remaining.join(", ")}`),process.exit(1))}catch(i){console.error(` close failed: ${i instanceof Error?i.message:String(i)}`),process.exit(1)}finally{n.close()}return}try{try{let i=await n.listSims(),l=N(i,e.positional[0]||e.simId),c=i.find(p=>p.id!==l.id&&p.readyState==="open");await n.closeSim(l.id),await ze(e.wsPort,e.commandTimeoutMs,l.id)||(await Q(i,[l.id]),console.error(` close failed: ${l.id} is still connected`),process.exit(1)),await Q(i,[l.id]),P()===l.id&&(c?w(c.id):k()),console.log(` closed: ${l.id}`)}catch(i){console.error(` close failed: ${i instanceof Error?i.message:String(i)}`),await O(n,{errorsCommand:`sootsim get errors 5${r}`,warningsCommand:`sootsim get warnings 5${r}`,requestsCommand:`sootsim get requests 5${r}`}),process.exit(1)}}finally{n.close()}}export{tt as a,Te as b,ot as c,$t as d,Se as e,D as f,Ne as g,He as h,Ke as i,L as j,je as k,vt as l,It as m,xt as n,Pt as o,kt as p,Qe as q,Ct as r};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.64 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import{createInterface as i}from"readline";var c=()=>i({input:process.stdin,output:process.stdout});function s(o){return new Promise(n=>{let r=c();r.question(o,t=>{r.close(),n(t.trim())})})}async function u(o,n=!0){let r=n?"[Y/n]":"[y/N]";if(!process.stdin.isTTY)return console.log(` ${o} ${r} ${n?"y":"n"} (non-interactive)`),n;let t=await s(` ${o} ${r} `);return t===""?n:t.toLowerCase().startsWith("y")}async function a(o,n){console.log(`
3
3
  ${o}
4
4
  `);for(let e=0;e<n.length;e++)console.log(` ${e+1}. ${n[e]}`);if(console.log(),!process.stdin.isTTY)return console.log(` choose [1-${n.length}]: 1 (non-interactive)`),0;let r=await s(` choose [1-${n.length}]: `),t=parseInt(r,10);return t>=1&&t<=n.length?t-1:0}export{u as a,a as b};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.64 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import{execFileSync as h,spawn as g}from"child_process";import{existsSync as s,readdirSync as k}from"fs";import{dirname as m,join as l,resolve as a}from"path";import{fileURLToPath as v}from"url";var c;function p(){if(c!==void 0)return c;try{c=m(v(import.meta.resolve("sootsim-engine/package.json")))}catch{c=null}return c}var I="dev.sootsim.simulator";function x(){let n=p();if(!n)return null;let e=l(n,"dist-electron/main.cjs");if(!s(e))return null;let i=D(n);return i?{path:i,platform:process.platform,kind:"dev-electron",engineDir:n}:null}function b(){let n=p();return n?s(l(n,"src-electron/main.ts")):!1}function D(n){let e=n;for(let i=0;i<6;i++){let t=l(e,"node_modules/.bin/electron");if(s(t))return t;let r=m(e);if(r===e)break;e=r}return null}function C(){let n=p(),i=["/Applications/sootsim.app",a(process.env.HOME||"","Applications/sootsim.app"),...n?[a(n,"app/sootsim.app")]:[]].find(t=>s(t));if(i)return{path:i,platform:"darwin",kind:"mac-app"};try{let t=h("mdfind",[`kMDItemCFBundleIdentifier == "${I}"`],{encoding:"utf8",timeout:3e3}).trim();if(t)return{path:t.split(`
3
3
  `)[0],platform:"darwin",kind:"mac-app"}}catch{}return null}function f(n){if(!s(n))return null;let e=k(n).filter(i=>i.startsWith("sootsim")&&i.endsWith(".AppImage")).sort().reverse()[0];return e?l(n,e):null}function w(){let n=p(),i=[a(process.env.HOME||"","Applications/sootsim.AppImage"),a(process.env.HOME||"",".local/bin/sootsim.AppImage"),"/opt/sootsim/sootsim.AppImage","/opt/sootsim/sootsim",...n?[a(n,"app/sootsim.AppImage"),a(n,"release/linux-unpacked/sootsim")]:[]].find(r=>s(r));if(i)return{path:i,platform:"linux",kind:i.endsWith(".AppImage")?"linux-appimage":"linux-binary"};let t=n?f(a(n,"app"))||f(a(n,"release")):null;return t?{path:t,platform:"linux",kind:"linux-appimage"}:null}function A(){let n=x();if(n)return n;if(b()){let e=p(),i=l(e,"dist-electron/main.cjs");return s(i)?console.error(` no node_modules/.bin/electron found near ${e}. run \`bun install\`.`):console.error(` dist-electron/main.cjs missing in ${e}.
4
4
  run: bun run --cwd packages/sootsim-engine build:electron-main