rnxsim 0.1.318 → 0.1.320
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/detox.ts +16 -5
- package/cli/commands/inspect.ts +35 -8
- package/cli/commands/maestro.ts +1 -1
- package/detox/index.ts +155 -15
- package/dist-cli/bin.js +5 -5
- package/dist-cli/chunks/{agent-OFH7IJEA.js → agent-E5UUPQXH.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-VF6BEPVN.js → agent-wrapper-LG33N5K3.js} +2 -2
- package/dist-cli/chunks/{app-fonts-ERM34FJ5.js → app-fonts-PCQ4B3U7.js} +2 -2
- package/dist-cli/chunks/{assert-IGMBFTLH.js → assert-2ADFEOQF.js} +2 -2
- package/dist-cli/chunks/{auth-HSBBTE4P.js → auth-NLB6E4XZ.js} +2 -2
- package/dist-cli/chunks/{beta-347FXXJ7.js → beta-AHSJMAOI.js} +2 -2
- package/dist-cli/chunks/{camera-OM4DK5HE.js → camera-IYDWHB6P.js} +2 -2
- package/dist-cli/chunks/{chunk-DCAN7GYY.js → chunk-2HKDCEHH.js} +2 -2
- package/dist-cli/chunks/{chunk-L7W6D2IV.js → chunk-2MJ3M5IF.js} +1 -1
- package/dist-cli/chunks/{chunk-JD5O4M44.js → chunk-3U24SEPY.js} +2 -2
- package/dist-cli/chunks/{chunk-6HOIAQW4.js → chunk-4FISS7J4.js} +1 -1
- package/dist-cli/chunks/{chunk-VAYHTDE7.js → chunk-4MGSHK3U.js} +2 -2
- package/dist-cli/chunks/{chunk-VWAZ2YDF.js → chunk-66W32ZAC.js} +3 -3
- package/dist-cli/chunks/{chunk-36N5TMLR.js → chunk-6TYW7J2S.js} +2 -2
- package/dist-cli/chunks/{chunk-7IZ5QXUO.js → chunk-6W4W2I2H.js} +1 -1
- package/dist-cli/chunks/{chunk-YLTTM35B.js → chunk-7QZCEUQH.js} +2 -2
- package/dist-cli/chunks/{chunk-SIGP7L6X.js → chunk-ACQPOL3N.js} +1 -1
- package/dist-cli/chunks/chunk-AGGO4OMP.js +4 -0
- package/dist-cli/chunks/{chunk-NOD2WL7K.js → chunk-AXCNZWS3.js} +3 -3
- package/dist-cli/chunks/{chunk-EBZQKLA4.js → chunk-BB2LGH5B.js} +1 -1
- package/dist-cli/chunks/{chunk-DD2XEHRT.js → chunk-BGG34LXF.js} +2 -2
- package/dist-cli/chunks/{chunk-FF6XN63V.js → chunk-BQQ2PVYQ.js} +1 -1
- package/dist-cli/chunks/{chunk-RUULSEKH.js → chunk-BVWMU5CV.js} +2 -2
- package/dist-cli/chunks/{chunk-SOWFP3GB.js → chunk-C2TJ2PLG.js} +1 -1
- package/dist-cli/chunks/{chunk-X2SNFQUB.js → chunk-C5VFP3FH.js} +2 -2
- package/dist-cli/chunks/{chunk-NZ3MD6WX.js → chunk-CQIH7FPK.js} +1 -1
- package/dist-cli/chunks/{chunk-ANCTBUP7.js → chunk-DNWMXDM5.js} +2 -2
- package/dist-cli/chunks/{chunk-PCS73SCM.js → chunk-F2BHWSSW.js} +2 -2
- package/dist-cli/chunks/{chunk-JBX2GVTM.js → chunk-FECIIPFS.js} +2 -2
- package/dist-cli/chunks/{chunk-6YA7ITPB.js → chunk-FEWMMQJW.js} +2 -2
- package/dist-cli/chunks/{chunk-MY37MGCH.js → chunk-FL3B7VQN.js} +1 -1
- package/dist-cli/chunks/{chunk-ZRQ5OUC3.js → chunk-FLBNTPBZ.js} +2 -2
- package/dist-cli/chunks/{chunk-526RTRUB.js → chunk-GBXRASTZ.js} +2 -2
- package/dist-cli/chunks/{chunk-KX5YGB6L.js → chunk-GTNGFY6G.js} +2 -2
- package/dist-cli/chunks/{chunk-GMR5HH6U.js → chunk-GTSF2TRR.js} +1 -1
- package/dist-cli/chunks/{chunk-HGEVJQ2Z.js → chunk-I76GK5JV.js} +2 -2
- package/dist-cli/chunks/{chunk-D35X4DGV.js → chunk-IETTTBIZ.js} +2 -2
- package/dist-cli/chunks/{chunk-PO5I6Q3N.js → chunk-IQKWVOTX.js} +2 -2
- package/dist-cli/chunks/{chunk-TEVDJAWR.js → chunk-JB2XWONS.js} +1 -1
- package/dist-cli/chunks/{chunk-KRYYXTD6.js → chunk-JMI7WP73.js} +2 -2
- package/dist-cli/chunks/{chunk-BPXQP2WT.js → chunk-KFZQQUKH.js} +2 -2
- package/dist-cli/chunks/{chunk-435RMSZJ.js → chunk-KX3OJSX7.js} +2 -2
- package/dist-cli/chunks/{chunk-PYKSLOEU.js → chunk-LEXXWNFD.js} +2 -2
- package/dist-cli/chunks/{chunk-YDK3RMDM.js → chunk-LRRJ3ORH.js} +2 -2
- package/dist-cli/chunks/{chunk-6VF3A4CX.js → chunk-LYC2SH2Y.js} +1 -1
- package/dist-cli/chunks/{chunk-C43A3HRV.js → chunk-MHWLXGJ3.js} +2 -2
- package/dist-cli/chunks/{chunk-SYUJCAYN.js → chunk-OI3DYYZV.js} +1 -1
- package/dist-cli/chunks/{chunk-BLBN76IW.js → chunk-OTZCVQOW.js} +1 -1
- package/dist-cli/chunks/{chunk-UPTSCAXP.js → chunk-QB35GBD5.js} +1 -1
- package/dist-cli/chunks/{chunk-GLMYWXLH.js → chunk-QSLD3RW7.js} +122 -122
- package/dist-cli/chunks/{chunk-FL5R6QVE.js → chunk-RHJFGX4A.js} +2 -2
- package/dist-cli/chunks/{chunk-MA5RZO4L.js → chunk-RY6GQZCH.js} +2 -2
- package/dist-cli/chunks/{chunk-IYCPNB23.js → chunk-VN56TL3M.js} +2 -2
- package/dist-cli/chunks/{chunk-MXSNB6VA.js → chunk-XMKZNJSL.js} +1 -1
- package/dist-cli/chunks/{chunk-V43DZ6MG.js → chunk-YK6FDOG6.js} +2 -2
- package/dist-cli/chunks/{chunk-W6BKNLC4.js → chunk-YNVC42AB.js} +1 -1
- package/dist-cli/chunks/{chunk-CCJGCZII.js → chunk-YUFTRNFC.js} +1 -1
- package/dist-cli/chunks/{chunk-5FR3XPEJ.js → chunk-Z2PV5BCT.js} +2 -2
- package/dist-cli/chunks/{chunk-XJPT7YWG.js → chunk-Z2TCDWQ7.js} +2 -2
- package/dist-cli/chunks/{chunk-53S3KEIU.js → chunk-ZWEBQ5MB.js} +3 -3
- package/dist-cli/chunks/{cleanup-JQOSDZEP.js → cleanup-TDZUWYSO.js} +2 -2
- package/dist-cli/chunks/cli-version-6BZFQWCZ.js +4 -0
- package/dist-cli/chunks/{compat-QHZRG5QJ.js → compat-A7N5NVPI.js} +2 -2
- package/dist-cli/chunks/{config-YF4L25Q3.js → config-LL62ATVZ.js} +2 -2
- package/dist-cli/chunks/{control-GRLJ3W27.js → control-ILH3IPOG.js} +2 -2
- package/dist-cli/chunks/daemon-ZUGLIV5U.js +4 -0
- package/dist-cli/chunks/{debug-PZOHF6WI.js → debug-WJN2YK7L.js} +3 -3
- package/dist-cli/chunks/{desktop-YX6QID7C.js → desktop-SACOU52P.js} +3 -3
- package/dist-cli/chunks/detox-HHA3KUST.js +52 -0
- package/dist-cli/chunks/{device-ZRHEHJ7R.js → device-K5DKLWPM.js} +2 -2
- package/dist-cli/chunks/{diagnose-ULSJOYWK.js → diagnose-XZYAGIEN.js} +2 -2
- package/dist-cli/chunks/{disk-cleanup-KLLOHU4N.js → disk-cleanup-BUHPEEFX.js} +2 -2
- package/dist-cli/chunks/drivers-4HU5USPO.js +4 -0
- package/dist-cli/chunks/{film-FDMTLO5O.js → film-XDVNORAX.js} +3 -3
- package/dist-cli/chunks/flow-Y42LVOVP.js +4 -0
- package/dist-cli/chunks/help-V6WBUFML.js +4 -0
- package/dist-cli/chunks/{hidden-runtime-alias-J5MGI3FF.js → hidden-runtime-alias-YIA5VZFO.js} +2 -2
- package/dist-cli/chunks/{home-paths-XNVF5J2H.js → home-paths-V276ZMFH.js} +2 -2
- package/dist-cli/chunks/inspect-WTEDX3A3.js +4 -0
- package/dist-cli/chunks/install-desktop-AFDKV7BH.js +4 -0
- package/dist-cli/chunks/{login-BIBNRKGQ.js → login-KZAVKL6H.js} +4 -4
- package/dist-cli/chunks/{logout-KI43UF3Y.js → logout-JFXC6U2P.js} +2 -2
- package/dist-cli/chunks/{maestro-4TUWVBVF.js → maestro-BS7T227L.js} +7 -7
- package/dist-cli/chunks/{maestro-generate-TWM4EXUJ.js → maestro-generate-WXDB2WUX.js} +3 -3
- package/dist-cli/chunks/{mode-AAHQAKIM.js → mode-DV2L7WE3.js} +2 -2
- package/dist-cli/chunks/{optional-demo-registry-E5QZ2HAL.js → optional-demo-registry-RRSPBGOI.js} +2 -2
- package/dist-cli/chunks/{perf-YYUZEBF7.js → perf-O3TENAUU.js} +2 -2
- package/dist-cli/chunks/{permissions-IGD736BA.js → permissions-DY5DNWIF.js} +2 -2
- package/dist-cli/chunks/{record-MOHHUJAY.js → record-XY5YEMJB.js} +3 -3
- package/dist-cli/chunks/{report-issue-NQT5KFBX.js → report-issue-NQA6W4LU.js} +2 -2
- package/dist-cli/chunks/reset-6JVRMIUQ.js +4 -0
- package/dist-cli/chunks/runtime-IQ5TU5BZ.js +4 -0
- package/dist-cli/chunks/{screenshot-command-GR5UBZGY.js → screenshot-command-26DMBR73.js} +3 -3
- package/dist-cli/chunks/{screenshot-layers-ZO3RNBJY.js → screenshot-layers-MVE2F5BO.js} +2 -2
- package/dist-cli/chunks/{screenshots-capture-LKZID6SS.js → screenshots-capture-DTSUAE6Q.js} +2 -2
- package/dist-cli/chunks/{serve-GW3TH5HX.js → serve-6PXVFH4O.js} +2 -2
- package/dist-cli/chunks/{setup-N3JKRPQK.js → setup-LDAY6QUQ.js} +2 -2
- package/dist-cli/chunks/{skills-IGHG3SV4.js → skills-RQWM2J2Q.js} +2 -2
- package/dist-cli/chunks/{state-CXCLASA5.js → state-IDQ43TIA.js} +2 -2
- package/dist-cli/chunks/{storage-RO6GHQ5L.js → storage-SNSBN3HY.js} +2 -2
- package/dist-cli/chunks/store-7L2QR4QG.js +4 -0
- package/dist-cli/chunks/telemetry-BHDOJRSL.js +4 -0
- package/dist-cli/chunks/{timeline-TUPEWR6V.js → timeline-36EQTWQZ.js} +2 -2
- package/dist-cli/chunks/{upgrade-HTNHXQDP.js → upgrade-MTJRBSTJ.js} +2 -2
- package/dist-cli/chunks/upload-76KYWLC7.js +4 -0
- package/dist-cli/chunks/{version-7ZYXM64U.js → version-CMVXNVHJ.js} +2 -2
- package/dist-cli/chunks/{web-PMRPY2NY.js → web-AHOIPBU3.js} +2 -2
- package/dist-cli/chunks/{what-happened-QSFD6H7W.js → what-happened-W3GZXD7R.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 +93 -11
- 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 +54 -17
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/skills/rnx-perf/SKILL.md +17 -0
- package/src/vite-plugin.ts +5 -1
- package/dist-cli/chunks/chunk-QZ73ZUC7.js +0 -4
- package/dist-cli/chunks/cli-version-4ZJSLJIZ.js +0 -4
- package/dist-cli/chunks/daemon-4ICA6HT6.js +0 -4
- package/dist-cli/chunks/detox-ZCPGXLXA.js +0 -52
- package/dist-cli/chunks/drivers-IANQ4PS2.js +0 -4
- package/dist-cli/chunks/flow-2NM5A2NB.js +0 -4
- package/dist-cli/chunks/help-ZFLHXXET.js +0 -4
- package/dist-cli/chunks/inspect-JBEVVCFB.js +0 -4
- package/dist-cli/chunks/install-desktop-I4K4ESL3.js +0 -4
- package/dist-cli/chunks/reset-KC4YU4RE.js +0 -4
- package/dist-cli/chunks/runtime-UB6LX3HK.js +0 -4
- package/dist-cli/chunks/store-SFC4MMBY.js +0 -4
- package/dist-cli/chunks/telemetry-B5SBPVLX.js +0 -4
- package/dist-cli/chunks/upload-NXMYH3HR.js +0 -4
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.320 | (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 jt,c as qt}from"./chunk-
|
|
4
|
+
import{b as jt,c as qt}from"./chunk-BQQ2PVYQ.js";import{a as Dt,b as Bt}from"./chunk-4FISS7J4.js";import{a as de}from"./chunk-FEWMMQJW.js";import{k as Ct}from"./chunk-IETTTBIZ.js";import{a as oe,b as C,c as B,d as Me,e as ae,f as X,g as pe,h as ye,i as Et,j as At,k as Ne,l as _t}from"./chunk-BVWMU5CV.js";import{A as Mt,B as Nt,C as Ft,F as Ot,H as Pt,J as ue,K as Rt,Q as We,a as Ie,b as mt,c as ft,d as gt,e as yt,f as ht,g as bt,h as wt,i as xt,j as $t,k as Ce,l as je,r as qe,s as St,t as vt,u as ge,v as kt,w as Te,x as Le,y as It,z as Tt}from"./chunk-JB2XWONS.js";import{a as st}from"./chunk-FL3B7VQN.js";import{a as Q}from"./chunk-GBXRASTZ.js";import{e as it,j as at,o as lt,q as ct,s as dt,t as ut,u as pt,v as ce}from"./chunk-KX3OJSX7.js";import{c as nt,d as Be,f as rt}from"./chunk-I76GK5JV.js";function Je(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 Bo,mkdirSync as Wt,readFileSync as Co,rmSync as Ke,writeFileSync as Jt}from"fs";import{tmpdir as jo}from"os";import{dirname as Ht,join as qo,resolve as Kt}from"path";import*as Fe from"fs";function Do(e){let t={},s=e,i=p=>Array.isArray(p)?p:[],
|
|
10
|
-
`)}function Ye(){let e=Oe();if(!Bo(e))return null;try{let t=JSON.parse(Co(e,"utf8"));return t.version!==Ue||!Array.isArray(t.steps)||typeof t.startedAt!="string"||typeof t.updatedAt!="string"?(Ke(e,{force:!0}),null):{version:Ue,startedAt:t.startedAt,updatedAt:t.updatedAt,steps:t.steps,candidate:t.candidate??null}}catch{return Ke(e,{force:!0}),null}}function Cs(){let e=new Date().toISOString(),t={version:Ue,startedAt:e,updatedAt:e,steps:[],candidate:null};return Ge(t),{path:Oe(),state:t}}function Lo(){Ke(Oe(),{force:!0})}function js(){Lo()}function
|
|
11
|
-
`}function Ls(e){let t=Ye();if(!t)return{active:!1};let s=Wo(t.steps),i=He(t.steps);if(i.length>0)return{active:!0,valid:!1,issues:i,yaml:s,stepCount:t.steps.length,outputPath:null};let
|
|
12
|
-
`)}function ss(e,t){let s=t.trim()||"default";return`${e}:${s}`}function ze(e,t,s,i={}){let
|
|
9
|
+
})()`}import{existsSync as Bo,mkdirSync as Wt,readFileSync as Co,rmSync as Ke,writeFileSync as Jt}from"fs";import{tmpdir as jo}from"os";import{dirname as Ht,join as qo,resolve as Kt}from"path";import*as Fe from"fs";function Do(e){let t={},s=e,i=p=>Array.isArray(p)?p:[],d=e.match(/^---\n([\s\S]*?)\n---\n?/);if(d){try{t=de.parse(d[1])??{}}catch(b){console.warn(` warn: could not parse frontmatter: ${b.message}`)}s=e.slice(d[0].length);let p=de.parse(s);return{frontmatter:t,steps:i(p)}}if(/\n---\s*\n/.test(e))try{let p=de.parseAllDocuments(e);if(p.length>=2){let b=p[0].toJS(),h=p[p.length-1].toJS();return{frontmatter:b&&typeof b=="object"?b:{},steps:i(h)}}}catch(p){console.warn(` warn: could not parse multi-doc flow: ${p.message}`)}let r=de.parse(s);return{frontmatter:t,steps:i(r)}}var Lt=new Set(["tapOn","inputText","pressKey","dispatchKey","hideKeyboard","swipe","pinch","scroll","scrollUntilVisible"]);function He(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 i of e)i&&typeof i=="object"?Object.keys(i).some(r=>Lt.has(r))&&(s+=1):typeof i=="string"&&Lt.has(i)&&(s+=1);return s===0&&t.push("no interaction steps found (expected at least one tapOn / inputText / pressKey / swipe / scroll)"),t}function Ps(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=Do(t);return He(s.steps)}catch(s){return[`yaml parse error: ${s.message}`]}}var Ue=1;function Oe(){return Kt(process.env.SOOTSIM_FLOW_SESSION_PATH||qo(jo(),"sootsim-flow-session.json"))}function Ge(e){let t=Oe();Wt(Ht(t),{recursive:!0}),Jt(t,JSON.stringify(e,null,2)+`
|
|
10
|
+
`)}function Ye(){let e=Oe();if(!Bo(e))return null;try{let t=JSON.parse(Co(e,"utf8"));return t.version!==Ue||!Array.isArray(t.steps)||typeof t.startedAt!="string"||typeof t.updatedAt!="string"?(Ke(e,{force:!0}),null):{version:Ue,startedAt:t.startedAt,updatedAt:t.updatedAt,steps:t.steps,candidate:t.candidate??null}}catch{return Ke(e,{force:!0}),null}}function Cs(){let e=new Date().toISOString(),t={version:Ue,startedAt:e,updatedAt:e,steps:[],candidate:null};return Ge(t),{path:Oe(),state:t}}function Lo(){Ke(Oe(),{force:!0})}function js(){Lo()}function Pe(e){let t=Ye();if(!t)return{active:!1};let s=t.candidate,i={...t,updatedAt:new Date().toISOString(),candidate:{step:e.step,summary:e.summary,source:e.source,recordedAt:new Date().toISOString()}};return Ge(i),{active:!0,candidate:i.candidate,replaced:s}}function qs(){let e=Ye();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 Ge(s),{active:!0,kept:!0,candidate:t,stepCount:s.steps.length}}function Wo(e){return de.stringify(e).trimEnd()+`
|
|
11
|
+
`}function Ls(e){let t=Ye();if(!t)return{active:!1};let s=Wo(t.steps),i=He(t.steps);if(i.length>0)return{active:!0,valid:!1,issues:i,yaml:s,stepCount:t.steps.length,outputPath:null};let d=null;return e&&(d=Kt(e),Wt(Ht(d),{recursive:!0}),Jt(d,s)),{active:!0,valid:!0,issues:[],yaml:s,stepCount:t.steps.length,outputPath:d}}import{existsSync as Jo,mkdirSync as Ho,readFileSync as Ko,rmSync as Ut,writeFileSync as Uo}from"fs";import{tmpdir as Go}from"os";import{dirname as Yo,join as zo,resolve as Xo}from"path";var he=1,Vo="SOOTSIM_INSPECT_NOTICE_PATH",Qo=300*1e3,Zo=15e3;function Gt(){return Xo(process.env[Vo]||zo(Go(),"sootsim-inspect-notice-state.json"))}function es(e,t){return Object.fromEntries(Object.entries(e).filter(([,s])=>typeof s?.signature=="string"&&Number.isFinite(s?.updatedAt)&&t-s.updatedAt<=Qo))}function ts(e){let t=Gt();if(!Jo(t))return{version:he,entries:{}};try{let s=JSON.parse(Ko(t,"utf8"));return s.version!==he||!s.entries||typeof s.entries!="object"?(Ut(t,{force:!0}),{version:he,entries:{}}):{version:he,entries:es(s.entries,e)}}catch{return Ut(t,{force:!0}),{version:he,entries:{}}}}function os(e){let t=Gt();Ho(Yo(t),{recursive:!0}),Uo(t,JSON.stringify(e,null,2)+`
|
|
12
|
+
`)}function ss(e,t){let s=t.trim()||"default";return`${e}:${s}`}function ze(e,t,s,i={}){let d=i.nowMs??Date.now(),r=i.cooldownMs??Zo,p=ts(d),b=ss(e,t),h=p.entries[b];return h&&h.signature===s&&d-h.updatedAt<r?!1:(p.entries[b]={signature:s,updatedAt:d},os(p),!0)}async function se({bridge:e,simId:t,maxMs:s,pollMs:i=50,stablePolls:d=3,strict:r=!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
15
|
const pollMs = ${Math.max(1,Math.round(i))}
|
|
16
|
-
const requiredStablePolls = ${Math.max(1,Math.round(
|
|
16
|
+
const requiredStablePolls = ${Math.max(1,Math.round(d))}
|
|
17
17
|
const strict = ${r?"true":"false"}
|
|
18
18
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
19
19
|
|
|
@@ -126,12 +126,12 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
126
126
|
await sleep(pollMs)
|
|
127
127
|
}
|
|
128
128
|
return { settled: false, elapsed: Date.now() - start }
|
|
129
|
-
})()`},{timeoutMs:s+1e3}),{elapsed:b,settled:
|
|
129
|
+
})()`},{timeoutMs:s+1e3}),{elapsed:b,settled:h}=p??{};return{elapsed:typeof b=="number"?b:s,settled:h===!0}}var Re=`(() => {
|
|
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
|
-
})()`,ns={initialWaitMs:3e3,deadlineMs:5e3,retryWaitMs:700},rs={initialWaitMs:1200,deadlineMs:2500,retryWaitMs:700};function is(e,t={}){return{...e?ns:rs,...t}}function me(e){return!(!e||e.hit===!1||e.ok===!1||e.requestedTargetMatched===!1||e.pointerTapHandled===!1&&!e.keyboardOpened&&!e.isTextInput)}function as(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=is(!!t.agent,t.timing),i=0,
|
|
134
|
+
})()`,ns={initialWaitMs:3e3,deadlineMs:5e3,retryWaitMs:700},rs={initialWaitMs:1200,deadlineMs:2500,retryWaitMs:700};function is(e,t={}){return{...e?ns:rs,...t}}function me(e){return!(!e||e.hit===!1||e.ok===!1||e.requestedTargetMatched===!1||e.pointerTapHandled===!1&&!e.keyboardOpened&&!e.isTextInput)}function as(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=is(!!t.agent,t.timing),i=0,d=null,r=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||i===0;){i++;let h=await t.resolve();if(d=h,h?.error==="bridge-not-ready"||h?.ambiguous||h?.nthOutOfRange)return{payload:h,result:null,attempts:i,failure:"special"};if(h&&typeof h.cx=="number"&&typeof h.cy=="number")if(h.offscreen){r={hit:!1,reason:"offscreen",x:h.cx,y:h.cy,screen:h.screen};let w=`${Math.round(h.cx)},${Math.round(h.cy)}`;if(b===w)return{payload:h,result:r,attempts:i,failure:"missed"};b=w}else{b=null;let w=as(h,t.textFallback),g=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 jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}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(w)}
|
|
144
|
+
const inspected = await t.inspectAt(${h.cx}, ${h.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 jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
192
192
|
return { error: 'tap-target-activation-unavailable' }
|
|
193
193
|
}
|
|
194
194
|
const activation = await t.activatePressAt(
|
|
195
|
-
${
|
|
196
|
-
${
|
|
195
|
+
${h.cx},
|
|
196
|
+
${h.cy},
|
|
197
197
|
requestedTarget.nodeId,
|
|
198
198
|
)
|
|
199
199
|
if (activation?.ok) {
|
|
@@ -201,8 +201,8 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
201
201
|
new CustomEvent('sootsim:agentAction', {
|
|
202
202
|
detail: {
|
|
203
203
|
type: 'tap',
|
|
204
|
-
x: ${
|
|
205
|
-
y: ${
|
|
204
|
+
x: ${h.cx},
|
|
205
|
+
y: ${h.cy},
|
|
206
206
|
target: requestedTarget,
|
|
207
207
|
},
|
|
208
208
|
}),
|
|
@@ -214,7 +214,7 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
214
214
|
requestedTarget,
|
|
215
215
|
coordinateTarget,
|
|
216
216
|
}
|
|
217
|
-
})()`});if(
|
|
217
|
+
})()`});if(g?.error)return{payload:h,result:{hit:!1,reason:g.error,requestedTarget:w},attempts:i,failure:"special"};if(g?.requestedTargetMatched===!1)return{payload:h,result:{hit:!1,reason:"target-covered",...g},attempts:i,failure:"missed"};let M=g?.activation?.tap??g?.activation,x=M&&typeof M=="object"?{...M,...g?.activation,...g}:{hit:!!M,...g};if(r=x,me(x))return{payload:h,result:x,attempts:i}}let I=p-Date.now();if(I<=0)break;try{await se({bridge:e,maxMs:Math.min(I,s.retryWaitMs),pollMs:32,stablePolls:2})}catch{await new Promise(w=>setTimeout(w,Math.min(120,I)))}}return{payload:d,result:r,attempts:i,failure:d&&typeof d.cx=="number"?"missed":"not-found"}}async function Yt(e,t,s,i){return e.send({type:"tap",x:t,y:s,...i?{target:i}:{}})}async function zt(e,t,s={}){let i=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
220
|
const n = (await t.findByTestId(${i})) || (await t.findById(${i}))
|
|
@@ -232,7 +232,7 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
232
232
|
resolved && typeof resolved.cy === 'number'
|
|
233
233
|
? resolved.cy
|
|
234
234
|
: n.absolutePosition.y + (n.layout.height || 0) / 2
|
|
235
|
-
const scr = ${
|
|
235
|
+
const scr = ${Re}
|
|
236
236
|
const offscreen =
|
|
237
237
|
!!scr && (cx < 0 || cy < 0 || cx > scr.width || cy > scr.height)
|
|
238
238
|
return {
|
|
@@ -260,10 +260,10 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
260
260
|
},
|
|
261
261
|
strategy: (resolved && resolved.strategy) || 'matched-node',
|
|
262
262
|
}
|
|
263
|
-
})()`})})}async function Xt(e,t,s={},i={}){let
|
|
263
|
+
})()`})})}async function Xt(e,t,s={},i={}){let d=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:i.agent,timing:i.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
|
-
const F = ${
|
|
266
|
+
const F = ${d}
|
|
267
267
|
|
|
268
268
|
const res = await t.queryTextCandidates({
|
|
269
269
|
query: F.query,
|
|
@@ -355,7 +355,7 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
355
355
|
resolved && typeof resolved.cy === 'number'
|
|
356
356
|
? resolved.cy
|
|
357
357
|
: n.absolutePosition.y + (n.layout.height || 0) / 2
|
|
358
|
-
const scr = ${
|
|
358
|
+
const scr = ${Re}
|
|
359
359
|
const offscreen =
|
|
360
360
|
!!scr && (cx < 0 || cy < 0 || cx > scr.width || cy > scr.height)
|
|
361
361
|
return {
|
|
@@ -384,7 +384,7 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
384
384
|
total,
|
|
385
385
|
idx,
|
|
386
386
|
}
|
|
387
|
-
})()`})})}async function Vt(e,t,s={}){let i=JSON.stringify(t);return be(e,{agent:s.agent,timing:s.timing,textFallback:t,resolve:async()=>{let
|
|
387
|
+
})()`})})}async function Vt(e,t,s={}){let i=JSON.stringify(t);return be(e,{agent:s.agent,timing:s.timing,textFallback:t,resolve:async()=>{let d=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 =
|
|
@@ -401,7 +401,7 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
401
401
|
absolutePosition: byTestId.absolutePosition,
|
|
402
402
|
layout: byTestId.layout,
|
|
403
403
|
},
|
|
404
|
-
screen: ${
|
|
404
|
+
screen: ${Re},
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
const byText = await t.findByText(${i})
|
|
@@ -417,21 +417,21 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
417
417
|
absolutePosition: byText.absolutePosition,
|
|
418
418
|
layout: byText.layout,
|
|
419
419
|
},
|
|
420
|
-
screen: ${
|
|
420
|
+
screen: ${Re},
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
return { strategy: 'none' }
|
|
424
|
-
})()`});if(!
|
|
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=
|
|
427
|
-
`).length>=80&&Q("describe-use-filters"),K&&K.visible){let
|
|
424
|
+
})()`});if(!d||!("node"in d))return d;let r=d.node,p=r.absolutePosition.x+r.layout.width/2,b=r.absolutePosition.y+r.layout.height/2,h=d.screen??null,I=!!h&&(p<0||b<0||p>h.width||b>h.height);return{...d,cx:p,cy:b,...I?{offscreen:!0,screen:h}:{},target:{id:r.id,testID:r.testID,text:d.strategy==="text"?t:r.text,type:r.type}}}})}async function Qt(e,t={args:[]}){let s=await ft(e);if(C(t.args)){B(s);return}console.log(` nodes: ${s.nodes}`)}function Xe(e,t){let s=e.indexOf(t);return s>=0&&s+1<e.length?e[s+1]:null}async function Zt(e){let{bridge:t,args:s,positional:i}=e,d=s.includes("--verbose")||s.includes("-v"),r=C(s),p=d&&!r,b=s.includes("--watch")||s.includes("-w"),h=1e3,I=s.includes("--compact"),w=s.includes("--no-xy"),g=s.includes("--no-clipped"),M=s.includes("--include-occluded"),x=Xe(s,"--testid-like"),_=Xe(s,"--only"),O=Xe(s,"--subtree"),c=i[1]&&!i[1].startsWith("-")?i[1]:void 0,D=c?/[*?]/.test(c):!1,R=!D&&!_?c:void 0,A=_??(D?c:void 0),J=async()=>{await pe(t,{verbose:p});let T=await ht(t,{describe:!0,verbose:d,filter:R||"",testIdLike:x||void 0,onlyGlob:A||void 0,subtreeRoot:O||void 0,compact:I,hideXy:w,includeOccluded:M,fullText:r}),P=T?.tree,H=T?.shell,K=T?.keyboard;if(r){B({shell:H,tree:P??"",keyboard:K});return}if(H&&typeof H=="object"){let q=[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);q.length>0&&console.log(` shell: ${q.join(" ")}`)}if(typeof P=="string"&&P.startsWith("__SUBTREE_NOT_FOUND__:")){let q=P.slice(22);console.log(` subtree root not found: ${q}`),Q("subtree-root-not-found",q);return}if(!P){let q=T?.nodeCount??0;console.log(" no matching nodes found"),!(R||x||A||O)&&q<10&&Q("app-still-loading",q);return}let ee=P,te=0;if(g&&typeof ee=="string"){let q=ee.split(`
|
|
425
|
+
`),le=[];for(let ve of q){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=R||x||A||O;if((R||x||A)&&!b&&Q("describe-filter-context"),!ie&&!b&&P.split(`
|
|
427
|
+
`).length>=80&&Q("describe-use-filters"),K&&K.visible){let q=K.spec,le=[q?.keyboardType?`type=${q.keyboardType}`:null,q?.returnKeyType&&q.returnKeyType!=="default"?`return=${q.returnKeyType}`:null,K.mode!=="letters"?`mode=${K.mode}`:null,K.shifted?"shift":null,K.capsLock?"caps":null,q?.autoCapitalize&&q.autoCapitalize!=="sentences"?`autoCap=${q.autoCapitalize}`:null,K.accessoryBarId?`accessory=${K.accessoryBarId}`:null].filter(Boolean);console.log(`
|
|
428
428
|
keyboard: ${le.join(" ")||"visible"}`)}};if(b)for(console.log(` watching... (Ctrl+C to stop)
|
|
429
|
-
`);;)console.clear(),await J(),await oe(
|
|
429
|
+
`);;)console.clear(),await J(),await oe(h);else await J()}var ls=["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 ls){let t=process.env[e];if(t&&t.trim()&&t!=="0")return!0}return!1}async function eo(e){let{bridge:t,args:s,effectiveArgs:i,positional:d,inspectUsage:r}=e,p=T=>{let P=i.indexOf(T);return P>=0&&P+1<i.length?i[P+1]:null},b=T=>i.includes(T),h=p("--testid")||p("--test-id"),I=p("--role"),w=p("--type"),g=p("--text"),M=b("--pressable"),x=b("--visible"),_=b("--interactive-targets")||b("--actions"),O=!h&&!I&&!w&&!g&&!M&&!x&&!_?d[1]:null,c=g??O,D=await $t(t,{testId:h,role:I,type:w,text:c,pressable:M,visible:x,interactive:_});D||(console.error(r("find","<text> | --text <t> | --testid <id> | --role <r> | --type <t> | --pressable | --visible | --interactive-targets")),process.exit(1));let{mode:R,result:A}=D,J=C(s),U=s.includes("--verbose")||s.includes("--dump");if(J)R==="interactive-targets"&&Array.isArray(A)?B(Ce(A).map(T=>({...T,tap:je(T)}))):B(A??null);else if(Array.isArray(A))if(A.length===0){console.log(` no ${R} nodes found`);let T=await t.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount?.()) || 0)()"});typeof T=="number"&&T<10&&Q("app-still-loading",T)}else if(R==="interactive-targets"){let T=Ce(A);console.log(` found ${T.length} interactive target${T.length===1?"":"s"} (sorted by score):`);for(let P of T.slice(0,20)){let H=P.absolutePosition?`@(${Math.round(P.absolutePosition.x)},${Math.round(P.absolutePosition.y)})`:"",K=P.layout?`${Math.round(P.layout.width)}x${Math.round(P.layout.height)}`:"?x?",ee=P.text?` "${P.text.slice(0,30)}"`:"",te=P.testID?` #${P.testID}`:"",ie=P.accessibilityLabel?` \u24D8"${String(P.accessibilityLabel).slice(0,24)}"`:"",Se=P.accessibilityRole?`[${P.accessibilityRole}]`:P.type,q=je(P);console.log(` ${Se}${ee}${ie}${te} ${K} ${H}`),console.log(` \u2192 ${q}`),U&&console.log(Ve(JSON.stringify(P,null,2)," "))}T.length>20&&console.log(` ... and ${T.length-20} more`)}else{console.log(` found ${A.length} node${A.length===1?"":"s"} (${R}):`);for(let T of A.slice(0,20)){let P=T.absolutePosition?`@(${Math.round(T.absolutePosition.x)},${Math.round(T.absolutePosition.y)})`:"",H=T.layout?`${Math.round(T.layout.width)}x${Math.round(T.layout.height)}`:"?x?",K=T.text?` "${T.text.slice(0,30)}"`:"",ee=T.testID?` #${T.testID}`:"",te=T.pressable?" (tap)":"",ie=T.accessibilityRole?`[${T.accessibilityRole}]`:T.type;console.log(` ${ie}${K}${ee} ${H} ${P}${te}`),U&&console.log(Ve(JSON.stringify(T,null,2)," "))}A.length>20&&console.log(` ... and ${A.length-20} more`)}else if(A==null)console.log(` not found: ${c||h||I||w||""||R}`),h&&Q("wait-selector-for-missing-testid",h);else{let T=A;if(T.type&&T.absolutePosition){let P=`@(${Math.round(T.absolutePosition.x)},${Math.round(T.absolutePosition.y)})`,H=T.layout?`${Math.round(T.layout.width)}x${Math.round(T.layout.height)}`:"?x?",K=T.text?` "${T.text.slice(0,40)}"`:"",ee=T.testID?` #${T.testID}`:"",te=T.pressable?" (tap)":"",ie=T.accessibilityRole?`[${T.accessibilityRole}]`:T.type;console.log(` ${ie}${K}${ee} ${H} ${P}${te}`),U&&console.log(Ve(JSON.stringify(T,null,2)," "))}else console.log(JSON.stringify(A,null,2))}}function Ve(e,t){return e.split(`
|
|
430
430
|
`).map(s=>t+s).join(`
|
|
431
|
-
`)}async function to(e){let{bridge:t,args:s}=e,i=
|
|
432
|
-
`),console.log(wt(b,{styling:
|
|
433
|
-
`))}async function so(e){let t=await e.bridge.listSims(),s=e.args.includes("--all"),i=e.args.find((b,
|
|
434
|
-
slope over ${
|
|
431
|
+
`)}async function to(e){let{bridge:t,args:s}=e,i=C(s);await pe(t,{verbose:!i});let d=s.includes("--styling"),r=s.indexOf("--filter"),p=r>=0?s[r+1]:void 0,b=await bt(t,{styling:d,filter:p});if(i){B({count:b.length,elements:b});return}console.log(` layout (${b.length} element${b.length===1?"":"s"}):
|
|
432
|
+
`),console.log(wt(b,{styling:d}))}async function oo(e,t={}){let s=await Pt(e);if("error"in s&&(console.error(s.error),process.exit(1)),t.json){console.log(JSON.stringify(s,null,2));return}let{visible:i,spec:d,mode:r,shifted:p,capsLock:b,accessoryBarId:h}=s,I=[];I.push(`keyboard: ${i?"visible":"hidden"}`),d?(I.push(` type: ${d.keyboardType}`),I.push(` returnKey: ${d.returnKeyType}`),I.push(` autoCap: ${d.autoCapitalize}`),I.push(` autoCorrect: ${d.autoCorrect?"on":"off"}`),I.push(` appearance: ${d.keyboardAppearance}`),d.secureTextEntry&&I.push(" secureTextEntry: true"),d.enablesReturnKeyAutomatically&&I.push(` return: ${d.currentTextIsEmpty?"disabled (empty)":"enabled"}`)):I.push(" spec: <none> (shown via dev-tools with no TextInput)"),I.push(` mode: ${r}${p?" (shifted)":""}${b?" (caps)":""}`),h&&I.push(` accessoryBar: ${h}`),console.log(I.join(`
|
|
433
|
+
`))}async function so(e){let t=await e.bridge.listSims(),s=e.args.includes("--all"),i=e.args.find((b,h)=>e.args[h-1]==="--bundle"),d=e.args.find((b,h)=>e.args[h-1]==="--app-port"),r=e.args.includes("--primary"),p=t.filter(b=>!(r&&!b.isPrimary||i&&!(b.url??"").includes(i)||d&&!(b.url??"").includes(`/rn/${d}`)||!s&&!i&&!d&&!r&&!(b.url&&(b.url.includes("bundle=")||b.url.includes("/index.bundle")))&&b.id!==e.simId));if(C(e.args)){B(p.map(b=>({...b,active:b.id===e.simId})));return}Ct(p,e.simId),p.length<t.length&&!C(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 cs(e,t){return t<=0?"?":`${(e/t*100).toFixed(0)}%`}function ds(e){let t={},s=(i,d)=>{d&&(d.nodesRegistered!=null&&(t[`${i}.nodes`]=d.nodesRegistered),d.nodesDetached!=null&&(t[`${i}.detached`]=d.nodesDetached),d.objects&&(t[`${i}.paragraphs`]=d.objects.paragraphs,t[`${i}.yogaNodes`]=d.objects.yogaNodes,t[`${i}.pictures`]=d.objects.pictures,t[`${i}.rasterImages`]=d.objects.rasterImages),d.imageLoader&&(t[`${i}.imageCacheEntries`]=d.imageLoader.cacheEntries,t[`${i}.imagePixelBytes`]=d.imageLoader.cachePixelBytes),d.workerHeap&&(t[`${i}.heapBytes`]=d.workerHeap.usedJSHeapSize),d.wasmHeapBytes!=null&&(t[`${i}.wasmHeapBytes`]=d.wasmHeapBytes))};return s("tenant",e.tenant),s("shell",e.shell),s("compositor",e.compositor),e.hostHeap&&(t["host.heapBytes"]=e.hostHeap.usedJSHeapSize),t}function no(e,t){return e.endsWith("Bytes")?re(t):String(t)}function Qe(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 i=Object.entries(t.detachedTypes??{}).map(([d,r])=>`${d}:${r}`).join(" ");console.log(` nodes detached: ${t.nodesDetached}${i?` (${i})`:""}`)}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 i=t.imageLoader;console.log(` image cache: ${i.cacheEntries}/${i.cacheMaxEntries} entries, ${re(i.cachePixelBytes)}/${re(i.cachePixelBudget)} (${cs(i.cachePixelBytes,i.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 us(e){console.log(" memory:"),Qe("tenant worker",e.tenant),Qe("shell worker",e.shell),Qe("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 ps(e,t,s){let i=e.indexOf(t);if(i===-1)return s;let d=Number(e[i+1]);return Number.isFinite(d)&&d>0?d:s}async function ro(e,t={args:[]}){let s=C(t.args),i=t.args.indexOf("--watch");if(i===-1){let O=await We(e);if(s){B(O);return}us(O);return}let d=Number(t.args[i+1]),r=Number.isFinite(d)&&d>0?d:60,p=ps(t.args,"--interval",5),b=[],h=Date.now(),I=null;for(s||console.log(` sampling every ${p}s for ${r}s \u2014 deltas per tick:`);;){let O=await We(e),c=(Date.now()-h)/1e3,D=ds(O);if(b.push({tSec:c,counters:D}),!s){let R=[];for(let[A,J]of Object.entries(D)){let U=I&&A in I?J-I[A]:null;if(U===null||U===0)continue;let T=U>0?"+":"-",P=A.endsWith("Bytes")?`${T}${re(Math.abs(U))}`:`${T}${Math.abs(U)}`;R.push(`${A} ${no(A,J)} (${P})`)}console.log(` t+${c.toFixed(0)}s ${R.length?R.join(" "):I?"no change":Object.entries(D).map(([A,J])=>`${A} ${no(A,J)}`).join(" ")}`)}if(I=D,c>=r)break;await new Promise(R=>setTimeout(R,p*1e3))}let w=b[0],g=b[b.length-1],M=Math.max(g.tSec-w.tSec,.001),x={};for(let O of Object.keys(g.counters))O in w.counters&&(x[O]=(g.counters[O]-w.counters[O])/M);if(s){B({samples:b,perSecond:x,elapsedSec:M});return}console.log(`
|
|
434
|
+
slope over ${M.toFixed(0)}s:`);let _=Object.entries(x).filter(([,O])=>O!==0).sort((O,c)=>Math.abs(c[1])-Math.abs(O[1]));if(_.length===0){console.log(" all counters flat");return}for(let[O,c]of _){let D=O.endsWith("Bytes")?`${re(Math.abs(c))}/s${c<0?" (shrinking)":""}`:`${c>0?"+":""}${c.toFixed(2)}/s`;console.log(` ${O.padEnd(28)}${D}`)}}var Z="<redacted secure text>";function we(e){let t=e?.layout?.spec??e?.spec??null;return!!t?.secureTextEntry&&t.keyboardType!=="visible-password"}function Ze(e,t){return we(t)?Z:e}function et(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 i=e.indexOf("--test-id");if(i>=0&&e[i+1])return{mode:"testid",value:e[i+1]};let d=e.indexOf("--text");if(d>=0&&e[d+1])return{mode:"text",value:e[d+1]};let r=t?.[1];return r&&!r.startsWith("-")&&!Number.isFinite(Number(r))?{mode:"testid",value:r}:null}async function Ee(e,t){let s=JSON.stringify(t.value),i=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
437
|
const n = ${i}
|
|
@@ -456,15 +456,15 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}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 io(e,t={}){let{nav:s,route:i,keyboard:
|
|
460
|
-
`))}async function ao(e){let{bridge:t,args:s,positional:i}=e,
|
|
459
|
+
})()`})??null}async function io(e,t={}){let{nav:s,route:i,keyboard:d,shell:r}=await Rt(e);if(t.json){console.log(JSON.stringify({shell:r??null,nav:s,route:i,keyboard:d},null,2));return}let p=[];if(r){let b=r.activeApp??r.state??"<none>",h=r.showSwitcher?" (app switcher open)":"",I=typeof r.launchProgress=="number"&&r.launchProgress<.98?` launching (${Math.round(r.launchProgress*100)}%)`:"";p.push(`shell: ${b}${h}${I}`)}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 h of s.screens){let I=h.isActive?"\u25B6":" ",w=h.routeName?` ${h.routeName}`:"",g=h.headerHeight>0?` header=${h.headerHeight}`:"",M=h.largeTitleState&&h.largeTitleState!=="expanded"?` large-title=${h.largeTitleState}`:"";p.push(` ${I} #${h.id}${w}${g}${M}`)}}else p.push("nav: <runtime not available>");if(p.push(`route: ${i?.currentPath??"<unavailable>"}`),i?.coveringPath&&p.push(`covered: a presented screen (${i.coveringPath}) is above this route`),d&&d.visible){let b=d.spec?.keyboardType??"default",h=d.spec?.returnKeyType??"default";p.push(`keyboard: visible (${b}, return=${h}, mode=${d.mode??"?"})`)}else p.push("keyboard: hidden");console.log(p.join(`
|
|
460
|
+
`))}async function ao(e){let{bridge:t,args:s,positional:i}=e,d=i[1]?Number(i[1])*1e3:3e3,r=s.includes("--strict"),{elapsed:p,settled:b}=await se({bridge:t,maxMs:d,strict:r});console.log(b?` settled in ${p}ms`:` timed out after ${p}ms (may still be animating)`)}async function lo(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 co(e){let{bridge:t,args:s,positional:i}=e,d=s.includes("--boxes"),r=i[1]?Number(i[1]):d?50:5,{tree:p}=await gt(t,r,d?{format:"boxes"}:void 0);if(C(s)){B({depth:r,tree:p??null});return}console.log(typeof p=="string"?p:JSON.stringify(p,null,2))}async function uo(e,t={args:[]}){let s=await yt(e);if(C(t.args)){B(s);return}console.log(s.url)}async function po(e){let{wsPort:t,commandTimeoutMs:s,simId:i,simIdSource:d,positional:r}=e,p=r[1]?Number(r[1]):30,b=Math.max(1e3,(Number.isFinite(p)?p:30)*1e3),h=Math.max(1,Math.ceil(b/500));console.log(" waiting for sim reconnect...");let I=await Et(t,s,i,{attempts:h,simIdSource:d});I||(console.error(" timed out waiting for sim reconnect"),process.exit(1)),I.bridge.close(),Pe({source:"inspect wait",step:{wait:b},summary:`wait ${Math.round(b/1e3)}s`}),console.log(` ready: ${I.count} nodes`)}var mo=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 ms(e,t){if(!t.filter&&!t.equals)return!0;let s=e.data,i=[];if(s&&typeof s=="object")for(let r of["url","displayUrl","message","name","activeName","path","pathname","title","phase","event","type","kind"]){let p=s[r];typeof p=="string"&&p.length>0&&i.push(p)}let d=i.join(" ");return t.equals?i.some(r=>r===t.equals):t.filter?d.toLowerCase().includes(t.filter.toLowerCase()):!0}async function fo(e){let{bridge:t,args:s,positional:i,inspectUsage:d}=e,r=i[1];r||(console.error(d("event","<kind> [--max-ms 5000] [--filter <substring>] [--equals <exact>] [--since now|cursor]")),process.exit(1)),mo.has(r)||console.error(` warning: '${r}' is not a known timeline kind \u2014 waiting anyway. known: ${[...mo].sort().join(", ")}`);let p=Ae(s,"--max-ms"),b=p&&Number.isFinite(Number(p))?Math.max(100,Number(p)):5e3,h=Ae(s,"--filter"),I=Ae(s,"--equals"),w=Ae(s,"--since")??"now",g=s.includes("--json"),M=Date.now(),x=M+b,_=200,O=M;for(;Date.now()<x;){let D={kinds:[r],since:w==="cursor"?void 0:O,limit:50},R=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
|
-
return { ok: true, result: await t.recent(${JSON.stringify(
|
|
464
|
-
})()`});(!
|
|
463
|
+
return { ok: true, result: await t.recent(${JSON.stringify(D)}) }
|
|
464
|
+
})()`});(!R||!R.ok)&&(console.error(` could not query timeline: ${R&&"error"in R?R.error:"unknown"}`),process.exit(1));let A=R.result.events??[];for(let J of A)if(ms(J,{filter:h,equals:I})){let U=Date.now()-M;console.log(g?JSON.stringify({found:!0,elapsedMs:U,event:J}):` ${r} event after ${U}ms${h?` (filter: ${h})`:""}${I?` (equals: ${I})`:""}`);return}R.result.watermark&&R.result.watermark>O&&(O=R.result.watermark),await new Promise(J=>setTimeout(J,_))}let c=Date.now()-M;g?console.log(JSON.stringify({found:!1,elapsedMs:c,kind:r,filter:h,equals:I})):console.error(` \u26A0 wait event ${r} timed out after ${c}ms${h?` (filter: ${h})`:""}${I?` (equals: ${I})`:""}`),process.exit(1)}async function go(e){let{bridge:t,args:s}=e,i=s.includes("--strict"),d=Ie(s,3e3),{elapsed:r,settled:p}=await se({bridge:t,maxMs:d,strict:i});p?console.log(` idle in ${r}ms`):(console.error(` \u26A0 wait idle timed out after ${r}ms (may still be animating)`),process.exit(1))}async function yo(e){let{bridge:t,args:s}=e,i=Ie(s,2e4),{ready:d,elapsedMs:r,nodes:p,targets:b,liveFrameActive:h,liveFrameChannels:I,flag:w,loadingText:g,externalReady:M,externalError:x,suppressedEntryError:_,errors:O,bridgeError:c}=await St(t,i,{onProgress(R){console.error(` still waiting after ${R.elapsedMs}ms \u2014 ${qe(R)} (nodes: ${R.nodes}, targets: ${R.targets}, live surfaces: ${R.liveFrameActive?R.liveFrameChannels:0}, errors: ${R.errors})`)}});if(d){let R=i-r,A=Math.max(100,Math.min(1e4,R)),J=await se({bridge:t,maxMs:A,pollMs:32,stablePolls:2});J.settled||(console.error(` \u26A0 wait ready timed out after ${r+J.elapsed}ms \u2014 app mounted but did not settle (nodes: ${p}, targets: ${b})`),process.exit(1)),console.log(` ready in ${r+J.elapsed}ms: ${p} nodes, ${b} targets${h?`, ${I} live surfaces`:""}`);return}let D=qe({externalError:x,loadingText:g,externalReady:M,flag:w,targets:b,suppressedEntryError:_,bridgeError:c});console.error(` \u26A0 wait ready timed out after ${r}ms \u2014 ${D} (nodes: ${p}, targets: ${b}, live surfaces: ${h?I:0}, errors: ${O})`),process.exit(1)}async function ho(e){let{bridge:t,args:s,positional:i,inspectUsage:d}=e,r=i[1];r||(console.error(d("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,h=s.includes("--gone"),{found:I,node:w,elapsed:g}=await vt(t,r,b,{gone:h});if(h){I?console.log(` #${r} gone after ${g}ms`):(console.error(` \u26A0 wait selector #${r} --gone timed out after ${g??b}ms (still present)`),process.exit(1));return}if(I&&w){let M=w.absolutePosition?`@(${Math.round(w.absolutePosition.x)},${Math.round(w.absolutePosition.y)})`:"",x=w.layout?`${Math.round(w.layout.width)}x${Math.round(w.layout.height)}`:"?x?";console.log(` found #${r} in ${g}ms ${x} ${M}`)}else console.error(` \u26A0 wait selector #${r} timed out after ${g??b}ms`),process.exit(1)}function No(e){return e==null?"\u2014":e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}K`:`${(e/1024/1024).toFixed(1)}M`}function Fo(e){return e==null?" \u2026":e<1e3?`${e}ms`.padStart(5):`${(e/1e3).toFixed(2)}s`.padStart(5)}function bo(){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]}),i=s?.steps?.[0],
|
|
467
|
+
`)}async function $e(e,t){let s=await e.send({type:"perform",steps:[t]}),i=s?.steps?.[0],d=i?.error??s?.error;return{ok:s?.ok===!0,value:i?.value,...d?{error:d}:{}}}async function gs(e){try{return await e.send({type:"evaluate",code:"1"},{timeoutMs:3e3}),!0}catch{return!1}}async function ys(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 jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
483
483
|
} catch {
|
|
484
484
|
return []
|
|
485
485
|
}
|
|
486
|
-
})()`});if(!Array.isArray(s)||s.length===0)return;let i=t.toLowerCase(),
|
|
487
|
-
`).slice(0,5);for(let p of r)console.log(` ${p.trim()}`)}}var vs=120;async function vo(e,t){let s=e.find((
|
|
488
|
-
`),s){let
|
|
486
|
+
})()`});if(!Array.isArray(s)||s.length===0)return;let i=t.toLowerCase(),d=s.map(r=>({id:r,score:hs(i,r.toLowerCase())})).filter(r=>r.score<i.length+4).sort((r,p)=>r.score-p.score).slice(0,5);if(d.length===0)return;console.error(" similar testIDs:");for(let r of d)console.error(` ${r.id}`)}catch{}}function hs(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 bs(e,t)-s}function bs(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),i=new Array(t.length+1);for(let d=0;d<=t.length;d++)s[d]=d;for(let d=1;d<=e.length;d++){i[0]=d;for(let p=1;p<=t.length;p++)i[p]=Math.min(s[p]+1,i[p-1]+1,s[p-1]+(e[d-1]===t[p-1]?0:1));let r=s;s=i,i=r}return s[t.length]}function ws(e){return e.error?"err":e.status==null?" \u2026 ":String(e.status)}function wo(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 xo(e){let t=ae(e.startTs),s=ws(e).padEnd(3),i=e.method.padEnd(5),d=No(e.size).padStart(6),r=Fo(e.durationMs);console.log(` [${t}] ${s} ${i} ${d} ${r} ${e.displayUrl}`),e.error&&console.log(` error: ${e.error}`)}function xs(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",Fo(e.durationMs).trim()],["size",No(e.size)],["content-type",e.type??"\u2014"]];for(let[s,i]of t)console.log(` ${s.padEnd(13)} ${i}`)}var $s={error:"\x1B[31m",warn:"\x1B[33m",info:"\x1B[36m",debug:"\x1B[35m",log:"\x1B[37m"},$o="\x1B[0m",Ss="\x1B[2m";function So(e,t){let s=ae(e.ts),i=e.level.toUpperCase().padEnd(5),d=e.args.join(" ");if(t){let r=$s[e.level];console.log(` ${Ss}[${s}]${$o} ${r}${i}${$o} ${d}`)}else console.log(` [${s}] ${i} ${d}`);if(e.stack&&e.level==="error"){let r=e.stack.split(`
|
|
487
|
+
`).slice(0,5);for(let p of r)console.log(` ${p.trim()}`)}}var vs=120;async function vo(e,t){let s=e.find((M,x)=>e[x-1]==="--id"),i=e.find((M,x)=>e[x-1]==="--text");if(s||i){let M=await t.send({type:"evaluate",code:Dt({id:s,text:i})});if(!M)throw new Error(s?`no node with id "${s}"`:`no node matching text "${i}"`);let{x,y:_,w:O,h:c}=M;return{x,y:_,w:O,h:c}}let d=e.find((M,x)=>e[x-1]==="--area");if(d){let M=d.split(",").map(D=>Number(D.trim()));if(M.length!==4||M.some(D=>!Number.isFinite(D)))throw new Error(`--area expects x,y,w,h (got "${d}")`);let[x,_,O,c]=M;return{x,y:_,w:O,h:c}}let r=M=>{let x=e.find((O,c)=>e[c-1]===M);if(x==null)return null;let _=Number(x);return Number.isFinite(_)?_:null},p=r("--x"),b=r("--y"),h=r("--w"),I=r("--h");if(p!=null||b!=null||h!=null||I!=null)return{x:p??0,y:b??0,w:h??1,h:I??1};let g=e.filter((M,x)=>x>0&&!M.startsWith("-")&&e[x-1]!=="--output"&&e[x-1]!=="--area"&&e[x-1]!=="--id"&&e[x-1]!=="--text"&&e[x-1]!=="--x"&&e[x-1]!=="--y"&&e[x-1]!=="--w"&&e[x-1]!=="--h").map(Number).filter(M=>Number.isFinite(M));if(g.length>=2){let[M,x,_=1,O=1]=g;return{x:M,y:x,w:_,h:O}}return null}function ko(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 i=[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 ");i&&(console.log(` raster skips: ${i} (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 Io(e){let t=e.avgMs>0?(1e3/e.avgMs).toFixed(1):"?",s=e.jank&&typeof e.jank=="object"?e.jank:null,i=e.compositorProduction&&typeof e.compositorProduction=="object"?e.compositorProduction:null,d=i?.budgetMs??8;if(console.log(` shell frame profile:
|
|
488
|
+
`),s){let M=(Array.isArray(s.compositor)?s.compositor:[]).reduce((x,_)=>x+(_.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 ${M} \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}%) >${d}ms \xB7 max ${s.shell?.maxMs??0}ms`);for(let g of Array.isArray(s.compositor)?s.compositor:[])console.log(` ${String(g.surfaceId).padEnd(12)} ${g.jankPaints}/${g.sampledPaints} compositor paints (${g.jankPct}%) >${d}ms \xB7 max ${g.maxMs}ms`)}else console.log(` jank: ${e.jankFrames} frames (${e.jankPct}%) >${d}ms`);if(console.log(` avg per frame: overlay ${e.avgOverlayMs}ms \xB7 aux ${e.avgAuxMs}ms \xB7 layout ${e.avgLayoutMs}ms`),i){let g=i.frames??{};console.log(""),console.log(` compositor production (${d}ms budget):`),console.log(` frames: ${g.count??0} \xB7 avg ${Number(g.avg??0).toFixed(2)} / p95 ${Number(g.p95??0).toFixed(2)} / max ${Number(g.max??0).toFixed(2)} ms \xB7 ${i.overBudget??0} over budget (${i.overBudgetPct??0}%)`);let M=[["javascript","javascript"],["layout","layout"],["paint","paint"],["prewarm","prewarm"],["texture upload","textureUpload"],["gpu submit","gpuSubmit"],["composite","composite"],["capture/readback","capture"]];for(let[O,c]of M){let D=i.phases?.[c];!D?.count||!D.max&&!D.avg||console.log(` ${O.padEnd(16)} avg ${Number(D.avg??0).toFixed(2)} / p95 ${Number(D.p95??0).toFixed(2)} / max ${Number(D.max??0).toFixed(2)} ms`)}let x=i.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 _=Array.isArray(i.worstFrames)?i.worstFrames.slice(0,5):[];if(_.length>0){console.log(" worst frames:");for(let O of _){let c=O.phases??{};console.log(` ${Number(O.productionMs??0).toFixed(2)}ms frame ${O.frameToken??"?"} \xB7 js ${Number(c.javascriptMs??0).toFixed(2)} \xB7 layout ${Number(c.layoutMs??0).toFixed(2)} \xB7 paint ${Number(c.paintMs??0).toFixed(2)} \xB7 prewarm ${Number(c.prewarmMs??0).toFixed(2)} \xB7 upload ${Number(c.textureUploadMs??0).toFixed(2)} \xB7 submit ${Number(c.gpuSubmitMs??0).toFixed(2)} \xB7 composite ${Number(c.compositeMs??0).toFixed(2)} \xB7 capture ${Number(c.captureMs??0).toFixed(2)}`)}}}let r=e.cadence;r&&typeof r=="object"&&(console.log(""),console.log(` cadence (frame delivery, ${r.vsyncTicks} vsync ticks):`),console.log(` display clock: ${r.displayHz}hz \xB7 host rAF interval p50 ${r.hostIntervalP50} / p95 ${r.hostIntervalP95} / max ${r.hostIntervalMax} ms${r.hostGaps?` \xB7 ${r.hostGaps} gaps >1.5x (host rAF starved)`:""}`),console.log(` delivery lag: p50 ${r.deliveryLagP50} / p95 ${r.deliveryLagP95} / max ${r.deliveryLagMax} ms (vsync postMessage \u2192 shell receipt)`),console.log(` paint interval: p50 ${r.paintIntervalP50} / p95 ${r.paintIntervalP95} / max ${r.paintIntervalMax} ms${r.idleBreaks?` \xB7 ${r.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 g=(M,x)=>{x?.count&&console.log(` ${M}: ${x.count} samples \xB7 p50 ${x.p50.toFixed(2)} / p95 ${x.p95.toFixed(2)} / max ${x.max.toFixed(2)} ms`)};g("engine-empty rAF",p.phases?.uninterruptedEngineEmpty),g("rAF with CanvasKit flush",p.phases?.withCanvaskitFlush),g("rAF after CanvasKit flush",p.phases?.afterCanvaskitFlush),g("CanvasKit submission",p.canvaskitSubmission)}let b=Array.isArray(e.auxSurfaces)?e.auxSurfaces:[],h=e.graphiteCaches,I=e.decodedImageCache;if(h||I){let g=(M,x)=>{if(typeof x?.bytes!="number"||typeof x.limitBytes!="number")return;let _=typeof x.purgeableBytes=="number"?` \xB7 ${(x.purgeableBytes/1024/1024).toFixed(1)}MB purgeable`:"";console.log(` ${M.padEnd(29)} ${(x.bytes/1024/1024).toFixed(1)}MB/${(x.limitBytes/1024/1024).toFixed(1)}MB${_}`)};console.log(""),console.log(" device-wide caches:"),g("Graphite context resources",h?.contextResources??null),g("Graphite recorder resources",h?.recorderResources??null),g("Graphite image provider",h?.imageProvider??null),g("decoded image pixels",I??null),h?.imageProvider&&console.log(` ${"".padEnd(29)} ${h.imageProvider.entries} entries \xB7 ${h.imageProvider.uploads} uploads \xB7 ${h.imageProvider.evictions} evictions`),I&&console.log(` ${"".padEnd(29)} ${I.entries} entries/${I.maxEntries} max`)}if(b.length>0){console.log(""),console.log(" surfaces (last 100 frames):");for(let g of b)console.log(` ${String(g.surfaceId).padEnd(10)} ${String(g.frames).padStart(4)} paints avg ${g.avgMs}ms (layout ${g.avgLayoutMs}, render ${g.avgRenderMs}, flush ${g.avgFlushMs}) max ${g.maxMs}ms`)}ko("shell worker",e.renderProfile),ko("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 g of w){if(g.source==="compositor"){console.log(` ${String(g.totalMs).padStart(7)}ms compositor ${g.surfaceId} paint ${g.paint} \xB7 layout ${g.layoutMs} \xB7 render ${g.renderMs} \xB7 flush ${g.flushMs}`);continue}let M=(g.auxSurfaces??[]).map(x=>`${x.surfaceId} ${x.totalMs}ms (layout ${x.layoutMs}, render ${x.renderMs})`).join(" \xB7 ");console.log(` ${String(g.totalMs).padStart(7)}ms overlay ${g.overlayMs} \xB7 aux ${g.auxMs} \xB7 layout ${g.layoutMs}${M?` [${M}]`:""}`)}}}async function _e(e,t,s){let i=Date.now()+t,d=await ue(e,t);for(;;){if(s(d))return{settled:!0,state:d};if(Date.now()>=i)return{settled:!1,state:d};await oe(16),d=await ue(e)}}async function ot(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 jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
524
524
|
frame: runtimeSnapshot?.keyboard?.frame ?? null,
|
|
525
525
|
focusedRect: runtimeSnapshot?.focused?.rect ?? null,
|
|
526
526
|
}
|
|
527
|
-
})()`}).then(t=>et(t))}function ks(e,t,s){if(!e.visible)return!1;let i=e.focusedInput;return!(t&&i&&!(i.testID===t||i.id===t)||s!==null&&we(e)!==s)}async function Is(e,t=600,s={}){let i=Date.now()+t;for(;Date.now()<=i;){let
|
|
527
|
+
})()`}).then(t=>et(t))}function ks(e,t,s){if(!e.visible)return!1;let i=e.focusedInput;return!(t&&i&&!(i.testID===t||i.id===t)||s!==null&&we(e)!==s)}async function Is(e,t=600,s={}){let i=Date.now()+t;for(;Date.now()<=i;){let d=await ot(e);if(ks(d,s.targetId??null,s.secureTextEntry??null))return d;await oe(30)}return ot(e)}async function De(e,t){let s=await ot(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 To(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,24 +547,24 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}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 Ts(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 i=e.match(/^Key([A-Z])$/);return i?i[1].toLowerCase():null}function Ms(e){if(typeof e!="string")return null;let t=e.replace(/\s+/g," ").trim();return t?t.slice(0,80):null}function Oo(...e){for(let t of e){if(typeof t!="string")continue;let s=t.trim();if(s)return s}return null}function Ns(e){let t=e.indexOf("--node-id");if(t<0)return null;let s=e[t+1];if(!s)return null;let i=Number(s);return Number.isInteger(i)&&i>0?i:null}async function W(e,t,s){let i=
|
|
551
|
-
`),process.exit(0))}if(
|
|
550
|
+
})()`})}function Ts(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 i=e.match(/^Key([A-Z])$/);return i?i[1].toLowerCase():null}function Ms(e){if(typeof e!="string")return null;let t=e.replace(/\s+/g," ").trim();return t?t.slice(0,80):null}function Oo(...e){for(let t of e){if(typeof t!="string")continue;let s=t.trim();if(s)return s}return null}function Ns(e){let t=e.indexOf("--node-id");if(t<0)return null;let s=e[t+1];if(!s)return null;let i=Number(s);return Number.isInteger(i)&&i>0?i:null}async function W(e,t,s){let i=Pe({source:e,step:t,summary:s});i.active&&(i.replaced?console.error(` draft: replaced unkept action "${i.replaced.summary}" \u2014 \`maestro keep\` commits one action at a time`):console.error(" draft: action pending \u2014 `rnxsim maestro keep` to commit"))}function Mo(e,t,s){if(!s||s.hit===!1)return null;let i=Oo(s.responderTestID,s.testID);if(i)return{step:{tapOn:{id:i}},summary:`tap #${i}`};let d=Ms(s.text);return d?{step:{tapOn:d},summary:`tap "${d}"`}:{step:{tapAtCoords:{x:e,y:t}},summary:`tap @${Math.round(e)},${Math.round(t)}`}}function tt(e,t,s){let i=Oo(t?.testID,t?.id);return i?{step:{tapOn:{id:i}},summary:`tap #${i}`}:s==="id"?{step:{tapOn:{id:e}},summary:`tap #${e}`}:{step:{tapOn:e},summary:`tap "${e}"`}}async function _r(e,t){let s=e[0]==="get"||e[0]==="do"||e[0]==="debug"||e[0]==="wait"?e[0]:null,i=s?e.slice(1):e,d=ct(i,{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"]}),r=d.positional,p=r[0],b=s,h=typeof i[0]=="string"&&st.has(i[0]),I=h?i[0]:null,w=S=>{if(t.internalPerfCommand&&S==="perf")return`rnxsim perf ${t.internalPerfCommand}`;if(h&&S===i[0])return`rnxsim ${S}`;let o=b??nt(S)?.group;return o?`rnxsim ${o} ${S}`:`rnxsim ${S}`},g=(S,o)=>` usage: ${w(S)}${o?` ${o}`:""}`;if(!p||e.includes("--help")||e.includes("-h")){let S={bridgePort:7668,defaultShellUrl:at};if(b==="do"||b==="get"||b==="debug"||b==="wait"){let n=Be(b,S);n&&(console.log(`${n}
|
|
551
|
+
`),process.exit(0))}if(I==="shell"){let n=rt("shell",S);n&&(console.log(`${n}
|
|
552
552
|
`),process.exit(0))}let o=["do","get","debug","wait"].map(n=>Be(n,S)).filter(n=>n!=null).join(`
|
|
553
553
|
|
|
554
554
|
`);console.log(`${o}
|
|
555
|
-
`),process.exit(0)}let
|
|
556
|
-
`);let n=Math.max(...o.map(l=>l.id.length),6),a=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(a);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
|
|
557
|
-
`)}catch{}}function
|
|
555
|
+
`),process.exit(0)}let M=d.wsPort,x=d.simId,_=d.simIdSource,O=d.commandTimeoutMs;if(b==="get"&&p==="diagnosis"){let S=i.indexOf("diagnosis"),o=S>=0?[...i.slice(0,S),...i.slice(S+1)]:i,{runDiagnose:n}=await import("./diagnose-XZYAGIEN.js"),a=await n(["recent",...o],t);process.exitCode=a;return}if(b==="do"&&p==="scan"){let{runCamera:S}=await import("./camera-IYDWHB6P.js");process.exitCode=await S(i,{port:t.port});return}if(p==="list"&&i.some(S=>S==="--drivers"||S==="-D")){let{buildDriverListRows:S}=await import("./drivers-4HU5USPO.js"),o=S();console.log(` available drivers (${o.length}):
|
|
556
|
+
`);let n=Math.max(...o.map(l=>l.id.length),6),a=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(a);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 c=dt(d),D=x||"default",R=new Set(["errors","warnings","requests","js","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 a=/<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=a||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 T(S){let o=fe()?400:200;try{let{settled:n,elapsed:a}=await se({bridge:S,maxMs:o,pollMs:32,stablePolls:2});n||process.stderr.write(` \u26A0 auto-wait timed out after ${a??o}ms \u2014 next command may see mid-animation state. use \`rnxsim do settle\` for a longer wait.
|
|
557
|
+
`)}catch{}}function P(S,o){if(o.result?.reason==="offscreen"){let{x:n,y:a,screen:l}=o.result;console.error(` tap failed: ${S} resolved to (${Math.round(n)},${Math.round(a)}), 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 c.send({type:"evaluate",code:`(() => ({
|
|
558
558
|
console: ${Te},
|
|
559
559
|
requests: window.__sootsimTest?.getRequestCounts?.() || null,
|
|
560
|
-
}))()`})||{console:null,requests:null}}catch{return{console:null,requests:null}}}async function K(S={}){let o=S.counts!==void 0?S.counts:await X(
|
|
561
|
-
network: ${n} failed request${n===1?"":"s"}`),console.log(` inspect: ${
|
|
560
|
+
}))()`})||{console:null,requests:null}}catch{return{console:null,requests:null}}}async function K(S={}){let o=S.counts!==void 0?S.counts:await X(c,"getRequestCounts");if(!o||typeof o!="object")return;let n=Math.max(0,Number(o.failed)||0);if(n===0||!S.includeTail&&!ze("requests",D,String(n))||(console.log(`
|
|
561
|
+
network: ${n} failed request${n===1?"":"s"}`),console.log(` inspect: ${w("requests")} 5`),!S.includeTail))return;let a=await X(c,"getFailedRequests",5);if(!(!Array.isArray(a)||a.length===0)){console.log(`
|
|
562
562
|
recent failed requests:
|
|
563
563
|
`);for(let l of a){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(`
|
|
564
|
-
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
|
|
565
|
-
console: ${u.join(", ")}`),console.error(` inspect: ${
|
|
564
|
+
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 c.send({type:"evaluate",code:Te});if(!o||typeof o!="object")return;let n=o,a=Math.max(0,Number(n.errors)||0),l=Math.max(0,Number(n.warnings)||0);if(a===0&&l===0||!S.includeTail&&!ze("console",D,`${a}:${l}`))return;let u=[];if(a>0&&u.push(`${a} console error${a===1?"":"s"}`),l>0&&u.push(`${l} console warning${l===1?"":"s"}`),console.error(`
|
|
565
|
+
console: ${u.join(", ")}`),console.error(` inspect: ${w("errors")} 5`),l>0&&console.error(` inspect: ${w("warnings")} 5`),!S.includeTail||a===0)return;let m=await ge(c,5);if(!(!Array.isArray(m)||m.length===0)){console.error(`
|
|
566
566
|
recent console errors:
|
|
567
|
-
`);for(let f of m){let $=ae(f.timestamp),
|
|
567
|
+
`);for(let f of m){let $=ae(f.timestamp),y=Array.isArray(f.args)?f.args.map(k=>typeof k=="object"?JSON.stringify(k):String(k)).join(" "):String(f);console.error(` [${$}] ${y}`)}}}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=it(),n=null;try{n=await pt(S,`(() => {
|
|
568
568
|
const tl = window.SootSim && window.SootSim.bridges && window.SootSim.bridges.timeline
|
|
569
569
|
if (!tl || typeof tl.summary !== 'function') return null
|
|
570
570
|
const cursorKey = ${JSON.stringify(o)}
|
|
@@ -580,9 +580,9 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
return summary ? { summary, consoleSplit } : null
|
|
583
|
-
})()`)}catch{return}if(!n||!n.summary||!n.summary.total)return;let a=n.summary.byKind??{},l=[],u=new Set;for(let m of ie){let f=a[m];if(f)if(u.add(m),m==="console"&&n.consoleSplit){let{error:$,warn:
|
|
584
|
-
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
|
|
585
|
-
`);for(let n of o){let a=[];if(a.push(`[${n.role}]`),n.label){let l=n.label.length>50?n.label.slice(0,47)+"...":n.label;a.push(`"${l}"`)}if(n.hint&&a.push(`(hint: "${n.hint}")`),n.testID&&a.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&&a.push(`{${l.join(", ")}}`)}n.position&&a.push(`@(${n.position.x},${n.position.y})`),n.size&&a.push(`${n.size.w}x${n.size.h}`),console.log(" "+a.join(" "))}}break}case"find":{await eo({bridge:
|
|
583
|
+
})()`)}catch{return}if(!n||!n.summary||!n.summary.total)return;let a=n.summary.byKind??{},l=[],u=new Set;for(let m of ie){let f=a[m];if(f)if(u.add(m),m==="console"&&n.consoleSplit){let{error:$,warn:y}=n.consoleSplit;$>0&&l.push(`${$} error${$===1?"":"s"}`),y>0&&l.push(`${y} warning${y===1?"":"s"}`)}else l.push(`${f} ${m}${f===1?"":"s"}`)}for(let[m,f]of Object.entries(a))!u.has(m)&&f&&l.push(`${f} ${m}${f===1?"":"s"}`);if(l.length!==0&&(console.error(`
|
|
584
|
+
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 q=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)),q.has(p)&&await ut(c),le.has(p)&&await pe(c,{verbose:ve});try{let S=q.has(p)?await Ot(c):[];switch(p){case"list":{lt(d.wsPort),await so({bridge:c,simId:x,args:i});break}case"tree":{await co({bridge:c,args:i,positional:r});break}case"a11y":{let o=await xt(c);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):
|
|
585
|
+
`);for(let n of o){let a=[];if(a.push(`[${n.role}]`),n.label){let l=n.label.length>50?n.label.slice(0,47)+"...":n.label;a.push(`"${l}"`)}if(n.hint&&a.push(`(hint: "${n.hint}")`),n.testID&&a.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&&a.push(`{${l.join(", ")}}`)}n.position&&a.push(`@(${n.position.x},${n.position.y})`),n.size&&a.push(`${n.size.w}x${n.size.h}`),console.log(" "+a.join(" "))}}break}case"find":{await eo({bridge:c,args:e,effectiveArgs:i,positional:r,inspectUsage:g});break}case"count":{await Qt(c,{args:i});break}case"keyboard":{await oo(c,{json:e.includes("--json")});break}case"screens":{await io(c,{json:e.includes("--json")});break}case"memory":{await ro(c,{args:i});break}case"wait":{await po({wsPort:M,commandTimeoutMs:O,simId:x,simIdSource:_,positional:r});break}case"sleep":{await lo({positional:r,inspectUsage:g});break}case"settle":{await ao({bridge:c,args:e,positional:r});break}case"ready":{await yo({bridge:c,args:e});break}case"idle":{await go({bridge:c,args:e,positional:r});break}case"selector":{await ho({bridge:c,args:e,positional:r,inspectUsage:g});break}case"event":{await fo({bridge:c,args:e,positional:r,inspectUsage:g});break}case"layout":{let o=r[1];if(!o){await to({bridge:c,args:i});break}let n=await c.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(($,y)=>e[y-1]==="--output")||"/tmp/sootsim-inspect.png",a=await vo(e,c),l={type:"screenshot"};a&&(l.crop=a);let m=(await c.send(l)).replace(/^data:image\/png;base64,/,"");a&&console.log(` area: x=${a.x} y=${a.y} w=${a.w} h=${a.h}`),(await import("fs")).writeFileSync(n,Buffer.from(m,"base64")),console.log(` saved: ${n}`);break}case"sample-color":{let o=await vo(e,c);o||(console.error(g("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 c.send({type:"evaluate",code:Bt(o)});if(e.includes("--json"))console.log(JSON.stringify(n,null,2));else{let{r:a,g:l,b:u,a:m,hex:f,samples:$}=n,y=o.w===1&&o.h===1?`@(${o.x},${o.y})`:`@(${o.x},${o.y}) ${o.w}x${o.h}`;console.log(` ${f} rgba(${a}, ${l}, ${u}, ${m}) ${y} ${$} samples`)}break}case"node":{let o=r[1];o||(console.error(g("node","<matcher>")),console.error(" resolves testID, id, then text \u2014 dumps full node info as JSON"),process.exit(1));let n=await c.send({type:"evaluate",code:`(async () => {
|
|
586
586
|
const t = window.__sootsimTest
|
|
587
587
|
const q = ${JSON.stringify(o)}
|
|
588
588
|
let node = null
|
|
@@ -638,7 +638,7 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
638
638
|
transform,
|
|
639
639
|
parentChain,
|
|
640
640
|
}
|
|
641
|
-
})()`});console.log(JSON.stringify(n,null,2));break}case"tap":{let o=Number(r[1]),n=Number(r[2]),a=xe(e,r);if(a){let m=await be(
|
|
641
|
+
})()`});console.log(JSON.stringify(n,null,2));break}case"tap":{let o=Number(r[1]),n=Number(r[2]),a=xe(e,r);if(a){let m=await be(c,{agent:fe(),textFallback:a.mode==="text"?a.value:void 0,resolve:async()=>{let y=await Ee(c,a);return y?{cx:y.x,cy:y.y,match:{id:a.mode==="testid"?a.value:y.id??null,testID:a.mode==="testid"?a.value:y.testID??null,text:a.mode==="text"?a.value:y.text??null,type:y.type??null},target:{id:y.id??null,testID:y.testID??null,text:y.text??null,type:y.type??null}}:null}}),f=m.payload;(!f||typeof f.cx!="number")&&(console.error(` not found: ${a.value}`),a.mode==="testid"&&Q("wait-selector-for-missing-testid",a.value),process.exit(1)),me(m.result)||(P(`${a.mode} "${a.value}"`,m),process.exit(1));let $=Mo(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(g("tap","<testid> | <x> <y> | --testid <id> | --text <t>")),process.exit(1));let l=await Yt(c,o,n),u=Mo(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(r[1]),n=Number(r[2]),a=Number(r[3]),l=Number(r[4]),u=p==="swipe"?10:12,m=p==="swipe"?8:16,f=r[5]?Number(r[5]):u,$=r[6]?Number(r[6]):m;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(a)||!Number.isFinite(l)||!Number.isFinite(f)||!Number.isFinite($))&&(console.error(g(p,"<x1> <y1> <x2> <y2> [steps] [stepMs]")),process.exit(1));let y=await $e(c,{type:"drag",fromX:o,fromY:n,toX:a,toY:l,steps:Math.max(1,Math.round(f)),stepMs:Math.max(0,Math.round($))});if(y?.ok){let k=Math.max(1,Math.round(Math.max(1,f)*Math.max(0,$)));await W(`inspect ${p}`,{swipe:{start:`${o}, ${n}`,end:`${a}, ${l}`,duration:k}},`${p} ${o},${n} -> ${a},${l}`)}console.log(JSON.stringify(y,null,2));break}case"pinch":{let o=Number(r[1]),n=Number(r[2]),a=Number(r[3]),l=Number(r[4]),u=Number(r[5]),m=Number(r[6]),f=Number(r[7]),$=Number(r[8]),y=r[9]?Number(r[9]):12,k=r[10]?Number(r[10]):16;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(a)||!Number.isFinite(l)||!Number.isFinite(u)||!Number.isFinite(m)||!Number.isFinite(f)||!Number.isFinite($)||!Number.isFinite(y)||!Number.isFinite(k))&&(console.error(g("pinch","<x1> <y1> <x2> <y2> <x1'> <y1'> <x2'> <y2'> [steps] [stepMs]")),process.exit(1));let L=await $e(c,{type:"pinch",fromX1:o,fromY1:n,fromX2:a,fromY2:l,toX1:u,toY1:m,toX2:f,toY2:$,steps:Math.max(1,Math.round(y)),stepMs:Math.max(0,Math.round(k))});L?.ok&&await W("inspect pinch",{pinch:{from:[o,n,a,l],to:[u,m,f,$],steps:Math.max(1,Math.round(y)),stepMs:Math.max(0,Math.round(k))}},`pinch (${o},${n}) (${a},${l}) -> (${u},${m}) (${f},${$})`),console.log(JSON.stringify(L,null,2));break}case"tap-text":{let o=r[1];o||(console.error(g("tap-text","<text>")),process.exit(1));let n=z=>{let j=e.indexOf(z);return j>=0&&j+1<e.length?e[j+1]:null},a=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"),$=a("--exact"),y=a("--first"),k=n("--min-y"),L=n("--max-y"),V=n("--min-x"),G=n("--max-x");for(let[z,j]of[["--min-y",k],["--max-y",L],["--min-x",V],["--max-x",G]])j!==null&&!Number.isFinite(Number(j))&&(console.error(` ${z} requires a number, got: ${j}`),process.exit(1));let Y=e.indexOf("--near"),E=null;if(Y>=0){let z=Number(e[Y+1]),j=Number(e[Y+2]);(!Number.isFinite(z)||!Number.isFinite(j))&&(console.error(" --near requires two numbers: --near <x> <y>"),process.exit(1)),E={x:z,y:j}}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:y},N=await Xt(c,o,v,{agent:fe()}),F=N.payload;if(F?.error==="bridge-not-ready"&&(console.error(" rnxsim test bridge not ready"),process.exit(1)),F?.ambiguous){let z=F.candidates;console.error(` ambiguous: ${F.total} matches for "${o}"`);for(let j of z){let ke=j.abs?`@(${Math.round(j.abs.x)},${Math.round(j.abs.y)})`:"",Po=j.layout?` ${j.layout.width}x${j.layout.height}`:"",Ro=j.testID?` #${j.testID}`:"",Eo=j.text?` "${j.text}"`:"",Ao=j.ancestorTestIDs.length>0?` within ${j.ancestorTestIDs.slice(0,3).map(_o=>`#${_o}`).join(" > ")}`:"";console.error(` [${j.idx}] <${j.type}>${Eo}${Ro} ${ke}${Po}${Ao}`)}F.total>z.length&&console.error(` ... and ${F.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)}F?.nthOutOfRange&&(console.error(` not found: nth ${F.nth} of ${F.total} match${F.total===1?"":"es"} for "${o}"`),process.exit(1)),(!F||typeof F.cx!="number")&&(console.error(` not found: ${o}`),process.exit(1)),me(N.result)||(P(`text "${o}"`,N),process.exit(1));let ne=tt(o,{id:F.target?.id??null,testID:F.target?.testID??null,type:F.target?.type??null,cx:F.cx,cy:F.cy},"text");await W("inspect tap-text",ne.step,ne.summary),console.log(JSON.stringify({matched:F.match,tapped:{nodeId:F.target?.nodeId??null,id:F.target?.id??null,testID:F.target?.testID??null,type:F.target?.type??null,cx:F.cx,cy:F.cy},...F.strategy&&F.strategy!=="matched-node"?{strategy:F.strategy}:{},...F.total>1||u!==null?{nth:{index:F.idx,total:F.total}}:{},...N.attempts>1?{attempts:N.attempts}:{},result:N.result},null,2));break}case"tap-best":{let o=r[1];o||(console.error(g("tap-best","<query>")),process.exit(1));let n=await Vt(c,o,{agent:fe()}),a=n.payload;a||(console.error(` tap-best: no testID or visible text matched "${o}". try \`rnxsim find --interactive-targets\` to list candidates.`),process.exit(1)),"error"in a&&(console.error(` ${a.error}`),process.exit(1)),a.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=a.node;me(n.result)||(P(`best "${o}"`,n),process.exit(1));let u=tt(o,{id:l.id,testID:l.testID,type:l.type,cx:a.cx,cy:a.cy},a.strategy==="testid"?"id":"text");await W("inspect tap-best",u.step,u.summary),console.log(JSON.stringify({matched:{strategy:a.strategy,nodeId:l.nodeId,id:l.id,testID:l.testID,type:l.type,text:l.text},tapped:{cx:a.cx,cy:a.cy},...n.attempts>1?{attempts:n.attempts}:{},result:n.result},null,2));break}case"tap-id":{let o=r[1];o||(console.error(g("tap-id","<id>")),process.exit(1));let n=await zt(c,o,{agent:fe()}),a=n.payload;(!a||typeof a.cx!="number")&&(console.error(` not found: ${o}`),await ys(c,o),process.exit(1)),me(n.result)||(P(`id "${o}"`,n),process.exit(1));let l=tt(o,{id:a.target?.id??null,testID:a.target?.testID??null,type:a.target?.type??null,cx:a.cx,cy:a.cy},"id");await W("inspect tap-id",l.step,l.summary),console.log(JSON.stringify({matched:a.match,tapped:{nodeId:a.target?.nodeId??null,id:a.target?.id??null,testID:a.target?.testID??null,type:a.target?.type??null,cx:a.cx,cy:a.cy},...a.strategy&&a.strategy!=="matched-node"?{strategy:a.strategy}:{},...n.attempts>1?{attempts:n.attempts}:{},result:n.result},null,2));break}case"type-into":{let o=r[1],n=r.slice(2).join(" ");(!o||!n)&&(console.error(g("type-into","<id> <text>")),process.exit(1));let a=JSON.stringify(o),l=await c.send({type:"evaluate",code:`(async () => {
|
|
642
642
|
const t = window.__sootsimTest
|
|
643
643
|
if (!t) return null
|
|
644
644
|
const n = await (t.findByTestId(${a}) || t.findById(${a}))
|
|
@@ -653,7 +653,7 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
653
653
|
secureTextEntry: !!n.secureTextEntry,
|
|
654
654
|
placeholder: n.placeholder || null,
|
|
655
655
|
}
|
|
656
|
-
})()`});(!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
|
|
656
|
+
})()`});(!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 c.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 Is(c,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 c.send({type:"keyboard",action:"type",text:n});let y=m||we(f),k=y?Z:Ze(n,f),L=y&&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:y,keyboardOpened:f.visible??u?.keyboardOpened??!1,focusedInput:L,typed:k},null,2));break}case"type":{let o=r.slice(1).join(" ");o||(console.error(g("type","<text>")),process.exit(1));let n=await De(c,"type");await c.send({type:"keyboard",action:"type",text:o});let a=Ze(o,n);await W("inspect type",{inputText:a},a===Z?`type ${Z}`:`type ${JSON.stringify(o)}`),console.log(a===Z?` typed: ${Z}`:` typed: ${JSON.stringify(o)}`);break}case"key":{let o=r[1];o||(console.error(g("key","<name>")),process.exit(1)),await De(c,"key"),await c.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=r.slice(1);o.length===0&&(console.error(g("key-sequence","<key> [<key> ...]")),process.exit(1)),await De(c,"key-sequence");for(let n of o)await c.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=r.slice(1);o.length===0&&(console.error(g("keycode","<code> [<code> ...]")),process.exit(1));let n=o.map(l=>({code:l,key:Ts(l)})),a=n.filter(l=>!l.key);a.length>0&&(console.error(` unsupported keycode(s): ${a.map(l=>l.code).join(", ")}`),process.exit(1)),await De(c,"keycode");for(let l of n)await c.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=r[1];o||(console.error(g("dispatch","<char>")),process.exit(1)),await c.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 c.send({type:"keyboard",action:"dismiss"}),await W("inspect dismiss",{hideKeyboard:!0},"dismiss keyboard"),console.log(" keyboard dismissed");break}case"double-tap":{let o=Number(r[1]),n=Number(r[2]),a=xe(e,r);if(a){let $=await Ee(c,a);$||(console.error(` not found: ${a.value}`),a.mode==="testid"&&Q("wait-selector-for-missing-testid",a.value),process.exit(1)),o=$.x,n=$.y}let l=r[3]?Number(r[3]):80;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(l))&&(console.error(g("double-tap","<testid> | <x> <y> [gapMs] | --testid <id>")),process.exit(1));let u=Math.max(0,Math.round(l)),f={...await $e(c,{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(r[1]),n=Number(r[2]),a=xe(e,r),l=null;if(a){let y=await Ee(c,a);y||(console.error(` not found: ${a.value}`),a.mode==="testid"&&Q("wait-selector-for-missing-testid",a.value),process.exit(1)),o=y.x,n=y.y,l={id:y.id??null,testID:y.testID??null,text:y.text??null,type:y.type??null}}let u=a?r[1]:r[3],m=u?Number(u):600;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(m))&&(console.error(g("long-press","<testid> | <x> <y> [durationMs] | --testid <id>")),process.exit(1));let f=Math.max(0,Math.round(m)),$=await c.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=r[1],n=Number(r[2]),a=Number(r[3]),l=r[4]?Number(r[4]):999,u=o==="down"?"touchDown":o==="move"?"touchMove":o==="up"?"touchUp":o==="cancel"?"touchCancel":null;u||(console.error(g("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1)),o!=="cancel"&&(!Number.isFinite(n)||!Number.isFinite(a))&&(console.error(g("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1));let m=Math.max(1,Math.round(l)),f=await $e(c,u==="touchCancel"?{type:u,pointerId:m}:{type:u,x:n,y:a,pointerId:m});f?.ok&&o!=="cancel"&&await W("inspect touch",{tapAtCoords:{x:n,y:a}},`touch ${o} @${n},${a}`),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=r[1],a=r[2]?Number(r[2]):220;(!n||!Number.isFinite(a))&&(console.error(g("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 c.send({type:"evaluate",code:`(async () => {
|
|
657
657
|
const spec = globalThis.__sootsimDeviceSpec || {}
|
|
658
658
|
return {
|
|
659
659
|
width: spec.width || window.innerWidth || 393,
|
|
@@ -661,7 +661,7 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
661
661
|
statusBarHeight: spec.statusBarHeight || 0,
|
|
662
662
|
homeIndicatorHeight: spec.homeIndicatorHeight || 0,
|
|
663
663
|
}
|
|
664
|
-
})()`}),u=Number(l?.width)||393,m=Number(l?.height)||852,f=Number(l?.statusBarHeight)||0,$=Number(l?.homeIndicatorHeight)||0,
|
|
664
|
+
})()`}),u=Number(l?.width)||393,m=Number(l?.height)||852,f=Number(l?.statusBarHeight)||0,$=Number(l?.homeIndicatorHeight)||0,y=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=y,N=k,F=y,ne=k;switch(n){case"scroll-up":N=k+Math.round(Y/2),ne=k-Math.round(Y/2);break;case"scroll-down":N=k-Math.round(Y/2),ne=k+Math.round(Y/2);break;case"scroll-left":v=y+Math.round(E/2),F=y-Math.round(E/2);break;case"scroll-right":v=y-Math.round(E/2),F=y+Math.round(E/2);break;case"swipe-from-left-edge":v=G,N=k,F=Math.min(u-G,G+E);break;case"swipe-from-right-edge":v=u-G,N=k,F=Math.max(G,u-G-E);break;case"swipe-from-top-edge":v=y,N=L,ne=Math.min(m-V,L+Y);break;case"swipe-from-bottom-edge":v=y,N=m-V,ne=Math.max(L,m-V-Y);break}let z=Math.max(8,Math.round(a/16)),j=Math.max(1,Math.round(a/z)),ke=await $e(c,{type:"drag",fromX:v,fromY:N,toX:F,toY:ne,steps:z,stepMs:j});ke?.ok&&await W("inspect gesture",{swipe:{start:`${v}, ${N}`,end:`${F}, ${ne}`,duration:Math.max(1,Math.round(a))}},`gesture ${n}`),console.log(JSON.stringify({preset:n,from:{x:v,y:N},to:{x:F,y:ne},result:ke},null,2));break}case"scroll":{let o=xe(e),n=Ns(e),a=o?.mode==="testid"?o.value:n==null?r[1]:null,l=o||n!=null?1:2,u=Number(r[l]),m=Number(r[l+1]);(!a&&n==null||!Number.isFinite(u)||!Number.isFinite(m))&&(console.error(g("scroll","<id> <x> <y> | --testid <id> <x> <y> | --node-id <nodeId> <x> <y>")),process.exit(1));let f=await c.send({type:"evaluate",code:`(async () => {
|
|
665
665
|
const t = window.__sootsimTest
|
|
666
666
|
if (!t) return null
|
|
667
667
|
const n = ${n!=null?`await t.inspectByNodeId(${JSON.stringify(n)})`:`await t.findByTestId(${JSON.stringify(a)})
|
|
@@ -671,8 +671,8 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
671
671
|
cx: n.absolutePosition.x + (n.layout.width || 0) / 2,
|
|
672
672
|
cy: n.absolutePosition.y + (n.layout.height || 0) / 2,
|
|
673
673
|
}
|
|
674
|
-
})()`}),$=await X(
|
|
675
|
-
${
|
|
674
|
+
})()`}),$=await X(c,"scrollTo",n!=null?{nodeId:n}:a,u,m,!1);if($?.ok){let y=n!=null?`node ${n}`:`#${a}`;await W("inspect scroll",{scrollTo:{...n!=null?{nodeId:n}:{id:a},x:u,y:m}},`scroll ${y} -> ${u},${m}`)}console.log(JSON.stringify({...$,...f?{at:{x:f.cx,y:f.cy}}:{}},null,2));break}case"state":{let o=r[1];if(s==="get"&&!o){let a=await X(c,"getRuntimeState"),l=await c.send({type:"evaluate",code:Te});if(a&&typeof a=="object"&&a.diagnostics&&(a.diagnostics.errors=l?.errors??0,a.diagnostics.warnings=l?.warnings??0),a&&typeof a=="object"&&a.shell==null)try{let u=await ue(c);u&&(a.shell=u)}catch{}console.log(JSON.stringify(a,null,2));break}if(!o||o==="--help"||o==="-h"){console.log(`
|
|
675
|
+
${w("state")} \u2014 dump raw runtime state
|
|
676
676
|
|
|
677
677
|
subcommands:
|
|
678
678
|
shell dump shell transition/layout state
|
|
@@ -690,24 +690,24 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
690
690
|
gesture-seam dump shell-hosted gesture recognizer state/events
|
|
691
691
|
|
|
692
692
|
examples:
|
|
693
|
-
${
|
|
694
|
-
${
|
|
695
|
-
${
|
|
696
|
-
${
|
|
697
|
-
${
|
|
698
|
-
${
|
|
699
|
-
${
|
|
700
|
-
${
|
|
701
|
-
${
|
|
702
|
-
${
|
|
703
|
-
${
|
|
704
|
-
`);break}let n;switch(o){case"shell":n=await ue(
|
|
693
|
+
${w("state")} shell
|
|
694
|
+
${w("state")} worker
|
|
695
|
+
${w("state")} keyboard
|
|
696
|
+
${w("state")} ownership
|
|
697
|
+
${w("state")} worklets
|
|
698
|
+
${w("state")} scroll-input
|
|
699
|
+
${w("state")} scroll-mirror
|
|
700
|
+
${w("state")} node photos
|
|
701
|
+
${w("state")} scroll feed
|
|
702
|
+
${w("state")} scroll-hit 360 420
|
|
703
|
+
${w("state")} hit 200 720
|
|
704
|
+
`);break}let n;switch(o){case"shell":n=await ue(c,500);break;case"worker":n=await ce(c,"__sootsimRenderHost.queryStats");break;case"ownership":n=await c.send({type:"evaluate",code:`(() => {
|
|
705
705
|
const h = window.__sootsimRenderHost
|
|
706
706
|
if (!h || typeof h.getOwnershipSnapshot !== 'function') {
|
|
707
707
|
return { error: 'getOwnershipSnapshot not available' }
|
|
708
708
|
}
|
|
709
709
|
return h.getOwnershipSnapshot()
|
|
710
|
-
})()`});break;case"keyboard":n=await
|
|
710
|
+
})()`});break;case"keyboard":n=await c.send({type:"evaluate",code:`(async () => {
|
|
711
711
|
const kb = window.__sootsimKeyboard
|
|
712
712
|
const test = window.__sootsimTest
|
|
713
713
|
if (!kb) return { error: 'keyboard bridge not available' }
|
|
@@ -735,8 +735,8 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
735
735
|
text: secureTextEntry ? ${JSON.stringify(Z)} : (focused.text || null),
|
|
736
736
|
} : null,
|
|
737
737
|
}
|
|
738
|
-
})()`}),n=et(n);break;case"node":{let a=r[2];a||(console.error(` usage: ${
|
|
739
|
-
${
|
|
738
|
+
})()`}),n=et(n);break;case"node":{let a=r[2];a||(console.error(` usage: ${w("state")} node <id>`),process.exit(1)),n=await X(c,"findByTestId",a)||await X(c,"findById",a);break}case"scroll":{let a=r[2];a||(console.error(` usage: ${w("state")} scroll <id>`),process.exit(1)),n=await X(c,"getScrollState",a);break}case"scroll-hit":{let a=Number(r[2]),l=Number(r[3]);(!Number.isFinite(a)||!Number.isFinite(l))&&(console.error(` usage: ${w("state")} scroll-hit <x> <y>`),process.exit(1)),n=await X(c,"getScrollStateAt",a,l);break}case"hit":{let a=Number(r[2]),l=Number(r[3]);(!Number.isFinite(a)||!Number.isFinite(l))&&(console.error(` usage: ${w("state")} hit <x> <y>`),process.exit(1)),n=await X(c,"debugHitAt",a,l);break}case"gesture":{let a=Number(r[2]),l=Number(r[3]);(!Number.isFinite(a)||!Number.isFinite(l))&&(console.error(` usage: ${w("state")} gesture <x> <y>`),process.exit(1)),n=await X(c,"debugGestureAt",a,l);break}case"gesture-seam":n=await ce(c,"SootSim.bridges.mainShell.callTestBridge","getShellGestureSeamDebug");break;case"worklets":{let[a,l]=await Promise.all([X(c,"getWorkletSlotStats"),ce(c,"SootSim.bridges.mainShell.callTestBridge","getWorkletSlotStats")]);n={tenant:a,shell:l};break}case"scroll-input":n=await ce(c,"SootSim.bridges.mainShell.callTestBridge","getShellScrollInputDebug");break;case"scroll-mirror":n=await ce(c,"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=r[1];if(!o||o==="--help"||o==="-h"){console.log(`
|
|
739
|
+
${w("shell")} \u2014 run built-in shell commands
|
|
740
740
|
|
|
741
741
|
subcommands:
|
|
742
742
|
launch <appId> [waitMs] [--clear-state]
|
|
@@ -751,15 +751,15 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
751
751
|
shake trigger the simulator shake gesture
|
|
752
752
|
|
|
753
753
|
examples:
|
|
754
|
-
${
|
|
755
|
-
${
|
|
756
|
-
${
|
|
757
|
-
${
|
|
758
|
-
${
|
|
759
|
-
${
|
|
760
|
-
${
|
|
761
|
-
${
|
|
762
|
-
`);break}let n=o==="launch"||o==="open-card"||o==="home"||o==="switcher",a=o==="launch"||o==="open-card"?r[3]:r[2],l=a?Number(a):350;n&&(!Number.isFinite(l)||l<0)&&(console.error(
|
|
754
|
+
${w("shell")} launch photos
|
|
755
|
+
${w("shell")} launch rn --clear-state
|
|
756
|
+
${w("shell")} launch photos 1500
|
|
757
|
+
${w("shell")} home 500
|
|
758
|
+
${w("shell")} switcher 800
|
|
759
|
+
${w("shell")} open-card clock 800
|
|
760
|
+
${w("shell")} appearance dark
|
|
761
|
+
${w("shell")} lock
|
|
762
|
+
`);break}let n=o==="launch"||o==="open-card"||o==="home"||o==="switcher",a=o==="launch"||o==="open-card"?r[3]:r[2],l=a?Number(a):350;n&&(!Number.isFinite(l)||l<0)&&(console.error(g("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 y=r[2];y||(console.error(g("shell","launch <appId> [settleMs] [--clear-state]")),process.exit(1)),$&&await c.send({type:"evaluate",code:Je(!0)}),u=!!await ye(c,"launchApp",l,y),{settled:m,state:f}=await _e(c,Math.round(l),k=>!!k&&k.state==="app"&&k.activeApp===y&&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(c,"goHome",l),{settled:m,state:f}=await _e(c,Math.round(l),y=>!!y&&y.state==="home"&&y.activeApp==null&&y.showSwitcher===!1&&y.switcherPhase==="idle"&&typeof y.launchProgress=="number"&&y.launchProgress>=.98);else if(o==="switcher")u=!!await ye(c,"openSwitcher",l),{settled:m,state:f}=await _e(c,Math.round(l),y=>!!y&&y.state==="app"&&y.showSwitcher===!0&&y.switcherPhase==="idle"&&typeof y.zoomLevel=="number"&&Math.abs(y.zoomLevel)<=.02&&typeof y.horizontalZoom=="number"&&Math.abs(y.horizontalZoom)<=.02),m&&(await oe(vs),f=await ue(c));else if(o==="open-card"){let y=r[2];y||(console.error(g("shell","open-card <appId> [settleMs]")),process.exit(1)),u=!!await ye(c,"openSwitcherCard",l,y),{settled:m,state:f}=await _e(c,Math.round(l),k=>!!k&&k.state==="app"&&k.activeApp===y&&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:y}},`open switcher card ${y}`)}else if(o==="appearance"){let y=r[2];(!y||!["light","dark","auto","toggle"].includes(y))&&(console.error(g("shell","appearance <light|dark|auto|toggle>")),process.exit(1));let k=await To(c,"appearance",y);if(u=!!k?.ok,f={appearance:k},u){let L=k?.applied??y;console.log(` appearance: ${L}`)}}else if(o==="lock"||o==="shake"){let y=await To(c,o);u=!!y?.ok,f={[o]:y}}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 uo(c,{args:i});break}case"reload":{let a=!1,l=!1;try{await c.send({type:"evaluate",code:"window.__sootsimConsole?.clear()"});let f=await c.send({type:"evaluate",code:`;(async () => {
|
|
763
763
|
// in-place guest reload is only valid while the page still runs
|
|
764
764
|
// the engine build the server would serve NOW. the shell dev
|
|
765
765
|
// server has no HMR client, so a long-lived sim tab otherwise
|
|
@@ -783,13 +783,13 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
783
783
|
}
|
|
784
784
|
window.location.reload()
|
|
785
785
|
return { kind: 'page', engineStale }
|
|
786
|
-
})()`});l=!!f&&f.kind==="external-app",a=!0,f&&f.engineStale&&console.log(" engine build changed since page load \u2014 full page reload")}catch{}console.log(" reloading...");let u=
|
|
786
|
+
})()`});l=!!f&&f.kind==="external-app",a=!0,f&&f.engineStale&&console.log(" engine build changed since page load \u2014 full page reload")}catch{}console.log(" reloading...");let u=c,m=null;if(l)m=await Ne(c,{timeoutMs:1e4,errorGraceMs:3e3});else{a&&await oe(300);let $=await At(M,O,x,{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=wo(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!==c&&u.close(),Array.isArray(f)&&f.length>0){console.log(`
|
|
787
787
|
\u26A0 ${f.length} error(s) during mount:
|
|
788
|
-
`);for(let $ of f){let
|
|
789
|
-
`).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 Le(
|
|
788
|
+
`);for(let $ of f){let y=$.args.map(k=>typeof k=="object"?JSON.stringify(k):k).join(" ");if(console.log(` ${y}`),$.stack){let k=$.stack.split(`
|
|
789
|
+
`).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 Le(c),await c.send({type:"evaluate",code:Je(!0)})!==!0){C(i)?B({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(c,{timeoutMs:1e4,errorGraceMs:3e3});if(C(i)){B({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=wo(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(c,10);if(Array.isArray(u)&&u.length>0){console.log(`
|
|
790
790
|
\u26A0 ${u.length} error(s) during mount:
|
|
791
791
|
`);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(`
|
|
792
|
-
`).slice(0,2);for(let
|
|
792
|
+
`).slice(0,2);for(let y of $)console.log(` ${y.trim()}`)}}}}catch{}l.ready||(process.exitCode=1);break}case"js":{let o=r.slice(1).join(" ");if(o||(console.error(g("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(` ${w("js")} SootSim.bridges.test.findByText("Sign in")`),console.error(` ${w("js")} SootSim.bridges.debug.snapshot("before")`),console.error(` ${w("js")} SootSim.bridges.keyboard.type("hello")`),console.error(` ${w("js")} SootSim.state.root.children.length`),process.exit(1)),e.includes("--tenant")){let m=r.slice(1).filter($=>$!=="--tenant").join(" "),f=await c.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 a=await c.send({type:"evaluate",code:n});console.log(JSON.stringify(a,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 c.send({type:"evaluate",code:`(async () => {
|
|
793
793
|
const globals = {}
|
|
794
794
|
|
|
795
795
|
// test bridge (proxy in worker mode)
|
|
@@ -827,8 +827,8 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
827
827
|
|
|
828
828
|
return globals
|
|
829
829
|
})()`});console.log(` rnx JS API:
|
|
830
|
-
`);for(let[n,a]of Object.entries(o)){console.log(` ${n}:`);for(let l of a)console.log(` .${l}`);console.log("")}console.log(` use: ${
|
|
831
|
-
${
|
|
830
|
+
`);for(let[n,a]of Object.entries(o)){console.log(` ${n}:`);for(let l of a)console.log(` .${l}`);console.log("")}console.log(` use: ${w("js")} <expression>`),console.log(` example: ${w("js")} test.findByText("Sign in")`);break}case"describe":{await Zt({bridge:c,args:e,positional:r});break}case"perf":{b==="debug"&&!t.internalPerfCommand&&(console.error(" `rnxsim debug perf` was removed. use `rnxsim perf shell ...`."),process.exit(1));let o=r[1];if(t.internalPerfCommand==="scroll"){if(!o||o==="--help"||o==="-h"){console.log(`
|
|
831
|
+
${w("perf")} <start|stop> [options]
|
|
832
832
|
|
|
833
833
|
records per-frame scroll offsets from the tenant worker, shell worker,
|
|
834
834
|
and compositor worker. timestamps use the shared wall clock, while frame
|
|
@@ -839,22 +839,22 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
839
839
|
--json emit every per-frame sample on stop
|
|
840
840
|
|
|
841
841
|
examples:
|
|
842
|
-
${
|
|
842
|
+
${w("perf")} start
|
|
843
843
|
# ... perform consecutive swipes ...
|
|
844
|
-
${
|
|
845
|
-
${
|
|
846
|
-
`);break}if(o==="start"){let n=i.find((u,m)=>i[m-1]==="--limit"),a=n===void 0?6e3:Number(n);(!Number.isFinite(a)||a<120)&&(console.error(" error: --limit must be a number of at least 120"),process.exit(1));let l=await
|
|
844
|
+
${w("perf")} stop
|
|
845
|
+
${w("perf")} stop --json
|
|
846
|
+
`);break}if(o==="start"){let n=i.find((u,m)=>i[m-1]==="--limit"),a=n===void 0?6e3:Number(n);(!Number.isFinite(a)||a<120)&&(console.error(" error: --limit must be a number of at least 120"),process.exit(1));let l=await c.send({type:"evaluate",code:`(async () => {
|
|
847
847
|
const perf = window.SootSim?.bridges?.scrollPerf
|
|
848
848
|
if (!perf) return { error: 'scroll performance profile unavailable' }
|
|
849
849
|
await perf.start(${Math.floor(a)})
|
|
850
850
|
return { started: true }
|
|
851
|
-
})()`});l?.error&&(console.error(` error: ${l.error}`),process.exit(1)),console.log(` scroll profiling started: perform consecutive swipes, then run '${
|
|
851
|
+
})()`});l?.error&&(console.error(` error: ${l.error}`),process.exit(1)),console.log(` scroll profiling started: perform consecutive swipes, then run '${w("perf")} stop'`);break}if(o==="stop"){let n=await c.send({type:"evaluate",code:`(async () => {
|
|
852
852
|
const perf = window.SootSim?.bridges?.scrollPerf
|
|
853
853
|
if (!perf) return { error: 'scroll performance profile unavailable' }
|
|
854
854
|
return await perf.stop()
|
|
855
|
-
})()`});n?.error&&(console.error(` error: ${n.error}`),process.exit(1));let a=n;if(
|
|
856
|
-
`),console.log(` duration: ${a.stoppedAt-a.startedAt}ms (worker series are timestamp-aligned, not frame-paired)`),console.log(` samples: tenant ${a.layers.tenant.length} \xB7 shell ${a.layers.shell.length} \xB7 compositor ${a.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(a.layers)){let m=new Map;for(let f of u){let $=`${f.surfaceId}:${f.nodeId}`,
|
|
857
|
-
${
|
|
855
|
+
})()`});n?.error&&(console.error(` error: ${n.error}`),process.exit(1));let a=n;if(C(i)){B(a);break}console.log(` scroll performance trace:
|
|
856
|
+
`),console.log(` duration: ${a.stoppedAt-a.startedAt}ms (worker series are timestamp-aligned, not frame-paired)`),console.log(` samples: tenant ${a.layers.tenant.length} \xB7 shell ${a.layers.shell.length} \xB7 compositor ${a.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(a.layers)){let m=new Map;for(let f of u){let $=`${f.surfaceId}:${f.nodeId}`,y=`${f.offsetY}:${f.slotY??""}:${f.phase??""}`;m.get($)!==y&&(m.set($,y),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-a.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(`
|
|
857
|
+
${w("perf")} \u2014 shell frame profiling (the worker that paints)
|
|
858
858
|
|
|
859
859
|
records per-painted-frame timing in the shell worker \u2014 the surface that
|
|
860
860
|
actually draws the app's pixels \u2014 merged with render-profile counters
|
|
@@ -868,24 +868,24 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
868
868
|
stop and transition accept --json for the full machine-readable payload.
|
|
869
869
|
|
|
870
870
|
examples:
|
|
871
|
-
${
|
|
871
|
+
${w("perf")} start
|
|
872
872
|
# ... interact with the app ...
|
|
873
|
-
${
|
|
874
|
-
${
|
|
875
|
-
${
|
|
876
|
-
`);break}switch(o){case"start":{let n=await
|
|
873
|
+
${w("perf")} stop
|
|
874
|
+
${w("perf")} stop --json
|
|
875
|
+
${w("perf")} transition goHome
|
|
876
|
+
`);break}switch(o){case"start":{let n=await c.send({type:"evaluate",code:`(() => {
|
|
877
877
|
if (!window.__sootsimShellPerf) {
|
|
878
878
|
return { error: 'shell frame profile unavailable (__sootsimShellPerf missing on the page)' }
|
|
879
879
|
}
|
|
880
880
|
window.__sootsimShellPerf.start()
|
|
881
881
|
return { started: true }
|
|
882
|
-
})()`});n?.error&&(console.error(` error: ${n.error}`),process.exit(1)),console.log(` shell profiling started \u2014 interact with the app, then run '${
|
|
882
|
+
})()`});n?.error&&(console.error(` error: ${n.error}`),process.exit(1)),console.log(` shell profiling started \u2014 interact with the app, then run '${w("perf")} stop'`);break}case"stop":{let n=await c.send({type:"evaluate",code:`(async () => {
|
|
883
883
|
if (!window.__sootsimShellPerf) {
|
|
884
884
|
return { error: 'shell frame profile unavailable (__sootsimShellPerf missing on the page)' }
|
|
885
885
|
}
|
|
886
886
|
return await window.__sootsimShellPerf.stop()
|
|
887
|
-
})()`});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)),
|
|
888
|
-
${
|
|
887
|
+
})()`});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)),C(i)){B(n);break}Io(n);break}case"transition":{let n=r[2];if(!n||!["goHome","appSwitcher","lockScreen"].includes(n)){console.log(`
|
|
888
|
+
${w("perf")} transition <event> \u2014 profile a shell transition
|
|
889
889
|
|
|
890
890
|
events:
|
|
891
891
|
goHome swipe-to-home animation
|
|
@@ -895,9 +895,9 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
895
895
|
note: uses 600ms capture window \u2014 may need --timeout 10000 flag
|
|
896
896
|
|
|
897
897
|
examples:
|
|
898
|
-
${
|
|
899
|
-
${
|
|
900
|
-
`);break}let l=`sootsim:${n}`;Me(` profiling ${n} transition...`),Me(" (use --timeout 10000 if this times out)");let u=await
|
|
898
|
+
${w("perf")} transition goHome --timeout 10000
|
|
899
|
+
${w("perf")} transition appSwitcher
|
|
900
|
+
`);break}let l=`sootsim:${n}`;Me(` profiling ${n} transition...`),Me(" (use --timeout 10000 if this times out)");let u=await c.send({type:"evaluate",code:`(async () => {
|
|
901
901
|
if (!window.__sootsimShellPerf) {
|
|
902
902
|
return { error: 'shell frame profile unavailable (__sootsimShellPerf missing on the page)' }
|
|
903
903
|
}
|
|
@@ -909,29 +909,29 @@ import{b as jt,c as qt}from"./chunk-FF6XN63V.js";import{a as Dt,b as Bt}from"./c
|
|
|
909
909
|
// animation-end detection
|
|
910
910
|
await new Promise(r => setTimeout(r, 600))
|
|
911
911
|
return await window.__sootsimShellPerf.stop()
|
|
912
|
-
})()`});if(u?.error&&(console.error(` error: ${u.error}`),process.exit(1)),
|
|
912
|
+
})()`});if(u?.error&&(console.error(` error: ${u.error}`),process.exit(1)),C(i)){B(u);break}Me(` ${n} transition profiled:`),Io(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=r[1];if(o==="clear"){await Le(c),C(i)?B({cleared:!0}):console.log(" error buffer cleared");break}let n=o?Number(o):20,a=await ge(c,n);if(C(i)){B(a);break}if(a.length===0){console.log(" no errors captured");break}console.log(` ${a.length} error(s):
|
|
913
913
|
`);for(let l of a){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(`
|
|
914
|
-
`).slice(0,3);for(let $ of f)console.log(` ${$.trim()}`)}}break}case"warnings":{let o=r[1]?Number(r[1]):20,n=await kt(
|
|
915
|
-
`);for(let a of n){let l=ae(a.timestamp),u=a.args.map(m=>typeof m=="object"?JSON.stringify(m):m).join(" ");console.log(` [${l}] ${u}`)}break}case"animations":{let o=await X(
|
|
916
|
-
`);for(let n of o){let a=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`,
|
|
917
|
-
`);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=r[1],n=null,a=null,l=!1,u=!1,m=1e3,f=!1,$=!1;for(let E=0;E<i.length;E++){let v=i[E];if(v==="--filter")n=i[E+1]??null,E++;else if(v==="--limit"){let
|
|
914
|
+
`).slice(0,3);for(let $ of f)console.log(` ${$.trim()}`)}}break}case"warnings":{let o=r[1]?Number(r[1]):20,n=await kt(c,o);if(C(i)){B(n);break}if(n.length===0){console.log(" no warnings captured");break}console.log(` ${n.length} warning(s):
|
|
915
|
+
`);for(let a of n){let l=ae(a.timestamp),u=a.args.map(m=>typeof m=="object"?JSON.stringify(m):m).join(" ");console.log(` [${l}] ${u}`)}break}case"animations":{let o=await X(c,"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):
|
|
916
|
+
`);for(let n of o){let a=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`,y=[n.loop?"loop":null,n.layoutBound?"layout":null,n.remoteDriven?"remote-driven":n.graphBacked?"graph":null,n.visible===!1?"offscreen":null].filter(Boolean),k=y.length>0?` [${y.join(" ")}]`:"";console.log(` #${n.id} ${a} ${l} ${u.padEnd(14)} cur=${m.padEnd(7)} ${f.padStart(4)} ${$}${k}`)}break}case"animation":{let o=r[1];(!o||o==="--help"||o==="-h")&&(console.error(` usage: ${w("animation")} <id>`),process.exit(1));let n=Number(o);Number.isFinite(n)||(console.error(` invalid id: ${o}`),process.exit(1));let a=await X(c,"getAnimation",n);console.log(JSON.stringify(a,null,2));break}case"stop-animation":{let o=r[1];(!o||o==="--help"||o==="-h")&&(console.error(` usage: ${w("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 a=await X(c,"stopAnimation",n);console.log(` stopped ${a??0} animation(s)`);break}case"requests":{let o=r[1];if(o==="clear"){await Tt(c),C(i)?B({cleared:!0}):console.log(" request buffer cleared");break}let n=o==="all",a=n?r[2]:o,l=a?Number(a):20,u=await It(c,{failed:!n,limit:l});if(C(i)){B(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)"}:
|
|
917
|
+
`);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=r[1],n=null,a=null,l=!1,u=!1,m=1e3,f=!1,$=!1;for(let E=0;E<i.length;E++){let v=i[E];if(v==="--filter")n=i[E+1]??null,E++;else if(v==="--limit"){let N=Number(i[E+1]);Number.isFinite(N)&&(a=N),E++}else if(v==="--threshold"){let N=Number(i[E+1]);Number.isFinite(N)&&N>0&&(m=N),E++}else v==="--failed"?l=!0:v==="--slow"?u=!0:v==="--tail"||v==="-f"?f=!0:v==="--json"&&($=!0)}if(o==="clear"){await c.send({type:"evaluate",code:'window.__sootsimObservability?.network.clear(); "cleared"'}),console.log(" network buffer cleared");break}if(o==="get"){let E=r[2];E||(console.error(" usage: rnxsim network get <id>"),process.exit(1));let v=await c.send({type:"evaluate",code:`(() => {
|
|
918
918
|
const obs = window.__sootsimObservability;
|
|
919
919
|
if (!obs) return null;
|
|
920
920
|
return obs.network.getSnapshot().find(e => e.id === ${JSON.stringify(E)}) || null;
|
|
921
|
-
})()`});v||(console.error(` no entry with id ${E}`),process.exit(1)),$?console.log(JSON.stringify(v,null,2)):xs(v);break}let
|
|
922
|
-
to target a specific sim, use \`--sim ${o}\` instead.`),process.exit(1));let k=async()=>{let E=await
|
|
921
|
+
})()`});v||(console.error(` no entry with id ${E}`),process.exit(1)),$?console.log(JSON.stringify(v,null,2)):xs(v);break}let y=a??(f?200:o?Number(o):20);Number.isFinite(y)||(console.error(` invalid limit: ${o} \u2014 \`network\` takes a numeric count (e.g. ${w("network")} 100).
|
|
922
|
+
to target a specific sim, use \`--sim ${o}\` instead.`),process.exit(1));let k=async()=>{let E=await c.send({type:"evaluate",code:`(() => {
|
|
923
923
|
const obs = window.__sootsimObservability;
|
|
924
924
|
if (!obs) return { ok: false };
|
|
925
925
|
return { ok: true, entries: obs.network.getSnapshot() };
|
|
926
|
-
})()`});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(
|
|
926
|
+
})()`});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(N=>!!N.error||N.status!=null&&N.status>=400)),u&&(v=v.filter(N=>N.durationMs!=null&&N.durationMs>=m)),n){let N=n.toLowerCase();v=v.filter(F=>(F.displayUrl||F.url).toLowerCase().includes(N))}return u&&!f&&(v=[...v].sort((N,F)=>(F.durationMs??0)-(N.durationMs??0))),v};if(!f){let E=await k(),v=L(E).slice(-y);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):
|
|
927
927
|
`:` ${v.length} request(s):
|
|
928
|
-
`);for(let
|
|
929
|
-
`);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
|
|
930
|
-
to target a specific sim, use \`--sim ${o}\` instead.`),process.exit(1));let L=()=>Mt(
|
|
931
|
-
`);for(let
|
|
932
|
-
`);let G=new Set,Y=!0,E=()=>{Y=!1};process.on("SIGINT",E);try{for(;Y;){let v=await L(),
|
|
928
|
+
`);for(let N of v)xo(N);break}console.log(` tailing network (ctrl-c to stop)...
|
|
929
|
+
`);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 N of v)N.durationMs!=null&&(V.has(N.id)||(V.add(N.id),$?console.log(JSON.stringify(N)):xo(N)));await oe(250)}}finally{process.off("SIGINT",Y)}break}case"logs":{let o=r[1],n=null,a=null,l=null,u=!1,m=!1,f=!1;for(let v=0;v<i.length;v++){let N=i[v];if(N==="--filter")n=i[v+1]??null,v++;else if(N==="--limit"){let F=Number(i[v+1]);Number.isFinite(F)&&(a=F),v++}else N==="--level"?(l=i[v+1]??null,v++):N==="--tail"||N==="-f"?u=!0:N==="--json"?m=!0:(N==="--internal"||N==="--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 Nt(c),console.log(" log buffer cleared");break}let y=!m&&process.stdout.isTTY===!0,k=a??(u?500:o?Number(o):50);Number.isFinite(k)||(console.error(` invalid limit: ${o} \u2014 \`logs\` takes a numeric count (e.g. ${w("logs")} 100).
|
|
930
|
+
to target a specific sim, use \`--sim ${o}\` instead.`),process.exit(1));let L=()=>Mt(c),V=v=>Ft(v,{level:$,filter:n,showInternal:f});if(!u){let v=await L(),N=V(v).slice(-k);if(m){console.log(JSON.stringify(N,null,2));break}if(N.length===0){console.log(v.length===0?" no logs captured":" no matching logs");break}console.log(` ${N.length} log(s):
|
|
931
|
+
`);for(let F of N)So(F,y);break}console.log(` tailing logs (ctrl-c to stop)...
|
|
932
|
+
`);let G=new Set,Y=!0,E=()=>{Y=!1};process.on("SIGINT",E);try{for(;Y;){let v=await L(),N=V(v);for(let F of N)G.has(F.id)||(G.add(F.id),m?console.log(JSON.stringify(F)):So(F,y));await oe(250)}}finally{process.off("SIGINT",E)}break}default:console.error(` unknown subcommand: ${p}`),process.exit(1)}if(q.has(p)&&!e.includes("--no-wait")&&process.env.SOOTSIM_NO_AUTO_WAIT!=="1"&&!await mt(c,p)&&await T(c),S.length>0&&ee(S),!R.has(p))try{await Se(c)}catch{}}catch(S){let o=S instanceof Error?S.message:String(S);console.error(` ${p??"rnxsim"} failed: ${o}`);let n=/^no sim connected with id ([^;]+)(?:; connected sims: .+)?$/.exec(o),a=/^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 qt(c,M,n[1]);else if(/^no sim connected$/.test(o))jt(M);else if(a)if(await gs(c)){let m=p??"describe";process.stderr.write(` the sim is still responsive \u2014 '${m}' just exceeded the ${a[1]}s command budget.
|
|
933
933
|
the screen's node tree is large; narrow the query or raise the budget:
|
|
934
934
|
rnxsim ${m} --testid <id> # scope to one subtree
|
|
935
935
|
rnxsim find --testid <id> # targeted single-node lookup
|
|
936
936
|
rnxsim ${m} --timeout 60000 # raise per-command budget (ms)
|
|
937
|
-
`)}else bo();else if(l)bo();else{try{await _t(
|
|
937
|
+
`)}else bo();else if(l)bo();else{try{await _t(c)}catch{}try{await te({includeTail:!0})}catch{}try{await K({includeTail:!0})}catch{}}process.exit(1)}finally{c.close()}}export{Je as a,Do as b,Ps as c,Cs as d,js as e,qs as f,Ls as g,se as h,Io as i,_r as j};
|