sootsim 0.1.202 → 0.1.204

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 (140) hide show
  1. package/dist-cli/bin.js +4 -4
  2. package/dist-cli/chunks/{agent-SP6EE5XV.js → agent-T2OMCNWX.js} +2 -2
  3. package/dist-cli/chunks/{agent-wrapper-PWZVJ3OK.js → agent-wrapper-TOEG4KZN.js} +2 -2
  4. package/dist-cli/chunks/{app-fonts-EMJB6QLM.js → app-fonts-ZZFS4AH7.js} +2 -2
  5. package/dist-cli/chunks/{assert-H2B6TDXT.js → assert-PY6GNPNF.js} +2 -2
  6. package/dist-cli/chunks/{auth-SOHXBYLQ.js → auth-B2PWGTKN.js} +2 -2
  7. package/dist-cli/chunks/beta-UOE2TYBN.js +2 -0
  8. package/dist-cli/chunks/{camera-ULLCBM5H.js → camera-OEPAIWJN.js} +2 -2
  9. package/dist-cli/chunks/{chunk-RS7QLHEH.js → chunk-2QNS3LVC.js} +2 -2
  10. package/dist-cli/chunks/{chunk-KRGHRSKY.js → chunk-3QH7DDPH.js} +2 -2
  11. package/dist-cli/chunks/{chunk-KYGUR727.js → chunk-4E5IRWI7.js} +2 -2
  12. package/dist-cli/chunks/{chunk-4KT2BGQE.js → chunk-4M2TZWK6.js} +1 -1
  13. package/dist-cli/chunks/{chunk-6FZ6SNVP.js → chunk-4MOXA427.js} +2 -2
  14. package/dist-cli/chunks/{chunk-6QFVYLX6.js → chunk-53WUR3VJ.js} +2 -2
  15. package/dist-cli/chunks/{chunk-CB7LDZKJ.js → chunk-6ZAG2UD7.js} +3 -3
  16. package/dist-cli/chunks/{chunk-5SKKMM7E.js → chunk-77BU6BBG.js} +1 -1
  17. package/dist-cli/chunks/{chunk-DRJ4YWUG.js → chunk-BASFSVR7.js} +1 -1
  18. package/dist-cli/chunks/{chunk-OG6TFGYF.js → chunk-BJPP3RYK.js} +2 -2
  19. package/dist-cli/chunks/{chunk-GZKT53SA.js → chunk-C77XHORB.js} +1 -1
  20. package/dist-cli/chunks/{chunk-3ZENZOIX.js → chunk-CTTF7N3P.js} +2 -2
  21. package/dist-cli/chunks/chunk-GYCMTLSB.js +1 -0
  22. package/dist-cli/chunks/{chunk-RWXCSRNE.js → chunk-HLFAGJQS.js} +2 -2
  23. package/dist-cli/chunks/{chunk-PL4GXELT.js → chunk-HXYRVST6.js} +1 -1
  24. package/dist-cli/chunks/{chunk-4KVSVFRF.js → chunk-IFELEVID.js} +1 -1
  25. package/dist-cli/chunks/{chunk-Z5VMWFCY.js → chunk-IFFUT5B6.js} +1 -1
  26. package/dist-cli/chunks/{chunk-2CID4LNK.js → chunk-IKUS3HEG.js} +3 -3
  27. package/dist-cli/chunks/chunk-JZHU6AG2.js +1 -0
  28. package/dist-cli/chunks/{chunk-RZQO4Q7E.js → chunk-LBIRAJOL.js} +1 -1
  29. package/dist-cli/chunks/{chunk-JP7J325R.js → chunk-LLSFRU7R.js} +2 -2
  30. package/dist-cli/chunks/{chunk-ENXHZGSL.js → chunk-LWAHCD7M.js} +1 -1
  31. package/dist-cli/chunks/{chunk-2V43M57C.js → chunk-MBP24UDB.js} +1 -1
  32. package/dist-cli/chunks/{chunk-ROYBEBG2.js → chunk-N4SBPOL2.js} +1 -1
  33. package/dist-cli/chunks/{chunk-AAQVPSIV.js → chunk-O5EQ6EUO.js} +2 -2
  34. package/dist-cli/chunks/{chunk-EMOZJ773.js → chunk-P4TMHMTW.js} +2 -2
  35. package/dist-cli/chunks/{chunk-HZYHSLNH.js → chunk-PNARQS2A.js} +2 -2
  36. package/dist-cli/chunks/{chunk-GUYKLSTX.js → chunk-QIUGKRGQ.js} +1 -1
  37. package/dist-cli/chunks/{chunk-WILIVPUU.js → chunk-QL7ZV7RK.js} +24 -24
  38. package/dist-cli/chunks/{chunk-W4Y3JJX6.js → chunk-QPWJELIW.js} +3 -3
  39. package/dist-cli/chunks/{chunk-K3UBHPVP.js → chunk-QQKXV6OM.js} +1 -1
  40. package/dist-cli/chunks/{chunk-CGJ2U6ST.js → chunk-R4XFWY2O.js} +1 -1
  41. package/dist-cli/chunks/{chunk-RJVIUQK4.js → chunk-SQPLGMB6.js} +1 -1
  42. package/dist-cli/chunks/{chunk-WVDWIXPH.js → chunk-UJYUJFAF.js} +2 -2
  43. package/dist-cli/chunks/{chunk-LNDRRZP3.js → chunk-UW5SGYV4.js} +2 -2
  44. package/dist-cli/chunks/{chunk-TANTCV45.js → chunk-VEPYEPFT.js} +2 -2
  45. package/dist-cli/chunks/chunk-VIZKVZQB.js +2 -0
  46. package/dist-cli/chunks/chunk-VK2PTPFN.js +97 -0
  47. package/dist-cli/chunks/{chunk-SQBX2HS7.js → chunk-WCGZK5VV.js} +2 -2
  48. package/dist-cli/chunks/{chunk-4NM6JBYH.js → chunk-WFS5YJAV.js} +1 -1
  49. package/dist-cli/chunks/{chunk-B6JB4THC.js → chunk-YZOZZJOB.js} +2 -2
  50. package/dist-cli/chunks/{chunk-F2LLN4U7.js → chunk-Z3I3WOQH.js} +2 -2
  51. package/dist-cli/chunks/cli-version-F5UUZ3AL.js +2 -0
  52. package/dist-cli/chunks/{compat-YW3OJ7RX.js → compat-M2I2R7FR.js} +3 -3
  53. package/dist-cli/chunks/{config-ZGOXFEX4.js → config-6H6NNUFA.js} +2 -2
  54. package/dist-cli/chunks/{control-75JRFOYV.js → control-RHYSHKVY.js} +2 -2
  55. package/dist-cli/chunks/daemon-E3GVTRTF.js +2 -0
  56. package/dist-cli/chunks/{debug-4APEP64L.js → debug-QBI2C77H.js} +3 -3
  57. package/dist-cli/chunks/{desktop-CS7S4CXK.js → desktop-YXBYOWT7.js} +3 -3
  58. package/dist-cli/chunks/{detox-7R7DOKQM.js → detox-5UZKDRSJ.js} +2 -2
  59. package/dist-cli/chunks/{device-EIDKLBEK.js → device-22PEYRIX.js} +2 -2
  60. package/dist-cli/chunks/{diagnose-J2F7MJAJ.js → diagnose-6XHZ44UY.js} +2 -2
  61. package/dist-cli/chunks/drivers-JMXYZ6QQ.js +2 -0
  62. package/dist-cli/chunks/flow-VWRNDUMP.js +2 -0
  63. package/dist-cli/chunks/help-EN6VZRYR.js +2 -0
  64. package/dist-cli/chunks/{home-paths-WVCREWI7.js → home-paths-KF47ROJM.js} +2 -2
  65. package/dist-cli/chunks/inspect-42Q6QOAY.js +2 -0
  66. package/dist-cli/chunks/install-desktop-6AW62HXK.js +2 -0
  67. package/dist-cli/chunks/{login-EOBJ7CZ4.js → login-7ORY4PH7.js} +4 -4
  68. package/dist-cli/chunks/{logout-RL7D66VQ.js → logout-DLV43XAX.js} +2 -2
  69. package/dist-cli/chunks/{maestro-F66ZIJKA.js → maestro-KUYHVA4K.js} +2 -2
  70. package/dist-cli/chunks/{mode-R2VIW66U.js → mode-KY52AGWL.js} +2 -2
  71. package/dist-cli/chunks/optional-demo-registry-CPJHOPHN.js +2 -0
  72. package/dist-cli/chunks/{perf-PGYO5BBR.js → perf-LOQ24NZ5.js} +2 -2
  73. package/dist-cli/chunks/{record-IGDVHC67.js → record-V7PUJQLE.js} +3 -3
  74. package/dist-cli/chunks/runtime-UWXYS6JK.js +2 -0
  75. package/dist-cli/chunks/screenshot-command-MHE3PC4G.js +151 -0
  76. package/dist-cli/chunks/screenshots-capture-4HAJBNUA.js +41 -0
  77. package/dist-cli/chunks/{serve-3TFVHYLY.js → serve-HADAVKJP.js} +2 -2
  78. package/dist-cli/chunks/{setup-JSPPRVET.js → setup-6HHTU6KU.js} +3 -3
  79. package/dist-cli/chunks/{skills-LK3B76W7.js → skills-KDJACPBK.js} +2 -2
  80. package/dist-cli/chunks/{storage-NC5RNBUA.js → storage-AU6V673L.js} +2 -2
  81. package/dist-cli/chunks/store-4XRYXAOA.js +2 -0
  82. package/dist-cli/chunks/telemetry-A4M356NJ.js +2 -0
  83. package/dist-cli/chunks/{test-2CXPLH5N.js → test-R4QJQNF2.js} +5 -5
  84. package/dist-cli/chunks/{timeline-WDTEVELN.js → timeline-MZZXRUH3.js} +2 -2
  85. package/dist-cli/chunks/{upgrade-TT2IJSNJ.js → upgrade-JTW54477.js} +2 -2
  86. package/dist-cli/chunks/upload-G6JTMQK7.js +2 -0
  87. package/dist-cli/chunks/{version-JUNH4FOR.js → version-TCNEY542.js} +2 -2
  88. package/dist-cli/chunks/{web-BWCW26ZA.js → web-OXDQRQVR.js} +2 -2
  89. package/dist-cli/chunks/{what-happened-L6EEB6MB.js → what-happened-6M7UMJUB.js} +2 -2
  90. package/dist-lib/agent-daemon-client.cjs +1 -1
  91. package/dist-lib/agent-events.cjs +1 -1
  92. package/dist-lib/agent-identity.cjs +1 -1
  93. package/dist-lib/agent-sessions.cjs +1 -1
  94. package/dist-lib/attached-projects.cjs +1 -1
  95. package/dist-lib/auth/shared-session.cjs +1 -1
  96. package/dist-lib/backend-origin.cjs +1 -1
  97. package/dist-lib/beta.cjs +1 -1
  98. package/dist-lib/beta.mjs +1 -1
  99. package/dist-lib/bridge-constants.cjs +1 -1
  100. package/dist-lib/cli-constants.cjs +1 -1
  101. package/dist-lib/config.cjs +1 -1
  102. package/dist-lib/detox/index.cjs +1 -1
  103. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  104. package/dist-lib/home-paths.cjs +1 -1
  105. package/dist-lib/host/bridge-host.cjs +1 -1
  106. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  107. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  108. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  109. package/dist-lib/host/websocket-proxy.cjs +1 -1
  110. package/dist-lib/index.cjs +1 -1
  111. package/dist-lib/jump-to-source-babel.cjs +1 -1
  112. package/dist-lib/menu.cjs +1 -1
  113. package/dist-lib/menu.mjs +1 -1
  114. package/dist-lib/metro.cjs +1 -1
  115. package/dist-lib/profiles.cjs +1 -1
  116. package/dist-lib/render-mode.cjs +1 -1
  117. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  118. package/dist-lib/sdk.cjs +1 -1
  119. package/dist-lib/sdk.mjs +1 -1
  120. package/dist-lib/skills.cjs +1 -1
  121. package/dist-lib/vite.cjs +1 -1
  122. package/package.json +1 -1
  123. package/dist-cli/chunks/beta-CCNQQ73A.js +0 -2
  124. package/dist-cli/chunks/chunk-5J63S2NM.js +0 -1
  125. package/dist-cli/chunks/chunk-BZ7AW7ZB.js +0 -92
  126. package/dist-cli/chunks/chunk-DKBKU55D.js +0 -2
  127. package/dist-cli/chunks/chunk-I6O7NBPZ.js +0 -1
  128. package/dist-cli/chunks/cli-version-Z4NGLJLH.js +0 -2
  129. package/dist-cli/chunks/daemon-SHFBQRHD.js +0 -2
  130. package/dist-cli/chunks/drivers-55L7BHDF.js +0 -2
  131. package/dist-cli/chunks/flow-AHWVTHJP.js +0 -2
  132. package/dist-cli/chunks/help-C4BTMPEE.js +0 -2
  133. package/dist-cli/chunks/inspect-M4Z4SSSB.js +0 -2
  134. package/dist-cli/chunks/install-desktop-PVRUAEMA.js +0 -2
  135. package/dist-cli/chunks/optional-demo-registry-ILX5YV34.js +0 -2
  136. package/dist-cli/chunks/runtime-43RJGUGS.js +0 -2
  137. package/dist-cli/chunks/screenshot-command-HX4GVUJM.js +0 -190
  138. package/dist-cli/chunks/store-3XMEKA6H.js +0 -2
  139. package/dist-cli/chunks/telemetry-CVJ5YZNS.js +0 -2
  140. package/dist-cli/chunks/upload-4HMNB4HA.js +0 -2
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.202 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.204 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import{createHash as b}from"node:crypto";import g from"node:fs";import{createRequire as S}from"node:module";import u from"node:path";var y=/\.(ttf|otf|woff|woff2)$/i;function P(t,n,r){if(!t||typeof t!="object")return;let o=t.fonts;if(Array.isArray(o))for(let i of o)typeof i=="string"&&r.push(i);let e=t[n];if(!e||typeof e!="object")return;let s=e.fonts;if(Array.isArray(s))for(let i of s){if(typeof i=="string"){r.push(i);continue}if(!i||typeof i!="object")continue;let c=i.fontDefinitions;if(Array.isArray(c))for(let a of c){if(!a||typeof a!="object")continue;let p=a.path;typeof p=="string"&&r.push(p)}}}function m(t,n){if(!Array.isArray(t))return[];let r=[];for(let o of t){let e=Array.isArray(o)?o[0]:o;if(typeof e!="string"||!/(^|\/)expo-font$/.test(e))continue;let s=Array.isArray(o)?o[1]??{}:{};P(s,n,r)}return r}function C(t){return t.slice(t.lastIndexOf("/")+1).replace(y,"")}function h(t,n){let r=n.replace(/\/+$/,""),o=new Set,e=[];for(let s of t){let i=s.replace(/^\.\//,"").replace(/^\/+/,"");!i||o.has(i)||(o.add(i),y.test(i)&&e.push({family:C(i),url:`${r}/assets/${i}`}))}return e}var d=S(import.meta.url);function x(t){try{let n=new URL(t),r=n.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(r==="localhost"||r.endsWith(".localhost")||r==="0.0.0.0"||r==="::1"||/^127(?:\.\d{1,3}){3}$/.test(r))return n.origin}catch{}return null}var R=["app.config.js","app.config.ts","app.config.cjs","app.config.mjs","app.json"];function w(t){for(let n of R)try{if(g.statSync(u.join(t,n)).isFile())return!0}catch{}return!1}var j=new Set(["node_modules","artifacts","dist","build","out","coverage","tmp","public","ios","android","macos","windows","__fixtures__","__tests__","examples","example"]);function F(t,n){w(t)&&n.push(t);let r;try{r=g.readdirSync(t,{withFileTypes:!0})}catch{return}for(let o of r)o.isDirectory()&&(o.name.startsWith(".")||j.has(o.name)||F(u.join(t,o.name),n))}function _(t){try{return g.statSync(u.join(t,"package.json")).isFile()}catch{return!1}}function I(t){let n=x(t.bundleUrl);if(!n)return[];let r=t.repoDir||process.env.SOOT_REPO_DIR,o=r?u.resolve(r):process.cwd();if(!r&&!_(o))return[];let e=[];if(r)F(o,e),e.includes(o)||e.push(o);else{if(!w(o))return[];e.push(o)}if(e.length===0)return[];let s=(t.platform||process.env.SOOT_PLATFORM||"ios").toLowerCase(),i=null;try{let l=d.resolve("@expo/config",{paths:[...e,o]}),f=d(l);typeof f.getConfig=="function"&&(i=f.getConfig)}catch{}if(!i)return[];let c;for(let l of e)try{let f=i(l,{skipSDKVersionRequirement:!0});if(f?.exp&&typeof f.exp=="object"){let A=f.exp.plugins;if(Array.isArray(A)){c=f.exp;break}}}catch{}if(!c||typeof c!="object")return[];let a=c.plugins;if(!Array.isArray(a))return[];let p=m(a,s==="android"?"android":"ios");return h(p,n)}async function L(t,n){let r=x(t);if(!r)return null;let o=new AbortController,e=setTimeout(()=>o.abort(),n?.timeoutMs??1500);try{let s=await fetch(`${r}/`,{headers:{"expo-platform":"ios",Accept:"application/json"},signal:o.signal});if(!s.ok)return null;let c=(await s.json())?.extra?.expoClient?._internal?.projectRoot;return typeof c=="string"&&c.length>0?c:null}catch{return null}finally{clearTimeout(e)}}function M(t){return t.map(n=>`${encodeURIComponent(n.url)}::${encodeURIComponent(n.family)}`).join(",")}function k(t){let n=[];for(let r of t.split(",")){let o=r.trim();if(!o)continue;let e=o.indexOf("::"),s=e===-1?o:o.slice(0,e);try{n.push(decodeURIComponent(s))}catch{n.push(s)}}return n.filter(Boolean)}function D(t){let n=(t.split("?")[0].split(".").pop()||"").toLowerCase();return n==="ttf"?"font/ttf":n==="otf"?"font/otf":n==="woff"?"font/woff":n==="woff2"?"font/woff2":"application/octet-stream"}async function G(t,n){let r=[],o=new Set;for(let e of k(t)){let s=b("sha256").update(e).digest("hex");if(!o.has(s)){o.add(s);try{let i=await fetch(e);if(!i.ok){n?.onError?.(e,new Error(`${i.status} ${i.statusText}`));continue}let c=new Uint8Array(await i.arrayBuffer());r.push({url:e,urlhash:s,contentType:D(e),bytes:c}),n?.onStaged?.({url:e,byteLength:c.byteLength})}catch(i){n?.onError?.(e,i)}}}return r}export{I as a,L as b,M as c,G as d};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.202 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as E,b as D}from"./chunk-4NM6JBYH.js";import{H as T}from"./chunk-GZKT53SA.js";var N="sootsimConfig";function p(e){return!!e&&Object.keys(e).length>0}function $(e){return e?p(e.modules)||p(e.turboModules)||p(e.nativeModules)||p(e.env)||p(e.network?.remap)||p(e.settings)||p(e.initialState):!1}function j(e,t){let n=new URL(e);return $(t)?n.searchParams.set(N,JSON.stringify(t)):n.searchParams.delete(N),n.toString()}var me="/index.bundle?platform=ios&dev=true&hot=true&minify=false";function A(e){return/^https?:\/\//i.test(e)}function O(e){return e.endsWith(".bundle")}function H(e){process.env.SOOTSIM_PREVIEW_PROD_BUNDLE&&(e.searchParams.set("dev","false"),e.searchParams.set("minify","true"),e.searchParams.has("hot")&&e.searchParams.set("hot","false"))}function I(e){try{let t=A(e),n=new URL(e,"http://soot.local");return n.pathname=n.pathname.replace(/\.\.bundle$/,".bundle"),O(n.pathname)?(n.searchParams.delete("transform.bytecode"),n.searchParams.get("lazy")==="true"&&n.searchParams.set("lazy","false"),H(n),t?n.toString():`${n.pathname}${n.search}${n.hash}`):e}catch{return e}}function pe(e,t){try{let n=A(e),o=new URL(e,"http://soot.local");return O(o.pathname)?(o.searchParams.set("hot",t?"true":"false"),n?o.toString():`${o.pathname}${o.search}${o.hash}`):e}catch{return e}}import{exec as W}from"child_process";import B from"http";import F from"net";import{promisify as G}from"util";var _=G(W);E();var z=250,J=1500,K=120;function V(e,t=K){return new Promise(n=>{let o=new F.Socket,s=!1,i=a=>{s||(s=!0,o.destroy(),n(a))};o.setTimeout(t),o.once("connect",()=>i(!0)),o.once("timeout",()=>i(!1)),o.once("error",()=>i(!1)),o.connect(e,"localhost")})}function h(e,t,n="GET",o=z,s={}){return new Promise(i=>{let a=B.request({hostname:"localhost",port:e,path:t,method:n,timeout:o,headers:s},r=>{let c="";r.on("data",l=>c+=l.toString());let u=(()=>{let l=r.headers["content-type"];if(typeof l=="string")return l;if(Array.isArray(l))return l[0]})();r.on("end",()=>i({statusCode:r.statusCode||0,body:c,contentType:u}))});a.on("error",()=>i(null)),a.setTimeout(o,()=>{a.destroy(),i(null)}),a.end()})}var q=[8081,8082,8083,8084,8085,8086,3e3,3001,19e3].map(e=>({port:e,pid:0}));function C(e,t){return!(e<=0||e>=2e4||t.has(e)||e>=5170&&e<=5200)}async function Y(e=[]){let t=new Set(e);try{let{stdout:n}=await _("lsof -iTCP -sTCP:LISTEN -P -n 2>/dev/null | grep -E '^(node|bun)'",{encoding:"utf8",timeout:2e3});if(n.trim()){let o=new Map;for(let s of n.trim().split(`
1
+ /*! sootsim v0.1.204 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as E,b as D}from"./chunk-WFS5YJAV.js";import{H as T}from"./chunk-C77XHORB.js";var N="sootsimConfig";function p(e){return!!e&&Object.keys(e).length>0}function $(e){return e?p(e.modules)||p(e.turboModules)||p(e.nativeModules)||p(e.env)||p(e.network?.remap)||p(e.settings)||p(e.initialState):!1}function j(e,t){let n=new URL(e);return $(t)?n.searchParams.set(N,JSON.stringify(t)):n.searchParams.delete(N),n.toString()}var me="/index.bundle?platform=ios&dev=true&hot=true&minify=false";function A(e){return/^https?:\/\//i.test(e)}function O(e){return e.endsWith(".bundle")}function H(e){process.env.SOOTSIM_PREVIEW_PROD_BUNDLE&&(e.searchParams.set("dev","false"),e.searchParams.set("minify","true"),e.searchParams.has("hot")&&e.searchParams.set("hot","false"))}function I(e){try{let t=A(e),n=new URL(e,"http://soot.local");return n.pathname=n.pathname.replace(/\.\.bundle$/,".bundle"),O(n.pathname)?(n.searchParams.delete("transform.bytecode"),n.searchParams.get("lazy")==="true"&&n.searchParams.set("lazy","false"),H(n),t?n.toString():`${n.pathname}${n.search}${n.hash}`):e}catch{return e}}function pe(e,t){try{let n=A(e),o=new URL(e,"http://soot.local");return O(o.pathname)?(o.searchParams.set("hot",t?"true":"false"),n?o.toString():`${o.pathname}${o.search}${o.hash}`):e}catch{return e}}import{exec as W}from"child_process";import B from"http";import F from"net";import{promisify as G}from"util";var _=G(W);E();var z=250,J=1500,K=120;function V(e,t=K){return new Promise(n=>{let o=new F.Socket,s=!1,i=a=>{s||(s=!0,o.destroy(),n(a))};o.setTimeout(t),o.once("connect",()=>i(!0)),o.once("timeout",()=>i(!1)),o.once("error",()=>i(!1)),o.connect(e,"localhost")})}function h(e,t,n="GET",o=z,s={}){return new Promise(i=>{let a=B.request({hostname:"localhost",port:e,path:t,method:n,timeout:o,headers:s},r=>{let c="";r.on("data",l=>c+=l.toString());let u=(()=>{let l=r.headers["content-type"];if(typeof l=="string")return l;if(Array.isArray(l))return l[0]})();r.on("end",()=>i({statusCode:r.statusCode||0,body:c,contentType:u}))});a.on("error",()=>i(null)),a.setTimeout(o,()=>{a.destroy(),i(null)}),a.end()})}var q=[8081,8082,8083,8084,8085,8086,3e3,3001,19e3].map(e=>({port:e,pid:0}));function C(e,t){return!(e<=0||e>=2e4||t.has(e)||e>=5170&&e<=5200)}async function Y(e=[]){let t=new Set(e);try{let{stdout:n}=await _("lsof -iTCP -sTCP:LISTEN -P -n 2>/dev/null | grep -E '^(node|bun)'",{encoding:"utf8",timeout:2e3});if(n.trim()){let o=new Map;for(let s of n.trim().split(`
3
3
  `)){let i=s.trim().split(/\s+/);if(i.length<9)continue;let a=Number(i[1]),c=i[8].match(/:(\d+)$/);if(!c)continue;let u=Number(c[1]);C(u,t)&&(o.has(u)||o.set(u,a))}if(o.size>0)return[...o.entries()].map(([s,i])=>({port:s,pid:i}))}}catch{}try{let{stdout:n}=await _(`ss -tlnp 2>/dev/null | grep -E '"(node|bun)"'`,{encoding:"utf8",timeout:2e3});if(n.trim()){let o=new Map;for(let s of n.trim().split(`
4
4
  `)){let i=s.match(/:(\d+)\s/),a=s.match(/pid=(\d+)/);if(!i)continue;let r=Number(i[1]),c=a?Number(a[1]):0;C(r,t)&&(o.has(r)||o.set(r,c))}if(o.size>0)return[...o.entries()].map(([s,i])=>({port:s,pid:i}))}}catch{}return q.filter(n=>C(n.port,t))}var x=new Map;async function Q(e){if(e<=0)return null;let t=x.get(e);if(t)return t;try{let{stdout:n}=await _(`lsof -p ${e} -a -d cwd -Fn 2>/dev/null`,{encoding:"utf8",timeout:1500});for(let o of n.split(`
5
5
  `))if(o.startsWith("n")&&o.length>1){let s=o.slice(1).trim();if(s)return x.set(e,s),s}}catch{}return null}function X(e,t){return{port:e,framework:t,bundleUrl:S(e,`http://localhost:${e}/index.bundle?platform=ios&dev=true&hot=true&minify=false`),hmrUrl:`ws://localhost:${e}/hot`,lastSeen:Date.now()}}function S(e,t){let n=D().find(s=>s.preferredPort===e),o=n?.runtimeConfig?j(t,n.runtimeConfig):t;return I(o)}function Z(e){return e.includes("/node_modules/one/metro-entry.bundle")}function ee(e){try{let t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}}function w(e,t,n){if(!t)return e;try{let o=JSON.parse(t.body),s=o?.extra?.expoClient||o?.extra||{};s.name&&(e.projectName=s.name),s.ios?.bundleIdentifier&&(e.bundleId=s.ios.bundleIdentifier),e.framework==="metro"&&s.sdkVersion&&(e.framework="expo");let i=o?.launchAsset?.url;i&&!e.patched&&!Z(e.bundleUrl)&&(e.bundleUrl=S(e.port,i));let a=s.iconUrl||s.ios?.iconUrl||s.icon||s.ios?.icon;if(a)if(e.iconPath=a,n)if(a.startsWith("http"))e.iconUrl=n(a);else{let r=a.replace(/^\.\//,"");e.iconUrl=n(`http://localhost:${e.port}/assets/${r}`)}else e.iconUrl=a.startsWith("http")?a:`http://localhost:${e.port}/assets/${a.replace(/^\.\//,"")}`}catch{}return e}var ne=2e4,v=new Map,k=new Set;function M(e,t){if(e.projectName)return e;let n=v.get(e.port);if(n)return n.projectName&&(e.projectName=n.projectName),n.iconUrl&&!e.iconUrl&&(e.iconUrl=n.iconUrl,e.iconPath=n.iconPath),n.bundleId&&!e.bundleId&&(e.bundleId=n.bundleId),e;if(!k.has(e.port)){k.add(e.port);let o=e.port;te(o,t).finally(()=>k.delete(o))}return e}async function te(e,t){let n=await h(e,"/","GET",ne,{"expo-platform":"ios"});if(!n||n.statusCode!==200)return;let o=w({port:e,framework:"one",bundleUrl:"",lastSeen:0},n,t);!o.projectName&&!o.iconUrl||(v.set(e,{projectName:o.projectName,iconUrl:o.iconUrl,iconPath:o.iconPath,bundleId:o.bundleId}),b.delete(e))}var d=new Set,g=new Set,y=new Set;async function oe(e,t){if(!await V(e))return null;let n="/node_modules/one/metro-entry.bundle?platform=ios&dev=true",[o,s,i,a]=await Promise.all([d.has(e)?Promise.resolve(null):h(e,"/__soot/"),h(e,"/status"),y.has(e)?Promise.resolve(null):h(e,"/","GET",J,{"expo-platform":"ios"}),g.has(e)?Promise.resolve(null):h(e,"/_expo/status")]);a&&a.statusCode===200?g.delete(e):g.has(e)||g.add(e);let r=i?ee(i.body):null,c=typeof r?.launchAsset?.url=="string"?r.launchAsset.url:null,u=r?.extra?.expoClient||r?.extra||{};if(r&&(c||typeof u.name=="string")){d.add(e);let U=c||`http://localhost:${e}/index.bundle?platform=ios&dev=true&hot=true&minify=false`,L=U.includes("/one/metro-entry.bundle")?"one":"expo";return w({port:e,framework:L,bundleUrl:S(e,U),hmrUrl:`ws://localhost:${e}/hot`,lastSeen:Date.now()},i,t)}if(s&&s.body.includes("packager-status:running"))return d.add(e),M(w(X(e,a&&a.statusCode===200?"expo":"metro"),i,t),t);if(o&&o.statusCode===200&&o.body.includes("sootsim-patched"))return d.delete(e),M(w({port:e,framework:"one",bundleUrl:S(e,`http://localhost:${e}/__soot/bundle.js`),hmrUrl:`ws://localhost:${e}/hot`,lastSeen:Date.now(),patched:!0},i,t),t);if(s&&s.statusCode===200||a&&a.statusCode===200||i&&i.statusCode===200&&r!=null)return null;let m=await h(e,n,"HEAD");return m&&m.statusCode>0&&m.statusCode<400&&/application\/javascript/i.test(m.contentType||"")?(d.add(e),y.add(e),M(w({port:e,framework:"one",bundleUrl:S(e,`http://localhost:${e}${n}&minify=false`),hmrUrl:`ws://localhost:${e}/hot`,lastSeen:Date.now()},i,t),t)):(d.add(e),null)}function re(e){return!!e.bundleId?.trim().toLowerCase()?.startsWith("dev.sootsim.")}var b=new Map,se=3e4,ie=1500;function ae(e){return!e||e.framework==="metro"||e.framework==="unknown"}function ce(e){return e?S(e.port,e.bundleUrl)===e.bundleUrl:!0}function ue(e,t,n=Date.now()){if(t===0||e.pid!==t||!ce(e.result))return!1;let o=n-e.cachedAt;return!(e.result===null&&o>=se||ae(e.result)&&o>=ie)}async function xe(e={}){let t=await Y(e.excludePorts),n=new Set(t.map(r=>r.port));for(let r of[...b.keys()])n.has(r)||b.delete(r);for(let r of[...d])n.has(r)||d.delete(r);for(let r of[...g])n.has(r)||g.delete(r);for(let r of[...y])n.has(r)||y.delete(r);for(let r of[...v.keys()])n.has(r)||v.delete(r);let o=[],s=[];for(let{port:r,pid:c}of t){let u=b.get(r);if(u&&ue(u,c)){u.result&&o.push(u.result);continue}u&&u.pid!==c&&(d.delete(r),g.delete(r),y.delete(r),v.delete(r)),s.push({port:r,pid:c})}s.length>0&&(await Promise.all(s.map(c=>oe(c.port,e.buildIconProxyUrl)))).forEach((c,u)=>{let{port:l,pid:m}=s[u];m!==0&&b.set(l,{pid:m,result:c,cachedAt:Date.now()}),c&&o.push(c)});let i=new Map;for(let{port:r,pid:c}of t)c>0&&i.set(r,c);await Promise.all(o.map(async r=>{let c=i.get(r.port);if(!c)return;r.pid=c;let u=await Q(c);u&&(r.cwd=u)}));let a=new Set(i.values());for(let r of[...x.keys()])a.has(r)||x.delete(r);return o.filter(r=>!re(r))}import R from"fs";import f from"path";import{fileURLToPath as le}from"url";var P;function de(){if(P!==void 0)return P;let e=f.dirname(le(import.meta.url));for(let t=0;t<12&&e!==f.dirname(e);t++){if(R.existsSync(f.join(e,"packages/sootsim-engine/package.json"))&&R.existsSync(f.join(e,"public/sootsim")))return P=e,e;e=f.dirname(e)}return P=null,null}function Te(){if(process.env.SOOTSIM_HOME&&T())return null;let e=de();if(!e)return null;let t=f.join(e,"public/sootsim");return R.existsSync(f.join(t,"index.html"))&&R.existsSync(f.join(t,"engine/index.html"))&&R.existsSync(f.join(t,"engine-tenant/worker.js"))?t:null}export{j as a,me as b,I as c,pe as d,oe as e,xe as f,Te as g};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.202 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{H as t,N as n,P as l,j as r}from"./chunk-GZKT53SA.js";function m(){let e=t(),i=r()?n():null;return i&&l(i)?{primary:`engine dev source (:${i.bridgePort})`,installedRuntime:e?`installed runtime v${e}`:null,isDevBridge:!0}:{primary:e?`runtime v${e}`:"runtime not installed",installedRuntime:null,isDevBridge:!1}}export{m as a};
1
+ /*! sootsim v0.1.204 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{H as t,N as n,P as l,j as r}from"./chunk-C77XHORB.js";function m(){let e=t(),i=r()?n():null;return i&&l(i)?{primary:`engine dev source (:${i.bridgePort})`,installedRuntime:e?`installed runtime v${e}`:null,isDevBridge:!0}:{primary:e?`runtime v${e}`:"runtime not installed",installedRuntime:null,isDevBridge:!1}}export{m as a};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.202 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as r}from"./chunk-RWXCSRNE.js";var c=["ghs_","ghp_","gho_","ghu_","github_pat_"];function d(n){return!!(n&&n.length>=20&&c.some(t=>n.startsWith(t)))}function p(){let n=process.env.SOOT_INSTALLATION_TOKEN?.trim(),t=process.env.GITHUB_TOKEN?.trim(),e=n||t;if(!d(e))return null;let o=(process.env.SOOT_REPO||process.env.GITHUB_REPOSITORY||"").trim();if(!o)return null;let[i,s]=o.includes("/")?o.split("/",2):[null,null],u=(process.env.SOOT_REPO_ID||process.env.GITHUB_REPOSITORY_ID||"").trim(),l=(process.env.SOOT_INSTALLATION_ID||process.env.GITHUB_APP_INSTALLATION_ID||"").trim();return{kind:"github",token:e,repoId:o,repositoryId:u||null,owner:i||null,repo:s||null,installationId:l||null,source:n?"soot-runner":"github-actions"}}function g(){let n=process.env.SOOTSIM_API_KEY?.trim();if(n&&n.startsWith("sk_sootsim_"))return{kind:"api-key",secret:n,source:"env"};let t=p();if(t)return t;let e=r();return e?.token?{kind:"session",token:e.token,origin:e.origin}:null}function a(n){return n.kind==="api-key"?`Bearer ${n.secret}`:`Bearer ${n.token}`}function _(n){return!n||n.kind!=="github"?null:{repoId:n.repoId,owner:n.owner??void 0,repo:n.repo??void 0,installationId:n.installationId}}export{g as a,a as b,_ as c};
1
+ /*! sootsim v0.1.204 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as r}from"./chunk-HLFAGJQS.js";var c=["ghs_","ghp_","gho_","ghu_","github_pat_"];function d(n){return!!(n&&n.length>=20&&c.some(t=>n.startsWith(t)))}function p(){let n=process.env.SOOT_INSTALLATION_TOKEN?.trim(),t=process.env.GITHUB_TOKEN?.trim(),e=n||t;if(!d(e))return null;let o=(process.env.SOOT_REPO||process.env.GITHUB_REPOSITORY||"").trim();if(!o)return null;let[i,s]=o.includes("/")?o.split("/",2):[null,null],u=(process.env.SOOT_REPO_ID||process.env.GITHUB_REPOSITORY_ID||"").trim(),l=(process.env.SOOT_INSTALLATION_ID||process.env.GITHUB_APP_INSTALLATION_ID||"").trim();return{kind:"github",token:e,repoId:o,repositoryId:u||null,owner:i||null,repo:s||null,installationId:l||null,source:n?"soot-runner":"github-actions"}}function g(){let n=process.env.SOOTSIM_API_KEY?.trim();if(n&&n.startsWith("sk_sootsim_"))return{kind:"api-key",secret:n,source:"env"};let t=p();if(t)return t;let e=r();return e?.token?{kind:"session",token:e.token,origin:e.origin}:null}function a(n){return n.kind==="api-key"?`Bearer ${n.secret}`:`Bearer ${n.token}`}function _(n){return!n||n.kind!=="github"?null:{repoId:n.repoId,owner:n.owner??void 0,repo:n.repo??void 0,installationId:n.installationId}}export{g as a,a as b,_ as c};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.204 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as d,b as p}from"./chunk-VEPYEPFT.js";import{execSync as c}from"child_process";function s(e){try{return c(e,{stdio:["ignore","pipe","ignore"],timeout:3e3,encoding:"utf8"}).trim()||null}catch{return null}}function o(e){let n=e?.trim();return!n||!/^\d+$/.test(n)?null:Number(n)}function m(){let e=s("git remote get-url origin");if(!e)return null;let n=e.match(/github\.com[/:]([^/\s]+)\/([^/\s]+?)(?:\.git)?\/?$/i);return n?{owner:n[1],repo:n[2]}:null}function f(){let e=process.env.GITHUB_ACTIONS==="true",n=(process.env.SOOT_REPO||process.env.GITHUB_REPOSITORY||"").trim(),[r,i]=n.includes("/")?n.split("/",2):[null,null];if(e){let u=process.env.GITHUB_REF?.match(/^refs\/pull\/(\d+)\//)?.[1];return{owner:r,repo:i,branch:process.env.GITHUB_HEAD_REF?.trim()||process.env.GITHUB_REF_NAME?.trim()||null,commitSha:process.env.GITHUB_SHA?.trim()||null,githubUsername:process.env.GITHUB_ACTOR?.trim()||null,pullRequestNumber:o(process.env.SOOT_PR_NUMBER)??o(u),githubRunId:process.env.GITHUB_RUN_ID?.trim()||null,source:"ci"}}let l=s("git rev-parse --abbrev-ref HEAD"),t=r?null:m();return{owner:r??t?.owner??null,repo:i??t?.repo??null,branch:l==="HEAD"?null:l,commitSha:s("git rev-parse HEAD"),githubUsername:null,pullRequestNumber:o(process.env.SOOT_PR_NUMBER),githubRunId:null,source:"cli"}}function R(e){if(e.length===0)return{stepCount:null,failedStepIndex:null};let n=e.find(r=>r.status==="failure");return{stepCount:e.length,failedStepIndex:n?n.stepIndex:null}}function b(e){return e.auth?e.uploadedShare?!0:e.auth.kind==="github"||process.env.GITHUB_ACTIONS==="true":!1}async function S(e){let n=e.auth??d();if(!n)return null;let r=f(),i=e.owner??(n.kind==="github"?n.owner:null)??r.owner,l=e.repo??(n.kind==="github"?n.repo:null)??r.repo;try{let t=await fetch(`${e.origin.replace(/\/$/,"")}/api/sootsim/test-runs`,{method:"POST",headers:{"content-type":"application/json",authorization:p(n)},body:JSON.stringify({kind:e.kind,source:r.source,name:e.name??void 0,prompt:e.prompt??void 0,summary:e.summary??void 0,status:e.status,failureMessage:e.failureMessage??void 0,previewShareId:e.previewShareId??void 0,owner:i??void 0,repo:l??void 0,branch:r.branch??void 0,commitSha:r.commitSha??void 0,githubUsername:r.githubUsername??void 0,pullRequestNumber:r.pullRequestNumber??void 0,githubRunId:r.githubRunId??void 0,stepCount:e.stepCount??void 0,failedStepIndex:e.failedStepIndex??void 0,durationMs:e.durationMs??void 0,flowYamlSizeBytes:e.flowYamlSizeBytes??void 0})});if(!t.ok){let a=await t.text().catch(()=>"");return console.warn(` warn: run registration failed: /api/sootsim/test-runs ${t.status}${a?`: ${a.slice(0,200)}`:""}`),null}let u=await t.json();return u.run?.id?{id:u.run.id,previewUrl:u.run.previewUrl??null,traceUrl:u.run.traceUrl??null}:(console.warn(" warn: run registration returned no id"),null)}catch(t){return console.warn(` warn: run registration failed: ${t instanceof Error?t.message:String(t)}`),null}}export{R as a,b,S as c};
@@ -0,0 +1,97 @@
1
+ /*! sootsim v0.1.204 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as Ie,b as Ae,c as Ue}from"./chunk-VEPYEPFT.js";import{c as ke}from"./chunk-R4XFWY2O.js";import{d as xe}from"./chunk-SQPLGMB6.js";import{g as Be,i as Ee,k as B}from"./chunk-3QH7DDPH.js";import{d as Re}from"./chunk-BASFSVR7.js";import{a as ve,b as k}from"./chunk-4E5IRWI7.js";import{a as Se}from"./chunk-HLFAGJQS.js";import{createHash as ft}from"crypto";import{readFileSync as U}from"fs";import Oe from"path";import{gzipSync as ae,gunzipSync as mt}from"zlib";function _e(e){let t=(e||"").toLowerCase().split(";")[0].trim();return t?!(t.startsWith("image/")||t.startsWith("video/")||t.startsWith("audio/")||t==="font/woff2"||t==="application/font-woff2"||t==="application/zip"||t==="application/gzip"):!0}import{brotliCompressSync as nt,constants as rt}from"node:zlib";var st=9;function Pe(e){return nt(e,{params:{[rt.BROTLI_PARAM_QUALITY]:st}})}function oe(e,t){let r=new AbortController,o=setTimeout(()=>r.abort(new Error(`${t} timed out after ${e/1e3}s`)),e);return{signal:r.signal,cancel:()=>clearTimeout(o)}}async function ot(e){let t=oe(12e4,`PUT ${e.url}`),r;try{r=await fetch(e.url,{method:"PUT",headers:{"content-type":e.contentType},body:e.bytes,signal:t.signal})}finally{t.cancel()}if(!r.ok){let o=await r.text().catch(()=>"");throw new Error(`PUT ${e.url} failed ${r.status}: ${o.slice(0,200)}`)}}async function it(e,t=8,r){let o=0,i=0,a=e.length;await Promise.all(Array.from({length:Math.min(t,a)},async()=>{for(;o<a;){let u=e[o++];await ot(u),i++,r?.(i,a)}}))}function at(e,t,r,o){let i=[];i.push({url:e.bundle.putUrl,contentType:e.bundle.contentType,bytes:t});for(let a of e.files){let u=r.get(a.urlhash);u&&i.push({url:a.putUrl,contentType:a.contentType,bytes:u})}e.events&&o?.eventsBytes&&i.push({url:e.events.putUrl,contentType:e.events.contentType,bytes:o.eventsBytes}),e.timeline&&o?.timelineBytes&&i.push({url:e.timeline.putUrl,contentType:e.timeline.contentType,bytes:o.timelineBytes}),e.flowVideo&&o?.videoBytes&&i.push({url:e.flowVideo.putUrl,contentType:e.flowVideo.contentType,bytes:o.videoBytes}),e.storage&&o?.storageBytes&&i.push({url:e.storage.putUrl,contentType:e.storage.contentType,bytes:o.storageBytes}),e.failureBundle&&o?.failureBundleBytes&&i.push({url:e.failureBundle.putUrl,contentType:e.failureBundle.contentType,bytes:o.failureBundleBytes});for(let a of e.snapshots??[]){let u=o?.snapshotBytes?.get(a.id);u&&i.push({url:a.putUrl,contentType:a.contentType,bytes:u})}return i}function lt(e){return e.replace(/\/+$/,"")}var J=class extends Error{constructor(r,o,i,a=""){super(r);this.status=o;this.phase=i;this.responseText=a;this.name="PresignedUploadError"}};async function Le(e){let t=lt(e.originBase),r={"content-type":"application/json"};e.authHeader&&(r.authorization=e.authHeader),e.adminBypassToken&&(r["x-soot-admin-upload-bypass"]=e.adminBypassToken);let o=oe(3e4,"init"),i;try{i=await fetch(`${t}/api/preview/upload/init`,{method:"POST",headers:r,body:JSON.stringify(e.initBody),signal:o.signal})}finally{o.cancel()}if(!i.ok){let g=await i.text().catch(()=>"");throw new J(`init failed: ${i.status} ${g.slice(0,200)}`,i.status,"init",g)}let a=await i.json(),u=at(a,e.bundleBytes,e.filesByHash,e.extras);await it(u,e.concurrency??8,e.onPutProgress);let b=oe(3e4,"finalize"),m;try{m=await fetch(`${t}/api/preview/upload/finalize`,{method:"POST",headers:r,body:JSON.stringify({token:a.token}),signal:b.signal})}finally{b.cancel()}if(!m.ok){let g=await m.text().catch(()=>"");throw new J(`finalize failed: ${m.status} ${g.slice(0,200)}`,m.status,"finalize",g)}let C=await m.json();return{init:a,finalize:C}}function ut(e){return e!==null&&typeof e=="object"?e:null}function Fe(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function ie(e){let t=ut(e);return t?t.schemaVersion===1&&Fe(t.t)!==void 0&&Fe(t.seq)!==void 0&&typeof t.context=="string"&&typeof t.kind=="string"&&"data"in t:!1}function ct(e,t){let r=[];for(let o of e.split(`
3
+ `)){let i=o.trim();if(i)try{let a=JSON.parse(i);t(a)&&r.push(a)}catch{}}return r}function $e(e){return ct(e,ie)}function gt(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 je=process.env.SOOTSIM_UPLOAD_ORIGIN||"https://sootbean.com",He=process.env.SOOTSIM_PREVIEW_ORIGIN||"https://sootsim.com",ue="http://localhost:3000",ht=2e3;async function yt(e){if(e)return e;if(process.env.SOOTSIM_UPLOAD_ORIGIN)return process.env.SOOTSIM_UPLOAD_ORIGIN;try{let t=await fetch(`${ue}/api/preview/upload/init`,{method:"OPTIONS",signal:AbortSignal.timeout(ht)});if(t.ok||t.status===204||t.status===405)return ue}catch{}return je}function F(e){return e.replace(/\/$/,"")}function bt(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 Mt(e){try{let t=new URL(e).hostname.toLowerCase();return t==="sootbean.com"||t.endsWith(".sootbean.com")}catch{return!1}}function wt(e,t){return t?F(t):process.env.SOOTSIM_PREVIEW_ORIGIN?F(process.env.SOOTSIM_PREVIEW_ORIGIN):bt(e)?F(e):Mt(e)?F(He):F(e)}function Tt(){console.log(`
4
+ sootsim record upload \u2014 publish the current recorded bundle as a /preview/<id> link
5
+
6
+ usage:
7
+ sootsim record upload [--origin <url>] [--public-origin <url>] (--events <path> | --video <path>) [--screenshot <path>] [--owner <org> --repo <repo>] [--sim <sim>] [--open] [--assets-only]
8
+
9
+ options:
10
+ --origin <url> upload target (default: auto)
11
+ prefers ${ue} when available, otherwise
12
+ falls back to ${je}
13
+ override with SOOTSIM_UPLOAD_ORIGIN env var
14
+ --public-origin <url>
15
+ public /preview link origin (default: ${He}
16
+ for prod uploads, upload origin for localhost/custom origins).
17
+ override with SOOTSIM_PREVIEW_ORIGIN env var
18
+ --events <path> path to a gzipped events .jsonl.gz file to attach
19
+ required unless --video is present; previews must
20
+ have replay or recording playback data
21
+ --screenshot <path>
22
+ path to a PNG thumbnail to attach to the share
23
+ --video <path> path to a mp4/gif flow recording. embedded inline
24
+ in the pr sticky comment served at
25
+ /api/preview/flow-video?id=<share-id>
26
+ --video-duration-ms <ms>
27
+ duration hint for attached flow video
28
+ --timeline-events <path>
29
+ extra trace timeline rows, JSONL or JSONL gz
30
+ --trace-frame-stats <path>
31
+ frame stats JSON returned by the recorder bridge
32
+ --failure-bundle <dir>
33
+ per-failure debug bundle dir written by the flow runner
34
+ (error.json, describe.json, a11y.txt, tree.txt,
35
+ console.json, screenshot.png). uploaded with the share
36
+ so failed CI runs are debuggable from the dashboard
37
+ --owner <org> associate a session upload with a linked org repo
38
+ --repo <repo> repo name for --owner; the signed-in user must belong
39
+ to the local/org team that owns the link
40
+ --billing-kind test_run
41
+ meter this upload as a natural-language test run
42
+ --sim <sim> target a specific sim (see: sootsim list)
43
+ --open open the resulting /preview/<id> url in the browser
44
+ --assets-only drop API/JSON/HTML records before upload; keep images,
45
+ fonts, css, js, and binary blobs. live-data demos hit
46
+ the real network at replay time instead of serving
47
+ recorded API snapshots
48
+ -h, --help
49
+
50
+ examples:
51
+ sootsim record upload --events ./my-session.jsonl.gz
52
+ sootsim record upload --origin http://localhost:3000 --events ./my-session.jsonl.gz --open
53
+ sootsim record upload --video /tmp/soot-flow.mp4 --video-duration-ms 12000
54
+ `)}function d(e,t){let r=e.findIndex(i=>i===t);if(r<0)return;let o=e[r+1];return e.splice(r,2),o}function Ce(e,t){let r=e.findIndex(o=>o===t);return r<0?!1:(e.splice(r,1),!0)}function Ne(e,t){if(!e)return;let r=Number(e);return(!Number.isFinite(r)||r<=0)&&(console.error(` invalid ${t}: ${e}`),process.exit(1)),Math.round(r)}function ze(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 De(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 St(e){return/\.bundle($|\?)/.test(e)||/\.js($|\?)/.test(e)?"application/javascript":/\.zip($|\?)/.test(e)?"application/zip":"application/javascript"}function vt(e){try{return new URL(e).searchParams.get("appFonts")||""}catch{return""}}function xt(e){try{return new URL(e).searchParams.get("appSplash")||""}catch{return""}}function kt(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 Bt(e,t){let o=[];for(let i=0;i<t;i+=15e5){let a=Math.min(i+15e5,t),u=await B(e,`(window.__sootsimLastTransformedBundle?.text || "").slice(${i}, ${a})`);if(typeof u!="string")return null;o.push(u)}return o.join("")}function Et(e){return e.recordedDurationMs&&e.recordingStartedAtMs?{since:e.recordingStartedAtMs-1e4,until:e.recordingStartedAtMs+e.recordedDurationMs+5e3,limit:2e3}:{limit:2e3}}function Rt(e){let t=U(e),o=(t[0]===31&&t[1]===139?mt(t):t).toString("utf8");return $e(o)}function It(e){return JSON.parse(U(e,"utf8"))}function At(e){if(e===null||typeof e!="object")return[];let t=e,r=typeof t.startedAtEpochMs=="number"&&t.startedAtEpochMs>0?t.startedAtEpochMs:null;if(r===null||!Array.isArray(t.samples))return[];let o=[];for(let i of t.samples){if(!Array.isArray(i)||typeof i[0]!="number")continue;let a=u=>typeof u=="number"&&Number.isFinite(u)?Math.round(u*100)/100:0;o.push({schemaVersion:1,t:r+Math.round(i[0]),seq:o.length+1,context:"tenant",kind:"frame",data:{totalMs:a(i[1]),layoutMs:a(i[2]),renderMs:a(i[3]),copyMs:a(i[4])}})}return o}function Ut(e){if(e===null||typeof e!="object")return e;let{samples:t,...r}=e;return r}function le(e){let t=new Map;for(let r of e)t.set(r.urlhash||r.url,r);return Array.from(t.values())}async function Zt(e,t){(e.includes("--help")||e.includes("-h"))&&(Tt(),process.exit(0));let r=[...e],o=await yt(d(r,"--origin")),i=wt(o,d(r,"--public-origin")),a=d(r,"--events"),u=d(r,"--screenshot"),b=d(r,"--video"),m=d(r,"--timeline-events"),C=d(r,"--trace-frame-stats"),g=d(r,"--failure-bundle"),K=d(r,"--video-duration-ms"),ce=Ne(d(r,"--recorded-duration-ms"),"--recorded-duration-ms"),de=Ne(d(r,"--recording-started-at-ms"),"--recording-started-at-ms"),q=d(r,"--owner"),V=d(r,"--repo"),N=d(r,"--billing-kind"),Je=Ce(r,"--open");(q&&!V||!q&&V)&&(console.error(" --owner and --repo must be provided together"),process.exit(1)),N&&N!=="test_run"&&(console.error(` invalid --billing-kind: ${N}`),process.exit(1)),!a&&!b&&(console.error(" preview uploads require playback data: pass --events or --video.\n for a normal local preview, use `sootsim record --mode combined --open`\n or `sootsim flow --preview` instead of uploading a bundle-only snapshot."),process.exit(1));let pe=Ce(r,"--assets-only"),Ke=Be(r,{stripBooleanFlags:[],stripValueFlags:[]}),M=Ee(Ke),c,fe=[],w=[],T=m?Rt(m):[],me=C?It(C):null;T.push(...At(me));let ge=T.length,W=null;try{if(c=await B(M,'(typeof window.__sootsimCaptureBundle === "function") ? window.__sootsimCaptureBundle() : null'),c?.bundleUrl){let l=new URL(c.bundleUrl).origin,[p,A]=await Promise.all([B(M,`(window.__sootsimPreviewRecorder?.list?.(${JSON.stringify(l)}) || [])`),B(M,`(async () => {
55
+ const list = window.__sootsimListWorkerFetchRecorder
56
+ return typeof list === 'function'
57
+ ? await list(${JSON.stringify(l)})
58
+ : []
59
+ })()`)]);fe=le([...p,...A]).filter(f=>{try{return!new URL(f.url).pathname.startsWith("/api/")}catch{return!0}});let L=await B(M,`(async () => {
60
+ const rec = window.__sootsimPreviewRecorder
61
+ const workerList = window.__sootsimListWorkerFetchRecorder
62
+ return {
63
+ main: rec?.list ? rec.list() : [],
64
+ worker: typeof workerList === 'function' ? await workerList() : [],
65
+ }
66
+ })()`),O=(L?le([...L.main,...L.worker]):[]).filter(f=>{try{return new URL(f.url).origin!==l}catch{return!1}}),x=O.length>0?{count:O.length,totalBytes:O.reduce((f,re)=>f+(re.size||0),0)}:null;if(x&&x.count>0){console.log(` ${x.count} recorded cross-origin responses (${(x.totalBytes/1024).toFixed(1)} KiB)`);let f=await B(M,`(async () => {
67
+ const rec = window.__sootsimPreviewRecorder
68
+ const workerDump = window.__sootsimDumpWorkerFetchRecorder
69
+ const bundleUrl = ${JSON.stringify(c.bundleUrl)}
70
+ const keep = (r) => {
71
+ try {
72
+ const u = new URL(r.url)
73
+ if (u.origin !== ${JSON.stringify(l)}) return true
74
+ // bundle-origin api responses came from the rewritten
75
+ // /__app-api proxy at record time (re-keyed by the
76
+ // recorder's unwrap step). they need bodies attached the
77
+ // same way as cross-origin records \u2014 direct re-fetch from
78
+ // the dev server lacks the bundle's session cookies.
79
+ if (r.url !== bundleUrl && u.pathname.startsWith('/api/')) return true
80
+ return false
81
+ } catch { return false }
82
+ }
83
+ return {
84
+ main: rec?.dump ? rec.dump().filter(keep) : [],
85
+ worker: typeof workerDump === 'function'
86
+ ? (await workerDump()).filter(keep)
87
+ : [],
88
+ }
89
+ })()`);if(w=le([...f.main,...f.worker]),pe){let re=w.length;w=w.filter(se=>ze(se.contentType));let et=x.totalBytes-w.reduce((se,tt)=>se+(tt.size||0),0);console.log(` --assets-only: kept ${w.length}/${re} records (dropped ${(et/1024).toFixed(1)} KiB of API responses)`)}}}c?.transformedBundle&&(W=await Bt(M,c.transformedBundle.byteLength));let n=await B(M,`(() => {
90
+ const bridge = window.SootSim?.bridges?.timeline ?? window.__sootsimTimeline
91
+ if (!bridge || typeof bridge.recent !== 'function') return null
92
+ return bridge.recent(${JSON.stringify(Et({recordedDurationMs:ce,recordingStartedAtMs:de}))})
93
+ })()`).catch(l=>(console.warn(` warning: failed to capture trace timeline: ${l instanceof Error?l.message:String(l)}`),null)),s=Array.isArray(n?.events)?n.events:[];T=[...T,...s.filter(ie)].sort((l,p)=>l.t-p.t||l.seq-p.seq)}finally{M.close()}c||(console.error(" could not read bundle snapshot \u2014 is sootsim running and is the bundle loaded?"),process.exit(2)),c.bundleUrl||(console.error(` no ?bundle= URL on the current sootsim tab.
94
+ open the app you want to share first (e.g. sootsim open 8082), then run upload.`),process.exit(2));let h,G=!1;if(W!==null)h=new TextEncoder().encode(W),G=!0,console.log(` using post-transform bundle: ${(h.byteLength/1024).toFixed(1)} KiB`);else{let n=kt(c.bundleUrl);n!==c.bundleUrl&&console.log(" forcing lazy=false for self-contained bundle"),console.log(` capturing: ${n}`),h=await De(n),console.log(` main bundle: ${(h.byteLength/1024).toFixed(1)} KiB`)}let z=fe.filter(n=>n.url!==c.bundleUrl);pe&&(z=z.filter(n=>ze(n.contentType))),console.log(` fetching ${z.length} extra files\u2026`);let D=(await Promise.all(z.map(async n=>{try{let s=await De(n.url);return{...n,bytes:s}}catch(s){return console.error(` warning: failed to re-fetch ${n.url}: ${s instanceof Error?s.message:s}`),null}}))).filter(n=>!!n),qe=D.reduce((n,s)=>n+s.bytes.byteLength,0);console.log(` ${D.length} extra files: ${(qe/1024).toFixed(1)} KiB`);let E;a&&(E=U(a)),T.sort((n,s)=>n.t-s.t||n.seq-s.seq);let he=T.map(n=>JSON.stringify(n)).join(`
95
+ `),Y=ae(he?`${he}
96
+ `:"");console.log(` trace timeline: ${T.length} events${ge?` (${ge} from runner sidecars)`:""}`);let y;u&&(y=U(u),console.log(` attaching screenshot: ${(y.byteLength/1024).toFixed(1)} KiB`));let R,I;if(g){let n=p=>{try{return U(Oe.join(g,p),"utf8")}catch{return null}},s=p=>{let A=n(p);if(A===null)return null;try{return JSON.parse(A)}catch{return A}},l={error:s("error.json"),describe:s("describe.json"),console:s("console.json"),a11y:n("a11y.txt"),tree:n("tree.txt")};Object.values(l).some(p=>p!==null)&&(R=ae(JSON.stringify(l)),console.log(` attaching failure bundle: ${(R.byteLength/1024).toFixed(1)} KiB gz`));try{I=U(Oe.join(g,"screenshot.png"))}catch{}}let S,$,ye;if(b){if(S=U(b),$=b.endsWith(".mp4")?"video/mp4":b.endsWith(".gif")?"image/gif":void 0,$||(console.error(" preview flow videos must be mp4 or gif"),await k(),process.exit(1)),K){let n=Number(K);(!Number.isFinite(n)||n<=0)&&(console.error(` invalid --video-duration-ms: ${K}`),await k(),process.exit(1)),ye=Math.round(n)}console.log(` attaching flow video: ${(S.byteLength/1024).toFixed(1)} KiB (${$})`)}let _=Ie(),P=Ue(_),Ve=Se();ve({event:"preview_upload_started",identity:{userId:_?.kind==="session"?Ve?.user?.id??null:null,repoId:P?.repoId??null,installationId:P?.installationId??null},properties:{origin:o,hasAuth:!!_,authMode:_?.kind??"none",bundleBytes:h.byteLength,isTransformed:G,extraFiles:D.length,recordedFetches:w.length,hasEvents:!!E,traceTimelineEvents:T.length,hasScreenshot:!!y,hasVideo:!!S}}),_||(console.error(" preview uploads need auth."),console.error(" set SOOTSIM_API_KEY=sk_sootsim_..., run `sootsim login`, or use the soot github runner."),await k(),process.exit(1));let We=Ae(_),Ge=(()=>{try{return new URL(c.bundleUrl).origin}catch{return null}})(),j=(n,s,l,p,A,L,Te,O)=>{let x=_e(L),f=x?ae(n):n;return{url:s,urlhash:l,method:p,bodyHash:A,requestVaryHash:O,contentType:L,responseHeaders:Te,bytes:f,encoding:x?"gzip":void 0}},be=[],Q=vt(c.pageHref)||"";if(Q){let n=await xe(Q,{onStaged:({url:s,byteLength:l})=>console.log(` staged app font: ${s} (${(l/1024).toFixed(1)} KiB)`),onError:(s,l)=>console.error(` warning: failed to fetch app font ${s}: ${l instanceof Error?l.message:l}`)});for(let s of n)be.push(j(Buffer.from(s.bytes),s.url,s.urlhash,"GET","-",s.contentType))}let Me=[],X=xt(c.pageHref)||"";if(X){let n=await ke(X,{onStaged:({url:s,byteLength:l})=>console.log(` staged splash image: ${s} (${(l/1024).toFixed(1)} KiB)`),onError:(s,l)=>console.error(` warning: failed to fetch splash image ${s}: ${l instanceof Error?l.message:l}`)});for(let s of n)Me.push(j(Buffer.from(s.bytes),s.url,s.urlhash,"GET","-",s.contentType))}let Z=[...D.map(n=>j(n.bytes,n.url,n.urlhash,"GET","-",n.contentType,n.responseHeaders,n.requestVaryHash)),...w.map(n=>j(Buffer.from(n.bodyBase64,"base64"),n.url,n.urlhash,n.method||"GET",n.bodyHash||"-",n.contentType,n.responseHeaders,n.requestVaryHash)),...be,...Me],ee=Pe(h),Ye=ft("sha256").update(h).digest("hex");console.log(` bundle raw=${(h.byteLength/1024).toFixed(1)} KiB br=${(ee.byteLength/1024).toFixed(1)} KiB`);let Qe={contentHash:Ye,bundleSizeBytes:h.byteLength,bundleContentType:St(c.bundleUrl),bundleEncoding:"br",bundleOrigin:Ge,runtimeVersion:c.runtimeVersion??void 0,appFonts:Q||void 0,appSplash:X||void 0,entry:c.entry,isTransformed:G,deviceSpec:c.deviceSpec,installationId:P?.installationId??void 0,repoId:P?.repoId,owner:q??P?.owner,repo:V??P?.repo,billingKind:N==="test_run"?"test_run":void 0,files:Z.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:E?{sizeBytes:E.byteLength}:void 0,timeline:{sizeBytes:Y.byteLength,encoding:"gzip"},traceFrameStats:Ut(me),recordedDurationMs:ce,recordingStartedAtMs:de,failureBundle:R?{sizeBytes:R.byteLength,encoding:"gzip"}:void 0,snapshots:(()=>{let n=[];return y&&n.push({id:"landing",label:"Landing",kind:"landing",t:0,contentType:"image/png",sizeBytes:y.byteLength}),I&&n.push({id:"failure",label:"Failure",kind:"failure",contentType:"image/png",sizeBytes:I.byteLength}),n.length>0?n:void 0})(),flowVideo:S&&$?{sizeBytes:S.byteLength,contentType:$,durationMs:ye}:void 0},we=new Map;for(let n of Z)we.set(n.urlhash,n.bytes);let te=new Map;y&&te.set("landing",y),I&&te.set("failure",I);let Xe=Date.now(),v=ee.byteLength;for(let n of Z)v+=n.bytes.byteLength;E&&(v+=E.byteLength),v+=Y.byteLength,y&&(v+=y.byteLength),I&&(v+=I.byteLength),R&&(v+=R.byteLength),S&&(v+=S.byteLength);let Ze=`${F(o)}/api/preview/upload/init`;console.log(` init: ${Ze}`);let H;try{let n=await Le({originBase:o,initBody:Qe,bundleBytes:ee,filesByHash:we,extras:{eventsBytes:E,timelineBytes:Y,videoBytes:S,failureBundleBytes:R,snapshotBytes:te},authHeader:We,concurrency:16});H=n.finalize;let s=1+n.init.files.length+(n.init.events?1:0)+(n.init.timeline?1:0)+n.init.snapshots.length+(n.init.flowVideo?1:0)+(n.init.failureBundle?1:0);console.log(` PUT ${s} objects in ${Date.now()-Xe}ms (${(v/1024).toFixed(1)} KiB)`)}catch(n){let s=n;s.phase==="init"&&s.status===401&&(console.error(" preview upload requires a valid login."),console.error(" run `sootsim login` and retry."),await k(),process.exit(1)),s.status===402&&(console.error(` ${gt(s.responseText)??"preview uploads require Personal, Team, or an active trial \u2014 upgrade from the billing dialog."}`),await k(),process.exit(1)),console.error(` ${s.message??`${s.phase??"upload"} failed: ${String(n)}`}`),await k(),process.exit(1)}let ne=`${i}${H.url}`;return console.log(`
97
+ stored ${H.filesStored??0} extra files`),console.log(` preview: ${ne}`),Je&&await Re(ne),await k(),{previewUrl:ne,shareId:H.id}}export{yt as a,wt as b,Zt as c};