sootsim 0.1.36 → 0.1.38
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.
- package/README.md +20 -5
- package/dist-cli/bin.js +15 -20
- package/dist-cli/chunks/{agent-YZB6D3DR.js → agent-CGQWOOOL.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-VHCVS22I.js → agent-wrapper-M6P53GJ2.js} +10 -10
- package/dist-cli/chunks/{assert-AIVCKKLG.js → assert-O7N2SYJZ.js} +2 -2
- package/dist-cli/chunks/auto-bootstrap-DF4KYGPS.js +2 -0
- package/dist-cli/chunks/beta-AK25X3AU.js +2 -0
- package/dist-cli/chunks/chunk-23YMXBQ2.js +1 -0
- package/dist-cli/chunks/chunk-2ABGQIW7.js +4 -0
- package/dist-cli/chunks/chunk-5HNZO5AI.js +7 -0
- package/dist-cli/chunks/chunk-5XI3AB4I.js +3 -0
- package/dist-cli/chunks/{chunk-IJMYFYDZ.js → chunk-67K3WAEZ.js} +2 -2
- package/dist-cli/chunks/chunk-6UJXRT7F.js +5 -0
- package/dist-cli/chunks/chunk-ARH3T5NK.js +66 -0
- package/dist-cli/chunks/{chunk-VFDRZNPN.js → chunk-B4VH67D3.js} +1 -1
- package/dist-cli/chunks/chunk-BEY2QVU5.js +3 -0
- package/dist-cli/chunks/chunk-CB4PUMI2.js +1 -0
- package/dist-cli/chunks/chunk-CHMHTTI7.js +11 -0
- package/dist-cli/chunks/chunk-E473YTRQ.js +2 -0
- package/dist-cli/chunks/chunk-FCOCFEBU.js +27 -0
- package/dist-cli/chunks/chunk-FRE5TY3C.js +1 -0
- package/dist-cli/chunks/chunk-FX3PPKSJ.js +2 -0
- package/dist-cli/chunks/{chunk-27P763IZ.js → chunk-FXY5FWVY.js} +2 -2
- package/dist-cli/chunks/{chunk-A5BRCXYE.js → chunk-G23GIRBM.js} +1 -1
- package/dist-cli/chunks/chunk-G62Q2MQI.js +1 -0
- package/dist-cli/chunks/chunk-GWQUPWVO.js +2 -0
- package/dist-cli/chunks/{chunk-EWSQSALM.js → chunk-H6CG42HE.js} +4 -4
- package/dist-cli/chunks/chunk-HNAGYNWN.js +16 -0
- package/dist-cli/chunks/{chunk-KAXZHEKM.js → chunk-IE2WYVJF.js} +1 -1
- package/dist-cli/chunks/chunk-IKVIHHWE.js +2 -0
- package/dist-cli/chunks/chunk-JJVZMGRM.js +2 -0
- package/dist-cli/chunks/{chunk-HWCKZXNJ.js → chunk-LNRBXCUI.js} +2 -2
- package/dist-cli/chunks/{chunk-CYCXOAVZ.js → chunk-MTPWS4JK.js} +4 -4
- package/dist-cli/chunks/{chunk-G7XQD4KC.js → chunk-NKYTISAN.js} +2 -2
- package/dist-cli/chunks/chunk-NSZBULGG.js +348 -0
- package/dist-cli/chunks/chunk-P32FCOS3.js +4 -0
- package/dist-cli/chunks/chunk-P722XCFT.js +3 -0
- package/dist-cli/chunks/chunk-PFRPXFSL.js +117 -0
- package/dist-cli/chunks/chunk-QD22CQLH.js +5 -0
- package/dist-cli/chunks/chunk-QI4VLQ3A.js +5 -0
- package/dist-cli/chunks/{chunk-OXN2PEB7.js → chunk-SKNHJDYO.js} +3 -3
- package/dist-cli/chunks/{chunk-YIO6S3R5.js → chunk-T442FYM5.js} +1 -1
- package/dist-cli/chunks/chunk-TR554AIH.js +17 -0
- package/dist-cli/chunks/chunk-UD5ILFN5.js +3 -0
- package/dist-cli/chunks/{chunk-LHDWH7VS.js → chunk-VIEK76DX.js} +1 -1
- package/dist-cli/chunks/chunk-VVUEWU2P.js +64 -0
- package/dist-cli/chunks/{chunk-RMW5BO3S.js → chunk-Z2PBRNJP.js} +2 -2
- package/dist-cli/chunks/chunk-ZEVZN3S4.js +2 -0
- package/dist-cli/chunks/{compat-Y2O2U7FL.js → compat-DNQWSPFQ.js} +2 -2
- package/dist-cli/chunks/{config-SRBOFUCI.js → config-ABR5BGUO.js} +2 -2
- package/dist-cli/chunks/control-DEHRU4XZ.js +2 -0
- package/dist-cli/chunks/cpu-profile-Y5YDH6X2.js +22 -0
- package/dist-cli/chunks/daemon-2Z4DAJT6.js +83 -0
- package/dist-cli/chunks/{debug-BIDMW2PE.js → debug-R36UPOJP.js} +4 -4
- package/dist-cli/chunks/demo-app-registry-DMMWYL7G.js +2 -0
- package/dist-cli/chunks/detox-FQJWEWLT.js +49 -0
- package/dist-cli/chunks/device-SXKLDZEC.js +16 -0
- package/dist-cli/chunks/diagnose-M7RKNI2H.js +41 -0
- package/dist-cli/chunks/drivers-NSCX5CRA.js +2 -0
- package/dist-cli/chunks/electron-YUAKGT4H.js +18 -0
- package/dist-cli/chunks/flow-UQSRNEZD.js +2 -0
- package/dist-cli/chunks/hints-SDD7L3VS.js +2 -0
- package/dist-cli/chunks/home-paths-QMCX2227.js +2 -0
- package/dist-cli/chunks/inspect-6FPPW7GS.js +1101 -0
- package/dist-cli/chunks/install-TTH3PM3B.js +2 -0
- package/dist-cli/chunks/{install-desktop-2MYEI4FM.js → install-desktop-EKMYRDQH.js} +3 -3
- package/dist-cli/chunks/{keys-7PNASIQR.js → keys-ODG3TDUP.js} +2 -2
- package/dist-cli/chunks/{launch-JNS47LAQ.js → launch-7HUL745I.js} +3 -3
- package/dist-cli/chunks/{login-YWZWUHBS.js → login-BJKQMJYT.js} +4 -4
- package/dist-cli/chunks/{logout-O6SXMSBP.js → logout-7NG3KGJD.js} +2 -2
- package/dist-cli/chunks/maestro-VFEUWV3Q.js +80 -0
- package/dist-cli/chunks/{preview-WGKJO5FS.js → preview-WZ6XNOBC.js} +2 -2
- package/dist-cli/chunks/profile-DXFEZOHB.js +22 -0
- package/dist-cli/chunks/react-QP7PL5CZ.js +30 -0
- package/dist-cli/chunks/{record-QPWLYH5R.js → record-AFE25EMH.js} +5 -5
- package/dist-cli/chunks/{runtime-KEMO2MSB.js → runtime-GFWS3QLZ.js} +3 -3
- package/dist-cli/chunks/screenshot-U6VFOVFW.js +28 -0
- package/dist-cli/chunks/screenshot-mode-HNGV3AFC.js +17 -0
- package/dist-cli/chunks/screenshots-GYMRDUJR.js +70 -0
- package/dist-cli/chunks/server-3Q22YYM6.js +35 -0
- package/dist-cli/chunks/setup-repo-NNDWIGZR.js +2 -0
- package/dist-cli/chunks/{skills-MO7BFNVM.js → skills-FT76ZVAV.js} +2 -2
- package/dist-cli/chunks/start-N573LFCF.js +23 -0
- package/dist-cli/chunks/store-6NTDGLPH.js +2 -0
- package/dist-cli/chunks/telemetry-SNZBIRGL.js +2 -0
- package/dist-cli/chunks/{test-XUI3KNNQ.js → test-AJPY2Q6W.js} +3 -3
- package/dist-cli/chunks/three-mode-JZZVOMTG.js +39 -0
- package/dist-cli/chunks/timeline-GTSCF5P6.js +22 -0
- package/dist-cli/chunks/upload-UHTVCGGR.js +2 -0
- package/dist-cli/chunks/what-happened-N3AQ6I7O.js +15 -0
- package/dist-cli/chunks/whoami-FOIMN6UC.js +2 -0
- package/dist-lib/agent-daemon-client.cjs +4 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +41 -39
- package/dist-lib/attached-projects.cjs +30 -28
- package/dist-lib/auth/shared-session.cjs +35 -27
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/config.cjs +6 -2
- package/dist-lib/dev-bundle-resolution.cjs +5 -50
- package/dist-lib/home-paths.cjs +94 -38
- package/dist-lib/host/bridge-host.cjs +2144 -1330
- package/dist-lib/host/fetch-proxy-handler.cjs +248 -0
- package/dist-lib/index.cjs +21 -21
- package/dist-lib/metro.cjs +21 -21
- package/dist-lib/profiles.cjs +246 -0
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/vite-base.cjs +3410 -1632
- package/dist-lib/vite.cjs +1 -1
- package/package.json +7 -1
- package/dist-cli/chunks/auto-bootstrap-MLNTX23H.js +0 -2
- package/dist-cli/chunks/chunk-3UIWOHC2.js +0 -62
- package/dist-cli/chunks/chunk-5KGFHWVR.js +0 -1
- package/dist-cli/chunks/chunk-5QIUJNT3.js +0 -5
- package/dist-cli/chunks/chunk-6GGMKFWJ.js +0 -4
- package/dist-cli/chunks/chunk-6Z275LCY.js +0 -2
- package/dist-cli/chunks/chunk-75LBYBKW.js +0 -11
- package/dist-cli/chunks/chunk-DFN3GGH7.js +0 -5
- package/dist-cli/chunks/chunk-EBEHZJRG.js +0 -117
- package/dist-cli/chunks/chunk-EJLNUMMP.js +0 -3
- package/dist-cli/chunks/chunk-FE7UI3MT.js +0 -4
- package/dist-cli/chunks/chunk-G663654J.js +0 -1
- package/dist-cli/chunks/chunk-GW7XY5KC.js +0 -2
- package/dist-cli/chunks/chunk-H2QO4TDV.js +0 -22
- package/dist-cli/chunks/chunk-HWFHBMAQ.js +0 -27
- package/dist-cli/chunks/chunk-J7CTD37P.js +0 -1
- package/dist-cli/chunks/chunk-N32NCVL2.js +0 -3
- package/dist-cli/chunks/chunk-NIZBR7EK.js +0 -2
- package/dist-cli/chunks/chunk-NYY36OKU.js +0 -308
- package/dist-cli/chunks/chunk-PJL25JQV.js +0 -5
- package/dist-cli/chunks/chunk-SHO54NET.js +0 -2
- package/dist-cli/chunks/chunk-SMVJOWSV.js +0 -16
- package/dist-cli/chunks/chunk-TC6V7YFC.js +0 -3
- package/dist-cli/chunks/chunk-YLIIVTTQ.js +0 -3
- package/dist-cli/chunks/chunk-YR7BGGYE.js +0 -2
- package/dist-cli/chunks/chunk-ZEW3RF5Q.js +0 -1
- package/dist-cli/chunks/control-PL2V2O6S.js +0 -2
- package/dist-cli/chunks/daemon-IZC32PZW.js +0 -50
- package/dist-cli/chunks/demo-app-registry-5JFOUU3D.js +0 -2
- package/dist-cli/chunks/detox-B3FDOIS3.js +0 -49
- package/dist-cli/chunks/device-ZZSI363W.js +0 -16
- package/dist-cli/chunks/drivers-S4NGK4DB.js +0 -2
- package/dist-cli/chunks/electron-5YFHXEOI.js +0 -15
- package/dist-cli/chunks/flow-JJBO6TFY.js +0 -2
- package/dist-cli/chunks/hints-G5HBBV2O.js +0 -2
- package/dist-cli/chunks/home-paths-VWC3FWA3.js +0 -2
- package/dist-cli/chunks/inspect-POOPWUQI.js +0 -1034
- package/dist-cli/chunks/install-MP6FHXNZ.js +0 -2
- package/dist-cli/chunks/install-dev-desktop-SKH3KEHY.js +0 -100
- package/dist-cli/chunks/maestro-CW6XVUKV.js +0 -75
- package/dist-cli/chunks/profile-SUOBRPIC.js +0 -22
- package/dist-cli/chunks/screenshot-JTY46V7G.js +0 -26
- package/dist-cli/chunks/screenshot-mode-7OYBBX6D.js +0 -17
- package/dist-cli/chunks/screenshots-QISKC4GD.js +0 -70
- package/dist-cli/chunks/server-YSFJAKAV.js +0 -34
- package/dist-cli/chunks/setup-repo-LFB3HBEO.js +0 -2
- package/dist-cli/chunks/store-6MFL53I4.js +0 -2
- package/dist-cli/chunks/telemetry-CN42GMVC.js +0 -2
- package/dist-cli/chunks/upload-6FUT7AX5.js +0 -2
- package/dist-cli/chunks/whoami-TQFHY42N.js +0 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*! sootsim v0.1.38 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{d as g,e as u}from"./chunk-UD5ILFN5.js";import{a as l}from"./chunk-BEY2QVU5.js";var c="https://sootbean.com";function d(e){let n=e.replace(/^\[|\]$/g,"").toLowerCase();return n==="localhost"||n.endsWith(".localhost")||n==="0.0.0.0"||n==="::1"||/^127(?:\.\d{1,3}){3}$/.test(n)}function h(e){let{currentOrigin:n,search:r="",explicitOrigin:s}=e;if(s)return s;let a=new URLSearchParams(r).get("sootbean");if(a)return a;try{let i=new URL(n);if(d(i.hostname)){if(i.port==="3000")return i.origin;let t=new URL(i.origin);return t.port="3000",t.origin}if(i.hostname==="sootbean.com"||i.hostname.endsWith(".sootbean.com"))return i.origin}catch{return c}return c}function f(){return typeof window>"u"?c:h({currentOrigin:window.location.origin,search:window.location.search,explicitOrigin:window.__sootsimSootbeanOrigin})}var p=f();function m(e,n){if(n)return n.replace(/\/$/,"");if(e.kind==="session"&&e.origin)return e.origin.replace(/\/$/,"");let r=l();return r?.origin?r.origin.replace(/\/$/,""):p.replace(/\/$/,"")}async function $(e,n={}){let r=g();if(r||(process.stderr.write(`
|
|
3
|
+
sootsim ${e} needs auth before it can check recording access.
|
|
4
|
+
|
|
5
|
+
pick one:
|
|
6
|
+
\u2022 run \`sootsim login\`
|
|
7
|
+
\u2022 set SOOTSIM_API_KEY=sk_sootsim_... (recommended for CI)
|
|
8
|
+
\u2022 save a personal key with \`sootsim keys use sk_sootsim_...\`
|
|
9
|
+
|
|
10
|
+
`),process.exit(1)),r.kind==="github"&&n.allowGitHubAuth)return;let s=m(r,n.originOverride),o;try{o=await fetch(`${s}/api/sootsim/billing/subscription`,{headers:{authorization:u(r)}})}catch(t){process.stderr.write(`
|
|
11
|
+
sootsim ${e} couldn't verify recording access.
|
|
12
|
+
${t instanceof Error?t.message:String(t)}
|
|
13
|
+
|
|
14
|
+
`),process.exit(1)}if(o.status===401&&(process.stderr.write(`
|
|
15
|
+
sootsim ${e} couldn't verify recording access with the current auth against ${s}.
|
|
16
|
+
sign in again for that origin, or provide a valid SOOTSIM_API_KEY.
|
|
17
|
+
|
|
18
|
+
`),process.exit(1)),!o.ok){let t=await o.text().catch(()=>"");process.stderr.write(`
|
|
19
|
+
sootsim ${e} couldn't verify recording access (${o.status}).
|
|
20
|
+
${t||"unexpected billing response"}
|
|
21
|
+
|
|
22
|
+
`),process.exit(1)}let a=await o.json();if(a.entitlements?.desktopRecording===!0)return;let i=a.plan??"free";process.stderr.write(`
|
|
23
|
+
sootsim ${e} recording requires Personal, Team, or an active trial.
|
|
24
|
+
current plan: ${i}.
|
|
25
|
+
free keeps basic 3d mode; the trial unlocks the full Personal surface.
|
|
26
|
+
|
|
27
|
+
`),process.exit(1)}export{$ as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! sootsim v0.1.38 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as P,b as v}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.38 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as P,b as v}from"./chunk-B4VH67D3.js";import{d as j}from"./chunk-5HNZO5AI.js";import{a as b}from"./chunk-67K3WAEZ.js";import{execSync as A}from"child_process";import{existsSync as w,readFileSync as _,writeFileSync as x}from"fs";import{relative as B,resolve as m}from"path";import{existsSync as a,readFileSync as k,readdirSync as O,statSync as R}from"fs";import{basename as L,dirname as T,join as c}from"path";function D(e){let t=e;for(;;){if(a(c(t,"turbo.json"))||a(c(t,"nx.json"))||a(c(t,"lerna.json"))||a(c(t,"pnpm-workspace.yaml")))return t;let s=c(t,"package.json");if(a(s))try{if(JSON.parse(k(s,"utf8")).workspaces)return t}catch{}let i=T(t);if(i===t)break;t=i}return e}function W(e){return a(c(e,"bun.lock"))||a(c(e,"bun.lockb"))?"bun":a(c(e,"pnpm-lock.yaml"))?"pnpm":a(c(e,"yarn.lock"))?"yarn":"npm"}function J(e){if(a(c(e,"turbo.json")))return"turbo";if(a(c(e,"nx.json")))return"nx";if(a(c(e,"pnpm-workspace.yaml")))return"pnpm";let t=c(e,"package.json");if(a(t))try{if(JSON.parse(k(t,"utf8")).workspaces)return"npm-workspaces"}catch{}return"single"}function N(e){return e.one?"one":e.expo?"expo":e["react-native"]?"bare":"unknown"}function y(e){let t=c(e,"package.json");if(!a(t))return null;let s;try{s=JSON.parse(k(t,"utf8"))}catch{return null}let i={...s.dependencies,...s.devDependencies},r=N(i);return r==="unknown"?null:{dir:e,name:s.name||L(e),framework:r,hasViteConfig:a(c(e,"vite.config.ts"))||a(c(e,"vite.config.js")),hasMetroConfig:a(c(e,"metro.config.js"))||a(c(e,"metro.config.ts")),hasSootsimDependency:!!i.sootsim,devCommand:s.scripts?.dev||null}}function V(e){let t=[],s=c(e,"pnpm-workspace.yaml");if(a(s)){let o=k(s,"utf8").match(/packages:\s*\n((?:\s+-\s+.+\n?)+)/);if(o){let n=o[1].split(`
|
|
3
3
|
`).filter(Boolean);for(let g of n){let p=g.replace(/^\s*-\s*['"]?/,"").replace(/['"]?\s*$/,"");p&&t.push(...S(e,p))}}return t}let i=c(e,"package.json");if(a(i))try{let r=JSON.parse(k(i,"utf8")),o=Array.isArray(r.workspaces)?r.workspaces:r.workspaces?.packages||[];for(let n of o)t.push(...S(e,n))}catch{}return t}function S(e,t){let s=t.replace(/\/\*\*?$/,"").replace(/\*$/,""),i=c(e,s);if(!a(i))return[];try{return O(i).map(o=>c(i,o)).filter(o=>{try{return R(o).isDirectory()&&a(c(o,"package.json"))}catch{return!1}})}catch{return[]}}function M(e){let t=J(e),s=W(e);if(t==="single"){let n=y(e);return{root:e,type:t,packageManager:s,apps:n?[n]:[]}}let i=V(e),r=[],o=y(e);o&&r.push(o);for(let n of i){if(n===e)continue;let g=y(n);g&&r.push(g)}return{root:e,type:t,packageManager:s,apps:r}}function $(e){switch(e){case"bun":return"bun add -d sootsim";case"pnpm":return"pnpm add -D sootsim";case"yarn":return"yarn add -D sootsim";case"npm":return"npm install -D sootsim"}}async function ce(e){(e.includes("--help")||e.includes("-h"))&&(console.log(`
|
|
4
4
|
sootsim setup-repo \u2014 set up sootsim in your project
|
|
5
5
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.38 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import{execFileSync as p,spawn as l}from"child_process";import{existsSync as a}from"fs";import{homedir as u}from"os";import{join as d}from"path";var g=["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome","~/Applications/Google Chrome.app/Contents/MacOS/Google Chrome","/Applications/Chromium.app/Contents/MacOS/Chromium","~/Applications/Chromium.app/Contents/MacOS/Chromium","/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge","~/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge","/Applications/Brave Browser.app/Contents/MacOS/Brave Browser","~/Applications/Brave Browser.app/Contents/MacOS/Brave Browser","/Applications/Arc.app/Contents/MacOS/Arc","~/Applications/Arc.app/Contents/MacOS/Arc"],h=["/usr/bin/google-chrome","/usr/bin/chromium","/usr/bin/chromium-browser","/usr/bin/microsoft-edge","/usr/bin/brave-browser","/snap/bin/chromium"],f=["C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe","C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe","C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe","C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe","C:\\Program Files\\BraveSoftware\\Brave-Browser\\Application\\brave.exe","C:\\Program Files (x86)\\BraveSoftware\\Brave-Browser\\Application\\brave.exe"],C=["google-chrome","chromium","chromium-browser","microsoft-edge","brave-browser"],O=["chrome","msedge","brave"];function w(r){return r.startsWith("~/")?d(u(),r.slice(2)):r}function s(r){for(let n of r){let o=w(n);if(a(o))return o}return null}function U(r,n){try{let e=p(n==="win32"?"where":"which",[r],{encoding:"utf8",timeout:1500,stdio:["ignore","pipe","ignore"]}).trim();return e?e.split(/\r?\n/)[0]:null}catch{return null}}function M(r=process.platform){let n=process.env.CHROME_PATH||process.env.CHROMIUM_PATH;if(n&&a(n))return n;let o=s(r==="darwin"?g:r==="win32"?f:h);if(o)return o;let e=r==="win32"?O:C;for(let t of e){let i=U(t,r);if(i)return i}return null}function A(r,n={}){if(!r)throw new Error("openUrl requires a url");let o=n.platform??process.platform;return n.newWindow?m(r,{...n,platform:o,newWindow:!0}):o==="darwin"?{command:"open",args:n.background===!1?[r]:["-g",r],via:"system"}:o==="win32"?{command:"cmd",args:["/c","start","",r],via:"system"}:{command:"xdg-open",args:[r],via:"system"}}function m(r,n={}){if(!r)throw new Error("openUrl requires a url");let o=n.platform??process.platform,e="chromiumBinary"in n?n.chromiumBinary:M(o);if(!e)throw new Error("browser launch requires Chrome, Chromium, Edge, Brave, or Arc");let t=[];return n.headless?t.push("--headless=new"):n.newWindow!==!1&&t.push("--new-window"),t.push(r),{command:e,args:t,via:"chromium",target:e}}async function c(r,n,o){return new Promise((e,t)=>{let i=l(r,n,{detached:o,stdio:"ignore"});i.once("error",t),i.once("spawn",()=>{o&&i.unref(),e(i.pid)})})}async function x(r,n={}){let o=A(r,n),e=await c(o.command,o.args,n.detached??!0);return{...o,pid:e,attachUrl:r}}async function y(r,n={}){let o=m(r,n),e=await c(o.command,o.args,n.detached??!0);return{...o,pid:e,attachUrl:r}}async function E(r,n={}){await x(r,n)}export{M as a,x as b,y as c,E as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! sootsim v0.1.38 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! sootsim v0.1.38 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{g as w,i as g,j as l}from"./chunk-ZEVZN3S4.js";var p="sootsim:settings",m=["errorReporting","colorScheme","a11yMode","a11yDepth","screenshotCanvas","screenshotBackground","screenshotText","screenshotPose","screenshotDynamicSize","agentProvider","onboardingComplete","betaConsentVersion","detailedTelemetry"];function S(){if(typeof window>"u")return null;let e=window.sootsimElectron;return e&&typeof e=="object"?e:null}function u(e){let t={};for(let n of m){if(!(n in e))continue;let r=e[n],o=g[n];o.validate&&!o.validate(r)||o.options&&!o.options.includes(r)||(t[n]=r)}return t}function h(e){let t={};for(let n of m)t[n]=e[n];return t}function C(){if(typeof localStorage>"u")return{};try{let e=localStorage.getItem(p);return e?u(JSON.parse(e)):{}}catch{return{}}}function P(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(p,JSON.stringify(h(e)))}catch{}}function _(){let t=S()?.sharedConfig?.settings;return!t||typeof t!="object"?{}:u(t)}function V(e){let t=S();if(t?.writeSharedConfig)try{t.writeSharedConfig({settings:h(e)})}catch{}}function v(){if(typeof window>"u")return null;let e=window.__sootsimSharedConfig;return e&&typeof e=="object"?e:null}function E(){let e=v()?.settings;return!e||typeof e!="object"?{}:u(e)}function D(e){if(!v())return;let t={settings:h(e)};try{if(globalThis.__sootsimBridgeRequest?.writeSharedConfig?.(t))return}catch{}if(!(typeof fetch>"u"))try{fetch("/__sootsim/shared-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0}).catch(()=>{})}catch{}}function b(){let e=C(),t=E(),n=_();return{...e,...t,...n}}function k(e){P(e),V(e),D(e)}function R(e){if(typeof window>"u")return()=>{};let t=i=>{if(!(i.key!==p||i.newValue==null))try{e(u(JSON.parse(i.newValue)))}catch{}};window.addEventListener("storage",t);let n=S(),r;n?.onSharedConfigChanged&&(r=n.onSharedConfigChanged(i=>{let d=i?.settings;!d||typeof d!="object"||e(u(d))}));let c=globalThis.__sootsimBridgeRequest?.subscribeSharedConfig?.(i=>{let d=i?.settings;!d||typeof d!="object"||e(u(d))});return()=>{window.removeEventListener("storage",t),r?.(),c?.()}}var K=l(),s={...K,...b()},f=[],a=null;function y(){for(let e of f)e();k(s)}R(e=>{let t={...s},n=!1;for(let[r,o]of Object.entries(e)){let c=r;t[c]!==o&&(t[c]=o,n=!0)}if(n){s=t,a=null;for(let r of f)r()}});var I={get(e){return s[e]},set(e,t){let n=g[e];n.validate&&!n.validate(t)||n.options&&!n.options.includes(t)||s[e]!==t&&(s={...s,[e]:t},e==="deviceModel"&&(a=null),y())},getAll(){return s},apply(e){let t=!1,n={...s};for(let[r,o]of Object.entries(e)){if(o===void 0)continue;let c=r,i=g[c];i&&(i.validate&&!i.validate(o)||i.options&&!i.options.includes(o)||n[c]!==o&&(n[c]=o,t=!0))}t&&(s=n,a=null,y())},reset(){s=l(),a=null,y()},subscribe(e){return f.push(e),()=>{f=f.filter(t=>t!==e)}},getDeviceSpec(){return a||(a=w(s.deviceModel)),a},getA11yMode(){return s.a11yMode},setA11yMode(e){this.set("a11yMode",e)},getInspectMode(){return s.inspectMode},setInspectMode(e){this.set("inspectMode",e)}};export{I as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{g as u}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.38 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{g as u}from"./chunk-ZEVZN3S4.js";var S=52,l=18,h=42,x=96,g=54,E=1.5,$="inset 0 0 0 0.5px #000, inset 0 0 0 2px #757575, inset 0 0 0 5px #212121",w=1;function y(e){let t=u(e),r=t.scale,o=!t.dynamicIsland&&t.homeIndicatorHeight===0&&t.cornerRadius===0,n=t.width,i=t.height,a=o?t.width+l*2:t.width+28,d=o?t.height+h+x:t.height+28,c=9.5,b=w,p=a+c*2,m=d+w*2,f=c+(o?l:14),B=o?h:14,H=o?S:t.cornerRadius+14,v=[{side:"right",top:t.hardwareButtons.lock.top,height:t.hardwareButtons.lock.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.ringToggle.top,height:t.hardwareButtons.ringToggle.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.volumeUp.top,height:t.hardwareButtons.volumeUp.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.volumeDown.top,height:t.hardwareButtons.volumeDown.height,width:t.hardwareButtons.width}];return{model:e,renderScale:r,outerWidth:Math.round(p*r),outerHeight:Math.round(m*r),logicalOuterWidth:p,logicalOuterHeight:m,logicalFrameWidth:a,logicalFrameHeight:d,logicalFrameLeft:c,logicalFrameTop:b,logicalScreenWidth:n,logicalScreenHeight:i,logicalScreenLeft:f,logicalScreenTop:B,logicalScreenRadius:o?0:t.cornerRadius,logicalFrameRadius:H,frameBackground:o?"linear-gradient(180deg, #1b1c20 0%, #0f1012 42%, #050608 100%)":"#000000",frameOutline:o?"0 0 0 1px #1f2125":"0 0 0 1px #333",metallicRingShadow:o?null:$,buttons:v,legacyHomeButton:o?{top:h+t.height+(x-g)/2,left:t.width/2-g/2+l,size:g,ring:E}:null,showHomeIndicator:t.homeIndicatorHeight>0,logicalHomeIndicatorStripHeight:t.homeIndicatorHeight}}function L(e){let t=e.side==="right",r=t?"inset(-3px -3px -3px 0)":"inset(-3px 0 -3px -3px)";return`
|
|
3
3
|
<div
|
|
4
4
|
aria-hidden="true"
|
|
5
5
|
style="
|
|
@@ -24,7 +24,7 @@ import{g as u}from"./chunk-6Z275LCY.js";var S=52,l=18,h=42,w=96,g=54,$=1.5,y="in
|
|
|
24
24
|
z-index:2;
|
|
25
25
|
"
|
|
26
26
|
></div>
|
|
27
|
-
`}function
|
|
27
|
+
`}function _(e,t){let r=e.buttons.map(L).join(""),o=e.metallicRingShadow?`
|
|
28
28
|
<div
|
|
29
29
|
aria-hidden="true"
|
|
30
30
|
style="
|
|
@@ -177,4 +177,4 @@ import{g as u}from"./chunk-6Z275LCY.js";var S=52,l=18,h=42,w=96,g=54,$=1.5,y="in
|
|
|
177
177
|
</div>
|
|
178
178
|
</div>
|
|
179
179
|
</body>
|
|
180
|
-
</html>`}async function
|
|
180
|
+
</html>`}async function A(e,t){let{chromium:r}=await import("playwright"),o=await r.launch({headless:!0});try{let n=await R(o);try{return await n.compose(e,t)}finally{await n.close()}}finally{await o.close()}}async function R(e){let t=new Map;async function r(o){let n=t.get(o);if(n)return n;let i=y(o),a=await e.newContext({viewport:{width:i.outerWidth,height:i.outerHeight},deviceScaleFactor:1}),d=await a.newPage(),c={layout:i,context:a,page:d};return t.set(o,c),c}return{async compose(o,n){let i=await r(n),a=`data:image/png;base64,${o.toString("base64")}`;return await i.page.setContent(_(i.layout,a),{waitUntil:"load"}),await i.page.waitForTimeout(20),await i.page.screenshot({type:"png",clip:{x:0,y:0,width:i.layout.outerWidth,height:i.layout.outerHeight},omitBackground:!0})},async close(){for(let o of t.values())await o.context.close();t.clear()}}}export{A as a,R as b};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*! sootsim v0.1.38 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{c as l,e as d,h as c}from"./chunk-TR554AIH.js";function g(n){let e=n[0]?.toLowerCase()??"toggle";return e!=="on"&&e!=="off"&&e!=="toggle"&&(console.error(` unknown argument: "${e}" (expected on | off | toggle)`),process.exit(1)),e}async function u(n,e,o){let s=l(n,{port:e.port}),a=g(s.positional),r=d({...s,commandTimeoutMs:5e3});try{let i=!!(await c(r,"SootSim.bridges.settings.get"))?.[o.modeKey],t=a==="on"?!0:a==="off"?!1:!i;if(i===t){console.log(` ${o.displayName}: already ${t?"on":"off"}`);return}if(!await r.send({type:"evaluate",acquireLock:!0,code:`(async () => {
|
|
3
|
+
const modeKey = ${JSON.stringify(o.modeKey)}
|
|
4
|
+
const target = ${JSON.stringify(t)}
|
|
5
|
+
window.dispatchEvent(new CustomEvent('sootsim:shell-command', {
|
|
6
|
+
detail: { type: 'fire-action', id: ${JSON.stringify(o.actionId)} },
|
|
7
|
+
}))
|
|
8
|
+
const deadline = Date.now() + 1200
|
|
9
|
+
while (Date.now() < deadline) {
|
|
10
|
+
if (Boolean(window.SootSim?.bridges?.settings?.get?.()?.[modeKey]) === target) {
|
|
11
|
+
return true
|
|
12
|
+
}
|
|
13
|
+
await new Promise((resolve) => setTimeout(resolve, 40))
|
|
14
|
+
}
|
|
15
|
+
return false
|
|
16
|
+
})()`}))throw new Error(`${o.displayName} did not change to ${t?"on":"off"}; the live shell may not support this mode`);console.log(` ${o.displayName}: ${i?"on":"off"} -> ${t?"on":"off"}`)}finally{r.close()}}export{u as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.38 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
var c="sootsim-agent-prompt-v1";function r(n){return typeof n=="string"?n.trim():""}function m(n){let e=r(n.text);if(!e)return"";let t=r(n.displayText),s=r(n.inspectSummary),o=r(n.inspectTrace);return!!s||!!o||/[\r\n]/.test(e)||!!t&&t!==e?JSON.stringify({__sootsimAgentPrompt:c,text:e,displayText:t,inspectSummary:s,inspectTrace:o}):e}function u(n){let e=r(n);if(!e)return null;try{let t=JSON.parse(e);if(t.__sootsimAgentPrompt!==c)return{text:e};let s=r(typeof t.text=="string"?t.text:void 0);if(!s)return null;let o=r(typeof t.displayText=="string"?t.displayText:void 0),i=r(typeof t.inspectSummary=="string"?t.inspectSummary:void 0),p=r(typeof t.inspectTrace=="string"?t.inspectTrace:void 0);return{text:s,...o?{displayText:o}:{},...i?{inspectSummary:i}:{},...p?{inspectTrace:p}:{}}}catch{return{text:e}}}export{m as a,u as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! sootsim v0.1.38 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
var t=!0,e="1.0.0",o="public beta",n=`${o} \xB7 free until ${e}`,r="free for everyone until 1.0 \u2014 we send anonymous error and dependency data while you use it";export{t as a,e as b,o as c,n as d,r as e};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! sootsim v0.1.38 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as l,b as d}from"./chunk-QI4VLQ3A.js";import{a as c,c as m}from"./chunk-5XI3AB4I.js";import{a as n,b as s,c as u}from"./chunk-G23GIRBM.js";function g(){let r=n();return r?{available:!0,reason:null,detail:r}:{available:!1,reason:"no chromium-family browser found (chrome, chromium, edge, brave, arc)"}}async function D(r){let e=n();if(!e)return{launched:!1,message:"chromium not found \u2014 install chrome or run `sootsim list --drivers`"};if(!r.url)return{launched:!1,message:"chromium driver requires a target url"};if(r.profileId||r.ephemeralProfile)return{launched:!1,message:"profiles require electron or playwright; browser tabs use your current Chrome profile"};try{let i=await u(r.url,{headless:r.headless,detached:r.detached??!0});return{launched:!0,message:`chromium launched \u2192 ${r.url}`,pid:i.pid,target:i.target??e,attachUrl:r.url}}catch(i){return{launched:!1,message:`chromium spawn failed: ${i instanceof Error?i.message:String(i)}`}}}var h={id:"chromium",name:"chromium",description:"system chrome / chromium / edge \u2014 supports --headless",kind:"browser",availability:g,launch:D};function w(){let r=l();return r?{available:!0,reason:null,detail:`${r.kind} @ ${r.path}`}:{available:!1,reason:"sootsim desktop app not installed (run `sootsim install-desktop`)"}}async function b(r){let e=l();if(!e)return{launched:!1,message:"sootsim desktop app not installed"};try{let i=await d(r.url,e,{device:r.device,profileId:r.profileId,ephemeralProfile:r.ephemeralProfile});return i.launched?{launched:!0,message:r.url?`electron launched via ${i.via} \u2192 ${r.url}`:`electron launched via ${i.via}`,target:i.target,attachUrl:r.url}:{launched:!1,message:"desktop companion failed to start"}}catch(i){return{launched:!1,message:`electron launch failed: ${i instanceof Error?i.message:String(i)}`}}}var p={id:"electron",name:"electron",description:"sootsim desktop companion app (native window, menu bar)",kind:"native",availability:w,launch:b};import{mkdtempSync as L}from"fs";import{createRequire as k}from"module";import{tmpdir as x}from"os";import{join as P}from"path";function f(){try{let r=k(process.cwd()+"/");for(let e of["playwright","playwright-chromium","playwright-core"])try{return r.resolve(e),e}catch{}}catch{}return null}function $(){let r=f();return r?{available:!0,reason:null,detail:`resolved via ${r}`}:{available:!1,reason:"playwright not installed in the current workspace"}}async function R(r){let e=f();if(!e)return{launched:!1,message:"playwright not installed \u2014 run `bun add -D playwright` first"};if(!r.url)return{launched:!1,message:"playwright driver requires a target url"};try{let i=await import(e);return await(await(r.profileId?await i.chromium.launchPersistentContext(c(m(r.profileId).id),{headless:r.headless??!0}):r.ephemeralProfile?await i.chromium.launchPersistentContext(L(P(x(),"sootsim-playwright-profile-")),{headless:r.headless??!0}):await(async()=>(await i.chromium.launch({headless:r.headless??!0})).newContext())()).newPage()).goto(r.url),{launched:!0,message:`playwright chromium launched \u2192 ${r.url}`,target:e,attachUrl:r.url}}catch(i){return{launched:!1,message:`playwright launch failed: ${i instanceof Error?i.message:String(i)}`}}}var v={id:"playwright",name:"playwright",description:"programmatic chromium via the playwright package \u2014 headless default",kind:"automation",availability:$,launch:R};function A(){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 I(r){if(r.headless)return{launched:!1,message:"system driver does not support --headless; use chromium or playwright"};if(!r.url)return{launched:!1,message:"system driver requires a target url"};if(r.profileId||r.ephemeralProfile)return{launched:!1,message:"profiles require electron or playwright; browser tabs use your current browser profile"};try{let e=await s(r.url,{detached:r.detached??!0,newWindow:r.newWindow});return{launched:!0,message:`${e.via} launch \u2192 ${r.url}`,pid:e.pid,target:e.target,attachUrl:r.url}}catch(e){return{launched:!1,message:`system launch failed: ${e instanceof Error?e.message:String(e)}`}}}var y={id:"system",name:"system",description:"shared browser launcher \u2014 system default or chromium window",kind:"delegate",availability:A,launch:I};var t=[h,p,v,y];function M(){return t}function N(r){return t.find(e=>e.id===r)??null}function Q(r,e){if(r)return t.find(a=>a.id===r)??null;for(let i of e){let a=t.find(o=>o.id===i);if(a&&a.availability().available)return a}return null}function T(){return t.map(r=>{let e=r.availability();return{id:r.id,name:r.name,kind:r.kind,description:r.description,available:e.available,reason:e.reason,detail:e.detail??null}})}export{h as a,p as b,v as c,y as d,t as e,M as f,N as g,Q as h,T as i};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{b as bs}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.38 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{b as bs}from"./chunk-VIEK76DX.js";var oi=`(async () => {
|
|
3
3
|
try { localStorage.clear() } catch {}
|
|
4
4
|
try { sessionStorage.clear() } catch {}
|
|
5
5
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{d as c,h as m,i as w}from"./chunk-
|
|
3
|
-
`)}async function g(e,t,...r){return m(e,`__sootsimTest.${t}`,...r)}async function f(e,t,...r){return w(e,`SootSim.bridges.mainShell.${t}`,...r)}async function h(e,t={}){try{let r=await g(e,"waitForScreenTransitions",y);if(!t.verbose||!r?.started)return;if(r.timedOut){console.log(` screen transition still active after ${r.waitedMs}ms; continuing`);return}r.waitedMs>0&&console.log(` waited ${r.waitedMs}ms for screen transition settle`)}catch{}}function p(e){let t=e instanceof Error?e.message:String(e);return t.includes("call target not found: SootSim.bridges.mainShell")||t.includes("test bridge unavailable before app-in-worker boot")}async function R(e,t=0){let r=Date.now()+Math.max(0,t);for(;;)try{return await m(e,"SootSim.bridges.mainShell.getState")}catch(n){if(!p(n)||Date.now()>=r)throw n;await i(50)}}async function v(e,t,r,...n){let o=Date.now()+Math.max(0,r);for(;;)try{return await f(e,t,...n)}catch(s){if(!p(s)||Date.now()>=o)throw s;await i(50)}}async function x(e,t,r,n={}){let o=n.attempts??30,s=n.intervalMs??500,l=n.minNodeCount??10;for(let a=0;a<o;a++){let d=c(e,{commandTimeoutMs:t,
|
|
1
|
+
/*! sootsim v0.1.38 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{d as c,h as m,i as w}from"./chunk-TR554AIH.js";var y={timeoutMs:1800,settleMs:48,startWindowMs:64};function i(e){return new Promise(t=>setTimeout(t,e))}function S(e){return e.includes("--json")}function M(e){process.stdout.write(`${JSON.stringify(e??null,null,2)}
|
|
3
|
+
`)}async function g(e,t,...r){return m(e,`__sootsimTest.${t}`,...r)}async function f(e,t,...r){return w(e,`SootSim.bridges.mainShell.${t}`,...r)}async function h(e,t={}){try{let r=await g(e,"waitForScreenTransitions",y);if(!t.verbose||!r?.started)return;if(r.timedOut){console.log(` screen transition still active after ${r.waitedMs}ms; continuing`);return}r.waitedMs>0&&console.log(` waited ${r.waitedMs}ms for screen transition settle`)}catch{}}function p(e){let t=e instanceof Error?e.message:String(e);return t.includes("call target not found: SootSim.bridges.mainShell")||t.includes("test bridge unavailable before app-in-worker boot")}async function R(e,t=0){let r=Date.now()+Math.max(0,t);for(;;)try{return await m(e,"SootSim.bridges.mainShell.getState")}catch(n){if(!p(n)||Date.now()>=r)throw n;await i(50)}}async function v(e,t,r,...n){let o=Date.now()+Math.max(0,r);for(;;)try{return await f(e,t,...n)}catch(s){if(!p(s)||Date.now()>=o)throw s;await i(50)}}async function x(e,t,r,n={}){let o=n.attempts??30,s=n.intervalMs??500,l=n.minNodeCount??10;for(let a=0;a<o;a++){let d=c(e,{commandTimeoutMs:t,simId:r});try{let u=await d.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof u=="number"&&u>l)return{bridge:d,count:u}}catch{}d.close(),await i(s)}return null}async function T(e,t,r,n={}){let o=n.timeoutMs??8e3,s=n.intervalMs??250,l=Date.now()+o;for(;Date.now()<l;){let a=c(e,{commandTimeoutMs:t,simId:r});try{return await a.send({type:"evaluate",code:"1"}),a}catch{a.close()}await i(s)}return null}async function _(e,t={}){let r=t.timeoutMs??1e4,n=t.errorGraceMs??3e3,o=t.pollIntervalMs??200;return await e.send({type:"evaluate",code:`(async () => {
|
|
4
4
|
const start = Date.now()
|
|
5
5
|
const deadline = start + ${r}
|
|
6
6
|
const errorGraceAt = start + ${n}
|
|
@@ -34,4 +34,4 @@ import{d as c,h as m,i as w}from"./chunk-SMVJOWSV.js";var y={timeoutMs:1800,sett
|
|
|
34
34
|
} finally {
|
|
35
35
|
try { window.removeEventListener('sootsim:externalAppReady', onReady) } catch {}
|
|
36
36
|
}
|
|
37
|
-
})()`})??{ready:!1,source:"timeout",elapsedMs:0,nodes:0,errors:0}}export{i as a,
|
|
37
|
+
})()`})??{ready:!1,source:"timeout",elapsedMs:0,nodes:0,errors:0}}export{i as a,S as b,M as c,g as d,h as e,R as f,v as g,x as h,T as i,_ as j};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{
|
|
1
|
+
/*! sootsim v0.1.38 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{A as R,C as y,i as p,r as w,t as x,y as v,z as d}from"./chunk-6UJXRT7F.js";import{spawn as I}from"child_process";import M from"crypto";import s from"fs";import l from"path";import{Readable as C}from"stream";import{pipeline as N}from"stream/promises";var E="https://sootbean.com",k="SOOTSIM_CDN_ORIGIN",D="SOOTSIM_RUNTIME_CHANNEL";function S(){try{let e=JSON.parse(s.readFileSync(x(),"utf8"));return e&&typeof e=="object"?e:{}}catch{return{}}}function h(e){let n=S();return(e||process.env[k]||n.cdnOrigin||E).replace(/\/+$/,"")}function $(e){let n=S();return e||process.env[D]||n.runtimeChannel||"stable"}function T(e){let n=new URL(`${h(e)}/runtimes/manifest.json`);return n.searchParams.set("t",String(Date.now())),n.toString()}function V(e,n){return`${h(n)}/runtimes/sootsim-runtime-${e}.tar.gz`}async function b(e){let n=T(e),r=await fetch(n,{headers:{Accept:"application/json"}});if(!r.ok)throw new Error(`manifest fetch failed: ${r.status} ${r.statusText} (${n})`);return await r.json()}function P(e,n={}){let r=$(n.channel),t=n.version||e.channels[r]?.latest;if(!t)throw new Error(`no version specified and channel '${r}' has no latest entry in the manifest`);let i=e.versions[t];if(!i)throw new Error(`version ${t} not found in manifest; available: ${Object.keys(e.versions).slice(-10).join(", ")||"(none)"}`);return{version:t,channel:r,entry:i}}async function _(e={}){v();let n=h(e.cdnOrigin),r=await b(n),{version:t,channel:i,entry:a}=P(r,e),o=p(t),c=e.setActive!==!1;if(!e.force&&s.existsSync(l.join(o,"index.html")))return c&&R(t),{version:t,channel:i,cdnOrigin:n,runtimeDir:o,installed:!1,activated:c,manifest:r};let g=a.tarball||V(t,n),m=l.join(w(),`sootsim-runtime-${t}.tar.gz`);process.stderr.write(`sootsim: downloading runtime ${t}\u2026
|
|
3
3
|
`),await U(g,m),process.stderr.write(`sootsim: extracting runtime ${t}\u2026
|
|
4
4
|
`);let f=await j(m);if(f!==a.sha256)throw s.rmSync(m,{force:!0}),new Error(`sha256 mismatch for runtime ${t}: expected ${a.sha256}, actual ${f}`);let u=l.join(l.dirname(o),`.installing-${t}-${process.pid}`);s.rmSync(u,{recursive:!0,force:!0}),s.mkdirSync(u,{recursive:!0});try{if(await A(m,u),!s.existsSync(l.join(u,"index.html")))throw new Error(`extracted tarball for runtime ${t} is missing index.html`);s.rmSync(o,{recursive:!0,force:!0}),s.renameSync(u,o)}catch(O){throw s.rmSync(u,{recursive:!0,force:!0}),O}return c&&R(t),{version:t,channel:i,cdnOrigin:n,runtimeDir:o,installed:!0,activated:c,manifest:r}}async function q(e={}){v();let n=h(e.cdnOrigin),r=$(e.channel),t=await b(n),i=t.channels[r]?.latest;if(!i)return{checked:!0,updated:!1,reason:`channel '${r}' has no latest runtime`,activeVersion:d()};if(!t.versions[i])return{checked:!0,updated:!1,reason:`manifest is missing version ${i}`,activeVersion:d(),latestVersion:i};let o=d(),c=o?p(o):null,g=c?s.existsSync(l.join(c,"index.html")):!1;if(!(!o||!g||y(i,o)>0))return{checked:!0,updated:!1,reason:"active runtime is current",activeVersion:o,latestVersion:i};let f=await _({version:i,channel:r,cdnOrigin:n,setActive:!1});return{checked:!0,updated:!0,activeVersion:i,latestVersion:i,install:f}}async function U(e,n){let r=await fetch(e);if(!r.ok||!r.body)throw new Error(`download failed: ${r.status} ${r.statusText} (${e})`);s.mkdirSync(l.dirname(n),{recursive:!0});let t=`${n}.partial`;try{await N(C.fromWeb(r.body),s.createWriteStream(t)),s.renameSync(t,n)}catch(i){try{s.unlinkSync(t)}catch{}throw i}}function j(e){return new Promise((n,r)=>{let t=M.createHash("sha256"),i=s.createReadStream(e);i.on("data",a=>t.update(a)),i.on("error",r),i.on("end",()=>n(t.digest("hex")))})}function A(e,n){return new Promise((r,t)=>{let i=I("tar",["-xzf",e,"-C",n],{stdio:["ignore","inherit","inherit"]});i.on("error",t),i.on("exit",a=>{a===0?r():t(new Error(`tar exited with code ${a}`))})})}export{E as a,h as b,b as c,_ as d,q as e};
|