sootsim 0.0.4 → 0.1.37

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 (165) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +24 -9
  3. package/dist-cli/bin.js +15 -20
  4. package/dist-cli/chunks/{agent-PJAOF4JS.js → agent-EQRQGSBL.js} +4 -4
  5. package/dist-cli/chunks/agent-wrapper-AWKZ67GN.js +15 -0
  6. package/dist-cli/chunks/{assert-P47NW4AF.js → assert-ZVGELUZB.js} +2 -2
  7. package/dist-cli/chunks/auto-bootstrap-UEOLNAWJ.js +2 -0
  8. package/dist-cli/chunks/beta-4MD7WSI4.js +2 -0
  9. package/dist-cli/chunks/chunk-2ZPJHSIJ.js +11 -0
  10. package/dist-cli/chunks/chunk-4IO3D5XG.js +2 -0
  11. package/dist-cli/chunks/chunk-4OHVCGMF.js +2 -0
  12. package/dist-cli/chunks/chunk-56BIMCDH.js +2 -0
  13. package/dist-cli/chunks/chunk-5FLDI6CV.js +66 -0
  14. package/dist-cli/chunks/{chunk-WWDJCKMI.js → chunk-B3RAGRK6.js} +1 -1
  15. package/dist-cli/chunks/chunk-BGAPLYMS.js +61 -0
  16. package/dist-cli/chunks/chunk-CX3ZIPD3.js +3 -0
  17. package/dist-cli/chunks/{chunk-I6XGFZPA.js → chunk-DSTV2VJT.js} +2 -2
  18. package/dist-cli/chunks/chunk-EDBFYOQB.js +2 -0
  19. package/dist-cli/chunks/chunk-ERLA3F77.js +1 -0
  20. package/dist-cli/chunks/chunk-FCQLQ7NA.js +117 -0
  21. package/dist-cli/chunks/chunk-H2HSOHXN.js +7 -0
  22. package/dist-cli/chunks/chunk-HYYMBXIX.js +2 -0
  23. package/dist-cli/chunks/chunk-JMGDVXAV.js +3 -0
  24. package/dist-cli/chunks/chunk-JMU5IGIU.js +1 -0
  25. package/dist-cli/chunks/chunk-KA5JJCWL.js +1 -0
  26. package/dist-cli/chunks/chunk-L4F4JRKJ.js +348 -0
  27. package/dist-cli/chunks/chunk-LDWXH43L.js +4 -0
  28. package/dist-cli/chunks/chunk-PERKPZ7T.js +4 -0
  29. package/dist-cli/chunks/chunk-PN6FWLD4.js +5 -0
  30. package/dist-cli/chunks/chunk-QD7YIVPS.js +64 -0
  31. package/dist-cli/chunks/chunk-QWKO62QM.js +2 -0
  32. package/dist-cli/chunks/{chunk-6SZMLFCR.js → chunk-QXMZNJV5.js} +1 -1
  33. package/dist-cli/chunks/chunk-R77F5J3X.js +4 -0
  34. package/dist-cli/chunks/chunk-RLNIKWFO.js +27 -0
  35. package/dist-cli/chunks/chunk-RX6RHGSI.js +2 -0
  36. package/dist-cli/chunks/chunk-S74RCIVB.js +2 -0
  37. package/dist-cli/chunks/chunk-SK4SOISL.js +1 -0
  38. package/dist-cli/chunks/{chunk-AFQBSK2J.js → chunk-T5L73GJB.js} +1 -1
  39. package/dist-cli/chunks/{chunk-432TMHBG.js → chunk-UIQ3536J.js} +1 -1
  40. package/dist-cli/chunks/chunk-URSEYCC5.js +16 -0
  41. package/dist-cli/chunks/chunk-WFXYY3DU.js +3 -0
  42. package/dist-cli/chunks/{chunk-DQKQYPIG.js → chunk-WHLHA5R5.js} +4 -4
  43. package/dist-cli/chunks/chunk-WLIVBPPY.js +3 -0
  44. package/dist-cli/chunks/{chunk-UQ3N6FZF.js → chunk-X6BP5JFC.js} +4 -4
  45. package/dist-cli/chunks/chunk-YFXTO4QX.js +5 -0
  46. package/dist-cli/chunks/{chunk-4XBPZQLW.js → chunk-Z5SVSAZO.js} +2 -2
  47. package/dist-cli/chunks/{chunk-5TTQKPGH.js → chunk-Z5X3PITK.js} +3 -3
  48. package/dist-cli/chunks/chunk-ZBOIGEGO.js +5 -0
  49. package/dist-cli/chunks/chunk-ZERYEI3L.js +17 -0
  50. package/dist-cli/chunks/{compat-ILLJ7VDL.js → compat-QQ3OJDBI.js} +2 -2
  51. package/dist-cli/chunks/{config-CDIAJIIT.js → config-LT27SC25.js} +2 -2
  52. package/dist-cli/chunks/control-3BO54QMO.js +2 -0
  53. package/dist-cli/chunks/cpu-profile-XEO3JCVB.js +22 -0
  54. package/dist-cli/chunks/daemon-3J2SAVQZ.js +83 -0
  55. package/dist-cli/chunks/{debug-6SMCTPMC.js → debug-OGQLIH4U.js} +4 -4
  56. package/dist-cli/chunks/demo-app-registry-5RZCXLWB.js +2 -0
  57. package/dist-cli/chunks/detox-Z2OSCIQU.js +49 -0
  58. package/dist-cli/chunks/device-RPTVD25S.js +16 -0
  59. package/dist-cli/chunks/diagnose-LAEXBNOQ.js +41 -0
  60. package/dist-cli/chunks/drivers-PSQUUAYC.js +2 -0
  61. package/dist-cli/chunks/electron-S2463O3P.js +18 -0
  62. package/dist-cli/chunks/flow-34YCVQDB.js +2 -0
  63. package/dist-cli/chunks/hints-E5PXPWFT.js +2 -0
  64. package/dist-cli/chunks/home-paths-F5SGBTRZ.js +2 -0
  65. package/dist-cli/chunks/inspect-EVGMEZ3G.js +1101 -0
  66. package/dist-cli/chunks/install-AM5PTJT3.js +2 -0
  67. package/dist-cli/chunks/install-desktop-ZNWYKTWQ.js +23 -0
  68. package/dist-cli/chunks/{keys-OWQ7SOTM.js → keys-5ETF6DYO.js} +2 -2
  69. package/dist-cli/chunks/{launch-WUEDHSO5.js → launch-DHUCNFX6.js} +3 -3
  70. package/dist-cli/chunks/login-KDR34JIP.js +26 -0
  71. package/dist-cli/chunks/logout-R6WIJYCW.js +2 -0
  72. package/dist-cli/chunks/maestro-ZOOJ2YVH.js +80 -0
  73. package/dist-cli/chunks/{preview-4RVHA2PP.js → preview-YFADHNBD.js} +2 -2
  74. package/dist-cli/chunks/profile-CQSC32HB.js +22 -0
  75. package/dist-cli/chunks/react-QSQD6CJE.js +30 -0
  76. package/dist-cli/chunks/{record-KEWLM5JR.js → record-IWLEYATN.js} +5 -5
  77. package/dist-cli/chunks/runtime-WKMNKYTN.js +25 -0
  78. package/dist-cli/chunks/screenshot-VJXHV57I.js +28 -0
  79. package/dist-cli/chunks/screenshot-mode-FA4VQ76K.js +17 -0
  80. package/dist-cli/chunks/screenshots-U4FQXHVK.js +70 -0
  81. package/dist-cli/chunks/server-7WZLM5NQ.js +35 -0
  82. package/dist-cli/chunks/setup-repo-3BXLAX5E.js +2 -0
  83. package/dist-cli/chunks/{skills-DJA6QEVR.js → skills-KO7RCY24.js} +2 -2
  84. package/dist-cli/chunks/start-EBD7T2GW.js +23 -0
  85. package/dist-cli/chunks/store-ONX3EBS4.js +2 -0
  86. package/dist-cli/chunks/telemetry-MFR7TUW7.js +2 -0
  87. package/dist-cli/chunks/{test-IWUHNFXV.js → test-OSVUG54G.js} +3 -3
  88. package/dist-cli/chunks/three-mode-MDBXZQG4.js +39 -0
  89. package/dist-cli/chunks/timeline-UJOKZKQR.js +22 -0
  90. package/dist-cli/chunks/upload-H2SMWP6T.js +2 -0
  91. package/dist-cli/chunks/what-happened-LFWH74FR.js +15 -0
  92. package/dist-cli/chunks/whoami-CUF56TLP.js +2 -0
  93. package/dist-lib/agent-daemon-client.cjs +6 -1
  94. package/dist-lib/agent-events.cjs +1 -1
  95. package/dist-lib/agent-sessions.cjs +42 -39
  96. package/dist-lib/attached-projects.cjs +30 -28
  97. package/dist-lib/auth/shared-session.cjs +35 -27
  98. package/dist-lib/backend-origin.cjs +1 -1
  99. package/dist-lib/bridge-constants.cjs +1 -1
  100. package/dist-lib/cli-constants.cjs +1 -1
  101. package/dist-lib/config.cjs +6 -2
  102. package/dist-lib/dev-bundle-resolution.cjs +7 -21
  103. package/dist-lib/home-paths.cjs +112 -30
  104. package/dist-lib/host/bridge-host.cjs +1817 -579
  105. package/dist-lib/host/fetch-proxy-handler.cjs +248 -0
  106. package/dist-lib/index.cjs +22 -22
  107. package/dist-lib/metro.cjs +22 -22
  108. package/dist-lib/profiles.cjs +246 -0
  109. package/dist-lib/render-mode.cjs +1 -1
  110. package/dist-lib/vite-base.cjs +3224 -764
  111. package/dist-lib/vite.cjs +1 -1
  112. package/package.json +11 -3
  113. package/dist-cli/chunks/agent-wrapper-STO7PLQD.js +0 -15
  114. package/dist-cli/chunks/auto-bootstrap-SC2LMI2H.js +0 -2
  115. package/dist-cli/chunks/chunk-47S5DXXX.js +0 -11
  116. package/dist-cli/chunks/chunk-4VXB2DBA.js +0 -119
  117. package/dist-cli/chunks/chunk-AUR2LTNX.js +0 -3
  118. package/dist-cli/chunks/chunk-BQRM4E66.js +0 -4
  119. package/dist-cli/chunks/chunk-C3QLIYCS.js +0 -16
  120. package/dist-cli/chunks/chunk-EHMSE3Q3.js +0 -2
  121. package/dist-cli/chunks/chunk-F4ARVCRR.js +0 -1
  122. package/dist-cli/chunks/chunk-HAKR72LJ.js +0 -2
  123. package/dist-cli/chunks/chunk-HGFIS26A.js +0 -2
  124. package/dist-cli/chunks/chunk-MQDPKSCK.js +0 -308
  125. package/dist-cli/chunks/chunk-MZPAJ5PQ.js +0 -1
  126. package/dist-cli/chunks/chunk-OAHMYSMD.js +0 -2
  127. package/dist-cli/chunks/chunk-QIP7LYQI.js +0 -5
  128. package/dist-cli/chunks/chunk-QQOBLF7O.js +0 -22
  129. package/dist-cli/chunks/chunk-SY74J6F4.js +0 -5
  130. package/dist-cli/chunks/chunk-UKYK63H6.js +0 -3
  131. package/dist-cli/chunks/chunk-UNFERMZ3.js +0 -27
  132. package/dist-cli/chunks/chunk-VGXARPIH.js +0 -3
  133. package/dist-cli/chunks/chunk-W3TYN64D.js +0 -62
  134. package/dist-cli/chunks/chunk-W7CYWXRZ.js +0 -4
  135. package/dist-cli/chunks/chunk-WRF43M33.js +0 -4
  136. package/dist-cli/chunks/chunk-WVBPATRA.js +0 -2
  137. package/dist-cli/chunks/chunk-XJF46GU2.js +0 -2
  138. package/dist-cli/chunks/chunk-ZF5FCFLD.js +0 -2
  139. package/dist-cli/chunks/chunk-ZKNI5MRD.js +0 -1
  140. package/dist-cli/chunks/control-7QGKUCAX.js +0 -2
  141. package/dist-cli/chunks/daemon-4BLYGM5N.js +0 -49
  142. package/dist-cli/chunks/demo-app-registry-HLI5UGGI.js +0 -2
  143. package/dist-cli/chunks/detox-R4G5INNB.js +0 -49
  144. package/dist-cli/chunks/device-YSLCWS4E.js +0 -16
  145. package/dist-cli/chunks/drivers-YIXRFFBQ.js +0 -2
  146. package/dist-cli/chunks/electron-JZOFO37G.js +0 -15
  147. package/dist-cli/chunks/flow-L7X5FGIN.js +0 -2
  148. package/dist-cli/chunks/hints-O4QR6UGI.js +0 -2
  149. package/dist-cli/chunks/home-paths-4YJJYGR6.js +0 -2
  150. package/dist-cli/chunks/inspect-DRFAUJUH.js +0 -1030
  151. package/dist-cli/chunks/install-BATRTWRI.js +0 -65
  152. package/dist-cli/chunks/install-desktop-6X474IQ3.js +0 -23
  153. package/dist-cli/chunks/install-dev-desktop-CAJHPRNP.js +0 -100
  154. package/dist-cli/chunks/login-54YJ2KH6.js +0 -26
  155. package/dist-cli/chunks/logout-XECXLEXW.js +0 -2
  156. package/dist-cli/chunks/maestro-PMHK6EHI.js +0 -75
  157. package/dist-cli/chunks/profile-3IVNHUS6.js +0 -22
  158. package/dist-cli/chunks/runtime-PJKHEB36.js +0 -25
  159. package/dist-cli/chunks/screenshot-BXRAQERZ.js +0 -26
  160. package/dist-cli/chunks/screenshot-mode-5IXEDIUS.js +0 -17
  161. package/dist-cli/chunks/screenshots-T4MQF3TB.js +0 -70
  162. package/dist-cli/chunks/server-CIP3LH45.js +0 -29
  163. package/dist-cli/chunks/store-SPC247DB.js +0 -2
  164. package/dist-cli/chunks/upload-UPD2RSYF.js +0 -2
  165. package/dist-cli/chunks/whoami-MCXFWKIH.js +0 -2
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{g as w,i as g,j as l}from"./chunk-56BIMCDH.js";var p="sootsim:settings",m=["errorReporting","colorScheme","a11yMode","a11yDepth","screenshotCanvas","screenshotBackground","screenshotText","screenshotPose","screenshotDynamicSize","agentProvider","onboardingComplete","betaConsentVersion","detailedTelemetry"];function S(){if(typeof window>"u")return null;let e=window.sootsimElectron;return e&&typeof e=="object"?e:null}function u(e){let t={};for(let n of m){if(!(n in e))continue;let r=e[n],o=g[n];o.validate&&!o.validate(r)||o.options&&!o.options.includes(r)||(t[n]=r)}return t}function h(e){let t={};for(let n of m)t[n]=e[n];return t}function C(){if(typeof localStorage>"u")return{};try{let e=localStorage.getItem(p);return e?u(JSON.parse(e)):{}}catch{return{}}}function P(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(p,JSON.stringify(h(e)))}catch{}}function _(){let t=S()?.sharedConfig?.settings;return!t||typeof t!="object"?{}:u(t)}function V(e){let t=S();if(t?.writeSharedConfig)try{t.writeSharedConfig({settings:h(e)})}catch{}}function v(){if(typeof window>"u")return null;let e=window.__sootsimSharedConfig;return e&&typeof e=="object"?e:null}function E(){let e=v()?.settings;return!e||typeof e!="object"?{}:u(e)}function D(e){if(!v())return;let t={settings:h(e)};try{if(globalThis.__sootsimBridgeRequest?.writeSharedConfig?.(t))return}catch{}if(!(typeof fetch>"u"))try{fetch("/__sootsim/shared-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0}).catch(()=>{})}catch{}}function b(){let e=C(),t=E(),n=_();return{...e,...t,...n}}function k(e){P(e),V(e),D(e)}function R(e){if(typeof window>"u")return()=>{};let t=i=>{if(!(i.key!==p||i.newValue==null))try{e(u(JSON.parse(i.newValue)))}catch{}};window.addEventListener("storage",t);let n=S(),r;n?.onSharedConfigChanged&&(r=n.onSharedConfigChanged(i=>{let d=i?.settings;!d||typeof d!="object"||e(u(d))}));let c=globalThis.__sootsimBridgeRequest?.subscribeSharedConfig?.(i=>{let d=i?.settings;!d||typeof d!="object"||e(u(d))});return()=>{window.removeEventListener("storage",t),r?.(),c?.()}}var K=l(),s={...K,...b()},f=[],a=null;function y(){for(let e of f)e();k(s)}R(e=>{let t={...s},n=!1;for(let[r,o]of Object.entries(e)){let c=r;t[c]!==o&&(t[c]=o,n=!0)}if(n){s=t,a=null;for(let r of f)r()}});var I={get(e){return s[e]},set(e,t){let n=g[e];n.validate&&!n.validate(t)||n.options&&!n.options.includes(t)||s[e]!==t&&(s={...s,[e]:t},e==="deviceModel"&&(a=null),y())},getAll(){return s},apply(e){let t=!1,n={...s};for(let[r,o]of Object.entries(e)){if(o===void 0)continue;let c=r,i=g[c];i&&(i.validate&&!i.validate(o)||i.options&&!i.options.includes(o)||n[c]!==o&&(n[c]=o,t=!0))}t&&(s=n,a=null,y())},reset(){s=l(),a=null,y()},subscribe(e){return f.push(e),()=>{f=f.filter(t=>t!==e)}},getDeviceSpec(){return a||(a=w(s.deviceModel)),a},getA11yMode(){return s.a11yMode},setA11yMode(e){this.set("a11yMode",e)},getInspectMode(){return s.inspectMode},setInspectMode(e){this.set("inspectMode",e)}};export{I as a};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as s}from"./chunk-WFXYY3DU.js";import{w as o}from"./chunk-PN6FWLD4.js";function u(){let e=process.env.DO_NOT_TRACK;return e==="1"||e==="true"||!o()}function a(){if(u())return null;let e=process.env.SOOT_POSTHOG_API_KEY||process.env.VITE_POSTHOG_API_KEY||"";if(!e)return null;let t=process.env.SOOT_POSTHOG_HOST||process.env.VITE_POSTHOG_HOST||"https://us.i.posthog.com";return{apiKey:e,host:t.replace(/\/+$/,"")}}function c(e){return e?e.userId?e.userId:e.installationId!=null?`install:${e.installationId}`:e.repoId?`repo:${e.repoId}`:e.shareId?`share:${e.shareId}`:"anonymous-cli":"anonymous-cli"}function p(e){let t=e.identity??{},n={$lib:"soot-cli",source:t.source??"cli",...e.properties};return t.userId&&(n.userId=t.userId),t.repoId&&(n.repoId=t.repoId),t.installationId!=null&&(n.installationId=String(t.installationId)),t.shareId&&(n.shareId=t.shareId),t.plan&&(n.plan=t.plan),{event:e.event,distinct_id:c(t),properties:n,timestamp:new Date().toISOString()}}var r=[],l=!1;async function i(){if(r.length===0)return;let e=a();if(!e){r.length=0;return}let t=r.splice(0,r.length).map(p);try{await fetch(`${e.host}/batch/`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({api_key:e.apiKey,batch:t}),signal:AbortSignal.timeout(2e3)})}catch{}}function d(){l||(l=!0,process.on("beforeExit",()=>{i()}),process.on("exit",()=>{i()}))}function h(e){if(u())return;d();let t=null;try{t=s()?.user?.id??null}catch{t=null}r.push({...e,identity:{source:"cli",userId:t,...e.identity}})}async function g(){await i()}export{h as a,g as b};
@@ -0,0 +1 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  function t(_){return`(async () => {
3
3
  const __t = window.__sootsimTest
4
4
  if (!__t) throw new Error('__sootsimTest not available')
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  var c="sootsim-agent-prompt-v1";function r(n){return typeof n=="string"?n.trim():""}function m(n){let e=r(n.text);if(!e)return"";let t=r(n.displayText),s=r(n.inspectSummary),o=r(n.inspectTrace);return!!s||!!o||/[\r\n]/.test(e)||!!t&&t!==e?JSON.stringify({__sootsimAgentPrompt:c,text:e,displayText:t,inspectSummary:s,inspectTrace:o}):e}function u(n){let e=r(n);if(!e)return null;try{let t=JSON.parse(e);if(t.__sootsimAgentPrompt!==c)return{text:e};let s=r(typeof t.text=="string"?t.text:void 0);if(!s)return null;let o=r(typeof t.displayText=="string"?t.displayText:void 0),i=r(typeof t.inspectSummary=="string"?t.inspectSummary:void 0),p=r(typeof t.inspectTrace=="string"?t.inspectTrace:void 0);return{text:s,...o?{displayText:o}:{},...i?{inspectSummary:i}:{},...p?{inspectTrace:p}:{}}}catch{return{text:e}}}export{m as a,u as b};
@@ -0,0 +1,16 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{c as l,e as d,h as c}from"./chunk-ZERYEI3L.js";function g(n){let e=n[0]?.toLowerCase()??"toggle";return e!=="on"&&e!=="off"&&e!=="toggle"&&(console.error(` unknown argument: "${e}" (expected on | off | toggle)`),process.exit(1)),e}async function u(n,e,o){let s=l(n,{port:e.port}),a=g(s.positional),r=d({...s,commandTimeoutMs:5e3});try{let i=!!(await c(r,"SootSim.bridges.settings.get"))?.[o.modeKey],t=a==="on"?!0:a==="off"?!1:!i;if(i===t){console.log(` ${o.displayName}: already ${t?"on":"off"}`);return}if(!await r.send({type:"evaluate",acquireLock:!0,code:`(async () => {
3
+ const modeKey = ${JSON.stringify(o.modeKey)}
4
+ const target = ${JSON.stringify(t)}
5
+ window.dispatchEvent(new CustomEvent('sootsim:shell-command', {
6
+ detail: { type: 'fire-action', id: ${JSON.stringify(o.actionId)} },
7
+ }))
8
+ const deadline = Date.now() + 1200
9
+ while (Date.now() < deadline) {
10
+ if (Boolean(window.SootSim?.bridges?.settings?.get?.()?.[modeKey]) === target) {
11
+ return true
12
+ }
13
+ await new Promise((resolve) => setTimeout(resolve, 40))
14
+ }
15
+ return false
16
+ })()`}))throw new Error(`${o.displayName} did not change to ${t?"on":"off"}; the live shell may not support this mode`);console.log(` ${o.displayName}: ${i?"on":"off"} -> ${t?"on":"off"}`)}finally{r.close()}}export{u as a};
@@ -0,0 +1,3 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{l as c}from"./chunk-PN6FWLD4.js";import{chmodSync as m,existsSync as g,mkdirSync as k,readFileSync as A,rmSync as i,writeFileSync as y}from"node:fs";import{dirname as l,join as D,resolve as p}from"node:path";var s=1,S="SOOTSIM_SHARED_AUTH_FILE",u="https://sootbean.com";function v(){let t=process.env[S];return t?.trim()?l(p(t)):c()}function a(){let t=process.env[S];return t?.trim()?p(t):D(v(),"desktop-auth.json")}function f(t){if(!t||typeof t!="object")return null;let e=t;return typeof e.id!="string"||!e.id.trim()?null:{id:e.id.trim(),name:typeof e.name=="string"?e.name:void 0,email:typeof e.email=="string"?e.email:void 0,image:typeof e.image=="string"?e.image:void 0}}function w(t){if(!t||typeof t!="object")return null;let e=t;if(e.version!==s||typeof e.token!="string"||!e.token.trim())return null;let r=typeof e.origin=="string"&&e.origin.trim()?e.origin.trim():u,n=e.source==="cli"||e.source==="electron"||e.source==="browser"||e.source==="unknown"?e.source:"unknown",o=typeof e.updatedAt=="string"&&e.updatedAt?e.updatedAt:new Date().toISOString(),h=typeof e.validatedAt=="string"&&e.validatedAt?e.validatedAt:void 0;return{version:s,token:e.token.trim(),user:f(e.user),origin:r,source:n,updatedAt:o,validatedAt:h}}function O(){let t=a();if(!g(t))return null;try{let e=JSON.parse(A(t,"utf8")),r=w(e);return r||(i(t,{force:!0}),null)}catch{return i(t,{force:!0}),null}}function I(t){let e=a();k(l(e),{recursive:!0});let r={version:s,token:t.token.trim(),user:t.user?f(t.user):null,origin:t.origin?.trim()||u,source:t.source,updatedAt:t.updatedAt||new Date().toISOString(),validatedAt:t.validatedAt};y(e,JSON.stringify(r,null,2)+`
3
+ `);try{m(e,384)}catch{}return r}function d(){i(a(),{force:!0})}async function N(t){let e=O();if(!e?.token)return null;let r=t||e.origin||u;try{let n=await fetch(`${r.replace(/\/$/,"")}/api/auth/me`,{headers:{authorization:`Bearer ${e.token}`}});if(n.status===401)return d(),null;if(!n.ok)return e;let o=await n.json();return o.user?.id?I({token:e.token,user:o.user,origin:r,source:e.source,validatedAt:new Date().toISOString()}):(d(),null)}catch{return e}}export{O as a,I as b,d as c,N as d};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{g as u}from"./chunk-EHMSE3Q3.js";var S=52,l=18,h=42,w=96,g=54,$=1.5,y="inset 0 0 0 0.5px #000, inset 0 0 0 2px #757575, inset 0 0 0 5px #212121",x=1;function L(e){let t=u(e),r=t.scale,o=!t.dynamicIsland&&t.homeIndicatorHeight===0&&t.cornerRadius===0,n=t.width,i=t.height,a=o?t.width+l*2:t.width+28,d=o?t.height+h+w:t.height+28,c=9.5,b=x,p=a+c*2,m=d+x*2,f=c+(o?l:14),B=o?h:14,v=o?S:t.cornerRadius+14,H=[{side:"right",top:t.hardwareButtons.lock.top,height:t.hardwareButtons.lock.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.ringToggle.top,height:t.hardwareButtons.ringToggle.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.volumeUp.top,height:t.hardwareButtons.volumeUp.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.volumeDown.top,height:t.hardwareButtons.volumeDown.height,width:t.hardwareButtons.width}];return{model:e,renderScale:r,outerWidth:Math.round(p*r),outerHeight:Math.round(m*r),logicalOuterWidth:p,logicalOuterHeight:m,logicalFrameWidth:a,logicalFrameHeight:d,logicalFrameLeft:c,logicalFrameTop:b,logicalScreenWidth:n,logicalScreenHeight:i,logicalScreenLeft:f,logicalScreenTop:B,logicalScreenRadius:o?0:t.cornerRadius,logicalFrameRadius:v,frameBackground:o?"linear-gradient(180deg, #1b1c20 0%, #0f1012 42%, #050608 100%)":"#000000",frameOutline:o?"0 0 0 1px #1f2125":"0 0 0 1px #333",metallicRingShadow:o?null:y,buttons:H,legacyHomeButton:o?{top:h+t.height+(w-g)/2,left:t.width/2-g/2+l,size:g,ring:$}:null,showHomeIndicator:t.homeIndicatorHeight>0,logicalHomeIndicatorStripHeight:t.homeIndicatorHeight}}function E(e){let t=e.side==="right",r=t?"inset(-3px -3px -3px 0)":"inset(-3px 0 -3px -3px)";return`
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{g as u}from"./chunk-56BIMCDH.js";var S=52,l=18,h=42,x=96,g=54,E=1.5,$="inset 0 0 0 0.5px #000, inset 0 0 0 2px #757575, inset 0 0 0 5px #212121",w=1;function y(e){let t=u(e),r=t.scale,o=!t.dynamicIsland&&t.homeIndicatorHeight===0&&t.cornerRadius===0,n=t.width,i=t.height,a=o?t.width+l*2:t.width+28,d=o?t.height+h+x:t.height+28,c=9.5,b=w,p=a+c*2,m=d+w*2,f=c+(o?l:14),B=o?h:14,H=o?S:t.cornerRadius+14,v=[{side:"right",top:t.hardwareButtons.lock.top,height:t.hardwareButtons.lock.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.ringToggle.top,height:t.hardwareButtons.ringToggle.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.volumeUp.top,height:t.hardwareButtons.volumeUp.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.volumeDown.top,height:t.hardwareButtons.volumeDown.height,width:t.hardwareButtons.width}];return{model:e,renderScale:r,outerWidth:Math.round(p*r),outerHeight:Math.round(m*r),logicalOuterWidth:p,logicalOuterHeight:m,logicalFrameWidth:a,logicalFrameHeight:d,logicalFrameLeft:c,logicalFrameTop:b,logicalScreenWidth:n,logicalScreenHeight:i,logicalScreenLeft:f,logicalScreenTop:B,logicalScreenRadius:o?0:t.cornerRadius,logicalFrameRadius:H,frameBackground:o?"linear-gradient(180deg, #1b1c20 0%, #0f1012 42%, #050608 100%)":"#000000",frameOutline:o?"0 0 0 1px #1f2125":"0 0 0 1px #333",metallicRingShadow:o?null:$,buttons:v,legacyHomeButton:o?{top:h+t.height+(x-g)/2,left:t.width/2-g/2+l,size:g,ring:E}:null,showHomeIndicator:t.homeIndicatorHeight>0,logicalHomeIndicatorStripHeight:t.homeIndicatorHeight}}function L(e){let t=e.side==="right",r=t?"inset(-3px -3px -3px 0)":"inset(-3px 0 -3px -3px)";return`
3
3
  <div
4
4
  aria-hidden="true"
5
5
  style="
@@ -24,7 +24,7 @@ import{g as u}from"./chunk-EHMSE3Q3.js";var S=52,l=18,h=42,w=96,g=54,$=1.5,y="in
24
24
  z-index:2;
25
25
  "
26
26
  ></div>
27
- `}function T(e,t){let r=e.buttons.map(E).join(""),o=e.metallicRingShadow?`
27
+ `}function _(e,t){let r=e.buttons.map(L).join(""),o=e.metallicRingShadow?`
28
28
  <div
29
29
  aria-hidden="true"
30
30
  style="
@@ -177,4 +177,4 @@ import{g as u}from"./chunk-EHMSE3Q3.js";var S=52,l=18,h=42,w=96,g=54,$=1.5,y="in
177
177
  </div>
178
178
  </div>
179
179
  </body>
180
- </html>`}async function D(e,t){let{chromium:r}=await import("playwright"),o=await r.launch({headless:!0});try{let n=await _(o);try{return await n.compose(e,t)}finally{await n.close()}}finally{await o.close()}}async function _(e){let t=new Map;async function r(o){let n=t.get(o);if(n)return n;let i=L(o),a=await e.newContext({viewport:{width:i.outerWidth,height:i.outerHeight},deviceScaleFactor:1}),d=await a.newPage(),c={layout:i,context:a,page:d};return t.set(o,c),c}return{async compose(o,n){let i=await r(n),a=`data:image/png;base64,${o.toString("base64")}`;return await i.page.setContent(T(i.layout,a),{waitUntil:"load"}),await i.page.waitForTimeout(20),await i.page.screenshot({type:"png",clip:{x:0,y:0,width:i.layout.outerWidth,height:i.layout.outerHeight},omitBackground:!0})},async close(){for(let o of t.values())await o.context.close();t.clear()}}}export{D as a,_ as b};
180
+ </html>`}async function A(e,t){let{chromium:r}=await import("playwright"),o=await r.launch({headless:!0});try{let n=await R(o);try{return await n.compose(e,t)}finally{await n.close()}}finally{await o.close()}}async function R(e){let t=new Map;async function r(o){let n=t.get(o);if(n)return n;let i=y(o),a=await e.newContext({viewport:{width:i.outerWidth,height:i.outerHeight},deviceScaleFactor:1}),d=await a.newPage(),c={layout:i,context:a,page:d};return t.set(o,c),c}return{async compose(o,n){let i=await r(n),a=`data:image/png;base64,${o.toString("base64")}`;return await i.page.setContent(_(i.layout,a),{waitUntil:"load"}),await i.page.waitForTimeout(20),await i.page.screenshot({type:"png",clip:{x:0,y:0,width:i.layout.outerWidth,height:i.layout.outerHeight},omitBackground:!0})},async close(){for(let o of t.values())await o.context.close();t.clear()}}}export{A as a,R as b};
@@ -0,0 +1,3 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{l as P,n as a,y as m}from"./chunk-PN6FWLD4.js";import l from"fs";import c from"path";var s="default",S="profiles.json",i=1;function o(e){let r=e.trim();if(!r)throw new Error("profile id is required");if(!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(r))throw new Error("profile ids must start with a letter or number and contain only letters, numbers, dot, dash, or underscore");if(r==="."||r==="..")throw new Error(`invalid profile id: ${r}`);return r}function d(){return c.join(a(),S)}function I(e){return`sootsim-profile-${o(e)}`}function h(e){return c.join(P(),"Partitions",I(e))}function A(e){return c.join(a(),"playwright",o(e))}function u(){try{let e=JSON.parse(l.readFileSync(d(),"utf8"));if(!e||e.version!==i)return{version:i,profiles:[]};let r=Array.isArray(e.profiles)?e.profiles.filter(t=>!!t&&typeof t.id=="string"&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string").map(t=>({id:o(t.id),createdAt:t.createdAt,updatedAt:t.updatedAt})):[];return{version:i,profiles:r}}catch{return{version:i,profiles:[]}}}function x(e){return[...e].sort((r,t)=>r.id===s?-1:t.id===s?1:r.id.localeCompare(t.id))}function p(e){if(e.profiles.some(t=>t.id===s))return{...e,profiles:x(e.profiles)};let r=new Date().toISOString();return{version:i,profiles:x([{id:s,createdAt:r,updatedAt:r},...e.profiles])}}function g(e){m();let r=p(e),t=`${d()}.tmp`;return l.writeFileSync(t,`${JSON.stringify(r,null,2)}
3
+ `,"utf8"),l.renameSync(t,d()),r}function y(){return g(u()).profiles}function E(e){let r=o(e);return y().find(t=>t.id===r)??null}function _(e=s){let r=o(e),t=E(r);return t||D(r)}function D(e){let r=o(e),t=p(u());if(t.profiles.some(w=>w.id===r))throw new Error(`profile already exists: ${r}`);let f=new Date().toISOString(),n={id:r,createdAt:f,updatedAt:f};return g({version:i,profiles:[...t.profiles,n]}),n}function F(e){let r=o(e);if(r===s)throw new Error("the default profile cannot be deleted; clear it instead");let t=p(u()),f=t.profiles.find(n=>n.id===r);if(!f)throw new Error(`profile not found: ${r}`);return g({version:i,profiles:t.profiles.filter(n=>n.id!==r)}),v(r),f}function v(e){let r=o(e);for(let t of[h(r),A(r)])try{l.rmSync(t,{recursive:!0,force:!0})}catch{}}export{A as a,y as b,_ as c,D as d,F as e,v as f};
@@ -1,6 +1,6 @@
1
- /*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{d as c,h as m,i as w}from"./chunk-C3QLIYCS.js";var y={timeoutMs:1800,settleMs:48,startWindowMs:64};function i(e){return new Promise(t=>setTimeout(t,e))}function M(e){return e.includes("--json")}function S(e){process.stdout.write(`${JSON.stringify(e??null,null,2)}
3
- `)}async function g(e,t,...r){return m(e,`__sootsimTest.${t}`,...r)}async function f(e,t,...r){return w(e,`SootSim.bridges.mainShell.${t}`,...r)}async function h(e,t={}){try{let r=await g(e,"waitForScreenTransitions",y);if(!t.verbose||!r?.started)return;if(r.timedOut){console.log(` screen transition still active after ${r.waitedMs}ms; continuing`);return}r.waitedMs>0&&console.log(` waited ${r.waitedMs}ms for screen transition settle`)}catch{}}function p(e){let t=e instanceof Error?e.message:String(e);return t.includes("call target not found: SootSim.bridges.mainShell")||t.includes("test bridge unavailable before app-in-worker boot")}async function R(e,t=0){let r=Date.now()+Math.max(0,t);for(;;)try{return await m(e,"SootSim.bridges.mainShell.getState")}catch(n){if(!p(n)||Date.now()>=r)throw n;await i(50)}}async function v(e,t,r,...n){let o=Date.now()+Math.max(0,r);for(;;)try{return await f(e,t,...n)}catch(s){if(!p(s)||Date.now()>=o)throw s;await i(50)}}async function x(e,t,r,n={}){let o=n.attempts??30,s=n.intervalMs??500,l=n.minNodeCount??10;for(let a=0;a<o;a++){let d=c(e,{commandTimeoutMs:t,browserId:r});try{let u=await d.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof u=="number"&&u>l)return{bridge:d,count:u}}catch{}d.close(),await i(s)}return null}async function T(e,t,r,n={}){let o=n.timeoutMs??8e3,s=n.intervalMs??250,l=Date.now()+o;for(;Date.now()<l;){let a=c(e,{commandTimeoutMs:t,browserId:r});try{return await a.send({type:"evaluate",code:"1"}),a}catch{a.close()}await i(s)}return null}async function _(e,t={}){let r=t.timeoutMs??1e4,n=t.errorGraceMs??3e3,o=t.pollIntervalMs??200;return await e.send({type:"evaluate",code:`(async () => {
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{d as c,h as m,i as w}from"./chunk-ZERYEI3L.js";var y={timeoutMs:1800,settleMs:48,startWindowMs:64};function i(e){return new Promise(t=>setTimeout(t,e))}function S(e){return e.includes("--json")}function M(e){process.stdout.write(`${JSON.stringify(e??null,null,2)}
3
+ `)}async function g(e,t,...r){return m(e,`__sootsimTest.${t}`,...r)}async function f(e,t,...r){return w(e,`SootSim.bridges.mainShell.${t}`,...r)}async function h(e,t={}){try{let r=await g(e,"waitForScreenTransitions",y);if(!t.verbose||!r?.started)return;if(r.timedOut){console.log(` screen transition still active after ${r.waitedMs}ms; continuing`);return}r.waitedMs>0&&console.log(` waited ${r.waitedMs}ms for screen transition settle`)}catch{}}function p(e){let t=e instanceof Error?e.message:String(e);return t.includes("call target not found: SootSim.bridges.mainShell")||t.includes("test bridge unavailable before app-in-worker boot")}async function R(e,t=0){let r=Date.now()+Math.max(0,t);for(;;)try{return await m(e,"SootSim.bridges.mainShell.getState")}catch(n){if(!p(n)||Date.now()>=r)throw n;await i(50)}}async function v(e,t,r,...n){let o=Date.now()+Math.max(0,r);for(;;)try{return await f(e,t,...n)}catch(s){if(!p(s)||Date.now()>=o)throw s;await i(50)}}async function x(e,t,r,n={}){let o=n.attempts??30,s=n.intervalMs??500,l=n.minNodeCount??10;for(let a=0;a<o;a++){let d=c(e,{commandTimeoutMs:t,simId:r});try{let u=await d.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof u=="number"&&u>l)return{bridge:d,count:u}}catch{}d.close(),await i(s)}return null}async function T(e,t,r,n={}){let o=n.timeoutMs??8e3,s=n.intervalMs??250,l=Date.now()+o;for(;Date.now()<l;){let a=c(e,{commandTimeoutMs:t,simId:r});try{return await a.send({type:"evaluate",code:"1"}),a}catch{a.close()}await i(s)}return null}async function _(e,t={}){let r=t.timeoutMs??1e4,n=t.errorGraceMs??3e3,o=t.pollIntervalMs??200;return await e.send({type:"evaluate",code:`(async () => {
4
4
  const start = Date.now()
5
5
  const deadline = start + ${r}
6
6
  const errorGraceAt = start + ${n}
@@ -34,4 +34,4 @@ import{d as c,h as m,i as w}from"./chunk-C3QLIYCS.js";var y={timeoutMs:1800,sett
34
34
  } finally {
35
35
  try { window.removeEventListener('sootsim:externalAppReady', onReady) } catch {}
36
36
  }
37
- })()`})??{ready:!1,source:"timeout",elapsedMs:0,nodes:0,errors:0}}export{i as a,M as b,S as c,g as d,h as e,R as f,v as g,x as h,T as i,_ as j};
37
+ })()`})??{ready:!1,source:"timeout",elapsedMs:0,nodes:0,errors:0}}export{i as a,S as b,M as c,g as d,h as e,R as f,v as g,x as h,T as i,_ as j};
@@ -0,0 +1,5 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{execFileSync as h,spawn as g}from"child_process";import{existsSync as s,readdirSync as k}from"fs";import{dirname as m,join as l,resolve as a}from"path";import{fileURLToPath as v}from"url";var c;function p(){if(c!==void 0)return c;try{c=m(v(import.meta.resolve("sootsim-engine/package.json")))}catch{c=null}return c}var I="dev.sootsim.simulator";function x(){let n=p();if(!n)return null;let e=l(n,"dist-electron/main.cjs");if(!s(e))return null;let i=D(n);return i?{path:i,platform:process.platform,kind:"dev-electron",engineDir:n}:null}function b(){let n=p();return n?s(l(n,"src-electron/main.ts")):!1}function D(n){let e=n;for(let i=0;i<6;i++){let t=l(e,"node_modules/.bin/electron");if(s(t))return t;let r=m(e);if(r===e)break;e=r}return null}function C(){let n=p(),i=["/Applications/sootsim.app",a(process.env.HOME||"","Applications/sootsim.app"),...n?[a(n,"app/sootsim.app")]:[]].find(t=>s(t));if(i)return{path:i,platform:"darwin",kind:"mac-app"};try{let t=h("mdfind",[`kMDItemCFBundleIdentifier == "${I}"`],{encoding:"utf8",timeout:3e3}).trim();if(t)return{path:t.split(`
3
+ `)[0],platform:"darwin",kind:"mac-app"}}catch{}return null}function f(n){if(!s(n))return null;let e=k(n).filter(i=>i.startsWith("sootsim")&&i.endsWith(".AppImage")).sort().reverse()[0];return e?l(n,e):null}function w(){let n=p(),i=[a(process.env.HOME||"","Applications/sootsim.AppImage"),a(process.env.HOME||"",".local/bin/sootsim.AppImage"),"/opt/sootsim/sootsim.AppImage","/opt/sootsim/sootsim",...n?[a(n,"app/sootsim.AppImage"),a(n,"release/linux-unpacked/sootsim")]:[]].find(r=>s(r));if(i)return{path:i,platform:"linux",kind:i.endsWith(".AppImage")?"linux-appimage":"linux-binary"};let t=n?f(a(n,"app"))||f(a(n,"release")):null;return t?{path:t,platform:"linux",kind:"linux-appimage"}:null}function A(){let n=x();if(n)return n;if(b()){let e=p(),i=l(e,"dist-electron/main.cjs");return s(i)?console.error(` no node_modules/.bin/electron found near ${e}. run \`bun install\`.`):console.error(` dist-electron/main.cjs missing in ${e}.
4
+ run: bun run --cwd packages/sootsim-engine build:electron-main
5
+ (or keep it fresh with: bun run watch:sootsim:electron-main)`),null}return process.platform==="darwin"?C():process.platform==="linux"?w():null}async function d(n,e,i={}){let t=i.inheritStdio?["ignore","inherit","inherit"]:"ignore";await new Promise((r,o)=>{let u=g(n,e,{detached:!0,stdio:t});u.once("error",o),u.once("spawn",()=>{u.unref(),r()})})}async function O(n,e=A(),i={}){if(!e)return{launched:!1};let t=[];if(i.device&&t.push("--device",i.device),i.profileId&&t.push("--profile",i.profileId),i.ephemeralProfile&&t.push("--ephemeral-profile"),e.kind==="mac-app"){let o=["-g","-a",e.path];return n&&o.push(L(n,i)),t.length>0&&o.push("--args",...t),await d("open",o),{launched:!0,via:"mac-app",target:e.path}}if(e.kind==="dev-electron"){let o=["--no-sandbox",e.engineDir||p()];return n&&o.push(n),t.length>0&&o.push(...t),await d(e.path,o,{inheritStdio:!0}),{launched:!0,via:"dev-electron",target:e.path}}let r=[];return n&&r.push(n),t.length>0&&r.push(...t),await d(e.path,r),{launched:!0,via:e.kind,target:e.path}}function L(n,e){if(!e.profileId&&!e.ephemeralProfile)return n;let i=new URL("sootsim://dev");return i.searchParams.set("url",n),e.profileId&&i.searchParams.set("profile",e.profileId),e.ephemeralProfile&&i.searchParams.set("ephemeral","1"),i.toString()}export{A as a,O as b};
@@ -1,3 +1,3 @@
1
- /*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{i as n}from"./chunk-EHMSE3Q3.js";var i=[];for(let[t,e]of Object.entries(n))e.cliFlag&&i.push({name:`--${e.cliFlag}`,short:e.cliFlagShort?`-${e.cliFlagShort}`:void 0,key:t,type:e.type==="enum"?"string":e.type,description:e.description,options:e.options,default:e.default});var a=i;function g(){let t=[];for(let e of a){let s=e.short?`${e.short}, ${e.name}`:` ${e.name}`,o=e.options?` [${e.options.join("|")}]`:"",r=e.default!==void 0?` (default: ${e.default})`:"";t.push(` ${s.padEnd(24)}${e.description}${o}${r}`)}return t.join(`
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{i as n}from"./chunk-56BIMCDH.js";var i=[];for(let[t,e]of Object.entries(n))e.cliFlag&&i.push({name:`--${e.cliFlag}`,short:e.cliFlagShort?`-${e.cliFlagShort}`:void 0,key:t,type:e.type==="enum"?"string":e.type,description:e.description,options:e.options,default:e.default});var a=i;function g(){let t=[];for(let e of a){let s=e.short?`${e.short}, ${e.name}`:` ${e.name}`,o=e.options?` [${e.options.join("|")}]`:"",r=e.default!==void 0?` (default: ${e.default})`:"";t.push(` ${s.padEnd(24)}${e.description}${o}${r}`)}return t.join(`
3
3
  `)}export{g as a};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  function d(t){let e=t.displayUrl||t.url;return t.status!=null?`${t.method} ${e} -> ${t.status}${t.statusText?` ${t.statusText}`:""}`:t.error?`${t.method} ${e} -> ${t.error}`:`${t.method} ${e}`}async function u(t,e,...o){return t.send({type:"call",path:`__sootsimTest.${e}`,args:o})}async function g(t,e={}){let o=await t.send({type:"evaluate",code:"window.__sootsimConsole?.count?.() || { errors: 0, warnings: 0, total: 0 }"});if(!o||typeof o!="object")return;let n=Math.max(0,Number(o.errors)||0),s=Math.max(0,Number(o.warnings)||0);if(n===0&&s===0)return;let r=[];if(n>0&&r.push(`${n} console error${n===1?"":"s"}`),s>0&&r.push(`${s} console warning${s===1?"":"s"}`),console.log(`
3
3
  console: ${r.join(", ")}`),e.errorsCommand&&console.log(` inspect: ${e.errorsCommand}`),s>0&&e.warningsCommand&&console.log(` inspect: ${e.warningsCommand}`),!e.includeTail||n===0)return;let i=await t.send({type:"evaluate",code:"window.__sootsimConsole?.getErrors?.(5) || []"});if(!(!Array.isArray(i)||i.length===0)){console.log(`
4
4
  recent console errors:
@@ -18,7 +18,7 @@ function d(t){let e=t.displayUrl||t.url;return t.status!=null?`${t.method} ${e}
18
18
  } catch {}
19
19
  return {
20
20
  url: window.location.href,
21
- bridgeId: window.__sootsimBridgeId || null,
21
+ simId: window.__sootsimSimId || null,
22
22
  nodeCount,
23
23
  mode: window.__sootsimRenderHost ? 'render-worker' : 'main-thread',
24
24
  shell: shell
@@ -31,4 +31,4 @@ function d(t){let e=t.displayUrl||t.url;return t.status!=null?`${t.method} ${e}
31
31
  : null,
32
32
  }
33
33
  })()`});if(!e||typeof e!="object")return;console.log(`
34
- state:`),e.bridgeId&&console.log(` session: ${e.bridgeId}`),e.url&&console.log(` url: ${e.url}`),e.mode&&console.log(` mode: ${e.mode}`);let o=Number(e.nodeCount)||0;console.log(` nodes: ${o}${o>10?" (ready)":" (not ready)"}`);let n=e.shell;if(n&&typeof n=="object"){let s=[n.state?`state=${n.state}`:null,n.activeApp?`app=${n.activeApp}`:null,n.showSwitcher?"switcher=open":null,n.switcherPhase?`phase=${n.switcherPhase}`:null].filter(Boolean);s.length>0&&console.log(` shell: ${s.join(" ")}`)}}async function h(t,e={}){try{await w(t)}catch{}try{await g(t,{includeTail:!0,errorsCommand:e.errorsCommand,warningsCommand:e.warningsCommand})}catch{}try{await f(t,{includeTail:!0,requestsCommand:e.requestsCommand})}catch{}}export{w as a,h as b};
34
+ state:`),e.simId&&console.log(` sim: ${e.simId}`),e.url&&console.log(` url: ${e.url}`),e.mode&&console.log(` mode: ${e.mode}`);let o=Number(e.nodeCount)||0;console.log(` nodes: ${o}${o>10?" (ready)":" (not ready)"}`);let n=e.shell;if(n&&typeof n=="object"){let s=[n.state?`state=${n.state}`:null,n.activeApp?`app=${n.activeApp}`:null,n.showSwitcher?"switcher=open":null,n.switcherPhase?`phase=${n.switcherPhase}`:null].filter(Boolean);s.length>0&&console.log(` shell: ${s.join(" ")}`)}}async function h(t,e={}){try{await w(t)}catch{}try{await g(t,{includeTail:!0,errorsCommand:e.errorsCommand,warningsCommand:e.warningsCommand})}catch{}try{await f(t,{includeTail:!0,requestsCommand:e.requestsCommand})}catch{}}export{w as a,h as b};
@@ -0,0 +1,5 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as C,d as x}from"./chunk-QWKO62QM.js";import{a as y}from"./chunk-QD7YIVPS.js";import{exec as D}from"child_process";import _ from"http";import k from"net";import{promisify as E}from"util";var v=E(D),U=250,T=120;function A(e,o=T){return new Promise(s=>{let n=new k.Socket,r=!1,i=c=>{r||(r=!0,n.destroy(),s(c))};n.setTimeout(o),n.once("connect",()=>i(!0)),n.once("timeout",()=>i(!1)),n.once("error",()=>i(!1)),n.connect(e,"localhost")})}function m(e,o,s="GET",n=U,r={}){return new Promise(i=>{let c=_.request({hostname:"localhost",port:e,path:o,method:s,timeout:n,headers:r},t=>{let a="";t.on("data",l=>a+=l.toString()),t.on("end",()=>i({statusCode:t.statusCode||0,body:a}))});c.on("error",()=>i(null)),c.setTimeout(n,()=>{c.destroy(),i(null)}),c.end()})}var M=[8081,8082,8083,8084,8085,8086,3e3,3001,19e3].map(e=>({port:e,pid:0}));function S(e,o){return!(e<=0||e>=2e4||o.has(e)||e>=5170&&e<=5200)}async function N(e=[]){let o=new Set(e);try{let{stdout:s}=await v("lsof -iTCP -sTCP:LISTEN -P -n 2>/dev/null | grep -E '^(node|bun)'",{encoding:"utf8",timeout:2e3});if(s.trim()){let n=new Map;for(let r of s.trim().split(`
3
+ `)){let i=r.trim().split(/\s+/);if(i.length<9)continue;let c=Number(i[1]),a=i[8].match(/:(\d+)$/);if(!a)continue;let l=Number(a[1]);S(l,o)&&(n.has(l)||n.set(l,c))}if(n.size>0)return[...n.entries()].map(([r,i])=>({port:r,pid:i}))}}catch{}try{let{stdout:s}=await v(`ss -tlnp 2>/dev/null | grep -E '"(node|bun)"'`,{encoding:"utf8",timeout:2e3});if(s.trim()){let n=new Map;for(let r of s.trim().split(`
4
+ `)){let i=r.match(/:(\d+)\s/),c=r.match(/pid=(\d+)/);if(!i)continue;let t=Number(i[1]),a=c?Number(c[1]):0;S(t,o)&&(n.has(t)||n.set(t,a))}if(n.size>0)return[...n.entries()].map(([r,i])=>({port:r,pid:i}))}}catch{}return M.filter(s=>S(s.port,o))}var w=new Map;async function R(e){if(e<=0)return null;let o=w.get(e);if(o)return o;try{let{stdout:s}=await v(`lsof -p ${e} -a -d cwd -Fn 2>/dev/null`,{encoding:"utf8",timeout:1500});for(let n of s.split(`
5
+ `))if(n.startsWith("n")&&n.length>1){let r=n.slice(1).trim();if(r)return w.set(e,r),r}}catch{}return null}function $(e,o){return{port:e,framework:o,bundleUrl:f(e,`http://localhost:${e}/index.bundle?platform=ios&dev=true&hot=true&minify=false`),hmrUrl:`ws://localhost:${e}/hot`,lastSeen:Date.now()}}function f(e,o){let s=y.find(r=>r.preferredPort===e),n=s?.runtimeConfig?C(o,s.runtimeConfig):o;return x(n)}function L(e){return e.includes("/node_modules/one/metro-entry.bundle")}function h(e,o,s){if(!o)return e;try{let n=JSON.parse(o.body),r=n?.extra?.expoClient||n?.extra||{};r.name&&(e.projectName=r.name),r.ios?.bundleIdentifier&&(e.bundleId=r.ios.bundleIdentifier),e.framework==="metro"&&r.sdkVersion&&(e.framework="expo");let i=n?.launchAsset?.url;i&&!e.patched&&!L(e.bundleUrl)&&(e.bundleUrl=f(e.port,i));let c=r.iconUrl||r.ios?.iconUrl||r.icon||r.ios?.icon;if(c)if(e.iconPath=c,s)if(c.startsWith("http"))e.iconUrl=s(c);else{let t=c.replace(/^\.\//,"");e.iconUrl=s(`http://localhost:${e.port}/assets/${t}`)}else e.iconUrl=c.startsWith("http")?c:`http://localhost:${e.port}/assets/${c.replace(/^\.\//,"")}`}catch{}return e}var u=new Set,d=new Set,p=new Set;async function I(e,o){if(!await A(e))return null;let s="/node_modules/one/metro-entry.bundle?platform=ios&dev=true",[n,r,i,c,t]=await Promise.all([u.has(e)?Promise.resolve(null):m(e,"/__soot/"),m(e,"/status"),m(e,s,"HEAD"),p.has(e)?Promise.resolve(null):m(e,"/","GET",U,{"expo-platform":"ios"}),d.has(e)?Promise.resolve(null):m(e,"/_expo/status")]);if(t&&t.statusCode===200?d.delete(e):d.has(e)||d.add(e),i&&i.statusCode>0&&i.statusCode<400)return u.add(e),p.add(e),h({port:e,framework:"one",bundleUrl:f(e,`http://localhost:${e}${s}&minify=false`),hmrUrl:`ws://localhost:${e}/hot`,lastSeen:Date.now()},c,o);if(r&&r.body.includes("packager-status:running"))return u.add(e),h($(e,t&&t.statusCode===200?"expo":"metro"),c,o);if(c)try{let a=JSON.parse(c.body);if((a?.extra?.expoClient||{}).name){let g=a?.launchAsset?.url||`http://localhost:${e}/index.bundle?platform=ios&dev=true&hot=true&minify=false`;return u.add(e),h({port:e,framework:"one",bundleUrl:f(e,g),hmrUrl:`ws://localhost:${e}/hot`,lastSeen:Date.now()},c,o)}}catch{}return n&&n.statusCode===200&&n.body.includes("sootsim-patched")?(u.delete(e),h({port:e,framework:"one",bundleUrl:f(e,`http://localhost:${e}/__soot/bundle.js`),hmrUrl:`ws://localhost:${e}/hot`,lastSeen:Date.now(),patched:!0},c,o)):(u.add(e),null)}function O(e){let o=e.projectName?.trim().toLowerCase();return!!(o==="soot"||o==="sootsim"||e.bundleId?.trim().toLowerCase()?.startsWith("dev.soot"))}var b=new Map,H=3e4,B=1500;function G(e){return!e||e.framework==="metro"||e.framework==="unknown"}function W(e){return e?f(e.port,e.bundleUrl)===e.bundleUrl:!0}function j(e,o,s=Date.now()){if(o===0||e.pid!==o||!W(e.result))return!1;let n=s-e.cachedAt;return!(e.result===null&&n>=H||G(e.result)&&n>=B)}async function X(e={}){let o=await N(e.excludePorts),s=new Set(o.map(t=>t.port));for(let t of[...b.keys()])s.has(t)||b.delete(t);for(let t of[...u])s.has(t)||u.delete(t);for(let t of[...d])s.has(t)||d.delete(t);for(let t of[...p])s.has(t)||p.delete(t);let n=[],r=[];for(let{port:t,pid:a}of o){let l=b.get(t);if(l&&j(l,a)){l.result&&n.push(l.result);continue}l&&l.pid!==a&&(u.delete(t),d.delete(t),p.delete(t)),r.push({port:t,pid:a})}r.length>0&&(await Promise.all(r.map(a=>I(a.port,e.buildIconProxyUrl)))).forEach((a,l)=>{let{port:g,pid:P}=r[l];P!==0&&b.set(g,{pid:P,result:a,cachedAt:Date.now()}),a&&n.push(a)});let i=new Map;for(let{port:t,pid:a}of o)a>0&&i.set(t,a);await Promise.all(n.map(async t=>{let a=i.get(t.port);if(!a)return;t.pid=a;let l=await R(a);l&&(t.cwd=l)}));let c=new Set(i.values());for(let t of[...w.keys()])c.has(t)||w.delete(t);return n.filter(t=>!O(t))}export{X as a};
@@ -0,0 +1,17 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as T,c as P,e as v}from"./chunk-PERKPZ7T.js";import{E as B,F as k}from"./chunk-PN6FWLD4.js";import{WebSocket as I}from"ws";function C(){let e=B();return e&&k(e)?e.bridgePort:7668}var h=class extends Error{lock;constructor(t,s){super(t),this.name="BridgeSimLockedError",this.lock=s}};function x(e){return e==="flag"?"via --sim":e==="saved"?"saved via `sootsim use`":"primary fallback \u2014 no sim pinned"}function $(e,t={}){let s=new Set,c=t.port??C(),l=t.commandTimeoutMs??15e3,d,u="none",p=new Set(t.stripBooleanFlags??[]),g=new Set(t.stripValueFlags??[]);for(let i=0;i<e.length;i++){let a=e[i];if(a==="--port"||a==="-p"){s.add(i),i+1<e.length&&(s.add(i+1),c=Number(e[i+1])),i++;continue}if(a.startsWith("--port=")){s.add(i),c=Number(a.slice(7));continue}if(a==="--timeout"){s.add(i),i+1<e.length&&(s.add(i+1),l=Number(e[i+1])),i++;continue}if(a==="--sim"){s.add(i),i+1<e.length&&(s.add(i+1),d=e[i+1]?.trim()||void 0,u="flag"),i++;continue}if(p.has(a)){s.add(i);continue}g.has(a)&&(s.add(i),i+1<e.length&&s.add(i+1),i++)}if(!d){let i=P();i&&(d=i.trim()||void 0,u="saved")}return{positional:e.filter((i,a)=>!s.has(a)),wsPort:c,simId:d,simIdSource:u,commandTimeoutMs:l}}function O(e,t={}){let s=1,c=t.commandTimeoutMs??15e3,l=new Map,d=new I(`ws://localhost:${e}`),u=t.simId?{key:`sim:${t.simId}`,source:"explicit-sim-id",stable:!0}:T(),p=new Promise((n,r)=>{d.on("open",()=>{try{d.send(JSON.stringify({type:"bridge:hello",id:0,cliIdentityKey:u.key,cliIdentitySource:u.source,cliLabel:t.cliLabel}))}catch{}n()}),d.on("error",o=>r(new Error(`could not connect to ws://localhost:${e}: ${o.message}`)))}),g=!1,i=!1;function a(n,r){if(i||process.env.SOOTSIM_QUIET_TARGET_NOTICE==="1"||n.startsWith("bridge:")||n==="focus"||n==="close")return;i=!0;let o=r??"primary",m=x(r?t.simIdSource:"none");process.stderr.write(` \u2192 ${o} (${m})
3
+ `)}return d.on("message",n=>{let r;try{r=JSON.parse(n.toString())}catch{return}if(r.id===0)return;let o=l.get(r.id);o&&(l.delete(r.id),r.i>0&&!g&&(g=!0,process.stderr.write(`
4
+ \u26A0 ${r.i} other CLI identity/identities are driving this sim
5
+ taps, scrolls, and keyboard input from multiple agents will collide on
6
+ the same screen state (this is not a bridge throughput limit).
7
+ use \`sootsim open --new\` for an isolated sim per agent.
8
+
9
+ `)),r.error?r.o?o.reject(new h(r.error,r.o)):o.reject(new Error(r.error)):o.resolve(r.result))}),d.on("close",(n,r)=>{let o=r?.toString()||"connection closed";for(let[m,y]of l)l.delete(m),y.reject(new Error(`sim disconnected: ${o} (code ${n})`))}),{async send(n){let r=async o=>{await p;let m=s++;return new Promise((y,w)=>{let S=setTimeout(()=>{l.delete(m),w(new Error(`command timed out after ${Math.round(c/1e3)}s`))},c);l.set(m,{resolve:b=>{clearTimeout(S),y(b)},reject:b=>{clearTimeout(S),w(b)}});let f={...n,id:m};f.simId===void 0&&o&&(f.simId=o),a(n.type??"",f.simId),d.send(JSON.stringify(f))})};try{return await r(t.simId)}catch(o){let m=o instanceof Error?o.message:String(o);if(t.fallbackOnMissingSimId&&t.simId&&n.simId===void 0&&m===`no sim connected with id ${t.simId}`)return v(),process.stderr.write(` \u26A0 saved sim ${t.simId} is gone \u2014 falling back to primary
10
+ pin a sim with: sootsim use <sim>
11
+ `),i=!1,r(void 0);throw o}},async listSims(){let n=await this.send({type:"bridge:list-sims"});return Array.isArray(n)?n:[]},async openUrl(n,r={}){return this.send({type:"bridge:open",url:n,newWindow:r.newWindow===!0})},async focusSim(n){return this.send({type:"focus",simId:n})},async closeSim(n){return this.send({type:"close",simId:n})},async claim(n,r={}){return await this.send({type:"bridge:claim",simId:n,force:r.force===!0})},close(){try{d.readyState===I.OPEN&&d.send(JSON.stringify({type:"bridge:bye",id:0}))}catch{}d.close();let n=setTimeout(()=>{d.readyState!==I.CLOSED&&d.terminate()},250)}}}function F(e){return O(e.wsPort,{commandTimeoutMs:e.commandTimeoutMs,simId:e.simId,fallbackOnMissingSimId:e.simIdSource==="saved",simIdSource:e.simIdSource})}async function N(e){try{return await e.send({type:"evaluate",code:"document.hidden"})===!0?(process.stderr.write(`
12
+ \u26A0 target sim is hidden (document.hidden = true)
13
+ animations and rAF callbacks are throttled \u2014 coordinates may be wrong
14
+ and launch/transition animations will not complete.
15
+ bring the sim to the foreground or use: sootsim debug eval "window.focus()"
16
+
17
+ `),{hidden:!0,warned:!0}):{hidden:!1,warned:!1}}catch{return{hidden:!1,warned:!1}}}async function R(e,t,s={}){let c={type:"evaluate",code:t};return s.acquireLock&&(c.acquireLock=!0),e.send(c)}async function _(e,t,...s){return e.send({type:"call",path:t,args:s})}async function D(e,t,...s){return e.send({type:"call",path:t,args:s,acquireLock:!0})}export{C as a,h as b,$ as c,O as d,F as e,N as f,R as g,_ as h,D as i};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import"./chunk-WWDJCKMI.js";import{existsSync as x,readFileSync as j}from"fs";import{resolve as g}from"path";async function P(s){(s.includes("--help")||s.includes("-h"))&&(console.log(`
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import"./chunk-B3RAGRK6.js";import{existsSync as x,readFileSync as j}from"fs";import{resolve as g}from"path";async function P(s){(s.includes("--help")||s.includes("-h"))&&(console.log(`
3
3
  sootsim compat \u2014 check package compatibility
4
4
 
5
5
  usage:
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import"./chunk-WWDJCKMI.js";import{existsSync as i,writeFileSync as n,readFileSync as c}from"fs";import{resolve as t}from"path";async function a(s){let e=s[0];switch((!e||s.includes("--help")||s.includes("-h"))&&(console.log(`
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import"./chunk-B3RAGRK6.js";import{existsSync as i,writeFileSync as n,readFileSync as c}from"fs";import{resolve as t}from"path";async function a(s){let e=s[0];switch((!e||s.includes("--help")||s.includes("-h"))&&(console.log(`
3
3
  sootsim config \u2014 manage sootsim configuration
4
4
 
5
5
  usage:
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i,l as j,m as k,n as l,o as m}from"./chunk-2ZPJHSIJ.js";import"./chunk-QWKO62QM.js";import"./chunk-Z5X3PITK.js";import"./chunk-HYYMBXIX.js";import"./chunk-YFXTO4QX.js";import"./chunk-WLIVBPPY.js";import"./chunk-JMU5IGIU.js";import"./chunk-4OHVCGMF.js";import"./chunk-4IO3D5XG.js";import"./chunk-ZERYEI3L.js";import"./chunk-PERKPZ7T.js";import"./chunk-ERLA3F77.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";export{d as buildOpenUrl,c as buildShellUrl,f as printConnectedSims,a as resolveBundleTarget,b as resolveDefaultShellBaseUrl,l as runClaimCommand,m as runCloseCommand,k as runFocusCommand,h as runListCommand,i as runOpenCommand,j as runUseCommand,e as summarizeSimUrl,g as waitForSimMatch};
@@ -0,0 +1,22 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{c as I,e as N,i as S}from"./chunk-ZERYEI3L.js";import"./chunk-PERKPZ7T.js";import"./chunk-ERLA3F77.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";import{createWriteStream as v,mkdirSync as k,writeFileSync as w}from"fs";import{dirname as C,resolve as T}from"path";import{Readable as x}from"stream";import{pipeline as y}from"stream/promises";import{createGzip as F}from"zlib";async function E(r,l){if(r.includes("--help")||r.includes("-h"))return console.log(`
3
+ sootsim cpu-profile \u2014 capture a sampled CPU trace from the tenant worker
4
+
5
+ usage:
6
+ sootsim cpu-profile [options]
7
+
8
+ options:
9
+ --duration <seconds> recording duration (default: 5)
10
+ --output <path> output file (default: /tmp/sootsim.cpuprofile)
11
+ if the path ends in .gz, the output is gzipped
12
+ --sample-interval <ms> requested sample interval in ms (default: 10 \u2014
13
+ chrome may clamp upward)
14
+ --max-buffer <n> max samples buffered (default: 100000)
15
+ --sim <sim> target a specific sim
16
+ --port <number> ws bridge port (default: 7668)
17
+
18
+ examples:
19
+ sootsim cpu-profile --duration 3
20
+ sootsim cpu-profile --duration 10 --output /tmp/after.cpuprofile.gz
21
+ sootsim cpu-profile --duration 3 -o /tmp/before.cpuprofile
22
+ `),0;let n=Number(b(r,"--duration")??"5");if(!Number.isFinite(n)||n<=0)return console.error(" --duration must be a positive number (seconds)"),1;let m=Number(b(r,"--sample-interval")??"10");if(!Number.isFinite(m)||m<=0)return console.error(" --sample-interval must be a positive number (milliseconds)"),1;let s=Number(b(r,"--max-buffer")??"100000");if(!Number.isFinite(s)||s<=0)return console.error(" --max-buffer must be a positive number"),1;let p=b(r,"--output")??b(r,"-o"),u=T(process.cwd(),p??"/tmp/sootsim.cpuprofile"),g=u.endsWith(".gz"),h=I(r,{port:l.port,stripValueFlags:["--duration","--output","-o","--sample-interval","--max-buffer"]}),c=N({...h,commandTimeoutMs:Math.max(3e4,(n+20)*1e3)});try{let a=await S(c,"SootSim.bridges.workerCpuProfileStart",{sampleInterval:m,maxBufferSize:s});if(!a?.started)return console.error(" could not start tenant-worker profiler."),console.error(" is sootsim running? (try `bun sootsim list`)"),1;l.verbose&&console.error(` started: sampleInterval=${a.sampleInterval}ms buffer=${a.maxBufferSize}`),console.log(` recording for ${n}s\u2026`),await new Promise(o=>setTimeout(o,n*1e3));let t=await S(c,"SootSim.bridges.workerCpuProfileStop");if(!t||t.error||!t.trace)return console.error(` profile capture failed: ${t?.error??"no trace returned"}`),t?.error?.includes("not available")&&(console.error(" your browser or page is missing the JS Self-Profiler API."),console.error(" requires chromium-based browser and Document-Policy: js-profiling.")),1;let P=z(t.trace),e=JSON.stringify(P);k(C(u),{recursive:!0}),g?await y(x.from([e]),F(),v(u)):w(u,e);let i=(Buffer.byteLength(e)/1024/1024).toFixed(2);return console.log(` samples: ${P.samples.length} (${i} MB uncompressed)`),console.log(` saved: ${u}`),console.log(" open in chrome devtools \u2192 Performance \u2192 Load profile to inspect."),0}catch(a){let t=a?.message??String(a);return console.error(` profile failed: ${t}`),/could not connect|ECONNREFUSED/i.test(t)&&console.error(" is sootsim running? (try `bun sootsim list`)"),1}finally{c.close()}}function z(r){let l=r.frames??[],n=r.resources??[],m=r.stacks??[],s=r.samples??[],p=1,u=[{id:p,callFrame:{functionName:"(root)",scriptId:"0",url:"",lineNumber:-1,columnNumber:-1},hitCount:0,children:[]}];for(let e=0;e<m.length;e++){let i=m[e],o=l[i.frameId]??{name:"(unknown)"},f=o.resource!==void 0?n[o.resource]??"":"";u.push({id:e+2,callFrame:{functionName:o.name||"(anonymous)",scriptId:o.resource!==void 0?String(o.resource):"0",url:f,lineNumber:typeof o.line=="number"?o.line-1:-1,columnNumber:typeof o.column=="number"?o.column-1:-1},hitCount:0,children:[]})}for(let e=0;e<m.length;e++){let i=m[e],o=e+2,f=i.parentId!==void 0?i.parentId+2:p,d=u[f-1];d&&!d.children.includes(o)&&d.children.push(o)}let g=[],h=[],c=s.length>0?s[0].timestamp:0,a=c;for(let e=0;e<s.length;e++){let i=s[e],o=i.stackId!==void 0?i.stackId+2:p;g.push(o);let f=u[o-1];f&&f.hitCount++;let d=e===0?0:i.timestamp-a;h.push(Math.max(0,Math.round(d*1e3))),a=i.timestamp}let t=Math.round(c*1e3),P=s.length>0?Math.round(s[s.length-1].timestamp*1e3):t;return{nodes:u,startTime:t,endTime:P,samples:g,timeDeltas:h}}function b(r,l){let n=r.indexOf(l);if(!(n<0||n===r.length-1))return r[n+1]}export{E as runCpuProfile};
@@ -0,0 +1,83 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as T,b as _}from"./chunk-S74RCIVB.js";import"./chunk-WFXYY3DU.js";import"./chunk-ERLA3F77.js";import{g as I,o as C,p as w,q as B}from"./chunk-PN6FWLD4.js";import{a as W}from"./chunk-B3RAGRK6.js";import{execFileSync as tt,spawnSync as n}from"child_process";import{existsSync as a,mkdirSync as v,readFileSync as et,rmSync as S,writeFileSync as R}from"fs";import{homedir as $}from"os";import{dirname as U,resolve as m}from"path";import{execFileSync as Y}from"child_process";import{chmodSync as H,mkdirSync as D,rmSync as K,writeFileSync as L}from"fs";import{dirname as P}from"path";var X="dev.sootsim.daemon",N="SootSim Daemon",O="0.1.36";function F(t,e,r){let o=w(),s=B(),i=P(P(s)),f=P(s),u=`${i}/Resources`;K(o,{recursive:!0,force:!0}),D(C(),{recursive:!0}),D(f,{recursive:!0}),D(u,{recursive:!0}),L(`${i}/Info.plist`,Q()),L(`${i}/PkgInfo`,"APPL????"),L(s,z(t,e,r)),H(s,493);try{Y("codesign",["--force","--sign","-","--deep",o],{stdio:"pipe"})}catch(c){let g=c instanceof Error?c.message:String(c);console.warn(` warning: ad-hoc codesign of ${o} failed: ${g}
3
+ the daemon will still run, but Login Items may show a generic name.`)}return{bundlePath:o,launcherPath:s}}function Q(){return`<?xml version="1.0" encoding="UTF-8"?>
4
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
5
+ <plist version="1.0">
6
+ <dict>
7
+ <key>CFBundleDevelopmentRegion</key><string>en</string>
8
+ <key>CFBundleDisplayName</key><string>${N}</string>
9
+ <key>CFBundleExecutable</key><string>sootsim-daemon</string>
10
+ <key>CFBundleIdentifier</key><string>${X}</string>
11
+ <key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
12
+ <key>CFBundleName</key><string>${N}</string>
13
+ <key>CFBundlePackageType</key><string>APPL</string>
14
+ <key>CFBundleShortVersionString</key><string>${O}</string>
15
+ <key>CFBundleSignature</key><string>????</string>
16
+ <key>CFBundleVersion</key><string>${O}</string>
17
+ <key>LSBackgroundOnly</key><true/>
18
+ <key>LSUIElement</key><true/>
19
+ <key>LSMinimumSystemVersion</key><string>13.0</string>
20
+ <key>NSHumanReadableCopyright</key><string>Tamagui LLC</string>
21
+ </dict>
22
+ </plist>
23
+ `}function z(t,e,r){let s=[t.executable,...t.prefixArgs,"server","--quiet","--port",String(e)].map(J).join(" ");return`#!/bin/sh
24
+ # SootSim Daemon launcher \u2014 auto-generated by 'sootsim daemon install'.
25
+ # launchd spawns this; we exec the real sootsim invocation in place so
26
+ # launchd tracks the daemon process, not the shell wrapper.
27
+ #
28
+ # stdout: ${r.stdout}
29
+ # stderr: ${r.stderr}
30
+ exec ${s}
31
+ `}function J(t){return`'${t.replace(/'/g,"'\\''")}'`}var q=60,p="dev.sootsim.daemon",E="dev.sootsim.server",d="sootsim-server",h=m($(),"Library/Logs/sootsim"),rt=m($(),".local/state/sootsim");async function At(t,e={}){let[r,...o]=t,s=e.port??7668;if(!r||r==="--help"||r==="-h"){M();return}new Set(["install","uninstall","restart","start","stop"]).has(r)&&T({event:`daemon_${r}`,properties:{platform:process.platform,subsource:"daemon"}});try{switch(r){case"install":return await lt({port:s,force:o.includes("--force")});case"uninstall":return await ut();case"status":return await dt();case"restart":return await mt();case"start":return await pt();case"stop":return await gt();default:console.error(` unknown daemon subcommand: ${r}`),M(),process.exit(1)}}finally{await _()}}function M(){console.log(`
32
+ sootsim daemon \u2014 manage the sootsim bridge daemon
33
+
34
+ the daemon is registered automatically on first CLI use, so you usually
35
+ don't need to run any of these subcommands. use them to inspect or remove
36
+ the launchd/systemd agent.
37
+
38
+ usage:
39
+ sootsim daemon uninstall stop and remove the login agent
40
+ sootsim daemon status show whether the agent is installed + running
41
+ sootsim daemon restart restart the agent (use after 'npm update -g sootsim')
42
+ sootsim daemon start start the installed agent
43
+ sootsim daemon stop stop the running agent
44
+
45
+ examples:
46
+ sootsim daemon status
47
+ sootsim daemon restart
48
+ sootsim daemon uninstall
49
+ `)}function ot(){let t=st();return{executable:process.execPath,prefixArgs:[t]}}function st(){try{let e=tt("which",["sootsim"],{encoding:"utf8"}).trim();if(e&&a(e))return V(e)}catch{}let t=process.argv[1];if(t&&a(t))return V(t);throw new Error("could not locate the sootsim binary")}function V(t){try{return W("fs").realpathSync(t)}catch{return t}}function nt(t,e){v(h,{recursive:!0});let r=m(h,"server.out.log"),o=m(h,"server.err.log"),{launcherPath:s}=F(t,e,{stdout:r,stderr:o}),i=` <string>${at(s)}</string>`;return`<?xml version="1.0" encoding="UTF-8"?>
50
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
51
+ <plist version="1.0">
52
+ <dict>
53
+ <key>Label</key><string>${p}</string>
54
+ <key>ProgramArguments</key>
55
+ <array>
56
+ ${i}
57
+ </array>
58
+ <key>RunAtLoad</key><true/>
59
+ <key>KeepAlive</key><true/>
60
+ <key>ThrottleInterval</key><integer>${q}</integer>
61
+ <key>ProcessType</key><string>Background</string>
62
+ <key>StandardOutPath</key><string>${r}</string>
63
+ <key>StandardErrorPath</key><string>${o}</string>
64
+ </dict>
65
+ </plist>
66
+ `}function it(t,e){return v(rt,{recursive:!0}),`[Unit]
67
+ Description=sootsim bridge daemon
68
+ After=default.target
69
+
70
+ [Service]
71
+ Type=simple
72
+ ExecStart=${[t.executable,...t.prefixArgs].map(ct).join(" ")} server --quiet --port ${e}
73
+ Restart=always
74
+ RestartSec=${q}
75
+
76
+ [Install]
77
+ WantedBy=default.target
78
+ `}function at(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function ct(t){return/[^\w@%+=:,./-]/.test(t)?`'${t.replace(/'/g,"'\\''")}'`:t}function b(){return m($(),"Library/LaunchAgents",`${p}.plist`)}function j(){return m($(),"Library/LaunchAgents",`${E}.plist`)}function x(){return m($(),".config/systemd/user",`${d}.service`)}function G(){let t=j();return a(t)?(n("launchctl",["bootout",`gui/${process.getuid()}/${E}`],{stdio:"ignore"}),S(t,{force:!0}),!0):!1}async function lt({port:t,force:e}){if(I())throw new Error(`refusing to install the persistent sootsim daemon agent from a dev checkout.
79
+ the launchd / systemd agent would point at workspace artifacts that change
80
+ between sessions, and would serve stale prod-built engine assets instead of
81
+ the live \`bun dev:sootsim\` output. start the daemon manually in another
82
+ shell with: bun sootsim server
83
+ (set SOOTSIM_FORCE_DAEMON_INSTALL=1 to override.)`);let r=ot();if(console.log(` binary: ${[r.executable,...r.prefixArgs].join(" ")}`),console.log(` port: ${t}`),process.platform==="darwin"){G()&&console.log(` migrated away from legacy ${E} plist`);let o=b();if(a(o)&&!e){console.log(` already installed at ${o}`),console.log(" pass --force to overwrite, or use 'sootsim daemon restart' to reload");return}v(U(o),{recursive:!0}),R(o,nt(r,t)),console.log(` wrote ${o}`);let s=`gui/${process.getuid()}`,i=`${s}/${p}`,f=()=>{let l=n("launchctl",["bootstrap",s,o],{stdio:"pipe",encoding:"utf8"}),k=(l.stderr||l.stdout||"").trim();if(l.status!==0)return{ok:!1,reason:`bootstrap exit ${l.status}${k?`: ${k}`:""}`};let A=n("launchctl",["print",i],{encoding:"utf8"});return A.status!==0?{ok:!1,reason:`bootstrap returned 0 but service not registered (print exit ${A.status})`}:{ok:!0}},u=f();if(!u.ok){let l=u.reason;if(n("launchctl",["bootout",i],{stdio:"ignore"}),u=f(),!u.ok)throw new Error(`launchctl bootstrap failed: ${u.reason}`+(l!==u.reason?` (initial: ${l})`:"")+" \u2014 try `sootsim daemon uninstall` then retry, or reboot if launchd state is stuck.")}let c=Date.now()+4e3,g,y;for(;Date.now()<c;){let l=n("launchctl",["print",i],{encoding:"utf8"});if(l.status===0&&(g=l.stdout?.match(/state\s*=\s*(\w+)/)?.[1],y=l.stdout?.match(/pid\s*=\s*(\d+)/)?.[1],g==="running"||y))break;await new Promise(k=>setTimeout(k,150))}if(g!=="running"&&!y)throw new Error(`daemon registered but did not reach running state within 4s (last state: ${g||"unknown"}). check ${m(h,"server.err.log")} \u2014 typically a stale runtime or a port already bound by another process.`);console.log(` registered (state: ${g||"unknown"}${y?`, pid ${y}`:""}, log: ${m(h,"server.err.log")})`);return}if(process.platform==="linux"){let o=x();if(a(o)&&!e){console.log(` already installed at ${o}`),console.log(" pass --force to overwrite, or use 'sootsim daemon restart' to reload");return}v(U(o),{recursive:!0}),R(o,it(r,t)),console.log(` wrote ${o}`);let s=n("systemctl",["--user","daemon-reload"],{stdio:"pipe",encoding:"utf8"});if(s.status!==0){let c=(s.stderr||s.stdout||"").trim();throw new Error(`systemctl daemon-reload failed${c?`: ${c}`:""}`)}let i=n("systemctl",["--user","enable","--now",d],{stdio:"pipe",encoding:"utf8"});if(i.status!==0){let c=(i.stderr||i.stdout||"").trim();throw new Error(`systemctl enable --now failed${c?`: ${c}`:""} \u2014 try \`sootsim daemon uninstall\` then retry.`)}let u=(n("systemctl",["--user","is-active",d],{encoding:"utf8"}).stdout||"").trim()||"unknown";console.log(` registered (state: ${u}, journalctl --user -u ${d} to tail logs)`);return}console.error(` sootsim daemon install is not supported on ${process.platform}`),console.error(" run 'sootsim server' in a persistent shell instead"),process.exit(1)}async function ut(){if(process.platform==="darwin"){let t=b(),e=G();e&&console.log(` removed legacy ${j()}`);let r=a(t);r&&(n("launchctl",["bootout",`gui/${process.getuid()}/${p}`],{stdio:"ignore"}),S(t,{force:!0}),console.log(` removed ${t}`));let o=w();a(o)&&(S(o,{recursive:!0,force:!0}),console.log(` removed ${o}`)),!r&&!e&&console.log(" not installed");return}if(process.platform==="linux"){let t=x();if(!a(t)){console.log(" not installed");return}n("systemctl",["--user","disable","--now",d],{stdio:"ignore"}),S(t,{force:!0}),n("systemctl",["--user","daemon-reload"],{stdio:"ignore"}),console.log(` removed ${t}`);return}console.error(` unsupported platform: ${process.platform}`),process.exit(1)}async function dt(){if(process.platform==="darwin"){let t=b();if(!a(t)){console.log(" installed: no");return}console.log(` installed: yes (${t})`);let e=ft(t);e&&console.log(` binary: ${e}`);let r=n("launchctl",["print",`gui/${process.getuid()}/${p}`],{encoding:"utf8"});if(r.status===0){let o=r.stdout.match(/state\s*=\s*(\w+)/)?.[1],s=r.stdout.match(/pid\s*=\s*(\d+)/)?.[1];console.log(` state: ${o||"unknown"}${s?` (pid ${s})`:""}`)}else console.log(" state: not running");return}if(process.platform==="linux"){let t=x();if(!a(t)){console.log(" installed: no");return}console.log(` installed: yes (${t})`);let e=n("systemctl",["--user","is-active",d],{encoding:"utf8"});console.log(` state: ${e.stdout.trim()||"unknown"}`);return}console.error(` unsupported platform: ${process.platform}`),process.exit(1)}async function mt(){if(process.platform==="darwin"){let t=b();a(t)||(console.error(" daemon not registered \u2014 run any sootsim command to bootstrap it"),process.exit(1));let e=n("launchctl",["kickstart","-k",`gui/${process.getuid()}/${p}`],{stdio:"pipe",encoding:"utf8"});e.status!==0&&(console.error(` kickstart failed: ${e.stderr?.trim()}`),process.exit(1)),console.log(" restarted");return}if(process.platform==="linux"){let t=x();a(t)||(console.error(" daemon not registered \u2014 run any sootsim command to bootstrap it"),process.exit(1));let e=n("systemctl",["--user","restart",d],{stdio:"pipe",encoding:"utf8"});e.status!==0&&(console.error(` restart failed: ${e.stderr?.trim()}`),process.exit(1)),console.log(" restarted");return}console.error(` unsupported platform: ${process.platform}`),process.exit(1)}async function pt(){if(process.platform==="darwin"){n("launchctl",["kickstart",`gui/${process.getuid()}/${p}`],{stdio:"inherit"});return}if(process.platform==="linux"){n("systemctl",["--user","start",d],{stdio:"inherit"});return}console.error(` unsupported platform: ${process.platform}`),process.exit(1)}async function gt(){if(process.platform==="darwin"){n("launchctl",["bootout",`gui/${process.getuid()}/${p}`],{stdio:"inherit"});return}if(process.platform==="linux"){n("systemctl",["--user","stop",d],{stdio:"inherit"});return}console.error(` unsupported platform: ${process.platform}`),process.exit(1)}function ft(t){try{return et(t,"utf8").match(/<array>\s*<string>([^<]+)<\/string>/)?.[1]||null}catch{return null}}export{lt as daemonInstall,At as runDaemon};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{d as f}from"./chunk-UQ3N6FZF.js";import{b as N}from"./chunk-5TTQKPGH.js";import{c as v,e as $,g as S}from"./chunk-C3QLIYCS.js";import"./chunk-W7CYWXRZ.js";import"./chunk-MZPAJ5PQ.js";import"./chunk-WRF43M33.js";import"./chunk-WWDJCKMI.js";var A=["portals","sheets","layout","onlayout","animated","render","touch","yoga","all"],x="__sootsimShellAnimationTrace",R="__sootsimDebugAnimation";function D(){console.log(`
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{d as f}from"./chunk-X6BP5JFC.js";import{b as N}from"./chunk-Z5X3PITK.js";import{c as v,e as $,g as S}from"./chunk-ZERYEI3L.js";import"./chunk-PERKPZ7T.js";import"./chunk-ERLA3F77.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";var A=["portals","sheets","layout","onlayout","animated","render","touch","yoga","all"],x="__sootsimShellAnimationTrace",R="__sootsimDebugAnimation";function D(){console.log(`
3
3
  sootsim debug \u2014 drive __sootsimDebug from the terminal
4
4
 
5
5
  usage:
@@ -49,7 +49,7 @@ subcommands:
49
49
 
50
50
  options:
51
51
  --port <port> WS bridge port (default: ${7668})
52
- --session <session-id> target a specific connected browser tab
52
+ --sim <sim> target a specific connected sim
53
53
  --pretty format JSON output for humans (default)
54
54
  --json compact JSON output for pipelines
55
55
 
@@ -167,7 +167,7 @@ examples:
167
167
  } : null,
168
168
  samples,
169
169
  }
170
- })()`}async function l(i,c){return S(i,c)}async function z(i,c){let g=v(i,{port:c.port,stripBooleanFlags:["--pretty","--json","--help","-h"]}),m=g.positional;(!m[0]||i.includes("--help")||i.includes("-h"))&&(D(),process.exit(0));let C=g.wsPort,k=g.browserId,n=!i.includes("--json"),y=k?` --session ${k}`:"",_=m[0],a=m.slice(1);if(new Set(["state","js","eval","perf","sample-color"]).has(_)){let{runInspect:e}=await import("./inspect-DRFAUJUH.js");await e(["debug",...i],{port:c.port,verbose:c.verbose});return}let o=$(g);try{switch(_){case"enable":{let e=O(a[0]);e.length===0&&(console.error(` usage: sootsim debug enable <channel[,channel,...]>
170
+ })()`}async function l(i,c){return S(i,c)}async function z(i,c){let g=v(i,{port:c.port,stripBooleanFlags:["--pretty","--json","--help","-h"]}),m=g.positional;(!m[0]||i.includes("--help")||i.includes("-h"))&&(D(),process.exit(0));let C=g.wsPort,k=g.simId,n=!i.includes("--json"),y=k?` --sim ${k}`:"",_=m[0],a=m.slice(1);if(new Set(["state","js","eval","perf","sample-color"]).has(_)){let{runInspect:e}=await import("./inspect-EVGMEZ3G.js");await e(["debug",...i],{port:c.port,verbose:c.verbose});return}let o=$(g);try{switch(_){case"enable":{let e=O(a[0]);e.length===0&&(console.error(` usage: sootsim debug enable <channel[,channel,...]>
171
171
  known: ${A.join(", ")}`),process.exit(1));let t=e.map(u=>JSON.stringify(u)).join(", "),s=await l(o,`window.__sootsimDebug.enable(${t})`);console.log(r({active:s},n));break}case"disable":{let e=O(a[0]),t=e.length>0?e.map(u=>JSON.stringify(u)).join(", "):"'all'",s=await l(o,`window.__sootsimDebug.disable(${t})`);console.log(r({active:s},n));break}case"toggle":{let e=a[0];e||(console.error(" usage: sootsim debug toggle <channel>"),process.exit(1));let t=await l(o,`window.__sootsimDebug.toggle(${JSON.stringify(e)})`);console.log(r({[e]:t},n));break}case"status":{let e=await l(o,"window.__sootsimDebug.status()");console.log(r(e,n));break}case"channels":{let e=await l(o,"window.__sootsimDebug.channels()");console.log(r(e,n));break}case"flags":{let e=await l(o,"window.__sootsimDebug.flags()");console.log(r(e,n));break}case"snapshot":{let e=a[0],t=e?`window.__sootsimDebug.snapshot(${JSON.stringify(e)})`:"window.__sootsimDebug.snapshot()",s=await l(o,`(() => { const s = ${t}; if (!s) return null; return { label: s.label, at: s.at, size: s.nodes.size }; })()`);console.log(r(s,n));break}case"snapshots":{let e=await l(o,"window.__sootsimDebug.snapshots()");console.log(r(e,n));break}case"diff":{let e=a[0],t=a[1];(!e||!t)&&(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(t)});
173
173
  if (!d) return null;
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a}from"./chunk-QD7YIVPS.js";import"./chunk-B3RAGRK6.js";export{a as APPS};
@@ -0,0 +1,49 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as S}from"./chunk-L4F4JRKJ.js";import"./chunk-ZBOIGEGO.js";import"./chunk-WHLHA5R5.js";import"./chunk-SK4SOISL.js";import"./chunk-RLNIKWFO.js";import"./chunk-DSTV2VJT.js";import"./chunk-2ZPJHSIJ.js";import"./chunk-QWKO62QM.js";import"./chunk-Z5X3PITK.js";import"./chunk-HYYMBXIX.js";import"./chunk-YFXTO4QX.js";import"./chunk-WLIVBPPY.js";import"./chunk-QD7YIVPS.js";import"./chunk-5FLDI6CV.js";import"./chunk-CX3ZIPD3.js";import"./chunk-JMU5IGIU.js";import"./chunk-Z5SVSAZO.js";import"./chunk-4OHVCGMF.js";import"./chunk-RX6RHGSI.js";import"./chunk-56BIMCDH.js";import"./chunk-S74RCIVB.js";import"./chunk-WFXYY3DU.js";import"./chunk-4IO3D5XG.js";import"./chunk-ZERYEI3L.js";import"./chunk-PERKPZ7T.js";import"./chunk-ERLA3F77.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.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
+ sootsim detox \u2014 run detox-style tests against a sootsim shell
4
+
5
+ usage:
6
+ sootsim detox [testFiles...] run all tests under e2e/, test/e2e/, or detox/
7
+ sootsim detox --config <path> use a specific jest config
8
+ sootsim detox init scaffold sootsim-detox.config.cjs + sample test
9
+ sootsim detox --watch jest watch mode
10
+ sootsim detox --headed keep the sootsim shell window visible
11
+ sootsim detox -t <pattern> pass a jest --testNamePattern
12
+ sootsim detox --no-launch skip auto-launching a sootsim shell
13
+
14
+ sootsim detox auto-launches a sootsim shell if none is running on the
15
+ expected port. disable with --no-launch if you're managing the shell yourself.
16
+ `;async function B(e,s={}){if((e.includes("--help")||e.includes("-h"))&&(console.log(F),process.exit(0)),e[0]==="init")return U();let c=t=>{let o=e.indexOf(t);return o>=0?e[o+1]:void 0},r=t=>e.includes(t),w=r("--watch"),h=r("--headed"),O=r("--no-launch"),y=c("--config"),d=s.port||Number(process.env.SOOTSIM_PORT)||5173,j=e.filter((t,o)=>{if(t.startsWith("--")||t==="-t"||t==="-h")return!1;let m=e[o-1];return!(m==="--config"||m==="-t"||m==="--testNamePattern"||m==="--grep")}),T=e.filter(t=>t==="--runInBand"||t.startsWith("--maxWorkers=")),x=["e2e","test/e2e","detox"],l=process.env.SOOTSIM_TEST_DIR?n(process.cwd(),process.env.SOOTSIM_TEST_DIR):null;if(!l)for(let t of x){let o=n(process.cwd(),t);if(u(o)){l=o;break}}l||(console.error(` error: no detox tests found. expected one of: ${x.join(", ")}
17
+ run 'sootsim detox init' to scaffold a starter suite.`),process.exit(1)),O||await k(d);let i=["jest"],p=y||R(["sootsim-detox.config.cjs","jest.config.cjs","jest.config.js"]),a=null;if(p)i.push("--config",n(process.cwd(),p));else{let t=n(E(),"jest-preset.cjs");a=M(P(),`sootsim-detox-${process.pid}.config.cjs`);let o={rootDir:l,roots:["<rootDir>"],testMatch:["<rootDir>/**/*.test.ts","<rootDir>/**/*.test.js"]};f(a,`module.exports = { ...require(${JSON.stringify(t)}), ...${JSON.stringify(o)} }
18
+ `),i.push("--config",a)}w&&i.push("--watch");let g=c("-t")||c("--testNamePattern")||c("--grep");g&&i.push("-t",g),process.env.SOOTSIM_JEST_JSON==="1"&&i.push("--json"),process.env.SOOTSIM_JEST_OUTPUT_FILE&&i.push("--outputFile",process.env.SOOTSIM_JEST_OUTPUT_FILE),i.push(...T),i.push(...j),console.log(" sootsim detox"),console.log(` test dir: ${l}`),console.log(` port: ${d}${h?" (headed)":""}`),p&&console.log(` config: ${p}`);let v=D("npx",i,{cwd:process.cwd(),stdio:"inherit",env:{...process.env,SOOTSIM_TEST_DIR:l,SOOTSIM_PORT:String(d),SOOTSIM_HEADED:h?"1":"",SOOTSIM_URL:process.env.SOOTSIM_URL||`http://localhost:${d}`}}),b=await new Promise(t=>v.on("exit",o=>t(o||0)));if(a)try{I(a)}catch{}process.exit(b)}function R(e){for(let s of e)if(u(n(process.cwd(),s)))return s;return null}async function k(e){await S()||console.warn(` warn: no sootsim shell reachable on :${e}. start one with \`bun run dev:sootsim:shell\`
19
+ or pass --no-launch if you're managing the shell yourself.`)}function U(){let e=process.cwd(),s=n(e,"sootsim-detox.config.cjs");u(s)?console.log(` skip: ${s} already exists`):(f(s,`// sootsim detox jest config.
20
+ // extends the sootsim preset, which rewrites \`import ... from 'detox'\`
21
+ // to the sootsim driver and keeps your jest transforms intact.
22
+
23
+ /** @type {import('@jest/types').Config.InitialOptions} */
24
+ module.exports = {
25
+ preset: 'sootsim/detox/jest-preset',
26
+ rootDir: __dirname,
27
+ testMatch: ['<rootDir>/e2e/**/*.test.ts', '<rootDir>/e2e/**/*.test.js'],
28
+ }
29
+ `),console.log(` created ${s}`));let c=n(e,"e2e"),r=n(c,"example.test.ts");u(r)?console.log(` skip: ${r} already exists`):(_(c,{recursive:!0}),f(r,`// sample sootsim detox test. resolve \`detox\` via the jest preset in
30
+ // sootsim-detox.config.cjs \u2014 no extra imports required.
31
+
32
+ import { by, device, element, expect, waitFor } from 'detox'
33
+
34
+ describe('example', () => {
35
+ beforeAll(async () => {
36
+ await device.launchApp()
37
+ })
38
+
39
+ it('shows the welcome text', async () => {
40
+ await waitFor(element(by.text('Welcome'))).toBeVisible().withTimeout(5000)
41
+ })
42
+
43
+ it('taps a button by id', async () => {
44
+ await element(by.id('start-button')).tap()
45
+ await expect(element(by.id('home-screen'))).toBeVisible()
46
+ })
47
+ })
48
+ `),console.log(` created ${r}`)),console.log(`
49
+ next:`),console.log(" bun sootsim detox # run the sample"),console.log(" bun sootsim detox --watch"),process.exit(0)}export{B as runDetox};
@@ -0,0 +1,16 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import"./chunk-SK4SOISL.js";import"./chunk-Z5SVSAZO.js";import"./chunk-RX6RHGSI.js";import{f as c,g as r,h as g}from"./chunk-56BIMCDH.js";import{c as d,e as l,h as a}from"./chunk-ZERYEI3L.js";import"./chunk-PERKPZ7T.js";import"./chunk-ERLA3F77.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";function h(){console.log(`
3
+ sootsim device \u2014 inspect or change the live device preset for a sim
4
+
5
+ usage:
6
+ sootsim device
7
+ sootsim device get
8
+ sootsim device set <model> [--sim <id>]
9
+ sootsim device list
10
+
11
+ examples:
12
+ sootsim device
13
+ sootsim device set iphone-14
14
+ sootsim device set ipad-pro-13 --sim a7
15
+ `)}function v(t){let o=r(t);console.log(` ${t.padEnd(14)} ${String(o.width).padStart(4)}x${String(o.height).padEnd(4)} pt ${String(o.width*o.scale).padStart(4)}x${String(o.height*o.scale).padEnd(4)} px ${o.name}`)}async function u(t){let o=l(t);try{let s=await a(o,"SootSim.bridges.settings.get")??{deviceModel:null},i=typeof s.deviceModel=="string"?s.deviceModel:null;if(!i||!(i in c))return null;let e=r(i);return{model:i,width:e.width,height:e.height,scale:e.scale,name:e.name}}finally{o.close()}}async function x(t,o){(t.includes("--help")||t.includes("-h"))&&(h(),process.exit(0));let s=t[0];if(!s||s==="get"){let i=d(t,{port:o.port}),e=await u(i);e||(console.error(" error: could not read current device from the target sim"),process.exit(1)),console.log(` ${e.model} ${e.width}x${e.height} pt ${e.width*e.scale}x${e.height*e.scale} px ${e.name}`);return}if(s==="list"){console.log(` available devices:
16
+ `);for(let i of g())v(i);return}if(s==="set"){let i=t[1];i||(console.error(" error: device set expects a model"),process.exit(1)),i in c||(console.error(` error: unknown device "${i}"`),console.error(" run `sootsim device list` to see valid models"),process.exit(1));let e=d(t,{port:o.port}),m=l(e);try{let p=await a(m,"SootSim.bridges.settings.set","deviceModel",i),n=r(i);console.log(` ${p?"set":"kept"} device: ${i} (${n.width}x${n.height} pt, ${n.width*n.scale}x${n.height*n.scale} px)${p?" \u2014 reloading sim":""}`)}finally{m.close()}return}h(),console.error(` unknown subcommand: ${s}`),process.exit(1)}export{x as runDeviceCommand};
@@ -0,0 +1,41 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{c as v,e as R,h as b}from"./chunk-ZERYEI3L.js";import{b as $}from"./chunk-PERKPZ7T.js";import"./chunk-ERLA3F77.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";function j(e){return e.ts??e.t??0}function F(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 W=new Set(["timeline","network","react","console","screen"]);function A(){console.log(`
3
+ sootsim diagnose \u2014 compact "what just went wrong?" report
4
+
5
+ usage:
6
+ sootsim diagnose recent [--since <duration>] [--include <csv>] [--json]
7
+
8
+ options:
9
+ --since <d> absolute window for timeline + network (e.g. 90s, 2m, 500ms; default 90s)
10
+ --include <csv> comma-separated dimensions: timeline, network, react, console, screen
11
+ (default: all)
12
+ --slow-threshold <n> network slow-request threshold in ms (default 1000)
13
+ --limit <n> rows to print per react table (default 8)
14
+ --json emit a single structured JSON document
15
+
16
+ the diagnose report runs every dimension in parallel against the same
17
+ sim and returns a grouped summary. use \`sootsim what-happened\`
18
+ for chronological events, \`sootsim network\` for full request inspection,
19
+ \`sootsim react summary\` for the React tables on their own.
20
+
21
+ examples:
22
+ sootsim diagnose recent
23
+ sootsim diagnose recent --since 30s --include network,react
24
+ sootsim diagnose recent --json > /tmp/diagnose.json
25
+ `)}function D(e,s){if(!e)return s;let o=/^(\d+(?:\.\d+)?)(ms|s|m)?$/.exec(e.trim());if(!o)return s;let r=Number(o[1]),t=o[2]??"ms";return t==="s"?r*1e3:t==="m"?r*6e4:r}function O(e){if(!e)return W;let s=new Set;for(let o of e.split(",")){let r=o.trim().toLowerCase();r&&s.add(r)}return s}function k(e,s){let o=e.indexOf(s);if(o>=0&&o+1<e.length)return e[o+1];let r=`${s}=`;return e.find(t=>t.startsWith(r))?.slice(r.length)}function E(e,s,o){let r=k(e,s);if(r===void 0)return o;let t=Number(r);return Number.isFinite(t)&&t>0?Math.round(t):o}async function P(e,s){let o={limit:500,since:Date.now()-s},t=(await b(e,"SootSim.bridges.timeline.recent",o)).events??[],i={},c=[],m=[],p=[];for(let u of t){i[u.kind]=(i[u.kind]??0)+1;let l=u.data,g=l&&typeof l=="object"?l.level:void 0;u.kind==="console"&&(g==="error"||g==="warn")&&c.push(u),(u.kind==="alert"||u.kind==="actionsheet"||u.kind==="picker")&&m.push(u),(u.kind==="screen"||u.kind==="route")&&p.push(u)}return{events:t,byKind:i,total:t.length,errors:c,alerts:m,screens:p}}async function B(e,s,o){let r=await e.send({type:"evaluate",code:`(() => {
26
+ const obs = window.__sootsimObservability;
27
+ if (!obs) return { ok: false };
28
+ return { ok: true, entries: obs.network.getSnapshot() };
29
+ })()`});if(!r||!r.ok)return{error:"observability bridge not installed"};let t=r.entries??[],i=Date.now()-s,c=t.filter(l=>(l.startTs??l.startedAt??0)>=i),m=c.filter(l=>!!l.error||l.status!=null&&l.status>=400),p=c.filter(l=>l.durationMs!=null&&l.durationMs>=o).sort((l,g)=>(g.durationMs??0)-(l.durationMs??0)),u=c.filter(l=>l.durationMs==null).length;return{total:c.length,failed:m,slow:p,inFlight:u,slowThresholdMs:o}}async function L(e,s){let[o,r]=await Promise.all([b(e,"SootSim.bridges.reactProfile.slow",{limit:s}),b(e,"SootSim.bridges.reactProfile.rerenders",{limit:s})]);return{commits:o.commits??r.commits??0,slow:o.rows??[],rerenders:r.rows??[],durationWarning:o.durationWarning,error:o.error??r.error}}async function C(e,s){let o=await e.send({type:"evaluate",code:`(() => {
30
+ const obs = window.__sootsimObservability;
31
+ if (!obs) return { ok: false };
32
+ return { ok: true, entries: obs.logs.getSnapshot() };
33
+ })()`});if(!o||!o.ok)return{error:"observability bridge not installed"};let r=Date.now()-s,i=(o.entries??[]).filter(c=>j(c)>=r&&(c.level==="error"||c.level==="warn"));return{entries:i.slice(-20),total:i.length}}function T(e){let s=e.error?"err":e.status!=null?String(e.status):"...",o=(e.method??"GET").padEnd(6),r=e.durationMs!=null?`${e.durationMs.toFixed(0)}ms`:"...",t=e.displayUrl??e.url,i=t.length>96?`${t.slice(0,92)}\u2026`:t;return` ${s.padStart(3)} ${o} ${r.padStart(7)} ${i} (${e.id})`}function N(e,s){let o=((e.t-s)/1e3).toFixed(2),r=e.t>=s?"-":"+",t=e.data,i="";if(t&&typeof t=="object"){let c=(t.message??"").toString().slice(0,120),m=(t.title??t.name??t.path??t.url??"").toString();i=[(t.phase??"").toString(),m,c].filter(Boolean).join(" \xB7 ")}return` -${o.padStart(5)}s [${e.kind}] ${i}`}function M(e,s,o){if(s.length===0)return`${o}(no rows)`;let r=e.map((i,c)=>Math.max(i.length,...s.map(m=>m[c]?.length??0))),t=i=>i.map((c,m)=>c.padEnd(r[m])).join(" ").trimEnd();return[t(e),t(e.map(i=>"-".repeat(i.length))),...s.map(t)].map(i=>`${o}${i}`).join(`
34
+ `)}async function q(e,s){if(e.includes("--help")||e.includes("-h"))return A(),0;let o=v(e,{port:s.port,stripBooleanFlags:["--json","--help","-h"],stripValueFlags:["--since","--include","--limit","--slow-threshold"]}),r=o.positional[0]??"recent";if(r!=="recent")return console.error(` unknown subcommand: ${r}`),console.error(" did you mean: sootsim diagnose recent ?"),1;let t=D(k(e,"--since"),9e4),i=O(k(e,"--include")),c=E(e,"--limit",8),m=E(e,"--slow-threshold",1e3),p=e.includes("--json"),u=R(o);try{let l=[],g=[];(i.has("timeline")||i.has("screen")||i.has("alert"))&&(g.push("timeline"),l.push(P(u,t))),(i.has("network")||i.has("fetch"))&&(g.push("network"),l.push(B(u,t,m))),i.has("react")&&(g.push("react"),l.push(L(u,c))),i.has("console")&&(g.push("console"),l.push(C(u,t)));let x=await Promise.all(l),w={};for(let n=0;n<g.length;n++)w[g[n]]=x[n];if(p)return console.log(JSON.stringify({generatedAt:Date.now(),sinceMs:t,include:Array.from(i),slices:w},null,2)),0;let S=Date.now();if(console.log(` diagnose recent (last ${(t/1e3).toFixed(0)}s, include: ${Array.from(i).sort().join(",")}):`),w.timeline){let n=w.timeline;console.log(`
35
+ timeline \u2014 ${n.total} event(s) in window`);let f=Object.entries(n.byKind).sort((a,d)=>d[1]-a[1]).map(([a,d])=>`${d} ${a}`).join(" \xB7 ");if(f&&console.log(` summary: ${f}`),n.screens.length){let d=n.screens[n.screens.length-1].data,h=d?d.name??d.activeName??d.path??"?":"?";console.log(` last screen: ${String(h)}`)}if(n.alerts.length){console.log(` alerts (${n.alerts.length}):`);for(let a of n.alerts.slice(-5))console.log(N(a,S))}if(n.errors.length){console.log(` console errors/warns from timeline (${n.errors.length}):`);for(let a of n.errors.slice(-5))console.log(N(a,S))}}if(w.network){let n=w.network;if("error"in n)console.log(`
36
+ network \u2014 ${n.error}`);else{if(console.log(`
37
+ network \u2014 ${n.total} request(s), ${n.failed.length} failed, ${n.slow.length} slow (>${n.slowThresholdMs}ms), ${n.inFlight} in-flight`),n.failed.length){console.log(" failed:");for(let f of n.failed.slice(-8))console.log(T(f))}if(n.slow.length){console.log(" slowest:");for(let f of n.slow.slice(0,5))console.log(T(f))}}}if(w.react){let n=w.react;console.log(`
38
+ react \u2014 ${n.commits} commit(s)`),n.error&&console.log(` warning: ${n.error}`),n.durationWarning&&console.log(` warning: ${n.durationWarning}`),n.slow.length>0&&n.slow.every(a=>a.totalMs<=0&&a.slowestMs<=0)&&!n.durationWarning&&console.log(" warning: every commit reports actualDuration=0ms \u2014 bundle has React profiler timer disabled"),n.slow.length&&(console.log(" slowest:"),console.log(M(["component","total","commits","slowest"],n.slow.slice(0,c).map(a=>[a.displayName,`${a.totalMs.toFixed(2)}ms`,String(a.commitCount),`${a.slowestMs.toFixed(2)}ms`])," "))),n.rerenders.length&&(console.log(" most rerenders:"),console.log(M(["component","renders","top causes"],n.rerenders.slice(0,c).map(a=>{let d=Object.entries(a.causes??{}).filter(([,h])=>h>0).sort((h,y)=>y[1]-h[1]).slice(0,3).map(([h,y])=>`${h}:${y}`).join(", ");return[a.displayName,String(a.renders??a.count??0),d||"-"]})," ")))}if(w.console){let n=w.console;if("error"in n)console.log(`
39
+ console \u2014 ${n.error}`);else{console.log(`
40
+ console errors/warns \u2014 ${n.total} in window`);for(let f of n.entries.slice(-8)){let a=((j(f)-S)/1e3).toFixed(2),d=F(f).slice(0,160);console.log(` -${a.padStart(5)}s [${f.level}] ${d}`)}}}return $()&&console.log(`
41
+ next: sootsim what-happened (cursor advances) \xB7 sootsim network get <id> \xB7 sootsim react why <fiber-id>`),0}finally{u.close()}}export{q as runDiagnose};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import"./chunk-KA5JJCWL.js";import{a,b,c,d,e,f,g,h,i}from"./chunk-HYYMBXIX.js";import"./chunk-YFXTO4QX.js";import"./chunk-WLIVBPPY.js";import"./chunk-JMU5IGIU.js";import"./chunk-4IO3D5XG.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.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};