sootsim 0.0.4 → 0.1.36
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/LICENSE +21 -0
- package/README.md +4 -4
- package/dist-cli/bin.js +12 -12
- package/dist-cli/chunks/{agent-PJAOF4JS.js → agent-YZB6D3DR.js} +4 -4
- package/dist-cli/chunks/agent-wrapper-VHCVS22I.js +15 -0
- package/dist-cli/chunks/{assert-P47NW4AF.js → assert-AIVCKKLG.js} +2 -2
- package/dist-cli/chunks/auto-bootstrap-MLNTX23H.js +2 -0
- package/dist-cli/chunks/chunk-27P763IZ.js +61 -0
- package/dist-cli/chunks/chunk-3UIWOHC2.js +62 -0
- package/dist-cli/chunks/chunk-5KGFHWVR.js +1 -0
- package/dist-cli/chunks/chunk-5QIUJNT3.js +5 -0
- package/dist-cli/chunks/{chunk-W7CYWXRZ.js → chunk-6GGMKFWJ.js} +1 -1
- package/dist-cli/chunks/{chunk-EHMSE3Q3.js → chunk-6Z275LCY.js} +2 -2
- package/dist-cli/chunks/chunk-75LBYBKW.js +11 -0
- package/dist-cli/chunks/chunk-A5BRCXYE.js +2 -0
- package/dist-cli/chunks/{chunk-UQ3N6FZF.js → chunk-CYCXOAVZ.js} +2 -2
- package/dist-cli/chunks/{chunk-QIP7LYQI.js → chunk-DFN3GGH7.js} +2 -2
- package/dist-cli/chunks/chunk-EBEHZJRG.js +117 -0
- package/dist-cli/chunks/{chunk-UKYK63H6.js → chunk-EJLNUMMP.js} +1 -1
- package/dist-cli/chunks/{chunk-DQKQYPIG.js → chunk-EWSQSALM.js} +2 -2
- package/dist-cli/chunks/{chunk-BQRM4E66.js → chunk-FE7UI3MT.js} +4 -4
- package/dist-cli/chunks/chunk-G663654J.js +1 -0
- package/dist-cli/chunks/chunk-G7XQD4KC.js +4 -0
- package/dist-cli/chunks/chunk-GW7XY5KC.js +2 -0
- package/dist-cli/chunks/{chunk-QQOBLF7O.js → chunk-H2QO4TDV.js} +2 -2
- package/dist-cli/chunks/{chunk-I6XGFZPA.js → chunk-HWCKZXNJ.js} +2 -2
- package/dist-cli/chunks/{chunk-UNFERMZ3.js → chunk-HWFHBMAQ.js} +2 -2
- package/dist-cli/chunks/chunk-IJMYFYDZ.js +2 -0
- package/dist-cli/chunks/chunk-J7CTD37P.js +1 -0
- package/dist-cli/chunks/{chunk-432TMHBG.js → chunk-KAXZHEKM.js} +1 -1
- package/dist-cli/chunks/{chunk-WWDJCKMI.js → chunk-LHDWH7VS.js} +1 -1
- package/dist-cli/chunks/{chunk-VGXARPIH.js → chunk-N32NCVL2.js} +2 -2
- package/dist-cli/chunks/{chunk-XJF46GU2.js → chunk-NIZBR7EK.js} +2 -2
- package/dist-cli/chunks/{chunk-MQDPKSCK.js → chunk-NYY36OKU.js} +12 -12
- package/dist-cli/chunks/{chunk-5TTQKPGH.js → chunk-OXN2PEB7.js} +1 -1
- package/dist-cli/chunks/{chunk-SY74J6F4.js → chunk-PJL25JQV.js} +1 -1
- package/dist-cli/chunks/{chunk-4XBPZQLW.js → chunk-RMW5BO3S.js} +2 -2
- package/dist-cli/chunks/chunk-SHO54NET.js +2 -0
- package/dist-cli/chunks/chunk-SMVJOWSV.js +16 -0
- package/dist-cli/chunks/chunk-TC6V7YFC.js +3 -0
- package/dist-cli/chunks/{chunk-6SZMLFCR.js → chunk-VFDRZNPN.js} +1 -1
- package/dist-cli/chunks/{chunk-AFQBSK2J.js → chunk-YIO6S3R5.js} +1 -1
- package/dist-cli/chunks/{chunk-AUR2LTNX.js → chunk-YLIIVTTQ.js} +2 -2
- package/dist-cli/chunks/chunk-YR7BGGYE.js +2 -0
- package/dist-cli/chunks/chunk-ZEW3RF5Q.js +1 -0
- package/dist-cli/chunks/{compat-ILLJ7VDL.js → compat-Y2O2U7FL.js} +2 -2
- package/dist-cli/chunks/{config-CDIAJIIT.js → config-SRBOFUCI.js} +2 -2
- package/dist-cli/chunks/control-PL2V2O6S.js +2 -0
- package/dist-cli/chunks/daemon-IZC32PZW.js +50 -0
- package/dist-cli/chunks/{debug-6SMCTPMC.js → debug-BIDMW2PE.js} +3 -3
- package/dist-cli/chunks/demo-app-registry-5JFOUU3D.js +2 -0
- package/dist-cli/chunks/{detox-R4G5INNB.js → detox-B3FDOIS3.js} +2 -2
- package/dist-cli/chunks/{device-YSLCWS4E.js → device-ZZSI363W.js} +2 -2
- package/dist-cli/chunks/drivers-S4NGK4DB.js +2 -0
- package/dist-cli/chunks/{electron-JZOFO37G.js → electron-5YFHXEOI.js} +3 -3
- package/dist-cli/chunks/flow-JJBO6TFY.js +2 -0
- package/dist-cli/chunks/{hints-O4QR6UGI.js → hints-G5HBBV2O.js} +2 -2
- package/dist-cli/chunks/home-paths-VWC3FWA3.js +2 -0
- package/dist-cli/chunks/{inspect-DRFAUJUH.js → inspect-POOPWUQI.js} +56 -52
- package/dist-cli/chunks/install-MP6FHXNZ.js +2 -0
- package/dist-cli/chunks/install-desktop-2MYEI4FM.js +23 -0
- package/dist-cli/chunks/{install-dev-desktop-CAJHPRNP.js → install-dev-desktop-SKH3KEHY.js} +2 -2
- package/dist-cli/chunks/{keys-OWQ7SOTM.js → keys-7PNASIQR.js} +2 -2
- package/dist-cli/chunks/{launch-WUEDHSO5.js → launch-JNS47LAQ.js} +3 -3
- package/dist-cli/chunks/login-YWZWUHBS.js +26 -0
- package/dist-cli/chunks/logout-O6SXMSBP.js +2 -0
- package/dist-cli/chunks/{maestro-PMHK6EHI.js → maestro-CW6XVUKV.js} +3 -3
- package/dist-cli/chunks/{preview-4RVHA2PP.js → preview-WGKJO5FS.js} +2 -2
- package/dist-cli/chunks/{profile-3IVNHUS6.js → profile-SUOBRPIC.js} +2 -2
- package/dist-cli/chunks/{record-KEWLM5JR.js → record-QPWLYH5R.js} +2 -2
- package/dist-cli/chunks/runtime-KEMO2MSB.js +25 -0
- package/dist-cli/chunks/{screenshot-BXRAQERZ.js → screenshot-JTY46V7G.js} +2 -2
- package/dist-cli/chunks/{screenshot-mode-5IXEDIUS.js → screenshot-mode-7OYBBX6D.js} +2 -2
- package/dist-cli/chunks/{screenshots-T4MQF3TB.js → screenshots-QISKC4GD.js} +2 -2
- package/dist-cli/chunks/server-YSFJAKAV.js +34 -0
- package/dist-cli/chunks/setup-repo-LFB3HBEO.js +2 -0
- package/dist-cli/chunks/{skills-DJA6QEVR.js → skills-MO7BFNVM.js} +2 -2
- package/dist-cli/chunks/store-6MFL53I4.js +2 -0
- package/dist-cli/chunks/telemetry-CN42GMVC.js +2 -0
- package/dist-cli/chunks/{test-IWUHNFXV.js → test-XUI3KNNQ.js} +3 -3
- package/dist-cli/chunks/upload-6FUT7AX5.js +2 -0
- package/dist-cli/chunks/{whoami-MCXFWKIH.js → whoami-TQFHY42N.js} +2 -2
- package/dist-lib/agent-daemon-client.cjs +3 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +2 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- 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 +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +3 -1
- package/dist-lib/home-paths.cjs +29 -3
- package/dist-lib/host/bridge-host.cjs +499 -59
- package/dist-lib/index.cjs +2 -2
- package/dist-lib/metro.cjs +2 -2
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/vite-base.cjs +800 -102
- package/dist-lib/vite.cjs +1 -1
- package/package.json +5 -3
- package/dist-cli/chunks/agent-wrapper-STO7PLQD.js +0 -15
- package/dist-cli/chunks/auto-bootstrap-SC2LMI2H.js +0 -2
- package/dist-cli/chunks/chunk-47S5DXXX.js +0 -11
- package/dist-cli/chunks/chunk-4VXB2DBA.js +0 -119
- package/dist-cli/chunks/chunk-C3QLIYCS.js +0 -16
- package/dist-cli/chunks/chunk-F4ARVCRR.js +0 -1
- package/dist-cli/chunks/chunk-HAKR72LJ.js +0 -2
- package/dist-cli/chunks/chunk-HGFIS26A.js +0 -2
- package/dist-cli/chunks/chunk-MZPAJ5PQ.js +0 -1
- package/dist-cli/chunks/chunk-OAHMYSMD.js +0 -2
- package/dist-cli/chunks/chunk-W3TYN64D.js +0 -62
- package/dist-cli/chunks/chunk-WRF43M33.js +0 -4
- package/dist-cli/chunks/chunk-WVBPATRA.js +0 -2
- package/dist-cli/chunks/chunk-ZF5FCFLD.js +0 -2
- package/dist-cli/chunks/chunk-ZKNI5MRD.js +0 -1
- package/dist-cli/chunks/control-7QGKUCAX.js +0 -2
- package/dist-cli/chunks/daemon-4BLYGM5N.js +0 -49
- package/dist-cli/chunks/demo-app-registry-HLI5UGGI.js +0 -2
- package/dist-cli/chunks/drivers-YIXRFFBQ.js +0 -2
- package/dist-cli/chunks/flow-L7X5FGIN.js +0 -2
- package/dist-cli/chunks/home-paths-4YJJYGR6.js +0 -2
- package/dist-cli/chunks/install-BATRTWRI.js +0 -65
- package/dist-cli/chunks/install-desktop-6X474IQ3.js +0 -23
- package/dist-cli/chunks/login-54YJ2KH6.js +0 -26
- package/dist-cli/chunks/logout-XECXLEXW.js +0 -2
- package/dist-cli/chunks/runtime-PJKHEB36.js +0 -25
- package/dist-cli/chunks/server-CIP3LH45.js +0 -29
- package/dist-cli/chunks/store-SPC247DB.js +0 -2
- package/dist-cli/chunks/upload-UPD2RSYF.js +0 -2
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{b as f,d as m}from"./chunk-EJLNUMMP.js";import"./chunk-LHDWH7VS.js";import{exec as S}from"node:child_process";import{randomBytes as $}from"node:crypto";import _ from"node:http";var I=process.env.SOOTSIM_AUTH_ORIGIN||"https://sootbean.com",h="http://localhost:3000";async function x(t){if(t)return t;if(process.env.SOOTSIM_AUTH_ORIGIN)return process.env.SOOTSIM_AUTH_ORIGIN;if(process.env.SOOTSIM_UPLOAD_ORIGIN)return process.env.SOOTSIM_UPLOAD_ORIGIN;try{if((await fetch(`${h}/api/auth/me`)).ok)return h}catch{}return I}function R(){console.log(`
|
|
3
|
+
sootsim login \u2014 sign in so desktop uploads can attach to your account
|
|
4
|
+
|
|
5
|
+
usage:
|
|
6
|
+
sootsim login [--origin <url>]
|
|
7
|
+
|
|
8
|
+
options:
|
|
9
|
+
--origin <url> auth host (default: auto)
|
|
10
|
+
prefers ${h} when available, otherwise
|
|
11
|
+
falls back to ${I}
|
|
12
|
+
override with SOOTSIM_AUTH_ORIGIN env var
|
|
13
|
+
-h, --help
|
|
14
|
+
`)}function T(t,o){let e=t.findIndex(i=>i===o);if(e<0)return;let c=t[e+1];return t.splice(e,2),c}function L(t){let o=process.platform==="darwin"?`open "${t}"`:process.platform==="win32"?`start "" "${t}"`:`xdg-open "${t}"`;S(o,e=>{e&&(console.log(" could not open browser automatically."),console.log(` open this URL manually:
|
|
15
|
+
${t}
|
|
16
|
+
`))})}function u(t){return`<!doctype html>
|
|
17
|
+
<html>
|
|
18
|
+
<body style="font-family:system-ui;background:#000;color:#fff;display:flex;align-items:center;justify-content:center;height:100vh;margin:0">
|
|
19
|
+
<div style="max-width:480px;text-align:center">
|
|
20
|
+
<h1 style="font-size:28px;margin:0 0 12px">SootSim</h1>
|
|
21
|
+
<p style="color:#ccc">${t}</p>
|
|
22
|
+
</div>
|
|
23
|
+
</body>
|
|
24
|
+
</html>`}async function P(t){try{let o=await fetch(`${t.replace(/\/$/,"")}/api/dev-login`,{method:"POST"});if(o.status===403)return{ok:!1,error:"dev-login disabled (not in dev mode)"};if(!o.ok){let c=await o.text().catch(()=>"");return{ok:!1,error:`dev-login ${o.status}: ${c}`}}let e=await o.json();return e.token?{ok:!0,token:e.token,userId:e.user?.id,email:e.email}:{ok:!1,error:"dev-login response missing token"}}catch(o){return{ok:!1,error:o instanceof Error?o.message:"dev-login fetch failed"}}}function A(t){try{let o=new URL(t).hostname;return o==="localhost"||o==="127.0.0.1"||o.endsWith(".local")}catch{return!1}}async function G(t){(t.includes("--help")||t.includes("-h"))&&(R(),process.exit(0));let o=[...t],e=await x(T(o,"--origin"));if(A(e)){console.log(` detected local origin (${e}) \u2014 signing in as dev user`);let r=await P(e);if(r.ok){f({token:r.token,user:r.userId?{id:r.userId,email:r.email}:null,origin:e,source:"cli"});let s=await m(e),l=s?.user?.email||r.email||s?.user?.id||r.userId,{trackCliEvent:n,flushCliTelemetry:a}=await import("./telemetry-CN42GMVC.js");n({event:"cli_login_succeeded",identity:{userId:r.userId??s?.user?.id??null},properties:{origin:e,mode:"dev"}}),await a(),console.log(` signed in${l?` as ${l}`:""} (dev)`);return}console.log(` dev-login not available (${r.error}); falling back to browser`)}let c=$(16).toString("hex"),i=await new Promise(r=>{let s=_.createServer((l,n)=>{try{let a=new URL(l.url||"/","http://127.0.0.1"),w=a.searchParams.get("state"),k=a.searchParams.get("token"),b=a.searchParams.get("email")||void 0,O=a.searchParams.get("userId")||void 0,g=a.searchParams.get("error");if(n.setHeader("content-type","text/html; charset=utf-8"),g){n.end(u(`sign-in failed: ${g}`)),r({ok:!1,error:g}),s.close();return}if(w!==c){n.end(u("state mismatch. close this tab and retry `sootsim login`.")),r({ok:!1,error:"state mismatch"}),s.close();return}if(!k){n.end(u("missing token. close this tab and retry `sootsim login`.")),r({ok:!1,error:"missing token"}),s.close();return}n.end(u("sign-in complete. you can return to the terminal.")),r({ok:!0,token:k,email:b,userId:O}),s.close()}catch(a){n.statusCode=500,n.end(u("sign-in callback failed. retry `sootsim login`.")),r({ok:!1,error:a instanceof Error?a.message:"callback failed"}),s.close()}});s.listen(0,"127.0.0.1",()=>{let l=s.address();if(!l||typeof l=="string"){r({ok:!1,error:"failed to bind callback server"}),s.close();return}let n=new URL(`${e.replace(/\/$/,"")}/auth/sootsim-cli`);n.searchParams.set("state",c),n.searchParams.set("port",String(l.port)),n.searchParams.set("sootbean",e),console.log(" opening browser for sootsim login..."),console.log(` waiting for callback on 127.0.0.1:${l.port}`),console.log(` if nothing opens, visit:
|
|
25
|
+
${n.toString()}
|
|
26
|
+
`),L(n.toString())})});if(!i.ok){let{trackCliEvent:r,flushCliTelemetry:s}=await import("./telemetry-CN42GMVC.js");r({event:"cli_login_failed",properties:{origin:e,error:i.error}}),await s(),console.error(` login failed: ${i.error}`),process.exit(1)}f({token:i.token,user:i.userId?{id:i.userId,email:i.email}:null,origin:e,source:"cli"});let d=await m(e),p=d?.user?.email||i.email||d?.user?.id||i.userId,{trackCliEvent:y,flushCliTelemetry:v}=await import("./telemetry-CN42GMVC.js");y({event:"cli_login_succeeded",identity:{userId:i.userId??d?.user?.id??null},properties:{origin:e}}),await v(),console.log(` signed in${p?` as ${p}`:""}`)}export{G as runLogin};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as r,b as i}from"./chunk-IJMYFYDZ.js";import{a as t,c as o}from"./chunk-EJLNUMMP.js";import"./chunk-5QIUJNT3.js";import"./chunk-LHDWH7VS.js";async function s(){let e=t();if(!e?.token){console.log(" not signed in");return}try{await fetch(`${e.origin.replace(/\/$/,"")}/api/auth/sign-out`,{method:"POST",headers:{authorization:`Bearer ${e.token}`}})}catch{}o(),r({event:"cli_logout",identity:{userId:e.user?.id??null},properties:{origin:e.origin}}),await i(),console.log(" signed out")}export{s as runLogout};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
2
|
-
import{c as h}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{c as h}from"./chunk-NYY36OKU.js";import"./chunk-DFN3GGH7.js";import"./chunk-HWFHBMAQ.js";import"./chunk-EWSQSALM.js";import"./chunk-5KGFHWVR.js";import"./chunk-HWCKZXNJ.js";import"./chunk-H2QO4TDV.js";import"./chunk-3UIWOHC2.js";import"./chunk-YLIIVTTQ.js";import"./chunk-RMW5BO3S.js";import"./chunk-NIZBR7EK.js";import"./chunk-6Z275LCY.js";import"./chunk-IJMYFYDZ.js";import"./chunk-EJLNUMMP.js";import"./chunk-75LBYBKW.js";import"./chunk-GW7XY5KC.js";import"./chunk-OXN2PEB7.js";import"./chunk-YR7BGGYE.js";import"./chunk-PJL25JQV.js";import"./chunk-G663654J.js";import"./chunk-A5BRCXYE.js";import"./chunk-SHO54NET.js";import"./chunk-SMVJOWSV.js";import"./chunk-6GGMKFWJ.js";import"./chunk-ZEW3RF5Q.js";import"./chunk-5QIUJNT3.js";import"./chunk-LHDWH7VS.js";import*as i from"fs";import*as l from"path";var w=[".maestro","maestro"];function v(){console.log(`
|
|
3
3
|
sootsim maestro \u2014 run maestro YAML flows against sootsim (drop-in)
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -13,7 +13,7 @@ options:
|
|
|
13
13
|
--env KEY=VALUE set env vars for \${KEY} interpolation (repeatable)
|
|
14
14
|
--continuous re-run the flow on file changes (alias for --watch)
|
|
15
15
|
--format <fmt> accepted for maestro cli compat (not used)
|
|
16
|
-
--new force a fresh
|
|
16
|
+
--new force a fresh browser window for this run
|
|
17
17
|
--record record a webm while the flow runs
|
|
18
18
|
--slow <ms> delay between steps for natural pacing
|
|
19
19
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
2
|
-
import"./chunk-
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import"./chunk-LHDWH7VS.js";import{resolve as c,dirname as m}from"path";import{fileURLToPath as a}from"url";var t=m(a(import.meta.resolve("sootsim-engine/package.json")));async function g(o,r){(o.includes("--help")||o.includes("-h"))&&(console.log(`
|
|
3
3
|
sootsim preview \u2014 production-like preview
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
2
|
-
import{c as I,e as N,i as S}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{c as I,e as N,i as S}from"./chunk-SMVJOWSV.js";import"./chunk-6GGMKFWJ.js";import"./chunk-ZEW3RF5Q.js";import"./chunk-5QIUJNT3.js";import"./chunk-LHDWH7VS.js";import{createWriteStream as v,mkdirSync as k,writeFileSync as w}from"fs";import{dirname as T,resolve as x}from"path";import{Readable as y}from"stream";import{pipeline as C}from"stream/promises";import{createGzip as F}from"zlib";async function E(r,m){if(r.includes("--help")||r.includes("-h"))return console.log(`
|
|
3
3
|
sootsim profile \u2014 capture a sampled CPU trace from the tenant worker
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
2
|
-
import{a as z}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as z}from"./chunk-HWFHBMAQ.js";import"./chunk-YLIIVTTQ.js";import"./chunk-EJLNUMMP.js";import"./chunk-G663654J.js";import{d as C}from"./chunk-A5BRCXYE.js";import{c as R,e as $}from"./chunk-SMVJOWSV.js";import{c as W}from"./chunk-6GGMKFWJ.js";import"./chunk-ZEW3RF5Q.js";import"./chunk-5QIUJNT3.js";import"./chunk-LHDWH7VS.js";import{existsSync as Z,mkdirSync as _,readFileSync as ee,rmSync as L,writeFileSync as U}from"fs";import{tmpdir as oe}from"os";import{dirname as T,extname as re,join as te,resolve as O}from"path";var D=6e4;async function ve(e,r){if((e.includes("--help")||e.includes("-h"))&&(console.log(`
|
|
3
3
|
sootsim record \u2014 capture the running session
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as p,b as w,c as $,d as y}from"./chunk-G7XQD4KC.js";import{a as d}from"./chunk-SMVJOWSV.js";import"./chunk-6GGMKFWJ.js";import"./chunk-ZEW3RF5Q.js";import{h,q as m,r as a,s as g,t as f}from"./chunk-5QIUJNT3.js";import"./chunk-LHDWH7VS.js";import b from"fs";import{WebSocket as D}from"ws";async function P(n,e={}){let[o,...t]=n;if(!o||o==="--help"||o==="-h"){R();return}switch(o){case"install":return O(t,e);case"list":case"ls":return S(t);case"use":return T(t);case"remove":case"rm":return N(t);case"which":case"active":return F();default:console.error(` unknown runtime subcommand: ${o}`),R(),process.exit(1)}}function R(){console.log(`
|
|
3
|
+
sootsim runtime \u2014 manage engine runtimes under ~/.sootsim/runtimes/
|
|
4
|
+
|
|
5
|
+
usage:
|
|
6
|
+
sootsim runtime install [version] install a version (default: channel latest)
|
|
7
|
+
sootsim runtime list show installed + available versions
|
|
8
|
+
sootsim runtime use <version> switch active runtime
|
|
9
|
+
sootsim runtime remove <version> delete an installed runtime
|
|
10
|
+
sootsim runtime which print active runtime version
|
|
11
|
+
|
|
12
|
+
flags:
|
|
13
|
+
--channel <name> channel to resolve 'latest' from (default: stable)
|
|
14
|
+
--force reinstall even if the version is already on disk
|
|
15
|
+
--set-active=false do not switch active runtime after install
|
|
16
|
+
|
|
17
|
+
environment:
|
|
18
|
+
SOOTSIM_CDN_ORIGIN override the CDN base URL (default: ${p})
|
|
19
|
+
|
|
20
|
+
examples:
|
|
21
|
+
sootsim runtime install
|
|
22
|
+
sootsim runtime install 1.2.3
|
|
23
|
+
sootsim runtime install --channel beta
|
|
24
|
+
sootsim runtime use 1.2.3
|
|
25
|
+
`)}async function O(n,e){let{version:o,flags:t}=_(n),s=t.channel??e.channel??"stable",l=t.force===!0,c=t.setActive!==!1;m(),console.log("sootsim runtime install"),console.log(` cdn: ${w()}`);try{let i=await y({version:o,channel:s,force:l,setActive:c});console.log(` version: ${i.version} (channel: ${i.channel})`),i.installed?console.log(` installed ${i.version}`):console.log(` already installed at ${i.runtimeDir}`),c&&await k(i.version)}catch(i){console.error(` ${I(i)}`),process.exit(1)}}async function k(n){g(n),console.log(` active: ${n}`),await A(n)||console.log(` (no daemon running \u2014 next sootsim/electron launch will pick up ${n})`)}async function A(n){let{isDaemonLockfileFresh:e,readDaemonLockfile:o}=await import("./home-paths-VWC3FWA3.js"),t=o();if(!e(t))return!1;let s=d();return new Promise(l=>{let c=!1,i=!1,u=x=>{c||(c=!0,l(x))},r=new D(`ws://127.0.0.1:${s}`,{handshakeTimeout:800}),v=setTimeout(()=>{try{r.close()}catch{}u(i)},1500);r.on("open",()=>{try{r.send(JSON.stringify({type:"runtime:use",version:n,id:0})),i=!0}catch{}setTimeout(()=>{try{r.close()}catch{}},100)}),r.on("close",()=>{clearTimeout(v),u(i)}),r.on("error",()=>{clearTimeout(v),u(!1)})})}async function S(n){m();let e=f(),o=a();if(console.log("installed:"),e.length===0)console.log(" (none)");else for(let t of e)console.log(` ${t===o?"*":" "} ${t}`);try{let t=await $();console.log("available (latest per channel):");for(let[s,l]of Object.entries(t.channels))console.log(` ${s.padEnd(8)} ${l.latest}`)}catch(t){console.log(`available: (could not fetch manifest: ${I(t)})`)}}async function T(n){let e=n[0];e||(console.error(" usage: sootsim runtime use <version>"),process.exit(1));let o=f();o.includes(e)||(console.error(` version ${e} is not installed`),console.error(` installed: ${o.join(", ")||"(none)"}`),console.error(` run \`sootsim runtime install ${e}\` first`),process.exit(1)),await k(e)}async function N(n){let e=n[0];e||(console.error(" usage: sootsim runtime remove <version>"),process.exit(1)),a()===e&&(console.error(` cannot remove active runtime ${e}`),console.error(" switch with `sootsim runtime use <other>` first, or install another version"),process.exit(1));let t=h(e);if(!b.existsSync(t)){console.error(` ${e} is not installed`);return}b.rmSync(t,{recursive:!0,force:!0}),console.log(` removed ${e}`)}async function F(){let n=a();if(!n){console.log(" no active runtime");return}console.log(n)}function _(n){let e={},o=[];for(let t=0;t<n.length;t++){let s=n[t];if(s==="--channel"&&t+1<n.length){e.channel=n[t+1],t++;continue}if(s.startsWith("--channel=")){e.channel=s.slice(10);continue}if(s==="--force"){e.force=!0;continue}if(s==="--set-active=false"||s==="--no-set-active"){e.setActive=!1;continue}o.push(s)}return{version:o[0]??null,flags:e}}function I(n){return n instanceof Error?n.message:String(n)}export{P as runRuntime};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
2
|
-
import{a as
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as x}from"./chunk-YIO6S3R5.js";import{a as v}from"./chunk-EWSQSALM.js";import"./chunk-5KGFHWVR.js";import"./chunk-RMW5BO3S.js";import"./chunk-NIZBR7EK.js";import{f}from"./chunk-6Z275LCY.js";import{c as h,d as g,e as w,h as y}from"./chunk-SMVJOWSV.js";import"./chunk-6GGMKFWJ.js";import"./chunk-ZEW3RF5Q.js";import"./chunk-5QIUJNT3.js";import"./chunk-LHDWH7VS.js";import{mkdirSync as _,writeFileSync as S}from"fs";import{dirname as R,resolve as B}from"path";async function V(e,t){(e.includes("--help")||e.includes("-h"))&&(console.log(`
|
|
3
3
|
sootsim screenshot \u2014 capture the canvas as a PNG
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
2
|
-
import{c,e as i,h as d}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{c,e as i,h as d}from"./chunk-SMVJOWSV.js";import"./chunk-6GGMKFWJ.js";import"./chunk-ZEW3RF5Q.js";import"./chunk-5QIUJNT3.js";import"./chunk-LHDWH7VS.js";async function g(o,l){(o.includes("--help")||o.includes("-h"))&&(console.log(`
|
|
3
3
|
sootsim screenshot-mode \u2014 toggle the screenshot-mode chrome overlay
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
2
|
-
import{c as Y}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{c as Y}from"./chunk-NYY36OKU.js";import"./chunk-DFN3GGH7.js";import"./chunk-HWFHBMAQ.js";import{b as j}from"./chunk-EWSQSALM.js";import"./chunk-5KGFHWVR.js";import{b as O}from"./chunk-HWCKZXNJ.js";import"./chunk-H2QO4TDV.js";import"./chunk-3UIWOHC2.js";import"./chunk-YLIIVTTQ.js";import"./chunk-RMW5BO3S.js";import"./chunk-NIZBR7EK.js";import{a as w,b as D,c as k,d as z,e as x,f as T}from"./chunk-6Z275LCY.js";import"./chunk-IJMYFYDZ.js";import"./chunk-EJLNUMMP.js";import"./chunk-75LBYBKW.js";import"./chunk-GW7XY5KC.js";import"./chunk-OXN2PEB7.js";import"./chunk-YR7BGGYE.js";import"./chunk-PJL25JQV.js";import"./chunk-G663654J.js";import"./chunk-A5BRCXYE.js";import"./chunk-SHO54NET.js";import"./chunk-SMVJOWSV.js";import"./chunk-6GGMKFWJ.js";import"./chunk-ZEW3RF5Q.js";import"./chunk-5QIUJNT3.js";import"./chunk-LHDWH7VS.js";import{mkdirSync as B,readFileSync as pe,writeFileSync as G}from"fs";import{tmpdir as je}from"os";import C from"path";import{mkdirSync as I,readFileSync as Q,writeFileSync as H}from"fs";import F from"path";function _(e){return e.replace(/\\/g,"/").replace(/\.png$/i,"").trim().split("/").filter(Boolean).join("--").replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"slide"}function v(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}function ee(e){let t=e.trim();return/^#[0-9a-f]{3}$/i.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function M(e,t){let r=ee(e),i=Math.max(0,Math.min(1,t)),n=r.match(/^#([0-9a-f]{6})$/i);if(n){let s=n[1],o=Number.parseInt(s.slice(0,2),16),a=Number.parseInt(s.slice(2,4),16),u=Number.parseInt(s.slice(4,6),16);return`rgba(${o}, ${a}, ${u}, ${i})`}return r.startsWith("rgb(")?r.replace(/^rgb\((.+)\)$/i,`rgba($1, ${i})`):r}function te(e){if(e.type==="solid")return e.color||"#000000";let t=e.direction??180,r=e.stops?.map(i=>`${i.color} ${i.offset}%`).join(", ")||"#000000 0%, #111111 100%";return`linear-gradient(${t}deg, ${r})`}function oe(e){let t=e.glow;return t?`radial-gradient(circle at 50% 24%, ${M(t,.46)} 0%, ${M(t,.2)} 24%, rgba(0,0,0,0) 62%)`:"none"}function A(e){switch(e){case"tilted-left":return"perspective(2400px) rotateY(10deg) rotateZ(-2deg)";case"tilted-right":return"perspective(2400px) rotateY(-10deg) rotateZ(2deg)";case"cut-bottom":return"translateY(10%) scale(1.08)";case"cut-top":return"translateY(-16%) scale(1.08)";default:return"none"}}function L(...e){let t=e.map(r=>r.trim()).filter(r=>r.length>0&&r!=="none");return t.length>0?t.join(" "):"none"}function E(e){let t=M(e.color,e.opacity),r=M(e.color,e.opacity*.52);return`drop-shadow(0 34px ${e.spread}px ${r}) drop-shadow(0 0 ${e.blur}px ${t})`}function R(e,t){return!t.glow||e.color&&e.color!==w.color?e:{...e,color:t.glow}}function re(e,t){if(e==="editorial-left"){let n=Math.round(t.height*.056),s=Math.round(t.height*.022);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.12)}px`,`left:${Math.round(t.width*.085)}px`,`width:${Math.round(t.width*.42)}px`,"text-align:left","z-index:3"].join(";"),titleStyle:`font-size:${n}px;line-height:0.92;`,subStyle:`font-size:${s}px;line-height:1.36;max-width:${Math.round(t.width*.36)}px;`,eyebrowStyle:"align-items:flex-start;",deviceStyle:(o,a,u)=>{let p=Math.round(t.width*.68*(a.scale??o.scale)),l=Math.round(t.height*(.03+o.offsetY+(a.offsetY??0))),c=a.pose||o.pose||"tilted-right",m=R(o.shadow,u);return["position:absolute",`top:${Math.round(t.height*.18)+l}px`,`left:${Math.round(t.width*.56)}px`,`width:${p}px`,"transform-origin:center center",`transform:${A(c)}`,`filter:${E(m)}`,"z-index:2"].join(";")}}}if(e==="minimal-bottom"){let n=Math.round(t.height*.041),s=Math.round(t.height*.019);return{copyStyle:["position:absolute",`left:${Math.round(t.width*.12)}px`,`right:${Math.round(t.width*.12)}px`,`bottom:${Math.round(t.height*.085)}px`,"text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${n}px;line-height:0.96;`,subStyle:`font-size:${s}px;line-height:1.34;max-width:${Math.round(t.width*.56)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(o,a,u)=>{let p=Math.round(t.width*.84*(a.scale??o.scale)),l=Math.round(t.height*(o.offsetY+(a.offsetY??0))),c=a.pose||o.pose,m=R(o.shadow,u);return["position:absolute",`top:${Math.round(t.height*.075)+l}px`,"left:50%",`width:${p}px`,"transform-origin:center center",`transform:${L("translateX(-50%)",A(c))}`,`filter:${E(m)}`,"z-index:2"].join(";")}}}let r=Math.round(t.height*.04),i=Math.round(t.height*.019);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.084)}px`,"left:50%",`width:${Math.round(t.width*.88)}px`,"transform:translateX(-50%)","text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${r}px;line-height:0.92;`,subStyle:`font-size:${i}px;line-height:1.34;max-width:${Math.round(t.width*.6)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(n,s,o)=>{let a=t.name==="ipad-13"?.54:.64,u=Math.round(t.width*a*(s.scale??n.scale)),p=Math.round(t.height*(n.offsetY+(s.offsetY??0))),l=s.pose||n.pose,c=R(n.shadow,o);return["position:absolute",`top:${Math.round(t.height*(t.name==="ipad-13"?.25:.28))+p}px`,"left:50%",`width:${u}px`,"transform-origin:center top",`transform:${L("translateX(-50%)",A(l))}`,`filter:${E(c)}`,"z-index:2"].join(";")}}}function ne({canvas:e,compose:t,slide:r,imageDataUrl:i}){let n=r.background??t.background,s=re(t.text.preset,e),o=t.text.preset!=="none"&&!!(r.eyebrow||r.headline||r.subheadline),a=s.deviceStyle(t.frame,r,n),u=r.headline?`<div style="font-weight:780;white-space:pre-line;text-wrap:balance;${s.titleStyle}">${v(r.headline)}</div>`:"",p=r.subheadline?`<div style="margin-top:${Math.round(e.height*.018)}px;color:${t.text.subColor};white-space:pre-line;text-wrap:balance;${s.subStyle}">${v(r.subheadline)}</div>`:"",l=r.eyebrow?`<div style="display:flex;${s.eyebrowStyle}margin-bottom:${Math.round(e.height*.016)}px;"><div style="font-size:${Math.round(e.height*.014)}px;font-weight:700;letter-spacing:0.18em;text-transform:uppercase;color:${t.text.eyebrowColor};">${v(r.eyebrow)}</div></div>`:"";return`<!doctype html>
|
|
3
3
|
<html>
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="utf-8" />
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{b as V,c as O,d as q,e as R,f as G,h as z,i as w,j as Y,k as X,l as Z,p as Q,s as b,t as ee,u as te,v as re,w as ie}from"./chunk-FE7UI3MT.js";import"./chunk-KAXZHEKM.js";import{a as J}from"./chunk-DFN3GGH7.js";import"./chunk-H2QO4TDV.js";import{e as H}from"./chunk-G7XQD4KC.js";import{a as $,b as j}from"./chunk-IJMYFYDZ.js";import"./chunk-EJLNUMMP.js";import"./chunk-GW7XY5KC.js";import{d as K}from"./chunk-A5BRCXYE.js";import"./chunk-ZEW3RF5Q.js";import{A as x,q as A,r as N,s as _,t as L,v as D,w as U,x as M,y as F,z as W}from"./chunk-5QIUJNT3.js";import"./chunk-LHDWH7VS.js";import{spawn as le}from"child_process";import v from"fs";import{createServer as ue}from"http";import y from"path";import{WebSocket as f,WebSocketServer as pe}from"ws";import se from"node:fs";import C from"node:path";var T=1;function ce(){return[Number(process.env.VITE_PORT_WEB||process.env.PORT||3e3),Number(process.env.VITE_PORT_ZERO||7849),Number(process.env.VITE_PORT_POSTGRES||7432),Number(process.env.VITE_PORT_R2||9500)].filter(h=>Number.isFinite(h)&&h>0)}var E=class{subscriptions=new Map;sessionsBySocket=new Map;allSockets=new Set;pendingPromptEchoes=new Map;pendingTurns=new Map;opts;constructor(e={}){this.opts=e}registerSocket(e){this.allSockets.add(e)}unregisterSocket(e){let t=this.sessionsBySocket.get(e);if(t){for(let r of t)this.decrementSubscription(r);this.sessionsBySocket.delete(e)}this.allSockets.delete(e)}async handleMessage(e,t){let r=t?.type;if(typeof r!="string"||!r.startsWith("agent:"))return!1;let o=t.id;try{let s=await this.dispatch(e,r,t);this.respond(e,o,s)}catch(s){s instanceof b?this.respondError(e,o,s.message,s.code):this.respondError(e,o,s instanceof Error?s.message:String(s))}return!0}async seedOnBoot(){try{await Z()}catch(e){process.stderr.write(`[sootsim-agent] seedFromDemoAppRegistry failed: ${e instanceof Error?e.message:String(e)}
|
|
3
|
+
`)}}close(){for(let e of this.subscriptions.values())try{e.unsubscribe()}catch{}this.subscriptions.clear(),this.sessionsBySocket.clear(),this.allSockets.clear()}async dispatch(e,t,r){switch(t){case"agent:list-projects":return R();case"agent:upsert-project":return O(r.input??{});case"agent:delete-project":return z(String(r.projectId)),{ok:!0};case"agent:auto-attach-for-url":return this.autoAttachForUrl(r.input??{});case"agent:list-sessions":return Y(r.projectId?String(r.projectId):void 0);case"agent:start-session":return this.doStartSession(r.input??{});case"agent:send-prompt":{let s=String(r.sessionId),n=w(s);if(!n)throw new b("NO_SESSION",`no session: ${s}`);let i=this.normalizePromptEnvelope(r);return await te(s,i),this.notePromptAccepted(s,i,n.status==="working")}case"agent:end-session":this.dropSessionFanout(String(r.sessionId)),await re(String(r.sessionId));let o=w(String(r.sessionId));return o&&this.broadcastSessionStatus(o),{ok:!0};case"agent:get-transcript":return this.getTranscript(String(r.sessionId));case"agent:get-paths":return this.getPaths();case"agent:subscribe-events":return this.subscribeSocket(e,String(r.sessionId));case"agent:unsubscribe-events":return this.unsubscribeSocket(e,String(r.sessionId));default:throw new b("UNKNOWN_AGENT_MSG",`unknown agent message: ${t}`)}}async doStartSession(e){if(!q(e.projectId))throw new b("NO_PROJECT",`no project: ${e.projectId}`);let r=await ee(e);return this.broadcastSessionStatus(r.session),r}async autoAttachForUrl(e){let t=e.bundleUrl??"",r=(()=>{try{return new URL(t).port||null}catch{return null}})();if(!r)return{project:null};let o=this.opts.getExcludePorts?.()??ce(),n=(await J({excludePorts:o})).find(d=>String(d.port)===r);if(!n||!n.cwd)return{project:null};let i=R().find(d=>d.cwd===n.cwd)??null,a=Array.from(new Set([...i?.knownBundleUrls??[],n.bundleUrl,t]));return{project:O({cwd:n.cwd,name:n.projectName??C.basename(n.cwd),preferredProvider:e.provider??i?.preferredProvider,sourceRoots:i?.sourceRoots??[n.cwd],knownBundleUrls:a,framework:i?.framework??de(n.framework),bundleId:n.bundleId??i?.bundleId})}}getTranscript(e){let t=Q(e);return se.existsSync(t)?se.readFileSync(t,"utf8"):{error:"transcript not found",code:"NO_TRANSCRIPT"}}getPaths(){let e=V();return{userDataDir:e,storeFile:C.join(e,"attached-projects.json"),sessionsDir:C.join(e,"sessions"),transcriptsDir:C.join(e,"transcripts")}}subscribeSocket(e,t){let r=this.sessionsBySocket.get(e);if(r||(r=new Set,this.sessionsBySocket.set(e,r)),r.has(t))return{ok:!0,refCount:this.subscriptions.get(t)?.refCount??1};r.add(t);let o=this.subscriptions.get(t);if(o)return o.refCount++,{ok:!0,refCount:o.refCount};let s=ie(t,n=>{let i=this.coalescePromptEcho(t,n);if(i&&(this.applySessionEvent(t,i),this.fanOutEvent(t,i)),n.type==="turn-completed"){let a=w(t);if(a)try{G(a.projectId,{usd:n.costUsd,ts:n.ts})}catch(c){process.stderr.write(`[sootsim-agent] recordTurnTelemetry failed: ${c instanceof Error?c.message:String(c)}
|
|
4
|
+
`)}}});return this.subscriptions.set(t,{unsubscribe:s,refCount:1}),{ok:!0,refCount:1}}unsubscribeSocket(e,t){let r=this.sessionsBySocket.get(e);return!r||!r.has(t)?{ok:!0,refCount:0}:(r.delete(t),this.decrementSubscription(t))}decrementSubscription(e){let t=this.subscriptions.get(e);if(!t)return{ok:!0,refCount:0};if(t.refCount--,t.refCount<=0){try{t.unsubscribe()}catch{}return this.subscriptions.delete(e),{ok:!0,refCount:0}}return{ok:!0,refCount:t.refCount}}dropSessionFanout(e){let t=this.subscriptions.get(e);if(t){try{t.unsubscribe()}catch{}this.subscriptions.delete(e)}for(let r of this.sessionsBySocket.values())r.delete(e);this.clearPromptTracking(e)}normalizePromptEnvelope(e){if(e?.prompt&&typeof e.prompt=="object"){let t=e.prompt;return{text:String(t.text??""),...typeof t.displayText=="string"?{displayText:t.displayText}:{},...typeof t.inspectSummary=="string"?{inspectSummary:t.inspectSummary}:{},...typeof t.inspectTrace=="string"?{inspectTrace:t.inspectTrace}:{}}}return{text:String(e?.text??""),...typeof e?.displayText=="string"?{displayText:e.displayText}:{},...typeof e?.inspectSummary=="string"?{inspectSummary:e.inspectSummary}:{},...typeof e?.inspectTrace=="string"?{inspectTrace:e.inspectTrace}:{}}}notePromptAccepted(e,t,r){let o=Date.now(),s=this.pendingPromptEchoes.get(e)??[];s.push({sentAt:o}),this.pendingPromptEchoes.set(e,s);let n=Math.max(this.pendingTurns.get(e)??0,r?1:0)+1;this.pendingTurns.set(e,n);let i=t.displayText??t.text;return this.patchSession(e,{lastPrompt:i,status:"working",needsAttention:!1}),this.fanOutEvent(e,{type:"prompt-received",text:i,...t.inspectSummary?{inspectSummary:t.inspectSummary}:{},...t.inspectTrace?{inspectTrace:t.inspectTrace}:{},ts:o}),{ok:!0,queued:n>1,pendingTurns:n,queueDepth:Math.max(0,n-1)}}applySessionEvent(e,t){switch(t.type){case"prompt-received":case"turn-started":this.patchSession(e,{status:"working",needsAttention:!1});return;case"turn-completed":{let r=this.consumeSettledTurn(e);this.patchSession(e,{status:r>0?"working":"idle",needsAttention:!1,lastTurnFiles:t.filesTouched,currentlyEditing:void 0});return}case"approval-needed":this.patchSession(e,{status:"needs-attention",needsAttention:!0});return;case"error":{let r=this.consumeSettledTurn(e);this.patchSession(e,{status:r>0?"working":"needs-attention",needsAttention:r<=0,currentlyEditing:void 0});return}case"exited":this.clearPromptTracking(e),this.patchSession(e,{status:"ended",needsAttention:!1,wrapperPid:void 0,currentlyEditing:void 0});return;case"ready":case"turn-reasoning":case"turn-message":case"turn-plan":case"tool-call":case"file-edited":case"file-diff-delta":return}}patchSession(e,t){X(e,t);let r=w(e);r&&this.broadcastSessionStatus(r)}coalescePromptEcho(e,t){if(t.type!=="prompt-received")return t;let r=this.pendingPromptEchoes.get(e);if(!r||r.length===0)return t;for(;r.length>0&&Date.now()-r[0].sentAt>15e3;)r.shift();return r.length===0?(this.pendingPromptEchoes.delete(e),t):(r.shift(),r.length===0?this.pendingPromptEchoes.delete(e):this.pendingPromptEchoes.set(e,r),null)}consumeSettledTurn(e){let t=Math.max(0,(this.pendingTurns.get(e)??1)-1);return t>0?this.pendingTurns.set(e,t):this.pendingTurns.delete(e),t}clearPromptTracking(e){this.pendingPromptEchoes.delete(e),this.pendingTurns.delete(e)}fanOutEvent(e,t){let r=JSON.stringify({type:"agent:event",sessionId:e,event:t});for(let[o,s]of this.sessionsBySocket)if(s.has(e)&&o.readyState===T)try{o.send(r)}catch{}}broadcastSessionStatus(e){let t=JSON.stringify({type:"agent:session-status",session:e});for(let r of this.allSockets)if(r.readyState===T)try{r.send(t)}catch{}}respond(e,t,r){if(e.readyState===T)try{e.send(JSON.stringify({id:t,result:r}))}catch{}}respondError(e,t,r,o){if(e.readyState===T)try{e.send(JSON.stringify({id:t,error:r,...o?{code:o}:{}}))}catch{}}};function de(h){return h==="expo"?"expo":h==="one"||h==="vxrn"?"one":"unknown"}var he=new Set(["tap","keyboard","close"]);function fe(h){return!h||typeof h.type!="string"?!1:h.acquireLock===!0?!0:h.readOnly===!0?!1:he.has(h.type)}var me=5e3,ge=3600*1e3,ye="SOOTSIM_RUNTIME_UPDATE_INTERVAL_MS",Se={".html":"text/html; charset=utf-8",".js":"application/javascript",".cjs":"application/javascript",".mjs":"application/javascript",".css":"text/css; charset=utf-8",".json":"application/json; charset=utf-8",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".webp":"image/webp",".avif":"image/avif",".ico":"image/x-icon",".wasm":"application/wasm",".ttf":"font/ttf",".otf":"font/otf",".woff":"font/woff",".woff2":"font/woff2",".map":"application/json",".txt":"text/plain; charset=utf-8"},P=class h{port;openUrlHandler;httpServer=null;wss=null;nextCommandId=1;nextBrowserId=1;browsers=new Map;primaryBrowserId=null;pendingCommands=new Map;cliBySentId=new Map;cliBrowserBySocket=new Map;cliLastCommandAt=new Map;cliSessionKeyBySocket=new Map;cliLabelBySocket=new Map;restorableBrowsers=new Map;nextCliFallbackId=1;cliIdleTimer=null;agentHost;static CLI_IDLE_TIMEOUT_MS=6e4;static CLI_LEASE_TTL_MS=6e5;static USER_ACTIVE_LEASE_TTL_MS=8e3;static USER_BOOT_LEASE_TTL_MS=6e4;static BROWSER_RECONNECT_TTL_MS=3e4;preferredPort;portFallbackCount;shouldWriteLockfile;effectivePort=0;startedAt=0;heartbeatTimer=null;runtimeUpdateTimer=null;runtimeUpdateInFlight=null;activeRuntimeVersion=null;activeRuntimeDirPath=null;constructor(e={}){this.preferredPort=e.port||7668,this.port=this.preferredPort,this.shouldWriteLockfile=e.writeLockfile===!0,this.portFallbackCount=Math.max(1,e.portFallbackCount??10),this.openUrlHandler=e.openUrl,this.agentHost=new E({getExcludePorts:e.agentScanExcludes})}getAgentHost(){return this.agentHost}start(e){this.startAsync(e)}async startAsync(e){if(this.httpServer||this.wss)return this.effectivePort;this.refreshActiveRuntime();for(let t=0;t<this.portFallbackCount;t++){let r=this.preferredPort+t;try{return await this.bindOnce(r,e?.silent===!0),this.effectivePort=r,this.port=r,this.startedAt=Date.now(),t>0&&!e?.silent&&process.stderr.write(`ws bridge bound to port ${r} (preferred ${this.preferredPort} was taken)
|
|
5
|
+
`),this.afterBind(),r}catch(o){if(o?.code!=="EADDRINUSE")throw o;e?.silent||process.stderr.write(`ws bridge port ${r} already in use, trying ${r+1}
|
|
6
|
+
`)}}throw new Error(`could not bind ws bridge after ${this.portFallbackCount} attempts starting at ${this.preferredPort}`)}bindOnce(e,t){return new Promise((r,o)=>{let s=ue((a,c)=>this.handleHttpRequest(a,c)),n=!1,i=a=>{if(!n){n=!0;try{s.close()}catch{}this.httpServer=null,this.wss=null,o(a)}};s.once("error",i),s.listen(e,"127.0.0.1",()=>{n||(n=!0,s.removeListener("error",i),s.on("error",a=>{process.stderr.write(`ws bridge http error: ${String(a)}
|
|
7
|
+
`)}),this.httpServer=s,this.wss=new pe({server:s}),this.wireWebSocketServer(),r())})})}wireWebSocketServer(){this.wss&&this.wss.on("connection",(e,t)=>{let r=t.headers.origin,o=r?"browser":"cli",s=null;if(e.on("error",()=>{}),this.agentHost.registerSocket(e),o==="browser")s={id:`tab-${this.nextBrowserId++}`,ws:e,origin:r,connectedAt:Date.now(),lastSeenAt:Date.now(),lastActiveAt:0,recentActions:[]},this.browsers.set(s.id,s),this.shouldPromoteBrowser(s)&&(this.primaryBrowserId=s.id),this.broadcastBrowserAssignments(),this.broadcastBrowserClientStates();else{let n=`ws-${this.nextCliFallbackId++}`;this.cliSessionKeyBySocket.set(e,n)}e.on("message",n=>{let i;try{i=JSON.parse(n.toString())}catch{return}if(!(!i||typeof i!="object")){if(typeof i.type=="string"&&i.type.startsWith("agent:")){this.agentHost.handleMessage(e,i);return}if(i.type==="runtime:list"){let a=L(),c=this.getActiveRuntime(),d={type:"runtime:list:ok",id:i.id,installed:a,active:c.version,activeRuntimeDir:c.runtimeDir};try{e.send(JSON.stringify(d))}catch{}return}if(i.type==="runtime:use"){let a=typeof i.version=="string"?i.version:"";if(!L().includes(a)){try{e.send(JSON.stringify({type:"runtime:use:error",id:i.id,error:`runtime ${a||"(missing)"} is not installed`}))}catch{}return}let d=this.setActiveRuntime(a);try{e.send(JSON.stringify({type:"runtime:use:ok",id:i.id,version:d.version,runtimeDir:d.runtimeDir}))}catch{}return}if(i.type==="runtime:get"){let a=this.getActiveRuntime();try{e.send(JSON.stringify({type:"runtime:get:ok",id:i.id,active:a.version,activeRuntimeDir:a.runtimeDir}))}catch{}return}if(o==="browser"){if(s&&(s.lastSeenAt=Date.now()),i.type==="bridge:register"&&s){let d=i,l=this.tryRestoreBrowserId(s,d.browserId);s.url=d.url,s.title=d.title,s.userAgent=d.userAgent,l&&(this.broadcastBrowserAssignments(),this.broadcastBrowserClientStates());return}if(i.type==="bridge:user-focus-state"&&s){let d=i;this.updateUserFocusLease(s,d.focused===!0);return}if(i.type==="bridge:user-interact"&&s){this.updateUserActivity(s);return}if(i.type==="bridge:open-path"){let d=typeof i.path=="string"?i.path:"",l=typeof i.line=="number"&&Number.isFinite(i.line)?i.line:void 0,p=typeof i.column=="number"&&Number.isFinite(i.column)?i.column:void 0;d&&this.openPathInEditor(d,l,p);return}if(i.type==="bridge:boot-clients"&&s){let d=[];for(let[p,u]of this.cliBrowserBySocket)u===s.id&&d.push(p);for(let p of d){this.cliBrowserBySocket.delete(p);try{p.close(1e3,"booted by browser")}catch{}}let l=!!s.cliLease;s.cliLease={kind:"user-active",cliSessionKey:"__user-active__",cliLabel:"active user",expiresAt:Date.now()+h.USER_BOOT_LEASE_TTL_MS},process.stderr.write(`sootsim booted ${d.length} cli client(s)${l?" (overrode prior lease)":""}; held tab for user [${s.id}]
|
|
8
|
+
`),this.recordBrowserAction(s.id,"browser booted cli clients"),this.broadcastBrowserClientStates();return}let a=this.pendingCommands.get(i.id);if(a){this.pendingCommands.delete(i.id),i.error?a.reject(new Error(i.error)):a.resolve(i.result);return}let c=this.cliBySentId.get(i.id);if(c&&(this.cliBySentId.delete(i.id),c.ws.readyState===f.OPEN)){let d=this.getOtherCliSessionCount(c.ws,c.browserId),l=d>0?{...i,id:c.originalId,i:d}:{...i,id:c.originalId};c.ws.send(JSON.stringify(l))}return}(async()=>{this.cliLastCommandAt.set(e,Date.now());try{if(i.type==="bridge:bye"){let p=this.cliBrowserBySocket.delete(e);this.cliLastCommandAt.delete(e),this.cliSessionKeyBySocket.delete(e),this.cliLabelBySocket.delete(e);for(let[u,g]of this.cliBySentId)g.ws===e&&this.cliBySentId.delete(u);p&&this.broadcastBrowserClientStates();return}if(i.type==="bridge:hello"){let p=typeof i.cliSessionKey=="string"&&i.cliSessionKey.trim()?i.cliSessionKey.trim():this.cliSessionKeyBySocket.get(e)||`ws-${this.nextCliFallbackId++}`;this.cliSessionKeyBySocket.set(e,p),typeof i.cliLabel=="string"&&i.cliLabel.trim()&&this.cliLabelBySocket.set(e,i.cliLabel.trim()),e.readyState===f.OPEN&&e.send(JSON.stringify({id:i.id,result:{cliSessionKey:p,leaseTtlMs:h.CLI_LEASE_TTL_MS,leasing:!0}}));return}if(i.type==="bridge:list-browsers"){e.readyState===f.OPEN&&e.send(JSON.stringify({id:i.id,result:this.listBrowsers()}));return}if(i.type==="bridge:open"){if(typeof i.url!="string"||!i.url)throw new Error("bridge:open requires a url");await this.openUrl(i.url,{newWindow:i.newWindow===!0}),e.readyState===f.OPEN&&e.send(JSON.stringify({id:i.id,result:{ok:!0,url:i.url}}));return}if(i.type==="bridge:claim"){let p=await this.waitForBrowser(i.browserId),u=this.tryAcquireLease(e,p,{force:i.force===!0});if(!u.granted){e.readyState===f.OPEN&&e.send(JSON.stringify({id:i.id,error:`tab ${p.id} is locked by another cli`,o:u.lock}));return}this.setCliBrowserTarget(e,p.id),this.recordBrowserAction(p.id,u.bootedCount>0?`cli force-claimed tab (booted ${u.bootedCount})`:"cli claimed tab"),e.readyState===f.OPEN&&e.send(JSON.stringify({id:i.id,result:{browserId:p.id,lockedBy:u.lease.cliSessionKey,lockExpiresAt:u.lease.expiresAt,bootedCount:u.bootedCount}}));return}let a=await this.waitForBrowser(i.browserId);if(fe(i)){let p=this.tryAcquireLease(e,a);if(!p.granted){e.readyState===f.OPEN&&e.send(JSON.stringify({id:i.id,error:`tab ${a.id} is locked by another cli \u2014 use \`sootsim claim ${a.id} --force\` or \`sootsim open --new\``,o:p.lock}));return}}else this.ensureCliSessionKey(e);this.setCliBrowserTarget(e,a.id),this.recordBrowserAction(a.id,this.describeForwardedCommand(i));let c=this.nextCommandId++;this.cliBySentId.set(c,{browserId:a.id,ws:e,originalId:i.id});let{browserId:d,...l}=i;a.ws.send(JSON.stringify({...l,id:c}))}catch(a){e.readyState===f.OPEN&&e.send(JSON.stringify({id:i.id,error:a instanceof Error?a.message:String(a)}))}})()}}),e.on("close",()=>{if(this.agentHost.unregisterSocket(e),o==="browser"&&s){this.rememberDisconnectedBrowser(s),this.primaryBrowserId===s.id&&(this.primaryBrowserId=this.getOpenBrowser()?.id??null);for(let[n,i]of this.pendingCommands)i.browserId===s.id&&(i.reject(new Error("browser disconnected")),this.pendingCommands.delete(n));for(let[n,i]of this.cliBySentId)i.browserId===s.id&&(i.ws.readyState===f.OPEN&&i.ws.send(JSON.stringify({id:i.originalId,error:"browser disconnected before responding"})),this.cliBySentId.delete(n));this.broadcastBrowserAssignments(),this.broadcastBrowserClientStates()}else if(o==="cli"){let n=this.cliBrowserBySocket.delete(e);this.cliLastCommandAt.delete(e),this.cliSessionKeyBySocket.delete(e),this.cliLabelBySocket.delete(e);for(let[i,a]of this.cliBySentId)a.ws===e&&this.cliBySentId.delete(i);n&&this.broadcastBrowserClientStates()}})})}afterBind(){if(process.stderr.write(`ws bridge listening on port ${this.port}
|
|
9
|
+
`),this.cliIdleTimer=setInterval(()=>this.sweepIdleCliClients(),3e4),this.cliIdleTimer.unref(),this.shouldWriteLockfile){try{if(A(),!W(this.buildLockfileSnapshot()))throw new Error("another sootsim daemon wrote the lockfile during startup \u2014 aborting")}catch(e){throw process.stderr.write(`ws bridge failed to claim daemon lockfile: ${String(e)}
|
|
10
|
+
`),e}this.heartbeatTimer=setInterval(()=>{try{this.writeLockfileSnapshot()}catch{}},me),this.heartbeatTimer.unref(),this.startRuntimeUpdater()}this.agentHost.seedOnBoot()}bootstrapping=!0;buildLockfileSnapshot(){return{schema:1,pid:process.pid,platform:process.platform,bridgePort:this.effectivePort,runtimePort:this.effectivePort,activeRuntime:this.activeRuntimeVersion,activeRuntimeDir:this.activeRuntimeDirPath,startedAt:this.startedAt,heartbeatAt:Date.now(),bootstrapping:this.bootstrapping}}writeLockfileSnapshot(){F(this.buildLockfileSnapshot())}refreshActiveRuntime(){this.activeRuntimeVersion=N(),this.activeRuntimeDirPath=D()}resolveRuntimeUpdateIntervalMs(){let e=Number(process.env[ye]);return Number.isFinite(e)&&e>0?Math.max(100,Math.round(e)):ge}startRuntimeUpdater(){if(!this.shouldWriteLockfile||this.runtimeUpdateTimer)return;this.runRuntimeUpdate("startup");let e=this.resolveRuntimeUpdateIntervalMs();this.runtimeUpdateTimer=setInterval(()=>{this.runRuntimeUpdate("periodic")},e),this.runtimeUpdateTimer.unref()}runRuntimeUpdate(e){return this.runtimeUpdateInFlight?this.runtimeUpdateInFlight:(this.runtimeUpdateInFlight=(async()=>{try{e==="startup"&&process.stderr.write(`sootsim: checking for runtime updates\u2026
|
|
11
|
+
`);let t=await H();if(!t.updated||!t.latestVersion){e==="startup"&&process.stderr.write(`sootsim: runtime ${this.activeRuntimeVersion??"(none)"} is current
|
|
12
|
+
`);return}let r=this.setActiveRuntime(t.latestVersion);process.stderr.write(`sootsim runtime updated to ${r.version} (${e})
|
|
13
|
+
`)}catch(t){process.stderr.write(`sootsim runtime update failed (${e}): ${t instanceof Error?t.message:String(t)}
|
|
14
|
+
`)}finally{if(this.runtimeUpdateInFlight=null,e==="startup"&&this.bootstrapping){if(this.bootstrapping=!1,this.shouldWriteLockfile&&this.httpServer)try{this.writeLockfileSnapshot()}catch{}process.stderr.write(`sootsim: ready
|
|
15
|
+
`)}}})(),this.runtimeUpdateInFlight)}setActiveRuntime(e){if(_(e),this.refreshActiveRuntime(),this.shouldWriteLockfile&&this.httpServer)try{this.writeLockfileSnapshot()}catch{}let t=JSON.stringify({type:"runtime:changed",version:e,runtimeDir:this.activeRuntimeDirPath});for(let r of this.browsers.values())if(r.ws.readyState===f.OPEN)try{r.ws.send(t)}catch{}return{version:e,runtimeDir:this.activeRuntimeDirPath}}getActiveRuntime(){return{version:this.activeRuntimeVersion,runtimeDir:this.activeRuntimeDirPath}}removeLockfile(){if(this.shouldWriteLockfile)try{x()}catch{}}handleHttpRequest(e,t){let r=(e.method||"GET").toUpperCase();if(r!=="GET"&&r!=="HEAD"){t.writeHead(405,{Allow:"GET, HEAD"}),t.end("method not allowed");return}let o=new URL(e.url||"/","http://localhost");if(o.pathname==="/__bundle-proxy"){let c=o.searchParams.get("url");if(!c){t.writeHead(400,{"Content-Type":"text/plain"}),t.end("bundle-proxy: missing url query param");return}let d;try{d=new URL(c)}catch{t.writeHead(400,{"Content-Type":"text/plain"}),t.end("bundle-proxy: invalid url");return}let l=d.hostname;if(!(l==="localhost"||l==="127.0.0.1"||l==="::1"||l.endsWith(".localhost"))){t.writeHead(403,{"Content-Type":"text/plain"}),t.end("bundle-proxy: only loopback targets allowed");return}(async()=>{try{let u=await fetch(d.toString(),{redirect:"follow"}),g={},m=u.headers.get("content-type");if(m&&(g["Content-Type"]=m),g["Cache-Control"]="no-store",t.writeHead(u.status,g),!u.body){t.end();return}let S=u.body.getReader();for(;;){let{done:B,value:k}=await S.read();if(B)break;t.write(Buffer.from(k))}t.end()}catch(u){t.writeHead(502,{"Content-Type":"text/plain"}),t.end(`bundle-proxy: upstream fetch failed: ${u instanceof Error?u.message:String(u)}`)}})();return}if(o.pathname==="/healthz"){t.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),t.end(JSON.stringify({ok:!0,pid:process.pid,platform:process.platform,bridgePort:this.effectivePort,runtimePort:this.effectivePort,activeRuntime:this.activeRuntimeVersion,startedAt:this.startedAt,uptimeMs:this.startedAt>0?Date.now()-this.startedAt:0}));return}this.refreshActiveRuntime();let s=this.activeRuntimeDirPath;if(!s){t.writeHead(503,{"Content-Type":"text/plain; charset=utf-8"}),t.end("sootsim: no active runtime installed. run `sootsim runtime install` to fetch one.");return}let n=o.pathname;if(n==="/runtime"||n==="/runtime/"?n="/":n.startsWith("/runtime/")&&(n=n.slice(8)),(n===""||n==="/")&&(n="/index.html"),n.includes("\0")){t.writeHead(400),t.end("bad request");return}if(process.platform!=="win32"&&n.includes("\\")){t.writeHead(400),t.end("bad request");return}for(let c of n.split("/"))if(c===".."){t.writeHead(403),t.end("forbidden");return}let i=y.resolve(s,"."+n),a=s.endsWith(y.sep)?s:s+y.sep;if(!i.startsWith(a)&&i!==s){t.writeHead(403),t.end("forbidden");return}v.realpath(i,(c,d)=>{let l=c?i:d,p=l.endsWith(y.sep)?l:l+y.sep;if(!c){let u=(()=>{try{let g=v.realpathSync(s);return g.endsWith(y.sep)?g:g+y.sep}catch{return a}})();if(!p.startsWith(u)&&l+y.sep!==u){t.writeHead(403),t.end("forbidden");return}}v.stat(l,(u,g)=>{if(u||!g?.isFile()){let k=y.extname(n).toLowerCase();if(k&&k!==".html"){t.writeHead(404),t.end("not found");return}let ne=y.join(s,"index.html");v.readFile(ne,(oe,ae)=>{if(oe){t.writeHead(404),t.end("not found");return}if(t.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),r==="HEAD"){t.end();return}t.end(ae)});return}let m=y.extname(l).toLowerCase(),S=Se[m]||"application/octet-stream";if(t.writeHead(200,{"Content-Type":S,"Cache-Control":"no-store"}),r==="HEAD"){t.end();return}let B=v.createReadStream(l);B.pipe(t),B.on("error",()=>{try{t.end()}catch{}})})})}sweepIdleCliClients(){let e=Date.now(),t=!1;for(let[r,o]of this.cliBrowserBySocket){let s=this.cliLastCommandAt.get(r)??0;if(!(e-s<h.CLI_IDLE_TIMEOUT_MS)){this.cliBrowserBySocket.delete(r),this.cliLastCommandAt.delete(r);for(let[n,i]of this.cliBySentId)i.ws===r&&this.cliBySentId.delete(n);try{r.close(1e3,"idle timeout")}catch{}t=!0}}t&&this.broadcastBrowserClientStates(),this.sweepRestorableBrowsers(e)}listBrowsers(){return Array.from(this.browsers.values()).sort((e,t)=>e.id===this.primaryBrowserId?-1:t.id===this.primaryBrowserId?1:e.connectedAt-t.connectedAt).map(e=>this.describeBrowser(e))}async sendCommand(e){let t=await this.waitForBrowser(e.browserId),r=this.nextCommandId++;return new Promise((o,s)=>{let n=setTimeout(()=>{this.pendingCommands.delete(r),this.broadcastBrowserClientStates(),s(new Error("command timed out after 30s"))},3e4);this.pendingCommands.set(r,{browserId:t.id,resolve:c=>{clearTimeout(n),this.pendingCommands.delete(r),this.broadcastBrowserClientStates(),o(c)},reject:c=>{clearTimeout(n),this.pendingCommands.delete(r),this.broadcastBrowserClientStates(),s(c)}}),this.broadcastBrowserClientStates();let{browserId:i,...a}=e;t.ws.send(JSON.stringify({...a,id:r}))})}async evaluate(e,t){return this.sendCommand({type:"evaluate",code:e,browserId:t})}async focusBrowser(e){return this.sendCommand({type:"focus",browserId:e})}async closeBrowser(e){return this.sendCommand({type:"close",browserId:e})}async openPathInEditor(e,t,r){let o=t!=null?`:${t}${r!=null?`:${r}`:""}`:"",s=`${e}${o}`,n=(a,c)=>new Promise(d=>{try{let l=le(a,c,{detached:!0,stdio:"ignore"}),p=!1;l.on("error",()=>{p||(p=!0,d(!1))}),l.on("spawn",()=>{p||(p=!0,l.unref(),d(!0))})}catch{d(!1)}}),i=process.env.REACT_EDITOR||process.env.EDITOR;if(i){let a=i.split(" ").filter(Boolean);if(a.length&&await n(a[0],[...a.slice(1),"-g",s]))return}await n("cursor",["-g",s])||await n("code",["-g",s])||await this.openUrl(e)}async openUrl(e,t={}){if(this.openUrlHandler){await this.openUrlHandler(e,t);return}await K(e,t)}async close(){if(this.cliIdleTimer&&(clearInterval(this.cliIdleTimer),this.cliIdleTimer=null),this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null),this.runtimeUpdateTimer&&(clearInterval(this.runtimeUpdateTimer),this.runtimeUpdateTimer=null),this.shouldWriteLockfile)try{x()}catch{}this.effectivePort=0,this.startedAt=0,this.agentHost.close();for(let[r,o]of this.pendingCommands)o.reject(new Error("server closing")),this.pendingCommands.delete(r);for(let r of this.browsers.values())r.ws.close();this.browsers.clear(),this.primaryBrowserId=null;let e=this.wss,t=this.httpServer;if(this.wss=null,this.httpServer=null,e)try{e.close()}catch{}if(t)try{t.close()}catch{}}describeBrowser(e){let t;try{t=e.ws.readyState}catch{t=f.CLOSED}let r=this.getActiveLease(e);return{id:e.id,origin:e.origin,url:e.url,title:e.title,userAgent:e.userAgent,connectedAt:e.connectedAt,lastSeenAt:e.lastSeenAt,lastActiveAt:e.lastActiveAt||void 0,isPrimary:e.id===this.primaryBrowserId,readyState:t===f.OPEN?"open":t===f.CLOSING?"closing":"closed",attachedCliCount:this.getAttachedCliCount(e.id),lockedBy:r?r.cliLabel||r.cliSessionKey:void 0,lockedByKind:r?r.kind:void 0,lockExpiresAt:r?r.expiresAt:void 0,userFocused:e.userFocused||void 0}}getActiveLease(e){let t=e.cliLease;return t?Date.now()>=t.expiresAt?(e.cliLease=void 0,null):t:null}tryAcquireLease(e,t,r={}){let o=this.cliSessionKeyBySocket.get(e)??(()=>{let l=`ws-${this.nextCliFallbackId++}`;return this.cliSessionKeyBySocket.set(e,l),l})(),s=this.cliLabelBySocket.get(e),n=Date.now(),i=this.getActiveLease(t),a=i&&i.cliSessionKey===o,c=0;if(i&&!a&&!r.force)return{granted:!1,lease:i,lock:{by:i.cliLabel||i.cliSessionKey,expiresInMs:Math.max(0,i.expiresAt-n)},bootedCount:0};if(i&&!a&&r.force)for(let[l,p]of this.cliBrowserBySocket){if(p!==t.id)continue;let u=this.cliSessionKeyBySocket.get(l);if(u&&u!==o){this.cliBrowserBySocket.delete(l);try{l.close(1e3,"lease claimed by another cli")}catch{}c++}}let d={kind:"cli",cliSessionKey:o,cliLabel:s,expiresAt:n+h.CLI_LEASE_TTL_MS};return t.cliLease=d,{granted:!0,lease:d,bootedCount:c}}updateUserFocusLease(e,t){let r=t;e.userFocused!==r&&(e.userFocused=r,this.broadcastBrowserClientStates())}updateUserActivity(e){let t=this.getActiveLease(e);if(t&&t.kind==="cli")return;let o=Date.now()+h.USER_ACTIVE_LEASE_TTL_MS,s=t&&t.kind==="user-active"?Math.max(t.expiresAt,o):o;e.cliLease={kind:"user-active",cliSessionKey:"__user-active__",cliLabel:"active user",expiresAt:s},this.broadcastBrowserClientStates()}ensureCliSessionKey(e){let t=this.cliSessionKeyBySocket.get(e);if(t)return t;let r=`ws-${this.nextCliFallbackId++}`;return this.cliSessionKeyBySocket.set(e,r),r}getOpenBrowser(e){if(e){let r=this.browsers.get(e);return r?.ws.readyState===f.OPEN?r:null}let t=this.primaryBrowserId!=null?this.browsers.get(this.primaryBrowserId):null;if(t?.ws.readyState===f.OPEN)return t;for(let r of this.browsers.values())if(r.ws.readyState===f.OPEN)return r;return null}async waitForBrowser(e,t={}){let r=t.attempts??10,o=t.intervalMs??200;for(let s=0;s<r;s++){let n=this.getOpenBrowser(e);if(n)return n;await new Promise(i=>setTimeout(i,o))}throw new Error(e?`no browser connected with id ${e}`:"no browser connected")}shouldPromoteBrowser(e){let t=this.primaryBrowserId?this.browsers.get(this.primaryBrowserId):null,r=e.origin?.includes(":5173"),o=t?.origin?.includes(":5173");return!t||t.ws.readyState!==f.OPEN||!!r||!o}broadcastBrowserAssignments(){for(let e of this.browsers.values())e.ws.readyState===f.OPEN&&e.ws.send(JSON.stringify({type:"bridge:welcome",browserId:e.id,isPrimary:e.id===this.primaryBrowserId}))}broadcastBrowserClientStates(){for(let e of this.browsers.values()){if(e.ws.readyState!==f.OPEN)continue;let t=this.getActiveLease(e),r={type:"bridge:client-state",attachedCliCount:this.getAttachedCliCount(e.id),activeAgentCommandCount:this.getActiveAgentCommandCount(e.id),recentActions:e.recentActions,lockedBy:t?t.cliLabel||t.cliSessionKey:void 0,lockedByKind:t?t.kind:void 0,lockExpiresAt:t?t.expiresAt:void 0,userFocused:e.userFocused||void 0};e.ws.send(JSON.stringify(r))}}setCliBrowserTarget(e,t){let r=this.cliBrowserBySocket.get(e);r!==t&&(this.cliBrowserBySocket.set(e,t),this.recordBrowserAction(t,r?"cli switched tabs":"cli connected",!1),this.broadcastBrowserClientStates())}recordBrowserAction(e,t,r=!0){let o=t?.trim();if(!o)return;let s=this.browsers.get(e);if(!s)return;let n=Date.now();s.lastActiveAt=n,s.recentActions=[{label:o,at:n},...s.recentActions.filter(i=>i.label!==o)].slice(0,4),r&&this.broadcastBrowserClientStates()}describeForwardedCommand(e){switch(e?.type){case"evaluate":return"evaluated page state";case"screenshot":return"captured screenshot";case"tap":return"sent tap event";case"keyboard":return e?.action==="type"?"typed text":"used keyboard";case"tree":return"dumped tree";case"focus":return"focused tab";case"close":return"requested close";default:return typeof e?.type=="string"?e.type:null}}getAttachedCliCount(e){let t=new Set;for(let[r,o]of this.cliBrowserBySocket){if(o!==e||r.readyState!==f.OPEN)continue;let s=this.cliSessionKeyBySocket.get(r);t.add(s??`ws-unknown-${t.size}`)}return t.size}getOtherCliSessionCount(e,t){let r=this.cliSessionKeyBySocket.get(e),o=new Set;for(let[s,n]of this.cliBrowserBySocket){if(n!==t||s.readyState!==f.OPEN)continue;let i=this.cliSessionKeyBySocket.get(s);i&&i===r||o.add(i??`ws-unknown-${o.size}`)}return o.size}getActiveAgentCommandCount(e){let t=0;for(let r of this.pendingCommands.values())r.browserId===e&&t++;return t}tryRestoreBrowserId(e,t){let r=t?.trim();if(!r||r===e.id)return!1;let o=this.browsers.get(r);if(o&&o!==e&&o.ws.readyState===f.OPEN)return!1;let s=this.getRestorableBrowserState(r),n=e.id;this.browsers.delete(n),e.id=r,s&&(e.recentActions=s.recentActions.map(i=>({...i})),e.lastActiveAt=s.lastActiveAt,e.cliLease=s.cliLease?{...s.cliLease}:void 0,this.restorableBrowsers.delete(r)),this.browsers.set(e.id,e),this.primaryBrowserId===n&&(this.primaryBrowserId=e.id);for(let[i,a]of this.cliBrowserBySocket)a===n&&this.cliBrowserBySocket.set(i,e.id);return!0}rememberDisconnectedBrowser(e){let t=this.getActiveLease(e);this.restorableBrowsers.set(e.id,{recentActions:e.recentActions.map(r=>({...r})),lastActiveAt:e.lastActiveAt,cliLease:t&&t.kind==="cli"?{...t}:void 0,expiresAt:Date.now()+h.BROWSER_RECONNECT_TTL_MS}),this.browsers.delete(e.id)}getRestorableBrowserState(e){let t=this.restorableBrowsers.get(e);return t?t.expiresAt<=Date.now()?(this.restorableBrowsers.delete(e),null):(t.cliLease&&t.cliLease.expiresAt<=Date.now()&&(t.cliLease=void 0),t):null}sweepRestorableBrowsers(e=Date.now()){for(let[t,r]of this.restorableBrowsers)if(!(r.expiresAt>e)){this.restorableBrowsers.delete(t);for(let[o,s]of this.cliBrowserBySocket)s===t&&this.cliBrowserBySocket.delete(o)}}resetServerState(){this.cliIdleTimer&&(clearInterval(this.cliIdleTimer),this.cliIdleTimer=null),this.runtimeUpdateTimer&&(clearInterval(this.runtimeUpdateTimer),this.runtimeUpdateTimer=null);let e=this.wss,t=this.httpServer;if(this.wss=null,this.httpServer=null,e)try{e.close()}catch{}if(t)try{t.close()}catch{}}};function we(){return!!((process.env.XPC_SERVICE_NAME||"").includes("dev.sootsim.server")||process.env.INVOCATION_ID)}async function $e(h,e={}){(h.includes("--help")||h.includes("-h"))&&(console.log(`
|
|
16
|
+
sootsim server \u2014 run the sootsim bridge daemon in the foreground
|
|
17
|
+
|
|
18
|
+
hosts the WS bridge that CLI commands talk to. once running, any sootsim
|
|
19
|
+
tab (browser, electron, headless playwright) that connects to port 7668
|
|
20
|
+
becomes drivable from 'sootsim describe', 'sootsim tap', etc.
|
|
21
|
+
|
|
22
|
+
usage:
|
|
23
|
+
sootsim server [options]
|
|
24
|
+
|
|
25
|
+
options:
|
|
26
|
+
--port <n> bridge port (defaults to ${7668})
|
|
27
|
+
--quiet suppress per-connection logging
|
|
28
|
+
|
|
29
|
+
examples:
|
|
30
|
+
sootsim server
|
|
31
|
+
sootsim server --port 7668 --quiet
|
|
32
|
+
`),process.exit(0));let t=h.indexOf("--port"),r=t>=0&&h[t+1]?Number(h[t+1]):e.port??7668;Number.isNaN(r)&&(console.error(` invalid --port value: ${h[t+1]}`),process.exit(1));let o=h.includes("--quiet")||h.includes("-q"),s=U();s&&M(s)&&(console.error(` a sootsim daemon is already running (pid ${s.pid}, port ${s.bridgePort})`),console.error(" stop it with 'sootsim daemon stop' first"),process.exit(1)),A();let n=new P({port:r,writeLockfile:!0}),i=await n.startAsync({silent:o}),a=Date.now(),c=u=>{o||process.stdout.write(`${u}
|
|
33
|
+
`)},d=new Set,l=setInterval(()=>{let u=n.listBrowsers(),g=new Set(u.map(m=>m.id));for(let m of u)if(!d.has(m.id)){let S=m.title||m.url||m.origin||"(unknown)";c(` + ${m.id} ${S}`)}for(let m of d)g.has(m)||c(` - ${m}`);d.clear();for(let m of g)d.add(m)},500);$({event:"daemon_heartbeat",properties:{bridge_port:i,under_daemon:we(),platform:process.platform,subsource:"daemon"}}),j(),c(`sootsim bridge listening on ws://localhost:${i} (runtime http on same port)`),i!==r&&c(` (preferred port ${r} was taken \u2014 fell back to ${i})`),c(" ready for browser tabs, electron, or headless playwright to connect"),c(" (ctrl-c to stop)");let p=async u=>{clearInterval(l),c(`
|
|
34
|
+
${u} received \u2014 shutting down after ${Math.round((Date.now()-a)/1e3)}s`);try{await n.close()}catch{}process.exit(0)};process.on("SIGINT",()=>p("SIGINT")),process.on("SIGTERM",()=>p("SIGTERM")),process.on("SIGHUP",()=>p("SIGHUP")),process.on("exit",()=>{try{n.removeLockfile()}catch{}}),await new Promise(()=>{})}export{$e as runServer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a}from"./chunk-27P763IZ.js";import"./chunk-VFDRZNPN.js";import"./chunk-IJMYFYDZ.js";import"./chunk-EJLNUMMP.js";import"./chunk-TC6V7YFC.js";import"./chunk-SMVJOWSV.js";import"./chunk-6GGMKFWJ.js";import"./chunk-ZEW3RF5Q.js";import"./chunk-5QIUJNT3.js";import"./chunk-LHDWH7VS.js";export{a as runSetupRepo};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
2
|
-
import"./chunk-
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import"./chunk-LHDWH7VS.js";import*as l from"fs";import*as i from"path";import{fileURLToPath as f}from"url";function g(){try{let s=f(import.meta.resolve("sootsim/package.json"));return i.join(i.dirname(s),"skills")}catch{let s=i.dirname(f(import.meta.url));return i.resolve(s,"../../skills")}}var m=g();function d(s){let n=s.match(/^---\n([\s\S]*?)\n---/);if(!n)return null;let e=n[1],o=e.match(/^name:\s*(.+)$/m),r=e.match(/^description:\s*(.+)$/m);return o?{name:o[1].trim(),description:r?.[1]?.trim()||""}:null}function p(){if(!l.existsSync(m))return[];let s=l.readdirSync(m).filter(e=>e.endsWith(".md")),n=[];for(let e of s){let o=l.readFileSync(i.join(m,e),"utf8"),r=d(o);r&&n.push({...r,filename:e})}return n}function u(s,n){let e=i.join(m,s.filename),o=i.join(n,s.filename);l.copyFileSync(e,o),console.log(` copied ${s.name} \u2192 ${o}`)}async function h(s){if(s.includes("--list")||s.includes("-l")||s.length===0){let t=p();if(t.length===0){console.log(" no skills found");return}console.log(`
|
|
3
3
|
available skills:
|
|
4
4
|
`);for(let c of t)console.log(` ${c.name}`),console.log(` ${c.description}
|
|
5
5
|
`);console.log(" usage: sootsim skills <target-dir> [skill-name...]"),console.log(" example: sootsim skills ./my-project"),console.log(` example: sootsim skills ./my-project debug perf
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
2
|
-
import"./chunk-
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import"./chunk-LHDWH7VS.js";import{spawn as m}from"child_process";import{existsSync as h,readdirSync as w}from"fs";import{resolve as u,dirname as x}from"path";import{fileURLToPath as y}from"url";var d=x(y(import.meta.resolve("sootsim-engine/package.json")));async function v(t,r){let l=t.includes("--flows"),f=t.includes("--detox"),c=t.includes("--parallel"),i=t.includes("--watch"),a=t.find((e,o)=>t[o-1]==="--reporter")||"console";if((t.includes("--help")||t.includes("-h"))&&(console.log(`
|
|
3
3
|
sootsim test \u2014 run tests against sootsim
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -26,6 +26,6 @@ examples:
|
|
|
26
26
|
notes:
|
|
27
27
|
playwright is best for smoke and package-local debugging
|
|
28
28
|
--detox is the preferred parity lane for behavior that should match real RN
|
|
29
|
-
`),process.exit(0)),l)await b(t,r,c,a);else if(f){let{runDetox:e}=await import("./detox-
|
|
29
|
+
`),process.exit(0)),l)await b(t,r,c,a);else if(f){let{runDetox:e}=await import("./detox-B3FDOIS3.js");await e(t.filter(o=>o!=="--detox"),r)}else await g(t,r)}async function g(t,r){let l=["playwright","test"],f=t.find((e,o)=>t[o-1]==="-t")||t.find((e,o)=>t[o-1]==="--testNamePattern")||t.find((e,o)=>t[o-1]==="--grep");f&&l.push("-g",f),t.includes("--watch")&&l.push("--ui");let c=new Set(["--flows","--detox","--parallel","--watch","--reporter","-t","--testNamePattern","--grep"]);for(let e=0;e<t.length;e++){if(c.has(t[e])){(t[e]==="-t"||t[e]==="--testNamePattern"||t[e]==="--grep"||t[e]==="--reporter")&&e++;continue}l.push(t[e])}console.log(` running: npx ${l.join(" ")}`);let i=m("npx",l,{cwd:d,stdio:"inherit",env:{...process.env}}),a=await new Promise(e=>{i.on("exit",o=>e(o||0))});process.exit(a)}async function b(t,r,l,f){let c=["flows","test/flows","e2e/flows",".maestro","maestro"],i=[];for(let o of c){let s=u(d,o);if(h(s)){let p=w(s).filter(n=>n.endsWith(".yaml")||n.endsWith(".yml"));for(let n of p)i.push(u(s,n))}}for(let o of c){let s=u(process.cwd(),o);if(!s.startsWith(d)&&h(s)){let p=w(s).filter(n=>n.endsWith(".yaml")||n.endsWith(".yml"));for(let n of p)i.push(u(s,n))}}i.length===0&&(console.log(" no flow files found in flows/, test/flows/, or e2e/flows/"),process.exit(0)),console.log(` found ${i.length} flow(s)`);let a=0,e=0;for(let o of i)try{let{runFlowPlayback:s}=await import("./flow-JJBO6TFY.js"),p=r.port?`http://localhost:${r.port}`:"http://localhost:5173";if(await s([o,"--url",p,"--new"])!==0){e++;continue}a++}catch{e++}console.log(`
|
|
30
30
|
results: ${a} passed, ${e} failed (${i.length} total)
|
|
31
31
|
`),process.exit(e>0?1:0)}export{v as runTest};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a,b}from"./chunk-3UIWOHC2.js";import"./chunk-YLIIVTTQ.js";import"./chunk-IJMYFYDZ.js";import"./chunk-EJLNUMMP.js";import"./chunk-G663654J.js";import"./chunk-A5BRCXYE.js";import"./chunk-SMVJOWSV.js";import"./chunk-6GGMKFWJ.js";import"./chunk-ZEW3RF5Q.js";import"./chunk-5QIUJNT3.js";import"./chunk-LHDWH7VS.js";export{a as resolveDefaultUploadOrigin,b as runUpload};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
2
|
-
import{d as n}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{d as n}from"./chunk-EJLNUMMP.js";import"./chunk-LHDWH7VS.js";async function s(){let o=await n();o?.token||(console.log(" not signed in"),process.exit(1));let e=o.user;console.log(` ${e?.email||e?.name||e?.id||"signed in"}`),console.log(` origin: ${o.origin}`),console.log(` updated: ${o.updatedAt}`)}export{s as runWhoami};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -190,6 +190,8 @@ var AgentDaemonClient = class {
|
|
|
190
190
|
});
|
|
191
191
|
this.ws.on("message", (data) => this.handleMessage(data));
|
|
192
192
|
this.ws.on("close", () => this.handleClose());
|
|
193
|
+
this.ws.on("error", () => {
|
|
194
|
+
});
|
|
193
195
|
}
|
|
194
196
|
async waitReady() {
|
|
195
197
|
return this.ready;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -524,6 +524,7 @@ async function startSession(opts) {
|
|
|
524
524
|
];
|
|
525
525
|
if (opts.codexBin) wrapperArgs.push("--codex-bin", opts.codexBin);
|
|
526
526
|
if (opts.claudeBin) wrapperArgs.push("--claude-bin", opts.claudeBin);
|
|
527
|
+
if (opts.freshThread) wrapperArgs.push("--fresh-thread");
|
|
527
528
|
if (claudeSessionUuid) {
|
|
528
529
|
wrapperArgs.push("--claude-session-uuid", claudeSessionUuid);
|
|
529
530
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
package/dist-lib/config.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -52,11 +52,13 @@ function normalizeNativeDevBundleUrl(bundleUrl) {
|
|
|
52
52
|
try {
|
|
53
53
|
const isAbsolute = isAbsoluteHttpUrl(bundleUrl);
|
|
54
54
|
const parsed = new URL(bundleUrl, "http://soot.local");
|
|
55
|
+
parsed.pathname = parsed.pathname.replace(/\.\.bundle$/, ".bundle");
|
|
55
56
|
if (!isNativeDevBundlePath(parsed.pathname)) return bundleUrl;
|
|
56
57
|
if (!parsed.searchParams.has("dev")) parsed.searchParams.set("dev", "true");
|
|
57
58
|
if (!parsed.searchParams.has("minify")) {
|
|
58
59
|
parsed.searchParams.set("minify", "false");
|
|
59
60
|
}
|
|
61
|
+
parsed.searchParams.delete("transform.bytecode");
|
|
60
62
|
if (isAbsolute) return parsed.toString();
|
|
61
63
|
return `${parsed.pathname}${parsed.search}${parsed.hash}`;
|
|
62
64
|
} catch {
|
package/dist-lib/home-paths.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.
|
|
1
|
+
/*! sootsim v0.1.36 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -51,12 +51,14 @@ __export(home_paths_exports, {
|
|
|
51
51
|
listInstalledRuntimes: () => listInstalledRuntimes,
|
|
52
52
|
readActiveRuntime: () => readActiveRuntime,
|
|
53
53
|
readDaemonLockfile: () => readDaemonLockfile,
|
|
54
|
+
readTelemetryEnabled: () => readTelemetryEnabled,
|
|
54
55
|
removeDaemonLockfile: () => removeDaemonLockfile,
|
|
55
56
|
runtimeDir: () => runtimeDir,
|
|
56
57
|
runtimesDir: () => runtimesDir,
|
|
57
58
|
sootsimHomeDir: () => sootsimHomeDir,
|
|
58
59
|
writeActiveRuntime: () => writeActiveRuntime,
|
|
59
|
-
writeDaemonLockfile: () => writeDaemonLockfile
|
|
60
|
+
writeDaemonLockfile: () => writeDaemonLockfile,
|
|
61
|
+
writeTelemetryEnabled: () => writeTelemetryEnabled
|
|
60
62
|
});
|
|
61
63
|
module.exports = __toCommonJS(home_paths_exports);
|
|
62
64
|
var import_fs = __toESM(require("fs"), 1);
|
|
@@ -96,6 +98,28 @@ function daemonLockfilePath() {
|
|
|
96
98
|
function configFilePath() {
|
|
97
99
|
return import_path.default.join(sootsimHomeDir(), CONFIG_FILE);
|
|
98
100
|
}
|
|
101
|
+
function readSharedConfig() {
|
|
102
|
+
try {
|
|
103
|
+
const raw = import_fs.default.readFileSync(configFilePath(), "utf8");
|
|
104
|
+
const parsed = JSON.parse(raw);
|
|
105
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
106
|
+
} catch {
|
|
107
|
+
return {};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function readTelemetryEnabled() {
|
|
111
|
+
const cfg = readSharedConfig();
|
|
112
|
+
return cfg.telemetry !== false;
|
|
113
|
+
}
|
|
114
|
+
function writeTelemetryEnabled(enabled) {
|
|
115
|
+
ensureSootsimHome();
|
|
116
|
+
const cfg = readSharedConfig();
|
|
117
|
+
cfg.telemetry = enabled;
|
|
118
|
+
const tmp = `${configFilePath()}.tmp`;
|
|
119
|
+
import_fs.default.writeFileSync(tmp, `${JSON.stringify(cfg, null, 2)}
|
|
120
|
+
`, "utf8");
|
|
121
|
+
import_fs.default.renameSync(tmp, configFilePath());
|
|
122
|
+
}
|
|
99
123
|
function ensureSootsimHome() {
|
|
100
124
|
import_fs.default.mkdirSync(sootsimHomeDir(), { recursive: true });
|
|
101
125
|
import_fs.default.mkdirSync(runtimesDir(), { recursive: true });
|
|
@@ -225,10 +249,12 @@ function removeDaemonLockfile() {
|
|
|
225
249
|
listInstalledRuntimes,
|
|
226
250
|
readActiveRuntime,
|
|
227
251
|
readDaemonLockfile,
|
|
252
|
+
readTelemetryEnabled,
|
|
228
253
|
removeDaemonLockfile,
|
|
229
254
|
runtimeDir,
|
|
230
255
|
runtimesDir,
|
|
231
256
|
sootsimHomeDir,
|
|
232
257
|
writeActiveRuntime,
|
|
233
|
-
writeDaemonLockfile
|
|
258
|
+
writeDaemonLockfile,
|
|
259
|
+
writeTelemetryEnabled
|
|
234
260
|
});
|