sootsim 0.1.169 → 0.1.170

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 (184) hide show
  1. package/README.md +66 -63
  2. package/detox/index.ts +3 -3
  3. package/dist-cli/bin.js +3 -3
  4. package/dist-cli/chunks/agent-3C2BKQKX.js +46 -0
  5. package/dist-cli/chunks/{agent-wrapper-Y5FQA3RL.js → agent-wrapper-OIKCYOXZ.js} +2 -2
  6. package/dist-cli/chunks/{app-fonts-FYVA4XV6.js → app-fonts-25O32NAP.js} +2 -2
  7. package/dist-cli/chunks/{assert-U64QBDM2.js → assert-ONEP4NQU.js} +2 -2
  8. package/dist-cli/chunks/beta-4E5USTEI.js +2 -0
  9. package/dist-cli/chunks/{camera-3GXBVIAM.js → camera-RORW4MAA.js} +2 -2
  10. package/dist-cli/chunks/{chunk-5C6BR24W.js → chunk-25RFZ6WP.js} +6 -6
  11. package/dist-cli/chunks/chunk-35GMFXVJ.js +2 -0
  12. package/dist-cli/chunks/{chunk-GLRFKYDV.js → chunk-3TM7DHWE.js} +2 -2
  13. package/dist-cli/chunks/{chunk-4F3BBP7B.js → chunk-4XVY5TUF.js} +2 -2
  14. package/dist-cli/chunks/{chunk-LZEL2RU3.js → chunk-5ZHUPPS5.js} +1 -1
  15. package/dist-cli/chunks/{chunk-GC4THE6K.js → chunk-6FAEORJ2.js} +2 -2
  16. package/dist-cli/chunks/{chunk-G2ZFDIPK.js → chunk-6TSXXN2W.js} +4 -4
  17. package/dist-cli/chunks/chunk-AJF3QF4K.js +1 -0
  18. package/dist-cli/chunks/{chunk-FIDPRJYH.js → chunk-AUCNBB6Q.js} +2 -2
  19. package/dist-cli/chunks/{chunk-SIB6I72P.js → chunk-BP3EGFER.js} +2 -2
  20. package/dist-cli/chunks/{chunk-OGLWXPVG.js → chunk-DAXME77O.js} +3 -3
  21. package/dist-cli/chunks/chunk-DGJTEFE7.js +13 -0
  22. package/dist-cli/chunks/chunk-DIRDEKRW.js +23 -0
  23. package/dist-cli/chunks/{chunk-3L4NRJ6C.js → chunk-DKTC53HV.js} +1 -1
  24. package/dist-cli/chunks/{chunk-KUUFY6FC.js → chunk-DWXC25XG.js} +1 -1
  25. package/dist-cli/chunks/{chunk-CR6DOLUD.js → chunk-E3FKMY5E.js} +1 -1
  26. package/dist-cli/chunks/chunk-ER4GBJRY.js +2 -0
  27. package/dist-cli/chunks/chunk-EX6V4ZV6.js +6 -0
  28. package/dist-cli/chunks/{chunk-VMYMPL6H.js → chunk-GQH3PD3W.js} +5 -5
  29. package/dist-cli/chunks/{chunk-MVOHANJG.js → chunk-GST4YSBO.js} +4 -4
  30. package/dist-cli/chunks/{chunk-BIWJE7CB.js → chunk-I4RV5I6V.js} +1 -1
  31. package/dist-cli/chunks/{chunk-Y6IDAARY.js → chunk-I5WXVKR6.js} +1 -1
  32. package/dist-cli/chunks/{chunk-HC72ILJK.js → chunk-IO7KAVFK.js} +2 -2
  33. package/dist-cli/chunks/{chunk-XEH4QGWB.js → chunk-LMX7UB5T.js} +2 -2
  34. package/dist-cli/chunks/{chunk-YADWU7OZ.js → chunk-N4YCSOCR.js} +2 -2
  35. package/dist-cli/chunks/{chunk-IODOTOOP.js → chunk-NI3L4A65.js} +2 -2
  36. package/dist-cli/chunks/{chunk-IACEJQIO.js → chunk-ODGEH6OW.js} +2 -2
  37. package/dist-cli/chunks/{chunk-DNA6VS6M.js → chunk-Q4NDYO2U.js} +1 -1
  38. package/dist-cli/chunks/{chunk-PV6MBKKE.js → chunk-QPRF3UYX.js} +2 -2
  39. package/dist-cli/chunks/{chunk-M2TMFGZH.js → chunk-QXJMXSQP.js} +1 -1
  40. package/dist-cli/chunks/chunk-RLKSLUNR.js +2 -0
  41. package/dist-cli/chunks/{chunk-WZG3YVJR.js → chunk-S244IT4W.js} +1 -1
  42. package/dist-cli/chunks/chunk-SDHOM6ZG.js +62 -0
  43. package/dist-cli/chunks/{chunk-B7BMSU7H.js → chunk-TXKOJ3P5.js} +1 -1
  44. package/dist-cli/chunks/{chunk-IBEMMV5E.js → chunk-UDMJSFSH.js} +8 -8
  45. package/dist-cli/chunks/{chunk-DQZEN256.js → chunk-ULV4PWN4.js} +1 -1
  46. package/dist-cli/chunks/{chunk-2TYEWVS4.js → chunk-V4HTQPMA.js} +1 -1
  47. package/dist-cli/chunks/chunk-VATHADSI.js +2 -0
  48. package/dist-cli/chunks/{chunk-5Q7IHJ7K.js → chunk-VUOCUCJ2.js} +2 -2
  49. package/dist-cli/chunks/{chunk-JDGLBW64.js → chunk-WN7R4GL4.js} +1 -1
  50. package/dist-cli/chunks/chunk-XOTJD6PU.js +118 -0
  51. package/dist-cli/chunks/chunk-XUNPVF5K.js +1 -0
  52. package/dist-cli/chunks/{chunk-KZIXAYN5.js → chunk-YMFSRCHL.js} +4 -4
  53. package/dist-cli/chunks/{chunk-X2HNVXNM.js → chunk-YV74D4MG.js} +2 -2
  54. package/dist-cli/chunks/{chunk-SNX3M4XD.js → chunk-YVTWSC5Y.js} +3 -3
  55. package/dist-cli/chunks/cli-version-EKKWCHRX.js +2 -0
  56. package/dist-cli/chunks/{compat-ORRWNXVT.js → compat-ZVZM5TML.js} +3 -3
  57. package/dist-cli/chunks/control-TWINYHMY.js +2 -0
  58. package/dist-cli/chunks/{cpu-profile-6PRSBZ2F.js → cpu-profile-RWGQTWLP.js} +2 -2
  59. package/dist-cli/chunks/daemon-AOSMNBD4.js +2 -0
  60. package/dist-cli/chunks/{debug-Q3J2X4WW.js → debug-R7PL3MHF.js} +5 -5
  61. package/dist-cli/chunks/{detox-DN57GMMJ.js → detox-UIJMKIGQ.js} +2 -2
  62. package/dist-cli/chunks/{device-IL5TPYGU.js → device-7SRVX2PU.js} +2 -2
  63. package/dist-cli/chunks/{diagnose-BW6QWP4F.js → diagnose-OXAKLLZT.js} +2 -2
  64. package/dist-cli/chunks/drivers-BPPG22VP.js +2 -0
  65. package/dist-cli/chunks/{electron-DGMSXQWG.js → electron-CTCH4VOL.js} +3 -3
  66. package/dist-cli/chunks/flow-KA2WCWDL.js +2 -0
  67. package/dist-cli/chunks/help-XBQIK2XY.js +2 -0
  68. package/dist-cli/chunks/{hints-TK3EHB4U.js → hints-P3ZIAP3Z.js} +2 -2
  69. package/dist-cli/chunks/home-paths-ZSCTLOYE.js +2 -0
  70. package/dist-cli/chunks/{inspect-NFWFGU4B.js → inspect-2ABU5WET.js} +24 -24
  71. package/dist-cli/chunks/{install-desktop-GB3JKSNX.js → install-desktop-4NOQ3YY4.js} +3 -3
  72. package/dist-cli/chunks/{keys-RAAHRIFH.js → keys-RPVEUNUC.js} +2 -2
  73. package/dist-cli/chunks/{login-KQ37GHDE.js → login-6D6DXBO3.js} +4 -4
  74. package/dist-cli/chunks/{logout-63SH2Y25.js → logout-T5OSWDTJ.js} +2 -2
  75. package/dist-cli/chunks/{maestro-24BT3MML.js → maestro-MKCHEOKA.js} +2 -2
  76. package/dist-cli/chunks/optional-demo-registry-EYD2K3QH.js +2 -0
  77. package/dist-cli/chunks/{preview-KQAOVN6R.js → preview-S52ZNGN2.js} +2 -2
  78. package/dist-cli/chunks/{profile-AN2B4NJT.js → profile-IG5F3LTL.js} +2 -2
  79. package/dist-cli/chunks/{react-ATGV35B4.js → react-275HCOFC.js} +2 -2
  80. package/dist-cli/chunks/{record-36662T3R.js → record-YT63SUHO.js} +4 -4
  81. package/dist-cli/chunks/runtime-WYZMDZAK.js +2 -0
  82. package/dist-cli/chunks/{screenshot-K4N5MPAT.js → screenshot-5AZ4MY3A.js} +4 -4
  83. package/dist-cli/chunks/{screenshot-mode-4QOJDLSH.js → screenshot-mode-4S4EX2XJ.js} +2 -2
  84. package/dist-cli/chunks/{screenshots-TB35YMSR.js → screenshots-UUJNZSG7.js} +2 -2
  85. package/dist-cli/chunks/{screenshots-capture-W6X33BZ4.js → screenshots-capture-I66JD3AD.js} +2 -2
  86. package/dist-cli/chunks/{server-L2PKDJZ2.js → serve-O46Q4WAD.js} +18 -17
  87. package/dist-cli/chunks/setup-C44N54O7.js +77 -0
  88. package/dist-cli/chunks/skills-PPVS4XOQ.js +40 -0
  89. package/dist-cli/chunks/{slides-TORKO36P.js → slides-ZWSZJZUY.js} +2 -2
  90. package/dist-cli/chunks/store-3SLGP5O3.js +2 -0
  91. package/dist-cli/chunks/telemetry-2XLLWARK.js +2 -0
  92. package/dist-cli/chunks/{test-5VCENVW3.js → test-362G4M5A.js} +3 -3
  93. package/dist-cli/chunks/{three-mode-ZVS2DSX6.js → three-mode-JNVTM2UT.js} +2 -2
  94. package/dist-cli/chunks/{timeline-TNC5OWLF.js → timeline-VKC6ULRK.js} +2 -2
  95. package/dist-cli/chunks/{upgrade-E7IO6A7Z.js → upgrade-SJPX4SPA.js} +2 -2
  96. package/dist-cli/chunks/upload-MXOBV6RT.js +2 -0
  97. package/dist-cli/chunks/version-4Z7AFNH3.js +4 -0
  98. package/dist-cli/chunks/web-WB2I2AWL.js +2 -0
  99. package/dist-cli/chunks/{what-happened-RMHZ7DGX.js → what-happened-KQCWMQJT.js} +3 -3
  100. package/dist-cli/chunks/{whoami-D53ANHR5.js → whoami-K76PXAD4.js} +2 -2
  101. package/dist-lib/agent-daemon-client.cjs +4 -5
  102. package/dist-lib/agent-events.cjs +1 -1
  103. package/dist-lib/agent-sessions.cjs +1 -1
  104. package/dist-lib/attached-projects.cjs +1 -1
  105. package/dist-lib/auth/shared-session.cjs +1 -1
  106. package/dist-lib/backend-origin.cjs +1 -1
  107. package/dist-lib/beta.cjs +3 -6
  108. package/dist-lib/beta.mjs +3 -5
  109. package/dist-lib/bridge-constants.cjs +1 -1
  110. package/dist-lib/cli-constants.cjs +1 -1
  111. package/dist-lib/config.cjs +1 -1
  112. package/dist-lib/detox/index.cjs +4 -4
  113. package/dist-lib/dev-bundle-resolution.cjs +2 -9
  114. package/dist-lib/home-paths.cjs +59 -1
  115. package/dist-lib/host/bridge-host.cjs +67 -5
  116. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  117. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  118. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  119. package/dist-lib/host/websocket-proxy.cjs +1 -1
  120. package/dist-lib/index.cjs +2 -2
  121. package/dist-lib/menu.cjs +1 -1
  122. package/dist-lib/menu.mjs +1 -1
  123. package/dist-lib/metro.cjs +2 -2
  124. package/dist-lib/profiles.cjs +1 -1
  125. package/dist-lib/render-mode.cjs +1 -1
  126. package/dist-lib/scripts/dev-server-scanner.cjs +5 -4
  127. package/dist-lib/sdk.cjs +1 -1
  128. package/dist-lib/sdk.mjs +1 -1
  129. package/dist-lib/skills.cjs +124 -8
  130. package/dist-lib/vite.cjs +2 -2
  131. package/package.json +2 -1
  132. package/scripts/dev-server-scanner.ts +3 -4
  133. package/scripts/postinstall.cjs +2 -2
  134. package/scripts/preuninstall.cjs +5 -7
  135. package/skills/soot.md +178 -0
  136. package/skills/sootsim-debug.md +384 -0
  137. package/skills/sootsim-setup.md +96 -0
  138. package/skills/sootsim-test.md +292 -0
  139. package/skills/sootsim-visual.md +122 -0
  140. package/src/agent-daemon-client.ts +4 -14
  141. package/src/beta.ts +3 -5
  142. package/src/dev-bundle-resolution.ts +1 -14
  143. package/src/home-paths.ts +77 -2
  144. package/src/host/agent-host.ts +1 -1
  145. package/src/host/bridge-host.ts +65 -6
  146. package/src/metro-plugin.ts +1 -1
  147. package/src/runtime-assets.ts +1 -1
  148. package/src/vite-plugin.ts +1 -0
  149. package/dist-cli/chunks/agent-V3GVCRPL.js +0 -46
  150. package/dist-cli/chunks/auto-bootstrap-YXDP3WKH.js +0 -2
  151. package/dist-cli/chunks/beta-FGSMZWLP.js +0 -2
  152. package/dist-cli/chunks/chunk-2IFWVIKM.js +0 -2
  153. package/dist-cli/chunks/chunk-3T36XLP3.js +0 -119
  154. package/dist-cli/chunks/chunk-5KY7TQ42.js +0 -5
  155. package/dist-cli/chunks/chunk-BQOMDL4K.js +0 -1
  156. package/dist-cli/chunks/chunk-FHMPJZKM.js +0 -7
  157. package/dist-cli/chunks/chunk-GQAWFQNN.js +0 -23
  158. package/dist-cli/chunks/chunk-HJTKKF7M.js +0 -13
  159. package/dist-cli/chunks/chunk-K4JAWKOY.js +0 -1
  160. package/dist-cli/chunks/chunk-NXGQS7IR.js +0 -2
  161. package/dist-cli/chunks/chunk-R2INPDGW.js +0 -1
  162. package/dist-cli/chunks/chunk-SLL5SZN4.js +0 -2
  163. package/dist-cli/chunks/chunk-XM66K64H.js +0 -79
  164. package/dist-cli/chunks/cli-version-3L6FFDIX.js +0 -2
  165. package/dist-cli/chunks/config-5IB6ONJ2.js +0 -45
  166. package/dist-cli/chunks/control-BM4V27OB.js +0 -2
  167. package/dist-cli/chunks/daemon-62MZT4G4.js +0 -67
  168. package/dist-cli/chunks/drivers-V6QDFZQD.js +0 -2
  169. package/dist-cli/chunks/flow-VBM6TU32.js +0 -2
  170. package/dist-cli/chunks/help-XWKNL743.js +0 -2
  171. package/dist-cli/chunks/home-paths-G23H3RO6.js +0 -2
  172. package/dist-cli/chunks/install-5YL7FITA.js +0 -2
  173. package/dist-cli/chunks/launch-DYFE4CAD.js +0 -16
  174. package/dist-cli/chunks/optional-demo-registry-JJXPB3UD.js +0 -2
  175. package/dist-cli/chunks/runtime-NRMC3U3D.js +0 -2
  176. package/dist-cli/chunks/runtime-delivery-RO6CTYPQ.js +0 -2
  177. package/dist-cli/chunks/setup-repo-AK6QOUE7.js +0 -2
  178. package/dist-cli/chunks/skills-KDSOWUOE.js +0 -10
  179. package/dist-cli/chunks/start-GH2AOUX6.js +0 -23
  180. package/dist-cli/chunks/store-JHW65VGQ.js +0 -2
  181. package/dist-cli/chunks/telemetry-SZLRXJXW.js +0 -2
  182. package/dist-cli/chunks/upload-KKEWETA5.js +0 -2
  183. package/dist-cli/chunks/version-37OD33SE.js +0 -4
  184. package/dist-cli/chunks/web-4JVMIBTB.js +0 -2
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.169 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{f,m as T}from"./chunk-KZIXAYN5.js";import{J as A,K as D,L as O,M as x,N as v}from"./chunk-DNA6VS6M.js";import{c as S,e as $,g as N}from"./chunk-GQAWFQNN.js";import"./chunk-DQZEN256.js";import"./chunk-KUUFY6FC.js";import"./chunk-5KY7TQ42.js";import"./chunk-JDGLBW64.js";var H=["portals","sheets","layout","onlayout","animated","render","touch","yoga","all"],R="__sootsimShellAnimationTrace",q="__sootsimDebugAnimation";function L(){console.log(`
1
+ /*! sootsim v0.1.170 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{f,m as T}from"./chunk-YMFSRCHL.js";import{J as S,K as $,L as N,M as A,N as v}from"./chunk-Q4NDYO2U.js";import{c as D,e as O,g as x}from"./chunk-DIRDEKRW.js";import"./chunk-ULV4PWN4.js";import"./chunk-DWXC25XG.js";import"./chunk-EX6V4ZV6.js";import"./chunk-WN7R4GL4.js";var H=["portals","sheets","layout","onlayout","animated","render","touch","yoga","all"],R="__sootsimShellAnimationTrace",q="__sootsimDebugAnimation";function L(){console.log(`
3
3
  sootsim debug \u2014 drive __sootsimDebug from the terminal
4
4
 
5
5
  usage:
@@ -167,8 +167,8 @@ examples:
167
167
  } : null,
168
168
  samples,
169
169
  }
170
- })()`}async function c(i,l){return N(i,l)}async function Y(i,l){let g=S(i,{port:l.port,stripBooleanFlags:["--pretty","--json","--help","-h"]}),u=g.positional;(!u[0]||i.includes("--help")||i.includes("-h"))&&(L(),process.exit(0));let P=g.wsPort,_=g.simId,n=!i.includes("--json"),y=_?` --sim ${_}`:"",k=u[0],r=u.slice(1);if(new Set(["state","js","eval","perf","sample-color"]).has(k)){let{runInspect:e}=await import("./inspect-NFWFGU4B.js");await e(["debug",...i],{port:l.port,verbose:l.verbose});return}let t=$(g);try{switch(k){case"enable":{let e=B(r[0]);e.length===0&&(console.error(` usage: sootsim debug enable <channel[,channel,...]>
171
- known: ${H.join(", ")}`),process.exit(1));let o=await v(t,"enable",e);console.log(a({active:o},n));break}case"disable":{let e=B(r[0]),o=await v(t,"disable",e);console.log(a({active:o},n));break}case"toggle":{let e=r[0];e||(console.error(" usage: sootsim debug toggle <channel>"),process.exit(1));let o=await c(t,`window.__sootsimDebug.toggle(${JSON.stringify(e)})`);console.log(a({[e]:o},n));break}case"status":{let e=await A(t);console.log(a(e,n));break}case"channels":{let e=await c(t,"window.__sootsimDebug.channels()");console.log(a(e,n));break}case"flags":{let e=await D(t);console.log(a(e,n));break}case"snapshot":{let e=r[0],o=e?`window.__sootsimDebug.snapshot(${JSON.stringify(e)})`:"window.__sootsimDebug.snapshot()",s=await c(t,`(() => { const s = ${o}; if (!s) return null; return { label: s.label, at: s.at, size: s.nodes.size }; })()`);console.log(a(s,n));break}case"snapshots":{let e=await c(t,"window.__sootsimDebug.snapshots()");console.log(a(e,n));break}case"diff":{let e=r[0],o=r[1];(!e||!o)&&(console.error(" usage: sootsim debug diff <labelA> <labelB>"),process.exit(1));let s=`(() => {
170
+ })()`}async function c(i,l){return x(i,l)}async function Y(i,l){let g=D(i,{port:l.port,stripBooleanFlags:["--pretty","--json","--help","-h"]}),u=g.positional;(!u[0]||i.includes("--help")||i.includes("-h"))&&(L(),process.exit(0));let P=g.wsPort,_=g.simId,n=!i.includes("--json"),y=_?` --sim ${_}`:"",k=u[0],r=u.slice(1);if(new Set(["state","js","eval","perf","sample-color"]).has(k)){let{runInspect:e}=await import("./inspect-2ABU5WET.js");await e(["debug",...i],{port:l.port,verbose:l.verbose});return}let t=O(g);try{switch(k){case"enable":{let e=B(r[0]);e.length===0&&(console.error(` usage: sootsim debug enable <channel[,channel,...]>
171
+ known: ${H.join(", ")}`),process.exit(1));let o=await v(t,"enable",e);console.log(a({active:o},n));break}case"disable":{let e=B(r[0]),o=await v(t,"disable",e);console.log(a({active:o},n));break}case"toggle":{let e=r[0];e||(console.error(" usage: sootsim debug toggle <channel>"),process.exit(1));let o=await c(t,`window.__sootsimDebug.toggle(${JSON.stringify(e)})`);console.log(a({[e]:o},n));break}case"status":{let e=await S(t);console.log(a(e,n));break}case"channels":{let e=await c(t,"window.__sootsimDebug.channels()");console.log(a(e,n));break}case"flags":{let e=await $(t);console.log(a(e,n));break}case"snapshot":{let e=r[0],o=e?`window.__sootsimDebug.snapshot(${JSON.stringify(e)})`:"window.__sootsimDebug.snapshot()",s=await c(t,`(() => { const s = ${o}; if (!s) return null; return { label: s.label, at: s.at, size: s.nodes.size }; })()`);console.log(a(s,n));break}case"snapshots":{let e=await c(t,"window.__sootsimDebug.snapshots()");console.log(a(e,n));break}case"diff":{let e=r[0],o=r[1];(!e||!o)&&(console.error(" usage: sootsim debug diff <labelA> <labelB>"),process.exit(1));let s=`(() => {
172
172
  const d = window.__sootsimDebug.diff(${JSON.stringify(e)}, ${JSON.stringify(o)});
173
173
  if (!d) return null;
174
174
  return {
@@ -179,4 +179,4 @@ examples:
179
179
  removed: d.removed,
180
180
  changed: d.changed,
181
181
  };
182
- })()`,m=await c(t,s);console.log(a(m,n));break}case"clear-snapshots":{let e=r[0],o=e?`window.__sootsimDebug.clearSnapshots(${JSON.stringify(e)})`:"window.__sootsimDebug.clearSnapshots()";await c(t,o),console.log(a({cleared:e||"all"},n));break}case"find":{let e=r[0];if(e==="sheets"||e==="portals"){let o=await O(t,e);console.log(a(o,n))}else console.error(" usage: sootsim debug find <sheets|portals>"),process.exit(1);break}case"trace":{let e=r[0],o=r[1];if(e==="anim"){let s=r[1];if((!s||s==="--help"||s==="-h")&&(console.error(" usage: sootsim debug trace anim <on|off|status|clear|<id>> [id|limit]"),process.exit(1)),s==="on"){let d=r[2]??"all",p=r[3]?Number(r[3]):void 0,h=d==="all"?"all":Number(d);h!=="all"&&!Number.isFinite(h)&&(console.error(` invalid target: ${d}`),process.exit(1)),await f(t,"enableAnimationTrace",h,p);let F=await f(t,"listAnimationTraces");console.log(a({enabled:h,traces:F},n));break}if(s==="off"){let d=r[2]??"all",p=d==="all"?"all":Number(d);p!=="all"&&!Number.isFinite(p)&&(console.error(` invalid target: ${d}`),process.exit(1)),await f(t,"disableAnimationTrace",p),console.log(a({disabled:p},n));break}if(s==="status"||s==="clear"){s==="clear"&&await f(t,"disableAnimationTrace","all");let d=await f(t,"listAnimationTraces");console.log(a({traces:d},n));break}let m=Number(s);Number.isFinite(m)||(console.error(` invalid id: ${s}`),process.exit(1));let C=r[2]?Number(r[2]):void 0,E=await f(t,"getAnimationTrace",m,C);console.log(a({id:m,samples:E},n));break}if(e!=="shell"&&(console.error(" usage: sootsim debug trace <shell|anim> [args]"),process.exit(1)),!o||/^[0-9]+$/.test(o)){let s=o?Number(o):50,m=await c(t,J(s));console.log(a(m,n));break}if(o==="on"){let s=r[2]?Number(r[2]):240,m=await c(t,w("on",s));console.log(a(m,n));break}if(o==="off"){let s=await c(t,w("off"));console.log(a(s,n));break}if(o==="clear"){let s=await c(t,w("clear"));console.log(a(s,n));break}if(o==="status"){let s=await c(t,w("status"));console.log(a(s,n));break}console.error(" usage: sootsim debug trace shell [on [limit]|off|status|clear|recentLimit]"),process.exit(1)}case"record":{let e=r[0],s=await c(t,`window.__sootsimDebug.record(${e==="on"?"true":e==="off"?"false":"undefined"})`);console.log(a({recording:s},n));break}case"recent":{let e=r[0],o=r[1]?Number(r[1]):50,s=await x(t,e,o);console.log(a(s,n));break}case"clear-events":{await c(t,"window.__sootsimDebug.clearEvents()"),console.log(a({cleared:!0},n));break}default:console.error(` unknown subcommand: ${k}`),L(),process.exit(1)}}catch(e){console.error(` debug failed: ${e.message}`),await T(t,{errorsCommand:`sootsim get errors 5${y}`,warningsCommand:`sootsim get warnings 5${y}`,requestsCommand:`sootsim get requests 5${y}`}),process.exit(1)}finally{t.close()}}export{Y as runDebug};
182
+ })()`,m=await c(t,s);console.log(a(m,n));break}case"clear-snapshots":{let e=r[0],o=e?`window.__sootsimDebug.clearSnapshots(${JSON.stringify(e)})`:"window.__sootsimDebug.clearSnapshots()";await c(t,o),console.log(a({cleared:e||"all"},n));break}case"find":{let e=r[0];if(e==="sheets"||e==="portals"){let o=await N(t,e);console.log(a(o,n))}else console.error(" usage: sootsim debug find <sheets|portals>"),process.exit(1);break}case"trace":{let e=r[0],o=r[1];if(e==="anim"){let s=r[1];if((!s||s==="--help"||s==="-h")&&(console.error(" usage: sootsim debug trace anim <on|off|status|clear|<id>> [id|limit]"),process.exit(1)),s==="on"){let d=r[2]??"all",p=r[3]?Number(r[3]):void 0,h=d==="all"?"all":Number(d);h!=="all"&&!Number.isFinite(h)&&(console.error(` invalid target: ${d}`),process.exit(1)),await f(t,"enableAnimationTrace",h,p);let F=await f(t,"listAnimationTraces");console.log(a({enabled:h,traces:F},n));break}if(s==="off"){let d=r[2]??"all",p=d==="all"?"all":Number(d);p!=="all"&&!Number.isFinite(p)&&(console.error(` invalid target: ${d}`),process.exit(1)),await f(t,"disableAnimationTrace",p),console.log(a({disabled:p},n));break}if(s==="status"||s==="clear"){s==="clear"&&await f(t,"disableAnimationTrace","all");let d=await f(t,"listAnimationTraces");console.log(a({traces:d},n));break}let m=Number(s);Number.isFinite(m)||(console.error(` invalid id: ${s}`),process.exit(1));let C=r[2]?Number(r[2]):void 0,E=await f(t,"getAnimationTrace",m,C);console.log(a({id:m,samples:E},n));break}if(e!=="shell"&&(console.error(" usage: sootsim debug trace <shell|anim> [args]"),process.exit(1)),!o||/^[0-9]+$/.test(o)){let s=o?Number(o):50,m=await c(t,J(s));console.log(a(m,n));break}if(o==="on"){let s=r[2]?Number(r[2]):240,m=await c(t,w("on",s));console.log(a(m,n));break}if(o==="off"){let s=await c(t,w("off"));console.log(a(s,n));break}if(o==="clear"){let s=await c(t,w("clear"));console.log(a(s,n));break}if(o==="status"){let s=await c(t,w("status"));console.log(a(s,n));break}console.error(" usage: sootsim debug trace shell [on [limit]|off|status|clear|recentLimit]"),process.exit(1)}case"record":{let e=r[0],s=await c(t,`window.__sootsimDebug.record(${e==="on"?"true":e==="off"?"false":"undefined"})`);console.log(a({recording:s},n));break}case"recent":{let e=r[0],o=r[1]?Number(r[1]):50,s=await A(t,e,o);console.log(a(s,n));break}case"clear-events":{await c(t,"window.__sootsimDebug.clearEvents()"),console.log(a({cleared:!0},n));break}default:console.error(` unknown subcommand: ${k}`),L(),process.exit(1)}}catch(e){console.error(` debug failed: ${e.message}`),await T(t,{errorsCommand:`sootsim get errors 5${y}`,warningsCommand:`sootsim get warnings 5${y}`,requestsCommand:`sootsim get requests 5${y}`}),process.exit(1)}finally{t.close()}}export{Y as runDebug};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.169 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as S}from"./chunk-5C6BR24W.js";import"./chunk-X2HNVXNM.js";import"./chunk-R2INPDGW.js";import"./chunk-YADWU7OZ.js";import"./chunk-VMYMPL6H.js";import"./chunk-SIB6I72P.js";import"./chunk-FIDPRJYH.js";import"./chunk-HJTKKF7M.js";import"./chunk-G2ZFDIPK.js";import"./chunk-KZIXAYN5.js";import"./chunk-DNA6VS6M.js";import"./chunk-M2TMFGZH.js";import"./chunk-B7BMSU7H.js";import"./chunk-GQAWFQNN.js";import"./chunk-Y6IDAARY.js";import"./chunk-MVOHANJG.js";import"./chunk-WZG3YVJR.js";import"./chunk-XEH4QGWB.js";import"./chunk-BQOMDL4K.js";import"./chunk-GC4THE6K.js";import"./chunk-IODOTOOP.js";import"./chunk-PV6MBKKE.js";import"./chunk-IACEJQIO.js";import"./chunk-2IFWVIKM.js";import"./chunk-DQZEN256.js";import"./chunk-KUUFY6FC.js";import"./chunk-5Q7IHJ7K.js";import"./chunk-2TYEWVS4.js";import"./chunk-5KY7TQ42.js";import"./chunk-JDGLBW64.js";import{spawn as D}from"child_process";import{existsSync as u,mkdirSync as _,writeFileSync as f,unlinkSync as I}from"fs";import{tmpdir as P}from"os";import{dirname as $,resolve as n,join as M}from"path";function E(){try{let e=import.meta.resolve("sootsim/detox");return $(e.startsWith("file://")?e.slice(7):e)}catch{return n(import.meta.dirname,"..","..","detox")}}var F=`
1
+ /*! sootsim v0.1.170 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as S}from"./chunk-25RFZ6WP.js";import"./chunk-YV74D4MG.js";import"./chunk-AJF3QF4K.js";import"./chunk-N4YCSOCR.js";import"./chunk-AUCNBB6Q.js";import"./chunk-DGJTEFE7.js";import"./chunk-6TSXXN2W.js";import"./chunk-YMFSRCHL.js";import"./chunk-Q4NDYO2U.js";import"./chunk-I5WXVKR6.js";import"./chunk-GST4YSBO.js";import"./chunk-S244IT4W.js";import"./chunk-LMX7UB5T.js";import"./chunk-GQH3PD3W.js";import"./chunk-BP3EGFER.js";import"./chunk-QXJMXSQP.js";import"./chunk-TXKOJ3P5.js";import"./chunk-DIRDEKRW.js";import"./chunk-6FAEORJ2.js";import"./chunk-NI3L4A65.js";import"./chunk-QPRF3UYX.js";import"./chunk-ODGEH6OW.js";import"./chunk-ER4GBJRY.js";import"./chunk-ULV4PWN4.js";import"./chunk-DWXC25XG.js";import"./chunk-EX6V4ZV6.js";import"./chunk-VUOCUCJ2.js";import"./chunk-V4HTQPMA.js";import"./chunk-WN7R4GL4.js";import{spawn as D}from"child_process";import{existsSync as u,mkdirSync as _,writeFileSync as f,unlinkSync as I}from"fs";import{tmpdir as P}from"os";import{dirname as $,resolve as n,join as M}from"path";function E(){try{let e=import.meta.resolve("sootsim/detox");return $(e.startsWith("file://")?e.slice(7):e)}catch{return n(import.meta.dirname,"..","..","detox")}}var F=`
3
3
  sootsim detox \u2014 run detox-style tests against a sootsim shell
4
4
 
5
5
  usage:
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.169 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import"./chunk-R2INPDGW.js";import{c as d,e as l,h as a}from"./chunk-GQAWFQNN.js";import"./chunk-IACEJQIO.js";import"./chunk-DQZEN256.js";import"./chunk-KUUFY6FC.js";import"./chunk-5Q7IHJ7K.js";import{g as c,h as r,i as g}from"./chunk-2TYEWVS4.js";import"./chunk-5KY7TQ42.js";import"./chunk-JDGLBW64.js";function h(){console.log(`
1
+ /*! sootsim v0.1.170 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import"./chunk-AJF3QF4K.js";import{c as d,e as l,h as a}from"./chunk-DIRDEKRW.js";import"./chunk-ODGEH6OW.js";import"./chunk-ULV4PWN4.js";import"./chunk-DWXC25XG.js";import"./chunk-EX6V4ZV6.js";import"./chunk-VUOCUCJ2.js";import{g as c,h as r,i as g}from"./chunk-V4HTQPMA.js";import"./chunk-WN7R4GL4.js";function h(){console.log(`
3
3
  sootsim device \u2014 inspect or change the live device preset for a sim
4
4
 
5
5
  usage:
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.169 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{c as E,e as R,h as b}from"./chunk-GQAWFQNN.js";import"./chunk-DQZEN256.js";import{b as v}from"./chunk-KUUFY6FC.js";import"./chunk-5KY7TQ42.js";import"./chunk-JDGLBW64.js";function F(e){return e.ts??e.t??0}function W(e){return typeof e.message=="string"&&e.message.length>0?e.message:Array.isArray(e.args)?e.args.map(s=>typeof s=="string"?s:JSON.stringify(s)).join(" "):""}var B=new Set(["timeline","network","react","console","screen"]);function P(){console.log(`
1
+ /*! sootsim v0.1.170 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{c as E,e as R,h as b}from"./chunk-DIRDEKRW.js";import"./chunk-ULV4PWN4.js";import{b as v}from"./chunk-DWXC25XG.js";import"./chunk-EX6V4ZV6.js";import"./chunk-WN7R4GL4.js";function F(e){return e.ts??e.t??0}function W(e){return typeof e.message=="string"&&e.message.length>0?e.message:Array.isArray(e.args)?e.args.map(s=>typeof s=="string"?s:JSON.stringify(s)).join(" "):""}var B=new Set(["timeline","network","react","console","screen"]);function P(){console.log(`
3
3
  sootsim diagnose \u2014 compact "what just went wrong?" report
4
4
 
5
5
  usage:
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.170 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import"./chunk-XUNPVF5K.js";import{a,b,c,d,e,f,g,h,i}from"./chunk-GST4YSBO.js";import"./chunk-S244IT4W.js";import"./chunk-LMX7UB5T.js";import"./chunk-6FAEORJ2.js";import"./chunk-DWXC25XG.js";import"./chunk-EX6V4ZV6.js";import"./chunk-WN7R4GL4.js";export{e as ALL_DRIVERS,i as buildDriverListRows,a as chromiumDriver,b as electronDriver,f as getAllDrivers,g as getDriver,c as playwrightDriver,h as resolveDriver,d as systemDriver};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.169 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as g}from"./chunk-BIWJE7CB.js";import"./chunk-K4JAWKOY.js";import{a as v,g as h}from"./chunk-HJTKKF7M.js";import"./chunk-G2ZFDIPK.js";import"./chunk-KZIXAYN5.js";import"./chunk-DNA6VS6M.js";import"./chunk-M2TMFGZH.js";import"./chunk-B7BMSU7H.js";import"./chunk-GQAWFQNN.js";import"./chunk-Y6IDAARY.js";import{b as f,g as u}from"./chunk-MVOHANJG.js";import{a as p}from"./chunk-WZG3YVJR.js";import{c as m}from"./chunk-XEH4QGWB.js";import"./chunk-BQOMDL4K.js";import"./chunk-GC4THE6K.js";import"./chunk-2IFWVIKM.js";import"./chunk-DQZEN256.js";import"./chunk-KUUFY6FC.js";import"./chunk-5KY7TQ42.js";import"./chunk-JDGLBW64.js";function b(e){let r=e.indexOf("--port");if(r<0)return;let o=e[r+1],i=o?Number(o):Number.NaN;return(!Number.isInteger(i)||i<=0)&&(console.error(` invalid --port value: ${o||"(missing)"}`),process.exit(1)),i}async function O(e,r){let o=b(e)??r.port;return o?h(String(o)):void 0}async function $(e,r){(e.includes("--help")||e.includes("-h"))&&(console.log(`
1
+ /*! sootsim v0.1.170 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as g}from"./chunk-I4RV5I6V.js";import"./chunk-XUNPVF5K.js";import{a as v,g as h}from"./chunk-DGJTEFE7.js";import"./chunk-6TSXXN2W.js";import"./chunk-YMFSRCHL.js";import"./chunk-Q4NDYO2U.js";import"./chunk-I5WXVKR6.js";import{b as f,g as u}from"./chunk-GST4YSBO.js";import{a as p}from"./chunk-S244IT4W.js";import{c as m}from"./chunk-LMX7UB5T.js";import"./chunk-QXJMXSQP.js";import"./chunk-TXKOJ3P5.js";import"./chunk-DIRDEKRW.js";import"./chunk-6FAEORJ2.js";import"./chunk-ER4GBJRY.js";import"./chunk-ULV4PWN4.js";import"./chunk-DWXC25XG.js";import"./chunk-EX6V4ZV6.js";import"./chunk-WN7R4GL4.js";function b(e){let r=e.indexOf("--port");if(r<0)return;let o=e[r+1],i=o?Number(o):Number.NaN;return(!Number.isInteger(i)||i<=0)&&(console.error(` invalid --port value: ${o||"(missing)"}`),process.exit(1)),i}async function O(e,r){let o=b(e)??r.port;return o?h(String(o)):void 0}async function $(e,r){(e.includes("--help")||e.includes("-h"))&&(console.log(`
3
3
  sootsim electron \u2014 launch the desktop companion
4
4
 
5
5
  usage:
@@ -15,4 +15,4 @@ examples:
15
15
  sootsim electron
16
16
  sootsim electron --port 5173
17
17
  sootsim electron --profile qa
18
- `),process.exit(0));let o=e.indexOf("--driver"),i=o>=0?e[o+1]:void 0,t=e.find((n,a)=>e[a-1]==="--profile"),d=e.includes("--ephemeral");t&&d&&(console.error(" sootsim electron: --profile cannot be combined with --ephemeral"),process.exit(1));let x=t?m(t).id:void 0,s=i||r.driver,l=f;if(s){let n=u(s);n||(console.error(` unknown driver "${s}" \u2014 run \`sootsim list --drivers\``),process.exit(1)),l=n}if(l.id==="electron"){let n=p();if(!n){if(v(),process.stdin.isTTY&&process.env.CI!=="1"&&process.env.SOOTSIM_NO_PROMPT!=="1"&&await g("run sootsim install-desktop now?",!0)){console.log();let{runInstallDesktop:I}=await import("./install-desktop-GB3JKSNX.js");await I(["--yes"]),n=p()}n||process.exit(1)}console.log(` launching ${n.path}`)}let w=await O(e,r),c=await l.launch({url:w,device:r.device,profileId:x,ephemeralProfile:d});c.launched||(console.error(` ${c.message}`),process.exit(1)),console.log(` ${c.message}`)}export{O as resolveElectronLaunchUrl,$ as runElectron};
18
+ `),process.exit(0));let o=e.indexOf("--driver"),i=o>=0?e[o+1]:void 0,t=e.find((n,a)=>e[a-1]==="--profile"),d=e.includes("--ephemeral");t&&d&&(console.error(" sootsim electron: --profile cannot be combined with --ephemeral"),process.exit(1));let x=t?m(t).id:void 0,s=i||r.driver,l=f;if(s){let n=u(s);n||(console.error(` unknown driver "${s}" \u2014 run \`sootsim list --drivers\``),process.exit(1)),l=n}if(l.id==="electron"){let n=p();if(!n){if(v(),process.stdin.isTTY&&process.env.CI!=="1"&&process.env.SOOTSIM_NO_PROMPT!=="1"&&await g("run sootsim install-desktop now?",!0)){console.log();let{runInstallDesktop:I}=await import("./install-desktop-4NOQ3YY4.js");await I(["--yes"]),n=p()}n||process.exit(1)}console.log(` launching ${n.path}`)}let w=await O(e,r),c=await l.launch({url:w,device:r.device,profileId:x,ephemeralProfile:d});c.launched||(console.error(` ${c.message}`),process.exit(1)),console.log(` ${c.message}`)}export{O as resolveElectronLaunchUrl,$ as runElectron};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.170 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as c,b as d,c as e,d as f}from"./chunk-25RFZ6WP.js";import"./chunk-YV74D4MG.js";import"./chunk-AJF3QF4K.js";import"./chunk-N4YCSOCR.js";import{c as a,d as b}from"./chunk-AUCNBB6Q.js";import"./chunk-DGJTEFE7.js";import"./chunk-6TSXXN2W.js";import"./chunk-YMFSRCHL.js";import"./chunk-Q4NDYO2U.js";import"./chunk-I5WXVKR6.js";import"./chunk-GST4YSBO.js";import"./chunk-S244IT4W.js";import"./chunk-LMX7UB5T.js";import"./chunk-GQH3PD3W.js";import"./chunk-BP3EGFER.js";import"./chunk-QXJMXSQP.js";import"./chunk-TXKOJ3P5.js";import"./chunk-DIRDEKRW.js";import"./chunk-6FAEORJ2.js";import"./chunk-NI3L4A65.js";import"./chunk-QPRF3UYX.js";import"./chunk-ODGEH6OW.js";import"./chunk-ER4GBJRY.js";import"./chunk-ULV4PWN4.js";import"./chunk-DWXC25XG.js";import"./chunk-EX6V4ZV6.js";import"./chunk-VUOCUCJ2.js";import"./chunk-V4HTQPMA.js";import"./chunk-WN7R4GL4.js";export{c as discoverSootsimUrl,e as hoistLeadingSimFlag,a as parseFlowFile,f as runFlow,d as runFlowPlayback,b as validateFlowFile};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.170 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a,b,c}from"./chunk-UDMJSFSH.js";import"./chunk-35GMFXVJ.js";import"./chunk-XOTJD6PU.js";import"./chunk-3TM7DHWE.js";import"./chunk-ODGEH6OW.js";import"./chunk-ER4GBJRY.js";import"./chunk-ULV4PWN4.js";import"./chunk-DWXC25XG.js";import"./chunk-EX6V4ZV6.js";import"./chunk-DKTC53HV.js";import"./chunk-VATHADSI.js";import"./chunk-V4HTQPMA.js";import"./chunk-WN7R4GL4.js";export{c as printCommandHelp,b as printGroupHelp,a as printHelp};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.169 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{b as n,c as r,d as l}from"./chunk-GLRFKYDV.js";import"./chunk-KUUFY6FC.js";import"./chunk-JDGLBW64.js";function a(t){let s=t[0]??"list";if(s==="reset"){t[1]==="global"?(r(),console.log(" cleared global hint state")):(n(),console.log(" cleared hint state for this CLI identity"));return}if(s==="list"){let e=l();if(!e.length){console.log(" no hints registered");return}let i=Math.max(...e.map(o=>o.id.length));console.log(" registered hints:");for(let o of e){let c=typeof o.frequency=="string"?o.frequency:`cooldown ${o.frequency.cooldownMs}ms`;console.log(` ${o.id.padEnd(i)} ${c}`)}console.log(""),console.log(" env overrides:"),console.log(" SOOTSIM_HINTS=off suppress all hints"),console.log(" SOOTSIM_HINTS=always show every hint every time");return}console.error(` unknown subcommand: ${s}`),console.error(" usage:"),console.error(" sootsim hints list show registered hints"),console.error(" sootsim hints reset [global] clear shown-state"),process.exit(1)}export{a as runHints};
1
+ /*! sootsim v0.1.170 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as n,c as r,d as l}from"./chunk-3TM7DHWE.js";import"./chunk-DWXC25XG.js";import"./chunk-WN7R4GL4.js";function a(t){let s=t[0]??"list";if(s==="reset"){t[1]==="global"?(r(),console.log(" cleared global hint state")):(n(),console.log(" cleared hint state for this CLI identity"));return}if(s==="list"){let e=l();if(!e.length){console.log(" no hints registered");return}let i=Math.max(...e.map(o=>o.id.length));console.log(" registered hints:");for(let o of e){let c=typeof o.frequency=="string"?o.frequency:`cooldown ${o.frequency.cooldownMs}ms`;console.log(` ${o.id.padEnd(i)} ${c}`)}console.log(""),console.log(" env overrides:"),console.log(" SOOTSIM_HINTS=off suppress all hints"),console.log(" SOOTSIM_HINTS=always show every hint every time");return}console.error(` unknown subcommand: ${s}`),console.error(" usage:"),console.error(" sootsim hints list show registered hints"),console.error(" sootsim hints reset [global] clear shown-state"),process.exit(1)}export{a as runHints};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.170 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-EX6V4ZV6.js";import"./chunk-WN7R4GL4.js";export{b as ACTIVE_RUNTIME_FILE,e as CONFIG_FILE,f as DAEMON_HEARTBEAT_STALE_MS,c as DAEMON_LOCKFILE,d as DEV_BRIDGE_LOCKFILE,a as SOOTSIM_HOME_ENV,H as activeRuntimeDir,m as activeRuntimeFile,u as cacheDir,O as claimDaemonLockfile,G as compareSemver,x as configFilePath,s as daemonAppBundlePath,r as daemonAppDir,t as daemonAppLauncherPath,v as daemonLockfilePath,w as devBridgeLockfilePath,n as electronDir,o as electronUserDataDir,p as electronVersionDir,C as ensureSootsimHome,K as isDaemonLockfileFresh,L as isDevBridgeLockfileFresh,i as isDevWorkstation,h as isSootsimDevCheckout,F as listInstalledRuntimes,q as profilesDir,D as readActiveRuntime,I as readDaemonLockfile,J as readDevBridgeLockfile,y as readSharedConfig,A as readTelemetryEnabled,P as removeDaemonLockfile,Q as removeDevBridgeLockfile,l as runtimeDir,k as runtimesDir,j as shouldSkipPersistentDaemon,g as sootsimHomeDir,E as writeActiveRuntime,M as writeDaemonLockfile,N as writeDevBridgeLockfile,z as writeSharedConfig,B as writeTelemetryEnabled};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.169 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as vt,b as kt}from"./chunk-CR6DOLUD.js";import{a as Ee,g as ke,j as te}from"./chunk-FIDPRJYH.js";import{b as Tt,c as Mt,j as It}from"./chunk-HJTKKF7M.js";import"./chunk-G2ZFDIPK.js";import{a as ee,b as A,c as E,d as Be,e as ie,f as G,g as de,h as ge,i as xt,j as $t,k as ve,l as St}from"./chunk-KZIXAYN5.js";import{A as gt,B as yt,F as bt,H as ce,I as ht,O as wt,a as $e,b as et,c as tt,d as ot,e as st,f as nt,g as rt,h as it,i as at,j as lt,k as Pe,l as Re,q as De,r as ct,s as dt,t as fe,u as ut,v as Se,w as Ce,x as mt,y as pt,z as ft}from"./chunk-DNA6VS6M.js";import"./chunk-M2TMFGZH.js";import"./chunk-B7BMSU7H.js";import{c as Xe,e as Ve,f as Qe,g as Ze,h as Ae}from"./chunk-GQAWFQNN.js";import"./chunk-Y6IDAARY.js";import"./chunk-MVOHANJG.js";import"./chunk-WZG3YVJR.js";import"./chunk-XEH4QGWB.js";import"./chunk-BQOMDL4K.js";import"./chunk-GC4THE6K.js";import{a as ze}from"./chunk-SLL5SZN4.js";import{a as _e,c as Oe}from"./chunk-3T36XLP3.js";import{a as Y}from"./chunk-GLRFKYDV.js";import{a as Ge}from"./chunk-2IFWVIKM.js";import"./chunk-DQZEN256.js";import{b as Ye}from"./chunk-KUUFY6FC.js";import"./chunk-5KY7TQ42.js";import"./chunk-JDGLBW64.js";import{existsSync as go,mkdirSync as yo,readFileSync as bo,rmSync as Nt,writeFileSync as ho}from"fs";import{tmpdir as wo}from"os";import{dirname as xo,join as $o,resolve as So}from"path";var ye=1,vo="SOOTSIM_INSPECT_NOTICE_PATH",ko=300*1e3,To=15e3;function Ft(){return So(process.env[vo]||$o(wo(),"sootsim-inspect-notice-state.json"))}function Mo(e,l){return Object.fromEntries(Object.entries(e).filter(([,r])=>typeof r?.signature=="string"&&Number.isFinite(r?.updatedAt)&&l-r.updatedAt<=ko))}function Io(e){let l=Ft();if(!go(l))return{version:ye,entries:{}};try{let r=JSON.parse(bo(l,"utf8"));return r.version!==ye||!r.entries||typeof r.entries!="object"?(Nt(l,{force:!0}),{version:ye,entries:{}}):{version:ye,entries:Mo(r.entries,e)}}catch{return Nt(l,{force:!0}),{version:ye,entries:{}}}}function No(e){let l=Ft();yo(xo(l),{recursive:!0}),ho(l,JSON.stringify(e,null,2)+`
1
+ /*! sootsim v0.1.170 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as vt,b as kt}from"./chunk-E3FKMY5E.js";import{a as Ae,g as ke,j as te}from"./chunk-AUCNBB6Q.js";import{b as Tt,c as Mt,j as It}from"./chunk-DGJTEFE7.js";import"./chunk-6TSXXN2W.js";import{a as ee,b as A,c as E,d as Be,e as ie,f as G,g as de,h as ge,i as xt,j as $t,k as ve,l as St}from"./chunk-YMFSRCHL.js";import{A as ut,B as mt,F as pt,H as ce,I as ft,O as gt,a as $e,b as Xe,c as Ve,d as Qe,e as Ze,f as et,g as tt,h as ot,i as st,j as nt,k as Ee,l as Pe,q as Re,r as rt,s as it,t as fe,u as at,v as Se,w as De,x as lt,y as ct,z as dt}from"./chunk-Q4NDYO2U.js";import"./chunk-I5WXVKR6.js";import"./chunk-GST4YSBO.js";import"./chunk-S244IT4W.js";import"./chunk-LMX7UB5T.js";import"./chunk-QXJMXSQP.js";import"./chunk-TXKOJ3P5.js";import{c as yt,e as bt,f as ht,g as wt,h as Ce}from"./chunk-DIRDEKRW.js";import"./chunk-6FAEORJ2.js";import{a as ze}from"./chunk-RLKSLUNR.js";import{a as _e,c as Oe}from"./chunk-XOTJD6PU.js";import{a as Y}from"./chunk-3TM7DHWE.js";import{a as Ge}from"./chunk-ER4GBJRY.js";import"./chunk-ULV4PWN4.js";import{b as Ye}from"./chunk-DWXC25XG.js";import"./chunk-EX6V4ZV6.js";import"./chunk-WN7R4GL4.js";import{existsSync as go,mkdirSync as yo,readFileSync as bo,rmSync as Nt,writeFileSync as ho}from"fs";import{tmpdir as wo}from"os";import{dirname as xo,join as $o,resolve as So}from"path";var ye=1,vo="SOOTSIM_INSPECT_NOTICE_PATH",ko=300*1e3,To=15e3;function Ft(){return So(process.env[vo]||$o(wo(),"sootsim-inspect-notice-state.json"))}function Mo(e,l){return Object.fromEntries(Object.entries(e).filter(([,r])=>typeof r?.signature=="string"&&Number.isFinite(r?.updatedAt)&&l-r.updatedAt<=ko))}function Io(e){let l=Ft();if(!go(l))return{version:ye,entries:{}};try{let r=JSON.parse(bo(l,"utf8"));return r.version!==ye||!r.entries||typeof r.entries!="object"?(Nt(l,{force:!0}),{version:ye,entries:{}}):{version:ye,entries:Mo(r.entries,e)}}catch{return Nt(l,{force:!0}),{version:ye,entries:{}}}}function No(e){let l=Ft();yo(xo(l),{recursive:!0}),ho(l,JSON.stringify(e,null,2)+`
3
3
  `)}function Fo(e,l){let r=l.trim()||"default";return`${e}:${r}`}function je(e,l,r,c={}){let p=c.nowMs??Date.now(),a=c.cooldownMs??To,g=Io(p),y=Fo(e,l),T=g.entries[y];return T&&T.signature===r&&p-T.updatedAt<a?!1:(g.entries[y]={signature:r,updatedAt:p},No(g),!0)}var _o={initialWaitMs:3e3,deadlineMs:5e3,retryWaitMs:700},Oo={initialWaitMs:1200,deadlineMs:2500,retryWaitMs:700};function Ao(e,l={}){return{...e?_o:Oo,...l}}function ue(e){return!(!e||e.hit===!1||e.ok===!1||e.pointerTapHandled===!1&&!e.keyboardOpened&&!e.isTextInput)}function Eo(e,l){return{id:e.target?.id??e.match?.id??e.node?.id??null,testID:e.target?.testID??e.match?.testID??e.node?.testID??null,text:e.target?.text??e.target?.accessibilityLabel??e.match?.text??e.match?.accessibilityLabel??e.node?.text??l??null,type:e.target?.type??e.match?.type??e.node?.type??null}}async function be(e,l){let r=Ao(!!l.agent,l.timing),c=0,p=null,a=null;try{await te({bridge:e,maxMs:r.initialWaitMs,pollMs:32,stablePolls:2})}catch{}let g=Date.now()+r.deadlineMs;for(;Date.now()<=g||c===0;){c++;let y=await l.resolve();if(p=y,y?.error==="bridge-not-ready"||y?.ambiguous||y?.nthOutOfRange)return{payload:y,result:null,attempts:c,failure:"special"};if(y&&typeof y.cx=="number"&&typeof y.cy=="number"){let M=await e.send({type:"tap",x:y.cx,y:y.cy,target:Eo(y,l.textFallback)});if(a=M,ue(M))return{payload:y,result:M,attempts:c}}let T=g-Date.now();if(T<=0)break;try{await te({bridge:e,maxMs:Math.min(T,r.retryWaitMs),pollMs:32,stablePolls:2})}catch{await new Promise(M=>setTimeout(M,Math.min(120,T)))}}return{payload:p,result:a,attempts:c,failure:p&&typeof p.cx=="number"?"missed":"not-found"}}async function _t(e,l,r,c){return e.send({type:"tap",x:l,y:r,...c?{target:c}:{}})}async function Ot(e,l,r={}){let c=JSON.stringify(l);return be(e,{agent:r.agent,timing:r.timing,resolve:()=>e.send({type:"evaluate",code:`(async () => {
4
4
  const t = window.__sootsimTest
5
5
  if (!t) return null
@@ -197,16 +197,16 @@ import{a as vt,b as kt}from"./chunk-CR6DOLUD.js";import{a as Ee,g as ke,j as te}
197
197
  }
198
198
  }
199
199
  return { strategy: 'none' }
200
- })()`});if(!p||!("node"in p))return p;let a=p.node,g=a.absolutePosition.x+a.layout.width/2,y=a.absolutePosition.y+a.layout.height/2;return{...p,cx:g,cy:y,target:{id:a.id,testID:a.testID,text:p.strategy==="text"?l:a.text,type:a.type}}}})}async function Pt(e,l={args:[]}){let r=await tt(e);if(A(l.args)){E(r);return}console.log(` nodes: ${r.nodes}`)}function Le(e,l){let r=e.indexOf(l);return r>=0&&r+1<e.length?e[r+1]:null}async function Rt(e){let{bridge:l,args:r,positional:c}=e,p=r.includes("--verbose")||r.includes("-v"),a=A(r),g=p&&!a,y=r.includes("--watch")||r.includes("-w"),T=1e3,M=r.includes("--compact"),h=r.includes("--no-xy"),k=r.includes("--no-clipped"),_=r.includes("--include-occluded"),I=Le(r,"--testid-like"),P=Le(r,"--only"),j=Le(r,"--subtree"),d=c[1]&&!c[1].startsWith("-")?c[1]:void 0,z=d?/[*?]/.test(d):!1,B=!z&&!P?d:void 0,D=P??(z?d:void 0),Q=async()=>{await de(l,{verbose:g});let S=await nt(l,{describe:!0,verbose:p,filter:B||"",testIdLike:I||void 0,onlyGlob:D||void 0,subtreeRoot:j||void 0,compact:M,hideXy:h,includeOccluded:_}),N=S?.tree,J=S?.shell,W=S?.keyboard;if(a){E({shell:J,tree:N??"",keyboard:W});return}if(J&&typeof J=="object"){let C=[J.state?`state=${J.state}`:null,J.activeApp?`app=${J.activeApp}`:null,J.showSwitcher?"switcher":null,J.switcherPhase&&J.switcherPhase!=="idle"?`phase=${J.switcherPhase}`:null].filter(Boolean);C.length>0&&console.log(` shell: ${C.join(" ")}`)}if(typeof N=="string"&&N.startsWith("__SUBTREE_NOT_FOUND__:")){let C=N.slice(22);console.log(` subtree root not found: ${C}`),Y("subtree-root-not-found",C);return}if(!N){let C=S?.nodeCount??0;console.log(" no matching nodes found"),!(B||I||D||j)&&C<10&&Y("app-still-loading",C);return}let V=N,Z=0;if(k&&typeof V=="string"){let C=V.split(`
200
+ })()`});if(!p||!("node"in p))return p;let a=p.node,g=a.absolutePosition.x+a.layout.width/2,y=a.absolutePosition.y+a.layout.height/2;return{...p,cx:g,cy:y,target:{id:a.id,testID:a.testID,text:p.strategy==="text"?l:a.text,type:a.type}}}})}async function Pt(e,l={args:[]}){let r=await Ve(e);if(A(l.args)){E(r);return}console.log(` nodes: ${r.nodes}`)}function Le(e,l){let r=e.indexOf(l);return r>=0&&r+1<e.length?e[r+1]:null}async function Rt(e){let{bridge:l,args:r,positional:c}=e,p=r.includes("--verbose")||r.includes("-v"),a=A(r),g=p&&!a,y=r.includes("--watch")||r.includes("-w"),T=1e3,M=r.includes("--compact"),h=r.includes("--no-xy"),k=r.includes("--no-clipped"),_=r.includes("--include-occluded"),I=Le(r,"--testid-like"),P=Le(r,"--only"),j=Le(r,"--subtree"),d=c[1]&&!c[1].startsWith("-")?c[1]:void 0,z=d?/[*?]/.test(d):!1,B=!z&&!P?d:void 0,D=P??(z?d:void 0),Q=async()=>{await de(l,{verbose:g});let S=await et(l,{describe:!0,verbose:p,filter:B||"",testIdLike:I||void 0,onlyGlob:D||void 0,subtreeRoot:j||void 0,compact:M,hideXy:h,includeOccluded:_}),N=S?.tree,J=S?.shell,W=S?.keyboard;if(a){E({shell:J,tree:N??"",keyboard:W});return}if(J&&typeof J=="object"){let C=[J.state?`state=${J.state}`:null,J.activeApp?`app=${J.activeApp}`:null,J.showSwitcher?"switcher":null,J.switcherPhase&&J.switcherPhase!=="idle"?`phase=${J.switcherPhase}`:null].filter(Boolean);C.length>0&&console.log(` shell: ${C.join(" ")}`)}if(typeof N=="string"&&N.startsWith("__SUBTREE_NOT_FOUND__:")){let C=N.slice(22);console.log(` subtree root not found: ${C}`),Y("subtree-root-not-found",C);return}if(!N){let C=S?.nodeCount??0;console.log(" no matching nodes found"),!(B||I||D||j)&&C<10&&Y("app-still-loading",C);return}let V=N,Z=0;if(k&&typeof V=="string"){let C=V.split(`
201
201
  `),le=[];for(let o of C){if(o.includes("(clipped:")){Z+=1;continue}le.push(o)}V=le.join(`
202
202
  `)}console.log(V),Z>0&&console.log(` ${Z} clipped row(s) hidden (omit --no-clipped to see)`);let re=B||I||D||j;if((B||I||D)&&!y&&Y("describe-filter-context"),!re&&!y&&N.split(`
203
203
  `).length>=80&&Y("describe-use-filters"),W&&W.visible){let C=W.spec,le=[C?.keyboardType?`type=${C.keyboardType}`:null,C?.returnKeyType&&C.returnKeyType!=="default"?`return=${C.returnKeyType}`:null,W.mode!=="letters"?`mode=${W.mode}`:null,W.shifted?"shift":null,W.capsLock?"caps":null,C?.autoCapitalize&&C.autoCapitalize!=="sentences"?`autoCap=${C.autoCapitalize}`:null,W.accessoryBarId?`accessory=${W.accessoryBarId}`:null].filter(Boolean);console.log(`
204
204
  keyboard: ${le.join(" ")||"visible"}`)}};if(y)for(console.log(` watching... (Ctrl+C to stop)
205
- `);;)console.clear(),await Q(),await ee(T);else await Q()}var Po=["SOOTSIM_AGENT","CLAUDECODE","CLAUDE_CODE_ENTRYPOINT","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","CURSOR_TRACE_ID","AIDER_MODEL"];function me(){if(process.env.SOOTSIM_AGENT==="0")return!1;for(let e of Po){let l=process.env[e];if(l&&l.trim()&&l!=="0")return!0}return!1}async function Dt(e){let{bridge:l,args:r,effectiveArgs:c,positional:p,inspectUsage:a}=e,g=S=>{let N=c.indexOf(S);return N>=0&&N+1<c.length?c[N+1]:null},y=S=>c.includes(S),T=g("--testid")||g("--test-id"),M=g("--role"),h=g("--type"),k=g("--text"),_=y("--pressable"),I=y("--visible"),P=y("--interactive-targets")||y("--actions"),j=!T&&!M&&!h&&!k&&!_&&!I&&!P?p[1]:null,d=k??j,z=await lt(l,{testId:T,role:M,type:h,text:d,pressable:_,visible:I,interactive:P});z||(console.error(a("find","<text> | --text <t> | --testid <id> | --role <r> | --type <t> | --pressable | --visible | --interactive-targets")),process.exit(1));let{mode:B,result:D}=z,Q=A(r),oe=r.includes("--verbose")||r.includes("--dump");if(Q)B==="interactive-targets"&&Array.isArray(D)?E(Pe(D).map(S=>({...S,tap:Re(S)}))):E(D??null);else if(Array.isArray(D))if(D.length===0){console.log(` no ${B} nodes found`);let S=await l.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount?.()) || 0)()"});typeof S=="number"&&S<10&&Y("app-still-loading",S)}else if(B==="interactive-targets"){let S=Pe(D);console.log(` found ${S.length} interactive target${S.length===1?"":"s"} (sorted by score):`);for(let N of S.slice(0,20)){let J=N.absolutePosition?`@(${Math.round(N.absolutePosition.x)},${Math.round(N.absolutePosition.y)})`:"",W=N.layout?`${Math.round(N.layout.width)}x${Math.round(N.layout.height)}`:"?x?",V=N.text?` "${N.text.slice(0,30)}"`:"",Z=N.testID?` #${N.testID}`:"",re=N.accessibilityLabel?` \u24D8"${String(N.accessibilityLabel).slice(0,24)}"`:"",pe=N.accessibilityRole?`[${N.accessibilityRole}]`:N.type,C=Re(N);console.log(` ${pe}${V}${re}${Z} ${W} ${J}`),console.log(` \u2192 ${C}`),oe&&console.log(Je(JSON.stringify(N,null,2)," "))}S.length>20&&console.log(` ... and ${S.length-20} more`)}else{console.log(` found ${D.length} node${D.length===1?"":"s"} (${B}):`);for(let S of D.slice(0,20)){let N=S.absolutePosition?`@(${Math.round(S.absolutePosition.x)},${Math.round(S.absolutePosition.y)})`:"",J=S.layout?`${Math.round(S.layout.width)}x${Math.round(S.layout.height)}`:"?x?",W=S.text?` "${S.text.slice(0,30)}"`:"",V=S.testID?` #${S.testID}`:"",Z=S.pressable?" (tap)":"",re=S.accessibilityRole?`[${S.accessibilityRole}]`:S.type;console.log(` ${re}${W}${V} ${J} ${N}${Z}`),oe&&console.log(Je(JSON.stringify(S,null,2)," "))}D.length>20&&console.log(` ... and ${D.length-20} more`)}else if(D==null)console.log(` not found: ${d||T||M||h||""||B}`),T&&Y("wait-selector-for-missing-testid",T);else{let S=D;if(S.type&&S.absolutePosition){let N=`@(${Math.round(S.absolutePosition.x)},${Math.round(S.absolutePosition.y)})`,J=S.layout?`${Math.round(S.layout.width)}x${Math.round(S.layout.height)}`:"?x?",W=S.text?` "${S.text.slice(0,40)}"`:"",V=S.testID?` #${S.testID}`:"",Z=S.pressable?" (tap)":"",re=S.accessibilityRole?`[${S.accessibilityRole}]`:S.type;console.log(` ${re}${W}${V} ${J} ${N}${Z}`),oe&&console.log(Je(JSON.stringify(S,null,2)," "))}else console.log(JSON.stringify(D,null,2))}}function Je(e,l){return e.split(`
205
+ `);;)console.clear(),await Q(),await ee(T);else await Q()}var Po=["SOOTSIM_AGENT","CLAUDECODE","CLAUDE_CODE_ENTRYPOINT","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","CURSOR_TRACE_ID","AIDER_MODEL"];function me(){if(process.env.SOOTSIM_AGENT==="0")return!1;for(let e of Po){let l=process.env[e];if(l&&l.trim()&&l!=="0")return!0}return!1}async function Dt(e){let{bridge:l,args:r,effectiveArgs:c,positional:p,inspectUsage:a}=e,g=S=>{let N=c.indexOf(S);return N>=0&&N+1<c.length?c[N+1]:null},y=S=>c.includes(S),T=g("--testid")||g("--test-id"),M=g("--role"),h=g("--type"),k=g("--text"),_=y("--pressable"),I=y("--visible"),P=y("--interactive-targets")||y("--actions"),j=!T&&!M&&!h&&!k&&!_&&!I&&!P?p[1]:null,d=k??j,z=await nt(l,{testId:T,role:M,type:h,text:d,pressable:_,visible:I,interactive:P});z||(console.error(a("find","<text> | --text <t> | --testid <id> | --role <r> | --type <t> | --pressable | --visible | --interactive-targets")),process.exit(1));let{mode:B,result:D}=z,Q=A(r),oe=r.includes("--verbose")||r.includes("--dump");if(Q)B==="interactive-targets"&&Array.isArray(D)?E(Ee(D).map(S=>({...S,tap:Pe(S)}))):E(D??null);else if(Array.isArray(D))if(D.length===0){console.log(` no ${B} nodes found`);let S=await l.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount?.()) || 0)()"});typeof S=="number"&&S<10&&Y("app-still-loading",S)}else if(B==="interactive-targets"){let S=Ee(D);console.log(` found ${S.length} interactive target${S.length===1?"":"s"} (sorted by score):`);for(let N of S.slice(0,20)){let J=N.absolutePosition?`@(${Math.round(N.absolutePosition.x)},${Math.round(N.absolutePosition.y)})`:"",W=N.layout?`${Math.round(N.layout.width)}x${Math.round(N.layout.height)}`:"?x?",V=N.text?` "${N.text.slice(0,30)}"`:"",Z=N.testID?` #${N.testID}`:"",re=N.accessibilityLabel?` \u24D8"${String(N.accessibilityLabel).slice(0,24)}"`:"",pe=N.accessibilityRole?`[${N.accessibilityRole}]`:N.type,C=Pe(N);console.log(` ${pe}${V}${re}${Z} ${W} ${J}`),console.log(` \u2192 ${C}`),oe&&console.log(Je(JSON.stringify(N,null,2)," "))}S.length>20&&console.log(` ... and ${S.length-20} more`)}else{console.log(` found ${D.length} node${D.length===1?"":"s"} (${B}):`);for(let S of D.slice(0,20)){let N=S.absolutePosition?`@(${Math.round(S.absolutePosition.x)},${Math.round(S.absolutePosition.y)})`:"",J=S.layout?`${Math.round(S.layout.width)}x${Math.round(S.layout.height)}`:"?x?",W=S.text?` "${S.text.slice(0,30)}"`:"",V=S.testID?` #${S.testID}`:"",Z=S.pressable?" (tap)":"",re=S.accessibilityRole?`[${S.accessibilityRole}]`:S.type;console.log(` ${re}${W}${V} ${J} ${N}${Z}`),oe&&console.log(Je(JSON.stringify(S,null,2)," "))}D.length>20&&console.log(` ... and ${D.length-20} more`)}else if(D==null)console.log(` not found: ${d||T||M||h||""||B}`),T&&Y("wait-selector-for-missing-testid",T);else{let S=D;if(S.type&&S.absolutePosition){let N=`@(${Math.round(S.absolutePosition.x)},${Math.round(S.absolutePosition.y)})`,J=S.layout?`${Math.round(S.layout.width)}x${Math.round(S.layout.height)}`:"?x?",W=S.text?` "${S.text.slice(0,40)}"`:"",V=S.testID?` #${S.testID}`:"",Z=S.pressable?" (tap)":"",re=S.accessibilityRole?`[${S.accessibilityRole}]`:S.type;console.log(` ${re}${W}${V} ${J} ${N}${Z}`),oe&&console.log(Je(JSON.stringify(S,null,2)," "))}else console.log(JSON.stringify(D,null,2))}}function Je(e,l){return e.split(`
206
206
  `).map(r=>l+r).join(`
207
- `)}async function Ct(e){let{bridge:l,args:r}=e,c=A(r);await de(l,{verbose:!c});let p=r.includes("--styling"),a=await rt(l,{styling:p});if(c){E({count:a.length,elements:a});return}console.log(` layout (${a.length} element${a.length===1?"":"s"}):
208
- `),console.log(it(a,{styling:p}))}async function Bt(e,l={}){let r=await bt(e);if("error"in r&&(console.error(r.error),process.exit(1)),l.json){console.log(JSON.stringify(r,null,2));return}let{visible:c,spec:p,mode:a,shifted:g,capsLock:y,accessoryBarId:T}=r,M=[];M.push(`keyboard: ${c?"visible":"hidden"}`),p?(M.push(` type: ${p.keyboardType}`),M.push(` returnKey: ${p.returnKeyType}`),M.push(` autoCap: ${p.autoCapitalize}`),M.push(` autoCorrect: ${p.autoCorrect?"on":"off"}`),M.push(` appearance: ${p.keyboardAppearance}`),p.secureTextEntry&&M.push(" secureTextEntry: true"),p.enablesReturnKeyAutomatically&&M.push(` return: ${p.currentTextIsEmpty?"disabled (empty)":"enabled"}`)):M.push(" spec: <none> (shown via dev-tools with no TextInput)"),M.push(` mode: ${a}${g?" (shifted)":""}${y?" (caps)":""}`),T&&M.push(` accessoryBar: ${T}`),console.log(M.join(`
209
- `))}async function jt(e){let l=await e.bridge.listSims(),r=e.args.includes("--all"),c=e.args.find((y,T)=>e.args[T-1]==="--bundle"),p=e.args.find((y,T)=>e.args[T-1]==="--app-port"),a=e.args.includes("--primary"),g=l.filter(y=>!(a&&!y.isPrimary||c&&!(y.url??"").includes(c)||p&&!(y.url??"").includes(`/rn/${p}`)||!r&&!c&&!p&&!a&&!(y.url&&(y.url.includes("bundle=")||y.url.includes("/index.bundle")))&&y.id!==e.simId));if(A(e.args)){E(g.map(y=>({...y,active:y.id===e.simId})));return}It(g,e.simId),g.length<l.length&&!A(e.args)&&console.log(` (${l.length-g.length} more hidden \u2014 pass --all to show)`)}function ae(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}function Te(e,l){return l<=0?"?":`${(e/l*100).toFixed(0)}%`}async function Lt(e,l={args:[]}){let r=await wt(e);if(A(l.args)){E(r);return}if(console.log(" memory:"),r.imageLoader){let c=r.imageLoader;console.log(" image-loader cache"),console.log(` entries: ${c.cacheEntries} / ${c.cacheMaxEntries} (${Te(c.cacheEntries,c.cacheMaxEntries)})`),console.log(` pixel bytes: ${ae(c.cachePixelBytes)} / ${ae(c.cachePixelBudget)} (${Te(c.cachePixelBytes,c.cachePixelBudget)})`),console.log(` pending: ${c.pendingFetches} fetches, ${c.pendingBytes} bytes`),console.log(` failed uris: ${c.failedUris}`),console.log(` snapshots: ${c.snapshots}`),console.log(` live frames: ${c.liveFrames}`)}else console.log(" image-loader cache: not available (engine pre-rebuild?)");if(r.workerHeap){let c=r.workerHeap;console.log(" worker heap (chrome only)"),console.log(` used: ${ae(c.usedJSHeapSize)} / ${ae(c.jsHeapSizeLimit)} (${Te(c.usedJSHeapSize,c.jsHeapSizeLimit)})`),console.log(` total: ${ae(c.totalJSHeapSize)}`)}if(r.hostHeap){let c=r.hostHeap;console.log(" host heap (chrome only)"),console.log(` used: ${ae(c.usedJSHeapSize)} / ${ae(c.jsHeapSizeLimit)} (${Te(c.usedJSHeapSize,c.jsHeapSizeLimit)})`),console.log(` total: ${ae(c.totalJSHeapSize)}`)}}var X="<redacted secure text>";function he(e){let l=e?.layout?.spec??e?.spec??null;return!!l?.secureTextEntry&&l.keyboardType!=="visible-password"}function We(e,l){return he(l)?X:e}function qe(e){if(!e||!he(e))return e;let l=e.focusedInput;return!l||typeof l!="object"?e:{...e,focusedInput:{...l,secureTextEntry:!0,text:typeof l.text=="string"?X:l.text}}}function we(e){let l=e.indexOf("--testid");if(l>=0&&e[l+1])return{mode:"testid",value:e[l+1]};let r=e.indexOf("--test-id");if(r>=0&&e[r+1])return{mode:"testid",value:e[r+1]};let c=e.indexOf("--text");return c>=0&&e[c+1]?{mode:"text",value:e[c+1]}:null}async function Me(e,l){let r=JSON.stringify(l.value),c=l.mode==="testid"?`(await t.findByTestId(${r})) || (await t.findById(${r}))`:`await t.findByText(${r})`;return await e.send({type:"evaluate",code:`(async () => {
207
+ `)}async function Ct(e){let{bridge:l,args:r}=e,c=A(r);await de(l,{verbose:!c});let p=r.includes("--styling"),a=await tt(l,{styling:p});if(c){E({count:a.length,elements:a});return}console.log(` layout (${a.length} element${a.length===1?"":"s"}):
208
+ `),console.log(ot(a,{styling:p}))}async function Bt(e,l={}){let r=await pt(e);if("error"in r&&(console.error(r.error),process.exit(1)),l.json){console.log(JSON.stringify(r,null,2));return}let{visible:c,spec:p,mode:a,shifted:g,capsLock:y,accessoryBarId:T}=r,M=[];M.push(`keyboard: ${c?"visible":"hidden"}`),p?(M.push(` type: ${p.keyboardType}`),M.push(` returnKey: ${p.returnKeyType}`),M.push(` autoCap: ${p.autoCapitalize}`),M.push(` autoCorrect: ${p.autoCorrect?"on":"off"}`),M.push(` appearance: ${p.keyboardAppearance}`),p.secureTextEntry&&M.push(" secureTextEntry: true"),p.enablesReturnKeyAutomatically&&M.push(` return: ${p.currentTextIsEmpty?"disabled (empty)":"enabled"}`)):M.push(" spec: <none> (shown via dev-tools with no TextInput)"),M.push(` mode: ${a}${g?" (shifted)":""}${y?" (caps)":""}`),T&&M.push(` accessoryBar: ${T}`),console.log(M.join(`
209
+ `))}async function jt(e){let l=await e.bridge.listSims(),r=e.args.includes("--all"),c=e.args.find((y,T)=>e.args[T-1]==="--bundle"),p=e.args.find((y,T)=>e.args[T-1]==="--app-port"),a=e.args.includes("--primary"),g=l.filter(y=>!(a&&!y.isPrimary||c&&!(y.url??"").includes(c)||p&&!(y.url??"").includes(`/rn/${p}`)||!r&&!c&&!p&&!a&&!(y.url&&(y.url.includes("bundle=")||y.url.includes("/index.bundle")))&&y.id!==e.simId));if(A(e.args)){E(g.map(y=>({...y,active:y.id===e.simId})));return}It(g,e.simId),g.length<l.length&&!A(e.args)&&console.log(` (${l.length-g.length} more hidden \u2014 pass --all to show)`)}function ae(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}function Te(e,l){return l<=0?"?":`${(e/l*100).toFixed(0)}%`}async function Lt(e,l={args:[]}){let r=await gt(e);if(A(l.args)){E(r);return}if(console.log(" memory:"),r.imageLoader){let c=r.imageLoader;console.log(" image-loader cache"),console.log(` entries: ${c.cacheEntries} / ${c.cacheMaxEntries} (${Te(c.cacheEntries,c.cacheMaxEntries)})`),console.log(` pixel bytes: ${ae(c.cachePixelBytes)} / ${ae(c.cachePixelBudget)} (${Te(c.cachePixelBytes,c.cachePixelBudget)})`),console.log(` pending: ${c.pendingFetches} fetches, ${c.pendingBytes} bytes`),console.log(` failed uris: ${c.failedUris}`),console.log(` snapshots: ${c.snapshots}`),console.log(` live frames: ${c.liveFrames}`)}else console.log(" image-loader cache: not available (engine pre-rebuild?)");if(r.workerHeap){let c=r.workerHeap;console.log(" worker heap (chrome only)"),console.log(` used: ${ae(c.usedJSHeapSize)} / ${ae(c.jsHeapSizeLimit)} (${Te(c.usedJSHeapSize,c.jsHeapSizeLimit)})`),console.log(` total: ${ae(c.totalJSHeapSize)}`)}if(r.hostHeap){let c=r.hostHeap;console.log(" host heap (chrome only)"),console.log(` used: ${ae(c.usedJSHeapSize)} / ${ae(c.jsHeapSizeLimit)} (${Te(c.usedJSHeapSize,c.jsHeapSizeLimit)})`),console.log(` total: ${ae(c.totalJSHeapSize)}`)}}var X="<redacted secure text>";function he(e){let l=e?.layout?.spec??e?.spec??null;return!!l?.secureTextEntry&&l.keyboardType!=="visible-password"}function We(e,l){return he(l)?X:e}function qe(e){if(!e||!he(e))return e;let l=e.focusedInput;return!l||typeof l!="object"?e:{...e,focusedInput:{...l,secureTextEntry:!0,text:typeof l.text=="string"?X:l.text}}}function we(e){let l=e.indexOf("--testid");if(l>=0&&e[l+1])return{mode:"testid",value:e[l+1]};let r=e.indexOf("--test-id");if(r>=0&&e[r+1])return{mode:"testid",value:e[r+1]};let c=e.indexOf("--text");return c>=0&&e[c+1]?{mode:"text",value:e[c+1]}:null}async function Me(e,l){let r=JSON.stringify(l.value),c=l.mode==="testid"?`(await t.findByTestId(${r})) || (await t.findById(${r}))`:`await t.findByText(${r})`;return await e.send({type:"evaluate",code:`(async () => {
210
210
  const t = window.__sootsimTest
211
211
  if (!t) return null
212
212
  const n = ${c}
@@ -231,12 +231,12 @@ import{a as vt,b as kt}from"./chunk-CR6DOLUD.js";import{a as Ee,g as ke,j as te}
231
231
  text: ${JSON.stringify(l.mode==="text")} ? ${r} : (n.text ?? n.accessibilityLabel ?? null),
232
232
  type: n.type ?? null,
233
233
  }
234
- })()`})??null}async function Jt(e,l={}){let{nav:r,keyboard:c,shell:p}=await ht(e);if(l.json){console.log(JSON.stringify({shell:p??null,nav:r,keyboard:c},null,2));return}let a=[];if(p){let g=p.activeApp??p.state??"<none>",y=p.showSwitcher?" (app switcher open)":"",T=typeof p.launchProgress=="number"&&p.launchProgress<.98?` launching (${Math.round(p.launchProgress*100)}%)`:"";a.push(`shell: ${g}${y}${T}`)}else a.push("shell: <unavailable>");if(r){let g=r.transitionPhase!=="idle"?` (${r.transitionPhase}, ${r.activeTransitionCount} active)`:"";if(a.push(`nav: phase=${r.transitionPhase}${g}`),r.screens.length===0)a.push(" <no registered screens \u2014 app may not use react-native-screens>");else for(let y of r.screens){let T=y.isActive?"\u25B6":" ",M=y.routeName?` ${y.routeName}`:"",h=y.headerHeight>0?` header=${y.headerHeight}`:"",k=y.largeTitleState&&y.largeTitleState!=="expanded"?` large-title=${y.largeTitleState}`:"";a.push(` ${T} #${y.id}${M}${h}${k}`)}}else a.push("nav: <runtime not available>");if(c&&c.visible){let g=c.spec?.keyboardType??"default",y=c.spec?.returnKeyType??"default";a.push(`keyboard: visible (${g}, return=${y}, mode=${c.mode??"?"})`)}else a.push("keyboard: hidden");console.log(a.join(`
235
- `))}async function Wt(e){let{bridge:l,args:r,positional:c}=e,p=c[1]?Number(c[1])*1e3:3e3,a=r.includes("--strict"),{elapsed:g,settled:y}=await te({bridge:l,maxMs:p,strict:a});console.log(y?` settled in ${g}ms`:` timed out after ${g}ms (may still be animating)`)}async function qt(e){let l=e.positional[1]?Number(e.positional[1]):.5;(!Number.isFinite(l)||l<0)&&(console.error(e.inspectUsage("sleep","[seconds]")),process.exit(1)),await ee(l*1e3),console.log(` slept ${l}s`)}async function Ht(e){let{bridge:l,args:r,positional:c}=e,p=c[1]?Number(c[1]):5,{tree:a}=await ot(l,p);if(A(r)){E({depth:p,tree:a??null});return}console.log(typeof a=="string"?a:JSON.stringify(a,null,2))}async function Kt(e,l={args:[]}){let r=await st(e);if(A(l.args)){E(r);return}console.log(r.url)}async function Ut(e){let{wsPort:l,commandTimeoutMs:r,simId:c,simIdSource:p,positional:a}=e,g=a[1]?Number(a[1]):30,y=Math.max(1e3,(Number.isFinite(g)?g:30)*1e3),T=Math.max(1,Math.ceil(y/500));console.log(" waiting for sim reconnect...");let M=await xt(l,r,c,{attempts:T,simIdSource:p});M||(console.error(" timed out waiting for sim reconnect"),process.exit(1)),M.bridge.close(),ke({source:"inspect wait",step:{wait:y},summary:`wait ${Math.round(y/1e3)}s`}),console.log(` ready: ${M.count} nodes`)}var zt=new Set(["app-launch","toast","keyboard","screen","route","alert","actionsheet","picker","notification","fetch","console","shell","scroll","gesture","text-input","react-commit","animation","reanimated"]);function Ie(e,l){let r=e.indexOf(l);if(r>=0&&r+1<e.length)return e[r+1]}function Ro(e,l){if(!l.filter&&!l.equals)return!0;let r=e.data,c=[];if(r&&typeof r=="object")for(let a of["url","displayUrl","message","name","activeName","path","pathname","title","phase","event","type","kind"]){let g=r[a];typeof g=="string"&&g.length>0&&c.push(g)}let p=c.join(" ");return l.equals?c.some(a=>a===l.equals):l.filter?p.toLowerCase().includes(l.filter.toLowerCase()):!0}async function Gt(e){let{bridge:l,args:r,positional:c,inspectUsage:p}=e,a=c[1];a||(console.error(p("wait event","<kind> [--max-ms 5000] [--filter <substring>] [--equals <exact>] [--since now|cursor]")),process.exit(1)),zt.has(a)||console.error(` warning: '${a}' is not a known timeline kind \u2014 waiting anyway. known: ${[...zt].sort().join(", ")}`);let g=Ie(r,"--max-ms"),y=g&&Number.isFinite(Number(g))?Math.max(100,Number(g)):5e3,T=Ie(r,"--filter"),M=Ie(r,"--equals"),h=Ie(r,"--since")??"now",k=r.includes("--json"),_=Date.now(),I=_+y,P=200,j=_;for(;Date.now()<I;){let z={kinds:[a],since:h==="cursor"?void 0:j,limit:50},B=await l.send({type:"evaluate",code:`(async () => {
234
+ })()`})??null}async function Jt(e,l={}){let{nav:r,keyboard:c,shell:p}=await ft(e);if(l.json){console.log(JSON.stringify({shell:p??null,nav:r,keyboard:c},null,2));return}let a=[];if(p){let g=p.activeApp??p.state??"<none>",y=p.showSwitcher?" (app switcher open)":"",T=typeof p.launchProgress=="number"&&p.launchProgress<.98?` launching (${Math.round(p.launchProgress*100)}%)`:"";a.push(`shell: ${g}${y}${T}`)}else a.push("shell: <unavailable>");if(r){let g=r.transitionPhase!=="idle"?` (${r.transitionPhase}, ${r.activeTransitionCount} active)`:"";if(a.push(`nav: phase=${r.transitionPhase}${g}`),r.screens.length===0)a.push(" <no registered screens \u2014 app may not use react-native-screens>");else for(let y of r.screens){let T=y.isActive?"\u25B6":" ",M=y.routeName?` ${y.routeName}`:"",h=y.headerHeight>0?` header=${y.headerHeight}`:"",k=y.largeTitleState&&y.largeTitleState!=="expanded"?` large-title=${y.largeTitleState}`:"";a.push(` ${T} #${y.id}${M}${h}${k}`)}}else a.push("nav: <runtime not available>");if(c&&c.visible){let g=c.spec?.keyboardType??"default",y=c.spec?.returnKeyType??"default";a.push(`keyboard: visible (${g}, return=${y}, mode=${c.mode??"?"})`)}else a.push("keyboard: hidden");console.log(a.join(`
235
+ `))}async function Wt(e){let{bridge:l,args:r,positional:c}=e,p=c[1]?Number(c[1])*1e3:3e3,a=r.includes("--strict"),{elapsed:g,settled:y}=await te({bridge:l,maxMs:p,strict:a});console.log(y?` settled in ${g}ms`:` timed out after ${g}ms (may still be animating)`)}async function qt(e){let l=e.positional[1]?Number(e.positional[1]):.5;(!Number.isFinite(l)||l<0)&&(console.error(e.inspectUsage("sleep","[seconds]")),process.exit(1)),await ee(l*1e3),console.log(` slept ${l}s`)}async function Ht(e){let{bridge:l,args:r,positional:c}=e,p=c[1]?Number(c[1]):5,{tree:a}=await Qe(l,p);if(A(r)){E({depth:p,tree:a??null});return}console.log(typeof a=="string"?a:JSON.stringify(a,null,2))}async function Kt(e,l={args:[]}){let r=await Ze(e);if(A(l.args)){E(r);return}console.log(r.url)}async function Ut(e){let{wsPort:l,commandTimeoutMs:r,simId:c,simIdSource:p,positional:a}=e,g=a[1]?Number(a[1]):30,y=Math.max(1e3,(Number.isFinite(g)?g:30)*1e3),T=Math.max(1,Math.ceil(y/500));console.log(" waiting for sim reconnect...");let M=await xt(l,r,c,{attempts:T,simIdSource:p});M||(console.error(" timed out waiting for sim reconnect"),process.exit(1)),M.bridge.close(),ke({source:"inspect wait",step:{wait:y},summary:`wait ${Math.round(y/1e3)}s`}),console.log(` ready: ${M.count} nodes`)}var zt=new Set(["app-launch","toast","keyboard","screen","route","alert","actionsheet","picker","notification","fetch","console","shell","scroll","gesture","text-input","react-commit","animation","reanimated"]);function Ie(e,l){let r=e.indexOf(l);if(r>=0&&r+1<e.length)return e[r+1]}function Ro(e,l){if(!l.filter&&!l.equals)return!0;let r=e.data,c=[];if(r&&typeof r=="object")for(let a of["url","displayUrl","message","name","activeName","path","pathname","title","phase","event","type","kind"]){let g=r[a];typeof g=="string"&&g.length>0&&c.push(g)}let p=c.join(" ");return l.equals?c.some(a=>a===l.equals):l.filter?p.toLowerCase().includes(l.filter.toLowerCase()):!0}async function Gt(e){let{bridge:l,args:r,positional:c,inspectUsage:p}=e,a=c[1];a||(console.error(p("wait event","<kind> [--max-ms 5000] [--filter <substring>] [--equals <exact>] [--since now|cursor]")),process.exit(1)),zt.has(a)||console.error(` warning: '${a}' is not a known timeline kind \u2014 waiting anyway. known: ${[...zt].sort().join(", ")}`);let g=Ie(r,"--max-ms"),y=g&&Number.isFinite(Number(g))?Math.max(100,Number(g)):5e3,T=Ie(r,"--filter"),M=Ie(r,"--equals"),h=Ie(r,"--since")??"now",k=r.includes("--json"),_=Date.now(),I=_+y,P=200,j=_;for(;Date.now()<I;){let z={kinds:[a],since:h==="cursor"?void 0:j,limit:50},B=await l.send({type:"evaluate",code:`(async () => {
236
236
  const t = window.SootSim?.bridges?.timeline
237
237
  if (!t) return { ok: false, error: 'timeline bridge missing' }
238
238
  return { ok: true, result: await t.recent(${JSON.stringify(z)}) }
239
- })()`});(!B||!B.ok)&&(console.error(` could not query timeline: ${B&&"error"in B?B.error:"unknown"}`),process.exit(1));let D=B.result.events??[];for(let Q of D)if(Ro(Q,{filter:T,equals:M})){let oe=Date.now()-_;console.log(k?JSON.stringify({found:!0,elapsedMs:oe,event:Q}):` ${a} event after ${oe}ms${T?` (filter: ${T})`:""}${M?` (equals: ${M})`:""}`);return}B.result.watermark&&B.result.watermark>j&&(j=B.result.watermark),await new Promise(Q=>setTimeout(Q,P))}let d=Date.now()-_;k?console.log(JSON.stringify({found:!1,elapsedMs:d,kind:a,filter:T,equals:M})):console.error(` \u26A0 wait event ${a} timed out after ${d}ms${T?` (filter: ${T})`:""}${M?` (equals: ${M})`:""}`),process.exit(1)}async function Yt(e){let{bridge:l,args:r}=e,c=r.includes("--strict"),p=$e(r,3e3),{elapsed:a,settled:g}=await te({bridge:l,maxMs:p,strict:c});g?console.log(` idle in ${a}ms`):(console.error(` \u26A0 wait idle timed out after ${a}ms (may still be animating)`),process.exit(1))}async function Xt(e){let{bridge:l,args:r}=e,c=$e(r,2e4),{ready:p,elapsedMs:a,nodes:g,targets:y,flag:T,loadingText:M,externalReady:h,externalError:k,errors:_}=await ct(l,c,{onProgress(P){console.error(` still waiting after ${P.elapsedMs}ms \u2014 ${De(P)} (nodes: ${P.nodes}, targets: ${P.targets}, errors: ${P.errors})`)}});if(p){let P=c-a,j=Math.max(100,Math.min(1e4,P)),d=await te({bridge:l,maxMs:j,pollMs:32,stablePolls:2});d.settled||(console.error(` \u26A0 wait ready timed out after ${a+d.elapsed}ms \u2014 app mounted but did not settle (nodes: ${g}, targets: ${y})`),process.exit(1)),console.log(` ready in ${a+d.elapsed}ms: ${g} nodes, ${y} targets`);return}let I=De({externalError:k,loadingText:M,externalReady:h,flag:T,targets:y});console.error(` \u26A0 wait ready timed out after ${a}ms \u2014 ${I} (nodes: ${g}, targets: ${y}, errors: ${_})`),process.exit(1)}async function Vt(e){let{bridge:l,args:r,positional:c,inspectUsage:p}=e,a=c[1];a||(console.error(p("wait selector","<testid> [--max-ms 5000] [--gone]")),process.exit(1));let g=r.indexOf("--max-ms"),y=g>=0&&r[g+1]?Math.max(100,Number(r[g+1])):5e3,T=r.includes("--gone"),{found:M,node:h,elapsed:k}=await dt(l,a,y,{gone:T});if(T){M?console.log(` #${a} gone after ${k}ms`):(console.error(` \u26A0 wait selector #${a} --gone timed out after ${k??y}ms (still present)`),process.exit(1));return}if(M&&h){let _=h.absolutePosition?`@(${Math.round(h.absolutePosition.x)},${Math.round(h.absolutePosition.y)})`:"",I=h.layout?`${Math.round(h.layout.width)}x${Math.round(h.layout.height)}`:"?x?";console.log(` found #${a} in ${k}ms ${I} ${_}`)}else console.error(` \u26A0 wait selector #${a} timed out after ${k??y}ms`),process.exit(1)}function io(e){return e==null?"\u2014":e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}K`:`${(e/1024/1024).toFixed(1)}M`}function ao(e){return e==null?" \u2026":e<1e3?`${e}ms`.padStart(5):`${(e/1e3).toFixed(2)}s`.padStart(5)}function Qt(){process.stderr.write(` the sim is not responding. recover it with:
239
+ })()`});(!B||!B.ok)&&(console.error(` could not query timeline: ${B&&"error"in B?B.error:"unknown"}`),process.exit(1));let D=B.result.events??[];for(let Q of D)if(Ro(Q,{filter:T,equals:M})){let oe=Date.now()-_;console.log(k?JSON.stringify({found:!0,elapsedMs:oe,event:Q}):` ${a} event after ${oe}ms${T?` (filter: ${T})`:""}${M?` (equals: ${M})`:""}`);return}B.result.watermark&&B.result.watermark>j&&(j=B.result.watermark),await new Promise(Q=>setTimeout(Q,P))}let d=Date.now()-_;k?console.log(JSON.stringify({found:!1,elapsedMs:d,kind:a,filter:T,equals:M})):console.error(` \u26A0 wait event ${a} timed out after ${d}ms${T?` (filter: ${T})`:""}${M?` (equals: ${M})`:""}`),process.exit(1)}async function Yt(e){let{bridge:l,args:r}=e,c=r.includes("--strict"),p=$e(r,3e3),{elapsed:a,settled:g}=await te({bridge:l,maxMs:p,strict:c});g?console.log(` idle in ${a}ms`):(console.error(` \u26A0 wait idle timed out after ${a}ms (may still be animating)`),process.exit(1))}async function Xt(e){let{bridge:l,args:r}=e,c=$e(r,2e4),{ready:p,elapsedMs:a,nodes:g,targets:y,flag:T,loadingText:M,externalReady:h,externalError:k,errors:_}=await rt(l,c,{onProgress(P){console.error(` still waiting after ${P.elapsedMs}ms \u2014 ${Re(P)} (nodes: ${P.nodes}, targets: ${P.targets}, errors: ${P.errors})`)}});if(p){let P=c-a,j=Math.max(100,Math.min(1e4,P)),d=await te({bridge:l,maxMs:j,pollMs:32,stablePolls:2});d.settled||(console.error(` \u26A0 wait ready timed out after ${a+d.elapsed}ms \u2014 app mounted but did not settle (nodes: ${g}, targets: ${y})`),process.exit(1)),console.log(` ready in ${a+d.elapsed}ms: ${g} nodes, ${y} targets`);return}let I=Re({externalError:k,loadingText:M,externalReady:h,flag:T,targets:y});console.error(` \u26A0 wait ready timed out after ${a}ms \u2014 ${I} (nodes: ${g}, targets: ${y}, errors: ${_})`),process.exit(1)}async function Vt(e){let{bridge:l,args:r,positional:c,inspectUsage:p}=e,a=c[1];a||(console.error(p("wait selector","<testid> [--max-ms 5000] [--gone]")),process.exit(1));let g=r.indexOf("--max-ms"),y=g>=0&&r[g+1]?Math.max(100,Number(r[g+1])):5e3,T=r.includes("--gone"),{found:M,node:h,elapsed:k}=await it(l,a,y,{gone:T});if(T){M?console.log(` #${a} gone after ${k}ms`):(console.error(` \u26A0 wait selector #${a} --gone timed out after ${k??y}ms (still present)`),process.exit(1));return}if(M&&h){let _=h.absolutePosition?`@(${Math.round(h.absolutePosition.x)},${Math.round(h.absolutePosition.y)})`:"",I=h.layout?`${Math.round(h.layout.width)}x${Math.round(h.layout.height)}`:"?x?";console.log(` found #${a} in ${k}ms ${I} ${_}`)}else console.error(` \u26A0 wait selector #${a} timed out after ${k??y}ms`),process.exit(1)}function io(e){return e==null?"\u2014":e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}K`:`${(e/1024/1024).toFixed(1)}M`}function ao(e){return e==null?" \u2026":e<1e3?`${e}ms`.padStart(5):`${(e/1e3).toFixed(2)}s`.padStart(5)}function Qt(){process.stderr.write(` the sim is not responding. recover it with:
240
240
  sootsim close --sim <id> # force-close the wedged sim
241
241
  sootsim list # confirm it's gone
242
242
  `)}async function Co(e){try{return await e.send({type:"evaluate",code:"1"},{timeoutMs:3e3}),!0}catch{return!1}}async function Bo(e,l){try{let r=await e.send({type:"evaluate",code:`(async () => {
@@ -312,15 +312,15 @@ import{a as vt,b as kt}from"./chunk-CR6DOLUD.js";import{a as Ee,g as ke,j as te}
312
312
  })()`}):e.send({type:"evaluate",code:`(async () => {
313
313
  window.dispatchEvent(new CustomEvent(${JSON.stringify(l==="lock"?"sootsim:toggleLock":"sootsim:shake")}))
314
314
  return { ok: true, action: ${JSON.stringify(l)} }
315
- })()`})}function Go(e){let l={Enter:"return",NumpadEnter:"return",Backspace:"delete",Delete:"delete",Space:"space",ShiftLeft:"shift",ShiftRight:"shift"};if(l[e])return l[e];let r=e.match(/^Digit([0-9])$/);if(r)return r[1];let c=e.match(/^Key([A-Z])$/);return c?c[1].toLowerCase():null}function Yo(e){if(typeof e!="string")return null;let l=e.replace(/\s+/g," ").trim();return l?l.slice(0,80):null}function lo(...e){for(let l of e){if(typeof l!="string")continue;let r=l.trim();if(r)return r}return null}function Xo(e){let l=e.indexOf("--node-id");if(l<0)return null;let r=e[l+1];if(!r)return null;let c=Number(r);return Number.isInteger(c)&&c>0?c:null}async function L(e,l,r){let c=ke({source:e,step:l,summary:r});c.active&&(c.replaced?console.error(` draft: replaced unkept action "${c.replaced.summary}" \u2014 \`flow keep\` commits one action at a time`):console.error(" draft: action pending \u2014 `sootsim flow keep` to commit"))}function ro(e,l,r){if(!r||r.hit===!1)return null;let c=lo(r.responderTestID,r.testID);if(c)return{step:{tapOn:{id:c}},summary:`tap #${c}`};let p=Yo(r.text);return p?{step:{tapOn:p},summary:`tap "${p}"`}:{step:{tapAtCoords:{x:e,y:l}},summary:`tap @${Math.round(e)},${Math.round(l)}`}}function Ke(e,l,r){let c=lo(l?.testID,l?.id);return c?{step:{tapOn:{id:c}},summary:`tap #${c}`}:r==="id"?{step:{tapOn:{id:e}},summary:`tap #${e}`}:{step:{tapOn:e},summary:`tap "${e}"`}}async function Jn(e,l){let r=e[0]==="get"||e[0]==="do"||e[0]==="debug"||e[0]==="wait"?e[0]:null,c=r?e.slice(1):e,p=Xe(c,{port:l.port,commandTimeoutMs:l.timeoutMs,stripBooleanFlags:["--verbose","-v","--help","-h","--clear-state","--json","--all","--watch","-w","--strict","--no-wait","--dump","--failed","--slow","--tail","-f","--interactive-targets","--actions","--internal","--compact","--no-xy","--no-clipped","--include-occluded"],stripValueFlags:["--output","--nth","--index","--testid","--test-id","--text","--node-id","--max-ms","--filter","--limit","--level","--threshold","--equals","--since","--testid-like","--only","--subtree"]}),a=p.positional,g=a[0],y=r==="get"||r==="do"||r==="debug"||r==="wait"?r:"inspect",T=typeof c[0]=="string"&&ze.has(c[0]),M=T?c[0]:null,h=o=>T&&o===c[0]?`sootsim ${o}`:`sootsim ${y} ${o}`,k=(o,t)=>` usage: ${h(o)}${t?` ${t}`:""}`;if(!g||e.includes("--help")||e.includes("-h")){let o={bridgePort:7668,defaultShellUrl:Ge};if(y==="do"||y==="get"||y==="debug"||y==="wait"){let n=_e(y,o);n&&(console.log(`${n}
315
+ })()`})}function Go(e){let l={Enter:"return",NumpadEnter:"return",Backspace:"delete",Delete:"delete",Space:"space",ShiftLeft:"shift",ShiftRight:"shift"};if(l[e])return l[e];let r=e.match(/^Digit([0-9])$/);if(r)return r[1];let c=e.match(/^Key([A-Z])$/);return c?c[1].toLowerCase():null}function Yo(e){if(typeof e!="string")return null;let l=e.replace(/\s+/g," ").trim();return l?l.slice(0,80):null}function lo(...e){for(let l of e){if(typeof l!="string")continue;let r=l.trim();if(r)return r}return null}function Xo(e){let l=e.indexOf("--node-id");if(l<0)return null;let r=e[l+1];if(!r)return null;let c=Number(r);return Number.isInteger(c)&&c>0?c:null}async function L(e,l,r){let c=ke({source:e,step:l,summary:r});c.active&&(c.replaced?console.error(` draft: replaced unkept action "${c.replaced.summary}" \u2014 \`flow keep\` commits one action at a time`):console.error(" draft: action pending \u2014 `sootsim flow keep` to commit"))}function ro(e,l,r){if(!r||r.hit===!1)return null;let c=lo(r.responderTestID,r.testID);if(c)return{step:{tapOn:{id:c}},summary:`tap #${c}`};let p=Yo(r.text);return p?{step:{tapOn:p},summary:`tap "${p}"`}:{step:{tapAtCoords:{x:e,y:l}},summary:`tap @${Math.round(e)},${Math.round(l)}`}}function Ke(e,l,r){let c=lo(l?.testID,l?.id);return c?{step:{tapOn:{id:c}},summary:`tap #${c}`}:r==="id"?{step:{tapOn:{id:e}},summary:`tap #${e}`}:{step:{tapOn:e},summary:`tap "${e}"`}}async function Jn(e,l){let r=e[0]==="get"||e[0]==="do"||e[0]==="debug"||e[0]==="wait"?e[0]:null,c=r?e.slice(1):e,p=yt(c,{port:l.port,commandTimeoutMs:l.timeoutMs,stripBooleanFlags:["--verbose","-v","--help","-h","--clear-state","--json","--all","--watch","-w","--strict","--no-wait","--dump","--failed","--slow","--tail","-f","--interactive-targets","--actions","--internal","--compact","--no-xy","--no-clipped","--include-occluded"],stripValueFlags:["--output","--nth","--index","--testid","--test-id","--text","--node-id","--max-ms","--filter","--limit","--level","--threshold","--equals","--since","--testid-like","--only","--subtree"]}),a=p.positional,g=a[0],y=r==="get"||r==="do"||r==="debug"||r==="wait"?r:"inspect",T=typeof c[0]=="string"&&ze.has(c[0]),M=T?c[0]:null,h=o=>T&&o===c[0]?`sootsim ${o}`:`sootsim ${y} ${o}`,k=(o,t)=>` usage: ${h(o)}${t?` ${t}`:""}`;if(!g||e.includes("--help")||e.includes("-h")){let o={bridgePort:7668,defaultShellUrl:Ge};if(y==="do"||y==="get"||y==="debug"||y==="wait"){let n=_e(y,o);n&&(console.log(`${n}
316
316
  `),process.exit(0))}if(M==="shell"){let n=Oe("shell",o);n&&(console.log(`${n}
317
317
  `),process.exit(0))}let t=Oe("inspect",o),s=["do","get","debug","wait"].map(n=>_e(n,o)).filter(n=>n!=null).join(`
318
318
 
319
319
  `);console.log(`${t??""}
320
320
 
321
321
  ${s}
322
- `),process.exit(0)}let _=p.wsPort,I=p.simId,P=p.simIdSource,j=p.commandTimeoutMs;if(g==="list"&&c.some(o=>o==="--drivers"||o==="-D")){let{buildDriverListRows:o}=await import("./drivers-V6QDFZQD.js"),t=o();console.log(` available drivers (${t.length}):
323
- `);let s=Math.max(...t.map(i=>i.id.length),6),n=Math.max(...t.map(i=>i.kind.length),4);for(let i of t){let u=i.available?"\u2713":"\u2717",m=i.id.padEnd(s),b=i.kind.padEnd(n);console.log(` ${u} ${m} ${b} ${i.description}`),i.available&&i.detail?console.log(` ${i.detail}`):!i.available&&i.reason&&console.log(` unavailable: ${i.reason}`)}return}let d=Ve(p),z=I||"default",B=new Set(["errors","warnings","requests","js","eval","reload","globals","perf","storage-clear","list","wait","sleep"]),D=200;function Q(o){let t=o.replace(/\s+/g," ").trim();if(!t)return"";if(/^<(!doctype html|html|\?xml)|<body[\s>]/i.test(t)){let n=/<title[^>]*>([^<]+)<\/title>/i.exec(o)?.[1]?.trim(),i=/<body[^>]*>([\s\S]*?)<\//i.exec(o)?.[1]?.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().slice(0,80),u=n||i||"html error page";return`<html ${o.length}B> "${u}" (body elided \u2014 add --json for the full payload)`}return t.length<=D?t:`${t.slice(0,D)}\u2026 (+${t.length-D} more bytes)`}function oe(o){let t=o.displayUrl||o.url;return o.status!=null?`${o.method} ${t} -> ${o.status}${o.statusText?` ${o.statusText}`:""}`:o.error?`${o.method} ${t} -> ${o.error}`:`${o.method} ${t}`}async function S(o){let t=me()?5e3:1500;try{let{settled:s,elapsed:n}=await te({bridge:o,maxMs:t,pollMs:32,stablePolls:2});s||process.stderr.write(` \u26A0 auto-wait timed out after ${n??t}ms \u2014 next command may see mid-animation state. use \`sootsim do settle\` for a longer wait.
322
+ `),process.exit(0)}let _=p.wsPort,I=p.simId,P=p.simIdSource,j=p.commandTimeoutMs;if(g==="list"&&c.some(o=>o==="--drivers"||o==="-D")){let{buildDriverListRows:o}=await import("./drivers-BPPG22VP.js"),t=o();console.log(` available drivers (${t.length}):
323
+ `);let s=Math.max(...t.map(i=>i.id.length),6),n=Math.max(...t.map(i=>i.kind.length),4);for(let i of t){let u=i.available?"\u2713":"\u2717",m=i.id.padEnd(s),b=i.kind.padEnd(n);console.log(` ${u} ${m} ${b} ${i.description}`),i.available&&i.detail?console.log(` ${i.detail}`):!i.available&&i.reason&&console.log(` unavailable: ${i.reason}`)}return}let d=bt(p),z=I||"default",B=new Set(["errors","warnings","requests","js","eval","reload","globals","perf","storage-clear","list","wait","sleep"]),D=200;function Q(o){let t=o.replace(/\s+/g," ").trim();if(!t)return"";if(/^<(!doctype html|html|\?xml)|<body[\s>]/i.test(t)){let n=/<title[^>]*>([^<]+)<\/title>/i.exec(o)?.[1]?.trim(),i=/<body[^>]*>([\s\S]*?)<\//i.exec(o)?.[1]?.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().slice(0,80),u=n||i||"html error page";return`<html ${o.length}B> "${u}" (body elided \u2014 add --json for the full payload)`}return t.length<=D?t:`${t.slice(0,D)}\u2026 (+${t.length-D} more bytes)`}function oe(o){let t=o.displayUrl||o.url;return o.status!=null?`${o.method} ${t} -> ${o.status}${o.statusText?` ${o.statusText}`:""}`:o.error?`${o.method} ${t} -> ${o.error}`:`${o.method} ${t}`}async function S(o){let t=me()?5e3:1500;try{let{settled:s,elapsed:n}=await te({bridge:o,maxMs:t,pollMs:32,stablePolls:2});s||process.stderr.write(` \u26A0 auto-wait timed out after ${n??t}ms \u2014 next command may see mid-animation state. use \`sootsim do settle\` for a longer wait.
324
324
  `)}catch{}}function N(o,t){console.error(` tap failed: ${o} stayed visible but did not receive a hittable press after ${t.attempts} attempt${t.attempts===1?"":"s"}`),t.result&&console.error(` last result: ${JSON.stringify(t.result)}`)}async function J(){try{return await d.send({type:"evaluate",code:`(() => ({
325
325
  console: ${Se},
326
326
  requests: window.__sootsimTest?.getRequestCounts?.() || null,
@@ -330,7 +330,7 @@ ${s}
330
330
  `);for(let i of n){let u=ie(i.timestamp);console.log(` [${u}] ${oe(i)}`),i.responseBody?console.log(` ${Q(i.responseBody)}`):i.error&&console.log(` ${i.error}`)}}}async function V(o={}){let t=o.counts!==void 0?o.counts:await d.send({type:"evaluate",code:Se});if(!t||typeof t!="object")return;let s=t,n=Math.max(0,Number(s.errors)||0),i=Math.max(0,Number(s.warnings)||0);if(n===0&&i===0||!o.includeTail&&!je("console",z,`${n}:${i}`))return;let u=[];if(n>0&&u.push(`${n} console error${n===1?"":"s"}`),i>0&&u.push(`${i} console warning${i===1?"":"s"}`),console.log(`
331
331
  console: ${u.join(", ")}`),console.log(` inspect: ${h("errors")} 5`),i>0&&console.log(` inspect: ${h("warnings")} 5`),!o.includeTail||n===0)return;let m=await fe(d,5);if(!(!Array.isArray(m)||m.length===0)){console.log(`
332
332
  recent console errors:
333
- `);for(let b of m){let f=ie(b.timestamp),w=Array.isArray(b.args)?b.args.map(O=>typeof O=="object"?JSON.stringify(O):String(O)).join(" "):String(b);console.log(` [${f}] ${w}`)}}}let Z=["console","fetch","toast","alert","notification","screen","app-launch","keyboard","route","actionsheet","picker","shell","scroll","gesture","text-input","animation","reanimated"];async function re(o){let t=Ye(),s=null;try{s=await Ze(o,`(() => {
333
+ `);for(let b of m){let f=ie(b.timestamp),w=Array.isArray(b.args)?b.args.map(O=>typeof O=="object"?JSON.stringify(O):String(O)).join(" "):String(b);console.log(` [${f}] ${w}`)}}}let Z=["console","fetch","toast","alert","notification","screen","app-launch","keyboard","route","actionsheet","picker","shell","scroll","gesture","text-input","animation","reanimated"];async function re(o){let t=Ye(),s=null;try{s=await wt(o,`(() => {
334
334
  const tl = window.SootSim && window.SootSim.bridges && window.SootSim.bridges.timeline
335
335
  if (!tl || typeof tl.summary !== 'function') return null
336
336
  const cursorKey = ${JSON.stringify(t)}
@@ -347,7 +347,7 @@ ${s}
347
347
  }
348
348
  return summary ? { summary, consoleSplit } : null
349
349
  })()`)}catch{return}if(!s||!s.summary||!s.summary.total)return;let n=s.summary.byKind??{},i=[],u=new Set;for(let m of Z){let b=n[m];if(b)if(u.add(m),m==="console"&&s.consoleSplit){let{error:f,warn:w}=s.consoleSplit;f>0&&i.push(`${f} error${f===1?"":"s"}`),w>0&&i.push(`${w} warning${w===1?"":"s"}`)}else i.push(`${b} ${m}${b===1?"":"s"}`)}for(let[m,b]of Object.entries(n))!u.has(m)&&b&&i.push(`${b} ${m}${b===1?"":"s"}`);if(i.length!==0&&(console.log(`
350
- since last: ${i.join(" \xB7 ")} \u2014 sootsim what-happened`),s.summary.lastAt))try{await Ae(o,"SootSim.bridges.timeline.cursorAdvance",t,s.summary.lastAt)}catch{}}let pe=new Set(["tap","double-tap","tap-text","tap-id","type","type-into","key","key-sequence","keycode","drag","swipe","long-press","touch","gesture","pinch","scroll","shell","storage-clear"]),C=new Set(["a11y","capture","count","double-tap","drag","find","gesture","layout","long-press","node","pinch","sample-color","scroll","screenshot","swipe","tap","tap-id","tap-text","touch","tree","type-into"]),le=(e.includes("--verbose")||e.includes("-v"))&&!e.includes("--json");y==="do"&&g==="shell"&&(console.error(" `sootsim do shell` was removed. use `sootsim shell ...` instead."),process.exit(1)),pe.has(g)&&await Qe(d),C.has(g)&&await de(d,{verbose:le});try{switch(g){case"list":{await jt({bridge:d,simId:I,args:c});break}case"tree":{await Ht({bridge:d,args:c,positional:a});break}case"a11y":{let o=await at(d);if(!Array.isArray(o)||o.length===0){console.log(" no accessible nodes found");break}if(e.includes("--json"))console.log(JSON.stringify(o,null,2));else{console.log(` accessibility tree (${o.length} nodes):
350
+ since last: ${i.join(" \xB7 ")} \u2014 sootsim what-happened`),s.summary.lastAt))try{await Ce(o,"SootSim.bridges.timeline.cursorAdvance",t,s.summary.lastAt)}catch{}}let pe=new Set(["tap","double-tap","tap-text","tap-id","type","type-into","key","key-sequence","keycode","drag","swipe","long-press","touch","gesture","pinch","scroll","shell","storage-clear"]),C=new Set(["a11y","capture","count","double-tap","drag","find","gesture","layout","long-press","node","pinch","sample-color","scroll","screenshot","swipe","tap","tap-id","tap-text","touch","tree","type-into"]),le=(e.includes("--verbose")||e.includes("-v"))&&!e.includes("--json");y==="do"&&g==="shell"&&(console.error(" `sootsim do shell` was removed. use `sootsim shell ...` instead."),process.exit(1)),pe.has(g)&&await ht(d),C.has(g)&&await de(d,{verbose:le});try{switch(g){case"list":{await jt({bridge:d,simId:I,args:c});break}case"tree":{await Ht({bridge:d,args:c,positional:a});break}case"a11y":{let o=await st(d);if(!Array.isArray(o)||o.length===0){console.log(" no accessible nodes found");break}if(e.includes("--json"))console.log(JSON.stringify(o,null,2));else{console.log(` accessibility tree (${o.length} nodes):
351
351
  `);for(let t of o){let s=[];if(s.push(`[${t.role}]`),t.label){let n=t.label.length>50?t.label.slice(0,47)+"...":t.label;s.push(`"${n}"`)}if(t.hint&&s.push(`(hint: "${t.hint}")`),t.testID&&s.push(`#${t.testID}`),t.state){let n=[];t.state.disabled&&n.push("disabled"),t.state.selected&&n.push("selected"),t.state.checked===!0&&n.push("checked"),t.state.checked==="mixed"&&n.push("mixed"),t.state.busy&&n.push("busy"),t.state.expanded===!0&&n.push("expanded"),t.state.expanded===!1&&n.push("collapsed"),n.length&&s.push(`{${n.join(", ")}}`)}t.position&&s.push(`@(${t.position.x},${t.position.y})`),t.size&&s.push(`${t.size.w}x${t.size.h}`),console.log(" "+s.join(" "))}}break}case"find":{await Dt({bridge:d,args:e,effectiveArgs:c,positional:a,inspectUsage:k});break}case"count":{await Pt(d,{args:c});break}case"keyboard":{await Bt(d,{json:e.includes("--json")});break}case"screens":{await Jt(d,{json:e.includes("--json")});break}case"memory":{await Lt(d,{args:c});break}case"wait":{await Ut({wsPort:_,commandTimeoutMs:j,simId:I,simIdSource:P,positional:a});break}case"sleep":{await qt({positional:a,inspectUsage:k});break}case"settle":{await Wt({bridge:d,args:e,positional:a});break}case"ready":{await Xt({bridge:d,args:e});break}case"idle":{await Yt({bridge:d,args:e,positional:a});break}case"selector":{await Vt({bridge:d,args:e,positional:a,inspectUsage:k});break}case"event":{await Gt({bridge:d,args:e,positional:a,inspectUsage:k});break}case"layout":{let o=a[1];if(!o){await Ct({bridge:d,args:c});break}let t=await d.send({type:"evaluate",code:`(async () => await window.__sootsimTest.getLayout(${JSON.stringify(o)}))()`});console.log(JSON.stringify(t,null,2));break}case"capture":case"screenshot":{let t=e.find((b,f)=>e[f-1]==="--output")||"/tmp/sootsim-inspect.png",s=await so(e,d),n={type:"screenshot"};s&&(n.crop=s);let u=(await d.send(n)).replace(/^data:image\/png;base64,/,"");s&&console.log(` area: x=${s.x} y=${s.y} w=${s.w} h=${s.h}`),(await import("fs")).writeFileSync(t,Buffer.from(u,"base64")),console.log(` saved: ${t}`);break}case"sample-color":{let o=await so(e,d);o||(console.error(k("sample-color","<x> <y> [w] [h] | --id <testID> | --text <text>")),console.error(" samples an averaged color from the canvas. coords are logical sootsim units."),process.exit(1));let t=await d.send({type:"evaluate",code:kt(o)});if(e.includes("--json"))console.log(JSON.stringify(t,null,2));else{let{r:s,g:n,b:i,a:u,hex:m,samples:b}=t,f=o.w===1&&o.h===1?`@(${o.x},${o.y})`:`@(${o.x},${o.y}) ${o.w}x${o.h}`;console.log(` ${m} rgba(${s}, ${n}, ${i}, ${u}) ${f} ${b} samples`)}break}case"node":{let o=a[1];o||(console.error(k("node","<matcher>")),console.error(" resolves testID, id, then text \u2014 dumps full node info as JSON"),process.exit(1));let t=await d.send({type:"evaluate",code:`(async () => {
352
352
  const t = window.__sootsimTest
353
353
  const q = ${JSON.stringify(o)}
@@ -504,7 +504,7 @@ ${s}
504
504
  ${h("state")} scroll feed
505
505
  ${h("state")} scroll-hit 360 420
506
506
  ${h("state")} hit 200 720
507
- `);break}let t;switch(o){case"shell":t=await ce(d,500);break;case"worker":t=await Ae(d,"__sootsimRenderHost.queryStats");break;case"ownership":t=await d.send({type:"evaluate",code:`(() => {
507
+ `);break}let t;switch(o){case"shell":t=await ce(d,500);break;case"worker":t=await Ce(d,"__sootsimRenderHost.queryStats");break;case"ownership":t=await d.send({type:"evaluate",code:`(() => {
508
508
  const h = window.__sootsimRenderHost
509
509
  if (!h || typeof h.getOwnershipSnapshot !== 'function') {
510
510
  return { error: 'getOwnershipSnapshot not available' }
@@ -562,7 +562,7 @@ ${s}
562
562
  ${h("shell")} open-card clock 800
563
563
  ${h("shell")} appearance dark
564
564
  ${h("shell")} lock
565
- `);break}let t=o==="launch"||o==="open-card"||o==="home"||o==="switcher",s=o==="launch"||o==="open-card"?a[3]:a[2],n=s?Number(s):350;t&&(!Number.isFinite(n)||n<0)&&(console.error(k("shell",o==="launch"||o==="open-card"?"<launch|open-card> <appId> [settleMs]":"<home|switcher> [settleMs]")),process.exit(1));let i=!1,u=!1,m=null,b=e.includes("--clear-state");if(o==="launch"){let f=a[2];f||(console.error(k("shell","launch <appId> [settleMs] [--clear-state]")),process.exit(1)),b&&await d.send({type:"evaluate",code:Ee(!0)}),i=!!await ge(d,"launchApp",n,f),{settled:u,state:m}=await Ne(d,Math.round(n),w=>!!w&&w.state==="app"&&w.activeApp===f&&w.showSwitcher===!1&&w.switcherPhase==="idle"&&typeof w.launchProgress=="number"&&w.launchProgress>=.98),i&&await L("inspect shell launch",b?{launchApp:{clearState:!0}}:{launchApp:{}},b?"launch app (clear state)":"launch app")}else if(o==="home")i=!!await ge(d,"goHome",n),{settled:u,state:m}=await Ne(d,Math.round(n),f=>!!f&&f.state==="home"&&f.activeApp==null&&f.showSwitcher===!1&&f.switcherPhase==="idle"&&typeof f.launchProgress=="number"&&f.launchProgress>=.98);else if(o==="switcher")i=!!await ge(d,"openSwitcher",n),{settled:u,state:m}=await Ne(d,Math.round(n),f=>!!f&&f.state==="app"&&f.showSwitcher===!0&&f.switcherPhase==="idle"&&typeof f.zoomLevel=="number"&&Math.abs(f.zoomLevel)<=.02&&typeof f.horizontalZoom=="number"&&Math.abs(f.horizontalZoom)<=.02),u&&(await ee(Ko),m=await ce(d));else if(o==="open-card"){let f=a[2];f||(console.error(k("shell","open-card <appId> [settleMs]")),process.exit(1)),i=!!await ge(d,"openSwitcherCard",n,f),{settled:u,state:m}=await Ne(d,Math.round(n),w=>!!w&&w.state==="app"&&w.activeApp===f&&w.showSwitcher===!1&&w.switcherPhase==="idle"&&typeof w.zoomLevel=="number"&&w.zoomLevel>=.98&&typeof w.horizontalZoom=="number"&&w.horizontalZoom>=.98),i&&await L("inspect shell open-card",{openSwitcherCard:{appId:f}},`open switcher card ${f}`)}else if(o==="appearance"){let f=a[2];(!f||!["light","dark","auto","toggle"].includes(f))&&(console.error(k("shell","appearance <light|dark|auto|toggle>")),process.exit(1));let w=await no(d,"appearance",f);if(i=!!w?.ok,m={appearance:w},i){let O=w?.applied??f;console.log(` appearance: ${O}`)}}else if(o==="lock"||o==="shake"){let f=await no(d,o);i=!!f?.ok,m={[o]:f}}else console.error(` unknown shell subcommand: ${o}`),process.exit(1);console.log(JSON.stringify({ok:i,settled:u,state:m},null,2));break}case"url":{await Kt(d,{args:c});break}case"reload":{let s=!1,n=!1;try{await d.send({type:"evaluate",code:"window.__sootsimConsole?.clear()"});let m=await d.send({type:"evaluate",code:`;(() => {
565
+ `);break}let t=o==="launch"||o==="open-card"||o==="home"||o==="switcher",s=o==="launch"||o==="open-card"?a[3]:a[2],n=s?Number(s):350;t&&(!Number.isFinite(n)||n<0)&&(console.error(k("shell",o==="launch"||o==="open-card"?"<launch|open-card> <appId> [settleMs]":"<home|switcher> [settleMs]")),process.exit(1));let i=!1,u=!1,m=null,b=e.includes("--clear-state");if(o==="launch"){let f=a[2];f||(console.error(k("shell","launch <appId> [settleMs] [--clear-state]")),process.exit(1)),b&&await d.send({type:"evaluate",code:Ae(!0)}),i=!!await ge(d,"launchApp",n,f),{settled:u,state:m}=await Ne(d,Math.round(n),w=>!!w&&w.state==="app"&&w.activeApp===f&&w.showSwitcher===!1&&w.switcherPhase==="idle"&&typeof w.launchProgress=="number"&&w.launchProgress>=.98),i&&await L("inspect shell launch",b?{launchApp:{clearState:!0}}:{launchApp:{}},b?"launch app (clear state)":"launch app")}else if(o==="home")i=!!await ge(d,"goHome",n),{settled:u,state:m}=await Ne(d,Math.round(n),f=>!!f&&f.state==="home"&&f.activeApp==null&&f.showSwitcher===!1&&f.switcherPhase==="idle"&&typeof f.launchProgress=="number"&&f.launchProgress>=.98);else if(o==="switcher")i=!!await ge(d,"openSwitcher",n),{settled:u,state:m}=await Ne(d,Math.round(n),f=>!!f&&f.state==="app"&&f.showSwitcher===!0&&f.switcherPhase==="idle"&&typeof f.zoomLevel=="number"&&Math.abs(f.zoomLevel)<=.02&&typeof f.horizontalZoom=="number"&&Math.abs(f.horizontalZoom)<=.02),u&&(await ee(Ko),m=await ce(d));else if(o==="open-card"){let f=a[2];f||(console.error(k("shell","open-card <appId> [settleMs]")),process.exit(1)),i=!!await ge(d,"openSwitcherCard",n,f),{settled:u,state:m}=await Ne(d,Math.round(n),w=>!!w&&w.state==="app"&&w.activeApp===f&&w.showSwitcher===!1&&w.switcherPhase==="idle"&&typeof w.zoomLevel=="number"&&w.zoomLevel>=.98&&typeof w.horizontalZoom=="number"&&w.horizontalZoom>=.98),i&&await L("inspect shell open-card",{openSwitcherCard:{appId:f}},`open switcher card ${f}`)}else if(o==="appearance"){let f=a[2];(!f||!["light","dark","auto","toggle"].includes(f))&&(console.error(k("shell","appearance <light|dark|auto|toggle>")),process.exit(1));let w=await no(d,"appearance",f);if(i=!!w?.ok,m={appearance:w},i){let O=w?.applied??f;console.log(` appearance: ${O}`)}}else if(o==="lock"||o==="shake"){let f=await no(d,o);i=!!f?.ok,m={[o]:f}}else console.error(` unknown shell subcommand: ${o}`),process.exit(1);console.log(JSON.stringify({ok:i,settled:u,state:m},null,2));break}case"url":{await Kt(d,{args:c});break}case"reload":{let s=!1,n=!1;try{await d.send({type:"evaluate",code:"window.__sootsimConsole?.clear()"});let m=await d.send({type:"evaluate",code:`;(() => {
566
566
  const reloadExternalApp = window.SootSim?.bridges?.hotRemount?.reloadExternalApp
567
567
  if (typeof reloadExternalApp === 'function') {
568
568
  reloadExternalApp()
@@ -573,7 +573,7 @@ ${s}
573
573
  })()`});n=!!m&&m.kind==="external-app",s=!0}catch{}console.log(" reloading...");let i=d,u=null;if(n)u=await ve(d,{timeoutMs:1e4,errorGraceMs:3e3});else{s&&await ee(300);let m=await $t(_,j,I,{timeoutMs:1e4,simIdSource:P});m?(i=m,u=await ve(m,{timeoutMs:1e4,errorGraceMs:3e3})):(console.log(" \u26A0 reload: bridge never reconnected within 10000ms"),i=null)}if(u)if(u.ready){let m=u.source==="nodes-fallback"?" (no ready signal, node-count fallback)":"";console.log(` ready in ${u.elapsedMs}ms: ${u.nodes} nodes${m}`)}else if(u.source==="error-bail")console.log(` \u26A0 reload bailed after ${u.elapsedMs}ms: ${u.errors} console error(s), ready signal never fired`);else{let m=Zt(u);console.log(` \u26A0 reload timed out after ${u.elapsedMs}ms \u2014 ${m} (nodes: ${u.nodes}, targets: ${u.targets}, errors: ${u.errors})`)}if(i)try{let m=await fe(i,10);if(i!==d&&i.close(),Array.isArray(m)&&m.length>0){console.log(`
574
574
  \u26A0 ${m.length} error(s) during mount:
575
575
  `);for(let b of m){let f=b.args.map(w=>typeof w=="object"?JSON.stringify(w):w).join(" ");if(console.log(` ${f}`),b.stack){let w=b.stack.split(`
576
- `).slice(0,2);for(let O of w)console.log(` ${O.trim()}`)}}}}catch{}u&&!u.ready&&(process.exitCode=1);break}case"storage-clear":{if(await Ce(d),await d.send({type:"evaluate",code:Ee(!0)})!==!0){A(c)?E({cleared:!1,ready:!1,error:"external app reload bridge is unavailable"}):console.error(" storage clear failed: external app reload bridge is unavailable"),process.exitCode=1;break}let n=await ve(d,{timeoutMs:1e4,errorGraceMs:3e3});if(A(c)){E({cleared:!0,ready:n.ready,reload:n}),n.ready||(process.exitCode=1);break}if(n.ready){let i=n.source==="nodes-fallback"?" (no ready signal, node-count fallback)":"";console.log(` cleared tenant storage; ready in ${n.elapsedMs}ms: ${n.nodes} nodes${i}`)}else if(n.source==="error-bail")console.log(` \u26A0 storage clear reloaded but bailed after ${n.elapsedMs}ms: ${n.errors} console error(s), ready signal never fired`);else{let i=Zt(n);console.log(` \u26A0 storage clear reloaded but timed out after ${n.elapsedMs}ms \u2014 ${i} (nodes: ${n.nodes}, targets: ${n.targets}, errors: ${n.errors})`)}try{let i=await fe(d,10);if(Array.isArray(i)&&i.length>0){console.log(`
576
+ `).slice(0,2);for(let O of w)console.log(` ${O.trim()}`)}}}}catch{}u&&!u.ready&&(process.exitCode=1);break}case"storage-clear":{if(await De(d),await d.send({type:"evaluate",code:Ae(!0)})!==!0){A(c)?E({cleared:!1,ready:!1,error:"external app reload bridge is unavailable"}):console.error(" storage clear failed: external app reload bridge is unavailable"),process.exitCode=1;break}let n=await ve(d,{timeoutMs:1e4,errorGraceMs:3e3});if(A(c)){E({cleared:!0,ready:n.ready,reload:n}),n.ready||(process.exitCode=1);break}if(n.ready){let i=n.source==="nodes-fallback"?" (no ready signal, node-count fallback)":"";console.log(` cleared tenant storage; ready in ${n.elapsedMs}ms: ${n.nodes} nodes${i}`)}else if(n.source==="error-bail")console.log(` \u26A0 storage clear reloaded but bailed after ${n.elapsedMs}ms: ${n.errors} console error(s), ready signal never fired`);else{let i=Zt(n);console.log(` \u26A0 storage clear reloaded but timed out after ${n.elapsedMs}ms \u2014 ${i} (nodes: ${n.nodes}, targets: ${n.targets}, errors: ${n.errors})`)}try{let i=await fe(d,10);if(Array.isArray(i)&&i.length>0){console.log(`
577
577
  \u26A0 ${i.length} error(s) during mount:
578
578
  `);for(let u of i){let m=u.args.map(b=>typeof b=="object"?JSON.stringify(b):b).join(" ");if(console.log(` ${m}`),u.stack){let b=u.stack.split(`
579
579
  `).slice(0,2);for(let f of b)console.log(` ${f.trim()}`)}}}}catch{}n.ready||(process.exitCode=1);break}case"eval":case"js":{let o=a.slice(1).join(" ");o||(console.error(k("js","<javascript>")),console.error(""),console.error(" runs the snippet in the engine realm. SootSim is the"),console.error(" canonical state surface \u2014 reach into it directly."),console.error(""),console.error(" examples:"),console.error(` ${h("js")} SootSim.bridges.test.findByText("Sign in")`),console.error(` ${h("js")} SootSim.bridges.debug.snapshot("before")`),console.error(` ${h("js")} SootSim.bridges.keyboard.type("hello")`),console.error(` ${h("js")} SootSim.state.root.children.length`),process.exit(1));let t=o;t.startsWith("(async")||(t=`(async () => ${t})()`);let s=await d.send({type:"evaluate",code:t});console.log(JSON.stringify(s,null,2));let n=o.toLowerCase(),i=[];(n.includes("sootsim:gohome")||n.includes("gohome"))&&i.push("sootsim shell home"),(n.includes("sootsim:appswitcher")||n.includes("appswitcher"))&&i.push("sootsim shell switcher"),(n.includes("keyboard.isvisible")||n.includes("keyboard.getmode"))&&i.push("sootsim debug state keyboard"),n.includes("interact.tap")&&i.push("sootsim do tap <x> <y>"),n.includes("keyboard.type")&&i.push("sootsim do type <text>"),(n.includes("keyboard.press")||n.includes("keyboard.dispatchkey"))&&i.push("sootsim do key <name>"),n.includes("keyboard.dismiss")&&i.push("sootsim do dismiss"),n.includes("dumptree")&&i.push("sootsim get tree"),n.includes("dumpaccessibilitytree")&&i.push("sootsim get a11y"),n.includes("getnodecount")&&i.push("sootsim get count"),n.includes("findbytext")&&i.push("sootsim find <text>"),(n.includes("findbytestid")||n.includes("findbyid"))&&i.push("sootsim find --testid <id>"),n.includes("document.hidden")&&i.push("sootsim debug state keyboard (includes tab health)"),i.length>0&&Y("prefer-cli-over-eval",i);break}case"globals":{let o=await d.send({type:"evaluate",code:`(async () => {
@@ -950,11 +950,11 @@ ${s}
950
950
  p50: ${i.p50.toFixed(2)}ms
951
951
  p95: ${i.p95.toFixed(2)}ms
952
952
  p99: ${i.p99.toFixed(2)}ms
953
- jank: ${i.jankFrames} frames (${m}%) >16.67ms`),Array.isArray(i.samples)&&i.samples.length>0&&(console.log(""),He(i.samples.map(b=>b[1])));break}default:console.error(` unknown perf subcommand: ${o}`),console.error(" valid: stats, start, stop, frames, worst, transition"),/^--?reset$/.test(o)&&console.error(" note: 'perf start' already clears prior frames \u2014 no reset needed"),process.exit(1)}break}case"errors":{let o=a[1];if(o==="clear"){await Ce(d),A(c)?E({cleared:!0}):console.log(" error buffer cleared");break}let t=o?Number(o):20,s=await fe(d,t);if(A(c)){E(s);break}if(s.length===0){console.log(" no errors captured");break}console.log(` ${s.length} error(s):
953
+ jank: ${i.jankFrames} frames (${m}%) >16.67ms`),Array.isArray(i.samples)&&i.samples.length>0&&(console.log(""),He(i.samples.map(b=>b[1])));break}default:console.error(` unknown perf subcommand: ${o}`),console.error(" valid: stats, start, stop, frames, worst, transition"),/^--?reset$/.test(o)&&console.error(" note: 'perf start' already clears prior frames \u2014 no reset needed"),process.exit(1)}break}case"errors":{let o=a[1];if(o==="clear"){await De(d),A(c)?E({cleared:!0}):console.log(" error buffer cleared");break}let t=o?Number(o):20,s=await fe(d,t);if(A(c)){E(s);break}if(s.length===0){console.log(" no errors captured");break}console.log(` ${s.length} error(s):
954
954
  `);for(let n of s){let i=ie(n.timestamp),u=n.args.map(m=>typeof m=="object"?JSON.stringify(m):m).join(" ");if(console.log(` [${i}] ${u}`),n.stack){let m=n.stack.split(`
955
- `).slice(0,3);for(let b of m)console.log(` ${b.trim()}`)}}break}case"warnings":{let o=a[1]?Number(a[1]):20,t=await ut(d,o);if(A(c)){E(t);break}if(t.length===0){console.log(" no warnings captured");break}console.log(` ${t.length} warning(s):
955
+ `).slice(0,3);for(let b of m)console.log(` ${b.trim()}`)}}break}case"warnings":{let o=a[1]?Number(a[1]):20,t=await at(d,o);if(A(c)){E(t);break}if(t.length===0){console.log(" no warnings captured");break}console.log(` ${t.length} warning(s):
956
956
  `);for(let s of t){let n=ie(s.timestamp),i=s.args.map(u=>typeof u=="object"?JSON.stringify(u):u).join(" ");console.log(` [${n}] ${i}`)}break}case"animations":{let o=await G(d,"listAnimations")??[];if(e.includes("--json")){console.log(JSON.stringify(o,null,2));break}if(o.length===0){console.log(" no active animations");break}console.log(` ${o.length} active animation(s):
957
- `);for(let t of o){let s=String(t.kind).padEnd(6),n=`${Number(t.from).toFixed(2)}\u2192${Number(t.to).toFixed(2)}`,i=Number(t.current??0).toFixed(2),u=`${Math.round((t.progress??0)*100)}%`,m=`${Math.round(t.elapsedMs??0)}ms`,b=t.loop?" loop":"",f=t.layoutBound?" layout":"";console.log(` #${t.id} ${s} ${n.padEnd(14)} cur=${i.padEnd(7)} ${u.padStart(4)} ${m}${b}${f}`)}break}case"animation":{let o=a[1];(!o||o==="--help"||o==="-h")&&(console.error(` usage: ${h("animation")} <id>`),process.exit(1));let t=Number(o);Number.isFinite(t)||(console.error(` invalid id: ${o}`),process.exit(1));let s=await G(d,"getAnimation",t);console.log(JSON.stringify(s,null,2));break}case"stop-animation":{let o=a[1];(!o||o==="--help"||o==="-h")&&(console.error(` usage: ${h("stop-animation")} <id|all>`),process.exit(1));let t=o==="all"?"all":Number(o);t!=="all"&&!Number.isFinite(t)&&(console.error(` invalid id: ${o}`),process.exit(1));let s=await G(d,"stopAnimation",t);console.log(` stopped ${s??0} animation(s)`);break}case"requests":{let o=a[1];if(o==="clear"){await pt(d),A(c)?E({cleared:!0}):console.log(" request buffer cleared");break}let t=o==="all",s=t?a[2]:o,n=s?Number(s):20,i=await mt(d,{failed:!t,limit:n});if(A(c)){E(i);break}if(i.length===0){console.log(t?" no requests captured":" no failed requests captured");break}console.log(` ${i.length} ${t?"request(s)":"failed request(s)"}:
957
+ `);for(let t of o){let s=String(t.kind).padEnd(6),n=`${Number(t.from).toFixed(2)}\u2192${Number(t.to).toFixed(2)}`,i=Number(t.current??0).toFixed(2),u=`${Math.round((t.progress??0)*100)}%`,m=`${Math.round(t.elapsedMs??0)}ms`,b=t.loop?" loop":"",f=t.layoutBound?" layout":"";console.log(` #${t.id} ${s} ${n.padEnd(14)} cur=${i.padEnd(7)} ${u.padStart(4)} ${m}${b}${f}`)}break}case"animation":{let o=a[1];(!o||o==="--help"||o==="-h")&&(console.error(` usage: ${h("animation")} <id>`),process.exit(1));let t=Number(o);Number.isFinite(t)||(console.error(` invalid id: ${o}`),process.exit(1));let s=await G(d,"getAnimation",t);console.log(JSON.stringify(s,null,2));break}case"stop-animation":{let o=a[1];(!o||o==="--help"||o==="-h")&&(console.error(` usage: ${h("stop-animation")} <id|all>`),process.exit(1));let t=o==="all"?"all":Number(o);t!=="all"&&!Number.isFinite(t)&&(console.error(` invalid id: ${o}`),process.exit(1));let s=await G(d,"stopAnimation",t);console.log(` stopped ${s??0} animation(s)`);break}case"requests":{let o=a[1];if(o==="clear"){await ct(d),A(c)?E({cleared:!0}):console.log(" request buffer cleared");break}let t=o==="all",s=t?a[2]:o,n=s?Number(s):20,i=await lt(d,{failed:!t,limit:n});if(A(c)){E(i);break}if(i.length===0){console.log(t?" no requests captured":" no failed requests captured");break}console.log(` ${i.length} ${t?"request(s)":"failed request(s)"}:
958
958
  `);for(let u of i){let m=ie(u.timestamp);console.log(` [${m}] ${oe(u)}`),u.responseBody?console.log(` ${u.responseBody}`):u.error&&console.log(` ${u.error}`)}break}case"network":{let o=a[1],t=null,s=null,n=!1,i=!1,u=1e3,m=!1,b=!1;for(let F=0;F<c.length;F++){let x=c[F];if(x==="--filter")t=c[F+1]??null,F++;else if(x==="--limit"){let $=Number(c[F+1]);Number.isFinite($)&&(s=$),F++}else if(x==="--threshold"){let $=Number(c[F+1]);Number.isFinite($)&&$>0&&(u=$),F++}else x==="--failed"?n=!0:x==="--slow"?i=!0:x==="--tail"||x==="-f"?m=!0:x==="--json"&&(b=!0)}if(o==="clear"){await d.send({type:"evaluate",code:'window.__sootsimObservability?.network.clear(); "cleared"'}),console.log(" network buffer cleared");break}if(o==="get"){let F=a[2];F||(console.error(" usage: sootsim network get <id>"),process.exit(1));let x=await d.send({type:"evaluate",code:`(() => {
959
959
  const obs = window.__sootsimObservability;
960
960
  if (!obs) return null;
@@ -967,10 +967,10 @@ ${s}
967
967
  })()`});if(!F||!F.ok)throw new Error("observability bridge not installed \u2014 is the engine running?");return F.entries??[]},O=F=>{let x=F;if(n&&(x=x.filter($=>!!$.error||$.status!=null&&$.status>=400)),i&&(x=x.filter($=>$.durationMs!=null&&$.durationMs>=u)),t){let $=t.toLowerCase();x=x.filter(v=>(v.displayUrl||v.url).toLowerCase().includes($))}return i&&!m&&(x=[...x].sort(($,v)=>(v.durationMs??0)-($.durationMs??0))),x};if(!m){let F=await w(),x=O(F).slice(-f);if(b){console.log(JSON.stringify(x,null,2));break}if(x.length===0){F.length===0?console.log(" no network requests captured"):console.log(i?` no requests slower than ${u}ms (${F.length} total \u2014 try --threshold <ms>)`:" no matching requests");break}console.log(i?` ${x.length} request(s) slower than ${u}ms (sorted by duration desc):
968
968
  `:` ${x.length} request(s):
969
969
  `);for(let $ of x)eo($);break}console.log(` tailing network (ctrl-c to stop)...
970
- `);let q=new Set,H=!0,K=()=>{H=!1};process.on("SIGINT",K);try{for(;H;){let F=await w(),x=O(F);for(let $ of x)$.durationMs!=null&&(q.has($.id)||(q.add($.id),b?console.log(JSON.stringify($)):eo($)));await ee(250)}}finally{process.off("SIGINT",K)}break}case"logs":{let o=a[1],t=null,s=null,n=null,i=!1,u=!1,m=!1;for(let x=0;x<c.length;x++){let $=c[x];if($==="--filter")t=c[x+1]??null,x++;else if($==="--limit"){let v=Number(c[x+1]);Number.isFinite(v)&&(s=v),x++}else $==="--level"?(n=c[x+1]??null,x++):$==="--tail"||$==="-f"?i=!0:$==="--json"?u=!0:($==="--internal"||$==="--all")&&(m=!0)}let b=n?new Set(n.split(",").map(x=>x.trim()).filter(x=>x==="log"||x==="info"||x==="warn"||x==="error"||x==="debug")):null;if(o==="clear"){await gt(d),console.log(" log buffer cleared");break}let f=!u&&process.stdout.isTTY===!0,w=s??(i?500:o?Number(o):50);Number.isFinite(w)||(console.error(` invalid limit: ${o} \u2014 \`logs\` takes a numeric count (e.g. ${h("logs")} 100).
971
- to target a specific sim, use \`--sim ${o}\` instead.`),process.exit(1));let O=()=>ft(d),q=x=>yt(x,{level:b,filter:t,showInternal:m});if(!i){let x=await O(),$=q(x).slice(-w);if(u){console.log(JSON.stringify($,null,2));break}if($.length===0){console.log(x.length===0?" no logs captured":" no matching logs");break}console.log(` ${$.length} log(s):
970
+ `);let q=new Set,H=!0,K=()=>{H=!1};process.on("SIGINT",K);try{for(;H;){let F=await w(),x=O(F);for(let $ of x)$.durationMs!=null&&(q.has($.id)||(q.add($.id),b?console.log(JSON.stringify($)):eo($)));await ee(250)}}finally{process.off("SIGINT",K)}break}case"logs":{let o=a[1],t=null,s=null,n=null,i=!1,u=!1,m=!1;for(let x=0;x<c.length;x++){let $=c[x];if($==="--filter")t=c[x+1]??null,x++;else if($==="--limit"){let v=Number(c[x+1]);Number.isFinite(v)&&(s=v),x++}else $==="--level"?(n=c[x+1]??null,x++):$==="--tail"||$==="-f"?i=!0:$==="--json"?u=!0:($==="--internal"||$==="--all")&&(m=!0)}let b=n?new Set(n.split(",").map(x=>x.trim()).filter(x=>x==="log"||x==="info"||x==="warn"||x==="error"||x==="debug")):null;if(o==="clear"){await ut(d),console.log(" log buffer cleared");break}let f=!u&&process.stdout.isTTY===!0,w=s??(i?500:o?Number(o):50);Number.isFinite(w)||(console.error(` invalid limit: ${o} \u2014 \`logs\` takes a numeric count (e.g. ${h("logs")} 100).
971
+ to target a specific sim, use \`--sim ${o}\` instead.`),process.exit(1));let O=()=>dt(d),q=x=>mt(x,{level:b,filter:t,showInternal:m});if(!i){let x=await O(),$=q(x).slice(-w);if(u){console.log(JSON.stringify($,null,2));break}if($.length===0){console.log(x.length===0?" no logs captured":" no matching logs");break}console.log(` ${$.length} log(s):
972
972
  `);for(let v of $)oo(v,f);break}console.log(` tailing logs (ctrl-c to stop)...
973
- `);let H=new Set,K=!0,F=()=>{K=!1};process.on("SIGINT",F);try{for(;K;){let x=await O(),$=q(x);for(let v of $)H.has(v.id)||(H.add(v.id),u?console.log(JSON.stringify(v)):oo(v,f));await ee(250)}}finally{process.off("SIGINT",F)}break}default:console.error(` unknown subcommand: ${g}`),process.exit(1)}if(pe.has(g)&&!e.includes("--no-wait")&&process.env.SOOTSIM_NO_AUTO_WAIT!=="1"&&!await et(d,g)&&await S(d),!B.has(g)&&!A(c))try{await re(d)}catch{}}catch(o){let t=o instanceof Error?o.message:String(o);console.error(` ${g??"inspect"} failed: ${t}`);let s=/^no sim connected with id (.+)$/.exec(t),n=/^command timed out after (\d+)s$/.exec(t),i=t.startsWith("sim disconnected:")||t.startsWith("bridge never reconnected")||t.startsWith("could not connect to ws://");if(s)await Mt(d,_,s[1]);else if(/^no sim connected$/.test(t))Tt(_);else if(n)if(await Co(d)){let m=g??"describe";process.stderr.write(` the sim is still responsive \u2014 '${m}' just exceeded the ${n[1]}s command budget.
973
+ `);let H=new Set,K=!0,F=()=>{K=!1};process.on("SIGINT",F);try{for(;K;){let x=await O(),$=q(x);for(let v of $)H.has(v.id)||(H.add(v.id),u?console.log(JSON.stringify(v)):oo(v,f));await ee(250)}}finally{process.off("SIGINT",F)}break}default:console.error(` unknown subcommand: ${g}`),process.exit(1)}if(pe.has(g)&&!e.includes("--no-wait")&&process.env.SOOTSIM_NO_AUTO_WAIT!=="1"&&!await Xe(d,g)&&await S(d),!B.has(g)&&!A(c))try{await re(d)}catch{}}catch(o){let t=o instanceof Error?o.message:String(o);console.error(` ${g??"inspect"} failed: ${t}`);let s=/^no sim connected with id (.+)$/.exec(t),n=/^command timed out after (\d+)s$/.exec(t),i=t.startsWith("sim disconnected:")||t.startsWith("bridge never reconnected")||t.startsWith("could not connect to ws://");if(s)await Mt(d,_,s[1]);else if(/^no sim connected$/.test(t))Tt(_);else if(n)if(await Co(d)){let m=g??"describe";process.stderr.write(` the sim is still responsive \u2014 '${m}' just exceeded the ${n[1]}s command budget.
974
974
  the screen's node tree is large; narrow the query or raise the budget:
975
975
  sootsim ${m} --testid <id> # scope to one subtree
976
976
  sootsim find --testid <id> # targeted single-node lookup
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.169 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as k}from"./chunk-BIWJE7CB.js";import{a as x}from"./chunk-WZG3YVJR.js";import"./chunk-JDGLBW64.js";import{spawn as v,spawnSync as u}from"child_process";import{chmodSync as S,copyFileSync as T,createWriteStream as E,existsSync as w,mkdirSync as y,rmSync as g,statSync as P,unlinkSync as D}from"fs";import{tmpdir as M}from"os";import{dirname as A,join as f,resolve as b}from"path";var h="https://sootbean.com/api/electron-release";function O(){let n=process.arch;if(process.platform==="darwin"){let o=n==="arm64"?"mac-arm64":"mac-x64",e=`sootsim-latest-${o}.dmg`;return{platform:o,filename:e,url:`${h}/${e}`,install:L}}if(process.platform==="linux"){let o=n==="arm64"?"linux-arm64":"linux-x64",e=`sootsim-latest-${o}.AppImage`;return{platform:o,filename:e,url:`${h}/${e}`,install:C}}if(process.platform==="win32"){let o="sootsim-latest-win-x64.exe";return{platform:"win-x64",filename:o,url:`${h}/${o}`,install:B}}return null}async function I({url:n,dest:o,onProgress:e}){let s=await fetch(n,{redirect:"follow"});if(!s.ok)throw new Error(`${s.status} ${s.statusText} (${n})`);let t=s.headers.get("content-length"),a=t?Number(t):null;if(!s.body)throw new Error(`empty response body (${n})`);y(A(o),{recursive:!0});let i=E(o),d=s.body.getReader(),c=0;try{for(;;){let{done:l,value:p}=await d.read();if(l)break;i.write(Buffer.from(p)),c+=p.byteLength,e?.(c,a)}}finally{await new Promise((l,p)=>{i.end(r=>r?p(r):l())})}}function _(n,o){let e=(n/1048576).toFixed(1);if(!o)return` ${e} MB`;let s=Math.min(100,Math.round(n/o*100)),t=(o/(1024*1024)).toFixed(1),a=24,i=Math.round(s/100*a);return` ${"\u2588".repeat(i)+"\u2591".repeat(a-i)} ${s}% ${e} / ${t} MB`}async function L(n){let o=u("hdiutil",["attach","-nobrowse","-readonly",n],{encoding:"utf8"});if(o.status!==0)throw new Error(`hdiutil attach failed: ${o.stderr||o.stdout}`.trim());let e=o.stdout.trim().split(`
1
+ /*! sootsim v0.1.170 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as k}from"./chunk-I4RV5I6V.js";import{a as x}from"./chunk-S244IT4W.js";import"./chunk-WN7R4GL4.js";import{spawn as v,spawnSync as u}from"child_process";import{chmodSync as S,copyFileSync as T,createWriteStream as E,existsSync as w,mkdirSync as y,rmSync as g,statSync as P,unlinkSync as D}from"fs";import{tmpdir as M}from"os";import{dirname as A,join as f,resolve as b}from"path";var h="https://sootbean.com/api/electron-release";function O(){let n=process.arch;if(process.platform==="darwin"){let o=n==="arm64"?"mac-arm64":"mac-x64",e=`sootsim-latest-${o}.dmg`;return{platform:o,filename:e,url:`${h}/${e}`,install:L}}if(process.platform==="linux"){let o=n==="arm64"?"linux-arm64":"linux-x64",e=`sootsim-latest-${o}.AppImage`;return{platform:o,filename:e,url:`${h}/${e}`,install:C}}if(process.platform==="win32"){let o="sootsim-latest-win-x64.exe";return{platform:"win-x64",filename:o,url:`${h}/${o}`,install:B}}return null}async function I({url:n,dest:o,onProgress:e}){let s=await fetch(n,{redirect:"follow"});if(!s.ok)throw new Error(`${s.status} ${s.statusText} (${n})`);let t=s.headers.get("content-length"),a=t?Number(t):null;if(!s.body)throw new Error(`empty response body (${n})`);y(A(o),{recursive:!0});let i=E(o),d=s.body.getReader(),c=0;try{for(;;){let{done:l,value:p}=await d.read();if(l)break;i.write(Buffer.from(p)),c+=p.byteLength,e?.(c,a)}}finally{await new Promise((l,p)=>{i.end(r=>r?p(r):l())})}}function _(n,o){let e=(n/1048576).toFixed(1);if(!o)return` ${e} MB`;let s=Math.min(100,Math.round(n/o*100)),t=(o/(1024*1024)).toFixed(1),a=24,i=Math.round(s/100*a);return` ${"\u2588".repeat(i)+"\u2591".repeat(a-i)} ${s}% ${e} / ${t} MB`}async function L(n){let o=u("hdiutil",["attach","-nobrowse","-readonly",n],{encoding:"utf8"});if(o.status!==0)throw new Error(`hdiutil attach failed: ${o.stderr||o.stdout}`.trim());let e=o.stdout.trim().split(`
3
3
  `),t=e[e.length-1].split(" ").pop()?.trim();if(!t||!w(t))throw new Error(`could not determine dmg mount point (output: ${o.stdout})`);let a=f(t,"sootsim.app");if(!w(a))throw u("hdiutil",["detach","-force",t]),new Error(`sootsim.app not found inside ${t}`);let i="/Applications",d=b(process.env.HOME||"","Applications"),c=i;try{let m=f(i,`.sootsim-write-probe-${process.pid}`);u("touch",[m]),w(m)?g(m,{force:!0}):c=d}catch{c=d}c===d&&y(c,{recursive:!0});let l=f(c,"sootsim.app");w(l)&&g(l,{recursive:!0,force:!0});let p=u("cp",["-R",a,l]),r=u("hdiutil",["detach","-force",t]);if(p.status!==0)throw new Error(`copy to ${l} failed: ${p.stderr?.toString()||""}`.trim());return r.status!==0&&console.warn(` warning: failed to unmount ${t} (${r.stderr?.toString().trim()||"unknown error"})`),u("xattr",["-dr","com.apple.quarantine",l]),l}async function C(n){let o=b(process.env.HOME||"","Applications");y(o,{recursive:!0});let e=f(o,"sootsim.AppImage");return w(e)&&g(e,{force:!0}),T(n,e),D(n),S(e,493),e}async function B(n){return await new Promise((o,e)=>{let s=v("cmd",["/c","start",'""',"/wait",n],{stdio:"inherit"});s.once("error",e),s.once("exit",t=>{t===0?o():e(new Error(`installer exited with code ${t}`))})}),n}async function q(n){(n.includes("--help")||n.includes("-h"))&&(console.log(`
4
4
  sootsim install-desktop \u2014 download and install the optional desktop GUI
5
5
 
@@ -20,4 +20,4 @@ examples:
20
20
  `),process.exit(0));let o=n.includes("--yes")||n.includes("-y")||process.env.SOOTSIM_NO_PROMPT==="1"||process.env.CI==="1"||!process.stdin.isTTY,e=n.includes("--force"),s=x();if(s&&!e){console.log(` sootsim desktop already installed at: ${s.path}`),console.log(" pass --force to reinstall.");return}let t=O();if(t||(console.error(` no desktop build available for ${process.platform}/${process.arch}.`),console.error(" supported: darwin-arm64, darwin-x64, linux-x64, win32-x64"),process.exit(1)),console.log(` platform: ${t.platform}`),console.log(` download: ${t.url}`),console.log(),!o){if(!await k("download and install now?",!0)){console.log(" cancelled.");return}console.log()}let a=f(M(),`sootsim-install-${Date.now()}`),i=f(a,t.filename),d=0;process.stdout.write(` downloading ${t.filename}...
21
21
  `);try{await I({url:t.url,dest:i,onProgress:(r,m)=>{let $=Date.now();$-d<100&&r<(m??1/0)||(d=$,process.stdout.isTTY&&process.stdout.write(`\r\x1B[2K${_(r,m)}`))}})}catch(r){g(a,{recursive:!0,force:!0});let m=r instanceof Error?r.message:String(r);console.error(`
22
22
  download failed: ${m}`),console.error(` the ${t.platform} desktop build may not be published yet, or your`),console.error(" network blocked the request. check your connection and try again later;"),console.error(" the CLI + daemon work without the desktop app (run: sootsim --help)."),process.exit(1)}process.stdout.isTTY&&process.stdout.write(`
23
- `);let c=P(i).size;console.log(` downloaded ${(c/(1024*1024)).toFixed(1)} MB`),console.log(),console.log(" installing...");let{trackCliEvent:l,flushCliTelemetry:p}=await import("./telemetry-SZLRXJXW.js");try{let r=await t.install(i);l({event:"cli_install_desktop_succeeded",properties:{platform:t.platform,size_bytes:c}}),console.log(` installed: ${r}`)}catch(r){l({event:"cli_install_desktop_failed",properties:{platform:t.platform,error:r instanceof Error?r.message:String(r)}}),await p(),console.error(` install failed: ${r instanceof Error?r.message:String(r)}`),console.error(` keeping download at ${i} for manual install.`),process.exit(1)}finally{g(a,{recursive:!0,force:!0})}console.log(),console.log(" next steps:"),console.log(" sootsim electron launch the desktop app"),console.log(" sootsim open <target> open a demo or bundle in it")}export{q as runInstallDesktop};
23
+ `);let c=P(i).size;console.log(` downloaded ${(c/(1024*1024)).toFixed(1)} MB`),console.log(),console.log(" installing...");let{trackCliEvent:l,flushCliTelemetry:p}=await import("./telemetry-2XLLWARK.js");try{let r=await t.install(i);l({event:"cli_install_desktop_succeeded",properties:{platform:t.platform,size_bytes:c}}),console.log(` installed: ${r}`)}catch(r){l({event:"cli_install_desktop_failed",properties:{platform:t.platform,error:r instanceof Error?r.message:String(r)}}),await p(),console.error(` install failed: ${r instanceof Error?r.message:String(r)}`),console.error(` keeping download at ${i} for manual install.`),process.exit(1)}finally{g(a,{recursive:!0,force:!0})}console.log(),console.log(" next steps:"),console.log(" sootsim electron launch the desktop app"),console.log(" sootsim open <target> open a demo or bundle in it")}export{q as runInstallDesktop};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.169 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as l,b as d,c as k,d as y,e as g}from"./chunk-SIB6I72P.js";import{d as c}from"./chunk-PV6MBKKE.js";import"./chunk-5KY7TQ42.js";import"./chunk-JDGLBW64.js";async function a(){let s=await c();return s?.token||(process.stderr.write(" sootsim keys ... needs you to be signed in.\n run `sootsim login` first.\n"),process.exit(1)),{origin:s.origin,token:s.token}}function f(s){if(!s)return"never";try{return new Date(s).toLocaleString()}catch{return s}}async function h(s){let i=s[0];if(!i||i==="--help"||i==="-h"){u();return}if(i==="list"){let{origin:o,token:e}=await a(),n=await fetch(`${o.replace(/\/$/,"")}/api/sootsim/billing/keys`,{headers:{authorization:`Bearer ${e}`}});n.ok||(console.error(` keys list failed (${n.status})`),process.exit(1));let{keys:r}=await n.json();if(r.length===0){console.log(" no keys. create one with `sootsim keys create <label>`.");return}for(let t of r)console.log(` ${t.keyPrefix}\u2026 ${t.label.padEnd(24)} scopes=${t.scopes.join(",")} last=${f(t.lastUsedAt)} id=${t.id}`);return}if(i==="create"){let o=s[1]?.trim();o||(console.error(" usage: sootsim keys create <label>"),process.exit(1));let{origin:e,token:n}=await a(),r=await fetch(`${e.replace(/\/$/,"")}/api/sootsim/billing/keys`,{method:"POST",headers:{authorization:`Bearer ${n}`,"content-type":"application/json"},body:JSON.stringify({label:o})});r.ok||(console.error(` keys create failed (${r.status}): ${await r.text()}`),process.exit(1));let t=await r.json();console.log(`
1
+ /*! sootsim v0.1.170 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as l,b as d,c as k,d as y,e as g}from"./chunk-BP3EGFER.js";import{d as c}from"./chunk-QPRF3UYX.js";import"./chunk-EX6V4ZV6.js";import"./chunk-WN7R4GL4.js";async function a(){let s=await c();return s?.token||(process.stderr.write(" sootsim keys ... needs you to be signed in.\n run `sootsim login` first.\n"),process.exit(1)),{origin:s.origin,token:s.token}}function f(s){if(!s)return"never";try{return new Date(s).toLocaleString()}catch{return s}}async function h(s){let i=s[0];if(!i||i==="--help"||i==="-h"){u();return}if(i==="list"){let{origin:o,token:e}=await a(),n=await fetch(`${o.replace(/\/$/,"")}/api/sootsim/billing/keys`,{headers:{authorization:`Bearer ${e}`}});n.ok||(console.error(` keys list failed (${n.status})`),process.exit(1));let{keys:r}=await n.json();if(r.length===0){console.log(" no keys. create one with `sootsim keys create <label>`.");return}for(let t of r)console.log(` ${t.keyPrefix}\u2026 ${t.label.padEnd(24)} scopes=${t.scopes.join(",")} last=${f(t.lastUsedAt)} id=${t.id}`);return}if(i==="create"){let o=s[1]?.trim();o||(console.error(" usage: sootsim keys create <label>"),process.exit(1));let{origin:e,token:n}=await a(),r=await fetch(`${e.replace(/\/$/,"")}/api/sootsim/billing/keys`,{method:"POST",headers:{authorization:`Bearer ${n}`,"content-type":"application/json"},body:JSON.stringify({label:o})});r.ok||(console.error(` keys create failed (${r.status}): ${await r.text()}`),process.exit(1));let t=await r.json();console.log(`
3
3
  created: ${t.record.label} (${t.record.keyPrefix}\u2026)`),console.log(` scopes: ${t.record.scopes.join(",")}`),console.log(`
4
4
  secret: ${t.secret}
5
5
  `),console.log(` copy this now \u2014 we can't show it again.
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.169 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{b as g,d as m}from"./chunk-PV6MBKKE.js";import"./chunk-5KY7TQ42.js";import"./chunk-JDGLBW64.js";import{exec as O}from"node:child_process";import{randomBytes as S}from"node:crypto";import _ from"node:http";var I=process.env.SOOTSIM_AUTH_ORIGIN||"https://sootbean.com",h="http://localhost:3000";async function x(r){if(r)return r;if(process.env.SOOTSIM_AUTH_ORIGIN)return process.env.SOOTSIM_AUTH_ORIGIN;if(process.env.SOOTSIM_UPLOAD_ORIGIN)return process.env.SOOTSIM_UPLOAD_ORIGIN;try{if((await fetch(`${h}/api/auth/me`)).ok)return h}catch{}return I}function L(){console.log(`
1
+ /*! sootsim v0.1.170 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as g,d as m}from"./chunk-QPRF3UYX.js";import"./chunk-EX6V4ZV6.js";import"./chunk-WN7R4GL4.js";import{exec as O}from"node:child_process";import{randomBytes as S}from"node:crypto";import _ from"node:http";var I=process.env.SOOTSIM_AUTH_ORIGIN||"https://sootbean.com",h="http://localhost:3000";async function x(r){if(r)return r;if(process.env.SOOTSIM_AUTH_ORIGIN)return process.env.SOOTSIM_AUTH_ORIGIN;if(process.env.SOOTSIM_UPLOAD_ORIGIN)return process.env.SOOTSIM_UPLOAD_ORIGIN;try{if((await fetch(`${h}/api/auth/me`)).ok)return h}catch{}return I}function L(){console.log(`
3
3
  sootsim login \u2014 sign in so desktop uploads can attach to your account
4
4
 
5
5
  usage:
@@ -21,6 +21,6 @@ options:
21
21
  <p style="color:#ccc">${r}</p>
22
22
  </div>
23
23
  </body>
24
- </html>`}async function P(r){try{let e=await fetch(`${r.replace(/\/$/,"")}/api/dev-login`,{method:"POST"});if(e.status===403)return{ok:!1,error:"dev-login disabled (not in dev mode)"};if(!e.ok){let c=await e.text().catch(()=>"");return{ok:!1,error:`dev-login ${e.status}: ${c}`}}let t=await e.json();return t.token?{ok:!0,token:t.token,userId:t.user?.id,email:t.email}:{ok:!1,error:"dev-login response missing token"}}catch(e){return{ok:!1,error:e instanceof Error?e.message:"dev-login fetch failed"}}}function A(r){try{let e=new URL(r).hostname.replace(/^\[|\]$/g,"").toLowerCase();return!!(e==="localhost"||/^127(?:\.\d{1,3}){3}$/.test(e)||e==="::1"||e==="0.0.0.0"||e.endsWith(".local")||e.endsWith(".localhost")||e==="host.containers.internal"||e==="host.docker.internal"||e==="host.orb.internal"||e==="host.lima.internal"||e==="fd07:b51a:cc66:f0::fe"||e==="192.168.5.2"||/^192\.168\.(?:64|139)\.1$/.test(e))}catch{return!1}}async function G(r){(r.includes("--help")||r.includes("-h"))&&(L(),process.exit(0));let e=[...r],t=await x(R(e,"--origin"));if(A(t)){console.log(` detected local origin (${t}) \u2014 signing in as dev user`);let o=await P(t);if(o.ok){g({token:o.token,user:o.userId?{id:o.userId,email:o.email}:null,origin:t,source:"cli"});let s=await m(t),l=s?.user?.email||o.email||s?.user?.id||o.userId,{trackCliEvent:n,flushCliTelemetry:a}=await import("./telemetry-SZLRXJXW.js");n({event:"cli_login_succeeded",identity:{userId:o.userId??s?.user?.id??null},properties:{origin:t,mode:"dev"}}),await a(),console.log(` signed in${l?` as ${l}`:""} (dev)`);return}console.log(` dev-login not available (${o.error}); falling back to browser`)}let c=S(16).toString("hex"),i=await new Promise(o=>{let s=_.createServer((l,n)=>{try{let a=new URL(l.url||"/","http://127.0.0.1"),w=a.searchParams.get("state"),k=a.searchParams.get("token"),b=a.searchParams.get("email")||void 0,$=a.searchParams.get("userId")||void 0,f=a.searchParams.get("error");if(n.setHeader("content-type","text/html; charset=utf-8"),f){n.end(u(`sign-in failed: ${f}`)),o({ok:!1,error:f}),s.close();return}if(w!==c){n.end(u("state mismatch. close this tab and retry `sootsim login`.")),o({ok:!1,error:"state mismatch"}),s.close();return}if(!k){n.end(u("missing token. close this tab and retry `sootsim login`.")),o({ok:!1,error:"missing token"}),s.close();return}n.end(u("sign-in complete. you can return to the terminal.")),o({ok:!0,token:k,email:b,userId:$}),s.close()}catch(a){n.statusCode=500,n.end(u("sign-in callback failed. retry `sootsim login`.")),o({ok:!1,error:a instanceof Error?a.message:"callback failed"}),s.close()}});s.listen(0,"127.0.0.1",()=>{let l=s.address();if(!l||typeof l=="string"){o({ok:!1,error:"failed to bind callback server"}),s.close();return}let n=new URL(`${t.replace(/\/$/,"")}/auth/sootsim-cli`);n.searchParams.set("state",c),n.searchParams.set("port",String(l.port)),n.searchParams.set("sootbean",t),console.log(" opening browser for sootsim login..."),console.log(` waiting for callback on 127.0.0.1:${l.port}`),console.log(` if nothing opens, visit:
24
+ </html>`}async function P(r){try{let e=await fetch(`${r.replace(/\/$/,"")}/api/dev-login`,{method:"POST"});if(e.status===403)return{ok:!1,error:"dev-login disabled (not in dev mode)"};if(!e.ok){let c=await e.text().catch(()=>"");return{ok:!1,error:`dev-login ${e.status}: ${c}`}}let t=await e.json();return t.token?{ok:!0,token:t.token,userId:t.user?.id,email:t.email}:{ok:!1,error:"dev-login response missing token"}}catch(e){return{ok:!1,error:e instanceof Error?e.message:"dev-login fetch failed"}}}function A(r){try{let e=new URL(r).hostname.replace(/^\[|\]$/g,"").toLowerCase();return!!(e==="localhost"||/^127(?:\.\d{1,3}){3}$/.test(e)||e==="::1"||e==="0.0.0.0"||e.endsWith(".local")||e.endsWith(".localhost")||e==="host.containers.internal"||e==="host.docker.internal"||e==="host.orb.internal"||e==="host.lima.internal"||e==="fd07:b51a:cc66:f0::fe"||e==="192.168.5.2"||/^192\.168\.(?:64|139)\.1$/.test(e))}catch{return!1}}async function G(r){(r.includes("--help")||r.includes("-h"))&&(L(),process.exit(0));let e=[...r],t=await x(R(e,"--origin"));if(A(t)){console.log(` detected local origin (${t}) \u2014 signing in as dev user`);let o=await P(t);if(o.ok){g({token:o.token,user:o.userId?{id:o.userId,email:o.email}:null,origin:t,source:"cli"});let s=await m(t),l=s?.user?.email||o.email||s?.user?.id||o.userId,{trackCliEvent:n,flushCliTelemetry:a}=await import("./telemetry-2XLLWARK.js");n({event:"cli_login_succeeded",identity:{userId:o.userId??s?.user?.id??null},properties:{origin:t,mode:"dev"}}),await a(),console.log(` signed in${l?` as ${l}`:""} (dev)`);return}console.log(` dev-login not available (${o.error}); falling back to browser`)}let c=S(16).toString("hex"),i=await new Promise(o=>{let s=_.createServer((l,n)=>{try{let a=new URL(l.url||"/","http://127.0.0.1"),w=a.searchParams.get("state"),k=a.searchParams.get("token"),b=a.searchParams.get("email")||void 0,$=a.searchParams.get("userId")||void 0,f=a.searchParams.get("error");if(n.setHeader("content-type","text/html; charset=utf-8"),f){n.end(u(`sign-in failed: ${f}`)),o({ok:!1,error:f}),s.close();return}if(w!==c){n.end(u("state mismatch. close this tab and retry `sootsim login`.")),o({ok:!1,error:"state mismatch"}),s.close();return}if(!k){n.end(u("missing token. close this tab and retry `sootsim login`.")),o({ok:!1,error:"missing token"}),s.close();return}n.end(u("sign-in complete. you can return to the terminal.")),o({ok:!0,token:k,email:b,userId:$}),s.close()}catch(a){n.statusCode=500,n.end(u("sign-in callback failed. retry `sootsim login`.")),o({ok:!1,error:a instanceof Error?a.message:"callback failed"}),s.close()}});s.listen(0,"127.0.0.1",()=>{let l=s.address();if(!l||typeof l=="string"){o({ok:!1,error:"failed to bind callback server"}),s.close();return}let n=new URL(`${t.replace(/\/$/,"")}/auth/sootsim-cli`);n.searchParams.set("state",c),n.searchParams.set("port",String(l.port)),n.searchParams.set("sootbean",t),console.log(" opening browser for sootsim login..."),console.log(` waiting for callback on 127.0.0.1:${l.port}`),console.log(` if nothing opens, visit:
25
25
  ${n.toString()}
26
- `),T(n.toString())})});if(!i.ok){let{trackCliEvent:o,flushCliTelemetry:s}=await import("./telemetry-SZLRXJXW.js");o({event:"cli_login_failed",properties:{origin:t,error:i.error}}),await s(),console.error(` login failed: ${i.error}`),process.exit(1)}g({token:i.token,user:i.userId?{id:i.userId,email:i.email}:null,origin:t,source:"cli"});let d=await m(t),p=d?.user?.email||i.email||d?.user?.id||i.userId,{trackCliEvent:y,flushCliTelemetry:v}=await import("./telemetry-SZLRXJXW.js");y({event:"cli_login_succeeded",identity:{userId:i.userId??d?.user?.id??null},properties:{origin:t}}),await v(),console.log(` signed in${p?` as ${p}`:""}`)}export{G as runLogin};
26
+ `),T(n.toString())})});if(!i.ok){let{trackCliEvent:o,flushCliTelemetry:s}=await import("./telemetry-2XLLWARK.js");o({event:"cli_login_failed",properties:{origin:t,error:i.error}}),await s(),console.error(` login failed: ${i.error}`),process.exit(1)}g({token:i.token,user:i.userId?{id:i.userId,email:i.email}:null,origin:t,source:"cli"});let d=await m(t),p=d?.user?.email||i.email||d?.user?.id||i.userId,{trackCliEvent:y,flushCliTelemetry:v}=await import("./telemetry-2XLLWARK.js");y({event:"cli_login_succeeded",identity:{userId:i.userId??d?.user?.id??null},properties:{origin:t}}),await v(),console.log(` signed in${p?` as ${p}`:""}`)}export{G as runLogin};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.169 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as r,b as i}from"./chunk-IODOTOOP.js";import{a as t,c as o}from"./chunk-PV6MBKKE.js";import"./chunk-5KY7TQ42.js";import"./chunk-JDGLBW64.js";async function s(){let e=t();if(!e?.token){console.log(" not signed in");return}try{await fetch(`${e.origin.replace(/\/$/,"")}/api/auth/sign-out`,{method:"POST",headers:{authorization:`Bearer ${e.token}`}})}catch{}o(),r({event:"cli_logout",identity:{userId:e.user?.id??null},properties:{origin:e.origin}}),await i(),console.log(" signed out")}export{s as runLogout};
1
+ /*! sootsim v0.1.170 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as r,b as i}from"./chunk-NI3L4A65.js";import{a as t,c as o}from"./chunk-QPRF3UYX.js";import"./chunk-EX6V4ZV6.js";import"./chunk-WN7R4GL4.js";async function s(){let e=t();if(!e?.token){console.log(" not signed in");return}try{await fetch(`${e.origin.replace(/\/$/,"")}/api/auth/sign-out`,{method:"POST",headers:{authorization:`Bearer ${e.token}`}})}catch{}o(),r({event:"cli_logout",identity:{userId:e.user?.id??null},properties:{origin:e.origin}}),await i(),console.log(" signed out")}export{s as runLogout};