sootsim 0.1.157 → 0.1.159
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-GKCKPDQL.js → agent-KF6LSAZP.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-H2U7JFCS.js → agent-wrapper-3QFRWQKR.js} +2 -2
- package/dist-cli/chunks/{app-fonts-QUD2SV6L.js → app-fonts-PJDS6KI4.js} +2 -2
- package/dist-cli/chunks/{assert-NH2HHMN4.js → assert-ISGIV5TC.js} +2 -2
- package/dist-cli/chunks/auto-bootstrap-EKITLKBX.js +2 -0
- package/dist-cli/chunks/beta-KXXIX4XI.js +2 -0
- package/dist-cli/chunks/{camera-BBIMVYXH.js → camera-YKPG3G7O.js} +2 -2
- package/dist-cli/chunks/{chunk-BRIWO44I.js → chunk-64SVW4EY.js} +1 -1
- package/dist-cli/chunks/{chunk-C5BXRLHS.js → chunk-6JPOPHYF.js} +1 -1
- package/dist-cli/chunks/{chunk-2SQVUKGN.js → chunk-6XYSN4NY.js} +1 -1
- package/dist-cli/chunks/{chunk-K4LDVZYP.js → chunk-6Z5BILA2.js} +3 -3
- package/dist-cli/chunks/{chunk-GAXCW6BZ.js → chunk-7D6WLJ4L.js} +2 -2
- package/dist-cli/chunks/{chunk-7P2QJUZB.js → chunk-A4YXDMYG.js} +1 -1
- package/dist-cli/chunks/{chunk-DHULHNVZ.js → chunk-AAF5FO3K.js} +1 -1
- package/dist-cli/chunks/{chunk-ESZY26WY.js → chunk-ALPNIF7J.js} +2 -2
- package/dist-cli/chunks/{chunk-J72RL5TX.js → chunk-C7TYTTHL.js} +1 -1
- package/dist-cli/chunks/{chunk-BJFLKJZI.js → chunk-CZS27ZM6.js} +2 -2
- package/dist-cli/chunks/{chunk-QA7DWZXG.js → chunk-DWTUFRMV.js} +2 -2
- package/dist-cli/chunks/{chunk-SKDLBR7B.js → chunk-DXMV5DOI.js} +2 -2
- package/dist-cli/chunks/{chunk-7WZEEFD3.js → chunk-EVRKFFWI.js} +2 -2
- package/dist-cli/chunks/{chunk-NT6JVAUN.js → chunk-FIEQCF25.js} +1 -1
- package/dist-cli/chunks/{chunk-ZJUIBQPS.js → chunk-FJKFG45M.js} +1 -1
- package/dist-cli/chunks/{chunk-FCICI3EX.js → chunk-G4DSRG6H.js} +1 -1
- package/dist-cli/chunks/{chunk-4HETKHPX.js → chunk-HPXG576I.js} +2 -2
- package/dist-cli/chunks/{chunk-QIFVD5D2.js → chunk-ICSBAPZZ.js} +2 -2
- package/dist-cli/chunks/{chunk-6CBI57IL.js → chunk-J4WEANS2.js} +2 -2
- package/dist-cli/chunks/{chunk-CQKIN4UH.js → chunk-KXPVKFSK.js} +2 -2
- package/dist-cli/chunks/{chunk-QSFSGKVF.js → chunk-MLVTWAFH.js} +1 -1
- package/dist-cli/chunks/{chunk-GH25H5QD.js → chunk-MMQJAMOP.js} +1 -1
- package/dist-cli/chunks/{chunk-OZ3UZ2VO.js → chunk-MZRI77BD.js} +2 -2
- package/dist-cli/chunks/{chunk-LV3DINZS.js → chunk-N6I6P5F6.js} +1 -1
- package/dist-cli/chunks/{chunk-FTCNYGT4.js → chunk-O5IRIGAI.js} +1 -1
- package/dist-cli/chunks/chunk-OJEAOQIW.js +2 -0
- package/dist-cli/chunks/chunk-Q2WO4DCI.js +1 -0
- package/dist-cli/chunks/{chunk-G4EHF2XU.js → chunk-QFVE7LSF.js} +2 -2
- package/dist-cli/chunks/{chunk-ZVELB7QY.js → chunk-QI33YQUW.js} +3 -3
- package/dist-cli/chunks/{chunk-2MWM7JD6.js → chunk-QJR3OGJT.js} +2 -2
- package/dist-cli/chunks/{chunk-PCW7AAPN.js → chunk-QO7KZEBY.js} +2 -2
- package/dist-cli/chunks/chunk-R2ERWUT7.js +1 -0
- package/dist-cli/chunks/{chunk-S56YDDA7.js → chunk-R3GY3JHX.js} +2 -2
- package/dist-cli/chunks/{chunk-SMYZKDMS.js → chunk-S6A4EJDD.js} +1 -1
- package/dist-cli/chunks/{chunk-QTFL2HSS.js → chunk-TCBFGJGG.js} +1 -1
- package/dist-cli/chunks/{chunk-O5HTYUHB.js → chunk-UR3V2PBR.js} +1 -1
- package/dist-cli/chunks/{chunk-XIG5BFQB.js → chunk-VO5YSZYA.js} +2 -2
- package/dist-cli/chunks/{chunk-JMXKC7DE.js → chunk-WWOVA5S5.js} +2 -2
- package/dist-cli/chunks/{chunk-AES7K6P5.js → chunk-X2FYVGXZ.js} +1 -1
- package/dist-cli/chunks/{chunk-P53GI4GU.js → chunk-XDVEDI42.js} +2 -2
- package/dist-cli/chunks/{chunk-KIMSPMBC.js → chunk-XEZQ7LCC.js} +3 -3
- package/dist-cli/chunks/chunk-XPXOAFXJ.js +1 -0
- package/dist-cli/chunks/{chunk-ISGEH5I6.js → chunk-YFSMKED3.js} +2 -2
- package/dist-cli/chunks/{chunk-GPV6OYQI.js → chunk-YKKHY7L3.js} +2 -2
- package/dist-cli/chunks/{chunk-4POIDYSQ.js → chunk-Z77ILKRY.js} +1 -1
- package/dist-cli/chunks/{chunk-2V4FB2RT.js → chunk-ZYK5NOIT.js} +2 -2
- package/dist-cli/chunks/cli-version-XJ6MQDMA.js +2 -0
- package/dist-cli/chunks/{compat-AUXJQIHL.js → compat-M4IMNI3Y.js} +3 -3
- package/dist-cli/chunks/{config-BXXIT3N3.js → config-GSKQNMRM.js} +2 -2
- package/dist-cli/chunks/{control-FSL5WY5D.js → control-BVZKRFSR.js} +2 -2
- package/dist-cli/chunks/{cpu-profile-YUS3WKAK.js → cpu-profile-ECOD3H6S.js} +2 -2
- package/dist-cli/chunks/{daemon-22L65BF7.js → daemon-TRAKEV2A.js} +2 -2
- package/dist-cli/chunks/{debug-XJN62JVM.js → debug-VIYPIIYP.js} +3 -3
- package/dist-cli/chunks/{detox-XTQMXYKU.js → detox-VYFSSTA2.js} +2 -2
- package/dist-cli/chunks/{device-MAE44TQB.js → device-EPNRLKK7.js} +2 -2
- package/dist-cli/chunks/{diagnose-HF3DUNXT.js → diagnose-YBD2U7L6.js} +2 -2
- package/dist-cli/chunks/drivers-NYH3XOHT.js +2 -0
- package/dist-cli/chunks/{electron-FM7ABQ55.js → electron-S734EJU7.js} +3 -3
- package/dist-cli/chunks/flow-O25VTFCT.js +2 -0
- package/dist-cli/chunks/help-N27EXLRA.js +2 -0
- package/dist-cli/chunks/{hints-5FKUHYYV.js → hints-PNYJJVGX.js} +2 -2
- package/dist-cli/chunks/{home-paths-2UT3LZCV.js → home-paths-YDMGYCD6.js} +2 -2
- package/dist-cli/chunks/{inspect-EDWNKILW.js → inspect-IQF57GEB.js} +83 -84
- package/dist-cli/chunks/install-KOSYPMP2.js +2 -0
- package/dist-cli/chunks/{install-desktop-MQV7A7LW.js → install-desktop-XSNYUCAX.js} +3 -3
- package/dist-cli/chunks/{keys-5R3GN66Z.js → keys-4JU2NSP3.js} +2 -2
- package/dist-cli/chunks/{launch-3XQXJHU6.js → launch-XCCEGMRP.js} +3 -3
- package/dist-cli/chunks/{login-RR3LSQ3A.js → login-BP5FDOL5.js} +4 -4
- package/dist-cli/chunks/{logout-3GIZQ27A.js → logout-QNLM6WMO.js} +2 -2
- package/dist-cli/chunks/{maestro-CS6JBEG4.js → maestro-C2Z7OF66.js} +2 -2
- package/dist-cli/chunks/optional-demo-registry-PDJMPOCQ.js +2 -0
- package/dist-cli/chunks/{preview-ZMOUSC43.js → preview-OSFRY4EO.js} +2 -2
- package/dist-cli/chunks/{profile-HGF54OC4.js → profile-XYXNGOHN.js} +2 -2
- package/dist-cli/chunks/{react-N6HTHJNA.js → react-X6BZGWA2.js} +2 -2
- package/dist-cli/chunks/{record-Z36PVVU7.js → record-BSSDCNDD.js} +2 -2
- package/dist-cli/chunks/runtime-VL7KIZWA.js +2 -0
- package/dist-cli/chunks/{runtime-delivery-PJMSW4HO.js → runtime-delivery-P2PKVTJX.js} +2 -2
- package/dist-cli/chunks/{screenshot-4YKF4UBD.js → screenshot-PFQI4YV3.js} +2 -2
- package/dist-cli/chunks/{screenshot-mode-BGXJPIBS.js → screenshot-mode-4MC3UR6Z.js} +2 -2
- package/dist-cli/chunks/{screenshots-TRGYSPW5.js → screenshots-A5LUY5YI.js} +2 -2
- package/dist-cli/chunks/{server-CV7RETHK.js → server-OAKKZMT4.js} +3 -3
- package/dist-cli/chunks/setup-repo-SWCGCGTU.js +2 -0
- package/dist-cli/chunks/{skills-MTXAUNIT.js → skills-K27FMX6I.js} +2 -2
- package/dist-cli/chunks/{slides-LDMZ3ZKO.js → slides-DVUE3IIM.js} +2 -2
- package/dist-cli/chunks/{start-LTZH7NX6.js → start-MNBDI5GS.js} +4 -4
- package/dist-cli/chunks/store-XCY444IP.js +2 -0
- package/dist-cli/chunks/telemetry-77HXPGXV.js +2 -0
- package/dist-cli/chunks/{test-MAGRP4B6.js → test-OMGWLQUF.js} +3 -3
- package/dist-cli/chunks/{three-mode-QYIRSQBC.js → three-mode-QFSF7IBL.js} +2 -2
- package/dist-cli/chunks/{timeline-X5HZN2L5.js → timeline-N7FMWUUC.js} +2 -2
- package/dist-cli/chunks/{upgrade-JZPXC2WH.js → upgrade-PUOM6MOF.js} +2 -2
- package/dist-cli/chunks/upload-AF6JZGG3.js +2 -0
- package/dist-cli/chunks/{version-YZNR4TYU.js → version-GANWTLFN.js} +2 -2
- package/dist-cli/chunks/{web-CHLW4MAH.js → web-VSTBLWKU.js} +2 -2
- package/dist-cli/chunks/{what-happened-P6YJADRY.js → what-happened-4XGFPI2N.js} +2 -2
- package/dist-cli/chunks/{whoami-MK25C7TJ.js → whoami-HFYZI6RP.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/beta.cjs +1 -1
- package/dist-lib/beta.mjs +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/detox/index.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/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro.cjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +1 -1
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/dist-cli/chunks/auto-bootstrap-CT7E764X.js +0 -2
- package/dist-cli/chunks/beta-WWL6ZI74.js +0 -2
- package/dist-cli/chunks/chunk-AYTLC7QV.js +0 -1
- package/dist-cli/chunks/chunk-PPH7UKZN.js +0 -1
- package/dist-cli/chunks/chunk-RI6LUHT6.js +0 -2
- package/dist-cli/chunks/chunk-RJTJ67H3.js +0 -1
- package/dist-cli/chunks/cli-version-BXPUDDCJ.js +0 -2
- package/dist-cli/chunks/drivers-6ZRVNWCU.js +0 -2
- package/dist-cli/chunks/flow-4PJHUWIA.js +0 -2
- package/dist-cli/chunks/help-C4MKKA5E.js +0 -2
- package/dist-cli/chunks/install-JJ2I2L3B.js +0 -2
- package/dist-cli/chunks/optional-demo-registry-BGV6FY2J.js +0 -2
- package/dist-cli/chunks/runtime-I64WAQIR.js +0 -2
- package/dist-cli/chunks/setup-repo-IZ44DI2U.js +0 -2
- package/dist-cli/chunks/store-HTK26UWW.js +0 -2
- package/dist-cli/chunks/telemetry-YKO6WSAB.js +0 -2
- package/dist-cli/chunks/upload-7DBFEXRG.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as Y}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.159 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as Y}from"./chunk-J4WEANS2.js";import{a as vt,b as kt}from"./chunk-A4YXDMYG.js";import{a as Qe,g as ve,j as te}from"./chunk-7D6WLJ4L.js";import{b as Tt,c as Mt,j as It}from"./chunk-HPXG576I.js";import"./chunk-CZS27ZM6.js";import{a as ee,b as A,c as P,d as Re,e as ie,f as G,g as ue,h as fe,i as xt,j as $t,k as De,l as St}from"./chunk-DWTUFRMV.js";import{A as gt,B as yt,F as ht,H as ce,I as bt,O as wt,a as xe,b as Ze,c as et,d as tt,e as ot,f as st,g as nt,h as rt,i as it,j as at,k as Ae,l as Pe,q as Ee,r as lt,s as ct,t as $e,u as ut,v as Se,w as dt,x as mt,y as pt,z as ft}from"./chunk-Z77ILKRY.js";import"./chunk-UR3V2PBR.js";import"./chunk-G4DSRG6H.js";import{c as Ge,e as Ye,f as Xe,g as Ve,h as Oe}from"./chunk-QO7KZEBY.js";import"./chunk-O5IRIGAI.js";import"./chunk-XDVEDI42.js";import"./chunk-FIEQCF25.js";import"./chunk-MZRI77BD.js";import"./chunk-XPXOAFXJ.js";import"./chunk-MLVTWAFH.js";import{b as ze}from"./chunk-FJKFG45M.js";import{a as Ke}from"./chunk-S6A4EJDD.js";import{a as Fe,c as _e}from"./chunk-AAF5FO3K.js";import{a as Ue}from"./chunk-OJEAOQIW.js";import"./chunk-N6I6P5F6.js";import"./chunk-MMQJAMOP.js";import"./chunk-TCBFGJGG.js";import{existsSync as fo,mkdirSync as go,readFileSync as yo,rmSync as Nt,writeFileSync as ho}from"fs";import{tmpdir as bo}from"os";import{dirname as wo,join as xo,resolve as $o}from"path";var ge=1,So="SOOTSIM_INSPECT_NOTICE_PATH",vo=300*1e3,ko=15e3;function Ft(){return $o(process.env[So]||xo(bo(),"sootsim-inspect-notice-state.json"))}function To(e,l){return Object.fromEntries(Object.entries(e).filter(([,n])=>typeof n?.signature=="string"&&Number.isFinite(n?.updatedAt)&&l-n.updatedAt<=vo))}function Mo(e){let l=Ft();if(!fo(l))return{version:ge,entries:{}};try{let n=JSON.parse(yo(l,"utf8"));return n.version!==ge||!n.entries||typeof n.entries!="object"?(Nt(l,{force:!0}),{version:ge,entries:{}}):{version:ge,entries:To(n.entries,e)}}catch{return Nt(l,{force:!0}),{version:ge,entries:{}}}}function Io(e){let l=Ft();go(wo(l),{recursive:!0}),ho(l,JSON.stringify(e,null,2)+`
|
|
3
3
|
`)}function No(e,l){let n=l.trim()||"default";return`${e}:${n}`}function Ce(e,l,n,c={}){let m=c.nowMs??Date.now(),i=c.cooldownMs??ko,g=Mo(m),y=No(e,l),T=g.entries[y];return T&&T.signature===n&&m-T.updatedAt<i?!1:(g.entries[y]={signature:n,updatedAt:m},Io(g),!0)}var Fo={initialWaitMs:3e3,deadlineMs:5e3,retryWaitMs:700},_o={initialWaitMs:1200,deadlineMs:2500,retryWaitMs:700};function Oo(e,l={}){return{...e?Fo:_o,...l}}function de(e){return!(!e||e.hit===!1||e.ok===!1||e.pointerTapHandled===!1&&!e.keyboardOpened&&!e.isTextInput)}function Ao(e,l){return{id:e.target?.id??e.match?.id??e.node?.id??null,testID:e.target?.testID??e.match?.testID??e.node?.testID??null,text:e.target?.text??e.target?.accessibilityLabel??e.match?.text??e.match?.accessibilityLabel??e.node?.text??l??null,type:e.target?.type??e.match?.type??e.node?.type??null}}async function ye(e,l){let n=Oo(!!l.agent,l.timing),c=0,m=null,i=null;try{await te({bridge:e,maxMs:n.initialWaitMs,pollMs:32,stablePolls:2})}catch{}let g=Date.now()+n.deadlineMs;for(;Date.now()<=g||c===0;){c++;let y=await l.resolve();if(m=y,y?.error==="bridge-not-ready"||y?.ambiguous||y?.nthOutOfRange)return{payload:y,result:null,attempts:c,failure:"special"};if(y&&typeof y.cx=="number"&&typeof y.cy=="number"){let M=await e.send({type:"tap",x:y.cx,y:y.cy,target:Ao(y,l.textFallback)});if(i=M,de(M))return{payload:y,result:M,attempts:c}}let T=g-Date.now();if(T<=0)break;try{await te({bridge:e,maxMs:Math.min(T,n.retryWaitMs),pollMs:32,stablePolls:2})}catch{await new Promise(M=>setTimeout(M,Math.min(120,T)))}}return{payload:m,result:i,attempts:c,failure:m&&typeof m.cx=="number"?"missed":"not-found"}}async function _t(e,l,n,c){return e.send({type:"tap",x:l,y:n,...c?{target:c}:{}})}async function Ot(e,l,n={}){let c=JSON.stringify(l);return ye(e,{agent:n.agent,timing:n.timing,resolve:()=>e.send({type:"evaluate",code:`(async () => {
|
|
4
4
|
const t = window.__sootsimTest
|
|
5
5
|
if (!t) return null
|
|
@@ -197,16 +197,16 @@ import{a as Y}from"./chunk-6CBI57IL.js";import{a as vt,b as kt}from"./chunk-7P2Q
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
return { strategy: 'none' }
|
|
200
|
-
})()`});if(!m||!("node"in m))return m;let i=m.node,g=i.absolutePosition.x+i.layout.width/2,y=i.absolutePosition.y+i.layout.height/2;return{...m,cx:g,cy:y,target:{id:i.id,testID:i.testID,text:m.strategy==="text"?l:i.text,type:i.type}}}})}async function Et(e,l={args:[]}){let n=await et(e);if(A(l.args)){P(n);return}console.log(` nodes: ${n.nodes}`)}function Be(e,l){let n=e.indexOf(l);return n>=0&&n+1<e.length?e[n+1]:null}async function Rt(e){let{bridge:l,args:n,positional:c}=e,m=n.includes("--verbose")||n.includes("-v"),i=A(n),g=m&&!i,y=n.includes("--watch")||n.includes("-w"),T=1e3,M=n.includes("--compact"),
|
|
200
|
+
})()`});if(!m||!("node"in m))return m;let i=m.node,g=i.absolutePosition.x+i.layout.width/2,y=i.absolutePosition.y+i.layout.height/2;return{...m,cx:g,cy:y,target:{id:i.id,testID:i.testID,text:m.strategy==="text"?l:i.text,type:i.type}}}})}async function Et(e,l={args:[]}){let n=await et(e);if(A(l.args)){P(n);return}console.log(` nodes: ${n.nodes}`)}function Be(e,l){let n=e.indexOf(l);return n>=0&&n+1<e.length?e[n+1]:null}async function Rt(e){let{bridge:l,args:n,positional:c}=e,m=n.includes("--verbose")||n.includes("-v"),i=A(n),g=m&&!i,y=n.includes("--watch")||n.includes("-w"),T=1e3,M=n.includes("--compact"),b=n.includes("--no-xy"),k=n.includes("--no-clipped"),_=n.includes("--include-occluded"),I=Be(n,"--testid-like"),E=Be(n,"--only"),j=Be(n,"--subtree"),u=c[1]&&!c[1].startsWith("-")?c[1]:void 0,z=u?/[*?]/.test(u):!1,B=!z&&!E?u:void 0,D=E??(z?u:void 0),Q=async()=>{await ue(l,{verbose:g});let S=await st(l,{describe:!0,verbose:m,filter:B||"",testIdLike:I||void 0,onlyGlob:D||void 0,subtreeRoot:j||void 0,compact:M,hideXy:b,includeOccluded:_}),N=S?.tree,J=S?.shell,W=S?.keyboard;if(i){P({shell:J,tree:N??"",keyboard:W});return}if(J&&typeof J=="object"){let C=[J.state?`state=${J.state}`:null,J.activeApp?`app=${J.activeApp}`:null,J.showSwitcher?"switcher":null,J.switcherPhase&&J.switcherPhase!=="idle"?`phase=${J.switcherPhase}`:null].filter(Boolean);C.length>0&&console.log(` shell: ${C.join(" ")}`)}if(typeof N=="string"&&N.startsWith("__SUBTREE_NOT_FOUND__:")){let C=N.slice(22);console.log(` subtree root not found: ${C}`),Y("subtree-root-not-found",C);return}if(!N){let C=S?.nodeCount??0;console.log(" no matching nodes found"),!(B||I||D||j)&&C<10&&Y("app-still-loading",C);return}let V=N,Z=0;if(k&&typeof V=="string"){let C=V.split(`
|
|
201
201
|
`),le=[];for(let o of C){if(o.includes("(clipped:")){Z+=1;continue}le.push(o)}V=le.join(`
|
|
202
202
|
`)}console.log(V),Z>0&&console.log(` ${Z} clipped row(s) hidden (omit --no-clipped to see)`);let re=B||I||D||j;if((B||I||D)&&!y&&Y("describe-filter-context"),!re&&!y&&N.split(`
|
|
203
203
|
`).length>=80&&Y("describe-use-filters"),W&&W.visible){let C=W.spec,le=[C?.keyboardType?`type=${C.keyboardType}`:null,C?.returnKeyType&&C.returnKeyType!=="default"?`return=${C.returnKeyType}`:null,W.mode!=="letters"?`mode=${W.mode}`:null,W.shifted?"shift":null,W.capsLock?"caps":null,C?.autoCapitalize&&C.autoCapitalize!=="sentences"?`autoCap=${C.autoCapitalize}`:null,W.accessoryBarId?`accessory=${W.accessoryBarId}`:null].filter(Boolean);console.log(`
|
|
204
204
|
keyboard: ${le.join(" ")||"visible"}`)}};if(y)for(console.log(` watching... (Ctrl+C to stop)
|
|
205
|
-
`);;)console.clear(),await Q(),await ee(T);else await Q()}var Po=["SOOTSIM_AGENT","CLAUDECODE","CLAUDE_CODE_ENTRYPOINT","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","CURSOR_TRACE_ID","AIDER_MODEL"];function me(){if(process.env.SOOTSIM_AGENT==="0")return!1;for(let e of Po){let l=process.env[e];if(l&&l.trim()&&l!=="0")return!0}return!1}async function Dt(e){let{bridge:l,args:n,effectiveArgs:c,positional:m,inspectUsage:i}=e,g=S=>{let N=c.indexOf(S);return N>=0&&N+1<c.length?c[N+1]:null},y=S=>c.includes(S),T=g("--testid")||g("--test-id"),M=g("--role"),
|
|
205
|
+
`);;)console.clear(),await Q(),await ee(T);else await Q()}var Po=["SOOTSIM_AGENT","CLAUDECODE","CLAUDE_CODE_ENTRYPOINT","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","CURSOR_TRACE_ID","AIDER_MODEL"];function me(){if(process.env.SOOTSIM_AGENT==="0")return!1;for(let e of Po){let l=process.env[e];if(l&&l.trim()&&l!=="0")return!0}return!1}async function Dt(e){let{bridge:l,args:n,effectiveArgs:c,positional:m,inspectUsage:i}=e,g=S=>{let N=c.indexOf(S);return N>=0&&N+1<c.length?c[N+1]:null},y=S=>c.includes(S),T=g("--testid")||g("--test-id"),M=g("--role"),b=g("--type"),k=g("--text"),_=y("--pressable"),I=y("--visible"),E=y("--interactive-targets")||y("--actions"),j=!T&&!M&&!b&&!k&&!_&&!I&&!E?m[1]:null,u=k??j,z=await at(l,{testId:T,role:M,type:b,text:u,pressable:_,visible:I,interactive:E});z||(console.error(i("find","<text> | --text <t> | --testid <id> | --role <r> | --type <t> | --pressable | --visible | --interactive-targets")),process.exit(1));let{mode:B,result:D}=z,Q=A(n),oe=n.includes("--verbose")||n.includes("--dump");if(Q)B==="interactive-targets"&&Array.isArray(D)?P(Ae(D).map(S=>({...S,tap:Pe(S)}))):P(D??null);else if(Array.isArray(D))if(D.length===0){console.log(` no ${B} nodes found`);let S=await l.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount?.()) || 0)()"});typeof S=="number"&&S<10&&Y("app-still-loading",S)}else if(B==="interactive-targets"){let S=Ae(D);console.log(` found ${S.length} interactive target${S.length===1?"":"s"} (sorted by score):`);for(let N of S.slice(0,20)){let J=N.absolutePosition?`@(${Math.round(N.absolutePosition.x)},${Math.round(N.absolutePosition.y)})`:"",W=N.layout?`${Math.round(N.layout.width)}x${Math.round(N.layout.height)}`:"?x?",V=N.text?` "${N.text.slice(0,30)}"`:"",Z=N.testID?` #${N.testID}`:"",re=N.accessibilityLabel?` \u24D8"${String(N.accessibilityLabel).slice(0,24)}"`:"",pe=N.accessibilityRole?`[${N.accessibilityRole}]`:N.type,C=Pe(N);console.log(` ${pe}${V}${re}${Z} ${W} ${J}`),console.log(` \u2192 ${C}`),oe&&console.log(je(JSON.stringify(N,null,2)," "))}S.length>20&&console.log(` ... and ${S.length-20} more`)}else{console.log(` found ${D.length} node${D.length===1?"":"s"} (${B}):`);for(let S of D.slice(0,20)){let N=S.absolutePosition?`@(${Math.round(S.absolutePosition.x)},${Math.round(S.absolutePosition.y)})`:"",J=S.layout?`${Math.round(S.layout.width)}x${Math.round(S.layout.height)}`:"?x?",W=S.text?` "${S.text.slice(0,30)}"`:"",V=S.testID?` #${S.testID}`:"",Z=S.pressable?" (tap)":"",re=S.accessibilityRole?`[${S.accessibilityRole}]`:S.type;console.log(` ${re}${W}${V} ${J} ${N}${Z}`),oe&&console.log(je(JSON.stringify(S,null,2)," "))}D.length>20&&console.log(` ... and ${D.length-20} more`)}else if(D==null)console.log(` not found: ${u||T||M||b||""||B}`),T&&Y("wait-selector-for-missing-testid",T);else{let S=D;if(S.type&&S.absolutePosition){let N=`@(${Math.round(S.absolutePosition.x)},${Math.round(S.absolutePosition.y)})`,J=S.layout?`${Math.round(S.layout.width)}x${Math.round(S.layout.height)}`:"?x?",W=S.text?` "${S.text.slice(0,40)}"`:"",V=S.testID?` #${S.testID}`:"",Z=S.pressable?" (tap)":"",re=S.accessibilityRole?`[${S.accessibilityRole}]`:S.type;console.log(` ${re}${W}${V} ${J} ${N}${Z}`),oe&&console.log(je(JSON.stringify(S,null,2)," "))}else console.log(JSON.stringify(D,null,2))}}function je(e,l){return e.split(`
|
|
206
206
|
`).map(n=>l+n).join(`
|
|
207
207
|
`)}async function Ct(e){let{bridge:l,args:n}=e,c=A(n);await ue(l,{verbose:!c});let m=n.includes("--styling"),i=await nt(l,{styling:m});if(c){P({count:i.length,elements:i});return}console.log(` layout (${i.length} element${i.length===1?"":"s"}):
|
|
208
|
-
`),console.log(rt(i,{styling:m}))}async function Bt(e,l={}){let n=await
|
|
209
|
-
`))}async function jt(e){let l=await e.bridge.listSims(),n=e.args.includes("--all"),c=e.args.find((y,T)=>e.args[T-1]==="--bundle"),m=e.args.find((y,T)=>e.args[T-1]==="--app-port"),i=e.args.includes("--primary"),g=l.filter(y=>!(i&&!y.isPrimary||c&&!(y.url??"").includes(c)||m&&!(y.url??"").includes(`/rn/${m}`)||!n&&!c&&!m&&!i&&!(y.url&&(y.url.includes("bundle=")||y.url.includes("/index.bundle")))&&y.id!==e.simId));if(A(e.args)){P(g.map(y=>({...y,active:y.id===e.simId})));return}It(g,e.simId),g.length<l.length&&!A(e.args)&&console.log(` (${l.length-g.length} more hidden \u2014 pass --all to show)`)}function ae(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}function ke(e,l){return l<=0?"?":`${(e/l*100).toFixed(0)}%`}async function Lt(e,l={args:[]}){let n=await wt(e);if(A(l.args)){P(n);return}if(console.log(" memory:"),n.imageLoader){let c=n.imageLoader;console.log(" image-loader cache"),console.log(` entries: ${c.cacheEntries} / ${c.cacheMaxEntries} (${ke(c.cacheEntries,c.cacheMaxEntries)})`),console.log(` pixel bytes: ${ae(c.cachePixelBytes)} / ${ae(c.cachePixelBudget)} (${ke(c.cachePixelBytes,c.cachePixelBudget)})`),console.log(` pending: ${c.pendingFetches} fetches, ${c.pendingBytes} bytes`),console.log(` failed uris: ${c.failedUris}`),console.log(` snapshots: ${c.snapshots}`),console.log(` live frames: ${c.liveFrames}`)}else console.log(" image-loader cache: not available (engine pre-rebuild?)");if(n.workerHeap){let c=n.workerHeap;console.log(" worker heap (chrome only)"),console.log(` used: ${ae(c.usedJSHeapSize)} / ${ae(c.jsHeapSizeLimit)} (${ke(c.usedJSHeapSize,c.jsHeapSizeLimit)})`),console.log(` total: ${ae(c.totalJSHeapSize)}`)}if(n.hostHeap){let c=n.hostHeap;console.log(" host heap (chrome only)"),console.log(` used: ${ae(c.usedJSHeapSize)} / ${ae(c.jsHeapSizeLimit)} (${ke(c.usedJSHeapSize,c.jsHeapSizeLimit)})`),console.log(` total: ${ae(c.totalJSHeapSize)}`)}}var X="<redacted secure text>";function
|
|
208
|
+
`),console.log(rt(i,{styling:m}))}async function Bt(e,l={}){let n=await ht(e);if("error"in n&&(console.error(n.error),process.exit(1)),l.json){console.log(JSON.stringify(n,null,2));return}let{visible:c,spec:m,mode:i,shifted:g,capsLock:y,accessoryBarId:T}=n,M=[];M.push(`keyboard: ${c?"visible":"hidden"}`),m?(M.push(` type: ${m.keyboardType}`),M.push(` returnKey: ${m.returnKeyType}`),M.push(` autoCap: ${m.autoCapitalize}`),M.push(` autoCorrect: ${m.autoCorrect?"on":"off"}`),M.push(` appearance: ${m.keyboardAppearance}`),m.secureTextEntry&&M.push(" secureTextEntry: true"),m.enablesReturnKeyAutomatically&&M.push(` return: ${m.currentTextIsEmpty?"disabled (empty)":"enabled"}`)):M.push(" spec: <none> (shown via dev-tools with no TextInput)"),M.push(` mode: ${i}${g?" (shifted)":""}${y?" (caps)":""}`),T&&M.push(` accessoryBar: ${T}`),console.log(M.join(`
|
|
209
|
+
`))}async function jt(e){let l=await e.bridge.listSims(),n=e.args.includes("--all"),c=e.args.find((y,T)=>e.args[T-1]==="--bundle"),m=e.args.find((y,T)=>e.args[T-1]==="--app-port"),i=e.args.includes("--primary"),g=l.filter(y=>!(i&&!y.isPrimary||c&&!(y.url??"").includes(c)||m&&!(y.url??"").includes(`/rn/${m}`)||!n&&!c&&!m&&!i&&!(y.url&&(y.url.includes("bundle=")||y.url.includes("/index.bundle")))&&y.id!==e.simId));if(A(e.args)){P(g.map(y=>({...y,active:y.id===e.simId})));return}It(g,e.simId),g.length<l.length&&!A(e.args)&&console.log(` (${l.length-g.length} more hidden \u2014 pass --all to show)`)}function ae(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}function ke(e,l){return l<=0?"?":`${(e/l*100).toFixed(0)}%`}async function Lt(e,l={args:[]}){let n=await wt(e);if(A(l.args)){P(n);return}if(console.log(" memory:"),n.imageLoader){let c=n.imageLoader;console.log(" image-loader cache"),console.log(` entries: ${c.cacheEntries} / ${c.cacheMaxEntries} (${ke(c.cacheEntries,c.cacheMaxEntries)})`),console.log(` pixel bytes: ${ae(c.cachePixelBytes)} / ${ae(c.cachePixelBudget)} (${ke(c.cachePixelBytes,c.cachePixelBudget)})`),console.log(` pending: ${c.pendingFetches} fetches, ${c.pendingBytes} bytes`),console.log(` failed uris: ${c.failedUris}`),console.log(` snapshots: ${c.snapshots}`),console.log(` live frames: ${c.liveFrames}`)}else console.log(" image-loader cache: not available (engine pre-rebuild?)");if(n.workerHeap){let c=n.workerHeap;console.log(" worker heap (chrome only)"),console.log(` used: ${ae(c.usedJSHeapSize)} / ${ae(c.jsHeapSizeLimit)} (${ke(c.usedJSHeapSize,c.jsHeapSizeLimit)})`),console.log(` total: ${ae(c.totalJSHeapSize)}`)}if(n.hostHeap){let c=n.hostHeap;console.log(" host heap (chrome only)"),console.log(` used: ${ae(c.usedJSHeapSize)} / ${ae(c.jsHeapSizeLimit)} (${ke(c.usedJSHeapSize,c.jsHeapSizeLimit)})`),console.log(` total: ${ae(c.totalJSHeapSize)}`)}}var X="<redacted secure text>";function he(e){let l=e?.layout?.spec??e?.spec??null;return!!l?.secureTextEntry&&l.keyboardType!=="visible-password"}function Le(e,l){return he(l)?X:e}function Je(e){if(!e||!he(e))return e;let l=e.focusedInput;return!l||typeof l!="object"?e:{...e,focusedInput:{...l,secureTextEntry:!0,text:typeof l.text=="string"?X:l.text}}}function be(e){let l=e.indexOf("--testid");if(l>=0&&e[l+1])return{mode:"testid",value:e[l+1]};let n=e.indexOf("--test-id");if(n>=0&&e[n+1])return{mode:"testid",value:e[n+1]};let c=e.indexOf("--text");return c>=0&&e[c+1]?{mode:"text",value:e[c+1]}:null}async function Te(e,l){let n=JSON.stringify(l.value),c=l.mode==="testid"?`(await t.findByTestId(${n})) || (await t.findById(${n}))`:`await t.findByText(${n})`;return await e.send({type:"evaluate",code:`(async () => {
|
|
210
210
|
const t = window.__sootsimTest
|
|
211
211
|
if (!t) return null
|
|
212
212
|
const n = ${c}
|
|
@@ -231,12 +231,12 @@ import{a as Y}from"./chunk-6CBI57IL.js";import{a as vt,b as kt}from"./chunk-7P2Q
|
|
|
231
231
|
text: ${JSON.stringify(l.mode==="text")} ? ${n} : (n.text ?? n.accessibilityLabel ?? null),
|
|
232
232
|
type: n.type ?? null,
|
|
233
233
|
}
|
|
234
|
-
})()`})??null}async function Jt(e,l={}){let{nav:n,keyboard:c,shell:m}=await
|
|
235
|
-
`))}async function Wt(e){let{bridge:l,args:n,positional:c}=e,m=c[1]?Number(c[1])*1e3:3e3,i=n.includes("--strict"),{elapsed:g,settled:y}=await te({bridge:l,maxMs:m,strict:i});console.log(y?` settled in ${g}ms`:` timed out after ${g}ms (may still be animating)`)}async function qt(e){let l=e.positional[1]?Number(e.positional[1]):.5;(!Number.isFinite(l)||l<0)&&(console.error(e.inspectUsage("sleep","[seconds]")),process.exit(1)),await ee(l*1e3),console.log(` slept ${l}s`)}async function Ht(e){let{bridge:l,args:n,positional:c}=e,m=c[1]?Number(c[1]):5,{tree:i}=await tt(l,m);if(A(n)){P({depth:m,tree:i??null});return}console.log(typeof i=="string"?i:JSON.stringify(i,null,2))}async function Kt(e,l={args:[]}){let n=await ot(e);if(A(l.args)){P(n);return}console.log(n.url)}async function Ut(e){let{wsPort:l,commandTimeoutMs:n,simId:c,simIdSource:m,positional:i}=e,g=i[1]?Number(i[1]):30,y=Math.max(1e3,(Number.isFinite(g)?g:30)*1e3),T=Math.max(1,Math.ceil(y/500));console.log(" waiting for sim reconnect...");let M=await xt(l,n,c,{attempts:T,simIdSource:m});M||(console.error(" timed out waiting for sim reconnect"),process.exit(1)),M.bridge.close(),ve({source:"inspect wait",step:{wait:y},summary:`wait ${Math.round(y/1e3)}s`}),console.log(` ready: ${M.count} nodes`)}var zt=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(e,l){let n=e.indexOf(l);if(n>=0&&n+1<e.length)return e[n+1]}function Eo(e,l){if(!l.filter&&!l.equals)return!0;let n=e.data,c=[];if(n&&typeof n=="object")for(let i of["url","displayUrl","message","name","activeName","path","pathname","title","phase","event","type","kind"]){let g=n[i];typeof g=="string"&&g.length>0&&c.push(g)}let m=c.join(" ");return l.equals?c.some(i=>i===l.equals):l.filter?m.toLowerCase().includes(l.filter.toLowerCase()):!0}async function Gt(e){let{bridge:l,args:n,positional:c,inspectUsage:m}=e,i=c[1];i||(console.error(m("wait event","<kind> [--max-ms 5000] [--filter <substring>] [--equals <exact>] [--since now|cursor]")),process.exit(1)),zt.has(i)||console.error(` warning: '${i}' is not a known timeline kind \u2014 waiting anyway. known: ${[...zt].sort().join(", ")}`);let g=Me(n,"--max-ms"),y=g&&Number.isFinite(Number(g))?Math.max(100,Number(g)):5e3,T=Me(n,"--filter"),M=Me(n,"--equals"),
|
|
234
|
+
})()`})??null}async function Jt(e,l={}){let{nav:n,keyboard:c,shell:m}=await bt(e);if(l.json){console.log(JSON.stringify({shell:m??null,nav:n,keyboard:c},null,2));return}let i=[];if(m){let g=m.activeApp??m.state??"<none>",y=m.showSwitcher?" (app switcher open)":"",T=typeof m.launchProgress=="number"&&m.launchProgress<.98?` launching (${Math.round(m.launchProgress*100)}%)`:"";i.push(`shell: ${g}${y}${T}`)}else i.push("shell: <unavailable>");if(n){let g=n.transitionPhase!=="idle"?` (${n.transitionPhase}, ${n.activeTransitionCount} active)`:"";if(i.push(`nav: phase=${n.transitionPhase}${g}`),n.screens.length===0)i.push(" <no registered screens \u2014 app may not use react-native-screens>");else for(let y of n.screens){let T=y.isActive?"\u25B6":" ",M=y.routeName?` ${y.routeName}`:"",b=y.headerHeight>0?` header=${y.headerHeight}`:"",k=y.largeTitleState&&y.largeTitleState!=="expanded"?` large-title=${y.largeTitleState}`:"";i.push(` ${T} #${y.id}${M}${b}${k}`)}}else i.push("nav: <runtime not available>");if(c&&c.visible){let g=c.spec?.keyboardType??"default",y=c.spec?.returnKeyType??"default";i.push(`keyboard: visible (${g}, return=${y}, mode=${c.mode??"?"})`)}else i.push("keyboard: hidden");console.log(i.join(`
|
|
235
|
+
`))}async function Wt(e){let{bridge:l,args:n,positional:c}=e,m=c[1]?Number(c[1])*1e3:3e3,i=n.includes("--strict"),{elapsed:g,settled:y}=await te({bridge:l,maxMs:m,strict:i});console.log(y?` settled in ${g}ms`:` timed out after ${g}ms (may still be animating)`)}async function qt(e){let l=e.positional[1]?Number(e.positional[1]):.5;(!Number.isFinite(l)||l<0)&&(console.error(e.inspectUsage("sleep","[seconds]")),process.exit(1)),await ee(l*1e3),console.log(` slept ${l}s`)}async function Ht(e){let{bridge:l,args:n,positional:c}=e,m=c[1]?Number(c[1]):5,{tree:i}=await tt(l,m);if(A(n)){P({depth:m,tree:i??null});return}console.log(typeof i=="string"?i:JSON.stringify(i,null,2))}async function Kt(e,l={args:[]}){let n=await ot(e);if(A(l.args)){P(n);return}console.log(n.url)}async function Ut(e){let{wsPort:l,commandTimeoutMs:n,simId:c,simIdSource:m,positional:i}=e,g=i[1]?Number(i[1]):30,y=Math.max(1e3,(Number.isFinite(g)?g:30)*1e3),T=Math.max(1,Math.ceil(y/500));console.log(" waiting for sim reconnect...");let M=await xt(l,n,c,{attempts:T,simIdSource:m});M||(console.error(" timed out waiting for sim reconnect"),process.exit(1)),M.bridge.close(),ve({source:"inspect wait",step:{wait:y},summary:`wait ${Math.round(y/1e3)}s`}),console.log(` ready: ${M.count} nodes`)}var zt=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(e,l){let n=e.indexOf(l);if(n>=0&&n+1<e.length)return e[n+1]}function Eo(e,l){if(!l.filter&&!l.equals)return!0;let n=e.data,c=[];if(n&&typeof n=="object")for(let i of["url","displayUrl","message","name","activeName","path","pathname","title","phase","event","type","kind"]){let g=n[i];typeof g=="string"&&g.length>0&&c.push(g)}let m=c.join(" ");return l.equals?c.some(i=>i===l.equals):l.filter?m.toLowerCase().includes(l.filter.toLowerCase()):!0}async function Gt(e){let{bridge:l,args:n,positional:c,inspectUsage:m}=e,i=c[1];i||(console.error(m("wait event","<kind> [--max-ms 5000] [--filter <substring>] [--equals <exact>] [--since now|cursor]")),process.exit(1)),zt.has(i)||console.error(` warning: '${i}' is not a known timeline kind \u2014 waiting anyway. known: ${[...zt].sort().join(", ")}`);let g=Me(n,"--max-ms"),y=g&&Number.isFinite(Number(g))?Math.max(100,Number(g)):5e3,T=Me(n,"--filter"),M=Me(n,"--equals"),b=Me(n,"--since")??"now",k=n.includes("--json"),_=Date.now(),I=_+y,E=200,j=_;for(;Date.now()<I;){let z={kinds:[i],since:b==="cursor"?void 0:j,limit:50},B=await l.send({type:"evaluate",code:`(async () => {
|
|
236
236
|
const t = window.SootSim?.bridges?.timeline
|
|
237
237
|
if (!t) return { ok: false, error: 'timeline bridge missing' }
|
|
238
238
|
return { ok: true, result: await t.recent(${JSON.stringify(z)}) }
|
|
239
|
-
})()`});(!B||!B.ok)&&(console.error(` could not query timeline: ${B&&"error"in B?B.error:"unknown"}`),process.exit(1));let D=B.result.events??[];for(let Q of D)if(Eo(Q,{filter:T,equals:M})){let oe=Date.now()-_;console.log(k?JSON.stringify({found:!0,elapsedMs:oe,event:Q}):` ${i} event after ${oe}ms${T?` (filter: ${T})`:""}${M?` (equals: ${M})`:""}`);return}B.result.watermark&&B.result.watermark>j&&(j=B.result.watermark),await new Promise(Q=>setTimeout(Q,E))}let u=Date.now()-_;k?console.log(JSON.stringify({found:!1,elapsedMs:u,kind:i,filter:T,equals:M})):console.error(` \u26A0 wait event ${i} timed out after ${u}ms${T?` (filter: ${T})`:""}${M?` (equals: ${M})`:""}`),process.exit(1)}async function Yt(e){let{bridge:l,args:n}=e,c=n.includes("--strict"),m=xe(n,3e3),{elapsed:i,settled:g}=await te({bridge:l,maxMs:m,strict:c});g?console.log(` idle in ${i}ms`):(console.error(` \u26A0 wait idle timed out after ${i}ms (may still be animating)`),process.exit(1))}async function Xt(e){let{bridge:l,args:n}=e,c=xe(n,2e4),{ready:m,elapsedMs:i,nodes:g,targets:y,flag:T,loadingText:M,externalReady:
|
|
239
|
+
})()`});(!B||!B.ok)&&(console.error(` could not query timeline: ${B&&"error"in B?B.error:"unknown"}`),process.exit(1));let D=B.result.events??[];for(let Q of D)if(Eo(Q,{filter:T,equals:M})){let oe=Date.now()-_;console.log(k?JSON.stringify({found:!0,elapsedMs:oe,event:Q}):` ${i} event after ${oe}ms${T?` (filter: ${T})`:""}${M?` (equals: ${M})`:""}`);return}B.result.watermark&&B.result.watermark>j&&(j=B.result.watermark),await new Promise(Q=>setTimeout(Q,E))}let u=Date.now()-_;k?console.log(JSON.stringify({found:!1,elapsedMs:u,kind:i,filter:T,equals:M})):console.error(` \u26A0 wait event ${i} timed out after ${u}ms${T?` (filter: ${T})`:""}${M?` (equals: ${M})`:""}`),process.exit(1)}async function Yt(e){let{bridge:l,args:n}=e,c=n.includes("--strict"),m=xe(n,3e3),{elapsed:i,settled:g}=await te({bridge:l,maxMs:m,strict:c});g?console.log(` idle in ${i}ms`):(console.error(` \u26A0 wait idle timed out after ${i}ms (may still be animating)`),process.exit(1))}async function Xt(e){let{bridge:l,args:n}=e,c=xe(n,2e4),{ready:m,elapsedMs:i,nodes:g,targets:y,flag:T,loadingText:M,externalReady:b,externalError:k,errors:_}=await lt(l,c,{onProgress(E){console.error(` still waiting after ${E.elapsedMs}ms \u2014 ${Ee(E)} (nodes: ${E.nodes}, targets: ${E.targets}, errors: ${E.errors})`)}});if(m){let E=c-i,j=Math.max(100,Math.min(1e4,E)),u=await te({bridge:l,maxMs:j,pollMs:32,stablePolls:2});u.settled||(console.error(` \u26A0 wait ready timed out after ${i+u.elapsed}ms \u2014 app mounted but did not settle (nodes: ${g}, targets: ${y})`),process.exit(1)),console.log(` ready in ${i+u.elapsed}ms: ${g} nodes, ${y} targets`);return}let I=Ee({externalError:k,loadingText:M,externalReady:b,flag:T,targets:y});console.error(` \u26A0 wait ready timed out after ${i}ms \u2014 ${I} (nodes: ${g}, targets: ${y}, errors: ${_})`),process.exit(1)}async function Vt(e){let{bridge:l,args:n,positional:c,inspectUsage:m}=e,i=c[1];i||(console.error(m("wait selector","<testid> [--max-ms 5000] [--gone]")),process.exit(1));let g=n.indexOf("--max-ms"),y=g>=0&&n[g+1]?Math.max(100,Number(n[g+1])):5e3,T=n.includes("--gone"),{found:M,node:b,elapsed:k}=await ct(l,i,y,{gone:T});if(T){M?console.log(` #${i} gone after ${k}ms`):(console.error(` \u26A0 wait selector #${i} --gone timed out after ${k??y}ms (still present)`),process.exit(1));return}if(M&&b){let _=b.absolutePosition?`@(${Math.round(b.absolutePosition.x)},${Math.round(b.absolutePosition.y)})`:"",I=b.layout?`${Math.round(b.layout.width)}x${Math.round(b.layout.height)}`:"?x?";console.log(` found #${i} in ${k}ms ${I} ${_}`)}else console.error(` \u26A0 wait selector #${i} timed out after ${k??y}ms`),process.exit(1)}function ro(e){return e==null?"\u2014":e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}K`:`${(e/1024/1024).toFixed(1)}M`}function io(e){return e==null?" \u2026":e<1e3?`${e}ms`.padStart(5):`${(e/1e3).toFixed(2)}s`.padStart(5)}function Qt(){process.stderr.write(` the sim is not responding. recover it with:
|
|
240
240
|
sootsim close --sim <id> # force-close the wedged sim
|
|
241
241
|
sootsim list # confirm it's gone
|
|
242
242
|
`)}async function Do(e){try{return await e.send({type:"evaluate",code:"1"},{timeoutMs:3e3}),!0}catch{return!1}}async function Co(e,l){try{let n=await e.send({type:"evaluate",code:`(async () => {
|
|
@@ -296,42 +296,41 @@ import{a as Y}from"./chunk-6CBI57IL.js";import{a as vt,b as kt}from"./chunk-7P2Q
|
|
|
296
296
|
frame: runtimeSnapshot?.keyboard?.frame ?? null,
|
|
297
297
|
focusedRect: runtimeSnapshot?.focused?.rect ?? null,
|
|
298
298
|
}
|
|
299
|
-
})()`}).then(l=>Je(l))}function Uo(e,l,n){if(!e.visible)return!1;let c=e.focusedInput;return!(l&&c&&!(c.testID===l||c.id===l)||n!==null&&
|
|
299
|
+
})()`}).then(l=>Je(l))}function Uo(e,l,n){if(!e.visible)return!1;let c=e.focusedInput;return!(l&&c&&!(c.testID===l||c.id===l)||n!==null&&he(e)!==n)}async function zo(e,l=600,n={}){let c=Date.now()+l;for(;Date.now()<=c;){let m=await He(e);if(Uo(m,n.targetId??null,n.secureTextEntry??null))return m;await ee(30)}return He(e)}async function Ne(e,l){let n=await He(e);if(n.visible)return n;console.error(` ${l} 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 so(e,l,n){return l==="appearance"?e.send({type:"evaluate",code:`(async () => {
|
|
300
300
|
const requested = ${JSON.stringify(n??"toggle")}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
return { ok: true, requested, value: next, applied }
|
|
301
|
+
// the engine owns toggle + auto resolution (settingsStore is the single
|
|
302
|
+
// source of truth). never infer the current scheme client-side \u2014 the old
|
|
303
|
+
// documentElement '#333333' sniff is never set in embedded / shell-chrome
|
|
304
|
+
// contexts, so 'toggle' read 'light' forever and stuck on the boot scheme.
|
|
305
|
+
window.postMessage({ type: 'soot-action', action: 'set-appearance', value: requested }, '*')
|
|
306
|
+
// let the engine's message handler apply + publish window.__sootsimColorScheme
|
|
307
|
+
await new Promise((r) => setTimeout(r, 60))
|
|
308
|
+
const applied = window.__sootsimColorScheme?.resolved
|
|
309
|
+
?? (window.matchMedia?.('(prefers-color-scheme: dark)')?.matches ? 'dark' : 'light')
|
|
310
|
+
const setting = window.__sootsimColorScheme?.setting ?? requested
|
|
311
|
+
return { ok: true, requested, setting, applied }
|
|
313
312
|
})()`}):e.send({type:"evaluate",code:`(async () => {
|
|
314
313
|
window.dispatchEvent(new CustomEvent(${JSON.stringify(l==="lock"?"sootsim:toggleLock":"sootsim:shake")}))
|
|
315
314
|
return { ok: true, action: ${JSON.stringify(l)} }
|
|
316
|
-
})()`})}function Go(e){let l={Enter:"return",NumpadEnter:"return",Backspace:"delete",Delete:"delete",Space:"space",ShiftLeft:"shift",ShiftRight:"shift"};if(l[e])return l[e];let n=e.match(/^Digit([0-9])$/);if(n)return n[1];let c=e.match(/^Key([A-Z])$/);return c?c[1].toLowerCase():null}function Yo(e){if(typeof e!="string")return null;let l=e.replace(/\s+/g," ").trim();return l?l.slice(0,80):null}function ao(...e){for(let l of e){if(typeof l!="string")continue;let n=l.trim();if(n)return n}return null}function Xo(e){let l=e.indexOf("--node-id");if(l<0)return null;let n=e[l+1];if(!n)return null;let c=Number(n);return Number.isInteger(c)&&c>0?c:null}async function L(e,l,n){let c=ve({source:e,step:l,summary:n});c.active&&(c.replaced?console.error(` draft: replaced unkept action "${c.replaced.summary}" \u2014 \`flow keep\` commits one action at a time`):console.error(" draft: action pending \u2014 `sootsim flow keep` to commit"))}function no(e,l,n){if(!n||n.hit===!1)return null;let c=ao(n.responderTestID,n.testID);if(c)return{step:{tapOn:{id:c}},summary:`tap #${c}`};let m=Yo(n.text);return m?{step:{tapOn:m},summary:`tap "${m}"`}:{step:{tapAtCoords:{x:e,y:l}},summary:`tap @${Math.round(e)},${Math.round(l)}`}}function qe(e,l,n){let c=ao(l?.testID,l?.id);return c?{step:{tapOn:{id:c}},summary:`tap #${c}`}:n==="id"?{step:{tapOn:{id:e}},summary:`tap #${e}`}:{step:{tapOn:e},summary:`tap "${e}"`}}async function Jn(e,l){let n=e[0]==="get"||e[0]==="do"||e[0]==="debug"||e[0]==="wait"?e[0]:null,c=n?e.slice(1):e,m=Ge(c,{port:l.port,commandTimeoutMs:l.timeoutMs,stripBooleanFlags:["--verbose","-v","--help","-h","--clear-state","--json","--all","--watch","-w","--strict","--no-wait","--dump","--failed","--slow","--tail","-f","--interactive-targets","--actions","--internal","--compact","--no-xy","--no-clipped","--include-occluded"],stripValueFlags:["--output","--nth","--index","--testid","--test-id","--text","--node-id","--max-ms","--filter","--limit","--level","--threshold","--equals","--since","--testid-like","--only","--subtree"]}),i=m.positional,g=i[0],y=n==="get"||n==="do"||n==="debug"||n==="wait"?n:"inspect",T=typeof c[0]=="string"&&Ke.has(c[0]),M=T?c[0]:null,
|
|
315
|
+
})()`})}function Go(e){let l={Enter:"return",NumpadEnter:"return",Backspace:"delete",Delete:"delete",Space:"space",ShiftLeft:"shift",ShiftRight:"shift"};if(l[e])return l[e];let n=e.match(/^Digit([0-9])$/);if(n)return n[1];let c=e.match(/^Key([A-Z])$/);return c?c[1].toLowerCase():null}function Yo(e){if(typeof e!="string")return null;let l=e.replace(/\s+/g," ").trim();return l?l.slice(0,80):null}function ao(...e){for(let l of e){if(typeof l!="string")continue;let n=l.trim();if(n)return n}return null}function Xo(e){let l=e.indexOf("--node-id");if(l<0)return null;let n=e[l+1];if(!n)return null;let c=Number(n);return Number.isInteger(c)&&c>0?c:null}async function L(e,l,n){let c=ve({source:e,step:l,summary:n});c.active&&(c.replaced?console.error(` draft: replaced unkept action "${c.replaced.summary}" \u2014 \`flow keep\` commits one action at a time`):console.error(" draft: action pending \u2014 `sootsim flow keep` to commit"))}function no(e,l,n){if(!n||n.hit===!1)return null;let c=ao(n.responderTestID,n.testID);if(c)return{step:{tapOn:{id:c}},summary:`tap #${c}`};let m=Yo(n.text);return m?{step:{tapOn:m},summary:`tap "${m}"`}:{step:{tapAtCoords:{x:e,y:l}},summary:`tap @${Math.round(e)},${Math.round(l)}`}}function qe(e,l,n){let c=ao(l?.testID,l?.id);return c?{step:{tapOn:{id:c}},summary:`tap #${c}`}:n==="id"?{step:{tapOn:{id:e}},summary:`tap #${e}`}:{step:{tapOn:e},summary:`tap "${e}"`}}async function Jn(e,l){let n=e[0]==="get"||e[0]==="do"||e[0]==="debug"||e[0]==="wait"?e[0]:null,c=n?e.slice(1):e,m=Ge(c,{port:l.port,commandTimeoutMs:l.timeoutMs,stripBooleanFlags:["--verbose","-v","--help","-h","--clear-state","--json","--all","--watch","-w","--strict","--no-wait","--dump","--failed","--slow","--tail","-f","--interactive-targets","--actions","--internal","--compact","--no-xy","--no-clipped","--include-occluded"],stripValueFlags:["--output","--nth","--index","--testid","--test-id","--text","--node-id","--max-ms","--filter","--limit","--level","--threshold","--equals","--since","--testid-like","--only","--subtree"]}),i=m.positional,g=i[0],y=n==="get"||n==="do"||n==="debug"||n==="wait"?n:"inspect",T=typeof c[0]=="string"&&Ke.has(c[0]),M=T?c[0]:null,b=o=>T&&o===c[0]?`sootsim ${o}`:`sootsim ${y} ${o}`,k=(o,t)=>` usage: ${b(o)}${t?` ${t}`:""}`;if(!g||e.includes("--help")||e.includes("-h")){let o={bridgePort:7668,defaultShellUrl:Ue};if(y==="do"||y==="get"||y==="debug"||y==="wait"){let r=Fe(y,o);r&&(console.log(`${r}
|
|
317
316
|
`),process.exit(0))}if(M==="shell"){let r=_e("shell",o);r&&(console.log(`${r}
|
|
318
317
|
`),process.exit(0))}let t=_e("inspect",o),s=["do","get","debug","wait"].map(r=>Fe(r,o)).filter(r=>r!=null).join(`
|
|
319
318
|
|
|
320
319
|
`);console.log(`${t??""}
|
|
321
320
|
|
|
322
321
|
${s}
|
|
323
|
-
`),process.exit(0)}let _=m.wsPort,I=m.simId,E=m.simIdSource,j=m.commandTimeoutMs;if(g==="list"&&c.some(o=>o==="--drivers"||o==="-D")){let{buildDriverListRows:o}=await import("./drivers-
|
|
324
|
-
`);let s=Math.max(...t.map(a=>a.id.length),6),r=Math.max(...t.map(a=>a.kind.length),4);for(let a of t){let d=a.available?"\u2713":"\u2717",p=a.id.padEnd(s),
|
|
322
|
+
`),process.exit(0)}let _=m.wsPort,I=m.simId,E=m.simIdSource,j=m.commandTimeoutMs;if(g==="list"&&c.some(o=>o==="--drivers"||o==="-D")){let{buildDriverListRows:o}=await import("./drivers-NYH3XOHT.js"),t=o();console.log(` available drivers (${t.length}):
|
|
323
|
+
`);let s=Math.max(...t.map(a=>a.id.length),6),r=Math.max(...t.map(a=>a.kind.length),4);for(let a of t){let d=a.available?"\u2713":"\u2717",p=a.id.padEnd(s),h=a.kind.padEnd(r);console.log(` ${d} ${p} ${h} ${a.description}`),a.available&&a.detail?console.log(` ${a.detail}`):!a.available&&a.reason&&console.log(` unavailable: ${a.reason}`)}return}let u=Ye(m),z=I||"default",B=new Set(["errors","warnings","requests","js","eval","reload","globals","perf","list","wait","sleep"]),D=200;function Q(o){let t=o.replace(/\s+/g," ").trim();if(!t)return"";if(/^<(!doctype html|html|\?xml)|<body[\s>]/i.test(t)){let r=/<title[^>]*>([^<]+)<\/title>/i.exec(o)?.[1]?.trim(),a=/<body[^>]*>([\s\S]*?)<\//i.exec(o)?.[1]?.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().slice(0,80),d=r||a||"html error page";return`<html ${o.length}B> "${d}" (body elided \u2014 add --json for the full payload)`}return t.length<=D?t:`${t.slice(0,D)}\u2026 (+${t.length-D} more bytes)`}function oe(o){let t=o.displayUrl||o.url;return o.status!=null?`${o.method} ${t} -> ${o.status}${o.statusText?` ${o.statusText}`:""}`:o.error?`${o.method} ${t} -> ${o.error}`:`${o.method} ${t}`}async function S(o){let t=me()?5e3:1500;try{let{settled:s,elapsed:r}=await te({bridge:o,maxMs:t,pollMs:32,stablePolls:2});s||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.
|
|
325
324
|
`)}catch{}}function N(o,t){console.error(` tap failed: ${o} stayed visible but did not receive a hittable press after ${t.attempts} attempt${t.attempts===1?"":"s"}`),t.result&&console.error(` last result: ${JSON.stringify(t.result)}`)}async function J(){try{return await u.send({type:"evaluate",code:`(() => ({
|
|
326
325
|
console: ${Se},
|
|
327
326
|
requests: window.__sootsimTest?.getRequestCounts?.() || null,
|
|
328
327
|
}))()`})||{console:null,requests:null}}catch{return{console:null,requests:null}}}async function W(o={}){let t=o.counts!==void 0?o.counts:await G(u,"getRequestCounts");if(!t||typeof t!="object")return;let s=Math.max(0,Number(t.failed)||0);if(s===0||!o.includeTail&&!Ce("requests",z,String(s))||(console.log(`
|
|
329
|
-
network: ${s} failed request${s===1?"":"s"}`),console.log(` inspect: ${
|
|
328
|
+
network: ${s} failed request${s===1?"":"s"}`),console.log(` inspect: ${b("requests")} 5`),!o.includeTail))return;let r=await G(u,"getFailedRequests",5);if(!(!Array.isArray(r)||r.length===0)){console.log(`
|
|
330
329
|
recent failed requests:
|
|
331
330
|
`);for(let a of r){let d=ie(a.timestamp);console.log(` [${d}] ${oe(a)}`),a.responseBody?console.log(` ${Q(a.responseBody)}`):a.error&&console.log(` ${a.error}`)}}}async function V(o={}){let t=o.counts!==void 0?o.counts:await u.send({type:"evaluate",code:Se});if(!t||typeof t!="object")return;let s=t,r=Math.max(0,Number(s.errors)||0),a=Math.max(0,Number(s.warnings)||0);if(r===0&&a===0||!o.includeTail&&!Ce("console",z,`${r}:${a}`))return;let d=[];if(r>0&&d.push(`${r} console error${r===1?"":"s"}`),a>0&&d.push(`${a} console warning${a===1?"":"s"}`),console.log(`
|
|
332
|
-
console: ${d.join(", ")}`),console.log(` inspect: ${
|
|
331
|
+
console: ${d.join(", ")}`),console.log(` inspect: ${b("errors")} 5`),a>0&&console.log(` inspect: ${b("warnings")} 5`),!o.includeTail||r===0)return;let p=await $e(u,5);if(!(!Array.isArray(p)||p.length===0)){console.log(`
|
|
333
332
|
recent console errors:
|
|
334
|
-
`);for(let
|
|
333
|
+
`);for(let h of p){let f=ie(h.timestamp),w=Array.isArray(h.args)?h.args.map(O=>typeof O=="object"?JSON.stringify(O):String(O)).join(" "):String(h);console.log(` [${f}] ${w}`)}}}let Z=["console","fetch","toast","alert","notification","screen","app-launch","keyboard","route","actionsheet","picker","shell","scroll","gesture","text-input","animation","reanimated"];async function re(o){let t=ze(),s=null;try{s=await Ve(o,`(() => {
|
|
335
334
|
const tl = window.SootSim && window.SootSim.bridges && window.SootSim.bridges.timeline
|
|
336
335
|
if (!tl || typeof tl.summary !== 'function') return null
|
|
337
336
|
const cursorKey = ${JSON.stringify(t)}
|
|
@@ -347,9 +346,9 @@ ${s}
|
|
|
347
346
|
}
|
|
348
347
|
}
|
|
349
348
|
return summary ? { summary, consoleSplit } : null
|
|
350
|
-
})()`)}catch{return}if(!s||!s.summary||!s.summary.total)return;let r=s.summary.byKind??{},a=[],d=new Set;for(let p of Z){let
|
|
349
|
+
})()`)}catch{return}if(!s||!s.summary||!s.summary.total)return;let r=s.summary.byKind??{},a=[],d=new Set;for(let p of Z){let h=r[p];if(h)if(d.add(p),p==="console"&&s.consoleSplit){let{error:f,warn:w}=s.consoleSplit;f>0&&a.push(`${f} error${f===1?"":"s"}`),w>0&&a.push(`${w} warning${w===1?"":"s"}`)}else a.push(`${h} ${p}${h===1?"":"s"}`)}for(let[p,h]of Object.entries(r))!d.has(p)&&h&&a.push(`${h} ${p}${h===1?"":"s"}`);if(a.length!==0&&(console.log(`
|
|
351
350
|
since last: ${a.join(" \xB7 ")} \u2014 sootsim what-happened`),s.summary.lastAt))try{await Oe(o,"SootSim.bridges.timeline.cursorAdvance",t,s.summary.lastAt)}catch{}}let pe=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"]),C=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"]),le=(e.includes("--verbose")||e.includes("-v"))&&!e.includes("--json");y==="do"&&g==="shell"&&(console.error(" `sootsim do shell` was removed. use `sootsim shell ...` instead."),process.exit(1)),pe.has(g)&&await Xe(u),C.has(g)&&await ue(u,{verbose:le});try{switch(g){case"list":{await jt({bridge:u,simId:I,args:c});break}case"tree":{await Ht({bridge:u,args:c,positional:i});break}case"a11y":{let o=await it(u);if(!Array.isArray(o)||o.length===0){console.log(" no accessible nodes found");break}if(e.includes("--json"))console.log(JSON.stringify(o,null,2));else{console.log(` accessibility tree (${o.length} nodes):
|
|
352
|
-
`);for(let t of o){let s=[];if(s.push(`[${t.role}]`),t.label){let r=t.label.length>50?t.label.slice(0,47)+"...":t.label;s.push(`"${r}"`)}if(t.hint&&s.push(`(hint: "${t.hint}")`),t.testID&&s.push(`#${t.testID}`),t.state){let r=[];t.state.disabled&&r.push("disabled"),t.state.selected&&r.push("selected"),t.state.checked===!0&&r.push("checked"),t.state.checked==="mixed"&&r.push("mixed"),t.state.busy&&r.push("busy"),t.state.expanded===!0&&r.push("expanded"),t.state.expanded===!1&&r.push("collapsed"),r.length&&s.push(`{${r.join(", ")}}`)}t.position&&s.push(`@(${t.position.x},${t.position.y})`),t.size&&s.push(`${t.size.w}x${t.size.h}`),console.log(" "+s.join(" "))}}break}case"find":{await Dt({bridge:u,args:e,effectiveArgs:c,positional:i,inspectUsage:k});break}case"count":{await Et(u,{args:c});break}case"keyboard":{await Bt(u,{json:e.includes("--json")});break}case"screens":{await Jt(u,{json:e.includes("--json")});break}case"memory":{await Lt(u,{args:c});break}case"wait":{await Ut({wsPort:_,commandTimeoutMs:j,simId:I,simIdSource:E,positional:i});break}case"sleep":{await qt({positional:i,inspectUsage:k});break}case"settle":{await Wt({bridge:u,args:e,positional:i});break}case"ready":{await Xt({bridge:u,args:e});break}case"idle":{await Yt({bridge:u,args:e,positional:i});break}case"selector":{await Vt({bridge:u,args:e,positional:i,inspectUsage:k});break}case"event":{await Gt({bridge:u,args:e,positional:i,inspectUsage:k});break}case"layout":{let o=i[1];if(!o){await Ct({bridge:u,args:c});break}let t=await u.send({type:"evaluate",code:`(async () => await window.__sootsimTest.getLayout(${JSON.stringify(o)}))()`});console.log(JSON.stringify(t,null,2));break}case"capture":case"screenshot":{let t=e.find((
|
|
351
|
+
`);for(let t of o){let s=[];if(s.push(`[${t.role}]`),t.label){let r=t.label.length>50?t.label.slice(0,47)+"...":t.label;s.push(`"${r}"`)}if(t.hint&&s.push(`(hint: "${t.hint}")`),t.testID&&s.push(`#${t.testID}`),t.state){let r=[];t.state.disabled&&r.push("disabled"),t.state.selected&&r.push("selected"),t.state.checked===!0&&r.push("checked"),t.state.checked==="mixed"&&r.push("mixed"),t.state.busy&&r.push("busy"),t.state.expanded===!0&&r.push("expanded"),t.state.expanded===!1&&r.push("collapsed"),r.length&&s.push(`{${r.join(", ")}}`)}t.position&&s.push(`@(${t.position.x},${t.position.y})`),t.size&&s.push(`${t.size.w}x${t.size.h}`),console.log(" "+s.join(" "))}}break}case"find":{await Dt({bridge:u,args:e,effectiveArgs:c,positional:i,inspectUsage:k});break}case"count":{await Et(u,{args:c});break}case"keyboard":{await Bt(u,{json:e.includes("--json")});break}case"screens":{await Jt(u,{json:e.includes("--json")});break}case"memory":{await Lt(u,{args:c});break}case"wait":{await Ut({wsPort:_,commandTimeoutMs:j,simId:I,simIdSource:E,positional:i});break}case"sleep":{await qt({positional:i,inspectUsage:k});break}case"settle":{await Wt({bridge:u,args:e,positional:i});break}case"ready":{await Xt({bridge:u,args:e});break}case"idle":{await Yt({bridge:u,args:e,positional:i});break}case"selector":{await Vt({bridge:u,args:e,positional:i,inspectUsage:k});break}case"event":{await Gt({bridge:u,args:e,positional:i,inspectUsage:k});break}case"layout":{let o=i[1];if(!o){await Ct({bridge:u,args:c});break}let t=await u.send({type:"evaluate",code:`(async () => await window.__sootsimTest.getLayout(${JSON.stringify(o)}))()`});console.log(JSON.stringify(t,null,2));break}case"capture":case"screenshot":{let t=e.find((h,f)=>e[f-1]==="--output")||"/tmp/sootsim-inspect.png",s=await oo(e,u),r={type:"screenshot"};s&&(r.crop=s);let d=(await u.send(r)).replace(/^data:image\/png;base64,/,"");s&&console.log(` area: x=${s.x} y=${s.y} w=${s.w} h=${s.h}`),(await import("fs")).writeFileSync(t,Buffer.from(d,"base64")),console.log(` saved: ${t}`);break}case"sample-color":{let o=await oo(e,u);o||(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 u.send({type:"evaluate",code:kt(o)});if(e.includes("--json"))console.log(JSON.stringify(t,null,2));else{let{r:s,g:r,b:a,a:d,hex:p,samples:h}=t,f=o.w===1&&o.h===1?`@(${o.x},${o.y})`:`@(${o.x},${o.y}) ${o.w}x${o.h}`;console.log(` ${p} rgba(${s}, ${r}, ${a}, ${d}) ${f} ${h} samples`)}break}case"node":{let o=i[1];o||(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 u.send({type:"evaluate",code:`(async () => {
|
|
353
352
|
const t = window.__sootsimTest
|
|
354
353
|
const q = ${JSON.stringify(o)}
|
|
355
354
|
let node = null
|
|
@@ -405,17 +404,17 @@ ${s}
|
|
|
405
404
|
transform,
|
|
406
405
|
parentChain,
|
|
407
406
|
}
|
|
408
|
-
})()`});console.log(JSON.stringify(t,null,2));break}case"tap":{let o=Number(i[1]),t=Number(i[2]),s=
|
|
407
|
+
})()`});console.log(JSON.stringify(t,null,2));break}case"tap":{let o=Number(i[1]),t=Number(i[2]),s=be(e);if(s){let d=await ye(u,{agent:me(),textFallback:s.mode==="text"?s.value:void 0,resolve:async()=>{let f=await Te(u,s);return f?{cx:f.x,cy:f.y,match:{id:s.mode==="testid"?s.value:f.id??null,testID:s.mode==="testid"?s.value:f.testID??null,text:s.mode==="text"?s.value:f.text??null,type:f.type??null},target:{id:f.id??null,testID:f.testID??null,text:f.text??null,type:f.type??null}}:null}}),p=d.payload;(!p||typeof p.cx!="number")&&(console.error(` not found: ${s.value}`),s.mode==="testid"&&Y("wait-selector-for-missing-testid",s.value),process.exit(1)),de(d.result)||(N(`${s.mode} "${s.value}"`,d),process.exit(1));let h=no(p.cx,p.cy,d.result);h&&await L("inspect tap",h.step,h.summary),console.log(JSON.stringify({...d.attempts>1?{attempts:d.attempts}:{},...d.result},null,2));break}(!Number.isFinite(o)||!Number.isFinite(t))&&(console.error(k("tap","<x> <y> | --testid <id> | --text <t>")),process.exit(1));let r=await _t(u,o,t),a=no(o,t,r);a&&await L("inspect tap",a.step,a.summary),console.log(JSON.stringify(r,null,2));break}case"drag":case"swipe":{let o=Number(i[1]),t=Number(i[2]),s=Number(i[3]),r=Number(i[4]),a=g==="swipe"?10:12,d=g==="swipe"?8:16,p=i[5]?Number(i[5]):a,h=i[6]?Number(i[6]):d;(!Number.isFinite(o)||!Number.isFinite(t)||!Number.isFinite(s)||!Number.isFinite(r)||!Number.isFinite(p)||!Number.isFinite(h))&&(console.error(k(g,"<x1> <y1> <x2> <y2> [steps] [stepMs]")),process.exit(1));let f=await u.send({type:"evaluate",code:`(async () => {
|
|
409
408
|
const interact = window.__sootsimInteract
|
|
410
409
|
if (!interact?.drag) return { ok: false, reason: 'no interact.drag' }
|
|
411
|
-
const value = await interact.drag(${o}, ${t}, ${s}, ${r}, ${Math.max(1,Math.round(p))}, ${Math.max(0,Math.round(
|
|
410
|
+
const value = await interact.drag(${o}, ${t}, ${s}, ${r}, ${Math.max(1,Math.round(p))}, ${Math.max(0,Math.round(h))})
|
|
412
411
|
return { ok: !!value, value }
|
|
413
|
-
})()`});if(f?.ok){let w=Math.max(1,Math.round(Math.max(1,p)*Math.max(0,
|
|
412
|
+
})()`});if(f?.ok){let w=Math.max(1,Math.round(Math.max(1,p)*Math.max(0,h)));await L(`inspect ${g}`,{swipe:{start:`${o}, ${t}`,end:`${s}, ${r}`,duration:w}},`${g} ${o},${t} -> ${s},${r}`)}console.log(JSON.stringify(f,null,2));break}case"pinch":{let o=Number(i[1]),t=Number(i[2]),s=Number(i[3]),r=Number(i[4]),a=Number(i[5]),d=Number(i[6]),p=Number(i[7]),h=Number(i[8]),f=i[9]?Number(i[9]):12,w=i[10]?Number(i[10]):16;(!Number.isFinite(o)||!Number.isFinite(t)||!Number.isFinite(s)||!Number.isFinite(r)||!Number.isFinite(a)||!Number.isFinite(d)||!Number.isFinite(p)||!Number.isFinite(h)||!Number.isFinite(f)||!Number.isFinite(w))&&(console.error(k("pinch","<x1> <y1> <x2> <y2> <x1'> <y1'> <x2'> <y2'> [steps] [stepMs]")),process.exit(1));let O=await u.send({type:"evaluate",code:`(async () => {
|
|
414
413
|
const interact = window.__sootsimInteract
|
|
415
414
|
if (!interact?.pinch) return { ok: false, reason: 'no interact.pinch' }
|
|
416
|
-
const value = await interact.pinch(${o}, ${t}, ${s}, ${r}, ${a}, ${d}, ${p}, ${
|
|
415
|
+
const value = await interact.pinch(${o}, ${t}, ${s}, ${r}, ${a}, ${d}, ${p}, ${h}, ${Math.max(1,Math.round(f))}, ${Math.max(0,Math.round(w))})
|
|
417
416
|
return { ok: !!value, value }
|
|
418
|
-
})()`});O?.ok&&await L("inspect pinch",{pinch:{from:[o,t,s,r],to:[a,d,p,
|
|
417
|
+
})()`});O?.ok&&await L("inspect pinch",{pinch:{from:[o,t,s,r],to:[a,d,p,h],steps:Math.max(1,Math.round(f)),stepMs:Math.max(0,Math.round(w))}},`pinch (${o},${t}) (${s},${r}) -> (${a},${d}) (${p},${h})`),console.log(JSON.stringify(O,null,2));break}case"tap-text":{let o=i[1];o||(console.error(k("tap-text","<text>")),process.exit(1));let t=U=>{let R=e.indexOf(U);return R>=0&&R+1<e.length?e[R+1]:null},s=U=>e.includes(U),r=t("--nth")??t("--index"),a=r!==null?Number(r):null;a!==null&&!Number.isFinite(a)&&(console.error(` --nth/--index requires an integer, got: ${r}`),process.exit(1));let d=t("--within"),p=t("--role"),h=s("--exact"),f=s("--first"),w=t("--min-y"),O=t("--max-y"),q=t("--min-x"),H=t("--max-x");for(let[U,R]of[["--min-y",w],["--max-y",O],["--min-x",q],["--max-x",H]])R!==null&&!Number.isFinite(Number(R))&&(console.error(` ${U} requires a number, got: ${R}`),process.exit(1));let K=e.indexOf("--near"),F=null;if(K>=0){let U=Number(e[K+1]),R=Number(e[K+2]);(!Number.isFinite(U)||!Number.isFinite(R))&&(console.error(" --near requires two numbers: --near <x> <y>"),process.exit(1)),F={x:U,y:R}}let x={exact:h,role:p,within:d,minX:q!==null?Number(q):null,maxX:H!==null?Number(H):null,minY:w!==null?Number(w):null,maxY:O!==null?Number(O):null,near:F,nth:a,first:f},$=await At(u,o,x,{agent:me()}),v=$.payload;if(v?.error==="bridge-not-ready"&&(console.error(" sootsim test bridge not ready"),process.exit(1)),v?.ambiguous){let U=v.candidates;console.error(` ambiguous: ${v.total} matches for "${o}"`);for(let R of U){let we=R.abs?`@(${Math.round(R.abs.x)},${Math.round(R.abs.y)})`:"",lo=R.layout?` ${R.layout.width}x${R.layout.height}`:"",co=R.testID?` #${R.testID}`:"",uo=R.text?` "${R.text}"`:"",mo=R.ancestorTestIDs.length>0?` within ${R.ancestorTestIDs.slice(0,3).map(po=>`#${po}`).join(" > ")}`:"";console.error(` [${R.idx}] <${R.type}>${uo}${co} ${we}${lo}${mo}`)}v.total>U.length&&console.error(` ... and ${v.total-U.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)}v?.nthOutOfRange&&(console.error(` not found: nth ${v.nth} of ${v.total} match${v.total===1?"":"es"} for "${o}"`),process.exit(1)),(!v||typeof v.cx!="number")&&(console.error(` not found: ${o}`),process.exit(1)),de($.result)||(N(`text "${o}"`,$),process.exit(1));let se=qe(o,{id:v.target?.id??null,testID:v.target?.testID??null,type:v.target?.type??null,cx:v.cx,cy:v.cy},"text");await L("inspect tap-text",se.step,se.summary),console.log(JSON.stringify({matched:v.match,tapped:{nodeId:v.target?.nodeId??null,id:v.target?.id??null,testID:v.target?.testID??null,type:v.target?.type??null,cx:v.cx,cy:v.cy},...v.strategy&&v.strategy!=="matched-node"?{strategy:v.strategy}:{},...v.total>1||a!==null?{nth:{index:v.idx,total:v.total}}:{},...$.attempts>1?{attempts:$.attempts}:{},result:$.result},null,2));break}case"tap-best":{let o=i[1];o||(console.error(k("tap-best","<query>")),process.exit(1));let t=await Pt(u,o,{agent:me()}),s=t.payload;s||(console.error(` tap-best: no testID or visible text matched "${o}". try \`sootsim find --interactive-targets\` to list candidates.`),process.exit(1)),"error"in s&&(console.error(` ${s.error}`),process.exit(1)),s.strategy==="none"&&(console.error(` tap-best: no testID or visible text matched "${o}". try \`sootsim find --interactive-targets\` to list candidates.`),process.exit(1));let r=s.node;de(t.result)||(N(`best "${o}"`,t),process.exit(1));let a=qe(o,{id:r.id,testID:r.testID,type:r.type,cx:s.cx,cy:s.cy},s.strategy==="testid"?"id":"text");await L("inspect tap-best",a.step,a.summary),console.log(JSON.stringify({matched:{strategy:s.strategy,nodeId:r.nodeId,id:r.id,testID:r.testID,type:r.type,text:r.text},tapped:{cx:s.cx,cy:s.cy},...t.attempts>1?{attempts:t.attempts}:{},result:t.result},null,2));break}case"tap-id":{let o=i[1];o||(console.error(k("tap-id","<id>")),process.exit(1));let t=await Ot(u,o,{agent:me()}),s=t.payload;(!s||typeof s.cx!="number")&&(console.error(` not found: ${o}`),await Co(u,o),process.exit(1)),de(t.result)||(N(`id "${o}"`,t),process.exit(1));let r=qe(o,{id:s.target?.id??null,testID:s.target?.testID??null,type:s.target?.type??null,cx:s.cx,cy:s.cy},"id");await L("inspect tap-id",r.step,r.summary),console.log(JSON.stringify({matched:s.match,tapped:{nodeId:s.target?.nodeId??null,id:s.target?.id??null,testID:s.target?.testID??null,type:s.target?.type??null,cx:s.cx,cy:s.cy},...s.strategy&&s.strategy!=="matched-node"?{strategy:s.strategy}:{},...t.attempts>1?{attempts:t.attempts}:{},result:t.result},null,2));break}case"type-into":{let o=i[1],t=i.slice(2).join(" ");(!o||!t)&&(console.error(k("type-into","<id> <text>")),process.exit(1));let s=JSON.stringify(o),r=await u.send({type:"evaluate",code:`(async () => {
|
|
419
418
|
const t = window.__sootsimTest
|
|
420
419
|
if (!t) return null
|
|
421
420
|
const n = await (t.findByTestId(${s}) || t.findById(${s}))
|
|
@@ -430,7 +429,7 @@ ${s}
|
|
|
430
429
|
secureTextEntry: !!n.secureTextEntry,
|
|
431
430
|
placeholder: n.placeholder || null,
|
|
432
431
|
}
|
|
433
|
-
})()`});(!r||typeof r.cx!="number")&&(console.error(` not found: ${o}`),process.exit(1)),r.isTextInput||console.error(` warning: ${o} is not a text input (isTextInput: false)`);let a=await u.send({type:"tap",x:r.cx,y:r.cy,target:{id:r.id??o,testID:r.testID??o,text:null,type:r.type??null}}),d=r.secureTextEntry===!0,p=await zo(u,1e3,{targetId:o,secureTextEntry:d});p.visible||(console.error(` keyboard did not open after tapping ${o}`),process.exit(1));let
|
|
432
|
+
})()`});(!r||typeof r.cx!="number")&&(console.error(` not found: ${o}`),process.exit(1)),r.isTextInput||console.error(` warning: ${o} is not a text input (isTextInput: false)`);let a=await u.send({type:"tap",x:r.cx,y:r.cy,target:{id:r.id??o,testID:r.testID??o,text:null,type:r.type??null}}),d=r.secureTextEntry===!0,p=await zo(u,1e3,{targetId:o,secureTextEntry:d});p.visible||(console.error(` keyboard did not open after tapping ${o}`),process.exit(1));let h=p.focusedInput;h&&(h.testID===o||h.id===o||(console.error(` focus routing mismatch after tap: requested ${JSON.stringify(o)} but focus is on ${JSON.stringify(h.testID??h.id??null)}. did the tap land on an outer Pressable wrapper?`),process.exit(1))),await u.send({type:"keyboard",action:"type",text:t});let f=d||he(p),w=f?X:Le(t,p),O=f&&p.focusedInput?{...p.focusedInput,secureTextEntry:!0,text:typeof p.focusedInput.text=="string"?X:p.focusedInput.text}:p.focusedInput??null;await L("inspect type-into",{tapOn:{id:o},inputText:w},w===X?`type-into #${o} ${X}`:`type-into #${o} ${JSON.stringify(t)}`),console.log(JSON.stringify({target:o,isTextInput:r.isTextInput,secureTextEntry:f,keyboardOpened:p.visible??a?.keyboardOpened??!1,focusedInput:O,typed:w},null,2));break}case"type":{let o=i.slice(1).join(" ");o||(console.error(k("type","<text>")),process.exit(1));let t=await Ne(u,"type");await u.send({type:"keyboard",action:"type",text:o});let s=Le(o,t);await L("inspect type",{inputText:s},s===X?`type ${X}`:`type ${JSON.stringify(o)}`),console.log(s===X?` typed: ${X}`:` typed: ${JSON.stringify(o)}`);break}case"key":{let o=i[1];o||(console.error(k("key","<name>")),process.exit(1)),await Ne(u,"key"),await u.send({type:"keyboard",action:"press",text:o}),await L("inspect key",{pressKey:o},`key ${o}`),console.log(` pressed: ${o}`);break}case"key-sequence":{let o=i.slice(1);o.length===0&&(console.error(k("key-sequence","<key> [<key> ...]")),process.exit(1)),await Ne(u,"key-sequence");for(let t of o)await u.send({type:"keyboard",action:"press",text:t});await L("inspect key-sequence",{pressKey:o.join(" ")},`key-sequence ${o.join(" ")}`),console.log(` pressed: ${o.join(", ")}`);break}case"keycode":{let o=i.slice(1);o.length===0&&(console.error(k("keycode","<code> [<code> ...]")),process.exit(1));let t=o.map(r=>({code:r,key:Go(r)})),s=t.filter(r=>!r.key);s.length>0&&(console.error(` unsupported keycode(s): ${s.map(r=>r.code).join(", ")}`),process.exit(1)),await Ne(u,"keycode");for(let r of t)await u.send({type:"keyboard",action:"press",text:r.key});await L("inspect keycode",{pressKey:t.map(r=>r.key).join(" ")},`keycode ${o.join(" ")}`),console.log(` pressed: ${o.join(", ")}`);break}case"dispatch":{let o=i[1];o||(console.error(k("dispatch","<char>")),process.exit(1)),await u.send({type:"keyboard",action:"dispatchKey",text:o}),await L("inspect dispatch",{dispatchKey:o},`dispatch ${JSON.stringify(o)}`),console.log(` dispatched: ${o}`);break}case"dismiss":{await u.send({type:"keyboard",action:"dismiss"}),await L("inspect dismiss",{hideKeyboard:!0},"dismiss keyboard"),console.log(" keyboard dismissed");break}case"double-tap":{let o=Number(i[1]),t=Number(i[2]),s=be(e);if(s){let p=await Te(u,s);p||(console.error(` not found: ${s.value}`),s.mode==="testid"&&Y("wait-selector-for-missing-testid",s.value),process.exit(1)),o=p.x,t=p.y}let r=i[3]?Number(i[3]):80;(!Number.isFinite(o)||!Number.isFinite(t)||!Number.isFinite(r))&&(console.error(k("double-tap","<x> <y> [gapMs] | --testid <id>")),process.exit(1));let a=Math.max(0,Math.round(r)),d=await u.send({type:"evaluate",code:`(async () => {
|
|
434
433
|
const interact = window.__sootsimInteract
|
|
435
434
|
if (interact?.doubleTap) {
|
|
436
435
|
return {
|
|
@@ -453,13 +452,13 @@ ${s}
|
|
|
453
452
|
first,
|
|
454
453
|
second,
|
|
455
454
|
}
|
|
456
|
-
})()`});d?.ok&&await L("inspect double-tap",{doubleTapAtCoords:{x:o,y:t,gapMs:a}},`double-tap @${o},${t}`),console.log(JSON.stringify(d,null,2));break}case"long-press":{let o=Number(i[1]),t=Number(i[2]),s=
|
|
455
|
+
})()`});d?.ok&&await L("inspect double-tap",{doubleTapAtCoords:{x:o,y:t,gapMs:a}},`double-tap @${o},${t}`),console.log(JSON.stringify(d,null,2));break}case"long-press":{let o=Number(i[1]),t=Number(i[2]),s=be(e),r=null;if(s){let f=await Te(u,s);f||(console.error(` not found: ${s.value}`),s.mode==="testid"&&Y("wait-selector-for-missing-testid",s.value),process.exit(1)),o=f.x,t=f.y,r={id:f.id??null,testID:f.testID??null,text:f.text??null,type:f.type??null}}let a=s?i[1]:i[3],d=a?Number(a):600;(!Number.isFinite(o)||!Number.isFinite(t)||!Number.isFinite(d))&&(console.error(k("long-press","<x> <y> [durationMs] | --testid <id>")),process.exit(1));let p=Math.max(0,Math.round(d)),h=await u.send({type:"longPress",x:o,y:t,durationMs:p,target:r});h?.ok&&await L("inspect long-press",{tapAtCoords:{x:o,y:t}},`long-press @${o},${t}`),console.log(JSON.stringify(h,null,2));break}case"touch":{let o=i[1],t=Number(i[2]),s=Number(i[3]),r=i[4]?Number(i[4]):999,a=o==="down"?"touchDown":o==="move"?"touchMove":o==="up"?"touchUp":o==="cancel"?"touchCancel":null;a||(console.error(k("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1)),o!=="cancel"&&(!Number.isFinite(t)||!Number.isFinite(s))&&(console.error(k("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1));let d=o==="down"?"tap":o==="move"?"move":null,p=d&&Number.isFinite(t)&&Number.isFinite(s)?`window.dispatchEvent(new CustomEvent('sootsim:agentAction', { detail: { type: '${d}', x: ${t}, y: ${s} } }));`:"",h=await u.send({type:"evaluate",code:`(async () => {
|
|
457
456
|
${p}
|
|
458
457
|
const interact = window.__sootsimInteract
|
|
459
458
|
if (!interact?.${a}) return { ok: false, reason: 'no interact.${a}' }
|
|
460
459
|
const value = ${o==="cancel"?`await interact.${a}(${Math.max(1,Math.round(r))})`:`await interact.${a}(${t}, ${s}, ${Math.max(1,Math.round(r))})`}
|
|
461
460
|
return { ok: !!value, value }
|
|
462
|
-
})()`});
|
|
461
|
+
})()`});h?.ok&&o!=="cancel"&&await L("inspect touch",{tapAtCoords:{x:t,y:s}},`touch ${o} @${t},${s}`),console.log(JSON.stringify(h,null,2));break}case"gesture":{let o=["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],s=i[2]?Number(i[2]):220;(!t||!Number.isFinite(s))&&(console.error(k("gesture","<preset> [durationMs]")),console.error(` presets: ${o.join(", ")}`),process.exit(1)),o.includes(t)||(console.error(` unknown gesture preset: ${t}`),console.error(` presets: ${o.join(", ")}`),process.exit(1));let r=await u.send({type:"evaluate",code:`(async () => {
|
|
463
462
|
const spec = globalThis.__sootsimDeviceSpec || {}
|
|
464
463
|
return {
|
|
465
464
|
width: spec.width || window.innerWidth || 393,
|
|
@@ -467,12 +466,12 @@ ${s}
|
|
|
467
466
|
statusBarHeight: spec.statusBarHeight || 0,
|
|
468
467
|
homeIndicatorHeight: spec.homeIndicatorHeight || 0,
|
|
469
468
|
}
|
|
470
|
-
})()`}),a=Number(r?.width)||393,d=Number(r?.height)||852,p=Number(r?.statusBarHeight)||0,
|
|
469
|
+
})()`}),a=Number(r?.width)||393,d=Number(r?.height)||852,p=Number(r?.statusBarHeight)||0,h=Number(r?.homeIndicatorHeight)||0,f=Math.round(a/2),w=Math.round(d/2),O=Math.max(24,p+18),q=Math.max(24,h+18),H=18,K=Math.min(220,Math.round(d*.24)),F=Math.min(180,Math.round(a*.32)),x=f,$=w,v=f,se=w;switch(t){case"scroll-up":$=w+Math.round(K/2),se=w-Math.round(K/2);break;case"scroll-down":$=w-Math.round(K/2),se=w+Math.round(K/2);break;case"scroll-left":x=f+Math.round(F/2),v=f-Math.round(F/2);break;case"scroll-right":x=f-Math.round(F/2),v=f+Math.round(F/2);break;case"swipe-from-left-edge":x=H,$=w,v=Math.min(a-H,H+F);break;case"swipe-from-right-edge":x=a-H,$=w,v=Math.max(H,a-H-F);break;case"swipe-from-top-edge":x=f,$=O,se=Math.min(d-q,O+K);break;case"swipe-from-bottom-edge":x=f,$=d-q,se=Math.max(O,d-q-K);break}let U=Math.max(8,Math.round(s/16)),R=Math.max(1,Math.round(s/U)),we=await u.send({type:"evaluate",code:`(async () => {
|
|
471
470
|
const interact = window.__sootsimInteract
|
|
472
471
|
if (!interact?.drag) return { ok: false, reason: 'no interact.drag' }
|
|
473
472
|
const value = await interact.drag(${x}, ${$}, ${v}, ${se}, ${U}, ${R})
|
|
474
473
|
return { ok: !!value, value }
|
|
475
|
-
})()`});we?.ok&&await L("inspect gesture",{swipe:{start:`${x}, ${$}`,end:`${v}, ${se}`,duration:Math.max(1,Math.round(s))}},`gesture ${t}`),console.log(JSON.stringify({preset:t,from:{x,y:$},to:{x:v,y:se},result:we},null,2));break}case"scroll":{let o=
|
|
474
|
+
})()`});we?.ok&&await L("inspect gesture",{swipe:{start:`${x}, ${$}`,end:`${v}, ${se}`,duration:Math.max(1,Math.round(s))}},`gesture ${t}`),console.log(JSON.stringify({preset:t,from:{x,y:$},to:{x:v,y:se},result:we},null,2));break}case"scroll":{let o=be(e),t=Xo(e),s=o?.mode==="testid"?o.value:t==null?i[1]:null,r=o||t!=null?1:2,a=Number(i[r]),d=Number(i[r+1]);(!s&&t==null||!Number.isFinite(a)||!Number.isFinite(d))&&(console.error(k("scroll","<id> <x> <y> | --testid <id> <x> <y> | --node-id <nodeId> <x> <y>")),process.exit(1));let p=await u.send({type:"evaluate",code:`(async () => {
|
|
476
475
|
const t = window.__sootsimTest
|
|
477
476
|
if (!t) return null
|
|
478
477
|
const n = ${t!=null?`await t.inspectByNodeId(${JSON.stringify(t)})`:`await t.findByTestId(${JSON.stringify(s)})
|
|
@@ -482,8 +481,8 @@ ${s}
|
|
|
482
481
|
cx: n.absolutePosition.x + (n.layout.width || 0) / 2,
|
|
483
482
|
cy: n.absolutePosition.y + (n.layout.height || 0) / 2,
|
|
484
483
|
}
|
|
485
|
-
})()`}),
|
|
486
|
-
${
|
|
484
|
+
})()`}),h=await G(u,"scrollTo",t!=null?{nodeId:t}:s,a,d,!1);if(h?.ok){let f=t!=null?`node ${t}`:`#${s}`;await L("inspect scroll",{scrollTo:{...t!=null?{nodeId:t}:{id:s},x:a,y:d}},`scroll ${f} -> ${a},${d}`)}console.log(JSON.stringify({...h,...p?{at:{x:p.cx,y:p.cy}}:{}},null,2));break}case"state":{let o=i[1];if(n==="get"&&!o){let s=await G(u,"getRuntimeState"),r=await u.send({type:"evaluate",code:Se});if(s&&typeof s=="object"&&s.diagnostics&&(s.diagnostics.errors=r?.errors??0,s.diagnostics.warnings=r?.warnings??0),s&&typeof s=="object"&&s.shell==null)try{let a=await ce(u);a&&(s.shell=a)}catch{}console.log(JSON.stringify(s,null,2));break}if(!o||o==="--help"||o==="-h"){console.log(`
|
|
485
|
+
${b("state")} \u2014 dump raw runtime state
|
|
487
486
|
|
|
488
487
|
subcommands:
|
|
489
488
|
shell dump shell transition/layout state
|
|
@@ -497,14 +496,14 @@ ${s}
|
|
|
497
496
|
gesture <x> <y> dump gesture routing/debug info at coordinates
|
|
498
497
|
|
|
499
498
|
examples:
|
|
500
|
-
${
|
|
501
|
-
${
|
|
502
|
-
${
|
|
503
|
-
${
|
|
504
|
-
${
|
|
505
|
-
${
|
|
506
|
-
${
|
|
507
|
-
${
|
|
499
|
+
${b("state")} shell
|
|
500
|
+
${b("state")} worker
|
|
501
|
+
${b("state")} keyboard
|
|
502
|
+
${b("state")} ownership
|
|
503
|
+
${b("state")} node photos
|
|
504
|
+
${b("state")} scroll feed
|
|
505
|
+
${b("state")} scroll-hit 360 420
|
|
506
|
+
${b("state")} hit 200 720
|
|
508
507
|
`);break}let t;switch(o){case"shell":t=await ce(u,500);break;case"worker":t=await Oe(u,"__sootsimRenderHost.queryStats");break;case"ownership":t=await u.send({type:"evaluate",code:`(() => {
|
|
509
508
|
const h = window.__sootsimRenderHost
|
|
510
509
|
if (!h || typeof h.getOwnershipSnapshot !== 'function') {
|
|
@@ -539,8 +538,8 @@ ${s}
|
|
|
539
538
|
text: secureTextEntry ? ${JSON.stringify(X)} : (focused.text || null),
|
|
540
539
|
} : null,
|
|
541
540
|
}
|
|
542
|
-
})()`}),t=Je(t);break;case"node":{let s=i[2];s||(console.error(` usage: ${
|
|
543
|
-
${
|
|
541
|
+
})()`}),t=Je(t);break;case"node":{let s=i[2];s||(console.error(` usage: ${b("state")} node <id>`),process.exit(1)),t=await G(u,"findByTestId",s)||await G(u,"findById",s);break}case"scroll":{let s=i[2];s||(console.error(` usage: ${b("state")} scroll <id>`),process.exit(1)),t=await G(u,"getScrollState",s);break}case"scroll-hit":{let s=Number(i[2]),r=Number(i[3]);(!Number.isFinite(s)||!Number.isFinite(r))&&(console.error(` usage: ${b("state")} scroll-hit <x> <y>`),process.exit(1)),t=await G(u,"getScrollStateAt",s,r);break}case"hit":{let s=Number(i[2]),r=Number(i[3]);(!Number.isFinite(s)||!Number.isFinite(r))&&(console.error(` usage: ${b("state")} hit <x> <y>`),process.exit(1)),t=await G(u,"debugHitAt",s,r);break}case"gesture":{let s=Number(i[2]),r=Number(i[3]);(!Number.isFinite(s)||!Number.isFinite(r))&&(console.error(` usage: ${b("state")} gesture <x> <y>`),process.exit(1)),t=await G(u,"debugGestureAt",s,r);break}default:console.error(` unknown state subcommand: ${o}`),process.exit(1)}console.log(JSON.stringify(t,null,2));break}case"shell":{let o=i[1];if(!o||o==="--help"||o==="-h"){console.log(`
|
|
542
|
+
${b("shell")} \u2014 run built-in shell commands
|
|
544
543
|
|
|
545
544
|
subcommands:
|
|
546
545
|
launch <appId> [waitMs] [--clear-state]
|
|
@@ -555,15 +554,15 @@ ${s}
|
|
|
555
554
|
shake trigger the simulator shake gesture
|
|
556
555
|
|
|
557
556
|
examples:
|
|
558
|
-
${
|
|
559
|
-
${
|
|
560
|
-
${
|
|
561
|
-
${
|
|
562
|
-
${
|
|
563
|
-
${
|
|
564
|
-
${
|
|
565
|
-
${
|
|
566
|
-
`);break}let t=o==="launch"||o==="open-card"||o==="home"||o==="switcher",s=o==="launch"||o==="open-card"?i[3]:i[2],r=s?Number(s):350;t&&(!Number.isFinite(r)||r<0)&&(console.error(k("shell",o==="launch"||o==="open-card"?"<launch|open-card> <appId> [settleMs]":"<home|switcher> [settleMs]")),process.exit(1));let a=!1,d=!1,p=null,
|
|
557
|
+
${b("shell")} launch photos
|
|
558
|
+
${b("shell")} launch rn --clear-state
|
|
559
|
+
${b("shell")} launch photos 1500
|
|
560
|
+
${b("shell")} home 500
|
|
561
|
+
${b("shell")} switcher 800
|
|
562
|
+
${b("shell")} open-card clock 800
|
|
563
|
+
${b("shell")} appearance dark
|
|
564
|
+
${b("shell")} lock
|
|
565
|
+
`);break}let t=o==="launch"||o==="open-card"||o==="home"||o==="switcher",s=o==="launch"||o==="open-card"?i[3]:i[2],r=s?Number(s):350;t&&(!Number.isFinite(r)||r<0)&&(console.error(k("shell",o==="launch"||o==="open-card"?"<launch|open-card> <appId> [settleMs]":"<home|switcher> [settleMs]")),process.exit(1));let a=!1,d=!1,p=null,h=e.includes("--clear-state");if(o==="launch"){let f=i[2];f||(console.error(k("shell","launch <appId> [settleMs] [--clear-state]")),process.exit(1)),h&&await u.send({type:"evaluate",code:Qe(!0)}),a=!!await fe(u,"launchApp",r,f),{settled:d,state:p}=await Ie(u,Math.round(r),w=>!!w&&w.state==="app"&&w.activeApp===f&&w.showSwitcher===!1&&w.switcherPhase==="idle"&&typeof w.launchProgress=="number"&&w.launchProgress>=.98),a&&await L("inspect shell launch",h?{launchApp:{clearState:!0}}:{launchApp:{}},h?"launch app (clear state)":"launch app")}else if(o==="home")a=!!await fe(u,"goHome",r),{settled:d,state:p}=await Ie(u,Math.round(r),f=>!!f&&f.state==="home"&&f.activeApp==null&&f.showSwitcher===!1&&f.switcherPhase==="idle"&&typeof f.launchProgress=="number"&&f.launchProgress>=.98);else if(o==="switcher")a=!!await fe(u,"openSwitcher",r),{settled:d,state:p}=await Ie(u,Math.round(r),f=>!!f&&f.state==="app"&&f.showSwitcher===!0&&f.switcherPhase==="idle"&&typeof f.zoomLevel=="number"&&Math.abs(f.zoomLevel)<=.02&&typeof f.horizontalZoom=="number"&&Math.abs(f.horizontalZoom)<=.02),d&&(await ee(Ko),p=await ce(u));else if(o==="open-card"){let f=i[2];f||(console.error(k("shell","open-card <appId> [settleMs]")),process.exit(1)),a=!!await fe(u,"openSwitcherCard",r,f),{settled:d,state:p}=await Ie(u,Math.round(r),w=>!!w&&w.state==="app"&&w.activeApp===f&&w.showSwitcher===!1&&w.switcherPhase==="idle"&&typeof w.zoomLevel=="number"&&w.zoomLevel>=.98&&typeof w.horizontalZoom=="number"&&w.horizontalZoom>=.98),a&&await L("inspect shell open-card",{openSwitcherCard:{appId:f}},`open switcher card ${f}`)}else if(o==="appearance"){let f=i[2];(!f||!["light","dark","auto","toggle"].includes(f))&&(console.error(k("shell","appearance <light|dark|auto|toggle>")),process.exit(1));let w=await so(u,"appearance",f);if(a=!!w?.ok,p={appearance:w},a){let O=w?.applied??f;console.log(` appearance: ${O}`)}}else if(o==="lock"||o==="shake"){let f=await so(u,o);a=!!f?.ok,p={[o]:f}}else console.error(` unknown shell subcommand: ${o}`),process.exit(1);console.log(JSON.stringify({ok:a,settled:d,state:p},null,2));break}case"url":{await Kt(u,{args:c});break}case"reload":{let s=!1,r=!1;try{await u.send({type:"evaluate",code:"window.__sootsimConsole?.clear()"});let p=await u.send({type:"evaluate",code:`;(() => {
|
|
567
566
|
const reloadExternalApp = window.SootSim?.bridges?.hotRemount?.reloadExternalApp
|
|
568
567
|
if (typeof reloadExternalApp === 'function') {
|
|
569
568
|
reloadExternalApp()
|
|
@@ -573,8 +572,8 @@ ${s}
|
|
|
573
572
|
return { kind: 'page' }
|
|
574
573
|
})()`});r=!!p&&p.kind==="external-app",s=!0}catch{}console.log(" reloading...");let a=u,d=null;if(r)d=await De(u,{timeoutMs:1e4,errorGraceMs:3e3});else{s&&await ee(300);let p=await $t(_,j,I,{timeoutMs:1e4,simIdSource:E});p?(a=p,d=await De(p,{timeoutMs:1e4,errorGraceMs:3e3})):(console.log(" \u26A0 reload: bridge never reconnected within 10000ms"),a=null)}if(d)if(d.ready){let p=d.source==="nodes-fallback"?" (no ready signal, node-count fallback)":"";console.log(` ready in ${d.elapsedMs}ms: ${d.nodes} nodes${p}`)}else if(d.source==="error-bail")console.log(` \u26A0 reload bailed after ${d.elapsedMs}ms: ${d.errors} console error(s), ready signal never fired`);else{let p=Jo(d);console.log(` \u26A0 reload timed out after ${d.elapsedMs}ms \u2014 ${p} (nodes: ${d.nodes}, targets: ${d.targets}, errors: ${d.errors})`)}if(a)try{let p=await $e(a,10);if(a!==u&&a.close(),Array.isArray(p)&&p.length>0){console.log(`
|
|
575
574
|
\u26A0 ${p.length} error(s) during mount:
|
|
576
|
-
`);for(let
|
|
577
|
-
`).slice(0,2);for(let O of w)console.log(` ${O.trim()}`)}}}}catch{}d&&!d.ready&&(process.exitCode=1);break}case"eval":case"js":{let o=i.slice(1).join(" ");o||(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(` ${
|
|
575
|
+
`);for(let h of p){let f=h.args.map(w=>typeof w=="object"?JSON.stringify(w):w).join(" ");if(console.log(` ${f}`),h.stack){let w=h.stack.split(`
|
|
576
|
+
`).slice(0,2);for(let O of w)console.log(` ${O.trim()}`)}}}}catch{}d&&!d.ready&&(process.exitCode=1);break}case"eval":case"js":{let o=i.slice(1).join(" ");o||(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=o;t.startsWith("(async")||(t=`(async () => ${t})()`);let s=await u.send({type:"evaluate",code:t});console.log(JSON.stringify(s,null,2));let r=o.toLowerCase(),a=[];(r.includes("sootsim:gohome")||r.includes("gohome"))&&a.push("sootsim shell home"),(r.includes("sootsim:appswitcher")||r.includes("appswitcher"))&&a.push("sootsim shell switcher"),(r.includes("keyboard.isvisible")||r.includes("keyboard.getmode"))&&a.push("sootsim debug state keyboard"),r.includes("interact.tap")&&a.push("sootsim do tap <x> <y>"),r.includes("keyboard.type")&&a.push("sootsim do type <text>"),(r.includes("keyboard.press")||r.includes("keyboard.dispatchkey"))&&a.push("sootsim do key <name>"),r.includes("keyboard.dismiss")&&a.push("sootsim do dismiss"),r.includes("dumptree")&&a.push("sootsim get tree"),r.includes("dumpaccessibilitytree")&&a.push("sootsim get a11y"),r.includes("getnodecount")&&a.push("sootsim get count"),r.includes("findbytext")&&a.push("sootsim find <text>"),(r.includes("findbytestid")||r.includes("findbyid"))&&a.push("sootsim find --testid <id>"),r.includes("document.hidden")&&a.push("sootsim debug state keyboard (includes tab health)"),a.length>0&&Y("prefer-cli-over-eval",a);break}case"globals":{let o=await u.send({type:"evaluate",code:`(async () => {
|
|
578
577
|
const globals = {}
|
|
579
578
|
|
|
580
579
|
// test bridge (proxy in worker mode)
|
|
@@ -612,8 +611,8 @@ ${s}
|
|
|
612
611
|
|
|
613
612
|
return globals
|
|
614
613
|
})()`});console.log(` sootsim JS API:
|
|
615
|
-
`);for(let[t,s]of Object.entries(o)){console.log(` ${t}:`);for(let r of s)console.log(` .${r}`);console.log("")}console.log(` use: ${
|
|
616
|
-
${
|
|
614
|
+
`);for(let[t,s]of Object.entries(o)){console.log(` ${t}:`);for(let r of s)console.log(` .${r}`);console.log("")}console.log(` use: ${b("js")} <expression>`),console.log(` example: ${b("js")} test.findByText("Sign in")`);break}case"describe":{await Rt({bridge:u,args:e,positional:i});break}case"perf":{let o=i[1];if(!o||o==="--help"||o==="-h"){console.log(`
|
|
615
|
+
${b("perf")} \u2014 performance profiling
|
|
617
616
|
|
|
618
617
|
subcommands:
|
|
619
618
|
stats one-shot stats (zero overhead query)
|
|
@@ -627,12 +626,12 @@ ${s}
|
|
|
627
626
|
--json for a machine-readable payload on stdout.
|
|
628
627
|
|
|
629
628
|
examples:
|
|
630
|
-
${
|
|
631
|
-
${
|
|
629
|
+
${b("perf")} stats
|
|
630
|
+
${b("perf")} start
|
|
632
631
|
# ... interact with the app ...
|
|
633
|
-
${
|
|
634
|
-
${
|
|
635
|
-
${
|
|
632
|
+
${b("perf")} stop
|
|
633
|
+
${b("perf")} stop --json
|
|
634
|
+
${b("perf")} transition goHome
|
|
636
635
|
`);break}switch(o){case"stats":{let t=await u.send({type:"evaluate",code:`(async () => {
|
|
637
636
|
// worker mode (host exposes these)
|
|
638
637
|
if (window.__sootsimPerfStats) {
|
|
@@ -686,7 +685,7 @@ ${s}
|
|
|
686
685
|
startedAt: performance.now(),
|
|
687
686
|
}
|
|
688
687
|
return { started: true }
|
|
689
|
-
})()`}),console.log(` profiling started \u2014 interact with the app, then run '${
|
|
688
|
+
})()`}),console.log(` profiling started \u2014 interact with the app, then run '${b("perf")} stop'`);break}case"stop":{let t=await u.send({type:"evaluate",code:`(async () => {
|
|
690
689
|
// worker mode
|
|
691
690
|
if (window.__sootsimRenderHost) {
|
|
692
691
|
const session = window.${ne} || {}
|
|
@@ -816,7 +815,7 @@ ${s}
|
|
|
816
815
|
mode: 'main-thread',
|
|
817
816
|
frames: (stats.recentFrames || []).slice(-${t}),
|
|
818
817
|
}
|
|
819
|
-
})()`});if(s.error&&(console.error(` error: ${s.error}`),process.exit(1)),A(c)){P(s);break}if(s.mode==="render-worker"){let a=Array.isArray(s.samples)?s.samples:[];if(a.length===0){console.log(` no frame data \u2014 run '${
|
|
818
|
+
})()`});if(s.error&&(console.error(` error: ${s.error}`),process.exit(1)),A(c)){P(s);break}if(s.mode==="render-worker"){let a=Array.isArray(s.samples)?s.samples:[];if(a.length===0){console.log(` no frame data \u2014 run '${b("perf")} start' first`);break}console.log(` last ${a.length} sampled frames (ms):`),console.log(" total layout render copy aux other t+");for(let[d,p,h,f,w,O,q]of a)console.log(` ${p.toFixed(2).padStart(7)} ${h.toFixed(2).padStart(7)} ${f.toFixed(2).padStart(7)} ${w.toFixed(2).padStart(7)} ${O.toFixed(2).padStart(6)} ${q.toFixed(2).padStart(7)} ${String(d).padStart(5)}`);console.log(""),We(a.map(d=>d[1])),s.live&&console.log(" sampling continues");break}let r=Array.isArray(s.frames)?s.frames:Array.isArray(s)?s:[];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(a=>a.toFixed(2)).join(", ")}`),We(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 s=await u.send({type:"evaluate",code:`(async () => {
|
|
820
819
|
if (window.__sootsimRenderHost) {
|
|
821
820
|
const session = window.${ne} || {}
|
|
822
821
|
if (session.active) {
|
|
@@ -858,8 +857,8 @@ ${s}
|
|
|
858
857
|
mode: 'main-thread',
|
|
859
858
|
frames: recent.slice().sort((a, b) => b - a).slice(0, ${t}),
|
|
860
859
|
}
|
|
861
|
-
})()`});if(s.error&&(console.error(` error: ${s.error}`),process.exit(1)),A(c)){P(s);break}if(s.mode==="render-worker"){let a=Array.isArray(s.samples)?s.samples:[];if(a.length===0){console.log(` no frame data \u2014 run '${
|
|
862
|
-
${
|
|
860
|
+
})()`});if(s.error&&(console.error(` error: ${s.error}`),process.exit(1)),A(c)){P(s);break}if(s.mode==="render-worker"){let a=Array.isArray(s.samples)?s.samples:[];if(a.length===0){console.log(` no frame data \u2014 run '${b("perf")} start' first`);break}console.log(` worst ${a.length} sampled frames (ms):`),console.log(" total layout render copy aux other t+");for(let[d,p,h,f,w,O,q]of a)console.log(` ${p.toFixed(2).padStart(7)} ${h.toFixed(2).padStart(7)} ${f.toFixed(2).padStart(7)} ${w.toFixed(2).padStart(7)} ${O.toFixed(2).padStart(6)} ${q.toFixed(2).padStart(7)} ${String(d).padStart(5)}`);s.live&&(console.log(""),console.log(" sampling continues"));break}let r=Array.isArray(s.frames)?s.frames:Array.isArray(s)?s:[];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(a=>a.toFixed(2)).join(", ")}`);break}case"transition":{let t=i[2];if(!t||!["goHome","appSwitcher","lockScreen"].includes(t)){console.log(`
|
|
861
|
+
${b("perf")} transition <event> \u2014 profile a shell transition
|
|
863
862
|
|
|
864
863
|
events:
|
|
865
864
|
goHome swipe-to-home animation
|
|
@@ -869,8 +868,8 @@ ${s}
|
|
|
869
868
|
note: uses 600ms capture window \u2014 may need --timeout 10000 flag
|
|
870
869
|
|
|
871
870
|
examples:
|
|
872
|
-
${
|
|
873
|
-
${
|
|
871
|
+
${b("perf")} transition goHome --timeout 10000
|
|
872
|
+
${b("perf")} transition appSwitcher
|
|
874
873
|
`);break}let r=`sootsim:${t}`;Re(` profiling ${t} transition...`),Re(" (use --timeout 10000 if this times out)");let a=await u.send({type:"evaluate",code:`(async () => {
|
|
875
874
|
// only supported in render-worker mode
|
|
876
875
|
if (!window.__sootsimRenderHost) {
|
|
@@ -948,25 +947,25 @@ ${s}
|
|
|
948
947
|
p50: ${a.p50.toFixed(2)}ms
|
|
949
948
|
p95: ${a.p95.toFixed(2)}ms
|
|
950
949
|
p99: ${a.p99.toFixed(2)}ms
|
|
951
|
-
jank: ${a.jankFrames} frames (${p}%) >16.67ms`),Array.isArray(a.samples)&&a.samples.length>0&&(console.log(""),We(a.samples.map(
|
|
950
|
+
jank: ${a.jankFrames} frames (${p}%) >16.67ms`),Array.isArray(a.samples)&&a.samples.length>0&&(console.log(""),We(a.samples.map(h=>h[1])));break}default:console.error(` unknown perf subcommand: ${o}`),console.error(" valid: stats, start, stop, frames, worst, transition"),/^--?reset$/.test(o)&&console.error(" note: 'perf start' already clears prior frames \u2014 no reset needed"),process.exit(1)}break}case"errors":{let o=i[1];if(o==="clear"){await dt(u),A(c)?P({cleared:!0}):console.log(" error buffer cleared");break}let t=o?Number(o):20,s=await $e(u,t);if(A(c)){P(s);break}if(s.length===0){console.log(" no errors captured");break}console.log(` ${s.length} error(s):
|
|
952
951
|
`);for(let r of s){let a=ie(r.timestamp),d=r.args.map(p=>typeof p=="object"?JSON.stringify(p):p).join(" ");if(console.log(` [${a}] ${d}`),r.stack){let p=r.stack.split(`
|
|
953
|
-
`).slice(0,3);for(let
|
|
952
|
+
`).slice(0,3);for(let h of p)console.log(` ${h.trim()}`)}}break}case"warnings":{let o=i[1]?Number(i[1]):20,t=await ut(u,o);if(A(c)){P(t);break}if(t.length===0){console.log(" no warnings captured");break}console.log(` ${t.length} warning(s):
|
|
954
953
|
`);for(let s of t){let r=ie(s.timestamp),a=s.args.map(d=>typeof d=="object"?JSON.stringify(d):d).join(" ");console.log(` [${r}] ${a}`)}break}case"animations":{let o=await G(u,"listAnimations")??[];if(e.includes("--json")){console.log(JSON.stringify(o,null,2));break}if(o.length===0){console.log(" no active animations");break}console.log(` ${o.length} active animation(s):
|
|
955
|
-
`);for(let t of o){let s=String(t.kind).padEnd(6),r=`${Number(t.from).toFixed(2)}\u2192${Number(t.to).toFixed(2)}`,a=Number(t.current??0).toFixed(2),d=`${Math.round((t.progress??0)*100)}%`,p=`${Math.round(t.elapsedMs??0)}ms`,
|
|
956
|
-
`);for(let d of a){let p=ie(d.timestamp);console.log(` [${p}] ${oe(d)}`),d.responseBody?console.log(` ${d.responseBody}`):d.error&&console.log(` ${d.error}`)}break}case"network":{let o=i[1],t=null,s=null,r=!1,a=!1,d=1e3,p=!1,
|
|
954
|
+
`);for(let t of o){let s=String(t.kind).padEnd(6),r=`${Number(t.from).toFixed(2)}\u2192${Number(t.to).toFixed(2)}`,a=Number(t.current??0).toFixed(2),d=`${Math.round((t.progress??0)*100)}%`,p=`${Math.round(t.elapsedMs??0)}ms`,h=t.loop?" loop":"",f=t.layoutBound?" layout":"";console.log(` #${t.id} ${s} ${r.padEnd(14)} cur=${a.padEnd(7)} ${d.padStart(4)} ${p}${h}${f}`)}break}case"animation":{let o=i[1];(!o||o==="--help"||o==="-h")&&(console.error(` usage: ${b("animation")} <id>`),process.exit(1));let t=Number(o);Number.isFinite(t)||(console.error(` invalid id: ${o}`),process.exit(1));let s=await G(u,"getAnimation",t);console.log(JSON.stringify(s,null,2));break}case"stop-animation":{let o=i[1];(!o||o==="--help"||o==="-h")&&(console.error(` usage: ${b("stop-animation")} <id|all>`),process.exit(1));let t=o==="all"?"all":Number(o);t!=="all"&&!Number.isFinite(t)&&(console.error(` invalid id: ${o}`),process.exit(1));let s=await G(u,"stopAnimation",t);console.log(` stopped ${s??0} animation(s)`);break}case"requests":{let o=i[1];if(o==="clear"){await pt(u),A(c)?P({cleared:!0}):console.log(" request buffer cleared");break}let t=o==="all",s=t?i[2]:o,r=s?Number(s):20,a=await mt(u,{failed:!t,limit:r});if(A(c)){P(a);break}if(a.length===0){console.log(t?" no requests captured":" no failed requests captured");break}console.log(` ${a.length} ${t?"request(s)":"failed request(s)"}:
|
|
955
|
+
`);for(let d of a){let p=ie(d.timestamp);console.log(` [${p}] ${oe(d)}`),d.responseBody?console.log(` ${d.responseBody}`):d.error&&console.log(` ${d.error}`)}break}case"network":{let o=i[1],t=null,s=null,r=!1,a=!1,d=1e3,p=!1,h=!1;for(let F=0;F<c.length;F++){let x=c[F];if(x==="--filter")t=c[F+1]??null,F++;else if(x==="--limit"){let $=Number(c[F+1]);Number.isFinite($)&&(s=$),F++}else if(x==="--threshold"){let $=Number(c[F+1]);Number.isFinite($)&&$>0&&(d=$),F++}else x==="--failed"?r=!0:x==="--slow"?a=!0:x==="--tail"||x==="-f"?p=!0:x==="--json"&&(h=!0)}if(o==="clear"){await u.send({type:"evaluate",code:'window.__sootsimObservability?.network.clear(); "cleared"'}),console.log(" network buffer cleared");break}if(o==="get"){let F=i[2];F||(console.error(" usage: sootsim network get <id>"),process.exit(1));let x=await u.send({type:"evaluate",code:`(() => {
|
|
957
956
|
const obs = window.__sootsimObservability;
|
|
958
957
|
if (!obs) return null;
|
|
959
958
|
return obs.network.getSnapshot().find(e => e.id === ${JSON.stringify(F)}) || null;
|
|
960
|
-
})()`});x||(console.error(` no entry with id ${F}`),process.exit(1)),
|
|
959
|
+
})()`});x||(console.error(` no entry with id ${F}`),process.exit(1)),h?console.log(JSON.stringify(x,null,2)):Wo(x);break}let f=s??(p?200:o?Number(o):20);Number.isFinite(f)||(console.error(` invalid limit: ${o} \u2014 \`network\` takes a numeric count (e.g. ${b("network")} 100).
|
|
961
960
|
to target a specific sim, use \`--sim ${o}\` instead.`),process.exit(1));let w=async()=>{let F=await u.send({type:"evaluate",code:`(() => {
|
|
962
961
|
const obs = window.__sootsimObservability;
|
|
963
962
|
if (!obs) return { ok: false };
|
|
964
963
|
return { ok: true, entries: obs.network.getSnapshot() };
|
|
965
|
-
})()`});if(!F||!F.ok)throw new Error("observability bridge not installed \u2014 is the engine running?");return F.entries??[]},O=F=>{let x=F;if(r&&(x=x.filter($=>!!$.error||$.status!=null&&$.status>=400)),a&&(x=x.filter($=>$.durationMs!=null&&$.durationMs>=d)),t){let $=t.toLowerCase();x=x.filter(v=>(v.displayUrl||v.url).toLowerCase().includes($))}return a&&!p&&(x=[...x].sort(($,v)=>(v.durationMs??0)-($.durationMs??0))),x};if(!p){let F=await w(),x=O(F).slice(-f);if(
|
|
964
|
+
})()`});if(!F||!F.ok)throw new Error("observability bridge not installed \u2014 is the engine running?");return F.entries??[]},O=F=>{let x=F;if(r&&(x=x.filter($=>!!$.error||$.status!=null&&$.status>=400)),a&&(x=x.filter($=>$.durationMs!=null&&$.durationMs>=d)),t){let $=t.toLowerCase();x=x.filter(v=>(v.displayUrl||v.url).toLowerCase().includes($))}return a&&!p&&(x=[...x].sort(($,v)=>(v.durationMs??0)-($.durationMs??0))),x};if(!p){let F=await w(),x=O(F).slice(-f);if(h){console.log(JSON.stringify(x,null,2));break}if(x.length===0){F.length===0?console.log(" no network requests captured"):console.log(a?` no requests slower than ${d}ms (${F.length} total \u2014 try --threshold <ms>)`:" no matching requests");break}console.log(a?` ${x.length} request(s) slower than ${d}ms (sorted by duration desc):
|
|
966
965
|
`:` ${x.length} request(s):
|
|
967
966
|
`);for(let $ of x)Zt($);break}console.log(` tailing network (ctrl-c to stop)...
|
|
968
|
-
`);let q=new Set,H=!0,K=()=>{H=!1};process.on("SIGINT",K);try{for(;H;){let F=await w(),x=O(F);for(let $ of x)$.durationMs!=null&&(q.has($.id)||(q.add($.id),
|
|
969
|
-
to target a specific sim, use \`--sim ${o}\` instead.`),process.exit(1));let O=()=>ft(u),q=x=>yt(x,{level:
|
|
967
|
+
`);let q=new Set,H=!0,K=()=>{H=!1};process.on("SIGINT",K);try{for(;H;){let F=await w(),x=O(F);for(let $ of x)$.durationMs!=null&&(q.has($.id)||(q.add($.id),h?console.log(JSON.stringify($)):Zt($)));await ee(250)}}finally{process.off("SIGINT",K)}break}case"logs":{let o=i[1],t=null,s=null,r=null,a=!1,d=!1,p=!1;for(let x=0;x<c.length;x++){let $=c[x];if($==="--filter")t=c[x+1]??null,x++;else if($==="--limit"){let v=Number(c[x+1]);Number.isFinite(v)&&(s=v),x++}else $==="--level"?(r=c[x+1]??null,x++):$==="--tail"||$==="-f"?a=!0:$==="--json"?d=!0:($==="--internal"||$==="--all")&&(p=!0)}let h=r?new Set(r.split(",").map(x=>x.trim()).filter(x=>x==="log"||x==="info"||x==="warn"||x==="error"||x==="debug")):null;if(o==="clear"){await gt(u),console.log(" log buffer cleared");break}let f=!d&&process.stdout.isTTY===!0,w=s??(a?500:o?Number(o):50);Number.isFinite(w)||(console.error(` invalid limit: ${o} \u2014 \`logs\` takes a numeric count (e.g. ${b("logs")} 100).
|
|
968
|
+
to target a specific sim, use \`--sim ${o}\` instead.`),process.exit(1));let O=()=>ft(u),q=x=>yt(x,{level:h,filter:t,showInternal:p});if(!a){let x=await O(),$=q(x).slice(-w);if(d){console.log(JSON.stringify($,null,2));break}if($.length===0){console.log(x.length===0?" no logs captured":" no matching logs");break}console.log(` ${$.length} log(s):
|
|
970
969
|
`);for(let v of $)to(v,f);break}console.log(` tailing logs (ctrl-c to stop)...
|
|
971
970
|
`);let H=new Set,K=!0,F=()=>{K=!1};process.on("SIGINT",F);try{for(;K;){let x=await O(),$=q(x);for(let v of $)H.has(v.id)||(H.add(v.id),d?console.log(JSON.stringify(v)):to(v,f));await ee(250)}}finally{process.off("SIGINT",F)}break}default:console.error(` unknown subcommand: ${g}`),process.exit(1)}if(pe.has(g)&&!e.includes("--no-wait")&&process.env.SOOTSIM_NO_AUTO_WAIT!=="1"&&!await Ze(u,g)&&await S(u),!B.has(g)&&!A(c))try{await re(u)}catch{}}catch(o){let t=o instanceof Error?o.message:String(o);console.error(` ${g??"inspect"} failed: ${t}`);let s=/^no sim connected with id (.+)$/.exec(t),r=/^command timed out after (\d+)s$/.exec(t),a=t.startsWith("sim disconnected:")||t.startsWith("bridge never reconnected")||t.startsWith("could not connect to ws://");if(s)await Mt(u,_,s[1]);else if(/^no sim connected$/.test(t))Tt(_);else if(r)if(await Do(u)){let p=g??"describe";process.stderr.write(` the sim is still responsive \u2014 '${p}' just exceeded the ${r[1]}s command budget.
|
|
972
971
|
the screen's node tree is large; narrow the query or raise the budget:
|