sootsim 0.1.263 → 0.1.265
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/detox/index.ts +10 -2
- package/dist-cli/bin.js +4 -4
- package/dist-cli/chunks/{agent-SABBMDA6.js → agent-6AAEHYLD.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-IMLZ2CXV.js → agent-wrapper-ODHLF3AV.js} +2 -2
- package/dist-cli/chunks/{app-fonts-ZTUQIBYK.js → app-fonts-OGYFXJXD.js} +2 -2
- package/dist-cli/chunks/{assert-TIYAXBF6.js → assert-I4TQ4NXU.js} +2 -2
- package/dist-cli/chunks/{auth-223C2CHR.js → auth-BUEQU2VB.js} +2 -2
- package/dist-cli/chunks/beta-MNLXA26T.js +2 -0
- package/dist-cli/chunks/{camera-XXLEBDFH.js → camera-ORZSDOGL.js} +2 -2
- package/dist-cli/chunks/{chunk-EJKWUNJZ.js → chunk-2QG4O74V.js} +1 -1
- package/dist-cli/chunks/{chunk-EBUFVZCH.js → chunk-36JQGZVO.js} +2 -2
- package/dist-cli/chunks/chunk-3T5B5JXU.js +1 -0
- package/dist-cli/chunks/{chunk-UTM7MUU3.js → chunk-46S6DEJV.js} +3 -3
- package/dist-cli/chunks/{chunk-3Z5LTNFA.js → chunk-6XRKL2TA.js} +3 -3
- package/dist-cli/chunks/{chunk-U7JPTBPY.js → chunk-7DDSF3RT.js} +2 -2
- package/dist-cli/chunks/{chunk-XNSO4LWS.js → chunk-7VJ3NQMP.js} +1 -1
- package/dist-cli/chunks/{chunk-REISVX53.js → chunk-B73Q4H36.js} +2 -2
- package/dist-cli/chunks/{chunk-DDNMDBEA.js → chunk-CHSR3OWX.js} +1 -1
- package/dist-cli/chunks/{chunk-DUFWSBPY.js → chunk-CWVN5CXI.js} +1 -1
- package/dist-cli/chunks/{chunk-IGC3SRM3.js → chunk-DNRYY6ZV.js} +2 -2
- package/dist-cli/chunks/{chunk-QKC5Z4UH.js → chunk-DUZEVMPR.js} +2 -2
- package/dist-cli/chunks/{chunk-DOCGZ27H.js → chunk-FXSVYPP6.js} +6 -5
- package/dist-cli/chunks/{chunk-BPX3XN6E.js → chunk-I4NFMMA5.js} +1 -1
- package/dist-cli/chunks/chunk-IJJ6EXN4.js +1 -0
- package/dist-cli/chunks/{chunk-FJ5ONZUO.js → chunk-KUMNKVNG.js} +2 -2
- package/dist-cli/chunks/{chunk-YGOC5Z3U.js → chunk-LEL7RBEF.js} +1 -1
- package/dist-cli/chunks/{chunk-KTMCN5BL.js → chunk-LVCWP5UR.js} +2 -2
- package/dist-cli/chunks/{chunk-VW5257DG.js → chunk-M3RFA42A.js} +1 -1
- package/dist-cli/chunks/{chunk-HIJPFSF7.js → chunk-N5D4CPTX.js} +2 -2
- package/dist-cli/chunks/{chunk-2MYVVXE4.js → chunk-NHVAVUAE.js} +2 -2
- package/dist-cli/chunks/{chunk-2DML5W6W.js → chunk-NONMTOOD.js} +1 -1
- package/dist-cli/chunks/{chunk-ZQW7GGQM.js → chunk-NY5UOFOW.js} +1 -1
- package/dist-cli/chunks/{chunk-XPXHTC52.js → chunk-O2CMJ7DI.js} +2 -2
- package/dist-cli/chunks/{chunk-PEZRTLOT.js → chunk-O46FOOZG.js} +1 -1
- package/dist-cli/chunks/{chunk-ICUIRCRG.js → chunk-OLADUVLC.js} +1 -1
- package/dist-cli/chunks/{chunk-LZ4IYEBS.js → chunk-P4QUUINT.js} +2 -2
- package/dist-cli/chunks/{chunk-FY635FUV.js → chunk-PSMBOW5K.js} +3 -3
- package/dist-cli/chunks/{chunk-HONUL3PR.js → chunk-PYEGYRAE.js} +1 -1
- package/dist-cli/chunks/{chunk-Z4UCEBOG.js → chunk-Q7BCEVSA.js} +2 -2
- package/dist-cli/chunks/{chunk-XW3233TZ.js → chunk-QHSTV2PN.js} +1 -1
- package/dist-cli/chunks/{chunk-IUH77CMW.js → chunk-QMQR5PQ4.js} +2 -2
- package/dist-cli/chunks/{chunk-GKXBG2OI.js → chunk-QTBQD7K6.js} +1 -1
- package/dist-cli/chunks/{chunk-WQKSIRPG.js → chunk-ROV6QPIT.js} +2 -2
- package/dist-cli/chunks/{chunk-CJZUMQT4.js → chunk-SUKTCHKG.js} +1 -1
- package/dist-cli/chunks/{chunk-A7P2RFUP.js → chunk-TCCKRP2M.js} +2 -2
- package/dist-cli/chunks/{chunk-ZRICZDD2.js → chunk-TEH4AIGW.js} +8 -8
- package/dist-cli/chunks/{chunk-QNTDRZ5Z.js → chunk-UHQHOLU6.js} +2 -2
- package/dist-cli/chunks/{chunk-EOT7X5OE.js → chunk-VFK343YQ.js} +1 -1
- package/dist-cli/chunks/{chunk-NFLRQNX5.js → chunk-VSCRWYVF.js} +2 -2
- package/dist-cli/chunks/{chunk-EIJTWNC2.js → chunk-VXY2VLMU.js} +75 -75
- package/dist-cli/chunks/{chunk-ZFE7YOWM.js → chunk-W7XELS2L.js} +1 -1
- package/dist-cli/chunks/{chunk-GBAGQOIO.js → chunk-XGNRTTZB.js} +2 -2
- package/dist-cli/chunks/{chunk-SZZ2VT2T.js → chunk-XI4ROTXE.js} +2 -2
- package/dist-cli/chunks/cli-version-LGV2DQIX.js +2 -0
- package/dist-cli/chunks/{compat-GZIS6Q64.js → compat-6KKFI6KA.js} +3 -3
- package/dist-cli/chunks/{config-5KJAYI5Z.js → config-RY77QJP3.js} +2 -2
- package/dist-cli/chunks/{control-BP63VJTO.js → control-QYFQZ2KW.js} +2 -2
- package/dist-cli/chunks/daemon-FR2AYBJ3.js +2 -0
- package/dist-cli/chunks/{debug-LS3SE73P.js → debug-OX4HMLKN.js} +3 -3
- package/dist-cli/chunks/{desktop-LH5KPO6G.js → desktop-7RBHCBDP.js} +3 -3
- package/dist-cli/chunks/{detox-GW3ITTWI.js → detox-PTPYGHTV.js} +2 -2
- package/dist-cli/chunks/{device-4KU5E6PW.js → device-TT2WXHA6.js} +2 -2
- package/dist-cli/chunks/{diagnose-DBAODCN6.js → diagnose-67RTUYDG.js} +2 -2
- package/dist-cli/chunks/drivers-LJ6764RH.js +2 -0
- package/dist-cli/chunks/{film-O5257KBQ.js → film-4OEMIECE.js} +3 -3
- package/dist-cli/chunks/flow-6GVHRPXH.js +2 -0
- package/dist-cli/chunks/help-JPOMJQ6Z.js +2 -0
- package/dist-cli/chunks/{hidden-runtime-alias-U2YO64VV.js → hidden-runtime-alias-EHPDP3OP.js} +2 -2
- package/dist-cli/chunks/{home-paths-CVE5VHVB.js → home-paths-NQVJD5H5.js} +2 -2
- package/dist-cli/chunks/inspect-ZZZSP3QK.js +2 -0
- package/dist-cli/chunks/install-desktop-CQDKRNLD.js +2 -0
- package/dist-cli/chunks/{login-MPMXIO6V.js → login-P3XE5BEP.js} +4 -4
- package/dist-cli/chunks/{logout-3O24HUUG.js → logout-ZIXSVV3A.js} +2 -2
- package/dist-cli/chunks/{maestro-TF5MIBYA.js → maestro-I6WREIVA.js} +3 -3
- package/dist-cli/chunks/{maestro-generate-XP5WN37P.js → maestro-generate-HKPM3HAE.js} +3 -3
- package/dist-cli/chunks/{mode-2XRYT5KA.js → mode-LSYT5IJA.js} +2 -2
- package/dist-cli/chunks/optional-demo-registry-WSTW3BIU.js +2 -0
- package/dist-cli/chunks/{perf-WYH2NAD5.js → perf-2YAJGTUK.js} +2 -2
- package/dist-cli/chunks/{record-YCDDPRDJ.js → record-MRZZB3EQ.js} +3 -3
- package/dist-cli/chunks/runtime-RSML7PBA.js +2 -0
- package/dist-cli/chunks/{screenshot-command-GEH36B4L.js → screenshot-command-5VSDGSUS.js} +3 -3
- package/dist-cli/chunks/{screenshots-capture-KH7GOWYV.js → screenshots-capture-4ZCOEPL7.js} +2 -2
- package/dist-cli/chunks/{serve-U2G6TN3F.js → serve-TUT7MRAV.js} +2 -2
- package/dist-cli/chunks/{setup-ELHKBCOJ.js → setup-3TDGXAZ5.js} +3 -3
- package/dist-cli/chunks/{skills-J4PRTTYG.js → skills-USEXKNZ4.js} +2 -2
- package/dist-cli/chunks/{storage-NNANRVX3.js → storage-M6X2NJFE.js} +2 -2
- package/dist-cli/chunks/store-G2IHM3HV.js +2 -0
- package/dist-cli/chunks/telemetry-RHIIFIVE.js +2 -0
- package/dist-cli/chunks/{timeline-BSVARME3.js → timeline-C6PWFYMW.js} +2 -2
- package/dist-cli/chunks/{upgrade-IXWEQERE.js → upgrade-LIPADIAC.js} +2 -2
- package/dist-cli/chunks/upload-23AUKU7U.js +2 -0
- package/dist-cli/chunks/{version-UN64ZCEZ.js → version-MI7TABKB.js} +2 -2
- package/dist-cli/chunks/{web-3HWWPJNK.js → web-VZO3V7DQ.js} +2 -2
- package/dist-cli/chunks/{what-happened-LWCC7Y5C.js → what-happened-ZU3H4QCY.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/cli-constants.cjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +3 -3
- 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/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +2 -1
- package/dist-lib/sdk.mjs +2 -1
- package/dist-lib/skills.cjs +1 -1
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/skills/sootsim-perf/SKILL.md +9 -0
- package/src/native-seam-manifest.ts +15 -18
- package/src/vite-plugin.ts +36 -5
- package/dist-cli/chunks/beta-BQJN5J2M.js +0 -2
- package/dist-cli/chunks/chunk-7MPXOKIW.js +0 -1
- package/dist-cli/chunks/chunk-DCH7SAFL.js +0 -1
- package/dist-cli/chunks/cli-version-IFV46HJZ.js +0 -2
- package/dist-cli/chunks/daemon-DXAREEME.js +0 -2
- package/dist-cli/chunks/drivers-MUXD5OLZ.js +0 -2
- package/dist-cli/chunks/flow-WGTBSRYI.js +0 -2
- package/dist-cli/chunks/help-A6KGCNQH.js +0 -2
- package/dist-cli/chunks/inspect-47PCNJWW.js +0 -2
- package/dist-cli/chunks/install-desktop-5RQ5TJZF.js +0 -2
- package/dist-cli/chunks/optional-demo-registry-OM7H7LZS.js +0 -2
- package/dist-cli/chunks/runtime-QM636MEL.js +0 -2
- package/dist-cli/chunks/store-EOFWZCAF.js +0 -2
- package/dist-cli/chunks/telemetry-VT6XBQWJ.js +0 -2
- package/dist-cli/chunks/upload-R5IC6OLQ.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as ce}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.265 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as ce}from"./chunk-UHQHOLU6.js";import{b as Et,c as Pt,k as At}from"./chunk-ROV6QPIT.js";import{a as oe,b as A,c as D,d as Ie,e as ae,f as X,g as ue,h as ye,i as Ft,j as Ot,k as Te,l as Rt}from"./chunk-Q7BCEVSA.js";import{A as $t,B as xt,E as St,G as vt,I as de,J as kt,P as Le,a as ke,b as rt,c as it,d as at,e as lt,f as ct,g as dt,h as ut,i as pt,j as mt,k as Be,l as Ce,q as je,r as ft,s as gt,t as fe,u as yt,v as _e,w as qe,x as ht,y as bt,z as wt}from"./chunk-FXSVYPP6.js";import{e as _t,g as It,i as Tt,j as Mt,k as Nt,l as ge}from"./chunk-VSCRWYVF.js";import{a as ot}from"./chunk-QHSTV2PN.js";import{a as Q}from"./chunk-LVCWP5UR.js";import{c as st}from"./chunk-M3RFA42A.js";import{c as nt}from"./chunk-7VJ3NQMP.js";import{c as Ae,e as De}from"./chunk-W7XELS2L.js";function We(e){return`(async () => {
|
|
3
3
|
const bridge = globalThis.SootSim && globalThis.SootSim.bridges && globalThis.SootSim.bridges.hotRemount
|
|
4
4
|
if (!bridge || typeof bridge.reloadExternalApp !== 'function') return false
|
|
5
5
|
await bridge.reloadExternalApp({ resetStorage: ${e?"true":"false"} })
|
|
@@ -71,14 +71,14 @@ import{a as ce}from"./chunk-QNTDRZ5Z.js";import{b as Pt,c as Rt,k as At}from"./c
|
|
|
71
71
|
deviceWidth: __w / __dpr,
|
|
72
72
|
deviceHeight: __h / __dpr,
|
|
73
73
|
}
|
|
74
|
-
})()`}import{existsSync as
|
|
75
|
-
`)}function Ge(){let e=Ne();if(!
|
|
76
|
-
`}function js(e){let t=Ge();if(!t)return{active:!1};let s=jo(t.steps),i=Je(t.steps);if(i.length>0)return{active:!0,valid:!1,issues:i,yaml:s,stepCount:t.steps.length,outputPath:null};let
|
|
77
|
-
`)}function es(e,t){let s=t.trim()||"default";return`${e}:${s}`}function Ye(e,t,s,i={}){let
|
|
74
|
+
})()`}import{existsSync as Po,mkdirSync as jt,readFileSync as Ao,rmSync as He,writeFileSync as qt}from"fs";import{tmpdir as Do}from"os";import{dirname as Lt,join as Bo,resolve as Wt}from"path";import*as Me from"fs";function Eo(e){let t={},s=e,i=m=>Array.isArray(m)?m:[],d=e.match(/^---\n([\s\S]*?)\n---\n?/);if(d){try{t=ce.parse(d[1])??{}}catch(f){console.warn(` warn: could not parse frontmatter: ${f.message}`)}s=e.slice(d[0].length);let m=ce.parse(s);return{frontmatter:t,steps:i(m)}}if(/\n---\s*\n/.test(e))try{let m=ce.parseAllDocuments(e);if(m.length>=2){let f=m[0].toJS(),h=m[m.length-1].toJS();return{frontmatter:f&&typeof f=="object"?f:{},steps:i(h)}}}catch(m){console.warn(` warn: could not parse multi-doc flow: ${m.message}`)}let l=ce.parse(s);return{frontmatter:t,steps:i(l)}}var Ct=new Set(["tapOn","inputText","pressKey","dispatchKey","hideKeyboard","swipe","pinch","scroll","scrollUntilVisible"]);function Je(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(l=>Ct.has(l))&&(s+=1):typeof i=="string"&&Ct.has(i)&&(s+=1);return s===0&&t.push("no interaction steps found (expected at least one tapOn / inputText / pressKey / swipe / scroll)"),t}function Ns(e){if(!Me.existsSync(e))return[`file not found: ${e}`];let t;try{t=Me.readFileSync(e,"utf8")}catch(s){return[`cannot read file: ${s.message}`]}if(t.trim().length===0)return["file is empty"];try{let s=Eo(t);return Je(s.steps)}catch(s){return[`yaml parse error: ${s.message}`]}}var Ke=1;function Ne(){return Wt(process.env.SOOTSIM_FLOW_SESSION_PATH||Bo(Do(),"sootsim-flow-session.json"))}function Ue(e){let t=Ne();jt(Lt(t),{recursive:!0}),qt(t,JSON.stringify(e,null,2)+`
|
|
75
|
+
`)}function Ge(){let e=Ne();if(!Po(e))return null;try{let t=JSON.parse(Ao(e,"utf8"));return t.version!==Ke||!Array.isArray(t.steps)||typeof t.startedAt!="string"||typeof t.updatedAt!="string"?(He(e,{force:!0}),null):{version:Ke,startedAt:t.startedAt,updatedAt:t.updatedAt,steps:t.steps,candidate:t.candidate??null}}catch{return He(e,{force:!0}),null}}function Ds(){let e=new Date().toISOString(),t={version:Ke,startedAt:e,updatedAt:e,steps:[],candidate:null};return Ue(t),{path:Ne(),state:t}}function Co(){He(Ne(),{force:!0})}function Bs(){Co()}function Fe(e){let t=Ge();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 Ue(i),{active:!0,candidate:i.candidate,replaced:s}}function Cs(){let e=Ge();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 Ue(s),{active:!0,kept:!0,candidate:t,stepCount:s.steps.length}}function jo(e){return ce.stringify(e).trimEnd()+`
|
|
76
|
+
`}function js(e){let t=Ge();if(!t)return{active:!1};let s=jo(t.steps),i=Je(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=Wt(e),jt(Lt(d),{recursive:!0}),qt(d,s)),{active:!0,valid:!0,issues:[],yaml:s,stepCount:t.steps.length,outputPath:d}}import{existsSync as qo,mkdirSync as Lo,readFileSync as Wo,rmSync as Jt,writeFileSync as Jo}from"fs";import{tmpdir as Ho}from"os";import{dirname as Ko,join as Uo,resolve as Go}from"path";var he=1,Yo="SOOTSIM_INSPECT_NOTICE_PATH",zo=300*1e3,Xo=15e3;function Ht(){return Go(process.env[Yo]||Uo(Ho(),"sootsim-inspect-notice-state.json"))}function Vo(e,t){return Object.fromEntries(Object.entries(e).filter(([,s])=>typeof s?.signature=="string"&&Number.isFinite(s?.updatedAt)&&t-s.updatedAt<=zo))}function Qo(e){let t=Ht();if(!qo(t))return{version:he,entries:{}};try{let s=JSON.parse(Wo(t,"utf8"));return s.version!==he||!s.entries||typeof s.entries!="object"?(Jt(t,{force:!0}),{version:he,entries:{}}):{version:he,entries:Vo(s.entries,e)}}catch{return Jt(t,{force:!0}),{version:he,entries:{}}}}function Zo(e){let t=Ht();Lo(Ko(t),{recursive:!0}),Jo(t,JSON.stringify(e,null,2)+`
|
|
77
|
+
`)}function es(e,t){let s=t.trim()||"default";return`${e}:${s}`}function Ye(e,t,s,i={}){let d=i.nowMs??Date.now(),l=i.cooldownMs??Xo,m=Qo(d),f=es(e,t),h=m.entries[f];return h&&h.signature===s&&d-h.updatedAt<l?!1:(m.entries[f]={signature:s,updatedAt:d},Zo(m),!0)}async function se({bridge:e,simId:t,maxMs:s,pollMs:i=50,stablePolls:d=3,strict:l=!1}){let m=await e.send({type:"evaluate",simId:t,code:`(async () => {
|
|
78
78
|
const start = Date.now()
|
|
79
79
|
const deadline = start + ${Math.max(0,Math.round(s))}
|
|
80
80
|
const pollMs = ${Math.max(1,Math.round(i))}
|
|
81
|
-
const requiredStablePolls = ${Math.max(1,Math.round(
|
|
81
|
+
const requiredStablePolls = ${Math.max(1,Math.round(d))}
|
|
82
82
|
const strict = ${l?"true":"false"}
|
|
83
83
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
84
84
|
|
|
@@ -191,7 +191,7 @@ import{a as ce}from"./chunk-QNTDRZ5Z.js";import{b as Pt,c as Rt,k as At}from"./c
|
|
|
191
191
|
await sleep(pollMs)
|
|
192
192
|
}
|
|
193
193
|
return { settled: false, elapsed: Date.now() - start }
|
|
194
|
-
})()`},{timeoutMs:s+1e3}),{elapsed:f,settled:h}=m??{};return{elapsed:typeof f=="number"?f:s,settled:h===!0}}var ts={initialWaitMs:3e3,deadlineMs:5e3,retryWaitMs:700},os={initialWaitMs:1200,deadlineMs:2500,retryWaitMs:700};function ss(e,t={}){return{...e?ts:os,...t}}function pe(e){return!(!e||e.hit===!1||e.ok===!1||e.requestedTargetMatched===!1||e.pointerTapHandled===!1&&!e.keyboardOpened&&!e.isTextInput)}function ns(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=ss(!!t.agent,t.timing),i=0,
|
|
194
|
+
})()`},{timeoutMs:s+1e3}),{elapsed:f,settled:h}=m??{};return{elapsed:typeof f=="number"?f:s,settled:h===!0}}var ts={initialWaitMs:3e3,deadlineMs:5e3,retryWaitMs:700},os={initialWaitMs:1200,deadlineMs:2500,retryWaitMs:700};function ss(e,t={}){return{...e?ts:os,...t}}function pe(e){return!(!e||e.hit===!1||e.ok===!1||e.requestedTargetMatched===!1||e.pointerTapHandled===!1&&!e.keyboardOpened&&!e.isTextInput)}function ns(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=ss(!!t.agent,t.timing),i=0,d=null,l=null;try{await se({bridge:e,maxMs:s.initialWaitMs,pollMs:32,stablePolls:2})}catch{}let m=Date.now()+s.deadlineMs,f=null;for(;Date.now()<=m||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){l={hit:!1,reason:"offscreen",x:h.cx,y:h.cy,screen:h.screen};let b=`${Math.round(h.cx)},${Math.round(h.cy)}`;if(f===b)return{payload:h,result:l,attempts:i,failure:"missed"};f=b}else{f=null;let b=ns(h,t.textFallback),k=await e.send({type:"evaluate",code:`(async () => {
|
|
195
195
|
const t = window.__sootsimTest
|
|
196
196
|
if (
|
|
197
197
|
!t ||
|
|
@@ -232,7 +232,7 @@ import{a as ce}from"./chunk-QNTDRZ5Z.js";import{b as Pt,c as Rt,k as At}from"./c
|
|
|
232
232
|
requestedTarget,
|
|
233
233
|
coordinateTarget,
|
|
234
234
|
}
|
|
235
|
-
})()`});if(k?.error)return{payload:h,result:{hit:!1,reason:k.error,requestedTarget:b},attempts:i,failure:"special"};if(k?.requestedTargetMatched===!1)return{payload:h,result:{hit:!1,reason:"target-covered",...k},attempts:i,failure:"missed"};let N=await e.send({type:"tap",x:h.cx,y:h.cy,target:b}),M=N&&typeof N=="object"?{...N,...k}:{hit:!!N,...k};if(l=M,pe(M))return{payload:h,result:M,attempts:i}}let S=m-Date.now();if(S<=0)break;try{await se({bridge:e,maxMs:Math.min(S,s.retryWaitMs),pollMs:32,stablePolls:2})}catch{await new Promise(b=>setTimeout(b,Math.min(120,S)))}}return{payload:
|
|
235
|
+
})()`});if(k?.error)return{payload:h,result:{hit:!1,reason:k.error,requestedTarget:b},attempts:i,failure:"special"};if(k?.requestedTargetMatched===!1)return{payload:h,result:{hit:!1,reason:"target-covered",...k},attempts:i,failure:"missed"};let N=await e.send({type:"tap",x:h.cx,y:h.cy,target:b}),M=N&&typeof N=="object"?{...N,...k}:{hit:!!N,...k};if(l=M,pe(M))return{payload:h,result:M,attempts:i}}let S=m-Date.now();if(S<=0)break;try{await se({bridge:e,maxMs:Math.min(S,s.retryWaitMs),pollMs:32,stablePolls:2})}catch{await new Promise(b=>setTimeout(b,Math.min(120,S)))}}return{payload:d,result:l,attempts:i,failure:d&&typeof d.cx=="number"?"missed":"not-found"}}async function Kt(e,t,s,i){return e.send({type:"tap",x:t,y:s,...i?{target:i}:{}})}async function Ut(e,t,s={}){let i=JSON.stringify(t);return be(e,{agent:s.agent,timing:s.timing,resolve:()=>e.send({type:"evaluate",code:`(async () => {
|
|
236
236
|
const t = window.__sootsimTest
|
|
237
237
|
if (!t) return null
|
|
238
238
|
const n = (await t.findByTestId(${i})) || (await t.findById(${i}))
|
|
@@ -282,10 +282,10 @@ import{a as ce}from"./chunk-QNTDRZ5Z.js";import{b as Pt,c as Rt,k as At}from"./c
|
|
|
282
282
|
},
|
|
283
283
|
strategy: (resolved && resolved.strategy) || 'matched-node',
|
|
284
284
|
}
|
|
285
|
-
})()`})})}async function Gt(e,t,s={},i={}){let
|
|
285
|
+
})()`})})}async function Gt(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 () => {
|
|
286
286
|
const t = window.__sootsimTest
|
|
287
287
|
if (!t) return { error: 'bridge-not-ready' }
|
|
288
|
-
const F = ${
|
|
288
|
+
const F = ${d}
|
|
289
289
|
|
|
290
290
|
const res = await t.queryTextCandidates({
|
|
291
291
|
query: F.query,
|
|
@@ -410,7 +410,7 @@ import{a as ce}from"./chunk-QNTDRZ5Z.js";import{b as Pt,c as Rt,k as At}from"./c
|
|
|
410
410
|
total,
|
|
411
411
|
idx,
|
|
412
412
|
}
|
|
413
|
-
})()`})})}async function Yt(e,t,s={}){let i=JSON.stringify(t);return be(e,{agent:s.agent,timing:s.timing,textFallback:t,resolve:async()=>{let
|
|
413
|
+
})()`})})}async function Yt(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 () => {
|
|
414
414
|
const t = window.__sootsimTest
|
|
415
415
|
if (!t) return { error: 'bridge-not-ready' }
|
|
416
416
|
const byTestId =
|
|
@@ -457,17 +457,17 @@ import{a as ce}from"./chunk-QNTDRZ5Z.js";import{b as Pt,c as Rt,k as At}from"./c
|
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
459
|
return { strategy: 'none' }
|
|
460
|
-
})()`});if(!
|
|
460
|
+
})()`});if(!d||!("node"in d))return d;let l=d.node,m=l.absolutePosition.x+l.layout.width/2,f=l.absolutePosition.y+l.layout.height/2,h=d.screen??null,S=!!h&&(m<0||f<0||m>h.width||f>h.height);return{...d,cx:m,cy:f,...S?{offscreen:!0,screen:h}:{},target:{id:l.id,testID:l.testID,text:d.strategy==="text"?t:l.text,type:l.type}}}})}async function zt(e,t={args:[]}){let s=await it(e);if(A(t.args)){D(s);return}console.log(` nodes: ${s.nodes}`)}function ze(e,t){let s=e.indexOf(t);return s>=0&&s+1<e.length?e[s+1]:null}async function Xt(e){let{bridge:t,args:s,positional:i}=e,d=s.includes("--verbose")||s.includes("-v"),l=A(s),m=d&&!l,f=s.includes("--watch")||s.includes("-w"),h=1e3,S=s.includes("--compact"),b=s.includes("--no-xy"),k=s.includes("--no-clipped"),N=s.includes("--include-occluded"),M=ze(s,"--testid-like"),j=ze(s,"--only"),O=ze(s,"--subtree"),c=i[1]&&!i[1].startsWith("-")?i[1]:void 0,q=c?/[*?]/.test(c):!1,P=!q&&!j?c:void 0,E=j??(q?c:void 0),K=async()=>{await ue(t,{verbose:m});let _=await ct(t,{describe:!0,verbose:d,filter:P||"",testIdLike:M||void 0,onlyGlob:E||void 0,subtreeRoot:O||void 0,compact:S,hideXy:b,includeOccluded:N}),F=_?.tree,J=_?.shell,H=_?.keyboard;if(l){D({shell:J,tree:F??"",keyboard:H});return}if(J&&typeof J=="object"){let C=[J.state?`state=${J.state}`:null,J.activeApp?`app=${J.activeApp}`:null,J.showSwitcher?"switcher":null,J.switcherPhase&&J.switcherPhase!=="idle"?`phase=${J.switcherPhase}`:null].filter(Boolean);C.length>0&&console.log(` shell: ${C.join(" ")}`)}if(typeof F=="string"&&F.startsWith("__SUBTREE_NOT_FOUND__:")){let C=F.slice(22);console.log(` subtree root not found: ${C}`),Q("subtree-root-not-found",C);return}if(!F){let C=_?.nodeCount??0;console.log(" no matching nodes found"),!(P||M||E||O)&&C<10&&Q("app-still-loading",C);return}let ee=F,te=0;if(k&&typeof ee=="string"){let C=ee.split(`
|
|
461
461
|
`),le=[];for(let Se of C){if(Se.includes("(clipped:")){te+=1;continue}le.push(Se)}ee=le.join(`
|
|
462
|
-
`)}console.log(ee),te>0&&console.log(` ${te} clipped row(s) hidden (omit --no-clipped to see)`);let
|
|
462
|
+
`)}console.log(ee),te>0&&console.log(` ${te} clipped row(s) hidden (omit --no-clipped to see)`);let ie=P||M||E||O;if((P||M||E)&&!f&&Q("describe-filter-context"),!ie&&!f&&F.split(`
|
|
463
463
|
`).length>=80&&Q("describe-use-filters"),H&&H.visible){let C=H.spec,le=[C?.keyboardType?`type=${C.keyboardType}`:null,C?.returnKeyType&&C.returnKeyType!=="default"?`return=${C.returnKeyType}`:null,H.mode!=="letters"?`mode=${H.mode}`:null,H.shifted?"shift":null,H.capsLock?"caps":null,C?.autoCapitalize&&C.autoCapitalize!=="sentences"?`autoCap=${C.autoCapitalize}`:null,H.accessoryBarId?`accessory=${H.accessoryBarId}`:null].filter(Boolean);console.log(`
|
|
464
464
|
keyboard: ${le.join(" ")||"visible"}`)}};if(f)for(console.log(` watching... (Ctrl+C to stop)
|
|
465
|
-
`);;)console.clear(),await K(),await oe(h);else await K()}var rs=["SOOTSIM_AGENT","AGENTBUS_SESSION","CLAUDECODE","CLAUDE_CODE_ENTRYPOINT","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","CURSOR_TRACE_ID","AIDER_MODEL"];function me(){if(process.env.SOOTSIM_AGENT==="0")return!1;for(let e of rs){let t=process.env[e];if(t&&t.trim()&&t!=="0")return!0}return!1}async function Vt(e){let{bridge:t,args:s,effectiveArgs:i,positional:
|
|
465
|
+
`);;)console.clear(),await K(),await oe(h);else await K()}var rs=["SOOTSIM_AGENT","AGENTBUS_SESSION","CLAUDECODE","CLAUDE_CODE_ENTRYPOINT","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","CURSOR_TRACE_ID","AIDER_MODEL"];function me(){if(process.env.SOOTSIM_AGENT==="0")return!1;for(let e of rs){let t=process.env[e];if(t&&t.trim()&&t!=="0")return!0}return!1}async function Vt(e){let{bridge:t,args:s,effectiveArgs:i,positional:d,inspectUsage:l}=e,m=_=>{let F=i.indexOf(_);return F>=0&&F+1<i.length?i[F+1]:null},f=_=>i.includes(_),h=m("--testid")||m("--test-id"),S=m("--role"),b=m("--type"),k=m("--text"),N=f("--pressable"),M=f("--visible"),j=f("--interactive-targets")||f("--actions"),O=!h&&!S&&!b&&!k&&!N&&!M&&!j?d[1]:null,c=k??O,q=await mt(t,{testId:h,role:S,type:b,text:c,pressable:N,visible:M,interactive:j});q||(console.error(l("find","<text> | --text <t> | --testid <id> | --role <r> | --type <t> | --pressable | --visible | --interactive-targets")),process.exit(1));let{mode:P,result:E}=q,K=A(s),U=s.includes("--verbose")||s.includes("--dump");if(K)P==="interactive-targets"&&Array.isArray(E)?D(Be(E).map(_=>({..._,tap:Ce(_)}))):D(E??null);else if(Array.isArray(E))if(E.length===0){console.log(` no ${P} nodes found`);let _=await t.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount?.()) || 0)()"});typeof _=="number"&&_<10&&Q("app-still-loading",_)}else if(P==="interactive-targets"){let _=Be(E);console.log(` found ${_.length} interactive target${_.length===1?"":"s"} (sorted by score):`);for(let F of _.slice(0,20)){let J=F.absolutePosition?`@(${Math.round(F.absolutePosition.x)},${Math.round(F.absolutePosition.y)})`:"",H=F.layout?`${Math.round(F.layout.width)}x${Math.round(F.layout.height)}`:"?x?",ee=F.text?` "${F.text.slice(0,30)}"`:"",te=F.testID?` #${F.testID}`:"",ie=F.accessibilityLabel?` \u24D8"${String(F.accessibilityLabel).slice(0,24)}"`:"",xe=F.accessibilityRole?`[${F.accessibilityRole}]`:F.type,C=Ce(F);console.log(` ${xe}${ee}${ie}${te} ${H} ${J}`),console.log(` \u2192 ${C}`),U&&console.log(Xe(JSON.stringify(F,null,2)," "))}_.length>20&&console.log(` ... and ${_.length-20} more`)}else{console.log(` found ${E.length} node${E.length===1?"":"s"} (${P}):`);for(let _ of E.slice(0,20)){let F=_.absolutePosition?`@(${Math.round(_.absolutePosition.x)},${Math.round(_.absolutePosition.y)})`:"",J=_.layout?`${Math.round(_.layout.width)}x${Math.round(_.layout.height)}`:"?x?",H=_.text?` "${_.text.slice(0,30)}"`:"",ee=_.testID?` #${_.testID}`:"",te=_.pressable?" (tap)":"",ie=_.accessibilityRole?`[${_.accessibilityRole}]`:_.type;console.log(` ${ie}${H}${ee} ${J} ${F}${te}`),U&&console.log(Xe(JSON.stringify(_,null,2)," "))}E.length>20&&console.log(` ... and ${E.length-20} more`)}else if(E==null)console.log(` not found: ${c||h||S||b||""||P}`),h&&Q("wait-selector-for-missing-testid",h);else{let _=E;if(_.type&&_.absolutePosition){let F=`@(${Math.round(_.absolutePosition.x)},${Math.round(_.absolutePosition.y)})`,J=_.layout?`${Math.round(_.layout.width)}x${Math.round(_.layout.height)}`:"?x?",H=_.text?` "${_.text.slice(0,40)}"`:"",ee=_.testID?` #${_.testID}`:"",te=_.pressable?" (tap)":"",ie=_.accessibilityRole?`[${_.accessibilityRole}]`:_.type;console.log(` ${ie}${H}${ee} ${J} ${F}${te}`),U&&console.log(Xe(JSON.stringify(_,null,2)," "))}else console.log(JSON.stringify(E,null,2))}}function Xe(e,t){return e.split(`
|
|
466
466
|
`).map(s=>t+s).join(`
|
|
467
|
-
`)}async function Qt(e){let{bridge:t,args:s}=e,i=A(s);await ue(t,{verbose:!i});let
|
|
468
|
-
`),console.log(ut(f,{styling:
|
|
469
|
-
`))}async function eo(e){let t=await e.bridge.listSims(),s=e.args.includes("--all"),i=e.args.find((f,h)=>e.args[h-1]==="--bundle"),
|
|
470
|
-
slope over ${N.toFixed(0)}s:`);let j=Object.entries(M).filter(([,O])=>O!==0).sort((O,c)=>Math.abs(c[1])-Math.abs(O[1]));if(j.length===0){console.log(" all counters flat");return}for(let[O,c]of j){let q=O.endsWith("Bytes")?`${
|
|
467
|
+
`)}async function Qt(e){let{bridge:t,args:s}=e,i=A(s);await ue(t,{verbose:!i});let d=s.includes("--styling"),l=s.indexOf("--filter"),m=l>=0?s[l+1]:void 0,f=await dt(t,{styling:d,filter:m});if(i){D({count:f.length,elements:f});return}console.log(` layout (${f.length} element${f.length===1?"":"s"}):
|
|
468
|
+
`),console.log(ut(f,{styling:d}))}async function Zt(e,t={}){let s=await vt(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:l,shifted:m,capsLock:f,accessoryBarId:h}=s,S=[];S.push(`keyboard: ${i?"visible":"hidden"}`),d?(S.push(` type: ${d.keyboardType}`),S.push(` returnKey: ${d.returnKeyType}`),S.push(` autoCap: ${d.autoCapitalize}`),S.push(` autoCorrect: ${d.autoCorrect?"on":"off"}`),S.push(` appearance: ${d.keyboardAppearance}`),d.secureTextEntry&&S.push(" secureTextEntry: true"),d.enablesReturnKeyAutomatically&&S.push(` return: ${d.currentTextIsEmpty?"disabled (empty)":"enabled"}`)):S.push(" spec: <none> (shown via dev-tools with no TextInput)"),S.push(` mode: ${l}${m?" (shifted)":""}${f?" (caps)":""}`),h&&S.push(` accessoryBar: ${h}`),console.log(S.join(`
|
|
469
|
+
`))}async function eo(e){let t=await e.bridge.listSims(),s=e.args.includes("--all"),i=e.args.find((f,h)=>e.args[h-1]==="--bundle"),d=e.args.find((f,h)=>e.args[h-1]==="--app-port"),l=e.args.includes("--primary"),m=t.filter(f=>!(l&&!f.isPrimary||i&&!(f.url??"").includes(i)||d&&!(f.url??"").includes(`/rn/${d}`)||!s&&!i&&!d&&!l&&!(f.url&&(f.url.includes("bundle=")||f.url.includes("/index.bundle")))&&f.id!==e.simId));if(A(e.args)){D(m.map(f=>({...f,active:f.id===e.simId})));return}At(m,e.simId),m.length<t.length&&!A(e.args)&&console.log(` (${t.length-m.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 is(e,t){return t<=0?"?":`${(e/t*100).toFixed(0)}%`}function as(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 to(e,t){return e.endsWith("Bytes")?re(t):String(t)}function Ve(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,l])=>`${d}:${l}`).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)} (${is(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 ls(e){console.log(" memory:"),Ve("tenant worker",e.tenant),Ve("shell worker",e.shell),Ve("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 cs(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 oo(e,t={args:[]}){let s=A(t.args),i=t.args.indexOf("--watch");if(i===-1){let O=await Le(e);if(s){D(O);return}ls(O);return}let d=Number(t.args[i+1]),l=Number.isFinite(d)&&d>0?d:60,m=cs(t.args,"--interval",5),f=[],h=Date.now(),S=null;for(s||console.log(` sampling every ${m}s for ${l}s \u2014 deltas per tick:`);;){let O=await Le(e),c=(Date.now()-h)/1e3,q=as(O);if(f.push({tSec:c,counters:q}),!s){let P=[];for(let[E,K]of Object.entries(q)){let U=S&&E in S?K-S[E]:null;if(U===null||U===0)continue;let _=U>0?"+":"-",F=E.endsWith("Bytes")?`${_}${re(Math.abs(U))}`:`${_}${Math.abs(U)}`;P.push(`${E} ${to(E,K)} (${F})`)}console.log(` t+${c.toFixed(0)}s ${P.length?P.join(" "):S?"no change":Object.entries(q).map(([E,K])=>`${E} ${to(E,K)}`).join(" ")}`)}if(S=q,c>=l)break;await new Promise(P=>setTimeout(P,m*1e3))}let b=f[0],k=f[f.length-1],N=Math.max(k.tSec-b.tSec,.001),M={};for(let O of Object.keys(k.counters))O in b.counters&&(M[O]=(k.counters[O]-b.counters[O])/N);if(s){D({samples:f,perSecond:M,elapsedSec:N});return}console.log(`
|
|
470
|
+
slope over ${N.toFixed(0)}s:`);let j=Object.entries(M).filter(([,O])=>O!==0).sort((O,c)=>Math.abs(c[1])-Math.abs(O[1]));if(j.length===0){console.log(" all counters flat");return}for(let[O,c]of j){let q=O.endsWith("Bytes")?`${re(Math.abs(c))}/s${c<0?" (shrinking)":""}`:`${c>0?"+":""}${c.toFixed(2)}/s`;console.log(` ${O.padEnd(28)}${q}`)}}var Z="<redacted secure text>";function we(e){let t=e?.layout?.spec??e?.spec??null;return!!t?.secureTextEntry&&t.keyboardType!=="visible-password"}function Qe(e,t){return we(t)?Z:e}function Ze(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 $e(e){let t=e.indexOf("--testid");if(t>=0&&e[t+1])return{mode:"testid",value:e[t+1]};let s=e.indexOf("--test-id");if(s>=0&&e[s+1])return{mode:"testid",value:e[s+1]};let i=e.indexOf("--text");return i>=0&&e[i+1]?{mode:"text",value:e[i+1]}:null}async function Oe(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 () => {
|
|
471
471
|
const t = window.__sootsimTest
|
|
472
472
|
if (!t) return null
|
|
473
473
|
const n = ${i}
|
|
@@ -492,12 +492,12 @@ import{a as ce}from"./chunk-QNTDRZ5Z.js";import{b as Pt,c as Rt,k as At}from"./c
|
|
|
492
492
|
text: ${JSON.stringify(t.mode==="text")} ? ${s} : (n.text ?? n.accessibilityLabel ?? null),
|
|
493
493
|
type: n.type ?? null,
|
|
494
494
|
}
|
|
495
|
-
})()`})??null}async function so(e,t={}){let{nav:s,route:i,keyboard:
|
|
496
|
-
`))}async function no(e){let{bridge:t,args:s,positional:i}=e,
|
|
495
|
+
})()`})??null}async function so(e,t={}){let{nav:s,route:i,keyboard:d,shell:l}=await kt(e);if(t.json){console.log(JSON.stringify({shell:l??null,nav:s,route:i,keyboard:d},null,2));return}let m=[];if(l){let f=l.activeApp??l.state??"<none>",h=l.showSwitcher?" (app switcher open)":"",S=typeof l.launchProgress=="number"&&l.launchProgress<.98?` launching (${Math.round(l.launchProgress*100)}%)`:"";m.push(`shell: ${f}${h}${S}`)}else m.push("shell: <unavailable>");if(s){let f=s.transitionPhase!=="idle"?` (${s.transitionPhase}, ${s.activeTransitionCount} active)`:"";if(m.push(`nav: phase=${s.transitionPhase}${f}`),s.screens.length===0)m.push(" <no registered screens \u2014 app may not use react-native-screens>");else for(let h of s.screens){let S=h.isActive?"\u25B6":" ",b=h.routeName?` ${h.routeName}`:"",k=h.headerHeight>0?` header=${h.headerHeight}`:"",N=h.largeTitleState&&h.largeTitleState!=="expanded"?` large-title=${h.largeTitleState}`:"";m.push(` ${S} #${h.id}${b}${k}${N}`)}}else m.push("nav: <runtime not available>");if(m.push(`route: ${i?.currentPath??"<unavailable>"}`),i?.coveringPath&&m.push(`covered: a presented screen (${i.coveringPath}) is above this route`),d&&d.visible){let f=d.spec?.keyboardType??"default",h=d.spec?.returnKeyType??"default";m.push(`keyboard: visible (${f}, return=${h}, mode=${d.mode??"?"})`)}else m.push("keyboard: hidden");console.log(m.join(`
|
|
496
|
+
`))}async function no(e){let{bridge:t,args:s,positional:i}=e,d=i[1]?Number(i[1])*1e3:3e3,l=s.includes("--strict"),{elapsed:m,settled:f}=await se({bridge:t,maxMs:d,strict:l});console.log(f?` settled in ${m}ms`:` timed out after ${m}ms (may still be animating)`)}async function ro(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 io(e){let{bridge:t,args:s,positional:i}=e,d=s.includes("--boxes"),l=i[1]?Number(i[1]):d?50:5,{tree:m}=await at(t,l,d?{format:"boxes"}:void 0);if(A(s)){D({depth:l,tree:m??null});return}console.log(typeof m=="string"?m:JSON.stringify(m,null,2))}async function ao(e,t={args:[]}){let s=await lt(e);if(A(t.args)){D(s);return}console.log(s.url)}async function lo(e){let{wsPort:t,commandTimeoutMs:s,simId:i,simIdSource:d,positional:l}=e,m=l[1]?Number(l[1]):30,f=Math.max(1e3,(Number.isFinite(m)?m:30)*1e3),h=Math.max(1,Math.ceil(f/500));console.log(" waiting for sim reconnect...");let S=await Ft(t,s,i,{attempts:h,simIdSource:d});S||(console.error(" timed out waiting for sim reconnect"),process.exit(1)),S.bridge.close(),Fe({source:"inspect wait",step:{wait:f},summary:`wait ${Math.round(f/1e3)}s`}),console.log(` ready: ${S.count} nodes`)}var co=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 Re(e,t){let s=e.indexOf(t);if(s>=0&&s+1<e.length)return e[s+1]}function ds(e,t){if(!t.filter&&!t.equals)return!0;let s=e.data,i=[];if(s&&typeof s=="object")for(let l of["url","displayUrl","message","name","activeName","path","pathname","title","phase","event","type","kind"]){let m=s[l];typeof m=="string"&&m.length>0&&i.push(m)}let d=i.join(" ");return t.equals?i.some(l=>l===t.equals):t.filter?d.toLowerCase().includes(t.filter.toLowerCase()):!0}async function uo(e){let{bridge:t,args:s,positional:i,inspectUsage:d}=e,l=i[1];l||(console.error(d("wait event","<kind> [--max-ms 5000] [--filter <substring>] [--equals <exact>] [--since now|cursor]")),process.exit(1)),co.has(l)||console.error(` warning: '${l}' is not a known timeline kind \u2014 waiting anyway. known: ${[...co].sort().join(", ")}`);let m=Re(s,"--max-ms"),f=m&&Number.isFinite(Number(m))?Math.max(100,Number(m)):5e3,h=Re(s,"--filter"),S=Re(s,"--equals"),b=Re(s,"--since")??"now",k=s.includes("--json"),N=Date.now(),M=N+f,j=200,O=N;for(;Date.now()<M;){let q={kinds:[l],since:b==="cursor"?void 0:O,limit:50},P=await t.send({type:"evaluate",code:`(async () => {
|
|
497
497
|
const t = window.SootSim?.bridges?.timeline
|
|
498
498
|
if (!t) return { ok: false, error: 'timeline bridge missing' }
|
|
499
499
|
return { ok: true, result: await t.recent(${JSON.stringify(q)}) }
|
|
500
|
-
})()`});(!
|
|
500
|
+
})()`});(!P||!P.ok)&&(console.error(` could not query timeline: ${P&&"error"in P?P.error:"unknown"}`),process.exit(1));let E=P.result.events??[];for(let K of E)if(ds(K,{filter:h,equals:S})){let U=Date.now()-N;console.log(k?JSON.stringify({found:!0,elapsedMs:U,event:K}):` ${l} event after ${U}ms${h?` (filter: ${h})`:""}${S?` (equals: ${S})`:""}`);return}P.result.watermark&&P.result.watermark>O&&(O=P.result.watermark),await new Promise(K=>setTimeout(K,j))}let c=Date.now()-N;k?console.log(JSON.stringify({found:!1,elapsedMs:c,kind:l,filter:h,equals:S})):console.error(` \u26A0 wait event ${l} timed out after ${c}ms${h?` (filter: ${h})`:""}${S?` (equals: ${S})`:""}`),process.exit(1)}async function po(e){let{bridge:t,args:s}=e,i=s.includes("--strict"),d=ke(s,3e3),{elapsed:l,settled:m}=await se({bridge:t,maxMs:d,strict:i});m?console.log(` idle in ${l}ms`):(console.error(` \u26A0 wait idle timed out after ${l}ms (may still be animating)`),process.exit(1))}async function mo(e){let{bridge:t,args:s}=e,i=ke(s,2e4),{ready:d,elapsedMs:l,nodes:m,targets:f,flag:h,loadingText:S,externalReady:b,externalError:k,suppressedEntryError:N,errors:M,bridgeError:j}=await ft(t,i,{onProgress(c){console.error(` still waiting after ${c.elapsedMs}ms \u2014 ${je(c)} (nodes: ${c.nodes}, targets: ${c.targets}, errors: ${c.errors})`)}});if(d){let c=i-l,q=Math.max(100,Math.min(1e4,c)),P=await se({bridge:t,maxMs:q,pollMs:32,stablePolls:2});P.settled||(console.error(` \u26A0 wait ready timed out after ${l+P.elapsed}ms \u2014 app mounted but did not settle (nodes: ${m}, targets: ${f})`),process.exit(1)),console.log(` ready in ${l+P.elapsed}ms: ${m} nodes, ${f} targets`);return}let O=je({externalError:k,loadingText:S,externalReady:b,flag:h,targets:f,suppressedEntryError:N,bridgeError:j});console.error(` \u26A0 wait ready timed out after ${l}ms \u2014 ${O} (nodes: ${m}, targets: ${f}, errors: ${M})`),process.exit(1)}async function fo(e){let{bridge:t,args:s,positional:i,inspectUsage:d}=e,l=i[1];l||(console.error(d("wait selector","<testid> [--max-ms 5000] [--gone]")),process.exit(1));let m=s.indexOf("--max-ms"),f=m>=0&&s[m+1]?Math.max(100,Number(s[m+1])):5e3,h=s.includes("--gone"),{found:S,node:b,elapsed:k}=await gt(t,l,f,{gone:h});if(h){S?console.log(` #${l} gone after ${k}ms`):(console.error(` \u26A0 wait selector #${l} --gone timed out after ${k??f}ms (still present)`),process.exit(1));return}if(S&&b){let N=b.absolutePosition?`@(${Math.round(b.absolutePosition.x)},${Math.round(b.absolutePosition.y)})`:"",M=b.layout?`${Math.round(b.layout.width)}x${Math.round(b.layout.height)}`:"?x?";console.log(` found #${l} in ${k}ms ${M} ${N}`)}else console.error(` \u26A0 wait selector #${l} timed out after ${k??f}ms`),process.exit(1)}function _o(e){return e==null?"\u2014":e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}K`:`${(e/1024/1024).toFixed(1)}M`}function Io(e){return e==null?" \u2026":e<1e3?`${e}ms`.padStart(5):`${(e/1e3).toFixed(2)}s`.padStart(5)}function go(){process.stderr.write(` the sim is not responding. recover it with:
|
|
501
501
|
sootsim close --sim <id> # force-close the wedged sim
|
|
502
502
|
sootsim list # confirm it's gone
|
|
503
503
|
`)}async function ps(e){try{return await e.send({type:"evaluate",code:"1"},{timeoutMs:3e3}),!0}catch{return!1}}async function ms(e,t){try{let s=await e.send({type:"evaluate",code:`(async () => {
|
|
@@ -519,9 +519,9 @@ import{a as ce}from"./chunk-QNTDRZ5Z.js";import{b as Pt,c as Rt,k as At}from"./c
|
|
|
519
519
|
} catch {
|
|
520
520
|
return []
|
|
521
521
|
}
|
|
522
|
-
})()`});if(!Array.isArray(s)||s.length===0)return;let i=t.toLowerCase(),
|
|
523
|
-
`).slice(0,5);for(let m of l)console.log(` ${m.trim()}`)}}var $s=120;async function $o(e,t){let s=e.find((N,M)=>e[M-1]==="--id"),i=e.find((N,M)=>e[M-1]==="--text");if(s||i){let N=await t.send({type:"evaluate",code:Dt({id:s,text:i})});if(!N)throw new Error(s?`no node with id "${s}"`:`no node matching text "${i}"`);let{x:M,y:j,w:O,h:c}=N;return{x:M,y:j,w:O,h:c}}let
|
|
524
|
-
`),s){let h=(Array.isArray(s.compositor)?s.compositor:[]).reduce((S,b)=>S+(b.jankPaints??0),0);console.log(` health: ${s.detected?"jank or cadence gaps observed":"no jank or cadence gaps observed"} \xB7 shell ${s.shell?.jankFrames??0} \xB7 compositor ${h} \xB7 host clock gaps ${s.hostGaps??0}`),console.log(" series: independent worker clocks, no per-frame pairing")}if(console.log(` painted frames: ${e.frames}${e.skippedFrames?` (+${e.skippedFrames} skipped idle ticks)`:""}`),console.log(` shell work avg: ${e.avgMs}ms (${t} fps) \xB7 worst observed ${e.maxMs}ms`),console.log(` shell p50/95/99:${e.p50} / ${e.p95} / ${e.p99} ms`),s){console.log(` shell jank: ${s.shell?.jankFrames??0}/${s.shell?.sampledFrames??0} (${s.shell?.jankPct??0}%) >16.67ms \xB7 max ${s.shell?.maxMs??0}ms`);for(let f of Array.isArray(s.compositor)?s.compositor:[])console.log(` ${String(f.surfaceId).padEnd(12)} ${f.jankPaints}/${f.sampledPaints} compositor paints (${f.jankPct}%) >16.67ms \xB7 max ${f.maxMs}ms`)}else console.log(` jank: ${e.jankFrames} frames (${e.jankPct}%) >16.67ms`);console.log(` avg per frame: overlay ${e.avgOverlayMs}ms \xB7 aux ${e.avgAuxMs}ms \xB7 layout ${e.avgLayoutMs}ms`);let i=e.cadence;i&&typeof i=="object"&&(console.log(""),console.log(` cadence (frame delivery, ${i.vsyncTicks} vsync ticks):`),console.log(` display clock: ${i.displayHz}hz \xB7 host rAF interval p50 ${i.hostIntervalP50} / p95 ${i.hostIntervalP95} / max ${i.hostIntervalMax} ms${i.hostGaps?` \xB7 ${i.hostGaps} gaps >1.5x (host rAF starved)`:""}`),console.log(` delivery lag: p50 ${i.deliveryLagP50} / p95 ${i.deliveryLagP95} / max ${i.deliveryLagMax} ms (vsync postMessage \u2192 shell receipt)`),console.log(` paint interval: p50 ${i.paintIntervalP50} / p95 ${i.paintIntervalP95} / max ${i.paintIntervalMax} ms${i.idleBreaks?` \xB7 ${i.idleBreaks} idle breaks excluded`:""}`));let
|
|
522
|
+
})()`});if(!Array.isArray(s)||s.length===0)return;let i=t.toLowerCase(),d=s.map(l=>({id:l,score:fs(i,l.toLowerCase())})).filter(l=>l.score<i.length+4).sort((l,m)=>l.score-m.score).slice(0,5);if(d.length===0)return;console.error(" similar testIDs:");for(let l of d)console.error(` ${l.id}`)}catch{}}function fs(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 gs(e,t)-s}function gs(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 m=1;m<=t.length;m++)i[m]=Math.min(s[m]+1,i[m-1]+1,s[m-1]+(e[d-1]===t[m-1]?0:1));let l=s;s=i,i=l}return s[t.length]}function ys(e){return e.error?"err":e.status==null?" \u2026 ":String(e.status)}function yo(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 ho(e){let t=ae(e.startTs),s=ys(e).padEnd(3),i=e.method.padEnd(5),d=_o(e.size).padStart(6),l=Io(e.durationMs);console.log(` [${t}] ${s} ${i} ${d} ${l} ${e.displayUrl}`),e.error&&console.log(` error: ${e.error}`)}function hs(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",Io(e.durationMs).trim()],["size",_o(e.size)],["content-type",e.type??"\u2014"]];for(let[s,i]of t)console.log(` ${s.padEnd(13)} ${i}`)}var bs={error:"\x1B[31m",warn:"\x1B[33m",info:"\x1B[36m",debug:"\x1B[35m",log:"\x1B[37m"},bo="\x1B[0m",ws="\x1B[2m";function wo(e,t){let s=ae(e.ts),i=e.level.toUpperCase().padEnd(5),d=e.args.join(" ");if(t){let l=bs[e.level];console.log(` ${ws}[${s}]${bo} ${l}${i}${bo} ${d}`)}else console.log(` [${s}] ${i} ${d}`);if(e.stack&&e.level==="error"){let l=e.stack.split(`
|
|
523
|
+
`).slice(0,5);for(let m of l)console.log(` ${m.trim()}`)}}var $s=120;async function $o(e,t){let s=e.find((N,M)=>e[M-1]==="--id"),i=e.find((N,M)=>e[M-1]==="--text");if(s||i){let N=await t.send({type:"evaluate",code:Dt({id:s,text:i})});if(!N)throw new Error(s?`no node with id "${s}"`:`no node matching text "${i}"`);let{x:M,y:j,w:O,h:c}=N;return{x:M,y:j,w:O,h:c}}let d=e.find((N,M)=>e[M-1]==="--area");if(d){let N=d.split(",").map(q=>Number(q.trim()));if(N.length!==4||N.some(q=>!Number.isFinite(q)))throw new Error(`--area expects x,y,w,h (got "${d}")`);let[M,j,O,c]=N;return{x:M,y:j,w:O,h:c}}let l=N=>{let M=e.find((O,c)=>e[c-1]===N);if(M==null)return null;let j=Number(M);return Number.isFinite(j)?j:null},m=l("--x"),f=l("--y"),h=l("--w"),S=l("--h");if(m!=null||f!=null||h!=null||S!=null)return{x:m??0,y:f??0,w:h??1,h:S??1};let k=e.filter((N,M)=>M>0&&!N.startsWith("-")&&e[M-1]!=="--output"&&e[M-1]!=="--area"&&e[M-1]!=="--id"&&e[M-1]!=="--text"&&e[M-1]!=="--x"&&e[M-1]!=="--y"&&e[M-1]!=="--w"&&e[M-1]!=="--h").map(Number).filter(N=>Number.isFinite(N));if(k.length>=2){let[N,M,j=1,O=1]=k;return{x:N,y:M,w:j,h:O}}return null}function xo(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 So(e){let t=e.avgMs>0?(1e3/e.avgMs).toFixed(1):"?",s=e.jank&&typeof e.jank=="object"?e.jank:null;if(console.log(` shell frame profile:
|
|
524
|
+
`),s){let h=(Array.isArray(s.compositor)?s.compositor:[]).reduce((S,b)=>S+(b.jankPaints??0),0);console.log(` health: ${s.detected?"jank or cadence gaps observed":"no jank or cadence gaps observed"} \xB7 shell ${s.shell?.jankFrames??0} \xB7 compositor ${h} \xB7 host clock gaps ${s.hostGaps??0}`),console.log(" series: independent worker clocks, no per-frame pairing")}if(console.log(` painted frames: ${e.frames}${e.skippedFrames?` (+${e.skippedFrames} skipped idle ticks)`:""}`),console.log(` shell work avg: ${e.avgMs}ms (${t} fps) \xB7 worst observed ${e.maxMs}ms`),console.log(` shell p50/95/99:${e.p50} / ${e.p95} / ${e.p99} ms`),s){console.log(` shell jank: ${s.shell?.jankFrames??0}/${s.shell?.sampledFrames??0} (${s.shell?.jankPct??0}%) >16.67ms \xB7 max ${s.shell?.maxMs??0}ms`);for(let f of Array.isArray(s.compositor)?s.compositor:[])console.log(` ${String(f.surfaceId).padEnd(12)} ${f.jankPaints}/${f.sampledPaints} compositor paints (${f.jankPct}%) >16.67ms \xB7 max ${f.maxMs}ms`)}else console.log(` jank: ${e.jankFrames} frames (${e.jankPct}%) >16.67ms`);console.log(` avg per frame: overlay ${e.avgOverlayMs}ms \xB7 aux ${e.avgAuxMs}ms \xB7 layout ${e.avgLayoutMs}ms`);let i=e.cadence;i&&typeof i=="object"&&(console.log(""),console.log(` cadence (frame delivery, ${i.vsyncTicks} vsync ticks):`),console.log(` display clock: ${i.displayHz}hz \xB7 host rAF interval p50 ${i.hostIntervalP50} / p95 ${i.hostIntervalP95} / max ${i.hostIntervalMax} ms${i.hostGaps?` \xB7 ${i.hostGaps} gaps >1.5x (host rAF starved)`:""}`),console.log(` delivery lag: p50 ${i.deliveryLagP50} / p95 ${i.deliveryLagP95} / max ${i.deliveryLagMax} ms (vsync postMessage \u2192 shell receipt)`),console.log(` paint interval: p50 ${i.paintIntervalP50} / p95 ${i.paintIntervalP95} / max ${i.paintIntervalMax} ms${i.idleBreaks?` \xB7 ${i.idleBreaks} idle breaks excluded`:""}`));let d=e.compositorCadence;d&&typeof d=="object"&&console.log(` compositor rAF: p50 ${d.p50} / p95 ${d.p95} / max ${d.max} ms \xB7 ${d.gaps} gaps >1.5x`);let l=Array.isArray(e.auxSurfaces)?e.auxSurfaces:[];if(l.length>0){console.log(""),console.log(" surfaces (last 100 frames):");for(let f of l)console.log(` ${String(f.surfaceId).padEnd(10)} ${String(f.frames).padStart(4)} paints avg ${f.avgMs}ms (layout ${f.avgLayoutMs}, render ${f.avgRenderMs}, flush ${f.avgFlushMs}) max ${f.maxMs}ms`),typeof f.gpuCacheBytes=="number"&&typeof f.gpuCacheLimitBytes=="number"&&console.log(` ${"".padEnd(10)} gpu cache ${(f.gpuCacheBytes/1024/1024).toFixed(1)}MB/${(f.gpuCacheLimitBytes/1024/1024).toFixed(1)}MB`)}xo("shell worker",e.renderProfile),xo("compositor worker",e.compositorRenderProfile);let m=Array.isArray(e.worstFrames)?e.worstFrames:[];if(m.length>0){console.log(""),console.log(" worst observations (shell and compositor series are unpaired):");for(let f of m){if(f.source==="compositor"){console.log(` ${String(f.totalMs).padStart(7)}ms compositor ${f.surfaceId} paint ${f.paint} \xB7 layout ${f.layoutMs} \xB7 render ${f.renderMs} \xB7 flush ${f.flushMs}`);continue}let h=(f.auxSurfaces??[]).map(S=>`${S.surfaceId} ${S.totalMs}ms (layout ${S.layoutMs}, render ${S.renderMs})`).join(" \xB7 ");console.log(` ${String(f.totalMs).padStart(7)}ms overlay ${f.overlayMs} \xB7 aux ${f.auxMs} \xB7 layout ${f.layoutMs}${h?` [${h}]`:""}`)}}}async function Ee(e,t,s){let i=Date.now()+t,d=await de(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 de(e)}}async function tt(e){return e.send({type:"evaluate",code:`(async () => {
|
|
525
525
|
const kb = window.__sootsimKeyboard
|
|
526
526
|
const test = window.__sootsimTest
|
|
527
527
|
if (!kb) return { error: 'keyboard bridge not available' }
|
|
@@ -558,7 +558,7 @@ import{a as ce}from"./chunk-QNTDRZ5Z.js";import{b as Pt,c as Rt,k as At}from"./c
|
|
|
558
558
|
frame: runtimeSnapshot?.keyboard?.frame ?? null,
|
|
559
559
|
focusedRect: runtimeSnapshot?.focused?.rect ?? null,
|
|
560
560
|
}
|
|
561
|
-
})()`}).then(t=>Ze(t))}function xs(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 Ss(e,t=600,s={}){let i=Date.now()+t;for(;Date.now()<=i;){let
|
|
561
|
+
})()`}).then(t=>Ze(t))}function xs(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 Ss(e,t=600,s={}){let i=Date.now()+t;for(;Date.now()<=i;){let d=await tt(e);if(xs(d,s.targetId??null,s.secureTextEntry??null))return d;await oe(30)}return tt(e)}async function Pe(e,t){let s=await tt(e);if(s.visible&&s.focusedInput)return s;s.visible&&(console.error(` ${t} requires a focused TextInput. 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 sootsim do tap-id/tap-text or sootsim do type-into.`),process.exit(1)}async function vo(e,t,s){return t==="appearance"?e.send({type:"evaluate",code:`(async () => {
|
|
562
562
|
const requested = ${JSON.stringify(s??"toggle")}
|
|
563
563
|
// the engine owns toggle + auto resolution (settingsStore is the single
|
|
564
564
|
// source of truth). never infer the current scheme client-side \u2014 the old
|
|
@@ -581,26 +581,26 @@ import{a as ce}from"./chunk-QNTDRZ5Z.js";import{b as Pt,c as Rt,k as At}from"./c
|
|
|
581
581
|
})()`}):e.send({type:"evaluate",code:`(async () => {
|
|
582
582
|
window.dispatchEvent(new CustomEvent('sootsim:shake'))
|
|
583
583
|
return { ok: true, action: 'shake' }
|
|
584
|
-
})()`})}function vs(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 ks(e){if(typeof e!="string")return null;let t=e.replace(/\s+/g," ").trim();return t?t.slice(0,80):null}function To(...e){for(let t of e){if(typeof t!="string")continue;let s=t.trim();if(s)return s}return null}function _s(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=Fe({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 `sootsim maestro keep` to commit"))}function ko(e,t,s){if(!s||s.hit===!1)return null;let i=To(s.responderTestID,s.testID);if(i)return{step:{tapOn:{id:i}},summary:`tap #${i}`};let
|
|
584
|
+
})()`})}function vs(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 ks(e){if(typeof e!="string")return null;let t=e.replace(/\s+/g," ").trim();return t?t.slice(0,80):null}function To(...e){for(let t of e){if(typeof t!="string")continue;let s=t.trim();if(s)return s}return null}function _s(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=Fe({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 `sootsim maestro keep` to commit"))}function ko(e,t,s){if(!s||s.hit===!1)return null;let i=To(s.responderTestID,s.testID);if(i)return{step:{tapOn:{id:i}},summary:`tap #${i}`};let d=ks(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 et(e,t,s){let i=To(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 Rr(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=It(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"]}),l=d.positional,m=l[0],f=s==="get"||s==="do"||s==="debug"||s==="wait"?s:"inspect",h=typeof i[0]=="string"&&ot.has(i[0]),S=h?i[0]:null,b=$=>t.internalPerfCommand&&$==="perf"?`sootsim perf ${t.internalPerfCommand}`:h&&$===i[0]?`sootsim ${$}`:`sootsim ${f} ${$}`,k=($,o)=>` usage: ${b($)}${o?` ${o}`:""}`;if(!m||e.includes("--help")||e.includes("-h")){let $={bridgePort:7668,defaultShellUrl:st};if(f==="do"||f==="get"||f==="debug"||f==="wait"){let r=Ae(f,$);r&&(console.log(`${r}
|
|
585
585
|
`),process.exit(0))}if(S==="shell"){let r=De("shell",$);r&&(console.log(`${r}
|
|
586
586
|
`),process.exit(0))}let o=De("inspect",$),n=["do","get","debug","wait"].map(r=>Ae(r,$)).filter(r=>r!=null).join(`
|
|
587
587
|
|
|
588
588
|
`);console.log(`${o??""}
|
|
589
589
|
|
|
590
590
|
${n}
|
|
591
|
-
`),process.exit(0)}let N=
|
|
592
|
-
`);let n=Math.max(...o.map(a=>a.id.length),6),r=Math.max(...o.map(a=>a.kind.length),4);for(let a of o){let
|
|
591
|
+
`),process.exit(0)}let N=d.wsPort,M=d.simId,j=d.simIdSource,O=d.commandTimeoutMs;if(f==="get"&&m==="diagnosis"){let $=i.indexOf("diagnosis"),o=$>=0?[...i.slice(0,$),...i.slice($+1)]:i,{runDiagnose:n}=await import("./diagnose-67RTUYDG.js"),r=await n(["recent",...o],t);process.exitCode=r;return}if(f==="do"&&m==="scan"){let{runCamera:$}=await import("./camera-ORZSDOGL.js");await $(i,{port:t.port});return}if(m==="list"&&i.some($=>$==="--drivers"||$==="-D")){let{buildDriverListRows:$}=await import("./drivers-LJ6764RH.js"),o=$();console.log(` available drivers (${o.length}):
|
|
592
|
+
`);let n=Math.max(...o.map(a=>a.id.length),6),r=Math.max(...o.map(a=>a.kind.length),4);for(let a of o){let u=a.available?"\u2713":"\u2717",p=a.id.padEnd(n),g=a.kind.padEnd(r);console.log(` ${u} ${p} ${g} ${a.description}`),a.available&&a.detail?console.log(` ${a.detail}`):!a.available&&a.reason&&console.log(` unavailable: ${a.reason}`)}return}let c=Tt(d),q=M||"default",P=new Set(["errors","warnings","requests","js","eval","reload","globals","perf","storage-clear","list","wait","sleep"]),E=200;function K($){let o=$.replace(/\s+/g," ").trim();if(!o)return"";if(/^<(!doctype html|html|\?xml)|<body[\s>]/i.test(o)){let r=/<title[^>]*>([^<]+)<\/title>/i.exec($)?.[1]?.trim(),a=/<body[^>]*>([\s\S]*?)<\//i.exec($)?.[1]?.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().slice(0,80),u=r||a||"html error page";return`<html ${$.length}B> "${u}" (body elided \u2014 add --json for the full payload)`}return o.length<=E?o:`${o.slice(0,E)}\u2026 (+${o.length-E} more bytes)`}function U($){let o=$.displayUrl||$.url;return $.status!=null?`${$.method} ${o} -> ${$.status}${$.statusText?` ${$.statusText}`:""}`:$.error?`${$.method} ${o} -> ${$.error}`:`${$.method} ${o}`}async function _($){let o=me()?400:200;try{let{settled:n,elapsed:r}=await se({bridge:$,maxMs:o,pollMs:32,stablePolls:2});n||process.stderr.write(` \u26A0 auto-wait timed out after ${r??o}ms \u2014 next command may see mid-animation state. use \`sootsim do settle\` for a longer wait.
|
|
593
593
|
`)}catch{}}function F($,o){if(o.result?.reason==="offscreen"){let{x:n,y:r,screen:a}=o.result;console.error(` tap failed: ${$} resolved to (${Math.round(n)},${Math.round(r)}), outside the ${a?.width}x${a?.height} screen`),console.error(" the node exists but is scrolled out of view \u2014 scroll it on-screen first (sootsim do scroll / swipe), then tap.");return}console.error(` tap failed: ${$} 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 J(){try{return await c.send({type:"evaluate",code:`(() => ({
|
|
594
594
|
console: ${_e},
|
|
595
595
|
requests: window.__sootsimTest?.getRequestCounts?.() || null,
|
|
596
596
|
}))()`})||{console:null,requests:null}}catch{return{console:null,requests:null}}}async function H($={}){let o=$.counts!==void 0?$.counts:await X(c,"getRequestCounts");if(!o||typeof o!="object")return;let n=Math.max(0,Number(o.failed)||0);if(n===0||!$.includeTail&&!Ye("requests",q,String(n))||(console.log(`
|
|
597
597
|
network: ${n} failed request${n===1?"":"s"}`),console.log(` inspect: ${b("requests")} 5`),!$.includeTail))return;let r=await X(c,"getFailedRequests",5);if(!(!Array.isArray(r)||r.length===0)){console.log(`
|
|
598
598
|
recent failed requests:
|
|
599
|
-
`);for(let a of r){let
|
|
600
|
-
note: ${o.label} is open${n} \u2014 taps/drags hit it, not the app`)}}async function te($={}){let o=$.counts!==void 0?$.counts:await c.send({type:"evaluate",code:_e});if(!o||typeof o!="object")return;let n=o,r=Math.max(0,Number(n.errors)||0),a=Math.max(0,Number(n.warnings)||0);if(r===0&&a===0||!$.includeTail&&!Ye("console",q,`${r}:${a}`))return;let
|
|
601
|
-
console: ${
|
|
599
|
+
`);for(let a of r){let u=ae(a.timestamp);console.log(` [${u}] ${U(a)}`),a.responseBody?console.log(` ${K(a.responseBody)}`):a.error&&console.log(` ${a.error}`)}}}function ee($){for(let o of $){let n=o.title?` (\u201C${o.title}\u201D)`:"";console.log(`
|
|
600
|
+
note: ${o.label} is open${n} \u2014 taps/drags hit it, not the app`)}}async function te($={}){let o=$.counts!==void 0?$.counts:await c.send({type:"evaluate",code:_e});if(!o||typeof o!="object")return;let n=o,r=Math.max(0,Number(n.errors)||0),a=Math.max(0,Number(n.warnings)||0);if(r===0&&a===0||!$.includeTail&&!Ye("console",q,`${r}:${a}`))return;let u=[];if(r>0&&u.push(`${r} console error${r===1?"":"s"}`),a>0&&u.push(`${a} console warning${a===1?"":"s"}`),console.log(`
|
|
601
|
+
console: ${u.join(", ")}`),console.log(` inspect: ${b("errors")} 5`),a>0&&console.log(` inspect: ${b("warnings")} 5`),!$.includeTail||r===0)return;let p=await fe(c,5);if(!(!Array.isArray(p)||p.length===0)){console.log(`
|
|
602
602
|
recent console errors:
|
|
603
|
-
`);for(let g of p){let w=
|
|
603
|
+
`);for(let g of p){let w=ae(g.timestamp),y=Array.isArray(g.args)?g.args.map(v=>typeof v=="object"?JSON.stringify(v):String(v)).join(" "):String(g);console.log(` [${w}] ${y}`)}}}let ie=["console","fetch","toast","alert","notification","screen","app-launch","keyboard","route","actionsheet","picker","shell","scroll","gesture","text-input","animation","reanimated"];async function xe($){let o=nt(),n=null;try{n=await Nt($,`(() => {
|
|
604
604
|
const tl = window.SootSim && window.SootSim.bridges && window.SootSim.bridges.timeline
|
|
605
605
|
if (!tl || typeof tl.summary !== 'function') return null
|
|
606
606
|
const cursorKey = ${JSON.stringify(o)}
|
|
@@ -616,9 +616,9 @@ ${n}
|
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
return summary ? { summary, consoleSplit } : null
|
|
619
|
-
})()`)}catch{return}if(!n||!n.summary||!n.summary.total)return;let r=n.summary.byKind??{},a=[],
|
|
620
|
-
since last: ${a.join(" \xB7 ")} \u2014 sootsim what-happened`),n.summary.lastAt))try{await ge($,"SootSim.bridges.timeline.cursorAdvance",o,n.summary.lastAt)}catch{}}let C=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"]),Se=(e.includes("--verbose")||e.includes("-v"))&&!e.includes("--json");f==="do"&&m==="shell"&&(console.error(" `sootsim do shell` was removed. use `sootsim shell ...` instead."),process.exit(1)),C.has(m)&&await Mt(c),le.has(m)&&await ue(c,{verbose:Se});try{let $=C.has(m)&&!A(i)?await St(c):[];switch(m){case"list":{_t(
|
|
621
|
-
`);for(let n of o){let r=[];if(r.push(`[${n.role}]`),n.label){let a=n.label.length>50?n.label.slice(0,47)+"...":n.label;r.push(`"${a}"`)}if(n.hint&&r.push(`(hint: "${n.hint}")`),n.testID&&r.push(`#${n.testID}`),n.state){let a=[];n.state.disabled&&a.push("disabled"),n.state.selected&&a.push("selected"),n.state.checked===!0&&a.push("checked"),n.state.checked==="mixed"&&a.push("mixed"),n.state.busy&&a.push("busy"),n.state.expanded===!0&&a.push("expanded"),n.state.expanded===!1&&a.push("collapsed"),a.length&&r.push(`{${a.join(", ")}}`)}n.position&&r.push(`@(${n.position.x},${n.position.y})`),n.size&&r.push(`${n.size.w}x${n.size.h}`),console.log(" "+r.join(" "))}}break}case"find":{await Vt({bridge:c,args:e,effectiveArgs:i,positional:l,inspectUsage:k});break}case"count":{await zt(c,{args:i});break}case"keyboard":{await Zt(c,{json:e.includes("--json")});break}case"screens":{await so(c,{json:e.includes("--json")});break}case"memory":{await oo(c,{args:i});break}case"wait":{await lo({wsPort:N,commandTimeoutMs:O,simId:M,simIdSource:j,positional:l});break}case"sleep":{await ro({positional:l,inspectUsage:k});break}case"settle":{await no({bridge:c,args:e,positional:l});break}case"ready":{await mo({bridge:c,args:e});break}case"idle":{await po({bridge:c,args:e,positional:l});break}case"selector":{await fo({bridge:c,args:e,positional:l,inspectUsage:k});break}case"event":{await uo({bridge:c,args:e,positional:l,inspectUsage:k});break}case"layout":{let o=l[1];if(!o){await Qt({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((w,y)=>e[y-1]==="--output")||"/tmp/sootsim-inspect.png",r=await $o(e,c),a={type:"screenshot"};r&&(a.crop=r);let p=(await c.send(a)).replace(/^data:image\/png;base64,/,"");r&&console.log(` area: x=${r.x} y=${r.y} w=${r.w} h=${r.h}`),(await import("fs")).writeFileSync(n,Buffer.from(p,"base64")),console.log(` saved: ${n}`);break}case"sample-color":{let o=await $o(e,c);o||(console.error(k("sample-color","<x> <y> [w] [h] | --id <testID> | --text <text>")),console.error(" samples an averaged color from the canvas. coords are logical sootsim units."),process.exit(1));let n=await c.send({type:"evaluate",code:Bt(o)});if(e.includes("--json"))console.log(JSON.stringify(n,null,2));else{let{r,g:a,b:
|
|
619
|
+
})()`)}catch{return}if(!n||!n.summary||!n.summary.total)return;let r=n.summary.byKind??{},a=[],u=new Set;for(let p of ie){let g=r[p];if(g)if(u.add(p),p==="console"&&n.consoleSplit){let{error:w,warn:y}=n.consoleSplit;w>0&&a.push(`${w} error${w===1?"":"s"}`),y>0&&a.push(`${y} warning${y===1?"":"s"}`)}else a.push(`${g} ${p}${g===1?"":"s"}`)}for(let[p,g]of Object.entries(r))!u.has(p)&&g&&a.push(`${g} ${p}${g===1?"":"s"}`);if(a.length!==0&&(console.log(`
|
|
620
|
+
since last: ${a.join(" \xB7 ")} \u2014 sootsim what-happened`),n.summary.lastAt))try{await ge($,"SootSim.bridges.timeline.cursorAdvance",o,n.summary.lastAt)}catch{}}let C=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"]),Se=(e.includes("--verbose")||e.includes("-v"))&&!e.includes("--json");f==="do"&&m==="shell"&&(console.error(" `sootsim do shell` was removed. use `sootsim shell ...` instead."),process.exit(1)),C.has(m)&&await Mt(c),le.has(m)&&await ue(c,{verbose:Se});try{let $=C.has(m)&&!A(i)?await St(c):[];switch(m){case"list":{_t(d.wsPort),await eo({bridge:c,simId:M,args:i});break}case"tree":{await io({bridge:c,args:i,positional:l});break}case"a11y":{let o=await pt(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):
|
|
621
|
+
`);for(let n of o){let r=[];if(r.push(`[${n.role}]`),n.label){let a=n.label.length>50?n.label.slice(0,47)+"...":n.label;r.push(`"${a}"`)}if(n.hint&&r.push(`(hint: "${n.hint}")`),n.testID&&r.push(`#${n.testID}`),n.state){let a=[];n.state.disabled&&a.push("disabled"),n.state.selected&&a.push("selected"),n.state.checked===!0&&a.push("checked"),n.state.checked==="mixed"&&a.push("mixed"),n.state.busy&&a.push("busy"),n.state.expanded===!0&&a.push("expanded"),n.state.expanded===!1&&a.push("collapsed"),a.length&&r.push(`{${a.join(", ")}}`)}n.position&&r.push(`@(${n.position.x},${n.position.y})`),n.size&&r.push(`${n.size.w}x${n.size.h}`),console.log(" "+r.join(" "))}}break}case"find":{await Vt({bridge:c,args:e,effectiveArgs:i,positional:l,inspectUsage:k});break}case"count":{await zt(c,{args:i});break}case"keyboard":{await Zt(c,{json:e.includes("--json")});break}case"screens":{await so(c,{json:e.includes("--json")});break}case"memory":{await oo(c,{args:i});break}case"wait":{await lo({wsPort:N,commandTimeoutMs:O,simId:M,simIdSource:j,positional:l});break}case"sleep":{await ro({positional:l,inspectUsage:k});break}case"settle":{await no({bridge:c,args:e,positional:l});break}case"ready":{await mo({bridge:c,args:e});break}case"idle":{await po({bridge:c,args:e,positional:l});break}case"selector":{await fo({bridge:c,args:e,positional:l,inspectUsage:k});break}case"event":{await uo({bridge:c,args:e,positional:l,inspectUsage:k});break}case"layout":{let o=l[1];if(!o){await Qt({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((w,y)=>e[y-1]==="--output")||"/tmp/sootsim-inspect.png",r=await $o(e,c),a={type:"screenshot"};r&&(a.crop=r);let p=(await c.send(a)).replace(/^data:image\/png;base64,/,"");r&&console.log(` area: x=${r.x} y=${r.y} w=${r.w} h=${r.h}`),(await import("fs")).writeFileSync(n,Buffer.from(p,"base64")),console.log(` saved: ${n}`);break}case"sample-color":{let o=await $o(e,c);o||(console.error(k("sample-color","<x> <y> [w] [h] | --id <testID> | --text <text>")),console.error(" samples an averaged color from the canvas. coords are logical sootsim units."),process.exit(1));let n=await c.send({type:"evaluate",code:Bt(o)});if(e.includes("--json"))console.log(JSON.stringify(n,null,2));else{let{r,g:a,b:u,a:p,hex:g,samples:w}=n,y=o.w===1&&o.h===1?`@(${o.x},${o.y})`:`@(${o.x},${o.y}) ${o.w}x${o.h}`;console.log(` ${g} rgba(${r}, ${a}, ${u}, ${p}) ${y} ${w} samples`)}break}case"node":{let o=l[1];o||(console.error(k("node","<matcher>")),console.error(" resolves testID, id, then text \u2014 dumps full node info as JSON"),process.exit(1));let n=await c.send({type:"evaluate",code:`(async () => {
|
|
622
622
|
const t = window.__sootsimTest
|
|
623
623
|
const q = ${JSON.stringify(o)}
|
|
624
624
|
let node = null
|
|
@@ -674,17 +674,17 @@ ${n}
|
|
|
674
674
|
transform,
|
|
675
675
|
parentChain,
|
|
676
676
|
}
|
|
677
|
-
})()`});console.log(JSON.stringify(n,null,2));break}case"tap":{let o=Number(l[1]),n=Number(l[2]),r=$e(e);if(r){let p=await be(c,{agent:me(),textFallback:r.mode==="text"?r.value:void 0,resolve:async()=>{let y=await Oe(c,r);return y?{cx:y.x,cy:y.y,match:{id:r.mode==="testid"?r.value:y.id??null,testID:r.mode==="testid"?r.value:y.testID??null,text:r.mode==="text"?r.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}}),g=p.payload;(!g||typeof g.cx!="number")&&(console.error(` not found: ${r.value}`),r.mode==="testid"&&Q("wait-selector-for-missing-testid",r.value),process.exit(1)),pe(p.result)||(F(`${r.mode} "${r.value}"`,p),process.exit(1));let w=ko(g.cx,g.cy,p.result);w&&await W("inspect tap",w.step,w.summary),console.log(JSON.stringify({...p.attempts>1?{attempts:p.attempts}:{},...p.result},null,2));break}(!Number.isFinite(o)||!Number.isFinite(n))&&(console.error(k("tap","<x> <y> | --testid <id> | --text <t>")),process.exit(1));let a=await Kt(c,o,n),
|
|
677
|
+
})()`});console.log(JSON.stringify(n,null,2));break}case"tap":{let o=Number(l[1]),n=Number(l[2]),r=$e(e);if(r){let p=await be(c,{agent:me(),textFallback:r.mode==="text"?r.value:void 0,resolve:async()=>{let y=await Oe(c,r);return y?{cx:y.x,cy:y.y,match:{id:r.mode==="testid"?r.value:y.id??null,testID:r.mode==="testid"?r.value:y.testID??null,text:r.mode==="text"?r.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}}),g=p.payload;(!g||typeof g.cx!="number")&&(console.error(` not found: ${r.value}`),r.mode==="testid"&&Q("wait-selector-for-missing-testid",r.value),process.exit(1)),pe(p.result)||(F(`${r.mode} "${r.value}"`,p),process.exit(1));let w=ko(g.cx,g.cy,p.result);w&&await W("inspect tap",w.step,w.summary),console.log(JSON.stringify({...p.attempts>1?{attempts:p.attempts}:{},...p.result},null,2));break}(!Number.isFinite(o)||!Number.isFinite(n))&&(console.error(k("tap","<x> <y> | --testid <id> | --text <t>")),process.exit(1));let a=await Kt(c,o,n),u=ko(o,n,a);u&&await W("inspect tap",u.step,u.summary),console.log(JSON.stringify(a,null,2));break}case"drag":case"swipe":{let o=Number(l[1]),n=Number(l[2]),r=Number(l[3]),a=Number(l[4]),u=m==="swipe"?10:12,p=m==="swipe"?8:16,g=l[5]?Number(l[5]):u,w=l[6]?Number(l[6]):p;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(a)||!Number.isFinite(g)||!Number.isFinite(w))&&(console.error(k(m,"<x1> <y1> <x2> <y2> [steps] [stepMs]")),process.exit(1));let y=await c.send({type:"evaluate",code:`(async () => {
|
|
678
678
|
const interact = window.__sootsimInteract
|
|
679
679
|
if (!interact?.drag) return { ok: false, reason: 'no interact.drag' }
|
|
680
680
|
const value = await interact.drag(${o}, ${n}, ${r}, ${a}, ${Math.max(1,Math.round(g))}, ${Math.max(0,Math.round(w))})
|
|
681
681
|
return { ok: !!value, value }
|
|
682
|
-
})()`});if(y?.ok){let v=Math.max(1,Math.round(Math.max(1,g)*Math.max(0,w)));await W(`inspect ${m}`,{swipe:{start:`${o}, ${n}`,end:`${r}, ${a}`,duration:v}},`${m} ${o},${n} -> ${r},${a}`)}console.log(JSON.stringify(y,null,2));break}case"pinch":{let o=Number(l[1]),n=Number(l[2]),r=Number(l[3]),a=Number(l[4]),
|
|
682
|
+
})()`});if(y?.ok){let v=Math.max(1,Math.round(Math.max(1,g)*Math.max(0,w)));await W(`inspect ${m}`,{swipe:{start:`${o}, ${n}`,end:`${r}, ${a}`,duration:v}},`${m} ${o},${n} -> ${r},${a}`)}console.log(JSON.stringify(y,null,2));break}case"pinch":{let o=Number(l[1]),n=Number(l[2]),r=Number(l[3]),a=Number(l[4]),u=Number(l[5]),p=Number(l[6]),g=Number(l[7]),w=Number(l[8]),y=l[9]?Number(l[9]):12,v=l[10]?Number(l[10]):16;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(a)||!Number.isFinite(u)||!Number.isFinite(p)||!Number.isFinite(g)||!Number.isFinite(w)||!Number.isFinite(y)||!Number.isFinite(v))&&(console.error(k("pinch","<x1> <y1> <x2> <y2> <x1'> <y1'> <x2'> <y2'> [steps] [stepMs]")),process.exit(1));let L=await c.send({type:"evaluate",code:`(async () => {
|
|
683
683
|
const interact = window.__sootsimInteract
|
|
684
684
|
if (!interact?.pinch) return { ok: false, reason: 'no interact.pinch' }
|
|
685
|
-
const value = await interact.pinch(${o}, ${n}, ${r}, ${a}, ${
|
|
685
|
+
const value = await interact.pinch(${o}, ${n}, ${r}, ${a}, ${u}, ${p}, ${g}, ${w}, ${Math.max(1,Math.round(y))}, ${Math.max(0,Math.round(v))})
|
|
686
686
|
return { ok: !!value, value }
|
|
687
|
-
})()`});L?.ok&&await W("inspect pinch",{pinch:{from:[o,n,r,a],to:[
|
|
687
|
+
})()`});L?.ok&&await W("inspect pinch",{pinch:{from:[o,n,r,a],to:[u,p,g,w],steps:Math.max(1,Math.round(y)),stepMs:Math.max(0,Math.round(v))}},`pinch (${o},${n}) (${r},${a}) -> (${u},${p}) (${g},${w})`),console.log(JSON.stringify(L,null,2));break}case"tap-text":{let o=l[1];o||(console.error(k("tap-text","<text>")),process.exit(1));let n=z=>{let B=e.indexOf(z);return B>=0&&B+1<e.length?e[B+1]:null},r=z=>e.includes(z),a=n("--nth")??n("--index"),u=a!==null?Number(a):null;u!==null&&!Number.isFinite(u)&&(console.error(` --nth/--index requires an integer, got: ${a}`),process.exit(1));let p=n("--within"),g=n("--role"),w=r("--exact"),y=r("--first"),v=n("--min-y"),L=n("--max-y"),V=n("--min-x"),G=n("--max-x");for(let[z,B]of[["--min-y",v],["--max-y",L],["--min-x",V],["--max-x",G]])B!==null&&!Number.isFinite(Number(B))&&(console.error(` ${z} requires a number, got: ${B}`),process.exit(1));let Y=e.indexOf("--near"),R=null;if(Y>=0){let z=Number(e[Y+1]),B=Number(e[Y+2]);(!Number.isFinite(z)||!Number.isFinite(B))&&(console.error(" --near requires two numbers: --near <x> <y>"),process.exit(1)),R={x:z,y:B}}let x={exact:w,role:g,within:p,minX:V!==null?Number(V):null,maxX:G!==null?Number(G):null,minY:v!==null?Number(v):null,maxY:L!==null?Number(L):null,near:R,nth:u,first:y},I=await Gt(c,o,x,{agent:me()}),T=I.payload;if(T?.error==="bridge-not-ready"&&(console.error(" sootsim test bridge not ready"),process.exit(1)),T?.ambiguous){let z=T.candidates;console.error(` ambiguous: ${T.total} matches for "${o}"`);for(let B of z){let ve=B.abs?`@(${Math.round(B.abs.x)},${Math.round(B.abs.y)})`:"",Mo=B.layout?` ${B.layout.width}x${B.layout.height}`:"",No=B.testID?` #${B.testID}`:"",Fo=B.text?` "${B.text}"`:"",Oo=B.ancestorTestIDs.length>0?` within ${B.ancestorTestIDs.slice(0,3).map(Ro=>`#${Ro}`).join(" > ")}`:"";console.error(` [${B.idx}] <${B.type}>${Fo}${No} ${ve}${Mo}${Oo}`)}T.total>z.length&&console.error(` ... and ${T.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)}T?.nthOutOfRange&&(console.error(` not found: nth ${T.nth} of ${T.total} match${T.total===1?"":"es"} for "${o}"`),process.exit(1)),(!T||typeof T.cx!="number")&&(console.error(` not found: ${o}`),process.exit(1)),pe(I.result)||(F(`text "${o}"`,I),process.exit(1));let ne=et(o,{id:T.target?.id??null,testID:T.target?.testID??null,type:T.target?.type??null,cx:T.cx,cy:T.cy},"text");await W("inspect tap-text",ne.step,ne.summary),console.log(JSON.stringify({matched:T.match,tapped:{nodeId:T.target?.nodeId??null,id:T.target?.id??null,testID:T.target?.testID??null,type:T.target?.type??null,cx:T.cx,cy:T.cy},...T.strategy&&T.strategy!=="matched-node"?{strategy:T.strategy}:{},...T.total>1||u!==null?{nth:{index:T.idx,total:T.total}}:{},...I.attempts>1?{attempts:I.attempts}:{},result:I.result},null,2));break}case"tap-best":{let o=l[1];o||(console.error(k("tap-best","<query>")),process.exit(1));let n=await Yt(c,o,{agent:me()}),r=n.payload;r||(console.error(` tap-best: no testID or visible text matched "${o}". try \`sootsim find --interactive-targets\` to list candidates.`),process.exit(1)),"error"in r&&(console.error(` ${r.error}`),process.exit(1)),r.strategy==="none"&&(console.error(` tap-best: no testID or visible text matched "${o}". try \`sootsim find --interactive-targets\` to list candidates.`),process.exit(1));let a=r.node;pe(n.result)||(F(`best "${o}"`,n),process.exit(1));let u=et(o,{id:a.id,testID:a.testID,type:a.type,cx:r.cx,cy:r.cy},r.strategy==="testid"?"id":"text");await W("inspect tap-best",u.step,u.summary),console.log(JSON.stringify({matched:{strategy:r.strategy,nodeId:a.nodeId,id:a.id,testID:a.testID,type:a.type,text:a.text},tapped:{cx:r.cx,cy:r.cy},...n.attempts>1?{attempts:n.attempts}:{},result:n.result},null,2));break}case"tap-id":{let o=l[1];o||(console.error(k("tap-id","<id>")),process.exit(1));let n=await Ut(c,o,{agent:me()}),r=n.payload;(!r||typeof r.cx!="number")&&(console.error(` not found: ${o}`),await ms(c,o),process.exit(1)),pe(n.result)||(F(`id "${o}"`,n),process.exit(1));let a=et(o,{id:r.target?.id??null,testID:r.target?.testID??null,type:r.target?.type??null,cx:r.cx,cy:r.cy},"id");await W("inspect tap-id",a.step,a.summary),console.log(JSON.stringify({matched:r.match,tapped:{nodeId:r.target?.nodeId??null,id:r.target?.id??null,testID:r.target?.testID??null,type:r.target?.type??null,cx:r.cx,cy:r.cy},...r.strategy&&r.strategy!=="matched-node"?{strategy:r.strategy}:{},...n.attempts>1?{attempts:n.attempts}:{},result:n.result},null,2));break}case"type-into":{let o=l[1],n=l.slice(2).join(" ");(!o||!n)&&(console.error(k("type-into","<id> <text>")),process.exit(1));let r=JSON.stringify(o),a=await c.send({type:"evaluate",code:`(async () => {
|
|
688
688
|
const t = window.__sootsimTest
|
|
689
689
|
if (!t) return null
|
|
690
690
|
const n = await (t.findByTestId(${r}) || t.findById(${r}))
|
|
@@ -699,34 +699,34 @@ ${n}
|
|
|
699
699
|
secureTextEntry: !!n.secureTextEntry,
|
|
700
700
|
placeholder: n.placeholder || null,
|
|
701
701
|
}
|
|
702
|
-
})()`});(!a||typeof a.cx!="number")&&(console.error(` not found: ${o}`),process.exit(1)),a.isTextInput||console.error(` warning: ${o} is not a text input (isTextInput: false)`);let
|
|
702
|
+
})()`});(!a||typeof a.cx!="number")&&(console.error(` not found: ${o}`),process.exit(1)),a.isTextInput||console.error(` warning: ${o} is not a text input (isTextInput: false)`);let u=await c.send({type:"tap",x:a.cx,y:a.cy,target:{id:a.id??o,testID:a.testID??o,text:null,type:a.type??null}}),p=a.secureTextEntry===!0,g=await Ss(c,1e3,{targetId:o,secureTextEntry:p});g.visible||(console.error(` keyboard did not open after tapping ${o}`),process.exit(1));let w=g.focusedInput;w&&(w.testID===o||w.id===o||(console.error(` focus routing mismatch after tap: requested ${JSON.stringify(o)} but focus is on ${JSON.stringify(w.testID??w.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=p||we(g),v=y?Z:Qe(n,g),L=y&&g.focusedInput?{...g.focusedInput,secureTextEntry:!0,text:typeof g.focusedInput.text=="string"?Z:g.focusedInput.text}:g.focusedInput??null;await W("inspect type-into",{tapOn:{id:o},inputText:v},v===Z?`type-into #${o} ${Z}`:`type-into #${o} ${JSON.stringify(n)}`),console.log(JSON.stringify({target:o,isTextInput:a.isTextInput,secureTextEntry:y,keyboardOpened:g.visible??u?.keyboardOpened??!1,focusedInput:L,typed:v},null,2));break}case"type":{let o=l.slice(1).join(" ");o||(console.error(k("type","<text>")),process.exit(1));let n=await Pe(c,"type");await c.send({type:"keyboard",action:"type",text:o});let r=Qe(o,n);await W("inspect type",{inputText:r},r===Z?`type ${Z}`:`type ${JSON.stringify(o)}`),console.log(r===Z?` typed: ${Z}`:` typed: ${JSON.stringify(o)}`);break}case"key":{let o=l[1];o||(console.error(k("key","<name>")),process.exit(1)),await Pe(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=l.slice(1);o.length===0&&(console.error(k("key-sequence","<key> [<key> ...]")),process.exit(1)),await Pe(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=l.slice(1);o.length===0&&(console.error(k("keycode","<code> [<code> ...]")),process.exit(1));let n=o.map(a=>({code:a,key:vs(a)})),r=n.filter(a=>!a.key);r.length>0&&(console.error(` unsupported keycode(s): ${r.map(a=>a.code).join(", ")}`),process.exit(1)),await Pe(c,"keycode");for(let a of n)await c.send({type:"keyboard",action:"press",text:a.key});await W("inspect keycode",{pressKey:n.map(a=>a.key).join(" ")},`keycode ${o.join(" ")}`),console.log(` pressed: ${o.join(", ")}`);break}case"dispatch":{let o=l[1];o||(console.error(k("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(l[1]),n=Number(l[2]),r=$e(e);if(r){let g=await Oe(c,r);g||(console.error(` not found: ${r.value}`),r.mode==="testid"&&Q("wait-selector-for-missing-testid",r.value),process.exit(1)),o=g.x,n=g.y}let a=l[3]?Number(l[3]):80;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(a))&&(console.error(k("double-tap","<x> <y> [gapMs] | --testid <id>")),process.exit(1));let u=Math.max(0,Math.round(a)),p=await c.send({type:"evaluate",code:`(async () => {
|
|
703
703
|
const interact = window.__sootsimInteract
|
|
704
704
|
if (interact?.doubleTap) {
|
|
705
705
|
return {
|
|
706
|
-
ok: !!(await interact.doubleTap(${o}, ${n}, ${
|
|
707
|
-
gapMs: ${
|
|
706
|
+
ok: !!(await interact.doubleTap(${o}, ${n}, ${u})),
|
|
707
|
+
gapMs: ${u},
|
|
708
708
|
}
|
|
709
709
|
}
|
|
710
710
|
if (!interact?.tap) {
|
|
711
|
-
return { ok: false, reason: 'no interact.tap', gapMs: ${
|
|
711
|
+
return { ok: false, reason: 'no interact.tap', gapMs: ${u} }
|
|
712
712
|
}
|
|
713
713
|
const first = await interact.tap(${o}, ${n})
|
|
714
714
|
if (!first || first.hit === false) {
|
|
715
|
-
return { ok: false, reason: 'first tap missed', gapMs: ${
|
|
715
|
+
return { ok: false, reason: 'first tap missed', gapMs: ${u}, first }
|
|
716
716
|
}
|
|
717
|
-
await new Promise((resolve) => setTimeout(resolve, ${
|
|
717
|
+
await new Promise((resolve) => setTimeout(resolve, ${u}))
|
|
718
718
|
const second = await interact.tap(${o}, ${n})
|
|
719
719
|
return {
|
|
720
720
|
ok: !!second && second.hit !== false,
|
|
721
|
-
gapMs: ${
|
|
721
|
+
gapMs: ${u},
|
|
722
722
|
first,
|
|
723
723
|
second,
|
|
724
724
|
}
|
|
725
|
-
})()`});p?.ok&&await W("inspect double-tap",{doubleTapAtCoords:{x:o,y:n,gapMs:
|
|
725
|
+
})()`});p?.ok&&await W("inspect double-tap",{doubleTapAtCoords:{x:o,y:n,gapMs:u}},`double-tap @${o},${n}`),console.log(JSON.stringify(p,null,2));break}case"long-press":{let o=Number(l[1]),n=Number(l[2]),r=$e(e),a=null;if(r){let y=await Oe(c,r);y||(console.error(` not found: ${r.value}`),r.mode==="testid"&&Q("wait-selector-for-missing-testid",r.value),process.exit(1)),o=y.x,n=y.y,a={id:y.id??null,testID:y.testID??null,text:y.text??null,type:y.type??null}}let u=r?l[1]:l[3],p=u?Number(u):600;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(p))&&(console.error(k("long-press","<x> <y> [durationMs] | --testid <id>")),process.exit(1));let g=Math.max(0,Math.round(p)),w=await c.send({type:"longPress",x:o,y:n,durationMs:g,target:a});w?.ok&&await W("inspect long-press",{tapAtCoords:{x:o,y:n}},`long-press @${o},${n}`),console.log(JSON.stringify(w,null,2));break}case"touch":{let o=l[1],n=Number(l[2]),r=Number(l[3]),a=l[4]?Number(l[4]):999,u=o==="down"?"touchDown":o==="move"?"touchMove":o==="up"?"touchUp":o==="cancel"?"touchCancel":null;u||(console.error(k("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1)),o!=="cancel"&&(!Number.isFinite(n)||!Number.isFinite(r))&&(console.error(k("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1));let p=o==="down"?"tap":o==="move"?"move":null,g=p&&Number.isFinite(n)&&Number.isFinite(r)?`window.dispatchEvent(new CustomEvent('sootsim:agentAction', { detail: { type: '${p}', x: ${n}, y: ${r} } }));`:"",w=await c.send({type:"evaluate",code:`(async () => {
|
|
726
726
|
${g}
|
|
727
727
|
const interact = window.__sootsimInteract
|
|
728
|
-
if (!interact?.${
|
|
729
|
-
const value = ${o==="cancel"?`await interact.${
|
|
728
|
+
if (!interact?.${u}) return { ok: false, reason: 'no interact.${u}' }
|
|
729
|
+
const value = ${o==="cancel"?`await interact.${u}(${Math.max(1,Math.round(a))})`:`await interact.${u}(${n}, ${r}, ${Math.max(1,Math.round(a))})`}
|
|
730
730
|
return { ok: !!value, value }
|
|
731
731
|
})()`});w?.ok&&o!=="cancel"&&await W("inspect touch",{tapAtCoords:{x:n,y:r}},`touch ${o} @${n},${r}`),console.log(JSON.stringify(w,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=l[1],r=l[2]?Number(l[2]):220;(!n||!Number.isFinite(r))&&(console.error(k("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 a=await c.send({type:"evaluate",code:`(async () => {
|
|
732
732
|
const spec = globalThis.__sootsimDeviceSpec || {}
|
|
@@ -736,12 +736,12 @@ ${n}
|
|
|
736
736
|
statusBarHeight: spec.statusBarHeight || 0,
|
|
737
737
|
homeIndicatorHeight: spec.homeIndicatorHeight || 0,
|
|
738
738
|
}
|
|
739
|
-
})()`}),
|
|
739
|
+
})()`}),u=Number(a?.width)||393,p=Number(a?.height)||852,g=Number(a?.statusBarHeight)||0,w=Number(a?.homeIndicatorHeight)||0,y=Math.round(u/2),v=Math.round(p/2),L=Math.max(24,g+18),V=Math.max(24,w+18),G=18,Y=Math.min(220,Math.round(p*.24)),R=Math.min(180,Math.round(u*.32)),x=y,I=v,T=y,ne=v;switch(n){case"scroll-up":I=v+Math.round(Y/2),ne=v-Math.round(Y/2);break;case"scroll-down":I=v-Math.round(Y/2),ne=v+Math.round(Y/2);break;case"scroll-left":x=y+Math.round(R/2),T=y-Math.round(R/2);break;case"scroll-right":x=y-Math.round(R/2),T=y+Math.round(R/2);break;case"swipe-from-left-edge":x=G,I=v,T=Math.min(u-G,G+R);break;case"swipe-from-right-edge":x=u-G,I=v,T=Math.max(G,u-G-R);break;case"swipe-from-top-edge":x=y,I=L,ne=Math.min(p-V,L+Y);break;case"swipe-from-bottom-edge":x=y,I=p-V,ne=Math.max(L,p-V-Y);break}let z=Math.max(8,Math.round(r/16)),B=Math.max(1,Math.round(r/z)),ve=await c.send({type:"evaluate",code:`(async () => {
|
|
740
740
|
const interact = window.__sootsimInteract
|
|
741
741
|
if (!interact?.drag) return { ok: false, reason: 'no interact.drag' }
|
|
742
742
|
const value = await interact.drag(${x}, ${I}, ${T}, ${ne}, ${z}, ${B})
|
|
743
743
|
return { ok: !!value, value }
|
|
744
|
-
})()`});ve?.ok&&await W("inspect gesture",{swipe:{start:`${x}, ${I}`,end:`${T}, ${ne}`,duration:Math.max(1,Math.round(r))}},`gesture ${n}`),console.log(JSON.stringify({preset:n,from:{x,y:I},to:{x:T,y:ne},result:ve},null,2));break}case"scroll":{let o=$e(e),n=_s(e),r=o?.mode==="testid"?o.value:n==null?l[1]:null,a=o||n!=null?1:2,
|
|
744
|
+
})()`});ve?.ok&&await W("inspect gesture",{swipe:{start:`${x}, ${I}`,end:`${T}, ${ne}`,duration:Math.max(1,Math.round(r))}},`gesture ${n}`),console.log(JSON.stringify({preset:n,from:{x,y:I},to:{x:T,y:ne},result:ve},null,2));break}case"scroll":{let o=$e(e),n=_s(e),r=o?.mode==="testid"?o.value:n==null?l[1]:null,a=o||n!=null?1:2,u=Number(l[a]),p=Number(l[a+1]);(!r&&n==null||!Number.isFinite(u)||!Number.isFinite(p))&&(console.error(k("scroll","<id> <x> <y> | --testid <id> <x> <y> | --node-id <nodeId> <x> <y>")),process.exit(1));let g=await c.send({type:"evaluate",code:`(async () => {
|
|
745
745
|
const t = window.__sootsimTest
|
|
746
746
|
if (!t) return null
|
|
747
747
|
const n = ${n!=null?`await t.inspectByNodeId(${JSON.stringify(n)})`:`await t.findByTestId(${JSON.stringify(r)})
|
|
@@ -751,7 +751,7 @@ ${n}
|
|
|
751
751
|
cx: n.absolutePosition.x + (n.layout.width || 0) / 2,
|
|
752
752
|
cy: n.absolutePosition.y + (n.layout.height || 0) / 2,
|
|
753
753
|
}
|
|
754
|
-
})()`}),w=await X(c,"scrollTo",n!=null?{nodeId:n}:r,
|
|
754
|
+
})()`}),w=await X(c,"scrollTo",n!=null?{nodeId:n}:r,u,p,!1);if(w?.ok){let y=n!=null?`node ${n}`:`#${r}`;await W("inspect scroll",{scrollTo:{...n!=null?{nodeId:n}:{id:r},x:u,y:p}},`scroll ${y} -> ${u},${p}`)}console.log(JSON.stringify({...w,...g?{at:{x:g.cx,y:g.cy}}:{}},null,2));break}case"state":{let o=l[1];if(s==="get"&&!o){let r=await X(c,"getRuntimeState"),a=await c.send({type:"evaluate",code:_e});if(r&&typeof r=="object"&&r.diagnostics&&(r.diagnostics.errors=a?.errors??0,r.diagnostics.warnings=a?.warnings??0),r&&typeof r=="object"&&r.shell==null)try{let u=await de(c);u&&(r.shell=u)}catch{}console.log(JSON.stringify(r,null,2));break}if(!o||o==="--help"||o==="-h"){console.log(`
|
|
755
755
|
${b("state")} \u2014 dump raw runtime state
|
|
756
756
|
|
|
757
757
|
subcommands:
|
|
@@ -835,7 +835,7 @@ ${n}
|
|
|
835
835
|
${b("shell")} open-card clock 800
|
|
836
836
|
${b("shell")} appearance dark
|
|
837
837
|
${b("shell")} lock
|
|
838
|
-
`);break}let n=o==="launch"||o==="open-card"||o==="home"||o==="switcher",r=o==="launch"||o==="open-card"?l[3]:l[2],a=r?Number(r):350;n&&(!Number.isFinite(a)||a<0)&&(console.error(k("shell",o==="launch"||o==="open-card"?"<launch|open-card> <appId> [settleMs]":"<home|switcher> [settleMs]")),process.exit(1));let
|
|
838
|
+
`);break}let n=o==="launch"||o==="open-card"||o==="home"||o==="switcher",r=o==="launch"||o==="open-card"?l[3]:l[2],a=r?Number(r):350;n&&(!Number.isFinite(a)||a<0)&&(console.error(k("shell",o==="launch"||o==="open-card"?"<launch|open-card> <appId> [settleMs]":"<home|switcher> [settleMs]")),process.exit(1));let u=!1,p=!1,g=null,w=e.includes("--clear-state");if(o==="launch"){let y=l[2];y||(console.error(k("shell","launch <appId> [settleMs] [--clear-state]")),process.exit(1)),w&&await c.send({type:"evaluate",code:We(!0)}),u=!!await ye(c,"launchApp",a,y),{settled:p,state:g}=await Ee(c,Math.round(a),v=>!!v&&v.state==="app"&&v.activeApp===y&&v.showSwitcher===!1&&v.switcherPhase==="idle"&&typeof v.launchProgress=="number"&&v.launchProgress>=.98),u&&await W("inspect shell launch",w?{launchApp:{clearState:!0}}:{launchApp:{}},w?"launch app (clear state)":"launch app")}else if(o==="home")u=!!await ye(c,"goHome",a),{settled:p,state:g}=await Ee(c,Math.round(a),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",a),{settled:p,state:g}=await Ee(c,Math.round(a),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),p&&(await oe($s),g=await de(c));else if(o==="open-card"){let y=l[2];y||(console.error(k("shell","open-card <appId> [settleMs]")),process.exit(1)),u=!!await ye(c,"openSwitcherCard",a,y),{settled:p,state:g}=await Ee(c,Math.round(a),v=>!!v&&v.state==="app"&&v.activeApp===y&&v.showSwitcher===!1&&v.switcherPhase==="idle"&&typeof v.zoomLevel=="number"&&v.zoomLevel>=.98&&typeof v.horizontalZoom=="number"&&v.horizontalZoom>=.98),u&&await W("inspect shell open-card",{openSwitcherCard:{appId:y}},`open switcher card ${y}`)}else if(o==="appearance"){let y=l[2];(!y||!["light","dark","auto","toggle"].includes(y))&&(console.error(k("shell","appearance <light|dark|auto|toggle>")),process.exit(1));let v=await vo(c,"appearance",y);if(u=!!v?.ok,g={appearance:v},u){let L=v?.applied??y;console.log(` appearance: ${L}`)}}else if(o==="lock"||o==="shake"){let y=await vo(c,o);u=!!y?.ok,g={[o]:y}}else console.error(` unknown shell subcommand: ${o}`),process.exit(1);console.log(JSON.stringify({ok:u,settled:p,state:g},null,2));break}case"url":{await ao(c,{args:i});break}case"reload":{let r=!1,a=!1;try{await c.send({type:"evaluate",code:"window.__sootsimConsole?.clear()"});let g=await c.send({type:"evaluate",code:`;(async () => {
|
|
839
839
|
// in-place guest reload is only valid while the page still runs
|
|
840
840
|
// the engine build the server would serve NOW. the shell dev
|
|
841
841
|
// server has no HMR client, so a long-lived sim tab otherwise
|
|
@@ -859,13 +859,13 @@ ${n}
|
|
|
859
859
|
}
|
|
860
860
|
window.location.reload()
|
|
861
861
|
return { kind: 'page', engineStale }
|
|
862
|
-
})()`});a=!!g&&g.kind==="external-app",r=!0,g&&g.engineStale&&console.log(" engine build changed since page load \u2014 full page reload")}catch{}console.log(" reloading...");let
|
|
862
|
+
})()`});a=!!g&&g.kind==="external-app",r=!0,g&&g.engineStale&&console.log(" engine build changed since page load \u2014 full page reload")}catch{}console.log(" reloading...");let u=c,p=null;if(a)p=await Te(c,{timeoutMs:1e4,errorGraceMs:3e3});else{r&&await oe(300);let w=await Ot(N,O,M,{timeoutMs:3e4,simIdSource:j});w?(u=w,p=await Te(w,{timeoutMs:3e4,errorGraceMs:3e3})):(console.log(" \u26A0 reload: bridge never reconnected within 30000ms"),u=null)}if(p)if(p.ready){let g=p.source==="nodes-fallback"?" (no ready signal, node-count fallback)":"";console.log(` ready in ${p.elapsedMs}ms: ${p.nodes} nodes${g}`)}else if(p.source==="error-bail")console.log(` \u26A0 reload bailed after ${p.elapsedMs}ms: ${p.errors} console error(s), ready signal never fired`);else{let g=yo(p);console.log(` \u26A0 reload timed out after ${p.elapsedMs}ms \u2014 ${g} (nodes: ${p.nodes}, targets: ${p.targets}, errors: ${p.errors})`)}if(u)try{let g=await fe(u,10);if(u!==c&&u.close(),Array.isArray(g)&&g.length>0){console.log(`
|
|
863
863
|
\u26A0 ${g.length} error(s) during mount:
|
|
864
864
|
`);for(let w of g){let y=w.args.map(v=>typeof v=="object"?JSON.stringify(v):v).join(" ");if(console.log(` ${y}`),w.stack){let v=w.stack.split(`
|
|
865
|
-
`).slice(0,2);for(let L of v)console.log(` ${L.trim()}`)}}}}catch{}p&&!p.ready&&(process.exitCode=1);break}case"storage-clear":{if(await qe(c),await c.send({type:"evaluate",code:We(!0)})!==!0){A(i)?D({cleared:!1,ready:!1,error:"external app reload bridge is unavailable"}):console.error(" storage clear failed: external app reload bridge is unavailable"),process.exitCode=1;break}let a=await Te(c,{timeoutMs:1e4,errorGraceMs:3e3});if(A(i)){D({cleared:!0,ready:a.ready,reload:a}),a.ready||(process.exitCode=1);break}if(a.ready){let
|
|
866
|
-
\u26A0 ${
|
|
867
|
-
`);for(let p of
|
|
868
|
-
`).slice(0,2);for(let y of w)console.log(` ${y.trim()}`)}}}}catch{}a.ready||(process.exitCode=1);break}case"eval":case"js":{let o=l.slice(1).join(" ");if(o||(console.error(k("js","<javascript>")),console.error(""),console.error(" runs the snippet in the engine realm. SootSim is the"),console.error(" canonical state surface \u2014 reach into it directly."),console.error(""),console.error(" examples:"),console.error(` ${b("js")} SootSim.bridges.test.findByText("Sign in")`),console.error(` ${b("js")} SootSim.bridges.debug.snapshot("before")`),console.error(` ${b("js")} SootSim.bridges.keyboard.type("hello")`),console.error(` ${b("js")} SootSim.state.root.children.length`),process.exit(1)),e.includes("--tenant")){let p=l.slice(1).filter(w=>w!=="--tenant").join(" "),g=await c.send({type:"evaluate",code:`(async () => SootSim.bridges.test.evalInTenant(${JSON.stringify(p)}))()`});console.log(JSON.stringify(g,null,2));break}let n=o;n.startsWith("(async")||(n=`(async () => ${n})()`);let r=await c.send({type:"evaluate",code:n});console.log(JSON.stringify(r,null,2));let a=o.toLowerCase(),
|
|
865
|
+
`).slice(0,2);for(let L of v)console.log(` ${L.trim()}`)}}}}catch{}p&&!p.ready&&(process.exitCode=1);break}case"storage-clear":{if(await qe(c),await c.send({type:"evaluate",code:We(!0)})!==!0){A(i)?D({cleared:!1,ready:!1,error:"external app reload bridge is unavailable"}):console.error(" storage clear failed: external app reload bridge is unavailable"),process.exitCode=1;break}let a=await Te(c,{timeoutMs:1e4,errorGraceMs:3e3});if(A(i)){D({cleared:!0,ready:a.ready,reload:a}),a.ready||(process.exitCode=1);break}if(a.ready){let u=a.source==="nodes-fallback"?" (no ready signal, node-count fallback)":"";console.log(` cleared tenant storage; ready in ${a.elapsedMs}ms: ${a.nodes} nodes${u}`)}else if(a.source==="error-bail")console.log(` \u26A0 storage clear reloaded but bailed after ${a.elapsedMs}ms: ${a.errors} console error(s), ready signal never fired`);else{let u=yo(a);console.log(` \u26A0 storage clear reloaded but timed out after ${a.elapsedMs}ms \u2014 ${u} (nodes: ${a.nodes}, targets: ${a.targets}, errors: ${a.errors})`)}try{let u=await fe(c,10);if(Array.isArray(u)&&u.length>0){console.log(`
|
|
866
|
+
\u26A0 ${u.length} error(s) during mount:
|
|
867
|
+
`);for(let p of u){let g=p.args.map(w=>typeof w=="object"?JSON.stringify(w):w).join(" ");if(console.log(` ${g}`),p.stack){let w=p.stack.split(`
|
|
868
|
+
`).slice(0,2);for(let y of w)console.log(` ${y.trim()}`)}}}}catch{}a.ready||(process.exitCode=1);break}case"eval":case"js":{let o=l.slice(1).join(" ");if(o||(console.error(k("js","<javascript>")),console.error(""),console.error(" runs the snippet in the engine realm. SootSim is the"),console.error(" canonical state surface \u2014 reach into it directly."),console.error(""),console.error(" examples:"),console.error(` ${b("js")} SootSim.bridges.test.findByText("Sign in")`),console.error(` ${b("js")} SootSim.bridges.debug.snapshot("before")`),console.error(` ${b("js")} SootSim.bridges.keyboard.type("hello")`),console.error(` ${b("js")} SootSim.state.root.children.length`),process.exit(1)),e.includes("--tenant")){let p=l.slice(1).filter(w=>w!=="--tenant").join(" "),g=await c.send({type:"evaluate",code:`(async () => SootSim.bridges.test.evalInTenant(${JSON.stringify(p)}))()`});console.log(JSON.stringify(g,null,2));break}let n=o;n.startsWith("(async")||(n=`(async () => ${n})()`);let r=await c.send({type:"evaluate",code:n});console.log(JSON.stringify(r,null,2));let a=o.toLowerCase(),u=[];(a.includes("sootsim:gohome")||a.includes("gohome"))&&u.push("sootsim shell home"),(a.includes("sootsim:appswitcher")||a.includes("appswitcher"))&&u.push("sootsim shell switcher"),(a.includes("keyboard.isvisible")||a.includes("keyboard.getmode"))&&u.push("sootsim debug state keyboard"),a.includes("interact.tap")&&u.push("sootsim do tap <x> <y>"),a.includes("keyboard.type")&&u.push("sootsim do type <text>"),(a.includes("keyboard.press")||a.includes("keyboard.dispatchkey"))&&u.push("sootsim do key <name>"),a.includes("keyboard.dismiss")&&u.push("sootsim do dismiss"),a.includes("dumptree")&&u.push("sootsim get tree"),a.includes("dumpaccessibilitytree")&&u.push("sootsim get a11y"),a.includes("getnodecount")&&u.push("sootsim get count"),a.includes("findbytext")&&u.push("sootsim find <text>"),(a.includes("findbytestid")||a.includes("findbyid"))&&u.push("sootsim find --testid <id>"),a.includes("document.hidden")&&u.push("sootsim 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 () => {
|
|
869
869
|
const globals = {}
|
|
870
870
|
|
|
871
871
|
// test bridge (proxy in worker mode)
|
|
@@ -919,7 +919,7 @@ ${n}
|
|
|
919
919
|
# ... perform consecutive swipes ...
|
|
920
920
|
${b("perf")} stop
|
|
921
921
|
${b("perf")} stop --json
|
|
922
|
-
`);break}if(o==="start"){let n=i.find((
|
|
922
|
+
`);break}if(o==="start"){let n=i.find((u,p)=>i[p-1]==="--limit"),r=n===void 0?6e3:Number(n);(!Number.isFinite(r)||r<120)&&(console.error(" error: --limit must be a number of at least 120"),process.exit(1));let a=await c.send({type:"evaluate",code:`(async () => {
|
|
923
923
|
const perf = window.SootSim?.bridges?.scrollPerf
|
|
924
924
|
if (!perf) return { error: 'scroll performance profile unavailable' }
|
|
925
925
|
await perf.start(${Math.floor(r)})
|
|
@@ -929,7 +929,7 @@ ${n}
|
|
|
929
929
|
if (!perf) return { error: 'scroll performance profile unavailable' }
|
|
930
930
|
return await perf.stop()
|
|
931
931
|
})()`});n?.error&&(console.error(` error: ${n.error}`),process.exit(1));let r=n;if(A(i)){D(r);break}console.log(` scroll performance trace:
|
|
932
|
-
`),console.log(` duration: ${r.stoppedAt-r.startedAt}ms (worker series are timestamp-aligned, not frame-paired)`),console.log(` samples: tenant ${r.layers.tenant.length} \xB7 shell ${r.layers.shell.length} \xB7 compositor ${r.layers.compositor.length}`),console.log(""),console.log(" offset and phase changes (--json includes every per-frame sample):"),console.log(" t(ms) layer surface node offsetY slotY phase paint");let a=[];for(let
|
|
932
|
+
`),console.log(` duration: ${r.stoppedAt-r.startedAt}ms (worker series are timestamp-aligned, not frame-paired)`),console.log(` samples: tenant ${r.layers.tenant.length} \xB7 shell ${r.layers.shell.length} \xB7 compositor ${r.layers.compositor.length}`),console.log(""),console.log(" offset and phase changes (--json includes every per-frame sample):"),console.log(" t(ms) layer surface node offsetY slotY phase paint");let a=[];for(let u of Object.values(r.layers)){let p=new Map;for(let g of u){let w=`${g.surfaceId}:${g.nodeId}`,y=`${g.offsetY}:${g.slotY??""}:${g.phase??""}`;p.get(w)!==y&&(p.set(w,y),a.push(g))}}a.sort((u,p)=>u.t-p.t||u.seq-p.seq);for(let u of a)console.log(` ${String(u.t-r.startedAt).padStart(5)} ${u.layer.padEnd(10)} ${u.surfaceId.padEnd(8)} ${String(u.nodeId).padStart(5)} ${u.offsetY.toFixed(2).padStart(8)} ${u.slotY===void 0?" -":u.slotY.toFixed(2).padStart(8)} ${(u.phase??"-").padEnd(8)} ${u.paint===void 0?"-":u.paint}`);break}console.error(` unknown scroll perf command: ${o}`),process.exit(1)}if(!o||o==="--help"||o==="-h"){console.log(`
|
|
933
933
|
${b("perf")} \u2014 shell frame profiling (the worker that paints)
|
|
934
934
|
|
|
935
935
|
records per-painted-frame timing in the shell worker \u2014 the surface that
|
|
@@ -973,7 +973,7 @@ ${n}
|
|
|
973
973
|
examples:
|
|
974
974
|
${b("perf")} transition goHome --timeout 10000
|
|
975
975
|
${b("perf")} transition appSwitcher
|
|
976
|
-
`);break}let a=`sootsim:${n}`;Ie(` profiling ${n} transition...`),Ie(" (use --timeout 10000 if this times out)");let
|
|
976
|
+
`);break}let a=`sootsim:${n}`;Ie(` profiling ${n} transition...`),Ie(" (use --timeout 10000 if this times out)");let u=await c.send({type:"evaluate",code:`(async () => {
|
|
977
977
|
if (!window.__sootsimShellPerf) {
|
|
978
978
|
return { error: 'shell frame profile unavailable (__sootsimShellPerf missing on the page)' }
|
|
979
979
|
}
|
|
@@ -985,29 +985,29 @@ ${n}
|
|
|
985
985
|
// animation-end detection
|
|
986
986
|
await new Promise(r => setTimeout(r, 600))
|
|
987
987
|
return await window.__sootsimShellPerf.stop()
|
|
988
|
-
})()`});if(
|
|
989
|
-
`);for(let a of r){let
|
|
988
|
+
})()`});if(u?.error&&(console.error(` error: ${u.error}`),process.exit(1)),A(i)){D(u);break}Ie(` ${n} transition profiled:`),So(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=l[1];if(o==="clear"){await qe(c),A(i)?D({cleared:!0}):console.log(" error buffer cleared");break}let n=o?Number(o):20,r=await fe(c,n);if(A(i)){D(r);break}if(r.length===0){console.log(" no errors captured");break}console.log(` ${r.length} error(s):
|
|
989
|
+
`);for(let a of r){let u=ae(a.timestamp),p=a.args.map(g=>typeof g=="object"?JSON.stringify(g):g).join(" ");if(console.log(` [${u}] ${p}`),a.stack){let g=a.stack.split(`
|
|
990
990
|
`).slice(0,3);for(let w of g)console.log(` ${w.trim()}`)}}break}case"warnings":{let o=l[1]?Number(l[1]):20,n=await yt(c,o);if(A(i)){D(n);break}if(n.length===0){console.log(" no warnings captured");break}console.log(` ${n.length} warning(s):
|
|
991
|
-
`);for(let r of n){let a=
|
|
992
|
-
`);for(let n of o){let r=String(n.kind).padEnd(6),a=`${Number(n.from).toFixed(2)}\u2192${Number(n.to).toFixed(2)}`,
|
|
993
|
-
`);for(let p of
|
|
991
|
+
`);for(let r of n){let a=ae(r.timestamp),u=r.args.map(p=>typeof p=="object"?JSON.stringify(p):p).join(" ");console.log(` [${a}] ${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):
|
|
992
|
+
`);for(let n of o){let r=String(n.kind).padEnd(6),a=`${Number(n.from).toFixed(2)}\u2192${Number(n.to).toFixed(2)}`,u=Number(n.current??0).toFixed(2),p=`${Math.round((n.progress??0)*100)}%`,g=`${Math.round(n.elapsedMs??0)}ms`,w=n.loop?" loop":"",y=n.layoutBound?" layout":"";console.log(` #${n.id} ${r} ${a.padEnd(14)} cur=${u.padEnd(7)} ${p.padStart(4)} ${g}${w}${y}`)}break}case"animation":{let o=l[1];(!o||o==="--help"||o==="-h")&&(console.error(` usage: ${b("animation")} <id>`),process.exit(1));let n=Number(o);Number.isFinite(n)||(console.error(` invalid id: ${o}`),process.exit(1));let r=await X(c,"getAnimation",n);console.log(JSON.stringify(r,null,2));break}case"stop-animation":{let o=l[1];(!o||o==="--help"||o==="-h")&&(console.error(` usage: ${b("stop-animation")} <id|all>`),process.exit(1));let n=o==="all"?"all":Number(o);n!=="all"&&!Number.isFinite(n)&&(console.error(` invalid id: ${o}`),process.exit(1));let r=await X(c,"stopAnimation",n);console.log(` stopped ${r??0} animation(s)`);break}case"requests":{let o=l[1];if(o==="clear"){await bt(c),A(i)?D({cleared:!0}):console.log(" request buffer cleared");break}let n=o==="all",r=n?l[2]:o,a=r?Number(r):20,u=await ht(c,{failed:!n,limit:a});if(A(i)){D(u);break}if(u.length===0){console.log(n?" no requests captured":" no failed requests captured");break}console.log(` ${u.length} ${n?"request(s)":"failed request(s)"}:
|
|
993
|
+
`);for(let p of u){let g=ae(p.timestamp);console.log(` [${g}] ${U(p)}`),p.responseBody?console.log(` ${p.responseBody}`):p.error&&console.log(` ${p.error}`)}break}case"network":{let o=l[1],n=null,r=null,a=!1,u=!1,p=1e3,g=!1,w=!1;for(let R=0;R<i.length;R++){let x=i[R];if(x==="--filter")n=i[R+1]??null,R++;else if(x==="--limit"){let I=Number(i[R+1]);Number.isFinite(I)&&(r=I),R++}else if(x==="--threshold"){let I=Number(i[R+1]);Number.isFinite(I)&&I>0&&(p=I),R++}else x==="--failed"?a=!0:x==="--slow"?u=!0:x==="--tail"||x==="-f"?g=!0:x==="--json"&&(w=!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 R=l[2];R||(console.error(" usage: sootsim network get <id>"),process.exit(1));let x=await c.send({type:"evaluate",code:`(() => {
|
|
994
994
|
const obs = window.__sootsimObservability;
|
|
995
995
|
if (!obs) return null;
|
|
996
|
-
return obs.network.getSnapshot().find(e => e.id === ${JSON.stringify(
|
|
997
|
-
})()`});x||(console.error(` no entry with id ${
|
|
998
|
-
to target a specific sim, use \`--sim ${o}\` instead.`),process.exit(1));let v=async()=>{let
|
|
996
|
+
return obs.network.getSnapshot().find(e => e.id === ${JSON.stringify(R)}) || null;
|
|
997
|
+
})()`});x||(console.error(` no entry with id ${R}`),process.exit(1)),w?console.log(JSON.stringify(x,null,2)):hs(x);break}let y=r??(g?200:o?Number(o):20);Number.isFinite(y)||(console.error(` invalid limit: ${o} \u2014 \`network\` takes a numeric count (e.g. ${b("network")} 100).
|
|
998
|
+
to target a specific sim, use \`--sim ${o}\` instead.`),process.exit(1));let v=async()=>{let R=await c.send({type:"evaluate",code:`(() => {
|
|
999
999
|
const obs = window.__sootsimObservability;
|
|
1000
1000
|
if (!obs) return { ok: false };
|
|
1001
1001
|
return { ok: true, entries: obs.network.getSnapshot() };
|
|
1002
|
-
})()`});if(!
|
|
1002
|
+
})()`});if(!R||!R.ok)throw new Error("observability bridge not installed \u2014 is the engine running?");return R.entries??[]},L=R=>{let x=R;if(a&&(x=x.filter(I=>!!I.error||I.status!=null&&I.status>=400)),u&&(x=x.filter(I=>I.durationMs!=null&&I.durationMs>=p)),n){let I=n.toLowerCase();x=x.filter(T=>(T.displayUrl||T.url).toLowerCase().includes(I))}return u&&!g&&(x=[...x].sort((I,T)=>(T.durationMs??0)-(I.durationMs??0))),x};if(!g){let R=await v(),x=L(R).slice(-y);if(w){console.log(JSON.stringify(x,null,2));break}if(x.length===0){R.length===0?console.log(" no network requests captured"):console.log(u?` no requests slower than ${p}ms (${R.length} total \u2014 try --threshold <ms>)`:" no matching requests");break}console.log(u?` ${x.length} request(s) slower than ${p}ms (sorted by duration desc):
|
|
1003
1003
|
`:` ${x.length} request(s):
|
|
1004
1004
|
`);for(let I of x)ho(I);break}console.log(` tailing network (ctrl-c to stop)...
|
|
1005
|
-
`);let V=new Set,G=!0,Y=()=>{G=!1};process.on("SIGINT",Y);try{for(;G;){let
|
|
1006
|
-
to target a specific sim, use \`--sim ${o}\` instead.`),process.exit(1));let L=()=>wt(c),V=x=>xt(x,{level:w,filter:n,showInternal:g});if(!
|
|
1005
|
+
`);let V=new Set,G=!0,Y=()=>{G=!1};process.on("SIGINT",Y);try{for(;G;){let R=await v(),x=L(R);for(let I of x)I.durationMs!=null&&(V.has(I.id)||(V.add(I.id),w?console.log(JSON.stringify(I)):ho(I)));await oe(250)}}finally{process.off("SIGINT",Y)}break}case"logs":{let o=l[1],n=null,r=null,a=null,u=!1,p=!1,g=!1;for(let x=0;x<i.length;x++){let I=i[x];if(I==="--filter")n=i[x+1]??null,x++;else if(I==="--limit"){let T=Number(i[x+1]);Number.isFinite(T)&&(r=T),x++}else I==="--level"?(a=i[x+1]??null,x++):I==="--tail"||I==="-f"?u=!0:I==="--json"?p=!0:(I==="--internal"||I==="--all")&&(g=!0)}let w=a?new Set(a.split(",").map(x=>x.trim()).filter(x=>x==="log"||x==="info"||x==="warn"||x==="error"||x==="debug")):null;if(o==="clear"){await $t(c),console.log(" log buffer cleared");break}let y=!p&&process.stdout.isTTY===!0,v=r??(u?500:o?Number(o):50);Number.isFinite(v)||(console.error(` invalid limit: ${o} \u2014 \`logs\` takes a numeric count (e.g. ${b("logs")} 100).
|
|
1006
|
+
to target a specific sim, use \`--sim ${o}\` instead.`),process.exit(1));let L=()=>wt(c),V=x=>xt(x,{level:w,filter:n,showInternal:g});if(!u){let x=await L(),I=V(x).slice(-v);if(p){console.log(JSON.stringify(I,null,2));break}if(I.length===0){console.log(x.length===0?" no logs captured":" no matching logs");break}console.log(` ${I.length} log(s):
|
|
1007
1007
|
`);for(let T of I)wo(T,y);break}console.log(` tailing logs (ctrl-c to stop)...
|
|
1008
|
-
`);let G=new Set,Y=!0,
|
|
1008
|
+
`);let G=new Set,Y=!0,R=()=>{Y=!1};process.on("SIGINT",R);try{for(;Y;){let x=await L(),I=V(x);for(let T of I)G.has(T.id)||(G.add(T.id),p?console.log(JSON.stringify(T)):wo(T,y));await oe(250)}}finally{process.off("SIGINT",R)}break}default:console.error(` unknown subcommand: ${m}`),process.exit(1)}if(C.has(m)&&!e.includes("--no-wait")&&process.env.SOOTSIM_NO_AUTO_WAIT!=="1"&&!await rt(c,m)&&await _(c),$.length>0&&ee($),!P.has(m)&&!A(i))try{await xe(c)}catch{}}catch($){let o=$ instanceof Error?$.message:String($);console.error(` ${m??"inspect"} failed: ${o}`);let n=/^no sim connected with id (.+)$/.exec(o),r=/^command timed out after (\d+)s$/.exec(o),a=o.startsWith("sim disconnected:")||o.startsWith("bridge never reconnected")||o.startsWith("could not connect to ws://");if(n)await Pt(c,N,n[1]);else if(/^no sim connected$/.test(o))Et(N);else if(r)if(await ps(c)){let p=m??"describe";process.stderr.write(` the sim is still responsive \u2014 '${p}' just exceeded the ${r[1]}s command budget.
|
|
1009
1009
|
the screen's node tree is large; narrow the query or raise the budget:
|
|
1010
1010
|
sootsim ${p} --testid <id> # scope to one subtree
|
|
1011
1011
|
sootsim find --testid <id> # targeted single-node lookup
|
|
1012
1012
|
sootsim ${p} --timeout 60000 # raise per-command budget (ms)
|
|
1013
|
-
`)}else go();else if(a)go();else{try{await
|
|
1013
|
+
`)}else go();else if(a)go();else{try{await Rt(c)}catch{}try{await te({includeTail:!0})}catch{}try{await H({includeTail:!0})}catch{}}process.exit(1)}finally{c.close()}}export{We as a,Dt as b,Eo as c,Ns as d,Ds as e,Bs as f,Cs as g,js as h,se as i,So as j,Rr as k};
|