sootsim 0.1.66 → 0.1.68

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 (152) hide show
  1. package/dist-cli/bin.js +7 -28
  2. package/dist-cli/chunks/agent-RWWC5VLR.js +46 -0
  3. package/dist-cli/chunks/{agent-wrapper-5DJBERZP.js → agent-wrapper-AZ2TWUZV.js} +2 -2
  4. package/dist-cli/chunks/{assert-RHILK3WR.js → assert-YVADDYYY.js} +2 -2
  5. package/dist-cli/chunks/auto-bootstrap-E62IXD2G.js +2 -0
  6. package/dist-cli/chunks/beta-7MI67AHK.js +2 -0
  7. package/dist-cli/chunks/{chunk-XZ5SQJM2.js → chunk-2HVRBEOU.js} +128 -36
  8. package/dist-cli/chunks/chunk-2NFRZQ3K.js +73 -0
  9. package/dist-cli/chunks/{chunk-22CO2ZE3.js → chunk-3HF6BNSA.js} +2 -2
  10. package/dist-cli/chunks/{chunk-GDCMTHEU.js → chunk-3NNUNABL.js} +1 -1
  11. package/dist-cli/chunks/{chunk-BD76YSRN.js → chunk-3QA6YYSG.js} +2 -2
  12. package/dist-cli/chunks/{chunk-T4YLDM5C.js → chunk-52QFCYGQ.js} +3 -3
  13. package/dist-cli/chunks/chunk-5LDGAVAV.js +23 -0
  14. package/dist-cli/chunks/{chunk-LRBMW2WC.js → chunk-5QUYJKLU.js} +2 -2
  15. package/dist-cli/chunks/chunk-5SGAFI2M.js +23 -0
  16. package/dist-cli/chunks/{chunk-VRV2X4X2.js → chunk-6453CCSA.js} +1 -1
  17. package/dist-cli/chunks/{chunk-FXF2FHPI.js → chunk-6JGI2JVM.js} +2 -2
  18. package/dist-cli/chunks/chunk-6TQ2IBH6.js +2 -0
  19. package/dist-cli/chunks/chunk-72Y42WVX.js +186 -0
  20. package/dist-cli/chunks/{chunk-4LYNJPUM.js → chunk-BQLKO6NP.js} +2 -2
  21. package/dist-cli/chunks/{chunk-AYBGSHQK.js → chunk-C3R25CWY.js} +2 -2
  22. package/dist-cli/chunks/{chunk-TJEP4DBA.js → chunk-CFR6W2AH.js} +2 -2
  23. package/dist-cli/chunks/chunk-CMEWLMED.js +1 -0
  24. package/dist-cli/chunks/chunk-CZWZG7GL.js +2 -0
  25. package/dist-cli/chunks/chunk-D5LXWWGN.js +12 -0
  26. package/dist-cli/chunks/{chunk-EIQLQDKX.js → chunk-E7FCGYB5.js} +2 -2
  27. package/dist-cli/chunks/{chunk-DEQ7RED3.js → chunk-FBO7YRJM.js} +2 -2
  28. package/dist-cli/chunks/chunk-FITG7BVA.js +1 -0
  29. package/dist-cli/chunks/{chunk-BEQD2DSK.js → chunk-G3WXMB3Z.js} +1 -1
  30. package/dist-cli/chunks/chunk-GFXFPPNR.js +35 -0
  31. package/dist-cli/chunks/chunk-H6YUT7HX.js +372 -0
  32. package/dist-cli/chunks/{chunk-D4VEI6MI.js → chunk-HC43PTFD.js} +1 -1
  33. package/dist-cli/chunks/chunk-HPFXTPOD.js +1 -0
  34. package/dist-cli/chunks/{chunk-V4SZERWD.js → chunk-J7XCQWQI.js} +14 -14
  35. package/dist-cli/chunks/{chunk-HIN5TAAL.js → chunk-K6N6DEL5.js} +1 -1
  36. package/dist-cli/chunks/{chunk-6AP6LXVV.js → chunk-KKK4RTBP.js} +1 -1
  37. package/dist-cli/chunks/{chunk-NCSGLZRV.js → chunk-OFTI3N27.js} +2 -2
  38. package/dist-cli/chunks/{chunk-BTHB3PMG.js → chunk-QHAZOOK2.js} +3 -3
  39. package/dist-cli/chunks/{chunk-4NT6VRUU.js → chunk-QYFPV5YO.js} +1 -1
  40. package/dist-cli/chunks/chunk-TBVBPZRF.js +3 -0
  41. package/dist-cli/chunks/{chunk-LVFWALS4.js → chunk-TKDMCYGS.js} +2 -2
  42. package/dist-cli/chunks/{chunk-LCKLQSZX.js → chunk-TY5CBM3C.js} +2 -2
  43. package/dist-cli/chunks/{chunk-WAOLC7WV.js → chunk-TZYXNQHA.js} +1 -1
  44. package/dist-cli/chunks/chunk-U7KUAZJB.js +119 -0
  45. package/dist-cli/chunks/{chunk-M2Q4FXRE.js → chunk-WHJFB6AK.js} +1 -1
  46. package/dist-cli/chunks/{chunk-HWCZYW6M.js → chunk-WIW3G6HS.js} +2 -2
  47. package/dist-cli/chunks/chunk-WXISHMXL.js +2 -0
  48. package/dist-cli/chunks/{chunk-UMXVWFST.js → chunk-YSDIOWNN.js} +1 -1
  49. package/dist-cli/chunks/{chunk-EEMGSSWY.js → chunk-Z6BCORBY.js} +2 -2
  50. package/dist-cli/chunks/{chunk-UNSLXX7V.js → chunk-ZP7YYRHI.js} +2 -2
  51. package/dist-cli/chunks/cli-version-LM6OBGUK.js +2 -0
  52. package/dist-cli/chunks/{compat-I7JXYUJN.js → compat-Z3IFUQ73.js} +3 -3
  53. package/dist-cli/chunks/{config-3HR5RKVH.js → config-XBERIMLW.js} +2 -2
  54. package/dist-cli/chunks/control-SWOP3KB7.js +2 -0
  55. package/dist-cli/chunks/{cpu-profile-ZVHMTVAU.js → cpu-profile-SNX23Q5V.js} +2 -2
  56. package/dist-cli/chunks/daemon-QQPC4GOV.js +65 -0
  57. package/dist-cli/chunks/{debug-CQ6Y7GJ2.js → debug-WENYS45R.js} +5 -5
  58. package/dist-cli/chunks/demo-app-registry-QWOGX5C2.js +2 -0
  59. package/dist-cli/chunks/{detox-7ZKTGLDR.js → detox-P4N47V6P.js} +2 -2
  60. package/dist-cli/chunks/{device-4M6Z7E2N.js → device-5WWFV22H.js} +2 -2
  61. package/dist-cli/chunks/{diagnose-SMQLYGNX.js → diagnose-HJ4F3ER7.js} +2 -2
  62. package/dist-cli/chunks/drivers-GAEMIY75.js +2 -0
  63. package/dist-cli/chunks/{electron-6N2MIN5W.js → electron-JHFA2OGV.js} +3 -3
  64. package/dist-cli/chunks/flow-J67STV2Q.js +2 -0
  65. package/dist-cli/chunks/{hints-RJCZS2E3.js → hints-UHQ2T2RX.js} +2 -2
  66. package/dist-cli/chunks/{home-paths-DCUNA3CD.js → home-paths-NWDFFIX4.js} +2 -2
  67. package/dist-cli/chunks/inspect-O34RH4AE.js +970 -0
  68. package/dist-cli/chunks/install-ZB2AGO44.js +2 -0
  69. package/dist-cli/chunks/{install-desktop-C7424OSW.js → install-desktop-RYP35PHA.js} +3 -3
  70. package/dist-cli/chunks/{keys-TXUQOAZ3.js → keys-U5YI77TK.js} +2 -2
  71. package/dist-cli/chunks/{launch-MVA44QTC.js → launch-UFOGCQWO.js} +3 -3
  72. package/dist-cli/chunks/{login-NHO2WTHC.js → login-SPX6IK6Q.js} +4 -4
  73. package/dist-cli/chunks/{logout-SRRWADCE.js → logout-I6UE3XYL.js} +2 -2
  74. package/dist-cli/chunks/{maestro-UHNXEZAN.js → maestro-IPEULAUZ.js} +2 -2
  75. package/dist-cli/chunks/{preview-ETIUP7KC.js → preview-CE27FPGG.js} +2 -2
  76. package/dist-cli/chunks/{profile-MY5JFVIF.js → profile-JZSFMO2Y.js} +2 -2
  77. package/dist-cli/chunks/{react-KCMC4GL3.js → react-6IJQG4V3.js} +2 -2
  78. package/dist-cli/chunks/record-6WDKEBXL.js +70 -0
  79. package/dist-cli/chunks/runtime-P54OGI57.js +2 -0
  80. package/dist-cli/chunks/{runtime-delivery-LQZIWQU6.js → runtime-delivery-C4KG6ISS.js} +2 -2
  81. package/dist-cli/chunks/screenshot-VQTI6G32.js +33 -0
  82. package/dist-cli/chunks/{screenshot-mode-USPWASI3.js → screenshot-mode-JBDCHRSS.js} +2 -2
  83. package/dist-cli/chunks/{screenshots-EPEDNA6H.js → screenshots-HLMGN2OX.js} +2 -2
  84. package/dist-cli/chunks/{server-222QT33M.js → server-U3QLKQDX.js} +6 -6
  85. package/dist-cli/chunks/setup-repo-TZULA5RK.js +2 -0
  86. package/dist-cli/chunks/{skills-6XRREE2M.js → skills-SMML5DJP.js} +2 -2
  87. package/dist-cli/chunks/{start-YCAZBZEX.js → start-7SCU4I64.js} +4 -4
  88. package/dist-cli/chunks/store-WEIVIM3L.js +2 -0
  89. package/dist-cli/chunks/telemetry-U3BBVPLJ.js +2 -0
  90. package/dist-cli/chunks/{test-6TNRHSWC.js → test-UWFHFDN7.js} +3 -3
  91. package/dist-cli/chunks/{three-mode-MDOLHGXW.js → three-mode-CJUNGCIF.js} +2 -2
  92. package/dist-cli/chunks/{timeline-72MWE44G.js → timeline-DIRXVM6R.js} +3 -3
  93. package/dist-cli/chunks/{upgrade-IHZ4DFAE.js → upgrade-LQQU4GSZ.js} +2 -2
  94. package/dist-cli/chunks/upload-SSAFKJGF.js +2 -0
  95. package/dist-cli/chunks/web-AJU6QA43.js +2 -0
  96. package/dist-cli/chunks/what-happened-QFXDQ6VU.js +22 -0
  97. package/dist-cli/chunks/{whoami-2EYGCRDQ.js → whoami-HWXPDZEF.js} +2 -2
  98. package/dist-lib/agent-daemon-client.cjs +1 -1
  99. package/dist-lib/agent-events.cjs +1 -1
  100. package/dist-lib/agent-sessions.cjs +1 -1
  101. package/dist-lib/attached-projects.cjs +1 -1
  102. package/dist-lib/auth/shared-session.cjs +1 -1
  103. package/dist-lib/backend-origin.cjs +1 -1
  104. package/dist-lib/bridge-constants.cjs +1 -1
  105. package/dist-lib/cli-constants.cjs +1 -1
  106. package/dist-lib/config.cjs +1 -1
  107. package/dist-lib/dev-bundle-resolution.cjs +9 -2
  108. package/dist-lib/home-paths.cjs +1 -1
  109. package/dist-lib/host/bridge-host.cjs +23 -7
  110. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  111. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  112. package/dist-lib/index.cjs +1 -1
  113. package/dist-lib/metro.cjs +1 -1
  114. package/dist-lib/profiles.cjs +1 -1
  115. package/dist-lib/render-mode.cjs +1 -1
  116. package/dist-lib/vite-base.cjs +23 -7
  117. package/dist-lib/vite.cjs +1 -1
  118. package/package.json +1 -1
  119. package/dist-cli/chunks/agent-IW7CCSSI.js +0 -61
  120. package/dist-cli/chunks/auto-bootstrap-PS2UDBP7.js +0 -2
  121. package/dist-cli/chunks/beta-XLYWSKEA.js +0 -2
  122. package/dist-cli/chunks/chunk-5MVFADNH.js +0 -3
  123. package/dist-cli/chunks/chunk-7NYW73Q6.js +0 -2
  124. package/dist-cli/chunks/chunk-EMMX6RF7.js +0 -73
  125. package/dist-cli/chunks/chunk-FIIBCY5I.js +0 -3
  126. package/dist-cli/chunks/chunk-G4VWDOWB.js +0 -17
  127. package/dist-cli/chunks/chunk-GMKGJHVG.js +0 -1
  128. package/dist-cli/chunks/chunk-M3ZEZHOB.js +0 -34
  129. package/dist-cli/chunks/chunk-MWTMLNGM.js +0 -348
  130. package/dist-cli/chunks/chunk-NQKBIKUZ.js +0 -1
  131. package/dist-cli/chunks/chunk-QMRXLBPN.js +0 -11
  132. package/dist-cli/chunks/chunk-X4HQLK4V.js +0 -119
  133. package/dist-cli/chunks/chunk-XOTJSR4T.js +0 -2
  134. package/dist-cli/chunks/chunk-YSQV4D7P.js +0 -1
  135. package/dist-cli/chunks/chunk-Z6HSVZIO.js +0 -100
  136. package/dist-cli/chunks/cli-version-ESQ2S6N5.js +0 -2
  137. package/dist-cli/chunks/control-TDZXFNVT.js +0 -2
  138. package/dist-cli/chunks/daemon-VYRTYH55.js +0 -83
  139. package/dist-cli/chunks/demo-app-registry-JAYU7BBM.js +0 -2
  140. package/dist-cli/chunks/drivers-SIY6JBEM.js +0 -2
  141. package/dist-cli/chunks/flow-BZEWL7UQ.js +0 -2
  142. package/dist-cli/chunks/inspect-T5NC7HHB.js +0 -1025
  143. package/dist-cli/chunks/install-YTJI5RS7.js +0 -2
  144. package/dist-cli/chunks/record-DHDSXC2Y.js +0 -51
  145. package/dist-cli/chunks/runtime-AJP6V5LM.js +0 -2
  146. package/dist-cli/chunks/screenshot-4KPEEI6I.js +0 -28
  147. package/dist-cli/chunks/setup-repo-D56L3CEB.js +0 -2
  148. package/dist-cli/chunks/store-Z32KZ34K.js +0 -2
  149. package/dist-cli/chunks/telemetry-RFTX2BZK.js +0 -2
  150. package/dist-cli/chunks/upload-G5C7LJWG.js +0 -2
  151. package/dist-cli/chunks/web-JLJSJUS2.js +0 -2
  152. package/dist-cli/chunks/what-happened-BUXSJ3QS.js +0 -15
@@ -0,0 +1,73 @@
1
+ /*! sootsim v0.1.68 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{d as ne,e as re}from"./chunk-Z6BCORBY.js";import{d as Z}from"./chunk-K6N6DEL5.js";import{a as X,b as v}from"./chunk-FBO7YRJM.js";import{a as Q}from"./chunk-E7FCGYB5.js";import{c as ee,e as te,g as T}from"./chunk-5LDGAVAV.js";import{createHash as Re}from"crypto";import{readFileSync as ie}from"fs";import{gzipSync as ae}from"zlib";function se(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}function W(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 Be(e){let t=W(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 ${r.status}: ${s.slice(0,200)}`)}}async function Ie(e,t=8,r){let s=0,o=0,a=e.length;await Promise.all(Array.from({length:Math.min(t,a)},async()=>{for(;s<a;){let u=e[s++];await Be(u),o++,r?.(o,a)}}))}function Ue(e,t,r,s){let o=[];o.push({url:e.bundle.putUrl,contentType:e.bundle.contentType,bytes:t});for(let a of e.files){let u=r.get(a.urlhash);u&&o.push({url:a.putUrl,contentType:a.contentType,bytes:u})}return e.events&&s?.eventsBytes&&o.push({url:e.events.putUrl,contentType:e.events.contentType,bytes:s.eventsBytes}),e.flowVideo&&s?.videoBytes&&o.push({url:e.flowVideo.putUrl,contentType:e.flowVideo.contentType,bytes:s.videoBytes}),e.storage&&s?.storageBytes&&o.push({url:e.storage.putUrl,contentType:e.storage.contentType,bytes:s.storageBytes}),o}function Pe(e){return e.replace(/\/+$/,"")}var E=class extends Error{constructor(r,s,o,a=""){super(r);this.status=s;this.phase=o;this.responseText=a;this.name="PresignedUploadError"}};async function oe(e){let t=Pe(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=W(3e4,"init"),o;try{o=await fetch(`${t}/api/preview/upload/init`,{method:"POST",headers:r,body:JSON.stringify(e.initBody),signal:s.signal})}finally{s.cancel()}if(!o.ok){let y=await o.text().catch(()=>"");throw new E(`init failed: ${o.status} ${y.slice(0,200)}`,o.status,"init",y)}let a=await o.json(),u=Ue(a,e.bundleBytes,e.filesByHash,e.extras);await Ie(u,e.concurrency??8,e.onPutProgress);let B=W(3e4,"finalize"),g;try{g=await fetch(`${t}/api/preview/upload/finalize`,{method:"POST",headers:r,body:JSON.stringify({token:a.token}),signal:B.signal})}finally{B.cancel()}if(!g.ok){let y=await g.text().catch(()=>"");throw new E(`finalize failed: ${g.status} ${y.slice(0,200)}`,g.status,"finalize",y)}let S=await g.json();return{init:a,finalize:S}}function xe(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 de=process.env.SOOTSIM_UPLOAD_ORIGIN||"https://sootbean.com",pe=process.env.SOOTSIM_PREVIEW_ORIGIN||"https://sootsim.com",D="http://localhost:3000";async function Se(e){if(e)return e;if(process.env.SOOTSIM_UPLOAD_ORIGIN)return process.env.SOOTSIM_UPLOAD_ORIGIN;try{let t=await fetch(`${D}/api/preview/upload/init`,{method:"OPTIONS"});if(t.ok||t.status===204||t.status===405)return D}catch{}return de}function P(e){return e.replace(/\/$/,"")}function Oe(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 _e(e){try{let t=new URL(e).hostname.toLowerCase();return t==="sootbean.com"||t.endsWith(".sootbean.com")}catch{return!1}}function $e(e,t){return t?P(t):process.env.SOOTSIM_PREVIEW_ORIGIN?P(process.env.SOOTSIM_PREVIEW_ORIGIN):Oe(e)?P(e):_e(e)?P(pe):P(e)}function ke(){console.log(`
3
+ sootsim upload \u2014 publish the current bundle as a /preview/<id> link
4
+
5
+ usage:
6
+ sootsim upload [--origin <url>] [--public-origin <url>] [--events <path>] [--sim <sim>] [--open] [--assets-only]
7
+
8
+ options:
9
+ --origin <url> upload target (default: auto)
10
+ prefers ${D} when available, otherwise
11
+ falls back to ${de}
12
+ override with SOOTSIM_UPLOAD_ORIGIN env var
13
+ --public-origin <url>
14
+ public /preview link origin (default: ${pe}
15
+ for prod uploads, upload origin for localhost/custom origins).
16
+ override with SOOTSIM_PREVIEW_ORIGIN env var
17
+ --events <path> path to a gzipped events .jsonl.gz file to attach
18
+ --video <path> path to a webm/mp4/gif flow recording. embedded inline
19
+ in the pr sticky comment served at
20
+ /api/preview/flow-video?id=<share-id>
21
+ --video-duration-ms <ms>
22
+ duration hint for attached flow video
23
+ --sim <sim> target a specific sim (see: sootsim list)
24
+ --open open the resulting /preview/<id> url in the browser
25
+ --assets-only drop API/JSON/HTML records before upload; keep images,
26
+ fonts, css, js, and binary blobs. live-data demos hit
27
+ the real network at replay time instead of serving
28
+ recorded API snapshots
29
+ -h, --help
30
+
31
+ examples:
32
+ sootsim upload
33
+ sootsim upload --origin http://localhost:3000 --open
34
+ sootsim upload --events ./my-session.jsonl.gz
35
+ sootsim upload --video /tmp/soot-flow.webm
36
+ `)}function x(e,t){let r=e.findIndex(o=>o===t);if(r<0)return;let s=e[r+1];return e.splice(r,2),s}function le(e,t){let r=e.findIndex(s=>s===t);return r<0?!1:(e.splice(r,1),!0)}function ue(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 ce(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 Ee(e){return/\.bundle($|\?)/.test(e)||/\.js($|\?)/.test(e)?"application/javascript":/\.zip($|\?)/.test(e)?"application/zip":"application/javascript"}function ze(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 Ae(e,t){let s=[];for(let o=0;o<t;o+=15e5){let a=Math.min(o+15e5,t),u=await T(e,`(window.__sootsimLastTransformedBundle?.text || "").slice(${o}, ${a})`);if(typeof u!="string")return null;s.push(u)}return s.join("")}function V(e){let t=new Map;for(let r of e)t.set(r.urlhash||r.url,r);return Array.from(t.values())}async function Ke(e,t){(e.includes("--help")||e.includes("-h"))&&(ke(),process.exit(0));let r=[...e],s=await Se(x(r,"--origin")),o=$e(s,x(r,"--public-origin")),a=x(r,"--events"),u=x(r,"--video"),B=x(r,"--video-duration-ms"),g=le(r,"--open"),S=le(r,"--assets-only"),y=ee(r,{stripBooleanFlags:[],stripValueFlags:[]}),m=te(y),l,q=[],f=[],z=null;try{if(l=await T(m,'(typeof window.__sootsimCaptureBundle === "function") ? window.__sootsimCaptureBundle() : null'),l?.bundleUrl){let n=new URL(l.bundleUrl).origin,[i,M]=await Promise.all([T(m,`(window.__sootsimPreviewRecorder?.list?.(${JSON.stringify(n)}) || [])`),T(m,`(async () => {
37
+ const list = window.__sootsimListWorkerFetchRecorder
38
+ return typeof list === 'function'
39
+ ? await list(${JSON.stringify(n)})
40
+ : []
41
+ })()`)]);q=V([...i,...M]).filter(d=>{try{return!new URL(d.url).pathname.startsWith("/api/")}catch{return!0}});let R=await T(m,`(async () => {
42
+ const rec = window.__sootsimPreviewRecorder
43
+ const workerList = window.__sootsimListWorkerFetchRecorder
44
+ return {
45
+ main: rec?.list ? rec.list() : [],
46
+ worker: typeof workerList === 'function' ? await workerList() : [],
47
+ }
48
+ })()`),I=(R?V([...R.main,...R.worker]):[]).filter(d=>{try{return new URL(d.url).origin!==n}catch{return!1}}),w=I.length>0?{count:I.length,totalBytes:I.reduce((d,U)=>d+(U.size||0),0)}:null;if(w&&w.count>0){console.log(` ${w.count} recorded cross-origin responses (${(w.totalBytes/1024).toFixed(1)} KiB)`);let d=await T(m,`(async () => {
49
+ const rec = window.__sootsimPreviewRecorder
50
+ const workerDump = window.__sootsimDumpWorkerFetchRecorder
51
+ const bundleUrl = ${JSON.stringify(l.bundleUrl)}
52
+ const keep = (r) => {
53
+ try {
54
+ const u = new URL(r.url)
55
+ if (u.origin !== ${JSON.stringify(n)}) return true
56
+ // bundle-origin api responses came from the rewritten
57
+ // /__app-api proxy at record time (re-keyed by the
58
+ // recorder's unwrap step). they need bodies attached the
59
+ // same way as cross-origin records \u2014 direct re-fetch from
60
+ // the dev server lacks the bundle's session cookies.
61
+ if (r.url !== bundleUrl && u.pathname.startsWith('/api/')) return true
62
+ return false
63
+ } catch { return false }
64
+ }
65
+ return {
66
+ main: rec?.dump ? rec.dump().filter(keep) : [],
67
+ worker: typeof workerDump === 'function'
68
+ ? (await workerDump()).filter(keep)
69
+ : [],
70
+ }
71
+ })()`);if(f=V([...d.main,...d.worker]),S){let U=f.length;f=f.filter(N=>ue(N.contentType));let C=w.totalBytes-f.reduce((N,Te)=>N+(Te.size||0),0);console.log(` --assets-only: kept ${f.length}/${U} records (dropped ${(C/1024).toFixed(1)} KiB of API responses)`)}}}l?.transformedBundle&&(z=await Ae(m,l.transformedBundle.byteLength))}finally{m.close()}l||(console.error(" could not read bundle snapshot \u2014 is sootsim running and is the bundle loaded?"),process.exit(2)),l.bundleUrl||(console.error(` no ?bundle= URL on the current sootsim tab.
72
+ open the app you want to share first (e.g. sootsim open 8082), then run upload.`),process.exit(2));let p,A=!1;if(z!==null)p=new TextEncoder().encode(z),A=!0,console.log(` using post-transform bundle: ${(p.byteLength/1024).toFixed(1)} KiB`);else{let n=ze(l.bundleUrl);n!==l.bundleUrl&&console.log(" forcing lazy=false for self-contained bundle"),console.log(` capturing: ${n}`),p=await ce(n),console.log(` main bundle: ${(p.byteLength/1024).toFixed(1)} KiB`)}let O=q.filter(n=>n.url!==l.bundleUrl);S&&(O=O.filter(n=>ue(n.contentType))),console.log(` fetching ${O.length} extra files\u2026`);let _=(await Promise.all(O.map(async n=>{try{let i=await ce(n.url);return{...n,bytes:i}}catch(i){return console.error(` warning: failed to re-fetch ${n.url}: ${i instanceof Error?i.message:i}`),null}}))).filter(n=>!!n),ge=_.reduce((n,i)=>n+i.bytes.byteLength,0);console.log(` ${_.length} extra files: ${(ge/1024).toFixed(1)} KiB`);let b;a&&(b=ie(a));let h,$,j;if(u){if(h=ie(u),$=u.endsWith(".mp4")?"video/mp4":u.endsWith(".gif")?"image/gif":"video/webm",B){let n=Number(B);(!Number.isFinite(n)||n<=0)&&(console.error(` invalid --video-duration-ms: ${B}`),await v(),process.exit(1)),j=Math.round(n)}console.log(` attaching flow video: ${(h.byteLength/1024).toFixed(1)} KiB (${$})`)}let c=ne(),fe=Q();X({event:"preview_upload_started",identity:{userId:c?.kind==="session"?fe?.user?.id??null:null,repoId:c?.kind==="github"?c.repoId:null,installationId:c?.kind==="github"?c.installationId??null:null},properties:{origin:s,hasAuth:!!c,authMode:c?.kind??"none",bundleBytes:p.byteLength,isTransformed:A,extraFiles:_.length,recordedFetches:f.length,hasEvents:!!b,hasVideo:!!h}}),c||(console.error(" preview uploads need auth."),console.error(" set SOOTSIM_API_KEY=sk_sootsim_..., run `sootsim login`, or use the soot github runner."),await v(),process.exit(1));let he=re(c),ye=(()=>{try{return new URL(l.bundleUrl).origin}catch{return null}})(),G=(n,i,M,R,Y,I,w,d)=>{let U=se(I),C=U?ae(n):n;return{url:i,urlhash:M,method:R,bodyHash:Y,requestVaryHash:d,contentType:I,responseHeaders:w,bytes:C,encoding:U?"gzip":void 0}},L=[..._.map(n=>G(n.bytes,n.url,n.urlhash,"GET","-",n.contentType,n.responseHeaders,n.requestVaryHash)),...f.map(n=>G(Buffer.from(n.bodyBase64,"base64"),n.url,n.urlhash,n.method||"GET",n.bodyHash||"-",n.contentType,n.responseHeaders,n.requestVaryHash))],H=ae(p),me=Re("sha256").update(p).digest("hex");console.log(` bundle raw=${(p.byteLength/1024).toFixed(1)} KiB gz=${(H.byteLength/1024).toFixed(1)} KiB`);let be={contentHash:me,bundleSizeBytes:p.byteLength,bundleContentType:Ee(l.bundleUrl),bundleEncoding:"gzip",bundleOrigin:ye,entry:l.entry,isTransformed:A,deviceSpec:l.deviceSpec,installationId:c.kind==="github"?c.installationId??void 0:void 0,repoId:c.kind==="github"?c.repoId:void 0,files:L.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:b?{sizeBytes:b.byteLength}:void 0,flowVideo:h&&$?{sizeBytes:h.byteLength,contentType:$,durationMs:j}:void 0},J=new Map;for(let n of L)J.set(n.urlhash,n.bytes);let we=Date.now(),k=H.byteLength;for(let n of L)k+=n.bytes.byteLength;b&&(k+=b.byteLength),h&&(k+=h.byteLength);let ve=`${P(s)}/api/preview/upload/init`;console.log(` init: ${ve}`);let F;try{let n=await oe({originBase:s,initBody:be,bundleBytes:H,filesByHash:J,extras:{eventsBytes:b,videoBytes:h},authHeader:he,concurrency:16});F=n.finalize;let i=1+n.init.files.length+(n.init.events?1:0)+(n.init.flowVideo?1:0);console.log(` PUT ${i} objects in ${Date.now()-we}ms (${(k/1024).toFixed(1)} KiB)`)}catch(n){let i=n;i.phase==="init"&&i.status===401&&(console.error(" preview upload requires a valid login."),console.error(" run `sootsim login` and retry."),await v(),process.exit(1)),i.status===402&&(console.error(` ${xe(i.responseText)??"preview uploads require Personal, Team, or an active trial \u2014 upgrade from the billing dialog."}`),await v(),process.exit(1)),console.error(` ${i.message??`${i.phase??"upload"} failed: ${String(n)}`}`),await v(),process.exit(1)}let K=`${o}${F.url}`;console.log(`
73
+ stored ${F.filesStored??0} extra files`),console.log(` preview: ${K}`),g&&await Z(K),await v()}export{Se as a,$e as b,Ke as c};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{c as i,e as d,h as c}from"./chunk-G4VWDOWB.js";function g(r){let e=r[0]?.toLowerCase()??"toggle";return e!=="on"&&e!=="off"&&e!=="toggle"&&(console.error(` unknown argument: "${e}" (expected on | off | toggle)`),process.exit(1)),e}async function u(r,e,t){let l=i(r,{port:e.port}),s=g(l.positional),a=d({...l,commandTimeoutMs:5e3});try{let n=!!(await c(a,"SootSim.bridges.settings.get"))?.[t.modeKey],o=s==="on"?!0:s==="off"?!1:!n;if(n===o)return console.log(` ${t.displayName}: already ${o?"on":"off"}`),{current:n,target:o,changed:!1};if(!await a.send({type:"evaluate",acquireLock:!0,code:`(async () => {
1
+ /*! sootsim v0.1.68 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{c as i,e as d,h as c}from"./chunk-5LDGAVAV.js";function g(r){let e=r[0]?.toLowerCase()??"toggle";return e!=="on"&&e!=="off"&&e!=="toggle"&&(console.error(` unknown argument: "${e}" (expected on | off | toggle)`),process.exit(1)),e}async function u(r,e,t){let l=i(r,{port:e.port}),s=g(l.positional),a=d({...l,commandTimeoutMs:5e3});try{let n=!!(await c(a,"SootSim.bridges.settings.get"))?.[t.modeKey],o=s==="on"?!0:s==="off"?!1:!n;if(n===o)return console.log(` ${t.displayName}: already ${o?"on":"off"}`),{current:n,target:o,changed:!1};if(!await a.send({type:"evaluate",acquireLock:!0,code:`(async () => {
3
3
  const modeKey = ${JSON.stringify(t.modeKey)}
4
4
  const target = ${JSON.stringify(o)}
5
5
  window.dispatchEvent(new CustomEvent('sootsim:shell-command', {
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.68 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import{execFileSync as h,spawn as g}from"child_process";import{existsSync as s,readdirSync as k}from"fs";import{dirname as m,join as l,resolve as a}from"path";import{fileURLToPath as v}from"url";var c;function p(){if(c!==void 0)return c;try{c=m(v(import.meta.resolve("sootsim-engine/package.json")))}catch{c=null}return c}var I="dev.sootsim.simulator";function x(){let n=p();if(!n)return null;let e=l(n,"dist-electron/main.cjs");if(!s(e))return null;let i=D(n);return i?{path:i,platform:process.platform,kind:"dev-electron",engineDir:n}:null}function b(){let n=p();return n?s(l(n,"src-electron/main.ts")):!1}function D(n){let e=n;for(let i=0;i<6;i++){let t=l(e,"node_modules/.bin/electron");if(s(t))return t;let r=m(e);if(r===e)break;e=r}return null}function C(){let n=p(),i=["/Applications/sootsim.app",a(process.env.HOME||"","Applications/sootsim.app"),...n?[a(n,"app/sootsim.app")]:[]].find(t=>s(t));if(i)return{path:i,platform:"darwin",kind:"mac-app"};try{let t=h("mdfind",[`kMDItemCFBundleIdentifier == "${I}"`],{encoding:"utf8",timeout:3e3}).trim();if(t)return{path:t.split(`
3
3
  `)[0],platform:"darwin",kind:"mac-app"}}catch{}return null}function f(n){if(!s(n))return null;let e=k(n).filter(i=>i.startsWith("sootsim")&&i.endsWith(".AppImage")).sort().reverse()[0];return e?l(n,e):null}function w(){let n=p(),i=[a(process.env.HOME||"","Applications/sootsim.AppImage"),a(process.env.HOME||"",".local/bin/sootsim.AppImage"),"/opt/sootsim/sootsim.AppImage","/opt/sootsim/sootsim",...n?[a(n,"app/sootsim.AppImage"),a(n,"release/linux-unpacked/sootsim")]:[]].find(r=>s(r));if(i)return{path:i,platform:"linux",kind:i.endsWith(".AppImage")?"linux-appimage":"linux-binary"};let t=n?f(a(n,"app"))||f(a(n,"release")):null;return t?{path:t,platform:"linux",kind:"linux-appimage"}:null}function A(){let n=x();if(n)return n;if(b()){let e=p(),i=l(e,"dist-electron/main.cjs");return s(i)?console.error(` no node_modules/.bin/electron found near ${e}. run \`bun install\`.`):console.error(` dist-electron/main.cjs missing in ${e}.
4
4
  run: bun run --cwd packages/sootsim-engine build:electron-main
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as R}from"./chunk-M2Q4FXRE.js";import{l as D}from"./chunk-BEQD2DSK.js";import{a as T}from"./chunk-D4VEI6MI.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 y from"node:path";var N=null;function _(){if(N)return N;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||D()}function h(){return _()}function U(){return y.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(y.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(y.resolve(e)).digest("hex").slice(0,16)}function K(){return`s_${G(10).toString("hex")}`}function ge(e){let t=y.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??y.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 ye(){return S().attachedProjects}var Q=336*60*60*1e3;function he(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 t;try{t=(await import("./demo-app-registry-JAYU7BBM.js")).APPS}catch(n){console.warn("[sootsim] seedFromDemoAppRegistry: could not load demo registry:",n.message);return}if(!Array.isArray(t))return;let r=t;w(n=>{for(let o of r){if(!m.existsSync(o.dir))continue;let s=y.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(h(),"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(h(),"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(h(),"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(),P=[...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&&P.push("--codex-bin",e.codexBin),e.claudeBin&&P.push("--claude-bin",e.claudeBin),e.freshThread&&P.push("--fresh-thread"),o&&P.push("--claude-session-uuid",o);let x=V(A,P,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:h()}});x.unref();let E=e.readyTimeoutMs??6e3,b=await ae(d,p=>p.type==="ready"||p.type==="error",E);if(!b||b.type==="error"){if(x.pid)try{process.kill(x.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:x.pid,status:"idle"}),{session:k(s.id),wrapperPid:x.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.68 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as R}from"./chunk-WHJFB6AK.js";import{l as D}from"./chunk-G3WXMB3Z.js";import{a as T}from"./chunk-HC43PTFD.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 y from"node:path";var N=null;function _(){if(N)return N;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||D()}function h(){return _()}function U(){return y.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(y.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(y.resolve(e)).digest("hex").slice(0,16)}function K(){return`s_${G(10).toString("hex")}`}function ge(e){let t=y.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??y.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 ye(){return S().attachedProjects}var Q=336*60*60*1e3;function he(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 t;try{t=(await import("./demo-app-registry-QWOGX5C2.js")).APPS}catch(n){console.warn("[sootsim] seedFromDemoAppRegistry: could not load demo registry:",n.message);return}if(!Array.isArray(t))return;let r=t;w(n=>{for(let o of r){if(!m.existsSync(o.dir))continue;let s=y.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(h(),"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(h(),"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(h(),"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(),P=[...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&&P.push("--codex-bin",e.codexBin),e.claudeBin&&P.push("--claude-bin",e.claudeBin),e.freshThread&&P.push("--fresh-thread"),o&&P.push("--claude-session-uuid",o);let x=V(A,P,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:h()}});x.unref();let E=e.readyTimeoutMs??6e3,b=await ae(d,p=>p.type==="ready"||p.type==="error",E);if(!b||b.type==="error"){if(x.pid)try{process.kill(x.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:x.pid,status:"idle"}),{session:k(s.id),wrapperPid:x.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=h();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,h as b,ge as c,F as d,ye as e,he 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,5 +1,5 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as d}from"./chunk-G4VWDOWB.js";import{a as p,d as w,h as $,j as y}from"./chunk-NCSGLZRV.js";import{A as g,B as f,i as h,y as m,z as a}from"./chunk-BEQD2DSK.js";import b from"fs";import{WebSocket as D}from"ws";async function P(n,e={}){let[o,...t]=n;if(!o||o==="--help"||o==="-h"){R();return}switch(o){case"install":return O(t,e);case"list":case"ls":return S(t);case"use":return T(t);case"remove":case"rm":return N(t);case"which":case"active":return F();default:console.error(` unknown runtime subcommand: ${o}`),R(),process.exit(1)}}function R(){console.log(`
1
+ /*! sootsim v0.1.68 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as d}from"./chunk-5LDGAVAV.js";import{a as p,d as w,h as $,j as y}from"./chunk-OFTI3N27.js";import{A as g,B as f,i as h,y as m,z as a}from"./chunk-G3WXMB3Z.js";import b from"fs";import{WebSocket as D}from"ws";async function P(n,e={}){let[o,...t]=n;if(!o||o==="--help"||o==="-h"){R();return}switch(o){case"install":return O(t,e);case"list":case"ls":return S(t);case"use":return T(t);case"remove":case"rm":return N(t);case"which":case"active":return F();default:console.error(` unknown runtime subcommand: ${o}`),R(),process.exit(1)}}function R(){console.log(`
3
3
  sootsim runtime \u2014 manage engine runtimes under ~/.sootsim/runtimes/
4
4
 
5
5
  usage:
@@ -22,4 +22,4 @@ examples:
22
22
  sootsim runtime install 1.2.3
23
23
  sootsim runtime install --channel beta
24
24
  sootsim runtime use 1.2.3
25
- `)}async function O(n,e){let{version:o,flags:t}=_(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 y({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 k(i.version)}catch(i){console.error(` ${I(i)}`),process.exit(1)}}async function k(n){g(n),console.log(` active: ${n}`),await A(n)||console.log(` (no daemon running \u2014 next sootsim/electron launch will pick up ${n})`)}async function A(n){let{isDaemonLockfileFresh:e,readDaemonLockfile:o}=await import("./home-paths-DCUNA3CD.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 D(`ws://127.0.0.1:${s}`,{handshakeTimeout:800}),v=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(v),u(i)}),r.on("error",()=>{clearTimeout(v),u(!1)})})}async function S(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 $();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: ${I(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 k(e)}async function N(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=h(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 F(){let n=a();if(!n){console.log(" no active runtime");return}console.log(n)}function _(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 I(n){return n instanceof Error?n.message:String(n)}export{P as a};
25
+ `)}async function O(n,e){let{version:o,flags:t}=_(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 y({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 k(i.version)}catch(i){console.error(` ${I(i)}`),process.exit(1)}}async function k(n){g(n),console.log(` active: ${n}`),await A(n)||console.log(` (no daemon running \u2014 next sootsim/electron launch will pick up ${n})`)}async function A(n){let{isDaemonLockfileFresh:e,readDaemonLockfile:o}=await import("./home-paths-NWDFFIX4.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 D(`ws://127.0.0.1:${s}`,{handshakeTimeout:800}),v=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(v),u(i)}),r.on("error",()=>{clearTimeout(v),u(!1)})})}async function S(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 $();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: ${I(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 k(e)}async function N(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=h(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 F(){let n=a();if(!n){console.log(" no active runtime");return}console.log(n)}function _(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 I(n){return n instanceof Error?n.message:String(n)}export{P as a};
@@ -0,0 +1,23 @@
1
+ /*! sootsim v0.1.68 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as k,c as T,e as C}from"./chunk-6453CCSA.js";import{E as v,F as P}from"./chunk-G3WXMB3Z.js";import{WebSocket as I}from"ws";function $(){let e=v();return e&&P(e)?e.bridgePort:7668}var w=class extends Error{lock;constructor(t,i){super(t),this.name="BridgeSimLockedError",this.lock=i}};function F(e){return e==="flag"?"via --sim":e==="saved"?"saved via `sootsim use`":"primary fallback \u2014 no sim pinned"}function R(e,t={}){let i=new Set,d=t.port??$(),a=t.commandTimeoutMs??15e3,r,g="none",p=new Set(t.stripBooleanFlags??[]),y=new Set(t.stripValueFlags??[]);for(let n=0;n<e.length;n++){let l=e[n];if(l==="--port"||l==="-p"){i.add(n),n+1<e.length&&(i.add(n+1),d=Number(e[n+1])),n++;continue}if(l.startsWith("--port=")){i.add(n),d=Number(l.slice(7));continue}if(l==="--timeout"){i.add(n),n+1<e.length&&(i.add(n+1),a=Number(e[n+1])),n++;continue}if(l==="--sim"){i.add(n),n+1<e.length&&(i.add(n+1),r=e[n+1]?.trim()||void 0,g="flag"),n++;continue}if(p.has(l)){i.add(n);continue}y.has(l)&&(i.add(n),n+1<e.length&&i.add(n+1),n++)}if(!r){let n=T();n&&(r=n.trim()||void 0,g="saved")}return{positional:e.filter((n,l)=>!i.has(l)),wsPort:d,simId:r,simIdSource:g,commandTimeoutMs:a}}function W(e,t={}){let i=1,d=t.commandTimeoutMs??15e3,a=new Map,r=new I(`ws://localhost:${e}`),g=t.simId?{key:`sim:${t.simId}`,source:"explicit-sim-id",stable:!0}:k(),p=new Promise((s,o)=>{r.on("open",()=>{try{r.send(JSON.stringify({type:"bridge:hello",id:0,cliIdentityKey:g.key,cliIdentitySource:g.source,cliLabel:t.cliLabel}))}catch{}s()}),r.on("error",c=>{let m=c.message?`: ${c.message}`:"";o(new Error(`could not connect to ws://localhost:${e}${m}`))})}),y=!1,n=!1;function l(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",m=F(o?t.simIdSource:"none");process.stderr.write(` \u2192 ${c} (${m})
3
+ `)}return r.on("message",s=>{let o;try{o=JSON.parse(s.toString())}catch{return}if(o.id===0)return;let c=a.get(o.id);c&&(a.delete(o.id),o.i>0&&!y&&(y=!0,process.stderr.write(`
4
+ \u26A0 ${o.i} other CLI identity/identities are driving this sim
5
+ taps, scrolls, and keyboard input from multiple agents will collide on
6
+ the same screen state (this is not a bridge throughput limit).
7
+ use \`sootsim open --new\` for an isolated sim per agent.
8
+
9
+ `)),o.error?o.o?c.reject(new w(o.error,o.o)):c.reject(new Error(o.error)):c.resolve(o.result))}),r.on("close",(s,o)=>{let c=o?.toString()||"connection closed";for(let[m,u]of a)a.delete(m),u.reject(new Error(`sim disconnected: ${c} (code ${s})`))}),{async send(s,o){let c=o?.timeoutMs??d,m=async u=>{await p;let f=i++;return new Promise((A,S)=>{let B=setTimeout(()=>{a.delete(f),S(new Error(`command timed out after ${Math.round(c/1e3)}s`))},c);a.set(f,{resolve:h=>{clearTimeout(B),A(h)},reject:h=>{clearTimeout(B),S(h)}});let b={...s,id:f};b.simId===void 0&&u&&(b.simId=u),l(s.type??"",b.simId),r.send(JSON.stringify(b))})};try{return await m(t.simId)}catch(u){let f=u instanceof Error?u.message:String(u);throw t.simIdSource==="saved"&&t.simId&&s.simId===void 0&&f===`no sim connected with id ${t.simId}`?(C(),new Error(`saved sim ${t.simId} is gone; run \`sootsim list\` and \`sootsim use <sim>\`, or open a fresh sim`)):u}},async listSims(){let s=await this.send({type:"bridge:list-sims"});return Array.isArray(s)?s:[]},async openUrl(s,o={}){return this.send({type:"bridge:open",url:s,newWindow:o.newWindow===!0})},async focusSim(s){return this.send({type:"focus",simId:s})},async closeSim(s){return this.send({type:"close",simId:s})},async claim(s,o={}){return await this.send({type:"bridge:claim",simId:s,force:o.force===!0})},close(){try{r.readyState===I.OPEN&&r.send(JSON.stringify({type:"bridge:bye",id:0}))}catch{}r.close();let s=setTimeout(()=>{r.readyState!==I.CLOSED&&r.terminate()},250)}}}function V(e){return W(e.wsPort,{commandTimeoutMs:e.commandTimeoutMs,simId:e.simId,simIdSource:e.simIdSource})}function E(e,t){let i=e.filter(r=>r.readyState==="open"&&r.id!==t),d=i.find(r=>r.userFocused)??i.find(r=>r.userVisible===!0&&r.isPrimary)??i.find(r=>r.userVisible===!0)??i.find(r=>r.isPrimary);if(!d)return null;let a=[d.isPrimary?"primary":null,d.userVisible===!1?"hidden":d.userVisible===!0?"visible":null,d.userFocused?"focused":null].filter(Boolean);return`${d.id}${a.length?` [${a.join(", ")}]`:""}`}async function _(e){try{let t=await e.send({type:"evaluate",code:`(() => ({
10
+ hidden: document.hidden,
11
+ visibilityState: document.visibilityState,
12
+ hasFocus: typeof document.hasFocus === 'function' ? document.hasFocus() : null,
13
+ simId: window.__sootsimBridge?.id ?? window.SootSim?.state?.simId ?? null,
14
+ url: location.href
15
+ }))()`}),i=typeof t=="object"&&t!==null?t:{hidden:t===!0};if(i.hidden===!0===!0){let a=null;try{a=E(await e.listSims(),i.simId)}catch{}return process.stderr.write(`
16
+ \u26A0 target sim${i.simId?` ${i.simId}`:""} is hidden (document.hidden = true)
17
+ `+(i.visibilityState?` visibility: ${i.visibilityState}
18
+ `:"")+` animations and rAF callbacks are throttled \u2014 coordinates may be wrong
19
+ and launch/transition animations will not complete.
20
+ `+(a?` another open sim looks usable: ${a}; target it with --sim.
21
+ `:" run `sootsim list` to find the visible sim and target it with --sim.\n")+` page-level window.focus() cannot unhide a browser tab.
22
+
23
+ `),{hidden:!0,warned:!0,simId:i.simId}}return{hidden:!1,warned:!1,simId:i.simId}}catch{return{hidden:!1,warned:!1}}}async function j(e,t,i={}){let d={type:"evaluate",code:t};return i.acquireLock&&(d.acquireLock=!0),e.send(d)}async function D(e,t,...i){return e.send({type:"call",path:t,args:i})}async function q(e,t,...i){return e.send({type:"call",path:t,args:i,acquireLock:!0})}export{$ as a,w as b,R as c,W as d,V as e,_ as f,j as g,D as h,q as i};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{g as w,i as u,j as m,k as l}from"./chunk-FXF2FHPI.js";var p="sootsim:settings",v=["errorReporting","colorScheme","a11yMode","a11yDepth","screenshotCanvas","screenshotBackground","screenshotText","screenshotPose","screenshotDynamicSize","agentProvider","onboardingComplete","betaConsentVersion","detailedTelemetry"];function S(){if(typeof window>"u")return null;let e=window.sootsimElectron;return e&&typeof e=="object"?e:null}function 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 k(){if(typeof window>"u")return null;let e=window.__sootsimSharedConfig;return e&&typeof e=="object"?e:null}function j(){let e=k()?.settings;return!e||typeof e!="object"?{}:g(e)}function D(e){if(!k())return;let t={settings:h(e)};try{if(globalThis.__sootsimBridgeRequest?.writeSharedConfig?.(t))return}catch{}if(!(typeof fetch>"u"))try{fetch("/__sootsim/shared-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0}).catch(()=>{})}catch{}}function b(){let e=_(),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=b();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.68 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{g as w,i as u,j as m,k as l}from"./chunk-6JGI2JVM.js";var p="sootsim:settings",v=["errorReporting","colorScheme","a11yMode","a11yDepth","screenshotCanvas","screenshotBackground","screenshotText","screenshotPose","screenshotDynamicSize","agentProvider","onboardingComplete","betaConsentVersion","detailedTelemetry"];function S(){if(typeof window>"u")return null;let e=window.sootsimElectron;return e&&typeof e=="object"?e:null}function 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 k(){if(typeof window>"u")return null;let e=window.__sootsimSharedConfig;return e&&typeof e=="object"?e:null}function j(){let e=k()?.settings;return!e||typeof e!="object"?{}:g(e)}function D(e){if(!k())return;let t={settings:h(e)};try{if(globalThis.__sootsimBridgeRequest?.writeSharedConfig?.(t))return}catch{}if(!(typeof fetch>"u"))try{fetch("/__sootsim/shared-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0}).catch(()=>{})}catch{}}function b(){let e=_(),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=b();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};
@@ -0,0 +1,23 @@
1
+ /*! sootsim v0.1.68 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as r}from"./chunk-ZP7YYRHI.js";import{a as s,b as i,c as l}from"./chunk-U7KUAZJB.js";import{a as t}from"./chunk-6TQ2IBH6.js";import{a as u,d}from"./chunk-YSDIOWNN.js";import{a as p}from"./chunk-QYFPV5YO.js";import{z as m}from"./chunk-G3WXMB3Z.js";function a(){let o=m();return`sootsim CLI v${p()} \xB7 runtime ${o?`v${o}`:"not installed"}`}function S(){let o=i({bridgePort:7668,defaultShellUrl:t},r()),e=`
3
+ ${d}
4
+ `;console.log(`${a()}
5
+ ${e}${o}
6
+
7
+ auth:
8
+ sootsim login sign in for desktop uploads
9
+ sootsim logout clear the shared desktop session
10
+ sootsim whoami show the current shared desktop account
11
+ `)}function $(o){let e=s(o,{bridgePort:7668,defaultShellUrl:t},r());return e?(console.log(`${e}
12
+ `),!0):!1}function c(o){if(o==="3d-mode"){c("three-mode");return}if(o==="login"){console.log(`sootsim login
13
+
14
+ sign in for desktop uploads using the shared desktop session.
15
+ opens the browser and stores the resulting bearer token for both the CLI and electron.
16
+ `);return}if(o==="logout"){console.log(`sootsim logout
17
+
18
+ clear the shared desktop session used by the CLI and electron.
19
+ `);return}if(o==="whoami"){console.log(`sootsim whoami
20
+
21
+ show the current shared desktop account used by the CLI and electron.
22
+ `);return}let e=l(o,{bridgePort:7668,defaultShellUrl:t});if(!e){console.log(`unknown command: ${o}`);return}console.log(`${e}
23
+ `)}export{S as a,$ as b,c};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.68 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import{existsSync as C,mkdirSync as D,readFileSync as O,rmSync as s,writeFileSync as g}from"fs";import{tmpdir as P}from"os";import{dirname as R,join as A,resolve as x}from"path";import{execFileSync as a}from"child_process";import{readFileSync as I}from"fs";import{createRequire as S}from"module";var o=null;function u(r){o||(o=_());try{return o(r)}catch{return null}}function _(){let r=Number(process.env.PPID);if(Number.isFinite(r)&&r>1&&r!==process.ppid)return()=>r;if(process.platform==="linux")return y();if(process.platform==="darwin"){let n=E();return n||T()}return()=>null}function y(){return r=>{try{let n=I(`/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 N=3,d=216,b=16;function E(){if(!process.versions?.bun)return null;try{let r=S(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 m=>{if(Number(i.symbols.proc_pidinfo(m,N,0n,e,d))<=0)return null;let p=e.readUInt32LE(b);return p>0?p:null}}catch{return null}}function T(){return r=>{try{let t=a("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",v=["SOOTSIM_CLI_IDENTITY","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 F(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 v){let t=process.env[n];if(t&&t.trim())return{key:`${n}:${t.trim()}`,source:n,stable:!0}}let r=F(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 l(){if(process.env[f])return x(process.env[f]);let r=L();return A(P(),`sootsim-current-sim-${r}.json`)}function h(){let r=l();if(!C(r))return null;try{let n=JSON.parse(O(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 j(r){let n=r.trim();if(!n)return;let t=l();D(R(t),{recursive:!0}),g(t,JSON.stringify({version:c,simId:n,updatedAt:new Date().toISOString()},null,2)+`
4
4
  `)}function K(){s(l(),{force:!0})}export{k as a,L as b,J as c,j as d,K as e};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- var o={width:3,lock:{top:253,height:103},ringToggle:{top:152,height:32},volumeUp:{top:214,height:61},volumeDown:{top:290,height:61}},m={width:2.5,lock:{top:130,height:78},ringToggle:{top:94,height:22},volumeUp:{top:126,height:48},volumeDown:{top:188,height:48}},d={width:3,lock:{top:238,height:78},ringToggle:{top:-1e3,height:0},volumeUp:{top:336,height:62},volumeDown:{top:408,height:62}},p={width:3,lock:{top:248,height:72},ringToggle:{top:-1e3,height:0},volumeUp:{top:144,height:62},volumeDown:{top:216,height:62}},a=48;function t(e){return{...e,platform:"ios",navigationBarHeight:0,navigationBarMode:e.homeIndicatorHeight>0?"gesture":"none",displayCutout:{top:e.dynamicIsland?e.statusBarHeight:0,bottom:0,left:0,right:0},cameraCutout:null,osVersion:e.iosVersion,androidApiLevel:null,systemName:"iOS",manufacturer:"Apple",brand:"Apple",modelName:e.name}}var h={"iphone-se":t({name:"iPhone SE",width:375,height:667,scale:2,statusBarHeight:20,homeIndicatorHeight:0,cornerRadius:0,dynamicIsland:null,safeAreaInsets:{top:20,bottom:0,left:0,right:0},iosVersion:"15.8",physicalPPI:326,hardwareButtons:m}),"iphone-14":t({name:"iPhone 14",width:390,height:844,scale:3,statusBarHeight:47,homeIndicatorHeight:34,cornerRadius:55,dynamicIsland:null,safeAreaInsets:{top:47,bottom:34,left:0,right:0},iosVersion:"17.6",physicalPPI:460,hardwareButtons:o}),"iphone-15":t({name:"iPhone 15",width:393,height:852,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:37.3},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"17.6",physicalPPI:460,hardwareButtons:o}),"iphone-15-plus":t({name:"iPhone 15 Plus",width:430,height:932,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:37.3},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"17.6",physicalPPI:460,hardwareButtons:o}),"iphone-15-pro":t({name:"iPhone 15 Pro",width:393,height:852,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:38},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"18.2",physicalPPI:460,hardwareButtons:o}),"iphone-15-pro-max":t({name:"iPhone 15 Pro Max",width:430,height:932,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:38},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"18.2",physicalPPI:460,hardwareButtons:o}),"iphone-16":t({name:"iPhone 16",width:393,height:852,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:37.3},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o}),"iphone-16-plus":t({name:"iPhone 16 Plus",width:430,height:932,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:37.3},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o}),"iphone-16-pro":t({name:"iPhone 16 Pro",width:402,height:874,scale:3,statusBarHeight:62,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:38},safeAreaInsets:{top:62,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o}),"iphone-16-pro-max":t({name:"iPhone 16 Pro Max",width:440,height:956,scale:3,statusBarHeight:62,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:38},safeAreaInsets:{top:62,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o}),"iphone-17":t({name:"iPhone 17",width:402,height:874,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:37.3},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o}),"iphone-17-air":t({name:"iPhone 17 Air",width:430,height:932,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:38},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o}),"iphone-17-pro":t({name:"iPhone 17 Pro",width:402,height:874,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:38},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o}),"iphone-17-pro-max":t({name:"iPhone 17 Pro Max",width:440,height:956,scale:3,statusBarHeight:62,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:38},safeAreaInsets:{top:62,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o}),"ipad-pro-13":t({name:'iPad Pro 13"',width:1032,height:1376,scale:2,statusBarHeight:24,homeIndicatorHeight:20,cornerRadius:18,dynamicIsland:null,safeAreaInsets:{top:24,bottom:20,left:0,right:0},iosVersion:"18.2",physicalPPI:264,hardwareButtons:o}),"pixel-8":{platform:"android",name:"Pixel 8",width:412,height:915,scale:2.625,statusBarHeight:40,homeIndicatorHeight:0,navigationBarHeight:a,navigationBarMode:"gesture",displayCutout:{top:40,bottom:0,left:0,right:0},cornerRadius:39,dynamicIsland:null,cameraCutout:{diameter:24},safeAreaInsets:{top:40,bottom:a,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Google",brand:"google",modelName:"Pixel 8",physicalPPI:428,hardwareButtons:d},"pixel-8-three-button":{platform:"android",name:"Pixel 8 (3-button)",width:412,height:915,scale:2.625,statusBarHeight:40,homeIndicatorHeight:0,navigationBarHeight:48,navigationBarMode:"three-button",displayCutout:{top:40,bottom:0,left:0,right:0},cornerRadius:39,dynamicIsland:null,cameraCutout:{diameter:24},safeAreaInsets:{top:40,bottom:48,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Google",brand:"google",modelName:"Pixel 8",physicalPPI:428,hardwareButtons:d},"pixel-9-pro-xl":{platform:"android",name:"Pixel 9 Pro XL",width:448,height:997,scale:3,statusBarHeight:40,homeIndicatorHeight:0,navigationBarHeight:a,navigationBarMode:"gesture",displayCutout:{top:40,bottom:0,left:0,right:0},cornerRadius:41,dynamicIsland:null,cameraCutout:{diameter:24},safeAreaInsets:{top:40,bottom:a,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Google",brand:"google",modelName:"Pixel 9 Pro XL",physicalPPI:486,hardwareButtons:d},"galaxy-s24":{platform:"android",name:"Galaxy S24",width:360,height:780,scale:3,statusBarHeight:36,homeIndicatorHeight:0,navigationBarHeight:a,navigationBarMode:"gesture",displayCutout:{top:36,bottom:0,left:0,right:0},cornerRadius:36,dynamicIsland:null,cameraCutout:{diameter:18},safeAreaInsets:{top:36,bottom:a,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Samsung",brand:"samsung",modelName:"SM-S921B",physicalPPI:416,hardwareButtons:p},"galaxy-s24-ultra":{platform:"android",name:"Galaxy S24 Ultra",width:384,height:824,scale:3.75,statusBarHeight:36,homeIndicatorHeight:0,navigationBarHeight:a,navigationBarMode:"gesture",displayCutout:{top:36,bottom:0,left:0,right:0},cornerRadius:24,dynamicIsland:null,cameraCutout:{diameter:18},safeAreaInsets:{top:36,bottom:a,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Samsung",brand:"samsung",modelName:"SM-S928B",physicalPPI:505,hardwareButtons:p}},u="iphone-17-pro";function b(e){return h[e]}function g(){return Object.keys(h)}var n={"iphone-6-9":{name:"iphone-6-9",label:'iPhone 6.7"',width:1284,height:2778,store:"apple"},"iphone-6-1":{name:"iphone-6-1",label:'iPhone 6.5"',width:1242,height:2688,store:"apple"},"ipad-13":{name:"ipad-13",label:'iPad 13"',width:2064,height:2752,store:"apple"},"android-phone":{name:"android-phone",label:"Google Play phone",width:1080,height:1920,store:"google"},"android-tablet-7":{name:"android-tablet-7",label:'Google Play 7" tablet',width:1200,height:1920,store:"google"},"android-tablet-10":{name:"android-tablet-10",label:'Google Play 10" tablet',width:1600,height:2560,store:"google"}},s={dark:{type:"gradient",direction:180,glow:"#4caeff",stops:[{offset:0,color:"#111827"},{offset:40,color:"#101725"},{offset:100,color:"#06080d"}]},cyan:{type:"gradient",direction:180,glow:"#25c3ec",stops:[{offset:0,color:"#1b465c"},{offset:32,color:"#122336"},{offset:100,color:"#05070b"}]},gold:{type:"gradient",direction:180,glow:"#ffc25a",stops:[{offset:0,color:"#3b2f1a"},{offset:34,color:"#18140d"},{offset:100,color:"#050505"}]},red:{type:"gradient",direction:180,glow:"#ff6178",stops:[{offset:0,color:"#3e1018"},{offset:35,color:"#17080c"},{offset:100,color:"#050405"}]}},S={color:"#25c3ec",blur:120,spread:52,opacity:.34},P="iphone-17-pro";function v(e){return Object.prototype.hasOwnProperty.call(n,e)?n[e]:null}function f(e){return{type:e.type,color:e.color,direction:e.direction,glow:e.glow,stops:e.stops?.map(r=>({...r}))}}function x(e){return Object.prototype.hasOwnProperty.call(s,e)?f(s[e]):null}var c={deviceModel:{type:"enum",default:u,description:"device model to simulate",cliFlag:"device",cliFlagShort:"d",options:g(),group:"device"},orientation:{type:"enum",default:"portrait",description:"screen orientation",cliFlag:"orientation",options:["portrait","landscape"],group:"device"},colorScheme:{type:"enum",default:"auto",description:"color scheme (auto follows system preference)",cliFlag:"theme",cliFlagShort:"t",options:["light","dark","auto"],group:"appearance"},reduceMotion:{type:"boolean",default:!1,description:"reduce motion",group:"appearance"},boldText:{type:"boolean",default:!1,description:"bold text",group:"appearance"},fontSize:{type:"number",default:1,description:"font size multiplier (1.0 = default)",group:"appearance",validate:e=>e>=.5&&e<=2},networkCondition:{type:"enum",default:"wifi",description:"simulated network condition",cliFlag:"network",options:["wifi","lte","fast-3g","slow-3g","offline"],group:"network"},language:{type:"string",default:"en",description:"language code (ISO 639-1)",cliFlag:"language",group:"locale"},region:{type:"string",default:"US",description:"region code (ISO 3166-1)",cliFlag:"region",group:"locale"},showTouches:{type:"boolean",default:!1,description:"show touch indicators",group:"simulator"},showFrame:{type:"boolean",default:!0,description:"show device frame",cliFlag:"frame",group:"simulator"},showTopBar:{type:"boolean",default:!0,description:"show simulator top bar",group:"simulator"},screenshotMode:{type:"boolean",default:!1,description:"show screenshot composition mode in the browser shell",group:"simulator"},threeMode:{type:"boolean",default:!1,description:"show the experimental 3d device stage in the browser shell",group:"simulator"},threeRecordingEditor:{type:"boolean",default:!1,description:"dock the 3d recording editor in the 3d stage (toggled from its rail)",group:"simulator"},screenshotCanvas:{type:"enum",default:"iphone-6-9",description:"target app-store canvas preset for screenshot mode",options:Object.keys(n),group:"simulator"},screenshotBackground:{type:"enum",default:"dark",description:"background preset rendered inside the screenshot canvas",options:Object.keys(s),group:"simulator"},screenshotText:{type:"enum",default:"bold-top",description:"text layout preset for the screenshot canvas",options:["bold-top","editorial-left","minimal-bottom","none"],group:"simulator"},screenshotPose:{type:"enum",default:"straight",description:"device pose preset inside the screenshot canvas",options:["straight","tilted-left","tilted-right","cut-bottom","cut-top"],group:"simulator"},screenshotDynamicSize:{type:"boolean",default:!1,description:"let the screenshot canvas rect fit available space (off = pin to exact preset pixels)",group:"simulator"},showStatusBar:{type:"boolean",default:!0,description:"show status bar",group:"simulator"},showHomeIndicator:{type:"boolean",default:!0,description:"show home indicator",group:"simulator"},a11yMode:{type:"enum",default:"delayed",description:"accessibility tree sync mode (off, delayed=100ms, active=30ms)",options:["off","delayed","active"],group:"simulator"},a11yDepth:{type:"enum",default:"deep",description:"accessibility tree structure depth (shallow or deep)",options:["shallow","deep"],group:"simulator"},inspectMode:{type:"boolean",default:!1,description:"inspect mode",group:"simulator"},errorReporting:{type:"boolean",default:!1,description:"send anonymous crash reports",group:"privacy"},agentProvider:{type:"enum",default:"codex",description:"ai agent used by the sootsim agent prompt bar",options:["codex","claude"],group:"agent"},onboardingComplete:{type:"boolean",default:!1,description:"first-run onboarding completed",group:"beta"},betaConsentVersion:{type:"number",default:0,description:"last accepted beta telemetry policy version",group:"beta"},detailedTelemetry:{type:"boolean",default:!0,description:"send detailed usage telemetry (sessions, perf samples)",group:"beta"}};function y(){if(typeof window>"u")return{};let e={};try{let r=new URLSearchParams(window.location.search),i=r.get("device");i&&c.deviceModel.options?.includes(i)&&(e.deviceModel=i);let l=r.get("colorScheme")??r.get("theme");l&&c.colorScheme.options?.includes(l)&&(e.colorScheme=l)}catch{}return e}function H(){let e={};for(let[r,i]of Object.entries(c))e[r]=i.default;return Object.assign(e,y()),e}export{S as a,P as b,v as c,f as d,x as e,h as f,b as g,g as h,c as i,y as j,H as k};
1
+ /*! sootsim v0.1.68 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ var o={width:3,lock:{top:253,height:103},ringToggle:{top:152,height:32},volumeUp:{top:214,height:61},volumeDown:{top:290,height:61}},m={width:2.5,lock:{top:130,height:78},ringToggle:{top:94,height:22},volumeUp:{top:126,height:48},volumeDown:{top:188,height:48}},c={width:3,lock:{top:238,height:78},ringToggle:{top:-1e3,height:0},volumeUp:{top:336,height:62},volumeDown:{top:408,height:62}},p={width:3,lock:{top:248,height:72},ringToggle:{top:-1e3,height:0},volumeUp:{top:144,height:62},volumeDown:{top:216,height:62}},r=48;function t(e){return{...e,platform:"ios",navigationBarHeight:0,navigationBarMode:e.homeIndicatorHeight>0?"gesture":"none",displayCutout:{top:e.dynamicIsland?e.statusBarHeight:0,bottom:0,left:0,right:0},cameraCutout:null,osVersion:e.iosVersion,androidApiLevel:null,systemName:"iOS",manufacturer:"Apple",brand:"Apple",modelName:e.name}}var h={"iphone-se":t({name:"iPhone SE",width:375,height:667,scale:2,statusBarHeight:20,homeIndicatorHeight:0,cornerRadius:0,dynamicIsland:null,safeAreaInsets:{top:20,bottom:0,left:0,right:0},iosVersion:"15.8",physicalPPI:326,hardwareButtons:m}),"iphone-14":t({name:"iPhone 14",width:390,height:844,scale:3,statusBarHeight:47,homeIndicatorHeight:34,cornerRadius:55,dynamicIsland:null,safeAreaInsets:{top:47,bottom:34,left:0,right:0},iosVersion:"17.6",physicalPPI:460,hardwareButtons:o}),"iphone-15":t({name:"iPhone 15",width:393,height:852,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:37.3},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"17.6",physicalPPI:460,hardwareButtons:o}),"iphone-15-plus":t({name:"iPhone 15 Plus",width:430,height:932,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:37.3},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"17.6",physicalPPI:460,hardwareButtons:o}),"iphone-15-pro":t({name:"iPhone 15 Pro",width:393,height:852,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:38},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"18.2",physicalPPI:460,hardwareButtons:o}),"iphone-15-pro-max":t({name:"iPhone 15 Pro Max",width:430,height:932,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:38},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"18.2",physicalPPI:460,hardwareButtons:o}),"iphone-16":t({name:"iPhone 16",width:393,height:852,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:37.3},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o}),"iphone-16-plus":t({name:"iPhone 16 Plus",width:430,height:932,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:37.3},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o}),"iphone-16-pro":t({name:"iPhone 16 Pro",width:402,height:874,scale:3,statusBarHeight:62,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:38},safeAreaInsets:{top:62,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o}),"iphone-16-pro-max":t({name:"iPhone 16 Pro Max",width:440,height:956,scale:3,statusBarHeight:62,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:38},safeAreaInsets:{top:62,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o}),"iphone-17":t({name:"iPhone 17",width:402,height:874,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:37.3},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o}),"iphone-17-air":t({name:"iPhone 17 Air",width:430,height:932,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:38},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o}),"iphone-17-pro":t({name:"iPhone 17 Pro",width:402,height:874,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:38},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o}),"iphone-17-pro-max":t({name:"iPhone 17 Pro Max",width:440,height:956,scale:3,statusBarHeight:62,homeIndicatorHeight:34,cornerRadius:58,dynamicIsland:{width:126,height:38},safeAreaInsets:{top:62,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o}),"ipad-pro-13":t({name:'iPad Pro 13"',width:1032,height:1376,scale:2,statusBarHeight:24,homeIndicatorHeight:20,cornerRadius:18,dynamicIsland:null,safeAreaInsets:{top:24,bottom:20,left:0,right:0},iosVersion:"18.2",physicalPPI:264,hardwareButtons:o}),"pixel-8":{platform:"android",name:"Pixel 8",width:412,height:915,scale:2.625,statusBarHeight:40,homeIndicatorHeight:0,navigationBarHeight:r,navigationBarMode:"gesture",displayCutout:{top:40,bottom:0,left:0,right:0},cornerRadius:39,dynamicIsland:null,cameraCutout:{diameter:24},safeAreaInsets:{top:40,bottom:r,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Google",brand:"google",modelName:"Pixel 8",physicalPPI:428,hardwareButtons:c},"pixel-8-three-button":{platform:"android",name:"Pixel 8 (3-button)",width:412,height:915,scale:2.625,statusBarHeight:40,homeIndicatorHeight:0,navigationBarHeight:48,navigationBarMode:"three-button",displayCutout:{top:40,bottom:0,left:0,right:0},cornerRadius:39,dynamicIsland:null,cameraCutout:{diameter:24},safeAreaInsets:{top:40,bottom:48,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Google",brand:"google",modelName:"Pixel 8",physicalPPI:428,hardwareButtons:c},"pixel-9-pro-xl":{platform:"android",name:"Pixel 9 Pro XL",width:448,height:997,scale:3,statusBarHeight:40,homeIndicatorHeight:0,navigationBarHeight:r,navigationBarMode:"gesture",displayCutout:{top:40,bottom:0,left:0,right:0},cornerRadius:41,dynamicIsland:null,cameraCutout:{diameter:24},safeAreaInsets:{top:40,bottom:r,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Google",brand:"google",modelName:"Pixel 9 Pro XL",physicalPPI:486,hardwareButtons:c},"galaxy-s24":{platform:"android",name:"Galaxy S24",width:360,height:780,scale:3,statusBarHeight:36,homeIndicatorHeight:0,navigationBarHeight:r,navigationBarMode:"gesture",displayCutout:{top:36,bottom:0,left:0,right:0},cornerRadius:36,dynamicIsland:null,cameraCutout:{diameter:18},safeAreaInsets:{top:36,bottom:r,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Samsung",brand:"samsung",modelName:"SM-S921B",physicalPPI:416,hardwareButtons:p},"galaxy-s24-ultra":{platform:"android",name:"Galaxy S24 Ultra",width:384,height:824,scale:3.75,statusBarHeight:36,homeIndicatorHeight:0,navigationBarHeight:r,navigationBarMode:"gesture",displayCutout:{top:36,bottom:0,left:0,right:0},cornerRadius:24,dynamicIsland:null,cameraCutout:{diameter:18},safeAreaInsets:{top:36,bottom:r,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Samsung",brand:"samsung",modelName:"SM-S928B",physicalPPI:505,hardwareButtons:p}},u="iphone-17-pro";function S(e){return h[e]}function g(){return Object.keys(h)}var i={"iphone-6-9":{name:"iphone-6-9",label:'iPhone 6.7"',width:1284,height:2778,store:"apple"},"iphone-6-1":{name:"iphone-6-1",label:'iPhone 6.5"',width:1242,height:2688,store:"apple"},"ipad-13":{name:"ipad-13",label:'iPad 13"',width:2064,height:2752,store:"apple"},"android-phone":{name:"android-phone",label:"Google Play phone",width:1080,height:1920,store:"google"},"android-tablet-7":{name:"android-tablet-7",label:'Google Play 7" tablet',width:1200,height:1920,store:"google"},"android-tablet-10":{name:"android-tablet-10",label:'Google Play 10" tablet',width:1600,height:2560,store:"google"}},s={dark:{type:"gradient",direction:180,glow:"#4caeff",stops:[{offset:0,color:"#111827"},{offset:40,color:"#101725"},{offset:100,color:"#06080d"}]},cyan:{type:"gradient",direction:180,glow:"#25c3ec",stops:[{offset:0,color:"#1b465c"},{offset:32,color:"#122336"},{offset:100,color:"#05070b"}]},gold:{type:"gradient",direction:180,glow:"#ffc25a",stops:[{offset:0,color:"#3b2f1a"},{offset:34,color:"#18140d"},{offset:100,color:"#050505"}]},red:{type:"gradient",direction:180,glow:"#ff6178",stops:[{offset:0,color:"#3e1018"},{offset:35,color:"#17080c"},{offset:100,color:"#050405"}]}},v={color:"#25c3ec",blur:120,spread:52,opacity:.34},w="iphone-17-pro";var f=[{name:"white",value:"#ffffff"},{name:"gray-light",value:"#d1d5db"},{name:"gray",value:"#6b7280"},{name:"gray-dark",value:"#3b4350"},{name:"slate",value:"#2a3644"},{name:"black",value:"#000000"},{name:"cyan",value:"#25c3ec"},{name:"blue",value:"#3f7cff"},{name:"teal",value:"#1fc7b4"},{name:"green",value:"#42c95d"},{name:"lime",value:"#92d21b"},{name:"gold",value:"#f5c518"},{name:"orange",value:"#ff912e"},{name:"coral",value:"#ff6f5b"},{name:"red",value:"#ff4f6f"},{name:"berry",value:"#d054ff"},{name:"magenta",value:"#ff4eb8"}],B=Object.fromEntries(f.map(e=>[e.name,e.value]));function x(e){return Object.prototype.hasOwnProperty.call(i,e)?i[e]:null}function b(e){return{type:e.type,color:e.color,direction:e.direction,glow:e.glow,stops:e.stops?.map(n=>({...n}))}}function I(e){return Object.prototype.hasOwnProperty.call(s,e)?b(s[e]):null}var d={deviceModel:{type:"enum",default:u,description:"device model to simulate",cliFlag:"device",cliFlagShort:"d",options:g(),group:"device"},orientation:{type:"enum",default:"portrait",description:"screen orientation",cliFlag:"orientation",options:["portrait","landscape"],group:"device"},colorScheme:{type:"enum",default:"auto",description:"color scheme (auto follows system preference)",cliFlag:"theme",cliFlagShort:"t",options:["light","dark","auto"],group:"appearance"},reduceMotion:{type:"boolean",default:!1,description:"reduce motion",group:"appearance"},boldText:{type:"boolean",default:!1,description:"bold text",group:"appearance"},fontSize:{type:"number",default:1,description:"font size multiplier (1.0 = default)",group:"appearance",validate:e=>e>=.5&&e<=2},networkCondition:{type:"enum",default:"wifi",description:"simulated network condition",cliFlag:"network",options:["wifi","lte","fast-3g","slow-3g","offline"],group:"network"},language:{type:"string",default:"en",description:"language code (ISO 639-1)",cliFlag:"language",group:"locale"},region:{type:"string",default:"US",description:"region code (ISO 3166-1)",cliFlag:"region",group:"locale"},showTouches:{type:"boolean",default:!1,description:"show touch indicators",group:"simulator"},showFrame:{type:"boolean",default:!0,description:"show device frame",cliFlag:"frame",group:"simulator"},showTopBar:{type:"boolean",default:!0,description:"show simulator top bar",group:"simulator"},screenshotMode:{type:"boolean",default:!1,description:"show screenshot composition mode in the browser shell",group:"simulator"},threeMode:{type:"boolean",default:!1,description:"show the experimental 3d device stage in the browser shell",group:"simulator"},threeRecordingEditor:{type:"boolean",default:!1,description:"dock the 3d recording editor in the 3d stage (toggled from its rail)",group:"simulator"},screenshotCanvas:{type:"enum",default:"iphone-6-9",description:"target app-store canvas preset for screenshot mode",options:Object.keys(i),group:"simulator"},screenshotBackground:{type:"enum",default:"dark",description:"background preset rendered inside the screenshot canvas",options:Object.keys(s),group:"simulator"},screenshotText:{type:"enum",default:"bold-top",description:"text layout preset for the screenshot canvas",options:["bold-top","editorial-left","minimal-bottom","none"],group:"simulator"},screenshotPose:{type:"enum",default:"straight",description:"device pose preset inside the screenshot canvas",options:["straight","tilted-left","tilted-right","cut-bottom","cut-top"],group:"simulator"},screenshotDynamicSize:{type:"boolean",default:!1,description:"let the screenshot canvas rect fit available space (off = pin to exact preset pixels)",group:"simulator"},showStatusBar:{type:"boolean",default:!0,description:"show status bar",group:"simulator"},showHomeIndicator:{type:"boolean",default:!0,description:"show home indicator",group:"simulator"},a11yMode:{type:"enum",default:"delayed",description:"accessibility tree sync mode (off, delayed=100ms, active=30ms)",options:["off","delayed","active"],group:"simulator"},a11yDepth:{type:"enum",default:"deep",description:"accessibility tree structure depth (shallow or deep)",options:["shallow","deep"],group:"simulator"},inspectMode:{type:"boolean",default:!1,description:"inspect mode",group:"simulator"},errorReporting:{type:"boolean",default:!1,description:"send anonymous crash reports",group:"privacy"},agentProvider:{type:"enum",default:"codex",description:"ai agent used by the sootsim agent prompt bar",options:["codex","claude"],group:"agent"},onboardingComplete:{type:"boolean",default:!1,description:"first-run onboarding completed",group:"beta"},betaConsentVersion:{type:"number",default:0,description:"last accepted beta telemetry policy version",group:"beta"},detailedTelemetry:{type:"boolean",default:!0,description:"send detailed usage telemetry (sessions, perf samples)",group:"beta"}};function y(){if(typeof window>"u")return{};let e={};try{let n=new URLSearchParams(window.location.search),a=n.get("device");a&&d.deviceModel.options?.includes(a)&&(e.deviceModel=a);let l=n.get("colorScheme")??n.get("theme");l&&d.colorScheme.options?.includes(l)&&(e.colorScheme=l)}catch{}return e}function R(){let e={};for(let[n,a]of Object.entries(d))e[n]=a.default;return Object.assign(e,y()),e}export{v as a,w as b,x as c,b as d,I as e,h as f,S as g,g as h,d as i,y as j,R as k};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.68 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ var t="http://localhost:5173/";export{t as a};
@@ -0,0 +1,186 @@
1
+ /*! sootsim v0.1.68 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as u,b as f}from"./chunk-3NNUNABL.js";import{a as p,c as h}from"./chunk-C3R25CWY.js";import{a as c,b as m,c as d}from"./chunk-K6N6DEL5.js";function T(){let e=c();return e?{available:!0,reason:null,detail:e}:{available:!1,reason:"no chromium-family browser found (chrome, chromium, edge, brave, arc)"}}async function O(e){if(e.headless)return{launched:!1,message:"the chromium driver launches a visible browser window and cannot run headless \u2014 a headless `chrome --headless=new` process exits immediately and the sim never connects. for headless automation use `--driver playwright`."};let r=c();if(!r)return{launched:!1,message:"chromium not found \u2014 install chrome or run `sootsim list --drivers`"};if(!e.url)return{launched:!1,message:"chromium driver requires a target url"};if(e.profileId||e.ephemeralProfile)return{launched:!1,message:"profiles require electron or playwright; browser tabs use your current Chrome profile"};try{let t=await d(e.url,{detached:e.detached??!0});return{launched:!0,message:`chromium launched \u2192 ${e.url}`,pid:t.pid,target:t.target??r,attachUrl:e.url}}catch(t){return{launched:!1,message:`chromium spawn failed: ${t instanceof Error?t.message:String(t)}`}}}var v={id:"chromium",name:"chromium",description:"system chrome / chromium / edge \u2014 visible window (headless: use playwright)",kind:"browser",availability:T,launch:O};function I(){let e=u();return e?{available:!0,reason:null,detail:`${e.kind} @ ${e.path}`}:{available:!1,reason:"sootsim desktop app not installed (run `sootsim install-desktop`)"}}async function x(e){let r=u();if(!r)return{launched:!1,message:"sootsim desktop app not installed"};try{let t=await f(e.url,r,{device:e.device,profileId:e.profileId,ephemeralProfile:e.ephemeralProfile});return t.launched?{launched:!0,message:e.url?`electron launched via ${t.via} \u2192 ${e.url}`:`electron launched via ${t.via}`,target:t.target,attachUrl:e.url}:{launched:!1,message:"desktop companion failed to start"}}catch(t){return{launched:!1,message:`electron launch failed: ${t instanceof Error?t.message:String(t)}`}}}var w={id:"electron",name:"electron",description:"sootsim desktop companion app (native window, menu bar)",kind:"native",availability:I,launch:x};import{spawn as A}from"child_process";import{closeSync as M,mkdtempSync as _,openSync as L,readFileSync as E}from"fs";import{createRequire as C}from"module";import{tmpdir as g}from"os";import{join as y}from"path";var R=`
3
+ const modulePath = process.env.SOOTSIM_PW_MODULE;
4
+ const url = process.env.SOOTSIM_PW_URL;
5
+ const headless = process.env.SOOTSIM_PW_HEADLESS === '1';
6
+ const userDataDir = process.env.SOOTSIM_PW_USERDATADIR || '';
7
+ const closeTimeoutMs = Number(process.env.SOOTSIM_PW_CLOSE_TIMEOUT_MS || 2500);
8
+ const connectAckFile = process.env.SOOTSIM_PW_CONNECTED_ACK_FILE || '';
9
+ const { existsSync, unlinkSync } = require('fs');
10
+ (async () => {
11
+ const pw = require(modulePath);
12
+ let browser = null;
13
+ let context;
14
+ let keepAlive = null;
15
+ let connectTimer = null;
16
+ let connectAckPoll = null;
17
+ let connected = false;
18
+ let shuttingDown = false;
19
+ const clearConnectTimer = () => {
20
+ if (connectTimer) {
21
+ clearTimeout(connectTimer);
22
+ connectTimer = null;
23
+ }
24
+ if (connectAckPoll) {
25
+ clearInterval(connectAckPoll);
26
+ connectAckPoll = null;
27
+ }
28
+ };
29
+ const markConnected = () => {
30
+ connected = true;
31
+ clearConnectTimer();
32
+ };
33
+ const ackFileExists = () => {
34
+ if (!connectAckFile) return false;
35
+ try { return existsSync(connectAckFile); } catch { return false; }
36
+ };
37
+ const bounded = async (label, work, timeoutMs) => {
38
+ let timer = null;
39
+ try {
40
+ const timeout = new Promise((resolve) => {
41
+ timer = setTimeout(() => resolve({ timedOut: true }), timeoutMs);
42
+ });
43
+ if (typeof timer.unref === 'function') timer.unref();
44
+ const result = await Promise.race([
45
+ Promise.resolve().then(work).then(
46
+ () => ({ timedOut: false }),
47
+ (error) => ({ timedOut: false, error }),
48
+ ),
49
+ timeout,
50
+ ]);
51
+ if (result && result.timedOut) {
52
+ process.stderr.write('[shutdown-timeout] ' + label + ' exceeded ' + timeoutMs + 'ms\\n');
53
+ return false;
54
+ }
55
+ if (result && result.error) {
56
+ process.stderr.write('[shutdown-error] ' + label + ': ' + String((result.error && result.error.message) || result.error) + '\\n');
57
+ return false;
58
+ }
59
+ return true;
60
+ } finally {
61
+ if (timer) clearTimeout(timer);
62
+ }
63
+ };
64
+ const maybeBrowser = () => {
65
+ if (browser) return browser;
66
+ if (context && typeof context.browser === 'function') {
67
+ try { return context.browser(); } catch {}
68
+ }
69
+ return null;
70
+ };
71
+ const browserProcess = () => {
72
+ const b = maybeBrowser();
73
+ if (b && typeof b.process === 'function') {
74
+ try { return b.process(); } catch {}
75
+ }
76
+ return null;
77
+ };
78
+ const processIsAlive = (proc) => {
79
+ if (!proc || !proc.pid) return false;
80
+ try {
81
+ process.kill(proc.pid, 0);
82
+ return true;
83
+ } catch (err) {
84
+ return err && err.code === 'EPERM';
85
+ }
86
+ };
87
+ const terminateBrowserProcess = async () => {
88
+ const proc = browserProcess();
89
+ if (!proc || !proc.pid || !processIsAlive(proc)) return;
90
+ try { proc.kill('SIGTERM'); } catch {}
91
+ await bounded('browser process exit after SIGTERM', async () => {
92
+ while (processIsAlive(proc)) {
93
+ await new Promise((resolve) => setTimeout(resolve, 50));
94
+ }
95
+ }, 600);
96
+ if (!processIsAlive(proc)) return;
97
+ try { proc.kill('SIGKILL'); } catch {}
98
+ };
99
+ const shutdown = async (code = 0) => {
100
+ if (shuttingDown) return;
101
+ shuttingDown = true;
102
+ clearConnectTimer();
103
+ if (keepAlive) clearInterval(keepAlive);
104
+ const timeoutMs = Number.isFinite(closeTimeoutMs) && closeTimeoutMs > 0 ? closeTimeoutMs : 2500;
105
+ if (context) await bounded('context.close', () => context.close(), timeoutMs);
106
+ const b = maybeBrowser();
107
+ if (b) await bounded('browser.close', () => b.close(), timeoutMs);
108
+ await terminateBrowserProcess();
109
+ if (connectAckFile) {
110
+ try { unlinkSync(connectAckFile); } catch {}
111
+ }
112
+ process.exit(code);
113
+ };
114
+ process.once('SIGTERM', () => { void shutdown(0); });
115
+ process.once('SIGINT', () => { void shutdown(0); });
116
+ // use the real Google Chrome install, not Playwright's bundled Chromium /
117
+ // Chrome for Testing builds. local SootSim sessions should look like the
118
+ // user's browser and must not leave behind a pile of "Chrome for Testing"
119
+ // processes. NOTE: this is NOT enough to make \`sootsim cpu-profile\`
120
+ // work \u2014 that profiles the tenant *worker*, and the JS Self-Profiler API
121
+ // cannot be constructed in a dedicated worker by any means (see
122
+ // worker-handlers/cpu-profile.ts). cpu-profile needs a CDP-based profiler
123
+ // instead.
124
+ const launchOpts = { headless, channel: 'chrome' };
125
+ if (userDataDir) {
126
+ context = await pw.chromium.launchPersistentContext(userDataDir, launchOpts);
127
+ } else {
128
+ browser = await pw.chromium.launch(launchOpts);
129
+ context = await browser.newContext();
130
+ }
131
+ const hostMeta = {
132
+ sootsimHostDriver: 'playwright',
133
+ sootsimHostPid: process.pid,
134
+ sootsimHostStartedAt: Date.now(),
135
+ };
136
+ await context.addInitScript({
137
+ content: 'Object.defineProperty(window, "__sootsimHostMeta", { value: ' + JSON.stringify(hostMeta) + ', configurable: true });',
138
+ });
139
+ await context.exposeBinding('__sootsimHostClose', async () => {
140
+ await shutdown(0);
141
+ });
142
+ const connectTimeoutMs = Number(process.env.SOOTSIM_PW_CONNECT_TIMEOUT_MS || 120000);
143
+ if (connectAckFile) {
144
+ connectAckPoll = setInterval(() => {
145
+ if (ackFileExists()) markConnected();
146
+ }, 500);
147
+ if (typeof connectAckPoll.unref === 'function') connectAckPoll.unref();
148
+ }
149
+ connectTimer = setTimeout(() => {
150
+ if (ackFileExists()) {
151
+ markConnected();
152
+ return;
153
+ }
154
+ if (connected) return;
155
+ process.stderr.write('[connect-timeout] sim did not register with the bridge within ' + connectTimeoutMs + 'ms; closing playwright host\\n');
156
+ void shutdown(2);
157
+ }, Number.isFinite(connectTimeoutMs) && connectTimeoutMs > 0 ? connectTimeoutMs : 120000);
158
+ if (typeof connectTimer.unref === 'function') connectTimer.unref();
159
+ const page = await context.newPage();
160
+ // surface page-side failures (engine boot crash, failed WS registration)
161
+ // to stderr so a sim that never connects produces a real diagnostic
162
+ // instead of a silent "timed out waiting for opened sim to connect".
163
+ page.on('pageerror', (e) => {
164
+ process.stderr.write('[pageerror] ' + ((e && e.stack) || e) + '\\n');
165
+ });
166
+ page.on('console', (m) => {
167
+ if (m.type() === 'error') {
168
+ process.stderr.write('[console.error] ' + m.text() + '\\n');
169
+ }
170
+ });
171
+ page.on('crash', () => process.stderr.write('[page] renderer crashed\\n'));
172
+ try {
173
+ await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 });
174
+ } catch (err) {
175
+ process.stderr.write('[goto] ' + String((err && err.message) || err) + '\\n');
176
+ }
177
+ keepAlive = setInterval(() => {}, 1 << 30);
178
+ if (browser) browser.on('disconnected', () => { void shutdown(0); });
179
+ context.on('close', () => { void shutdown(0); });
180
+ page.on('close', () => { void shutdown(0); });
181
+ })().catch((err) => {
182
+ process.stderr.write(String((err && err.stack) || err) + '\\n');
183
+ process.exit(1);
184
+ });
185
+ `;function b(){let e=[process.cwd()+"/"];try{process.argv[1]&&e.push(process.argv[1])}catch{}for(let r of e)try{let t=C(r);for(let i of["playwright","playwright-chromium","playwright-core"])try{return{spec:i,modulePath:t.resolve(i)}}catch{}}catch{}return null}function $(){let e=b();return e?{available:!0,reason:null,detail:`resolved via ${e.spec}`}:{available:!1,reason:"playwright not installed in the current workspace"}}function U(e){return e.profileId?p(h(e.profileId).id):e.ephemeralProfile?_(y(g(),"sootsim-playwright-profile-")):""}async function F(e){let r=b();if(!r)return{launched:!1,message:"playwright not installed \u2014 run `bun add -D playwright` first"};if(!e.url)return{launched:!1,message:"playwright driver requires a target url"};let t=y(g(),`sootsim-playwright-host-${Date.now().toString(36)}-${process.pid}.log`),i=`${t}.connected`,a=L(t,"a");try{let n=A(process.execPath,["-e",R],{detached:!0,stdio:["ignore","ignore",a],env:{...process.env,SOOTSIM_PW_MODULE:r.modulePath,SOOTSIM_PW_URL:e.url,SOOTSIM_PW_HEADLESS:e.headless??!0?"1":"0",SOOTSIM_PW_USERDATADIR:U(e),SOOTSIM_PW_CONNECTED_ACK_FILE:i}});n.unref();let l=await new Promise(o=>{let k=setTimeout(()=>o(null),4e3);n.once("exit",P=>{clearTimeout(k),o(P??0)})});if(l!==null&&l!==0){let o=E(t,"utf8").trim();return{launched:!1,message:`playwright host exited early (code ${l}) \u2014 host log ${t}${o?`:
186
+ ${o}`:""}`}}return{launched:!0,message:`playwright chrome launched \u2192 ${e.url}`,pid:n.pid,target:r.spec,attachUrl:e.url,connectAckFile:i}}catch(n){return{launched:!1,message:`playwright launch failed: ${n instanceof Error?n.message:String(n)}`}}finally{M(a)}}var D={id:"playwright",name:"playwright",description:"programmatic chromium via the playwright package \u2014 headless default",kind:"automation",availability:$,launch:F};function W(){return process.platform!=="darwin"&&process.platform!=="linux"&&process.platform!=="win32"?{available:!1,reason:`unsupported platform: ${process.platform}`}:{available:!0,reason:null,detail:process.platform==="darwin"?"open(1)":process.platform==="win32"?"cmd /c start":"xdg-open(1)"}}async function N(e){if(e.headless)return{launched:!1,message:"system driver does not support --headless; use chromium or playwright"};if(!e.url)return{launched:!1,message:"system driver requires a target url"};if(e.profileId||e.ephemeralProfile)return{launched:!1,message:"profiles require electron or playwright; browser tabs use your current browser profile"};try{let r=await m(e.url,{detached:e.detached??!0,newWindow:e.newWindow});return{launched:!0,message:`${r.via} launch \u2192 ${e.url}`,pid:r.pid,target:r.target,attachUrl:e.url}}catch(r){return{launched:!1,message:`system launch failed: ${r instanceof Error?r.message:String(r)}`}}}var S={id:"system",name:"system",description:"shared browser launcher \u2014 system default or chromium window",kind:"delegate",availability:W,launch:N};var s=[v,w,D,S];function ne(){return s}function oe(e){return s.find(r=>r.id===e)??null}function se(e,r){if(e)return s.find(i=>i.id===e)??null;for(let t of r){let i=s.find(a=>a.id===t);if(i&&i.availability().available)return i}return null}function ae(){return s.map(e=>{let r=e.availability();return{id:e.id,name:e.name,kind:e.kind,description:e.description,available:r.available,reason:r.reason,detail:r.detail??null}})}export{v as a,w as b,D as c,S as d,s as e,ne as f,oe as g,se as h,ae as i};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as p}from"./chunk-EMMX6RF7.js";import{d as c,e as l}from"./chunk-EEMGSSWY.js";import{a}from"./chunk-EIQLQDKX.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.68 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as p}from"./chunk-2NFRZQ3K.js";import{d as c,e as l}from"./chunk-Z6BCORBY.js";import{a}from"./chunk-E7FCGYB5.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: