sootsim 0.1.190 → 0.1.191

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 (135) hide show
  1. package/dist-cli/bin.js +3 -3
  2. package/dist-cli/chunks/{agent-XZWMKC4F.js → agent-YS7SPS6Z.js} +2 -2
  3. package/dist-cli/chunks/{agent-wrapper-CFJYDDAY.js → agent-wrapper-MHH4YKJE.js} +2 -2
  4. package/dist-cli/chunks/{app-fonts-64UN5GRY.js → app-fonts-PZNPXQAI.js} +2 -2
  5. package/dist-cli/chunks/{assert-A3MQH7ZB.js → assert-XVKXT3KE.js} +2 -2
  6. package/dist-cli/chunks/{auth-CNKNHD6U.js → auth-DUCWOBV3.js} +2 -2
  7. package/dist-cli/chunks/beta-4JXGELJG.js +2 -0
  8. package/dist-cli/chunks/{camera-YQPIDOEN.js → camera-XVZUX6Q2.js} +2 -2
  9. package/dist-cli/chunks/{chunk-CVUAT6TO.js → chunk-2QAG5IPN.js} +1 -1
  10. package/dist-cli/chunks/{chunk-LRJVY7SN.js → chunk-2ZZIXID6.js} +2 -2
  11. package/dist-cli/chunks/{chunk-MJU4XNZ3.js → chunk-5N2BFB4I.js} +1 -1
  12. package/dist-cli/chunks/{chunk-ITQV76PX.js → chunk-5XMJFP54.js} +1 -1
  13. package/dist-cli/chunks/{chunk-3JVMBXLH.js → chunk-64GTYKIF.js} +2 -2
  14. package/dist-cli/chunks/{chunk-R3VO3MDO.js → chunk-6PJLFYJT.js} +1 -1
  15. package/dist-cli/chunks/{chunk-PSETHPMH.js → chunk-6XAGMAP7.js} +3 -3
  16. package/dist-cli/chunks/{chunk-PR3IKD6A.js → chunk-6YV6WW5Q.js} +1 -1
  17. package/dist-cli/chunks/{chunk-PGQHNKRL.js → chunk-7NN725AT.js} +2 -2
  18. package/dist-cli/chunks/{chunk-F6GCSGBJ.js → chunk-A46MWTJB.js} +2 -2
  19. package/dist-cli/chunks/chunk-A4J3ZFTP.js +1 -0
  20. package/dist-cli/chunks/{chunk-TBFBGSRV.js → chunk-BORW7JE4.js} +1 -1
  21. package/dist-cli/chunks/{chunk-24OZOK2K.js → chunk-BYZ5SCMD.js} +1 -1
  22. package/dist-cli/chunks/chunk-D3FMK5KM.js +1 -0
  23. package/dist-cli/chunks/{chunk-IOJDFCGV.js → chunk-EXC6INU6.js} +3 -3
  24. package/dist-cli/chunks/{chunk-K7OCH4WY.js → chunk-FWZQSSEJ.js} +2 -2
  25. package/dist-cli/chunks/{chunk-YWQH2KQJ.js → chunk-JALTULVB.js} +1 -1
  26. package/dist-cli/chunks/{chunk-AAQ6AYYW.js → chunk-JCXQE5XP.js} +2 -2
  27. package/dist-cli/chunks/{chunk-EBBYYBYM.js → chunk-JYRWIES4.js} +3 -3
  28. package/dist-cli/chunks/{chunk-SPYRMNAJ.js → chunk-KITHQVX5.js} +2 -2
  29. package/dist-cli/chunks/{chunk-WHYPFQIZ.js → chunk-LJ4CQHHZ.js} +2 -2
  30. package/dist-cli/chunks/{chunk-WT74ZUKN.js → chunk-M6GIXT25.js} +1 -1
  31. package/dist-cli/chunks/{chunk-Y6CZ5N26.js → chunk-NX2QM2BE.js} +2 -2
  32. package/dist-cli/chunks/{chunk-P7MW7S62.js → chunk-O2X7YSAD.js} +13 -13
  33. package/dist-cli/chunks/{chunk-QJVITDKU.js → chunk-O7QYV2FI.js} +1 -1
  34. package/dist-cli/chunks/{chunk-6UQKBGI7.js → chunk-QLZSJLM4.js} +2 -2
  35. package/dist-cli/chunks/{chunk-WR5IDCCN.js → chunk-R6YZNTVX.js} +1 -1
  36. package/dist-cli/chunks/{chunk-7TSFDDU7.js → chunk-R7AEJR2M.js} +2 -2
  37. package/dist-cli/chunks/{chunk-CTP3U4WV.js → chunk-RINOK2FV.js} +2 -2
  38. package/dist-cli/chunks/{chunk-6EFMFMJB.js → chunk-S23R7GAE.js} +2 -2
  39. package/dist-cli/chunks/{chunk-SJHC6HZH.js → chunk-S6L32ZQF.js} +1 -1
  40. package/dist-cli/chunks/{chunk-QNVY6BLP.js → chunk-SQ2MTGDQ.js} +1 -1
  41. package/dist-cli/chunks/{chunk-MH6BMKK5.js → chunk-TE4UPZY2.js} +1 -1
  42. package/dist-cli/chunks/{chunk-K5GLQDTG.js → chunk-UKKQXZFZ.js} +2 -2
  43. package/dist-cli/chunks/{chunk-SMDCNCVZ.js → chunk-UYNPUHMD.js} +1 -1
  44. package/dist-cli/chunks/{chunk-5IM3DYTZ.js → chunk-UZDH32UA.js} +1 -1
  45. package/dist-cli/chunks/{chunk-IUVDM73R.js → chunk-WSF2QLMD.js} +2 -2
  46. package/dist-cli/chunks/{chunk-KLGX6B46.js → chunk-WUV6QJJU.js} +2 -2
  47. package/dist-cli/chunks/{chunk-INRO26KS.js → chunk-WXMGGTWH.js} +2 -2
  48. package/dist-cli/chunks/{chunk-NAI6N6SN.js → chunk-WXN3JD2J.js} +14 -5
  49. package/dist-cli/chunks/{chunk-UPN7Z5XZ.js → chunk-XJHF3OFF.js} +3 -3
  50. package/dist-cli/chunks/cli-version-UOHSVKG2.js +2 -0
  51. package/dist-cli/chunks/{compat-AU7EW2AY.js → compat-ZKG2T55R.js} +3 -3
  52. package/dist-cli/chunks/{config-TNZV6ASD.js → config-RWZGJPQB.js} +2 -2
  53. package/dist-cli/chunks/{control-TKDPQACC.js → control-6PTTSYCT.js} +2 -2
  54. package/dist-cli/chunks/daemon-NZA4D5HD.js +2 -0
  55. package/dist-cli/chunks/{debug-H5UHUDC4.js → debug-WMJUSORS.js} +3 -3
  56. package/dist-cli/chunks/{desktop-WYPCYR3Z.js → desktop-B4IZ3JSC.js} +3 -3
  57. package/dist-cli/chunks/{detox-36VI5PZ3.js → detox-GL2W7X6M.js} +2 -2
  58. package/dist-cli/chunks/{device-XPSGGSM5.js → device-ID3KADOW.js} +2 -2
  59. package/dist-cli/chunks/{diagnose-CH3VYGFO.js → diagnose-SNSGBFUR.js} +2 -2
  60. package/dist-cli/chunks/drivers-SCKKGVU5.js +2 -0
  61. package/dist-cli/chunks/flow-2DURO62S.js +2 -0
  62. package/dist-cli/chunks/help-NVVELOB7.js +2 -0
  63. package/dist-cli/chunks/{home-paths-IT2LCG6O.js → home-paths-QGNZG3YG.js} +2 -2
  64. package/dist-cli/chunks/inspect-5FWMOJ7P.js +2 -0
  65. package/dist-cli/chunks/install-desktop-5Z3S4JTX.js +2 -0
  66. package/dist-cli/chunks/{login-O6XRDK26.js → login-GDTYJBVI.js} +4 -4
  67. package/dist-cli/chunks/{logout-YK7BH4AK.js → logout-VE4INQI4.js} +2 -2
  68. package/dist-cli/chunks/{maestro-T52UBLSK.js → maestro-XBBDWQQU.js} +2 -2
  69. package/dist-cli/chunks/{mode-L4GR563F.js → mode-P34QE7AA.js} +2 -2
  70. package/dist-cli/chunks/optional-demo-registry-E7K3MGYI.js +2 -0
  71. package/dist-cli/chunks/{perf-7DYLYEBO.js → perf-ROSEJBSJ.js} +2 -2
  72. package/dist-cli/chunks/{record-MNIFB5DJ.js → record-UT47RU34.js} +3 -3
  73. package/dist-cli/chunks/runtime-HXK427JM.js +2 -0
  74. package/dist-cli/chunks/{screenshot-command-D77AXBND.js → screenshot-command-LXG5T54F.js} +2 -2
  75. package/dist-cli/chunks/{serve-LFPZVOVA.js → serve-UHVABXXQ.js} +2 -2
  76. package/dist-cli/chunks/{setup-6FX2KQP4.js → setup-RP4ZZNHU.js} +3 -3
  77. package/dist-cli/chunks/{skills-36CRDBMN.js → skills-IGB4LGQE.js} +2 -2
  78. package/dist-cli/chunks/{storage-N45XGOMV.js → storage-WIZD4QJO.js} +2 -2
  79. package/dist-cli/chunks/store-MS3GXV6K.js +2 -0
  80. package/dist-cli/chunks/telemetry-2RQQYIGP.js +2 -0
  81. package/dist-cli/chunks/{test-GCVW3U2P.js → test-6O3VSW7H.js} +5 -5
  82. package/dist-cli/chunks/{timeline-4ALLBESW.js → timeline-J6JK2K5P.js} +2 -2
  83. package/dist-cli/chunks/{upgrade-75XAVSMJ.js → upgrade-UCL5HS5J.js} +2 -2
  84. package/dist-cli/chunks/upload-H53ZS5FN.js +2 -0
  85. package/dist-cli/chunks/{version-MSFDAHVF.js → version-YHJ4K5CY.js} +2 -2
  86. package/dist-cli/chunks/{web-IS75NWAC.js → web-5UEVEPW2.js} +2 -2
  87. package/dist-cli/chunks/{what-happened-TW6SN7Z7.js → what-happened-3UE3QORD.js} +2 -2
  88. package/dist-lib/agent-daemon-client.cjs +1 -1
  89. package/dist-lib/agent-events.cjs +1 -1
  90. package/dist-lib/agent-identity.cjs +1 -1
  91. package/dist-lib/agent-sessions.cjs +1 -1
  92. package/dist-lib/attached-projects.cjs +1 -1
  93. package/dist-lib/auth/shared-session.cjs +1 -1
  94. package/dist-lib/backend-origin.cjs +1 -1
  95. package/dist-lib/beta.cjs +1 -1
  96. package/dist-lib/beta.mjs +1 -1
  97. package/dist-lib/bridge-constants.cjs +1 -1
  98. package/dist-lib/cli-constants.cjs +1 -1
  99. package/dist-lib/config.cjs +1 -1
  100. package/dist-lib/detox/index.cjs +1 -1
  101. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  102. package/dist-lib/home-paths.cjs +1 -1
  103. package/dist-lib/host/bridge-host.cjs +1 -1
  104. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  105. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  106. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  107. package/dist-lib/host/websocket-proxy.cjs +1 -1
  108. package/dist-lib/index.cjs +1 -1
  109. package/dist-lib/jump-to-source-babel.cjs +1 -1
  110. package/dist-lib/menu.cjs +1 -1
  111. package/dist-lib/menu.mjs +1 -1
  112. package/dist-lib/metro.cjs +1 -1
  113. package/dist-lib/profiles.cjs +1 -1
  114. package/dist-lib/render-mode.cjs +1 -1
  115. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  116. package/dist-lib/sdk.cjs +1 -1
  117. package/dist-lib/sdk.mjs +1 -1
  118. package/dist-lib/skills.cjs +1 -1
  119. package/dist-lib/vite.cjs +1 -1
  120. package/package.json +1 -1
  121. package/dist-cli/chunks/beta-CDL7U2RE.js +0 -2
  122. package/dist-cli/chunks/chunk-CD3ARXZW.js +0 -1
  123. package/dist-cli/chunks/chunk-DHDV2I2T.js +0 -1
  124. package/dist-cli/chunks/cli-version-PVRNMRL7.js +0 -2
  125. package/dist-cli/chunks/daemon-L57B7HBL.js +0 -2
  126. package/dist-cli/chunks/drivers-XDAXVIZF.js +0 -2
  127. package/dist-cli/chunks/flow-Q24HN25I.js +0 -2
  128. package/dist-cli/chunks/help-OPVDM7BI.js +0 -2
  129. package/dist-cli/chunks/inspect-FEMU6KSY.js +0 -2
  130. package/dist-cli/chunks/install-desktop-NCMJNSW7.js +0 -2
  131. package/dist-cli/chunks/optional-demo-registry-PDFLBZMQ.js +0 -2
  132. package/dist-cli/chunks/runtime-E4KWRPBT.js +0 -2
  133. package/dist-cli/chunks/store-USJP5W6S.js +0 -2
  134. package/dist-cli/chunks/telemetry-WQ7RK6NE.js +0 -2
  135. package/dist-cli/chunks/upload-34BCSEFZ.js +0 -2
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as x}from"./chunk-SMDCNCVZ.js";import{a as k}from"./chunk-TBFBGSRV.js";import{spawn as v,spawnSync as u}from"child_process";import{chmodSync as S,copyFileSync as T,createWriteStream as E,existsSync as w,mkdirSync as y,rmSync as g,statSync as P,unlinkSync as D}from"fs";import{tmpdir as M}from"os";import{dirname as A,join as f,resolve as b}from"path";var h="https://sootbean.com/api/electron-release";function O(){let n=process.arch;if(process.platform==="darwin"){let o=n==="arm64"?"mac-arm64":"mac-x64",e=`sootsim-latest-${o}.dmg`;return{platform:o,filename:e,url:`${h}/${e}`,install:L}}if(process.platform==="linux"){let o=n==="arm64"?"linux-arm64":"linux-x64",e=`sootsim-latest-${o}.AppImage`;return{platform:o,filename:e,url:`${h}/${e}`,install:C}}if(process.platform==="win32"){let o="sootsim-latest-win-x64.exe";return{platform:"win-x64",filename:o,url:`${h}/${o}`,install:B}}return null}async function I({url:n,dest:o,onProgress:e}){let s=await fetch(n,{redirect:"follow"});if(!s.ok)throw new Error(`${s.status} ${s.statusText} (${n})`);let t=s.headers.get("content-length"),a=t?Number(t):null;if(!s.body)throw new Error(`empty response body (${n})`);y(A(o),{recursive:!0});let i=E(o),d=s.body.getReader(),c=0;try{for(;;){let{done:l,value:p}=await d.read();if(l)break;i.write(Buffer.from(p)),c+=p.byteLength,e?.(c,a)}}finally{await new Promise((l,p)=>{i.end(r=>r?p(r):l())})}}function _(n,o){let e=(n/1048576).toFixed(1);if(!o)return` ${e} MB`;let s=Math.min(100,Math.round(n/o*100)),t=(o/(1024*1024)).toFixed(1),a=24,i=Math.round(s/100*a);return` ${"\u2588".repeat(i)+"\u2591".repeat(a-i)} ${s}% ${e} / ${t} MB`}async function L(n){let o=u("hdiutil",["attach","-nobrowse","-readonly",n],{encoding:"utf8"});if(o.status!==0)throw new Error(`hdiutil attach failed: ${o.stderr||o.stdout}`.trim());let e=o.stdout.trim().split(`
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as x}from"./chunk-UYNPUHMD.js";import{a as k}from"./chunk-BORW7JE4.js";import{spawn as v,spawnSync as u}from"child_process";import{chmodSync as S,copyFileSync as T,createWriteStream as E,existsSync as w,mkdirSync as y,rmSync as g,statSync as P,unlinkSync as D}from"fs";import{tmpdir as M}from"os";import{dirname as A,join as f,resolve as b}from"path";var h="https://sootbean.com/api/electron-release";function O(){let n=process.arch;if(process.platform==="darwin"){let o=n==="arm64"?"mac-arm64":"mac-x64",e=`sootsim-latest-${o}.dmg`;return{platform:o,filename:e,url:`${h}/${e}`,install:L}}if(process.platform==="linux"){let o=n==="arm64"?"linux-arm64":"linux-x64",e=`sootsim-latest-${o}.AppImage`;return{platform:o,filename:e,url:`${h}/${e}`,install:C}}if(process.platform==="win32"){let o="sootsim-latest-win-x64.exe";return{platform:"win-x64",filename:o,url:`${h}/${o}`,install:B}}return null}async function I({url:n,dest:o,onProgress:e}){let s=await fetch(n,{redirect:"follow"});if(!s.ok)throw new Error(`${s.status} ${s.statusText} (${n})`);let t=s.headers.get("content-length"),a=t?Number(t):null;if(!s.body)throw new Error(`empty response body (${n})`);y(A(o),{recursive:!0});let i=E(o),d=s.body.getReader(),c=0;try{for(;;){let{done:l,value:p}=await d.read();if(l)break;i.write(Buffer.from(p)),c+=p.byteLength,e?.(c,a)}}finally{await new Promise((l,p)=>{i.end(r=>r?p(r):l())})}}function _(n,o){let e=(n/1048576).toFixed(1);if(!o)return` ${e} MB`;let s=Math.min(100,Math.round(n/o*100)),t=(o/(1024*1024)).toFixed(1),a=24,i=Math.round(s/100*a);return` ${"\u2588".repeat(i)+"\u2591".repeat(a-i)} ${s}% ${e} / ${t} MB`}async function L(n){let o=u("hdiutil",["attach","-nobrowse","-readonly",n],{encoding:"utf8"});if(o.status!==0)throw new Error(`hdiutil attach failed: ${o.stderr||o.stdout}`.trim());let e=o.stdout.trim().split(`
3
3
  `),t=e[e.length-1].split(" ").pop()?.trim();if(!t||!w(t))throw new Error(`could not determine dmg mount point (output: ${o.stdout})`);let a=f(t,"sootsim.app");if(!w(a))throw u("hdiutil",["detach","-force",t]),new Error(`sootsim.app not found inside ${t}`);let i="/Applications",d=b(process.env.HOME||"","Applications"),c=i;try{let m=f(i,`.sootsim-write-probe-${process.pid}`);u("touch",[m]),w(m)?g(m,{force:!0}):c=d}catch{c=d}c===d&&y(c,{recursive:!0});let l=f(c,"sootsim.app");w(l)&&g(l,{recursive:!0,force:!0});let p=u("cp",["-R",a,l]),r=u("hdiutil",["detach","-force",t]);if(p.status!==0)throw new Error(`copy to ${l} failed: ${p.stderr?.toString()||""}`.trim());return r.status!==0&&console.warn(` warning: failed to unmount ${t} (${r.stderr?.toString().trim()||"unknown error"})`),u("xattr",["-dr","com.apple.quarantine",l]),l}async function C(n){let o=b(process.env.HOME||"","Applications");y(o,{recursive:!0});let e=f(o,"sootsim.AppImage");return w(e)&&g(e,{force:!0}),T(n,e),D(n),S(e,493),e}async function B(n){return await new Promise((o,e)=>{let s=v("cmd",["/c","start",'""',"/wait",n],{stdio:"inherit"});s.once("error",e),s.once("exit",t=>{t===0?o():e(new Error(`installer exited with code ${t}`))})}),n}async function q(n){(n.includes("--help")||n.includes("-h"))&&(console.log(`
4
4
  sootsim desktop install \u2014 download and install the optional desktop GUI
5
5
 
@@ -20,4 +20,4 @@ examples:
20
20
  `),process.exit(0));let o=n.includes("--yes")||n.includes("-y")||process.env.SOOTSIM_NO_PROMPT==="1"||process.env.CI==="1"||!process.stdin.isTTY,e=n.includes("--force"),s=k();if(s&&!e){console.log(` sootsim desktop already installed at: ${s.path}`),console.log(" pass --force to reinstall.");return}let t=O();if(t||(console.error(` no desktop build available for ${process.platform}/${process.arch}.`),console.error(" supported: darwin-arm64, darwin-x64, linux-x64, linux-arm64, win32-x64"),process.exit(1)),console.log(` platform: ${t.platform}`),console.log(` download: ${t.url}`),console.log(),!o){if(!await x("download and install now?",!0)){console.log(" cancelled.");return}console.log()}let a=f(M(),`sootsim-install-${Date.now()}`),i=f(a,t.filename),d=0;process.stdout.write(` downloading ${t.filename}...
21
21
  `);try{await I({url:t.url,dest:i,onProgress:(r,m)=>{let $=Date.now();$-d<100&&r<(m??1/0)||(d=$,process.stdout.isTTY&&process.stdout.write(`\r\x1B[2K${_(r,m)}`))}})}catch(r){g(a,{recursive:!0,force:!0});let m=r instanceof Error?r.message:String(r);console.error(`
22
22
  download failed: ${m}`),console.error(` the ${t.platform} desktop build may not be published yet, or your`),console.error(" network blocked the request. check your connection and try again later;"),console.error(" the CLI + daemon work without the desktop app (run: sootsim --help)."),process.exit(1)}process.stdout.isTTY&&process.stdout.write(`
23
- `);let c=P(i).size;console.log(` downloaded ${(c/(1024*1024)).toFixed(1)} MB`),console.log(),console.log(" installing...");let{trackCliEvent:l,flushCliTelemetry:p}=await import("./telemetry-WQ7RK6NE.js");try{let r=await t.install(i);l({event:"cli_install_desktop_succeeded",properties:{platform:t.platform,size_bytes:c}}),console.log(` installed: ${r}`)}catch(r){l({event:"cli_install_desktop_failed",properties:{platform:t.platform,error:r instanceof Error?r.message:String(r)}}),await p(),console.error(` install failed: ${r instanceof Error?r.message:String(r)}`),console.error(` keeping download at ${i} for manual install.`),process.exit(1)}finally{g(a,{recursive:!0,force:!0})}console.log(),console.log(" next steps:"),console.log(" sootsim desktop launch the desktop app"),console.log(" sootsim open <target> open a demo or bundle in it")}export{q as a};
23
+ `);let c=P(i).size;console.log(` downloaded ${(c/(1024*1024)).toFixed(1)} MB`),console.log(),console.log(" installing...");let{trackCliEvent:l,flushCliTelemetry:p}=await import("./telemetry-2RQQYIGP.js");try{let r=await t.install(i);l({event:"cli_install_desktop_succeeded",properties:{platform:t.platform,size_bytes:c}}),console.log(` installed: ${r}`)}catch(r){l({event:"cli_install_desktop_failed",properties:{platform:t.platform,error:r instanceof Error?r.message:String(r)}}),await p(),console.error(` install failed: ${r instanceof Error?r.message:String(r)}`),console.error(` keeping download at ${i} for manual install.`),process.exit(1)}finally{g(a,{recursive:!0,force:!0})}console.log(),console.log(" next steps:"),console.log(" sootsim desktop launch the desktop app"),console.log(" sootsim open <target> open a demo or bundle in it")}export{q as a};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as R}from"./chunk-5IM3DYTZ.js";import{o as D}from"./chunk-MH6BMKK5.js";import{a as T}from"./chunk-YWQH2KQJ.js";function Y(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.type=="string"&&typeof t.ts=="number"}function I(e){let t=e.trim();if(!t)return null;try{let r=JSON.parse(t);return Y(r)?r:null}catch{return null}}import{randomBytes as G,createHash as q}from"node:crypto";import m from"node:fs";import h from"node:path";var N=null;function _(){if(N)return N;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||D()}function y(){return _()}function U(){return h.join(_(),"attached-projects.json")}function $(){return{version:1,attachedProjects:[],previewAttachments:[],agentSessions:[]}}function S(){let e=U(),t;try{t=m.readFileSync(e,"utf8")}catch(r){if(r.code==="ENOENT")return $();throw r}try{let r=JSON.parse(t);if(!r||typeof r!="object")throw new Error("not an object");return{version:1,attachedProjects:Array.isArray(r.attachedProjects)?r.attachedProjects:[],previewAttachments:Array.isArray(r.previewAttachments)?r.previewAttachments:[],agentSessions:Array.isArray(r.agentSessions)?r.agentSessions:[]}}catch(r){let n=`${e}.corrupt-${Date.now()}`;try{m.renameSync(e,n),console.warn(`[sootsim] attached-projects.json was unparseable; quarantined to ${n}. original error: ${r.message}`)}catch{}return $()}}function X(e){let t=U();m.mkdirSync(h.dirname(t),{recursive:!0});let r=`${t}.tmp-${process.pid}-${Date.now()}`,n=m.openSync(r,"w",384);try{m.writeFileSync(n,JSON.stringify(e,null,2)),m.fsyncSync(n)}finally{m.closeSync(n)}m.renameSync(r,t)}function w(e){let t=S();return e(t),X(t),t}function B(e){return q("sha256").update(h.resolve(e)).digest("hex").slice(0,16)}function K(){return`s_${G(10).toString("hex")}`}function ge(e){let t=h.resolve(e.cwd),r=B(t),n;return w(o=>{let s=o.attachedProjects.find(c=>c.id===r);if(s){let c={...s,...e,id:r,cwd:t,sourceRoots:e.sourceRoots??s.sourceRoots,knownBundleUrls:e.knownBundleUrls??s.knownBundleUrls,pinnedSourceResolutions:e.pinnedSourceResolutions??s.pinnedSourceResolutions,telemetry:e.telemetry??s.telemetry,updatedAt:Date.now(),createdAt:s.createdAt},g=o.attachedProjects.indexOf(s);o.attachedProjects[g]=c,n=c;return}let a=Date.now(),d={id:r,name:e.name??h.basename(t),cwd:t,repoRoot:e.repoRoot,sourceRoots:e.sourceRoots??[t],framework:e.framework??"unknown",bundleId:e.bundleId,knownBundleUrls:e.knownBundleUrls??[],preferredProvider:e.preferredProvider??"codex",preferredTransport:e.preferredTransport??"tmux",editorOpenCommand:e.editorOpenCommand,moshiWebhookToken:e.moshiWebhookToken,pinnedSourceResolutions:e.pinnedSourceResolutions??{},isolateDiscovery:e.isolateDiscovery,git:e.git,telemetry:e.telemetry??{lastOpened:0,runsCompleted:0},createdAt:a,updatedAt:a};o.attachedProjects.push(d),n=d}),n}function F(e){return S().attachedProjects.find(t=>t.id===e)??null}function he(){return S().attachedProjects}var Q=336*60*60*1e3;function ye(e,t={}){w(r=>{let n=r.attachedProjects.find(s=>s.id===e);if(!n)return;let o=t.ts??Date.now();if(n.telemetry.runsCompleted=(n.telemetry.runsCompleted??0)+1,typeof t.usd=="number"&&Number.isFinite(t.usd)&&t.usd>=0){let s=n.telemetry.costHistory??[],a=o-Q,d=s.filter(c=>c.ts>=a);d.push({ts:o,usd:t.usd}),n.telemetry.costHistory=d}n.updatedAt=o})}function Se(e,t=Date.now()){let r=t-6048e5,n=e.telemetry.costHistory??[],o=0;for(let s of n)s.ts>=r&&(o+=s.usd);return o}function we(e){w(t=>{t.attachedProjects=t.attachedProjects.filter(r=>r.id!==e),t.agentSessions=t.agentSessions.filter(r=>r.projectId!==e),t.previewAttachments=t.previewAttachments.filter(r=>r.projectId!==e)})}function M(e){let t;return w(r=>{if(e.id){let a=r.agentSessions.find(d=>d.id===e.id);if(a){let d={...a,...e,lastSeenAt:Date.now()},c=r.agentSessions.indexOf(a);r.agentSessions[c]=d,t=d;return}}let n=r.attachedProjects.find(a=>a.id===e.projectId);if(!n)throw new Error(`upsertSession: no AttachedProject with id=${e.projectId}`);let o=Date.now(),s={id:e.id??K(),projectId:e.projectId,provider:e.provider,transport:e.transport??n.preferredTransport,cwd:e.cwd??n.cwd,claudeSessionUuid:e.claudeSessionUuid,tmuxSessionName:e.tmuxSessionName,wrapperPid:e.wrapperPid,status:e.status??"idle",needsAttention:e.needsAttention??!1,lastPrompt:e.lastPrompt,lastSummary:e.lastSummary,lastTurnFiles:e.lastTurnFiles,currentlyEditing:e.currentlyEditing,lastSeenAt:o,createdAt:o};r.agentSessions.push(s),t=s}),t}function k(e){return S().agentSessions.find(t=>t.id===e)??null}function C(e){let t=S().agentSessions;return e?t.filter(r=>r.projectId===e):t}function v(e,t){w(r=>{let n=r.agentSessions.find(s=>s.id===e);if(!n)return;let o=r.agentSessions.indexOf(n);r.agentSessions[o]={...n,...t,id:n.id,projectId:n.projectId,createdAt:n.createdAt,lastSeenAt:Date.now()}})}async function ve(){if(S().attachedProjects.length>0)return;let{loadOptionalDemoApps:t}=await import("./optional-demo-registry-PDFLBZMQ.js"),r=await t();r.length!==0&&w(n=>{for(let o of r){if(!m.existsSync(o.dir))continue;let s=h.resolve(o.dir),a=B(s);if(n.attachedProjects.some(c=>c.id===a))continue;let d=Date.now();n.attachedProjects.push({id:a,name:o.label,cwd:s,sourceRoots:[s],framework:o.framework,knownBundleUrls:[`http://localhost:${o.preferredPort}/index.bundle`],preferredProvider:"codex",preferredTransport:"tmux",pinnedSourceResolutions:{},telemetry:{lastOpened:0,runsCompleted:0},createdAt:d,updatedAt:d})}})}import{spawn as V,spawnSync as z}from"node:child_process";import{randomUUID as Z}from"node:crypto";import i,{constants as f}from"node:fs";import u from"node:path";import ee from"node:readline";function j(e){return u.join(y(),"sessions",e)}function W(e){return u.join(j(e),"prompt.in")}function J(e){return u.join(j(e),"events.out")}function te(e){return u.join(y(),"transcripts",`${e}.log`)}function O(e,t){if(!e)return!1;try{process.kill(e,0)}catch{return!1}return!(t&&!i.existsSync(j(t)))}function re(){if(process.env.SOOTSIM_BIN)return{cmd:process.env.SOOTSIM_BIN,prefixArgs:[]};if(process.versions.electron){let n=process.resourcesPath;if(n){let o=[u.join(n,"bin","sootsim"),u.join(n,"bin",`sootsim-${process.platform}-${process.arch}`)];for(let s of o)if(i.existsSync(s))return{cmd:s,prefixArgs:[]}}}let e=ne();if(e)return e;let t=process.argv[0],r=process.argv[1];if(r&&/\.(ts|tsx|mjs|cjs|js)$/.test(r))return{cmd:t,prefixArgs:[r]};if(!r||r.includes("/.bin/"))throw new Error("sootsim CLI not found. set SOOTSIM_BIN to the path of the sootsim binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`.");return{cmd:t,prefixArgs:[]}}function ne(){try{let e=se();if(!e)return null;let t=`sootsim-${process.platform}-${process.arch}`,r=u.join(e,"dist-bin",t);if(i.existsSync(r))return{cmd:r,prefixArgs:[]};let n=u.join(e,"dist-cli","bin.js");if(i.existsSync(n)){try{let o=u.join(e,"cli","commands","agent-wrapper.ts");if(i.existsSync(o)){let s=i.statSync(o).mtimeMs;i.statSync(n).mtimeMs<s&&console.warn("[sootsim] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with `bun run --cwd packages/sootsim build:cli` (watch:cli:binary builds dist-bin/ instead).")}}catch{}return{cmd:process.execPath,prefixArgs:[n]}}return null}catch{return null}}function se(){try{let r=T.resolve("sootsim/package.json");return u.dirname(r)}catch{}let e=oe();if(!e)return null;let t=u.dirname(e);for(let r=0;r<8;r++){let n=u.join(t,"package.json");try{if(i.existsSync(n)&&JSON.parse(i.readFileSync(n,"utf8")).name==="sootsim")return t}catch{}let o=u.dirname(t);if(o===t)break;t=o}return null}function oe(){try{let e=import.meta.url;return!e||!e.startsWith("file://")?null:decodeURIComponent(e.slice(7))}catch{return null}}async function ie(e,t,r){let n=u.join(y(),"locks");i.mkdirSync(n,{recursive:!0});try{i.chmodSync(n,448)}catch{}let o=u.join(n,`start-${e}-${t}.lock`),s=Date.now()+4e3,a=null;for(;a===null;)try{a=i.openSync(o,f.O_WRONLY|f.O_CREAT|f.O_EXCL,384)}catch(d){if(d.code!=="EEXIST")throw d;try{let c=Number(i.readFileSync(o,"utf8").trim());if(c&&!ce(c)){i.unlinkSync(o);continue}}catch{}if(Date.now()>s)throw new Error(`another start is in progress for project=${e} provider=${t} (lock: ${o})`);await new Promise(c=>setTimeout(c,50))}try{return i.writeFileSync(a,String(process.pid)),await r()}finally{try{i.closeSync(a)}catch{}try{i.unlinkSync(o)}catch{}}}function ce(e){try{return process.kill(e,0),!0}catch{return!1}}function L(e){let t=u.dirname(e);i.mkdirSync(t,{recursive:!0});try{i.chmodSync(t,448)}catch{}if(i.existsSync(e))try{if(i.statSync(e).isFIFO()){try{i.chmodSync(e,384)}catch{}return}i.unlinkSync(e)}catch{i.unlinkSync(e)}let r=z("mkfifo",["-m","600",e]);if(r.status!==0)throw new Error(`mkfifo(${e}) failed: ${r.stderr?.toString().trim()||"unknown error"}`)}var l=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function Te(e){let t=F(e.projectId);if(!t)throw new l("NO_PROJECT",`no project with id=${e.projectId}`);let r=e.provider||t.preferredProvider||"codex";return ie(t.id,r,async()=>{let n=C(t.id).find(p=>p.provider===r&&p.status!=="ended"&&O(p.wrapperPid,p.id));if(n)throw new l("ALREADY_RUNNING",`session already running for project=${t.id} provider=${r} (session ${n.id}, pid ${n.wrapperPid}). end it first with \`sootsim agent end <sessionId>\`.`);let o=r==="claude"?Z():void 0,s=M({projectId:t.id,provider:r,transport:"pty",cwd:t.cwd,status:"idle",claudeSessionUuid:o}),a=W(s.id),d=J(s.id),c=te(s.id);L(a),L(d);let g=u.dirname(c);i.mkdirSync(g,{recursive:!0});try{i.chmodSync(g,448)}catch{}let{cmd:A,prefixArgs:H}=re(),x=[...H,"agent-wrapper","--session-id",s.id,"--project-id",t.id,"--provider",r,"--cwd",t.cwd,"--prompt-in",a,"--events-out",d,"--transcript",c];e.codexBin&&x.push("--codex-bin",e.codexBin),e.claudeBin&&x.push("--claude-bin",e.claudeBin),e.freshThread&&x.push("--fresh-thread"),o&&x.push("--claude-session-uuid",o);let P=V(A,x,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:y()}});P.unref();let E=e.readyTimeoutMs??6e3,b=await ae(d,p=>p.type==="ready"||p.type==="error",E);if(!b||b.type==="error"){if(P.pid)try{process.kill(P.pid,"SIGTERM")}catch{}try{i.rmSync(j(s.id),{recursive:!0,force:!0})}catch{}v(s.id,{status:"ended"});let p=b&&b.type==="error"?b.message:`no ready event within ${E}ms`;throw new l("WRAPPER_FAILED",p)}return v(s.id,{wrapperPid:P.pid,status:"idle"}),{session:k(s.id),wrapperPid:P.pid}})}async function De(e,t){let r=k(e);if(!r)throw new l("NO_SESSION",`no session with id=${e}`);if(!O(r.wrapperPid,e))throw v(e,{status:"ended"}),new l("NOT_ALIVE",`session wrapper is not alive (pid=${r.wrapperPid}). start a new session.`);let n=W(e);if(!i.existsSync(n))throw new l("NO_FIFO",`prompt FIFO missing: ${n}`);let o=i.openSync(n,f.O_WRONLY);try{let s=R(t);if(!s)throw new l("EMPTY_PROMPT","prompt text is empty");i.writeSync(o,s+`
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as R}from"./chunk-UZDH32UA.js";import{o as D}from"./chunk-TE4UPZY2.js";import{a as T}from"./chunk-JALTULVB.js";function Y(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.type=="string"&&typeof t.ts=="number"}function I(e){let t=e.trim();if(!t)return null;try{let r=JSON.parse(t);return Y(r)?r:null}catch{return null}}import{randomBytes as G,createHash as q}from"node:crypto";import m from"node:fs";import h from"node:path";var N=null;function _(){if(N)return N;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||D()}function y(){return _()}function U(){return h.join(_(),"attached-projects.json")}function $(){return{version:1,attachedProjects:[],previewAttachments:[],agentSessions:[]}}function S(){let e=U(),t;try{t=m.readFileSync(e,"utf8")}catch(r){if(r.code==="ENOENT")return $();throw r}try{let r=JSON.parse(t);if(!r||typeof r!="object")throw new Error("not an object");return{version:1,attachedProjects:Array.isArray(r.attachedProjects)?r.attachedProjects:[],previewAttachments:Array.isArray(r.previewAttachments)?r.previewAttachments:[],agentSessions:Array.isArray(r.agentSessions)?r.agentSessions:[]}}catch(r){let n=`${e}.corrupt-${Date.now()}`;try{m.renameSync(e,n),console.warn(`[sootsim] attached-projects.json was unparseable; quarantined to ${n}. original error: ${r.message}`)}catch{}return $()}}function X(e){let t=U();m.mkdirSync(h.dirname(t),{recursive:!0});let r=`${t}.tmp-${process.pid}-${Date.now()}`,n=m.openSync(r,"w",384);try{m.writeFileSync(n,JSON.stringify(e,null,2)),m.fsyncSync(n)}finally{m.closeSync(n)}m.renameSync(r,t)}function w(e){let t=S();return e(t),X(t),t}function B(e){return q("sha256").update(h.resolve(e)).digest("hex").slice(0,16)}function K(){return`s_${G(10).toString("hex")}`}function ge(e){let t=h.resolve(e.cwd),r=B(t),n;return w(o=>{let s=o.attachedProjects.find(c=>c.id===r);if(s){let c={...s,...e,id:r,cwd:t,sourceRoots:e.sourceRoots??s.sourceRoots,knownBundleUrls:e.knownBundleUrls??s.knownBundleUrls,pinnedSourceResolutions:e.pinnedSourceResolutions??s.pinnedSourceResolutions,telemetry:e.telemetry??s.telemetry,updatedAt:Date.now(),createdAt:s.createdAt},g=o.attachedProjects.indexOf(s);o.attachedProjects[g]=c,n=c;return}let a=Date.now(),d={id:r,name:e.name??h.basename(t),cwd:t,repoRoot:e.repoRoot,sourceRoots:e.sourceRoots??[t],framework:e.framework??"unknown",bundleId:e.bundleId,knownBundleUrls:e.knownBundleUrls??[],preferredProvider:e.preferredProvider??"codex",preferredTransport:e.preferredTransport??"tmux",editorOpenCommand:e.editorOpenCommand,moshiWebhookToken:e.moshiWebhookToken,pinnedSourceResolutions:e.pinnedSourceResolutions??{},isolateDiscovery:e.isolateDiscovery,git:e.git,telemetry:e.telemetry??{lastOpened:0,runsCompleted:0},createdAt:a,updatedAt:a};o.attachedProjects.push(d),n=d}),n}function F(e){return S().attachedProjects.find(t=>t.id===e)??null}function he(){return S().attachedProjects}var Q=336*60*60*1e3;function ye(e,t={}){w(r=>{let n=r.attachedProjects.find(s=>s.id===e);if(!n)return;let o=t.ts??Date.now();if(n.telemetry.runsCompleted=(n.telemetry.runsCompleted??0)+1,typeof t.usd=="number"&&Number.isFinite(t.usd)&&t.usd>=0){let s=n.telemetry.costHistory??[],a=o-Q,d=s.filter(c=>c.ts>=a);d.push({ts:o,usd:t.usd}),n.telemetry.costHistory=d}n.updatedAt=o})}function Se(e,t=Date.now()){let r=t-6048e5,n=e.telemetry.costHistory??[],o=0;for(let s of n)s.ts>=r&&(o+=s.usd);return o}function we(e){w(t=>{t.attachedProjects=t.attachedProjects.filter(r=>r.id!==e),t.agentSessions=t.agentSessions.filter(r=>r.projectId!==e),t.previewAttachments=t.previewAttachments.filter(r=>r.projectId!==e)})}function M(e){let t;return w(r=>{if(e.id){let a=r.agentSessions.find(d=>d.id===e.id);if(a){let d={...a,...e,lastSeenAt:Date.now()},c=r.agentSessions.indexOf(a);r.agentSessions[c]=d,t=d;return}}let n=r.attachedProjects.find(a=>a.id===e.projectId);if(!n)throw new Error(`upsertSession: no AttachedProject with id=${e.projectId}`);let o=Date.now(),s={id:e.id??K(),projectId:e.projectId,provider:e.provider,transport:e.transport??n.preferredTransport,cwd:e.cwd??n.cwd,claudeSessionUuid:e.claudeSessionUuid,tmuxSessionName:e.tmuxSessionName,wrapperPid:e.wrapperPid,status:e.status??"idle",needsAttention:e.needsAttention??!1,lastPrompt:e.lastPrompt,lastSummary:e.lastSummary,lastTurnFiles:e.lastTurnFiles,currentlyEditing:e.currentlyEditing,lastSeenAt:o,createdAt:o};r.agentSessions.push(s),t=s}),t}function k(e){return S().agentSessions.find(t=>t.id===e)??null}function C(e){let t=S().agentSessions;return e?t.filter(r=>r.projectId===e):t}function v(e,t){w(r=>{let n=r.agentSessions.find(s=>s.id===e);if(!n)return;let o=r.agentSessions.indexOf(n);r.agentSessions[o]={...n,...t,id:n.id,projectId:n.projectId,createdAt:n.createdAt,lastSeenAt:Date.now()}})}async function ve(){if(S().attachedProjects.length>0)return;let{loadOptionalDemoApps:t}=await import("./optional-demo-registry-E7K3MGYI.js"),r=await t();r.length!==0&&w(n=>{for(let o of r){if(!m.existsSync(o.dir))continue;let s=h.resolve(o.dir),a=B(s);if(n.attachedProjects.some(c=>c.id===a))continue;let d=Date.now();n.attachedProjects.push({id:a,name:o.label,cwd:s,sourceRoots:[s],framework:o.framework,knownBundleUrls:[`http://localhost:${o.preferredPort}/index.bundle`],preferredProvider:"codex",preferredTransport:"tmux",pinnedSourceResolutions:{},telemetry:{lastOpened:0,runsCompleted:0},createdAt:d,updatedAt:d})}})}import{spawn as V,spawnSync as z}from"node:child_process";import{randomUUID as Z}from"node:crypto";import i,{constants as f}from"node:fs";import u from"node:path";import ee from"node:readline";function j(e){return u.join(y(),"sessions",e)}function W(e){return u.join(j(e),"prompt.in")}function J(e){return u.join(j(e),"events.out")}function te(e){return u.join(y(),"transcripts",`${e}.log`)}function O(e,t){if(!e)return!1;try{process.kill(e,0)}catch{return!1}return!(t&&!i.existsSync(j(t)))}function re(){if(process.env.SOOTSIM_BIN)return{cmd:process.env.SOOTSIM_BIN,prefixArgs:[]};if(process.versions.electron){let n=process.resourcesPath;if(n){let o=[u.join(n,"bin","sootsim"),u.join(n,"bin",`sootsim-${process.platform}-${process.arch}`)];for(let s of o)if(i.existsSync(s))return{cmd:s,prefixArgs:[]}}}let e=ne();if(e)return e;let t=process.argv[0],r=process.argv[1];if(r&&/\.(ts|tsx|mjs|cjs|js)$/.test(r))return{cmd:t,prefixArgs:[r]};if(!r||r.includes("/.bin/"))throw new Error("sootsim CLI not found. set SOOTSIM_BIN to the path of the sootsim binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`.");return{cmd:t,prefixArgs:[]}}function ne(){try{let e=se();if(!e)return null;let t=`sootsim-${process.platform}-${process.arch}`,r=u.join(e,"dist-bin",t);if(i.existsSync(r))return{cmd:r,prefixArgs:[]};let n=u.join(e,"dist-cli","bin.js");if(i.existsSync(n)){try{let o=u.join(e,"cli","commands","agent-wrapper.ts");if(i.existsSync(o)){let s=i.statSync(o).mtimeMs;i.statSync(n).mtimeMs<s&&console.warn("[sootsim] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with `bun run --cwd packages/sootsim build:cli` (watch:cli:binary builds dist-bin/ instead).")}}catch{}return{cmd:process.execPath,prefixArgs:[n]}}return null}catch{return null}}function se(){try{let r=T.resolve("sootsim/package.json");return u.dirname(r)}catch{}let e=oe();if(!e)return null;let t=u.dirname(e);for(let r=0;r<8;r++){let n=u.join(t,"package.json");try{if(i.existsSync(n)&&JSON.parse(i.readFileSync(n,"utf8")).name==="sootsim")return t}catch{}let o=u.dirname(t);if(o===t)break;t=o}return null}function oe(){try{let e=import.meta.url;return!e||!e.startsWith("file://")?null:decodeURIComponent(e.slice(7))}catch{return null}}async function ie(e,t,r){let n=u.join(y(),"locks");i.mkdirSync(n,{recursive:!0});try{i.chmodSync(n,448)}catch{}let o=u.join(n,`start-${e}-${t}.lock`),s=Date.now()+4e3,a=null;for(;a===null;)try{a=i.openSync(o,f.O_WRONLY|f.O_CREAT|f.O_EXCL,384)}catch(d){if(d.code!=="EEXIST")throw d;try{let c=Number(i.readFileSync(o,"utf8").trim());if(c&&!ce(c)){i.unlinkSync(o);continue}}catch{}if(Date.now()>s)throw new Error(`another start is in progress for project=${e} provider=${t} (lock: ${o})`);await new Promise(c=>setTimeout(c,50))}try{return i.writeFileSync(a,String(process.pid)),await r()}finally{try{i.closeSync(a)}catch{}try{i.unlinkSync(o)}catch{}}}function ce(e){try{return process.kill(e,0),!0}catch{return!1}}function L(e){let t=u.dirname(e);i.mkdirSync(t,{recursive:!0});try{i.chmodSync(t,448)}catch{}if(i.existsSync(e))try{if(i.statSync(e).isFIFO()){try{i.chmodSync(e,384)}catch{}return}i.unlinkSync(e)}catch{i.unlinkSync(e)}let r=z("mkfifo",["-m","600",e]);if(r.status!==0)throw new Error(`mkfifo(${e}) failed: ${r.stderr?.toString().trim()||"unknown error"}`)}var l=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function Te(e){let t=F(e.projectId);if(!t)throw new l("NO_PROJECT",`no project with id=${e.projectId}`);let r=e.provider||t.preferredProvider||"codex";return ie(t.id,r,async()=>{let n=C(t.id).find(p=>p.provider===r&&p.status!=="ended"&&O(p.wrapperPid,p.id));if(n)throw new l("ALREADY_RUNNING",`session already running for project=${t.id} provider=${r} (session ${n.id}, pid ${n.wrapperPid}). end it first with \`sootsim agent end <sessionId>\`.`);let o=r==="claude"?Z():void 0,s=M({projectId:t.id,provider:r,transport:"pty",cwd:t.cwd,status:"idle",claudeSessionUuid:o}),a=W(s.id),d=J(s.id),c=te(s.id);L(a),L(d);let g=u.dirname(c);i.mkdirSync(g,{recursive:!0});try{i.chmodSync(g,448)}catch{}let{cmd:A,prefixArgs:H}=re(),x=[...H,"agent-wrapper","--session-id",s.id,"--project-id",t.id,"--provider",r,"--cwd",t.cwd,"--prompt-in",a,"--events-out",d,"--transcript",c];e.codexBin&&x.push("--codex-bin",e.codexBin),e.claudeBin&&x.push("--claude-bin",e.claudeBin),e.freshThread&&x.push("--fresh-thread"),o&&x.push("--claude-session-uuid",o);let P=V(A,x,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:y()}});P.unref();let E=e.readyTimeoutMs??6e3,b=await ae(d,p=>p.type==="ready"||p.type==="error",E);if(!b||b.type==="error"){if(P.pid)try{process.kill(P.pid,"SIGTERM")}catch{}try{i.rmSync(j(s.id),{recursive:!0,force:!0})}catch{}v(s.id,{status:"ended"});let p=b&&b.type==="error"?b.message:`no ready event within ${E}ms`;throw new l("WRAPPER_FAILED",p)}return v(s.id,{wrapperPid:P.pid,status:"idle"}),{session:k(s.id),wrapperPid:P.pid}})}async function De(e,t){let r=k(e);if(!r)throw new l("NO_SESSION",`no session with id=${e}`);if(!O(r.wrapperPid,e))throw v(e,{status:"ended"}),new l("NOT_ALIVE",`session wrapper is not alive (pid=${r.wrapperPid}). start a new session.`);let n=W(e);if(!i.existsSync(n))throw new l("NO_FIFO",`prompt FIFO missing: ${n}`);let o=i.openSync(n,f.O_WRONLY);try{let s=R(t);if(!s)throw new l("EMPTY_PROMPT","prompt text is empty");i.writeSync(o,s+`
3
3
  `)}finally{i.closeSync(o)}v(e,{lastPrompt:t.displayText??t.text,status:"working"})}async function Re(e){let t=k(e);if(!t)throw new l("NO_SESSION",`no session with id=${e}`);if(O(t.wrapperPid,e))try{process.kill(t.wrapperPid,"SIGTERM")}catch{}let r=j(e),n=y();if(r.startsWith(n))try{i.rmSync(r,{recursive:!0,force:!0})}catch{}v(e,{status:"ended",wrapperPid:void 0})}function Ne(e,t){let r=J(e);if(!i.existsSync(r))throw new l("NO_FIFO",`events FIFO missing: ${r}`);let n=i.openSync(r,f.O_RDWR),o=i.createReadStream("",{fd:n,autoClose:!0}),s=ee.createInterface({input:o,crlfDelay:1/0});s.on("line",d=>{let c=I(d);c&&t(c)});let a=!1;return()=>{if(!a){a=!0;try{s.close()}catch{}try{o.destroy()}catch{}}}}async function ae(e,t,r){let n=i.openSync(e,f.O_RDWR|f.O_NONBLOCK),o=Buffer.alloc(8192),s="",a=Date.now()+r;try{for(;Date.now()<a;){let d=0;try{d=i.readSync(n,o,0,o.length,null)}catch(c){if(c.code!=="EAGAIN")throw c;d=0}if(d>0){s+=o.subarray(0,d).toString("utf8");let c;for(;(c=s.indexOf(`
4
4
  `))>=0;){let g=s.slice(0,c);s=s.slice(c+1);let A=I(g);if(A&&t(A))return A}}else await new Promise(c=>setTimeout(c,30))}return null}finally{i.closeSync(n)}}export{I as a,y as b,ge as c,F as d,he as e,ye as f,Se as g,we as h,k as i,C as j,v as k,ve as l,j as m,W as n,J as o,te as p,O as q,re as r,l as s,Te as t,De as u,Re as v,Ne as w};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  var d=Object.defineProperty;var e=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var f=(a,b)=>{for(var c in b)d(a,c,{get:b[c],enumerable:!0})};export{e as a,f as b};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as r}from"./chunk-K5GLQDTG.js";var c=["ghs_","ghp_","gho_","ghu_","github_pat_"];function d(n){return!!(n&&n.length>=20&&c.some(t=>n.startsWith(t)))}function p(){let n=process.env.SOOT_INSTALLATION_TOKEN?.trim(),t=process.env.GITHUB_TOKEN?.trim(),e=n||t;if(!d(e))return null;let o=(process.env.SOOT_REPO||process.env.GITHUB_REPOSITORY||"").trim();if(!o)return null;let[i,s]=o.includes("/")?o.split("/",2):[null,null],u=(process.env.SOOT_REPO_ID||process.env.GITHUB_REPOSITORY_ID||"").trim(),l=(process.env.SOOT_INSTALLATION_ID||process.env.GITHUB_APP_INSTALLATION_ID||"").trim();return{kind:"github",token:e,repoId:o,repositoryId:u||null,owner:i||null,repo:s||null,installationId:l||null,source:n?"soot-runner":"github-actions"}}function g(){let n=process.env.SOOTSIM_API_KEY?.trim();if(n&&n.startsWith("sk_sootsim_"))return{kind:"api-key",secret:n,source:"env"};let t=p();if(t)return t;let e=r();return e?.token?{kind:"session",token:e.token,origin:e.origin}:null}function a(n){return n.kind==="api-key"?`Bearer ${n.secret}`:`Bearer ${n.token}`}function _(n){return!n||n.kind!=="github"?null:{repoId:n.repoId,owner:n.owner??void 0,repo:n.repo??void 0,installationId:n.installationId}}export{g as a,a as b,_ as c};
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as r}from"./chunk-UKKQXZFZ.js";var c=["ghs_","ghp_","gho_","ghu_","github_pat_"];function d(n){return!!(n&&n.length>=20&&c.some(t=>n.startsWith(t)))}function p(){let n=process.env.SOOT_INSTALLATION_TOKEN?.trim(),t=process.env.GITHUB_TOKEN?.trim(),e=n||t;if(!d(e))return null;let o=(process.env.SOOT_REPO||process.env.GITHUB_REPOSITORY||"").trim();if(!o)return null;let[i,s]=o.includes("/")?o.split("/",2):[null,null],u=(process.env.SOOT_REPO_ID||process.env.GITHUB_REPOSITORY_ID||"").trim(),l=(process.env.SOOT_INSTALLATION_ID||process.env.GITHUB_APP_INSTALLATION_ID||"").trim();return{kind:"github",token:e,repoId:o,repositoryId:u||null,owner:i||null,repo:s||null,installationId:l||null,source:n?"soot-runner":"github-actions"}}function g(){let n=process.env.SOOTSIM_API_KEY?.trim();if(n&&n.startsWith("sk_sootsim_"))return{kind:"api-key",secret:n,source:"env"};let t=p();if(t)return t;let e=r();return e?.token?{kind:"session",token:e.token,origin:e.origin}:null}function a(n){return n.kind==="api-key"?`Bearer ${n.secret}`:`Bearer ${n.token}`}function _(n){return!n||n.kind!=="github"?null:{repoId:n.repoId,owner:n.owner??void 0,repo:n.repo??void 0,installationId:n.installationId}}export{g as a,a as b,_ as c};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as p,b as $,c as w,e as y,f as R}from"./chunk-3JVMBXLH.js";import{d}from"./chunk-Y6CZ5N26.js";import{C as m,D as a,E as h,F as f,l as v}from"./chunk-MH6BMKK5.js";import b from"fs";import{WebSocket as A}from"ws";async function P(n,e={}){let[o,...t]=n;if(!o||o==="--help"||o==="-h"){O();return}switch(o){case"install":return D(t,e);case"list":case"ls":return N(t);case"use":return T(t);case"remove":case"rm":return L(t);case"which":case"active":return _();case"notes":case"changelog":return C(t);default:console.error(` unknown runtime subcommand: ${o}`),O(),process.exit(1)}}function O(){console.log(`
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as p,b as $,c as w,e as y,f as R}from"./chunk-64GTYKIF.js";import{d}from"./chunk-NX2QM2BE.js";import{C as m,D as a,E as h,F as f,l as v}from"./chunk-TE4UPZY2.js";import b from"fs";import{WebSocket as A}from"ws";async function P(n,e={}){let[o,...t]=n;if(!o||o==="--help"||o==="-h"){O();return}switch(o){case"install":return D(t,e);case"list":case"ls":return N(t);case"use":return T(t);case"remove":case"rm":return L(t);case"which":case"active":return _();case"notes":case"changelog":return C(t);default:console.error(` unknown runtime subcommand: ${o}`),O(),process.exit(1)}}function O(){console.log(`
3
3
  sootsim runtime \u2014 manage engine runtimes under ~/.sootsim/runtimes/
4
4
 
5
5
  usage:
@@ -24,4 +24,4 @@ examples:
24
24
  sootsim runtime install --channel beta
25
25
  sootsim runtime use 1.2.3
26
26
  sootsim runtime notes
27
- `)}async function D(n,e){let{version:o,flags:t}=E(n),s=t.channel??e.channel??"stable",l=t.force===!0,c=t.setActive!==!1;m(),console.log("sootsim runtime install"),console.log(` cdn: ${w()}`);try{let i=await R({version:o,channel:s,force:l,setActive:c});console.log(` version: ${i.version} (channel: ${i.channel})`),i.installed?console.log(` installed ${i.version}`):console.log(` already installed at ${i.runtimeDir}`),c&&await I(i.version)}catch(i){console.error(` ${k(i)}`),process.exit(1)}}async function I(n){h(n),console.log(` active: ${n}`),await S(n)||console.log(` (no daemon running \u2014 next sootsim/electron launch will pick up ${n})`)}async function S(n){let{isDaemonLockfileFresh:e,readDaemonLockfile:o}=await import("./home-paths-IT2LCG6O.js"),t=o();if(!e(t))return!1;let s=d();return new Promise(l=>{let c=!1,i=!1,u=x=>{c||(c=!0,l(x))},r=new A(`ws://127.0.0.1:${s}`,{handshakeTimeout:800}),g=setTimeout(()=>{try{r.close()}catch{}u(i)},1500);r.on("open",()=>{try{r.send(JSON.stringify({type:"runtime:use",version:n,id:0})),i=!0}catch{}setTimeout(()=>{try{r.close()}catch{}},100)}),r.on("close",()=>{clearTimeout(g),u(i)}),r.on("error",()=>{clearTimeout(g),u(!1)})})}async function N(n){m();let e=f(),o=a();if(console.log("installed:"),e.length===0)console.log(" (none)");else for(let t of e)console.log(` ${t===o?"*":" "} ${t}`);try{let t=await y();console.log("available (latest per channel):");for(let[s,l]of Object.entries(t.channels))console.log(` ${s.padEnd(8)} ${l.latest}`)}catch(t){console.log(`available: (could not fetch manifest: ${k(t)})`)}}async function T(n){let e=n[0];e||(console.error(" usage: sootsim runtime use <version>"),process.exit(1));let o=f();o.includes(e)||(console.error(` version ${e} is not installed`),console.error(` installed: ${o.join(", ")||"(none)"}`),console.error(` run \`sootsim runtime install ${e}\` first`),process.exit(1)),await I(e)}async function L(n){let e=n[0];e||(console.error(" usage: sootsim runtime remove <version>"),process.exit(1)),a()===e&&(console.error(` cannot remove active runtime ${e}`),console.error(" switch with `sootsim runtime use <other>` first, or install another version"),process.exit(1));let t=v(e);if(!b.existsSync(t)){console.error(` ${e} is not installed`);return}b.rmSync(t,{recursive:!0,force:!0}),console.log(` removed ${e}`)}async function _(){let n=a();if(!n){console.log(" no active runtime");return}console.log(n)}async function C(n){n.length>0&&(console.error(" usage: sootsim runtime notes"),process.exit(1));let e=a();e&&console.log(` active runtime: v${e}`),console.log(` release notes: ${$}`)}function E(n){let e={},o=[];for(let t=0;t<n.length;t++){let s=n[t];if(s==="--channel"&&t+1<n.length){e.channel=n[t+1],t++;continue}if(s.startsWith("--channel=")){e.channel=s.slice(10);continue}if(s==="--force"){e.force=!0;continue}if(s==="--set-active=false"||s==="--no-set-active"){e.setActive=!1;continue}o.push(s)}return{version:o[0]??null,flags:e}}function k(n){return n instanceof Error?n.message:String(n)}export{P as a};
27
+ `)}async function D(n,e){let{version:o,flags:t}=E(n),s=t.channel??e.channel??"stable",l=t.force===!0,c=t.setActive!==!1;m(),console.log("sootsim runtime install"),console.log(` cdn: ${w()}`);try{let i=await R({version:o,channel:s,force:l,setActive:c});console.log(` version: ${i.version} (channel: ${i.channel})`),i.installed?console.log(` installed ${i.version}`):console.log(` already installed at ${i.runtimeDir}`),c&&await I(i.version)}catch(i){console.error(` ${k(i)}`),process.exit(1)}}async function I(n){h(n),console.log(` active: ${n}`),await S(n)||console.log(` (no daemon running \u2014 next sootsim/electron launch will pick up ${n})`)}async function S(n){let{isDaemonLockfileFresh:e,readDaemonLockfile:o}=await import("./home-paths-QGNZG3YG.js"),t=o();if(!e(t))return!1;let s=d();return new Promise(l=>{let c=!1,i=!1,u=x=>{c||(c=!0,l(x))},r=new A(`ws://127.0.0.1:${s}`,{handshakeTimeout:800}),g=setTimeout(()=>{try{r.close()}catch{}u(i)},1500);r.on("open",()=>{try{r.send(JSON.stringify({type:"runtime:use",version:n,id:0})),i=!0}catch{}setTimeout(()=>{try{r.close()}catch{}},100)}),r.on("close",()=>{clearTimeout(g),u(i)}),r.on("error",()=>{clearTimeout(g),u(!1)})})}async function N(n){m();let e=f(),o=a();if(console.log("installed:"),e.length===0)console.log(" (none)");else for(let t of e)console.log(` ${t===o?"*":" "} ${t}`);try{let t=await y();console.log("available (latest per channel):");for(let[s,l]of Object.entries(t.channels))console.log(` ${s.padEnd(8)} ${l.latest}`)}catch(t){console.log(`available: (could not fetch manifest: ${k(t)})`)}}async function T(n){let e=n[0];e||(console.error(" usage: sootsim runtime use <version>"),process.exit(1));let o=f();o.includes(e)||(console.error(` version ${e} is not installed`),console.error(` installed: ${o.join(", ")||"(none)"}`),console.error(` run \`sootsim runtime install ${e}\` first`),process.exit(1)),await I(e)}async function L(n){let e=n[0];e||(console.error(" usage: sootsim runtime remove <version>"),process.exit(1)),a()===e&&(console.error(` cannot remove active runtime ${e}`),console.error(" switch with `sootsim runtime use <other>` first, or install another version"),process.exit(1));let t=v(e);if(!b.existsSync(t)){console.error(` ${e} is not installed`);return}b.rmSync(t,{recursive:!0,force:!0}),console.log(` removed ${e}`)}async function _(){let n=a();if(!n){console.log(" no active runtime");return}console.log(n)}async function C(n){n.length>0&&(console.error(" usage: sootsim runtime notes"),process.exit(1));let e=a();e&&console.log(` active runtime: v${e}`),console.log(` release notes: ${$}`)}function E(n){let e={},o=[];for(let t=0;t<n.length;t++){let s=n[t];if(s==="--channel"&&t+1<n.length){e.channel=n[t+1],t++;continue}if(s.startsWith("--channel=")){e.channel=s.slice(10);continue}if(s==="--force"){e.force=!0;continue}if(s==="--set-active=false"||s==="--no-set-active"){e.setActive=!1;continue}o.push(s)}return{version:o[0]??null,flags:e}}function k(n){return n instanceof Error?n.message:String(n)}export{P as a};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as E,b as D}from"./chunk-MJU4XNZ3.js";import{D as T}from"./chunk-MH6BMKK5.js";var N="sootsimConfig";function p(e){return!!e&&Object.keys(e).length>0}function $(e){return e?p(e.modules)||p(e.turboModules)||p(e.nativeModules)||p(e.env)||p(e.network?.remap)||p(e.settings)||p(e.initialState):!1}function j(e,t){let n=new URL(e);return $(t)?n.searchParams.set(N,JSON.stringify(t)):n.searchParams.delete(N),n.toString()}var me="/index.bundle?platform=ios&dev=true&hot=true&minify=false";function A(e){return/^https?:\/\//i.test(e)}function O(e){return e.endsWith(".bundle")}function H(e){process.env.SOOTSIM_PREVIEW_PROD_BUNDLE&&(e.searchParams.set("dev","false"),e.searchParams.set("minify","true"),e.searchParams.has("hot")&&e.searchParams.set("hot","false"))}function I(e){try{let t=A(e),n=new URL(e,"http://soot.local");return n.pathname=n.pathname.replace(/\.\.bundle$/,".bundle"),O(n.pathname)?(n.searchParams.delete("transform.bytecode"),n.searchParams.get("lazy")==="true"&&n.searchParams.set("lazy","false"),H(n),t?n.toString():`${n.pathname}${n.search}${n.hash}`):e}catch{return e}}function pe(e,t){try{let n=A(e),o=new URL(e,"http://soot.local");return O(o.pathname)?(o.searchParams.set("hot",t?"true":"false"),n?o.toString():`${o.pathname}${o.search}${o.hash}`):e}catch{return e}}import{exec as W}from"child_process";import B from"http";import F from"net";import{promisify as G}from"util";var _=G(W);E();var z=250,J=1500,K=120;function V(e,t=K){return new Promise(n=>{let o=new F.Socket,s=!1,i=a=>{s||(s=!0,o.destroy(),n(a))};o.setTimeout(t),o.once("connect",()=>i(!0)),o.once("timeout",()=>i(!1)),o.once("error",()=>i(!1)),o.connect(e,"localhost")})}function h(e,t,n="GET",o=z,s={}){return new Promise(i=>{let a=B.request({hostname:"localhost",port:e,path:t,method:n,timeout:o,headers:s},r=>{let c="";r.on("data",l=>c+=l.toString());let u=(()=>{let l=r.headers["content-type"];if(typeof l=="string")return l;if(Array.isArray(l))return l[0]})();r.on("end",()=>i({statusCode:r.statusCode||0,body:c,contentType:u}))});a.on("error",()=>i(null)),a.setTimeout(o,()=>{a.destroy(),i(null)}),a.end()})}var q=[8081,8082,8083,8084,8085,8086,3e3,3001,19e3].map(e=>({port:e,pid:0}));function C(e,t){return!(e<=0||e>=2e4||t.has(e)||e>=5170&&e<=5200)}async function Y(e=[]){let t=new Set(e);try{let{stdout:n}=await _("lsof -iTCP -sTCP:LISTEN -P -n 2>/dev/null | grep -E '^(node|bun)'",{encoding:"utf8",timeout:2e3});if(n.trim()){let o=new Map;for(let s of n.trim().split(`
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as E,b as D}from"./chunk-5N2BFB4I.js";import{D as T}from"./chunk-TE4UPZY2.js";var N="sootsimConfig";function p(e){return!!e&&Object.keys(e).length>0}function $(e){return e?p(e.modules)||p(e.turboModules)||p(e.nativeModules)||p(e.env)||p(e.network?.remap)||p(e.settings)||p(e.initialState):!1}function j(e,t){let n=new URL(e);return $(t)?n.searchParams.set(N,JSON.stringify(t)):n.searchParams.delete(N),n.toString()}var me="/index.bundle?platform=ios&dev=true&hot=true&minify=false";function A(e){return/^https?:\/\//i.test(e)}function O(e){return e.endsWith(".bundle")}function H(e){process.env.SOOTSIM_PREVIEW_PROD_BUNDLE&&(e.searchParams.set("dev","false"),e.searchParams.set("minify","true"),e.searchParams.has("hot")&&e.searchParams.set("hot","false"))}function I(e){try{let t=A(e),n=new URL(e,"http://soot.local");return n.pathname=n.pathname.replace(/\.\.bundle$/,".bundle"),O(n.pathname)?(n.searchParams.delete("transform.bytecode"),n.searchParams.get("lazy")==="true"&&n.searchParams.set("lazy","false"),H(n),t?n.toString():`${n.pathname}${n.search}${n.hash}`):e}catch{return e}}function pe(e,t){try{let n=A(e),o=new URL(e,"http://soot.local");return O(o.pathname)?(o.searchParams.set("hot",t?"true":"false"),n?o.toString():`${o.pathname}${o.search}${o.hash}`):e}catch{return e}}import{exec as W}from"child_process";import B from"http";import F from"net";import{promisify as G}from"util";var _=G(W);E();var z=250,J=1500,K=120;function V(e,t=K){return new Promise(n=>{let o=new F.Socket,s=!1,i=a=>{s||(s=!0,o.destroy(),n(a))};o.setTimeout(t),o.once("connect",()=>i(!0)),o.once("timeout",()=>i(!1)),o.once("error",()=>i(!1)),o.connect(e,"localhost")})}function h(e,t,n="GET",o=z,s={}){return new Promise(i=>{let a=B.request({hostname:"localhost",port:e,path:t,method:n,timeout:o,headers:s},r=>{let c="";r.on("data",l=>c+=l.toString());let u=(()=>{let l=r.headers["content-type"];if(typeof l=="string")return l;if(Array.isArray(l))return l[0]})();r.on("end",()=>i({statusCode:r.statusCode||0,body:c,contentType:u}))});a.on("error",()=>i(null)),a.setTimeout(o,()=>{a.destroy(),i(null)}),a.end()})}var q=[8081,8082,8083,8084,8085,8086,3e3,3001,19e3].map(e=>({port:e,pid:0}));function C(e,t){return!(e<=0||e>=2e4||t.has(e)||e>=5170&&e<=5200)}async function Y(e=[]){let t=new Set(e);try{let{stdout:n}=await _("lsof -iTCP -sTCP:LISTEN -P -n 2>/dev/null | grep -E '^(node|bun)'",{encoding:"utf8",timeout:2e3});if(n.trim()){let o=new Map;for(let s of n.trim().split(`
3
3
  `)){let i=s.trim().split(/\s+/);if(i.length<9)continue;let a=Number(i[1]),c=i[8].match(/:(\d+)$/);if(!c)continue;let u=Number(c[1]);C(u,t)&&(o.has(u)||o.set(u,a))}if(o.size>0)return[...o.entries()].map(([s,i])=>({port:s,pid:i}))}}catch{}try{let{stdout:n}=await _(`ss -tlnp 2>/dev/null | grep -E '"(node|bun)"'`,{encoding:"utf8",timeout:2e3});if(n.trim()){let o=new Map;for(let s of n.trim().split(`
4
4
  `)){let i=s.match(/:(\d+)\s/),a=s.match(/pid=(\d+)/);if(!i)continue;let r=Number(i[1]),c=a?Number(a[1]):0;C(r,t)&&(o.has(r)||o.set(r,c))}if(o.size>0)return[...o.entries()].map(([s,i])=>({port:s,pid:i}))}}catch{}return q.filter(n=>C(n.port,t))}var x=new Map;async function Q(e){if(e<=0)return null;let t=x.get(e);if(t)return t;try{let{stdout:n}=await _(`lsof -p ${e} -a -d cwd -Fn 2>/dev/null`,{encoding:"utf8",timeout:1500});for(let o of n.split(`
5
5
  `))if(o.startsWith("n")&&o.length>1){let s=o.slice(1).trim();if(s)return x.set(e,s),s}}catch{}return null}function X(e,t){return{port:e,framework:t,bundleUrl:S(e,`http://localhost:${e}/index.bundle?platform=ios&dev=true&hot=true&minify=false`),hmrUrl:`ws://localhost:${e}/hot`,lastSeen:Date.now()}}function S(e,t){let n=D().find(s=>s.preferredPort===e),o=n?.runtimeConfig?j(t,n.runtimeConfig):t;return I(o)}function Z(e){return e.includes("/node_modules/one/metro-entry.bundle")}function ee(e){try{let t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}}function w(e,t,n){if(!t)return e;try{let o=JSON.parse(t.body),s=o?.extra?.expoClient||o?.extra||{};s.name&&(e.projectName=s.name),s.ios?.bundleIdentifier&&(e.bundleId=s.ios.bundleIdentifier),e.framework==="metro"&&s.sdkVersion&&(e.framework="expo");let i=o?.launchAsset?.url;i&&!e.patched&&!Z(e.bundleUrl)&&(e.bundleUrl=S(e.port,i));let a=s.iconUrl||s.ios?.iconUrl||s.icon||s.ios?.icon;if(a)if(e.iconPath=a,n)if(a.startsWith("http"))e.iconUrl=n(a);else{let r=a.replace(/^\.\//,"");e.iconUrl=n(`http://localhost:${e.port}/assets/${r}`)}else e.iconUrl=a.startsWith("http")?a:`http://localhost:${e.port}/assets/${a.replace(/^\.\//,"")}`}catch{}return e}var ne=2e4,v=new Map,k=new Set;function M(e,t){if(e.projectName)return e;let n=v.get(e.port);if(n)return n.projectName&&(e.projectName=n.projectName),n.iconUrl&&!e.iconUrl&&(e.iconUrl=n.iconUrl,e.iconPath=n.iconPath),n.bundleId&&!e.bundleId&&(e.bundleId=n.bundleId),e;if(!k.has(e.port)){k.add(e.port);let o=e.port;te(o,t).finally(()=>k.delete(o))}return e}async function te(e,t){let n=await h(e,"/","GET",ne,{"expo-platform":"ios"});if(!n||n.statusCode!==200)return;let o=w({port:e,framework:"one",bundleUrl:"",lastSeen:0},n,t);!o.projectName&&!o.iconUrl||(v.set(e,{projectName:o.projectName,iconUrl:o.iconUrl,iconPath:o.iconPath,bundleId:o.bundleId}),b.delete(e))}var d=new Set,g=new Set,y=new Set;async function oe(e,t){if(!await V(e))return null;let n="/node_modules/one/metro-entry.bundle?platform=ios&dev=true",[o,s,i,a]=await Promise.all([d.has(e)?Promise.resolve(null):h(e,"/__soot/"),h(e,"/status"),y.has(e)?Promise.resolve(null):h(e,"/","GET",J,{"expo-platform":"ios"}),g.has(e)?Promise.resolve(null):h(e,"/_expo/status")]);a&&a.statusCode===200?g.delete(e):g.has(e)||g.add(e);let r=i?ee(i.body):null,c=typeof r?.launchAsset?.url=="string"?r.launchAsset.url:null,u=r?.extra?.expoClient||r?.extra||{};if(r&&(c||typeof u.name=="string")){d.add(e);let U=c||`http://localhost:${e}/index.bundle?platform=ios&dev=true&hot=true&minify=false`,L=U.includes("/one/metro-entry.bundle")?"one":"expo";return w({port:e,framework:L,bundleUrl:S(e,U),hmrUrl:`ws://localhost:${e}/hot`,lastSeen:Date.now()},i,t)}if(s&&s.body.includes("packager-status:running"))return d.add(e),M(w(X(e,a&&a.statusCode===200?"expo":"metro"),i,t),t);if(o&&o.statusCode===200&&o.body.includes("sootsim-patched"))return d.delete(e),M(w({port:e,framework:"one",bundleUrl:S(e,`http://localhost:${e}/__soot/bundle.js`),hmrUrl:`ws://localhost:${e}/hot`,lastSeen:Date.now(),patched:!0},i,t),t);if(s&&s.statusCode===200||a&&a.statusCode===200||i&&i.statusCode===200&&r!=null)return null;let m=await h(e,n,"HEAD");return m&&m.statusCode>0&&m.statusCode<400&&/application\/javascript/i.test(m.contentType||"")?(d.add(e),y.add(e),M(w({port:e,framework:"one",bundleUrl:S(e,`http://localhost:${e}${n}&minify=false`),hmrUrl:`ws://localhost:${e}/hot`,lastSeen:Date.now()},i,t),t)):(d.add(e),null)}function re(e){return!!e.bundleId?.trim().toLowerCase()?.startsWith("dev.sootsim.")}var b=new Map,se=3e4,ie=1500;function ae(e){return!e||e.framework==="metro"||e.framework==="unknown"}function ce(e){return e?S(e.port,e.bundleUrl)===e.bundleUrl:!0}function ue(e,t,n=Date.now()){if(t===0||e.pid!==t||!ce(e.result))return!1;let o=n-e.cachedAt;return!(e.result===null&&o>=se||ae(e.result)&&o>=ie)}async function xe(e={}){let t=await Y(e.excludePorts),n=new Set(t.map(r=>r.port));for(let r of[...b.keys()])n.has(r)||b.delete(r);for(let r of[...d])n.has(r)||d.delete(r);for(let r of[...g])n.has(r)||g.delete(r);for(let r of[...y])n.has(r)||y.delete(r);for(let r of[...v.keys()])n.has(r)||v.delete(r);let o=[],s=[];for(let{port:r,pid:c}of t){let u=b.get(r);if(u&&ue(u,c)){u.result&&o.push(u.result);continue}u&&u.pid!==c&&(d.delete(r),g.delete(r),y.delete(r),v.delete(r)),s.push({port:r,pid:c})}s.length>0&&(await Promise.all(s.map(c=>oe(c.port,e.buildIconProxyUrl)))).forEach((c,u)=>{let{port:l,pid:m}=s[u];m!==0&&b.set(l,{pid:m,result:c,cachedAt:Date.now()}),c&&o.push(c)});let i=new Map;for(let{port:r,pid:c}of t)c>0&&i.set(r,c);await Promise.all(o.map(async r=>{let c=i.get(r.port);if(!c)return;r.pid=c;let u=await Q(c);u&&(r.cwd=u)}));let a=new Set(i.values());for(let r of[...x.keys()])a.has(r)||x.delete(r);return o.filter(r=>!re(r))}import R from"fs";import f from"path";import{fileURLToPath as le}from"url";var P;function de(){if(P!==void 0)return P;let e=f.dirname(le(import.meta.url));for(let t=0;t<12&&e!==f.dirname(e);t++){if(R.existsSync(f.join(e,"packages/sootsim-engine/package.json"))&&R.existsSync(f.join(e,"public/sootsim")))return P=e,e;e=f.dirname(e)}return P=null,null}function Te(){if(process.env.SOOTSIM_HOME&&T())return null;let e=de();if(!e)return null;let t=f.join(e,"public/sootsim");return R.existsSync(f.join(t,"index.html"))&&R.existsSync(f.join(t,"engine/index.html"))&&R.existsSync(f.join(t,"engine-tenant/worker.js"))?t:null}export{j as a,me as b,I as c,pe as d,oe as e,xe as f,Te as g};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{H as I,m as B,n as E,o as y,t as v,v as A}from"./chunk-QNVY6BLP.js";import{h,l as N,m as P}from"./chunk-Y6CZ5N26.js";var q={timeoutMs:1800,settleMs:48,startWindowMs:64};function w(e){return new Promise(t=>setTimeout(t,e))}function U(e){return e.includes("--json")}function Y(e){process.stdout.write(`${JSON.stringify(e??null,null,2)}
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{H as I,m as B,n as E,o as y,t as v,v as A}from"./chunk-SQ2MTGDQ.js";import{h,l as N,m as P}from"./chunk-NX2QM2BE.js";var q={timeoutMs:1800,settleMs:48,startWindowMs:64};function w(e){return new Promise(t=>setTimeout(t,e))}function U(e){return e.includes("--json")}function Y(e){process.stdout.write(`${JSON.stringify(e??null,null,2)}
3
3
  `)}function V(e){process.stderr.write(`${e}
4
4
  `)}function b(e,t=Date.now()){let r=new Date(e),n=`${S(r.getHours())}:${S(r.getMinutes())}:${S(r.getSeconds())}`,s=t-e;if(s<0)return n;let o=Math.round(s/1e3);return o<60?`${n} +${o}s`:o<3600?`${n} +${Math.round(o/60)}m`:o<86400?`${n} +${Math.round(o/3600)}h`:`${n} +${Math.round(o/86400)}d`}function S(e){return e<10?`0${e}`:String(e)}async function D(e,t,...r){return N(e,`__sootsimTest.${t}`,...r)}async function k(e,t,...r){return P(e,`SootSim.bridges.mainShell.${t}`,...r)}async function z(e,t={}){try{let r=await D(e,"waitForScreenTransitions",q);if(!t.verbose||!r?.started)return;if(r.timedOut){console.log(` screen transition still active after ${r.waitedMs}ms; continuing`);return}r.waitedMs>0&&console.log(` waited ${r.waitedMs}ms for screen transition settle`)}catch{}}async function K(e,t,r,...n){let s=Date.now()+Math.max(0,r);for(;;)try{return await k(e,t,...n)}catch(o){if(!I(o)||Date.now()>=s)throw o;await w(50)}}async function Q(e,t,r,n={}){let s=n.attempts??30,o=n.intervalMs??500,l=n.minNodeCount??10;for(let a=0;a<s;a++){let u=h(e,{commandTimeoutMs:t,simId:r,simIdSource:n.simIdSource});try{let c=await u.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof c=="number"&&c>l)return{bridge:u,count:c}}catch{}u.close(),await w(o)}return null}async function X(e,t,r,n={}){let s=n.timeoutMs??8e3,o=n.intervalMs??250,l=Date.now()+s;for(;Date.now()<l;){let a=h(e,{commandTimeoutMs:t,simId:r,simIdSource:n.simIdSource});try{return await a.send({type:"evaluate",code:"1"}),a}catch{a.close()}await w(o)}return null}async function Z(e,t={}){let r=t.timeoutMs??1e4,n=t.errorGraceMs??3e3,s=t.pollIntervalMs??200,o=Date.now(),l=o+r,a=-1,u=o,c=null,d=!1,m={ready:!1,source:"timeout",elapsedMs:0,nodes:0,targets:0,flag:void 0,loadingText:"",externalReady:null,externalStatus:"",externalError:"",errors:0};for(;Date.now()<l;){try{let i=await e.send({type:"evaluate",code:B}),g=Date.now()-o,f=Number(i?.nodes)||0,$=Number(i?.targets)||0,x=Number(i?.errors)||0,C=i?.flag===!0,p=i?.externalReady,T=typeof i?.loadingText=="string"?i.loadingText.trim():"",W=typeof i?.externalStatus=="string"?i.externalStatus.trim():"",M=typeof i?.externalError=="string"?i.externalError.trim():"",R=typeof i?.externalError=="string"&&M.length>0;if(c=p,d=R,f!==a&&(a=f,u=g),m={ready:!1,source:"timeout",elapsedMs:g,nodes:f,targets:$,flag:i?.flag,loadingText:T,externalReady:typeof p=="boolean"?p:null,externalStatus:W,externalError:M,errors:x},C&&p!==!1&&!R&&!T&&y({nodes:f,targets:$})&&g-u>=E)return{...m,ready:!0,source:"flag"};if(g>=n&&x>0&&!C)return{...m,ready:!1,source:"error-bail"}}catch{}await w(s)}return c!==!1&&!d&&!m.loadingText&&y(m)?{...m,ready:!0,source:"nodes-fallback"}:{...m,ready:!1,source:"timeout",elapsedMs:Date.now()-o}}function O(e){let t=e.displayUrl||e.url;return e.status!=null?`${e.method} ${t} -> ${e.status}${e.statusText?` ${e.statusText}`:""}`:e.error?`${e.method} ${t} -> ${e.error}`:`${e.method} ${t}`}async function _(e,t,...r){return e.send({type:"call",path:`__sootsimTest.${t}`,args:r})}async function F(e,t={}){let r=await e.send({type:"evaluate",code:A});if(!r||typeof r!="object")return;let n=Math.max(0,Number(r.errors)||0),s=Math.max(0,Number(r.warnings)||0);if(n===0&&s===0)return;let o=[];if(n>0&&o.push(`${n} console error${n===1?"":"s"}`),s>0&&o.push(`${s} console warning${s===1?"":"s"}`),console.log(`
5
5
  console: ${o.join(", ")}`),t.errorsCommand&&console.log(` inspect: ${t.errorsCommand}`),s>0&&t.warningsCommand&&console.log(` inspect: ${t.warningsCommand}`),!t.includeTail||n===0)return;let l=await v(e,5);if(!(!Array.isArray(l)||l.length===0)){console.log(`
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import{readFileSync as i}from"node:fs";import{fileURLToPath as e}from"node:url";var r=null;function l(){if(r!=null)return r;let o=[()=>e(import.meta.resolve("sootsim/package.json")),()=>e(new URL("../package.json",import.meta.url))];for(let n of o)try{let t=JSON.parse(i(n(),"utf8")).version;if(typeof t=="string"&&t)return r=t,r}catch{}return r="0.0.0",r}export{l as a};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{c as f}from"./chunk-CVUAT6TO.js";import{a as C,d as W,f as x}from"./chunk-SJHC6HZH.js";import{I as y,J as w,K as I,L as S}from"./chunk-MH6BMKK5.js";import{WebSocket as v}from"ws";function L(){let i=w();if(i&&S(i))return{source:"dev-bridge",bridgePort:i.bridgePort,shellBaseUrl:i.shellPort?`http://localhost:${i.shellPort}/`:f};let r=y();return r&&I(r)?{source:"daemon",bridgePort:r.bridgePort,shellBaseUrl:r.runtimePort>0?`http://localhost:${r.runtimePort}/`:f}:{source:"default",bridgePort:7668,shellBaseUrl:f}}function E(i){let r=w();if(r&&S(r)&&r.bridgePort===i)return{source:"dev-bridge",shellBaseUrl:r.shellPort?`http://localhost:${r.shellPort}/`:f};let e=y();return e&&I(e)&&e.bridgePort===i?{source:"daemon",shellBaseUrl:e.runtimePort>0?`http://localhost:${e.runtimePort}/`:f}:null}function q(i){let r;try{let l=new URL(i);r=l.port?Number(l.port):l.protocol==="https:"?443:80}catch{return null}if(!Number.isFinite(r)||r<=0)return null;let e=w();if(e&&S(e)&&(e.shellPort===r||e.runtimePort===r||e.bridgePort===r))return e.bridgePort;let d=y();return d&&I(d)&&(d.runtimePort===r||d.bridgePort===r)?d.bridgePort:null}function O(){return L().bridgePort}function H(i,r){let e=E(i),d=e?.source==="dev-bridge"?"dev bridge":e?.source==="daemon"?"daemon bridge":"bridge",l=e?`${e.source}.json`:"no lockfile",t=r??e?.shellBaseUrl;process.stderr.write(` \u2192 ${d} :${i} (${t?`shell ${t}, `:""}${l})
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{c as f}from"./chunk-2QAG5IPN.js";import{a as C,d as W,f as x}from"./chunk-S6L32ZQF.js";import{I as y,J as w,K as I,L as S}from"./chunk-TE4UPZY2.js";import{WebSocket as v}from"ws";function L(){let i=w();if(i&&S(i))return{source:"dev-bridge",bridgePort:i.bridgePort,shellBaseUrl:i.shellPort?`http://localhost:${i.shellPort}/`:f};let r=y();return r&&I(r)?{source:"daemon",bridgePort:r.bridgePort,shellBaseUrl:r.runtimePort>0?`http://localhost:${r.runtimePort}/`:f}:{source:"default",bridgePort:7668,shellBaseUrl:f}}function E(i){let r=w();if(r&&S(r)&&r.bridgePort===i)return{source:"dev-bridge",shellBaseUrl:r.shellPort?`http://localhost:${r.shellPort}/`:f};let e=y();return e&&I(e)&&e.bridgePort===i?{source:"daemon",shellBaseUrl:e.runtimePort>0?`http://localhost:${e.runtimePort}/`:f}:null}function q(i){let r;try{let l=new URL(i);r=l.port?Number(l.port):l.protocol==="https:"?443:80}catch{return null}if(!Number.isFinite(r)||r<=0)return null;let e=w();if(e&&S(e)&&(e.shellPort===r||e.runtimePort===r||e.bridgePort===r))return e.bridgePort;let d=y();return d&&I(d)&&(d.runtimePort===r||d.bridgePort===r)?d.bridgePort:null}function O(){return L().bridgePort}function H(i,r){let e=E(i),d=e?.source==="dev-bridge"?"dev bridge":e?.source==="daemon"?"daemon bridge":"bridge",l=e?`${e.source}.json`:"no lockfile",t=r??e?.shellBaseUrl;process.stderr.write(` \u2192 ${d} :${i} (${t?`shell ${t}, `:""}${l})
3
3
  `)}var k=class extends Error{lock;constructor(r,e){super(r),this.name="BridgeSimLockedError",this.lock=e}};function M(i){return i==="flag"?"via --sim":i==="saved"?"saved via `sootsim use`":"primary fallback \u2014 no sim pinned"}function J(i,r={}){let e=new Set,d=r.port??O(),l=r.commandTimeoutMs??15e3,t,m="none",B=new Set(r.stripBooleanFlags??[]),h=new Set(r.stripValueFlags??[]);for(let n=0;n<i.length;n++){let a=i[n];if(a==="--port"||a==="-p"){e.add(n),n+1<i.length&&(e.add(n+1),d=Number(i[n+1])),n++;continue}if(a.startsWith("--port=")){e.add(n),d=Number(a.slice(7));continue}if(a==="--timeout"){e.add(n),n+1<i.length&&(e.add(n+1),l=Number(i[n+1])),n++;continue}if(a==="--sim"||a==="--session"||a==="--tab"){e.add(n),n+1<i.length&&(e.add(n+1),t=i[n+1]?.trim()||void 0,m="flag"),n++;continue}let s=a.startsWith("--sim=")?a.slice(6):a.startsWith("--session=")?a.slice(10):a.startsWith("--tab=")?a.slice(6):void 0;if(s!==void 0){e.add(n),t=s.trim()||void 0,m="flag";continue}if(B.has(a)){e.add(n);continue}h.has(a)&&(e.add(n),n+1<i.length&&e.add(n+1),n++)}if(!t){let n=W();n&&(t=n.trim()||void 0,m="saved")}return{positional:i.filter((n,a)=>!e.has(a)),wsPort:d,simId:t,simIdSource:m,commandTimeoutMs:l}}function U(i,r={}){let e=1,d=r.commandTimeoutMs??15e3,l=new Map,t=new v(`ws://localhost:${i}`),m=C(),B=new Promise((s,o)=>{t.on("open",()=>{try{t.send(JSON.stringify({type:"bridge:hello",id:0,cliIdentityKey:m.key,cliIdentitySource:m.source,cliLabel:r.cliLabel}))}catch{}s()}),t.on("error",c=>{let g=c.message?`: ${c.message}`:"";o(new Error(`could not connect to ws://localhost:${i}${g}`))})}),h=!1,n=!1;function a(s,o){if(n||process.env.SOOTSIM_QUIET_TARGET_NOTICE==="1"||s.startsWith("bridge:")||s==="focus"||s==="close")return;n=!0;let c=o??"primary",g=M(o?r.simIdSource:"none");process.stderr.write(` \u2192 ${c} (${g})
4
4
  `)}return t.on("message",s=>{let o;try{o=JSON.parse(s.toString())}catch{return}if(o.id===0)return;let c=l.get(o.id);c&&(l.delete(o.id),o._otherCliCount>0&&!h&&(h=!0,process.stderr.write(`
5
5
  \u26A0 ${o._otherCliCount} other CLI identity/identities are driving this sim
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as ve,b as Te,c as Se}from"./chunk-AAQ6AYYW.js";import{c as he}from"./chunk-R3VO3MDO.js";import{d as ge}from"./chunk-WR5IDCCN.js";import{g as ye,i as be,k as x}from"./chunk-Y6CZ5N26.js";import{d as we}from"./chunk-QJVITDKU.js";import{a as me,b as S}from"./chunk-KLGX6B46.js";import{a as fe}from"./chunk-K5GLQDTG.js";import{createHash as rt}from"crypto";import{readFileSync as te}from"fs";import{gzipSync as Ue}from"zlib";function xe(e){let t=(e||"").toLowerCase().split(";")[0].trim();return t?!(t.startsWith("image/")||t.startsWith("video/")||t.startsWith("audio/")||t==="font/woff2"||t==="application/font-woff2"||t==="application/zip"||t==="application/gzip"):!0}import{brotliCompressSync as Ke,constants as je}from"node:zlib";var Ge=9;function Ie(e){return Ke(e,{params:{[je.BROTLI_PARAM_QUALITY]:Ge}})}function ee(e,t){let r=new AbortController,s=setTimeout(()=>r.abort(new Error(`${t} timed out after ${e/1e3}s`)),e);return{signal:r.signal,cancel:()=>clearTimeout(s)}}async function Ye(e){let t=ee(12e4,`PUT ${e.url}`),r;try{r=await fetch(e.url,{method:"PUT",headers:{"content-type":e.contentType},body:e.bytes,signal:t.signal})}finally{t.cancel()}if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`PUT ${e.url} failed ${r.status}: ${s.slice(0,200)}`)}}async function Qe(e,t=8,r){let s=0,i=0,a=e.length;await Promise.all(Array.from({length:Math.min(t,a)},async()=>{for(;s<a;){let c=e[s++];await Ye(c),i++,r?.(i,a)}}))}function Xe(e,t,r,s){let i=[];i.push({url:e.bundle.putUrl,contentType:e.bundle.contentType,bytes:t});for(let a of e.files){let c=r.get(a.urlhash);c&&i.push({url:a.putUrl,contentType:a.contentType,bytes:c})}e.events&&s?.eventsBytes&&i.push({url:e.events.putUrl,contentType:e.events.contentType,bytes:s.eventsBytes}),e.timeline&&s?.timelineBytes&&i.push({url:e.timeline.putUrl,contentType:e.timeline.contentType,bytes:s.timelineBytes}),e.flowVideo&&s?.videoBytes&&i.push({url:e.flowVideo.putUrl,contentType:e.flowVideo.contentType,bytes:s.videoBytes}),e.storage&&s?.storageBytes&&i.push({url:e.storage.putUrl,contentType:e.storage.contentType,bytes:s.storageBytes});for(let a of e.snapshots??[]){let c=s?.snapshotBytes?.get(a.id);c&&i.push({url:a.putUrl,contentType:a.contentType,bytes:c})}return i}function Ze(e){return e.replace(/\/+$/,"")}var N=class extends Error{constructor(r,s,i,a=""){super(r);this.status=s;this.phase=i;this.responseText=a;this.name="PresignedUploadError"}};async function Me(e){let t=Ze(e.originBase),r={"content-type":"application/json"};e.authHeader&&(r.authorization=e.authHeader),e.adminBypassToken&&(r["x-soot-admin-upload-bypass"]=e.adminBypassToken);let s=ee(3e4,"init"),i;try{i=await fetch(`${t}/api/preview/upload/init`,{method:"POST",headers:r,body:JSON.stringify(e.initBody),signal:s.signal})}finally{s.cancel()}if(!i.ok){let y=await i.text().catch(()=>"");throw new N(`init failed: ${i.status} ${y.slice(0,200)}`,i.status,"init",y)}let a=await i.json(),c=Xe(a,e.bundleBytes,e.filesByHash,e.extras);await Qe(c,e.concurrency??8,e.onPutProgress);let h=ee(3e4,"finalize"),p;try{p=await fetch(`${t}/api/preview/upload/finalize`,{method:"POST",headers:r,body:JSON.stringify({token:a.token}),signal:h.signal})}finally{h.cancel()}if(!p.ok){let y=await p.text().catch(()=>"");throw new N(`finalize failed: ${p.status} ${y.slice(0,200)}`,p.status,"finalize",y)}let _=await p.json();return{init:a,finalize:_}}function et(e){return e!==null&&typeof e=="object"?e:null}function Re(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Ee(e){let t=et(e);return t?t.schemaVersion===1&&Re(t.t)!==void 0&&Re(t.seq)!==void 0&&typeof t.context=="string"&&typeof t.kind=="string"&&"data"in t:!1}function ot(e){if(!e)return null;try{let t=JSON.parse(e);return typeof t.message=="string"&&t.message?t.message:null}catch{return null}}var ke=process.env.SOOTSIM_UPLOAD_ORIGIN||"https://sootbean.com",$e=process.env.SOOTSIM_PREVIEW_ORIGIN||"https://sootsim.com",re="http://localhost:3000",st=2e3;async function it(e){if(e)return e;if(process.env.SOOTSIM_UPLOAD_ORIGIN)return process.env.SOOTSIM_UPLOAD_ORIGIN;try{let t=await fetch(`${re}/api/preview/upload/init`,{method:"OPTIONS",signal:AbortSignal.timeout(st)});if(t.ok||t.status===204||t.status===405)return re}catch{}return ke}function B(e){return e.replace(/\/$/,"")}function at(e){try{let r=new URL(e).hostname.replace(/^\[|\]$/g,"").toLowerCase();return r==="localhost"||r.endsWith(".localhost")||r==="0.0.0.0"||r==="::1"||/^127(?:\.\d{1,3}){3}$/.test(r)}catch{return!1}}function lt(e){try{let t=new URL(e).hostname.toLowerCase();return t==="sootbean.com"||t.endsWith(".sootbean.com")}catch{return!1}}function ut(e,t){return t?B(t):process.env.SOOTSIM_PREVIEW_ORIGIN?B(process.env.SOOTSIM_PREVIEW_ORIGIN):at(e)?B(e):lt(e)?B($e):B(e)}function ct(){console.log(`
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as ve,b as Te,c as Se}from"./chunk-JCXQE5XP.js";import{c as he}from"./chunk-6PJLFYJT.js";import{d as ge}from"./chunk-R6YZNTVX.js";import{g as ye,i as be,k as x}from"./chunk-NX2QM2BE.js";import{d as we}from"./chunk-O7QYV2FI.js";import{a as me,b as S}from"./chunk-WUV6QJJU.js";import{a as fe}from"./chunk-UKKQXZFZ.js";import{createHash as rt}from"crypto";import{readFileSync as te}from"fs";import{gzipSync as Be}from"zlib";function xe(e){let t=(e||"").toLowerCase().split(";")[0].trim();return t?!(t.startsWith("image/")||t.startsWith("video/")||t.startsWith("audio/")||t==="font/woff2"||t==="application/font-woff2"||t==="application/zip"||t==="application/gzip"):!0}import{brotliCompressSync as Je,constants as Ge}from"node:zlib";var Ke=9;function Ie(e){return Je(e,{params:{[Ge.BROTLI_PARAM_QUALITY]:Ke}})}function ee(e,t){let r=new AbortController,o=setTimeout(()=>r.abort(new Error(`${t} timed out after ${e/1e3}s`)),e);return{signal:r.signal,cancel:()=>clearTimeout(o)}}async function Ye(e){let t=ee(12e4,`PUT ${e.url}`),r;try{r=await fetch(e.url,{method:"PUT",headers:{"content-type":e.contentType},body:e.bytes,signal:t.signal})}finally{t.cancel()}if(!r.ok){let o=await r.text().catch(()=>"");throw new Error(`PUT ${e.url} failed ${r.status}: ${o.slice(0,200)}`)}}async function Qe(e,t=8,r){let o=0,i=0,a=e.length;await Promise.all(Array.from({length:Math.min(t,a)},async()=>{for(;o<a;){let c=e[o++];await Ye(c),i++,r?.(i,a)}}))}function Xe(e,t,r,o){let i=[];i.push({url:e.bundle.putUrl,contentType:e.bundle.contentType,bytes:t});for(let a of e.files){let c=r.get(a.urlhash);c&&i.push({url:a.putUrl,contentType:a.contentType,bytes:c})}e.events&&o?.eventsBytes&&i.push({url:e.events.putUrl,contentType:e.events.contentType,bytes:o.eventsBytes}),e.timeline&&o?.timelineBytes&&i.push({url:e.timeline.putUrl,contentType:e.timeline.contentType,bytes:o.timelineBytes}),e.flowVideo&&o?.videoBytes&&i.push({url:e.flowVideo.putUrl,contentType:e.flowVideo.contentType,bytes:o.videoBytes}),e.storage&&o?.storageBytes&&i.push({url:e.storage.putUrl,contentType:e.storage.contentType,bytes:o.storageBytes});for(let a of e.snapshots??[]){let c=o?.snapshotBytes?.get(a.id);c&&i.push({url:a.putUrl,contentType:a.contentType,bytes:c})}return i}function Ze(e){return e.replace(/\/+$/,"")}var N=class extends Error{constructor(r,o,i,a=""){super(r);this.status=o;this.phase=i;this.responseText=a;this.name="PresignedUploadError"}};async function Me(e){let t=Ze(e.originBase),r={"content-type":"application/json"};e.authHeader&&(r.authorization=e.authHeader),e.adminBypassToken&&(r["x-soot-admin-upload-bypass"]=e.adminBypassToken);let o=ee(3e4,"init"),i;try{i=await fetch(`${t}/api/preview/upload/init`,{method:"POST",headers:r,body:JSON.stringify(e.initBody),signal:o.signal})}finally{o.cancel()}if(!i.ok){let y=await i.text().catch(()=>"");throw new N(`init failed: ${i.status} ${y.slice(0,200)}`,i.status,"init",y)}let a=await i.json(),c=Xe(a,e.bundleBytes,e.filesByHash,e.extras);await Qe(c,e.concurrency??8,e.onPutProgress);let h=ee(3e4,"finalize"),p;try{p=await fetch(`${t}/api/preview/upload/finalize`,{method:"POST",headers:r,body:JSON.stringify({token:a.token}),signal:h.signal})}finally{h.cancel()}if(!p.ok){let y=await p.text().catch(()=>"");throw new N(`finalize failed: ${p.status} ${y.slice(0,200)}`,p.status,"finalize",y)}let A=await p.json();return{init:a,finalize:A}}function et(e){return e!==null&&typeof e=="object"?e:null}function Ee(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Re(e){let t=et(e);return t?t.schemaVersion===1&&Ee(t.t)!==void 0&&Ee(t.seq)!==void 0&&typeof t.context=="string"&&typeof t.kind=="string"&&"data"in t:!1}function st(e){if(!e)return null;try{let t=JSON.parse(e);return typeof t.message=="string"&&t.message?t.message:null}catch{return null}}var _e=process.env.SOOTSIM_UPLOAD_ORIGIN||"https://sootbean.com",$e=process.env.SOOTSIM_PREVIEW_ORIGIN||"https://sootsim.com",re="http://localhost:3000",ot=2e3;async function it(e){if(e)return e;if(process.env.SOOTSIM_UPLOAD_ORIGIN)return process.env.SOOTSIM_UPLOAD_ORIGIN;try{let t=await fetch(`${re}/api/preview/upload/init`,{method:"OPTIONS",signal:AbortSignal.timeout(ot)});if(t.ok||t.status===204||t.status===405)return re}catch{}return _e}function U(e){return e.replace(/\/$/,"")}function at(e){try{let r=new URL(e).hostname.replace(/^\[|\]$/g,"").toLowerCase();return r==="localhost"||r.endsWith(".localhost")||r==="0.0.0.0"||r==="::1"||/^127(?:\.\d{1,3}){3}$/.test(r)}catch{return!1}}function lt(e){try{let t=new URL(e).hostname.toLowerCase();return t==="sootbean.com"||t.endsWith(".sootbean.com")}catch{return!1}}function ut(e,t){return t?U(t):process.env.SOOTSIM_PREVIEW_ORIGIN?U(process.env.SOOTSIM_PREVIEW_ORIGIN):at(e)?U(e):lt(e)?U($e):U(e)}function ct(){console.log(`
3
3
  sootsim record upload \u2014 publish the current recorded bundle as a /preview/<id> link
4
4
 
5
5
  usage:
@@ -8,7 +8,7 @@ usage:
8
8
  options:
9
9
  --origin <url> upload target (default: auto)
10
10
  prefers ${re} when available, otherwise
11
- falls back to ${ke}
11
+ falls back to ${_e}
12
12
  override with SOOTSIM_UPLOAD_ORIGIN env var
13
13
  --public-origin <url>
14
14
  public /preview link origin (default: ${$e}
@@ -41,19 +41,19 @@ examples:
41
41
  sootsim record upload --events ./my-session.jsonl.gz
42
42
  sootsim record upload --origin http://localhost:3000 --events ./my-session.jsonl.gz --open
43
43
  sootsim record upload --video /tmp/soot-flow.mp4 --video-duration-ms 12000
44
- `)}function d(e,t){let r=e.findIndex(i=>i===t);if(r<0)return;let s=e[r+1];return e.splice(r,2),s}function Be(e,t){let r=e.findIndex(s=>s===t);return r<0?!1:(e.splice(r,1),!0)}function Pe(e,t){if(!e)return;let r=Number(e);return(!Number.isFinite(r)||r<=0)&&(console.error(` invalid ${t}: ${e}`),process.exit(1)),Math.round(r)}function Ae(e){let t=(e||"").toLowerCase().split(";")[0].trim();return t?!!(t.startsWith("image/")||t.startsWith("font/")||t.startsWith("video/")||t.startsWith("audio/")||t.startsWith("model/")||t==="text/css"||t==="application/javascript"||t==="text/javascript"||t==="application/wasm"||t==="application/font-woff"||t==="application/font-woff2"||t==="application/octet-stream"):!1}async function _e(e){let t=await fetch(e);if(!t.ok)throw new Error(`fetch ${e} -> ${t.status} ${t.statusText}`);return new Uint8Array(await t.arrayBuffer())}function dt(e){return/\.bundle($|\?)/.test(e)||/\.js($|\?)/.test(e)?"application/javascript":/\.zip($|\?)/.test(e)?"application/zip":"application/javascript"}function pt(e){try{return new URL(e).searchParams.get("appFonts")||""}catch{return""}}function ft(e){try{return new URL(e).searchParams.get("appSplash")||""}catch{return""}}function mt(e){try{let t=new URL(e);return t.searchParams.get("lazy")==="true"?(t.searchParams.set("lazy","false"),t.toString()):e}catch{return e}}async function gt(e,t){let s=[];for(let i=0;i<t;i+=15e5){let a=Math.min(i+15e5,t),c=await x(e,`(window.__sootsimLastTransformedBundle?.text || "").slice(${i}, ${a})`);if(typeof c!="string")return null;s.push(c)}return s.join("")}function ht(e){return e.recordedDurationMs&&e.recordingStartedAtMs?{since:e.recordingStartedAtMs-1e4,until:e.recordingStartedAtMs+e.recordedDurationMs+5e3,limit:2e3}:{limit:2e3}}function ne(e){let t=new Map;for(let r of e)t.set(r.urlhash||r.url,r);return Array.from(t.values())}async function Ft(e,t){(e.includes("--help")||e.includes("-h"))&&(ct(),process.exit(0));let r=[...e],s=await it(d(r,"--origin")),i=ut(s,d(r,"--public-origin")),a=d(r,"--events"),c=d(r,"--screenshot"),h=d(r,"--video"),p=d(r,"--video-duration-ms"),_=Pe(d(r,"--recorded-duration-ms"),"--recorded-duration-ms"),y=Pe(d(r,"--recording-started-at-ms"),"--recording-started-at-ms"),z=d(r,"--owner"),D=d(r,"--repo"),k=d(r,"--billing-kind"),Le=Be(r,"--open");(z&&!D||!z&&D)&&(console.error(" --owner and --repo must be provided together"),process.exit(1)),k&&k!=="test_run"&&(console.error(` invalid --billing-kind: ${k}`),process.exit(1)),!a&&!h&&(console.error(" preview uploads require playback data: pass --events or --video.\n for a normal local preview, use `sootsim record --mode combined --open`\n or `sootsim flow --preview` instead of uploading a bundle-only snapshot."),process.exit(1));let oe=Be(r,"--assets-only"),Oe=ye(r,{stripBooleanFlags:[],stripValueFlags:[]}),b=be(Oe),u,se=[],w=[],$=[],H=null;try{if(u=await x(b,'(typeof window.__sootsimCaptureBundle === "function") ? window.__sootsimCaptureBundle() : null'),u?.bundleUrl){let l=new URL(u.bundleUrl).origin,[Y,Q]=await Promise.all([x(b,`(window.__sootsimPreviewRecorder?.list?.(${JSON.stringify(l)}) || [])`),x(b,`(async () => {
44
+ `)}function d(e,t){let r=e.findIndex(i=>i===t);if(r<0)return;let o=e[r+1];return e.splice(r,2),o}function Ue(e,t){let r=e.findIndex(o=>o===t);return r<0?!1:(e.splice(r,1),!0)}function ke(e,t){if(!e)return;let r=Number(e);return(!Number.isFinite(r)||r<=0)&&(console.error(` invalid ${t}: ${e}`),process.exit(1)),Math.round(r)}function Pe(e){let t=(e||"").toLowerCase().split(";")[0].trim();return t?!!(t.startsWith("image/")||t.startsWith("font/")||t.startsWith("video/")||t.startsWith("audio/")||t.startsWith("model/")||t==="text/css"||t==="application/javascript"||t==="text/javascript"||t==="application/wasm"||t==="application/font-woff"||t==="application/font-woff2"||t==="application/octet-stream"):!1}async function Ae(e){let t=await fetch(e);if(!t.ok)throw new Error(`fetch ${e} -> ${t.status} ${t.statusText}`);return new Uint8Array(await t.arrayBuffer())}function dt(e){return/\.bundle($|\?)/.test(e)||/\.js($|\?)/.test(e)?"application/javascript":/\.zip($|\?)/.test(e)?"application/zip":"application/javascript"}function pt(e){try{return new URL(e).searchParams.get("appFonts")||""}catch{return""}}function ft(e){try{return new URL(e).searchParams.get("appSplash")||""}catch{return""}}function mt(e){try{let t=new URL(e);return t.searchParams.get("lazy")==="true"?(t.searchParams.set("lazy","false"),t.toString()):e}catch{return e}}async function gt(e,t){let o=[];for(let i=0;i<t;i+=15e5){let a=Math.min(i+15e5,t),c=await x(e,`(window.__sootsimLastTransformedBundle?.text || "").slice(${i}, ${a})`);if(typeof c!="string")return null;o.push(c)}return o.join("")}function ht(e){return e.recordedDurationMs&&e.recordingStartedAtMs?{since:e.recordingStartedAtMs-1e4,until:e.recordingStartedAtMs+e.recordedDurationMs+5e3,limit:2e3}:{limit:2e3}}function ne(e){let t=new Map;for(let r of e)t.set(r.urlhash||r.url,r);return Array.from(t.values())}async function Ft(e,t){(e.includes("--help")||e.includes("-h"))&&(ct(),process.exit(0));let r=[...e],o=await it(d(r,"--origin")),i=ut(o,d(r,"--public-origin")),a=d(r,"--events"),c=d(r,"--screenshot"),h=d(r,"--video"),p=d(r,"--video-duration-ms"),A=ke(d(r,"--recorded-duration-ms"),"--recorded-duration-ms"),y=ke(d(r,"--recording-started-at-ms"),"--recording-started-at-ms"),z=d(r,"--owner"),D=d(r,"--repo"),_=d(r,"--billing-kind"),Le=Ue(r,"--open");(z&&!D||!z&&D)&&(console.error(" --owner and --repo must be provided together"),process.exit(1)),_&&_!=="test_run"&&(console.error(` invalid --billing-kind: ${_}`),process.exit(1)),!a&&!h&&(console.error(" preview uploads require playback data: pass --events or --video.\n for a normal local preview, use `sootsim record --mode combined --open`\n or `sootsim flow --preview` instead of uploading a bundle-only snapshot."),process.exit(1));let se=Ue(r,"--assets-only"),Oe=ye(r,{stripBooleanFlags:[],stripValueFlags:[]}),b=be(Oe),u,oe=[],w=[],$=[],H=null;try{if(u=await x(b,'(typeof window.__sootsimCaptureBundle === "function") ? window.__sootsimCaptureBundle() : null'),u?.bundleUrl){let l=new URL(u.bundleUrl).origin,[Y,Q]=await Promise.all([x(b,`(window.__sootsimPreviewRecorder?.list?.(${JSON.stringify(l)}) || [])`),x(b,`(async () => {
45
45
  const list = window.__sootsimListWorkerFetchRecorder
46
46
  return typeof list === 'function'
47
47
  ? await list(${JSON.stringify(l)})
48
48
  : []
49
- })()`)]);se=ne([...Y,...Q]).filter(f=>{try{return!new URL(f.url).pathname.startsWith("/api/")}catch{return!0}});let U=await x(b,`(async () => {
49
+ })()`)]);oe=ne([...Y,...Q]).filter(f=>{try{return!new URL(f.url).pathname.startsWith("/api/")}catch{return!0}});let B=await x(b,`(async () => {
50
50
  const rec = window.__sootsimPreviewRecorder
51
51
  const workerList = window.__sootsimListWorkerFetchRecorder
52
52
  return {
53
53
  main: rec?.list ? rec.list() : [],
54
54
  worker: typeof workerList === 'function' ? await workerList() : [],
55
55
  }
56
- })()`),A=(U?ne([...U.main,...U.worker]):[]).filter(f=>{try{return new URL(f.url).origin!==l}catch{return!1}}),T=A.length>0?{count:A.length,totalBytes:A.reduce((f,X)=>f+(X.size||0),0)}:null;if(T&&T.count>0){console.log(` ${T.count} recorded cross-origin responses (${(T.totalBytes/1024).toFixed(1)} KiB)`);let f=await x(b,`(async () => {
56
+ })()`),P=(B?ne([...B.main,...B.worker]):[]).filter(f=>{try{return new URL(f.url).origin!==l}catch{return!1}}),T=P.length>0?{count:P.length,totalBytes:P.reduce((f,X)=>f+(X.size||0),0)}:null;if(T&&T.count>0){console.log(` ${T.count} recorded cross-origin responses (${(T.totalBytes/1024).toFixed(1)} KiB)`);let f=await x(b,`(async () => {
57
57
  const rec = window.__sootsimPreviewRecorder
58
58
  const workerDump = window.__sootsimDumpWorkerFetchRecorder
59
59
  const bundleUrl = ${JSON.stringify(u.bundleUrl)}
@@ -76,12 +76,12 @@ examples:
76
76
  ? (await workerDump()).filter(keep)
77
77
  : [],
78
78
  }
79
- })()`);if(w=ne([...f.main,...f.worker]),oe){let X=w.length;w=w.filter(Z=>Ae(Z.contentType));let qe=T.totalBytes-w.reduce((Z,Je)=>Z+(Je.size||0),0);console.log(` --assets-only: kept ${w.length}/${X} records (dropped ${(qe/1024).toFixed(1)} KiB of API responses)`)}}}u?.transformedBundle&&(H=await gt(b,u.transformedBundle.byteLength));let n=await x(b,`(() => {
79
+ })()`);if(w=ne([...f.main,...f.worker]),se){let X=w.length;w=w.filter(Z=>Pe(Z.contentType));let We=T.totalBytes-w.reduce((Z,qe)=>Z+(qe.size||0),0);console.log(` --assets-only: kept ${w.length}/${X} records (dropped ${(We/1024).toFixed(1)} KiB of API responses)`)}}}u?.transformedBundle&&(H=await gt(b,u.transformedBundle.byteLength));let n=await x(b,`(() => {
80
80
  const bridge = window.SootSim?.bridges?.timeline ?? window.__sootsimTimeline
81
81
  if (!bridge || typeof bridge.recent !== 'function') return null
82
- return bridge.recent(${JSON.stringify(ht({recordedDurationMs:_,recordingStartedAtMs:y}))})
83
- })()`).catch(l=>(console.warn(` warning: failed to capture trace timeline: ${l instanceof Error?l.message:String(l)}`),null));$=(Array.isArray(n?.events)?n.events:[]).filter(Ee)}finally{b.close()}u||(console.error(" could not read bundle snapshot \u2014 is sootsim running and is the bundle loaded?"),process.exit(2)),u.bundleUrl||(console.error(` no ?bundle= URL on the current sootsim tab.
84
- open the app you want to share first (e.g. sootsim open 8082), then run upload.`),process.exit(2));let m,V=!1;if(H!==null)m=new TextEncoder().encode(H),V=!0,console.log(` using post-transform bundle: ${(m.byteLength/1024).toFixed(1)} KiB`);else{let n=mt(u.bundleUrl);n!==u.bundleUrl&&console.log(" forcing lazy=false for self-contained bundle"),console.log(` capturing: ${n}`),m=await _e(n),console.log(` main bundle: ${(m.byteLength/1024).toFixed(1)} KiB`)}let L=se.filter(n=>n.url!==u.bundleUrl);oe&&(L=L.filter(n=>Ae(n.contentType))),console.log(` fetching ${L.length} extra files\u2026`);let O=(await Promise.all(L.map(async n=>{try{let o=await _e(n.url);return{...n,bytes:o}}catch(o){return console.error(` warning: failed to re-fetch ${n.url}: ${o instanceof Error?o.message:o}`),null}}))).filter(n=>!!n),Fe=O.reduce((n,o)=>n+o.bytes.byteLength,0);console.log(` ${O.length} extra files: ${(Fe/1024).toFixed(1)} KiB`);let I;a&&(I=te(a));let ie=$.map(n=>JSON.stringify(n)).join(`
85
- `),W=Ue(ie?`${ie}
86
- `:"");console.log(` trace timeline: ${$.length} events`);let g;c&&(g=te(c),console.log(` attaching screenshot: ${(g.byteLength/1024).toFixed(1)} KiB`));let v,P,ae;if(h){if(v=te(h),P=h.endsWith(".mp4")?"video/mp4":h.endsWith(".gif")?"image/gif":void 0,P||(console.error(" preview flow videos must be mp4 or gif"),await S(),process.exit(1)),p){let n=Number(p);(!Number.isFinite(n)||n<=0)&&(console.error(` invalid --video-duration-ms: ${p}`),await S(),process.exit(1)),ae=Math.round(n)}console.log(` attaching flow video: ${(v.byteLength/1024).toFixed(1)} KiB (${P})`)}let M=ve(),R=Se(M),Ce=fe();me({event:"preview_upload_started",identity:{userId:M?.kind==="session"?Ce?.user?.id??null:null,repoId:R?.repoId??null,installationId:R?.installationId??null},properties:{origin:s,hasAuth:!!M,authMode:M?.kind??"none",bundleBytes:m.byteLength,isTransformed:V,extraFiles:O.length,recordedFetches:w.length,hasEvents:!!I,traceTimelineEvents:$.length,hasScreenshot:!!g,hasVideo:!!v}}),M||(console.error(" preview uploads need auth."),console.error(" set SOOTSIM_API_KEY=sk_sootsim_..., run `sootsim login`, or use the soot github runner."),await S(),process.exit(1));let Ne=Te(M),ze=(()=>{try{return new URL(u.bundleUrl).origin}catch{return null}})(),F=(n,o,l,Y,Q,U,pe,A)=>{let T=xe(U),f=T?Ue(n):n;return{url:o,urlhash:l,method:Y,bodyHash:Q,requestVaryHash:A,contentType:U,responseHeaders:pe,bytes:f,encoding:T?"gzip":void 0}},le=[],q=pt(u.pageHref)||"";if(q){let n=await ge(q,{onStaged:({url:o,byteLength:l})=>console.log(` staged app font: ${o} (${(l/1024).toFixed(1)} KiB)`),onError:(o,l)=>console.error(` warning: failed to fetch app font ${o}: ${l instanceof Error?l.message:l}`)});for(let o of n)le.push(F(Buffer.from(o.bytes),o.url,o.urlhash,"GET","-",o.contentType))}let ue=[],J=ft(u.pageHref)||"";if(J){let n=await he(J,{onStaged:({url:o,byteLength:l})=>console.log(` staged splash image: ${o} (${(l/1024).toFixed(1)} KiB)`),onError:(o,l)=>console.error(` warning: failed to fetch splash image ${o}: ${l instanceof Error?l.message:l}`)});for(let o of n)ue.push(F(Buffer.from(o.bytes),o.url,o.urlhash,"GET","-",o.contentType))}let K=[...O.map(n=>F(n.bytes,n.url,n.urlhash,"GET","-",n.contentType,n.responseHeaders,n.requestVaryHash)),...w.map(n=>F(Buffer.from(n.bodyBase64,"base64"),n.url,n.urlhash,n.method||"GET",n.bodyHash||"-",n.contentType,n.responseHeaders,n.requestVaryHash)),...le,...ue],j=Ie(m),De=rt("sha256").update(m).digest("hex");console.log(` bundle raw=${(m.byteLength/1024).toFixed(1)} KiB br=${(j.byteLength/1024).toFixed(1)} KiB`);let He={contentHash:De,bundleSizeBytes:m.byteLength,bundleContentType:dt(u.bundleUrl),bundleEncoding:"br",bundleOrigin:ze,runtimeVersion:u.runtimeVersion??void 0,appFonts:q||void 0,appSplash:J||void 0,entry:u.entry,isTransformed:V,deviceSpec:u.deviceSpec,installationId:R?.installationId??void 0,repoId:R?.repoId,owner:z??R?.owner,repo:D??R?.repo,billingKind:k==="test_run"?"test_run":void 0,files:K.map(n=>({url:n.url,urlhash:n.urlhash,method:n.method,bodyHash:n.bodyHash,contentType:n.contentType,responseHeaders:n.responseHeaders,requestVaryHash:n.requestVaryHash,encoding:n.encoding,sizeBytes:n.bytes.byteLength})),events:I?{sizeBytes:I.byteLength}:void 0,timeline:{sizeBytes:W.byteLength,encoding:"gzip"},recordedDurationMs:_,recordingStartedAtMs:y,snapshots:g?[{id:"landing",label:"Landing",kind:"landing",t:0,contentType:"image/png",sizeBytes:g.byteLength}]:void 0,flowVideo:v&&P?{sizeBytes:v.byteLength,contentType:P,durationMs:ae}:void 0},ce=new Map;for(let n of K)ce.set(n.urlhash,n.bytes);let de=new Map;g&&de.set("landing",g);let Ve=Date.now(),E=j.byteLength;for(let n of K)E+=n.bytes.byteLength;I&&(E+=I.byteLength),E+=W.byteLength,g&&(E+=g.byteLength),v&&(E+=v.byteLength);let We=`${B(s)}/api/preview/upload/init`;console.log(` init: ${We}`);let C;try{let n=await Me({originBase:s,initBody:He,bundleBytes:j,filesByHash:ce,extras:{eventsBytes:I,timelineBytes:W,videoBytes:v,snapshotBytes:de},authHeader:Ne,concurrency:16});C=n.finalize;let o=1+n.init.files.length+(n.init.events?1:0)+(n.init.timeline?1:0)+n.init.snapshots.length+(n.init.flowVideo?1:0);console.log(` PUT ${o} objects in ${Date.now()-Ve}ms (${(E/1024).toFixed(1)} KiB)`)}catch(n){let o=n;o.phase==="init"&&o.status===401&&(console.error(" preview upload requires a valid login."),console.error(" run `sootsim login` and retry."),await S(),process.exit(1)),o.status===402&&(console.error(` ${ot(o.responseText)??"preview uploads require Personal, Team, or an active trial \u2014 upgrade from the billing dialog."}`),await S(),process.exit(1)),console.error(` ${o.message??`${o.phase??"upload"} failed: ${String(n)}`}`),await S(),process.exit(1)}let G=`${i}${C.url}`;return console.log(`
87
- stored ${C.filesStored??0} extra files`),console.log(` preview: ${G}`),Le&&await we(G),await S(),{previewUrl:G,shareId:C.id}}export{it as a,ut as b,Ft as c};
82
+ return bridge.recent(${JSON.stringify(ht({recordedDurationMs:A,recordingStartedAtMs:y}))})
83
+ })()`).catch(l=>(console.warn(` warning: failed to capture trace timeline: ${l instanceof Error?l.message:String(l)}`),null));$=(Array.isArray(n?.events)?n.events:[]).filter(Re)}finally{b.close()}u||(console.error(" could not read bundle snapshot \u2014 is sootsim running and is the bundle loaded?"),process.exit(2)),u.bundleUrl||(console.error(` no ?bundle= URL on the current sootsim tab.
84
+ open the app you want to share first (e.g. sootsim open 8082), then run upload.`),process.exit(2));let m,j=!1;if(H!==null)m=new TextEncoder().encode(H),j=!0,console.log(` using post-transform bundle: ${(m.byteLength/1024).toFixed(1)} KiB`);else{let n=mt(u.bundleUrl);n!==u.bundleUrl&&console.log(" forcing lazy=false for self-contained bundle"),console.log(` capturing: ${n}`),m=await Ae(n),console.log(` main bundle: ${(m.byteLength/1024).toFixed(1)} KiB`)}let L=oe.filter(n=>n.url!==u.bundleUrl);se&&(L=L.filter(n=>Pe(n.contentType))),console.log(` fetching ${L.length} extra files\u2026`);let O=(await Promise.all(L.map(async n=>{try{let s=await Ae(n.url);return{...n,bytes:s}}catch(s){return console.error(` warning: failed to re-fetch ${n.url}: ${s instanceof Error?s.message:s}`),null}}))).filter(n=>!!n),Fe=O.reduce((n,s)=>n+s.bytes.byteLength,0);console.log(` ${O.length} extra files: ${(Fe/1024).toFixed(1)} KiB`);let I;a&&(I=te(a));let ie=$.map(n=>JSON.stringify(n)).join(`
85
+ `),V=Be(ie?`${ie}
86
+ `:"");console.log(` trace timeline: ${$.length} events`);let g;c&&(g=te(c),console.log(` attaching screenshot: ${(g.byteLength/1024).toFixed(1)} KiB`));let v,k,ae;if(h){if(v=te(h),k=h.endsWith(".mp4")?"video/mp4":h.endsWith(".gif")?"image/gif":void 0,k||(console.error(" preview flow videos must be mp4 or gif"),await S(),process.exit(1)),p){let n=Number(p);(!Number.isFinite(n)||n<=0)&&(console.error(` invalid --video-duration-ms: ${p}`),await S(),process.exit(1)),ae=Math.round(n)}console.log(` attaching flow video: ${(v.byteLength/1024).toFixed(1)} KiB (${k})`)}let M=ve(),E=Se(M),Ce=fe();me({event:"preview_upload_started",identity:{userId:M?.kind==="session"?Ce?.user?.id??null:null,repoId:E?.repoId??null,installationId:E?.installationId??null},properties:{origin:o,hasAuth:!!M,authMode:M?.kind??"none",bundleBytes:m.byteLength,isTransformed:j,extraFiles:O.length,recordedFetches:w.length,hasEvents:!!I,traceTimelineEvents:$.length,hasScreenshot:!!g,hasVideo:!!v}}),M||(console.error(" preview uploads need auth."),console.error(" set SOOTSIM_API_KEY=sk_sootsim_..., run `sootsim login`, or use the soot github runner."),await S(),process.exit(1));let Ne=Te(M),ze=(()=>{try{return new URL(u.bundleUrl).origin}catch{return null}})(),F=(n,s,l,Y,Q,B,pe,P)=>{let T=xe(B),f=T?Be(n):n;return{url:s,urlhash:l,method:Y,bodyHash:Q,requestVaryHash:P,contentType:B,responseHeaders:pe,bytes:f,encoding:T?"gzip":void 0}},le=[],W=pt(u.pageHref)||"";if(W){let n=await ge(W,{onStaged:({url:s,byteLength:l})=>console.log(` staged app font: ${s} (${(l/1024).toFixed(1)} KiB)`),onError:(s,l)=>console.error(` warning: failed to fetch app font ${s}: ${l instanceof Error?l.message:l}`)});for(let s of n)le.push(F(Buffer.from(s.bytes),s.url,s.urlhash,"GET","-",s.contentType))}let ue=[],q=ft(u.pageHref)||"";if(q){let n=await he(q,{onStaged:({url:s,byteLength:l})=>console.log(` staged splash image: ${s} (${(l/1024).toFixed(1)} KiB)`),onError:(s,l)=>console.error(` warning: failed to fetch splash image ${s}: ${l instanceof Error?l.message:l}`)});for(let s of n)ue.push(F(Buffer.from(s.bytes),s.url,s.urlhash,"GET","-",s.contentType))}let J=[...O.map(n=>F(n.bytes,n.url,n.urlhash,"GET","-",n.contentType,n.responseHeaders,n.requestVaryHash)),...w.map(n=>F(Buffer.from(n.bodyBase64,"base64"),n.url,n.urlhash,n.method||"GET",n.bodyHash||"-",n.contentType,n.responseHeaders,n.requestVaryHash)),...le,...ue],G=Ie(m),De=rt("sha256").update(m).digest("hex");console.log(` bundle raw=${(m.byteLength/1024).toFixed(1)} KiB br=${(G.byteLength/1024).toFixed(1)} KiB`);let He={contentHash:De,bundleSizeBytes:m.byteLength,bundleContentType:dt(u.bundleUrl),bundleEncoding:"br",bundleOrigin:ze,runtimeVersion:u.runtimeVersion??void 0,appFonts:W||void 0,appSplash:q||void 0,entry:u.entry,isTransformed:j,deviceSpec:u.deviceSpec,installationId:E?.installationId??void 0,repoId:E?.repoId,owner:z??E?.owner,repo:D??E?.repo,billingKind:_==="test_run"?"test_run":void 0,files:J.map(n=>({url:n.url,urlhash:n.urlhash,method:n.method,bodyHash:n.bodyHash,contentType:n.contentType,responseHeaders:n.responseHeaders,requestVaryHash:n.requestVaryHash,encoding:n.encoding,sizeBytes:n.bytes.byteLength})),events:I?{sizeBytes:I.byteLength}:void 0,timeline:{sizeBytes:V.byteLength,encoding:"gzip"},recordedDurationMs:A,recordingStartedAtMs:y,snapshots:g?[{id:"landing",label:"Landing",kind:"landing",t:0,contentType:"image/png",sizeBytes:g.byteLength}]:void 0,flowVideo:v&&k?{sizeBytes:v.byteLength,contentType:k,durationMs:ae}:void 0},ce=new Map;for(let n of J)ce.set(n.urlhash,n.bytes);let de=new Map;g&&de.set("landing",g);let je=Date.now(),R=G.byteLength;for(let n of J)R+=n.bytes.byteLength;I&&(R+=I.byteLength),R+=V.byteLength,g&&(R+=g.byteLength),v&&(R+=v.byteLength);let Ve=`${U(o)}/api/preview/upload/init`;console.log(` init: ${Ve}`);let C;try{let n=await Me({originBase:o,initBody:He,bundleBytes:G,filesByHash:ce,extras:{eventsBytes:I,timelineBytes:V,videoBytes:v,snapshotBytes:de},authHeader:Ne,concurrency:16});C=n.finalize;let s=1+n.init.files.length+(n.init.events?1:0)+(n.init.timeline?1:0)+n.init.snapshots.length+(n.init.flowVideo?1:0);console.log(` PUT ${s} objects in ${Date.now()-je}ms (${(R/1024).toFixed(1)} KiB)`)}catch(n){let s=n;s.phase==="init"&&s.status===401&&(console.error(" preview upload requires a valid login."),console.error(" run `sootsim login` and retry."),await S(),process.exit(1)),s.status===402&&(console.error(` ${st(s.responseText)??"preview uploads require Personal, Team, or an active trial \u2014 upgrade from the billing dialog."}`),await S(),process.exit(1)),console.error(` ${s.message??`${s.phase??"upload"} failed: ${String(n)}`}`),await S(),process.exit(1)}let K=`${i}${C.url}`;return console.log(`
87
+ stored ${C.filesStored??0} extra files`),console.log(` preview: ${K}`),Le&&await we(K),await S(),{previewUrl:K,shareId:C.id}}export{it as a,ut as b,Ft as c};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import{execFileSync as d,spawn as g}from"child_process";import{existsSync as m}from"fs";import{homedir as h}from"os";import{join as C}from"path";var f=["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome","~/Applications/Google Chrome.app/Contents/MacOS/Google Chrome","/Applications/Chromium.app/Contents/MacOS/Chromium","~/Applications/Chromium.app/Contents/MacOS/Chromium","/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge","~/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge","/Applications/Brave Browser.app/Contents/MacOS/Brave Browser","~/Applications/Brave Browser.app/Contents/MacOS/Brave Browser","/Applications/Arc.app/Contents/MacOS/Arc","~/Applications/Arc.app/Contents/MacOS/Arc"],O=["/usr/bin/google-chrome","/usr/bin/chromium","/usr/bin/chromium-browser","/usr/bin/microsoft-edge","/usr/bin/brave-browser","/snap/bin/chromium"],w=["C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe","C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe","C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe","C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe","C:\\Program Files\\BraveSoftware\\Brave-Browser\\Application\\brave.exe","C:\\Program Files (x86)\\BraveSoftware\\Brave-Browser\\Application\\brave.exe"],U=["google-chrome","chromium","chromium-browser","microsoft-edge","brave-browser"],M=["chrome","msedge","brave"];function A(r){return r.startsWith("~/")?C(h(),r.slice(2)):r}function a(r){for(let n of r){let o=A(n);if(m(o))return o}return null}function x(r,n){try{let e=d(n==="win32"?"where":"which",[r],{encoding:"utf8",timeout:1500,stdio:["ignore","pipe","ignore"]}).trim();return e?e.split(/\r?\n/)[0]:null}catch{return null}}function c(r=process.platform){let n=process.env.CHROME_PATH||process.env.CHROMIUM_PATH;if(n&&m(n))return n;let o=a(r==="darwin"?f:r==="win32"?w:O);if(o)return o;let e=r==="win32"?M:U;for(let t of e){let i=x(t,r);if(i)return i}return null}function p(r,n={}){if(!r)throw new Error("openUrl requires a url");let o=n.platform??process.platform;return n.newWindow?s(r,{...n,platform:o,newWindow:!0}):o==="darwin"?{command:"open",args:n.background===!1?[r]:["-g",r],via:"system"}:o==="win32"?{command:"cmd",args:["/c","start","",r],via:"system"}:{command:"xdg-open",args:[r],via:"system"}}function s(r,n={}){if(!r)throw new Error("openUrl requires a url");let o=n.platform??process.platform,e="chromiumBinary"in n?n.chromiumBinary:c(o);if(!e)throw new Error("browser launch requires Chrome, Chromium, Edge, Brave, or Arc");let t=[];return n.newWindow!==!1&&t.push("--new-window"),t.push(r),{command:e,args:t,via:"chromium",target:e}}async function l(r,n,o){return new Promise((e,t)=>{let i=g(r,n,{detached:o,stdio:"ignore"});i.once("error",t),i.once("spawn",()=>{o&&i.unref(),e(i.pid)})})}async function u(r,n={}){let o=p(r,n),e=await l(o.command,o.args,n.detached??!0);return{...o,pid:e,attachUrl:r}}async function b(r,n={}){let o=s(r,n),e=await l(o.command,o.args,n.detached??!0);return{...o,pid:e,attachUrl:r}}async function v(r,n={}){await u(r,n)}export{c as a,u as b,b as c,v as d};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as p}from"./chunk-P7MW7S62.js";import{a as c,b as l}from"./chunk-AAQ6AYYW.js";import{a}from"./chunk-K5GLQDTG.js";async function g(e,t){if(t)return t.replace(/\/$/,"");if(e.kind==="session"&&e.origin)return e.origin.replace(/\/$/,"");let i=a();return i?.origin?i.origin.replace(/\/$/,""):(await p()).replace(/\/$/,"")}async function m(e,t={}){let i=c();if(i||(process.stderr.write(`
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as p}from"./chunk-O2X7YSAD.js";import{a as c,b as l}from"./chunk-JCXQE5XP.js";import{a}from"./chunk-UKKQXZFZ.js";async function g(e,t){if(t)return t.replace(/\/$/,"");if(e.kind==="session"&&e.origin)return e.origin.replace(/\/$/,"");let i=a();return i?.origin?i.origin.replace(/\/$/,""):(await p()).replace(/\/$/,"")}async function m(e,t={}){let i=c();if(i||(process.stderr.write(`
3
3
  sootsim ${e} needs auth before it can check recording access.
4
4
 
5
5
  pick one:
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import{createHash as b}from"node:crypto";import g from"node:fs";import{createRequire as S}from"node:module";import u from"node:path";var y=/\.(ttf|otf|woff|woff2)$/i;function P(t,n,r){if(!t||typeof t!="object")return;let o=t.fonts;if(Array.isArray(o))for(let i of o)typeof i=="string"&&r.push(i);let e=t[n];if(!e||typeof e!="object")return;let s=e.fonts;if(Array.isArray(s))for(let i of s){if(typeof i=="string"){r.push(i);continue}if(!i||typeof i!="object")continue;let c=i.fontDefinitions;if(Array.isArray(c))for(let a of c){if(!a||typeof a!="object")continue;let p=a.path;typeof p=="string"&&r.push(p)}}}function m(t,n){if(!Array.isArray(t))return[];let r=[];for(let o of t){let e=Array.isArray(o)?o[0]:o;if(typeof e!="string"||!/(^|\/)expo-font$/.test(e))continue;let s=Array.isArray(o)?o[1]??{}:{};P(s,n,r)}return r}function C(t){return t.slice(t.lastIndexOf("/")+1).replace(y,"")}function h(t,n){let r=n.replace(/\/+$/,""),o=new Set,e=[];for(let s of t){let i=s.replace(/^\.\//,"").replace(/^\/+/,"");!i||o.has(i)||(o.add(i),y.test(i)&&e.push({family:C(i),url:`${r}/assets/${i}`}))}return e}var d=S(import.meta.url);function x(t){try{let n=new URL(t),r=n.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(r==="localhost"||r.endsWith(".localhost")||r==="0.0.0.0"||r==="::1"||/^127(?:\.\d{1,3}){3}$/.test(r))return n.origin}catch{}return null}var R=["app.config.js","app.config.ts","app.config.cjs","app.config.mjs","app.json"];function w(t){for(let n of R)try{if(g.statSync(u.join(t,n)).isFile())return!0}catch{}return!1}var j=new Set(["node_modules","artifacts","dist","build","out","coverage","tmp","public","ios","android","macos","windows","__fixtures__","__tests__","examples","example"]);function F(t,n){w(t)&&n.push(t);let r;try{r=g.readdirSync(t,{withFileTypes:!0})}catch{return}for(let o of r)o.isDirectory()&&(o.name.startsWith(".")||j.has(o.name)||F(u.join(t,o.name),n))}function _(t){try{return g.statSync(u.join(t,"package.json")).isFile()}catch{return!1}}function I(t){let n=x(t.bundleUrl);if(!n)return[];let r=t.repoDir||process.env.SOOT_REPO_DIR,o=r?u.resolve(r):process.cwd();if(!r&&!_(o))return[];let e=[];if(r)F(o,e),e.includes(o)||e.push(o);else{if(!w(o))return[];e.push(o)}if(e.length===0)return[];let s=(t.platform||process.env.SOOT_PLATFORM||"ios").toLowerCase(),i=null;try{let l=d.resolve("@expo/config",{paths:[...e,o]}),f=d(l);typeof f.getConfig=="function"&&(i=f.getConfig)}catch{}if(!i)return[];let c;for(let l of e)try{let f=i(l,{skipSDKVersionRequirement:!0});if(f?.exp&&typeof f.exp=="object"){let A=f.exp.plugins;if(Array.isArray(A)){c=f.exp;break}}}catch{}if(!c||typeof c!="object")return[];let a=c.plugins;if(!Array.isArray(a))return[];let p=m(a,s==="android"?"android":"ios");return h(p,n)}async function L(t,n){let r=x(t);if(!r)return null;let o=new AbortController,e=setTimeout(()=>o.abort(),n?.timeoutMs??1500);try{let s=await fetch(`${r}/`,{headers:{"expo-platform":"ios",Accept:"application/json"},signal:o.signal});if(!s.ok)return null;let c=(await s.json())?.extra?.expoClient?._internal?.projectRoot;return typeof c=="string"&&c.length>0?c:null}catch{return null}finally{clearTimeout(e)}}function M(t){return t.map(n=>`${encodeURIComponent(n.url)}::${encodeURIComponent(n.family)}`).join(",")}function k(t){let n=[];for(let r of t.split(",")){let o=r.trim();if(!o)continue;let e=o.indexOf("::"),s=e===-1?o:o.slice(0,e);try{n.push(decodeURIComponent(s))}catch{n.push(s)}}return n.filter(Boolean)}function D(t){let n=(t.split("?")[0].split(".").pop()||"").toLowerCase();return n==="ttf"?"font/ttf":n==="otf"?"font/otf":n==="woff"?"font/woff":n==="woff2"?"font/woff2":"application/octet-stream"}async function G(t,n){let r=[],o=new Set;for(let e of k(t)){let s=b("sha256").update(e).digest("hex");if(!o.has(s)){o.add(s);try{let i=await fetch(e);if(!i.ok){n?.onError?.(e,new Error(`${i.status} ${i.statusText}`));continue}let c=new Uint8Array(await i.arrayBuffer());r.push({url:e,urlhash:s,contentType:D(e),bytes:c}),n?.onStaged?.({url:e,byteLength:c.byteLength})}catch(i){n?.onError?.(e,i)}}}return r}export{I as a,L as b,M as c,G as d};
@@ -1,3 +1,3 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{j as n}from"./chunk-ITQV76PX.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.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{j as n}from"./chunk-5XMJFP54.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,5 +1,5 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as K,b as oe,c as ne,d as Se,e as $e,g as ke}from"./chunk-SPYRMNAJ.js";import{a as Ce,b as Ee}from"./chunk-R3VO3MDO.js";import{a as Ie,b as re,c as Pe}from"./chunk-WR5IDCCN.js";import{m as R}from"./chunk-WHYPFQIZ.js";import{m as Me,o as Te}from"./chunk-QNVY6BLP.js";import{a as Ue,b as Re,c as Oe,e as _e,f as Be,g as C,h as v,i as E}from"./chunk-Y6CZ5N26.js";import{b as xe,l as ae}from"./chunk-NAI6N6SN.js";import{a as O,b as se}from"./chunk-TBFBGSRV.js";import{d as ie}from"./chunk-QJVITDKU.js";import{d as T,e as b,f as U}from"./chunk-SJHC6HZH.js";import{D as ve,I as te,K as W,l as ye}from"./chunk-MH6BMKK5.js";import{g as j}from"./chunk-ITQV76PX.js";import{spawn as We}from"node:child_process";import D from"node:fs";import mt from"node:os";import M from"node:path";import{WebSocket as ut}from"ws";function nt(e){return e.replace(/^\[|\]$/g,"").toLowerCase()}function z(e){let t=nt(e);return t==="localhost"||t.endsWith(".localhost")||t==="0.0.0.0"||t==="::1"||/^127(?:\.\d{1,3}){3}$/.test(t)}function De(e){return new Error(`could not resolve a native bundle for ${e}. pass an explicit bundle URL or open Connect and choose the app there.`)}function rt(e,t){return e?.includes("/one/metro-entry.bundle")?"one":typeof t=="string"&&t?"expo":"unknown"}function Le(e,t,o){return`${e}//${t}:${o}`}function st(e){if(typeof window>"u")return!1;try{let t=new URL(e);return z(t.hostname)&&z(window.location.hostname)&&t.origin!==window.location.origin}catch{return!1}}async function Ae(e,t){let o={...t,cache:t?.cache??"no-store"};return st(e)?fetch(`/__fetch-proxy?url=${encodeURIComponent(e)}`,o):fetch(e,o)}function it(e){return e==="https:"?443:80}function at(e){let t=e.pathname||"/";return(t==="/"||t==="")&&!e.search&&!e.hash}async function lt(e){try{let t=await fetch("/__server-scan",{cache:"no-store"});if(!t.ok||!(t.headers.get("content-type")||"").toLowerCase().includes("json"))return null;let o=await t.json();if(!Array.isArray(o))return null;let n=o.find(r=>!!r&&typeof r=="object"&&r.port===e&&typeof r.bundleUrl=="string");return n?{bundleUrl:ne(n.bundleUrl),port:e,framework:typeof n.framework=="string"?n.framework:"unknown",projectName:typeof n.projectName=="string"?n.projectName:void 0}:null}catch{return null}}async function Ne(e,t){let o=e.replace(/\/+$/,"");try{if(z(new URL(o).hostname)){let n=await lt(t);if(n)return n}}catch{}try{let n=await Ae(`${o}/`,{headers:{"expo-platform":"ios"}});if(n.ok){let r=await n.json(),s=r?.extra?.expoClient||r?.extra||{},i=typeof r?.launchAsset?.url=="string"?r.launchAsset.url:void 0;if(i||s.name)return{bundleUrl:ne(i||`${o}${oe}`),port:t,framework:rt(i,s.sdkVersion),projectName:s.name}}}catch{}try{let n=await Ae(`${o}/status`);if(n.ok&&(await n.text()).includes("packager-status:running"))return{bundleUrl:`${o}${oe}`,port:t,framework:"metro"}}catch{}return null}async function ct(e){return Ne(Le("http:","localhost",e),e)}async function Fe(e){let t=e.trim();if(/^\d+$/.test(t)){let a=parseInt(t,10),l=await ct(a);if(l)return l;throw De(`localhost:${a}`)}let o=t.startsWith("http")?t:`http://${t}`,n;try{n=new URL(o)}catch{throw new Error(`could not parse "${e}". pass a dev-server port, a dev-server base URL, or a full bundle URL.`)}let r=n.protocol||"http:",s=n.port?parseInt(n.port,10):it(r),i=Le(r,n.hostname,s);if(at(n)){let a=await Ne(i,s);if(a)return a;throw De(i)}return{bundleUrl:n.toString(),port:s,framework:"unknown"}}function no(){console.error(" no sootsim desktop companion found."),console.error(""),console.error(" install the desktop app:"),console.error(" sootsim desktop install"),console.error(""),console.error(" or run setup to install the background daemon:"),console.error(" sootsim setup"),console.error("")}function He(e){let t=O();if(console.log(` note: no sootsim bridge detected on port ${e}`),t){console.log(" launch the installed companion with:"),console.log(" sootsim desktop");return}console.log(""),console.log(" run `sootsim setup` to install the background daemon,"),console.log(" or run `sootsim serve` in another shell for a foreground bridge.")}function dt(e){console.error(""),console.error(` no sim is connected to the sootsim bridge on port ${e}.`),console.error(""),console.error(" start your app dev server, then open it in sootsim:"),console.error(" npx expo start --localhost --port 8081"),console.error(" sootsim open 8081"),console.error(""),console.error(" then inspect the live app:"),console.error(" sootsim describe")}async function ro(e,t,o){let n=[];try{n=await e.listSims()}catch{}if(console.error(""),n.length===0){dt(t);return}console.error(` no sim with id "${o}" is connected to the bridge on port ${t}.`),console.error(""),console.error(" connected sims:");for(let r of n){let s=[r.isPrimary?"primary":null,r.readyState,r.userVisible===!1?"hidden":r.userVisible===!0?"visible":null,r.userFocused?"focused":null].filter(Boolean).join(", ");console.error(` ${r.id} (${s})`)}console.error(""),console.error(" pass a valid --sim id, or run `sootsim list` to see all sessions.")}var pt=12e4,je=100,ft=5e3,Ke=1e4,ht={rn:"/rn",connectrn:"/rn","connect-rn":"/rn",clock:"/app/clock","native-ui":"/app/native-ui",tamagui:"/app/tamagui",settings:"/app/settings",photos:"/app/photos",camera:"/app/camera"};function $(e){return new Promise(t=>setTimeout(t,e))}function ze(e){let t=process.env[e]?.trim();if(!t)return null;let o=Number(t);return Number.isInteger(o)&&o>0?o:null}function gt(){let e=ze("SOOTSIM_DRIVER_CONNECT_TIMEOUT_MS")??ze("SOOTSIM_PW_CONNECT_TIMEOUT_MS")??pt;return{timeoutMs:e,hostTimeoutMs:e+ft,intervalMs:je,attempts:Math.max(1,Math.ceil(e/je))}}function wt(e){return e==="chromium"||e==="electron"||e==="playwright"||e==="system"}function bt(e,t){return e.includes("--headless")?!0:e.includes("--headed")?!1:t==="playwright"&&process.platform==="linux"&&!process.env.DISPLAY&&!process.env.WAYLAND_DISPLAY?(console.error(" no display detected \u2192 running playwright headless (override with --headed)"),!0):!1}function V(e){return e.trim()}var Je=/^[A-Za-z][A-Za-z0-9+.-]*:/;function yt(e){let t=e.trim();if(!t)throw new Error("expected <url-or-route>");return Je.test(t)||t.startsWith("/")?t:`/${t}`}function vt(e){return e!==null&&typeof e=="object"}function St(e){let t=e.trim();return t?t.startsWith("/")?!0:Je.test(t)?!/^https?:\/\//i.test(t):!1:!1}async function $t(e){if(await q(e,250))return e;let t=te();if(t&&W(t)&&await q(t.bridgePort,500))return t.bridgePort;if(t&&W(t))throw new Error(`sootsim bridge lockfile is fresh (port ${t.bridgePort}) but the bridge is not reachable. run \`sootsim daemon restart\` or \`sootsim daemon uninstall\`.`);await xt();let o=kt(["serve","--quiet","--port",String(e)]),n=null;o.once("exit",(s,i)=>{n=String(s??i??"unknown")}),o.unref();let r=Date.now()+Ke;for(;Date.now()<r;){let s=te();if(s&&W(s)&&await q(s.bridgePort,250))return console.error(` started local bridge on port ${s.bridgePort}; run \`sootsim setup\` to install the background daemon`),s.bridgePort;if(await q(e,250))return console.error(` started local bridge on port ${e}; run \`sootsim setup\` to install the background daemon`),e;if(n)throw new Error(`sootsim bridge exited before becoming ready (exit ${n})`);await $(150)}throw new Error(`sootsim bridge did not start within ${Math.round(Ke/1e3)}s`)}async function xt(){let e=ve();if(e&&D.existsSync(ye(e)))return;console.error(" installing sootsim engine runtime...");let{runRuntime:t}=await import("./runtime-E4KWRPBT.js");await t(["install"],{})}function kt(e){let t=process.argv[1];return t&&D.existsSync(t)?We(process.execPath,[t,...e],{detached:!0,stdio:"ignore",env:process.env}):We("sootsim",e,{detached:!0,stdio:"ignore",env:process.env})}function q(e,t){return new Promise(o=>{let n=new ut(`ws://127.0.0.1:${e}`,{handshakeTimeout:t}),r=!1,s=i=>{if(!r){r=!0;try{n.close()}catch{}o(i)}};n.once("open",()=>s(!0)),n.once("error",()=>s(!1)),setTimeout(()=>s(!1),t)})}function de(e){try{let t=new URL(e),o=t.pathname.replace(/\/+$/,"")||"/";return t.searchParams.has("open")||t.searchParams.has("port")||t.searchParams.has("bundle")||t.searchParams.has("demo")||t.pathname.includes("/sootsim/index.html")||o==="/sootsim"||t.pathname==="/__soot"||t.pathname==="/__soot/"||o==="/rn"||/^\/rn\/[^/]+$/i.test(o)||/^\/app\/[^/]+$/i.test(o)||o==="/__soot/rn"||/^\/__soot\/rn\/[^/]+$/i.test(o)||/^\/__soot\/app\/[^/]+$/i.test(o)}catch{return!1}}function It(e){try{let t=new URL(e).pathname.replace(/\/+$/,"")||"/";return/^\/preview\/[^/]+$/.test(t)||/^\/build\/.+/.test(t)}catch{return!1}}async function To(e){let t=V(e);return(await Qe(t)).bundleUrl}function Pt(e){try{let t=new URL(e.startsWith("http")?e:`http://${e}`),o=t.pathname||"/";if(o!=="/"&&o!==""||t.search||t.hash||!/^(localhost|127\.0\.0\.1|\[::1\]|::1)$/i.test(t.hostname))return null;let n=t.port?Number(t.port):t.protocol==="https:"?443:80;return Number.isFinite(n)&&n>0?n:null}catch{return null}}async function Qe(e){let t=V(e),o=/^\d+$/.test(t)?Number(t):Pt(t);if(o&&o>0){let n=await $e(o);if(n)return{bundleUrl:n.bundleUrl,port:n.port,framework:n.framework,projectName:n.projectName}}return Fe(t)}function ue(e){let t=e.replace(/\/+$/,"")||"/";return t==="/__soot"||t.startsWith("/__soot/")?"/__soot":""}function Ct(e,t){let o=V(e),n=new URL(t),r=ue(n.pathname);return n.pathname=`${r}/rn`,n.searchParams.delete("bundle"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.delete("open"),n.searchParams.delete("port"),/^\d+$/.test(o)?n.pathname=`${r}/rn/${o}`:(n.pathname=`${r}/rn`,n.searchParams.set("open",o)),n.toString()}function Et(e){let t=V(e);return/^\d+$/.test(t)||/^https?:\/\//i.test(t)?!0:/^(localhost|127\.0\.0\.1|\[::1\]|[^/]+\.localhost):\d+(?:\/.*)?$/i.test(t)}async function Mt(e,t,o={}){let n=await Qe(e),r=new URL(t),s=ue(r.pathname);r.pathname=`${s}/rn`,r.searchParams.delete("open"),r.searchParams.delete("port"),r.searchParams.delete("demo"),r.searchParams.delete("app");let i=o.hot===void 0?n.bundleUrl:Se(n.bundleUrl,o.hot);return r.searchParams.set("bundle",i),r.toString()}function Tt(e){return e.startsWith("~/")?M.join(mt.homedir(),e.slice(2)):M.isAbsolute(e)?e:M.resolve(process.cwd(),e)}function Ut(e){let t={},o={};for(let r=0;r<e.length;r++){if(e[r]==="--replace"){let s=e[r+1];s||(console.error(" sootsim open: --replace expects <module>=<file>"),process.exit(1));let i=s.indexOf("=");(i<=0||i===s.length-1)&&(console.error(" sootsim open: --replace expects <module>=<file>"),process.exit(1));let a=s.slice(0,i).trim(),l=Tt(s.slice(i+1).trim());D.existsSync(l)||(console.error(` sootsim open: replacement file not found: ${l}`),process.exit(1)),t[a]={file:l},r++;continue}if(e[r]==="--remap"){let s=e[r+1],i=s?s.indexOf("="):-1;(!s||i<=0||i===s.length-1)&&(console.error(" sootsim open: --remap expects <host:port>=<host:port>"),process.exit(1)),o[s.slice(0,i).trim()]=s.slice(i+1).trim(),r++;continue}}let n={};return Object.keys(t).length>0&&(n.modules=t),Object.keys(o).length>0&&(n.network={remap:o}),n.modules||n.network?n:void 0}function Ye(){return Ue().shellBaseUrl}async function Rt(e){try{let t=new URL(e),o=t.searchParams.get("bundle")||"";if(!o)return e;let n=process.env.SOOT_REPO_DIR||await re(o)||void 0,r=Ie({bundleUrl:o,repoDir:n});if(r.length===0)return e;let s=await Ot(r);return s.length===0?e:(t.searchParams.set("appFonts",Pe(s)),t.toString())}catch{return e}}async function Ot(e){let t=await Promise.all(e.map(async n=>{let r=new AbortController,s=setTimeout(()=>r.abort(),1500);try{let i=await fetch(n.url,{method:"HEAD",signal:r.signal});return i.status>=200&&i.status<400?n:null}catch{return null}finally{clearTimeout(s)}})),o=[];for(let n of t)n!==null&&o.push(n);return o}async function _t(e,t,o={}){if(!e)return new URL(t).toString();if(de(e))return new URL(e).toString();let n=ht[e.toLowerCase()];if(n){let r=new URL(t),s=ue(r.pathname);return r.pathname=`${s}${n}`,r.toString()}return Et(e)?Mt(e,t,o):Ct(e,t)}async function Bt(e){try{let t=new URL(e),o=t.searchParams.get("bundle")||"";if(!o)return e;let n=process.env.SOOT_REPO_DIR||await re(o)||void 0,r=Ce({bundleUrl:o,repoDir:n});return!r||r.imageUrl&&!await Dt(r.imageUrl)?e:(t.searchParams.set("appSplash",Ee(r)),t.toString())}catch{return e}}async function Dt(e){let t=new AbortController,o=setTimeout(()=>t.abort(),1500);try{let n=await fetch(e,{method:"HEAD",signal:t.signal});return n.status>=200&&n.status<400}catch{return!1}finally{clearTimeout(o)}}async function G(e,t=Ye(),o={}){let n=await _t(e,t,o),r=await Bt(await Rt(n));if(!o.device)return r;let s=new URL(r);return s.searchParams.set("device",o.device),s.toString()}function qe(e,t){let o=e?.url||e?.origin||t;try{let n=new URL(o);return n.searchParams.delete("bundle"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.delete("open"),n.searchParams.delete("port"),n.searchParams.delete("inspectOpen"),n.searchParams.delete("appFonts"),n.searchParams.delete("appSplash"),n.toString()}catch{return t}}async function At(e,t,o,n={}){let r=new URL(await G(e,t,n));return r.searchParams.set("inspectOpen",o),r.toString()}async function Lt(e,t,o,n={}){let r=n.attempts??30,s=n.intervalMs??500,i=n.minNodeCount??10;for(let a=0;a<r;a++){let l=v(e,{commandTimeoutMs:t,simId:o,simIdSource:"flag"});try{let d=await l.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof d=="number"&&d>i)return{bridge:l,count:d}}catch{}l.close(),await $(s)}return null}function Nt(e){if(!e)return null;try{let t=new URL(e);if(t.searchParams.has("bundle")){let o=t.searchParams.get("bundle")||"";try{let n=new URL(o),r=n.pathname.length>36?`...${n.pathname.slice(-36)}`:n.pathname;return`bundle ${n.host}${r}`}catch{return"bundle"}}return t.searchParams.has("port")?`connect :${t.searchParams.get("port")||""}`:t.searchParams.has("open")?`connect ${t.searchParams.get("open")||""}`:t.searchParams.has("demo")?`demo ${t.searchParams.get("demo")||"default"}`:t.pathname.includes("/sootsim/index.html")||t.pathname==="/sootsim/"||t.pathname==="/sootsim"?"embedded sootsim":null}catch{return null}}function Ft(e){let t=e.indexOf(":");if(t<=0)return e.length>24?`${e.slice(0,21)}\u2026`:e;let o=e.slice(0,t),n=e.slice(t+1),r=n.length>12?`${n.slice(0,8)}\u2026`:n;return o==="AGENTBUS_SESSION"||o==="CLAUDE_CODE_SESSION_ID"||o==="CODEX_THREAD_ID"?`agent ${r}`:`${o} ${r}`}function Uo(e,t){if(e.length===0){console.log(" no sims connected");return}console.log(` connected sims (${e.length}):
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as K,b as oe,c as ne,d as Se,e as $e,g as ke}from"./chunk-KITHQVX5.js";import{a as Ce,b as Ee}from"./chunk-6PJLFYJT.js";import{a as Ie,b as re,c as Pe}from"./chunk-R6YZNTVX.js";import{m as R}from"./chunk-LJ4CQHHZ.js";import{m as Me,o as Te}from"./chunk-SQ2MTGDQ.js";import{a as Ue,b as Re,c as Oe,e as _e,f as Be,g as C,h as v,i as E}from"./chunk-NX2QM2BE.js";import{b as xe,l as ae}from"./chunk-WXN3JD2J.js";import{a as O,b as se}from"./chunk-BORW7JE4.js";import{d as ie}from"./chunk-O7QYV2FI.js";import{d as T,e as b,f as U}from"./chunk-S6L32ZQF.js";import{D as ve,I as te,K as W,l as ye}from"./chunk-TE4UPZY2.js";import{g as j}from"./chunk-5XMJFP54.js";import{spawn as We}from"node:child_process";import D from"node:fs";import mt from"node:os";import M from"node:path";import{WebSocket as ut}from"ws";function nt(e){return e.replace(/^\[|\]$/g,"").toLowerCase()}function z(e){let t=nt(e);return t==="localhost"||t.endsWith(".localhost")||t==="0.0.0.0"||t==="::1"||/^127(?:\.\d{1,3}){3}$/.test(t)}function De(e){return new Error(`could not resolve a native bundle for ${e}. pass an explicit bundle URL or open Connect and choose the app there.`)}function rt(e,t){return e?.includes("/one/metro-entry.bundle")?"one":typeof t=="string"&&t?"expo":"unknown"}function Le(e,t,o){return`${e}//${t}:${o}`}function st(e){if(typeof window>"u")return!1;try{let t=new URL(e);return z(t.hostname)&&z(window.location.hostname)&&t.origin!==window.location.origin}catch{return!1}}async function Ae(e,t){let o={...t,cache:t?.cache??"no-store"};return st(e)?fetch(`/__fetch-proxy?url=${encodeURIComponent(e)}`,o):fetch(e,o)}function it(e){return e==="https:"?443:80}function at(e){let t=e.pathname||"/";return(t==="/"||t==="")&&!e.search&&!e.hash}async function lt(e){try{let t=await fetch("/__server-scan",{cache:"no-store"});if(!t.ok||!(t.headers.get("content-type")||"").toLowerCase().includes("json"))return null;let o=await t.json();if(!Array.isArray(o))return null;let n=o.find(r=>!!r&&typeof r=="object"&&r.port===e&&typeof r.bundleUrl=="string");return n?{bundleUrl:ne(n.bundleUrl),port:e,framework:typeof n.framework=="string"?n.framework:"unknown",projectName:typeof n.projectName=="string"?n.projectName:void 0}:null}catch{return null}}async function Ne(e,t){let o=e.replace(/\/+$/,"");try{if(z(new URL(o).hostname)){let n=await lt(t);if(n)return n}}catch{}try{let n=await Ae(`${o}/`,{headers:{"expo-platform":"ios"}});if(n.ok){let r=await n.json(),s=r?.extra?.expoClient||r?.extra||{},i=typeof r?.launchAsset?.url=="string"?r.launchAsset.url:void 0;if(i||s.name)return{bundleUrl:ne(i||`${o}${oe}`),port:t,framework:rt(i,s.sdkVersion),projectName:s.name}}}catch{}try{let n=await Ae(`${o}/status`);if(n.ok&&(await n.text()).includes("packager-status:running"))return{bundleUrl:`${o}${oe}`,port:t,framework:"metro"}}catch{}return null}async function ct(e){return Ne(Le("http:","localhost",e),e)}async function Fe(e){let t=e.trim();if(/^\d+$/.test(t)){let a=parseInt(t,10),l=await ct(a);if(l)return l;throw De(`localhost:${a}`)}let o=t.startsWith("http")?t:`http://${t}`,n;try{n=new URL(o)}catch{throw new Error(`could not parse "${e}". pass a dev-server port, a dev-server base URL, or a full bundle URL.`)}let r=n.protocol||"http:",s=n.port?parseInt(n.port,10):it(r),i=Le(r,n.hostname,s);if(at(n)){let a=await Ne(i,s);if(a)return a;throw De(i)}return{bundleUrl:n.toString(),port:s,framework:"unknown"}}function no(){console.error(" no sootsim desktop companion found."),console.error(""),console.error(" install the desktop app:"),console.error(" sootsim desktop install"),console.error(""),console.error(" or run setup to install the background daemon:"),console.error(" sootsim setup"),console.error("")}function He(e){let t=O();if(console.log(` note: no sootsim bridge detected on port ${e}`),t){console.log(" launch the installed companion with:"),console.log(" sootsim desktop");return}console.log(""),console.log(" run `sootsim setup` to install the background daemon,"),console.log(" or run `sootsim serve` in another shell for a foreground bridge.")}function dt(e){console.error(""),console.error(` no sim is connected to the sootsim bridge on port ${e}.`),console.error(""),console.error(" start your app dev server, then open it in sootsim:"),console.error(" npx expo start --localhost --port 8081"),console.error(" sootsim open 8081"),console.error(""),console.error(" then inspect the live app:"),console.error(" sootsim describe")}async function ro(e,t,o){let n=[];try{n=await e.listSims()}catch{}if(console.error(""),n.length===0){dt(t);return}console.error(` no sim with id "${o}" is connected to the bridge on port ${t}.`),console.error(""),console.error(" connected sims:");for(let r of n){let s=[r.isPrimary?"primary":null,r.readyState,r.userVisible===!1?"hidden":r.userVisible===!0?"visible":null,r.userFocused?"focused":null].filter(Boolean).join(", ");console.error(` ${r.id} (${s})`)}console.error(""),console.error(" pass a valid --sim id, or run `sootsim list` to see all sessions.")}var pt=12e4,je=100,ft=5e3,Ke=1e4,ht={rn:"/rn",connectrn:"/rn","connect-rn":"/rn",clock:"/app/clock","native-ui":"/app/native-ui",tamagui:"/app/tamagui",settings:"/app/settings",photos:"/app/photos",camera:"/app/camera"};function $(e){return new Promise(t=>setTimeout(t,e))}function ze(e){let t=process.env[e]?.trim();if(!t)return null;let o=Number(t);return Number.isInteger(o)&&o>0?o:null}function gt(){let e=ze("SOOTSIM_DRIVER_CONNECT_TIMEOUT_MS")??ze("SOOTSIM_PW_CONNECT_TIMEOUT_MS")??pt;return{timeoutMs:e,hostTimeoutMs:e+ft,intervalMs:je,attempts:Math.max(1,Math.ceil(e/je))}}function wt(e){return e==="chromium"||e==="electron"||e==="playwright"||e==="system"}function bt(e,t){return e.includes("--headless")?!0:e.includes("--headed")?!1:t==="playwright"&&process.platform==="linux"&&!process.env.DISPLAY&&!process.env.WAYLAND_DISPLAY?(console.error(" no display detected \u2192 running playwright headless (override with --headed)"),!0):!1}function V(e){return e.trim()}var Je=/^[A-Za-z][A-Za-z0-9+.-]*:/;function yt(e){let t=e.trim();if(!t)throw new Error("expected <url-or-route>");return Je.test(t)||t.startsWith("/")?t:`/${t}`}function vt(e){return e!==null&&typeof e=="object"}function St(e){let t=e.trim();return t?t.startsWith("/")?!0:Je.test(t)?!/^https?:\/\//i.test(t):!1:!1}async function $t(e){if(await q(e,250))return e;let t=te();if(t&&W(t)&&await q(t.bridgePort,500))return t.bridgePort;if(t&&W(t))throw new Error(`sootsim bridge lockfile is fresh (port ${t.bridgePort}) but the bridge is not reachable. run \`sootsim daemon restart\` or \`sootsim daemon uninstall\`.`);await xt();let o=kt(["serve","--quiet","--port",String(e)]),n=null;o.once("exit",(s,i)=>{n=String(s??i??"unknown")}),o.unref();let r=Date.now()+Ke;for(;Date.now()<r;){let s=te();if(s&&W(s)&&await q(s.bridgePort,250))return console.error(` started local bridge on port ${s.bridgePort}; run \`sootsim setup\` to install the background daemon`),s.bridgePort;if(await q(e,250))return console.error(` started local bridge on port ${e}; run \`sootsim setup\` to install the background daemon`),e;if(n)throw new Error(`sootsim bridge exited before becoming ready (exit ${n})`);await $(150)}throw new Error(`sootsim bridge did not start within ${Math.round(Ke/1e3)}s`)}async function xt(){let e=ve();if(e&&D.existsSync(ye(e)))return;console.error(" installing sootsim engine runtime...");let{runRuntime:t}=await import("./runtime-HXK427JM.js");await t(["install"],{})}function kt(e){let t=process.argv[1];return t&&D.existsSync(t)?We(process.execPath,[t,...e],{detached:!0,stdio:"ignore",env:process.env}):We("sootsim",e,{detached:!0,stdio:"ignore",env:process.env})}function q(e,t){return new Promise(o=>{let n=new ut(`ws://127.0.0.1:${e}`,{handshakeTimeout:t}),r=!1,s=i=>{if(!r){r=!0;try{n.close()}catch{}o(i)}};n.once("open",()=>s(!0)),n.once("error",()=>s(!1)),setTimeout(()=>s(!1),t)})}function de(e){try{let t=new URL(e),o=t.pathname.replace(/\/+$/,"")||"/";return t.searchParams.has("open")||t.searchParams.has("port")||t.searchParams.has("bundle")||t.searchParams.has("demo")||t.pathname.includes("/sootsim/index.html")||o==="/sootsim"||t.pathname==="/__soot"||t.pathname==="/__soot/"||o==="/rn"||/^\/rn\/[^/]+$/i.test(o)||/^\/app\/[^/]+$/i.test(o)||o==="/__soot/rn"||/^\/__soot\/rn\/[^/]+$/i.test(o)||/^\/__soot\/app\/[^/]+$/i.test(o)}catch{return!1}}function It(e){try{let t=new URL(e).pathname.replace(/\/+$/,"")||"/";return/^\/preview\/[^/]+$/.test(t)||/^\/build\/.+/.test(t)}catch{return!1}}async function To(e){let t=V(e);return(await Qe(t)).bundleUrl}function Pt(e){try{let t=new URL(e.startsWith("http")?e:`http://${e}`),o=t.pathname||"/";if(o!=="/"&&o!==""||t.search||t.hash||!/^(localhost|127\.0\.0\.1|\[::1\]|::1)$/i.test(t.hostname))return null;let n=t.port?Number(t.port):t.protocol==="https:"?443:80;return Number.isFinite(n)&&n>0?n:null}catch{return null}}async function Qe(e){let t=V(e),o=/^\d+$/.test(t)?Number(t):Pt(t);if(o&&o>0){let n=await $e(o);if(n)return{bundleUrl:n.bundleUrl,port:n.port,framework:n.framework,projectName:n.projectName}}return Fe(t)}function ue(e){let t=e.replace(/\/+$/,"")||"/";return t==="/__soot"||t.startsWith("/__soot/")?"/__soot":""}function Ct(e,t){let o=V(e),n=new URL(t),r=ue(n.pathname);return n.pathname=`${r}/rn`,n.searchParams.delete("bundle"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.delete("open"),n.searchParams.delete("port"),/^\d+$/.test(o)?n.pathname=`${r}/rn/${o}`:(n.pathname=`${r}/rn`,n.searchParams.set("open",o)),n.toString()}function Et(e){let t=V(e);return/^\d+$/.test(t)||/^https?:\/\//i.test(t)?!0:/^(localhost|127\.0\.0\.1|\[::1\]|[^/]+\.localhost):\d+(?:\/.*)?$/i.test(t)}async function Mt(e,t,o={}){let n=await Qe(e),r=new URL(t),s=ue(r.pathname);r.pathname=`${s}/rn`,r.searchParams.delete("open"),r.searchParams.delete("port"),r.searchParams.delete("demo"),r.searchParams.delete("app");let i=o.hot===void 0?n.bundleUrl:Se(n.bundleUrl,o.hot);return r.searchParams.set("bundle",i),r.toString()}function Tt(e){return e.startsWith("~/")?M.join(mt.homedir(),e.slice(2)):M.isAbsolute(e)?e:M.resolve(process.cwd(),e)}function Ut(e){let t={},o={};for(let r=0;r<e.length;r++){if(e[r]==="--replace"){let s=e[r+1];s||(console.error(" sootsim open: --replace expects <module>=<file>"),process.exit(1));let i=s.indexOf("=");(i<=0||i===s.length-1)&&(console.error(" sootsim open: --replace expects <module>=<file>"),process.exit(1));let a=s.slice(0,i).trim(),l=Tt(s.slice(i+1).trim());D.existsSync(l)||(console.error(` sootsim open: replacement file not found: ${l}`),process.exit(1)),t[a]={file:l},r++;continue}if(e[r]==="--remap"){let s=e[r+1],i=s?s.indexOf("="):-1;(!s||i<=0||i===s.length-1)&&(console.error(" sootsim open: --remap expects <host:port>=<host:port>"),process.exit(1)),o[s.slice(0,i).trim()]=s.slice(i+1).trim(),r++;continue}}let n={};return Object.keys(t).length>0&&(n.modules=t),Object.keys(o).length>0&&(n.network={remap:o}),n.modules||n.network?n:void 0}function Ye(){return Ue().shellBaseUrl}async function Rt(e){try{let t=new URL(e),o=t.searchParams.get("bundle")||"";if(!o)return e;let n=process.env.SOOT_REPO_DIR||await re(o)||void 0,r=Ie({bundleUrl:o,repoDir:n});if(r.length===0)return e;let s=await Ot(r);return s.length===0?e:(t.searchParams.set("appFonts",Pe(s)),t.toString())}catch{return e}}async function Ot(e){let t=await Promise.all(e.map(async n=>{let r=new AbortController,s=setTimeout(()=>r.abort(),1500);try{let i=await fetch(n.url,{method:"HEAD",signal:r.signal});return i.status>=200&&i.status<400?n:null}catch{return null}finally{clearTimeout(s)}})),o=[];for(let n of t)n!==null&&o.push(n);return o}async function _t(e,t,o={}){if(!e)return new URL(t).toString();if(de(e))return new URL(e).toString();let n=ht[e.toLowerCase()];if(n){let r=new URL(t),s=ue(r.pathname);return r.pathname=`${s}${n}`,r.toString()}return Et(e)?Mt(e,t,o):Ct(e,t)}async function Bt(e){try{let t=new URL(e),o=t.searchParams.get("bundle")||"";if(!o)return e;let n=process.env.SOOT_REPO_DIR||await re(o)||void 0,r=Ce({bundleUrl:o,repoDir:n});return!r||r.imageUrl&&!await Dt(r.imageUrl)?e:(t.searchParams.set("appSplash",Ee(r)),t.toString())}catch{return e}}async function Dt(e){let t=new AbortController,o=setTimeout(()=>t.abort(),1500);try{let n=await fetch(e,{method:"HEAD",signal:t.signal});return n.status>=200&&n.status<400}catch{return!1}finally{clearTimeout(o)}}async function G(e,t=Ye(),o={}){let n=await _t(e,t,o),r=await Bt(await Rt(n));if(!o.device)return r;let s=new URL(r);return s.searchParams.set("device",o.device),s.toString()}function qe(e,t){let o=e?.url||e?.origin||t;try{let n=new URL(o);return n.searchParams.delete("bundle"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.delete("open"),n.searchParams.delete("port"),n.searchParams.delete("inspectOpen"),n.searchParams.delete("appFonts"),n.searchParams.delete("appSplash"),n.toString()}catch{return t}}async function At(e,t,o,n={}){let r=new URL(await G(e,t,n));return r.searchParams.set("inspectOpen",o),r.toString()}async function Lt(e,t,o,n={}){let r=n.attempts??30,s=n.intervalMs??500,i=n.minNodeCount??10;for(let a=0;a<r;a++){let l=v(e,{commandTimeoutMs:t,simId:o,simIdSource:"flag"});try{let d=await l.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof d=="number"&&d>i)return{bridge:l,count:d}}catch{}l.close(),await $(s)}return null}function Nt(e){if(!e)return null;try{let t=new URL(e);if(t.searchParams.has("bundle")){let o=t.searchParams.get("bundle")||"";try{let n=new URL(o),r=n.pathname.length>36?`...${n.pathname.slice(-36)}`:n.pathname;return`bundle ${n.host}${r}`}catch{return"bundle"}}return t.searchParams.has("port")?`connect :${t.searchParams.get("port")||""}`:t.searchParams.has("open")?`connect ${t.searchParams.get("open")||""}`:t.searchParams.has("demo")?`demo ${t.searchParams.get("demo")||"default"}`:t.pathname.includes("/sootsim/index.html")||t.pathname==="/sootsim/"||t.pathname==="/sootsim"?"embedded sootsim":null}catch{return null}}function Ft(e){let t=e.indexOf(":");if(t<=0)return e.length>24?`${e.slice(0,21)}\u2026`:e;let o=e.slice(0,t),n=e.slice(t+1),r=n.length>12?`${n.slice(0,8)}\u2026`:n;return o==="AGENTBUS_SESSION"||o==="CLAUDE_CODE_SESSION_ID"||o==="CODEX_THREAD_ID"?`agent ${r}`:`${o} ${r}`}function Uo(e,t){if(e.length===0){console.log(" no sims connected");return}console.log(` connected sims (${e.length}):
3
3
  `);for(let o of e){let n=o.lockedBy&&o.lockExpiresAt?`locked by ${Ft(o.lockedBy)} (${Math.max(0,Math.round((o.lockExpiresAt-Date.now())/1e3))}s)`:"",r=[o.isPrimary?"primary":"",o.id===t?"selected":"",o.readyState,o.userVisible===!1?"hidden":o.userVisible===!0?"visible":"",o.attachedCliCount&&o.attachedCliCount>0?"in use":"",o.userFocused?"focused":"",n].filter(Boolean);console.log(` ${o.id}${r.length?` [${r.join(", ")}]`:""}`);let s=Nt(o.url);if(s)console.log(` loaded: ${s}`);else if(o.url){let a=o.url.length>96?`${o.url.slice(0,93)}\u2026`:o.url;console.log(` url: ${a}`)}else o.origin&&console.log(` origin: ${o.origin}`);let i=Ht(o);i&&console.log(` engine: ${i}`),o.title&&console.log(` title: ${o.title}`),o.visibilityState&&o.visibilityState!=="visible"&&console.log(` visibility: ${o.visibilityState}`),console.log(` connected: ${Ge(Date.now()-o.connectedAt)}`),o.lastActiveAt&&o.lastActiveAt>0&&console.log(` last active: ${Ge(Date.now()-o.lastActiveAt)}`)}}function Ht(e){let t=e.url||e.origin||"";if(!t)return null;try{let o=new URL(t).port;return o==="5173"?"dev \u2014 local source (:5173)":o==="3000"?"soot app embedded (:3000)":ke()?`dev \u2014 local build (:${o||"?"})`:`runtime \u2014 published engine (:${o||"?"})`}catch{return null}}function Ge(e){let t=Math.max(0,Math.round(e/1e3));return t<60?`${t}s ago`:t<3600?`${Math.round(t/60)}m ago`:t<86400?`${Math.round(t/3600)}h ago`:`${Math.round(t/86400)}d ago`}async function le(e,t,o,n={}){let r=n.attempts??30,s=n.intervalMs??500;for(let i=0;i<r;i++){let a=v(e,{commandTimeoutMs:t});try{let d=(await a.listSims()).find(o);if(d)return d}catch{}finally{a.close()}await $(s)}return null}async function Wt(e,t,o,n,r={}){let s=r.attempts??30,i=r.intervalMs??500,a=!!n&&Number.isInteger(n)&&n>1,l=()=>a&&n!==void 0&&!me(n);for(let d=0;d<s;d++){if(l())return{kind:"host-exit"};let m=v(e,{commandTimeoutMs:t});try{let g=(await m.listSims()).find(o);if(g)return l()?{kind:"host-exit"}:{kind:"match",sim:g}}catch{}finally{m.close()}if(l())return{kind:"host-exit"};await $(i)}return{kind:"timeout"}}async function jt(e,t,o,n={}){let r=n.attempts??20,s=n.intervalMs??250;for(let i=0;i<r;i++){let a=v(e,{commandTimeoutMs:t});try{let d=(await a.listSims()).find(m=>m.id===o);if(!d||d.readyState!=="open")return!0}catch{return!0}finally{a.close()}await $(s)}return!1}function Kt(e){let t=e.meta;if(!t||t.sootsimHostDriver!=="playwright")return null;let o=Number(t.sootsimHostPid);return!Number.isInteger(o)||o<=1||o===process.pid?null:o}function zt(e){if(!e.connectAckFile)return!1;try{return D.writeFileSync(e.connectAckFile,`${JSON.stringify({connectedAt:Date.now(),pid:e.pid??null})}
4
4
  `,{flag:"w"}),!0}catch{return!1}}function Ve(e){if(e.diagnosticLogPath)try{let t=D.readFileSync(e.diagnosticLogPath,"utf8").trim();if(!t){console.error(` ${M.basename(e.diagnosticLogPath)} was empty`);return}let o=t.length>4e3?`\u2026
5
5
  ${t.slice(-4e3)}`:t;console.error(` ${M.basename(e.diagnosticLogPath)}:`),console.error(o)}catch(t){let o=t instanceof Error?t.message:String(t);console.error(` failed to read ${M.basename(e.diagnosticLogPath)}: ${o}`)}}function me(e){try{return process.kill(e,0),!0}catch(t){return t?.code==="EPERM"}}async function qt(e,t=2500){let o=Date.now()+t;for(;Date.now()<o;){if(!me(e))return!0;await $(100)}return!me(e)}async function ce(e,t){let o=new Set(t),n=new Set;for(let r of e){if(!o.has(r.id))continue;let s=Kt(r);s&&n.add(s)}for(let r of n){try{process.kill(r,"SIGTERM")}catch{}if(await qt(r)){console.log(` closed playwright host process ${r}`);continue}try{process.kill(r,"SIGKILL"),console.log(` force-closed playwright host process ${r}`)}catch{}}}function J(e,t){if(t){let r=t.trim(),s=e.find(i=>i.id===r);if(!s)throw new Error(`no sim connected with id ${r}`);return s}let o=e.find(r=>r.isPrimary&&r.readyState==="open");if(o)return o;let n=e.find(r=>r.readyState==="open");if(n)return n;throw new Error("no sim connected")}function _(e,t,o){console.log(` ${o==="current sim"?"loaded":"opened"}: ${e} [${o}]`),console.log(` current sim: ${t.id}`),console.log(JSON.stringify({simId:t.id,url:t.url},null,2))}async function B(e,t,o){if(o.includes("--no-describe"))return;let n=process.env.SOOTSIM_QUIET_TARGET_NOTICE;process.env.SOOTSIM_QUIET_TARGET_NOTICE="1";try{await Gt(e,t,{stableMs:150,maxMs:400});let r=v(e,{commandTimeoutMs:3e3,simId:t,cliLabel:"open --describe",simIdSource:"flag"});try{let s=null;try{s=await r.send({type:"evaluate",code:Me})}catch{}if(s&&!(s.flag===!0&&!s.loadingText&&Te(s))){let m=s.loadingText?`still showing "${s.loadingText}"`:s.flag!==!0?"guest ready event has not fired":s.targets<=0?"no visible app content is inspectable yet":"app tree is still stabilizing";console.log(` app still loading: ${m} (nodes: ${s.nodes}, targets: ${s.targets})`),console.log(" before interacting, run: sootsim wait ready --max-ms 120000")}let a=`(async () => {
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{h as w,j as u,k as m,l}from"./chunk-ITQV76PX.js";var p="sootsim:settings",v=["errorReporting","colorScheme","a11yMode","a11yDepth","screenshotCanvas","screenshotBackground","screenshotText","screenshotPose","screenshotDynamicSize","alwaysShowLiveWebViews","agentProvider","onboardingComplete","betaConsentVersion","detailedTelemetry"];function S(){if(typeof window>"u")return null;let e=window.sootsimElectron;return e&&typeof e=="object"?e:null}function g(e){let t={};for(let n of v){if(!(n in e))continue;let r=e[n],o=u[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 v)t[n]=e[n];return t}function _(){if(typeof localStorage>"u")return{};try{let e=localStorage.getItem(p);return e?g(JSON.parse(e)):{}}catch{return{}}}function V(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(p,JSON.stringify(h(e)))}catch{}}function E(){let t=S()?.sharedConfig?.settings;return!t||typeof t!="object"?{}:g(t)}function K(e){let t=S();if(t?.writeSharedConfig)try{t.writeSharedConfig({settings:h(e)})}catch{}}function b(){if(typeof window>"u")return null;let e=window.__sootsimSharedConfig;return e&&typeof e=="object"?e:null}function j(){let e=b()?.settings;return!e||typeof e!="object"?{}:g(e)}function D(e){if(!b())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 k(){let e=_(),t=j(),n=E();return{...e,...t,...n}}function R(e){V(e),K(e),D(e)}function C(e){if(typeof window>"u")return()=>{};let t=i=>{if(!(i.key!==p||i.newValue==null))try{e(g(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(g(d))}));let c=globalThis.__sootsimBridgeRequest?.subscribeSharedConfig?.(i=>{let d=i?.settings;!d||typeof d!="object"||e(g(d))});return()=>{window.removeEventListener("storage",t),r?.(),c?.()}}var M=l(),P=k();for(let e of Object.keys(m()))delete P[e];var s={...M,...P},f=[],a=null;function y(){for(let e of f)e();R(s)}C(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 L={get(e){return s[e]},set(e,t){let n=u[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=u[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{L as a};
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{h as w,j as u,k as m,l}from"./chunk-5XMJFP54.js";var p="sootsim:settings",v=["errorReporting","colorScheme","a11yMode","a11yDepth","screenshotCanvas","screenshotBackground","screenshotText","screenshotPose","screenshotDynamicSize","alwaysShowLiveWebViews","agentProvider","onboardingComplete","betaConsentVersion","detailedTelemetry"];function S(){if(typeof window>"u")return null;let e=window.sootsimElectron;return e&&typeof e=="object"?e:null}function g(e){let t={};for(let n of v){if(!(n in e))continue;let r=e[n],o=u[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 v)t[n]=e[n];return t}function _(){if(typeof localStorage>"u")return{};try{let e=localStorage.getItem(p);return e?g(JSON.parse(e)):{}}catch{return{}}}function V(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(p,JSON.stringify(h(e)))}catch{}}function E(){let t=S()?.sharedConfig?.settings;return!t||typeof t!="object"?{}:g(t)}function K(e){let t=S();if(t?.writeSharedConfig)try{t.writeSharedConfig({settings:h(e)})}catch{}}function b(){if(typeof window>"u")return null;let e=window.__sootsimSharedConfig;return e&&typeof e=="object"?e:null}function j(){let e=b()?.settings;return!e||typeof e!="object"?{}:g(e)}function D(e){if(!b())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 k(){let e=_(),t=j(),n=E();return{...e,...t,...n}}function R(e){V(e),K(e),D(e)}function C(e){if(typeof window>"u")return()=>{};let t=i=>{if(!(i.key!==p||i.newValue==null))try{e(g(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(g(d))}));let c=globalThis.__sootsimBridgeRequest?.subscribeSharedConfig?.(i=>{let d=i?.settings;!d||typeof d!="object"||e(g(d))});return()=>{window.removeEventListener("storage",t),r?.(),c?.()}}var M=l(),P=k();for(let e of Object.keys(m()))delete P[e];var s={...M,...P},f=[],a=null;function y(){for(let e of f)e();R(s)}C(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 L={get(e){return s[e]},set(e,t){let n=u[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=u[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{L as a};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import{existsSync as D,mkdirSync as O,readFileSync as g,rmSync as s,writeFileSync as P}from"fs";import{tmpdir as R}from"os";import{dirname as A,join as x,resolve as v}from"path";import{execFileSync as I}from"child_process";import{readFileSync as S}from"fs";import{createRequire as _}from"module";var o=null;function u(r){o||(o=N());try{return o(r)}catch{return null}}function N(){let r=Number(process.env.PPID);if(Number.isFinite(r)&&r>1&&r!==process.ppid)return()=>r;if(process.platform==="linux")return b();if(process.platform==="darwin"){let n=T();return n||C()}return()=>null}function b(){return r=>{try{let n=S(`/proc/${r}/stat`,"utf8"),t=n.lastIndexOf(")");if(t<0)return null;let i=n.slice(t+1).trim().split(/\s+/),e=Number(i[1]);return Number.isFinite(e)&&e>0?e:null}catch{return null}}}var y=3,d=216,E=16;function T(){if(!process.versions?.bun)return null;try{let r=_(import.meta.url),{dlopen:n,FFIType:t}=r("bun:ffi"),i=n("/usr/lib/libproc.dylib",{proc_pidinfo:{args:[t.i32,t.i32,t.u64,t.ptr,t.i32],returns:t.i32}}),e=Buffer.alloc(d);return a=>{if(Number(i.symbols.proc_pidinfo(a,y,0n,e,d))<=0)return null;let p=e.readUInt32LE(E);return p>0?p:null}}catch{return null}}function C(){return r=>{try{let t=I("lsof",["-R","-p",String(r),"-d","cwd","-a"],{encoding:"utf8",timeout:2e3,stdio:["ignore","pipe","ignore"]}).split(`
3
3
  `)[1];if(!t)return null;let i=t.trim().split(/\s+/),e=Number(i[2]);return Number.isFinite(e)&&e>1?e:null}catch{return null}}}var c=1,f="SOOTSIM_CLI_CURRENT_SIM_PATH",F=["SOOTSIM_CLI_IDENTITY","AGENTBUS_SESSION","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","TERM_SESSION_ID","ITERM_SESSION_ID","TMUX_PANE","STY","KITTY_WINDOW_ID","WEZTERM_PANE","ALACRITTY_WINDOW_ID","WINDOWID","VSCODE_INJECTION"];function m(r,n=20){let t=u(r);if(!t||t<=1)return null;for(let i=0;i<n;i++){let e=u(t);if(!e||e<=1)return t;t=e}return t}function k(){for(let n of F){let t=process.env[n];if(t&&t.trim())return{key:`${n}:${t.trim()}`,source:n,stable:!0}}let r=m(process.ppid);return r&&r>1?{key:`gppid-${r}`,source:"grand-ppid",stable:!0}:{key:`pid-${process.ppid}`,source:"ppid",stable:!1}}function L(){return k().key}function J(){return m(process.ppid)}function l(){if(process.env[f])return v(process.env[f]);let r=L();return x(R(),`sootsim-current-sim-${r}.json`)}function h(){let r=l();if(!D(r))return null;try{let n=JSON.parse(g(r,"utf8"));return n.version!==c||typeof n.simId!="string"||!n.simId.trim()||typeof n.updatedAt!="string"?(s(r,{force:!0}),null):{version:c,simId:n.simId.trim(),updatedAt:n.updatedAt}}catch{return s(r,{force:!0}),null}}function j(){return h()?.simId||null}function K(r){let n=r.trim();if(!n)return;let t=l();O(A(t),{recursive:!0}),P(t,JSON.stringify({version:c,simId:n,updatedAt:new Date().toISOString()},null,2)+`
4
4
  `)}function X(){s(l(),{force:!0})}export{k as a,L as b,J as c,j as d,K as e,X as f};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.190 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  function C(t,e){let r=["--max-ms","--maxMs","--maxms","--max_ms"];for(let n of r){let s=t.indexOf(n);if(s>=0&&t[s+1]){let o=Number(t[s+1]);if(Number.isFinite(o))return Math.max(100,o)}}return e}var w=new Set(["tap","double-tap","tap-text","tap-id","long-press","touch"]);function S(t){return typeof t=="string"&&w.has(t)}async function v(t){return await t.send({type:"evaluate",code:"window.__sootsimEngineState?.inspectActive === true"})===!0}async function H(t,e){if(!S(e))return!1;try{return await v(t)}catch{return!1}}async function W(t){let e=await t.send({type:"evaluate",code:"(async () => await window.__sootsimTest.getNodeCount())()"});return{nodes:typeof e=="number"?e:0}}async function B(t,e=5){let r=await t.send({type:"evaluate",code:`(async () => await window.__sootsimTest.dumpTree(${e}))()`});return{depth:e,tree:r}}async function F(t){let e=await t.send({type:"evaluate",code:"window.location.href"});return{url:typeof e=="string"?e:""}}async function j(t,e){let r=`(async () => {
3
3
  const t = window.__sootsimTest
4
4
  const mainShell = window.SootSim?.bridges?.mainShell