sootsim 0.1.45 → 0.1.46
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/dist-cli/bin.js +3 -3
- package/dist-cli/chunks/{agent-NSVMKP3P.js → agent-4SFE3DNP.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-HREUS3JR.js → agent-wrapper-BCXD55HW.js} +2 -2
- package/dist-cli/chunks/{assert-N7KX2APG.js → assert-ILRVN6CB.js} +2 -2
- package/dist-cli/chunks/auto-bootstrap-A4ML6QTW.js +2 -0
- package/dist-cli/chunks/beta-34TOAZFI.js +2 -0
- package/dist-cli/chunks/{chunk-AFBOAQAV.js → chunk-4OPZYTVB.js} +1 -1
- package/dist-cli/chunks/{chunk-QJMUNN2V.js → chunk-7CZ5VL7E.js} +1 -1
- package/dist-cli/chunks/{chunk-EHJMKPJP.js → chunk-BVXZZOBA.js} +2 -2
- package/dist-cli/chunks/{chunk-N4KSVDAU.js → chunk-DGAHFMAU.js} +2 -2
- package/dist-cli/chunks/{chunk-HZ5W4PIP.js → chunk-FCFKR7EM.js} +4 -4
- package/dist-cli/chunks/{chunk-2V4ALWOZ.js → chunk-FLJAN5PS.js} +2 -2
- package/dist-cli/chunks/{chunk-2WW7WJHA.js → chunk-GWOV6KFE.js} +1 -1
- package/dist-cli/chunks/{chunk-PPY2OTIR.js → chunk-H46ZLTT5.js} +1 -1
- package/dist-cli/chunks/{chunk-FNXGAYHN.js → chunk-K3I6VLF3.js} +1 -1
- package/dist-cli/chunks/{chunk-CBMFBTB3.js → chunk-KETYRULQ.js} +2 -2
- package/dist-cli/chunks/chunk-KV7XS7WL.js +1 -0
- package/dist-cli/chunks/{chunk-PNEIZ2DY.js → chunk-M5HZVUQQ.js} +1 -1
- package/dist-cli/chunks/{chunk-WUZSBXWF.js → chunk-MDSET24U.js} +2 -2
- package/dist-cli/chunks/chunk-MGEB3WEI.js +117 -0
- package/dist-cli/chunks/{chunk-QAL3T64I.js → chunk-MJD6C3BG.js} +2 -2
- package/dist-cli/chunks/{chunk-HNOQEJK3.js → chunk-N7DDQ5ZB.js} +2 -2
- package/dist-cli/chunks/{chunk-4RG3RPXB.js → chunk-OHI4DJSD.js} +1 -1
- package/dist-cli/chunks/{chunk-CFY2ELQ4.js → chunk-OMPAUB4V.js} +3 -3
- package/dist-cli/chunks/{chunk-ECI22OZU.js → chunk-OZICEBUA.js} +2 -2
- package/dist-cli/chunks/{chunk-CPCM75G3.js → chunk-PAOOYAVI.js} +2 -2
- package/dist-cli/chunks/{chunk-CVMSXDFO.js → chunk-PEXPACO5.js} +1 -1
- package/dist-cli/chunks/{chunk-3K4GAAOE.js → chunk-PG6FUKZX.js} +2 -2
- package/dist-cli/chunks/{chunk-WI72PADL.js → chunk-PKVNCXQD.js} +2 -2
- package/dist-cli/chunks/{chunk-65Q34YMN.js → chunk-PRRVFNFG.js} +2 -2
- package/dist-cli/chunks/{chunk-JKG66FDZ.js → chunk-QXJR74QV.js} +1 -1
- package/dist-cli/chunks/chunk-RSMU24BE.js +1 -0
- package/dist-cli/chunks/{chunk-25K4SXL3.js → chunk-S4OSFQIC.js} +2 -2
- package/dist-cli/chunks/{chunk-FGLQTXGF.js → chunk-SG7ICXM2.js} +3 -3
- package/dist-cli/chunks/chunk-T4H37KU7.js +2 -0
- package/dist-cli/chunks/chunk-UH5PKJXT.js +1 -0
- package/dist-cli/chunks/chunk-VWJ4O366.js +1 -0
- package/dist-cli/chunks/{chunk-ZSDPMO6R.js → chunk-W52DGZNV.js} +1 -1
- package/dist-cli/chunks/{chunk-VLWCOUVW.js → chunk-WD36PEEJ.js} +2 -2
- package/dist-cli/chunks/{chunk-R2VBXQYS.js → chunk-WRNSX5RR.js} +2 -2
- package/dist-cli/chunks/{chunk-ZR2EL6AG.js → chunk-WWEMLI77.js} +1 -1
- package/dist-cli/chunks/{chunk-TIE6ENCX.js → chunk-X7P3CGPY.js} +3 -3
- package/dist-cli/chunks/{chunk-YU2F5Y7A.js → chunk-XKNZR4BB.js} +2 -2
- package/dist-cli/chunks/{chunk-OSFZQ7NV.js → chunk-XSJ4SU63.js} +31 -31
- package/dist-cli/chunks/{chunk-T3PYVAO7.js → chunk-XT36ZR2H.js} +1 -1
- package/dist-cli/chunks/{chunk-BARR77SV.js → chunk-XU27QCRX.js} +1 -1
- package/dist-cli/chunks/{chunk-KJLLZQJO.js → chunk-YZ7BSNJJ.js} +2 -2
- package/dist-cli/chunks/{chunk-BVLKRIBN.js → chunk-Z6BJVYOU.js} +1 -1
- package/dist-cli/chunks/{chunk-FBKOSZKD.js → chunk-Z7J6LG53.js} +2 -2
- package/dist-cli/chunks/chunk-ZM4JL3VP.js +11 -0
- package/dist-cli/chunks/{compat-WZHG6K4B.js → compat-IC7P6QWF.js} +3 -3
- package/dist-cli/chunks/{config-E4ENAYVL.js → config-WVL2Y7UU.js} +2 -2
- package/dist-cli/chunks/control-7VDRDQXQ.js +2 -0
- package/dist-cli/chunks/{cpu-profile-5VX6YXR5.js → cpu-profile-FJIMZKXF.js} +2 -2
- package/dist-cli/chunks/{daemon-L4IR5GKS.js → daemon-TH7B22C4.js} +2 -2
- package/dist-cli/chunks/{debug-RPLWF66R.js → debug-MN6RXRJO.js} +3 -3
- package/dist-cli/chunks/demo-app-registry-ISNBFJTI.js +2 -0
- package/dist-cli/chunks/{detox-F4I7XDUZ.js → detox-BUJ3IOIB.js} +2 -2
- package/dist-cli/chunks/{device-DAHI737I.js → device-MUCGW2TT.js} +2 -2
- package/dist-cli/chunks/{diagnose-YR7GNYPN.js → diagnose-5NADXMRL.js} +2 -2
- package/dist-cli/chunks/drivers-RXVSKXUD.js +2 -0
- package/dist-cli/chunks/{electron-GC7AQHGS.js → electron-ON6434HQ.js} +3 -3
- package/dist-cli/chunks/flow-WI5MN76X.js +2 -0
- package/dist-cli/chunks/{hints-FPPTZ5A4.js → hints-23C3BW62.js} +2 -2
- package/dist-cli/chunks/{home-paths-6KKZMFRE.js → home-paths-DAI3XZLG.js} +2 -2
- package/dist-cli/chunks/{inspect-RDGBV7FC.js → inspect-UVS4UIJF.js} +91 -91
- package/dist-cli/chunks/install-QKH2JQGE.js +2 -0
- package/dist-cli/chunks/{install-desktop-NVXLOF4C.js → install-desktop-6BT3VL2C.js} +3 -3
- package/dist-cli/chunks/{keys-WUPEDL27.js → keys-4OT37H4C.js} +2 -2
- package/dist-cli/chunks/{launch-KIVZVX45.js → launch-2C3YGABQ.js} +3 -3
- package/dist-cli/chunks/{login-6VWSRHCZ.js → login-NWY5ENAT.js} +4 -4
- package/dist-cli/chunks/{logout-JASQH22U.js → logout-6BHGSVMN.js} +2 -2
- package/dist-cli/chunks/{maestro-UINOO5ZB.js → maestro-V7WIYUNE.js} +2 -2
- package/dist-cli/chunks/{preview-7QA7XGF4.js → preview-H2ACZ26A.js} +2 -2
- package/dist-cli/chunks/{profile-L43GQNI7.js → profile-ZLDFCIZA.js} +2 -2
- package/dist-cli/chunks/{react-4WDCAK7S.js → react-PEM4I7YB.js} +2 -2
- package/dist-cli/chunks/{record-VJGGKQBY.js → record-KVBDN3GC.js} +8 -7
- package/dist-cli/chunks/runtime-LLWAHSVR.js +2 -0
- package/dist-cli/chunks/{runtime-delivery-XQBDABU4.js → runtime-delivery-ECDTRILR.js} +2 -2
- package/dist-cli/chunks/{screenshot-N67LQOUY.js → screenshot-PJEMMFQO.js} +2 -2
- package/dist-cli/chunks/{screenshot-mode-EWTPX4XH.js → screenshot-mode-DKPHJONC.js} +2 -2
- package/dist-cli/chunks/{screenshots-WY27EWBW.js → screenshots-5UQ36N7Q.js} +2 -2
- package/dist-cli/chunks/{server-57MUO65L.js → server-LADTO7OS.js} +2 -2
- package/dist-cli/chunks/setup-repo-TXI7Q6F6.js +2 -0
- package/dist-cli/chunks/{skills-TDFRPGQ2.js → skills-FUN6M66H.js} +2 -2
- package/dist-cli/chunks/{start-TNY3DBAJ.js → start-A6FDAXGU.js} +4 -4
- package/dist-cli/chunks/store-KTDAA7SP.js +2 -0
- package/dist-cli/chunks/telemetry-VPFS3BGR.js +2 -0
- package/dist-cli/chunks/{test-N4RCDGFL.js → test-HPXQTADO.js} +3 -3
- package/dist-cli/chunks/{three-mode-YWFPU7KR.js → three-mode-2APCW2N7.js} +2 -2
- package/dist-cli/chunks/{timeline-OAZXNDFK.js → timeline-6D6V6LRX.js} +2 -2
- package/dist-cli/chunks/{upgrade-QUS553XV.js → upgrade-KZIO3ZJH.js} +2 -2
- package/dist-cli/chunks/upload-LDL3FZKD.js +2 -0
- package/dist-cli/chunks/{web-UR3EWC7V.js → web-MR4EQWCC.js} +2 -2
- package/dist-cli/chunks/{what-happened-6UNRX4BP.js → what-happened-FHQD42JV.js} +2 -2
- package/dist-cli/chunks/{whoami-I5VW66LS.js → whoami-GHNFMMK4.js} +2 -2
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.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 +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 +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +1 -1
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/index.cjs +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/vite-base.cjs +1 -1
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/dist-cli/chunks/auto-bootstrap-YCOWYMVV.js +0 -2
- package/dist-cli/chunks/beta-UF2ITPYH.js +0 -2
- package/dist-cli/chunks/chunk-5IJS7CFG.js +0 -117
- package/dist-cli/chunks/chunk-72GGPCB2.js +0 -2
- package/dist-cli/chunks/chunk-7VSW2XVU.js +0 -1
- package/dist-cli/chunks/chunk-A5EZYWAO.js +0 -1
- package/dist-cli/chunks/chunk-LRE73CBG.js +0 -1
- package/dist-cli/chunks/chunk-MDT2KSFY.js +0 -11
- package/dist-cli/chunks/chunk-PLTKWJ7M.js +0 -1
- package/dist-cli/chunks/control-USODFZCF.js +0 -2
- package/dist-cli/chunks/demo-app-registry-3SDEOEC4.js +0 -2
- package/dist-cli/chunks/drivers-FYOQW4OZ.js +0 -2
- package/dist-cli/chunks/flow-65752NAO.js +0 -2
- package/dist-cli/chunks/install-PA5K5XJ6.js +0 -2
- package/dist-cli/chunks/runtime-JM4WL6FX.js +0 -2
- package/dist-cli/chunks/setup-repo-6PKR67R6.js +0 -2
- package/dist-cli/chunks/store-LMNSJWN7.js +0 -2
- package/dist-cli/chunks/telemetry-7TOFRDK5.js +0 -2
- package/dist-cli/chunks/upload-OT5RQ4QV.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as P,b as v}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.46 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as P,b as v}from"./chunk-H46ZLTT5.js";import{d as j}from"./chunk-X7P3CGPY.js";import{a as b}from"./chunk-PAOOYAVI.js";import{execSync as A}from"child_process";import{existsSync as w,readFileSync as _,writeFileSync as x}from"fs";import{relative as B,resolve as d}from"path";import{existsSync as p,readFileSync as k,readdirSync as O,statSync as R}from"fs";import{basename as L,dirname as T,join as a}from"path";function D(e){let o=e;for(;;){if(p(a(o,"turbo.json"))||p(a(o,"nx.json"))||p(a(o,"lerna.json"))||p(a(o,"pnpm-workspace.yaml")))return o;let i=a(o,"package.json");if(p(i))try{if(JSON.parse(k(i,"utf8")).workspaces)return o}catch{}let r=T(o);if(r===o)break;o=r}return e}function W(e){return p(a(e,"bun.lock"))||p(a(e,"bun.lockb"))?"bun":p(a(e,"pnpm-lock.yaml"))?"pnpm":p(a(e,"yarn.lock"))?"yarn":"npm"}function J(e){if(p(a(e,"turbo.json")))return"turbo";if(p(a(e,"nx.json")))return"nx";if(p(a(e,"pnpm-workspace.yaml")))return"pnpm";let o=a(e,"package.json");if(p(o))try{if(JSON.parse(k(o,"utf8")).workspaces)return"npm-workspaces"}catch{}return"single"}function N(e){return e.one?"one":e.expo?"expo":e["react-native"]?"bare":"unknown"}function y(e){let o=a(e,"package.json");if(!p(o))return null;let i;try{i=JSON.parse(k(o,"utf8"))}catch{return null}let r={...i.dependencies,...i.devDependencies},s=N(r);return s==="unknown"?null:{dir:e,name:i.name||L(e),framework:s,hasViteConfig:p(a(e,"vite.config.ts"))||p(a(e,"vite.config.js")),hasMetroConfig:p(a(e,"metro.config.js"))||p(a(e,"metro.config.ts")),hasSootsimDependency:!!r.sootsim,devCommand:i.scripts?.dev||null}}function V(e){let o=[],i=a(e,"pnpm-workspace.yaml");if(p(i)){let t=k(i,"utf8").match(/packages:\s*\n((?:\s+-\s+.+\n?)+)/);if(t){let c=t[1].split(`
|
|
3
3
|
`).filter(Boolean);for(let n of c){let g=n.replace(/^\s*-\s*['"]?/,"").replace(/['"]?\s*$/,"");g&&o.push(...S(e,g))}}return o}let r=a(e,"package.json");if(p(r))try{let s=JSON.parse(k(r,"utf8")),t=Array.isArray(s.workspaces)?s.workspaces:s.workspaces?.packages||[];for(let c of t)o.push(...S(e,c))}catch{}return o}function S(e,o){let i=o.replace(/\/\*\*?$/,"").replace(/\*$/,""),r=a(e,i);if(!p(r))return[];try{return O(r).map(t=>a(r,t)).filter(t=>{try{return R(t).isDirectory()&&p(a(t,"package.json"))}catch{return!1}})}catch{return[]}}function M(e){let o=J(e),i=W(e);if(o==="single"){let c=y(e);return{root:e,type:o,packageManager:i,apps:c?[c]:[]}}let r=V(e),s=[],t=y(e);t&&s.push(t);for(let c of r){if(c===e)continue;let n=y(c);n&&s.push(n)}return{root:e,type:o,packageManager:i,apps:s}}function $(e){switch(e){case"bun":return"bun add -d sootsim";case"pnpm":return"pnpm add -D sootsim";case"yarn":return"yarn add -D sootsim";case"npm":return"npm install -D sootsim"}}async function ce(e){(e.includes("--help")||e.includes("-h"))&&(console.log(`
|
|
4
4
|
sootsim setup-repo \u2014 set up sootsim in your project
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{b as bs}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.46 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{b as bs}from"./chunk-GWOV6KFE.js";var oi=`(async () => {
|
|
3
3
|
try { localStorage.clear() } catch {}
|
|
4
4
|
try { sessionStorage.clear() } catch {}
|
|
5
5
|
try {
|
|
@@ -172,5 +172,5 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
172
172
|
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",r=[];if(i&&t.sep&&!t.value){let o=[];for(let a=0;a<t.sep.length;++a){let l=t.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):i||t.value?(r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ge(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(un(t.key)&&!ge(t.sep,"newline")){let o=Ke(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(ge(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=Ke(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||i?e.items.push({start:r,key:null,sep:[this.sourceToken]}):ge(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);i||t.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!ge(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||ge(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=Kt(n),r=Ke(i);fn(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
173
173
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
174
174
|
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Kt(e),n=Ke(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Kt(e),n=Ke(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function hn(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new Be||null,prettyErrors:e}}function pn(s,e={}){let{lineCounter:t,prettyErrors:n}=hn(e),i=new we(t?.addNewLine),r=new be(e),o=Array.from(r.compose(i.parse(s)));if(n&&t)for(let a of o)a.errors.forEach(We(s,t)),a.warnings.forEach(We(s,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function us(s,e={}){let{lineCounter:t,prettyErrors:n}=hn(e),i=new we(t?.addNewLine),r=new be(e),o=null;for(let a of r.compose(i.parse(s),!0,s.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new x(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(We(s,t)),o.warnings.forEach(We(s,t))),o}function mn(s,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);let i=us(s,t);if(!i)return null;if(i.warnings.forEach(r=>ht(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},t))}function dn(s,e,t){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let i=Math.round(t);t=i<1?void 0:i>8?{indent:8}:{indent:i}}if(s===void 0){let{keepUndefined:i}=t??e??{};if(!i)return}return R(s)&&!n?s.toString(t):new se(s,n,t).toString(t)}var gn=hs;import{existsSync as ei,mkdirSync as yn,readFileSync as ti,rmSync as ps,writeFileSync as bn}from"fs";import{tmpdir as si}from"os";import{dirname as wn,join as ni,resolve as Sn}from"path";var ms=1;function jt(){return Sn(process.env.SOOTSIM_FLOW_SESSION_PATH||ni(si(),"sootsim-flow-session.json"))}function ds(s){let e=jt();yn(wn(e),{recursive:!0}),bn(e,JSON.stringify(s,null,2)+`
|
|
175
|
-
`)}function gs(){let s=jt();if(!ei(s))return null;try{let e=JSON.parse(ti(s,"utf8"));return e.version!==ms||!Array.isArray(e.steps)||typeof e.startedAt!="string"||typeof e.updatedAt!="string"?(ps(s,{force:!0}),null):{version:ms,startedAt:e.startedAt,updatedAt:e.updatedAt,steps:e.steps,candidate:e.candidate??null}}catch{return ps(s,{force:!0}),null}}function Rc(){let s=new Date().toISOString(),e={version:ms,startedAt:s,updatedAt:s,steps:[],candidate:null};return ds(e),{path:jt(),state:e}}function ii(){ps(jt(),{force:!0})}function Uc(){ii()}function Vc(s){let e=gs();if(!e)return{active:!1};let t={...e,updatedAt:new Date().toISOString(),candidate:{step:s.step,summary:s.summary,source:s.source,recordedAt:new Date().toISOString()}};return ds(
|
|
175
|
+
`)}function gs(){let s=jt();if(!ei(s))return null;try{let e=JSON.parse(ti(s,"utf8"));return e.version!==ms||!Array.isArray(e.steps)||typeof e.startedAt!="string"||typeof e.updatedAt!="string"?(ps(s,{force:!0}),null):{version:ms,startedAt:e.startedAt,updatedAt:e.updatedAt,steps:e.steps,candidate:e.candidate??null}}catch{return ps(s,{force:!0}),null}}function Rc(){let s=new Date().toISOString(),e={version:ms,startedAt:s,updatedAt:s,steps:[],candidate:null};return ds(e),{path:jt(),state:e}}function ii(){ps(jt(),{force:!0})}function Uc(){ii()}function Vc(s){let e=gs();if(!e)return{active:!1};let t=e.candidate,n={...e,updatedAt:new Date().toISOString(),candidate:{step:s.step,summary:s.summary,source:s.source,recordedAt:new Date().toISOString()}};return ds(n),{active:!0,candidate:n.candidate,replaced:t}}function Jc(){let s=gs();if(!s)return{active:!1,kept:!1,reason:"no-session"};if(!s.candidate)return{active:!0,kept:!1,reason:"no-candidate"};let e=s.candidate,t={...s,updatedAt:new Date().toISOString(),steps:[...s.steps,e.step],candidate:null};return ds(t),{active:!0,kept:!0,candidate:e,stepCount:t.steps.length}}function ri(s){return gn.stringify(s).trimEnd()+`
|
|
176
176
|
`}function Yc(s){let e=gs();if(!e)return{active:!1};let t=ri(e.steps),n=null;return s&&(n=Sn(s),yn(wn(n),{recursive:!0}),bn(n,t)),{active:!0,yaml:t,stepCount:e.steps.length,outputPath:n}}export{oi as a,gn as b,Rc as c,Uc as d,Vc as e,Jc as f,Yc as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! sootsim v0.1.46 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! sootsim v0.1.46 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.46 | (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};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{c as l,e as d,h as c}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.46 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{c as l,e as d,h as c}from"./chunk-DGAHFMAU.js";function g(n){let e=n[0]?.toLowerCase()??"toggle";return e!=="on"&&e!=="off"&&e!=="toggle"&&(console.error(` unknown argument: "${e}" (expected on | off | toggle)`),process.exit(1)),e}async function u(n,e,o){let s=l(n,{port:e.port}),a=g(s.positional),r=d({...s,commandTimeoutMs:5e3});try{let i=!!(await c(r,"SootSim.bridges.settings.get"))?.[o.modeKey],t=a==="on"?!0:a==="off"?!1:!i;if(i===t){console.log(` ${o.displayName}: already ${t?"on":"off"}`);return}if(!await r.send({type:"evaluate",acquireLock:!0,code:`(async () => {
|
|
3
3
|
const modeKey = ${JSON.stringify(o.modeKey)}
|
|
4
4
|
const target = ${JSON.stringify(t)}
|
|
5
5
|
window.dispatchEvent(new CustomEvent('sootsim:shell-command', {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{l as c}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.46 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{l as c}from"./chunk-M5HZVUQQ.js";import{chmodSync as m,existsSync as g,mkdirSync as k,readFileSync as A,rmSync as i,writeFileSync as y}from"node:fs";import{dirname as l,join as D,resolve as p}from"node:path";var s=1,S="SOOTSIM_SHARED_AUTH_FILE",u="https://sootbean.com";function v(){let t=process.env[S];return t?.trim()?l(p(t)):c()}function a(){let t=process.env[S];return t?.trim()?p(t):D(v(),"desktop-auth.json")}function f(t){if(!t||typeof t!="object")return null;let e=t;return typeof e.id!="string"||!e.id.trim()?null:{id:e.id.trim(),name:typeof e.name=="string"?e.name:void 0,email:typeof e.email=="string"?e.email:void 0,image:typeof e.image=="string"?e.image:void 0}}function w(t){if(!t||typeof t!="object")return null;let e=t;if(e.version!==s||typeof e.token!="string"||!e.token.trim())return null;let r=typeof e.origin=="string"&&e.origin.trim()?e.origin.trim():u,n=e.source==="cli"||e.source==="electron"||e.source==="browser"||e.source==="unknown"?e.source:"unknown",o=typeof e.updatedAt=="string"&&e.updatedAt?e.updatedAt:new Date().toISOString(),h=typeof e.validatedAt=="string"&&e.validatedAt?e.validatedAt:void 0;return{version:s,token:e.token.trim(),user:f(e.user),origin:r,source:n,updatedAt:o,validatedAt:h}}function O(){let t=a();if(!g(t))return null;try{let e=JSON.parse(A(t,"utf8")),r=w(e);return r||(i(t,{force:!0}),null)}catch{return i(t,{force:!0}),null}}function I(t){let e=a();k(l(e),{recursive:!0});let r={version:s,token:t.token.trim(),user:t.user?f(t.user):null,origin:t.origin?.trim()||u,source:t.source,updatedAt:t.updatedAt||new Date().toISOString(),validatedAt:t.validatedAt};y(e,JSON.stringify(r,null,2)+`
|
|
3
3
|
`);try{m(e,384)}catch{}return r}function d(){i(a(),{force:!0})}async function N(t){let e=O();if(!e?.token)return null;let r=t||e.origin||u;try{let n=await fetch(`${r.replace(/\/$/,"")}/api/auth/me`,{headers:{authorization:`Bearer ${e.token}`}});if(n.status===401)return d(),null;if(!n.ok)return e;let o=await n.json();return o.user?.id?I({token:e.token,user:o.user,origin:r,source:e.source,validatedAt:new Date().toISOString()}):(d(),null)}catch{return e}}export{O as a,I as b,d as c,N as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.46 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import{existsSync as C,mkdirSync as D,readFileSync as O,rmSync as s,writeFileSync as g}from"fs";import{tmpdir as P}from"os";import{dirname as R,join as A,resolve as x}from"path";import{execFileSync as a}from"child_process";import{readFileSync as I}from"fs";import{createRequire as S}from"module";var o=null;function u(r){o||(o=_());try{return o(r)}catch{return null}}function _(){let r=Number(process.env.PPID);if(Number.isFinite(r)&&r>1&&r!==process.ppid)return()=>r;if(process.platform==="linux")return y();if(process.platform==="darwin"){let n=E();return n||T()}return()=>null}function y(){return r=>{try{let n=I(`/proc/${r}/stat`,"utf8"),t=n.lastIndexOf(")");if(t<0)return null;let i=n.slice(t+1).trim().split(/\s+/),e=Number(i[1]);return Number.isFinite(e)&&e>0?e:null}catch{return null}}}var N=3,d=216,b=16;function E(){if(!process.versions?.bun)return null;try{let r=S(import.meta.url),{dlopen:n,FFIType:t}=r("bun:ffi"),i=n("/usr/lib/libproc.dylib",{proc_pidinfo:{args:[t.i32,t.i32,t.u64,t.ptr,t.i32],returns:t.i32}}),e=Buffer.alloc(d);return m=>{if(Number(i.symbols.proc_pidinfo(m,N,0n,e,d))<=0)return null;let p=e.readUInt32LE(b);return p>0?p:null}}catch{return null}}function T(){return r=>{try{let t=a("lsof",["-R","-p",String(r),"-d","cwd","-a"],{encoding:"utf8",timeout:2e3,stdio:["ignore","pipe","ignore"]}).split(`
|
|
3
3
|
`)[1];if(!t)return null;let i=t.trim().split(/\s+/),e=Number(i[2]);return Number.isFinite(e)&&e>1?e:null}catch{return null}}}var c=1,f="SOOTSIM_CLI_CURRENT_SIM_PATH",v=["SOOTSIM_CLI_IDENTITY","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","TERM_SESSION_ID","ITERM_SESSION_ID","TMUX_PANE","STY","KITTY_WINDOW_ID","WEZTERM_PANE","ALACRITTY_WINDOW_ID","WINDOWID","VSCODE_INJECTION"];function F(r,n=20){let t=u(r);if(!t||t<=1)return null;for(let i=0;i<n;i++){let e=u(t);if(!e||e<=1)return t;t=e}return t}function k(){for(let n of v){let t=process.env[n];if(t&&t.trim())return{key:`${n}:${t.trim()}`,source:n,stable:!0}}let r=F(process.ppid);return r&&r>1?{key:`gppid-${r}`,source:"grand-ppid",stable:!0}:{key:`pid-${process.ppid}`,source:"ppid",stable:!1}}function L(){return k().key}function l(){if(process.env[f])return x(process.env[f]);let r=L();return A(P(),`sootsim-current-sim-${r}.json`)}function h(){let r=l();if(!C(r))return null;try{let n=JSON.parse(O(r,"utf8"));return n.version!==c||typeof n.simId!="string"||!n.simId.trim()||typeof n.updatedAt!="string"?(s(r,{force:!0}),null):{version:c,simId:n.simId.trim(),updatedAt:n.updatedAt}}catch{return s(r,{force:!0}),null}}function J(){return h()?.simId||null}function j(r){let n=r.trim();if(!n)return;let t=l();D(R(t),{recursive:!0}),g(t,JSON.stringify({version:c,simId:n,updatedAt:new Date().toISOString()},null,2)+`
|
|
4
4
|
`)}function K(){s(l(),{force:!0})}export{k as a,L as b,J as c,j as d,K as e};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as l}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.46 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as l}from"./chunk-DGAHFMAU.js";import{E as u,F as c,g as p,i as h,z as w}from"./chunk-M5HZVUQQ.js";import{closeSync as v,existsSync as f,openSync as P,readSync as S,statSync as g}from"fs";import{homedir as k}from"os";import{resolve as T}from"path";import{WebSocket as D}from"ws";var E=6e4;async function L(){let t=w();if(t&&f(h(t)))return;console.log(" first run \u2014 installing sootsim engine runtime (~6 MB)...");let{runRuntime:e}=await import("./runtime-LLWAHSVR.js");await e(["install"],{})}function I(t,e){return x(t)??e??l()}async function $(t=l(),e=E){if(await m(t,250))return;let n=u();if(n&&c(n)){if(n.bootstrapping===!0&&(await b(e),await m(n.bridgePort,500)))return;throw new Error(`sootsim daemon lockfile is fresh (port ${n.bridgePort}) but the bridge is not reachable. run \`sootsim daemon restart\` or \`sootsim daemon uninstall\`.`)}if(p())throw new Error(`sootsim bridge daemon is not running on port ${t}.
|
|
3
3
|
dev checkouts skip the auto-install of the persistent launchd / systemd
|
|
4
4
|
agent. start the daemon manually in another shell with:
|
|
5
5
|
bun sootsim server
|
|
6
|
-
(set SOOTSIM_FORCE_DAEMON_INSTALL=1 to allow auto-install from this repo.)`);console.log(" registering sootsim bridge daemon...");let{daemonInstall:o}=await import("./daemon-
|
|
6
|
+
(set SOOTSIM_FORCE_DAEMON_INSTALL=1 to allow auto-install from this repo.)`);console.log(" registering sootsim bridge daemon...");let{daemonInstall:o}=await import("./daemon-TH7B22C4.js");try{await o({port:t,force:!0})}catch(r){let s=r instanceof Error?r.message:String(r);throw new Error(`${s}
|
|
7
7
|
if this keeps failing, run \`sootsim daemon uninstall\` and retry, or run \`sootsim server\` in a persistent shell as a workaround.`)}console.log(" waiting for runtime to come online...");let i=process.platform==="darwin"?B():null;try{await b(e);let r=Date.now()+5e3;for(;Date.now()<r;){if(await m(t,500))return;await new Promise(s=>setTimeout(s,200))}throw new Error(`daemon registered but the bridge never bound on port ${t} \u2014 see ${d()} (mac) or \`journalctl --user -u sootsim-server\` (linux).`)}finally{i?.stop()}}async function C(t=l()){await L(),await $(t)}function x(t){for(let e=0;e<t.length;e++){let n=t[e];if((n==="--port"||n==="-p")&&t[e+1]){let o=Number(t[e+1]);return Number.isFinite(o)?o:void 0}if(n.startsWith("--port=")){let o=Number(n.slice(7));return Number.isFinite(o)?o:void 0}}}function m(t,e){return new Promise(n=>{let o=new D(`ws://127.0.0.1:${t}`,{handshakeTimeout:e}),i=!1,r=s=>{if(!i){i=!0;try{o.close()}catch{}n(s)}};o.once("open",()=>r(!0)),o.once("error",()=>r(!1)),setTimeout(()=>r(!1),e)})}async function b(t){let e=Date.now()+t,n;for(;Date.now()<e;){let o=u();if(o&&c(o)){if(o.bootstrapping!==!0)return;o.bootstrapping!==n&&(n=o.bootstrapping)}await new Promise(i=>setTimeout(i,250))}throw new Error(`daemon did not finish bootstrapping within ${Math.round(t/1e3)}s \u2014 check ${d()} (mac) or \`journalctl --user -u sootsim-server\` (linux).`)}function d(){return T(k(),"Library/Logs/sootsim/server.err.log")}function B(){let t=d(),e=0;try{f(t)&&(e=g(t).size)}catch{}let n=!1,o=()=>{if(!n){try{if(f(t)){let i=g(t).size;if(i>e){let r=Buffer.alloc(i-e),s=P(t,"r");try{S(s,r,0,r.length,e)}finally{v(s)}e=i;for(let y of r.toString("utf8").split(/\r?\n/)){let a=y.trim();a&&(a.startsWith("sootsim:")||a.startsWith("sootsim "))&&console.log(` ${a}`)}}else i<e&&(e=i)}}catch{}setTimeout(o,250)}};return o(),{stop:()=>{n=!0}}}export{L as a,I as b,$ as c,C as d};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{l as P,n as a,y as m}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.46 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{l as P,n as a,y as m}from"./chunk-M5HZVUQQ.js";import l from"fs";import c from"path";var s="default",S="profiles.json",i=1;function o(e){let r=e.trim();if(!r)throw new Error("profile id is required");if(!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(r))throw new Error("profile ids must start with a letter or number and contain only letters, numbers, dot, dash, or underscore");if(r==="."||r==="..")throw new Error(`invalid profile id: ${r}`);return r}function d(){return c.join(a(),S)}function I(e){return`sootsim-profile-${o(e)}`}function h(e){return c.join(P(),"Partitions",I(e))}function A(e){return c.join(a(),"playwright",o(e))}function u(){try{let e=JSON.parse(l.readFileSync(d(),"utf8"));if(!e||e.version!==i)return{version:i,profiles:[]};let r=Array.isArray(e.profiles)?e.profiles.filter(t=>!!t&&typeof t.id=="string"&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string").map(t=>({id:o(t.id),createdAt:t.createdAt,updatedAt:t.updatedAt})):[];return{version:i,profiles:r}}catch{return{version:i,profiles:[]}}}function x(e){return[...e].sort((r,t)=>r.id===s?-1:t.id===s?1:r.id.localeCompare(t.id))}function p(e){if(e.profiles.some(t=>t.id===s))return{...e,profiles:x(e.profiles)};let r=new Date().toISOString();return{version:i,profiles:x([{id:s,createdAt:r,updatedAt:r},...e.profiles])}}function g(e){m();let r=p(e),t=`${d()}.tmp`;return l.writeFileSync(t,`${JSON.stringify(r,null,2)}
|
|
3
3
|
`,"utf8"),l.renameSync(t,d()),r}function y(){return g(u()).profiles}function E(e){let r=o(e);return y().find(t=>t.id===r)??null}function _(e=s){let r=o(e),t=E(r);return t||D(r)}function D(e){let r=o(e),t=p(u());if(t.profiles.some(w=>w.id===r))throw new Error(`profile already exists: ${r}`);let f=new Date().toISOString(),n={id:r,createdAt:f,updatedAt:f};return g({version:i,profiles:[...t.profiles,n]}),n}function F(e){let r=o(e);if(r===s)throw new Error("the default profile cannot be deleted; clear it instead");let t=p(u()),f=t.profiles.find(n=>n.id===r);if(!f)throw new Error(`profile not found: ${r}`);return g({version:i,profiles:t.profiles.filter(n=>n.id!==r)}),v(r),f}function v(e){let r=o(e);for(let t of[h(r),A(r)])try{l.rmSync(t,{recursive:!0,force:!0})}catch{}}export{A as a,y as b,_ as c,D as d,F as e,v as f};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as ye}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.46 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as ye}from"./chunk-OZICEBUA.js";import{a as be}from"./chunk-FLJAN5PS.js";import{a as Se}from"./chunk-Z7J6LG53.js";import{a as V,b as M,c as pe,d as Y,f as G,g as fe}from"./chunk-SG7ICXM2.js";import{f as ge,l as he}from"./chunk-ZM4JL3VP.js";import{b as me}from"./chunk-PEXPACO5.js";import{a as we}from"./chunk-XU27QCRX.js";import{a as ve}from"./chunk-PKVNCXQD.js";import{f as ae}from"./chunk-QXJR74QV.js";import{c as q,d as de,e as ue}from"./chunk-DGAHFMAU.js";import{c as ce}from"./chunk-WWEMLI77.js";import{a as le,b as z}from"./chunk-PAOOYAVI.js";import*as $ from"fs";import{tmpdir as $e}from"os";import*as h from"path";import*as w from"fs";import*as f from"path";var U=1e4,B=393,C=852,xe="__sootsimCliPerf",Ne="maestroCopiedText",Z=new Map;function p(i){return new Promise(e=>setTimeout(e,i))}function De(i){return i?f.basename(i)===".maestro"?f.dirname(i):i:process.cwd()}function Re(i,e,t){let r=e.endsWith(".png")?e:`${e}.png`;if(f.isAbsolute(r))return r;if(t.mode==="flow"&&/[\\/]/.test(r)){let o=r.startsWith("./")||r.startsWith("../")?t.flowDir??process.cwd():De(t.flowDir);return f.resolve(o,r)}return f.join(i,r)}function Ve(i){if(typeof i=="string")return{path:i,withFrame:!1};let e=i.path?.trim()||i.name?.trim();if(!e)throw new Error("takeScreenshot object form requires path or name");return{path:e,withFrame:i.withFrame===!0}}function X(i){let[e,t]=i.split(",").map(o=>o.trim()),r=(o,n)=>o.endsWith("%")?Number.parseFloat(o)/100*n:Number.parseFloat(o);return{x:r(e,B),y:r(t,C)}}function Q(i){return typeof i=="string"?i.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,(e,t)=>{if(Z.has(t))return Z.get(t);let r=process.env[t];if(r===void 0)throw new Error(`missing environment variable for flow placeholder: ${t}`);return r}):Array.isArray(i)?i.map(e=>Q(e)):i&&typeof i=="object"?Object.fromEntries(Object.entries(i).map(([e,t])=>[e,Q(t)])):i}function Ue(i){let e=i.split(/^---$/m),t=e.length>1?e[e.length-1]:i,r=Q(M.parse(t));return Array.isArray(r)?r:[]}var L=class{constructor(e,t){this.bridge=e;this.opts=t}stepDelay=0;firstLaunchDone=!1;profilingEnabled=!1;recordingEnabled=!1;recordingAccessChecked=!1;recordingStartedAtMs=null;lastRecordingDurationMs=null;simRouteHint=null;lastFailedStep=null;get simId(){return this.opts.simId}setSimRouteHint(e){this.simRouteHint=this.normalizeSimRoute(e)}normalizeSimRoute(e){if(!e)return null;try{let t=new URL(e);t.searchParams.delete("inspectOpen");let r=t.searchParams.toString();return`${t.origin}${t.pathname}${r?`?${r}`:""}`}catch{return e}}async refreshSimId(){if(this.opts.simId)try{let e=await this.bridge.listSims(),t=e.find(l=>l.id===this.opts.simId);if(t&&(this.simRouteHint=this.normalizeSimRoute(t.url||t.origin)),e.find(l=>l.id===this.opts.simId&&l.readyState==="open")||!this.simRouteHint)return;let o=this.simRouteHint&&e.find(l=>l.readyState==="open"&&this.normalizeSimRoute(l.url||l.origin)===this.simRouteHint);if(!o)return;let n=e.find(l=>l.isPrimary&&l.readyState==="open"),s=e.find(l=>l.readyState==="open"),a=o??n??s;a&&(this.opts.simId=a.id,console.log(` [flow] sim rotated to ${a.id}`))}catch{}}async evaluate(e){return this.bridge.send({type:"evaluate",simId:this.opts.simId,code:e})}async callTest(e,...t){return this.bridge.send({type:"call",simId:this.opts.simId,path:`__sootsimTest.${e}`,args:t})}async waitForTree(e=U){let t=Date.now()+e,r=null;for(;Date.now()<t;){try{let o=await this.evaluate(`(async () => {
|
|
3
3
|
const test = window.__sootsimTest
|
|
4
4
|
if (!test) return { count: 0, loading: true }
|
|
5
5
|
const count = (await test.getNodeCount?.()) || 0
|
|
@@ -19,12 +19,12 @@ import{a as ye}from"./chunk-ECI22OZU.js";import{a as be}from"./chunk-2V4ALWOZ.js
|
|
|
19
19
|
const openingAppNode = await test.findByText?.('opening app')
|
|
20
20
|
const isLoading = !!loadingNode || !!capturingNode || !!openingAppNode || count < 5
|
|
21
21
|
return { count, loading: isLoading, error: null }
|
|
22
|
-
})()`);if(
|
|
22
|
+
})()`);if(o?.error)throw new Error(`app failed to load: ${o.error}`);if(o&&o.count>10&&!o.loading)return}catch(o){r=o instanceof Error?o:new Error(String(o)),await this.refreshSimId()}await p(500)}throw r?.message.startsWith("app failed to load:")?r:new Error(`app not ready after ${e}ms`)}async ensureRecordingStarted(){if(!this.opts.recordingOutputDir)throw new Error("recording output directory not configured");this.recordingAccessChecked||(await Se("flow --video",{originOverride:this.opts.billingOriginOverride,allowGitHubAuth:this.opts.allowGitHubRecording}),this.recordingAccessChecked=!0);let e=Date.now(),t=await this.evaluate(`(() => {
|
|
23
23
|
const rec = window.__sootsimRecorder
|
|
24
24
|
if (!rec) return { ok: false, error: 'recorder unavailable on this page' }
|
|
25
25
|
if (rec.state() === 'recording') return { ok: true, format: 'webm' }
|
|
26
26
|
return rec.start({ format: 'webm', fps: 24 })
|
|
27
|
-
})()`);if(!t?.ok)throw new Error(t?.error||"recording unavailable on this page");this.recordingStartedAtMs||(this.recordingStartedAtMs=e)}async startRecording(){this.recordingEnabled=!0,await this.ensureRecordingStarted()}prepareRecording(){this.recordingEnabled=!0}getLastRecordingDurationMs(){return this.lastRecordingDurationMs}async stopRecording(){if(!this.recordingEnabled||!this.opts.recordingOutputDir)return null;this.recordingEnabled=!1;let e=Date.now(),t=await this.evaluate("window.__sootsimRecorder.stop()");if(!t?.ok)throw this.recordingStartedAtMs=null,new Error(t?.error||"recording stop failed");this.lastRecordingDurationMs=this.recordingStartedAtMs?Math.max(1,e-this.recordingStartedAtMs):null,this.recordingStartedAtMs=null;let r=[],
|
|
27
|
+
})()`);if(!t?.ok)throw new Error(t?.error||"recording unavailable on this page");this.recordingStartedAtMs||(this.recordingStartedAtMs=e)}async startRecording(){this.recordingEnabled=!0,await this.ensureRecordingStarted()}prepareRecording(){this.recordingEnabled=!0}getLastRecordingDurationMs(){return this.lastRecordingDurationMs}async stopRecording(){if(!this.recordingEnabled||!this.opts.recordingOutputDir)return null;this.recordingEnabled=!1;let e=Date.now(),t=await this.evaluate("window.__sootsimRecorder.stop()");if(!t?.ok)throw this.recordingStartedAtMs=null,new Error(t?.error||"recording stop failed");this.lastRecordingDurationMs=this.recordingStartedAtMs?Math.max(1,e-this.recordingStartedAtMs):null,this.recordingStartedAtMs=null;let r=[],o=0;for(;;){let s=await this.evaluate(`window.__sootsimRecorder.getBlobBase64({ offset: ${o}, chunk: 2097152 })`);if(!s||(r.push(Buffer.from(s.data,"base64")),o=s.offset,s.done))break}if(r.length===0)throw new Error("recording requested but no video buffer was produced");w.mkdirSync(this.opts.recordingOutputDir,{recursive:!0});let n=f.join(this.opts.recordingOutputDir,`sootsim-${Date.now()}.webm`);return w.writeFileSync(n,Buffer.concat(r)),n}async findElement(e){return this.evaluate(`(async () => {
|
|
28
28
|
const test = window.__sootsimTest
|
|
29
29
|
if (!test) return null
|
|
30
30
|
let node = null
|
|
@@ -88,18 +88,18 @@ import{a as ye}from"./chunk-ECI22OZU.js";import{a as be}from"./chunk-2V4ALWOZ.js
|
|
|
88
88
|
)
|
|
89
89
|
}
|
|
90
90
|
return direct
|
|
91
|
-
})()`)}async tap(e,t){return await this.bridge.send({type:"tap",simId:this.opts.simId,x:e,y:t})}async tapOn(e){let t=typeof e=="string"?{text:e}:e;if(t.point){let
|
|
91
|
+
})()`)}async tap(e,t){return await this.bridge.send({type:"tap",simId:this.opts.simId,x:e,y:t})}async tapOn(e){let t=typeof e=="string"?{text:e}:e;if(t.point){let l=X(t.point);(await this.activatePressAt(l.x,l.y))?.ok||await this.tap(l.x,l.y),await p(300);return}let r=5e3,o=150,n=Date.now()+r,s=await this.findElement({text:t.text,id:t.id});for(;!s&&Date.now()<n;)await p(o),s=await this.findElement({text:t.text,id:t.id});if(s&&!s.isTextInput&&(await this.activatePressTarget(t))?.ok){await p(300);return}if(s){let l=typeof s.nodeId=="number"?await this.resolveTapTarget(s.nodeId):null,m=l?.cx??s.absolutePosition.x+s.layout.width/2,g=l?.cy??s.absolutePosition.y+s.layout.height/2;if((await this.tap(m,g))?.hit!==!1){await p(300);return}}if((await this.activatePressTarget(t))?.ok){await p(300);return}throw new Error(`tapOn: element not found: ${JSON.stringify(t)}`)}async tapAtCoords(e,t){await this.tap(e,t),await p(300)}async doubleTapAtCoords(e,t,r=80){let o=Math.max(0,Math.round(r));if(!await this.evaluate(`(async () => {
|
|
92
92
|
const interact = window.__sootsimInteract
|
|
93
93
|
if (interact?.doubleTap) {
|
|
94
|
-
return !!(await interact.doubleTap(${e}, ${t}, ${
|
|
94
|
+
return !!(await interact.doubleTap(${e}, ${t}, ${o}))
|
|
95
95
|
}
|
|
96
96
|
if (!interact?.tap) return false
|
|
97
97
|
const first = await interact.tap(${e}, ${t})
|
|
98
98
|
if (!first || first.hit === false) return false
|
|
99
|
-
await new Promise((resolve) => setTimeout(resolve, ${
|
|
99
|
+
await new Promise((resolve) => setTimeout(resolve, ${o}))
|
|
100
100
|
const second = await interact.tap(${e}, ${t})
|
|
101
101
|
return !!second && second.hit !== false
|
|
102
|
-
})()`))throw new Error(`doubleTapAtCoords failed at (${e}, ${t})`);await
|
|
102
|
+
})()`))throw new Error(`doubleTapAtCoords failed at (${e}, ${t})`);await p(300)}async assertVisible(e){let t=typeof e=="string"?{text:e}:e;for(let r=0;r<15;r++){if(await this.isElementVisible(t))return;await p(200)}throw new Error(`assertVisible: ${JSON.stringify(t)} not found or off-screen`)}async assertNotVisible(e){let t=typeof e=="string"?{text:e}:e;if(await this.isElementVisible(t))throw new Error(`assertNotVisible: ${JSON.stringify(t)} IS visible`)}async isElementVisible(e){let t=await this.findElement(e);return!!(t&&t.absolutePosition.y+t.layout.height>0&&t.absolutePosition.y<C)}async inputText(e){await this.bridge.send({type:"keyboard",simId:this.opts.simId,action:"type",text:e}),await p(200)}async pressKey(e){await this.bridge.send({type:"keyboard",simId:this.opts.simId,action:"press",text:e}),await p(120)}async dispatchKey(e){await this.bridge.send({type:"keyboard",simId:this.opts.simId,action:"dispatchKey",text:e}),await p(120)}async hideKeyboard(){try{await this.callTest("blurFocusedTextInput")}catch{}await this.bridge.send({type:"keyboard",simId:this.opts.simId,action:"dismiss"});let e=Date.now()+3e3;for(;Date.now()<e;){let t=await this.evaluate(`(() => {
|
|
103
103
|
const keyboard =
|
|
104
104
|
window.__sootsimKeyboard ??
|
|
105
105
|
window.SootSim?.bridges?.keyboard ??
|
|
@@ -109,7 +109,7 @@ import{a as ye}from"./chunk-ECI22OZU.js";import{a as be}from"./chunk-2V4ALWOZ.js
|
|
|
109
109
|
visible: !!keyboard?.isVisible?.(),
|
|
110
110
|
focused: !!test?.isTextInputFocused?.(),
|
|
111
111
|
}
|
|
112
|
-
})()`);if(!t?.visible&&!t?.focused){await
|
|
112
|
+
})()`);if(!t?.visible&&!t?.focused){await p(80);return}await p(80)}}async eraseText(e){for(let t=0;t<e;t++)await this.pressKey("Backspace");await p(100)}async waitFor(e){let t=Date.now()+(e.timeout||U);for(;Date.now()<t;){if(await this.findElement(e))return;await p(200)}throw new Error(`waitFor: ${JSON.stringify(e)} not found after ${e.timeout||U}ms`)}async takeScreenshot(e){await p(250);let t=Ve(e),r=Re(this.opts.screenshotDir,t.path,{mode:this.opts.screenshotPathMode??"dir",flowDir:this.opts.flowDir});w.mkdirSync(f.dirname(r),{recursive:!0});let n=(await this.bridge.send({type:"screenshot",simId:this.opts.simId})).replace(/^data:image\/png;base64,/,""),s=Buffer.from(n,"base64");if(t.withFrame){let a=await this.readCurrentDeviceModel();if(!a)throw new Error("could not read current device model for framed screenshot");let l=await be(s,a);w.writeFileSync(r,l),console.log(`[flow] screenshot: ${r} (frame: ${a})`);return}w.writeFileSync(r,s),console.log(`[flow] screenshot: ${r}`)}async readCurrentDeviceModel(){let e=await this.bridge.send({type:"call",simId:this.opts.simId,path:"SootSim.bridges.settings.get",args:[]}),t=e&&typeof e.deviceModel=="string"?e.deviceModel:null;return!t||!(t in ae)?null:t}async captureFailureScreenshot(e){w.mkdirSync(f.dirname(e),{recursive:!0});let r=(await this.bridge.send({type:"screenshot",simId:this.opts.simId})).replace(/^data:image\/png;base64,/,"");w.writeFileSync(e,Buffer.from(r,"base64"))}async captureFailureBundle(e,t){w.mkdirSync(e,{recursive:!0});let r=(m,g)=>{try{w.writeFileSync(f.join(e,m),g)}catch{}},o=async m=>{try{return await this.bridge.send({type:"evaluate",simId:this.opts.simId,code:m})}catch{return null}};r("error.json",JSON.stringify({message:t.error.message,stack:t.error.stack,stepIndex:t.stepIndex,stepKind:t.stepKind,stepTarget:t.stepTarget,capturedAt:new Date().toISOString()},null,2));try{let g=(await this.bridge.send({type:"screenshot",simId:this.opts.simId})).replace(/^data:image\/png;base64,/,"");r("screenshot.png",Buffer.from(g,"base64"))}catch{}let n=await o(`(async () => {
|
|
113
113
|
const t = window.__sootsimTest
|
|
114
114
|
const mainShell = window.SootSim?.bridges?.mainShell
|
|
115
115
|
if (!t) return { error: 'no test bridge' }
|
|
@@ -119,19 +119,19 @@ import{a as ye}from"./chunk-ECI22OZU.js";import{a as be}from"./chunk-2V4ALWOZ.js
|
|
|
119
119
|
} catch {}
|
|
120
120
|
const all = await t.queryAll({ pruneHidden: true })
|
|
121
121
|
return { shell, nodes: all, url: location.href, title: document.title }
|
|
122
|
-
})()`);n&&r("describe.json",JSON.stringify(n,null,2));let s=await
|
|
122
|
+
})()`);n&&r("describe.json",JSON.stringify(n,null,2));let s=await o("(async () => await window.__sootsimTest?.dumpAccessibilityTree?.(20))()");typeof s=="string"&&r("a11y.txt",s);let a=await o("(async () => await window.__sootsimTest?.dumpTree?.(15))()");typeof a=="string"&&r("tree.txt",a);let l=await o(`(() => {
|
|
123
123
|
const c = window.__sootsimConsole
|
|
124
124
|
return {
|
|
125
125
|
errors: c?.getErrors?.() ?? [],
|
|
126
126
|
warnings: c?.getWarnings?.() ?? [],
|
|
127
127
|
requests: (window.__sootsimGetFailedRequests?.() ?? []),
|
|
128
128
|
}
|
|
129
|
-
})()`);return
|
|
129
|
+
})()`);return l&&r("console.json",JSON.stringify(l,null,2)),e}async swipe(e="UP",t=300){let r=B/2,o=C/2,n=200,s=r,a=o,l=r,m=o;switch(e.toUpperCase()){case"UP":a+=n,m-=n;break;case"DOWN":a-=n,m+=n;break;case"LEFT":s+=n,l-=n;break;case"RIGHT":s-=n,l+=n;break}let g=Math.max(10,Math.round(t/16));await this.drag(s,a,l,m,g,16)}async drag(e,t,r,o,n=12,s=16){if(!(await this.evaluate(`(async () => {
|
|
130
130
|
const interact = window.__sootsimInteract
|
|
131
131
|
if (!interact?.drag) return { ok: false }
|
|
132
|
-
const value = await interact.drag(${e}, ${t}, ${r}, ${
|
|
132
|
+
const value = await interact.drag(${e}, ${t}, ${r}, ${o}, ${Math.max(1,Math.round(n))}, ${Math.max(0,Math.round(s))})
|
|
133
133
|
return { ok: !!value, value }
|
|
134
|
-
})()`))?.ok)throw new Error("drag failed");await
|
|
134
|
+
})()`))?.ok)throw new Error("drag failed");await p(300)}async swipeCoords(e,t,r=300){let o=X(e),n=X(t),s=Math.max(10,Math.round(r/16));await this.drag(o.x,o.y,n.x,n.y,s,16)}async swipeFrom(e,t="UP",r=300){let o=await this.findElement(e);if(!o)throw new Error(`swipeFrom: element not found: ${JSON.stringify(e)}`);let n=o.absolutePosition.x+o.layout.width/2,s=o.absolutePosition.y+o.layout.height/2,a=180,l=n,m=s;switch(t.toUpperCase()){case"UP":m-=a;break;case"DOWN":m+=a;break;case"LEFT":l-=a;break;case"RIGHT":l+=a;break}let g=Math.max(10,Math.round(r/16));await this.drag(n,s,l,m,g,16)}async scrollTo(e,t,r){let o=await this.callTest("scrollTo",e,t,r,!1);if(!o?.ok)throw new Error(`scrollTo failed: ${o?.reason||"unknown error"}`);await p(250)}async pinch(e){let t=await this.evaluate(`(async () => {
|
|
135
135
|
const interact = window.__sootsimInteract
|
|
136
136
|
if (!interact?.pinch) return { ok: false, reason: 'no interact.pinch' }
|
|
137
137
|
const ok = await interact.pinch(
|
|
@@ -140,13 +140,13 @@ import{a as ye}from"./chunk-ECI22OZU.js";import{a as be}from"./chunk-2V4ALWOZ.js
|
|
|
140
140
|
${e.steps||12}, ${e.stepMs||16}
|
|
141
141
|
)
|
|
142
142
|
return { ok: !!ok, reason: ok ? null : 'pinch returned false' }
|
|
143
|
-
})()`);if(!t?.ok)throw new Error(`pinch failed: ${t?.reason||"unknown error"}`);await
|
|
143
|
+
})()`);if(!t?.ok)throw new Error(`pinch failed: ${t?.reason||"unknown error"}`);await p(250)}async dumpTree(e=6){let t=await this.bridge.send({type:"tree",simId:this.opts.simId,depth:e});return console.log("[flow] tree:"),console.log(typeof t=="string"?t:JSON.stringify(t,null,2)),typeof t=="string"?t:JSON.stringify(t)}async assertTreeContains(e){if(!(await this.dumpTree(8)).includes(e))throw new Error(`assertTreeContains: "${e}" not in tree`)}async waitForAnimationToEnd(e=2e3){await p(e)}async back(){try{await this.tapOn("\u2039")}catch{await this.tapOn("<")}}async scrollUntilVisible(e){let t=Date.now()+(e.timeout||15e3),r=e.direction?.toUpperCase()||"DOWN",o=r==="DOWN"?"UP":r==="UP"?"DOWN":r;for(;Date.now()<t;){let n=await this.findElement({text:e.element});if(n&&n.absolutePosition.y>=0&&n.absolutePosition.y+n.layout.height>0&&n.absolutePosition.y<C-50){if(e.centerElement){let s=C/2,a=n.absolutePosition.y-s;if(Math.abs(a)>100){let l=Math.min(150,Math.abs(a)*.5),m=a>0?s-l:s+l;await this.drag(B/2,s,B/2,m,10,16)}}return}await this.swipe(o,250),await p(500)}throw new Error(`scrollUntilVisible: "${e.element}" not found`)}async extendedWaitUntil(e){let t=Date.now()+(e.timeout||U);for(;Date.now()<t;){let r=e.visible?await this.isElementVisible(typeof e.visible=="string"?{text:e.visible}:e.visible):!0,o=e.notVisible?!await this.isElementVisible(typeof e.notVisible=="string"?{text:e.notVisible}:e.notVisible):!0;if(r&&o)return;await p(200)}throw new Error("extendedWaitUntil timed out")}async launchApp(e){await this.refreshSimId();let t=!!(e&&typeof e=="object"&&e.clearState);if(t&&await this.evaluate(`(async () => {
|
|
144
144
|
await (${V})
|
|
145
145
|
try {
|
|
146
146
|
const regs = await navigator.serviceWorker?.getRegistrations?.()
|
|
147
147
|
await Promise.all((regs || []).map((reg) => reg.unregister()))
|
|
148
148
|
} catch {}
|
|
149
|
-
})()`),!this.firstLaunchDone&&!t)this.firstLaunchDone=!0,await this.waitForTree(3e4);else if(this.firstLaunchDone=!0,await this.evaluate("window.location.reload()").catch(()=>{}),await
|
|
149
|
+
})()`),!this.firstLaunchDone&&!t)this.firstLaunchDone=!0,await this.waitForTree(3e4);else if(this.firstLaunchDone=!0,await this.evaluate("window.location.reload()").catch(()=>{}),await p(500),await this.refreshSimId(),await this.waitForTree(12e4),this.opts.onAfterLaunch)try{await this.opts.onAfterLaunch()}catch(r){console.warn(` warn: onAfterLaunch hook threw: ${r instanceof Error?r.message:r}`)}this.profilingEnabled&&await this.startProfile(),this.recordingEnabled&&(await this.waitForVisualSettle(),await this.ensureRecordingStarted())}async waitForVisualSettle(){try{await this.evaluate(`new Promise((resolve) => {
|
|
150
150
|
requestAnimationFrame(() => {
|
|
151
151
|
requestAnimationFrame(() => {
|
|
152
152
|
requestAnimationFrame(() => {
|
|
@@ -154,7 +154,7 @@ import{a as ye}from"./chunk-ECI22OZU.js";import{a as be}from"./chunk-2V4ALWOZ.js
|
|
|
154
154
|
})
|
|
155
155
|
})
|
|
156
156
|
})
|
|
157
|
-
})`)}catch{await
|
|
157
|
+
})`)}catch{await p(180)}}async startProfile(){await this.evaluate(`((sessionKey) => {
|
|
158
158
|
const host = window.__sootsimRenderHost
|
|
159
159
|
if (host?.startPerfSession) {
|
|
160
160
|
host.startPerfSession(sessionKey)
|
|
@@ -251,13 +251,13 @@ import{a as ye}from"./chunk-ECI22OZU.js";import{a as be}from"./chunk-2V4ALWOZ.js
|
|
|
251
251
|
} catch {}
|
|
252
252
|
})()`)}async clearState(){await this.evaluate(`(async () => {
|
|
253
253
|
await (${V})
|
|
254
|
-
})()`)}clearKeychain(){console.warn("[flow] clearKeychain: sootsim has no keychain surface \u2014 no-op (warning)")}async copyTextFrom(e){let t=typeof e=="string"?{id:e}:e,r=await this.findElement(t);if(!r)throw new Error(`copyTextFrom: element not found: ${JSON.stringify(t)}`);let
|
|
254
|
+
})()`)}clearKeychain(){console.warn("[flow] clearKeychain: sootsim has no keychain surface \u2014 no-op (warning)")}async copyTextFrom(e){let t=typeof e=="string"?{id:e}:e,r=await this.findElement(t);if(!r)throw new Error(`copyTextFrom: element not found: ${JSON.stringify(t)}`);let o=r.text??r.testID??"";Z.set(Ne,o),console.log(`[flow] copied text: ${JSON.stringify(o)}`)}async evalScript(e){let r=await this.evaluate(`(async () => {
|
|
255
255
|
try {
|
|
256
256
|
return { ok: true, value: await (async () => { ${e} })() }
|
|
257
257
|
} catch (err) {
|
|
258
258
|
return { ok: false, error: err && err.message ? err.message : String(err) }
|
|
259
259
|
}
|
|
260
|
-
})()`);if(!r.ok)throw new Error(`evalScript failed: ${r.error}`);r.value!==void 0&&console.log("[flow] evalScript ->",r.value)}async openLink(e){let t=typeof e=="string"?e:e.link;if(!t)throw new Error("openLink: missing link");await this.evaluate(`window.location.href = ${JSON.stringify(t)}`),await
|
|
260
|
+
})()`);if(!r.ok)throw new Error(`evalScript failed: ${r.error}`);r.value!==void 0&&console.log("[flow] evalScript ->",r.value)}async openLink(e){let t=typeof e=="string"?e:e.link;if(!t)throw new Error("openLink: missing link");await this.evaluate(`window.location.href = ${JSON.stringify(t)}`),await p(300),await this.refreshSimId(),await this.waitForTree(3e4)}async evaluateWhen(e){if(e.visible!==void 0){let t=typeof e.visible=="string"?{text:e.visible}:e.visible;return!!await this.findElement(t)}if(e.notVisible!==void 0){let t=typeof e.notVisible=="string"?{text:e.notVisible}:e.notVisible;return!await this.findElement(t)}return e.platform!==void 0?e.platform.toLowerCase()==="ios":e.true!==void 0?e.true.toLowerCase()!=="false":!0}isOptional(e){if(e.optional===!0)return!0;let r=Object.entries(e).find(([n])=>n!=="when"&&n!=="optional"),o=r?r[1]:void 0;return!!(o&&typeof o=="object"&&"optional"in o&&o.optional)}async runStep(e,t){let r=Object.keys(e).find(o=>o!=="when")||Object.keys(e)[0];if(console.log(`[flow] step ${t+1}: ${r}`),e.when&&!await this.evaluateWhen(e.when)){console.log("[flow] (when: predicate false, skipped)");return}try{let o=!!(e.extendedWaitUntil||e.waitFor||e.scrollUntilVisible||e.launchApp||e.runFlow),n=1e4,s=this.runStepInner(e);if(o)await s;else{let l=null,m=new Promise((g,y)=>{l=setTimeout(()=>{y(new Error(`step watchdog: ${r} made no progress in ${n}ms \u2014 bridge or bundle probably hung`))},n)});try{await Promise.race([s,m])}finally{l&&clearTimeout(l)}}let a=!!(e.assertVisible||e.assertNotVisible||e.extendedWaitUntil||e.waitFor);this.stepDelay>0&&!a&&await p(this.stepDelay)}catch(o){if(this.isOptional(e)){console.log(`[flow] (optional, skipped: ${o.message.slice(0,80)})`);return}throw this.lastFailedStep={index:t,kind:r,target:e[r]},o}}async runStepInner(e){if(e.tapOn)await this.tapOn(e.tapOn);else if(e.scrollUntilVisible)await this.scrollUntilVisible(e.scrollUntilVisible);else if(e.extendedWaitUntil)await this.extendedWaitUntil(e.extendedWaitUntil);else if(e.assertVisible)await this.assertVisible(e.assertVisible);else if(e.assertNotVisible)await this.assertNotVisible(e.assertNotVisible);else if(e.inputText)await this.inputText(e.inputText);else if(e.pressKey)await this.pressKey(e.pressKey);else if(e.dispatchKey)await this.dispatchKey(e.dispatchKey);else if(e.waitFor)await this.waitFor(e.waitFor);else if(e.takeScreenshot)await this.takeScreenshot(e.takeScreenshot);else if(e.swipe)e.swipe.start&&e.swipe.end?await this.swipeCoords(e.swipe.start,e.swipe.end,e.swipe.duration):e.swipe.from?await this.swipeFrom(e.swipe.from,e.swipe.direction,e.swipe.duration):await this.swipe(e.swipe.direction,e.swipe.duration);else if(e.scroll)await this.swipe(e.scroll.direction==="DOWN"?"UP":"DOWN");else if(e.scrollTo)await this.scrollTo(e.scrollTo.id,e.scrollTo.x,e.scrollTo.y);else if(e.pinch)await this.pinch(e.pinch);else if(e.waitForAnimationToEnd)await this.waitForAnimationToEnd(typeof e.waitForAnimationToEnd=="number"?e.waitForAnimationToEnd:2e3);else if(e.back)await this.back();else if(e.hideKeyboard)await this.hideKeyboard();else if(e.launchApp)await this.launchApp(e.launchApp);else if(typeof e.wait=="number")await p(e.wait);else if(e.dumpTree)await this.dumpTree(e.dumpTree);else if(e.tapAtCoords)await this.tapAtCoords(e.tapAtCoords.x,e.tapAtCoords.y);else if(e.doubleTapAtCoords)await this.doubleTapAtCoords(e.doubleTapAtCoords.x,e.doubleTapAtCoords.y,e.doubleTapAtCoords.gapMs);else if(e.assertTreeContains)await this.assertTreeContains(e.assertTreeContains);else if(typeof e.eraseText=="number")await this.eraseText(e.eraseText);else if(e.repeat)for(let t=0;t<e.repeat.times;t++)for(let r=0;r<e.repeat.commands.length;r++)await this.runStep(e.repeat.commands[r],r);else if(e.stopApp!==void 0)await this.stopApp();else if(e.clearState!==void 0)await this.clearState();else if(e.clearKeychain!==void 0)this.clearKeychain();else if(e.copyTextFrom!==void 0)await this.copyTextFrom(e.copyTextFrom);else if(typeof e.evalScript=="string")await this.evalScript(e.evalScript);else if(e.openLink!==void 0)await this.openLink(e.openLink);else if(e.runFlow){let t=e.runFlow,r=typeof t=="string"?t:t.file,o=typeof t=="string"?void 0:t.when;if(o&&!await this.evaluateWhen(o)){console.log(`[flow] runFlow skipped (when predicate false): ${r}`);return}let n=f.resolve(this.opts.flowDir,r),s=w.readFileSync(n,"utf8"),a=this.opts.flowDir;this.opts.flowDir=f.dirname(n),await this.runFlow(Ue(s)),this.opts.flowDir=a}else throw new Error(`unsupported flow step: ${JSON.stringify(e)}`)}async runFlow(e){let t=[],r=[],o=[];for(let s of e){let a=Object.keys(s);if(a.length===1&&a[0]==="onFlowStart"&&Array.isArray(s.onFlowStart)){t.push(...s.onFlowStart);continue}if(a.length===1&&a[0]==="onFlowComplete"&&Array.isArray(s.onFlowComplete)){r.push(...s.onFlowComplete);continue}o.push(s)}if(t.length>0){console.log(`[flow] onFlowStart (${t.length} steps)`);for(let s=0;s<t.length;s++)await this.runStep(t[s],s)}let n=null;try{await this.runFlowBody(o)}catch(s){n=s instanceof Error?s:new Error(String(s))}if(r.length>0){console.log(`[flow] onFlowComplete (${r.length} steps)`);for(let s=0;s<r.length;s++)try{await this.runStep(r[s],s)}catch(a){console.warn(`[flow] onFlowComplete step ${s+1} failed: ${a instanceof Error?a.message:a}`)}}if(n)throw n}async runFlowBody(e){for(let t=0;t<e.length;t++){let r=e[t],o=typeof r.wait=="number"?r.wait:0,n=typeof r.waitFor?.timeout=="number"?r.waitFor.timeout:0,s=Math.max(6e4,o+15e3,n+15e3);if(r.runFlow){await this.runStep(r,t);continue}await Promise.race([this.runStep(r,t),new Promise((a,l)=>setTimeout(()=>l(new Error(`step ${t+1} (${Object.keys(r)[0]}) exceeded ${s}ms deadline`)),s))])}}};function ke(i){let e={},t=i,r=i.match(/^---\n([\s\S]*?)\n---\n?/);if(r){try{e=M.parse(r[1])??{}}catch(s){console.warn(` warn: could not parse frontmatter: ${s.message}`)}t=i.slice(r[0].length);let n=M.parse(t);return{frontmatter:e,steps:Array.isArray(n)?n:[]}}if(/\n---\s*\n/.test(i))try{let n=M.parseAllDocuments(i);if(n.length>=2){let s=n[0].toJS(),a=n[n.length-1].toJS();return{frontmatter:s&&typeof s=="object"?s:{},steps:Array.isArray(a)?a:[]}}}catch(n){console.warn(` warn: could not parse multi-doc flow: ${n.message}`)}let o=M.parse(t);return{frontmatter:e,steps:Array.isArray(o)?o:[]}}async function Be(){let i=await ye(),e=i.find(r=>r.patched);if(e)return`http://localhost:${e.port}/__soot/`;let t=i[0];return t?`http://localhost:${t.port}/__soot/`:null}async function Ae(i){(i.length===0||i.includes("--help")||i.includes("-h"))&&(console.log(`
|
|
261
261
|
sootsim flow \u2014 run flows or manage a draft
|
|
262
262
|
|
|
263
263
|
usage:
|
|
@@ -324,25 +324,25 @@ flow extension:
|
|
|
324
324
|
takeScreenshot:
|
|
325
325
|
path: marketing/hero
|
|
326
326
|
withFrame: true
|
|
327
|
-
`),process.exit(0));let e=
|
|
328
|
-
sootsim flow \u2014 ${
|
|
329
|
-
${E.length} steps | ${
|
|
330
|
-
`),y&&
|
|
327
|
+
`),process.exit(0));let e=i[0];$.existsSync(e)||(console.error(` error: ${e} not found`),process.exit(1));let t=d=>i.find((c,v)=>i[v-1]===d),r=i.includes("--profile"),o=i.includes("--new"),n=t("--out")||"/tmp/sootsim-recordings",s=t("--screenshots")||"/tmp/sootsim-flow",a=t("--screenshot-paths")==="flow"?"flow":"dir",l=t("--device")?.trim()||"",m=i.includes("--slow")?+(t("--slow")||"500"):0,g=i.includes("--electron"),y=i.includes("--preview"),W=await ve(t("--preview-origin")),ee=t("--preview-public-origin"),Me=i.includes("--preview-open"),Ee=i.flatMap((d,c)=>i[c-1]==="--replace"?["--replace",d]:[]),S=i.includes("--record")||y,te=i.includes("--tail-wait")?Math.max(0,+(t("--tail-wait")||"2000")):S?2e3:0,Pe=$.readFileSync(e,"utf8"),{frontmatter:k,steps:E}=ke(Pe);E.length===0&&(console.error(" error: flow file must contain a YAML array of steps"),process.exit(1));let I=l||k.device||"",O=g||k.electron===!0,j=k.app===void 0||k.app===null?"":typeof k.app=="number"?String(k.app):k.app,re={stripBooleanFlags:["--record","--profile","--electron","--new","--preview","--preview-open","--headless"],stripValueFlags:["--out","--device","--slow","--tail-wait","--url","--replace","--screenshots","--screenshot-paths","--preview-origin","--preview-public-origin","--driver"]},x=q(i,re),Ie=t("--url")||"";O&&!we()&&(console.error(" error: desktop companion not found. install or build it first with `bun run build:electron`"),process.exit(1));let ie=O?"desktop companion":"bridge",_e=j?` | target: ${j}`:"";console.log(`
|
|
328
|
+
sootsim flow \u2014 ${h.basename(e)}
|
|
329
|
+
${E.length} steps | ${ie}${_e}${S?" | recording":""}${r?" | profiling":""}${m?` | ${m}ms delay`:""}
|
|
330
|
+
`),y&&le({event:"preview_flow_started",properties:{flowName:h.basename(e),stepCount:E.length,mode:ie,electron:O,record:S,profile:r,previewOrigin:W}});let F=Ie||j||"",K=o||O&&x.simIdSource!=="flag",oe=!1;if(!F&&!K&&x.simIdSource==="none"){let d=ue(x);try{let c=await d.listSims(),v=c.find(R=>R.isPrimary&&R.readyState==="open"),D=c.find(R=>R.readyState==="open"),ne=v??D;ne&&(oe=!0,console.log(` reusing active sim: ${ne.id}`))}catch{}finally{d.close()}}if(!F&&!oe&&(K||x.simIdSource==="none")){let d=await Be();d||(console.error(" error: no current sim and no sootsim target found"),await z(),process.exit(1)),F=d}if(F&&I){let d=new URL(await ge(F));d.searchParams.set("device",I),F=d.toString()}if(F){let d=[F];d.push(...Ee),K&&d.push("--new"),x.simIdSource==="flag"&&x.simId&&d.push("--sim",x.simId);let c=t("--driver");c&&d.push("--driver",c),i.includes("--headless")&&d.push("--headless"),await he(d,{port:x.wsPort,timeoutMs:x.commandTimeoutMs})}let P=q(i,re),J=P.simIdSource==="flag"?P.simId:ce()||P.simId,Ce=P.simIdSource==="flag"?"flag":J?"saved":"none",T=de(P.wsPort,{commandTimeoutMs:P.commandTimeoutMs,simId:J,simIdSource:Ce,fallbackOnMissingSimId:!1}),u,se=async()=>{if(!I)return!1;let d=await T.send({type:"evaluate",simId:u.simId,code:"window.location.href"});if(typeof d=="string"&&d.length>0){let c=new URL(d);c.searchParams.set("device",I),u.setSimRouteHint(c.toString())}return!!await T.send({type:"call",simId:u.simId,path:"SootSim.bridges.settings.set",args:["deviceModel",I]})};u=new L(T,{screenshotDir:s,flowDir:h.dirname(h.resolve(e)),screenshotPathMode:a,simId:J,recordingOutputDir:S?n:void 0,billingOriginOverride:y?W:void 0,allowGitHubRecording:S,onAfterLaunch:async()=>{await se()&&await u.waitForTree(12e4),y&&await T.send({type:"evaluate",simId:u.simId,code:`(() => {
|
|
331
331
|
const r = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder
|
|
332
332
|
return r?.start?.() ?? false
|
|
333
|
-
})()`})}}),
|
|
333
|
+
})()`})}}),m&&(u.stepDelay=m);let A=null,b=null,_=null,H=null,N=0,Oe=!!E[0]?.launchApp;try{await u.waitForTree(12e4),await se()&&await u.waitForTree(12e4),S&&(Oe?u.prepareRecording():await u.startRecording()),r&&await u.startProfile(),y&&(await T.send({type:"evaluate",simId:u.simId,code:`(() => {
|
|
334
334
|
const r = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder
|
|
335
335
|
return r?.start?.() ?? false
|
|
336
|
-
})()`})||console.warn(" warn: eventRecorder.start() returned false \u2014 preview will upload bundle without replay events")),await u.runFlow(E),r&&(A=await u.stopProfile()),S&&
|
|
336
|
+
})()`})||console.warn(" warn: eventRecorder.start() returned false \u2014 preview will upload bundle without replay events")),await u.runFlow(E),r&&(A=await u.stopProfile()),S&&te>0&&await new Promise(c=>setTimeout(c,te)),S&&(b=await u.stopRecording(),_=u.getLastRecordingDurationMs()),y&&(H=await T.send({type:"evaluate",simId:u.simId,code:`(() => {
|
|
337
337
|
const r = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder
|
|
338
338
|
return r?.stop?.() ?? []
|
|
339
339
|
})()`}),console.log(` captured ${H.length} replay events`)),console.log(`
|
|
340
340
|
+ completed (${E.length} steps)`),A&&Te(A),b&&console.log(` video: ${b}`),console.log()}catch(d){if(r&&!A)try{A=await u.stopProfile()}catch{}if(S&&!b)try{b=await u.stopRecording(),_=u.getLastRecordingDurationMs()}catch(c){console.warn(` recording stop failed: ${c?.message||String(c)}`)}console.error(`
|
|
341
341
|
x failed: ${d.message}
|
|
342
|
-
`),A&&(console.log(" partial profile:"),Te(A)),b&&console.log(` partial video: ${b}`);try{let c=u.lastFailedStep,v=c?`step-${String(c.index+1).padStart(2,"0")}-${c.kind}`:"unstaged",D=
|
|
343
|
-
preparing preview upload\u2026`);let{runUpload:v}=await import("./upload-
|
|
344
|
-
`)+(
|
|
345
|
-
`:""),r=e(Buffer.from(t,"utf8")),
|
|
346
|
-
validation failed \u2014 draft preserved so you can keep iterating`),process.exitCode=
|
|
347
|
-
profile:`),console.log(` frames: ${
|
|
348
|
-
worst frames:`),
|
|
342
|
+
`),A&&(console.log(" partial profile:"),Te(A)),b&&console.log(` partial video: ${b}`);try{let c=u.lastFailedStep,v=c?`step-${String(c.index+1).padStart(2,"0")}-${c.kind}`:"unstaged",D=h.join(s,v);await u.captureFailureBundle(D,{error:d,stepIndex:c?.index,stepKind:c?.kind,stepTarget:c?.target}),console.log(` failure bundle: ${D}`),console.log(" (contents: screenshot.png, describe.json, a11y.txt, tree.txt, console.json, error.json)")}catch(c){try{let v=h.join(s,"error.png");await u.captureFailureScreenshot(v),console.log(` error screenshot: ${v}`)}catch{}console.log(` (failure bundle capture failed: ${c instanceof Error?c.message:String(c)})`)}await me(T,{errorsCommand:`sootsim get errors 5${u.simId?` --sim ${u.simId}`:""}`,warningsCommand:`sootsim get warnings 5${u.simId?` --sim ${u.simId}`:""}`,requestsCommand:`sootsim get requests 5${u.simId?` --sim ${u.simId}`:""}`}),N=1}finally{T.close()}if(N===0&&y)try{let d=await Le(H??[]),c=["--origin",W,"--events",d];ee&&c.push("--public-origin",ee),b&&c.push("--video",b),b&&_&&Number.isFinite(_)&&c.push("--video-duration-ms",String(Math.round(_))),u.simId&&c.push("--sim",u.simId),Me&&c.push("--open"),console.log(`
|
|
343
|
+
preparing preview upload\u2026`);let{runUpload:v}=await import("./upload-LDL3FZKD.js");await v(c,{})}catch(d){console.error(` preview upload failed: ${d?.message||d}`),N=1}return await z(),N}async function Le(i){let{gzipSync:e}=await import("zlib"),t=i.map(n=>JSON.stringify(n)).join(`
|
|
344
|
+
`)+(i.length?`
|
|
345
|
+
`:""),r=e(Buffer.from(t,"utf8")),o=h.join($e(),`sootsim-events-${Date.now()}.jsonl.gz`);return $.writeFileSync(o,r),console.log(` events: ${i.length} written to ${o} (${r.length} bytes gz)`),o}async function We(i){let e=i[0],t=r=>i.find((o,n)=>i[n-1]===r);switch(e){case"start":{let{path:r,state:o}=pe();console.log(" flow draft started"),console.log(` session: ${r}`),console.log(` steps: ${o.steps.length}`);return}case"keep":case"good":{let r=G();if(r.active||(console.error(" no active flow draft \u2014 run `sootsim flow start` first"),process.exit(1)),!r.kept){console.log(" no pending action to keep");return}console.log(` kept: ${r.candidate.summary}`),console.log(` steps: ${r.stepCount}`);return}case"end":{let r=t("--output")||(i[1]&&!i[1].startsWith("-")?i[1]:void 0),o=i.includes("--validate")||i.includes("--video"),n=i.includes("--video"),s=G();s.active&&s.kept&&console.log(` auto-kept trailing action: ${s.candidate.summary}`);let a=fe(r||(o?Je():void 0));if(a.active||(console.error(" no active flow draft \u2014 run `sootsim flow start` first"),process.exit(1)),o){let l=He(i,a.outputPath),m=await Ae(l);if(m!==0){console.error(`
|
|
346
|
+
validation failed \u2014 draft preserved so you can keep iterating`),process.exitCode=m;return}Y(),console.log(` flow draft validated (${a.stepCount} step${a.stepCount===1?"":"s"})`),a.outputPath&&console.log(` saved: ${a.outputPath}`),n&&console.log(" video: recorded during validation run");return}if(Y(),console.log(` flow draft ended (${a.stepCount} step${a.stepCount===1?"":"s"})`),a.outputPath){console.log(` saved: ${a.outputPath}`),console.log(` next: sootsim flow ${a.outputPath} --record`);return}console.log(""),process.stdout.write(a.yaml);return}case"validate":{let r=i[1];(!r||r.startsWith("-"))&&(console.error(" usage: sootsim flow validate <path>"),process.exit(1));let o=je(r);if(o.length>0){console.error(` x ${r} failed validation:`);for(let n of o)console.error(` - ${n}`);process.exit(1)}console.log(` + ${r} looks valid`);return}}}var Fe=new Set(["tapOn","inputText","pressKey","dispatchKey","hideKeyboard","swipe","pinch","scroll","scrollUntilVisible"]);function je(i){let e=[];if(!$.existsSync(i))return[`file not found: ${i}`];let t;try{t=$.readFileSync(i,"utf8")}catch(n){return[`cannot read file: ${n.message}`]}if(t.trim().length===0)return["file is empty"];let r;try{r=ke(t)}catch(n){return[`yaml parse error: ${n.message}`]}if(!Array.isArray(r.steps)||r.steps.length===0)return e.push("flow body must be a non-empty YAML array of steps"),e;let o=0;for(let n=0;n<r.steps.length;n++){let s=r.steps[n];s&&typeof s=="object"?Object.keys(s).some(l=>Fe.has(l))&&(o+=1):typeof s=="string"&&Fe.has(s)&&(o+=1)}return o===0&&e.push("no interaction steps found (expected at least one tapOn / inputText / pressKey / swipe / scroll)"),e}function Ke(i){return i[0]==="--sim"&&i.length>=2?[...i.slice(2),"--sim",i[1]]:i}async function ut(i){let e=Ke(i),t=e[0];if(t==="start"||t==="keep"||t==="good"||t==="end"||t==="validate")return await We(e),0;let r=await Ae(e);return r!==0&&(process.exitCode=r),r}function Te(i){let e=i.avgMs>0?(1e3/i.avgMs).toFixed(1):"?",t=i.sampleCount>0?(i.jankFrames/i.sampleCount*100).toFixed(1):"0";console.log(`
|
|
347
|
+
profile:`),console.log(` frames: ${i.frames}`),console.log(` total: ${i.totalMs.toFixed(1)}ms`),console.log(` avg: ${i.avgMs.toFixed(2)}ms (${e} fps)`),console.log(` max: ${i.maxMs.toFixed(2)}ms`),i.layoutAvgMs!==void 0&&console.log(` breakdown: layout ${i.layoutAvgMs.toFixed(2)}ms | render ${i.renderAvgMs?.toFixed(2)||"0.00"}ms | copy ${i.copyAvgMs?.toFixed(2)||"0.00"}ms`),console.log(` p95: ${i.p95.toFixed(2)}ms`),console.log(` p99: ${i.p99.toFixed(2)}ms`),console.log(` jank: ${i.jankFrames}/${i.sampleCount} (${t}%) >16.67ms`);let r=Array.isArray(i.worstFrames)?i.worstFrames:[];if(r.length!==0){if(console.log(`
|
|
348
|
+
worst frames:`),i.mode==="render-worker"){console.log(" total layout render copy t+");for(let o of r){let[n,s,a,l,m]=o;console.log(` ${s.toFixed(2).padStart(7)} ${a.toFixed(2).padStart(7)} ${l.toFixed(2).padStart(7)} ${m.toFixed(2).padStart(7)} ${String(n).padStart(5)}`)}return}console.log(` ${r.map(o=>o.toFixed(2)).join(", ")}`)}}function Je(){return h.join($e(),`sootsim-flow-draft-${Date.now()}.yaml`)}function He(i,e){if(!e)throw new Error("validated flow draft requires an output path");let t=[e];for(let r=1;r<i.length;r++){let o=i[r];if(!(o==="--validate"||o==="--video")){if(o==="--output"){r+=1;continue}r===1&&!o.startsWith("-")||t.push(o)}}return!t.includes("--record")&&i.includes("--video")&&t.push("--record"),t}export{ke as a,Be as b,Ae as c,ut as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.46 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
var t=!0,e="1.0.0",o="public beta",n=`${o} \xB7 free until ${e}`,r="free for everyone until 1.0 \u2014 we send anonymous error and dependency data while you use it";export{t as a,e as b,o as c,n as d,r as e};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.46 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import{execFileSync as h,spawn as g}from"child_process";import{existsSync as s,readdirSync as k}from"fs";import{dirname as m,join as l,resolve as a}from"path";import{fileURLToPath as v}from"url";var c;function p(){if(c!==void 0)return c;try{c=m(v(import.meta.resolve("sootsim-engine/package.json")))}catch{c=null}return c}var I="dev.sootsim.simulator";function x(){let n=p();if(!n)return null;let e=l(n,"dist-electron/main.cjs");if(!s(e))return null;let i=D(n);return i?{path:i,platform:process.platform,kind:"dev-electron",engineDir:n}:null}function b(){let n=p();return n?s(l(n,"src-electron/main.ts")):!1}function D(n){let e=n;for(let i=0;i<6;i++){let t=l(e,"node_modules/.bin/electron");if(s(t))return t;let r=m(e);if(r===e)break;e=r}return null}function C(){let n=p(),i=["/Applications/sootsim.app",a(process.env.HOME||"","Applications/sootsim.app"),...n?[a(n,"app/sootsim.app")]:[]].find(t=>s(t));if(i)return{path:i,platform:"darwin",kind:"mac-app"};try{let t=h("mdfind",[`kMDItemCFBundleIdentifier == "${I}"`],{encoding:"utf8",timeout:3e3}).trim();if(t)return{path:t.split(`
|
|
3
3
|
`)[0],platform:"darwin",kind:"mac-app"}}catch{}return null}function f(n){if(!s(n))return null;let e=k(n).filter(i=>i.startsWith("sootsim")&&i.endsWith(".AppImage")).sort().reverse()[0];return e?l(n,e):null}function w(){let n=p(),i=[a(process.env.HOME||"","Applications/sootsim.AppImage"),a(process.env.HOME||"",".local/bin/sootsim.AppImage"),"/opt/sootsim/sootsim.AppImage","/opt/sootsim/sootsim",...n?[a(n,"app/sootsim.AppImage"),a(n,"release/linux-unpacked/sootsim")]:[]].find(r=>s(r));if(i)return{path:i,platform:"linux",kind:i.endsWith(".AppImage")?"linux-appimage":"linux-binary"};let t=n?f(a(n,"app"))||f(a(n,"release")):null;return t?{path:t,platform:"linux",kind:"linux-appimage"}:null}function A(){let n=x();if(n)return n;if(b()){let e=p(),i=l(e,"dist-electron/main.cjs");return s(i)?console.error(` no node_modules/.bin/electron found near ${e}. run \`bun install\`.`):console.error(` dist-electron/main.cjs missing in ${e}.
|
|
4
4
|
run: bun run --cwd packages/sootsim-engine build:electron-main
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as R}from"./chunk-ZSDPMO6R.js";import{l as D}from"./chunk-PNEIZ2DY.js";import{a as T}from"./chunk-2WW7WJHA.js";function Y(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.type=="string"&&typeof t.ts=="number"}function I(e){let t=e.trim();if(!t)return null;try{let r=JSON.parse(t);return Y(r)?r:null}catch{return null}}import{randomBytes as G,createHash as q}from"node:crypto";import m from"node:fs";import y from"node:path";var N=null;function _(){if(N)return N;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||D()}function h(){return _()}function U(){return y.join(_(),"attached-projects.json")}function $(){return{version:1,attachedProjects:[],previewAttachments:[],agentSessions:[]}}function S(){let e=U(),t;try{t=m.readFileSync(e,"utf8")}catch(r){if(r.code==="ENOENT")return $();throw r}try{let r=JSON.parse(t);if(!r||typeof r!="object")throw new Error("not an object");return{version:1,attachedProjects:Array.isArray(r.attachedProjects)?r.attachedProjects:[],previewAttachments:Array.isArray(r.previewAttachments)?r.previewAttachments:[],agentSessions:Array.isArray(r.agentSessions)?r.agentSessions:[]}}catch(r){let n=`${e}.corrupt-${Date.now()}`;try{m.renameSync(e,n),console.warn(`[sootsim] attached-projects.json was unparseable; quarantined to ${n}. original error: ${r.message}`)}catch{}return $()}}function X(e){let t=U();m.mkdirSync(y.dirname(t),{recursive:!0});let r=`${t}.tmp-${process.pid}-${Date.now()}`,n=m.openSync(r,"w",384);try{m.writeFileSync(n,JSON.stringify(e,null,2)),m.fsyncSync(n)}finally{m.closeSync(n)}m.renameSync(r,t)}function w(e){let t=S();return e(t),X(t),t}function B(e){return q("sha256").update(y.resolve(e)).digest("hex").slice(0,16)}function K(){return`s_${G(10).toString("hex")}`}function ge(e){let t=y.resolve(e.cwd),r=B(t),n;return w(o=>{let s=o.attachedProjects.find(c=>c.id===r);if(s){let c={...s,...e,id:r,cwd:t,sourceRoots:e.sourceRoots??s.sourceRoots,knownBundleUrls:e.knownBundleUrls??s.knownBundleUrls,pinnedSourceResolutions:e.pinnedSourceResolutions??s.pinnedSourceResolutions,telemetry:e.telemetry??s.telemetry,updatedAt:Date.now(),createdAt:s.createdAt},g=o.attachedProjects.indexOf(s);o.attachedProjects[g]=c,n=c;return}let a=Date.now(),d={id:r,name:e.name??y.basename(t),cwd:t,repoRoot:e.repoRoot,sourceRoots:e.sourceRoots??[t],framework:e.framework??"unknown",bundleId:e.bundleId,knownBundleUrls:e.knownBundleUrls??[],preferredProvider:e.preferredProvider??"codex",preferredTransport:e.preferredTransport??"tmux",editorOpenCommand:e.editorOpenCommand,moshiWebhookToken:e.moshiWebhookToken,pinnedSourceResolutions:e.pinnedSourceResolutions??{},isolateDiscovery:e.isolateDiscovery,git:e.git,telemetry:e.telemetry??{lastOpened:0,runsCompleted:0},createdAt:a,updatedAt:a};o.attachedProjects.push(d),n=d}),n}function F(e){return S().attachedProjects.find(t=>t.id===e)??null}function ye(){return S().attachedProjects}var Q=336*60*60*1e3;function he(e,t={}){w(r=>{let n=r.attachedProjects.find(s=>s.id===e);if(!n)return;let o=t.ts??Date.now();if(n.telemetry.runsCompleted=(n.telemetry.runsCompleted??0)+1,typeof t.usd=="number"&&Number.isFinite(t.usd)&&t.usd>=0){let s=n.telemetry.costHistory??[],a=o-Q,d=s.filter(c=>c.ts>=a);d.push({ts:o,usd:t.usd}),n.telemetry.costHistory=d}n.updatedAt=o})}function Se(e,t=Date.now()){let r=t-6048e5,n=e.telemetry.costHistory??[],o=0;for(let s of n)s.ts>=r&&(o+=s.usd);return o}function we(e){w(t=>{t.attachedProjects=t.attachedProjects.filter(r=>r.id!==e),t.agentSessions=t.agentSessions.filter(r=>r.projectId!==e),t.previewAttachments=t.previewAttachments.filter(r=>r.projectId!==e)})}function M(e){let t;return w(r=>{if(e.id){let a=r.agentSessions.find(d=>d.id===e.id);if(a){let d={...a,...e,lastSeenAt:Date.now()},c=r.agentSessions.indexOf(a);r.agentSessions[c]=d,t=d;return}}let n=r.attachedProjects.find(a=>a.id===e.projectId);if(!n)throw new Error(`upsertSession: no AttachedProject with id=${e.projectId}`);let o=Date.now(),s={id:e.id??K(),projectId:e.projectId,provider:e.provider,transport:e.transport??n.preferredTransport,cwd:e.cwd??n.cwd,claudeSessionUuid:e.claudeSessionUuid,tmuxSessionName:e.tmuxSessionName,wrapperPid:e.wrapperPid,status:e.status??"idle",needsAttention:e.needsAttention??!1,lastPrompt:e.lastPrompt,lastSummary:e.lastSummary,lastTurnFiles:e.lastTurnFiles,currentlyEditing:e.currentlyEditing,lastSeenAt:o,createdAt:o};r.agentSessions.push(s),t=s}),t}function k(e){return S().agentSessions.find(t=>t.id===e)??null}function C(e){let t=S().agentSessions;return e?t.filter(r=>r.projectId===e):t}function v(e,t){w(r=>{let n=r.agentSessions.find(s=>s.id===e);if(!n)return;let o=r.agentSessions.indexOf(n);r.agentSessions[o]={...n,...t,id:n.id,projectId:n.projectId,createdAt:n.createdAt,lastSeenAt:Date.now()}})}async function ve(){if(S().attachedProjects.length>0)return;let t;try{t=(await import("./demo-app-registry-3SDEOEC4.js")).APPS}catch(n){console.warn("[sootsim] seedFromDemoAppRegistry: could not load demo registry:",n.message);return}if(!Array.isArray(t))return;let r=t;w(n=>{for(let o of r){if(!m.existsSync(o.dir))continue;let s=y.resolve(o.dir),a=B(s);if(n.attachedProjects.some(c=>c.id===a))continue;let d=Date.now();n.attachedProjects.push({id:a,name:o.label,cwd:s,sourceRoots:[s],framework:o.framework,knownBundleUrls:[`http://localhost:${o.preferredPort}/index.bundle`],preferredProvider:"codex",preferredTransport:"tmux",pinnedSourceResolutions:{},telemetry:{lastOpened:0,runsCompleted:0},createdAt:d,updatedAt:d})}})}import{spawn as V,spawnSync as z}from"node:child_process";import{randomUUID as Z}from"node:crypto";import i,{constants as f}from"node:fs";import u from"node:path";import ee from"node:readline";function j(e){return u.join(h(),"sessions",e)}function W(e){return u.join(j(e),"prompt.in")}function J(e){return u.join(j(e),"events.out")}function te(e){return u.join(h(),"transcripts",`${e}.log`)}function O(e,t){if(!e)return!1;try{process.kill(e,0)}catch{return!1}return!(t&&!i.existsSync(j(t)))}function re(){if(process.env.SOOTSIM_BIN)return{cmd:process.env.SOOTSIM_BIN,prefixArgs:[]};if(process.versions.electron){let n=process.resourcesPath;if(n){let o=[u.join(n,"bin","sootsim"),u.join(n,"bin",`sootsim-${process.platform}-${process.arch}`)];for(let s of o)if(i.existsSync(s))return{cmd:s,prefixArgs:[]}}}let e=ne();if(e)return e;let t=process.argv[0],r=process.argv[1];if(r&&/\.(ts|tsx|mjs|cjs|js)$/.test(r))return{cmd:t,prefixArgs:[r]};if(!r||r.includes("/.bin/"))throw new Error("sootsim CLI not found. set SOOTSIM_BIN to the path of the sootsim binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`.");return{cmd:t,prefixArgs:[]}}function ne(){try{let e=se();if(!e)return null;let t=`sootsim-${process.platform}-${process.arch}`,r=u.join(e,"dist-bin",t);if(i.existsSync(r))return{cmd:r,prefixArgs:[]};let n=u.join(e,"dist-cli","bin.js");if(i.existsSync(n)){try{let o=u.join(e,"cli","commands","agent-wrapper.ts");if(i.existsSync(o)){let s=i.statSync(o).mtimeMs;i.statSync(n).mtimeMs<s&&console.warn("[sootsim] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with `bun run --cwd packages/sootsim build:cli` (watch:cli:binary builds dist-bin/ instead).")}}catch{}return{cmd:process.execPath,prefixArgs:[n]}}return null}catch{return null}}function se(){try{let r=T.resolve("sootsim/package.json");return u.dirname(r)}catch{}let e=oe();if(!e)return null;let t=u.dirname(e);for(let r=0;r<8;r++){let n=u.join(t,"package.json");try{if(i.existsSync(n)&&JSON.parse(i.readFileSync(n,"utf8")).name==="sootsim")return t}catch{}let o=u.dirname(t);if(o===t)break;t=o}return null}function oe(){try{let e=import.meta.url;return!e||!e.startsWith("file://")?null:decodeURIComponent(e.slice(7))}catch{return null}}async function ie(e,t,r){let n=u.join(h(),"locks");i.mkdirSync(n,{recursive:!0});try{i.chmodSync(n,448)}catch{}let o=u.join(n,`start-${e}-${t}.lock`),s=Date.now()+4e3,a=null;for(;a===null;)try{a=i.openSync(o,f.O_WRONLY|f.O_CREAT|f.O_EXCL,384)}catch(d){if(d.code!=="EEXIST")throw d;try{let c=Number(i.readFileSync(o,"utf8").trim());if(c&&!ce(c)){i.unlinkSync(o);continue}}catch{}if(Date.now()>s)throw new Error(`another start is in progress for project=${e} provider=${t} (lock: ${o})`);await new Promise(c=>setTimeout(c,50))}try{return i.writeFileSync(a,String(process.pid)),await r()}finally{try{i.closeSync(a)}catch{}try{i.unlinkSync(o)}catch{}}}function ce(e){try{return process.kill(e,0),!0}catch{return!1}}function L(e){let t=u.dirname(e);i.mkdirSync(t,{recursive:!0});try{i.chmodSync(t,448)}catch{}if(i.existsSync(e))try{if(i.statSync(e).isFIFO()){try{i.chmodSync(e,384)}catch{}return}i.unlinkSync(e)}catch{i.unlinkSync(e)}let r=z("mkfifo",["-m","600",e]);if(r.status!==0)throw new Error(`mkfifo(${e}) failed: ${r.stderr?.toString().trim()||"unknown error"}`)}var l=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function Te(e){let t=F(e.projectId);if(!t)throw new l("NO_PROJECT",`no project with id=${e.projectId}`);let r=e.provider||t.preferredProvider||"codex";return ie(t.id,r,async()=>{let n=C(t.id).find(p=>p.provider===r&&p.status!=="ended"&&O(p.wrapperPid,p.id));if(n)throw new l("ALREADY_RUNNING",`session already running for project=${t.id} provider=${r} (session ${n.id}, pid ${n.wrapperPid}). end it first with \`sootsim agent end <sessionId>\`.`);let o=r==="claude"?Z():void 0,s=M({projectId:t.id,provider:r,transport:"pty",cwd:t.cwd,status:"idle",claudeSessionUuid:o}),a=W(s.id),d=J(s.id),c=te(s.id);L(a),L(d);let g=u.dirname(c);i.mkdirSync(g,{recursive:!0});try{i.chmodSync(g,448)}catch{}let{cmd:A,prefixArgs:H}=re(),P=[...H,"agent-wrapper","--session-id",s.id,"--project-id",t.id,"--provider",r,"--cwd",t.cwd,"--prompt-in",a,"--events-out",d,"--transcript",c];e.codexBin&&P.push("--codex-bin",e.codexBin),e.claudeBin&&P.push("--claude-bin",e.claudeBin),e.freshThread&&P.push("--fresh-thread"),o&&P.push("--claude-session-uuid",o);let x=V(A,P,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:h()}});x.unref();let E=e.readyTimeoutMs??6e3,b=await ae(d,p=>p.type==="ready"||p.type==="error",E);if(!b||b.type==="error"){if(x.pid)try{process.kill(x.pid,"SIGTERM")}catch{}try{i.rmSync(j(s.id),{recursive:!0,force:!0})}catch{}v(s.id,{status:"ended"});let p=b&&b.type==="error"?b.message:`no ready event within ${E}ms`;throw new l("WRAPPER_FAILED",p)}return v(s.id,{wrapperPid:x.pid,status:"idle"}),{session:k(s.id),wrapperPid:x.pid}})}async function De(e,t){let r=k(e);if(!r)throw new l("NO_SESSION",`no session with id=${e}`);if(!O(r.wrapperPid,e))throw v(e,{status:"ended"}),new l("NOT_ALIVE",`session wrapper is not alive (pid=${r.wrapperPid}). start a new session.`);let n=W(e);if(!i.existsSync(n))throw new l("NO_FIFO",`prompt FIFO missing: ${n}`);let o=i.openSync(n,f.O_WRONLY);try{let s=R(t);if(!s)throw new l("EMPTY_PROMPT","prompt text is empty");i.writeSync(o,s+`
|
|
1
|
+
/*! sootsim v0.1.46 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as R}from"./chunk-W52DGZNV.js";import{l as D}from"./chunk-M5HZVUQQ.js";import{a as T}from"./chunk-GWOV6KFE.js";function Y(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.type=="string"&&typeof t.ts=="number"}function I(e){let t=e.trim();if(!t)return null;try{let r=JSON.parse(t);return Y(r)?r:null}catch{return null}}import{randomBytes as G,createHash as q}from"node:crypto";import m from"node:fs";import y from"node:path";var N=null;function _(){if(N)return N;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||D()}function h(){return _()}function U(){return y.join(_(),"attached-projects.json")}function $(){return{version:1,attachedProjects:[],previewAttachments:[],agentSessions:[]}}function S(){let e=U(),t;try{t=m.readFileSync(e,"utf8")}catch(r){if(r.code==="ENOENT")return $();throw r}try{let r=JSON.parse(t);if(!r||typeof r!="object")throw new Error("not an object");return{version:1,attachedProjects:Array.isArray(r.attachedProjects)?r.attachedProjects:[],previewAttachments:Array.isArray(r.previewAttachments)?r.previewAttachments:[],agentSessions:Array.isArray(r.agentSessions)?r.agentSessions:[]}}catch(r){let n=`${e}.corrupt-${Date.now()}`;try{m.renameSync(e,n),console.warn(`[sootsim] attached-projects.json was unparseable; quarantined to ${n}. original error: ${r.message}`)}catch{}return $()}}function X(e){let t=U();m.mkdirSync(y.dirname(t),{recursive:!0});let r=`${t}.tmp-${process.pid}-${Date.now()}`,n=m.openSync(r,"w",384);try{m.writeFileSync(n,JSON.stringify(e,null,2)),m.fsyncSync(n)}finally{m.closeSync(n)}m.renameSync(r,t)}function w(e){let t=S();return e(t),X(t),t}function B(e){return q("sha256").update(y.resolve(e)).digest("hex").slice(0,16)}function K(){return`s_${G(10).toString("hex")}`}function ge(e){let t=y.resolve(e.cwd),r=B(t),n;return w(o=>{let s=o.attachedProjects.find(c=>c.id===r);if(s){let c={...s,...e,id:r,cwd:t,sourceRoots:e.sourceRoots??s.sourceRoots,knownBundleUrls:e.knownBundleUrls??s.knownBundleUrls,pinnedSourceResolutions:e.pinnedSourceResolutions??s.pinnedSourceResolutions,telemetry:e.telemetry??s.telemetry,updatedAt:Date.now(),createdAt:s.createdAt},g=o.attachedProjects.indexOf(s);o.attachedProjects[g]=c,n=c;return}let a=Date.now(),d={id:r,name:e.name??y.basename(t),cwd:t,repoRoot:e.repoRoot,sourceRoots:e.sourceRoots??[t],framework:e.framework??"unknown",bundleId:e.bundleId,knownBundleUrls:e.knownBundleUrls??[],preferredProvider:e.preferredProvider??"codex",preferredTransport:e.preferredTransport??"tmux",editorOpenCommand:e.editorOpenCommand,moshiWebhookToken:e.moshiWebhookToken,pinnedSourceResolutions:e.pinnedSourceResolutions??{},isolateDiscovery:e.isolateDiscovery,git:e.git,telemetry:e.telemetry??{lastOpened:0,runsCompleted:0},createdAt:a,updatedAt:a};o.attachedProjects.push(d),n=d}),n}function F(e){return S().attachedProjects.find(t=>t.id===e)??null}function ye(){return S().attachedProjects}var Q=336*60*60*1e3;function he(e,t={}){w(r=>{let n=r.attachedProjects.find(s=>s.id===e);if(!n)return;let o=t.ts??Date.now();if(n.telemetry.runsCompleted=(n.telemetry.runsCompleted??0)+1,typeof t.usd=="number"&&Number.isFinite(t.usd)&&t.usd>=0){let s=n.telemetry.costHistory??[],a=o-Q,d=s.filter(c=>c.ts>=a);d.push({ts:o,usd:t.usd}),n.telemetry.costHistory=d}n.updatedAt=o})}function Se(e,t=Date.now()){let r=t-6048e5,n=e.telemetry.costHistory??[],o=0;for(let s of n)s.ts>=r&&(o+=s.usd);return o}function we(e){w(t=>{t.attachedProjects=t.attachedProjects.filter(r=>r.id!==e),t.agentSessions=t.agentSessions.filter(r=>r.projectId!==e),t.previewAttachments=t.previewAttachments.filter(r=>r.projectId!==e)})}function M(e){let t;return w(r=>{if(e.id){let a=r.agentSessions.find(d=>d.id===e.id);if(a){let d={...a,...e,lastSeenAt:Date.now()},c=r.agentSessions.indexOf(a);r.agentSessions[c]=d,t=d;return}}let n=r.attachedProjects.find(a=>a.id===e.projectId);if(!n)throw new Error(`upsertSession: no AttachedProject with id=${e.projectId}`);let o=Date.now(),s={id:e.id??K(),projectId:e.projectId,provider:e.provider,transport:e.transport??n.preferredTransport,cwd:e.cwd??n.cwd,claudeSessionUuid:e.claudeSessionUuid,tmuxSessionName:e.tmuxSessionName,wrapperPid:e.wrapperPid,status:e.status??"idle",needsAttention:e.needsAttention??!1,lastPrompt:e.lastPrompt,lastSummary:e.lastSummary,lastTurnFiles:e.lastTurnFiles,currentlyEditing:e.currentlyEditing,lastSeenAt:o,createdAt:o};r.agentSessions.push(s),t=s}),t}function k(e){return S().agentSessions.find(t=>t.id===e)??null}function C(e){let t=S().agentSessions;return e?t.filter(r=>r.projectId===e):t}function v(e,t){w(r=>{let n=r.agentSessions.find(s=>s.id===e);if(!n)return;let o=r.agentSessions.indexOf(n);r.agentSessions[o]={...n,...t,id:n.id,projectId:n.projectId,createdAt:n.createdAt,lastSeenAt:Date.now()}})}async function ve(){if(S().attachedProjects.length>0)return;let t;try{t=(await import("./demo-app-registry-ISNBFJTI.js")).APPS}catch(n){console.warn("[sootsim] seedFromDemoAppRegistry: could not load demo registry:",n.message);return}if(!Array.isArray(t))return;let r=t;w(n=>{for(let o of r){if(!m.existsSync(o.dir))continue;let s=y.resolve(o.dir),a=B(s);if(n.attachedProjects.some(c=>c.id===a))continue;let d=Date.now();n.attachedProjects.push({id:a,name:o.label,cwd:s,sourceRoots:[s],framework:o.framework,knownBundleUrls:[`http://localhost:${o.preferredPort}/index.bundle`],preferredProvider:"codex",preferredTransport:"tmux",pinnedSourceResolutions:{},telemetry:{lastOpened:0,runsCompleted:0},createdAt:d,updatedAt:d})}})}import{spawn as V,spawnSync as z}from"node:child_process";import{randomUUID as Z}from"node:crypto";import i,{constants as f}from"node:fs";import u from"node:path";import ee from"node:readline";function j(e){return u.join(h(),"sessions",e)}function W(e){return u.join(j(e),"prompt.in")}function J(e){return u.join(j(e),"events.out")}function te(e){return u.join(h(),"transcripts",`${e}.log`)}function O(e,t){if(!e)return!1;try{process.kill(e,0)}catch{return!1}return!(t&&!i.existsSync(j(t)))}function re(){if(process.env.SOOTSIM_BIN)return{cmd:process.env.SOOTSIM_BIN,prefixArgs:[]};if(process.versions.electron){let n=process.resourcesPath;if(n){let o=[u.join(n,"bin","sootsim"),u.join(n,"bin",`sootsim-${process.platform}-${process.arch}`)];for(let s of o)if(i.existsSync(s))return{cmd:s,prefixArgs:[]}}}let e=ne();if(e)return e;let t=process.argv[0],r=process.argv[1];if(r&&/\.(ts|tsx|mjs|cjs|js)$/.test(r))return{cmd:t,prefixArgs:[r]};if(!r||r.includes("/.bin/"))throw new Error("sootsim CLI not found. set SOOTSIM_BIN to the path of the sootsim binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`.");return{cmd:t,prefixArgs:[]}}function ne(){try{let e=se();if(!e)return null;let t=`sootsim-${process.platform}-${process.arch}`,r=u.join(e,"dist-bin",t);if(i.existsSync(r))return{cmd:r,prefixArgs:[]};let n=u.join(e,"dist-cli","bin.js");if(i.existsSync(n)){try{let o=u.join(e,"cli","commands","agent-wrapper.ts");if(i.existsSync(o)){let s=i.statSync(o).mtimeMs;i.statSync(n).mtimeMs<s&&console.warn("[sootsim] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with `bun run --cwd packages/sootsim build:cli` (watch:cli:binary builds dist-bin/ instead).")}}catch{}return{cmd:process.execPath,prefixArgs:[n]}}return null}catch{return null}}function se(){try{let r=T.resolve("sootsim/package.json");return u.dirname(r)}catch{}let e=oe();if(!e)return null;let t=u.dirname(e);for(let r=0;r<8;r++){let n=u.join(t,"package.json");try{if(i.existsSync(n)&&JSON.parse(i.readFileSync(n,"utf8")).name==="sootsim")return t}catch{}let o=u.dirname(t);if(o===t)break;t=o}return null}function oe(){try{let e=import.meta.url;return!e||!e.startsWith("file://")?null:decodeURIComponent(e.slice(7))}catch{return null}}async function ie(e,t,r){let n=u.join(h(),"locks");i.mkdirSync(n,{recursive:!0});try{i.chmodSync(n,448)}catch{}let o=u.join(n,`start-${e}-${t}.lock`),s=Date.now()+4e3,a=null;for(;a===null;)try{a=i.openSync(o,f.O_WRONLY|f.O_CREAT|f.O_EXCL,384)}catch(d){if(d.code!=="EEXIST")throw d;try{let c=Number(i.readFileSync(o,"utf8").trim());if(c&&!ce(c)){i.unlinkSync(o);continue}}catch{}if(Date.now()>s)throw new Error(`another start is in progress for project=${e} provider=${t} (lock: ${o})`);await new Promise(c=>setTimeout(c,50))}try{return i.writeFileSync(a,String(process.pid)),await r()}finally{try{i.closeSync(a)}catch{}try{i.unlinkSync(o)}catch{}}}function ce(e){try{return process.kill(e,0),!0}catch{return!1}}function L(e){let t=u.dirname(e);i.mkdirSync(t,{recursive:!0});try{i.chmodSync(t,448)}catch{}if(i.existsSync(e))try{if(i.statSync(e).isFIFO()){try{i.chmodSync(e,384)}catch{}return}i.unlinkSync(e)}catch{i.unlinkSync(e)}let r=z("mkfifo",["-m","600",e]);if(r.status!==0)throw new Error(`mkfifo(${e}) failed: ${r.stderr?.toString().trim()||"unknown error"}`)}var l=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function Te(e){let t=F(e.projectId);if(!t)throw new l("NO_PROJECT",`no project with id=${e.projectId}`);let r=e.provider||t.preferredProvider||"codex";return ie(t.id,r,async()=>{let n=C(t.id).find(p=>p.provider===r&&p.status!=="ended"&&O(p.wrapperPid,p.id));if(n)throw new l("ALREADY_RUNNING",`session already running for project=${t.id} provider=${r} (session ${n.id}, pid ${n.wrapperPid}). end it first with \`sootsim agent end <sessionId>\`.`);let o=r==="claude"?Z():void 0,s=M({projectId:t.id,provider:r,transport:"pty",cwd:t.cwd,status:"idle",claudeSessionUuid:o}),a=W(s.id),d=J(s.id),c=te(s.id);L(a),L(d);let g=u.dirname(c);i.mkdirSync(g,{recursive:!0});try{i.chmodSync(g,448)}catch{}let{cmd:A,prefixArgs:H}=re(),P=[...H,"agent-wrapper","--session-id",s.id,"--project-id",t.id,"--provider",r,"--cwd",t.cwd,"--prompt-in",a,"--events-out",d,"--transcript",c];e.codexBin&&P.push("--codex-bin",e.codexBin),e.claudeBin&&P.push("--claude-bin",e.claudeBin),e.freshThread&&P.push("--fresh-thread"),o&&P.push("--claude-session-uuid",o);let x=V(A,P,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:h()}});x.unref();let E=e.readyTimeoutMs??6e3,b=await ae(d,p=>p.type==="ready"||p.type==="error",E);if(!b||b.type==="error"){if(x.pid)try{process.kill(x.pid,"SIGTERM")}catch{}try{i.rmSync(j(s.id),{recursive:!0,force:!0})}catch{}v(s.id,{status:"ended"});let p=b&&b.type==="error"?b.message:`no ready event within ${E}ms`;throw new l("WRAPPER_FAILED",p)}return v(s.id,{wrapperPid:x.pid,status:"idle"}),{session:k(s.id),wrapperPid:x.pid}})}async function De(e,t){let r=k(e);if(!r)throw new l("NO_SESSION",`no session with id=${e}`);if(!O(r.wrapperPid,e))throw v(e,{status:"ended"}),new l("NOT_ALIVE",`session wrapper is not alive (pid=${r.wrapperPid}). start a new session.`);let n=W(e);if(!i.existsSync(n))throw new l("NO_FIFO",`prompt FIFO missing: ${n}`);let o=i.openSync(n,f.O_WRONLY);try{let s=R(t);if(!s)throw new l("EMPTY_PROMPT","prompt text is empty");i.writeSync(o,s+`
|
|
3
3
|
`)}finally{i.closeSync(o)}v(e,{lastPrompt:t.displayText??t.text,status:"working"})}async function Re(e){let t=k(e);if(!t)throw new l("NO_SESSION",`no session with id=${e}`);if(O(t.wrapperPid,e))try{process.kill(t.wrapperPid,"SIGTERM")}catch{}let r=j(e),n=h();if(r.startsWith(n))try{i.rmSync(r,{recursive:!0,force:!0})}catch{}v(e,{status:"ended",wrapperPid:void 0})}function Ne(e,t){let r=J(e);if(!i.existsSync(r))throw new l("NO_FIFO",`events FIFO missing: ${r}`);let n=i.openSync(r,f.O_RDWR),o=i.createReadStream("",{fd:n,autoClose:!0}),s=ee.createInterface({input:o,crlfDelay:1/0});s.on("line",d=>{let c=I(d);c&&t(c)});let a=!1;return()=>{if(!a){a=!0;try{s.close()}catch{}try{o.destroy()}catch{}}}}async function ae(e,t,r){let n=i.openSync(e,f.O_RDWR|f.O_NONBLOCK),o=Buffer.alloc(8192),s="",a=Date.now()+r;try{for(;Date.now()<a;){let d=0;try{d=i.readSync(n,o,0,o.length,null)}catch(c){if(c.code!=="EAGAIN")throw c;d=0}if(d>0){s+=o.subarray(0,d).toString("utf8");let c;for(;(c=s.indexOf(`
|
|
4
4
|
`))>=0;){let g=s.slice(0,c);s=s.slice(c+1);let A=I(g);if(A&&t(A))return A}}else await new Promise(c=>setTimeout(c,30))}return null}finally{i.closeSync(n)}}export{I as a,h as b,ge as c,F as d,ye as e,he as f,Se as g,we as h,k as i,C as j,v as k,ve as l,j as m,W as n,J as o,te as p,O as q,re as r,l as s,Te as t,De as u,Re as v,Ne as w};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.46 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import{readFileSync as i}from"node:fs";import{fileURLToPath as e}from"node:url";var r=null;function l(){if(r!=null)return r;let o=[()=>e(import.meta.resolve("sootsim/package.json")),()=>e(new URL("../package.json",import.meta.url))];for(let n of o)try{let t=JSON.parse(i(n(),"utf8")).version;if(typeof t=="string"&&t)return r=t,r}catch{}return r="0.0.0",r}export{l as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as p}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.46 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as p}from"./chunk-PKVNCXQD.js";import{d as c,e as l}from"./chunk-KETYRULQ.js";import{a}from"./chunk-WRNSX5RR.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:
|