rnxsim 0.1.314 → 0.1.316
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/cli/commands/control.ts +20 -3
- package/cli/commands/flow.ts +23 -11
- package/cli/commands/inspect.ts +51 -3
- package/dist-cli/bin.js +5 -5
- package/dist-cli/chunks/{agent-7YBDCYMA.js → agent-ILQPZETA.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-2GHFBHCR.js → agent-wrapper-FBWOEHCY.js} +2 -2
- package/dist-cli/chunks/{app-fonts-RSNVPQSU.js → app-fonts-6UBVGCEO.js} +2 -2
- package/dist-cli/chunks/{assert-XCMX3XJX.js → assert-KYLN3EAI.js} +2 -2
- package/dist-cli/chunks/{auth-B442HRAX.js → auth-5AUZXTFY.js} +2 -2
- package/dist-cli/chunks/{beta-XJ55JK3M.js → beta-J63PH5OY.js} +2 -2
- package/dist-cli/chunks/{camera-UGYSSLIK.js → camera-INL3BDHS.js} +2 -2
- package/dist-cli/chunks/{chunk-X6H76EKP.js → chunk-2BJVDP7R.js} +2 -2
- package/dist-cli/chunks/{chunk-JZS3Q37N.js → chunk-3S3NDSH4.js} +2 -2
- package/dist-cli/chunks/{chunk-AMG5E6CC.js → chunk-4CYHLDEM.js} +1 -1
- package/dist-cli/chunks/{chunk-J62KM5TB.js → chunk-4EZXTMIO.js} +2 -2
- package/dist-cli/chunks/{chunk-TAX4UT2N.js → chunk-5W4XMFMD.js} +1 -1
- package/dist-cli/chunks/{chunk-7ZC35MOU.js → chunk-6I4A7AIN.js} +1 -1
- package/dist-cli/chunks/{chunk-7OOPFSQS.js → chunk-6KBBHTEX.js} +2 -2
- package/dist-cli/chunks/{chunk-MCWPL644.js → chunk-ABWLCBHL.js} +2 -2
- package/dist-cli/chunks/{chunk-RZKU2K3J.js → chunk-AK3GDHDT.js} +2 -2
- package/dist-cli/chunks/{chunk-277AEQZX.js → chunk-AKHNXYSL.js} +2 -2
- package/dist-cli/chunks/{chunk-ZBSJO4NB.js → chunk-B34FLQCQ.js} +1 -1
- package/dist-cli/chunks/{chunk-IZAHPAN6.js → chunk-BFVPTBI4.js} +1 -1
- package/dist-cli/chunks/{chunk-32WOTSTR.js → chunk-BJW2TLIK.js} +3 -3
- package/dist-cli/chunks/{chunk-5L7ELDQL.js → chunk-BPBFNFGG.js} +2 -2
- package/dist-cli/chunks/{chunk-FXUAC6D5.js → chunk-BZAED6TK.js} +1 -1
- package/dist-cli/chunks/{chunk-EG32ML36.js → chunk-CBTHKMXT.js} +2 -2
- package/dist-cli/chunks/{chunk-WGGRJDRE.js → chunk-CUN5GSJM.js} +1 -1
- package/dist-cli/chunks/{chunk-QGRI2Z4M.js → chunk-D4ECXYED.js} +2 -2
- package/dist-cli/chunks/{chunk-KR4JON7D.js → chunk-D5U7M6CS.js} +1 -1
- package/dist-cli/chunks/{chunk-TUOFAWXT.js → chunk-FBUYTMEM.js} +1 -1
- package/dist-cli/chunks/{chunk-46ZOLOYA.js → chunk-HKD3XX6U.js} +2 -2
- package/dist-cli/chunks/{chunk-RWZY5427.js → chunk-HOGMZTXK.js} +2 -2
- package/dist-cli/chunks/{chunk-XULEACM4.js → chunk-J57S6THQ.js} +2 -2
- package/dist-cli/chunks/{chunk-MJYK3N2I.js → chunk-J6ZW2E5Q.js} +2 -2
- package/dist-cli/chunks/{chunk-VUKKYPZN.js → chunk-K7A3VZKE.js} +2 -2
- package/dist-cli/chunks/{chunk-VC7V76U3.js → chunk-KHDXKC7O.js} +1 -1
- package/dist-cli/chunks/{chunk-KWCYKQIQ.js → chunk-NOYR57HW.js} +1 -1
- package/dist-cli/chunks/{chunk-QLXXE7GE.js → chunk-OAUWIZ7B.js} +1 -1
- package/dist-cli/chunks/{chunk-GQSL4USA.js → chunk-OSDNJBHO.js} +2 -2
- package/dist-cli/chunks/{chunk-UHZLOHGP.js → chunk-P2EIPQFW.js} +1 -1
- package/dist-cli/chunks/{chunk-3S753SNQ.js → chunk-PMBPC32N.js} +2 -2
- package/dist-cli/chunks/{chunk-HAXW27SS.js → chunk-PVL6TOGJ.js} +2 -2
- package/dist-cli/chunks/{chunk-XLZ5FNRT.js → chunk-QXZUTSYV.js} +2 -2
- package/dist-cli/chunks/{chunk-O6TRIZNS.js → chunk-RWDPBV6A.js} +2 -2
- package/dist-cli/chunks/{chunk-JEMCD5E4.js → chunk-SWJXWDAF.js} +1 -1
- package/dist-cli/chunks/{chunk-B57XUKY3.js → chunk-T4BAXNNP.js} +2 -2
- package/dist-cli/chunks/{chunk-PG5RZCTN.js → chunk-U523FCYZ.js} +2 -2
- package/dist-cli/chunks/{chunk-EAC34EQS.js → chunk-UIGPENDJ.js} +1 -1
- package/dist-cli/chunks/{chunk-7SV3RPRW.js → chunk-UJD4QTX3.js} +2 -2
- package/dist-cli/chunks/{chunk-SBV4IK4H.js → chunk-UWWINDYC.js} +1 -1
- package/dist-cli/chunks/{chunk-SGMVFFMK.js → chunk-V3DA77A6.js} +1 -1
- package/dist-cli/chunks/{chunk-YFSDM7AX.js → chunk-VQXFEXNH.js} +2 -2
- package/dist-cli/chunks/{chunk-QOJJJWJE.js → chunk-VSBUWTVL.js} +131 -131
- package/dist-cli/chunks/{chunk-2JNSK774.js → chunk-VV4TEHX7.js} +2 -2
- package/dist-cli/chunks/{chunk-PFQTUKQ4.js → chunk-WGW2A62I.js} +23 -23
- package/dist-cli/chunks/{chunk-D2FNUWAB.js → chunk-WO4W67CV.js} +5 -5
- package/dist-cli/chunks/{chunk-E5T4XSJ3.js → chunk-XADARHFI.js} +2 -2
- package/dist-cli/chunks/{chunk-P7XL2E73.js → chunk-XYZYRG4O.js} +3 -3
- package/dist-cli/chunks/{chunk-APWNH3A4.js → chunk-Y3FEGWJ6.js} +1 -1
- package/dist-cli/chunks/{chunk-C2NL26TD.js → chunk-YGZJWH2Q.js} +1 -1
- package/dist-cli/chunks/{chunk-VQVMLW4U.js → chunk-ZRFG75QL.js} +1 -1
- package/dist-cli/chunks/{chunk-YWI3UEVX.js → chunk-ZTWOF243.js} +2 -2
- package/dist-cli/chunks/{cleanup-EYLGCA6Z.js → cleanup-X6FK675T.js} +2 -2
- package/dist-cli/chunks/cli-version-6B4DYWVM.js +4 -0
- package/dist-cli/chunks/{compat-TLJYHB4E.js → compat-LBTG3Z3H.js} +2 -2
- package/dist-cli/chunks/{config-4JWUOEXK.js → config-QI7SSUP5.js} +2 -2
- package/dist-cli/chunks/{control-HPAOYF4N.js → control-RLBAGXOX.js} +2 -2
- package/dist-cli/chunks/daemon-B6KKISRP.js +4 -0
- package/dist-cli/chunks/{debug-4BKXF6KI.js → debug-6TAEJ7GA.js} +3 -3
- package/dist-cli/chunks/{desktop-ZQ6ZD2S6.js → desktop-3M7KSOFZ.js} +3 -3
- package/dist-cli/chunks/{detox-WNPASSS3.js → detox-433UDKEA.js} +2 -2
- package/dist-cli/chunks/{device-BXLXVG3V.js → device-ULYQASXP.js} +2 -2
- package/dist-cli/chunks/{diagnose-3QX7W5RW.js → diagnose-JAR7WZOI.js} +2 -2
- package/dist-cli/chunks/{disk-cleanup-KSWKI7WB.js → disk-cleanup-S2JSTRYU.js} +2 -2
- package/dist-cli/chunks/drivers-PGUH2YO6.js +4 -0
- package/dist-cli/chunks/{film-GDMR33VO.js → film-RT5C6JLU.js} +3 -3
- package/dist-cli/chunks/flow-RZKTARAU.js +4 -0
- package/dist-cli/chunks/help-SNFCDNKB.js +4 -0
- package/dist-cli/chunks/{hidden-runtime-alias-S2GTDX3T.js → hidden-runtime-alias-VF4CWKWJ.js} +2 -2
- package/dist-cli/chunks/{home-paths-QRCDLTTV.js → home-paths-WIUCKYP5.js} +2 -2
- package/dist-cli/chunks/inspect-NZQBU45Y.js +4 -0
- package/dist-cli/chunks/install-desktop-NEDPFLVG.js +4 -0
- package/dist-cli/chunks/{login-IJAPUZHI.js → login-VSEVRTEC.js} +4 -4
- package/dist-cli/chunks/{logout-QMXDFU2X.js → logout-R3P3CCBX.js} +2 -2
- package/dist-cli/chunks/{maestro-ZXU3YCVX.js → maestro-4QTHFBIU.js} +3 -3
- package/dist-cli/chunks/{maestro-generate-PYB5QY7K.js → maestro-generate-WKVRX6UW.js} +3 -3
- package/dist-cli/chunks/{mode-WGUCL5FZ.js → mode-OS77UC5H.js} +2 -2
- package/dist-cli/chunks/{optional-demo-registry-WH2O6H36.js → optional-demo-registry-KGQBFKET.js} +2 -2
- package/dist-cli/chunks/{perf-TOD3UFAH.js → perf-GZCPKCVI.js} +2 -2
- package/dist-cli/chunks/{permissions-I5BRJGTB.js → permissions-FISUG42S.js} +2 -2
- package/dist-cli/chunks/{record-ZYL2FYSK.js → record-QQ2OUWC6.js} +3 -3
- package/dist-cli/chunks/{report-issue-TAI6DYZO.js → report-issue-7NJ73U63.js} +2 -2
- package/dist-cli/chunks/reset-A5QZVHYZ.js +4 -0
- package/dist-cli/chunks/runtime-5VU3DJPZ.js +4 -0
- package/dist-cli/chunks/{screenshot-command-7ANLODZY.js → screenshot-command-Q62EW4KN.js} +3 -3
- package/dist-cli/chunks/{screenshot-layers-A7FYXSVU.js → screenshot-layers-3BEAAGYL.js} +2 -2
- package/dist-cli/chunks/{screenshots-capture-WT2ZY6CB.js → screenshots-capture-JV6F6HUN.js} +2 -2
- package/dist-cli/chunks/{serve-TG5WKA4V.js → serve-XAWQZ6WL.js} +2 -2
- package/dist-cli/chunks/{setup-PCWLD22V.js → setup-RKFNOXC4.js} +2 -2
- package/dist-cli/chunks/{skills-27ZHWCQS.js → skills-VW3AZ3GF.js} +2 -2
- package/dist-cli/chunks/{state-ZQVY46ZO.js → state-5PSQAXT5.js} +2 -2
- package/dist-cli/chunks/{storage-OYC57C4X.js → storage-ERGWLRMH.js} +2 -2
- package/dist-cli/chunks/store-HMXFP3QX.js +4 -0
- package/dist-cli/chunks/telemetry-WG3FVU67.js +4 -0
- package/dist-cli/chunks/{timeline-RAJJFQT6.js → timeline-2QK6DQPO.js} +2 -2
- package/dist-cli/chunks/{upgrade-OEFNZRIP.js → upgrade-R4ZYLZF3.js} +2 -2
- package/dist-cli/chunks/upload-BLDJ2HNG.js +4 -0
- package/dist-cli/chunks/{version-NIXTY6PL.js → version-R5B2AL7G.js} +2 -2
- package/dist-cli/chunks/{web-XBUTBVGR.js → web-TIUDT34D.js} +2 -2
- package/dist-cli/chunks/{what-happened-YNHRFUDX.js → what-happened-PTEBTEQM.js} +2 -2
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +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/bridge-contract.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/jump-to-source-babel.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro.cjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.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 +21 -4
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/dist-cli/chunks/cli-version-LL2UGIHE.js +0 -4
- package/dist-cli/chunks/daemon-OYLASXLE.js +0 -4
- package/dist-cli/chunks/drivers-EPIEFF7P.js +0 -4
- package/dist-cli/chunks/flow-NKMPBYCJ.js +0 -4
- package/dist-cli/chunks/help-OGCBHOKA.js +0 -4
- package/dist-cli/chunks/inspect-FUYMOZPY.js +0 -4
- package/dist-cli/chunks/install-desktop-FR6YKW7Y.js +0 -4
- package/dist-cli/chunks/reset-7YGYKQPQ.js +0 -4
- package/dist-cli/chunks/runtime-B4JO6QRI.js +0 -4
- package/dist-cli/chunks/store-32HSPZHI.js +0 -4
- package/dist-cli/chunks/telemetry-PBJR7XHR.js +0 -4
- package/dist-cli/chunks/upload-LQJITLKK.js +0 -4
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.316 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{b as Ct,c as jt}from"./chunk-
|
|
4
|
+
import{b as Ct,c as jt}from"./chunk-5W4XMFMD.js";import{a as _t,b as Dt}from"./chunk-SWJXWDAF.js";import{a as de}from"./chunk-U523FCYZ.js";import{k as Bt}from"./chunk-WO4W67CV.js";import{a as oe,b as B,c as D,d as Me,e as ae,f as X,g as pe,h as ye,i as Pt,j as Et,k as Ne,l as At}from"./chunk-VQXFEXNH.js";import{A as Tt,B as Mt,C as Nt,F as Ft,H as Ot,J as ue,K as Rt,Q as Je,a as Ie,b as pt,c as mt,d as ft,e as gt,f as yt,g as ht,h as bt,i as wt,j as xt,k as je,l as qe,r as Le,s as $t,t as St,u as ge,v as vt,w as Te,x as We,y as kt,z as It}from"./chunk-B34FLQCQ.js";import{a as nt}from"./chunk-NOYR57HW.js";import{a as Q}from"./chunk-ABWLCBHL.js";import{e as rt,j as it,o as at,q as lt,s as ct,t as dt,u as ut,v as ce}from"./chunk-QXZUTSYV.js";import{c as Be,e as Ce}from"./chunk-OAUWIZ7B.js";function He(e){return`(async () => {
|
|
5
5
|
const bridge = globalThis.SootSim && globalThis.SootSim.bridges && globalThis.SootSim.bridges.hotRemount
|
|
6
6
|
if (!bridge || typeof bridge.reloadExternalApp !== 'function') return false
|
|
7
7
|
await bridge.reloadExternalApp({ resetStorage: ${e?"true":"false"} })
|
|
8
8
|
return true
|
|
9
|
-
})()`}import{existsSync as Do,mkdirSync as Lt,readFileSync as Bo,rmSync as Ue,writeFileSync as Wt}from"fs";import{tmpdir as Co}from"os";import{dirname as Jt,join as jo,resolve as Ht}from"path";import*as Fe from"fs";function
|
|
10
|
-
`)}function ze(){let e=Oe();if(!Do(e))return null;try{let t=JSON.parse(Bo(e,"utf8"));return t.version!==Ge||!Array.isArray(t.steps)||typeof t.startedAt!="string"||typeof t.updatedAt!="string"?(Ue(e,{force:!0}),null):{version:Ge,startedAt:t.startedAt,updatedAt:t.updatedAt,steps:t.steps,candidate:t.candidate??null}}catch{return Ue(e,{force:!0}),null}}function Bs(){let e=new Date().toISOString(),t={version:Ge,startedAt:e,updatedAt:e,steps:[],candidate:null};return Ye(t),{path:Oe(),state:t}}function qo(){Ue(Oe(),{force:!0})}function Cs(){qo()}function Re(e){let t=ze();if(!t)return{active:!1};let s=t.candidate,
|
|
11
|
-
`}function qs(e){let t=ze();if(!t)return{active:!1};let s=Lo(t.steps),
|
|
12
|
-
`)}function os(e,t){let s=t.trim()||"default";return`${e}:${s}`}function Xe(e,t,s,
|
|
9
|
+
})()`}import{existsSync as Do,mkdirSync as Lt,readFileSync as Bo,rmSync as Ue,writeFileSync as Wt}from"fs";import{tmpdir as Co}from"os";import{dirname as Jt,join as jo,resolve as Ht}from"path";import*as Fe from"fs";function _o(e){let t={},s=e,a=p=>Array.isArray(p)?p:[],c=e.match(/^---\n([\s\S]*?)\n---\n?/);if(c){try{t=de.parse(c[1])??{}}catch(b){console.warn(` warn: could not parse frontmatter: ${b.message}`)}s=e.slice(c[0].length);let p=de.parse(s);return{frontmatter:t,steps:a(p)}}if(/\n---\s*\n/.test(e))try{let p=de.parseAllDocuments(e);if(p.length>=2){let b=p[0].toJS(),w=p[p.length-1].toJS();return{frontmatter:b&&typeof b=="object"?b:{},steps:a(w)}}}catch(p){console.warn(` warn: could not parse multi-doc flow: ${p.message}`)}let i=de.parse(s);return{frontmatter:t,steps:a(i)}}var qt=new Set(["tapOn","inputText","pressKey","dispatchKey","hideKeyboard","swipe","pinch","scroll","scrollUntilVisible"]);function Ke(e){let t=[];if(!Array.isArray(e)||e.length===0)return t.push("flow body must be a non-empty YAML array of steps"),t;let s=0;for(let a of e)a&&typeof a=="object"?Object.keys(a).some(i=>qt.has(i))&&(s+=1):typeof a=="string"&&qt.has(a)&&(s+=1);return s===0&&t.push("no interaction steps found (expected at least one tapOn / inputText / pressKey / swipe / scroll)"),t}function Os(e){if(!Fe.existsSync(e))return[`file not found: ${e}`];let t;try{t=Fe.readFileSync(e,"utf8")}catch(s){return[`cannot read file: ${s.message}`]}if(t.trim().length===0)return["file is empty"];try{let s=_o(t);return Ke(s.steps)}catch(s){return[`yaml parse error: ${s.message}`]}}var Ge=1;function Oe(){return Ht(process.env.SOOTSIM_FLOW_SESSION_PATH||jo(Co(),"sootsim-flow-session.json"))}function Ye(e){let t=Oe();Lt(Jt(t),{recursive:!0}),Wt(t,JSON.stringify(e,null,2)+`
|
|
10
|
+
`)}function ze(){let e=Oe();if(!Do(e))return null;try{let t=JSON.parse(Bo(e,"utf8"));return t.version!==Ge||!Array.isArray(t.steps)||typeof t.startedAt!="string"||typeof t.updatedAt!="string"?(Ue(e,{force:!0}),null):{version:Ge,startedAt:t.startedAt,updatedAt:t.updatedAt,steps:t.steps,candidate:t.candidate??null}}catch{return Ue(e,{force:!0}),null}}function Bs(){let e=new Date().toISOString(),t={version:Ge,startedAt:e,updatedAt:e,steps:[],candidate:null};return Ye(t),{path:Oe(),state:t}}function qo(){Ue(Oe(),{force:!0})}function Cs(){qo()}function Re(e){let t=ze();if(!t)return{active:!1};let s=t.candidate,a={...t,updatedAt:new Date().toISOString(),candidate:{step:e.step,summary:e.summary,source:e.source,recordedAt:new Date().toISOString()}};return Ye(a),{active:!0,candidate:a.candidate,replaced:s}}function js(){let e=ze();if(!e)return{active:!1,kept:!1,reason:"no-session"};if(!e.candidate)return{active:!0,kept:!1,reason:"no-candidate"};let t=e.candidate,s={...e,updatedAt:new Date().toISOString(),steps:[...e.steps,t.step],candidate:null};return Ye(s),{active:!0,kept:!0,candidate:t,stepCount:s.steps.length}}function Lo(e){return de.stringify(e).trimEnd()+`
|
|
11
|
+
`}function qs(e){let t=ze();if(!t)return{active:!1};let s=Lo(t.steps),a=Ke(t.steps);if(a.length>0)return{active:!0,valid:!1,issues:a,yaml:s,stepCount:t.steps.length,outputPath:null};let c=null;return e&&(c=Ht(e),Lt(Jt(c),{recursive:!0}),Wt(c,s)),{active:!0,valid:!0,issues:[],yaml:s,stepCount:t.steps.length,outputPath:c}}import{existsSync as Wo,mkdirSync as Jo,readFileSync as Ho,rmSync as Kt,writeFileSync as Ko}from"fs";import{tmpdir as Uo}from"os";import{dirname as Go,join as Yo,resolve as zo}from"path";var he=1,Xo="SOOTSIM_INSPECT_NOTICE_PATH",Vo=300*1e3,Qo=15e3;function Ut(){return zo(process.env[Xo]||Yo(Uo(),"sootsim-inspect-notice-state.json"))}function Zo(e,t){return Object.fromEntries(Object.entries(e).filter(([,s])=>typeof s?.signature=="string"&&Number.isFinite(s?.updatedAt)&&t-s.updatedAt<=Vo))}function es(e){let t=Ut();if(!Wo(t))return{version:he,entries:{}};try{let s=JSON.parse(Ho(t,"utf8"));return s.version!==he||!s.entries||typeof s.entries!="object"?(Kt(t,{force:!0}),{version:he,entries:{}}):{version:he,entries:Zo(s.entries,e)}}catch{return Kt(t,{force:!0}),{version:he,entries:{}}}}function ts(e){let t=Ut();Jo(Go(t),{recursive:!0}),Ko(t,JSON.stringify(e,null,2)+`
|
|
12
|
+
`)}function os(e,t){let s=t.trim()||"default";return`${e}:${s}`}function Xe(e,t,s,a={}){let c=a.nowMs??Date.now(),i=a.cooldownMs??Qo,p=es(c),b=os(e,t),w=p.entries[b];return w&&w.signature===s&&c-w.updatedAt<i?!1:(p.entries[b]={signature:s,updatedAt:c},ts(p),!0)}async function se({bridge:e,simId:t,maxMs:s,pollMs:a=50,stablePolls:c=3,strict:i=!1}){let p=await e.send({type:"evaluate",simId:t,code:`(async () => {
|
|
13
13
|
const start = Date.now()
|
|
14
14
|
const deadline = start + ${Math.max(0,Math.round(s))}
|
|
15
|
-
const pollMs = ${Math.max(1,Math.round(
|
|
15
|
+
const pollMs = ${Math.max(1,Math.round(a))}
|
|
16
16
|
const requiredStablePolls = ${Math.max(1,Math.round(c))}
|
|
17
|
-
const strict = ${
|
|
17
|
+
const strict = ${i?"true":"false"}
|
|
18
18
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
19
19
|
|
|
20
20
|
// route-aware settle: a tap that pushes/pops a screen is async \u2014 the
|
|
@@ -126,12 +126,12 @@ import{b as Ct,c as jt}from"./chunk-TAX4UT2N.js";import{a as At,b as Dt}from"./c
|
|
|
126
126
|
await sleep(pollMs)
|
|
127
127
|
}
|
|
128
128
|
return { settled: false, elapsed: Date.now() - start }
|
|
129
|
-
})()`},{timeoutMs:s+1e3}),{elapsed:
|
|
129
|
+
})()`},{timeoutMs:s+1e3}),{elapsed:b,settled:w}=p??{};return{elapsed:typeof b=="number"?b:s,settled:w===!0}}var Pe=`(() => {
|
|
130
130
|
const spec = window.SootSim?.state?.engineSnapshot?.windowState?.deviceSpec
|
|
131
131
|
return spec && spec.width > 0 && spec.height > 0
|
|
132
132
|
? { width: spec.width, height: spec.height }
|
|
133
133
|
: null
|
|
134
|
-
})()`,ss={initialWaitMs:3e3,deadlineMs:5e3,retryWaitMs:700},ns={initialWaitMs:1200,deadlineMs:2500,retryWaitMs:700};function rs(e,t={}){return{...e?ss:ns,...t}}function me(e){return!(!e||e.hit===!1||e.ok===!1||e.requestedTargetMatched===!1||e.pointerTapHandled===!1&&!e.keyboardOpened&&!e.isTextInput)}function is(e,t){return{nodeId:e.target?.nodeId??e.match?.nodeId??e.node?.nodeId??null,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??t??null,type:e.target?.type??e.match?.type??e.node?.type??null}}async function be(e,t){let s=rs(!!t.agent,t.timing),
|
|
134
|
+
})()`,ss={initialWaitMs:3e3,deadlineMs:5e3,retryWaitMs:700},ns={initialWaitMs:1200,deadlineMs:2500,retryWaitMs:700};function rs(e,t={}){return{...e?ss:ns,...t}}function me(e){return!(!e||e.hit===!1||e.ok===!1||e.requestedTargetMatched===!1||e.pointerTapHandled===!1&&!e.keyboardOpened&&!e.isTextInput)}function is(e,t){return{nodeId:e.target?.nodeId??e.match?.nodeId??e.node?.nodeId??null,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??t??null,type:e.target?.type??e.match?.type??e.node?.type??null}}async function be(e,t){let s=rs(!!t.agent,t.timing),a=0,c=null,i=null;try{await se({bridge:e,maxMs:s.initialWaitMs,pollMs:32,stablePolls:2})}catch{}let p=Date.now()+s.deadlineMs,b=null;for(;Date.now()<=p||a===0;){a++;let w=await t.resolve();if(c=w,w?.error==="bridge-not-ready"||w?.ambiguous||w?.nthOutOfRange)return{payload:w,result:null,attempts:a,failure:"special"};if(w&&typeof w.cx=="number"&&typeof w.cy=="number")if(w.offscreen){i={hit:!1,reason:"offscreen",x:w.cx,y:w.cy,screen:w.screen};let h=`${Math.round(w.cx)},${Math.round(w.cy)}`;if(b===h)return{payload:w,result:i,attempts:a,failure:"missed"};b=h}else{b=null;let h=is(w,t.textFallback),x=await e.send({type:"evaluate",code:`(async () => {
|
|
135
135
|
const t = window.__sootsimTest
|
|
136
136
|
if (
|
|
137
137
|
!t ||
|
|
@@ -140,8 +140,8 @@ import{b as Ct,c as jt}from"./chunk-TAX4UT2N.js";import{a as At,b as Dt}from"./c
|
|
|
140
140
|
) {
|
|
141
141
|
return { error: 'tap-target-inspection-unavailable' }
|
|
142
142
|
}
|
|
143
|
-
const requestedTarget = ${JSON.stringify(
|
|
144
|
-
const inspected = await t.inspectAt(${
|
|
143
|
+
const requestedTarget = ${JSON.stringify(h)}
|
|
144
|
+
const inspected = await t.inspectAt(${w.cx}, ${w.cy})
|
|
145
145
|
const resolved =
|
|
146
146
|
inspected && typeof inspected.nodeId === 'number'
|
|
147
147
|
? await t.resolveTapTarget(inspected.nodeId)
|
|
@@ -192,8 +192,8 @@ import{b as Ct,c as jt}from"./chunk-TAX4UT2N.js";import{a as At,b as Dt}from"./c
|
|
|
192
192
|
return { error: 'tap-target-activation-unavailable' }
|
|
193
193
|
}
|
|
194
194
|
const activation = await t.activatePressAt(
|
|
195
|
-
${
|
|
196
|
-
${
|
|
195
|
+
${w.cx},
|
|
196
|
+
${w.cy},
|
|
197
197
|
requestedTarget.nodeId,
|
|
198
198
|
)
|
|
199
199
|
if (activation?.ok) {
|
|
@@ -201,8 +201,8 @@ import{b as Ct,c as jt}from"./chunk-TAX4UT2N.js";import{a as At,b as Dt}from"./c
|
|
|
201
201
|
new CustomEvent('sootsim:agentAction', {
|
|
202
202
|
detail: {
|
|
203
203
|
type: 'tap',
|
|
204
|
-
x: ${
|
|
205
|
-
y: ${
|
|
204
|
+
x: ${w.cx},
|
|
205
|
+
y: ${w.cy},
|
|
206
206
|
target: requestedTarget,
|
|
207
207
|
},
|
|
208
208
|
}),
|
|
@@ -214,10 +214,10 @@ import{b as Ct,c as jt}from"./chunk-TAX4UT2N.js";import{a as At,b as Dt}from"./c
|
|
|
214
214
|
requestedTarget,
|
|
215
215
|
coordinateTarget,
|
|
216
216
|
}
|
|
217
|
-
})()`});if(
|
|
217
|
+
})()`});if(x?.error)return{payload:w,result:{hit:!1,reason:x.error,requestedTarget:h},attempts:a,failure:"special"};if(x?.requestedTargetMatched===!1)return{payload:w,result:{hit:!1,reason:"target-covered",...x},attempts:a,failure:"missed"};let F=x?.activation?.tap??x?.activation,M=F&&typeof F=="object"?{...F,...x?.activation,...x}:{hit:!!F,...x};if(i=M,me(M))return{payload:w,result:M,attempts:a}}let y=p-Date.now();if(y<=0)break;try{await se({bridge:e,maxMs:Math.min(y,s.retryWaitMs),pollMs:32,stablePolls:2})}catch{await new Promise(h=>setTimeout(h,Math.min(120,y)))}}return{payload:c,result:i,attempts:a,failure:c&&typeof c.cx=="number"?"missed":"not-found"}}async function Gt(e,t,s,a){return e.send({type:"tap",x:t,y:s,...a?{target:a}:{}})}async function Yt(e,t,s={}){let a=JSON.stringify(t);return be(e,{agent:s.agent,timing:s.timing,resolve:()=>e.send({type:"evaluate",code:`(async () => {
|
|
218
218
|
const t = window.__sootsimTest
|
|
219
219
|
if (!t) return null
|
|
220
|
-
const n = (await t.findByTestId(${
|
|
220
|
+
const n = (await t.findByTestId(${a})) || (await t.findById(${a}))
|
|
221
221
|
if (!n || !n.absolutePosition || !n.layout) return { cx: null }
|
|
222
222
|
const resolved =
|
|
223
223
|
typeof n.nodeId === 'number' && typeof t.resolveTapTarget === 'function'
|
|
@@ -260,7 +260,7 @@ import{b as Ct,c as jt}from"./chunk-TAX4UT2N.js";import{a as At,b as Dt}from"./c
|
|
|
260
260
|
},
|
|
261
261
|
strategy: (resolved && resolved.strategy) || 'matched-node',
|
|
262
262
|
}
|
|
263
|
-
})()`})})}async function zt(e,t,s={},
|
|
263
|
+
})()`})})}async function zt(e,t,s={},a={}){let c=JSON.stringify({query:t,exact:!!s.exact,role:s.role??null,within:s.within??null,minX:s.minX??null,maxX:s.maxX??null,minY:s.minY??null,maxY:s.maxY??null,near:s.near??null,nth:s.nth??null,first:!!s.first});return be(e,{agent:a.agent,timing:a.timing,textFallback:t,resolve:()=>e.send({type:"evaluate",code:`(async () => {
|
|
264
264
|
const t = window.__sootsimTest
|
|
265
265
|
if (!t) return { error: 'bridge-not-ready' }
|
|
266
266
|
const F = ${c}
|
|
@@ -384,11 +384,11 @@ import{b as Ct,c as jt}from"./chunk-TAX4UT2N.js";import{a as At,b as Dt}from"./c
|
|
|
384
384
|
total,
|
|
385
385
|
idx,
|
|
386
386
|
}
|
|
387
|
-
})()`})})}async function Xt(e,t,s={}){let
|
|
387
|
+
})()`})})}async function Xt(e,t,s={}){let a=JSON.stringify(t);return be(e,{agent:s.agent,timing:s.timing,textFallback:t,resolve:async()=>{let c=await e.send({type:"evaluate",code:`(async () => {
|
|
388
388
|
const t = window.__sootsimTest
|
|
389
389
|
if (!t) return { error: 'bridge-not-ready' }
|
|
390
390
|
const byTestId =
|
|
391
|
-
(await t.findByTestId(${
|
|
391
|
+
(await t.findByTestId(${a})) || (await t.findById(${a}))
|
|
392
392
|
if (byTestId && byTestId.absolutePosition && byTestId.layout) {
|
|
393
393
|
return {
|
|
394
394
|
strategy: 'testid',
|
|
@@ -404,7 +404,7 @@ import{b as Ct,c as jt}from"./chunk-TAX4UT2N.js";import{a as At,b as Dt}from"./c
|
|
|
404
404
|
screen: ${Pe},
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
|
-
const byText = await t.findByText(${
|
|
407
|
+
const byText = await t.findByText(${a})
|
|
408
408
|
if (byText && byText.absolutePosition && byText.layout) {
|
|
409
409
|
return {
|
|
410
410
|
strategy: 'text',
|
|
@@ -421,20 +421,20 @@ import{b as Ct,c as jt}from"./chunk-TAX4UT2N.js";import{a as At,b as Dt}from"./c
|
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
return { strategy: 'none' }
|
|
424
|
-
})()`});if(!c||!("node"in c))return c;let
|
|
425
|
-
`),le=[];for(let ve of
|
|
426
|
-
`)}console.log(ee),te>0&&console.log(` ${te} clipped row(s) hidden (omit --no-clipped to see)`);let ie=P||
|
|
427
|
-
`).length>=80&&Q("describe-use-filters"),K&&K.visible){let
|
|
428
|
-
keyboard: ${le.join(" ")||"visible"}`)}};if(
|
|
429
|
-
`);;)console.clear(),await J(),await oe(
|
|
424
|
+
})()`});if(!c||!("node"in c))return c;let i=c.node,p=i.absolutePosition.x+i.layout.width/2,b=i.absolutePosition.y+i.layout.height/2,w=c.screen??null,y=!!w&&(p<0||b<0||p>w.width||b>w.height);return{...c,cx:p,cy:b,...y?{offscreen:!0,screen:w}:{},target:{id:i.id,testID:i.testID,text:c.strategy==="text"?t:i.text,type:i.type}}}})}async function Vt(e,t={args:[]}){let s=await mt(e);if(B(t.args)){D(s);return}console.log(` nodes: ${s.nodes}`)}function Ve(e,t){let s=e.indexOf(t);return s>=0&&s+1<e.length?e[s+1]:null}async function Qt(e){let{bridge:t,args:s,positional:a}=e,c=s.includes("--verbose")||s.includes("-v"),i=B(s),p=c&&!i,b=s.includes("--watch")||s.includes("-w"),w=1e3,y=s.includes("--compact"),h=s.includes("--no-xy"),x=s.includes("--no-clipped"),F=s.includes("--include-occluded"),M=Ve(s,"--testid-like"),_=Ve(s,"--only"),O=Ve(s,"--subtree"),d=a[1]&&!a[1].startsWith("-")?a[1]:void 0,q=d?/[*?]/.test(d):!1,P=!q&&!_?d:void 0,A=_??(q?d:void 0),J=async()=>{await pe(t,{verbose:p});let I=await yt(t,{describe:!0,verbose:c,filter:P||"",testIdLike:M||void 0,onlyGlob:A||void 0,subtreeRoot:O||void 0,compact:y,hideXy:h,includeOccluded:F,fullText:i}),R=I?.tree,H=I?.shell,K=I?.keyboard;if(i){D({shell:H,tree:R??"",keyboard:K});return}if(H&&typeof H=="object"){let j=[H.state?`state=${H.state}`:null,H.activeApp?`app=${H.activeApp}`:null,H.showSwitcher?"switcher":null,H.switcherPhase&&H.switcherPhase!=="idle"?`phase=${H.switcherPhase}`:null].filter(Boolean);j.length>0&&console.log(` shell: ${j.join(" ")}`)}if(typeof R=="string"&&R.startsWith("__SUBTREE_NOT_FOUND__:")){let j=R.slice(22);console.log(` subtree root not found: ${j}`),Q("subtree-root-not-found",j);return}if(!R){let j=I?.nodeCount??0;console.log(" no matching nodes found"),!(P||M||A||O)&&j<10&&Q("app-still-loading",j);return}let ee=R,te=0;if(x&&typeof ee=="string"){let j=ee.split(`
|
|
425
|
+
`),le=[];for(let ve of j){if(ve.includes("(clipped:")){te+=1;continue}le.push(ve)}ee=le.join(`
|
|
426
|
+
`)}console.log(ee),te>0&&console.log(` ${te} clipped row(s) hidden (omit --no-clipped to see)`);let ie=P||M||A||O;if((P||M||A)&&!b&&Q("describe-filter-context"),!ie&&!b&&R.split(`
|
|
427
|
+
`).length>=80&&Q("describe-use-filters"),K&&K.visible){let j=K.spec,le=[j?.keyboardType?`type=${j.keyboardType}`:null,j?.returnKeyType&&j.returnKeyType!=="default"?`return=${j.returnKeyType}`:null,K.mode!=="letters"?`mode=${K.mode}`:null,K.shifted?"shift":null,K.capsLock?"caps":null,j?.autoCapitalize&&j.autoCapitalize!=="sentences"?`autoCap=${j.autoCapitalize}`:null,K.accessoryBarId?`accessory=${K.accessoryBarId}`:null].filter(Boolean);console.log(`
|
|
428
|
+
keyboard: ${le.join(" ")||"visible"}`)}};if(b)for(console.log(` watching... (Ctrl+C to stop)
|
|
429
|
+
`);;)console.clear(),await J(),await oe(w);else await J()}var as=["SOOTSIM_AGENT","TM_SESSION","CLAUDECODE","CLAUDE_CODE_ENTRYPOINT","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","CURSOR_TRACE_ID","AIDER_MODEL"];function fe(){if(process.env.SOOTSIM_AGENT==="0")return!1;for(let e of as){let t=process.env[e];if(t&&t.trim()&&t!=="0")return!0}return!1}async function Zt(e){let{bridge:t,args:s,effectiveArgs:a,positional:c,inspectUsage:i}=e,p=I=>{let R=a.indexOf(I);return R>=0&&R+1<a.length?a[R+1]:null},b=I=>a.includes(I),w=p("--testid")||p("--test-id"),y=p("--role"),h=p("--type"),x=p("--text"),F=b("--pressable"),M=b("--visible"),_=b("--interactive-targets")||b("--actions"),O=!w&&!y&&!h&&!x&&!F&&!M&&!_?c[1]:null,d=x??O,q=await xt(t,{testId:w,role:y,type:h,text:d,pressable:F,visible:M,interactive:_});q||(console.error(i("find","<text> | --text <t> | --testid <id> | --role <r> | --type <t> | --pressable | --visible | --interactive-targets")),process.exit(1));let{mode:P,result:A}=q,J=B(s),U=s.includes("--verbose")||s.includes("--dump");if(J)P==="interactive-targets"&&Array.isArray(A)?D(je(A).map(I=>({...I,tap:qe(I)}))):D(A??null);else if(Array.isArray(A))if(A.length===0){console.log(` no ${P} nodes found`);let I=await t.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount?.()) || 0)()"});typeof I=="number"&&I<10&&Q("app-still-loading",I)}else if(P==="interactive-targets"){let I=je(A);console.log(` found ${I.length} interactive target${I.length===1?"":"s"} (sorted by score):`);for(let R of I.slice(0,20)){let H=R.absolutePosition?`@(${Math.round(R.absolutePosition.x)},${Math.round(R.absolutePosition.y)})`:"",K=R.layout?`${Math.round(R.layout.width)}x${Math.round(R.layout.height)}`:"?x?",ee=R.text?` "${R.text.slice(0,30)}"`:"",te=R.testID?` #${R.testID}`:"",ie=R.accessibilityLabel?` \u24D8"${String(R.accessibilityLabel).slice(0,24)}"`:"",Se=R.accessibilityRole?`[${R.accessibilityRole}]`:R.type,j=qe(R);console.log(` ${Se}${ee}${ie}${te} ${K} ${H}`),console.log(` \u2192 ${j}`),U&&console.log(Qe(JSON.stringify(R,null,2)," "))}I.length>20&&console.log(` ... and ${I.length-20} more`)}else{console.log(` found ${A.length} node${A.length===1?"":"s"} (${P}):`);for(let I of A.slice(0,20)){let R=I.absolutePosition?`@(${Math.round(I.absolutePosition.x)},${Math.round(I.absolutePosition.y)})`:"",H=I.layout?`${Math.round(I.layout.width)}x${Math.round(I.layout.height)}`:"?x?",K=I.text?` "${I.text.slice(0,30)}"`:"",ee=I.testID?` #${I.testID}`:"",te=I.pressable?" (tap)":"",ie=I.accessibilityRole?`[${I.accessibilityRole}]`:I.type;console.log(` ${ie}${K}${ee} ${H} ${R}${te}`),U&&console.log(Qe(JSON.stringify(I,null,2)," "))}A.length>20&&console.log(` ... and ${A.length-20} more`)}else if(A==null)console.log(` not found: ${d||w||y||h||""||P}`),w&&Q("wait-selector-for-missing-testid",w);else{let I=A;if(I.type&&I.absolutePosition){let R=`@(${Math.round(I.absolutePosition.x)},${Math.round(I.absolutePosition.y)})`,H=I.layout?`${Math.round(I.layout.width)}x${Math.round(I.layout.height)}`:"?x?",K=I.text?` "${I.text.slice(0,40)}"`:"",ee=I.testID?` #${I.testID}`:"",te=I.pressable?" (tap)":"",ie=I.accessibilityRole?`[${I.accessibilityRole}]`:I.type;console.log(` ${ie}${K}${ee} ${H} ${R}${te}`),U&&console.log(Qe(JSON.stringify(I,null,2)," "))}else console.log(JSON.stringify(A,null,2))}}function Qe(e,t){return e.split(`
|
|
430
430
|
`).map(s=>t+s).join(`
|
|
431
|
-
`)}async function eo(e){let{bridge:t,args:s}=e,
|
|
432
|
-
`),console.log(bt(
|
|
433
|
-
`))}async function oo(e){let t=await e.bridge.listSims(),s=e.args.includes("--all"),
|
|
434
|
-
slope over ${F.toFixed(0)}s:`);let
|
|
431
|
+
`)}async function eo(e){let{bridge:t,args:s}=e,a=B(s);await pe(t,{verbose:!a});let c=s.includes("--styling"),i=s.indexOf("--filter"),p=i>=0?s[i+1]:void 0,b=await ht(t,{styling:c,filter:p});if(a){D({count:b.length,elements:b});return}console.log(` layout (${b.length} element${b.length===1?"":"s"}):
|
|
432
|
+
`),console.log(bt(b,{styling:c}))}async function to(e,t={}){let s=await Ot(e);if("error"in s&&(console.error(s.error),process.exit(1)),t.json){console.log(JSON.stringify(s,null,2));return}let{visible:a,spec:c,mode:i,shifted:p,capsLock:b,accessoryBarId:w}=s,y=[];y.push(`keyboard: ${a?"visible":"hidden"}`),c?(y.push(` type: ${c.keyboardType}`),y.push(` returnKey: ${c.returnKeyType}`),y.push(` autoCap: ${c.autoCapitalize}`),y.push(` autoCorrect: ${c.autoCorrect?"on":"off"}`),y.push(` appearance: ${c.keyboardAppearance}`),c.secureTextEntry&&y.push(" secureTextEntry: true"),c.enablesReturnKeyAutomatically&&y.push(` return: ${c.currentTextIsEmpty?"disabled (empty)":"enabled"}`)):y.push(" spec: <none> (shown via dev-tools with no TextInput)"),y.push(` mode: ${i}${p?" (shifted)":""}${b?" (caps)":""}`),w&&y.push(` accessoryBar: ${w}`),console.log(y.join(`
|
|
433
|
+
`))}async function oo(e){let t=await e.bridge.listSims(),s=e.args.includes("--all"),a=e.args.find((b,w)=>e.args[w-1]==="--bundle"),c=e.args.find((b,w)=>e.args[w-1]==="--app-port"),i=e.args.includes("--primary"),p=t.filter(b=>!(i&&!b.isPrimary||a&&!(b.url??"").includes(a)||c&&!(b.url??"").includes(`/rn/${c}`)||!s&&!a&&!c&&!i&&!(b.url&&(b.url.includes("bundle=")||b.url.includes("/index.bundle")))&&b.id!==e.simId));if(B(e.args)){D(p.map(b=>({...b,active:b.id===e.simId})));return}Bt(p,e.simId),p.length<t.length&&!B(e.args)&&console.log(` (${t.length-p.length} more hidden \u2014 pass --all to show)`)}function re(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}function ls(e,t){return t<=0?"?":`${(e/t*100).toFixed(0)}%`}function cs(e){let t={},s=(a,c)=>{c&&(c.nodesRegistered!=null&&(t[`${a}.nodes`]=c.nodesRegistered),c.nodesDetached!=null&&(t[`${a}.detached`]=c.nodesDetached),c.objects&&(t[`${a}.paragraphs`]=c.objects.paragraphs,t[`${a}.yogaNodes`]=c.objects.yogaNodes,t[`${a}.pictures`]=c.objects.pictures,t[`${a}.rasterImages`]=c.objects.rasterImages),c.imageLoader&&(t[`${a}.imageCacheEntries`]=c.imageLoader.cacheEntries,t[`${a}.imagePixelBytes`]=c.imageLoader.cachePixelBytes),c.workerHeap&&(t[`${a}.heapBytes`]=c.workerHeap.usedJSHeapSize),c.wasmHeapBytes!=null&&(t[`${a}.wasmHeapBytes`]=c.wasmHeapBytes))};return s("tenant",e.tenant),s("shell",e.shell),s("compositor",e.compositor),e.hostHeap&&(t["host.heapBytes"]=e.hostHeap.usedJSHeapSize),t}function so(e,t){return e.endsWith("Bytes")?re(t):String(t)}function Ze(e,t){if(!t){console.log(` ${e}: not available`);return}let s=t.objects;if(console.log(` ${e}`),t.nodesRegistered!=null&&console.log(` nodes registered: ${t.nodesRegistered}`),t.nodesDetached!=null){let a=Object.entries(t.detachedTypes??{}).map(([c,i])=>`${c}:${i}`).join(" ");console.log(` nodes detached: ${t.nodesDetached}${a?` (${a})`:""}`)}if(s&&(console.log(` paragraphs: ${s.paragraphs}`),console.log(` yoga nodes: ${s.yogaNodes}`),console.log(` pictures: ${s.pictures}`),console.log(` raster images: ${s.rasterImages}`)),t.activeNativeAnimations!=null&&console.log(` native anims: ${t.activeNativeAnimations}`),t.imageLoader){let a=t.imageLoader;console.log(` image cache: ${a.cacheEntries}/${a.cacheMaxEntries} entries, ${re(a.cachePixelBytes)}/${re(a.cachePixelBudget)} (${ls(a.cachePixelBytes,a.cachePixelBudget)})`)}t.workerHeap&&console.log(` js heap: ${re(t.workerHeap.usedJSHeapSize)} used / ${re(t.workerHeap.totalJSHeapSize)} total`),t.wasmHeapBytes!=null&&console.log(` canvaskit wasm: ${re(t.wasmHeapBytes)}`)}function ds(e){console.log(" memory:"),Ze("tenant worker",e.tenant),Ze("shell worker",e.shell),Ze("compositor worker",e.compositor),e.hostHeap?(console.log(" host"),console.log(` js heap: ${re(e.hostHeap.usedJSHeapSize)} used / ${re(e.hostHeap.totalJSHeapSize)} total`)):console.log(" host js heap: not available (chrome only)")}function us(e,t,s){let a=e.indexOf(t);if(a===-1)return s;let c=Number(e[a+1]);return Number.isFinite(c)&&c>0?c:s}async function no(e,t={args:[]}){let s=B(t.args),a=t.args.indexOf("--watch");if(a===-1){let O=await Je(e);if(s){D(O);return}ds(O);return}let c=Number(t.args[a+1]),i=Number.isFinite(c)&&c>0?c:60,p=us(t.args,"--interval",5),b=[],w=Date.now(),y=null;for(s||console.log(` sampling every ${p}s for ${i}s \u2014 deltas per tick:`);;){let O=await Je(e),d=(Date.now()-w)/1e3,q=cs(O);if(b.push({tSec:d,counters:q}),!s){let P=[];for(let[A,J]of Object.entries(q)){let U=y&&A in y?J-y[A]:null;if(U===null||U===0)continue;let I=U>0?"+":"-",R=A.endsWith("Bytes")?`${I}${re(Math.abs(U))}`:`${I}${Math.abs(U)}`;P.push(`${A} ${so(A,J)} (${R})`)}console.log(` t+${d.toFixed(0)}s ${P.length?P.join(" "):y?"no change":Object.entries(q).map(([A,J])=>`${A} ${so(A,J)}`).join(" ")}`)}if(y=q,d>=i)break;await new Promise(P=>setTimeout(P,p*1e3))}let h=b[0],x=b[b.length-1],F=Math.max(x.tSec-h.tSec,.001),M={};for(let O of Object.keys(x.counters))O in h.counters&&(M[O]=(x.counters[O]-h.counters[O])/F);if(s){D({samples:b,perSecond:M,elapsedSec:F});return}console.log(`
|
|
434
|
+
slope over ${F.toFixed(0)}s:`);let _=Object.entries(M).filter(([,O])=>O!==0).sort((O,d)=>Math.abs(d[1])-Math.abs(O[1]));if(_.length===0){console.log(" all counters flat");return}for(let[O,d]of _){let q=O.endsWith("Bytes")?`${re(Math.abs(d))}/s${d<0?" (shrinking)":""}`:`${d>0?"+":""}${d.toFixed(2)}/s`;console.log(` ${O.padEnd(28)}${q}`)}}var Z="<redacted secure text>";function we(e){let t=e?.layout?.spec??e?.spec??null;return!!t?.secureTextEntry&&t.keyboardType!=="visible-password"}function et(e,t){return we(t)?Z:e}function tt(e){if(!e||!we(e))return e;let t=e.focusedInput;return!t||typeof t!="object"?e:{...e,focusedInput:{...t,secureTextEntry:!0,text:typeof t.text=="string"?Z:t.text}}}function xe(e,t){let s=e.indexOf("--testid");if(s>=0&&e[s+1])return{mode:"testid",value:e[s+1]};let a=e.indexOf("--test-id");if(a>=0&&e[a+1])return{mode:"testid",value:e[a+1]};let c=e.indexOf("--text");if(c>=0&&e[c+1])return{mode:"text",value:e[c+1]};let i=t?.[1];return i&&!i.startsWith("-")&&!Number.isFinite(Number(i))?{mode:"testid",value:i}:null}async function Ee(e,t){let s=JSON.stringify(t.value),a=t.mode==="testid"?`(await t.findByTestId(${s})) || (await t.findById(${s}))`:`await t.findByText(${s})`;return await e.send({type:"evaluate",code:`(async () => {
|
|
435
435
|
const t = window.__sootsimTest
|
|
436
436
|
if (!t) return null
|
|
437
|
-
const n = ${
|
|
437
|
+
const n = ${a}
|
|
438
438
|
if (!n || !n.absolutePosition || !n.layout) return null
|
|
439
439
|
const resolved =
|
|
440
440
|
typeof n.nodeId === 'number' && typeof t.resolveTapTarget === 'function'
|
|
@@ -456,15 +456,15 @@ import{b as Ct,c as jt}from"./chunk-TAX4UT2N.js";import{a as At,b as Dt}from"./c
|
|
|
456
456
|
text: ${JSON.stringify(t.mode==="text")} ? ${s} : (n.text ?? n.accessibilityLabel ?? null),
|
|
457
457
|
type: n.type ?? null,
|
|
458
458
|
}
|
|
459
|
-
})()`})??null}async function ro(e,t={}){let{nav:s,route:
|
|
460
|
-
`))}async function io(e){let{bridge:t,args:s,positional:
|
|
459
|
+
})()`})??null}async function ro(e,t={}){let{nav:s,route:a,keyboard:c,shell:i}=await Rt(e);if(t.json){console.log(JSON.stringify({shell:i??null,nav:s,route:a,keyboard:c},null,2));return}let p=[];if(i){let b=i.activeApp??i.state??"<none>",w=i.showSwitcher?" (app switcher open)":"",y=typeof i.launchProgress=="number"&&i.launchProgress<.98?` launching (${Math.round(i.launchProgress*100)}%)`:"";p.push(`shell: ${b}${w}${y}`)}else p.push("shell: <unavailable>");if(s){let b=s.transitionPhase!=="idle"?` (${s.transitionPhase}, ${s.activeTransitionCount} active)`:"";if(p.push(`nav: phase=${s.transitionPhase}${b}`),s.screens.length===0)p.push(" <no registered screens \u2014 app may not use react-native-screens>");else for(let w of s.screens){let y=w.isActive?"\u25B6":" ",h=w.routeName?` ${w.routeName}`:"",x=w.headerHeight>0?` header=${w.headerHeight}`:"",F=w.largeTitleState&&w.largeTitleState!=="expanded"?` large-title=${w.largeTitleState}`:"";p.push(` ${y} #${w.id}${h}${x}${F}`)}}else p.push("nav: <runtime not available>");if(p.push(`route: ${a?.currentPath??"<unavailable>"}`),a?.coveringPath&&p.push(`covered: a presented screen (${a.coveringPath}) is above this route`),c&&c.visible){let b=c.spec?.keyboardType??"default",w=c.spec?.returnKeyType??"default";p.push(`keyboard: visible (${b}, return=${w}, mode=${c.mode??"?"})`)}else p.push("keyboard: hidden");console.log(p.join(`
|
|
460
|
+
`))}async function io(e){let{bridge:t,args:s,positional:a}=e,c=a[1]?Number(a[1])*1e3:3e3,i=s.includes("--strict"),{elapsed:p,settled:b}=await se({bridge:t,maxMs:c,strict:i});console.log(b?` settled in ${p}ms`:` timed out after ${p}ms (may still be animating)`)}async function ao(e){let t=e.positional[1]?Number(e.positional[1]):.5;(!Number.isFinite(t)||t<0)&&(console.error(e.inspectUsage("sleep","[seconds]")),process.exit(1)),await oe(t*1e3),console.log(` slept ${t}s`)}async function lo(e){let{bridge:t,args:s,positional:a}=e,c=s.includes("--boxes"),i=a[1]?Number(a[1]):c?50:5,{tree:p}=await ft(t,i,c?{format:"boxes"}:void 0);if(B(s)){D({depth:i,tree:p??null});return}console.log(typeof p=="string"?p:JSON.stringify(p,null,2))}async function co(e,t={args:[]}){let s=await gt(e);if(B(t.args)){D(s);return}console.log(s.url)}async function uo(e){let{wsPort:t,commandTimeoutMs:s,simId:a,simIdSource:c,positional:i}=e,p=i[1]?Number(i[1]):30,b=Math.max(1e3,(Number.isFinite(p)?p:30)*1e3),w=Math.max(1,Math.ceil(b/500));console.log(" waiting for sim reconnect...");let y=await Pt(t,s,a,{attempts:w,simIdSource:c});y||(console.error(" timed out waiting for sim reconnect"),process.exit(1)),y.bridge.close(),Re({source:"inspect wait",step:{wait:b},summary:`wait ${Math.round(b/1e3)}s`}),console.log(` ready: ${y.count} nodes`)}var po=new Set(["app-launch","toast","keyboard","screen","flow-step","route","alert","actionsheet","picker","notification","fetch","console","shell","scroll","gesture","text-input","react-commit","animation","reanimated"]);function Ae(e,t){let s=e.indexOf(t);if(s>=0&&s+1<e.length)return e[s+1]}function ps(e,t){if(!t.filter&&!t.equals)return!0;let s=e.data,a=[];if(s&&typeof s=="object")for(let i of["url","displayUrl","message","name","activeName","path","pathname","title","phase","event","type","kind"]){let p=s[i];typeof p=="string"&&p.length>0&&a.push(p)}let c=a.join(" ");return t.equals?a.some(i=>i===t.equals):t.filter?c.toLowerCase().includes(t.filter.toLowerCase()):!0}async function mo(e){let{bridge:t,args:s,positional:a,inspectUsage:c}=e,i=a[1];i||(console.error(c("wait event","<kind> [--max-ms 5000] [--filter <substring>] [--equals <exact>] [--since now|cursor]")),process.exit(1)),po.has(i)||console.error(` warning: '${i}' is not a known timeline kind \u2014 waiting anyway. known: ${[...po].sort().join(", ")}`);let p=Ae(s,"--max-ms"),b=p&&Number.isFinite(Number(p))?Math.max(100,Number(p)):5e3,w=Ae(s,"--filter"),y=Ae(s,"--equals"),h=Ae(s,"--since")??"now",x=s.includes("--json"),F=Date.now(),M=F+b,_=200,O=F;for(;Date.now()<M;){let q={kinds:[i],since:h==="cursor"?void 0:O,limit:50},P=await t.send({type:"evaluate",code:`(async () => {
|
|
461
461
|
const t = window.SootSim?.bridges?.timeline
|
|
462
462
|
if (!t) return { ok: false, error: 'timeline bridge missing' }
|
|
463
463
|
return { ok: true, result: await t.recent(${JSON.stringify(q)}) }
|
|
464
|
-
})()`});(!P||!P.ok)&&(console.error(` could not query timeline: ${P&&"error"in P?P.error:"unknown"}`),process.exit(1));let
|
|
464
|
+
})()`});(!P||!P.ok)&&(console.error(` could not query timeline: ${P&&"error"in P?P.error:"unknown"}`),process.exit(1));let A=P.result.events??[];for(let J of A)if(ps(J,{filter:w,equals:y})){let U=Date.now()-F;console.log(x?JSON.stringify({found:!0,elapsedMs:U,event:J}):` ${i} event after ${U}ms${w?` (filter: ${w})`:""}${y?` (equals: ${y})`:""}`);return}P.result.watermark&&P.result.watermark>O&&(O=P.result.watermark),await new Promise(J=>setTimeout(J,_))}let d=Date.now()-F;x?console.log(JSON.stringify({found:!1,elapsedMs:d,kind:i,filter:w,equals:y})):console.error(` \u26A0 wait event ${i} timed out after ${d}ms${w?` (filter: ${w})`:""}${y?` (equals: ${y})`:""}`),process.exit(1)}async function fo(e){let{bridge:t,args:s}=e,a=s.includes("--strict"),c=Ie(s,3e3),{elapsed:i,settled:p}=await se({bridge:t,maxMs:c,strict:a});p?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 go(e){let{bridge:t,args:s}=e,a=Ie(s,2e4),{ready:c,elapsedMs:i,nodes:p,targets:b,liveFrameActive:w,liveFrameChannels:y,flag:h,loadingText:x,externalReady:F,externalError:M,suppressedEntryError:_,errors:O,bridgeError:d}=await $t(t,a,{onProgress(P){console.error(` still waiting after ${P.elapsedMs}ms \u2014 ${Le(P)} (nodes: ${P.nodes}, targets: ${P.targets}, live surfaces: ${P.liveFrameActive?P.liveFrameChannels:0}, errors: ${P.errors})`)}});if(c){let P=a-i,A=Math.max(100,Math.min(1e4,P)),J=await se({bridge:t,maxMs:A,pollMs:32,stablePolls:2});J.settled||(console.error(` \u26A0 wait ready timed out after ${i+J.elapsed}ms \u2014 app mounted but did not settle (nodes: ${p}, targets: ${b})`),process.exit(1)),console.log(` ready in ${i+J.elapsed}ms: ${p} nodes, ${b} targets${w?`, ${y} live surfaces`:""}`);return}let q=Le({externalError:M,loadingText:x,externalReady:F,flag:h,targets:b,suppressedEntryError:_,bridgeError:d});console.error(` \u26A0 wait ready timed out after ${i}ms \u2014 ${q} (nodes: ${p}, targets: ${b}, live surfaces: ${w?y:0}, errors: ${O})`),process.exit(1)}async function yo(e){let{bridge:t,args:s,positional:a,inspectUsage:c}=e,i=a[1];i||(console.error(c("wait selector","<testid> [--max-ms 5000] [--gone]")),process.exit(1));let p=s.indexOf("--max-ms"),b=p>=0&&s[p+1]?Math.max(100,Number(s[p+1])):5e3,w=s.includes("--gone"),{found:y,node:h,elapsed:x}=await St(t,i,b,{gone:w});if(w){y?console.log(` #${i} gone after ${x}ms`):(console.error(` \u26A0 wait selector #${i} --gone timed out after ${x??b}ms (still present)`),process.exit(1));return}if(y&&h){let F=h.absolutePosition?`@(${Math.round(h.absolutePosition.x)},${Math.round(h.absolutePosition.y)})`:"",M=h.layout?`${Math.round(h.layout.width)}x${Math.round(h.layout.height)}`:"?x?";console.log(` found #${i} in ${x}ms ${M} ${F}`)}else console.error(` \u26A0 wait selector #${i} timed out after ${x??b}ms`),process.exit(1)}function Mo(e){return e==null?"\u2014":e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}K`:`${(e/1024/1024).toFixed(1)}M`}function No(e){return e==null?" \u2026":e<1e3?`${e}ms`.padStart(5):`${(e/1e3).toFixed(2)}s`.padStart(5)}function ho(){process.stderr.write(` the sim is not responding. recover it with:
|
|
465
465
|
rnxsim close --sim <id> # force-close the wedged sim
|
|
466
466
|
rnxsim list # confirm it's gone
|
|
467
|
-
`)}async function $e(e,t){let s=await e.send({type:"perform",steps:[t]}),
|
|
467
|
+
`)}async function $e(e,t){let s=await e.send({type:"perform",steps:[t]}),a=s?.steps?.[0],c=a?.error??s?.error;return{ok:s?.ok===!0,value:a?.value,...c?{error:c}:{}}}async function fs(e){try{return await e.send({type:"evaluate",code:"1"},{timeoutMs:3e3}),!0}catch{return!1}}async function gs(e,t){try{let s=await e.send({type:"evaluate",code:`(async () => {
|
|
468
468
|
const t = window.__sootsimTest
|
|
469
469
|
if (!t || typeof t.queryAll !== 'function') return []
|
|
470
470
|
try {
|
|
@@ -483,9 +483,9 @@ import{b as Ct,c as jt}from"./chunk-TAX4UT2N.js";import{a as At,b as Dt}from"./c
|
|
|
483
483
|
} catch {
|
|
484
484
|
return []
|
|
485
485
|
}
|
|
486
|
-
})()`});if(!Array.isArray(s)||s.length===0)return;let
|
|
487
|
-
`).slice(0,5);for(let
|
|
488
|
-
`),s){let h=(Array.isArray(s.compositor)?s.compositor:[]).reduce((x,
|
|
486
|
+
})()`});if(!Array.isArray(s)||s.length===0)return;let a=t.toLowerCase(),c=s.map(i=>({id:i,score:ys(a,i.toLowerCase())})).filter(i=>i.score<a.length+4).sort((i,p)=>i.score-p.score).slice(0,5);if(c.length===0)return;console.error(" similar testIDs:");for(let i of c)console.error(` ${i.id}`)}catch{}}function ys(e,t){if(t===e)return 0;if(t.includes(e))return 1;if(e.includes(t))return 2;let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];)s+=1;return hs(e,t)-s}function hs(e,t){if(e===t)return 0;if(!e.length)return t.length;if(!t.length)return e.length;let s=new Array(t.length+1),a=new Array(t.length+1);for(let c=0;c<=t.length;c++)s[c]=c;for(let c=1;c<=e.length;c++){a[0]=c;for(let p=1;p<=t.length;p++)a[p]=Math.min(s[p]+1,a[p-1]+1,s[p-1]+(e[c-1]===t[p-1]?0:1));let i=s;s=a,a=i}return s[t.length]}function bs(e){return e.error?"err":e.status==null?" \u2026 ":String(e.status)}function bo(e){return e.externalError?`guest app errored: ${e.externalError}`:e.loadingText?`still showing "${e.loadingText}"`:e.externalReady===!1?"guest app is still loading":e.flag!==!0?"guest app has not emitted sootsim:externalAppReady":e.targets<=0?"ready flag emitted but no visible app content is inspectable yet":"node tree is still changing"}function wo(e){let t=ae(e.startTs),s=bs(e).padEnd(3),a=e.method.padEnd(5),c=Mo(e.size).padStart(6),i=No(e.durationMs);console.log(` [${t}] ${s} ${a} ${c} ${i} ${e.displayUrl}`),e.error&&console.log(` error: ${e.error}`)}function ws(e){let t=[["id",e.id],["source",e.source],["kind",e.kind],["method",e.method],["status",e.error?`error: ${e.error}`:`${e.status??"\u2014"} ${e.statusText??""}`.trim()],["url",e.url],["started",ae(e.startTs)],["duration",No(e.durationMs).trim()],["size",Mo(e.size)],["content-type",e.type??"\u2014"]];for(let[s,a]of t)console.log(` ${s.padEnd(13)} ${a}`)}var xs={error:"\x1B[31m",warn:"\x1B[33m",info:"\x1B[36m",debug:"\x1B[35m",log:"\x1B[37m"},xo="\x1B[0m",$s="\x1B[2m";function $o(e,t){let s=ae(e.ts),a=e.level.toUpperCase().padEnd(5),c=e.args.join(" ");if(t){let i=xs[e.level];console.log(` ${$s}[${s}]${xo} ${i}${a}${xo} ${c}`)}else console.log(` [${s}] ${a} ${c}`);if(e.stack&&e.level==="error"){let i=e.stack.split(`
|
|
487
|
+
`).slice(0,5);for(let p of i)console.log(` ${p.trim()}`)}}var Ss=120;async function So(e,t){let s=e.find((F,M)=>e[M-1]==="--id"),a=e.find((F,M)=>e[M-1]==="--text");if(s||a){let F=await t.send({type:"evaluate",code:_t({id:s,text:a})});if(!F)throw new Error(s?`no node with id "${s}"`:`no node matching text "${a}"`);let{x:M,y:_,w:O,h:d}=F;return{x:M,y:_,w:O,h:d}}let c=e.find((F,M)=>e[M-1]==="--area");if(c){let F=c.split(",").map(q=>Number(q.trim()));if(F.length!==4||F.some(q=>!Number.isFinite(q)))throw new Error(`--area expects x,y,w,h (got "${c}")`);let[M,_,O,d]=F;return{x:M,y:_,w:O,h:d}}let i=F=>{let M=e.find((O,d)=>e[d-1]===F);if(M==null)return null;let _=Number(M);return Number.isFinite(_)?_:null},p=i("--x"),b=i("--y"),w=i("--w"),y=i("--h");if(p!=null||b!=null||w!=null||y!=null)return{x:p??0,y:b??0,w:w??1,h:y??1};let x=e.filter((F,M)=>M>0&&!F.startsWith("-")&&e[M-1]!=="--output"&&e[M-1]!=="--area"&&e[M-1]!=="--id"&&e[M-1]!=="--text"&&e[M-1]!=="--x"&&e[M-1]!=="--y"&&e[M-1]!=="--w"&&e[M-1]!=="--h").map(Number).filter(F=>Number.isFinite(F));if(x.length>=2){let[F,M,_=1,O=1]=x;return{x:F,y:M,w:_,h:O}}return null}function vo(e,t){if(!t||typeof t!="object")return;console.log(""),console.log(` render profile \u2014 ${e} (per painted frame):`),console.log(` node visits: ${t.nodeVisitsPerFrame}`),console.log(` boundaries: ${t.recordsPerFrame} records (${t.avgBoundaryRecordMs}ms) / ${t.replaysPerFrame} replays`);let s=[t.boundaryRecordsInvalidated?`invalidated ${t.boundaryRecordsInvalidated}`:"",t.boundaryRecordsOrigin?`moved ${t.boundaryRecordsOrigin}`:"",t.boundaryRecordsScheme?`first-record ${t.boundaryRecordsScheme}`:""].filter(Boolean).join(" \xB7 ");s&&console.log(` why recorded: ${s}`),t.prewarmRecords&&console.log(` pre-recorded: ${t.prewarmRecords} boundaries at idle (${Number(t.prewarmRecordMs).toFixed(1)}ms total)`),console.log(` raster tier: ${t.rasterPromotionsPerFrame} promotions / ${t.rasterBlitsPerFrame} blits`);let a=[t.rasterRejectRebuild?`rebuild ${t.rasterRejectRebuild}`:"",t.rasterRejectLinear?`linear ${t.rasterRejectLinear}`:"",t.rasterRejectAnimated?`animated ${t.rasterRejectAnimated}`:"",t.rasterRejectTransform?`transform ${t.rasterRejectTransform}`:"",t.rasterRejectOpacity?`opacity ${t.rasterRejectOpacity}`:"",t.rasterRejectCacheable?`cacheable ${t.rasterRejectCacheable}`:"",t.rasterRejectBounds?`bounds ${t.rasterRejectBounds}`:"",t.rasterRejectPixels?`pixels ${t.rasterRejectPixels}`:"",t.rasterRejectBudget?`budget ${t.rasterRejectBudget}`:"",t.rasterWarming?`warming ${t.rasterWarming}`:""].filter(Boolean).join(" \xB7 ");a&&(console.log(` raster skips: ${a} (total across run)`),t.rasterRejectAlsoBlocked&&console.log(` ${"".padEnd(12)} ${t.rasterRejectAlsoBlocked} of those also fail a later gate \u2014 widening the named gate cannot promote them`)),console.log(` blur: ${t.avgBlurMs}ms`),(t.glassDownsampleActive||t.glassBackdropCacheMisses)&&console.log(` glass: ${t.glassDownsampleFactor}x downsample (${t.glassDownsampledDraws} draws) \xB7 cache ${t.glassBackdropCacheHits} hits / ${t.glassBackdropCacheMisses} misses / ${t.glassBackdropCacheInvalidations} invalidations`),console.log(` draw calls: text ${t.textDrawsPerFrame} \xB7 image ${t.imageDrawsPerFrame} \xB7 path ${t.pathDrawsPerFrame} \xB7 saveLayer ${t.saveLayersPerFrame}`)}function ko(e){let t=e.avgMs>0?(1e3/e.avgMs).toFixed(1):"?",s=e.jank&&typeof e.jank=="object"?e.jank:null,a=e.compositorProduction&&typeof e.compositorProduction=="object"?e.compositorProduction:null,c=a?.budgetMs??8;if(console.log(` shell frame profile:
|
|
488
|
+
`),s){let h=(Array.isArray(s.compositor)?s.compositor:[]).reduce((x,F)=>x+(F.jankPaints??0),0);console.log(` health: ${s.detected?"jank or cadence gaps observed":"no jank or cadence gaps observed"} \xB7 shell ${s.shell?.jankFrames??0} \xB7 compositor ${h} \xB7 host clock gaps ${s.hostGaps??0}`),console.log(" series: independent worker clocks, no per-frame pairing")}if(console.log(` painted frames: ${e.frames}${e.skippedFrames?` (+${e.skippedFrames} skipped idle ticks)`:""}`),console.log(` shell work avg: ${e.avgMs}ms (${t} fps) \xB7 worst observed ${e.maxMs}ms`),console.log(` shell p50/95/99:${e.p50} / ${e.p95} / ${e.p99} ms`),s){console.log(` shell jank: ${s.shell?.jankFrames??0}/${s.shell?.sampledFrames??0} (${s.shell?.jankPct??0}%) >${c}ms \xB7 max ${s.shell?.maxMs??0}ms`);for(let y of Array.isArray(s.compositor)?s.compositor:[])console.log(` ${String(y.surfaceId).padEnd(12)} ${y.jankPaints}/${y.sampledPaints} compositor paints (${y.jankPct}%) >${c}ms \xB7 max ${y.maxMs}ms`)}else console.log(` jank: ${e.jankFrames} frames (${e.jankPct}%) >${c}ms`);if(console.log(` avg per frame: overlay ${e.avgOverlayMs}ms \xB7 aux ${e.avgAuxMs}ms \xB7 layout ${e.avgLayoutMs}ms`),a){let y=a.frames??{};console.log(""),console.log(` compositor production (${c}ms budget):`),console.log(` frames: ${y.count??0} \xB7 avg ${Number(y.avg??0).toFixed(2)} / p95 ${Number(y.p95??0).toFixed(2)} / max ${Number(y.max??0).toFixed(2)} ms \xB7 ${a.overBudget??0} over budget (${a.overBudgetPct??0}%)`);let h=[["javascript","javascript"],["layout","layout"],["paint","paint"],["prewarm","prewarm"],["texture upload","textureUpload"],["gpu submit","gpuSubmit"],["composite","composite"],["capture/readback","capture"]];for(let[M,_]of h){let O=a.phases?.[_];!O?.count||!O.max&&!O.avg||console.log(` ${M.padEnd(16)} avg ${Number(O.avg??0).toFixed(2)} / p95 ${Number(O.p95??0).toFixed(2)} / max ${Number(O.max??0).toFixed(2)} ms`)}let x=a.captureBetweenFrames;x?.count&&x.max>0&&console.log(` capture between p95 ${Number(x.p95??0).toFixed(2)} / max ${Number(x.max??0).toFixed(2)} ms between compositor rAF callbacks`);let F=Array.isArray(a.worstFrames)?a.worstFrames.slice(0,5):[];if(F.length>0){console.log(" worst frames:");for(let M of F){let _=M.phases??{};console.log(` ${Number(M.productionMs??0).toFixed(2)}ms frame ${M.frameToken??"?"} \xB7 js ${Number(_.javascriptMs??0).toFixed(2)} \xB7 layout ${Number(_.layoutMs??0).toFixed(2)} \xB7 paint ${Number(_.paintMs??0).toFixed(2)} \xB7 prewarm ${Number(_.prewarmMs??0).toFixed(2)} \xB7 upload ${Number(_.textureUploadMs??0).toFixed(2)} \xB7 submit ${Number(_.gpuSubmitMs??0).toFixed(2)} \xB7 composite ${Number(_.compositeMs??0).toFixed(2)} \xB7 capture ${Number(_.captureMs??0).toFixed(2)}`)}}}let i=e.cadence;i&&typeof i=="object"&&(console.log(""),console.log(` cadence (frame delivery, ${i.vsyncTicks} vsync ticks):`),console.log(` display clock: ${i.displayHz}hz \xB7 host rAF interval p50 ${i.hostIntervalP50} / p95 ${i.hostIntervalP95} / max ${i.hostIntervalMax} ms${i.hostGaps?` \xB7 ${i.hostGaps} gaps >1.5x (host rAF starved)`:""}`),console.log(` delivery lag: p50 ${i.deliveryLagP50} / p95 ${i.deliveryLagP95} / max ${i.deliveryLagMax} ms (vsync postMessage \u2192 shell receipt)`),console.log(` paint interval: p50 ${i.paintIntervalP50} / p95 ${i.paintIntervalP95} / max ${i.paintIntervalMax} ms${i.idleBreaks?` \xB7 ${i.idleBreaks} idle breaks excluded`:""}`));let p=e.compositorCadence;if(p&&typeof p=="object"){console.log(` compositor rAF: p50 ${p.p50} / p95 ${p.p95} / max ${p.max} ms \xB7 ${p.gaps} gaps >1.5x`);let y=(h,x)=>{x?.count&&console.log(` ${h}: ${x.count} samples \xB7 p50 ${x.p50.toFixed(2)} / p95 ${x.p95.toFixed(2)} / max ${x.max.toFixed(2)} ms`)};y("engine-empty rAF",p.phases?.uninterruptedEngineEmpty),y("rAF with CanvasKit flush",p.phases?.withCanvaskitFlush),y("rAF after CanvasKit flush",p.phases?.afterCanvaskitFlush),y("CanvasKit submission",p.canvaskitSubmission)}let b=Array.isArray(e.auxSurfaces)?e.auxSurfaces:[];if(b.length>0){console.log(""),console.log(" surfaces (last 100 frames):");for(let y of b)console.log(` ${String(y.surfaceId).padEnd(10)} ${String(y.frames).padStart(4)} paints avg ${y.avgMs}ms (layout ${y.avgLayoutMs}, render ${y.avgRenderMs}, flush ${y.avgFlushMs}) max ${y.maxMs}ms`),typeof y.gpuCacheBytes=="number"&&typeof y.gpuCacheLimitBytes=="number"&&console.log(` ${"".padEnd(10)} gpu cache ${(y.gpuCacheBytes/1024/1024).toFixed(1)}MB/${(y.gpuCacheLimitBytes/1024/1024).toFixed(1)}MB`)}vo("shell worker",e.renderProfile),vo("compositor worker",e.compositorRenderProfile);let w=Array.isArray(e.worstFrames)?e.worstFrames:[];if(w.length>0){console.log(""),console.log(" worst observations (shell and compositor series are unpaired):");for(let y of w){if(y.source==="compositor"){console.log(` ${String(y.totalMs).padStart(7)}ms compositor ${y.surfaceId} paint ${y.paint} \xB7 layout ${y.layoutMs} \xB7 render ${y.renderMs} \xB7 flush ${y.flushMs}`);continue}let h=(y.auxSurfaces??[]).map(x=>`${x.surfaceId} ${x.totalMs}ms (layout ${x.layoutMs}, render ${x.renderMs})`).join(" \xB7 ");console.log(` ${String(y.totalMs).padStart(7)}ms overlay ${y.overlayMs} \xB7 aux ${y.auxMs} \xB7 layout ${y.layoutMs}${h?` [${h}]`:""}`)}}}async function _e(e,t,s){let a=Date.now()+t,c=await ue(e,t);for(;;){if(s(c))return{settled:!0,state:c};if(Date.now()>=a)return{settled:!1,state:c};await oe(16),c=await ue(e)}}async function st(e){return e.send({type:"evaluate",code:`(async () => {
|
|
489
489
|
const kb = window.__sootsimKeyboard
|
|
490
490
|
const test = window.__sootsimTest
|
|
491
491
|
if (!kb) return { error: 'keyboard bridge not available' }
|
|
@@ -524,7 +524,7 @@ import{b as Ct,c as jt}from"./chunk-TAX4UT2N.js";import{a as At,b as Dt}from"./c
|
|
|
524
524
|
frame: runtimeSnapshot?.keyboard?.frame ?? null,
|
|
525
525
|
focusedRect: runtimeSnapshot?.focused?.rect ?? null,
|
|
526
526
|
}
|
|
527
|
-
})()`}).then(t=>tt(t))}function vs(e,t,s){if(!e.visible)return!1;let
|
|
527
|
+
})()`}).then(t=>tt(t))}function vs(e,t,s){if(!e.visible)return!1;let a=e.focusedInput;return!(t&&a&&!(a.testID===t||a.id===t)||s!==null&&we(e)!==s)}async function ks(e,t=600,s={}){let a=Date.now()+t;for(;Date.now()<=a;){let c=await st(e);if(vs(c,s.targetId??null,s.secureTextEntry??null))return c;await oe(30)}return st(e)}async function De(e,t){let s=await st(e);if(s.visible&&(s.focusedInput||s.hostedEditorFocused))return s;s.visible&&(console.error(` ${t} requires a focused editable control. the iOS keyboard is visible, but no input owns focus.`),process.exit(1)),console.error(` ${t} requires the iOS keyboard to be visible. focus an input first with rnxsim do tap-id/tap-text or rnxsim do type-into.`),process.exit(1)}async function Io(e,t,s){return t==="appearance"?e.send({type:"evaluate",code:`(async () => {
|
|
528
528
|
const requested = ${JSON.stringify(s??"toggle")}
|
|
529
529
|
// the engine owns toggle + auto resolution (settingsStore is the single
|
|
530
530
|
// source of truth). never infer the current scheme client-side \u2014 the old
|
|
@@ -547,26 +547,26 @@ import{b as Ct,c as jt}from"./chunk-TAX4UT2N.js";import{a as At,b as Dt}from"./c
|
|
|
547
547
|
})()`}):e.send({type:"evaluate",code:`(async () => {
|
|
548
548
|
window.dispatchEvent(new CustomEvent('sootsim:shake'))
|
|
549
549
|
return { ok: true, action: 'shake' }
|
|
550
|
-
})()`})}function Is(e){let t={Enter:"return",NumpadEnter:"return",Backspace:"delete",Delete:"delete",Space:"space",ShiftLeft:"shift",ShiftRight:"shift"};if(t[e])return t[e];let s=e.match(/^Digit([0-9])$/);if(s)return s[1];let
|
|
551
|
-
`),process.exit(0))}if(
|
|
552
|
-
`),process.exit(0))}let o=Ce("inspect"
|
|
550
|
+
})()`})}function Is(e){let t={Enter:"return",NumpadEnter:"return",Backspace:"delete",Delete:"delete",Space:"space",ShiftLeft:"shift",ShiftRight:"shift"};if(t[e])return t[e];let s=e.match(/^Digit([0-9])$/);if(s)return s[1];let a=e.match(/^Key([A-Z])$/);return a?a[1].toLowerCase():null}function Ts(e){if(typeof e!="string")return null;let t=e.replace(/\s+/g," ").trim();return t?t.slice(0,80):null}function Fo(...e){for(let t of e){if(typeof t!="string")continue;let s=t.trim();if(s)return s}return null}function Ms(e){let t=e.indexOf("--node-id");if(t<0)return null;let s=e[t+1];if(!s)return null;let a=Number(s);return Number.isInteger(a)&&a>0?a:null}async function W(e,t,s){let a=Re({source:e,step:t,summary:s});a.active&&(a.replaced?console.error(` draft: replaced unkept action "${a.replaced.summary}" \u2014 \`maestro keep\` commits one action at a time`):console.error(" draft: action pending \u2014 `rnxsim maestro keep` to commit"))}function To(e,t,s){if(!s||s.hit===!1)return null;let a=Fo(s.responderTestID,s.testID);if(a)return{step:{tapOn:{id:a}},summary:`tap #${a}`};let c=Ts(s.text);return c?{step:{tapOn:c},summary:`tap "${c}"`}:{step:{tapAtCoords:{x:e,y:t}},summary:`tap @${Math.round(e)},${Math.round(t)}`}}function ot(e,t,s){let a=Fo(t?.testID,t?.id);return a?{step:{tapOn:{id:a}},summary:`tap #${a}`}:s==="id"?{step:{tapOn:{id:e}},summary:`tap #${e}`}:{step:{tapOn:e},summary:`tap "${e}"`}}async function Er(e,t){let s=e[0]==="get"||e[0]==="do"||e[0]==="debug"||e[0]==="wait"?e[0]:null,a=s?e.slice(1):e,c=lt(a,{port:t.port,commandTimeoutMs:t.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=c.positional,p=i[0],b=s==="get"||s==="do"||s==="debug"||s==="wait"?s:"inspect",w=typeof a[0]=="string"&&nt.has(a[0]),y=w?a[0]:null,h=S=>t.internalPerfCommand&&S==="perf"?`rnxsim perf ${t.internalPerfCommand}`:w&&S===a[0]?`rnxsim ${S}`:`rnxsim ${b} ${S}`,x=(S,o)=>` usage: ${h(S)}${o?` ${o}`:""}`;if(!p||e.includes("--help")||e.includes("-h")){let S={bridgePort:7668,defaultShellUrl:it};if(b==="do"||b==="get"||b==="debug"||b==="wait"){let r=Be(b,S);r&&(console.log(`${r}
|
|
551
|
+
`),process.exit(0))}if(y==="shell"){let r=Ce("shell",S);r&&(console.log(`${r}
|
|
552
|
+
`),process.exit(0))}let o=Ce("inspect",S),n=["do","get","debug","wait"].map(r=>Be(r,S)).filter(r=>r!=null).join(`
|
|
553
553
|
|
|
554
554
|
`);console.log(`${o??""}
|
|
555
555
|
|
|
556
556
|
${n}
|
|
557
|
-
`),process.exit(0)}let F=c.wsPort,
|
|
558
|
-
`);let n=Math.max(...o.map(
|
|
559
|
-
`)}catch{}}function
|
|
557
|
+
`),process.exit(0)}let F=c.wsPort,M=c.simId,_=c.simIdSource,O=c.commandTimeoutMs;if(b==="get"&&p==="diagnosis"){let S=a.indexOf("diagnosis"),o=S>=0?[...a.slice(0,S),...a.slice(S+1)]:a,{runDiagnose:n}=await import("./diagnose-JAR7WZOI.js"),r=await n(["recent",...o],t);process.exitCode=r;return}if(b==="do"&&p==="scan"){let{runCamera:S}=await import("./camera-INL3BDHS.js");process.exitCode=await S(a,{port:t.port});return}if(p==="list"&&a.some(S=>S==="--drivers"||S==="-D")){let{buildDriverListRows:S}=await import("./drivers-PGUH2YO6.js"),o=S();console.log(` available drivers (${o.length}):
|
|
558
|
+
`);let n=Math.max(...o.map(l=>l.id.length),6),r=Math.max(...o.map(l=>l.kind.length),4);for(let l of o){let u=l.available?"\u2713":"\u2717",m=l.id.padEnd(n),f=l.kind.padEnd(r);console.log(` ${u} ${m} ${f} ${l.description}`),l.available&&l.detail?console.log(` ${l.detail}`):!l.available&&l.reason&&console.log(` unavailable: ${l.reason}`)}return}let d=ct(c),q=M||"default",P=new Set(["errors","warnings","requests","js","eval","reload","globals","perf","storage-clear","list","wait","sleep"]),A=200;function J(S){let o=S.replace(/\s+/g," ").trim();if(!o)return"";if(/^<(!doctype html|html|\?xml)|<body[\s>]/i.test(o)){let r=/<title[^>]*>([^<]+)<\/title>/i.exec(S)?.[1]?.trim(),l=/<body[^>]*>([\s\S]*?)<\//i.exec(S)?.[1]?.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().slice(0,80),u=r||l||"html error page";return`<html ${S.length}B> "${u}" (body elided \u2014 add --json for the full payload)`}return o.length<=A?o:`${o.slice(0,A)}\u2026 (+${o.length-A} more bytes)`}function U(S){let o=S.displayUrl||S.url;return S.status!=null?`${S.method} ${o} -> ${S.status}${S.statusText?` ${S.statusText}`:""}`:S.error?`${S.method} ${o} -> ${S.error}`:`${S.method} ${o}`}async function I(S){let o=fe()?400:200;try{let{settled:n,elapsed:r}=await se({bridge:S,maxMs:o,pollMs:32,stablePolls:2});n||process.stderr.write(` \u26A0 auto-wait timed out after ${r??o}ms \u2014 next command may see mid-animation state. use \`rnxsim do settle\` for a longer wait.
|
|
559
|
+
`)}catch{}}function R(S,o){if(o.result?.reason==="offscreen"){let{x:n,y:r,screen:l}=o.result;console.error(` tap failed: ${S} resolved to (${Math.round(n)},${Math.round(r)}), outside the ${l?.width}x${l?.height} screen`),console.error(" the node exists but is scrolled out of view \u2014 scroll it on-screen first (rnxsim do scroll / swipe), then tap.");return}console.error(` tap failed: ${S} stayed visible but did not receive a hittable press after ${o.attempts} attempt${o.attempts===1?"":"s"}`),o.result&&console.error(` last result: ${JSON.stringify(o.result)}`)}async function H(){try{return await d.send({type:"evaluate",code:`(() => ({
|
|
560
560
|
console: ${Te},
|
|
561
561
|
requests: window.__sootsimTest?.getRequestCounts?.() || null,
|
|
562
|
-
}))()`})||{console:null,requests:null}}catch{return{console:null,requests:null}}}async function K(
|
|
563
|
-
network: ${n} failed request${n===1?"":"s"}`),console.log(` inspect: ${
|
|
562
|
+
}))()`})||{console:null,requests:null}}catch{return{console:null,requests:null}}}async function K(S={}){let o=S.counts!==void 0?S.counts:await X(d,"getRequestCounts");if(!o||typeof o!="object")return;let n=Math.max(0,Number(o.failed)||0);if(n===0||!S.includeTail&&!Xe("requests",q,String(n))||(console.log(`
|
|
563
|
+
network: ${n} failed request${n===1?"":"s"}`),console.log(` inspect: ${h("requests")} 5`),!S.includeTail))return;let r=await X(d,"getFailedRequests",5);if(!(!Array.isArray(r)||r.length===0)){console.log(`
|
|
564
564
|
recent failed requests:
|
|
565
|
-
`);for(let
|
|
566
|
-
note: ${o.label} is open${n} \u2014 taps/drags hit it, not the app`)}}async function te(
|
|
567
|
-
console: ${u.join(", ")}`),console.error(` inspect: ${
|
|
565
|
+
`);for(let l of r){let u=ae(l.timestamp);console.log(` [${u}] ${U(l)}`),l.responseBody?console.log(` ${J(l.responseBody)}`):l.error&&console.log(` ${l.error}`)}}}function ee(S){for(let o of S){let n=o.title?` (\u201C${o.title}\u201D)`:"";console.error(`
|
|
566
|
+
note: ${o.label} is open${n} \u2014 taps/drags hit it, not the app`)}}async function te(S={}){let o=S.counts!==void 0?S.counts:await d.send({type:"evaluate",code:Te});if(!o||typeof o!="object")return;let n=o,r=Math.max(0,Number(n.errors)||0),l=Math.max(0,Number(n.warnings)||0);if(r===0&&l===0||!S.includeTail&&!Xe("console",q,`${r}:${l}`))return;let u=[];if(r>0&&u.push(`${r} console error${r===1?"":"s"}`),l>0&&u.push(`${l} console warning${l===1?"":"s"}`),console.error(`
|
|
567
|
+
console: ${u.join(", ")}`),console.error(` inspect: ${h("errors")} 5`),l>0&&console.error(` inspect: ${h("warnings")} 5`),!S.includeTail||r===0)return;let m=await ge(d,5);if(!(!Array.isArray(m)||m.length===0)){console.error(`
|
|
568
568
|
recent console errors:
|
|
569
|
-
`);for(let
|
|
569
|
+
`);for(let f of m){let $=ae(f.timestamp),g=Array.isArray(f.args)?f.args.map(k=>typeof k=="object"?JSON.stringify(k):String(k)).join(" "):String(f);console.error(` [${$}] ${g}`)}}}let ie=["console","fetch","toast","alert","notification","screen","app-launch","keyboard","route","actionsheet","picker","shell","scroll","gesture","text-input","animation","reanimated"];async function Se(S){let o=rt(),n=null;try{n=await ut(S,`(() => {
|
|
570
570
|
const tl = window.SootSim && window.SootSim.bridges && window.SootSim.bridges.timeline
|
|
571
571
|
if (!tl || typeof tl.summary !== 'function') return null
|
|
572
572
|
const cursorKey = ${JSON.stringify(o)}
|
|
@@ -582,9 +582,9 @@ ${n}
|
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
584
|
return summary ? { summary, consoleSplit } : null
|
|
585
|
-
})()`)}catch{return}if(!n||!n.summary||!n.summary.total)return;let
|
|
586
|
-
since last: ${
|
|
587
|
-
`);for(let n of o){let
|
|
585
|
+
})()`)}catch{return}if(!n||!n.summary||!n.summary.total)return;let r=n.summary.byKind??{},l=[],u=new Set;for(let m of ie){let f=r[m];if(f)if(u.add(m),m==="console"&&n.consoleSplit){let{error:$,warn:g}=n.consoleSplit;$>0&&l.push(`${$} error${$===1?"":"s"}`),g>0&&l.push(`${g} warning${g===1?"":"s"}`)}else l.push(`${f} ${m}${f===1?"":"s"}`)}for(let[m,f]of Object.entries(r))!u.has(m)&&f&&l.push(`${f} ${m}${f===1?"":"s"}`);if(l.length!==0&&(console.error(`
|
|
586
|
+
since last: ${l.join(" \xB7 ")} \u2014 rnxsim what-happened`),n.summary.lastAt))try{await ce(S,"SootSim.bridges.timeline.cursorAdvance",o,n.summary.lastAt)}catch{}}let j=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","storage-clear"]),le=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"]),ve=(e.includes("--verbose")||e.includes("-v"))&&!e.includes("--json");b==="do"&&p==="shell"&&(console.error(" `rnxsim do shell` was removed. use `rnxsim shell ...` instead."),process.exit(1)),j.has(p)&&await dt(d),le.has(p)&&await pe(d,{verbose:ve});try{let S=j.has(p)?await Ft(d):[];switch(p){case"list":{at(c.wsPort),await oo({bridge:d,simId:M,args:a});break}case"tree":{await lo({bridge:d,args:a,positional:i});break}case"a11y":{let o=await wt(d);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):
|
|
587
|
+
`);for(let n of o){let r=[];if(r.push(`[${n.role}]`),n.label){let l=n.label.length>50?n.label.slice(0,47)+"...":n.label;r.push(`"${l}"`)}if(n.hint&&r.push(`(hint: "${n.hint}")`),n.testID&&r.push(`#${n.testID}`),n.state){let l=[];n.state.disabled&&l.push("disabled"),n.state.selected&&l.push("selected"),n.state.checked===!0&&l.push("checked"),n.state.checked==="mixed"&&l.push("mixed"),n.state.busy&&l.push("busy"),n.state.expanded===!0&&l.push("expanded"),n.state.expanded===!1&&l.push("collapsed"),l.length&&r.push(`{${l.join(", ")}}`)}n.position&&r.push(`@(${n.position.x},${n.position.y})`),n.size&&r.push(`${n.size.w}x${n.size.h}`),console.log(" "+r.join(" "))}}break}case"find":{await Zt({bridge:d,args:e,effectiveArgs:a,positional:i,inspectUsage:x});break}case"count":{await Vt(d,{args:a});break}case"keyboard":{await to(d,{json:e.includes("--json")});break}case"screens":{await ro(d,{json:e.includes("--json")});break}case"memory":{await no(d,{args:a});break}case"wait":{await uo({wsPort:F,commandTimeoutMs:O,simId:M,simIdSource:_,positional:i});break}case"sleep":{await ao({positional:i,inspectUsage:x});break}case"settle":{await io({bridge:d,args:e,positional:i});break}case"ready":{await go({bridge:d,args:e});break}case"idle":{await fo({bridge:d,args:e,positional:i});break}case"selector":{await yo({bridge:d,args:e,positional:i,inspectUsage:x});break}case"event":{await mo({bridge:d,args:e,positional:i,inspectUsage:x});break}case"layout":{let o=i[1];if(!o){await eo({bridge:d,args:a});break}let n=await d.send({type:"evaluate",code:`(async () => await window.__sootsimTest.getLayout(${JSON.stringify(o)}))()`});console.log(JSON.stringify(n,null,2));break}case"capture":case"screenshot":{let n=e.find(($,g)=>e[g-1]==="--output")||"/tmp/sootsim-inspect.png",r=await So(e,d),l={type:"screenshot"};r&&(l.crop=r);let m=(await d.send(l)).replace(/^data:image\/png;base64,/,"");r&&console.log(` area: x=${r.x} y=${r.y} w=${r.w} h=${r.h}`),(await import("fs")).writeFileSync(n,Buffer.from(m,"base64")),console.log(` saved: ${n}`);break}case"sample-color":{let o=await So(e,d);o||(console.error(x("sample-color","<x> <y> [w] [h] | --id <testID> | --text <text>")),console.error(" samples an averaged color from the canvas. coords are logical rnx units."),process.exit(1));let n=await d.send({type:"evaluate",code:Dt(o)});if(e.includes("--json"))console.log(JSON.stringify(n,null,2));else{let{r,g:l,b:u,a:m,hex:f,samples:$}=n,g=o.w===1&&o.h===1?`@(${o.x},${o.y})`:`@(${o.x},${o.y}) ${o.w}x${o.h}`;console.log(` ${f} rgba(${r}, ${l}, ${u}, ${m}) ${g} ${$} samples`)}break}case"node":{let o=i[1];o||(console.error(x("node","<matcher>")),console.error(" resolves testID, id, then text \u2014 dumps full node info as JSON"),process.exit(1));let n=await d.send({type:"evaluate",code:`(async () => {
|
|
588
588
|
const t = window.__sootsimTest
|
|
589
589
|
const q = ${JSON.stringify(o)}
|
|
590
590
|
let node = null
|
|
@@ -640,10 +640,10 @@ ${n}
|
|
|
640
640
|
transform,
|
|
641
641
|
parentChain,
|
|
642
642
|
}
|
|
643
|
-
})()`});console.log(JSON.stringify(n,null,2));break}case"tap":{let o=Number(
|
|
643
|
+
})()`});console.log(JSON.stringify(n,null,2));break}case"tap":{let o=Number(i[1]),n=Number(i[2]),r=xe(e,i);if(r){let m=await be(d,{agent:fe(),textFallback:r.mode==="text"?r.value:void 0,resolve:async()=>{let g=await Ee(d,r);return g?{cx:g.x,cy:g.y,match:{id:r.mode==="testid"?r.value:g.id??null,testID:r.mode==="testid"?r.value:g.testID??null,text:r.mode==="text"?r.value:g.text??null,type:g.type??null},target:{id:g.id??null,testID:g.testID??null,text:g.text??null,type:g.type??null}}:null}}),f=m.payload;(!f||typeof f.cx!="number")&&(console.error(` not found: ${r.value}`),r.mode==="testid"&&Q("wait-selector-for-missing-testid",r.value),process.exit(1)),me(m.result)||(R(`${r.mode} "${r.value}"`,m),process.exit(1));let $=To(f.cx,f.cy,m.result);$&&await W("inspect tap",$.step,$.summary),console.log(JSON.stringify({...m.attempts>1?{attempts:m.attempts}:{},...m.result},null,2));break}(!Number.isFinite(o)||!Number.isFinite(n))&&(console.error(x("tap","<testid> | <x> <y> | --testid <id> | --text <t>")),process.exit(1));let l=await Gt(d,o,n),u=To(o,n,l);u&&await W("inspect tap",u.step,u.summary),console.log(JSON.stringify(l,null,2));break}case"drag":case"swipe":{let o=Number(i[1]),n=Number(i[2]),r=Number(i[3]),l=Number(i[4]),u=p==="swipe"?10:12,m=p==="swipe"?8:16,f=i[5]?Number(i[5]):u,$=i[6]?Number(i[6]):m;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(l)||!Number.isFinite(f)||!Number.isFinite($))&&(console.error(x(p,"<x1> <y1> <x2> <y2> [steps] [stepMs]")),process.exit(1));let g=await $e(d,{type:"drag",fromX:o,fromY:n,toX:r,toY:l,steps:Math.max(1,Math.round(f)),stepMs:Math.max(0,Math.round($))});if(g?.ok){let k=Math.max(1,Math.round(Math.max(1,f)*Math.max(0,$)));await W(`inspect ${p}`,{swipe:{start:`${o}, ${n}`,end:`${r}, ${l}`,duration:k}},`${p} ${o},${n} -> ${r},${l}`)}console.log(JSON.stringify(g,null,2));break}case"pinch":{let o=Number(i[1]),n=Number(i[2]),r=Number(i[3]),l=Number(i[4]),u=Number(i[5]),m=Number(i[6]),f=Number(i[7]),$=Number(i[8]),g=i[9]?Number(i[9]):12,k=i[10]?Number(i[10]):16;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(l)||!Number.isFinite(u)||!Number.isFinite(m)||!Number.isFinite(f)||!Number.isFinite($)||!Number.isFinite(g)||!Number.isFinite(k))&&(console.error(x("pinch","<x1> <y1> <x2> <y2> <x1'> <y1'> <x2'> <y2'> [steps] [stepMs]")),process.exit(1));let L=await $e(d,{type:"pinch",fromX1:o,fromY1:n,fromX2:r,fromY2:l,toX1:u,toY1:m,toX2:f,toY2:$,steps:Math.max(1,Math.round(g)),stepMs:Math.max(0,Math.round(k))});L?.ok&&await W("inspect pinch",{pinch:{from:[o,n,r,l],to:[u,m,f,$],steps:Math.max(1,Math.round(g)),stepMs:Math.max(0,Math.round(k))}},`pinch (${o},${n}) (${r},${l}) -> (${u},${m}) (${f},${$})`),console.log(JSON.stringify(L,null,2));break}case"tap-text":{let o=i[1];o||(console.error(x("tap-text","<text>")),process.exit(1));let n=z=>{let C=e.indexOf(z);return C>=0&&C+1<e.length?e[C+1]:null},r=z=>e.includes(z),l=n("--nth")??n("--index"),u=l!==null?Number(l):null;u!==null&&!Number.isFinite(u)&&(console.error(` --nth/--index requires an integer, got: ${l}`),process.exit(1));let m=n("--within"),f=n("--role"),$=r("--exact"),g=r("--first"),k=n("--min-y"),L=n("--max-y"),V=n("--min-x"),G=n("--max-x");for(let[z,C]of[["--min-y",k],["--max-y",L],["--min-x",V],["--max-x",G]])C!==null&&!Number.isFinite(Number(C))&&(console.error(` ${z} requires a number, got: ${C}`),process.exit(1));let Y=e.indexOf("--near"),E=null;if(Y>=0){let z=Number(e[Y+1]),C=Number(e[Y+2]);(!Number.isFinite(z)||!Number.isFinite(C))&&(console.error(" --near requires two numbers: --near <x> <y>"),process.exit(1)),E={x:z,y:C}}let v={exact:$,role:f,within:m,minX:V!==null?Number(V):null,maxX:G!==null?Number(G):null,minY:k!==null?Number(k):null,maxY:L!==null?Number(L):null,near:E,nth:u,first:g},T=await zt(d,o,v,{agent:fe()}),N=T.payload;if(N?.error==="bridge-not-ready"&&(console.error(" rnxsim test bridge not ready"),process.exit(1)),N?.ambiguous){let z=N.candidates;console.error(` ambiguous: ${N.total} matches for "${o}"`);for(let C of z){let ke=C.abs?`@(${Math.round(C.abs.x)},${Math.round(C.abs.y)})`:"",Oo=C.layout?` ${C.layout.width}x${C.layout.height}`:"",Ro=C.testID?` #${C.testID}`:"",Po=C.text?` "${C.text}"`:"",Eo=C.ancestorTestIDs.length>0?` within ${C.ancestorTestIDs.slice(0,3).map(Ao=>`#${Ao}`).join(" > ")}`:"";console.error(` [${C.idx}] <${C.type}>${Po}${Ro} ${ke}${Oo}${Eo}`)}N.total>z.length&&console.error(` ... and ${N.total-z.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)}N?.nthOutOfRange&&(console.error(` not found: nth ${N.nth} of ${N.total} match${N.total===1?"":"es"} for "${o}"`),process.exit(1)),(!N||typeof N.cx!="number")&&(console.error(` not found: ${o}`),process.exit(1)),me(T.result)||(R(`text "${o}"`,T),process.exit(1));let ne=ot(o,{id:N.target?.id??null,testID:N.target?.testID??null,type:N.target?.type??null,cx:N.cx,cy:N.cy},"text");await W("inspect tap-text",ne.step,ne.summary),console.log(JSON.stringify({matched:N.match,tapped:{nodeId:N.target?.nodeId??null,id:N.target?.id??null,testID:N.target?.testID??null,type:N.target?.type??null,cx:N.cx,cy:N.cy},...N.strategy&&N.strategy!=="matched-node"?{strategy:N.strategy}:{},...N.total>1||u!==null?{nth:{index:N.idx,total:N.total}}:{},...T.attempts>1?{attempts:T.attempts}:{},result:T.result},null,2));break}case"tap-best":{let o=i[1];o||(console.error(x("tap-best","<query>")),process.exit(1));let n=await Xt(d,o,{agent:fe()}),r=n.payload;r||(console.error(` tap-best: no testID or visible text matched "${o}". try \`rnxsim find --interactive-targets\` to list candidates.`),process.exit(1)),"error"in r&&(console.error(` ${r.error}`),process.exit(1)),r.strategy==="none"&&(console.error(` tap-best: no testID or visible text matched "${o}". try \`rnxsim find --interactive-targets\` to list candidates.`),process.exit(1));let l=r.node;me(n.result)||(R(`best "${o}"`,n),process.exit(1));let u=ot(o,{id:l.id,testID:l.testID,type:l.type,cx:r.cx,cy:r.cy},r.strategy==="testid"?"id":"text");await W("inspect tap-best",u.step,u.summary),console.log(JSON.stringify({matched:{strategy:r.strategy,nodeId:l.nodeId,id:l.id,testID:l.testID,type:l.type,text:l.text},tapped:{cx:r.cx,cy:r.cy},...n.attempts>1?{attempts:n.attempts}:{},result:n.result},null,2));break}case"tap-id":{let o=i[1];o||(console.error(x("tap-id","<id>")),process.exit(1));let n=await Yt(d,o,{agent:fe()}),r=n.payload;(!r||typeof r.cx!="number")&&(console.error(` not found: ${o}`),await gs(d,o),process.exit(1)),me(n.result)||(R(`id "${o}"`,n),process.exit(1));let l=ot(o,{id:r.target?.id??null,testID:r.target?.testID??null,type:r.target?.type??null,cx:r.cx,cy:r.cy},"id");await W("inspect tap-id",l.step,l.summary),console.log(JSON.stringify({matched:r.match,tapped:{nodeId:r.target?.nodeId??null,id:r.target?.id??null,testID:r.target?.testID??null,type:r.target?.type??null,cx:r.cx,cy:r.cy},...r.strategy&&r.strategy!=="matched-node"?{strategy:r.strategy}:{},...n.attempts>1?{attempts:n.attempts}:{},result:n.result},null,2));break}case"type-into":{let o=i[1],n=i.slice(2).join(" ");(!o||!n)&&(console.error(x("type-into","<id> <text>")),process.exit(1));let r=JSON.stringify(o),l=await d.send({type:"evaluate",code:`(async () => {
|
|
644
644
|
const t = window.__sootsimTest
|
|
645
645
|
if (!t) return null
|
|
646
|
-
const n = await (t.findByTestId(${
|
|
646
|
+
const n = await (t.findByTestId(${r}) || t.findById(${r}))
|
|
647
647
|
if (!n || !n.absolutePosition || !n.layout) return null
|
|
648
648
|
return {
|
|
649
649
|
cx: n.absolutePosition.x + (n.layout.width || 0) / 2,
|
|
@@ -655,7 +655,7 @@ ${n}
|
|
|
655
655
|
secureTextEntry: !!n.secureTextEntry,
|
|
656
656
|
placeholder: n.placeholder || null,
|
|
657
657
|
}
|
|
658
|
-
})()`});(!
|
|
658
|
+
})()`});(!l||typeof l.cx!="number")&&(console.error(` not found: ${o}`),process.exit(1)),l.isTextInput||console.error(` warning: ${o} is not a text input (isTextInput: false)`);let u=await d.send({type:"tap",x:l.cx,y:l.cy,target:{id:l.id??o,testID:l.testID??o,text:null,type:l.type??null}}),m=l.secureTextEntry===!0,f=await ks(d,1e3,{targetId:o,secureTextEntry:m});f.visible||(console.error(` keyboard did not open after tapping ${o}`),process.exit(1));let $=f.focusedInput;$&&($.testID===o||$.id===o||(console.error(` focus routing mismatch after tap: requested ${JSON.stringify(o)} but focus is on ${JSON.stringify($.testID??$.id??null)}. did the tap land on an outer Pressable wrapper?`),process.exit(1))),await d.send({type:"keyboard",action:"type",text:n});let g=m||we(f),k=g?Z:et(n,f),L=g&&f.focusedInput?{...f.focusedInput,secureTextEntry:!0,text:typeof f.focusedInput.text=="string"?Z:f.focusedInput.text}:f.focusedInput??null;await W("inspect type-into",{tapOn:{id:o},inputText:k},k===Z?`type-into #${o} ${Z}`:`type-into #${o} ${JSON.stringify(n)}`),console.log(JSON.stringify({target:o,isTextInput:l.isTextInput,secureTextEntry:g,keyboardOpened:f.visible??u?.keyboardOpened??!1,focusedInput:L,typed:k},null,2));break}case"type":{let o=i.slice(1).join(" ");o||(console.error(x("type","<text>")),process.exit(1));let n=await De(d,"type");await d.send({type:"keyboard",action:"type",text:o});let r=et(o,n);await W("inspect type",{inputText:r},r===Z?`type ${Z}`:`type ${JSON.stringify(o)}`),console.log(r===Z?` typed: ${Z}`:` typed: ${JSON.stringify(o)}`);break}case"key":{let o=i[1];o||(console.error(x("key","<name>")),process.exit(1)),await De(d,"key"),await d.send({type:"keyboard",action:"press",text:o}),await W("inspect key",{pressKey:o},`key ${o}`),console.log(` pressed: ${o}`);break}case"key-sequence":{let o=i.slice(1);o.length===0&&(console.error(x("key-sequence","<key> [<key> ...]")),process.exit(1)),await De(d,"key-sequence");for(let n of o)await d.send({type:"keyboard",action:"press",text:n});await W("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(x("keycode","<code> [<code> ...]")),process.exit(1));let n=o.map(l=>({code:l,key:Is(l)})),r=n.filter(l=>!l.key);r.length>0&&(console.error(` unsupported keycode(s): ${r.map(l=>l.code).join(", ")}`),process.exit(1)),await De(d,"keycode");for(let l of n)await d.send({type:"keyboard",action:"press",text:l.key});await W("inspect keycode",{pressKey:n.map(l=>l.key).join(" ")},`keycode ${o.join(" ")}`),console.log(` pressed: ${o.join(", ")}`);break}case"dispatch":{let o=i[1];o||(console.error(x("dispatch","<char>")),process.exit(1)),await d.send({type:"keyboard",action:"dispatchKey",text:o}),await W("inspect dispatch",{dispatchKey:o},`dispatch ${JSON.stringify(o)}`),console.log(` dispatched: ${o}`);break}case"dismiss":{await d.send({type:"keyboard",action:"dismiss"}),await W("inspect dismiss",{hideKeyboard:!0},"dismiss keyboard"),console.log(" keyboard dismissed");break}case"double-tap":{let o=Number(i[1]),n=Number(i[2]),r=xe(e,i);if(r){let $=await Ee(d,r);$||(console.error(` not found: ${r.value}`),r.mode==="testid"&&Q("wait-selector-for-missing-testid",r.value),process.exit(1)),o=$.x,n=$.y}let l=i[3]?Number(i[3]):80;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(l))&&(console.error(x("double-tap","<testid> | <x> <y> [gapMs] | --testid <id>")),process.exit(1));let u=Math.max(0,Math.round(l)),f={...await $e(d,{type:"doubleTap",x:o,y:n,gapMs:u}),gapMs:u};f?.ok&&await W("inspect double-tap",{doubleTapAtCoords:{x:o,y:n,gapMs:u}},`double-tap @${o},${n}`),console.log(JSON.stringify(f,null,2));break}case"long-press":{let o=Number(i[1]),n=Number(i[2]),r=xe(e,i),l=null;if(r){let g=await Ee(d,r);g||(console.error(` not found: ${r.value}`),r.mode==="testid"&&Q("wait-selector-for-missing-testid",r.value),process.exit(1)),o=g.x,n=g.y,l={id:g.id??null,testID:g.testID??null,text:g.text??null,type:g.type??null}}let u=r?i[1]:i[3],m=u?Number(u):600;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(m))&&(console.error(x("long-press","<testid> | <x> <y> [durationMs] | --testid <id>")),process.exit(1));let f=Math.max(0,Math.round(m)),$=await d.send({type:"longPress",x:o,y:n,durationMs:f,target:l});$?.ok&&await W("inspect long-press",{tapAtCoords:{x:o,y:n}},`long-press @${o},${n}`),console.log(JSON.stringify($,null,2));break}case"touch":{let o=i[1],n=Number(i[2]),r=Number(i[3]),l=i[4]?Number(i[4]):999,u=o==="down"?"touchDown":o==="move"?"touchMove":o==="up"?"touchUp":o==="cancel"?"touchCancel":null;u||(console.error(x("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1)),o!=="cancel"&&(!Number.isFinite(n)||!Number.isFinite(r))&&(console.error(x("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1));let m=Math.max(1,Math.round(l)),f=await $e(d,u==="touchCancel"?{type:u,pointerId:m}:{type:u,x:n,y:r,pointerId:m});f?.ok&&o!=="cancel"&&await W("inspect touch",{tapAtCoords:{x:n,y:r}},`touch ${o} @${n},${r}`),console.log(JSON.stringify(f,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"],n=i[1],r=i[2]?Number(i[2]):220;(!n||!Number.isFinite(r))&&(console.error(x("gesture","<preset> [durationMs]")),console.error(` presets: ${o.join(", ")}`),process.exit(1)),o.includes(n)||(console.error(` unknown gesture preset: ${n}`),console.error(` presets: ${o.join(", ")}`),process.exit(1));let l=await d.send({type:"evaluate",code:`(async () => {
|
|
659
659
|
const spec = globalThis.__sootsimDeviceSpec || {}
|
|
660
660
|
return {
|
|
661
661
|
width: spec.width || window.innerWidth || 393,
|
|
@@ -663,18 +663,18 @@ ${n}
|
|
|
663
663
|
statusBarHeight: spec.statusBarHeight || 0,
|
|
664
664
|
homeIndicatorHeight: spec.homeIndicatorHeight || 0,
|
|
665
665
|
}
|
|
666
|
-
})()`}),u=Number(
|
|
666
|
+
})()`}),u=Number(l?.width)||393,m=Number(l?.height)||852,f=Number(l?.statusBarHeight)||0,$=Number(l?.homeIndicatorHeight)||0,g=Math.round(u/2),k=Math.round(m/2),L=Math.max(24,f+18),V=Math.max(24,$+18),G=18,Y=Math.min(220,Math.round(m*.24)),E=Math.min(180,Math.round(u*.32)),v=g,T=k,N=g,ne=k;switch(n){case"scroll-up":T=k+Math.round(Y/2),ne=k-Math.round(Y/2);break;case"scroll-down":T=k-Math.round(Y/2),ne=k+Math.round(Y/2);break;case"scroll-left":v=g+Math.round(E/2),N=g-Math.round(E/2);break;case"scroll-right":v=g-Math.round(E/2),N=g+Math.round(E/2);break;case"swipe-from-left-edge":v=G,T=k,N=Math.min(u-G,G+E);break;case"swipe-from-right-edge":v=u-G,T=k,N=Math.max(G,u-G-E);break;case"swipe-from-top-edge":v=g,T=L,ne=Math.min(m-V,L+Y);break;case"swipe-from-bottom-edge":v=g,T=m-V,ne=Math.max(L,m-V-Y);break}let z=Math.max(8,Math.round(r/16)),C=Math.max(1,Math.round(r/z)),ke=await $e(d,{type:"drag",fromX:v,fromY:T,toX:N,toY:ne,steps:z,stepMs:C});ke?.ok&&await W("inspect gesture",{swipe:{start:`${v}, ${T}`,end:`${N}, ${ne}`,duration:Math.max(1,Math.round(r))}},`gesture ${n}`),console.log(JSON.stringify({preset:n,from:{x:v,y:T},to:{x:N,y:ne},result:ke},null,2));break}case"scroll":{let o=xe(e),n=Ms(e),r=o?.mode==="testid"?o.value:n==null?i[1]:null,l=o||n!=null?1:2,u=Number(i[l]),m=Number(i[l+1]);(!r&&n==null||!Number.isFinite(u)||!Number.isFinite(m))&&(console.error(x("scroll","<id> <x> <y> | --testid <id> <x> <y> | --node-id <nodeId> <x> <y>")),process.exit(1));let f=await d.send({type:"evaluate",code:`(async () => {
|
|
667
667
|
const t = window.__sootsimTest
|
|
668
668
|
if (!t) return null
|
|
669
|
-
const n = ${n!=null?`await t.inspectByNodeId(${JSON.stringify(n)})`:`await t.findByTestId(${JSON.stringify(
|
|
670
|
-
|| await t.findById(${JSON.stringify(
|
|
669
|
+
const n = ${n!=null?`await t.inspectByNodeId(${JSON.stringify(n)})`:`await t.findByTestId(${JSON.stringify(r)})
|
|
670
|
+
|| await t.findById(${JSON.stringify(r)})`}
|
|
671
671
|
if (!n || !n.absolutePosition || !n.layout) return null
|
|
672
672
|
return {
|
|
673
673
|
cx: n.absolutePosition.x + (n.layout.width || 0) / 2,
|
|
674
674
|
cy: n.absolutePosition.y + (n.layout.height || 0) / 2,
|
|
675
675
|
}
|
|
676
|
-
})()`})
|
|
677
|
-
${
|
|
676
|
+
})()`}),$=await X(d,"scrollTo",n!=null?{nodeId:n}:r,u,m,!1);if($?.ok){let g=n!=null?`node ${n}`:`#${r}`;await W("inspect scroll",{scrollTo:{...n!=null?{nodeId:n}:{id:r},x:u,y:m}},`scroll ${g} -> ${u},${m}`)}console.log(JSON.stringify({...$,...f?{at:{x:f.cx,y:f.cy}}:{}},null,2));break}case"state":{let o=i[1];if(s==="get"&&!o){let r=await X(d,"getRuntimeState"),l=await d.send({type:"evaluate",code:Te});if(r&&typeof r=="object"&&r.diagnostics&&(r.diagnostics.errors=l?.errors??0,r.diagnostics.warnings=l?.warnings??0),r&&typeof r=="object"&&r.shell==null)try{let u=await ue(d);u&&(r.shell=u)}catch{}console.log(JSON.stringify(r,null,2));break}if(!o||o==="--help"||o==="-h"){console.log(`
|
|
677
|
+
${h("state")} \u2014 dump raw runtime state
|
|
678
678
|
|
|
679
679
|
subcommands:
|
|
680
680
|
shell dump shell transition/layout state
|
|
@@ -692,17 +692,17 @@ ${n}
|
|
|
692
692
|
gesture-seam dump shell-hosted gesture recognizer state/events
|
|
693
693
|
|
|
694
694
|
examples:
|
|
695
|
-
${
|
|
696
|
-
${
|
|
697
|
-
${
|
|
698
|
-
${
|
|
699
|
-
${
|
|
700
|
-
${
|
|
701
|
-
${
|
|
702
|
-
${
|
|
703
|
-
${
|
|
704
|
-
${
|
|
705
|
-
${
|
|
695
|
+
${h("state")} shell
|
|
696
|
+
${h("state")} worker
|
|
697
|
+
${h("state")} keyboard
|
|
698
|
+
${h("state")} ownership
|
|
699
|
+
${h("state")} worklets
|
|
700
|
+
${h("state")} scroll-input
|
|
701
|
+
${h("state")} scroll-mirror
|
|
702
|
+
${h("state")} node photos
|
|
703
|
+
${h("state")} scroll feed
|
|
704
|
+
${h("state")} scroll-hit 360 420
|
|
705
|
+
${h("state")} hit 200 720
|
|
706
706
|
`);break}let n;switch(o){case"shell":n=await ue(d,500);break;case"worker":n=await ce(d,"__sootsimRenderHost.queryStats");break;case"ownership":n=await d.send({type:"evaluate",code:`(() => {
|
|
707
707
|
const h = window.__sootsimRenderHost
|
|
708
708
|
if (!h || typeof h.getOwnershipSnapshot !== 'function') {
|
|
@@ -737,8 +737,8 @@ ${n}
|
|
|
737
737
|
text: secureTextEntry ? ${JSON.stringify(Z)} : (focused.text || null),
|
|
738
738
|
} : null,
|
|
739
739
|
}
|
|
740
|
-
})()`}),n=tt(n);break;case"node":{let i
|
|
741
|
-
${
|
|
740
|
+
})()`}),n=tt(n);break;case"node":{let r=i[2];r||(console.error(` usage: ${h("state")} node <id>`),process.exit(1)),n=await X(d,"findByTestId",r)||await X(d,"findById",r);break}case"scroll":{let r=i[2];r||(console.error(` usage: ${h("state")} scroll <id>`),process.exit(1)),n=await X(d,"getScrollState",r);break}case"scroll-hit":{let r=Number(i[2]),l=Number(i[3]);(!Number.isFinite(r)||!Number.isFinite(l))&&(console.error(` usage: ${h("state")} scroll-hit <x> <y>`),process.exit(1)),n=await X(d,"getScrollStateAt",r,l);break}case"hit":{let r=Number(i[2]),l=Number(i[3]);(!Number.isFinite(r)||!Number.isFinite(l))&&(console.error(` usage: ${h("state")} hit <x> <y>`),process.exit(1)),n=await X(d,"debugHitAt",r,l);break}case"gesture":{let r=Number(i[2]),l=Number(i[3]);(!Number.isFinite(r)||!Number.isFinite(l))&&(console.error(` usage: ${h("state")} gesture <x> <y>`),process.exit(1)),n=await X(d,"debugGestureAt",r,l);break}case"gesture-seam":n=await ce(d,"SootSim.bridges.mainShell.callTestBridge","getShellGestureSeamDebug");break;case"worklets":{let[r,l]=await Promise.all([X(d,"getWorkletSlotStats"),ce(d,"SootSim.bridges.mainShell.callTestBridge","getWorkletSlotStats")]);n={tenant:r,shell:l};break}case"scroll-input":n=await ce(d,"SootSim.bridges.mainShell.callTestBridge","getShellScrollInputDebug");break;case"scroll-mirror":n=await ce(d,"SootSim.bridges.mainShell.callTestBridge","getScrollMirrorDebug");break;default:console.error(` unknown state subcommand: ${o}`),process.exit(1)}console.log(JSON.stringify(n,null,2));break}case"shell":{let o=i[1];if(!o||o==="--help"||o==="-h"){console.log(`
|
|
741
|
+
${h("shell")} \u2014 run built-in shell commands
|
|
742
742
|
|
|
743
743
|
subcommands:
|
|
744
744
|
launch <appId> [waitMs] [--clear-state]
|
|
@@ -753,15 +753,15 @@ ${n}
|
|
|
753
753
|
shake trigger the simulator shake gesture
|
|
754
754
|
|
|
755
755
|
examples:
|
|
756
|
-
${
|
|
757
|
-
${
|
|
758
|
-
${
|
|
759
|
-
${
|
|
760
|
-
${
|
|
761
|
-
${
|
|
762
|
-
${
|
|
763
|
-
${
|
|
764
|
-
`);break}let n=o==="launch"||o==="open-card"||o==="home"||o==="switcher",
|
|
756
|
+
${h("shell")} launch photos
|
|
757
|
+
${h("shell")} launch rn --clear-state
|
|
758
|
+
${h("shell")} launch photos 1500
|
|
759
|
+
${h("shell")} home 500
|
|
760
|
+
${h("shell")} switcher 800
|
|
761
|
+
${h("shell")} open-card clock 800
|
|
762
|
+
${h("shell")} appearance dark
|
|
763
|
+
${h("shell")} lock
|
|
764
|
+
`);break}let n=o==="launch"||o==="open-card"||o==="home"||o==="switcher",r=o==="launch"||o==="open-card"?i[3]:i[2],l=r?Number(r):350;n&&(!Number.isFinite(l)||l<0)&&(console.error(x("shell",o==="launch"||o==="open-card"?"<launch|open-card> <appId> [settleMs]":"<home|switcher> [settleMs]")),process.exit(1));let u=!1,m=!1,f=null,$=e.includes("--clear-state");if(o==="launch"){let g=i[2];g||(console.error(x("shell","launch <appId> [settleMs] [--clear-state]")),process.exit(1)),$&&await d.send({type:"evaluate",code:He(!0)}),u=!!await ye(d,"launchApp",l,g),{settled:m,state:f}=await _e(d,Math.round(l),k=>!!k&&k.state==="app"&&k.activeApp===g&&k.showSwitcher===!1&&k.switcherPhase==="idle"&&typeof k.launchProgress=="number"&&k.launchProgress>=.98),u&&await W("inspect shell launch",$?{launchApp:{clearState:!0}}:{launchApp:{}},$?"launch app (clear state)":"launch app")}else if(o==="home")u=!!await ye(d,"goHome",l),{settled:m,state:f}=await _e(d,Math.round(l),g=>!!g&&g.state==="home"&&g.activeApp==null&&g.showSwitcher===!1&&g.switcherPhase==="idle"&&typeof g.launchProgress=="number"&&g.launchProgress>=.98);else if(o==="switcher")u=!!await ye(d,"openSwitcher",l),{settled:m,state:f}=await _e(d,Math.round(l),g=>!!g&&g.state==="app"&&g.showSwitcher===!0&&g.switcherPhase==="idle"&&typeof g.zoomLevel=="number"&&Math.abs(g.zoomLevel)<=.02&&typeof g.horizontalZoom=="number"&&Math.abs(g.horizontalZoom)<=.02),m&&(await oe(Ss),f=await ue(d));else if(o==="open-card"){let g=i[2];g||(console.error(x("shell","open-card <appId> [settleMs]")),process.exit(1)),u=!!await ye(d,"openSwitcherCard",l,g),{settled:m,state:f}=await _e(d,Math.round(l),k=>!!k&&k.state==="app"&&k.activeApp===g&&k.showSwitcher===!1&&k.switcherPhase==="idle"&&typeof k.zoomLevel=="number"&&k.zoomLevel>=.98&&typeof k.horizontalZoom=="number"&&k.horizontalZoom>=.98),u&&await W("inspect shell open-card",{openSwitcherCard:{appId:g}},`open switcher card ${g}`)}else if(o==="appearance"){let g=i[2];(!g||!["light","dark","auto","toggle"].includes(g))&&(console.error(x("shell","appearance <light|dark|auto|toggle>")),process.exit(1));let k=await Io(d,"appearance",g);if(u=!!k?.ok,f={appearance:k},u){let L=k?.applied??g;console.log(` appearance: ${L}`)}}else if(o==="lock"||o==="shake"){let g=await Io(d,o);u=!!g?.ok,f={[o]:g}}else console.error(` unknown shell subcommand: ${o}`),process.exit(1);console.log(JSON.stringify({ok:u,settled:m,state:f},null,2));break}case"url":{await co(d,{args:a});break}case"reload":{let r=!1,l=!1;try{await d.send({type:"evaluate",code:"window.__sootsimConsole?.clear()"});let f=await d.send({type:"evaluate",code:`;(async () => {
|
|
765
765
|
// in-place guest reload is only valid while the page still runs
|
|
766
766
|
// the engine build the server would serve NOW. the shell dev
|
|
767
767
|
// server has no HMR client, so a long-lived sim tab otherwise
|
|
@@ -785,13 +785,13 @@ ${n}
|
|
|
785
785
|
}
|
|
786
786
|
window.location.reload()
|
|
787
787
|
return { kind: 'page', engineStale }
|
|
788
|
-
})()`});
|
|
789
|
-
\u26A0 ${
|
|
790
|
-
`);for(let
|
|
791
|
-
`).slice(0,2);for(let L of k)console.log(` ${L.trim()}`)}}}}catch{}
|
|
788
|
+
})()`});l=!!f&&f.kind==="external-app",r=!0,f&&f.engineStale&&console.log(" engine build changed since page load \u2014 full page reload")}catch{}console.log(" reloading...");let u=d,m=null;if(l)m=await Ne(d,{timeoutMs:1e4,errorGraceMs:3e3});else{r&&await oe(300);let $=await Et(F,O,M,{timeoutMs:3e4,simIdSource:_});$?(u=$,m=await Ne($,{timeoutMs:3e4,errorGraceMs:3e3})):(console.log(" \u26A0 reload: bridge never reconnected within 30000ms"),u=null)}if(m)if(m.ready){let f=m.source==="nodes-fallback"?" (no ready signal, node-count fallback)":"";console.log(` ready in ${m.elapsedMs}ms: ${m.nodes} nodes${f}`)}else if(m.source==="error-bail")console.log(` \u26A0 reload bailed after ${m.elapsedMs}ms: ${m.errors} console error(s), ready signal never fired`);else{let f=bo(m);console.log(` \u26A0 reload timed out after ${m.elapsedMs}ms \u2014 ${f} (nodes: ${m.nodes}, targets: ${m.targets}, errors: ${m.errors})`)}if(u)try{let f=await ge(u,10);if(u!==d&&u.close(),Array.isArray(f)&&f.length>0){console.log(`
|
|
789
|
+
\u26A0 ${f.length} error(s) during mount:
|
|
790
|
+
`);for(let $ of f){let g=$.args.map(k=>typeof k=="object"?JSON.stringify(k):k).join(" ");if(console.log(` ${g}`),$.stack){let k=$.stack.split(`
|
|
791
|
+
`).slice(0,2);for(let L of k)console.log(` ${L.trim()}`)}}}}catch{}m&&!m.ready&&(process.exitCode=1);break}case"storage-clear":{if(await We(d),await d.send({type:"evaluate",code:He(!0)})!==!0){B(a)?D({cleared:!1,ready:!1,error:"external app reload bridge is unavailable"}):console.error(" storage clear failed: external app reload bridge is unavailable"),process.exitCode=1;break}let l=await Ne(d,{timeoutMs:1e4,errorGraceMs:3e3});if(B(a)){D({cleared:!0,ready:l.ready,reload:l}),l.ready||(process.exitCode=1);break}if(l.ready){let u=l.source==="nodes-fallback"?" (no ready signal, node-count fallback)":"";console.log(` cleared tenant storage; ready in ${l.elapsedMs}ms: ${l.nodes} nodes${u}`)}else if(l.source==="error-bail")console.log(` \u26A0 storage clear reloaded but bailed after ${l.elapsedMs}ms: ${l.errors} console error(s), ready signal never fired`);else{let u=bo(l);console.log(` \u26A0 storage clear reloaded but timed out after ${l.elapsedMs}ms \u2014 ${u} (nodes: ${l.nodes}, targets: ${l.targets}, errors: ${l.errors})`)}try{let u=await ge(d,10);if(Array.isArray(u)&&u.length>0){console.log(`
|
|
792
792
|
\u26A0 ${u.length} error(s) during mount:
|
|
793
|
-
`);for(let
|
|
794
|
-
`).slice(0,2);for(let
|
|
793
|
+
`);for(let m of u){let f=m.args.map($=>typeof $=="object"?JSON.stringify($):$).join(" ");if(console.log(` ${f}`),m.stack){let $=m.stack.split(`
|
|
794
|
+
`).slice(0,2);for(let g of $)console.log(` ${g.trim()}`)}}}}catch{}l.ready||(process.exitCode=1);break}case"eval":case"js":{let o=i.slice(1).join(" ");if(o||(console.error(x("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(` ${h("js")} SootSim.bridges.test.findByText("Sign in")`),console.error(` ${h("js")} SootSim.bridges.debug.snapshot("before")`),console.error(` ${h("js")} SootSim.bridges.keyboard.type("hello")`),console.error(` ${h("js")} SootSim.state.root.children.length`),process.exit(1)),e.includes("--tenant")){let m=i.slice(1).filter($=>$!=="--tenant").join(" "),f=await d.send({type:"evaluate",code:`(async () => SootSim.bridges.test.evalInTenant(${JSON.stringify(m)}))()`});console.log(JSON.stringify(f,null,2));break}let n=o;n.startsWith("(async")||(n=`(async () => ${n})()`);let r=await d.send({type:"evaluate",code:n});console.log(JSON.stringify(r,null,2));let l=o.toLowerCase(),u=[];(l.includes("sootsim:gohome")||l.includes("gohome"))&&u.push("rnxsim shell home"),(l.includes("sootsim:appswitcher")||l.includes("appswitcher"))&&u.push("rnxsim shell switcher"),(l.includes("keyboard.isvisible")||l.includes("keyboard.getmode"))&&u.push("rnxsim debug state keyboard"),l.includes("interact.tap")&&u.push("rnxsim do tap <x> <y>"),l.includes("keyboard.type")&&u.push("rnxsim do type <text>"),(l.includes("keyboard.press")||l.includes("keyboard.dispatchkey"))&&u.push("rnxsim do key <name>"),l.includes("keyboard.dismiss")&&u.push("rnxsim do dismiss"),l.includes("dumptree")&&u.push("rnxsim get tree"),l.includes("dumpaccessibilitytree")&&u.push("rnxsim get a11y"),l.includes("getnodecount")&&u.push("rnxsim get count"),l.includes("findbytext")&&u.push("rnxsim find <text>"),(l.includes("findbytestid")||l.includes("findbyid"))&&u.push("rnxsim find --testid <id>"),l.includes("document.hidden")&&u.push("rnxsim debug state keyboard (includes tab health)"),u.length>0&&Q("prefer-cli-over-eval",u);break}case"globals":{let o=await d.send({type:"evaluate",code:`(async () => {
|
|
795
795
|
const globals = {}
|
|
796
796
|
|
|
797
797
|
// test bridge (proxy in worker mode)
|
|
@@ -829,8 +829,8 @@ ${n}
|
|
|
829
829
|
|
|
830
830
|
return globals
|
|
831
831
|
})()`});console.log(` rnx JS API:
|
|
832
|
-
`);for(let[n,
|
|
833
|
-
${
|
|
832
|
+
`);for(let[n,r]of Object.entries(o)){console.log(` ${n}:`);for(let l of r)console.log(` .${l}`);console.log("")}console.log(` use: ${h("js")} <expression>`),console.log(` example: ${h("js")} test.findByText("Sign in")`);break}case"describe":{await Qt({bridge:d,args:e,positional:i});break}case"perf":{b==="debug"&&!t.internalPerfCommand&&(console.error(" `rnxsim debug perf` was removed. use `rnxsim perf shell ...`."),process.exit(1));let o=i[1];if(t.internalPerfCommand==="scroll"){if(!o||o==="--help"||o==="-h"){console.log(`
|
|
833
|
+
${h("perf")} <start|stop> [options]
|
|
834
834
|
|
|
835
835
|
records per-frame scroll offsets from the tenant worker, shell worker,
|
|
836
836
|
and compositor worker. timestamps use the shared wall clock, while frame
|
|
@@ -841,22 +841,22 @@ ${n}
|
|
|
841
841
|
--json emit every per-frame sample on stop
|
|
842
842
|
|
|
843
843
|
examples:
|
|
844
|
-
${
|
|
844
|
+
${h("perf")} start
|
|
845
845
|
# ... perform consecutive swipes ...
|
|
846
|
-
${
|
|
847
|
-
${
|
|
848
|
-
`);break}if(o==="start"){let n=
|
|
846
|
+
${h("perf")} stop
|
|
847
|
+
${h("perf")} stop --json
|
|
848
|
+
`);break}if(o==="start"){let n=a.find((u,m)=>a[m-1]==="--limit"),r=n===void 0?6e3:Number(n);(!Number.isFinite(r)||r<120)&&(console.error(" error: --limit must be a number of at least 120"),process.exit(1));let l=await d.send({type:"evaluate",code:`(async () => {
|
|
849
849
|
const perf = window.SootSim?.bridges?.scrollPerf
|
|
850
850
|
if (!perf) return { error: 'scroll performance profile unavailable' }
|
|
851
|
-
await perf.start(${Math.floor(
|
|
851
|
+
await perf.start(${Math.floor(r)})
|
|
852
852
|
return { started: true }
|
|
853
|
-
})()`});
|
|
853
|
+
})()`});l?.error&&(console.error(` error: ${l.error}`),process.exit(1)),console.log(` scroll profiling started: perform consecutive swipes, then run '${h("perf")} stop'`);break}if(o==="stop"){let n=await d.send({type:"evaluate",code:`(async () => {
|
|
854
854
|
const perf = window.SootSim?.bridges?.scrollPerf
|
|
855
855
|
if (!perf) return { error: 'scroll performance profile unavailable' }
|
|
856
856
|
return await perf.stop()
|
|
857
|
-
})()`});n?.error&&(console.error(` error: ${n.error}`),process.exit(1));let
|
|
858
|
-
`),console.log(` duration: ${
|
|
859
|
-
${
|
|
857
|
+
})()`});n?.error&&(console.error(` error: ${n.error}`),process.exit(1));let r=n;if(B(a)){D(r);break}console.log(` scroll performance trace:
|
|
858
|
+
`),console.log(` duration: ${r.stoppedAt-r.startedAt}ms (worker series are timestamp-aligned, not frame-paired)`),console.log(` samples: tenant ${r.layers.tenant.length} \xB7 shell ${r.layers.shell.length} \xB7 compositor ${r.layers.compositor.length}`),console.log(""),console.log(" offset and phase changes (--json includes every per-frame sample):"),console.log(" t(ms) layer surface node offsetY slotY phase paint");let l=[];for(let u of Object.values(r.layers)){let m=new Map;for(let f of u){let $=`${f.surfaceId}:${f.nodeId}`,g=`${f.offsetY}:${f.slotY??""}:${f.phase??""}`;m.get($)!==g&&(m.set($,g),l.push(f))}}l.sort((u,m)=>u.t-m.t||u.seq-m.seq);for(let u of l)console.log(` ${String(u.t-r.startedAt).padStart(5)} ${u.layer.padEnd(10)} ${u.surfaceId.padEnd(8)} ${String(u.nodeId).padStart(5)} ${u.offsetY.toFixed(2).padStart(8)} ${u.slotY===void 0?" -":u.slotY.toFixed(2).padStart(8)} ${(u.phase??"-").padEnd(8)} ${u.paint===void 0?"-":u.paint}`);break}console.error(` unknown scroll perf command: ${o}`),process.exit(1)}if(!o||o==="--help"||o==="-h"){console.log(`
|
|
859
|
+
${h("perf")} \u2014 shell frame profiling (the worker that paints)
|
|
860
860
|
|
|
861
861
|
records per-painted-frame timing in the shell worker \u2014 the surface that
|
|
862
862
|
actually draws the app's pixels \u2014 merged with render-profile counters
|
|
@@ -870,24 +870,24 @@ ${n}
|
|
|
870
870
|
stop and transition accept --json for the full machine-readable payload.
|
|
871
871
|
|
|
872
872
|
examples:
|
|
873
|
-
${
|
|
873
|
+
${h("perf")} start
|
|
874
874
|
# ... interact with the app ...
|
|
875
|
-
${
|
|
876
|
-
${
|
|
877
|
-
${
|
|
875
|
+
${h("perf")} stop
|
|
876
|
+
${h("perf")} stop --json
|
|
877
|
+
${h("perf")} transition goHome
|
|
878
878
|
`);break}switch(o){case"start":{let n=await d.send({type:"evaluate",code:`(() => {
|
|
879
879
|
if (!window.__sootsimShellPerf) {
|
|
880
880
|
return { error: 'shell frame profile unavailable (__sootsimShellPerf missing on the page)' }
|
|
881
881
|
}
|
|
882
882
|
window.__sootsimShellPerf.start()
|
|
883
883
|
return { started: true }
|
|
884
|
-
})()`});n?.error&&(console.error(` error: ${n.error}`),process.exit(1)),console.log(` shell profiling started \u2014 interact with the app, then run '${
|
|
884
|
+
})()`});n?.error&&(console.error(` error: ${n.error}`),process.exit(1)),console.log(` shell profiling started \u2014 interact with the app, then run '${h("perf")} stop'`);break}case"stop":{let n=await d.send({type:"evaluate",code:`(async () => {
|
|
885
885
|
if (!window.__sootsimShellPerf) {
|
|
886
886
|
return { error: 'shell frame profile unavailable (__sootsimShellPerf missing on the page)' }
|
|
887
887
|
}
|
|
888
888
|
return await window.__sootsimShellPerf.stop()
|
|
889
|
-
})()`});if(n?.error&&(console.error(` error: ${n.error}`),n.error==="timeout"&&console.error(" (shell worker did not answer within 5s \u2014 is a sim loaded?)"),process.exit(1)),
|
|
890
|
-
${
|
|
889
|
+
})()`});if(n?.error&&(console.error(` error: ${n.error}`),n.error==="timeout"&&console.error(" (shell worker did not answer within 5s \u2014 is a sim loaded?)"),process.exit(1)),B(a)){D(n);break}ko(n);break}case"transition":{let n=i[2];if(!n||!["goHome","appSwitcher","lockScreen"].includes(n)){console.log(`
|
|
890
|
+
${h("perf")} transition <event> \u2014 profile a shell transition
|
|
891
891
|
|
|
892
892
|
events:
|
|
893
893
|
goHome swipe-to-home animation
|
|
@@ -897,43 +897,43 @@ ${n}
|
|
|
897
897
|
note: uses 600ms capture window \u2014 may need --timeout 10000 flag
|
|
898
898
|
|
|
899
899
|
examples:
|
|
900
|
-
${
|
|
901
|
-
${
|
|
902
|
-
`);break}let
|
|
900
|
+
${h("perf")} transition goHome --timeout 10000
|
|
901
|
+
${h("perf")} transition appSwitcher
|
|
902
|
+
`);break}let l=`sootsim:${n}`;Me(` profiling ${n} transition...`),Me(" (use --timeout 10000 if this times out)");let u=await d.send({type:"evaluate",code:`(async () => {
|
|
903
903
|
if (!window.__sootsimShellPerf) {
|
|
904
904
|
return { error: 'shell frame profile unavailable (__sootsimShellPerf missing on the page)' }
|
|
905
905
|
}
|
|
906
906
|
window.__sootsimShellPerf.start()
|
|
907
907
|
// give a frame for profiling to engage before the event
|
|
908
908
|
await new Promise(r => requestAnimationFrame(() => r(undefined)))
|
|
909
|
-
window.dispatchEvent(new Event('${
|
|
909
|
+
window.dispatchEvent(new Event('${l}'))
|
|
910
910
|
// shell animations are ~300-500ms; fixed timing avoids complex
|
|
911
911
|
// animation-end detection
|
|
912
912
|
await new Promise(r => setTimeout(r, 600))
|
|
913
913
|
return await window.__sootsimShellPerf.stop()
|
|
914
|
-
})()`});if(u?.error&&(console.error(` error: ${u.error}`),process.exit(1)),
|
|
915
|
-
`);for(let
|
|
916
|
-
`).slice(0,3);for(let
|
|
917
|
-
`);for(let
|
|
918
|
-
`);for(let n of o){let
|
|
919
|
-
`);for(let
|
|
914
|
+
})()`});if(u?.error&&(console.error(` error: ${u.error}`),process.exit(1)),B(a)){D(u);break}Me(` ${n} transition profiled:`),ko(u);break}default:console.error(` unknown perf subcommand: ${o}`),console.error(" valid: start, stop, transition"),/^--?reset$/.test(o)&&console.error(" note: 'perf start' already clears prior frames \u2014 no reset needed"),(o==="stats"||o==="frames"||o==="worst")&&(console.error(" note: the tenant sampler (stats/frames/worst) was removed \u2014 it hardcoded"),console.error(" layout/render/copy to zero because the shell worker owns every real paint."),console.error(" use 'perf start' / 'perf stop' (worst frames are in the stop report).")),process.exit(1)}break}case"errors":{let o=i[1];if(o==="clear"){await We(d),B(a)?D({cleared:!0}):console.log(" error buffer cleared");break}let n=o?Number(o):20,r=await ge(d,n);if(B(a)){D(r);break}if(r.length===0){console.log(" no errors captured");break}console.log(` ${r.length} error(s):
|
|
915
|
+
`);for(let l of r){let u=ae(l.timestamp),m=l.args.map(f=>typeof f=="object"?JSON.stringify(f):f).join(" ");if(console.log(` [${u}] ${m}`),l.stack){let f=l.stack.split(`
|
|
916
|
+
`).slice(0,3);for(let $ of f)console.log(` ${$.trim()}`)}}break}case"warnings":{let o=i[1]?Number(i[1]):20,n=await vt(d,o);if(B(a)){D(n);break}if(n.length===0){console.log(" no warnings captured");break}console.log(` ${n.length} warning(s):
|
|
917
|
+
`);for(let r of n){let l=ae(r.timestamp),u=r.args.map(m=>typeof m=="object"?JSON.stringify(m):m).join(" ");console.log(` [${l}] ${u}`)}break}case"animations":{let o=await X(d,"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):
|
|
918
|
+
`);for(let n of o){let r=String(n.realm??"tenant").padEnd(6),l=String(n.kind).padEnd(10),u=typeof n.from=="number"&&typeof n.to=="number"?`${n.from.toFixed(2)}\u2192${n.to.toFixed(2)}`:"\u2014",m=Number(n.current??0).toFixed(2),f=typeof n.progress=="number"?`${Math.round(n.progress*100)}%`:"\u2014",$=`${Math.round(n.elapsedMs??0)}ms`,g=[n.loop?"loop":null,n.layoutBound?"layout":null,n.remoteDriven?"remote-driven":n.graphBacked?"graph":null,n.visible===!1?"offscreen":null].filter(Boolean),k=g.length>0?` [${g.join(" ")}]`:"";console.log(` #${n.id} ${r} ${l} ${u.padEnd(14)} cur=${m.padEnd(7)} ${f.padStart(4)} ${$}${k}`)}break}case"animation":{let o=i[1];(!o||o==="--help"||o==="-h")&&(console.error(` usage: ${h("animation")} <id>`),process.exit(1));let n=Number(o);Number.isFinite(n)||(console.error(` invalid id: ${o}`),process.exit(1));let r=await X(d,"getAnimation",n);console.log(JSON.stringify(r,null,2));break}case"stop-animation":{let o=i[1];(!o||o==="--help"||o==="-h")&&(console.error(` usage: ${h("stop-animation")} <id|all>`),process.exit(1));let n=o==="all"?"all":Number(o);n!=="all"&&!Number.isFinite(n)&&(console.error(` invalid id: ${o}`),process.exit(1));let r=await X(d,"stopAnimation",n);console.log(` stopped ${r??0} animation(s)`);break}case"requests":{let o=i[1];if(o==="clear"){await It(d),B(a)?D({cleared:!0}):console.log(" request buffer cleared");break}let n=o==="all",r=n?i[2]:o,l=r?Number(r):20,u=await kt(d,{failed:!n,limit:l});if(B(a)){D(u);break}if(u.length===0){console.log(n?" no requests captured":" no failed requests captured");break}console.log(` ${u.length} ${n?"request(s)":"failed request(s)"}:
|
|
919
|
+
`);for(let m of u){let f=ae(m.timestamp);console.log(` [${f}] ${U(m)}`),m.responseBody?console.log(` ${m.responseBody}`):m.error&&console.log(` ${m.error}`)}break}case"network":{let o=i[1],n=null,r=null,l=!1,u=!1,m=1e3,f=!1,$=!1;for(let E=0;E<a.length;E++){let v=a[E];if(v==="--filter")n=a[E+1]??null,E++;else if(v==="--limit"){let T=Number(a[E+1]);Number.isFinite(T)&&(r=T),E++}else if(v==="--threshold"){let T=Number(a[E+1]);Number.isFinite(T)&&T>0&&(m=T),E++}else v==="--failed"?l=!0:v==="--slow"?u=!0:v==="--tail"||v==="-f"?f=!0:v==="--json"&&($=!0)}if(o==="clear"){await d.send({type:"evaluate",code:'window.__sootsimObservability?.network.clear(); "cleared"'}),console.log(" network buffer cleared");break}if(o==="get"){let E=i[2];E||(console.error(" usage: rnxsim network get <id>"),process.exit(1));let v=await d.send({type:"evaluate",code:`(() => {
|
|
920
920
|
const obs = window.__sootsimObservability;
|
|
921
921
|
if (!obs) return null;
|
|
922
922
|
return obs.network.getSnapshot().find(e => e.id === ${JSON.stringify(E)}) || null;
|
|
923
|
-
})()`});
|
|
923
|
+
})()`});v||(console.error(` no entry with id ${E}`),process.exit(1)),$?console.log(JSON.stringify(v,null,2)):ws(v);break}let g=r??(f?200:o?Number(o):20);Number.isFinite(g)||(console.error(` invalid limit: ${o} \u2014 \`network\` takes a numeric count (e.g. ${h("network")} 100).
|
|
924
924
|
to target a specific sim, use \`--sim ${o}\` instead.`),process.exit(1));let k=async()=>{let E=await d.send({type:"evaluate",code:`(() => {
|
|
925
925
|
const obs = window.__sootsimObservability;
|
|
926
926
|
if (!obs) return { ok: false };
|
|
927
927
|
return { ok: true, entries: obs.network.getSnapshot() };
|
|
928
|
-
})()`});if(!E||!E.ok)throw new Error("observability bridge not installed \u2014 is the engine running?");return E.entries??[]},L=E=>{let
|
|
929
|
-
`:` ${
|
|
930
|
-
`);for(let T of
|
|
931
|
-
`);let V=new Set,G=!0,Y=()=>{G=!1};process.on("SIGINT",Y);try{for(;G;){let E=await k(),
|
|
932
|
-
to target a specific sim, use \`--sim ${o}\` instead.`),process.exit(1));let L=()=>Tt(d),V=
|
|
933
|
-
`);for(let
|
|
934
|
-
`);let G=new Set,Y=!0,E=()=>{Y=!1};process.on("SIGINT",E);try{for(;Y;){let
|
|
928
|
+
})()`});if(!E||!E.ok)throw new Error("observability bridge not installed \u2014 is the engine running?");return E.entries??[]},L=E=>{let v=E;if(l&&(v=v.filter(T=>!!T.error||T.status!=null&&T.status>=400)),u&&(v=v.filter(T=>T.durationMs!=null&&T.durationMs>=m)),n){let T=n.toLowerCase();v=v.filter(N=>(N.displayUrl||N.url).toLowerCase().includes(T))}return u&&!f&&(v=[...v].sort((T,N)=>(N.durationMs??0)-(T.durationMs??0))),v};if(!f){let E=await k(),v=L(E).slice(-g);if($){console.log(JSON.stringify(v,null,2));break}if(v.length===0){E.length===0?console.log(" no network requests captured"):console.log(u?` no requests slower than ${m}ms (${E.length} total \u2014 try --threshold <ms>)`:" no matching requests");break}console.log(u?` ${v.length} request(s) slower than ${m}ms (sorted by duration desc):
|
|
929
|
+
`:` ${v.length} request(s):
|
|
930
|
+
`);for(let T of v)wo(T);break}console.log(` tailing network (ctrl-c to stop)...
|
|
931
|
+
`);let V=new Set,G=!0,Y=()=>{G=!1};process.on("SIGINT",Y);try{for(;G;){let E=await k(),v=L(E);for(let T of v)T.durationMs!=null&&(V.has(T.id)||(V.add(T.id),$?console.log(JSON.stringify(T)):wo(T)));await oe(250)}}finally{process.off("SIGINT",Y)}break}case"logs":{let o=i[1],n=null,r=null,l=null,u=!1,m=!1,f=!1;for(let v=0;v<a.length;v++){let T=a[v];if(T==="--filter")n=a[v+1]??null,v++;else if(T==="--limit"){let N=Number(a[v+1]);Number.isFinite(N)&&(r=N),v++}else T==="--level"?(l=a[v+1]??null,v++):T==="--tail"||T==="-f"?u=!0:T==="--json"?m=!0:(T==="--internal"||T==="--all")&&(f=!0)}let $=l?new Set(l.split(",").map(v=>v.trim()).filter(v=>v==="log"||v==="info"||v==="warn"||v==="error"||v==="debug")):null;if(o==="clear"){await Mt(d),console.log(" log buffer cleared");break}let g=!m&&process.stdout.isTTY===!0,k=r??(u?500:o?Number(o):50);Number.isFinite(k)||(console.error(` invalid limit: ${o} \u2014 \`logs\` takes a numeric count (e.g. ${h("logs")} 100).
|
|
932
|
+
to target a specific sim, use \`--sim ${o}\` instead.`),process.exit(1));let L=()=>Tt(d),V=v=>Nt(v,{level:$,filter:n,showInternal:f});if(!u){let v=await L(),T=V(v).slice(-k);if(m){console.log(JSON.stringify(T,null,2));break}if(T.length===0){console.log(v.length===0?" no logs captured":" no matching logs");break}console.log(` ${T.length} log(s):
|
|
933
|
+
`);for(let N of T)$o(N,g);break}console.log(` tailing logs (ctrl-c to stop)...
|
|
934
|
+
`);let G=new Set,Y=!0,E=()=>{Y=!1};process.on("SIGINT",E);try{for(;Y;){let v=await L(),T=V(v);for(let N of T)G.has(N.id)||(G.add(N.id),m?console.log(JSON.stringify(N)):$o(N,g));await oe(250)}}finally{process.off("SIGINT",E)}break}default:console.error(` unknown subcommand: ${p}`),process.exit(1)}if(j.has(p)&&!e.includes("--no-wait")&&process.env.SOOTSIM_NO_AUTO_WAIT!=="1"&&!await pt(d,p)&&await I(d),S.length>0&&ee(S),!P.has(p))try{await Se(d)}catch{}}catch(S){let o=S instanceof Error?S.message:String(S);console.error(` ${p??"inspect"} failed: ${o}`);let n=/^no sim connected with id ([^;]+)(?:; connected sims: .+)?$/.exec(o),r=/^command timed out after (\d+)s$/.exec(o),l=o.startsWith("sim disconnected:")||o.startsWith("bridge never reconnected")||o.startsWith("could not connect to ws://");if(n)await jt(d,F,n[1]);else if(/^no sim connected$/.test(o))Ct(F);else if(r)if(await fs(d)){let m=p??"describe";process.stderr.write(` the sim is still responsive \u2014 '${m}' just exceeded the ${r[1]}s command budget.
|
|
935
935
|
the screen's node tree is large; narrow the query or raise the budget:
|
|
936
|
-
rnxsim ${
|
|
936
|
+
rnxsim ${m} --testid <id> # scope to one subtree
|
|
937
937
|
rnxsim find --testid <id> # targeted single-node lookup
|
|
938
|
-
rnxsim ${
|
|
939
|
-
`)}else ho();else if(
|
|
938
|
+
rnxsim ${m} --timeout 60000 # raise per-command budget (ms)
|
|
939
|
+
`)}else ho();else if(l)ho();else{try{await At(d)}catch{}try{await te({includeTail:!0})}catch{}try{await K({includeTail:!0})}catch{}}process.exit(1)}finally{d.close()}}export{He as a,_o as b,Os as c,Bs as d,Cs as e,js as f,qs as g,se as h,ko as i,Er as j};
|