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,12 +1,12 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as G}from"./chunk-
|
|
3
|
-
`)}function eo(s,d){let a=d.trim()||"default";return`${s}:${a}`}function
|
|
4
|
-
`).length>=80&&G("describe-use-filters"),
|
|
1
|
+
/*! sootsim v0.1.46 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as G}from"./chunk-BVXZZOBA.js";import{a as De,b as Be}from"./chunk-7CZ5VL7E.js";import{a as X,b as D,c as B,d as z,e as ce,f as ne,g as st,h as nt,i as $e}from"./chunk-PRRVFNFG.js";import{D as ot,a as je,b as Le,c as Je,d as qe,e as We,f as we,g as xe,h as He,i as Ke,j as Ue,k as ze,l as Ye,m as Ge,n as Xe,o as Ve,p as Qe,q as Ze,u as et,w as se,x as tt}from"./chunk-K3I6VLF3.js";import{a as Ee,e as le}from"./chunk-SG7ICXM2.js";import{b as rt,c as it,i as at}from"./chunk-ZM4JL3VP.js";import"./chunk-OHI4DJSD.js";import{a as Ce}from"./chunk-PEXPACO5.js";import"./chunk-FCFKR7EM.js";import"./chunk-XU27QCRX.js";import"./chunk-XKNZR4BB.js";import"./chunk-KV7XS7WL.js";import"./chunk-4OPZYTVB.js";import{a as ye,c as he,d as _e}from"./chunk-MGEB3WEI.js";import{a as Ie}from"./chunk-T4H37KU7.js";import{c as Ae,e as Pe,f as Oe,g as Re,h as be}from"./chunk-DGAHFMAU.js";import{b as Fe}from"./chunk-WWEMLI77.js";import"./chunk-VWJ4O366.js";import"./chunk-M5HZVUQQ.js";import"./chunk-GWOV6KFE.js";import{existsSync as Lt,mkdirSync as Jt,readFileSync as qt,rmSync as lt,writeFileSync as Wt}from"fs";import{tmpdir as Ht}from"os";import{dirname as Kt,join as Ut,resolve as zt}from"path";var re=1,Yt="SOOTSIM_INSPECT_NOTICE_PATH",Gt=300*1e3,Xt=15e3;function ct(){return zt(process.env[Yt]||Ut(Ht(),"sootsim-inspect-notice-state.json"))}function Vt(s,d){return Object.fromEntries(Object.entries(s).filter(([,a])=>typeof a?.signature=="string"&&Number.isFinite(a?.updatedAt)&&d-a.updatedAt<=Gt))}function Qt(s){let d=ct();if(!Lt(d))return{version:re,entries:{}};try{let a=JSON.parse(qt(d,"utf8"));return a.version!==re||!a.entries||typeof a.entries!="object"?(lt(d,{force:!0}),{version:re,entries:{}}):{version:re,entries:Vt(a.entries,s)}}catch{return lt(d,{force:!0}),{version:re,entries:{}}}}function Zt(s){let d=ct();Jt(Kt(d),{recursive:!0}),Wt(d,JSON.stringify(s,null,2)+`
|
|
3
|
+
`)}function eo(s,d){let a=d.trim()||"default";return`${s}:${a}`}function Se(s,d,a,l={}){let f=l.nowMs??Date.now(),i=l.cooldownMs??Xt,y=Qt(f),S=eo(s,d),I=y.entries[S];return I&&I.signature===a&&f-I.updatedAt<i?!1:(y.entries[S]={signature:a,updatedAt:f},Zt(y),!0)}async function dt(s,d={args:[]}){let a=await je(s);if(D(d.args)){B(a);return}console.log(` nodes: ${a.nodes}`)}function ke(s,d){let a=s.indexOf(d);return a>=0&&a+1<s.length?s[a+1]:null}async function ut(s){let{bridge:d,args:a,positional:l}=s,f=a.includes("--verbose")||a.includes("-v"),i=D(a),y=f&&!i,S=a.includes("--watch")||a.includes("-w"),I=1e3,v=a.includes("--compact"),b=a.includes("--no-xy"),k=ke(a,"--testid-like"),_=ke(a,"--only"),T=ke(a,"--subtree"),E=l[1],c=E?/[*?]/.test(E):!1,J=!c&&!_?E:void 0,U=_??(c?E:void 0),C=async()=>{await ce(d,{verbose:y});let Y=await qe(d,{describe:!0,verbose:f,filter:J||"",testIdLike:k||void 0,onlyGlob:U||void 0,subtreeRoot:T||void 0,compact:v,hideXy:b}),W=Y?.tree,w=Y?.shell,M=Y?.keyboard;if(i){B({shell:w,tree:W??"",keyboard:M});return}if(w&&typeof w=="object"){let P=[w.state?`state=${w.state}`:null,w.activeApp?`app=${w.activeApp}`:null,w.showSwitcher?"switcher":null,w.switcherPhase&&w.switcherPhase!=="idle"?`phase=${w.switcherPhase}`:null].filter(Boolean);P.length>0&&console.log(` shell: ${P.join(" ")}`)}if(typeof W=="string"&&W.startsWith("__SUBTREE_NOT_FOUND__:")){let P=W.slice(22);console.log(` subtree root not found: ${P}`),G("subtree-root-not-found",P);return}if(!W){let P=Y?.nodeCount??0;console.log(" no matching nodes found"),!(J||k||U||T)&&P<10&&G("app-still-loading",P);return}if(console.log(W),!(J||k||U||T)&&!S&&W.split(`
|
|
4
|
+
`).length>=80&&G("describe-use-filters"),M&&M.visible){let P=M.spec,V=[P?.keyboardType?`type=${P.keyboardType}`:null,P?.returnKeyType&&P.returnKeyType!=="default"?`return=${P.returnKeyType}`:null,M.mode!=="letters"?`mode=${M.mode}`:null,M.shifted?"shift":null,M.capsLock?"caps":null,P?.autoCapitalize&&P.autoCapitalize!=="sentences"?`autoCap=${P.autoCapitalize}`:null,M.accessoryBarId?`accessory=${M.accessoryBarId}`:null].filter(Boolean);console.log(`
|
|
5
5
|
keyboard: ${V.join(" ")||"visible"}`)}};if(S)for(console.log(` watching... (Ctrl+C to stop)
|
|
6
|
-
`);;)console.clear(),await
|
|
6
|
+
`);;)console.clear(),await C(),await X(I);else await C()}var to=["SOOTSIM_AGENT","CLAUDECODE","CLAUDE_CODE_ENTRYPOINT","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","CURSOR_TRACE_ID","AIDER_MODEL"];function mt(){if(process.env.SOOTSIM_AGENT==="0")return!1;for(let s of to){let d=process.env[s];if(d&&d.trim()&&d!=="0")return!0}return!1}async function pt(s){let{bridge:d,args:a,effectiveArgs:l,positional:f,inspectUsage:i}=s,y=w=>{let M=l.indexOf(w);return M>=0&&M+1<l.length?l[M+1]:null},S=w=>l.includes(w),I=y("--testid")||y("--test-id"),v=y("--role"),b=y("--type"),k=y("--text"),_=S("--pressable"),T=S("--visible"),E=S("--interactive-targets")||S("--actions"),c=!I&&!v&&!b&&!k&&!_&&!T&&!E?f[1]:null,J=k??c,U=await We(d,{testId:I,role:v,type:b,text:J,pressable:_,visible:T,interactive:E});U||(console.error(i("find","<text> | --text <t> | --testid <id> | --role <r> | --type <t> | --pressable | --visible | --interactive-targets")),process.exit(1));let{mode:C,result:L}=U,Y=D(a),W=a.includes("--verbose")||a.includes("--dump");if(Y)C==="interactive-targets"&&Array.isArray(L)?B(we(L).map(w=>({...w,tap:xe(w)}))):B(L??null);else if(Array.isArray(L))if(L.length===0){console.log(` no ${C} nodes found`);let w=await d.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount?.()) || 0)()"});typeof w=="number"&&w<10&&G("app-still-loading",w)}else if(C==="interactive-targets"){let w=we(L);console.log(` found ${w.length} interactive target${w.length===1?"":"s"} (sorted by score):`);for(let M of w.slice(0,20)){let Z=M.absolutePosition?`@(${Math.round(M.absolutePosition.x)},${Math.round(M.absolutePosition.y)})`:"",P=M.layout?`${Math.round(M.layout.width)}x${Math.round(M.layout.height)}`:"?x?",V=M.text?` "${M.text.slice(0,30)}"`:"",te=M.testID?` #${M.testID}`:"",e=M.accessibilityLabel?` \u24D8"${String(M.accessibilityLabel).slice(0,24)}"`:"",t=M.accessibilityRole?`[${M.accessibilityRole}]`:M.type,o=xe(M);console.log(` ${t}${V}${e}${te} ${P} ${Z}`),console.log(` \u2192 ${o}`),W&&console.log(ve(JSON.stringify(M,null,2)," "))}w.length>20&&console.log(` ... and ${w.length-20} more`)}else{console.log(` found ${L.length} node${L.length===1?"":"s"} (${C}):`);for(let w of L.slice(0,20)){let M=w.absolutePosition?`@(${Math.round(w.absolutePosition.x)},${Math.round(w.absolutePosition.y)})`:"",Z=w.layout?`${Math.round(w.layout.width)}x${Math.round(w.layout.height)}`:"?x?",P=w.text?` "${w.text.slice(0,30)}"`:"",V=w.testID?` #${w.testID}`:"",te=w.pressable?" (tap)":"",e=w.accessibilityRole?`[${w.accessibilityRole}]`:w.type;console.log(` ${e}${P}${V} ${Z} ${M}${te}`),W&&console.log(ve(JSON.stringify(w,null,2)," "))}L.length>20&&console.log(` ... and ${L.length-20} more`)}else if(L==null)console.log(` not found: ${J||I||v||b||""||C}`),I&&G("wait-selector-for-missing-testid",I);else{let w=L;if(w.type&&w.absolutePosition){let M=`@(${Math.round(w.absolutePosition.x)},${Math.round(w.absolutePosition.y)})`,Z=w.layout?`${Math.round(w.layout.width)}x${Math.round(w.layout.height)}`:"?x?",P=w.text?` "${w.text.slice(0,40)}"`:"",V=w.testID?` #${w.testID}`:"",te=w.pressable?" (tap)":"",e=w.accessibilityRole?`[${w.accessibilityRole}]`:w.type;console.log(` ${e}${P}${V} ${Z} ${M}${te}`),W&&console.log(ve(JSON.stringify(w,null,2)," "))}else console.log(JSON.stringify(L,null,2))}}function ve(s,d){return s.split(`
|
|
7
7
|
`).map(a=>d+a).join(`
|
|
8
|
-
`)}async function
|
|
9
|
-
`))}async function
|
|
8
|
+
`)}async function ft(s,d={}){let a=await et(s);if("error"in a&&(console.error(a.error),process.exit(1)),d.json){console.log(JSON.stringify(a,null,2));return}let{visible:l,spec:f,mode:i,shifted:y,capsLock:S,accessoryBarId:I}=a,v=[];v.push(`keyboard: ${l?"visible":"hidden"}`),f?(v.push(` type: ${f.keyboardType}`),v.push(` returnKey: ${f.returnKeyType}`),v.push(` autoCap: ${f.autoCapitalize}`),v.push(` autoCorrect: ${f.autoCorrect?"on":"off"}`),v.push(` appearance: ${f.keyboardAppearance}`),f.secureTextEntry&&v.push(" secureTextEntry: true"),f.enablesReturnKeyAutomatically&&v.push(` return: ${f.currentTextIsEmpty?"disabled (empty)":"enabled"}`)):v.push(" spec: <none> (shown via dev-tools with no TextInput)"),v.push(` mode: ${i}${y?" (shifted)":""}${S?" (caps)":""}`),I&&v.push(` accessoryBar: ${I}`),console.log(v.join(`
|
|
9
|
+
`))}async function gt(s){let d=await s.bridge.listSims();if(D(s.args)){B(d.map(a=>({...a,active:a.id===s.simId})));return}at(d,s.simId)}function ee(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/1024/1024).toFixed(1)}MB`}function de(s,d){return d<=0?"?":`${(s/d*100).toFixed(0)}%`}async function yt(s,d={args:[]}){let a=await ot(s);if(D(d.args)){B(a);return}if(console.log(" memory:"),a.imageLoader){let l=a.imageLoader;console.log(" image-loader cache"),console.log(` entries: ${l.cacheEntries} / ${l.cacheMaxEntries} (${de(l.cacheEntries,l.cacheMaxEntries)})`),console.log(` pixel bytes: ${ee(l.cachePixelBytes)} / ${ee(l.cachePixelBudget)} (${de(l.cachePixelBytes,l.cachePixelBudget)})`),console.log(` pending: ${l.pendingFetches} fetches, ${l.pendingBytes} bytes`),console.log(` failed uris: ${l.failedUris}`),console.log(` snapshots: ${l.snapshots}`),console.log(` camera frames: ${l.cameraFrames}`)}else console.log(" image-loader cache: not available (engine pre-rebuild?)");if(a.workerHeap){let l=a.workerHeap;console.log(" worker heap (chrome only)"),console.log(` used: ${ee(l.usedJSHeapSize)} / ${ee(l.jsHeapSizeLimit)} (${de(l.usedJSHeapSize,l.jsHeapSizeLimit)})`),console.log(` total: ${ee(l.totalJSHeapSize)}`)}if(a.hostHeap){let l=a.hostHeap;console.log(" host heap (chrome only)"),console.log(` used: ${ee(l.usedJSHeapSize)} / ${ee(l.jsHeapSizeLimit)} (${de(l.usedJSHeapSize,l.jsHeapSizeLimit)})`),console.log(` total: ${ee(l.totalJSHeapSize)}`)}}function ie(s){let d=s.indexOf("--testid");if(d>=0&&s[d+1])return{mode:"testid",value:s[d+1]};let a=s.indexOf("--test-id");if(a>=0&&s[a+1])return{mode:"testid",value:s[a+1]};let l=s.indexOf("--text");return l>=0&&s[l+1]?{mode:"text",value:s[l+1]}:null}async function ue(s,d){let a=JSON.stringify(d.value),l=d.mode==="testid"?`(await t.findByTestId(${a})) || (await t.findById(${a}))`:`await t.findByText(${a})`;return await s.send({type:"evaluate",code:`(async () => {
|
|
10
10
|
const t = window.__sootsimTest
|
|
11
11
|
if (!t) return null
|
|
12
12
|
const n = ${l}
|
|
@@ -24,7 +24,7 @@ import{a as G}from"./chunk-EHJMKPJP.js";import{a as Ce,b as De}from"./chunk-QJMU
|
|
|
24
24
|
? resolved.cy
|
|
25
25
|
: n.absolutePosition.y + (n.layout.height || 0) / 2
|
|
26
26
|
return { x: cx, y: cy, testID: n.testID, text: n.text }
|
|
27
|
-
})()`})??null}async function
|
|
27
|
+
})()`})??null}async function ht(s,d={}){let{nav:a,keyboard:l,shell:f}=await tt(s);if(d.json){console.log(JSON.stringify({shell:f??null,nav:a,keyboard:l},null,2));return}let i=[];if(f){let y=f.activeApp??f.state??"<none>",S=f.showSwitcher?" (app switcher open)":"",I=typeof f.launchProgress=="number"&&f.launchProgress<.98?` launching (${Math.round(f.launchProgress*100)}%)`:"";i.push(`shell: ${y}${S}${I}`)}else i.push("shell: <unavailable>");if(a){let y=a.transitionPhase!=="idle"?` (${a.transitionPhase}, ${a.activeTransitionCount} active)`:"";if(i.push(`nav: phase=${a.transitionPhase}${y}`),a.screens.length===0)i.push(" <no registered screens \u2014 app may not use react-native-screens>");else for(let S of a.screens){let I=S.isActive?"\u25B6":" ",v=S.routeName?` ${S.routeName}`:"",b=S.headerHeight>0?` header=${S.headerHeight}`:"",k=S.largeTitleState&&S.largeTitleState!=="expanded"?` large-title=${S.largeTitleState}`:"";i.push(` ${I} #${S.id}${v}${b}${k}`)}}else i.push("nav: <runtime not available>");if(l&&l.visible){let y=l.spec?.keyboardType??"default",S=l.spec?.returnKeyType??"default";i.push(`keyboard: visible (${y}, return=${S}, mode=${l.mode??"?"})`)}else i.push("keyboard: hidden");console.log(i.join(`
|
|
28
28
|
`))}async function oe({bridge:s,maxMs:d,pollMs:a=50,stablePolls:l=3,strict:f=!1}){let i=await s.send({type:"evaluate",code:`(async () => {
|
|
29
29
|
const start = Date.now()
|
|
30
30
|
const deadline = start + ${Math.max(0,Math.round(d))}
|
|
@@ -74,12 +74,12 @@ import{a as G}from"./chunk-EHJMKPJP.js";import{a as Ce,b as De}from"./chunk-QJMU
|
|
|
74
74
|
await sleep(pollMs)
|
|
75
75
|
}
|
|
76
76
|
return { settled: false, elapsed: Date.now() - start }
|
|
77
|
-
})()`}),{elapsed:
|
|
77
|
+
})()`}),{elapsed:y,settled:S}=i??{};return{elapsed:typeof y=="number"?y:d,settled:S===!0}}async function bt(s){let{bridge:d,args:a,positional:l}=s,f=l[1]?Number(l[1])*1e3:3e3,i=a.includes("--strict"),{elapsed:y,settled:S}=await oe({bridge:d,maxMs:f,strict:i});console.log(S?` settled in ${y}ms`:` timed out after ${y}ms (may still be animating)`)}async function wt(s){let d=s.positional[1]?Number(s.positional[1]):.5;(!Number.isFinite(d)||d<0)&&(console.error(s.inspectUsage("sleep","[seconds]")),process.exit(1)),await X(d*1e3),console.log(` slept ${d}s`)}async function xt(s){let{bridge:d,args:a,positional:l}=s,f=l[1]?Number(l[1]):5,{tree:i}=await Le(d,f);if(D(a)){B({depth:f,tree:i??null});return}console.log(typeof i=="string"?i:JSON.stringify(i,null,2))}async function $t(s,d={args:[]}){let a=await Je(s);if(D(d.args)){B(a);return}console.log(a.url)}async function St(s){let{wsPort:d,commandTimeoutMs:a,simId:l,positional:f}=s,i=f[1]?Number(f[1]):30,y=Math.max(1e3,(Number.isFinite(i)?i:30)*1e3),S=Math.max(1,Math.ceil(y/500));console.log(" waiting for sim reconnect...");let I=await st(d,a,l,{attempts:S});I||(console.error(" timed out waiting for sim reconnect"),process.exit(1)),I.bridge.close(),le({source:"inspect wait",step:{wait:y},summary:`wait ${Math.round(y/1e3)}s`}),console.log(` ready: ${I.count} nodes`)}var kt=new Set(["app-launch","toast","keyboard","screen","route","alert","actionsheet","picker","notification","fetch","console","shell","scroll","gesture","text-input","react-commit","animation","reanimated"]);function me(s,d){let a=s.indexOf(d);if(a>=0&&a+1<s.length)return s[a+1]}function oo(s,d){if(!d.filter&&!d.equals)return!0;let a=s.data,l=[];if(a&&typeof a=="object")for(let i of["url","displayUrl","message","name","activeName","path","pathname","title","phase","event","type","kind"]){let y=a[i];typeof y=="string"&&y.length>0&&l.push(y)}let f=l.join(" ");return d.equals?l.some(i=>i===d.equals):d.filter?f.toLowerCase().includes(d.filter.toLowerCase()):!0}async function vt(s){let{bridge:d,args:a,positional:l,inspectUsage:f}=s,i=l[1];i||(console.error(f("wait event","<kind> [--max-ms 5000] [--filter <substring>] [--equals <exact>] [--since now|cursor]")),process.exit(1)),kt.has(i)||console.error(` warning: '${i}' is not a known timeline kind \u2014 waiting anyway. known: ${[...kt].sort().join(", ")}`);let y=me(a,"--max-ms"),S=y&&Number.isFinite(Number(y))?Math.max(100,Number(y)):5e3,I=me(a,"--filter"),v=me(a,"--equals"),b=me(a,"--since")??"now",k=a.includes("--json"),_=Date.now(),T=_+S,E=200,c=_;for(;Date.now()<T;){let U={kinds:[i],since:b==="cursor"?void 0:c,limit:50},C=await d.send({type:"evaluate",code:`(async () => {
|
|
78
78
|
const t = window.SootSim?.bridges?.timeline
|
|
79
79
|
if (!t) return { ok: false, error: 'timeline bridge missing' }
|
|
80
80
|
return { ok: true, result: await t.recent(${JSON.stringify(U)}) }
|
|
81
|
-
})()`});(!
|
|
82
|
-
`).slice(0,5);for(let
|
|
81
|
+
})()`});(!C||!C.ok)&&(console.error(` could not query timeline: ${C&&"error"in C?C.error:"unknown"}`),process.exit(1));let L=C.result.events??[];for(let Y of L)if(oo(Y,{filter:I,equals:v})){let W=Date.now()-_;console.log(k?JSON.stringify({found:!0,elapsedMs:W,event:Y}):` ${i} event after ${W}ms${I?` (filter: ${I})`:""}${v?` (equals: ${v})`:""}`);return}C.result.watermark&&C.result.watermark>c&&(c=C.result.watermark),await new Promise(Y=>setTimeout(Y,E))}let J=Date.now()-_;k?console.log(JSON.stringify({found:!1,elapsedMs:J,kind:i,filter:I,equals:v})):console.error(` \u26A0 wait event ${i} timed out after ${J}ms${I?` (filter: ${I})`:""}${v?` (equals: ${v})`:""}`),process.exit(1)}async function Tt(s){let{bridge:d,args:a}=s,l=a.includes("--strict"),f=a.indexOf("--max-ms"),i=f>=0&&a[f+1]?Math.max(100,Number(a[f+1])):3e3,{elapsed:y,settled:S}=await oe({bridge:d,maxMs:i,strict:l});S?console.log(` idle in ${y}ms`):(console.error(` \u26A0 wait idle timed out after ${y}ms (may still be animating)`),process.exit(1))}async function Mt(s){let{bridge:d,args:a}=s,l=2e4,f=a.indexOf("--max-ms");f>=0&&a[f+1]&&(l=Math.max(100,Number(a[f+1])));let{ready:i,elapsedMs:y,nodes:S}=await He(d,l);if(i){console.log(` ready in ${y}ms: ${S} nodes (flag)`);return}console.error(` \u26A0 wait ready timed out after ${y}ms \u2014 guest app did not emit sootsim:externalAppReady (nodes: ${S})`),process.exit(1)}async function Nt(s){let{bridge:d,args:a,positional:l,inspectUsage:f}=s,i=l[1];i||(console.error(f("wait selector","<testid> [--max-ms 5000]")),process.exit(1));let y=a.indexOf("--max-ms"),S=y>=0&&a[y+1]?Math.max(100,Number(a[y+1])):5e3,{found:I,node:v,elapsed:b}=await Ke(d,i,S);if(I&&v){let k=v.absolutePosition?`@(${Math.round(v.absolutePosition.x)},${Math.round(v.absolutePosition.y)})`:"",_=v.layout?`${Math.round(v.layout.width)}x${Math.round(v.layout.height)}`:"?x?";console.log(` found #${i} in ${b}ms ${_} ${k}`)}else console.error(` \u26A0 wait selector #${i} timed out after ${b??S}ms`),process.exit(1)}function Ot(s){return s==null?"\u2014":s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}K`:`${(s/1024/1024).toFixed(1)}M`}function Rt(s){return s==null?" \u2026":s<1e3?`${s}ms`.padStart(5):`${(s/1e3).toFixed(2)}s`.padStart(5)}function no(s){return s.error?"err":s.status==null?" \u2026 ":String(s.status)}function It(s){let d=new Date(s.startTs).toLocaleTimeString(),a=no(s).padEnd(3),l=s.method.padEnd(5),f=Ot(s.size).padStart(6),i=Rt(s.durationMs);console.log(` [${d}] ${a} ${l} ${f} ${i} ${s.displayUrl}`),s.error&&console.log(` error: ${s.error}`)}function ro(s){let d=[["id",s.id],["source",s.source],["kind",s.kind],["method",s.method],["status",s.error?`error: ${s.error}`:`${s.status??"\u2014"} ${s.statusText??""}`.trim()],["url",s.url],["started",new Date(s.startTs).toLocaleTimeString()],["duration",Rt(s.durationMs).trim()],["size",Ot(s.size)],["content-type",s.type??"\u2014"]];for(let[a,l]of d)console.log(` ${a.padEnd(13)} ${l}`)}var io={error:"\x1B[31m",warn:"\x1B[33m",info:"\x1B[36m",debug:"\x1B[35m",log:"\x1B[37m"},_t="\x1B[0m",ao="\x1B[2m";function Ft(s,d){let a=new Date(s.ts).toLocaleTimeString(),l=s.level.toUpperCase().padEnd(5),f=s.args.join(" ");if(d){let i=io[s.level];console.log(` ${ao}[${a}]${_t} ${i}${l}${_t} ${f}`)}else console.log(` [${a}] ${l} ${f}`);if(s.stack&&s.level==="error"){let i=s.stack.split(`
|
|
82
|
+
`).slice(0,5);for(let y of i)console.log(` ${y.trim()}`)}}var Q="__sootsimCliPerf",lo=120;async function At(s,d){let a=s.find((_,T)=>s[T-1]==="--id"),l=s.find((_,T)=>s[T-1]==="--text");if(a||l){let _=await d.send({type:"evaluate",code:De({id:a,text:l})});if(!_)throw new Error(a?`no node with id "${a}"`:`no node matching text "${l}"`);let{x:T,y:E,w:c,h:J}=_;return{x:T,y:E,w:c,h:J}}let f=s.find((_,T)=>s[T-1]==="--area");if(f){let _=f.split(",").map(U=>Number(U.trim()));if(_.length!==4||_.some(U=>!Number.isFinite(U)))throw new Error(`--area expects x,y,w,h (got "${f}")`);let[T,E,c,J]=_;return{x:T,y:E,w:c,h:J}}let i=_=>{let T=s.find((c,J)=>s[J-1]===_);if(T==null)return null;let E=Number(T);return Number.isFinite(E)?E:null},y=i("--x"),S=i("--y"),I=i("--w"),v=i("--h");if(y!=null||S!=null||I!=null||v!=null)return{x:y??0,y:S??0,w:I??1,h:v??1};let k=s.filter((_,T)=>T>0&&!_.startsWith("-")&&s[T-1]!=="--output"&&s[T-1]!=="--area"&&s[T-1]!=="--id"&&s[T-1]!=="--text"&&s[T-1]!=="--x"&&s[T-1]!=="--y"&&s[T-1]!=="--w"&&s[T-1]!=="--h").map(Number).filter(_=>Number.isFinite(_));if(k.length>=2){let[_,T,E=1,c=1]=k;return{x:_,y:T,w:E,h:c}}return null}function Te(s){let d={"<8":0,"8-12":0,"12-16":0,"16-20":0,"20-33":0,">33":0};for(let a of s)a<8?d["<8"]++:a<12?d["8-12"]++:a<16?d["12-16"]++:a<20?d["16-20"]++:a<33?d["20-33"]++:d[">33"]++;console.log(" histogram:");for(let[a,l]of Object.entries(d)){let f="\u2588".repeat(Math.ceil(l/s.length*40));console.log(` ${a.padEnd(6)} ${f} ${l}`)}}async function pe(s,d,a){let l=Date.now()+d,f=await se(s,d);for(;;){if(a(f))return{settled:!0,state:f};if(Date.now()>=l)return{settled:!1,state:f};await X(16),f=await se(s)}}async function Ne(s){return s.send({type:"evaluate",code:`(async () => {
|
|
83
83
|
const kb = window.__sootsimKeyboard
|
|
84
84
|
const test = window.__sootsimTest
|
|
85
85
|
if (!kb) return { error: 'keyboard bridge not available' }
|
|
@@ -111,7 +111,7 @@ import{a as G}from"./chunk-EHJMKPJP.js";import{a as Ce,b as De}from"./chunk-QJMU
|
|
|
111
111
|
frame: runtimeSnapshot?.keyboard?.frame ?? null,
|
|
112
112
|
focusedRect: runtimeSnapshot?.focused?.rect ?? null,
|
|
113
113
|
}
|
|
114
|
-
})()`})}async function co(s,d=600){let a=Date.now()+d;for(;Date.now()<=a;){let l=await
|
|
114
|
+
})()`})}async function co(s,d=600){let a=Date.now()+d;for(;Date.now()<=a;){let l=await Ne(s);if(l.visible)return l;await X(30)}return Ne(s)}async function fe(s,d){let a=await Ne(s);if(a.visible)return a;console.error(` ${d} requires the iOS keyboard to be visible. focus an input first with sootsim do tap-id/tap-text or sootsim do type-into.`),process.exit(1)}async function Pt(s,d,a){return d==="appearance"?s.send({type:"evaluate",code:`(async () => {
|
|
115
115
|
const requested = ${JSON.stringify(a??"toggle")}
|
|
116
116
|
const rootBg = (document.documentElement?.style?.background || '').toLowerCase()
|
|
117
117
|
const inferredCurrent = rootBg.includes('33') ? 'dark' : 'light'
|
|
@@ -128,25 +128,25 @@ import{a as G}from"./chunk-EHJMKPJP.js";import{a as Ce,b as De}from"./chunk-QJMU
|
|
|
128
128
|
})()`}):s.send({type:"evaluate",code:`(async () => {
|
|
129
129
|
window.dispatchEvent(new CustomEvent(${JSON.stringify(d==="lock"?"sootsim:toggleLock":"sootsim:shake")}))
|
|
130
130
|
return { ok: true, action: ${JSON.stringify(d)} }
|
|
131
|
-
})()`})}function uo(s){let d={Enter:"return",NumpadEnter:"return",Backspace:"delete",Delete:"delete",Space:"space",ShiftLeft:"shift",ShiftRight:"shift"};if(d[s])return d[s];let a=s.match(/^Digit([0-9])$/);if(a)return a[1];let l=s.match(/^Key([A-Z])$/);return l?l[1].toLowerCase():null}function mo(s){if(typeof s!="string")return null;let d=s.replace(/\s+/g," ").trim();return d?d.slice(0,80):null}function
|
|
132
|
-
`),process.exit(0))}if(
|
|
133
|
-
`),process.exit(0))}let t=
|
|
131
|
+
})()`})}function uo(s){let d={Enter:"return",NumpadEnter:"return",Backspace:"delete",Delete:"delete",Space:"space",ShiftLeft:"shift",ShiftRight:"shift"};if(d[s])return d[s];let a=s.match(/^Digit([0-9])$/);if(a)return a[1];let l=s.match(/^Key([A-Z])$/);return l?l[1].toLowerCase():null}function mo(s){if(typeof s!="string")return null;let d=s.replace(/\s+/g," ").trim();return d?d.slice(0,80):null}function Et(...s){for(let d of s){if(typeof d!="string")continue;let a=d.trim();if(a)return a}return null}async function j(s,d,a){let l=le({source:s,step:d,summary:a});l.active&&(l.replaced?console.error(` draft: replaced unkept action "${l.replaced.summary}" \u2014 \`flow keep\` commits one action at a time`):console.error(" draft: action pending \u2014 `sootsim flow keep` to commit"))}function po(s,d,a){if(!a||a.hit===!1)return null;let l=Et(a.responderTestID,a.testID);if(l)return{step:{tapOn:{id:l}},summary:`tap #${l}`};let f=mo(a.text);return f?{step:{tapOn:f},summary:`tap "${f}"`}:{step:{tapAtCoords:{x:s,y:d}},summary:`tap @${Math.round(s)},${Math.round(d)}`}}function Me(s,d,a){let l=Et(d?.testID,d?.id);return l?{step:{tapOn:{id:l}},summary:`tap #${l}`}:a==="id"?{step:{tapOn:{id:s}},summary:`tap #${s}`}:{step:{tapOn:s},summary:`tap "${s}"`}}async function zs(s,d){let a=s[0]==="get"||s[0]==="do"||s[0]==="debug"||s[0]==="wait"?s[0]:null,l=a?s.slice(1):s,f=Ae(l,{port:d.port,commandTimeoutMs:d.timeoutMs,stripBooleanFlags:["--verbose","-v","--help","-h","--clear-state","--json","--all","--watch","-w","--strict","--no-wait","--dump","--failed","--slow","--tail","-f","--interactive-targets","--actions","--internal"],stripValueFlags:["--output","--nth","--index","--testid","--test-id","--text","--max-ms","--filter","--limit","--level","--threshold","--equals","--since"]}),i=f.positional,y=i[0],S=a==="get"||a==="do"||a==="debug"||a==="wait"?a:"inspect",I=typeof l[0]=="string"&&_e.has(l[0]),v=I?l[0]:null,b=e=>I&&e===l[0]?`sootsim ${e}`:`sootsim ${S} ${e}`,k=(e,t)=>` usage: ${b(e)}${t?` ${t}`:""}`;if(!y||s.includes("--help")||s.includes("-h")){let e={bridgePort:7668,defaultShellUrl:Ie};if(S==="do"||S==="get"||S==="debug"||S==="wait"){let r=ye(S,e);r&&(console.log(`${r}
|
|
132
|
+
`),process.exit(0))}if(v==="shell"){let r=he("shell",e);r&&(console.log(`${r}
|
|
133
|
+
`),process.exit(0))}let t=he("inspect",e),o=["do","get","debug","wait"].map(r=>ye(r,e)).filter(r=>r!=null).join(`
|
|
134
134
|
|
|
135
135
|
`);console.log(`${t??""}
|
|
136
136
|
|
|
137
137
|
${o}
|
|
138
|
-
`),process.exit(0)}let _=f.wsPort,
|
|
139
|
-
`);let o=Math.max(...t.map(n=>n.id.length),6),r=Math.max(...t.map(n=>n.kind.length),4);for(let n of t){let u=n.available?"\u2713":"\u2717",m=n.id.padEnd(o)
|
|
138
|
+
`),process.exit(0)}let _=f.wsPort,T=f.simId,E=f.commandTimeoutMs;if(y==="list"&&l.some(e=>e==="--drivers"||e==="-D")){let{buildDriverListRows:e}=await import("./drivers-RXVSKXUD.js"),t=e();console.log(` available drivers (${t.length}):
|
|
139
|
+
`);let o=Math.max(...t.map(n=>n.id.length),6),r=Math.max(...t.map(n=>n.kind.length),4);for(let n of t){let u=n.available?"\u2713":"\u2717",m=n.id.padEnd(o),$=n.kind.padEnd(r);console.log(` ${u} ${m} ${$} ${n.description}`),n.available&&n.detail?console.log(` ${n.detail}`):!n.available&&n.reason&&console.log(` unavailable: ${n.reason}`)}return}let c=Pe(f),J=T||"default",U=new Set(["errors","warnings","requests","js","eval","reload","globals","perf","list","wait","sleep"]);function C(e){let t=e.displayUrl||e.url;return e.status!=null?`${e.method} ${t} -> ${e.status}${e.statusText?` ${e.statusText}`:""}`:e.error?`${e.method} ${t} -> ${e.error}`:`${e.method} ${t}`}async function L(e){let t=mt()?1200:350;try{let{settled:o,elapsed:r}=await oe({bridge:e,maxMs:t,pollMs:32,stablePolls:2});o||process.stderr.write(` \u26A0 auto-wait timed out after ${r??t}ms \u2014 next command may see mid-animation state. use \`sootsim do settle\` for a longer wait.
|
|
140
140
|
`)}catch{}}async function Y(){try{return await c.send({type:"evaluate",code:`(() => ({
|
|
141
141
|
console: window.__sootsimConsole?.count?.() || null,
|
|
142
142
|
requests: window.__sootsimTest?.getRequestCounts?.() || null,
|
|
143
|
-
}))()`})||{console:null,requests:null}}catch{return{console:null,requests:null}}}async function W(e={}){let t=e.counts!==void 0?e.counts:await z(c,"getRequestCounts");if(!t||typeof t!="object")return;let o=Math.max(0,Number(t.failed)||0);if(o===0||!e.includeTail
|
|
144
|
-
network: ${o} failed request${o===1?"":"s"}`),console.log(` inspect: ${
|
|
143
|
+
}))()`})||{console:null,requests:null}}catch{return{console:null,requests:null}}}async function W(e={}){let t=e.counts!==void 0?e.counts:await z(c,"getRequestCounts");if(!t||typeof t!="object")return;let o=Math.max(0,Number(t.failed)||0);if(o===0||!e.includeTail&&!Se("requests",J,String(o))||(console.log(`
|
|
144
|
+
network: ${o} failed request${o===1?"":"s"}`),console.log(` inspect: ${b("requests")} 5`),!e.includeTail))return;let r=await z(c,"getFailedRequests",5);if(!(!Array.isArray(r)||r.length===0)){console.log(`
|
|
145
145
|
recent failed requests:
|
|
146
|
-
`);for(let n of r){let u=new Date(n.timestamp).toLocaleTimeString();console.log(` [${u}] ${
|
|
147
|
-
console: ${u.join(", ")}`),console.log(` inspect: ${
|
|
146
|
+
`);for(let n of r){let u=new Date(n.timestamp).toLocaleTimeString();console.log(` [${u}] ${C(n)}`),n.responseBody?console.log(` ${n.responseBody}`):n.error&&console.log(` ${n.error}`)}}}async function w(e={}){let t=e.counts!==void 0?e.counts:await c.send({type:"evaluate",code:"window.__sootsimConsole?.count?.() || { errors: 0, warnings: 0, total: 0 }"});if(!t||typeof t!="object")return;let o=t,r=Math.max(0,Number(o.errors)||0),n=Math.max(0,Number(o.warnings)||0);if(r===0&&n===0||!e.includeTail&&!Se("console",J,`${r}:${n}`))return;let u=[];if(r>0&&u.push(`${r} console error${r===1?"":"s"}`),n>0&&u.push(`${n} console warning${n===1?"":"s"}`),console.log(`
|
|
147
|
+
console: ${u.join(", ")}`),console.log(` inspect: ${b("errors")} 5`),n>0&&console.log(` inspect: ${b("warnings")} 5`),!e.includeTail||r===0)return;let m=await c.send({type:"evaluate",code:"window.__sootsimConsole?.getErrors?.(5) || []"});if(!(!Array.isArray(m)||m.length===0)){console.log(`
|
|
148
148
|
recent console errors:
|
|
149
|
-
`);for(let
|
|
149
|
+
`);for(let $ of m){let g=new Date($.timestamp).toLocaleTimeString(),x=Array.isArray($.args)?$.args.map(F=>typeof F=="object"?JSON.stringify(F):String(F)).join(" "):String($);console.log(` [${g}] ${x}`)}}}let M=["console","fetch","toast","alert","notification","screen","app-launch","keyboard","route","actionsheet","picker","shell","scroll","gesture","text-input","animation","reanimated"];async function Z(e){let t=Fe(),o=null;try{o=await Re(e,`(() => {
|
|
150
150
|
const tl = window.SootSim && window.SootSim.bridges && window.SootSim.bridges.timeline
|
|
151
151
|
if (!tl || typeof tl.summary !== 'function') return null
|
|
152
152
|
const cursorKey = ${JSON.stringify(t)}
|
|
@@ -162,8 +162,8 @@ ${o}
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
return summary ? { summary, consoleSplit } : null
|
|
165
|
-
})()`)}catch{return}if(!o||!o.summary||!o.summary.total)return;let r=o.summary.byKind??{},n=[],u=new Set;for(let m of
|
|
166
|
-
since last: ${n.join(" \xB7 ")} \u2014 sootsim what-happened`),o.summary.lastAt))try{await
|
|
165
|
+
})()`)}catch{return}if(!o||!o.summary||!o.summary.total)return;let r=o.summary.byKind??{},n=[],u=new Set;for(let m of M){let $=r[m];if($)if(u.add(m),m==="console"&&o.consoleSplit){let{error:g,warn:x}=o.consoleSplit;g>0&&n.push(`${g} error${g===1?"":"s"}`),x>0&&n.push(`${x} warning${x===1?"":"s"}`)}else n.push(`${$} ${m}${$===1?"":"s"}`)}for(let[m,$]of Object.entries(r))!u.has(m)&&$&&n.push(`${$} ${m}${$===1?"":"s"}`);if(n.length!==0&&(console.log(`
|
|
166
|
+
since last: ${n.join(" \xB7 ")} \u2014 sootsim what-happened`),o.summary.lastAt))try{await be(e,"SootSim.bridges.timeline.cursorAdvance",t,o.summary.lastAt)}catch{}}let P=new Set(["tap","double-tap","tap-text","tap-id","type","type-into","key","key-sequence","keycode","drag","swipe","long-press","touch","gesture","pinch","scroll","shell"]),V=new Set(["a11y","capture","count","double-tap","drag","find","gesture","layout","long-press","node","pinch","sample-color","scroll","screenshot","swipe","tap","tap-id","tap-text","touch","tree","type-into"]),te=(s.includes("--verbose")||s.includes("-v"))&&!s.includes("--json");S==="do"&&y==="shell"&&(console.error(" `sootsim do shell` was removed. use `sootsim shell ...` instead."),process.exit(1)),P.has(y)&&await Oe(c),V.has(y)&&await ce(c,{verbose:te});try{switch(y){case"list":{await gt({bridge:c,simId:T,args:l});break}case"tree":{await xt({bridge:c,args:l,positional:i});break}case"a11y":{let e=i[1]?Number(i[1]):5,t=await c.send({type:"evaluate",code:`(async () => {
|
|
167
167
|
const t = window.__sootsimTest
|
|
168
168
|
if (!t) return []
|
|
169
169
|
const all = await t.queryAll({ pruneHidden: true })
|
|
@@ -192,7 +192,7 @@ ${o}
|
|
|
192
192
|
size: n.layout ? { w: Math.round(n.layout.width), h: Math.round(n.layout.height) } : null,
|
|
193
193
|
}))
|
|
194
194
|
})()`});if(!Array.isArray(t)||t.length===0){console.log(" no accessible nodes found");break}if(s.includes("--json"))console.log(JSON.stringify(t,null,2));else{console.log(` accessibility tree (${t.length} nodes):
|
|
195
|
-
`);for(let o of t){let r=[];if(r.push(`[${o.role}]`),o.label){let n=o.label.length>50?o.label.slice(0,47)+"...":o.label;r.push(`"${n}"`)}if(o.hint&&r.push(`(hint: "${o.hint}")`),o.testID&&r.push(`#${o.testID}`),o.state){let n=[];o.state.disabled&&n.push("disabled"),o.state.selected&&n.push("selected"),o.state.checked===!0&&n.push("checked"),o.state.checked==="mixed"&&n.push("mixed"),o.state.busy&&n.push("busy"),o.state.expanded===!0&&n.push("expanded"),o.state.expanded===!1&&n.push("collapsed"),n.length&&r.push(`{${n.join(", ")}}`)}o.position&&r.push(`@(${o.position.x},${o.position.y})`),o.size&&r.push(`${o.size.w}x${o.size.h}`),console.log(" "+r.join(" "))}}break}case"find":{await
|
|
195
|
+
`);for(let o of t){let r=[];if(r.push(`[${o.role}]`),o.label){let n=o.label.length>50?o.label.slice(0,47)+"...":o.label;r.push(`"${n}"`)}if(o.hint&&r.push(`(hint: "${o.hint}")`),o.testID&&r.push(`#${o.testID}`),o.state){let n=[];o.state.disabled&&n.push("disabled"),o.state.selected&&n.push("selected"),o.state.checked===!0&&n.push("checked"),o.state.checked==="mixed"&&n.push("mixed"),o.state.busy&&n.push("busy"),o.state.expanded===!0&&n.push("expanded"),o.state.expanded===!1&&n.push("collapsed"),n.length&&r.push(`{${n.join(", ")}}`)}o.position&&r.push(`@(${o.position.x},${o.position.y})`),o.size&&r.push(`${o.size.w}x${o.size.h}`),console.log(" "+r.join(" "))}}break}case"find":{await pt({bridge:c,args:s,effectiveArgs:l,positional:i,inspectUsage:k});break}case"count":{await dt(c,{args:l});break}case"keyboard":{await ft(c,{json:s.includes("--json")});break}case"screens":{await ht(c,{json:s.includes("--json")});break}case"memory":{await yt(c,{args:l});break}case"wait":{await St({wsPort:_,commandTimeoutMs:E,simId:T,positional:i});break}case"sleep":{await wt({positional:i,inspectUsage:k});break}case"settle":{await bt({bridge:c,args:s,positional:i});break}case"ready":{await Mt({bridge:c,args:s});break}case"idle":{await Tt({bridge:c,args:s,positional:i});break}case"selector":{await Nt({bridge:c,args:s,positional:i,inspectUsage:k});break}case"event":{await vt({bridge:c,args:s,positional:i,inspectUsage:k});break}case"layout":{let e=i[1];e||(console.error(k("layout","<id>")),process.exit(1));let t=await c.send({type:"evaluate",code:`(async () => await window.__sootsimTest.getLayout(${JSON.stringify(e)}))()`});console.log(JSON.stringify(t,null,2));break}case"capture":case"screenshot":{let t=s.find(($,g)=>s[g-1]==="--output")||"/tmp/sootsim-inspect.png",o=await At(s,c),r={type:"screenshot"};o&&(r.crop=o);let u=(await c.send(r)).replace(/^data:image\/png;base64,/,"");o&&console.log(` area: x=${o.x} y=${o.y} w=${o.w} h=${o.h}`),(await import("fs")).writeFileSync(t,Buffer.from(u,"base64")),console.log(` saved: ${t}`);break}case"sample-color":{let e=await At(s,c);e||(console.error(k("sample-color","<x> <y> [w] [h] | --id <testID> | --text <text>")),console.error(" samples an averaged color from the canvas. coords are logical sootsim units."),process.exit(1));let t=await c.send({type:"evaluate",code:Be(e)});if(s.includes("--json"))console.log(JSON.stringify(t,null,2));else{let{r:o,g:r,b:n,a:u,hex:m,samples:$}=t,g=e.w===1&&e.h===1?`@(${e.x},${e.y})`:`@(${e.x},${e.y}) ${e.w}x${e.h}`;console.log(` ${m} rgba(${o}, ${r}, ${n}, ${u}) ${g} ${$} samples`)}break}case"node":{let e=i[1];e||(console.error(k("node","<matcher>")),console.error(" resolves testID, id, then text \u2014 dumps full node info as JSON"),process.exit(1));let t=await c.send({type:"evaluate",code:`(async () => {
|
|
196
196
|
const t = window.__sootsimTest
|
|
197
197
|
const q = ${JSON.stringify(e)}
|
|
198
198
|
let node = null
|
|
@@ -248,20 +248,20 @@ ${o}
|
|
|
248
248
|
transform,
|
|
249
249
|
parentChain,
|
|
250
250
|
}
|
|
251
|
-
})()`});console.log(JSON.stringify(t,null,2));break}case"tap":{let e=Number(i[1]),t=Number(i[2]),o=ie(s);if(o){let u=await ue(c,o);u||(console.error(` not found: ${o.value}`),o.mode==="testid"&&G("wait-selector-for-missing-testid",o.value),process.exit(1)),e=u.x,t=u.y}(!Number.isFinite(e)||!Number.isFinite(t))&&(console.error(
|
|
251
|
+
})()`});console.log(JSON.stringify(t,null,2));break}case"tap":{let e=Number(i[1]),t=Number(i[2]),o=ie(s);if(o){let u=await ue(c,o);u||(console.error(` not found: ${o.value}`),o.mode==="testid"&&G("wait-selector-for-missing-testid",o.value),process.exit(1)),e=u.x,t=u.y}(!Number.isFinite(e)||!Number.isFinite(t))&&(console.error(k("tap","<x> <y> | --testid <id> | --text <t>")),process.exit(1));let r=await c.send({type:"tap",x:e,y:t}),n=po(e,t,r);n&&await j("inspect tap",n.step,n.summary),console.log(JSON.stringify(r,null,2));break}case"drag":case"swipe":{let e=Number(i[1]),t=Number(i[2]),o=Number(i[3]),r=Number(i[4]),n=y==="swipe"?10:12,u=y==="swipe"?8:16,m=i[5]?Number(i[5]):n,$=i[6]?Number(i[6]):u;(!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(o)||!Number.isFinite(r)||!Number.isFinite(m)||!Number.isFinite($))&&(console.error(k(y,"<x1> <y1> <x2> <y2> [steps] [stepMs]")),process.exit(1));let g=await c.send({type:"evaluate",code:`(async () => {
|
|
252
252
|
const interact = window.__sootsimInteract
|
|
253
253
|
if (!interact?.drag) return { ok: false, reason: 'no interact.drag' }
|
|
254
|
-
const value = await interact.drag(${e}, ${t}, ${o}, ${r}, ${Math.max(1,Math.round(m))}, ${Math.max(0,Math.round(
|
|
254
|
+
const value = await interact.drag(${e}, ${t}, ${o}, ${r}, ${Math.max(1,Math.round(m))}, ${Math.max(0,Math.round($))})
|
|
255
255
|
return { ok: !!value, value }
|
|
256
|
-
})()`});if(g?.ok){let
|
|
256
|
+
})()`});if(g?.ok){let x=Math.max(1,Math.round(Math.max(1,m)*Math.max(0,$)));await j(`inspect ${y}`,{swipe:{start:`${e}, ${t}`,end:`${o}, ${r}`,duration:x}},`${y} ${e},${t} -> ${o},${r}`)}console.log(JSON.stringify(g,null,2));break}case"pinch":{let e=Number(i[1]),t=Number(i[2]),o=Number(i[3]),r=Number(i[4]),n=Number(i[5]),u=Number(i[6]),m=Number(i[7]),$=Number(i[8]),g=i[9]?Number(i[9]):12,x=i[10]?Number(i[10]):16;(!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(o)||!Number.isFinite(r)||!Number.isFinite(n)||!Number.isFinite(u)||!Number.isFinite(m)||!Number.isFinite($)||!Number.isFinite(g)||!Number.isFinite(x))&&(console.error(k("pinch","<x1> <y1> <x2> <y2> <x1'> <y1'> <x2'> <y2'> [steps] [stepMs]")),process.exit(1));let F=await c.send({type:"evaluate",code:`(async () => {
|
|
257
257
|
const interact = window.__sootsimInteract
|
|
258
258
|
if (!interact?.pinch) return { ok: false, reason: 'no interact.pinch' }
|
|
259
|
-
const value = await interact.pinch(${e}, ${t}, ${o}, ${r}, ${n}, ${u}, ${m}, ${
|
|
259
|
+
const value = await interact.pinch(${e}, ${t}, ${o}, ${r}, ${n}, ${u}, ${m}, ${$}, ${Math.max(1,Math.round(g))}, ${Math.max(0,Math.round(x))})
|
|
260
260
|
return { ok: !!value, value }
|
|
261
|
-
})()`});
|
|
261
|
+
})()`});F?.ok&&await j("inspect pinch",{pinch:{from:[e,t,o,r],to:[n,u,m,$],steps:Math.max(1,Math.round(g)),stepMs:Math.max(0,Math.round(x))}},`pinch (${e},${t}) (${o},${r}) -> (${n},${u}) (${m},${$})`),console.log(JSON.stringify(F,null,2));break}case"tap-text":{let e=i[1];e||(console.error(k("tap-text","<text>")),process.exit(1));let t=R=>{let A=s.indexOf(R);return A>=0&&A+1<s.length?s[A+1]:null},o=R=>s.includes(R),r=t("--nth")??t("--index"),n=r!==null?Number(r):null;n!==null&&!Number.isFinite(n)&&(console.error(` --nth/--index requires an integer, got: ${r}`),process.exit(1));let u=t("--within"),m=t("--role"),$=o("--exact"),g=o("--first"),x=t("--min-y"),F=t("--max-y"),q=t("--min-x"),H=t("--max-x");for(let[R,A]of[["--min-y",x],["--max-y",F],["--min-x",q],["--max-x",H]])A!==null&&!Number.isFinite(Number(A))&&(console.error(` ${R} requires a number, got: ${A}`),process.exit(1));let K=s.indexOf("--near"),N=null;if(K>=0){let R=Number(s[K+1]),A=Number(s[K+2]);(!Number.isFinite(R)||!Number.isFinite(A))&&(console.error(" --near requires two numbers: --near <x> <y>"),process.exit(1)),N={x:R,y:A}}let h=JSON.stringify({query:e,exact:$,role:m,within:u,minX:q!==null?Number(q):null,maxX:H!==null?Number(H):null,minY:x!==null?Number(x):null,maxY:F!==null?Number(F):null,near:N,nth:n,first:g}),p=await c.send({type:"evaluate",code:`(async () => {
|
|
262
262
|
const t = window.__sootsimTest
|
|
263
263
|
if (!t) return { error: 'bridge-not-ready' }
|
|
264
|
-
const F = ${
|
|
264
|
+
const F = ${h}
|
|
265
265
|
|
|
266
266
|
const res = await t.queryTextCandidates({
|
|
267
267
|
query: F.query,
|
|
@@ -372,7 +372,7 @@ ${o}
|
|
|
372
372
|
total,
|
|
373
373
|
idx,
|
|
374
374
|
}
|
|
375
|
-
})()`});if(p?.error==="bridge-not-ready"&&(console.error(" sootsim test bridge not ready"),process.exit(1)),p?.ambiguous){let
|
|
375
|
+
})()`});if(p?.error==="bridge-not-ready"&&(console.error(" sootsim test bridge not ready"),process.exit(1)),p?.ambiguous){let R=p.candidates;console.error(` ambiguous: ${p.total} matches for "${e}"`);for(let A of R){let ge=A.abs?`@(${Math.round(A.abs.x)},${Math.round(A.abs.y)})`:"",ae=A.layout?` ${A.layout.width}x${A.layout.height}`:"",Ct=A.testID?` #${A.testID}`:"",Dt=A.text?` "${A.text}"`:"",Bt=A.ancestorTestIDs.length>0?` within ${A.ancestorTestIDs.slice(0,3).map(jt=>`#${jt}`).join(" > ")}`:"";console.error(` [${A.idx}] <${A.type}>${Dt}${Ct} ${ge}${ae}${Bt}`)}p.total>R.length&&console.error(` ... and ${p.total-R.length} more`),console.error(" pick one:"),console.error(" --nth <index> pick the nth match (top-to-bottom, left-to-right; negatives from end)"),console.error(" --within <testID> narrow to descendants of a node"),console.error(" --min-y / --max-y geometric filter (pixels, absolute)"),console.error(" --min-x / --max-x geometric filter (pixels, absolute)"),console.error(" --near <x> <y> pick the closest match to a point"),console.error(" --exact exact text match (default is substring)"),console.error(" --role <role> narrow to accessibilityRole"),console.error(" --first keep the old pick-first-silently behavior"),process.exit(2)}p?.nthOutOfRange&&(console.error(` not found: nth ${p.nth} of ${p.total} match${p.total===1?"":"es"} for "${e}"`),process.exit(1)),(!p||typeof p.cx!="number")&&(console.error(` not found: ${e}`),process.exit(1));let O=await c.send({type:"tap",x:p.cx,y:p.cy});if(O?.hit!==!1&&O?.ok!==!1){let R=Me(e,{id:p.target?.id??null,testID:p.target?.testID??null,type:p.target?.type??null,cx:p.cx,cy:p.cy},"text");await j("inspect tap-text",R.step,R.summary)}console.log(JSON.stringify({matched:p.match,tapped:{nodeId:p.target?.nodeId??null,id:p.target?.id??null,testID:p.target?.testID??null,type:p.target?.type??null,cx:p.cx,cy:p.cy},...p.strategy&&p.strategy!=="matched-node"?{strategy:p.strategy}:{},...p.total>1||n!==null?{nth:{index:p.idx,total:p.total}}:{},result:O},null,2));break}case"tap-best":{let e=i[1];e||(console.error(k("tap-best","<query>")),process.exit(1));let t=JSON.stringify(e),o=await c.send({type:"evaluate",code:`(async () => {
|
|
376
376
|
const t = window.__sootsimTest
|
|
377
377
|
if (!t) return { error: 'bridge-not-ready' }
|
|
378
378
|
// try testID first \u2014 strongest signal of "this is the
|
|
@@ -413,7 +413,7 @@ ${o}
|
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
return { strategy: 'none' }
|
|
416
|
-
})()`});"error"in o&&(console.error(` ${o.error}`),process.exit(1)),o.strategy==="none"&&(console.error(` tap-best: no testID or visible text matched "${e}". try \`sootsim find --interactive-targets\` to list candidates.`),process.exit(1));let r=o.node,n=r.absolutePosition.x+r.layout.width/2,u=r.absolutePosition.y+r.layout.height/2,m=await c.send({type:"tap",x:n,y:u});if(m?.hit!==!1&&m?.ok!==!1){let
|
|
416
|
+
})()`});"error"in o&&(console.error(` ${o.error}`),process.exit(1)),o.strategy==="none"&&(console.error(` tap-best: no testID or visible text matched "${e}". try \`sootsim find --interactive-targets\` to list candidates.`),process.exit(1));let r=o.node,n=r.absolutePosition.x+r.layout.width/2,u=r.absolutePosition.y+r.layout.height/2,m=await c.send({type:"tap",x:n,y:u});if(m?.hit!==!1&&m?.ok!==!1){let $=Me(e,{id:r.id,testID:r.testID,type:r.type,cx:n,cy:u},o.strategy==="testid"?"id":"text");await j("inspect tap-best",$.step,$.summary)}console.log(JSON.stringify({matched:{strategy:o.strategy,nodeId:r.nodeId,id:r.id,testID:r.testID,type:r.type,text:r.text},tapped:{cx:n,cy:u},result:m},null,2));break}case"tap-id":{let e=i[1];e||(console.error(k("tap-id","<id>")),process.exit(1));let t=JSON.stringify(e),o=await c.send({type:"evaluate",code:`(async () => {
|
|
417
417
|
const t = window.__sootsimTest
|
|
418
418
|
if (!t) return null
|
|
419
419
|
const n = (await t.findByTestId(${t})) || (await t.findById(${t}))
|
|
@@ -448,7 +448,7 @@ ${o}
|
|
|
448
448
|
},
|
|
449
449
|
strategy: (resolved && resolved.strategy) || 'matched-node',
|
|
450
450
|
}
|
|
451
|
-
})()`});(!o||typeof o.cx!="number")&&(console.error(` not found: ${e}`),process.exit(1));let r=await c.send({type:"tap",x:o.cx,y:o.cy});if(r?.hit!==!1&&r?.ok!==!1){let n=
|
|
451
|
+
})()`});(!o||typeof o.cx!="number")&&(console.error(` not found: ${e}`),process.exit(1));let r=await c.send({type:"tap",x:o.cx,y:o.cy});if(r?.hit!==!1&&r?.ok!==!1){let n=Me(e,{id:o.target?.id??null,testID:o.target?.testID??null,type:o.target?.type??null,cx:o.cx,cy:o.cy},"id");await j("inspect tap-id",n.step,n.summary)}console.log(JSON.stringify({matched:o.match,tapped:{nodeId:o.target?.nodeId??null,id:o.target?.id??null,testID:o.target?.testID??null,type:o.target?.type??null,cx:o.cx,cy:o.cy},...o.strategy&&o.strategy!=="matched-node"?{strategy:o.strategy}:{},result:r},null,2));break}case"type-into":{let e=i[1],t=i.slice(2).join(" ");(!e||!t)&&(console.error(k("type-into","<id> <text>")),process.exit(1));let o=JSON.stringify(e),r=await c.send({type:"evaluate",code:`(async () => {
|
|
452
452
|
const t = window.__sootsimTest
|
|
453
453
|
if (!t) return null
|
|
454
454
|
const n = await (t.findByTestId(${o}) || t.findById(${o}))
|
|
@@ -460,7 +460,7 @@ ${o}
|
|
|
460
460
|
isTextInput: !!n.isTextInput,
|
|
461
461
|
placeholder: n.placeholder || null,
|
|
462
462
|
}
|
|
463
|
-
})()`});(!r||typeof r.cx!="number")&&(console.error(` not found: ${e}`),process.exit(1)),r.isTextInput||console.error(` warning: ${e} is not a text input (isTextInput: false)`);let n=await c.send({type:"tap",x:r.cx,y:r.cy}),u=await co(c);u.visible||(console.error(` keyboard did not open after tapping ${e}`),process.exit(1));let m=u.focusedInput;m&&(m.testID===e||m.id===e||(console.error(` focus routing mismatch after tap: requested ${JSON.stringify(e)} but focus is on ${JSON.stringify(m.testID??m.id??null)}. did the tap land on an outer Pressable wrapper?`),process.exit(1))),await c.send({type:"keyboard",action:"type",text:t}),await j("inspect type-into",{tapOn:{id:e},inputText:t},`type-into #${e} ${JSON.stringify(t)}`),console.log(JSON.stringify({target:e,isTextInput:r.isTextInput,keyboardOpened:u.visible??n?.keyboardOpened??!1,focusedInput:u.focusedInput??null,typed:t},null,2));break}case"type":{let e=i.slice(1).join(" ");e||(console.error(
|
|
463
|
+
})()`});(!r||typeof r.cx!="number")&&(console.error(` not found: ${e}`),process.exit(1)),r.isTextInput||console.error(` warning: ${e} is not a text input (isTextInput: false)`);let n=await c.send({type:"tap",x:r.cx,y:r.cy}),u=await co(c);u.visible||(console.error(` keyboard did not open after tapping ${e}`),process.exit(1));let m=u.focusedInput;m&&(m.testID===e||m.id===e||(console.error(` focus routing mismatch after tap: requested ${JSON.stringify(e)} but focus is on ${JSON.stringify(m.testID??m.id??null)}. did the tap land on an outer Pressable wrapper?`),process.exit(1))),await c.send({type:"keyboard",action:"type",text:t}),await j("inspect type-into",{tapOn:{id:e},inputText:t},`type-into #${e} ${JSON.stringify(t)}`),console.log(JSON.stringify({target:e,isTextInput:r.isTextInput,keyboardOpened:u.visible??n?.keyboardOpened??!1,focusedInput:u.focusedInput??null,typed:t},null,2));break}case"type":{let e=i.slice(1).join(" ");e||(console.error(k("type","<text>")),process.exit(1)),await fe(c,"type"),await c.send({type:"keyboard",action:"type",text:e}),await j("inspect type",{inputText:e},`type ${JSON.stringify(e)}`),console.log(` typed: ${JSON.stringify(e)}`);break}case"key":{let e=i[1];e||(console.error(k("key","<name>")),process.exit(1)),await fe(c,"key"),await c.send({type:"keyboard",action:"press",text:e}),await j("inspect key",{pressKey:e},`key ${e}`),console.log(` pressed: ${e}`);break}case"key-sequence":{let e=i.slice(1);e.length===0&&(console.error(k("key-sequence","<key> [<key> ...]")),process.exit(1)),await fe(c,"key-sequence");for(let t of e)await c.send({type:"keyboard",action:"press",text:t});await j("inspect key-sequence",{pressKey:e.join(" ")},`key-sequence ${e.join(" ")}`),console.log(` pressed: ${e.join(", ")}`);break}case"keycode":{let e=i.slice(1);e.length===0&&(console.error(k("keycode","<code> [<code> ...]")),process.exit(1));let t=e.map(r=>({code:r,key:uo(r)})),o=t.filter(r=>!r.key);o.length>0&&(console.error(` unsupported keycode(s): ${o.map(r=>r.code).join(", ")}`),process.exit(1)),await fe(c,"keycode");for(let r of t)await c.send({type:"keyboard",action:"press",text:r.key});await j("inspect keycode",{pressKey:t.map(r=>r.key).join(" ")},`keycode ${e.join(" ")}`),console.log(` pressed: ${e.join(", ")}`);break}case"dispatch":{let e=i[1];e||(console.error(k("dispatch","<char>")),process.exit(1)),await c.send({type:"keyboard",action:"dispatchKey",text:e}),await j("inspect dispatch",{dispatchKey:e},`dispatch ${JSON.stringify(e)}`),console.log(` dispatched: ${e}`);break}case"dismiss":{await c.send({type:"keyboard",action:"dismiss"}),await j("inspect dismiss",{hideKeyboard:!0},"dismiss keyboard"),console.log(" keyboard dismissed");break}case"double-tap":{let e=Number(i[1]),t=Number(i[2]),o=ie(s);if(o){let m=await ue(c,o);m||(console.error(` not found: ${o.value}`),o.mode==="testid"&&G("wait-selector-for-missing-testid",o.value),process.exit(1)),e=m.x,t=m.y}let r=i[3]?Number(i[3]):80;(!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(r))&&(console.error(k("double-tap","<x> <y> [gapMs] | --testid <id>")),process.exit(1));let n=Math.max(0,Math.round(r)),u=await c.send({type:"evaluate",code:`(async () => {
|
|
464
464
|
const interact = window.__sootsimInteract
|
|
465
465
|
if (interact?.doubleTap) {
|
|
466
466
|
return {
|
|
@@ -483,18 +483,18 @@ ${o}
|
|
|
483
483
|
first,
|
|
484
484
|
second,
|
|
485
485
|
}
|
|
486
|
-
})()`});u?.ok&&await j("inspect double-tap",{doubleTapAtCoords:{x:e,y:t,gapMs:n}},`double-tap @${e},${t}`),console.log(JSON.stringify(u,null,2));break}case"long-press":{let e=Number(i[1]),t=Number(i[2]),o=ie(s);if(o){let u=await ue(c,o);u||(console.error(` not found: ${o.value}`),o.mode==="testid"&&G("wait-selector-for-missing-testid",o.value),process.exit(1)),e=u.x,t=u.y}let r=i[3]?Number(i[3]):600;(!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(r))&&(console.error(
|
|
486
|
+
})()`});u?.ok&&await j("inspect double-tap",{doubleTapAtCoords:{x:e,y:t,gapMs:n}},`double-tap @${e},${t}`),console.log(JSON.stringify(u,null,2));break}case"long-press":{let e=Number(i[1]),t=Number(i[2]),o=ie(s);if(o){let u=await ue(c,o);u||(console.error(` not found: ${o.value}`),o.mode==="testid"&&G("wait-selector-for-missing-testid",o.value),process.exit(1)),e=u.x,t=u.y}let r=i[3]?Number(i[3]):600;(!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(r))&&(console.error(k("long-press","<x> <y> [durationMs] | --testid <id>")),process.exit(1));let n=await c.send({type:"evaluate",code:`(async () => {
|
|
487
487
|
const interact = window.__sootsimInteract
|
|
488
488
|
if (!interact?.longPress) return { ok: false, reason: 'no interact.longPress' }
|
|
489
489
|
const value = await interact.longPress(${e}, ${t}, ${Math.max(0,Math.round(r))})
|
|
490
490
|
return { ok: !!value, value }
|
|
491
|
-
})()`});n?.ok&&await j("inspect long-press",{tapAtCoords:{x:e,y:t}},`long-press @${e},${t}`),console.log(JSON.stringify(n,null,2));break}case"touch":{let e=i[1],t=Number(i[2]),o=Number(i[3]),r=i[4]?Number(i[4]):999,n=e==="down"?"touchDown":e==="move"?"touchMove":e==="up"?"touchUp":e==="cancel"?"touchCancel":null;n||(console.error(
|
|
491
|
+
})()`});n?.ok&&await j("inspect long-press",{tapAtCoords:{x:e,y:t}},`long-press @${e},${t}`),console.log(JSON.stringify(n,null,2));break}case"touch":{let e=i[1],t=Number(i[2]),o=Number(i[3]),r=i[4]?Number(i[4]):999,n=e==="down"?"touchDown":e==="move"?"touchMove":e==="up"?"touchUp":e==="cancel"?"touchCancel":null;n||(console.error(k("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1)),e!=="cancel"&&(!Number.isFinite(t)||!Number.isFinite(o))&&(console.error(k("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1));let u=e==="down"?"tap":e==="move"?"move":null,m=u&&Number.isFinite(t)&&Number.isFinite(o)?`window.dispatchEvent(new CustomEvent('sootsim:agentAction', { detail: { type: '${u}', x: ${t}, y: ${o} } }));`:"",$=await c.send({type:"evaluate",code:`(async () => {
|
|
492
492
|
${m}
|
|
493
493
|
const interact = window.__sootsimInteract
|
|
494
494
|
if (!interact?.${n}) return { ok: false, reason: 'no interact.${n}' }
|
|
495
495
|
const value = ${e==="cancel"?`await interact.${n}(${Math.max(1,Math.round(r))})`:`await interact.${n}(${t}, ${o}, ${Math.max(1,Math.round(r))})`}
|
|
496
496
|
return { ok: !!value, value }
|
|
497
|
-
})()`})
|
|
497
|
+
})()`});$?.ok&&e!=="cancel"&&await j("inspect touch",{tapAtCoords:{x:t,y:o}},`touch ${e} @${t},${o}`),console.log(JSON.stringify($,null,2));break}case"gesture":{let e=["scroll-up","scroll-down","scroll-left","scroll-right","swipe-from-left-edge","swipe-from-right-edge","swipe-from-top-edge","swipe-from-bottom-edge"],t=i[1],o=i[2]?Number(i[2]):220;(!t||!Number.isFinite(o))&&(console.error(k("gesture","<preset> [durationMs]")),console.error(` presets: ${e.join(", ")}`),process.exit(1)),e.includes(t)||(console.error(` unknown gesture preset: ${t}`),console.error(` presets: ${e.join(", ")}`),process.exit(1));let r=await c.send({type:"evaluate",code:`(async () => {
|
|
498
498
|
const spec = globalThis.__sootsimDeviceSpec || {}
|
|
499
499
|
return {
|
|
500
500
|
width: spec.width || window.innerWidth || 393,
|
|
@@ -502,12 +502,12 @@ ${o}
|
|
|
502
502
|
statusBarHeight: spec.statusBarHeight || 0,
|
|
503
503
|
homeIndicatorHeight: spec.homeIndicatorHeight || 0,
|
|
504
504
|
}
|
|
505
|
-
})()`}),
|
|
505
|
+
})()`}),n=Number(r?.width)||393,u=Number(r?.height)||852,m=Number(r?.statusBarHeight)||0,$=Number(r?.homeIndicatorHeight)||0,g=Math.round(n/2),x=Math.round(u/2),F=Math.max(24,m+18),q=Math.max(24,$+18),H=18,K=Math.min(220,Math.round(u*.24)),N=Math.min(180,Math.round(n*.32)),h=g,p=x,O=g,R=x;switch(t){case"scroll-up":p=x+Math.round(K/2),R=x-Math.round(K/2);break;case"scroll-down":p=x-Math.round(K/2),R=x+Math.round(K/2);break;case"scroll-left":h=g+Math.round(N/2),O=g-Math.round(N/2);break;case"scroll-right":h=g-Math.round(N/2),O=g+Math.round(N/2);break;case"swipe-from-left-edge":h=H,p=x,O=Math.min(n-H,H+N);break;case"swipe-from-right-edge":h=n-H,p=x,O=Math.max(H,n-H-N);break;case"swipe-from-top-edge":h=g,p=F,R=Math.min(u-q,F+K);break;case"swipe-from-bottom-edge":h=g,p=u-q,R=Math.max(F,u-q-K);break}let A=Math.max(8,Math.round(o/16)),ge=Math.max(1,Math.round(o/A)),ae=await c.send({type:"evaluate",code:`(async () => {
|
|
506
506
|
const interact = window.__sootsimInteract
|
|
507
507
|
if (!interact?.drag) return { ok: false, reason: 'no interact.drag' }
|
|
508
|
-
const value = await interact.drag(${
|
|
508
|
+
const value = await interact.drag(${h}, ${p}, ${O}, ${R}, ${A}, ${ge})
|
|
509
509
|
return { ok: !!value, value }
|
|
510
|
-
})()`});ae?.ok&&await j("inspect gesture",{swipe:{start:`${
|
|
510
|
+
})()`});ae?.ok&&await j("inspect gesture",{swipe:{start:`${h}, ${p}`,end:`${O}, ${R}`,duration:Math.max(1,Math.round(o))}},`gesture ${t}`),console.log(JSON.stringify({preset:t,from:{x:h,y:p},to:{x:O,y:R},result:ae},null,2));break}case"scroll":{let e=ie(s),t=e?.mode==="testid"?e.value:i[1],o=Number(i[e?1:2]),r=Number(i[e?2:3]);(!t||!Number.isFinite(o)||!Number.isFinite(r))&&(console.error(k("scroll","<id> <dx> <dy> | --testid <id> <dx> <dy>")),process.exit(1));let n=await c.send({type:"evaluate",code:`(async () => {
|
|
511
511
|
const t = window.__sootsimTest
|
|
512
512
|
if (!t) return null
|
|
513
513
|
const n = await t.findByTestId(${JSON.stringify(t)})
|
|
@@ -521,7 +521,7 @@ ${o}
|
|
|
521
521
|
errors: window.__sootsimConsole?.getErrors?.()?.length ?? 0,
|
|
522
522
|
warnings: window.__sootsimConsole?.getWarnings?.()?.length ?? 0,
|
|
523
523
|
})`});o&&typeof o=="object"&&o.diagnostics&&(o.diagnostics.errors=r?.errors??0,o.diagnostics.warnings=r?.warnings??0),console.log(JSON.stringify(o,null,2));break}if(!e||e==="--help"||e==="-h"){console.log(`
|
|
524
|
-
${
|
|
524
|
+
${b("state")} \u2014 dump raw runtime state
|
|
525
525
|
|
|
526
526
|
subcommands:
|
|
527
527
|
shell dump shell transition/layout state
|
|
@@ -535,15 +535,15 @@ ${o}
|
|
|
535
535
|
gesture <x> <y> dump gesture routing/debug info at coordinates
|
|
536
536
|
|
|
537
537
|
examples:
|
|
538
|
-
${
|
|
539
|
-
${
|
|
540
|
-
${
|
|
541
|
-
${
|
|
542
|
-
${
|
|
543
|
-
${
|
|
544
|
-
${
|
|
545
|
-
${
|
|
546
|
-
`);break}let t;switch(e){case"shell":t=await se(c,500);break;case"worker":t=await
|
|
538
|
+
${b("state")} shell
|
|
539
|
+
${b("state")} worker
|
|
540
|
+
${b("state")} keyboard
|
|
541
|
+
${b("state")} ownership
|
|
542
|
+
${b("state")} node photos
|
|
543
|
+
${b("state")} scroll feed
|
|
544
|
+
${b("state")} scroll-hit 360 420
|
|
545
|
+
${b("state")} hit 200 720
|
|
546
|
+
`);break}let t;switch(e){case"shell":t=await se(c,500);break;case"worker":t=await be(c,"__sootsimRenderHost.queryStats");break;case"ownership":t=await c.send({type:"evaluate",code:`(() => {
|
|
547
547
|
const h = window.__sootsimRenderHost
|
|
548
548
|
if (!h || typeof h.getOwnershipSnapshot !== 'function') {
|
|
549
549
|
return { error: 'getOwnershipSnapshot not available' }
|
|
@@ -574,8 +574,8 @@ ${o}
|
|
|
574
574
|
text: focused.text || null,
|
|
575
575
|
} : null,
|
|
576
576
|
}
|
|
577
|
-
})()`});break;case"node":{let o=i[2];o||(console.error(` usage: ${
|
|
578
|
-
${
|
|
577
|
+
})()`});break;case"node":{let o=i[2];o||(console.error(` usage: ${b("state")} node <id>`),process.exit(1)),t=await z(c,"findByTestId",o)||await z(c,"findById",o);break}case"scroll":{let o=i[2];o||(console.error(` usage: ${b("state")} scroll <id>`),process.exit(1)),t=await z(c,"getScrollState",o);break}case"scroll-hit":{let o=Number(i[2]),r=Number(i[3]);(!Number.isFinite(o)||!Number.isFinite(r))&&(console.error(` usage: ${b("state")} scroll-hit <x> <y>`),process.exit(1)),t=await z(c,"getScrollStateAt",o,r);break}case"hit":{let o=Number(i[2]),r=Number(i[3]);(!Number.isFinite(o)||!Number.isFinite(r))&&(console.error(` usage: ${b("state")} hit <x> <y>`),process.exit(1)),t=await z(c,"debugHitAt",o,r);break}case"gesture":{let o=Number(i[2]),r=Number(i[3]);(!Number.isFinite(o)||!Number.isFinite(r))&&(console.error(` usage: ${b("state")} gesture <x> <y>`),process.exit(1)),t=await z(c,"debugGestureAt",o,r);break}default:console.error(` unknown state subcommand: ${e}`),process.exit(1)}console.log(JSON.stringify(t,null,2));break}case"shell":{let e=i[1];if(!e||e==="--help"||e==="-h"){console.log(`
|
|
578
|
+
${b("shell")} \u2014 run built-in shell commands
|
|
579
579
|
|
|
580
580
|
subcommands:
|
|
581
581
|
launch <appId> [waitMs] [--clear-state]
|
|
@@ -590,15 +590,15 @@ ${o}
|
|
|
590
590
|
shake trigger the simulator shake gesture
|
|
591
591
|
|
|
592
592
|
examples:
|
|
593
|
-
${
|
|
594
|
-
${
|
|
595
|
-
${
|
|
596
|
-
${
|
|
597
|
-
${
|
|
598
|
-
${
|
|
599
|
-
${
|
|
600
|
-
${
|
|
601
|
-
`);break}let t=e==="launch"||e==="open-card"||e==="home"||e==="switcher",o=e==="launch"||e==="open-card"?i[3]:i[2],r=o?Number(o):350;t&&(!Number.isFinite(r)||r<0)&&(console.error(
|
|
593
|
+
${b("shell")} launch photos
|
|
594
|
+
${b("shell")} launch rn --clear-state
|
|
595
|
+
${b("shell")} launch photos 1500
|
|
596
|
+
${b("shell")} home 500
|
|
597
|
+
${b("shell")} switcher 800
|
|
598
|
+
${b("shell")} open-card clock 800
|
|
599
|
+
${b("shell")} appearance dark
|
|
600
|
+
${b("shell")} lock
|
|
601
|
+
`);break}let t=e==="launch"||e==="open-card"||e==="home"||e==="switcher",o=e==="launch"||e==="open-card"?i[3]:i[2],r=o?Number(o):350;t&&(!Number.isFinite(r)||r<0)&&(console.error(k("shell",e==="launch"||e==="open-card"?"<launch|open-card> <appId> [settleMs]":"<home|switcher> [settleMs]")),process.exit(1));let n=!1,u=!1,m=null,$=s.includes("--clear-state");if(e==="launch"){let g=i[2];g||(console.error(k("shell","launch <appId> [settleMs] [--clear-state]")),process.exit(1)),$&&await c.send({type:"evaluate",code:Ee}),n=!!await ne(c,"launchApp",r,g),{settled:u,state:m}=await pe(c,Math.round(r),x=>!!x&&x.state==="app"&&x.activeApp===g&&x.showSwitcher===!1&&x.switcherPhase==="idle"&&typeof x.launchProgress=="number"&&x.launchProgress>=.98),n&&await j("inspect shell launch",$?{launchApp:{clearState:!0}}:{launchApp:{}},$?"launch app (clear state)":"launch app")}else if(e==="home")n=!!await ne(c,"goHome",r),{settled:u,state:m}=await pe(c,Math.round(r),g=>!!g&&g.state==="home"&&g.activeApp==null&&g.showSwitcher===!1&&g.switcherPhase==="idle"&&typeof g.launchProgress=="number"&&g.launchProgress>=.98);else if(e==="switcher")n=!!await ne(c,"openSwitcher",r),{settled:u,state:m}=await pe(c,Math.round(r),g=>!!g&&g.state==="app"&&g.showSwitcher===!0&&g.switcherPhase==="idle"&&typeof g.zoomLevel=="number"&&Math.abs(g.zoomLevel)<=.02&&typeof g.horizontalZoom=="number"&&Math.abs(g.horizontalZoom)<=.02),u&&(await X(lo),m=await se(c));else if(e==="open-card"){let g=i[2];g||(console.error(k("shell","open-card <appId> [settleMs]")),process.exit(1)),n=!!await ne(c,"openSwitcherCard",r,g),{settled:u,state:m}=await pe(c,Math.round(r),x=>!!x&&x.state==="app"&&x.activeApp===g&&x.showSwitcher===!1&&x.switcherPhase==="idle"&&typeof x.zoomLevel=="number"&&x.zoomLevel>=.98&&typeof x.horizontalZoom=="number"&&x.horizontalZoom>=.98),n&&await j("inspect shell open-card",{openSwitcherCard:{appId:g}},`open switcher card ${g}`)}else if(e==="appearance"){let g=i[2];(!g||!["light","dark","auto","toggle"].includes(g))&&(console.error(k("shell","appearance <light|dark|auto|toggle>")),process.exit(1));let x=await Pt(c,"appearance",g);if(n=!!x?.ok,m={appearance:x},n){let F=x?.applied??g;console.log(` appearance: ${F}`)}}else if(e==="lock"||e==="shake"){let g=await Pt(c,e);n=!!g?.ok,m={[e]:g}}else console.error(` unknown shell subcommand: ${e}`),process.exit(1);console.log(JSON.stringify({ok:n,settled:u,state:m},null,2));break}case"url":{await $t(c,{args:l});break}case"reload":{let o=!1,r=!1;try{await c.send({type:"evaluate",code:"window.__sootsimConsole?.clear()"});let m=await c.send({type:"evaluate",code:`;(() => {
|
|
602
602
|
const reloadExternalApp = window.SootSim?.bridges?.hotRemount?.reloadExternalApp
|
|
603
603
|
if (typeof reloadExternalApp === 'function') {
|
|
604
604
|
reloadExternalApp()
|
|
@@ -606,10 +606,10 @@ ${o}
|
|
|
606
606
|
}
|
|
607
607
|
window.location.reload()
|
|
608
608
|
return { kind: 'page' }
|
|
609
|
-
})()`});r=!!m&&m.kind==="external-app",o=!0}catch{}console.log(" reloading...");let n=c,u=null;if(r)u=await
|
|
609
|
+
})()`});r=!!m&&m.kind==="external-app",o=!0}catch{}console.log(" reloading...");let n=c,u=null;if(r)u=await $e(c,{timeoutMs:1e4,errorGraceMs:3e3});else{o&&await X(300);let m=await nt(_,E,T,{timeoutMs:1e4});m?(n=m,u=await $e(m,{timeoutMs:1e4,errorGraceMs:3e3})):(console.log(" \u26A0 reload: bridge never reconnected within 10000ms"),n=null)}if(u)if(u.ready){let m=u.source==="nodes-fallback"?" (no ready signal, node-count fallback)":"";console.log(` ready in ${u.elapsedMs}ms: ${u.nodes} nodes${m}`)}else u.source==="error-bail"?console.log(` \u26A0 reload bailed after ${u.elapsedMs}ms: ${u.errors} console error(s), ready signal never fired`):console.log(` \u26A0 reload timed out after ${u.elapsedMs}ms (${u.nodes} nodes, ${u.errors} errors)`);if(n)try{let m=await n.send({type:"evaluate",code:"window.__sootsimConsole?.getErrors(10) || []"});if(n!==c&&n.close(),Array.isArray(m)&&m.length>0){console.log(`
|
|
610
610
|
\u26A0 ${m.length} error(s) during mount:
|
|
611
|
-
`);for(let
|
|
612
|
-
`).slice(0,2);for(let
|
|
611
|
+
`);for(let $ of m){let g=$.args.map(x=>typeof x=="object"?JSON.stringify(x):x).join(" ");if(console.log(` ${g}`),$.stack){let x=$.stack.split(`
|
|
612
|
+
`).slice(0,2);for(let F of x)console.log(` ${F.trim()}`)}}}}catch{}u&&!u.ready&&(process.exitCode=1);break}case"eval":case"js":{let e=i.slice(1).join(" ");e||(console.error(k("js","<javascript>")),console.error(""),console.error(" runs the snippet in the engine realm. SootSim is the"),console.error(" canonical state surface \u2014 reach into it directly."),console.error(""),console.error(" examples:"),console.error(` ${b("js")} SootSim.bridges.test.findByText("Sign in")`),console.error(` ${b("js")} SootSim.bridges.debug.snapshot("before")`),console.error(` ${b("js")} SootSim.bridges.keyboard.type("hello")`),console.error(` ${b("js")} SootSim.state.root.children.length`),process.exit(1));let t=e;t.startsWith("(async")||(t=`(async () => ${t})()`);let o=await c.send({type:"evaluate",code:t});console.log(JSON.stringify(o,null,2));let r=e.toLowerCase(),n=[];(r.includes("sootsim:gohome")||r.includes("gohome"))&&n.push("sootsim shell home"),(r.includes("sootsim:appswitcher")||r.includes("appswitcher"))&&n.push("sootsim shell switcher"),(r.includes("keyboard.isvisible")||r.includes("keyboard.getmode"))&&n.push("sootsim debug state keyboard"),r.includes("interact.tap")&&n.push("sootsim do tap <x> <y>"),r.includes("keyboard.type")&&n.push("sootsim do type <text>"),(r.includes("keyboard.press")||r.includes("keyboard.dispatchkey"))&&n.push("sootsim do key <name>"),r.includes("keyboard.dismiss")&&n.push("sootsim do dismiss"),r.includes("dumptree")&&n.push("sootsim get tree"),r.includes("dumpaccessibilitytree")&&n.push("sootsim get a11y"),r.includes("getnodecount")&&n.push("sootsim get count"),r.includes("findbytext")&&n.push("sootsim find <text>"),(r.includes("findbytestid")||r.includes("findbyid"))&&n.push("sootsim find --testid <id>"),r.includes("document.hidden")&&n.push("sootsim debug state keyboard (includes tab health)"),n.length>0&&G("prefer-cli-over-eval",n);break}case"globals":{let e=await c.send({type:"evaluate",code:`(async () => {
|
|
613
613
|
const globals = {}
|
|
614
614
|
|
|
615
615
|
// test bridge (proxy in worker mode)
|
|
@@ -647,8 +647,8 @@ ${o}
|
|
|
647
647
|
|
|
648
648
|
return globals
|
|
649
649
|
})()`});console.log(` sootsim JS API:
|
|
650
|
-
`);for(let[t,o]of Object.entries(e)){console.log(` ${t}:`);for(let r of o)console.log(` .${r}`);console.log("")}console.log(` use: ${
|
|
651
|
-
${
|
|
650
|
+
`);for(let[t,o]of Object.entries(e)){console.log(` ${t}:`);for(let r of o)console.log(` .${r}`);console.log("")}console.log(` use: ${b("js")} <expression>`),console.log(` example: ${b("js")} test.findByText("Sign in")`);break}case"describe":{await ut({bridge:c,args:s,positional:i});break}case"perf":{let e=i[1];if(!e||e==="--help"||e==="-h"){console.log(`
|
|
651
|
+
${b("perf")} \u2014 performance profiling
|
|
652
652
|
|
|
653
653
|
subcommands:
|
|
654
654
|
stats one-shot stats (zero overhead query)
|
|
@@ -658,11 +658,11 @@ ${o}
|
|
|
658
658
|
transition <e> profile a shell transition (goHome, appSwitcher, lockScreen)
|
|
659
659
|
|
|
660
660
|
examples:
|
|
661
|
-
${
|
|
662
|
-
${
|
|
661
|
+
${b("perf")} stats
|
|
662
|
+
${b("perf")} start
|
|
663
663
|
# ... interact with the app ...
|
|
664
|
-
${
|
|
665
|
-
${
|
|
664
|
+
${b("perf")} stop
|
|
665
|
+
${b("perf")} transition goHome
|
|
666
666
|
`);break}switch(e){case"stats":{let t=await c.send({type:"evaluate",code:`(async () => {
|
|
667
667
|
// worker mode (host exposes these)
|
|
668
668
|
if (window.__sootsimPerfStats) {
|
|
@@ -710,7 +710,7 @@ ${o}
|
|
|
710
710
|
startedAt: performance.now(),
|
|
711
711
|
}
|
|
712
712
|
return { started: true }
|
|
713
|
-
})()`}),console.log(` profiling started \u2014 interact with the app, then run '${
|
|
713
|
+
})()`}),console.log(` profiling started \u2014 interact with the app, then run '${b("perf")} stop'`);break}case"stop":{let t=await c.send({type:"evaluate",code:`(async () => {
|
|
714
714
|
// worker mode
|
|
715
715
|
if (window.__sootsimRenderHost) {
|
|
716
716
|
const session = window.${Q} || {}
|
|
@@ -840,7 +840,7 @@ ${o}
|
|
|
840
840
|
mode: 'main-thread',
|
|
841
841
|
frames: (stats.recentFrames || []).slice(-${t}),
|
|
842
842
|
}
|
|
843
|
-
})()`});if(o.error&&(console.error(` error: ${o.error}`),process.exit(1)),o.mode==="render-worker"){let n=Array.isArray(o.samples)?o.samples:[];if(n.length===0){console.log(` no frame data \u2014 run '${
|
|
843
|
+
})()`});if(o.error&&(console.error(` error: ${o.error}`),process.exit(1)),o.mode==="render-worker"){let n=Array.isArray(o.samples)?o.samples:[];if(n.length===0){console.log(` no frame data \u2014 run '${b("perf")} start' first`);break}console.log(` last ${n.length} sampled frames (ms):`),console.log(" total layout render copy aux other t+");for(let[u,m,$,g,x,F,q]of n)console.log(` ${m.toFixed(2).padStart(7)} ${$.toFixed(2).padStart(7)} ${g.toFixed(2).padStart(7)} ${x.toFixed(2).padStart(7)} ${F.toFixed(2).padStart(6)} ${q.toFixed(2).padStart(7)} ${String(u).padStart(5)}`);console.log(""),Te(n.map(u=>u[1])),o.live&&console.log(" sampling continues");break}let r=Array.isArray(o.frames)?o.frames:Array.isArray(o)?o:[];if(r.length===0){console.log(` no frame data \u2014 run '${b("perf")} start' first`);break}console.log(` last ${r.length} frame times (ms):`),console.log(` ${r.map(n=>n.toFixed(2)).join(", ")}`),Te(r);break}case"worst":{let t=i[2]?Number(i[2]):20;(!Number.isFinite(t)||t<=0)&&(console.error(` error: expected a positive frame count, got "${i[2]}"`),process.exit(1));let o=await c.send({type:"evaluate",code:`(async () => {
|
|
844
844
|
if (window.__sootsimRenderHost) {
|
|
845
845
|
const session = window.${Q} || {}
|
|
846
846
|
if (session.active) {
|
|
@@ -882,8 +882,8 @@ ${o}
|
|
|
882
882
|
mode: 'main-thread',
|
|
883
883
|
frames: recent.slice().sort((a, b) => b - a).slice(0, ${t}),
|
|
884
884
|
}
|
|
885
|
-
})()`});if(o.error&&(console.error(` error: ${o.error}`),process.exit(1)),o.mode==="render-worker"){let n=Array.isArray(o.samples)?o.samples:[];if(n.length===0){console.log(` no frame data \u2014 run '${
|
|
886
|
-
${
|
|
885
|
+
})()`});if(o.error&&(console.error(` error: ${o.error}`),process.exit(1)),o.mode==="render-worker"){let n=Array.isArray(o.samples)?o.samples:[];if(n.length===0){console.log(` no frame data \u2014 run '${b("perf")} start' first`);break}console.log(` worst ${n.length} sampled frames (ms):`),console.log(" total layout render copy aux other t+");for(let[u,m,$,g,x,F,q]of n)console.log(` ${m.toFixed(2).padStart(7)} ${$.toFixed(2).padStart(7)} ${g.toFixed(2).padStart(7)} ${x.toFixed(2).padStart(7)} ${F.toFixed(2).padStart(6)} ${q.toFixed(2).padStart(7)} ${String(u).padStart(5)}`);o.live&&(console.log(""),console.log(" sampling continues"));break}let r=Array.isArray(o.frames)?o.frames:Array.isArray(o)?o:[];if(r.length===0){console.log(` no frame data \u2014 run '${b("perf")} start' first`);break}console.log(` worst ${r.length} frame times (ms):`),console.log(` ${r.map(n=>n.toFixed(2)).join(", ")}`);break}case"transition":{let t=i[2];if(!t||!["goHome","appSwitcher","lockScreen"].includes(t)){console.log(`
|
|
886
|
+
${b("perf")} transition <event> \u2014 profile a shell transition
|
|
887
887
|
|
|
888
888
|
events:
|
|
889
889
|
goHome swipe-to-home animation
|
|
@@ -893,8 +893,8 @@ ${o}
|
|
|
893
893
|
note: uses 600ms capture window \u2014 may need --timeout 10000 flag
|
|
894
894
|
|
|
895
895
|
examples:
|
|
896
|
-
${
|
|
897
|
-
${
|
|
896
|
+
${b("perf")} transition goHome --timeout 10000
|
|
897
|
+
${b("perf")} transition appSwitcher
|
|
898
898
|
`);break}let r=`sootsim:${t}`;console.log(` profiling ${t} transition...`),console.log(" (use --timeout 10000 if this times out)");let n=await c.send({type:"evaluate",code:`(async () => {
|
|
899
899
|
// only supported in render-worker mode
|
|
900
900
|
if (!window.__sootsimRenderHost) {
|
|
@@ -972,24 +972,24 @@ ${o}
|
|
|
972
972
|
p50: ${n.p50.toFixed(2)}ms
|
|
973
973
|
p95: ${n.p95.toFixed(2)}ms
|
|
974
974
|
p99: ${n.p99.toFixed(2)}ms
|
|
975
|
-
jank: ${n.jankFrames} frames (${m}%) >16.67ms`),Array.isArray(n.samples)&&n.samples.length>0&&(console.log(""),
|
|
975
|
+
jank: ${n.jankFrames} frames (${m}%) >16.67ms`),Array.isArray(n.samples)&&n.samples.length>0&&(console.log(""),Te(n.samples.map($=>$[1])));break}default:console.error(` unknown perf subcommand: ${e}`),process.exit(1)}break}case"errors":{let e=i[1];if(e==="clear"){await Ye(c),D(l)?B({cleared:!0}):console.log(" error buffer cleared");break}let t=e?Number(e):20,o=await Ue(c,t);if(D(l)){B(o);break}if(o.length===0){console.log(" no errors captured");break}console.log(` ${o.length} error(s):
|
|
976
976
|
`);for(let r of o){let n=new Date(r.timestamp).toLocaleTimeString(),u=r.args.map(m=>typeof m=="object"?JSON.stringify(m):m).join(" ");if(console.log(` [${n}] ${u}`),r.stack){let m=r.stack.split(`
|
|
977
|
-
`).slice(0,3);for(let
|
|
977
|
+
`).slice(0,3);for(let $ of m)console.log(` ${$.trim()}`)}}break}case"warnings":{let e=i[1]?Number(i[1]):20,t=await ze(c,e);if(D(l)){B(t);break}if(t.length===0){console.log(" no warnings captured");break}console.log(` ${t.length} warning(s):
|
|
978
978
|
`);for(let o of t){let r=new Date(o.timestamp).toLocaleTimeString(),n=o.args.map(u=>typeof u=="object"?JSON.stringify(u):u).join(" ");console.log(` [${r}] ${n}`)}break}case"animations":{let e=await z(c,"listAnimations")??[];if(s.includes("--json")){console.log(JSON.stringify(e,null,2));break}if(e.length===0){console.log(" no active animations");break}console.log(` ${e.length} active animation(s):
|
|
979
|
-
`);for(let t of e){let o=String(t.kind).padEnd(6),r=`${Number(t.from).toFixed(2)}\u2192${Number(t.to).toFixed(2)}`,n=Number(t.current??0).toFixed(2),u=`${Math.round((t.progress??0)*100)}%`,m=`${Math.round(t.elapsedMs??0)}ms
|
|
980
|
-
`);for(let u of n){let m=new Date(u.timestamp).toLocaleTimeString();console.log(` [${m}] ${
|
|
979
|
+
`);for(let t of e){let o=String(t.kind).padEnd(6),r=`${Number(t.from).toFixed(2)}\u2192${Number(t.to).toFixed(2)}`,n=Number(t.current??0).toFixed(2),u=`${Math.round((t.progress??0)*100)}%`,m=`${Math.round(t.elapsedMs??0)}ms`,$=t.loop?" loop":"",g=t.layoutBound?" layout":"";console.log(` #${t.id} ${o} ${r.padEnd(14)} cur=${n.padEnd(7)} ${u.padStart(4)} ${m}${$}${g}`)}break}case"animation":{let e=i[1];(!e||e==="--help"||e==="-h")&&(console.error(` usage: ${b("animation")} <id>`),process.exit(1));let t=Number(e);Number.isFinite(t)||(console.error(` invalid id: ${e}`),process.exit(1));let o=await z(c,"getAnimation",t);console.log(JSON.stringify(o,null,2));break}case"stop-animation":{let e=i[1];(!e||e==="--help"||e==="-h")&&(console.error(` usage: ${b("stop-animation")} <id|all>`),process.exit(1));let t=e==="all"?"all":Number(e);t!=="all"&&!Number.isFinite(t)&&(console.error(` invalid id: ${e}`),process.exit(1));let o=await z(c,"stopAnimation",t);console.log(` stopped ${o??0} animation(s)`);break}case"requests":{let e=i[1];if(e==="clear"){await Xe(c),D(l)?B({cleared:!0}):console.log(" request buffer cleared");break}let t=e==="all",o=t?i[2]:e,r=o?Number(o):20,n=await Ge(c,{failed:!t,limit:r});if(D(l)){B(n);break}if(n.length===0){console.log(t?" no requests captured":" no failed requests captured");break}console.log(` ${n.length} ${t?"request(s)":"failed request(s)"}:
|
|
980
|
+
`);for(let u of n){let m=new Date(u.timestamp).toLocaleTimeString();console.log(` [${m}] ${C(u)}`),u.responseBody?console.log(` ${u.responseBody}`):u.error&&console.log(` ${u.error}`)}break}case"network":{let e=i[1],t=null,o=null,r=!1,n=!1,u=1e3,m=!1,$=!1;for(let N=0;N<l.length;N++){let h=l[N];if(h==="--filter")t=l[N+1]??null,N++;else if(h==="--limit"){let p=Number(l[N+1]);Number.isFinite(p)&&(o=p),N++}else if(h==="--threshold"){let p=Number(l[N+1]);Number.isFinite(p)&&p>0&&(u=p),N++}else h==="--failed"?r=!0:h==="--slow"?n=!0:h==="--tail"||h==="-f"?m=!0:h==="--json"&&($=!0)}if(e==="clear"){await c.send({type:"evaluate",code:'window.__sootsimObservability?.network.clear(); "cleared"'}),console.log(" network buffer cleared");break}if(e==="get"){let N=i[2];N||(console.error(" usage: sootsim network get <id>"),process.exit(1));let h=await c.send({type:"evaluate",code:`(() => {
|
|
981
981
|
const obs = window.__sootsimObservability;
|
|
982
982
|
if (!obs) return null;
|
|
983
|
-
return obs.network.getSnapshot().find(e => e.id === ${JSON.stringify(
|
|
984
|
-
})()`});
|
|
985
|
-
to target a specific sim, use \`--sim ${e}\` instead.`),process.exit(1));let
|
|
983
|
+
return obs.network.getSnapshot().find(e => e.id === ${JSON.stringify(N)}) || null;
|
|
984
|
+
})()`});h||(console.error(` no entry with id ${N}`),process.exit(1)),$?console.log(JSON.stringify(h,null,2)):ro(h);break}let g=o??(m?200:e?Number(e):20);Number.isFinite(g)||(console.error(` invalid limit: ${e} \u2014 \`network\` takes a numeric count (e.g. ${b("network")} 100).
|
|
985
|
+
to target a specific sim, use \`--sim ${e}\` instead.`),process.exit(1));let x=async()=>{let N=await c.send({type:"evaluate",code:`(() => {
|
|
986
986
|
const obs = window.__sootsimObservability;
|
|
987
987
|
if (!obs) return { ok: false };
|
|
988
988
|
return { ok: true, entries: obs.network.getSnapshot() };
|
|
989
|
-
})()`});if(!
|
|
990
|
-
`:` ${
|
|
991
|
-
`);for(let p of
|
|
992
|
-
`);let
|
|
993
|
-
to target a specific sim, use \`--sim ${e}\` instead.`),process.exit(1));let
|
|
994
|
-
`);for(let O of p)
|
|
995
|
-
`);let H=new Set,K=!0,
|
|
989
|
+
})()`});if(!N||!N.ok)throw new Error("observability bridge not installed \u2014 is the engine running?");return N.entries??[]},F=N=>{let h=N;if(r&&(h=h.filter(p=>!!p.error||p.status!=null&&p.status>=400)),n&&(h=h.filter(p=>p.durationMs!=null&&p.durationMs>=u)),t){let p=t.toLowerCase();h=h.filter(O=>(O.displayUrl||O.url).toLowerCase().includes(p))}return n&&!m&&(h=[...h].sort((p,O)=>(O.durationMs??0)-(p.durationMs??0))),h};if(!m){let N=await x(),h=F(N).slice(-g);if($){console.log(JSON.stringify(h,null,2));break}if(h.length===0){N.length===0?console.log(" no network requests captured"):console.log(n?` no requests slower than ${u}ms (${N.length} total \u2014 try --threshold <ms>)`:" no matching requests");break}console.log(n?` ${h.length} request(s) slower than ${u}ms (sorted by duration desc):
|
|
990
|
+
`:` ${h.length} request(s):
|
|
991
|
+
`);for(let p of h)It(p);break}console.log(` tailing network (ctrl-c to stop)...
|
|
992
|
+
`);let q=new Set,H=!0,K=()=>{H=!1};process.on("SIGINT",K);try{for(;H;){let N=await x(),h=F(N);for(let p of h)p.durationMs!=null&&(q.has(p.id)||(q.add(p.id),$?console.log(JSON.stringify(p)):It(p)));await X(250)}}finally{process.off("SIGINT",K)}break}case"logs":{let e=i[1],t=null,o=null,r=null,n=!1,u=!1,m=!1;for(let h=0;h<l.length;h++){let p=l[h];if(p==="--filter")t=l[h+1]??null,h++;else if(p==="--limit"){let O=Number(l[h+1]);Number.isFinite(O)&&(o=O),h++}else p==="--level"?(r=l[h+1]??null,h++):p==="--tail"||p==="-f"?n=!0:p==="--json"?u=!0:(p==="--internal"||p==="--all")&&(m=!0)}let $=r?new Set(r.split(",").map(h=>h.trim()).filter(h=>h==="log"||h==="info"||h==="warn"||h==="error"||h==="debug")):null;if(e==="clear"){await Qe(c),console.log(" log buffer cleared");break}let g=!u&&process.stdout.isTTY===!0,x=o??(n?500:e?Number(e):50);Number.isFinite(x)||(console.error(` invalid limit: ${e} \u2014 \`logs\` takes a numeric count (e.g. ${b("logs")} 100).
|
|
993
|
+
to target a specific sim, use \`--sim ${e}\` instead.`),process.exit(1));let F=()=>Ve(c),q=h=>Ze(h,{level:$,filter:t,showInternal:m});if(!n){let h=await F(),p=q(h).slice(-x);if(u){console.log(JSON.stringify(p,null,2));break}if(p.length===0){console.log(h.length===0?" no logs captured":" no matching logs");break}console.log(` ${p.length} log(s):
|
|
994
|
+
`);for(let O of p)Ft(O,g);break}console.log(` tailing logs (ctrl-c to stop)...
|
|
995
|
+
`);let H=new Set,K=!0,N=()=>{K=!1};process.on("SIGINT",N);try{for(;K;){let h=await F(),p=q(h);for(let O of p)H.has(O.id)||(H.add(O.id),u?console.log(JSON.stringify(O)):Ft(O,g));await X(250)}}finally{process.off("SIGINT",N)}break}default:console.error(` unknown subcommand: ${y}`),process.exit(1)}if(P.has(y)&&!s.includes("--no-wait")&&process.env.SOOTSIM_NO_AUTO_WAIT!=="1"&&await L(c),!U.has(y)&&!D(l))try{await Z(c)}catch{}}catch(e){let t=e instanceof Error?e.message:String(e);console.error(` ${y??"inspect"} failed: ${t}`);let o=/^no sim connected with id (.+)$/.exec(t);if(o)await it(c,_,o[1]);else if(/^no sim connected$/.test(t))rt(_);else{try{await Ce(c)}catch{}try{await w({includeTail:!0})}catch{}try{await W({includeTail:!0})}catch{}}process.exit(1)}finally{c.close()}}export{zs as runInspect};
|