sootsim 0.1.85 → 0.1.86

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 (145) hide show
  1. package/dist-cli/bin.js +3 -3
  2. package/dist-cli/chunks/{agent-T3DUH5YJ.js → agent-S3WLX5Z4.js} +2 -2
  3. package/dist-cli/chunks/{agent-wrapper-NSBF4THI.js → agent-wrapper-PFPEQTPG.js} +2 -2
  4. package/dist-cli/chunks/{assert-X3F7TRCZ.js → assert-RQD66YGE.js} +2 -2
  5. package/dist-cli/chunks/auto-bootstrap-PWF7OYCV.js +2 -0
  6. package/dist-cli/chunks/beta-2HH7F2DQ.js +2 -0
  7. package/dist-cli/chunks/{chunk-WGDL5V6C.js → chunk-2IYMBWHL.js} +1 -1
  8. package/dist-cli/chunks/{chunk-5DIGWOY7.js → chunk-3GCSX5H5.js} +1 -1
  9. package/dist-cli/chunks/{chunk-OISHLFON.js → chunk-3TNIXR6J.js} +1 -1
  10. package/dist-cli/chunks/{chunk-5N3V7OCG.js → chunk-535UNERF.js} +2 -2
  11. package/dist-cli/chunks/{chunk-G7CIZ5S3.js → chunk-5DFVKWYQ.js} +3 -3
  12. package/dist-cli/chunks/{chunk-GTAD6IUV.js → chunk-5NW6W7YF.js} +1 -1
  13. package/dist-cli/chunks/{chunk-EKXK3SWK.js → chunk-5ZYANOOI.js} +2 -2
  14. package/dist-cli/chunks/{chunk-BZL6D4TV.js → chunk-6A7IWFXR.js} +63 -62
  15. package/dist-cli/chunks/{chunk-BHZJ6RIH.js → chunk-6LG7WJMD.js} +2 -2
  16. package/dist-cli/chunks/{chunk-EFM53PZ5.js → chunk-7YZHI7V6.js} +1 -1
  17. package/dist-cli/chunks/{chunk-QLJNSOS7.js → chunk-CMAANHYQ.js} +1 -1
  18. package/dist-cli/chunks/{chunk-KUSQ4NNJ.js → chunk-CQAQTU5K.js} +1 -1
  19. package/dist-cli/chunks/{chunk-AFNDVS4E.js → chunk-CSJS4MRN.js} +2 -2
  20. package/dist-cli/chunks/{chunk-7LKUN46F.js → chunk-DKW7Q4F3.js} +2 -2
  21. package/dist-cli/chunks/{chunk-ZO3VHP6W.js → chunk-EDWDFOPL.js} +1 -1
  22. package/dist-cli/chunks/{chunk-EBEL6TTJ.js → chunk-FF5KD3BS.js} +2 -2
  23. package/dist-cli/chunks/{chunk-BESAZ2HA.js → chunk-FO52BFW4.js} +2 -2
  24. package/dist-cli/chunks/chunk-I3JMONYJ.js +2 -0
  25. package/dist-cli/chunks/{chunk-UYRGCJ4N.js → chunk-JB467MUR.js} +45 -45
  26. package/dist-cli/chunks/{chunk-SBGOUA6F.js → chunk-JBYW57OA.js} +2 -2
  27. package/dist-cli/chunks/{chunk-NVTL3JQG.js → chunk-JITAVV2G.js} +1 -1
  28. package/dist-cli/chunks/{chunk-O6N2CEET.js → chunk-JMILXXI4.js} +2 -2
  29. package/dist-cli/chunks/chunk-KGYC4SZA.js +2 -0
  30. package/dist-cli/chunks/{chunk-H44IQHKZ.js → chunk-KQYOS5SM.js} +1 -1
  31. package/dist-cli/chunks/{chunk-HQDJ5BOF.js → chunk-M6GOCS27.js} +1 -1
  32. package/dist-cli/chunks/{chunk-DWTLRPEN.js → chunk-NBBH2PVW.js} +2 -2
  33. package/dist-cli/chunks/chunk-NIRJVBXJ.js +1 -0
  34. package/dist-cli/chunks/{chunk-PHPXGLME.js → chunk-NLH7FNSG.js} +1 -1
  35. package/dist-cli/chunks/{chunk-Y5PLPEEU.js → chunk-OBHJKTWA.js} +2 -2
  36. package/dist-cli/chunks/{chunk-5S6D7K4L.js → chunk-OCTDP37S.js} +2 -2
  37. package/dist-cli/chunks/{chunk-OUNLJM56.js → chunk-P7IKKZTG.js} +2 -2
  38. package/dist-cli/chunks/{chunk-3WGHC7JN.js → chunk-PVMX5UNR.js} +2 -2
  39. package/dist-cli/chunks/chunk-QUYC7CVV.js +1 -0
  40. package/dist-cli/chunks/{chunk-CF2LPRXD.js → chunk-STHMWSVN.js} +2 -2
  41. package/dist-cli/chunks/{chunk-OXOARRKR.js → chunk-TSNBQ4ZV.js} +10 -10
  42. package/dist-cli/chunks/{chunk-E2QE5FFP.js → chunk-UWSP2AT7.js} +1 -1
  43. package/dist-cli/chunks/{chunk-4EVSIUNB.js → chunk-V7CFSKMC.js} +2 -2
  44. package/dist-cli/chunks/{chunk-4QZHZ6BC.js → chunk-VFGAEMSI.js} +2 -2
  45. package/dist-cli/chunks/{chunk-RZHREO3M.js → chunk-VUYCS6QI.js} +2 -2
  46. package/dist-cli/chunks/chunk-XB4QIINM.js +24 -0
  47. package/dist-cli/chunks/{chunk-MAO7F5PH.js → chunk-XFJYEKYK.js} +3 -3
  48. package/dist-cli/chunks/{chunk-AC6QGW22.js → chunk-XZE53P4L.js} +2 -2
  49. package/dist-cli/chunks/chunk-Y7BXSTVX.js +1 -0
  50. package/dist-cli/chunks/cli-version-TGWWTYQX.js +2 -0
  51. package/dist-cli/chunks/{compat-PCXGGZBZ.js → compat-I2U3P4KP.js} +3 -3
  52. package/dist-cli/chunks/{config-LULEVEYL.js → config-S73CCGP5.js} +2 -2
  53. package/dist-cli/chunks/{control-6P6HY7UF.js → control-QR6MY7RA.js} +2 -2
  54. package/dist-cli/chunks/{cpu-profile-NOK73ZYW.js → cpu-profile-RFYCTVAF.js} +2 -2
  55. package/dist-cli/chunks/{daemon-4A3DMUYL.js → daemon-D5MV2B22.js} +2 -2
  56. package/dist-cli/chunks/{debug-74BWB2ZG.js → debug-ZYEI75AG.js} +3 -3
  57. package/dist-cli/chunks/{detox-HEOMINSC.js → detox-J5IH52RV.js} +2 -2
  58. package/dist-cli/chunks/{device-TTXXBJFZ.js → device-NOBLSUOD.js} +2 -2
  59. package/dist-cli/chunks/{diagnose-QZ3GOHSE.js → diagnose-B6J5ZUHV.js} +2 -2
  60. package/dist-cli/chunks/drivers-RRHVOU6S.js +2 -0
  61. package/dist-cli/chunks/{electron-QVOWV44R.js → electron-PSX4KDCC.js} +3 -3
  62. package/dist-cli/chunks/flow-FWNVFKMP.js +2 -0
  63. package/dist-cli/chunks/{hints-YKWRNMJC.js → hints-ZE4I3YO3.js} +2 -2
  64. package/dist-cli/chunks/{home-paths-SFADSTJM.js → home-paths-N76MJE3D.js} +2 -2
  65. package/dist-cli/chunks/{inspect-LEWGQCIU.js → inspect-V2TXTDOG.js} +3 -3
  66. package/dist-cli/chunks/install-4PINRR2O.js +2 -0
  67. package/dist-cli/chunks/{install-desktop-22HYQZ2G.js → install-desktop-6ZRTRRCU.js} +3 -3
  68. package/dist-cli/chunks/{keys-3ZT3MICU.js → keys-L2RN4URM.js} +2 -2
  69. package/dist-cli/chunks/{launch-ZXW2NFLG.js → launch-BJGXPNZR.js} +3 -3
  70. package/dist-cli/chunks/{login-NJKJ7GZO.js → login-HYNEMAYR.js} +4 -4
  71. package/dist-cli/chunks/{logout-VMMQL7CB.js → logout-AO4YS27T.js} +2 -2
  72. package/dist-cli/chunks/{maestro-OJY4MTI7.js → maestro-PRACYFKV.js} +2 -2
  73. package/dist-cli/chunks/{preview-QU2GXTEV.js → preview-ZTANXVEK.js} +2 -2
  74. package/dist-cli/chunks/{profile-7APWK47T.js → profile-FNMAGUDB.js} +2 -2
  75. package/dist-cli/chunks/{react-RSVO5JZZ.js → react-6ZV2FQIM.js} +2 -2
  76. package/dist-cli/chunks/{record-UWH4MDEO.js → record-MLFVJZ6Y.js} +2 -2
  77. package/dist-cli/chunks/runtime-5762IE56.js +2 -0
  78. package/dist-cli/chunks/{runtime-delivery-QMKGRV7N.js → runtime-delivery-ATYW2SQR.js} +2 -2
  79. package/dist-cli/chunks/{screenshot-43M27ALE.js → screenshot-UOMYMFZ4.js} +2 -2
  80. package/dist-cli/chunks/{screenshot-mode-EBYYN6TY.js → screenshot-mode-MWSVD4YG.js} +2 -2
  81. package/dist-cli/chunks/{screenshots-7TQZL6Z6.js → screenshots-GSA3VCWB.js} +2 -2
  82. package/dist-cli/chunks/server-YPFC6POG.js +40 -0
  83. package/dist-cli/chunks/setup-repo-QBQ4VWFO.js +2 -0
  84. package/dist-cli/chunks/{skills-RQA6EJQL.js → skills-YE5OPWMQ.js} +2 -2
  85. package/dist-cli/chunks/{start-ZT6MBYND.js → start-BSSQ5U2V.js} +4 -4
  86. package/dist-cli/chunks/store-EG4SONAH.js +2 -0
  87. package/dist-cli/chunks/telemetry-XXN4LRDS.js +2 -0
  88. package/dist-cli/chunks/{test-RNRX5SWV.js → test-5JMLBH2O.js} +3 -3
  89. package/dist-cli/chunks/{three-mode-TQZH25ZO.js → three-mode-TRBWZJQY.js} +2 -2
  90. package/dist-cli/chunks/{timeline-GGN3AY6P.js → timeline-YMZPIEB4.js} +2 -2
  91. package/dist-cli/chunks/{upgrade-XT22D67C.js → upgrade-JLAS7FIF.js} +2 -2
  92. package/dist-cli/chunks/upload-K6UNCFQH.js +2 -0
  93. package/dist-cli/chunks/{web-KEHVF5MB.js → web-D6S5UXOO.js} +2 -2
  94. package/dist-cli/chunks/{what-happened-PATQRJ5T.js → what-happened-65NXWU2S.js} +2 -2
  95. package/dist-cli/chunks/{whoami-CXVY26VV.js → whoami-6BSB6FQC.js} +2 -2
  96. package/dist-lib/agent-daemon-client.cjs +1 -1
  97. package/dist-lib/agent-events.cjs +1 -1
  98. package/dist-lib/agent-sessions.cjs +1 -1
  99. package/dist-lib/attached-projects.cjs +1 -1
  100. package/dist-lib/auth/shared-session.cjs +1 -1
  101. package/dist-lib/backend-origin.cjs +1 -1
  102. package/dist-lib/beta.cjs +1 -1
  103. package/dist-lib/beta.mjs +15 -0
  104. package/dist-lib/bridge-constants.cjs +1 -1
  105. package/dist-lib/cli-constants.cjs +1 -1
  106. package/dist-lib/config.cjs +1 -1
  107. package/dist-lib/detox/index.cjs +1 -1
  108. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  109. package/dist-lib/home-paths.cjs +1 -1
  110. package/dist-lib/host/bridge-host.cjs +244 -35
  111. package/dist-lib/host/fetch-proxy-handler.cjs +24 -4
  112. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  113. package/dist-lib/host/fetch-proxy-overrides.mjs +33 -0
  114. package/dist-lib/host/websocket-proxy.cjs +207 -0
  115. package/dist-lib/index.cjs +1 -1
  116. package/dist-lib/metro.cjs +1 -1
  117. package/dist-lib/profiles.cjs +1 -1
  118. package/dist-lib/render-mode.cjs +1 -1
  119. package/dist-lib/scripts/demo-app-registry.cjs +14 -3
  120. package/dist-lib/scripts/dev-server-scanner.cjs +14 -3
  121. package/dist-lib/skills.cjs +290 -73
  122. package/dist-lib/vite.cjs +1 -1
  123. package/package.json +7 -1
  124. package/scripts/demo-app-registry.ts +17 -1
  125. package/src/host/bridge-host.ts +8 -1
  126. package/src/host/fetch-proxy-handler.ts +26 -3
  127. package/src/host/websocket-proxy.ts +201 -0
  128. package/dist-cli/chunks/auto-bootstrap-47RN2V5G.js +0 -2
  129. package/dist-cli/chunks/beta-BRCGAF2N.js +0 -2
  130. package/dist-cli/chunks/chunk-36RPD6JI.js +0 -2
  131. package/dist-cli/chunks/chunk-4DBPNLGI.js +0 -1
  132. package/dist-cli/chunks/chunk-PQFFUJR6.js +0 -24
  133. package/dist-cli/chunks/chunk-QQAECG5B.js +0 -2
  134. package/dist-cli/chunks/chunk-SSCA2AEA.js +0 -1
  135. package/dist-cli/chunks/chunk-ZFAM4N5B.js +0 -1
  136. package/dist-cli/chunks/cli-version-WPFDM2A6.js +0 -2
  137. package/dist-cli/chunks/drivers-QRPWNOIT.js +0 -2
  138. package/dist-cli/chunks/flow-QMA7GVN6.js +0 -2
  139. package/dist-cli/chunks/install-7N2N7Q32.js +0 -2
  140. package/dist-cli/chunks/runtime-3FUENRHM.js +0 -2
  141. package/dist-cli/chunks/server-VCFM25Z6.js +0 -35
  142. package/dist-cli/chunks/setup-repo-HFH4VKJQ.js +0 -2
  143. package/dist-cli/chunks/store-BJBTDSZE.js +0 -2
  144. package/dist-cli/chunks/telemetry-ZZZKTILZ.js +0 -2
  145. package/dist-cli/chunks/upload-NC2AYLC5.js +0 -2
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.85 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{A as y,L as x,y as F,z as T}from"./chunk-ZO3VHP6W.js";import{c as S,e as N}from"./chunk-EKXK3SWK.js";import{b as k}from"./chunk-OISHLFON.js";import"./chunk-QQAECG5B.js";import"./chunk-WGDL5V6C.js";import"./chunk-H44IQHKZ.js";function _(n){let e=[];for(let t=0;t<n.length;t++)if(n[t]==="--since"&&t+1<n.length){e.push(t,t+1);let s=n[t+1].trim(),l=/^(\d+(?:\.\d+)?)(ms|s|m)?$/.exec(s);if(l){let a=Number(l[1]),m=l[2]??"ms",$=m==="s"?a*1e3:m==="m"?a*6e4:a;return{since:Date.now()-$,consumed:e}}let o=Number(s);if(Number.isFinite(o)&&o>1e12)return{since:o,consumed:e}}return{consumed:e}}function K(n){let e=[];for(let t=0;t<n.length;t++)if(n[t]==="--kinds"&&t+1<n.length)return e.push(t,t+1),{kinds:n[t+1].split(",").map(s=>s.trim()).filter(Boolean),consumed:e};return{consumed:e}}function O(n){let e=[];for(let t=0;t<n.length;t++)if(n[t]==="--limit"&&t+1<n.length){e.push(t,t+1);let s=Number(n[t+1]);if(Number.isFinite(s)&&s>0)return{limit:s,consumed:e}}return{consumed:e}}function j(n,e){if(e===null)return new Date(n).toLocaleTimeString();let t=(n-e)/1e3;return`${t>=0?"+":""}${t.toFixed(2)}s`}function B(n,e){switch(n){case"app-launch":return e.phase==="launch"?`launch ${e.appName??e.toAppId??""}`:`dismiss ${e.appName??e.fromAppId??""} \u2192 ${e.toAppId??""}`;case"toast":return`"${e.text??""}"${e.durationMs?` (${e.durationMs}ms)`:""}`;case"keyboard":return`${e.phase??"?"}${e.heightPx?` h=${e.heightPx}`:""}${e.mode?` ${e.mode}`:""}`;case"screen":return`${e.phase??"?"} ${e.name??e.activeName??""}`;case"route":return`${e.phase??"?"} ${e.path??e.pathname??""}`;case"alert":case"actionsheet":case"picker":return`${e.phase??"?"} ${e.title??e.message??""}`;case"notification":return`${e.title??""}${e.body?` \u2014 ${e.body}`:""}`;case"fetch":return`${e.method??"GET"} ${e.url??""}${e.status?` -> ${e.status}`:""}`;case"console":return`${e.level??"log"}: ${(e.message??"").toString().slice(0,120)}`;case"shell":return`${e.event??e.type??e.phase??""}`;case"scroll":return`${e.phase??"?"} ${e.target??""}`;case"gesture":return`${e.phase??"?"} ${e.type??""}`;case"text-input":return`${e.phase??"?"}${e.value!==void 0?` "${String(e.value).slice(0,40)}"`:""}`;case"layout":return`${e.kind??"?"} ${e.testID??e.type??""}${e.skipped?` skipped:${e.reason??"unknown"}`:""}`;case"react-commit":{let t=e.slowest;return`${e.fiberCount??"?"} fibers ${e.durationMs??"?"}ms${t?.displayName?` \xB7 ${t.displayName} ${t.durationMs??"?"}ms`:""}`}case"reanimated":case"animation":return`${e.kind??""} ${e.target??""}${e.durationMs?` ${e.durationMs}ms`:""}`}}function A(n,e){let t=j(n.t,e).padStart(8),s=n.context.padEnd(6),l=`[${n.kind}]`.padEnd(15),o="",a=n.data;return a&&typeof a=="object"&&(o=B(n.kind,a)),` ${t} ${s} ${l} ${o}`}function M(n){let e=[],t={label:"initial state",events:[],startedAt:n[0]?.t??null};e.push(t);for(let s of n)if(t.events.push(s),s.kind==="screen"||s.kind==="route"){let l=s.data,o=l?.phase;if(!o||o==="enter"||o==="appear"||o==="active"){let a=l?.name||l?.activeName||l?.path||l?.pathname||s.kind;e.length===1&&t.events.length===1?t.label=`${s.kind}: ${a}`:(t={label:`${s.kind}: ${a}`,events:[],startedAt:s.t},e.push(t))}}return e}async function J(n,e){let t=S(n,{port:e.port,stripBooleanFlags:["--summary","--all","--json","--no-advance","--help","-h","--flow","--noisy"],stripValueFlags:["--since","--kinds","--limit"]});(n.includes("--help")||n.includes("-h"))&&(console.log(`
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{A as y,L as x,y as F,z as T}from"./chunk-EDWDFOPL.js";import{c as S,e as N}from"./chunk-5ZYANOOI.js";import{b as k}from"./chunk-3TNIXR6J.js";import"./chunk-I3JMONYJ.js";import"./chunk-2IYMBWHL.js";import"./chunk-KQYOS5SM.js";function _(n){let e=[];for(let t=0;t<n.length;t++)if(n[t]==="--since"&&t+1<n.length){e.push(t,t+1);let s=n[t+1].trim(),l=/^(\d+(?:\.\d+)?)(ms|s|m)?$/.exec(s);if(l){let a=Number(l[1]),m=l[2]??"ms",$=m==="s"?a*1e3:m==="m"?a*6e4:a;return{since:Date.now()-$,consumed:e}}let o=Number(s);if(Number.isFinite(o)&&o>1e12)return{since:o,consumed:e}}return{consumed:e}}function K(n){let e=[];for(let t=0;t<n.length;t++)if(n[t]==="--kinds"&&t+1<n.length)return e.push(t,t+1),{kinds:n[t+1].split(",").map(s=>s.trim()).filter(Boolean),consumed:e};return{consumed:e}}function O(n){let e=[];for(let t=0;t<n.length;t++)if(n[t]==="--limit"&&t+1<n.length){e.push(t,t+1);let s=Number(n[t+1]);if(Number.isFinite(s)&&s>0)return{limit:s,consumed:e}}return{consumed:e}}function j(n,e){if(e===null)return new Date(n).toLocaleTimeString();let t=(n-e)/1e3;return`${t>=0?"+":""}${t.toFixed(2)}s`}function B(n,e){switch(n){case"app-launch":return e.phase==="launch"?`launch ${e.appName??e.toAppId??""}`:`dismiss ${e.appName??e.fromAppId??""} \u2192 ${e.toAppId??""}`;case"toast":return`"${e.text??""}"${e.durationMs?` (${e.durationMs}ms)`:""}`;case"keyboard":return`${e.phase??"?"}${e.heightPx?` h=${e.heightPx}`:""}${e.mode?` ${e.mode}`:""}`;case"screen":return`${e.phase??"?"} ${e.name??e.activeName??""}`;case"route":return`${e.phase??"?"} ${e.path??e.pathname??""}`;case"alert":case"actionsheet":case"picker":return`${e.phase??"?"} ${e.title??e.message??""}`;case"notification":return`${e.title??""}${e.body?` \u2014 ${e.body}`:""}`;case"fetch":return`${e.method??"GET"} ${e.url??""}${e.status?` -> ${e.status}`:""}`;case"console":return`${e.level??"log"}: ${(e.message??"").toString().slice(0,120)}`;case"shell":return`${e.event??e.type??e.phase??""}`;case"scroll":return`${e.phase??"?"} ${e.target??""}`;case"gesture":return`${e.phase??"?"} ${e.type??""}`;case"text-input":return`${e.phase??"?"}${e.value!==void 0?` "${String(e.value).slice(0,40)}"`:""}`;case"layout":return`${e.kind??"?"} ${e.testID??e.type??""}${e.skipped?` skipped:${e.reason??"unknown"}`:""}`;case"react-commit":{let t=e.slowest;return`${e.fiberCount??"?"} fibers ${e.durationMs??"?"}ms${t?.displayName?` \xB7 ${t.displayName} ${t.durationMs??"?"}ms`:""}`}case"reanimated":case"animation":return`${e.kind??""} ${e.target??""}${e.durationMs?` ${e.durationMs}ms`:""}`}}function A(n,e){let t=j(n.t,e).padStart(8),s=n.context.padEnd(6),l=`[${n.kind}]`.padEnd(15),o="",a=n.data;return a&&typeof a=="object"&&(o=B(n.kind,a)),` ${t} ${s} ${l} ${o}`}function M(n){let e=[],t={label:"initial state",events:[],startedAt:n[0]?.t??null};e.push(t);for(let s of n)if(t.events.push(s),s.kind==="screen"||s.kind==="route"){let l=s.data,o=l?.phase;if(!o||o==="enter"||o==="appear"||o==="active"){let a=l?.name||l?.activeName||l?.path||l?.pathname||s.kind;e.length===1&&t.events.length===1?t.label=`${s.kind}: ${a}`:(t={label:`${s.kind}: ${a}`,events:[],startedAt:s.t},e.push(t))}}return e}async function J(n,e){let t=S(n,{port:e.port,stripBooleanFlags:["--summary","--all","--json","--no-advance","--help","-h","--flow","--noisy"],stripValueFlags:["--since","--kinds","--limit"]});(n.includes("--help")||n.includes("-h"))&&(console.log(`
3
3
  sootsim what-happened \u2014 show recent events from the semantic timeline
4
4
 
5
5
  usage:
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.85 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{d as i}from"./chunk-5N3V7OCG.js";import{d as n}from"./chunk-OUNLJM56.js";import"./chunk-WGDL5V6C.js";import"./chunk-H44IQHKZ.js";async function u(){let o=i();if(o||(console.log(" not signed in"),console.log(" set SOOTSIM_API_KEY=sk_sootsim_\u2026 or run `sootsim login`"),process.exit(1)),o.kind==="api-key"){let r=`${o.secret.slice(0,14)}\u2026`,t=o.source==="env"?"SOOTSIM_API_KEY env var":"saved key (~/.config/sootsim/credentials.json)";console.log(` api key ${r}`),console.log(` source: ${t}`);return}if(o.kind==="github"){console.log(` github token (${o.source})`),console.log(` repo: ${o.repoId}`);return}let e=await n(),s=e?.user;console.log(` ${s?.email||s?.name||s?.id||"signed in"}`),console.log(` origin: ${e?.origin??o.origin}`),e?.updatedAt&&console.log(` updated: ${e.updatedAt}`)}export{u as runWhoami};
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{d as i}from"./chunk-535UNERF.js";import{d as n}from"./chunk-P7IKKZTG.js";import"./chunk-2IYMBWHL.js";import"./chunk-KQYOS5SM.js";async function u(){let o=i();if(o||(console.log(" not signed in"),console.log(" set SOOTSIM_API_KEY=sk_sootsim_\u2026 or run `sootsim login`"),process.exit(1)),o.kind==="api-key"){let r=`${o.secret.slice(0,14)}\u2026`,t=o.source==="env"?"SOOTSIM_API_KEY env var":"saved key (~/.config/sootsim/credentials.json)";console.log(` api key ${r}`),console.log(` source: ${t}`);return}if(o.kind==="github"){console.log(` github token (${o.source})`),console.log(` repo: ${o.repoId}`);return}let e=await n(),s=e?.user;console.log(` ${s?.email||s?.name||s?.id||"signed in"}`),console.log(` origin: ${e?.origin??o.origin}`),e?.updatedAt&&console.log(` updated: ${e.updatedAt}`)}export{u as runWhoami};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.85 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.85 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.85 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.85 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.85 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.85 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
package/dist-lib/beta.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.85 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -0,0 +1,15 @@
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+
3
+ // src/beta.ts
4
+ var IS_BETA = true;
5
+ var BETA_VERSION_TARGET = "1.0.0";
6
+ var BETA_LABEL = "public beta";
7
+ var BETA_TAGLINE = `${BETA_LABEL} \xB7 free until ${BETA_VERSION_TARGET}`;
8
+ var BETA_ASK_HEADLINE = "free for everyone until 1.0 \u2014 we send anonymous error and dependency data while you use it";
9
+ export {
10
+ BETA_ASK_HEADLINE,
11
+ BETA_LABEL,
12
+ BETA_TAGLINE,
13
+ BETA_VERSION_TARGET,
14
+ IS_BETA
15
+ };
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.85 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.85 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.85 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.85 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.85 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.85 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.85 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.86 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -39,7 +39,7 @@ var import_child_process4 = require("child_process");
39
39
  var import_fs3 = __toESM(require("fs"), 1);
40
40
  var import_http3 = require("http");
41
41
  var import_path3 = __toESM(require("path"), 1);
42
- var import_ws = require("ws");
42
+ var import_ws2 = require("ws");
43
43
 
44
44
  // scripts/dev-server-scanner.ts
45
45
  var import_child_process = require("child_process");
@@ -663,11 +663,22 @@ var APPS = [
663
663
  // be holding pglite locks on ~/takeout/.orez (soot can attach takeout as
664
664
  // a project and spin up its own orez against the same data dir).
665
665
  readyTimeoutMs: 24e4,
666
+ managedPorts: (p) => {
667
+ const offset = p - 8081;
668
+ return [5433 + offset, 4848 + offset, 9200 + offset];
669
+ },
666
670
  command: (p) => ({
667
- cmd: "bun lite",
671
+ cmd: "bun lite:demo",
668
672
  env: {
673
+ TAKEOUT_ENV_MODE: "development",
669
674
  PORT_OFFSET: String(p - 8081),
670
- OREZ_DATA_DIR: `${HOME}/.cache/sootsim-demo/takeout-orez`
675
+ OREZ_DATA_DIR: `${HOME}/.cache/sootsim-demo/takeout-orez`,
676
+ VITE_DEMO_MODE: "1",
677
+ ZERO_APP_ID: "takeout",
678
+ ZERO_APP_PUBLICATIONS: "zero_takeout",
679
+ ZERO_CVR_MAX_CONNS: "4",
680
+ ZERO_NUM_SYNC_WORKERS: "2",
681
+ ZERO_UPSTREAM_MAX_CONNS: "8"
671
682
  }
672
683
  })
673
684
  },
@@ -2910,6 +2921,14 @@ var FETCH_PROXY_CORS_HEADERS = {
2910
2921
  "access-control-expose-headers": "*",
2911
2922
  "access-control-max-age": "3600"
2912
2923
  };
2924
+ var APP_API_HEADER_REWRITES = /* @__PURE__ */ new Set([
2925
+ "host",
2926
+ "origin",
2927
+ "referer",
2928
+ "sec-fetch-site",
2929
+ "sec-fetch-mode",
2930
+ "sec-fetch-dest"
2931
+ ]);
2913
2932
  function applyFetchProxyCors(res) {
2914
2933
  for (const [key, value] of Object.entries(FETCH_PROXY_CORS_HEADERS)) {
2915
2934
  res.setHeader(key, value);
@@ -2942,6 +2961,18 @@ function buildFetchProxyHeaders(reqHeaders, targetUrl) {
2942
2961
  );
2943
2962
  return headers;
2944
2963
  }
2964
+ function buildAppApiProxyHeaders(reqHeaders, targetUrl) {
2965
+ const headers = {};
2966
+ for (const [key, value] of Object.entries(reqHeaders)) {
2967
+ if (!value) continue;
2968
+ if (APP_API_HEADER_REWRITES.has(key.toLowerCase())) continue;
2969
+ headers[key] = value;
2970
+ }
2971
+ headers.host = targetUrl.host;
2972
+ headers.origin = targetUrl.origin;
2973
+ headers.referer = `${targetUrl.origin}/`;
2974
+ return headers;
2975
+ }
2945
2976
  function isFetchProxyRequestUrl(rawUrl) {
2946
2977
  return rawUrl?.startsWith("/__fetch-proxy?") || rawUrl?.startsWith("/__proxy?") || false;
2947
2978
  }
@@ -3052,9 +3083,7 @@ function handleAppApiRequest(req, res) {
3052
3083
  return true;
3053
3084
  }
3054
3085
  const transport = targetUrl.protocol === "https:" ? import_https.default : import_http2.default;
3055
- const fwdHeaders = { ...req.headers };
3056
- delete fwdHeaders.host;
3057
- fwdHeaders.host = targetUrl.host;
3086
+ const fwdHeaders = buildAppApiProxyHeaders(req.headers, targetUrl);
3058
3087
  const proxyReq = transport.request(
3059
3088
  {
3060
3089
  hostname: targetUrl.hostname,
@@ -3232,6 +3261,180 @@ async function openUrl(url, options = {}) {
3232
3261
  await launchUrl(url, options);
3233
3262
  }
3234
3263
 
3264
+ // src/host/websocket-proxy.ts
3265
+ var import_ws = require("ws");
3266
+ var WEBSOCKET_PROXY_PATH = "/__websocket-proxy";
3267
+ var STRIP_UPSTREAM_HEADERS = /* @__PURE__ */ new Set([
3268
+ "host",
3269
+ "connection",
3270
+ "upgrade",
3271
+ "transfer-encoding",
3272
+ "content-length",
3273
+ "sec-websocket-accept",
3274
+ "sec-websocket-extensions",
3275
+ "sec-websocket-key",
3276
+ "sec-websocket-protocol",
3277
+ "sec-websocket-version"
3278
+ ]);
3279
+ function rejectUpgrade(socket, status, message) {
3280
+ try {
3281
+ socket.write(
3282
+ `HTTP/1.1 ${status} ${message}\r
3283
+ Connection: close\r
3284
+ Content-Type: text/plain\r
3285
+ Content-Length: ${message.length}\r
3286
+ \r
3287
+ ${message}`
3288
+ );
3289
+ } catch {
3290
+ }
3291
+ socket.destroy();
3292
+ }
3293
+ function isSameOriginUpgrade(req) {
3294
+ const origin = req.headers.origin;
3295
+ const host = req.headers.host;
3296
+ if (!origin || !host) return false;
3297
+ try {
3298
+ return new URL(origin).host === host;
3299
+ } catch {
3300
+ return false;
3301
+ }
3302
+ }
3303
+ function decodeProxyHeaders(encoded) {
3304
+ if (!encoded) return {};
3305
+ const base64 = encoded.replace(/-/g, "+").replace(/_/g, "/");
3306
+ const padded = base64 + "=".repeat((4 - base64.length % 4) % 4);
3307
+ const parsed = JSON.parse(Buffer.from(padded, "base64").toString("utf8"));
3308
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
3309
+ const headers = {};
3310
+ for (const [key, value] of Object.entries(parsed)) {
3311
+ if (value == null) continue;
3312
+ if (STRIP_UPSTREAM_HEADERS.has(key.toLowerCase())) continue;
3313
+ headers[key] = Array.isArray(value) ? value.join(", ") : String(value);
3314
+ }
3315
+ return headers;
3316
+ }
3317
+ function getDefaultWebSocketOrigin(targetUrl) {
3318
+ const origin = new URL(targetUrl.href);
3319
+ origin.protocol = targetUrl.protocol === "wss:" ? "https:" : "http:";
3320
+ return origin.origin;
3321
+ }
3322
+ function getRequestedProtocols(req) {
3323
+ const header = req.headers["sec-websocket-protocol"];
3324
+ const value = Array.isArray(header) ? header.join(",") : header || "";
3325
+ return value.split(",").map((part) => part.trim()).filter(Boolean);
3326
+ }
3327
+ function safeClose(ws, code, reason) {
3328
+ if (ws.readyState === import_ws.WebSocket.CLOSED || ws.readyState === import_ws.WebSocket.CLOSING) {
3329
+ return;
3330
+ }
3331
+ try {
3332
+ ws.close(code, reason);
3333
+ } catch {
3334
+ ws.terminate();
3335
+ }
3336
+ }
3337
+ function connectProxyPair(clientWs, upstream) {
3338
+ let closing = false;
3339
+ const closeBoth = (source, target, code, reason) => {
3340
+ if (closing) return;
3341
+ closing = true;
3342
+ safeClose(target, code, reason.toString());
3343
+ if (source.readyState === import_ws.WebSocket.OPEN) {
3344
+ safeClose(source, code, reason.toString());
3345
+ }
3346
+ };
3347
+ clientWs.on("message", (data, isBinary) => {
3348
+ if (upstream.readyState === import_ws.WebSocket.OPEN) {
3349
+ upstream.send(data, { binary: isBinary });
3350
+ }
3351
+ });
3352
+ upstream.on("message", (data, isBinary) => {
3353
+ if (clientWs.readyState === import_ws.WebSocket.OPEN) {
3354
+ clientWs.send(data, { binary: isBinary });
3355
+ }
3356
+ });
3357
+ clientWs.on("close", (code, reason) => closeBoth(clientWs, upstream, code, reason));
3358
+ upstream.on("close", (code, reason) => closeBoth(upstream, clientWs, code, reason));
3359
+ clientWs.on("error", () => safeClose(upstream, 1011, "proxy client error"));
3360
+ upstream.on("error", () => safeClose(clientWs, 1011, "upstream websocket error"));
3361
+ }
3362
+ function createUpstreamWebSocket(targetUrl, protocols, headers) {
3363
+ const upstreamHeaders = { ...headers };
3364
+ if (!Object.keys(upstreamHeaders).some((key) => key.toLowerCase() === "origin")) {
3365
+ upstreamHeaders.origin = getDefaultWebSocketOrigin(targetUrl);
3366
+ }
3367
+ return new import_ws.WebSocket(targetUrl.href, protocols, {
3368
+ headers: upstreamHeaders
3369
+ });
3370
+ }
3371
+ function isWebSocketProxyRequestUrl(rawUrl) {
3372
+ if (!rawUrl) return false;
3373
+ try {
3374
+ return new URL(rawUrl, "http://localhost").pathname === WEBSOCKET_PROXY_PATH;
3375
+ } catch {
3376
+ return false;
3377
+ }
3378
+ }
3379
+ function handleWebSocketProxyUpgrade(req, socket, head) {
3380
+ if (!isWebSocketProxyRequestUrl(req.url)) return false;
3381
+ if (!isSameOriginUpgrade(req)) {
3382
+ rejectUpgrade(socket, 403, "forbidden websocket proxy origin");
3383
+ return true;
3384
+ }
3385
+ let targetUrl;
3386
+ let headers;
3387
+ try {
3388
+ const requestUrl = new URL(req.url || "/", "http://localhost");
3389
+ const target = requestUrl.searchParams.get("url");
3390
+ if (!target) {
3391
+ rejectUpgrade(socket, 400, "missing websocket proxy url");
3392
+ return true;
3393
+ }
3394
+ targetUrl = new URL(target);
3395
+ if (targetUrl.protocol !== "ws:" && targetUrl.protocol !== "wss:") {
3396
+ rejectUpgrade(socket, 400, "invalid websocket proxy protocol");
3397
+ return true;
3398
+ }
3399
+ headers = decodeProxyHeaders(requestUrl.searchParams.get("headers"));
3400
+ } catch {
3401
+ rejectUpgrade(socket, 400, "invalid websocket proxy request");
3402
+ return true;
3403
+ }
3404
+ const protocols = getRequestedProtocols(req);
3405
+ const upstream = createUpstreamWebSocket(targetUrl, protocols, headers);
3406
+ let completed = false;
3407
+ socket.once("close", () => {
3408
+ if (!completed) upstream.terminate();
3409
+ });
3410
+ upstream.once("open", () => {
3411
+ if (completed) return;
3412
+ completed = true;
3413
+ const selectedProtocol = upstream.protocol;
3414
+ const proxyServer = new import_ws.WebSocketServer({
3415
+ noServer: true,
3416
+ clientTracking: false,
3417
+ handleProtocols(requestedProtocols) {
3418
+ return selectedProtocol || requestedProtocols.values().next().value || false;
3419
+ }
3420
+ });
3421
+ proxyServer.handleUpgrade(req, socket, head, (clientWs) => {
3422
+ connectProxyPair(clientWs, upstream);
3423
+ });
3424
+ });
3425
+ upstream.once("error", () => {
3426
+ if (completed) return;
3427
+ completed = true;
3428
+ rejectUpgrade(socket, 502, "upstream websocket error");
3429
+ });
3430
+ upstream.once("close", () => {
3431
+ if (completed) return;
3432
+ completed = true;
3433
+ rejectUpgrade(socket, 502, "upstream websocket closed");
3434
+ });
3435
+ return true;
3436
+ }
3437
+
3235
3438
  // src/host/bridge-host.ts
3236
3439
  var WRITE_COMMAND_TYPES = /* @__PURE__ */ new Set(["tap", "keyboard"]);
3237
3440
  var FORCE_CLOSE_GRACE_MS = 2e3;
@@ -3446,8 +3649,14 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
3446
3649
  `);
3447
3650
  });
3448
3651
  this.httpServer = server;
3449
- this.wss = new import_ws.WebSocketServer({ server });
3652
+ this.wss = new import_ws2.WebSocketServer({ noServer: true });
3450
3653
  this.wireWebSocketServer();
3654
+ server.on("upgrade", (req, socket, head) => {
3655
+ if (handleWebSocketProxyUpgrade(req, socket, head)) return;
3656
+ this.wss?.handleUpgrade(req, socket, head, (ws) => {
3657
+ this.wss?.emit("connection", ws, req);
3658
+ });
3659
+ });
3451
3660
  resolve2();
3452
3661
  });
3453
3662
  });
@@ -3611,7 +3820,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
3611
3820
  config: next
3612
3821
  });
3613
3822
  for (const peer of this.sims.values()) {
3614
- if (peer.ws.readyState !== import_ws.WebSocket.OPEN) continue;
3823
+ if (peer.ws.readyState !== import_ws2.WebSocket.OPEN) continue;
3615
3824
  try {
3616
3825
  peer.ws.send(payload);
3617
3826
  } catch {
@@ -3667,7 +3876,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
3667
3876
  const entry = this.cliBySentId.get(msg.id);
3668
3877
  if (entry) {
3669
3878
  this.cliBySentId.delete(msg.id);
3670
- if (entry.ws.readyState === import_ws.WebSocket.OPEN) {
3879
+ if (entry.ws.readyState === import_ws2.WebSocket.OPEN) {
3671
3880
  const otherCliCount = this.getOtherCliIdentityCount(entry.ws, entry.simId);
3672
3881
  const response = otherCliCount > 0 ? { ...msg, id: entry.originalId, _otherCliCount: otherCliCount } : { ...msg, id: entry.originalId };
3673
3882
  entry.ws.send(JSON.stringify(response));
@@ -3695,7 +3904,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
3695
3904
  if (typeof msg.cliLabel === "string" && msg.cliLabel.trim()) {
3696
3905
  this.cliLabelBySocket.set(ws, msg.cliLabel.trim());
3697
3906
  }
3698
- if (ws.readyState === import_ws.WebSocket.OPEN) {
3907
+ if (ws.readyState === import_ws2.WebSocket.OPEN) {
3699
3908
  ws.send(
3700
3909
  JSON.stringify({
3701
3910
  id: msg.id,
@@ -3710,7 +3919,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
3710
3919
  return;
3711
3920
  }
3712
3921
  if (msg.type === "bridge:list-sims") {
3713
- if (ws.readyState === import_ws.WebSocket.OPEN) {
3922
+ if (ws.readyState === import_ws2.WebSocket.OPEN) {
3714
3923
  ws.send(
3715
3924
  JSON.stringify({
3716
3925
  id: msg.id,
@@ -3725,7 +3934,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
3725
3934
  throw new Error("bridge:open requires a url");
3726
3935
  }
3727
3936
  await this.openUrl(msg.url, { newWindow: msg.newWindow === true });
3728
- if (ws.readyState === import_ws.WebSocket.OPEN) {
3937
+ if (ws.readyState === import_ws2.WebSocket.OPEN) {
3729
3938
  ws.send(
3730
3939
  JSON.stringify({
3731
3940
  id: msg.id,
@@ -3741,7 +3950,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
3741
3950
  force: msg.force === true
3742
3951
  });
3743
3952
  if (!outcome.granted) {
3744
- if (ws.readyState === import_ws.WebSocket.OPEN) {
3953
+ if (ws.readyState === import_ws2.WebSocket.OPEN) {
3745
3954
  ws.send(
3746
3955
  JSON.stringify({
3747
3956
  id: msg.id,
@@ -3757,7 +3966,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
3757
3966
  targetSim2.id,
3758
3967
  outcome.bootedCount > 0 ? `cli force-claimed sim (booted ${outcome.bootedCount})` : "cli claimed sim"
3759
3968
  );
3760
- if (ws.readyState === import_ws.WebSocket.OPEN) {
3969
+ if (ws.readyState === import_ws2.WebSocket.OPEN) {
3761
3970
  ws.send(
3762
3971
  JSON.stringify({
3763
3972
  id: msg.id,
@@ -3776,7 +3985,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
3776
3985
  if (shouldAcquireLease(msg)) {
3777
3986
  const outcome = this.tryAcquireLease(ws, targetSim);
3778
3987
  if (!outcome.granted) {
3779
- if (ws.readyState === import_ws.WebSocket.OPEN) {
3988
+ if (ws.readyState === import_ws2.WebSocket.OPEN) {
3780
3989
  ws.send(
3781
3990
  JSON.stringify({
3782
3991
  id: msg.id,
@@ -3802,7 +4011,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
3802
4011
  targetSim.ws.send(JSON.stringify({ ...forwarded, id: sentId }));
3803
4012
  if (forwarded.type === "close") {
3804
4013
  this.cliBySentId.delete(sentId);
3805
- if (ws.readyState === import_ws.WebSocket.OPEN) {
4014
+ if (ws.readyState === import_ws2.WebSocket.OPEN) {
3806
4015
  ws.send(
3807
4016
  JSON.stringify({
3808
4017
  id: msg.id,
@@ -3817,7 +4026,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
3817
4026
  unrefTimer(closeTimer);
3818
4027
  }
3819
4028
  } catch (err) {
3820
- if (ws.readyState === import_ws.WebSocket.OPEN) {
4029
+ if (ws.readyState === import_ws2.WebSocket.OPEN) {
3821
4030
  ws.send(
3822
4031
  JSON.stringify({
3823
4032
  id: msg.id,
@@ -3842,7 +4051,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
3842
4051
  }
3843
4052
  for (const [sentId, entry] of this.cliBySentId) {
3844
4053
  if (entry.simId !== sim.id) continue;
3845
- if (entry.ws.readyState === import_ws.WebSocket.OPEN) {
4054
+ if (entry.ws.readyState === import_ws2.WebSocket.OPEN) {
3846
4055
  entry.ws.send(
3847
4056
  JSON.stringify({
3848
4057
  id: entry.originalId,
@@ -4048,7 +4257,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4048
4257
  runtimeDir: this.activeRuntimeDirPath
4049
4258
  });
4050
4259
  for (const sim of this.sims.values()) {
4051
- if (sim.ws.readyState === import_ws.WebSocket.OPEN) {
4260
+ if (sim.ws.readyState === import_ws2.WebSocket.OPEN) {
4052
4261
  try {
4053
4262
  sim.ws.send(payload);
4054
4263
  } catch {
@@ -4373,7 +4582,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4373
4582
  sweepDeadWebSockets() {
4374
4583
  if (!this.wss) return;
4375
4584
  for (const ws of this.wss.clients) {
4376
- if (ws.readyState !== import_ws.WebSocket.OPEN) continue;
4585
+ if (ws.readyState !== import_ws2.WebSocket.OPEN) continue;
4377
4586
  const alive = this.wsIsAlive.get(ws);
4378
4587
  if (alive === false) {
4379
4588
  try {
@@ -4394,7 +4603,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4394
4603
  }
4395
4604
  }
4396
4605
  closeSimSocketFromHost(ws) {
4397
- if (ws.readyState !== import_ws.WebSocket.OPEN) return;
4606
+ if (ws.readyState !== import_ws2.WebSocket.OPEN) return;
4398
4607
  try {
4399
4608
  ws.close(SOOTSIM_BRIDGE_SIM_CLOSE_CODE, SOOTSIM_BRIDGE_SIM_CLOSE_REASON);
4400
4609
  } catch {
@@ -4405,7 +4614,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4405
4614
  return;
4406
4615
  }
4407
4616
  const terminateTimer = setTimeout(() => {
4408
- if (ws.readyState === import_ws.WebSocket.CLOSED) return;
4617
+ if (ws.readyState === import_ws2.WebSocket.CLOSED) return;
4409
4618
  try {
4410
4619
  ws.terminate();
4411
4620
  } catch {
@@ -4554,7 +4763,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4554
4763
  try {
4555
4764
  readyState = sim.ws.readyState;
4556
4765
  } catch {
4557
- readyState = import_ws.WebSocket.CLOSED;
4766
+ readyState = import_ws2.WebSocket.CLOSED;
4558
4767
  }
4559
4768
  const lease = this.getActiveLease(sim);
4560
4769
  return {
@@ -4567,7 +4776,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4567
4776
  lastSeenAt: sim.lastSeenAt,
4568
4777
  lastActiveAt: sim.lastActiveAt || void 0,
4569
4778
  isPrimary: sim.id === this.primarySimId,
4570
- readyState: readyState === import_ws.WebSocket.OPEN ? "open" : readyState === import_ws.WebSocket.CLOSING ? "closing" : "closed",
4779
+ readyState: readyState === import_ws2.WebSocket.OPEN ? "open" : readyState === import_ws2.WebSocket.CLOSING ? "closing" : "closed",
4571
4780
  attachedCliCount: this.getAttachedCliCount(sim.id),
4572
4781
  lockedBy: lease ? lease.cliLabel || lease.cliIdentityKey : void 0,
4573
4782
  lockedByKind: lease ? lease.kind : void 0,
@@ -4684,18 +4893,18 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4684
4893
  getOpenSim(simId) {
4685
4894
  if (simId) {
4686
4895
  const sim = this.sims.get(simId);
4687
- if (sim?.ws.readyState === import_ws.WebSocket.OPEN) return sim;
4896
+ if (sim?.ws.readyState === import_ws2.WebSocket.OPEN) return sim;
4688
4897
  return null;
4689
4898
  }
4690
4899
  const primary = this.primarySimId != null ? this.sims.get(this.primarySimId) : null;
4691
- if (primary?.ws.readyState === import_ws.WebSocket.OPEN && primary.url) return primary;
4900
+ if (primary?.ws.readyState === import_ws2.WebSocket.OPEN && primary.url) return primary;
4692
4901
  let pagelessFallback = null;
4693
4902
  for (const sim of this.sims.values()) {
4694
- if (sim.ws.readyState !== import_ws.WebSocket.OPEN) continue;
4903
+ if (sim.ws.readyState !== import_ws2.WebSocket.OPEN) continue;
4695
4904
  if (sim.url) return sim;
4696
4905
  pagelessFallback ??= sim;
4697
4906
  }
4698
- if (primary?.ws.readyState === import_ws.WebSocket.OPEN) return primary;
4907
+ if (primary?.ws.readyState === import_ws2.WebSocket.OPEN) return primary;
4699
4908
  return pagelessFallback;
4700
4909
  }
4701
4910
  async waitForSim(simId, options = {}) {
@@ -4711,7 +4920,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4711
4920
  shouldPromoteSim(sim) {
4712
4921
  const current = this.primarySimId ? this.sims.get(this.primarySimId) : null;
4713
4922
  if (!sim.url) return !current;
4714
- const currentAlive = current?.ws.readyState === import_ws.WebSocket.OPEN;
4923
+ const currentAlive = current?.ws.readyState === import_ws2.WebSocket.OPEN;
4715
4924
  if (!current || !currentAlive || !current.url) return true;
4716
4925
  const isPrimaryCandidate = sim.origin?.includes(":5173");
4717
4926
  const currentIsPrimary = current.origin?.includes(":5173");
@@ -4719,7 +4928,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4719
4928
  }
4720
4929
  broadcastSimAssignments() {
4721
4930
  for (const sim of this.sims.values()) {
4722
- if (sim.ws.readyState !== import_ws.WebSocket.OPEN) continue;
4931
+ if (sim.ws.readyState !== import_ws2.WebSocket.OPEN) continue;
4723
4932
  sim.ws.send(
4724
4933
  JSON.stringify({
4725
4934
  type: "bridge:welcome",
@@ -4731,7 +4940,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4731
4940
  }
4732
4941
  broadcastSimClientStates() {
4733
4942
  for (const sim of this.sims.values()) {
4734
- if (sim.ws.readyState !== import_ws.WebSocket.OPEN) continue;
4943
+ if (sim.ws.readyState !== import_ws2.WebSocket.OPEN) continue;
4735
4944
  const lease = this.getActiveLease(sim);
4736
4945
  const message = {
4737
4946
  type: "bridge:client-state",
@@ -4796,7 +5005,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4796
5005
  const keys = /* @__PURE__ */ new Set();
4797
5006
  for (const [ws, attachedSimId] of this.cliSimBySocket) {
4798
5007
  if (attachedSimId !== simId) continue;
4799
- if (ws.readyState !== import_ws.WebSocket.OPEN) continue;
5008
+ if (ws.readyState !== import_ws2.WebSocket.OPEN) continue;
4800
5009
  const key = this.cliIdentityKeyBySocket.get(ws);
4801
5010
  keys.add(key ?? `ws-unknown-${keys.size}`);
4802
5011
  }
@@ -4809,7 +5018,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4809
5018
  const keys = /* @__PURE__ */ new Set();
4810
5019
  for (const [ws, attachedSimId] of this.cliSimBySocket) {
4811
5020
  if (attachedSimId !== simId) continue;
4812
- if (ws.readyState !== import_ws.WebSocket.OPEN) continue;
5021
+ if (ws.readyState !== import_ws2.WebSocket.OPEN) continue;
4813
5022
  const key = this.cliIdentityKeyBySocket.get(ws);
4814
5023
  if (key && key === selfKey) continue;
4815
5024
  keys.add(key ?? `ws-unknown-${keys.size}`);
@@ -4834,7 +5043,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4834
5043
  const nextId = requestedId?.trim();
4835
5044
  if (!nextId || nextId === sim.id) return false;
4836
5045
  const existing = this.sims.get(nextId);
4837
- if (existing && existing !== sim && existing.ws.readyState === import_ws.WebSocket.OPEN) {
5046
+ if (existing && existing !== sim && existing.ws.readyState === import_ws2.WebSocket.OPEN) {
4838
5047
  return false;
4839
5048
  }
4840
5049
  const restorable = this.getRestorableSimState(nextId);