sootsim 0.1.227 → 0.1.229
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 +14 -14
- package/detox/element-types.ts +3 -3
- package/detox/expectations.ts +29 -24
- package/detox/gestures.ts +16 -16
- package/detox/index.ts +34 -32
- package/dist-cli/bin.js +4 -4
- package/dist-cli/chunks/{agent-HBVXCRJT.js → agent-O26YYN6Z.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-X376DPV2.js → agent-wrapper-GSMHXP6S.js} +2 -2
- package/dist-cli/chunks/{app-fonts-LIQTD5RP.js → app-fonts-TVTDVD7S.js} +2 -2
- package/dist-cli/chunks/{assert-X6PPLN72.js → assert-KEWRJSST.js} +2 -2
- package/dist-cli/chunks/{auth-INRWIM2C.js → auth-KQXLD6AC.js} +2 -2
- package/dist-cli/chunks/beta-BXBII74U.js +2 -0
- package/dist-cli/chunks/{camera-LGFHYCJ5.js → camera-RTNVNBMT.js} +2 -2
- package/dist-cli/chunks/{chunk-YB2LM6VB.js → chunk-32O3YKA2.js} +6 -6
- package/dist-cli/chunks/{chunk-SBIAPF6E.js → chunk-3FGXJMSF.js} +1 -1
- package/dist-cli/chunks/{chunk-QWRYD2QV.js → chunk-3FYUTNM4.js} +18 -18
- package/dist-cli/chunks/{chunk-A4BOYB55.js → chunk-3UE5OA64.js} +2 -2
- package/dist-cli/chunks/{chunk-LCJSTEIR.js → chunk-456MZ4LU.js} +2 -2
- package/dist-cli/chunks/{chunk-E75EBS77.js → chunk-4O73AHYA.js} +2 -2
- package/dist-cli/chunks/chunk-4WAZOAAS.js +2 -0
- package/dist-cli/chunks/{chunk-RNWJQ4UR.js → chunk-62GPXYH7.js} +1 -1
- package/dist-cli/chunks/chunk-6Q3M6FMW.js +24 -0
- package/dist-cli/chunks/chunk-6VQIZJLG.js +1 -0
- package/dist-cli/chunks/chunk-7FSM4I7A.js +1 -0
- package/dist-cli/chunks/{chunk-J2JAOIMN.js → chunk-7IBNJPSB.js} +2 -2
- package/dist-cli/chunks/{chunk-GUCFICA4.js → chunk-7LSM7YNF.js} +1 -1
- package/dist-cli/chunks/{chunk-J7IFVTWX.js → chunk-AB7XCG3A.js} +1 -1
- package/dist-cli/chunks/{chunk-MG6JE3AM.js → chunk-AZWH6YSL.js} +2 -2
- package/dist-cli/chunks/{chunk-ESK7B2BQ.js → chunk-BZOTL2IQ.js} +6 -6
- package/dist-cli/chunks/{chunk-2XXPF6LP.js → chunk-CE3XI55C.js} +2 -2
- package/dist-cli/chunks/{chunk-HRYKZ5YY.js → chunk-DXF6DHIR.js} +5 -5
- package/dist-cli/chunks/{chunk-DB3GMVOH.js → chunk-FF7GZMWQ.js} +2 -2
- package/dist-cli/chunks/chunk-GVOFX6LJ.js +118 -0
- package/dist-cli/chunks/{chunk-HXHB5A6R.js → chunk-HKBDDBKZ.js} +2 -2
- package/dist-cli/chunks/{chunk-UGWURWHN.js → chunk-HKZICBKI.js} +2 -2
- package/dist-cli/chunks/{chunk-E3DLUOFK.js → chunk-JK4AGL2U.js} +7 -7
- package/dist-cli/chunks/{chunk-NIN75M5H.js → chunk-OUJVQUX4.js} +2 -2
- package/dist-cli/chunks/chunk-OWSZCLYZ.js +2 -0
- package/dist-cli/chunks/{chunk-XESYTWFM.js → chunk-P3ORPGKZ.js} +29 -29
- package/dist-cli/chunks/{chunk-Q4FB222M.js → chunk-PNLTVAPK.js} +3 -3
- package/dist-cli/chunks/{chunk-4J7BIXEB.js → chunk-PY65YXHI.js} +2 -2
- package/dist-cli/chunks/{chunk-7LDHOQ7B.js → chunk-S4CJUMUZ.js} +34 -34
- package/dist-cli/chunks/{chunk-T6MEERRI.js → chunk-SCGYOJJP.js} +2 -2
- package/dist-cli/chunks/{chunk-HXSV263V.js → chunk-SHBXXKJW.js} +1 -1
- package/dist-cli/chunks/chunk-SPBHQVJ4.js +2 -0
- package/dist-cli/chunks/{chunk-F53C5HAB.js → chunk-SYZKYAPC.js} +1 -1
- package/dist-cli/chunks/{chunk-3L5EXWCP.js → chunk-THDVL3ST.js} +1 -1
- package/dist-cli/chunks/{chunk-HTVB3FW2.js → chunk-TJXRSDEU.js} +2 -2
- package/dist-cli/chunks/{chunk-NU755HCE.js → chunk-TWUPMUWQ.js} +1 -1
- package/dist-cli/chunks/{chunk-F5HOYUD2.js → chunk-U4OPCVAL.js} +1 -1
- package/dist-cli/chunks/chunk-UCVK6JDW.js +3 -0
- package/dist-cli/chunks/chunk-UGFZIHBA.js +2 -0
- package/dist-cli/chunks/{chunk-LM544J6V.js → chunk-V2TABN7W.js} +1 -1
- package/dist-cli/chunks/{chunk-D42IRY2Y.js → chunk-VKVRAWJR.js} +2 -2
- package/dist-cli/chunks/{chunk-7L5IKIHC.js → chunk-VUJ5FLL7.js} +1 -1
- package/dist-cli/chunks/{chunk-2BQOZATN.js → chunk-WRPO6J3Z.js} +3 -3
- package/dist-cli/chunks/chunk-XQHCHVHE.js +4 -0
- package/dist-cli/chunks/{chunk-NHE3YHDU.js → chunk-ZORXBO54.js} +2 -2
- package/dist-cli/chunks/cli-version-W42GGXV7.js +2 -0
- package/dist-cli/chunks/{compat-MH673TEJ.js → compat-HPS6RGWD.js} +3 -3
- package/dist-cli/chunks/{config-SSCDV5ZJ.js → config-EKIT7WKS.js} +2 -2
- package/dist-cli/chunks/{control-54R2XDLV.js → control-QFNWOCLW.js} +2 -2
- package/dist-cli/chunks/daemon-B6RUIEYN.js +2 -0
- package/dist-cli/chunks/{debug-PFP646II.js → debug-EU5JDWZR.js} +3 -3
- package/dist-cli/chunks/{desktop-BPYYJ3EM.js → desktop-OOCDJB3I.js} +3 -3
- package/dist-cli/chunks/{detox-BIUVHXYH.js → detox-BXXEPJ3F.js} +2 -2
- package/dist-cli/chunks/{device-BNSPNIP6.js → device-6B6NKGAW.js} +2 -2
- package/dist-cli/chunks/{diagnose-BPTDSGOB.js → diagnose-FOWBMKO6.js} +2 -2
- package/dist-cli/chunks/drivers-DC6SRA2P.js +2 -0
- package/dist-cli/chunks/{film-ILA6VSOG.js → film-MVJCHWBU.js} +3 -3
- package/dist-cli/chunks/flow-XO4D3LRA.js +2 -0
- package/dist-cli/chunks/help-WNPSM6ZU.js +2 -0
- package/dist-cli/chunks/{hidden-runtime-alias-TD7IVAPF.js → hidden-runtime-alias-OVGHDXOR.js} +2 -2
- package/dist-cli/chunks/{home-paths-H36JDTNO.js → home-paths-3W46OKY6.js} +2 -2
- package/dist-cli/chunks/inspect-4J5NJCXS.js +2 -0
- package/dist-cli/chunks/install-desktop-GAEFTQ2K.js +2 -0
- package/dist-cli/chunks/{login-5WGZX2ZD.js → login-CU72MJHE.js} +4 -4
- package/dist-cli/chunks/{logout-V53WTVIZ.js → logout-SF5EPW7M.js} +2 -2
- package/dist-cli/chunks/{maestro-HGKYRD54.js → maestro-NYFSOD2H.js} +3 -3
- package/dist-cli/chunks/{maestro-generate-6DNZSKDP.js → maestro-generate-VDAXEVCE.js} +3 -3
- package/dist-cli/chunks/{mode-YFMKORE5.js → mode-VSABDCU5.js} +2 -2
- package/dist-cli/chunks/optional-demo-registry-YQZA2MRD.js +2 -0
- package/dist-cli/chunks/{perf-EOIGFDWM.js → perf-5XMCN7A2.js} +2 -2
- package/dist-cli/chunks/{record-2F54QS6Y.js → record-NAYAEQPD.js} +10 -10
- package/dist-cli/chunks/runtime-LR63M7XX.js +2 -0
- package/dist-cli/chunks/screenshot-command-HFNYL2CY.js +151 -0
- package/dist-cli/chunks/{screenshots-capture-DIICN24R.js → screenshots-capture-JCBFMJFS.js} +3 -3
- package/dist-cli/chunks/{serve-66NC6PPZ.js → serve-Z5HVGJ3C.js} +5 -5
- package/dist-cli/chunks/{setup-ZYN4BTBR.js → setup-YKDBK3RX.js} +3 -3
- package/dist-cli/chunks/{skills-MDBIER7U.js → skills-DQOWHZBC.js} +2 -2
- package/dist-cli/chunks/{storage-AQ3SEO4Y.js → storage-TKTKWTWE.js} +2 -2
- package/dist-cli/chunks/store-FPAX23SK.js +2 -0
- package/dist-cli/chunks/telemetry-CWRFOESH.js +2 -0
- package/dist-cli/chunks/{timeline-VEGHQZ36.js → timeline-QJPIAP7L.js} +2 -2
- package/dist-cli/chunks/{upgrade-RNDCRPLJ.js → upgrade-4ZEV4BY2.js} +3 -3
- package/dist-cli/chunks/upload-OF4CO6WM.js +2 -0
- package/dist-cli/chunks/{version-XUMPKQUM.js → version-OVU37MXP.js} +2 -2
- package/dist-cli/chunks/{web-ESQGHVPD.js → web-JUDK5W4T.js} +2 -2
- package/dist-cli/chunks/{what-happened-6NJENKUF.js → what-happened-TKCIGNLL.js} +2 -2
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +2 -2
- package/dist-lib/backend-origin.cjs +18 -18
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +4 -4
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +321 -79
- package/dist-lib/dev-bundle-resolution.cjs +2 -2
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +18 -13
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro.cjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +7 -7
- package/dist-lib/sdk.cjs +12 -4
- package/dist-lib/sdk.mjs +12 -4
- package/dist-lib/skills.cjs +456 -170
- package/dist-lib/vite.cjs +1 -1
- package/package.json +4 -4
- package/scripts/dev-server-scanner.ts +5 -5
- package/scripts/postinstall.cjs +1 -1
- package/scripts/preuninstall.cjs +1 -1
- package/skills/{soot → contrast}/SKILL.md +4 -4
- package/skills/sootsim-perf/SKILL.md +3 -1
- package/src/auth/shared-session.ts +1 -1
- package/src/backend-origin.ts +11 -11
- package/src/bridge-constants.ts +3 -3
- package/src/home-paths.ts +1 -1
- package/src/host/agent-host.ts +2 -2
- package/src/host/bridge-host.ts +21 -21
- package/src/native-dev-bundle-url.ts +3 -3
- package/src/runtime-assets.ts +3 -3
- package/src/runtime-delivery.ts +10 -4
- package/src/screenshots/compose.ts +4 -1
- package/src/screenshots/frame-compose.ts +4 -1
- package/src/screenshots/orchestrate.ts +7 -2
- package/src/vite-plugin-one.ts +3 -3
- package/src/vite-plugin.ts +3 -3
- package/dist-cli/chunks/beta-WLLSIVLW.js +0 -2
- package/dist-cli/chunks/chunk-35EAEAN4.js +0 -24
- package/dist-cli/chunks/chunk-44Z2X5R4.js +0 -2
- package/dist-cli/chunks/chunk-4BLOZ3AF.js +0 -2
- package/dist-cli/chunks/chunk-7K5K5NKB.js +0 -2
- package/dist-cli/chunks/chunk-7RWDQCIT.js +0 -1
- package/dist-cli/chunks/chunk-BVD2JFOX.js +0 -1
- package/dist-cli/chunks/chunk-HBEEYWK5.js +0 -2
- package/dist-cli/chunks/chunk-JNUGPBWC.js +0 -118
- package/dist-cli/chunks/chunk-KBSJA7HK.js +0 -3
- package/dist-cli/chunks/chunk-Z2E2DDIQ.js +0 -4
- package/dist-cli/chunks/cli-version-NNBCIQKL.js +0 -2
- package/dist-cli/chunks/daemon-GL5GQTWB.js +0 -2
- package/dist-cli/chunks/drivers-KBKJVF2Y.js +0 -2
- package/dist-cli/chunks/flow-L247VVBM.js +0 -2
- package/dist-cli/chunks/help-QIZEANNK.js +0 -2
- package/dist-cli/chunks/inspect-6OAVS27G.js +0 -2
- package/dist-cli/chunks/install-desktop-LKYAUUQY.js +0 -2
- package/dist-cli/chunks/optional-demo-registry-YGNESGBH.js +0 -2
- package/dist-cli/chunks/runtime-FYVV4DCQ.js +0 -2
- package/dist-cli/chunks/screenshot-command-R535TYXY.js +0 -151
- package/dist-cli/chunks/store-6ZGLOTZI.js +0 -2
- package/dist-cli/chunks/telemetry-V76UPVDV.js +0 -2
- package/dist-cli/chunks/upload-KRBS3Y7Q.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{d as p}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{d as p}from"./chunk-OWSZCLYZ.js";import"./chunk-U4OPCVAL.js";import{existsSync as h,mkdirSync as d,readFileSync as y,writeFileSync as g}from"node:fs";import{join as m}from"node:path";import{gzipSync as w}from"node:zlib";function f(t,e){let o=t.indexOf(`--${e}`);if(o!==-1&&o+1<t.length)return t[o+1];let i=t.find(r=>r.startsWith(`--${e}=`));return i?i.slice(e.length+3):void 0}async function S(t){let e=f(t,"wire")||"",o=f(t,"out-dir"),i=f(t,"manifest");if((!o||!i)&&(console.error(" usage: sootsim app-fonts stage --wire <wire> --out-dir <dir> --manifest <path>"),process.exit(1)),!e.trim()){console.log("no app fonts declared \u2014 nothing to stage");return}d(o,{recursive:!0});let r=await p(e,{onStaged:({url:n,byteLength:s})=>console.log(` staged app font: ${n} (${(s/1024).toFixed(1)} KiB)`),onError:(n,s)=>console.error(` warning: failed to fetch app font ${n}: ${s instanceof Error?s.message:s}`)}),a=[];for(let n of r){let s=w(n.bytes);g(m(o,n.urlhash),s),a.push({url:n.url,urlhash:n.urlhash,contentType:n.contentType,encoding:"gzip",sizeBytes:s.length,rawBytes:n.bytes.byteLength})}let c=[];if(h(i))try{let n=JSON.parse(y(i,"utf8"));Array.isArray(n)&&(c=n)}catch{}let u=new Set(c.map(n=>n.urlhash)),l=[...c,...a.filter(n=>!u.has(n.urlhash))];g(i,JSON.stringify(l)),console.log(`staged ${a.length} app font(s); manifest now has ${l.length} file(s)`)}async function E(t){let e=t[0];if(e==="stage"){await S(t.slice(1));return}console.error(` unknown app-fonts subcommand: ${e??"(none)"}`),console.error(" available: stage"),process.exit(1)}export{E as runAppFonts};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import"./chunk-
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import"./chunk-U4OPCVAL.js";import{spawn as x}from"child_process";var w=new Set(["describe","find","list","network","logs","count","tree","url","a11y","node","layout","keyboard","errors","warnings","requests","animations","animation","state","sample-color"]),S=new Set(["--exists","--empty","--negate","--quiet","--allow-timeout","!"]),q=new Set(["--count","--count-at-least","--count-at-most","--contains","--not-contains","--matches","--not-matches","--equals","--jq","--has-path","--within"]),P=new Set(["--path-equals"]);function j(s){let r=[],u=[],n=0,e=!1,t=!1,i=!1;for(let o=0;o<s.length;o++){let a=s[o];if(a==="--within"){let c=Number(s[o+1]);if(!Number.isFinite(c)||c<0)return{error:`--within requires a non-negative number, got: ${s[o+1]}`};n=c,o++;continue}if(a==="--negate"||a==="!"){e=!0;continue}if(a==="--quiet"){t=!0;continue}if(a==="--allow-timeout"){i=!0;continue}if(S.has(a)){u.push({kind:a,args:[]});continue}if(q.has(a)){let c=s[o+1];if(c==null)return{error:`${a} requires a value`};u.push({kind:a,args:[c]}),o++;continue}if(P.has(a)){let c=s[o+1],f=s[o+2];if(c==null||f==null)return{error:`${a} requires <path> <value>`};u.push({kind:a,args:[c,f]}),o+=2;continue}r.push(a)}return r.length===0?{error:"assert requires a verb (e.g. find, describe, get errors)"}:{verbArgs:r,predicates:u,withinMs:n,negate:e,quiet:t,allowTimeout:i}}function N(s){return s[0]==="get"||s[0]==="debug"?w.has(s[1])?s[1]:null:s[0]==="do"||s[0]==="wait"?null:w.has(s[0])?s[0]:null}async function R(s){let u=[process.argv[1],...s,"--json"];return new Promise(n=>{let e=x(process.execPath,u,{stdio:["ignore","pipe","pipe"],env:process.env}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",o=>{n({ok:!1,payload:null,reason:`spawn failed: ${o.message}`})}),e.on("close",o=>{if(o!==0){let a=i.trim().split(`
|
|
3
3
|
`).slice(-2).join(" | ").slice(0,200);n({ok:!1,payload:null,reason:`verb exited ${o}${a?`: ${a}`:""}`});return}if(!t.trim()){n({ok:!1,payload:null,reason:"verb produced no output"});return}try{let a=JSON.parse(t);n({ok:!0,payload:a})}catch{n({ok:!1,payload:null,reason:`verb output was not valid json: ${t.slice(0,120)}`})}})})}function y(s,r){let u=r.split(".").filter(e=>e.length>0),n=s;for(let e of u){if(n==null)return{found:!1};if(Array.isArray(n)){let t=Number(e);if(!Number.isInteger(t)||t<0||t>=n.length)return{found:!1};n=n[t];continue}if(typeof n=="object"){let t=n;if(!(e in t))return{found:!1};n=t[e];continue}return{found:!1}}return{found:!0,value:n}}function d(s){return Array.isArray(s)?s.length:s&&typeof s=="object"?Object.keys(s).length:null}async function A(s,r){let{kind:u,args:n}=s;switch(u){case"--exists":return r==null?{ok:!1,reason:"payload is null"}:d(r)===0?{ok:!1,reason:"payload is empty"}:{ok:!0,reason:"exists"};case"--empty":{if(r==null)return{ok:!0,reason:"payload is null"};let e=d(r);return e===0?{ok:!0,reason:"payload is empty"}:{ok:!1,reason:`payload has ${e} item(s)`}}case"--count":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:`payload not countable (${typeof r})`}:{ok:t===e,reason:`count=${t}, want=${e}`}}case"--count-at-least":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:"payload not countable"}:{ok:t>=e,reason:`count=${t}, want>=${e}`}}case"--count-at-most":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:"payload not countable"}:{ok:t<=e,reason:`count=${t}, want<=${e}`}}case"--contains":{let e=n[0],t=JSON.stringify(r);return{ok:t.includes(e),reason:t.includes(e)?`contains "${e}"`:`missing "${e}"`}}case"--not-contains":{let e=n[0],t=JSON.stringify(r);return{ok:!t.includes(e),reason:t.includes(e)?`unexpected "${e}"`:`not contains "${e}"`}}case"--matches":{let e=new RegExp(n[0]),t=JSON.stringify(r),i=e.test(t);return{ok:i,reason:i?`matches /${n[0]}/`:`no match for /${n[0]}/`}}case"--not-matches":{let e=new RegExp(n[0]),t=JSON.stringify(r),i=!e.test(t);return{ok:i,reason:i?`not matches /${n[0]}/`:`unexpected /${n[0]}/`}}case"--equals":{let e=n[0],t=typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(r):JSON.stringify(r);return{ok:t===e,reason:`got=${JSON.stringify(t)}, want=${JSON.stringify(e)}`}}case"--has-path":{let e=y(r,n[0]);return{ok:e.found,reason:e.found?`path ${n[0]} present`:`path ${n[0]} missing`}}case"--path-equals":{let[e,t]=n,i=y(r,e);if(!i.found)return{ok:!1,reason:`path ${e} missing`};let o=typeof i.value=="string"||typeof i.value=="number"||typeof i.value=="boolean"?String(i.value):JSON.stringify(i.value);return{ok:o===t,reason:`${e}=${o}, want=${t}`}}case"--jq":{let e=n[0];try{let i=(await O(e,r)).trim();return{ok:i.length>0&&i!=="null"&&i!=="false"&&i!=='""',reason:`jq: ${i.slice(0,120)}`}}catch(t){throw new Error(`jq evaluation failed: ${t.message}`)}}default:return{ok:!1,reason:`unknown predicate ${u}`}}}function O(s,r){return new Promise((u,n)=>{let e=x("jq",[s],{stdio:["pipe","pipe","pipe"]}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",n),e.on("close",o=>{if(o!==0){n(new Error(i.trim()||`jq exited ${o}`));return}u(t)}),e.stdin.end(JSON.stringify(r))})}async function T(s){(s[0]==="--help"||s[0]==="-h"||s.length===0)&&(J(),process.exit(s.length===0?2:0));let r=j(s);"error"in r&&(process.stderr.write(` assert: ${r.error}
|
|
4
4
|
`),process.exit(2));let{verbArgs:u,predicates:n,withinMs:e,negate:t,quiet:i,allowTimeout:o}=r;N(u)||(process.stderr.write(` assert: unknown or non-read verb: ${u.join(" ")}
|
|
5
5
|
supported: ${Array.from(w).sort().join(", ")}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as t}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as t}from"./chunk-SPBHQVJ4.js";import{d as s}from"./chunk-WRPO6J3Z.js";import"./chunk-TWUPMUWQ.js";import"./chunk-U4OPCVAL.js";function i(){console.log(`
|
|
3
3
|
sootsim auth \u2014 inspect CLI auth
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{m as d}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{m as d}from"./chunk-FF7GZMWQ.js";import"./chunk-3FYUTNM4.js";import{g as l,i as m,k as p}from"./chunk-6Q3M6FMW.js";import"./chunk-AB7XCG3A.js";import"./chunk-4O73AHYA.js";import"./chunk-TWUPMUWQ.js";import"./chunk-U4OPCVAL.js";function f(){console.log(`
|
|
3
3
|
sootsim do scan \u2014 inject a barcode scan
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as k}from"./chunk-
|
|
3
|
-
`),t=e[e.length-1].split(" ").pop()?.trim();if(!t||!w(t))throw new Error(`could not determine dmg mount point (output: ${o.stdout})`);let a=f(t,"sootsim.app");if(!w(a))throw u("hdiutil",["detach","-force",t]),new Error(`sootsim.app not found inside ${t}`);let i="/Applications",d=b(process.env.HOME||"","Applications"),c=i;try{let m=f(i,`.sootsim-write-probe-${process.pid}`);u("touch",[m]),w(m)?g(m,{force:!0}):c=d}catch{c=d}c===d&&y(c,{recursive:!0});let l=f(c,"sootsim.app");w(l)&&g(l,{recursive:!0,force:!0});let p=u("cp",["-R",a,l]),
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as k}from"./chunk-SHBXXKJW.js";import{a as x}from"./chunk-7LSM7YNF.js";import{spawn as v,spawnSync as u}from"child_process";import{chmodSync as S,copyFileSync as T,createWriteStream as E,existsSync as w,mkdirSync as y,rmSync as g,statSync as P,unlinkSync as D}from"fs";import{tmpdir as M}from"os";import{dirname as A,join as f,resolve as b}from"path";var h="https://contrast.dev/api/electron-release";function O(){let r=process.arch;if(process.platform==="darwin"){let o=r==="arm64"?"mac-arm64":"mac-x64",e=`sootsim-latest-${o}.dmg`;return{platform:o,filename:e,url:`${h}/${e}`,install:L}}if(process.platform==="linux"){let o=r==="arm64"?"linux-arm64":"linux-x64",e=`sootsim-latest-${o}.AppImage`;return{platform:o,filename:e,url:`${h}/${e}`,install:C}}if(process.platform==="win32"){let o="sootsim-latest-win-x64.exe";return{platform:"win-x64",filename:o,url:`${h}/${o}`,install:B}}return null}async function I({url:r,dest:o,onProgress:e}){let s=await fetch(r,{redirect:"follow"});if(!s.ok)throw new Error(`${s.status} ${s.statusText} (${r})`);let t=s.headers.get("content-length"),a=t?Number(t):null;if(!s.body)throw new Error(`empty response body (${r})`);y(A(o),{recursive:!0});let i=E(o),d=s.body.getReader(),c=0;try{for(;;){let{done:l,value:p}=await d.read();if(l)break;i.write(Buffer.from(p)),c+=p.byteLength,e?.(c,a)}}finally{await new Promise((l,p)=>{i.end(n=>n?p(n):l())})}}function _(r,o){let e=(r/1048576).toFixed(1);if(!o)return` ${e} MB`;let s=Math.min(100,Math.round(r/o*100)),t=(o/(1024*1024)).toFixed(1),a=24,i=Math.round(s/100*a);return` ${"\u2588".repeat(i)+"\u2591".repeat(a-i)} ${s}% ${e} / ${t} MB`}async function L(r){let o=u("hdiutil",["attach","-nobrowse","-readonly",r],{encoding:"utf8"});if(o.status!==0)throw new Error(`hdiutil attach failed: ${o.stderr||o.stdout}`.trim());let e=o.stdout.trim().split(`
|
|
3
|
+
`),t=e[e.length-1].split(" ").pop()?.trim();if(!t||!w(t))throw new Error(`could not determine dmg mount point (output: ${o.stdout})`);let a=f(t,"sootsim.app");if(!w(a))throw u("hdiutil",["detach","-force",t]),new Error(`sootsim.app not found inside ${t}`);let i="/Applications",d=b(process.env.HOME||"","Applications"),c=i;try{let m=f(i,`.sootsim-write-probe-${process.pid}`);u("touch",[m]),w(m)?g(m,{force:!0}):c=d}catch{c=d}c===d&&y(c,{recursive:!0});let l=f(c,"sootsim.app");w(l)&&g(l,{recursive:!0,force:!0});let p=u("cp",["-R",a,l]),n=u("hdiutil",["detach","-force",t]);if(p.status!==0)throw new Error(`copy to ${l} failed: ${p.stderr?.toString()||""}`.trim());return n.status!==0&&console.warn(` warning: failed to unmount ${t} (${n.stderr?.toString().trim()||"unknown error"})`),u("xattr",["-dr","com.apple.quarantine",l]),l}async function C(r){let o=b(process.env.HOME||"","Applications");y(o,{recursive:!0});let e=f(o,"sootsim.AppImage");return w(e)&&g(e,{force:!0}),T(r,e),D(r),S(e,493),e}async function B(r){return await new Promise((o,e)=>{let s=v("cmd",["/c","start",'""',"/wait",r],{stdio:"inherit"});s.once("error",e),s.once("exit",t=>{t===0?o():e(new Error(`installer exited with code ${t}`))})}),r}async function q(r){(r.includes("--help")||r.includes("-h"))&&(console.log(`
|
|
4
4
|
sootsim desktop install \u2014 download and install the optional desktop GUI
|
|
5
5
|
|
|
6
6
|
the CLI + daemon are the canonical sootsim surface; the GUI is optional.
|
|
@@ -17,7 +17,7 @@ options:
|
|
|
17
17
|
examples:
|
|
18
18
|
sootsim desktop install
|
|
19
19
|
sootsim desktop install --yes
|
|
20
|
-
`),process.exit(0));let o=
|
|
21
|
-
`);try{await I({url:t.url,dest:i,onProgress:(
|
|
20
|
+
`),process.exit(0));let o=r.includes("--yes")||r.includes("-y")||process.env.SOOTSIM_NO_PROMPT==="1"||process.env.CI==="1"||!process.stdin.isTTY,e=r.includes("--force"),s=k();if(s&&!e){console.log(` sootsim desktop already installed at: ${s.path}`),console.log(" pass --force to reinstall.");return}let t=O();if(t||(console.error(` no desktop build available for ${process.platform}/${process.arch}.`),console.error(" supported: darwin-arm64, darwin-x64, linux-x64, linux-arm64, win32-x64"),process.exit(1)),console.log(` platform: ${t.platform}`),console.log(` download: ${t.url}`),console.log(),!o){if(!await x("download and install now?",!0)){console.log(" cancelled.");return}console.log()}let a=f(M(),`sootsim-install-${Date.now()}`),i=f(a,t.filename),d=0;process.stdout.write(` downloading ${t.filename}...
|
|
21
|
+
`);try{await I({url:t.url,dest:i,onProgress:(n,m)=>{let $=Date.now();$-d<100&&n<(m??1/0)||(d=$,process.stdout.isTTY&&process.stdout.write(`\r\x1B[2K${_(n,m)}`))}})}catch(n){g(a,{recursive:!0,force:!0});let m=n instanceof Error?n.message:String(n);console.error(`
|
|
22
22
|
download failed: ${m}`),console.error(` the ${t.platform} desktop build may not be published yet, or your`),console.error(" network blocked the request. check your connection and try again later;"),console.error(" the CLI + daemon work without the desktop app (run: sootsim --help)."),process.exit(1)}process.stdout.isTTY&&process.stdout.write(`
|
|
23
|
-
`);let c=P(i).size;console.log(` downloaded ${(c/(1024*1024)).toFixed(1)} MB`),console.log(),console.log(" installing...");let{trackCliEvent:l,flushCliTelemetry:p}=await import("./telemetry-
|
|
23
|
+
`);let c=P(i).size;console.log(` downloaded ${(c/(1024*1024)).toFixed(1)} MB`),console.log(),console.log(" installing...");let{trackCliEvent:l,flushCliTelemetry:p}=await import("./telemetry-CWRFOESH.js");try{let n=await t.install(i);l({event:"cli_install_desktop_succeeded",properties:{platform:t.platform,size_bytes:c}}),console.log(` installed: ${n}`)}catch(n){l({event:"cli_install_desktop_failed",properties:{platform:t.platform,error:n instanceof Error?n.message:String(n)}}),await p(),console.error(` install failed: ${n instanceof Error?n.message:String(n)}`),console.error(` keeping download at ${i} for manual install.`),process.exit(1)}finally{g(a,{recursive:!0,force:!0})}console.log(),console.log(" next steps:"),console.log(" sootsim desktop launch the desktop app"),console.log(" sootsim open <target> open a demo or bundle in it")}export{q as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
var o=!0,e="public beta",t=e,n="we send anonymous error and dependency data while you use it";export{o as a,e as b,t as c,n as d};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
function
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
function H(t,e){let r=["--max-ms","--maxMs","--maxms","--max_ms"];for(let n of r){let s=t.indexOf(n);if(s>=0&&t[s+1]){let o=Number(t[s+1]);if(Number.isFinite(o))return Math.max(100,o)}}return e}var S=new Set(["tap","double-tap","tap-text","tap-id","long-press","touch"]);function v(t){return typeof t=="string"&&S.has(t)}async function T(t){return await t.send({type:"evaluate",code:"window.__sootsimEngineState?.inspectActive === true"})===!0}async function W(t,e){if(!v(e))return!1;try{return await T(t)}catch{return!1}}async function B(t){let e=await t.send({type:"evaluate",code:"(async () => await window.__sootsimTest.getNodeCount())()"});return{nodes:typeof e=="number"?e:0}}async function F(t,e=5,r){let n=r?.format?`, ${JSON.stringify(r)}`:"",s=await t.send({type:"evaluate",code:`(async () => await window.__sootsimTest.dumpTree(${e}${n}))()`});if(r?.format==="boxes"&&typeof s=="string")try{return{depth:e,tree:JSON.parse(s)}}catch{return{depth:e,tree:s}}return{depth:e,tree:s}}async function j(t){let e=await t.send({type:"evaluate",code:"window.location.href"});return{url:typeof e=="string"?e:""}}async function z(t,e){let r=`(async () => {
|
|
3
3
|
const t = window.__sootsimTest
|
|
4
4
|
const mainShell = window.SootSim?.bridges?.mainShell
|
|
5
5
|
const kb = window.__sootsimKeyboard
|
|
@@ -76,7 +76,7 @@ function C(t,e){let r=["--max-ms","--maxMs","--maxms","--max_ms"];for(let n of r
|
|
|
76
76
|
const nodeCount = (await t.getNodeCount?.()) || 0
|
|
77
77
|
const keyboard = kb && typeof kb.getLayout === 'function' ? kb.getLayout() : null
|
|
78
78
|
return { tree, shell, nodeCount, keyboard }
|
|
79
|
-
})()`;return await t.send({type:"evaluate",code:r})??{}}function
|
|
79
|
+
})()`;return await t.send({type:"evaluate",code:r})??{}}function f(t={}){let e=t.styling===!0;return`(async () => {
|
|
80
80
|
const t = window.__sootsimTest
|
|
81
81
|
if (!t || typeof t.listInspectable !== 'function') return []
|
|
82
82
|
const list = await t.listInspectable({})
|
|
@@ -184,8 +184,8 @@ function C(t,e){let r=["--max-ms","--maxMs","--maxms","--max_ms"];for(let n of r
|
|
|
184
184
|
borderWidth: borderWOf(style),
|
|
185
185
|
}
|
|
186
186
|
})
|
|
187
|
-
})()`}var
|
|
188
|
-
`)}var
|
|
187
|
+
})()`}var J=f();async function K(t,e={}){let r=await t.send({type:"evaluate",code:f(e)});return Array.isArray(r)?r:[]}function V(t,e){return t.length===0?" no visible elements found":t.map(n=>{let o=[n.testID?`#${n.testID}`:n.selector?n.selector:n.role?`[${n.role}]`:`<${n.type}>`,`@(${n.box.x},${n.box.y})`,`${n.box.w}x${n.box.h}`];n.borderRadius>0&&o.push(`radius:${n.borderRadius}`);let i=n.padding;if(i.t||i.r||i.b||i.l){let l=i.t===i.r&&i.r===i.b&&i.b===i.l;o.push(l?`pad:${i.t}`:`pad:${i.t},${i.r},${i.b},${i.l}`)}if(n.fontSize>0&&o.push(`font:${n.fontSize}`),e?.styling&&(n.fontWeight&&o.push(`weight:${n.fontWeight}`),n.color&&o.push(`color:${n.color}`),n.bg&&o.push(`bg:${n.bg}`),n.opacity!=null&&o.push(`opacity:${n.opacity}`),n.textDecoration&&o.push(`deco:${n.textDecoration}`),n.overflow&&o.push(`overflow:${n.overflow}`),n.borderWidth&&o.push(`border:${n.borderWidth}`)),n.text){let l=n.text.length>40?`${n.text.slice(0,39)}\u2026`:n.text;o.push(`"${l}"`)}return` ${o.join(" ")}`}).join(`
|
|
188
|
+
`)}var I=`(async () => {
|
|
189
189
|
const t = window.__sootsimTest
|
|
190
190
|
if (!t) return []
|
|
191
191
|
|
|
@@ -258,7 +258,7 @@ function C(t,e){let r=["--max-ms","--maxMs","--maxms","--max_ms"];for(let n of r
|
|
|
258
258
|
return all
|
|
259
259
|
.filter(n => isVisibleTarget(n) && hasAccessibleSignal(n))
|
|
260
260
|
.map(normalize)
|
|
261
|
-
})()`;async function
|
|
261
|
+
})()`;async function G(t){let e=await t.send({type:"evaluate",code:I});return Array.isArray(e)?e:[]}var g=`
|
|
262
262
|
const fromInspectable = async () => {
|
|
263
263
|
if (typeof t.listInspectable !== 'function') return null
|
|
264
264
|
const list = await t.listInspectable({})
|
|
@@ -330,7 +330,7 @@ function C(t,e){let r=["--max-ms","--maxMs","--maxms","--max_ms"];for(let n of r
|
|
|
330
330
|
abs.y < screenH
|
|
331
331
|
)
|
|
332
332
|
}
|
|
333
|
-
`;function
|
|
333
|
+
`;function E(t){return t.testId?{mode:"testid",code:`(async () => {
|
|
334
334
|
const t = window.__sootsimTest
|
|
335
335
|
if (!t) return null
|
|
336
336
|
return (await t.findByTestId(${JSON.stringify(t.testId)})) || (await t.findById(${JSON.stringify(t.testId)}))
|
|
@@ -345,7 +345,7 @@ function C(t,e){let r=["--max-ms","--maxMs","--maxms","--max_ms"];for(let n of r
|
|
|
345
345
|
})()`}:t.pressable?{mode:"pressable",code:`(async () => {
|
|
346
346
|
const t = window.__sootsimTest
|
|
347
347
|
if (!t) return []
|
|
348
|
-
${
|
|
348
|
+
${g}
|
|
349
349
|
const inspectable = await fromInspectable()
|
|
350
350
|
if (inspectable) return inspectable.filter(n => n.pressable && isVisibleTarget(n))
|
|
351
351
|
const all = await t.queryAll({ pruneHidden: true })
|
|
@@ -353,7 +353,7 @@ ${p}
|
|
|
353
353
|
})()`}:t.interactive?{mode:"interactive-targets",code:`(async () => {
|
|
354
354
|
const t = window.__sootsimTest
|
|
355
355
|
if (!t) return []
|
|
356
|
-
${
|
|
356
|
+
${g}
|
|
357
357
|
const inspectable = await fromInspectable()
|
|
358
358
|
if (inspectable) {
|
|
359
359
|
return inspectable.filter(n => n.pressable && isVisibleTarget(n))
|
|
@@ -369,7 +369,7 @@ ${p}
|
|
|
369
369
|
const t = window.__sootsimTest
|
|
370
370
|
if (!t) return null
|
|
371
371
|
return await t.findByText(${JSON.stringify(t.text)})
|
|
372
|
-
})()`}:null}async function
|
|
372
|
+
})()`}:null}async function U(t,e){let r=E(e);if(!r)return null;let n=await t.send({type:"evaluate",code:r.code});return{mode:r.mode,result:n}}function Q(t){return[...t].sort((e,r)=>b(r)-b(e))}function b(t){let e=0;t.testID&&(e+=100),typeof t.text=="string"&&t.text.trim().length>0&&(e+=60),typeof t.accessibilityLabel=="string"&&t.accessibilityLabel.trim().length>0&&(e+=30),t.accessibilityRole&&(e+=15);let r=t.layout?.width??0,n=t.layout?.height??0,s=r*n;return s>=400&&s<=6e4?e+=25:s>6e4&&(e-=20),(t.absolutePosition?.y??0)<0&&(e-=30),e}function Y(t){if(t.testID)return`sootsim do tap-id ${m(t.testID)}`;let e=typeof t.text=="string"?t.text.trim():"";if(e.length>0&&e.length<=80)return`sootsim do tap-text ${m(e)}`;let r=Math.round(((t.absolutePosition?.x??0)+(t.layout?.width??0)/2)*10)/10,n=Math.round(((t.absolutePosition?.y??0)+(t.layout?.height??0)/2)*10)/10;return`sootsim do tap ${r} ${n}`}function m(t){return/^[A-Za-z0-9_./@:-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`}var k=`(async () => {
|
|
373
373
|
const t = window.__sootsimTest
|
|
374
374
|
let nodes = 0
|
|
375
375
|
try { nodes = (await t?.getNodeCount?.()) || 0 } catch {}
|
|
@@ -488,7 +488,7 @@ ${p}
|
|
|
488
488
|
externalError,
|
|
489
489
|
suppressedEntryError,
|
|
490
490
|
}
|
|
491
|
-
})()`,
|
|
491
|
+
})()`,R=100,$=750,_=2e3;function N(t){return t.targets>0||t.nodes>=R}function A(t){return t.targets>0}function q(t){if(t.bridgeError)return`sim unreachable: ${t.bridgeError} \u2014 the target tab is closed or no sim is connected (check \`sootsim list\`, reopen with \`sootsim open\`)`;let e=t.externalError?`guest app errored: ${t.externalError}`:t.loadingText?`still showing "${t.loadingText}"`:t.externalReady===!1?"guest app is still loading":t.flag!==!0&&t.targets>0?"native content is rendered but the ready signal has not settled":t.flag!==!0?"guest app has not emitted sootsim:externalAppReady":t.targets<=0?"ready flag emitted but no visible app content is inspectable yet":"node tree is still changing";return!t.externalError&&t.suppressedEntryError?`${e} (suppressed entry error: ${t.suppressedEntryError})`:e}async function X(t,e=2e4,r={}){let n=Date.now(),s=n+e,o=r.progressIntervalMs??_,i=n+o,l=-1,u=n,p="",a={flag:void 0,at:0,nodes:0,targets:0,errors:0,loadingText:"",externalReady:null,externalStatus:"",externalError:"",suppressedEntryError:""};for(;Date.now()<s;){try{a=await t.send({type:"evaluate",code:k})??a,p=""}catch(d){p=d instanceof Error?d.message:String(d)}let c=Date.now(),y={ready:!1,elapsedMs:c-n,nodes:a.nodes,targets:a.targets,flag:a.flag,loadingText:a.loadingText,externalReady:a.externalReady,externalStatus:a.externalStatus,externalError:a.externalError,suppressedEntryError:a.suppressedEntryError,errors:a.errors,bridgeError:p};a.nodes!==l&&(l=a.nodes,u=c);let x=a.flag===!0&&N(a),w=a.flag!==!0&&A(a);if((x||w)&&a.externalReady!==!1&&!a.externalError&&!a.loadingText&&c-u>=$)return{...y,ready:!0};if(r.onProgress&&o>0&&c>=i){r.onProgress(y);do i+=o;while(c>=i)}await new Promise(d=>setTimeout(d,150))}return{ready:!1,elapsedMs:Date.now()-n,nodes:a.nodes,targets:a.targets,flag:a.flag,loadingText:a.loadingText,externalReady:a.externalReady,externalStatus:a.externalStatus,externalError:a.externalError,suppressedEntryError:a.suppressedEntryError,errors:a.errors,bridgeError:p}}async function Z(t,e,r=5e3,n={}){let s=n.gone===!0;return await t.send({type:"evaluate",code:`(async () => {
|
|
492
492
|
const start = Date.now()
|
|
493
493
|
const deadline = start + ${r}
|
|
494
494
|
const gone = ${s}
|
|
@@ -531,7 +531,7 @@ ${p}
|
|
|
531
531
|
await new Promise((r) => setTimeout(r, 80))
|
|
532
532
|
}
|
|
533
533
|
return { found: false, elapsed: Date.now() - start }
|
|
534
|
-
})()`},{timeoutMs:r+1e3})??{found:!1,elapsed:r}}function
|
|
534
|
+
})()`},{timeoutMs:r+1e3})??{found:!1,elapsed:r}}function h(t,e){return`(() => {
|
|
535
535
|
const out = []
|
|
536
536
|
const seen = new Set()
|
|
537
537
|
const norm = (s) => (typeof s === 'string' ? s : (() => { try { return JSON.stringify(s) } catch { return String(s) } })())
|
|
@@ -553,7 +553,7 @@ ${p}
|
|
|
553
553
|
for (const e of snap) if (e && e.level === ${JSON.stringify(t)}) push(e)
|
|
554
554
|
} catch {}
|
|
555
555
|
return out.sort((a, b) => (a.timestamp || 0) - (b.timestamp || 0)).slice(-${e})
|
|
556
|
-
})()`}async function
|
|
556
|
+
})()`}async function ee(t,e=20){let r=await t.send({type:"evaluate",code:h("error",e)});return Array.isArray(r)?r:[]}async function te(t,e=20){let r=await t.send({type:"evaluate",code:h("warn",e)});return Array.isArray(r)?r:[]}var ne=`(() => {
|
|
557
557
|
const norm = (s) => (typeof s === 'string' ? s : (() => { try { return JSON.stringify(s) } catch { return String(s) } })())
|
|
558
558
|
const key = (lvl, ts, args) => lvl + '|' + Math.round((ts || 0) / 250) + '|' + (Array.isArray(args) ? args.map(norm).join(' ') : norm(args))
|
|
559
559
|
const seen = new Set()
|
|
@@ -578,17 +578,17 @@ ${p}
|
|
|
578
578
|
for (const e of snap) if (e) add(e.level, e.ts, e.args)
|
|
579
579
|
} catch {}
|
|
580
580
|
return { errors, warnings, total: errors + warnings }
|
|
581
|
-
})()`;async function
|
|
581
|
+
})()`;async function re(t){await t.send({type:"evaluate",code:'window.__sootsimConsole?.clear(); window.__sootsimObservability?.logs?.clear?.(); "cleared"'})}async function se(t,e={}){let r=e.limit??20,n=e.failed===!1?"getRequests":"getFailedRequests",s=await t.send({type:"call",path:`__sootsimTest.${n}`,args:[r]});return Array.isArray(s)?s:[]}async function oe(t){await t.send({type:"call",path:"__sootsimTest.clearRequests",args:[]})}async function ae(t){let e=await t.send({type:"evaluate",code:`(() => {
|
|
582
582
|
const obs = window.__sootsimObservability;
|
|
583
583
|
if (!obs) return { ok: false };
|
|
584
584
|
return { ok: true, entries: obs.logs.getSnapshot() };
|
|
585
|
-
})()`});return!e||!e.ok?[]:e.entries??[]}async function
|
|
585
|
+
})()`});return!e||!e.ok?[]:e.entries??[]}async function ie(t){await t.send({type:"evaluate",code:'window.__sootsimObservability?.logs.clear(); "cleared"'})}function L(t,e){if(t.source===e.source||t.level!==e.level||Math.abs(t.ts-e.ts)>1e3||t.args.length!==e.args.length)return!1;let r=new Set([t.source,e.source]);return!r.has("sootsim-worker")||!r.has("render-worker")&&!r.has("forwarded-render-worker")?!1:t.args.every((n,s)=>n===e.args[s])}function le(t,e={}){let r=[];for(let n of t)r.some(s=>L(s,n))||r.push(n);if(e.showInternal||(r=r.filter(n=>{let s=n.args[0];return!(typeof s=="string"&&s.startsWith("[sootsim]"))})),e.level&&(r=r.filter(n=>e.level.has(n.level))),e.filter){let n=e.filter.toLowerCase();r=r.filter(s=>s.args.join(" ").toLowerCase().includes(n))}return r}async function ue(t,e){return await t.send({type:"call",path:"SootSim.bridges.timeline.summary",args:[e]})}async function P(t,e){return await t.send({type:"call",path:"SootSim.bridges.timeline.recent",args:[e]})}async function ce(t){let e;try{e=(await P(t,{kinds:["alert","actionsheet"],limit:80})).events}catch{return[]}let r=new Map;for(let o of e)r.set(o.kind,o);let n=[],s=(o,i)=>{let l=r.get(o);if(!l||!l.data||typeof l.data!="object")return;let u=l.data;u.phase==="show"&&n.push({label:i,title:typeof u.title=="string"?u.title:null})};return s("alert","Alert"),s("actionsheet","ActionSheet"),n}async function de(t,e,r){await t.send({type:"call",path:"SootSim.bridges.timeline.cursorAdvance",args:[e,r]})}async function pe(t){return await t.send({type:"evaluate",code:`(() => {
|
|
586
586
|
const kb = window.__sootsimKeyboard
|
|
587
587
|
if (!kb || typeof kb.getLayout !== 'function') {
|
|
588
588
|
return { error: 'keyboard bridge getLayout() not available' }
|
|
589
589
|
}
|
|
590
590
|
return kb.getLayout()
|
|
591
|
-
})()`})??{error:"keyboard bridge returned no result"}}function
|
|
591
|
+
})()`})??{error:"keyboard bridge returned no result"}}function D(t){let e=t instanceof Error?t.message:String(t);return e.includes("call target not found: SootSim.bridges.mainShell")||e.includes("test bridge unavailable before app-in-worker boot")}async function M(t,e=0){let r=Date.now()+Math.max(0,e);for(;;)try{return await t.send({type:"call",path:"SootSim.bridges.mainShell.getState",args:[]})}catch(n){if(!D(n)||Date.now()>=r)throw n;await new Promise(s=>setTimeout(s,50))}}async function ye(t){let e=await t.send({type:"evaluate",code:`(async () => {
|
|
592
592
|
const test = window.__sootsimTest
|
|
593
593
|
const kb = window.__sootsimKeyboard
|
|
594
594
|
const navSnap =
|
|
@@ -612,7 +612,7 @@ ${p}
|
|
|
612
612
|
})()
|
|
613
613
|
: null
|
|
614
614
|
return { nav: navSnap, keyboard }
|
|
615
|
-
})()`});return{shell:await
|
|
615
|
+
})()`});return{shell:await M(t,500).catch(()=>null),nav:e?.nav??null,keyboard:e?.keyboard??null}}async function ge(t){return t.send({type:"evaluate",code:"window.__sootsimDebug.status()"})}async function be(t){return t.send({type:"evaluate",code:"window.__sootsimDebug.flags()"})}async function me(t,e){return t.send({type:"evaluate",code:`window.__sootsimTest.debugFind(${JSON.stringify(e)})`})}async function fe(t,e,r=50){let n=e&&e!=="all"?`window.__sootsimDebug.recent(${JSON.stringify(e)}, ${r})`:`window.__sootsimDebug.recent(undefined, ${r})`;return t.send({type:"evaluate",code:n})}async function he(t,e,r){let n=r.length>0?r.map(s=>JSON.stringify(s)).join(", "):e==="disable"?"'all'":"";return t.send({type:"evaluate",code:`window.__sootsimDebug.${e}(${n})`})}async function xe(t){return await t.send({type:"evaluate",code:`(async () => {
|
|
616
616
|
const host = window.__sootsimRenderHost
|
|
617
617
|
const stats = host?.queryStats ? await host.queryStats() : null
|
|
618
618
|
const shellRaw = window.__sootsimShellMemory
|
|
@@ -643,4 +643,4 @@ ${p}
|
|
|
643
643
|
shell: normalize(shell),
|
|
644
644
|
hostHeap: hostMem,
|
|
645
645
|
}
|
|
646
|
-
})()`})??{tenant:null,shell:null,hostHeap:null}}function
|
|
646
|
+
})()`})??{tenant:null,shell:null,hostHeap:null}}function we(t){if(t.total===0)return"nothing recorded";let e=[],r=["error","warning","console","fetch","toast","alert","actionsheet","picker","notification","screen","route","keyboard","app-launch","shell","scroll","gesture","text-input","react-commit","animation","reanimated"],n=new Set;for(let s of r){let o=t.byKind[s];o&&(e.push(`${o} ${s}${o===1?"":"s"}`),n.add(s))}for(let[s,o]of Object.entries(t.byKind))!n.has(s)&&o&&e.push(`${o} ${s}${o===1?"":"s"}`);return e.join(" \xB7 ")}var Se=new Set(["react-commit","layout","scroll"]);function O(t,e){if(e===null)return new Date(t).toLocaleTimeString();let r=(t-e)/1e3;return`${r>=0?"+":""}${r.toFixed(2)}s`}function C(t,e){switch(t){case"app-launch":return e.phase==="launch"?`launch ${e.appName??e.toAppId??""}`:`dismiss ${e.appName??e.fromAppId??""} \u2192 ${e.toAppId??""}`;case"toast":return`"${e.text??""}"${e.durationMs?` (${e.durationMs}ms)`:""}`;case"keyboard":return`${e.phase??"?"}${e.heightPx?` h=${e.heightPx}`:""}${e.mode?` ${e.mode}`:""}`;case"screen":return`${e.phase??"?"} ${e.name??e.activeName??""}`;case"flow-step":return`${e.status??"?"} ${e.stepName??"step"}${e.durationMs?` ${e.durationMs}ms`:""}`;case"route":return`${e.phase??"?"} ${e.path??e.pathname??""}`;case"alert":case"actionsheet":case"picker":return`${e.phase??"?"} ${e.title??e.message??""}`;case"notification":return`${e.title??""}${e.body?` \u2014 ${e.body}`:""}`;case"fetch":return`${e.method??"GET"} ${e.url??""}${e.status?` -> ${e.status}`:""}`;case"console":case"console-log":return`${e.level??"log"}: ${(e.message??"").toString().slice(0,120)}`;case"shell":return`${e.event??e.type??e.phase??""}`;case"scroll":return`${e.phase??"?"} ${e.target??""}`;case"gesture":return`${e.phase??"?"} ${e.type??""}`;case"text-input":return`${e.phase??"?"}${e.value!==void 0?` "${String(e.value).slice(0,40)}"`:""}`;case"layout":return`${e.kind??"?"} ${e.testID??e.type??""}${e.skipped?` skipped:${e.reason??"unknown"}`:""}`;case"react-commit":{let r=e.slowest;return`${e.fiberCount??"?"} fibers ${e.durationMs??"?"}ms${r?.displayName?` \xB7 ${r.displayName} ${r.durationMs??"?"}ms`:""}`}case"frame":return`${e.totalMs??"?"}ms${e.renderMs?` \xB7 render ${e.renderMs}ms`:""}${e.layoutMs?` \xB7 layout ${e.layoutMs}ms`:""}${e.copyMs?` \xB7 copy ${e.copyMs}ms`:""}`;case"reanimated":case"animation":return`${e.kind??""} ${e.target??""}${e.durationMs?` ${e.durationMs}ms`:""}`}return""}function ve(t,e){let r=O(t.t,e).padStart(8),n=t.context.padEnd(6),s=`[${t.kind}]`.padEnd(15),o=t.data,i=o&&typeof o=="object"?C(t.kind,o):"";return` ${r} ${n} ${s} ${i}`}export{H as a,W as b,B as c,F as d,j as e,z as f,K as g,V as h,G as i,U as j,Q as k,Y as l,k as m,$ as n,N as o,A as p,q,X as r,Z as s,ee as t,te as u,ne as v,re as w,se as x,oe as y,ae as z,ie as A,le as B,ue as C,P as D,ce as E,de as F,pe as G,D as H,M as I,ye as J,ge as K,be as L,me as M,fe as N,he as O,xe as P,we as Q,Se as R,ve as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as R}from"./chunk-RNWJQ4UR.js";import{o as D}from"./chunk-NU755HCE.js";import{a as T}from"./chunk-F5HOYUD2.js";function Y(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.type=="string"&&typeof t.ts=="number"}function I(e){let t=e.trim();if(!t)return null;try{let r=JSON.parse(t);return Y(r)?r:null}catch{return null}}import{randomBytes as G,createHash as q}from"node:crypto";import m from"node:fs";import h from"node:path";var N=null;function _(){if(N)return N;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||D()}function y(){return _()}function U(){return h.join(_(),"attached-projects.json")}function $(){return{version:1,attachedProjects:[],previewAttachments:[],agentSessions:[]}}function S(){let e=U(),t;try{t=m.readFileSync(e,"utf8")}catch(r){if(r.code==="ENOENT")return $();throw r}try{let r=JSON.parse(t);if(!r||typeof r!="object")throw new Error("not an object");return{version:1,attachedProjects:Array.isArray(r.attachedProjects)?r.attachedProjects:[],previewAttachments:Array.isArray(r.previewAttachments)?r.previewAttachments:[],agentSessions:Array.isArray(r.agentSessions)?r.agentSessions:[]}}catch(r){let n=`${e}.corrupt-${Date.now()}`;try{m.renameSync(e,n),console.warn(`[sootsim] attached-projects.json was unparseable; quarantined to ${n}. original error: ${r.message}`)}catch{}return $()}}function X(e){let t=U();m.mkdirSync(h.dirname(t),{recursive:!0});let r=`${t}.tmp-${process.pid}-${Date.now()}`,n=m.openSync(r,"w",384);try{m.writeFileSync(n,JSON.stringify(e,null,2)),m.fsyncSync(n)}finally{m.closeSync(n)}m.renameSync(r,t)}function w(e){let t=S();return e(t),X(t),t}function B(e){return q("sha256").update(h.resolve(e)).digest("hex").slice(0,16)}function K(){return`s_${G(10).toString("hex")}`}function ge(e){let t=h.resolve(e.cwd),r=B(t),n;return w(o=>{let s=o.attachedProjects.find(c=>c.id===r);if(s){let c={...s,...e,id:r,cwd:t,sourceRoots:e.sourceRoots??s.sourceRoots,knownBundleUrls:e.knownBundleUrls??s.knownBundleUrls,pinnedSourceResolutions:e.pinnedSourceResolutions??s.pinnedSourceResolutions,telemetry:e.telemetry??s.telemetry,updatedAt:Date.now(),createdAt:s.createdAt},g=o.attachedProjects.indexOf(s);o.attachedProjects[g]=c,n=c;return}let a=Date.now(),d={id:r,name:e.name??h.basename(t),cwd:t,repoRoot:e.repoRoot,sourceRoots:e.sourceRoots??[t],framework:e.framework??"unknown",bundleId:e.bundleId,knownBundleUrls:e.knownBundleUrls??[],preferredProvider:e.preferredProvider??"codex",preferredTransport:e.preferredTransport??"tmux",editorOpenCommand:e.editorOpenCommand,moshiWebhookToken:e.moshiWebhookToken,pinnedSourceResolutions:e.pinnedSourceResolutions??{},isolateDiscovery:e.isolateDiscovery,git:e.git,telemetry:e.telemetry??{lastOpened:0,runsCompleted:0},createdAt:a,updatedAt:a};o.attachedProjects.push(d),n=d}),n}function F(e){return S().attachedProjects.find(t=>t.id===e)??null}function he(){return S().attachedProjects}var Q=336*60*60*1e3;function ye(e,t={}){w(r=>{let n=r.attachedProjects.find(s=>s.id===e);if(!n)return;let o=t.ts??Date.now();if(n.telemetry.runsCompleted=(n.telemetry.runsCompleted??0)+1,typeof t.usd=="number"&&Number.isFinite(t.usd)&&t.usd>=0){let s=n.telemetry.costHistory??[],a=o-Q,d=s.filter(c=>c.ts>=a);d.push({ts:o,usd:t.usd}),n.telemetry.costHistory=d}n.updatedAt=o})}function Se(e,t=Date.now()){let r=t-6048e5,n=e.telemetry.costHistory??[],o=0;for(let s of n)s.ts>=r&&(o+=s.usd);return o}function we(e){w(t=>{t.attachedProjects=t.attachedProjects.filter(r=>r.id!==e),t.agentSessions=t.agentSessions.filter(r=>r.projectId!==e),t.previewAttachments=t.previewAttachments.filter(r=>r.projectId!==e)})}function M(e){let t;return w(r=>{if(e.id){let a=r.agentSessions.find(d=>d.id===e.id);if(a){let d={...a,...e,lastSeenAt:Date.now()},c=r.agentSessions.indexOf(a);r.agentSessions[c]=d,t=d;return}}let n=r.attachedProjects.find(a=>a.id===e.projectId);if(!n)throw new Error(`upsertSession: no AttachedProject with id=${e.projectId}`);let o=Date.now(),s={id:e.id??K(),projectId:e.projectId,provider:e.provider,transport:e.transport??n.preferredTransport,cwd:e.cwd??n.cwd,claudeSessionUuid:e.claudeSessionUuid,tmuxSessionName:e.tmuxSessionName,wrapperPid:e.wrapperPid,status:e.status??"idle",needsAttention:e.needsAttention??!1,lastPrompt:e.lastPrompt,lastSummary:e.lastSummary,lastTurnFiles:e.lastTurnFiles,currentlyEditing:e.currentlyEditing,lastSeenAt:o,createdAt:o};r.agentSessions.push(s),t=s}),t}function k(e){return S().agentSessions.find(t=>t.id===e)??null}function C(e){let t=S().agentSessions;return e?t.filter(r=>r.projectId===e):t}function v(e,t){w(r=>{let n=r.agentSessions.find(s=>s.id===e);if(!n)return;let o=r.agentSessions.indexOf(n);r.agentSessions[o]={...n,...t,id:n.id,projectId:n.projectId,createdAt:n.createdAt,lastSeenAt:Date.now()}})}async function ve(){if(S().attachedProjects.length>0)return;let{loadOptionalDemoApps:t}=await import("./optional-demo-registry-YGNESGBH.js"),r=await t();r.length!==0&&w(n=>{for(let o of r){if(!m.existsSync(o.dir))continue;let s=h.resolve(o.dir),a=B(s);if(n.attachedProjects.some(c=>c.id===a))continue;let d=Date.now();n.attachedProjects.push({id:a,name:o.label,cwd:s,sourceRoots:[s],framework:o.framework,knownBundleUrls:[`http://localhost:${o.preferredPort}/index.bundle`],preferredProvider:"codex",preferredTransport:"tmux",pinnedSourceResolutions:{},telemetry:{lastOpened:0,runsCompleted:0},createdAt:d,updatedAt:d})}})}import{spawn as V,spawnSync as z}from"node:child_process";import{randomUUID as Z}from"node:crypto";import i,{constants as f}from"node:fs";import u from"node:path";import ee from"node:readline";function j(e){return u.join(y(),"sessions",e)}function W(e){return u.join(j(e),"prompt.in")}function J(e){return u.join(j(e),"events.out")}function te(e){return u.join(y(),"transcripts",`${e}.log`)}function O(e,t){if(!e)return!1;try{process.kill(e,0)}catch{return!1}return!(t&&!i.existsSync(j(t)))}function re(){if(process.env.SOOTSIM_BIN)return{cmd:process.env.SOOTSIM_BIN,prefixArgs:[]};if(process.versions.electron){let n=process.resourcesPath;if(n){let o=[u.join(n,"bin","sootsim"),u.join(n,"bin",`sootsim-${process.platform}-${process.arch}`)];for(let s of o)if(i.existsSync(s))return{cmd:s,prefixArgs:[]}}}let e=ne();if(e)return e;let t=process.argv[0],r=process.argv[1];if(r&&/\.(ts|tsx|mjs|cjs|js)$/.test(r))return{cmd:t,prefixArgs:[r]};if(!r||r.includes("/.bin/"))throw new Error("sootsim CLI not found. set SOOTSIM_BIN to the path of the sootsim binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`.");return{cmd:t,prefixArgs:[]}}function ne(){try{let e=se();if(!e)return null;let t=`sootsim-${process.platform}-${process.arch}`,r=u.join(e,"dist-bin",t);if(i.existsSync(r))return{cmd:r,prefixArgs:[]};let n=u.join(e,"dist-cli","bin.js");if(i.existsSync(n)){try{let o=u.join(e,"cli","commands","agent-wrapper.ts");if(i.existsSync(o)){let s=i.statSync(o).mtimeMs;i.statSync(n).mtimeMs<s&&console.warn("[sootsim] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with `bun run --cwd packages/sootsim build:cli` (watch:cli:binary builds dist-bin/ instead).")}}catch{}return{cmd:process.execPath,prefixArgs:[n]}}return null}catch{return null}}function se(){try{let r=T.resolve("sootsim/package.json");return u.dirname(r)}catch{}let e=oe();if(!e)return null;let t=u.dirname(e);for(let r=0;r<8;r++){let n=u.join(t,"package.json");try{if(i.existsSync(n)&&JSON.parse(i.readFileSync(n,"utf8")).name==="sootsim")return t}catch{}let o=u.dirname(t);if(o===t)break;t=o}return null}function oe(){try{let e=import.meta.url;return!e||!e.startsWith("file://")?null:decodeURIComponent(e.slice(7))}catch{return null}}async function ie(e,t,r){let n=u.join(y(),"locks");i.mkdirSync(n,{recursive:!0});try{i.chmodSync(n,448)}catch{}let o=u.join(n,`start-${e}-${t}.lock`),s=Date.now()+4e3,a=null;for(;a===null;)try{a=i.openSync(o,f.O_WRONLY|f.O_CREAT|f.O_EXCL,384)}catch(d){if(d.code!=="EEXIST")throw d;try{let c=Number(i.readFileSync(o,"utf8").trim());if(c&&!ce(c)){i.unlinkSync(o);continue}}catch{}if(Date.now()>s)throw new Error(`another start is in progress for project=${e} provider=${t} (lock: ${o})`);await new Promise(c=>setTimeout(c,50))}try{return i.writeFileSync(a,String(process.pid)),await r()}finally{try{i.closeSync(a)}catch{}try{i.unlinkSync(o)}catch{}}}function ce(e){try{return process.kill(e,0),!0}catch{return!1}}function L(e){let t=u.dirname(e);i.mkdirSync(t,{recursive:!0});try{i.chmodSync(t,448)}catch{}if(i.existsSync(e))try{if(i.statSync(e).isFIFO()){try{i.chmodSync(e,384)}catch{}return}i.unlinkSync(e)}catch{i.unlinkSync(e)}let r=z("mkfifo",["-m","600",e]);if(r.status!==0)throw new Error(`mkfifo(${e}) failed: ${r.stderr?.toString().trim()||"unknown error"}`)}var l=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function Te(e){let t=F(e.projectId);if(!t)throw new l("NO_PROJECT",`no project with id=${e.projectId}`);let r=e.provider||t.preferredProvider||"codex";return ie(t.id,r,async()=>{let n=C(t.id).find(p=>p.provider===r&&p.status!=="ended"&&O(p.wrapperPid,p.id));if(n)throw new l("ALREADY_RUNNING",`session already running for project=${t.id} provider=${r} (session ${n.id}, pid ${n.wrapperPid}). end it first with \`sootsim agent end <sessionId>\`.`);let o=r==="claude"?Z():void 0,s=M({projectId:t.id,provider:r,transport:"pty",cwd:t.cwd,status:"idle",claudeSessionUuid:o}),a=W(s.id),d=J(s.id),c=te(s.id);L(a),L(d);let g=u.dirname(c);i.mkdirSync(g,{recursive:!0});try{i.chmodSync(g,448)}catch{}let{cmd:A,prefixArgs:H}=re(),x=[...H,"agent-wrapper","--session-id",s.id,"--project-id",t.id,"--provider",r,"--cwd",t.cwd,"--prompt-in",a,"--events-out",d,"--transcript",c];e.codexBin&&x.push("--codex-bin",e.codexBin),e.claudeBin&&x.push("--claude-bin",e.claudeBin),e.freshThread&&x.push("--fresh-thread"),o&&x.push("--claude-session-uuid",o);let P=V(A,x,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:y()}});P.unref();let E=e.readyTimeoutMs??6e3,b=await ae(d,p=>p.type==="ready"||p.type==="error",E);if(!b||b.type==="error"){if(P.pid)try{process.kill(P.pid,"SIGTERM")}catch{}try{i.rmSync(j(s.id),{recursive:!0,force:!0})}catch{}v(s.id,{status:"ended"});let p=b&&b.type==="error"?b.message:`no ready event within ${E}ms`;throw new l("WRAPPER_FAILED",p)}return v(s.id,{wrapperPid:P.pid,status:"idle"}),{session:k(s.id),wrapperPid:P.pid}})}async function De(e,t){let r=k(e);if(!r)throw new l("NO_SESSION",`no session with id=${e}`);if(!O(r.wrapperPid,e))throw v(e,{status:"ended"}),new l("NOT_ALIVE",`session wrapper is not alive (pid=${r.wrapperPid}). start a new session.`);let n=W(e);if(!i.existsSync(n))throw new l("NO_FIFO",`prompt FIFO missing: ${n}`);let o=i.openSync(n,f.O_WRONLY);try{let s=R(t);if(!s)throw new l("EMPTY_PROMPT","prompt text is empty");i.writeSync(o,s+`
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as R}from"./chunk-62GPXYH7.js";import{o as D}from"./chunk-TWUPMUWQ.js";import{a as T}from"./chunk-U4OPCVAL.js";function Y(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.type=="string"&&typeof t.ts=="number"}function I(e){let t=e.trim();if(!t)return null;try{let r=JSON.parse(t);return Y(r)?r:null}catch{return null}}import{randomBytes as G,createHash as q}from"node:crypto";import m from"node:fs";import h from"node:path";var N=null;function _(){if(N)return N;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||D()}function y(){return _()}function U(){return h.join(_(),"attached-projects.json")}function $(){return{version:1,attachedProjects:[],previewAttachments:[],agentSessions:[]}}function S(){let e=U(),t;try{t=m.readFileSync(e,"utf8")}catch(r){if(r.code==="ENOENT")return $();throw r}try{let r=JSON.parse(t);if(!r||typeof r!="object")throw new Error("not an object");return{version:1,attachedProjects:Array.isArray(r.attachedProjects)?r.attachedProjects:[],previewAttachments:Array.isArray(r.previewAttachments)?r.previewAttachments:[],agentSessions:Array.isArray(r.agentSessions)?r.agentSessions:[]}}catch(r){let n=`${e}.corrupt-${Date.now()}`;try{m.renameSync(e,n),console.warn(`[sootsim] attached-projects.json was unparseable; quarantined to ${n}. original error: ${r.message}`)}catch{}return $()}}function X(e){let t=U();m.mkdirSync(h.dirname(t),{recursive:!0});let r=`${t}.tmp-${process.pid}-${Date.now()}`,n=m.openSync(r,"w",384);try{m.writeFileSync(n,JSON.stringify(e,null,2)),m.fsyncSync(n)}finally{m.closeSync(n)}m.renameSync(r,t)}function w(e){let t=S();return e(t),X(t),t}function B(e){return q("sha256").update(h.resolve(e)).digest("hex").slice(0,16)}function K(){return`s_${G(10).toString("hex")}`}function ge(e){let t=h.resolve(e.cwd),r=B(t),n;return w(o=>{let s=o.attachedProjects.find(c=>c.id===r);if(s){let c={...s,...e,id:r,cwd:t,sourceRoots:e.sourceRoots??s.sourceRoots,knownBundleUrls:e.knownBundleUrls??s.knownBundleUrls,pinnedSourceResolutions:e.pinnedSourceResolutions??s.pinnedSourceResolutions,telemetry:e.telemetry??s.telemetry,updatedAt:Date.now(),createdAt:s.createdAt},g=o.attachedProjects.indexOf(s);o.attachedProjects[g]=c,n=c;return}let a=Date.now(),d={id:r,name:e.name??h.basename(t),cwd:t,repoRoot:e.repoRoot,sourceRoots:e.sourceRoots??[t],framework:e.framework??"unknown",bundleId:e.bundleId,knownBundleUrls:e.knownBundleUrls??[],preferredProvider:e.preferredProvider??"codex",preferredTransport:e.preferredTransport??"tmux",editorOpenCommand:e.editorOpenCommand,moshiWebhookToken:e.moshiWebhookToken,pinnedSourceResolutions:e.pinnedSourceResolutions??{},isolateDiscovery:e.isolateDiscovery,git:e.git,telemetry:e.telemetry??{lastOpened:0,runsCompleted:0},createdAt:a,updatedAt:a};o.attachedProjects.push(d),n=d}),n}function F(e){return S().attachedProjects.find(t=>t.id===e)??null}function he(){return S().attachedProjects}var Q=336*60*60*1e3;function ye(e,t={}){w(r=>{let n=r.attachedProjects.find(s=>s.id===e);if(!n)return;let o=t.ts??Date.now();if(n.telemetry.runsCompleted=(n.telemetry.runsCompleted??0)+1,typeof t.usd=="number"&&Number.isFinite(t.usd)&&t.usd>=0){let s=n.telemetry.costHistory??[],a=o-Q,d=s.filter(c=>c.ts>=a);d.push({ts:o,usd:t.usd}),n.telemetry.costHistory=d}n.updatedAt=o})}function Se(e,t=Date.now()){let r=t-6048e5,n=e.telemetry.costHistory??[],o=0;for(let s of n)s.ts>=r&&(o+=s.usd);return o}function we(e){w(t=>{t.attachedProjects=t.attachedProjects.filter(r=>r.id!==e),t.agentSessions=t.agentSessions.filter(r=>r.projectId!==e),t.previewAttachments=t.previewAttachments.filter(r=>r.projectId!==e)})}function M(e){let t;return w(r=>{if(e.id){let a=r.agentSessions.find(d=>d.id===e.id);if(a){let d={...a,...e,lastSeenAt:Date.now()},c=r.agentSessions.indexOf(a);r.agentSessions[c]=d,t=d;return}}let n=r.attachedProjects.find(a=>a.id===e.projectId);if(!n)throw new Error(`upsertSession: no AttachedProject with id=${e.projectId}`);let o=Date.now(),s={id:e.id??K(),projectId:e.projectId,provider:e.provider,transport:e.transport??n.preferredTransport,cwd:e.cwd??n.cwd,claudeSessionUuid:e.claudeSessionUuid,tmuxSessionName:e.tmuxSessionName,wrapperPid:e.wrapperPid,status:e.status??"idle",needsAttention:e.needsAttention??!1,lastPrompt:e.lastPrompt,lastSummary:e.lastSummary,lastTurnFiles:e.lastTurnFiles,currentlyEditing:e.currentlyEditing,lastSeenAt:o,createdAt:o};r.agentSessions.push(s),t=s}),t}function k(e){return S().agentSessions.find(t=>t.id===e)??null}function C(e){let t=S().agentSessions;return e?t.filter(r=>r.projectId===e):t}function v(e,t){w(r=>{let n=r.agentSessions.find(s=>s.id===e);if(!n)return;let o=r.agentSessions.indexOf(n);r.agentSessions[o]={...n,...t,id:n.id,projectId:n.projectId,createdAt:n.createdAt,lastSeenAt:Date.now()}})}async function ve(){if(S().attachedProjects.length>0)return;let{loadOptionalDemoApps:t}=await import("./optional-demo-registry-YQZA2MRD.js"),r=await t();r.length!==0&&w(n=>{for(let o of r){if(!m.existsSync(o.dir))continue;let s=h.resolve(o.dir),a=B(s);if(n.attachedProjects.some(c=>c.id===a))continue;let d=Date.now();n.attachedProjects.push({id:a,name:o.label,cwd:s,sourceRoots:[s],framework:o.framework,knownBundleUrls:[`http://localhost:${o.preferredPort}/index.bundle`],preferredProvider:"codex",preferredTransport:"tmux",pinnedSourceResolutions:{},telemetry:{lastOpened:0,runsCompleted:0},createdAt:d,updatedAt:d})}})}import{spawn as V,spawnSync as z}from"node:child_process";import{randomUUID as Z}from"node:crypto";import i,{constants as f}from"node:fs";import u from"node:path";import ee from"node:readline";function j(e){return u.join(y(),"sessions",e)}function W(e){return u.join(j(e),"prompt.in")}function J(e){return u.join(j(e),"events.out")}function te(e){return u.join(y(),"transcripts",`${e}.log`)}function O(e,t){if(!e)return!1;try{process.kill(e,0)}catch{return!1}return!(t&&!i.existsSync(j(t)))}function re(){if(process.env.SOOTSIM_BIN)return{cmd:process.env.SOOTSIM_BIN,prefixArgs:[]};if(process.versions.electron){let n=process.resourcesPath;if(n){let o=[u.join(n,"bin","sootsim"),u.join(n,"bin",`sootsim-${process.platform}-${process.arch}`)];for(let s of o)if(i.existsSync(s))return{cmd:s,prefixArgs:[]}}}let e=ne();if(e)return e;let t=process.argv[0],r=process.argv[1];if(r&&/\.(ts|tsx|mjs|cjs|js)$/.test(r))return{cmd:t,prefixArgs:[r]};if(!r||r.includes("/.bin/"))throw new Error("sootsim CLI not found. set SOOTSIM_BIN to the path of the sootsim binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`.");return{cmd:t,prefixArgs:[]}}function ne(){try{let e=se();if(!e)return null;let t=`sootsim-${process.platform}-${process.arch}`,r=u.join(e,"dist-bin",t);if(i.existsSync(r))return{cmd:r,prefixArgs:[]};let n=u.join(e,"dist-cli","bin.js");if(i.existsSync(n)){try{let o=u.join(e,"cli","commands","agent-wrapper.ts");if(i.existsSync(o)){let s=i.statSync(o).mtimeMs;i.statSync(n).mtimeMs<s&&console.warn("[sootsim] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with `bun run --cwd packages/sootsim build:cli` (watch:cli:binary builds dist-bin/ instead).")}}catch{}return{cmd:process.execPath,prefixArgs:[n]}}return null}catch{return null}}function se(){try{let r=T.resolve("sootsim/package.json");return u.dirname(r)}catch{}let e=oe();if(!e)return null;let t=u.dirname(e);for(let r=0;r<8;r++){let n=u.join(t,"package.json");try{if(i.existsSync(n)&&JSON.parse(i.readFileSync(n,"utf8")).name==="sootsim")return t}catch{}let o=u.dirname(t);if(o===t)break;t=o}return null}function oe(){try{let e=import.meta.url;return!e||!e.startsWith("file://")?null:decodeURIComponent(e.slice(7))}catch{return null}}async function ie(e,t,r){let n=u.join(y(),"locks");i.mkdirSync(n,{recursive:!0});try{i.chmodSync(n,448)}catch{}let o=u.join(n,`start-${e}-${t}.lock`),s=Date.now()+4e3,a=null;for(;a===null;)try{a=i.openSync(o,f.O_WRONLY|f.O_CREAT|f.O_EXCL,384)}catch(d){if(d.code!=="EEXIST")throw d;try{let c=Number(i.readFileSync(o,"utf8").trim());if(c&&!ce(c)){i.unlinkSync(o);continue}}catch{}if(Date.now()>s)throw new Error(`another start is in progress for project=${e} provider=${t} (lock: ${o})`);await new Promise(c=>setTimeout(c,50))}try{return i.writeFileSync(a,String(process.pid)),await r()}finally{try{i.closeSync(a)}catch{}try{i.unlinkSync(o)}catch{}}}function ce(e){try{return process.kill(e,0),!0}catch{return!1}}function L(e){let t=u.dirname(e);i.mkdirSync(t,{recursive:!0});try{i.chmodSync(t,448)}catch{}if(i.existsSync(e))try{if(i.statSync(e).isFIFO()){try{i.chmodSync(e,384)}catch{}return}i.unlinkSync(e)}catch{i.unlinkSync(e)}let r=z("mkfifo",["-m","600",e]);if(r.status!==0)throw new Error(`mkfifo(${e}) failed: ${r.stderr?.toString().trim()||"unknown error"}`)}var l=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function Te(e){let t=F(e.projectId);if(!t)throw new l("NO_PROJECT",`no project with id=${e.projectId}`);let r=e.provider||t.preferredProvider||"codex";return ie(t.id,r,async()=>{let n=C(t.id).find(p=>p.provider===r&&p.status!=="ended"&&O(p.wrapperPid,p.id));if(n)throw new l("ALREADY_RUNNING",`session already running for project=${t.id} provider=${r} (session ${n.id}, pid ${n.wrapperPid}). end it first with \`sootsim agent end <sessionId>\`.`);let o=r==="claude"?Z():void 0,s=M({projectId:t.id,provider:r,transport:"pty",cwd:t.cwd,status:"idle",claudeSessionUuid:o}),a=W(s.id),d=J(s.id),c=te(s.id);L(a),L(d);let g=u.dirname(c);i.mkdirSync(g,{recursive:!0});try{i.chmodSync(g,448)}catch{}let{cmd:A,prefixArgs:H}=re(),x=[...H,"agent-wrapper","--session-id",s.id,"--project-id",t.id,"--provider",r,"--cwd",t.cwd,"--prompt-in",a,"--events-out",d,"--transcript",c];e.codexBin&&x.push("--codex-bin",e.codexBin),e.claudeBin&&x.push("--claude-bin",e.claudeBin),e.freshThread&&x.push("--fresh-thread"),o&&x.push("--claude-session-uuid",o);let P=V(A,x,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:y()}});P.unref();let E=e.readyTimeoutMs??6e3,b=await ae(d,p=>p.type==="ready"||p.type==="error",E);if(!b||b.type==="error"){if(P.pid)try{process.kill(P.pid,"SIGTERM")}catch{}try{i.rmSync(j(s.id),{recursive:!0,force:!0})}catch{}v(s.id,{status:"ended"});let p=b&&b.type==="error"?b.message:`no ready event within ${E}ms`;throw new l("WRAPPER_FAILED",p)}return v(s.id,{wrapperPid:P.pid,status:"idle"}),{session:k(s.id),wrapperPid:P.pid}})}async function De(e,t){let r=k(e);if(!r)throw new l("NO_SESSION",`no session with id=${e}`);if(!O(r.wrapperPid,e))throw v(e,{status:"ended"}),new l("NOT_ALIVE",`session wrapper is not alive (pid=${r.wrapperPid}). start a new session.`);let n=W(e);if(!i.existsSync(n))throw new l("NO_FIFO",`prompt FIFO missing: ${n}`);let o=i.openSync(n,f.O_WRONLY);try{let s=R(t);if(!s)throw new l("EMPTY_PROMPT","prompt text is empty");i.writeSync(o,s+`
|
|
3
3
|
`)}finally{i.closeSync(o)}v(e,{lastPrompt:t.displayText??t.text,status:"working"})}async function Re(e){let t=k(e);if(!t)throw new l("NO_SESSION",`no session with id=${e}`);if(O(t.wrapperPid,e))try{process.kill(t.wrapperPid,"SIGTERM")}catch{}let r=j(e),n=y();if(r.startsWith(n))try{i.rmSync(r,{recursive:!0,force:!0})}catch{}v(e,{status:"ended",wrapperPid:void 0})}function Ne(e,t){let r=J(e);if(!i.existsSync(r))throw new l("NO_FIFO",`events FIFO missing: ${r}`);let n=i.openSync(r,f.O_RDWR),o=i.createReadStream("",{fd:n,autoClose:!0}),s=ee.createInterface({input:o,crlfDelay:1/0});s.on("line",d=>{let c=I(d);c&&t(c)});let a=!1;return()=>{if(!a){a=!0;try{s.close()}catch{}try{o.destroy()}catch{}}}}async function ae(e,t,r){let n=i.openSync(e,f.O_RDWR|f.O_NONBLOCK),o=Buffer.alloc(8192),s="",a=Date.now()+r;try{for(;Date.now()<a;){let d=0;try{d=i.readSync(n,o,0,o.length,null)}catch(c){if(c.code!=="EAGAIN")throw c;d=0}if(d>0){s+=o.subarray(0,d).toString("utf8");let c;for(;(c=s.indexOf(`
|
|
4
4
|
`))>=0;){let g=s.slice(0,c);s=s.slice(c+1);let A=I(g);if(A&&t(A))return A}}else await new Promise(c=>setTimeout(c,30))}return null}finally{i.closeSync(n)}}export{I as a,y as b,ge as c,F as d,he as e,ye as f,Se as g,we as h,k as i,C as j,v as k,ve as l,j as m,W as n,J as o,te as p,O as q,re as r,l as s,Te as t,De as u,Re as v,Ne as w};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{H as t,N as n,P as l,j as r}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{H as t,N as n,P as l,j as r}from"./chunk-TWUPMUWQ.js";function m(){let e=t(),i=r()?n():null;return i&&l(i)?{primary:`engine dev source (:${i.bridgePort})`,installedRuntime:e?`installed runtime v${e}`:null,isDevBridge:!0}:{primary:e?`runtime v${e}`:"runtime not installed",installedRuntime:null,isDevBridge:!1}}export{m as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import{existsSync as A,mkdirSync as M,readFileSync as v,rmSync as f,writeFileSync as h}from"fs";import{tmpdir as w}from"os";import{dirname as B,join as U,resolve as V}from"path";import{execFileSync as b}from"child_process";import{readFileSync as _}from"fs";import{createRequire as y}from"module";var c=null,p=null;function m(r){c||(c=T());try{return c(r)}catch{return null}}function C(r){p||(p=O());try{return p(r)}catch{return null}}function O(){if(process.platform==="linux")return r=>{try{return _(`/proc/${r}/comm`,"utf8").trim()||null}catch{return null}};if(process.platform==="darwin"){let r=x();return r||F()}return()=>null}function T(){let r=Number(process.env.PPID);if(Number.isFinite(r)&&r>1&&r!==process.ppid)return()=>r;if(process.platform==="linux")return D();if(process.platform==="darwin"){let n=R();return n||k()}return()=>null}function D(){return r=>{try{let n=_(`/proc/${r}/stat`,"utf8"),t=n.lastIndexOf(")");if(t<0)return null;let e=n.slice(t+1).trim().split(/\s+/),i=Number(e[1]);return Number.isFinite(i)&&i>0?i:null}catch{return null}}}var g=3,l=216,P=16,S=48,L=16;function R(){if(!process.versions?.bun)return null;try{let r=y(import.meta.url),{dlopen:n,FFIType:t}=r("bun:ffi"),e=n("/usr/lib/libproc.dylib",{proc_pidinfo:{args:[t.i32,t.i32,t.u64,t.ptr,t.i32],returns:t.i32}}),i=Buffer.alloc(l);return o=>{if(Number(e.symbols.proc_pidinfo(o,g,0n,i,l))<=0)return null;let u=i.readUInt32LE(P);return u>0?u:null}}catch{return null}}function x(){if(!process.versions?.bun)return null;try{let r=y(import.meta.url),{dlopen:n,FFIType:t}=r("bun:ffi"),e=n("/usr/lib/libproc.dylib",{proc_pidinfo:{args:[t.i32,t.i32,t.u64,t.ptr,t.i32],returns:t.i32}}),i=Buffer.alloc(l);return o=>{if(Number(e.symbols.proc_pidinfo(o,g,0n,i,l))<=0)return null;let u=i.subarray(S,S+L),I=u.indexOf(0);return u.subarray(0,I<0?u.length:I).toString("utf8")||null}}catch{return null}}function F(){return r=>{try{let t=b("lsof",["-R","-p",String(r),"-d","cwd","-a"],{encoding:"utf8",timeout:2e3,stdio:["ignore","pipe","ignore"]}).split(`
|
|
3
3
|
`)[1];return t&&t.trim().split(/\s+/)[0]||null}catch{return null}}}function k(){return r=>{try{let t=b("lsof",["-R","-p",String(r),"-d","cwd","-a"],{encoding:"utf8",timeout:2e3,stdio:["ignore","pipe","ignore"]}).split(`
|
|
4
4
|
`)[1];if(!t)return null;let e=t.trim().split(/\s+/),i=Number(e[2]);return Number.isFinite(i)&&i>1?i:null}catch{return null}}}var d=1,N="SOOTSIM_CLI_CURRENT_SIM_PATH",W=["SOOTSIM_CLI_IDENTITY","AGENTBUS_SESSION","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","TERM_SESSION_ID","ITERM_SESSION_ID","TMUX_PANE","STY","KITTY_WINDOW_ID","WEZTERM_PANE","ALACRITTY_WINDOW_ID","WINDOWID","VSCODE_INJECTION"],$=/^(tmux|screen|agentbus)/i;function E(r,n=20){let t=r,e=m(r);if(!e||e<=1)return null;for(let i=0;i<n;i++){let o=C(e);if(o&&$.test(o))return t;let s=m(e);if(!s||s<=1)return e;t=e,e=s}return e}function Y(){for(let n of W){let t=process.env[n];if(t&&t.trim())return{key:`${n}:${t.trim()}`,source:n,stable:!0}}let r=E(process.ppid);return r&&r>1?{key:`gppid-${r}`,source:"grand-ppid",stable:!0}:{key:`pid-${process.ppid}`,source:"ppid",stable:!1}}function H(){return Y().key}function tr(){return E(process.ppid)}function a(){if(process.env[N])return V(process.env[N]);let r=H();return U(w(),`sootsim-current-sim-${r}.json`)}function J(){let r=a();if(!A(r))return null;try{let n=JSON.parse(v(r,"utf8"));return n.version!==d||typeof n.simId!="string"||!n.simId.trim()||typeof n.updatedAt!="string"?(f(r,{force:!0}),null):{version:d,simId:n.simId.trim(),updatedAt:n.updatedAt}}catch{return f(r,{force:!0}),null}}function nr(){return J()?.simId||null}function er(r){let n=r.trim();if(!n)return;let t=a();M(B(t),{recursive:!0}),h(t,JSON.stringify({version:d,simId:n,updatedAt:new Date().toISOString()},null,2)+`
|
|
5
|
-
`)}function ir(){f(a(),{force:!0})}export{
|
|
5
|
+
`)}function ir(){f(a(),{force:!0})}export{C as a,Y as b,H as c,tr as d,nr as e,er as f,ir as g};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as d,b as p}from"./chunk-SPBHQVJ4.js";import{execSync as c}from"child_process";function s(e){try{return c(e,{stdio:["ignore","pipe","ignore"],timeout:3e3,encoding:"utf8"}).trim()||null}catch{return null}}function o(e){let n=e?.trim();return!n||!/^\d+$/.test(n)?null:Number(n)}function m(){let e=s("git remote get-url origin");if(!e)return null;let n=e.match(/github\.com[/:]([^/\s]+)\/([^/\s]+?)(?:\.git)?\/?$/i);return n?{owner:n[1],repo:n[2]}:null}function f(){let e=process.env.GITHUB_ACTIONS==="true",n=(process.env.CONTRAST_REPO||process.env.GITHUB_REPOSITORY||"").trim(),[r,i]=n.includes("/")?n.split("/",2):[null,null];if(e){let u=process.env.GITHUB_REF?.match(/^refs\/pull\/(\d+)\//)?.[1];return{owner:r,repo:i,branch:process.env.GITHUB_HEAD_REF?.trim()||process.env.GITHUB_REF_NAME?.trim()||null,commitSha:process.env.GITHUB_SHA?.trim()||null,githubUsername:process.env.GITHUB_ACTOR?.trim()||null,pullRequestNumber:o(process.env.CONTRAST_PR_NUMBER)??o(u),githubRunId:process.env.GITHUB_RUN_ID?.trim()||null,source:"ci"}}let l=s("git rev-parse --abbrev-ref HEAD"),t=r?null:m();return{owner:r??t?.owner??null,repo:i??t?.repo??null,branch:l==="HEAD"?null:l,commitSha:s("git rev-parse HEAD"),githubUsername:null,pullRequestNumber:o(process.env.CONTRAST_PR_NUMBER),githubRunId:null,source:"cli"}}function R(e){if(e.length===0)return{stepCount:null,failedStepIndex:null};let n=e.find(r=>r.status==="failure");return{stepCount:e.length,failedStepIndex:n?n.stepIndex:null}}function b(e){return e.auth?e.uploadedShare?!0:e.auth.kind==="github"||process.env.GITHUB_ACTIONS==="true":!1}async function S(e){let n=e.auth??d();if(!n)return null;let r=f(),i=e.owner??(n.kind==="github"?n.owner:null)??r.owner,l=e.repo??(n.kind==="github"?n.repo:null)??r.repo;try{let t=await fetch(`${e.origin.replace(/\/$/,"")}/api/sootsim/test-runs`,{method:"POST",headers:{"content-type":"application/json",authorization:p(n)},body:JSON.stringify({kind:e.kind,source:r.source,name:e.name??void 0,prompt:e.prompt??void 0,summary:e.summary??void 0,status:e.status,failureMessage:e.failureMessage??void 0,previewShareId:e.previewShareId??void 0,owner:i??void 0,repo:l??void 0,branch:r.branch??void 0,commitSha:r.commitSha??void 0,githubUsername:r.githubUsername??void 0,pullRequestNumber:r.pullRequestNumber??void 0,githubRunId:r.githubRunId??void 0,stepCount:e.stepCount??void 0,failedStepIndex:e.failedStepIndex??void 0,durationMs:e.durationMs??void 0,flowYamlSizeBytes:e.flowYamlSizeBytes??void 0})});if(!t.ok){let a=await t.text().catch(()=>"");return console.warn(` warn: run registration failed: /api/sootsim/test-runs ${t.status}${a?`: ${a.slice(0,200)}`:""}`),null}let u=await t.json();return u.run?.id?{id:u.run.id,previewUrl:u.run.previewUrl??null,traceUrl:u.run.traceUrl??null}:(console.warn(" warn: run registration returned no id"),null)}catch(t){return console.warn(` warn: run registration failed: ${t instanceof Error?t.message:String(t)}`),null}}export{R as a,b,S as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.229 | (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,24 @@
|
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{c as b}from"./chunk-AB7XCG3A.js";import{b as F,e as T,g as A}from"./chunk-4O73AHYA.js";import{M as w,N as S,O as I,P as B}from"./chunk-TWUPMUWQ.js";import{WebSocket as W}from"ws";var P=null;function O(){return P||(P=M(),P)}function M(){let i=S();if(i&&B(i))return{source:"dev-bridge",bridgePort:i.bridgePort,shellBaseUrl:i.shellPort?`http://localhost:${i.shellPort}/`:b};let r=w();return r&&I(r)?{source:"daemon",bridgePort:r.bridgePort,shellBaseUrl:r.runtimePort>0?`http://localhost:${r.runtimePort}/`:b}:{source:"default",bridgePort:7668,shellBaseUrl:b}}function U(i){let r=S();if(r&&B(r)&&r.bridgePort===i)return{source:"dev-bridge",shellBaseUrl:r.shellPort?`http://localhost:${r.shellPort}/`:b};let e=w();return e&&I(e)&&e.bridgePort===i?{source:"daemon",shellBaseUrl:e.runtimePort>0?`http://localhost:${e.runtimePort}/`:b}:null}function G(i){let r;try{let l=new URL(i);r=l.port?Number(l.port):l.protocol==="https:"?443:80}catch{return null}if(!Number.isFinite(r)||r<=0)return null;let e=S();if(e&&B(e)&&(e.shellPort===r||e.runtimePort===r||e.bridgePort===r))return e.bridgePort;let d=w();return d&&I(d)&&(d.runtimePort===r||d.bridgePort===r)?d.bridgePort:null}function _(){return O().bridgePort}function K(i,r){let e=U(i),d=e?.source==="dev-bridge"?"dev bridge":e?.source==="daemon"?"daemon bridge":"bridge",l=e?`${e.source}.json`:"no lockfile",t=r??e?.shellBaseUrl;process.stderr.write(` \u2192 ${d} :${i} (${t?`shell ${t}, `:""}${l})
|
|
3
|
+
`)}var $=class extends Error{lock;constructor(r,e){super(r),this.name="BridgeSimLockedError",this.lock=e}};function N(i){return i==="flag"?"via --sim":i==="saved"?"saved via `sootsim use`":"primary fallback \u2014 no sim pinned"}function Q(i,r={}){let e=new Set,d=r.port??_(),l=r.commandTimeoutMs??15e3,t,u="none",v=new Set(r.stripBooleanFlags??[]),p=new Set(r.stripValueFlags??[]);for(let n=0;n<i.length;n++){let a=i[n];if(a==="--port"||a==="-p"){e.add(n),n+1<i.length&&(e.add(n+1),d=Number(i[n+1])),n++;continue}if(a.startsWith("--port=")){e.add(n),d=Number(a.slice(7));continue}if(a==="--timeout"){e.add(n),n+1<i.length&&(e.add(n+1),l=Number(i[n+1])),n++;continue}if(a==="--sim"||a==="--session"||a==="--tab"){e.add(n),n+1<i.length&&(e.add(n+1),t=i[n+1]?.trim()||void 0,u="flag"),n++;continue}let s=a.startsWith("--sim=")?a.slice(6):a.startsWith("--session=")?a.slice(10):a.startsWith("--tab=")?a.slice(6):void 0;if(s!==void 0){e.add(n),t=s.trim()||void 0,u="flag";continue}if(v.has(a)){e.add(n);continue}p.has(a)&&(e.add(n),n+1<i.length&&e.add(n+1),n++)}if(!t){let n=T();n&&(t=n.trim()||void 0,u="saved")}return{positional:i.filter((n,a)=>!e.has(a)),wsPort:d,simId:t,simIdSource:u,commandTimeoutMs:l}}function R(i,r={}){let e=1,d=r.commandTimeoutMs??15e3,l=new Map,t=new W(`ws://localhost:${i}`),u=F(),v=new Promise((s,o)=>{t.on("open",()=>{try{t.send(JSON.stringify({type:"bridge:hello",id:0,cliIdentityKey:u.key,cliIdentitySource:u.source,cliLabel:r.cliLabel}))}catch{}s()}),t.on("error",c=>{let m=c.message?`: ${c.message}`:"";o(new Error(`could not connect to ws://localhost:${i}${m}`))})}),p=!1,n=!1;function a(s,o){if(n||process.env.SOOTSIM_QUIET_TARGET_NOTICE==="1"||s.startsWith("bridge:")||s==="focus"||s==="close")return;n=!0;let c=o??"primary",m=N(o?r.simIdSource:"none");process.stderr.write(` \u2192 ${c} (${m})
|
|
4
|
+
`)}return t.on("message",s=>{let o;try{o=JSON.parse(s.toString())}catch{return}if(o.id===0)return;let c=l.get(o.id);c&&(l.delete(o.id),o._otherCliCount>0&&!p&&(p=!0,process.stderr.write(`
|
|
5
|
+
\u26A0 ${o._otherCliCount} other CLI identity/identities are driving this sim
|
|
6
|
+
taps, scrolls, and keyboard input from multiple agents will collide on
|
|
7
|
+
the same screen state (this is not a bridge throughput limit).
|
|
8
|
+
use \`sootsim open --new\` for an isolated sim per agent.
|
|
9
|
+
|
|
10
|
+
`)),o.error?o._locked?c.reject(new $(o.error,o._locked)):c.reject(new Error(o.error)):c.resolve(o.result))}),t.on("close",(s,o)=>{let c=o?.toString()||"connection closed";for(let[m,f]of l)l.delete(m),f.reject(new Error(`sim disconnected: ${c} (code ${s})`))}),{async send(s,o){let c=o?.timeoutMs??d,m=async g=>{await v;let h=e++;return new Promise((L,C)=>{let x=setTimeout(()=>{l.delete(h),C(new Error(`command timed out after ${Math.round(c/1e3)}s`))},c);l.set(h,{resolve:k=>{clearTimeout(x),L(k)},reject:k=>{clearTimeout(x),C(k)}});let y={...s,id:h};y.simId===void 0&&g&&(y.simId=g),a(s.type??"",y.simId),t.send(JSON.stringify(y))})},f=r.simIdSource==="flag"?r.simId:T()??r.simId;try{return await m(f)}catch(g){let h=g instanceof Error?g.message:String(g);throw r.simIdSource!=="flag"&&f&&s.simId===void 0&&h===`no sim connected with id ${f}`?(A(),new Error(`saved sim ${f} is gone; run \`sootsim list\` and \`sootsim use <sim>\`, or open a fresh sim`)):g}},async listSims(){let s=await this.send({type:"bridge:list-sims"});return Array.isArray(s)?s:[]},async openUrl(s,o={}){return this.send({type:"bridge:open",url:s,newWindow:o.newWindow===!0})},async focusSim(s){return this.send({type:"focus",simId:s})},async closeSim(s){return this.send({type:"close",simId:s})},async claim(s,o={}){return await this.send({type:"bridge:claim",simId:s,force:o.force===!0})},close(){try{t.readyState===W.OPEN&&t.send(JSON.stringify({type:"bridge:bye",id:0}))}catch{}t.close();let s=setTimeout(()=>{t.readyState!==W.CLOSED&&t.terminate()},250)}}}function z(i){return R(i.wsPort,{commandTimeoutMs:i.commandTimeoutMs,simId:i.simId,simIdSource:i.simIdSource})}function D(i,r){let e=i.filter(t=>t.readyState==="open"&&t.id!==r),d=e.find(t=>t.userFocused)??e.find(t=>t.userVisible===!0&&t.isPrimary)??e.find(t=>t.userVisible===!0)??e.find(t=>t.isPrimary);if(!d)return null;let l=[d.isPrimary?"primary":null,d.userVisible===!1?"hidden":d.userVisible===!0?"visible":null,d.userFocused?"focused":null].filter(Boolean);return`${d.id}${l.length?` [${l.join(", ")}]`:""}`}async function X(i){try{let r=await i.send({type:"evaluate",code:`(() => ({
|
|
11
|
+
hidden: document.hidden,
|
|
12
|
+
visibilityState: document.visibilityState,
|
|
13
|
+
hasFocus: typeof document.hasFocus === 'function' ? document.hasFocus() : null,
|
|
14
|
+
simId: window.__sootsimBridge?.id ?? window.SootSim?.state?.simId ?? null,
|
|
15
|
+
url: location.href
|
|
16
|
+
}))()`}),e=typeof r=="object"&&r!==null?r:{hidden:r===!0};if(e.hidden===!0===!0){let l=null;try{l=D(await i.listSims(),e.simId)}catch{}return process.stderr.write(`
|
|
17
|
+
\u26A0 target sim${e.simId?` ${e.simId}`:""} is hidden (document.hidden = true)
|
|
18
|
+
`+(e.visibilityState?` visibility: ${e.visibilityState}
|
|
19
|
+
`:"")+` animations and rAF callbacks are throttled \u2014 coordinates may be wrong
|
|
20
|
+
and launch/transition animations will not complete.
|
|
21
|
+
`+(l?` another open sim looks usable: ${l}; target it with --sim.
|
|
22
|
+
`:" run `sootsim list` to find the visible sim and target it with --sim.\n")+` page-level window.focus() cannot unhide a browser tab.
|
|
23
|
+
|
|
24
|
+
`),{hidden:!0,warned:!0,simId:e.simId}}return{hidden:!1,warned:!1,simId:e.simId}}catch{return{hidden:!1,warned:!1}}}async function Y(i,r,e={}){let d={type:"evaluate",code:r};return e.acquireLock&&(d.acquireLock=!0),i.send(d)}async function Z(i,r,...e){return i.send({type:"call",path:r,args:e})}async function ee(i,r,...e){return i.send({type:"call",path:r,args:e,acquireLock:!0})}export{O as a,U as b,G as c,_ as d,K as e,$ as f,Q as g,R as h,z as i,X as j,Y as k,Z as l,ee as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as p}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as p}from"./chunk-JK4AGL2U.js";import{a as c,b as l}from"./chunk-SPBHQVJ4.js";import{a}from"./chunk-WRPO6J3Z.js";async function g(e,t){if(t)return t.replace(/\/$/,"");if(e.kind==="session"&&e.origin)return e.origin.replace(/\/$/,"");let i=a();return i?.origin?i.origin.replace(/\/$/,""):(await p()).replace(/\/$/,"")}async function m(e,t={}){let i=c();if(i||(process.stderr.write(`
|
|
3
3
|
sootsim ${e} needs auth before it can check recording access.
|
|
4
4
|
|
|
5
5
|
pick one:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import{createInterface as i}from"readline";var c=()=>i({input:process.stdin,output:process.stdout});function s(o){return new Promise(n=>{let r=c();r.question(o,t=>{r.close(),n(t.trim())})})}async function u(o,n=!0){let r=n?"[Y/n]":"[y/N]";if(!process.stdin.isTTY)return console.log(` ${o} ${r} ${n?"y":"n"} (non-interactive)`),n;let t=await s(` ${o} ${r} `);return t===""?n:t.toLowerCase().startsWith("y")}async function a(o,n){console.log(`
|
|
3
3
|
${o}
|
|
4
4
|
`);for(let e=0;e<n.length;e++)console.log(` ${e+1}. ${n[e]}`);if(console.log(),!process.stdin.isTTY)return console.log(` choose [1-${n.length}]: 1 (non-interactive)`),0;let r=await s(` choose [1-${n.length}]: `),t=parseInt(r,10);return t>=1&&t<=n.length?t-1:0}export{u as a,a as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
var t=4001,r="sootsim close";var o="http://localhost:5173/";export{t as a,r as b,o as c};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{j as n}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.229 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{j as n}from"./chunk-OUJVQUX4.js";var i=[];for(let[t,e]of Object.entries(n))e.cliFlag&&i.push({name:`--${e.cliFlag}`,short:e.cliFlagShort?`-${e.cliFlagShort}`:void 0,key:t,type:e.type==="enum"?"string":e.type,description:e.description,options:e.options,default:e.default});var a=i;function g(){let t=[];for(let e of a){let s=e.short?`${e.short}, ${e.name}`:` ${e.name}`,o=e.options?` [${e.options.join("|")}]`:"",r=e.default!==void 0?` (default: ${e.default})`:"";t.push(` ${s.padEnd(24)}${e.description}${o}${r}`)}return t.join(`
|
|
3
3
|
`)}export{g as a};
|