rnxsim 0.1.375 → 0.1.377
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/README.md +28 -25
- package/cli/app-config.ts +9 -12
- package/cli/app-fonts.ts +3 -3
- package/cli/app-project.ts +8 -8
- package/cli/auth.ts +7 -9
- package/cli/bin.ts +16 -31
- package/cli/bridge-flow-runner.ts +3 -3
- package/cli/browser-backend.ts +44 -0
- package/cli/command-contract.ts +221 -0
- package/cli/command-registry.ts +291 -0
- package/cli/commands/agent-wrapper.ts +2 -2
- package/cli/commands/app-fonts.ts +2 -2
- package/cli/commands/assert.ts +3 -3
- package/cli/commands/auth.ts +1 -1
- package/cli/commands/box/cloud-box.ts +1 -1
- package/cli/commands/box/plane-share.ts +2 -2
- package/cli/commands/box.ts +4 -6
- package/cli/commands/compat.ts +1 -1
- package/cli/commands/config.ts +2 -2
- package/cli/commands/control.ts +42 -28
- package/cli/commands/cpu-profile.ts +7 -7
- package/cli/commands/daemon-mac-app.ts +7 -7
- package/cli/commands/daemon.ts +10 -10
- package/cli/commands/debug.ts +11 -11
- package/cli/commands/detox.ts +13 -13
- package/cli/commands/diagnose.ts +6 -6
- package/cli/commands/do-chain.ts +1 -2
- package/cli/commands/electron.ts +1 -3
- package/cli/commands/film.ts +3 -3
- package/cli/commands/flow.ts +43 -43
- package/cli/commands/inspect/count.ts +1 -1
- package/cli/commands/inspect/describe.ts +1 -1
- package/cli/commands/inspect/env.ts +2 -2
- package/cli/commands/inspect/get-layout.ts +1 -1
- package/cli/commands/inspect/keyboard.ts +1 -1
- package/cli/commands/inspect/list.ts +1 -1
- package/cli/commands/inspect/memory.ts +1 -1
- package/cli/commands/inspect/resolve-target.ts +1 -1
- package/cli/commands/inspect/screens.ts +1 -1
- package/cli/commands/inspect/tree.ts +1 -1
- package/cli/commands/inspect/url.ts +1 -1
- package/cli/commands/inspect/wait-event.ts +5 -5
- package/cli/commands/inspect.ts +34 -34
- package/cli/commands/install-desktop.ts +3 -3
- package/cli/commands/login.ts +6 -6
- package/cli/commands/maestro-generate.ts +5 -5
- package/cli/commands/maestro.ts +5 -5
- package/cli/commands/profile.ts +1 -1
- package/cli/commands/record.ts +9 -9
- package/cli/commands/runtime.ts +18 -18
- package/cli/commands/screenshot-command.ts +1 -1
- package/cli/commands/screenshot-layers.ts +5 -5
- package/cli/commands/screenshot-mode.ts +1 -1
- package/cli/commands/screenshot.ts +8 -8
- package/cli/commands/screenshots-capture.ts +5 -5
- package/cli/commands/serve.ts +3 -3
- package/cli/commands/setup.ts +20 -12
- package/cli/commands/skills.ts +5 -5
- package/cli/commands/slides.ts +1 -1
- package/cli/commands/telemetry.ts +1 -1
- package/cli/commands/three-mode.ts +1 -1
- package/cli/commands/timeline.ts +8 -8
- package/cli/commands/upgrade.ts +116 -131
- package/cli/commands/upload.ts +12 -12
- package/cli/commands/version.ts +7 -7
- package/cli/commands/what-happened.ts +9 -9
- package/cli/current-sim.ts +3 -3
- package/cli/desktop-companion.ts +1 -1
- package/cli/drivers/playwright.ts +9 -9
- package/cli/drivers/registry.ts +1 -1
- package/cli/drivers/types.ts +1 -1
- package/cli/flow-file.ts +2 -2
- package/cli/flow-session.ts +1 -1
- package/cli/help-core.ts +136 -0
- package/cli/help.ts +17 -53
- package/cli/hints.ts +5 -5
- package/cli/inspect-notice-state.ts +1 -1
- package/cli/maestro-js.ts +1 -1
- package/cli/outbound-endpoints.ts +23 -5
- package/cli/parse-args.ts +19 -66
- package/cli/recording-access.ts +1 -1
- package/cli/registry.ts +1 -0
- package/cli/run-registry.ts +1 -1
- package/cli/run-rnx-core.ts +148 -0
- package/cli/run-rnx.ts +6 -9
- package/cli/runtime-notes.ts +3 -3
- package/cli/standalone.ts +4 -0
- package/cli/ws-bridge.ts +8 -8
- package/detox/config-loader.ts +2 -2
- package/detox/index.ts +8 -8
- package/detox/jest-preset.cjs +1 -1
- package/detox/navigation.ts +2 -2
- package/dist-lib/agent-daemon-client.cjs +5 -5
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +2 -2
- package/dist-lib/agent-sessions.cjs +10 -10
- package/dist-lib/attached-projects.cjs +6 -6
- package/dist-lib/auth/shared-session.cjs +6 -6
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/config.cjs +25 -25
- package/dist-lib/detox/index.cjs +9 -9
- package/dist-lib/detox/jest-preset.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +29 -29
- package/dist-lib/host/bridge-host.cjs +274 -181
- 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/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +14 -14
- 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-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +8 -8
- package/dist-lib/profiles.cjs +12 -12
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +25 -11
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +470 -322
- package/dist-lib/vite.cjs +9 -9
- package/package.json +4 -11
- package/scripts/dev-server-scanner.ts +25 -7
- package/scripts/optional-demo-registry.ts +1 -1
- package/skills/contrast/SKILL.md +3 -3
- package/skills/rnx-debug/SKILL.md +1 -1
- package/skills/rnx-test/SKILL.md +2 -2
- package/src/agent-identity.ts +1 -1
- package/src/agent-sessions.ts +7 -5
- package/src/cli-version.ts +12 -4
- package/src/config.ts +26 -28
- package/src/disk-cleanup.ts +11 -11
- package/src/home-paths.ts +28 -28
- package/src/host/bridge-host.ts +16 -16
- package/src/metro-plugin.ts +2 -2
- package/src/profiles.ts +2 -2
- package/src/runtime-assets.ts +7 -7
- package/src/runtime-delivery.ts +13 -13
- package/src/screenshots/orchestrate.ts +1 -1
- package/src/screenshots/schema.ts +2 -2
- package/src/skills/builtin/a11y-review.ts +2 -2
- package/src/skills/builtin/compat-check.ts +2 -2
- package/src/skills/builtin/maestro-test.ts +2 -2
- package/src/skills/builtin/perf-profile.ts +2 -2
- package/src/skills/builtin/screenshot-all.ts +2 -2
- package/src/skills/builtin/visual-diff.ts +2 -2
- package/src/skills/registry.ts +8 -8
- package/src/skills/types.ts +1 -1
- package/src/vite-plugin-one.ts +3 -3
- package/src/vite-plugin.ts +15 -2
- package/dist-cli/bin.js +0 -15
- package/dist-cli/chunks/agent-JJN7U6FR.js +0 -48
- package/dist-cli/chunks/agent-wrapper-AVVUJ3WF.js +0 -17
- package/dist-cli/chunks/app-fonts-QJ22CNAZ.js +0 -4
- package/dist-cli/chunks/assert-PZZKIY3K.js +0 -49
- package/dist-cli/chunks/auth-5AVDJO33.js +0 -12
- package/dist-cli/chunks/beta-PFRGP266.js +0 -4
- package/dist-cli/chunks/box-ILC2O7ZO.js +0 -1730
- package/dist-cli/chunks/camera-J3V62PP7.js +0 -33
- package/dist-cli/chunks/chunk-25KRGDZT.js +0 -4
- package/dist-cli/chunks/chunk-2BRBFLWA.js +0 -38
- package/dist-cli/chunks/chunk-2GXNAZHB.js +0 -74
- package/dist-cli/chunks/chunk-2IUMRRYV.js +0 -7
- package/dist-cli/chunks/chunk-4ALPWIMP.js +0 -10
- package/dist-cli/chunks/chunk-4CEZZKRY.js +0 -4
- package/dist-cli/chunks/chunk-4EUKOIAV.js +0 -4
- package/dist-cli/chunks/chunk-4IKE4YUS.js +0 -32
- package/dist-cli/chunks/chunk-4ZXR2M3D.js +0 -4
- package/dist-cli/chunks/chunk-5CGJFU27.js +0 -7
- package/dist-cli/chunks/chunk-5HHWECGT.js +0 -4
- package/dist-cli/chunks/chunk-5PZVYF42.js +0 -312
- package/dist-cli/chunks/chunk-7NCPUZ52.js +0 -27
- package/dist-cli/chunks/chunk-7OSIJCBR.js +0 -107
- package/dist-cli/chunks/chunk-AQ5TMOAI.js +0 -4
- package/dist-cli/chunks/chunk-BQCEI37V.js +0 -5
- package/dist-cli/chunks/chunk-C6B5FOP3.js +0 -4
- package/dist-cli/chunks/chunk-CCMZSHJB.js +0 -71
- package/dist-cli/chunks/chunk-CX7VCKAT.js +0 -14
- package/dist-cli/chunks/chunk-DQUPSAHE.js +0 -4
- package/dist-cli/chunks/chunk-DSD2UBZI.js +0 -4
- package/dist-cli/chunks/chunk-EWPAI4MO.js +0 -7
- package/dist-cli/chunks/chunk-EZXV6U2N.js +0 -497
- package/dist-cli/chunks/chunk-F5F7FIPM.js +0 -6
- package/dist-cli/chunks/chunk-FUTYK55H.js +0 -30
- package/dist-cli/chunks/chunk-FW6AN7I2.js +0 -3
- package/dist-cli/chunks/chunk-FZDRA7Z4.js +0 -4
- package/dist-cli/chunks/chunk-GDLE4NIV.js +0 -4
- package/dist-cli/chunks/chunk-GEX7RVHY.js +0 -5
- package/dist-cli/chunks/chunk-H4MYYOYJ.js +0 -5
- package/dist-cli/chunks/chunk-HEV7BAPE.js +0 -11
- package/dist-cli/chunks/chunk-HNDWYCND.js +0 -506
- package/dist-cli/chunks/chunk-HNPHODBD.js +0 -4
- package/dist-cli/chunks/chunk-HWDVC6YA.js +0 -11
- package/dist-cli/chunks/chunk-JOHJZUGG.js +0 -4
- package/dist-cli/chunks/chunk-JWUDT4QK.js +0 -5
- package/dist-cli/chunks/chunk-K7QQWKGE.js +0 -4
- package/dist-cli/chunks/chunk-LAOKTKT4.js +0 -4
- package/dist-cli/chunks/chunk-LD7I266X.js +0 -24
- package/dist-cli/chunks/chunk-LMHBU5LZ.js +0 -4
- package/dist-cli/chunks/chunk-LSOGXSDV.js +0 -535
- package/dist-cli/chunks/chunk-MP2GPO4T.js +0 -4
- package/dist-cli/chunks/chunk-MXJ2UWRV.js +0 -4
- package/dist-cli/chunks/chunk-OJNKRIZF.js +0 -15
- package/dist-cli/chunks/chunk-PBOWUNXO.js +0 -4
- package/dist-cli/chunks/chunk-PNRJFHX4.js +0 -4
- package/dist-cli/chunks/chunk-QJQOK34O.js +0 -28
- package/dist-cli/chunks/chunk-RLCQLMFF.js +0 -142
- package/dist-cli/chunks/chunk-S65CK3RI.js +0 -9
- package/dist-cli/chunks/chunk-SWBUNMQS.js +0 -4
- package/dist-cli/chunks/chunk-SXBFGGAM.js +0 -4
- package/dist-cli/chunks/chunk-T4ISWS5H.js +0 -4
- package/dist-cli/chunks/chunk-TPPVAA7Z.js +0 -5
- package/dist-cli/chunks/chunk-USM3P74H.js +0 -4
- package/dist-cli/chunks/chunk-V4EJJHF5.js +0 -4
- package/dist-cli/chunks/chunk-V7RGRZOL.js +0 -423
- package/dist-cli/chunks/chunk-XUBV77WH.js +0 -130
- package/dist-cli/chunks/chunk-XYSDYGKC.js +0 -4
- package/dist-cli/chunks/chunk-YNHRSDVG.js +0 -5
- package/dist-cli/chunks/chunk-YX52RJKO.js +0 -4
- package/dist-cli/chunks/chunk-Z5O5H4O7.js +0 -99
- package/dist-cli/chunks/chunk-Z6LOIW46.js +0 -7
- package/dist-cli/chunks/chunk-ZXFVBYJY.js +0 -5
- package/dist-cli/chunks/cleanup-KPUW4SFK.js +0 -25
- package/dist-cli/chunks/cli-version-APGT6GAT.js +0 -4
- package/dist-cli/chunks/compat-XXRFD2TW.js +0 -23
- package/dist-cli/chunks/config-DDMFDQ7F.js +0 -13
- package/dist-cli/chunks/connect-IPG47YXM.js +0 -4
- package/dist-cli/chunks/control-O22Z3UJ5.js +0 -4
- package/dist-cli/chunks/daemon-PADUIMJV.js +0 -4
- package/dist-cli/chunks/debug-MYIP46TM.js +0 -200
- package/dist-cli/chunks/desktop-ENFFBQAA.js +0 -31
- package/dist-cli/chunks/detox-J5WVK6OH.js +0 -52
- package/dist-cli/chunks/device-RAVQVL75.js +0 -18
- package/dist-cli/chunks/diagnose-PJMPXKJY.js +0 -43
- package/dist-cli/chunks/disk-cleanup-YLAY445J.js +0 -4
- package/dist-cli/chunks/do-chain-UBE7GIOU.js +0 -5
- package/dist-cli/chunks/drivers-ZFNX3T5Z.js +0 -4
- package/dist-cli/chunks/env-Y5XJSNRD.js +0 -4
- package/dist-cli/chunks/film-W3V6VURB.js +0 -74
- package/dist-cli/chunks/flow-VMLI7BYM.js +0 -4
- package/dist-cli/chunks/help-PKZCWHJJ.js +0 -4
- package/dist-cli/chunks/hidden-runtime-alias-S5DJ7EDF.js +0 -4
- package/dist-cli/chunks/home-paths-5O4IZPYV.js +0 -4
- package/dist-cli/chunks/inspect-LT4MXK37.js +0 -4
- package/dist-cli/chunks/install-desktop-EXCFMXFS.js +0 -4
- package/dist-cli/chunks/login-V6TZ54ZH.js +0 -26
- package/dist-cli/chunks/logout-SPMLFWYA.js +0 -4
- package/dist-cli/chunks/maestro-5ISTBAZE.js +0 -108
- package/dist-cli/chunks/maestro-generate-WUI64NHR.js +0 -36
- package/dist-cli/chunks/mode-QPNBYXUF.js +0 -26
- package/dist-cli/chunks/optional-demo-registry-CBSYF4CG.js +0 -4
- package/dist-cli/chunks/perf-T6N5PVYV.js +0 -48
- package/dist-cli/chunks/permissions-YZ7RRSZJ.js +0 -13
- package/dist-cli/chunks/platform-XDQAA72X.js +0 -6
- package/dist-cli/chunks/privacy-54FIGXLT.js +0 -4
- package/dist-cli/chunks/record-QGYXRUKP.js +0 -72
- package/dist-cli/chunks/report-issue-VUUTGX7V.js +0 -29
- package/dist-cli/chunks/reset-CGO52KBW.js +0 -4
- package/dist-cli/chunks/resolve-target-NNQCALDM.js +0 -4
- package/dist-cli/chunks/runtime-4EP6YJVL.js +0 -4
- package/dist-cli/chunks/screenshot-command-NZCMSJ4P.js +0 -159
- package/dist-cli/chunks/screenshot-layers-VMTQ6XIU.js +0 -20
- package/dist-cli/chunks/screenshots-capture-K3MWIDBK.js +0 -42
- package/dist-cli/chunks/serve-QJRIB2BV.js +0 -56
- package/dist-cli/chunks/setup-6XXEJQVF.js +0 -4
- package/dist-cli/chunks/sim-client-5YUVL45C.js +0 -4
- package/dist-cli/chunks/skills-T3CS7CXK.js +0 -50
- package/dist-cli/chunks/state-AJC3VK3G.js +0 -14
- package/dist-cli/chunks/storage-KVGZKC3Y.js +0 -37
- package/dist-cli/chunks/store-AWUMOQUH.js +0 -4
- package/dist-cli/chunks/telemetry-W5ZDGWK6.js +0 -4
- package/dist-cli/chunks/timeline-DXDCAZUA.js +0 -24
- package/dist-cli/chunks/upgrade-SRPTJACU.js +0 -7
- package/dist-cli/chunks/upload-ZDV4BFED.js +0 -4
- package/dist-cli/chunks/version-SOLPSBMG.js +0 -6
- package/dist-cli/chunks/web-RT75LD7A.js +0 -4
- package/dist-cli/chunks/welcome-IJ55EC7U.js +0 -5
- package/dist-cli/chunks/what-happened-CEIWJIWK.js +0 -25
- package/dist-cli/chunks/ws-bridge-YK5R3HOI.js +0 -4
- package/scripts/postinstall.cjs +0 -3
- package/scripts/preuninstall.cjs +0 -118
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
/*! rnx v0.1.375 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
-
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
function X(t,e){let n=["--max-ms","--maxMs","--maxms","--max_ms"];for(let r of n){let s=t.indexOf(r);if(s>=0&&t[s+1]){let o=Number(t[s+1]);if(Number.isFinite(o))return Math.max(100,o)}}return e}var P=new Set(["tap","double-tap","tap-text","tap-id","long-press","touch"]);function _(t){return typeof t=="string"&&P.has(t)}async function A(t){return await t.send({type:"evaluate",code:"window.__sootsimEngineState?.inspectActive === true"})===!0}async function G(t,e){if(!_(e))return!1;try{return await A(t)}catch{return!1}}async function V(t){let e=await t.send({type:"query",query:{kind:"count"}});return{nodes:b(e)?e.total:0}}async function Z(t,e=5){let n=await t.send({type:"query",query:{kind:"tree",depth:e}}),r=b(n)?n.nodes:[];return{depth:e,tree:r}}async function ee(t){let e=await t.send({type:"evaluate",code:"window.location.href"});return{url:typeof e=="string"?e:""}}function C(t){return t!==null&&typeof t=="object"&&[Reflect.get(t,"x"),Reflect.get(t,"y"),Reflect.get(t,"width"),Reflect.get(t,"height")].every(e=>typeof e=="number"?Number.isFinite(e):!1)}function I(t){return Array.isArray(t)?t.every(e=>{if(e===null||typeof e!="object"||!Number.isInteger(Reflect.get(e,"nodeId"))||typeof Reflect.get(e,"type")!="string"||!C(Reflect.get(e,"geometry")))return!1;for(let s of["testID","text","role","label"]){let o=Reflect.get(e,s);if(o!==void 0&&typeof o!="string")return!1}let n=Reflect.get(e,"pressable");if(n!==void 0&&n!==!0)return!1;let r=Reflect.get(e,"children");return r===void 0||I(r)}):!1}function b(t){let e=t!==null&&typeof t=="object"?Reflect.get(t,"total"):void 0;return t!==null&&typeof t=="object"&&typeof e=="number"&&Number.isInteger(e)&&e>=0&&I(Reflect.get(t,"nodes"))}function N(t){let e=t.replace(/[.+^$(){}|[\]\\]/g,"\\$&");return new RegExp(`^${e.replace(/\*/g,".*").replace(/\?/g,".")}$`,"i")}function F(t,e={}){let n=e.filter?.toLowerCase()??"",r=e.testIdLike?N(e.testIdLike):null,s=e.onlyGlob?N(e.onlyGlob):null,o=[],i=(a,y)=>{let p=[a.role,a.label,a.text,a.testID].filter(d=>typeof d=="string").join(" ");if((!n||p.toLowerCase().includes(n))&&(!r||r.test(a.testID??""))&&(!s||s.test(p))){let d=[a.role?`[${a.role}]`:a.pressable?"[tap]":`<${a.type}>`];if(a.text){let g=e.fullText||a.text.length<=50?a.text:`${a.text.slice(0,49).trimEnd()}\u2026`;d.push(JSON.stringify(g))}if(a.testID&&d.push(`#${a.testID}`),a.label&&a.label!==a.text&&d.push(`label=${JSON.stringify(a.label)}`),!e.hideXy){let g=a.geometry;d.push(`@(${Math.round(g.x)},${Math.round(g.y)}) ${Math.round(g.width)}x${Math.round(g.height)}`)}a.pressable&&d.push("(tap)"),o.push(`${" ".repeat(y+1)}${d.join(" ")}`)}for(let d of a.children??[])i(d,y+1)},u=t;if(e.subtreeRoot){let a=[...t],y;for(;a.length>0&&!y;){let p=a.shift();p&&(p.testID===e.subtreeRoot?y=p:a.push(...p.children??[]))}if(!y)return`__SUBTREE_NOT_FOUND__:${e.subtreeRoot}`;u=[y]}for(let a of u)i(a,0);return o.join(`
|
|
5
|
-
`)}async function te(t,e){let n=e.maxDepth??12,r=await t.send({type:"query",query:{kind:"tree",depth:n}});return b(r)?{tree:F(r.nodes,e),nodeCount:r.total}:{}}function W(t){let e=t.fontSize>=18||t.fontSize>=14&&(t.fontWeight??400)>=700?3:4.5,{normal:n,background:r}=t;if(n.width<=0||n.height<=0||n.width!==r.width||n.height!==r.height)return{ratio:null,required:e,reason:"capture dimensions do not match"};let s=Math.max(0,Math.floor(t.box.x)),o=Math.max(0,Math.floor(t.box.y)),i=Math.min(n.width,Math.ceil(t.box.x+t.box.w)),u=Math.min(n.height,Math.ceil(t.box.y+t.box.h));if(i<=s||u<=o)return{ratio:null,required:e,reason:"text is outside the captured frame"};let a=l=>{let c=l/255;return c<=.04045?c/12.92:Math.pow((c+.055)/1.055,2.4)},y=(l,c)=>{let m=.2126*a(l[0])+.7152*a(l[1])+.0722*a(l[2]),x=.2126*a(c[0])+.7152*a(c[1])+.0722*a(c[2]);return(Math.max(m,x)+.05)/(Math.min(m,x)+.05)},p=l=>`#${l.slice(0,3).map(c=>Math.round(c).toString(16).padStart(2,"0")).join("")}`,R=(i-s)*(u-o),d=Math.max(1,Math.floor(Math.sqrt(R/12e3))),g=(l,c)=>(c*n.width+l)*4,$=l=>Math.max(Math.abs(n.data[l]-r.data[l]),Math.abs(n.data[l+1]-r.data[l+1]),Math.abs(n.data[l+2]-r.data[l+2])),S=0,w=null,f=null;for(let l=o;l<u;l+=d)for(let c=s;c<i;c+=d){let m=g(c,l);if(r.data[m+3]<250)continue;let x=[r.data[m],r.data[m+1],r.data[m+2]];f??=x;let M=$(m);M<=S||(S=M,w=[n.data[m],n.data[m+1],n.data[m+2]])}let h=1/0,v=null,k=null,E=(l,c)=>{let m=y(l,c);m>=h||(h=m,v=l,k=c)};if(S>=2&&w)for(let l=o;l<u;l+=d)for(let c=s;c<i;c+=d){let m=g(c,l);r.data[m+3]<250||$(m)<2||E(w,[r.data[m],r.data[m+1],r.data[m+2]])}else f&&E(f,f);return!v||!k||!Number.isFinite(h)?{ratio:null,required:e,reason:"could not isolate opaque rendered text pixels"}:{ratio:Math.round(h*100)/100,required:e,foreground:p(v),background:p(k)}}function O(t={}){let e=t.styling===!0,n=t.filter?.trim().toLowerCase()??"";return`(async () => {
|
|
6
|
-
const t = window.__sootsimTest
|
|
7
|
-
if (!t || typeof t.listInspectable !== 'function') return []
|
|
8
|
-
const list = await t.listInspectable({})
|
|
9
|
-
if (!Array.isArray(list)) return []
|
|
10
|
-
const includeStyle = ${JSON.stringify(e)}
|
|
11
|
-
const scoreContrast = ${W.toString()}
|
|
12
|
-
// narrows by ELEMENT, not by style field: fewer rows, full detail on each.
|
|
13
|
-
const filter = ${JSON.stringify(n)}
|
|
14
|
-
const matchesFilter = (n, text) => {
|
|
15
|
-
if (!filter) return true
|
|
16
|
-
const fields = [text, n.testID || n.testId, n.accessibilityRole || n.role, n.type]
|
|
17
|
-
return fields.some((f) => typeof f === 'string' && f.toLowerCase().includes(filter))
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : 0)
|
|
21
|
-
const round = (v) => Math.round(num(v))
|
|
22
|
-
|
|
23
|
-
// borderRadius can be authored as a string ("12px") or split per-corner;
|
|
24
|
-
// prefer the uniform borderRadius, else the largest corner radius present.
|
|
25
|
-
const radiusOf = (style) => {
|
|
26
|
-
if (!style) return 0
|
|
27
|
-
const keys = ['borderRadius','borderTopLeftRadius','borderTopRightRadius','borderBottomLeftRadius','borderBottomRightRadius']
|
|
28
|
-
let max = 0
|
|
29
|
-
for (const k of keys) {
|
|
30
|
-
const raw = style[k]
|
|
31
|
-
const n = typeof raw === 'number' ? raw : (typeof raw === 'string' ? parseFloat(raw) : NaN)
|
|
32
|
-
if (Number.isFinite(n)) max = Math.max(max, n)
|
|
33
|
-
}
|
|
34
|
-
return Math.round(max)
|
|
35
|
-
}
|
|
36
|
-
const fontSizeOf = (style) => {
|
|
37
|
-
if (!style) return 0
|
|
38
|
-
const raw = style.fontSize
|
|
39
|
-
const n = typeof raw === 'number' ? raw : (typeof raw === 'string' ? parseFloat(raw) : NaN)
|
|
40
|
-
return Number.isFinite(n) ? Math.round(n) : 0
|
|
41
|
-
}
|
|
42
|
-
// styling extractors \u2014 omit boring defaults so the agent only sees notable
|
|
43
|
-
// styling (low opacity, struck text, clipping, a real border/color).
|
|
44
|
-
const colorStr = (v) => {
|
|
45
|
-
if (v == null) return undefined
|
|
46
|
-
const s = String(v).split(' ').join('')
|
|
47
|
-
return s && s !== 'transparent' && s !== 'rgba(0,0,0,0)' ? s : undefined
|
|
48
|
-
}
|
|
49
|
-
const opacityOf = (style) => {
|
|
50
|
-
const o = style && style.opacity
|
|
51
|
-
const n = typeof o === 'number' ? o : (typeof o === 'string' ? parseFloat(o) : NaN)
|
|
52
|
-
return Number.isFinite(n) && n < 1 ? Math.round(n * 100) / 100 : undefined
|
|
53
|
-
}
|
|
54
|
-
const weightOf = (style) => {
|
|
55
|
-
const w = style && style.fontWeight
|
|
56
|
-
const n = w === 'bold' ? 700 : (typeof w === 'number' ? w : (typeof w === 'string' ? parseInt(w, 10) : NaN))
|
|
57
|
-
return Number.isFinite(n) && n >= 600 ? n : undefined
|
|
58
|
-
}
|
|
59
|
-
const decoOf = (style) => {
|
|
60
|
-
const d = style && (style.textDecorationLine || style.textDecoration)
|
|
61
|
-
return d && d !== 'none' && d !== 'normal' ? String(d).split(' ')[0] : undefined
|
|
62
|
-
}
|
|
63
|
-
const overflowOf = (style) => (style && style.overflow === 'hidden' ? 'hidden' : undefined)
|
|
64
|
-
const borderWOf = (style) => {
|
|
65
|
-
if (!style) return undefined
|
|
66
|
-
const keys = ['borderWidth','borderTopWidth','borderBottomWidth','borderLeftWidth','borderRightWidth']
|
|
67
|
-
let max = 0
|
|
68
|
-
for (const k of keys) {
|
|
69
|
-
const r = style[k]
|
|
70
|
-
const n = typeof r === 'number' ? r : (typeof r === 'string' ? parseFloat(r) : NaN)
|
|
71
|
-
if (Number.isFinite(n)) max = Math.max(max, n)
|
|
72
|
-
}
|
|
73
|
-
return max > 0 ? Math.round(max) : undefined
|
|
74
|
-
}
|
|
75
|
-
// only meaningful alongside a real border width, so it is resolved by the
|
|
76
|
-
// caller below rather than on its own.
|
|
77
|
-
const borderColorOf = (style) => {
|
|
78
|
-
if (!style) return undefined
|
|
79
|
-
const keys = ['borderColor','borderTopColor','borderBottomColor','borderLeftColor','borderRightColor']
|
|
80
|
-
for (const k of keys) {
|
|
81
|
-
const c = colorStr(style[k])
|
|
82
|
-
if (c) return c
|
|
83
|
-
}
|
|
84
|
-
return undefined
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const isVisible = (n) => {
|
|
88
|
-
const layout = n && n.layout
|
|
89
|
-
if (!layout || layout.width <= 0 || layout.height <= 0) return false
|
|
90
|
-
const abs = (n && (n.absolute || n.absolutePosition)) || null
|
|
91
|
-
if (!abs) return true
|
|
92
|
-
const device = (n && n.device) || {}
|
|
93
|
-
const screenW = Number(device.width) || window.innerWidth || 0
|
|
94
|
-
const screenH = Number(device.height) || window.innerHeight || 0
|
|
95
|
-
if (!screenW || !screenH) return true
|
|
96
|
-
return abs.x + layout.width > 0 && abs.y + layout.height > 0 && abs.x < screenW && abs.y < screenH
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const elements = list.filter(isVisible).filter((n) => {
|
|
100
|
-
const t = typeof n.text === 'string' && n.text.trim() ? n.text.trim() : undefined
|
|
101
|
-
return matchesFilter(n, t)
|
|
102
|
-
}).map((n) => {
|
|
103
|
-
const layout = n.layout || { x: 0, y: 0, width: 0, height: 0 }
|
|
104
|
-
const abs = n.absolute || n.absolutePosition || { x: layout.x, y: layout.y }
|
|
105
|
-
const text = typeof n.text === 'string' && n.text.trim() ? n.text.trim() : undefined
|
|
106
|
-
const base = {
|
|
107
|
-
...(typeof n.nodeId === 'number'
|
|
108
|
-
? {
|
|
109
|
-
nodeId: n.nodeId,
|
|
110
|
-
ancestorIds: Array.isArray(n.ancestors)
|
|
111
|
-
? n.ancestors.map((ancestor) => ancestor && ancestor.nodeId).filter((id) => typeof id === 'number')
|
|
112
|
-
: [],
|
|
113
|
-
}
|
|
114
|
-
: {}),
|
|
115
|
-
testID: n.testID || n.testId || undefined,
|
|
116
|
-
role: n.accessibilityRole || n.role || undefined,
|
|
117
|
-
type: typeof n.type === 'string' ? n.type : 'node',
|
|
118
|
-
text,
|
|
119
|
-
box: { x: round(abs.x), y: round(abs.y), w: round(layout.width), h: round(layout.height) },
|
|
120
|
-
}
|
|
121
|
-
if (!includeStyle) return base
|
|
122
|
-
// computedStyle has the resolved values; style is the curated subset \u2014
|
|
123
|
-
// fall back across both so radius/fontSize survive either shape.
|
|
124
|
-
const style = Object.assign({}, n.style || {}, n.computedStyle || {})
|
|
125
|
-
const pad = (n.boxModel && n.boxModel.padding) || {}
|
|
126
|
-
const borderWidth = borderWOf(style)
|
|
127
|
-
return {
|
|
128
|
-
...base,
|
|
129
|
-
borderRadius: radiusOf(style),
|
|
130
|
-
padding: { t: round(pad.top), r: round(pad.right), b: round(pad.bottom), l: round(pad.left) },
|
|
131
|
-
fontSize: text ? (fontSizeOf(style) || 14) : 0,
|
|
132
|
-
color: text ? colorStr(style.color) : undefined,
|
|
133
|
-
bg: colorStr(style.backgroundColor),
|
|
134
|
-
opacity: opacityOf(style),
|
|
135
|
-
fontWeight: weightOf(style),
|
|
136
|
-
textDecoration: decoOf(style),
|
|
137
|
-
overflow: overflowOf(style),
|
|
138
|
-
borderWidth,
|
|
139
|
-
borderColor: borderWidth ? borderColorOf(style) : undefined,
|
|
140
|
-
}
|
|
141
|
-
})
|
|
142
|
-
const textElements = elements.filter((element) => element.text && element.fontSize > 0)
|
|
143
|
-
if (!includeStyle || textElements.length === 0) return elements
|
|
144
|
-
|
|
145
|
-
const screenshot = window.SootSim && window.SootSim.bridges && window.SootSim.bridges.screenshot
|
|
146
|
-
if (typeof screenshot !== 'function') {
|
|
147
|
-
throw new Error('styled native layout requires the rnx capture bridge')
|
|
148
|
-
}
|
|
149
|
-
const device = list.find((node) => node && node.device)?.device || {}
|
|
150
|
-
const width = Math.round(Number(device.width) || window.innerWidth || 0)
|
|
151
|
-
const height = Math.round(Number(device.height) || window.innerHeight || 0)
|
|
152
|
-
if (!width || !height) throw new Error('native layout has no capture dimensions')
|
|
153
|
-
const capture = async (suppressText) => {
|
|
154
|
-
const dataUrl = await screenshot({
|
|
155
|
-
format: 'png',
|
|
156
|
-
outputWidth: width,
|
|
157
|
-
outputHeight: height,
|
|
158
|
-
...(suppressText ? { suppressText: true } : {}),
|
|
159
|
-
})
|
|
160
|
-
const image = await new Promise((resolve, reject) => {
|
|
161
|
-
const next = new Image()
|
|
162
|
-
next.onload = () => resolve(next)
|
|
163
|
-
next.onerror = () => reject(new Error('could not decode native layout pixels'))
|
|
164
|
-
next.src = dataUrl
|
|
165
|
-
})
|
|
166
|
-
const canvas = document.createElement('canvas')
|
|
167
|
-
canvas.width = image.naturalWidth
|
|
168
|
-
canvas.height = image.naturalHeight
|
|
169
|
-
const context = canvas.getContext('2d', { willReadFrequently: true })
|
|
170
|
-
if (!context) throw new Error('could not read native layout pixels')
|
|
171
|
-
context.drawImage(image, 0, 0)
|
|
172
|
-
return context.getImageData(0, 0, canvas.width, canvas.height)
|
|
173
|
-
}
|
|
174
|
-
const normal = await capture(false)
|
|
175
|
-
const background = await capture(true)
|
|
176
|
-
for (const element of textElements) {
|
|
177
|
-
element.contrast = scoreContrast({
|
|
178
|
-
normal,
|
|
179
|
-
background,
|
|
180
|
-
box: element.box,
|
|
181
|
-
fontSize: element.fontSize,
|
|
182
|
-
fontWeight: element.fontWeight,
|
|
183
|
-
})
|
|
184
|
-
}
|
|
185
|
-
return elements
|
|
186
|
-
})()`}var re=O();async function ne(t,e={}){if(!e.styling){let r=await t.send({type:"query",query:{kind:"find",selector:{visible:!0}}});if(!b(r))return[];let s=e.filter?.trim().toLowerCase()??"";return r.nodes.filter(o=>s?[o.text,o.testID,o.role,o.type].some(i=>typeof i=="string"&&i.toLowerCase().includes(s)):!0).map(o=>({nodeId:o.nodeId,...o.testID?{testID:o.testID}:{},...o.role?{role:o.role}:{},type:o.type,...o.text?{text:o.text}:{},box:{x:Math.round(o.geometry.x),y:Math.round(o.geometry.y),w:Math.round(o.geometry.width),h:Math.round(o.geometry.height)}}))}let n=await t.send({type:"evaluate",code:O(e)});return Array.isArray(n)?n:[]}function oe(t,e){return t.length===0?" no visible elements found":t.map(r=>{let o=[r.testID?`#${r.testID}`:r.selector?r.selector:r.role?`[${r.role}]`:`<${r.type}>`,`@(${r.box.x},${r.box.y})`,`${r.box.w}x${r.box.h}`];r.borderRadius!==void 0&&r.borderRadius>0&&o.push(`radius:${r.borderRadius}`);let i=r.padding;if(i&&(i.t||i.r||i.b||i.l)){let u=i.t===i.r&&i.r===i.b&&i.b===i.l;o.push(u?`pad:${i.t}`:`pad:${i.t},${i.r},${i.b},${i.l}`)}if(r.fontSize!==void 0&&r.fontSize>0&&o.push(`font:${r.fontSize}`),e?.styling){if(r.fontWeight&&o.push(`weight:${r.fontWeight}`),r.color&&o.push(`color:${r.color}`),r.bg&&o.push(`bg:${r.bg}`),r.contrast){let u=r.contrast.ratio==null?`?/${r.contrast.required}`:`${r.contrast.ratio}/${r.contrast.required}${r.contrast.ratio<r.contrast.required?" FAIL":""}`;o.push(`contrast:${u}`),r.contrast.background&&o.push(`on:${r.contrast.background}`)}r.opacity!=null&&o.push(`opacity:${r.opacity}`),r.textDecoration&&o.push(`deco:${r.textDecoration}`),r.overflow&&o.push(`overflow:${r.overflow}`),r.borderWidth&&o.push(r.borderColor?`border:${r.borderWidth}/${r.borderColor}`:`border:${r.borderWidth}`)}if(r.text){let u=r.text.length>40?`${r.text.slice(0,39)}\u2026`:r.text;o.push(`"${u}"`)}return` ${o.join(" ")}`}).join(`
|
|
187
|
-
`)}async function se(t){let e=await t.send({type:"query",query:{kind:"find",selector:{visible:!0}}});return b(e)?e.nodes.flatMap(n=>!n.role&&!n.label&&!n.text&&!n.pressable?[]:[{role:n.role??(n.pressable?"button":n.type==="text"?"statictext":"none"),label:n.label??n.text??null,hint:null,state:null,testID:n.testID??null,position:{x:Math.round(n.geometry.x),y:Math.round(n.geometry.y)},size:{w:Math.round(n.geometry.width),h:Math.round(n.geometry.height)}}]):[]}function B(t){return t.testId?{mode:"testid",selector:{testID:t.testId}}:t.role?{mode:"role",selector:{role:t.role}}:t.type?{mode:"type",selector:{type:t.type}}:t.pressable?{mode:"pressable",selector:{pressable:!0}}:t.interactive?{mode:"interactive-targets",selector:{pressable:!0}}:t.visible?{mode:"visible",selector:{visible:!0}}:t.text?{mode:"text",selector:{text:t.text}}:null}async function ie(t,e){let n=B(e);if(!n)return null;let r=await t.send({type:"query",query:{kind:"find",selector:n.selector}});if(!b(r))return{mode:n.mode,result:[]};let s=r.nodes.map(i=>({type:i.type,nodeId:i.nodeId,...i.testID?{testID:i.testID}:{},...i.text?{text:i.text}:{},...i.pressable?{pressable:!0}:{},...i.role?{accessibilityRole:i.role}:{},...i.label?{accessibilityLabel:i.label}:{},absolutePosition:{x:i.geometry.x,y:i.geometry.y},layout:{width:i.geometry.width,height:i.geometry.height}})),o=n.mode==="testid"||n.mode==="text"?s[0]??null:s;return{mode:n.mode,result:o}}function ae(t){return[...t].sort((e,n)=>T(n)-T(e))}function T(t){let e=0;t.testID&&(e+=100),typeof t.text=="string"&&t.text.trim().length>0&&(e+=60),typeof t.accessibilityLabel=="string"&&t.accessibilityLabel.trim().length>0&&(e+=30),t.accessibilityRole&&(e+=15);let n=t.layout?.width??0,r=t.layout?.height??0,s=n*r;return s>=400&&s<=6e4?e+=25:s>6e4&&(e-=20),(t.absolutePosition?.y??0)<0&&(e-=30),e}function le(t){if(t.testID)return`rnx do tap-id ${L(t.testID)}`;let e=typeof t.text=="string"?t.text.trim():"";if(e.length>0&&e.length<=80)return`rnx do tap-text ${L(e)}`;let n=Math.round(((t.absolutePosition?.x??0)+(t.layout?.width??0)/2)*10)/10,r=Math.round(((t.absolutePosition?.y??0)+(t.layout?.height??0)/2)*10)/10;return`rnx do tap ${n} ${r}`}function L(t){return/^[A-Za-z0-9_./@:-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`}function ue(t){if(t.bridgeError)return`sim unreachable: ${t.bridgeError} \u2014 the target tab is closed or no sim is connected (check \`rnx list\`, reopen with \`rnx open\`)`;let e=t.externalError?`guest app errored: ${t.externalError}`:t.loadingText?`still showing "${t.loadingText}"`:t.externalReady===!1?"guest app is still loading":t.flag!==!0&&t.targets>0?"native content is rendered but the ready signal has not settled":t.flag!==!0?"guest app has not emitted sootsim:externalAppReady":t.targets<=0?"ready flag emitted but no visible app content is inspectable yet":"node tree is still changing";return!t.externalError&&t.suppressedEntryError?`${e} (suppressed entry error: ${t.suppressedEntryError})`:e}async function ce(t,e=2e4,n={}){let r=Date.now(),s;try{s=await t.send({type:"waitFor",waitForOptions:{condition:{type:"ready"},timeoutMs:e}},{timeoutMs:e+1e3})}catch(u){let a=u instanceof Error?u.message:String(u);if(a.startsWith("multiple sims are connected:")||a.startsWith("saved sim "))throw u;s={matched:!1,elapsedMs:Date.now()-r,polls:0,error:a}}let o=s.probe,i={ready:s.matched,elapsedMs:s.elapsedMs,nodes:o?.nodes??0,targets:o?.targets??0,liveFrameActive:o?.liveFrameActive??!1,liveFrameChannels:o?.liveFrameChannels??0,liveFramePublishes:o?.liveFramePublishes??0,flag:o?.flag,loadingText:o?.loadingText??"",externalReady:o?.externalReady??null,externalStatus:o?.externalStatus??"",externalError:o?.externalError??"",suppressedEntryError:o?.suppressedEntryError??"",errors:o?.errors??0,bridgeError:s.error??""};return!i.ready&&n.onProgress&&n.onProgress(i),i}async function me(t,e,n=5e3,r={}){let s=r.gone===!0,o=await t.send({type:"waitFor",waitForOptions:{condition:{type:s?"absent":"present",testID:e},timeoutMs:n}},{timeoutMs:n+1e3});if(o?.error)throw new Error(o.error);if(o?.node&&!I([o.node]))throw new Error("waitFor returned an invalid semantic node");return{found:o?.matched===!0,...o?.node?{node:o.node}:{},elapsed:o?.elapsedMs??n}}function D(t,e){return`(() => {
|
|
188
|
-
const out = []
|
|
189
|
-
const seen = new Set()
|
|
190
|
-
const norm = (s) => (typeof s === 'string' ? s : (() => { try { return JSON.stringify(s) } catch { return String(s) } })())
|
|
191
|
-
const key = (ts, args) => Math.round((ts || 0) / 250) + '|' + (Array.isArray(args) ? args.map(norm).join(' ') : norm(args))
|
|
192
|
-
const push = (e) => {
|
|
193
|
-
if (!e) return
|
|
194
|
-
const ts = typeof e.timestamp === 'number' ? e.timestamp : (typeof e.ts === 'number' ? e.ts : 0)
|
|
195
|
-
const k = key(ts, e.args)
|
|
196
|
-
if (seen.has(k)) return
|
|
197
|
-
seen.add(k)
|
|
198
|
-
out.push({ timestamp: ts, args: Array.isArray(e.args) ? e.args : [e.args], stack: e.stack || undefined, source: e.source || undefined })
|
|
199
|
-
}
|
|
200
|
-
// page-realm ws-bridge buffer first (richest stacks for page-origin errors)
|
|
201
|
-
try { for (const e of (window.__sootsimConsole?.${t==="error"?"getErrors":"getWarnings"}(${e}) || [])) push(e) } catch {}
|
|
202
|
-
// engine observability store \u2014 the always-on render-worker / forwarded path
|
|
203
|
-
try {
|
|
204
|
-
const obs = window.__sootsimObservability
|
|
205
|
-
const snap = obs && obs.logs && typeof obs.logs.getSnapshot === 'function' ? obs.logs.getSnapshot() : []
|
|
206
|
-
for (const e of snap) if (e && e.level === ${JSON.stringify(t)}) push(e)
|
|
207
|
-
} catch {}
|
|
208
|
-
return out.sort((a, b) => (a.timestamp || 0) - (b.timestamp || 0)).slice(-${e})
|
|
209
|
-
})()`}async function de(t,e=20){let n=await t.send({type:"evaluate",code:D("error",e)});return Array.isArray(n)?n:[]}async function pe(t,e=20){let n=await t.send({type:"evaluate",code:D("warn",e)});return Array.isArray(n)?n:[]}var ye=`(() => {
|
|
210
|
-
const norm = (s) => (typeof s === 'string' ? s : (() => { try { return JSON.stringify(s) } catch { return String(s) } })())
|
|
211
|
-
const key = (lvl, ts, args) => lvl + '|' + Math.round((ts || 0) / 250) + '|' + (Array.isArray(args) ? args.map(norm).join(' ') : norm(args))
|
|
212
|
-
const seen = new Set()
|
|
213
|
-
let errors = 0
|
|
214
|
-
let warnings = 0
|
|
215
|
-
const add = (lvl, ts, args) => {
|
|
216
|
-
if (lvl !== 'error' && lvl !== 'warn') return
|
|
217
|
-
const k = key(lvl, ts, args)
|
|
218
|
-
if (seen.has(k)) return
|
|
219
|
-
seen.add(k)
|
|
220
|
-
if (lvl === 'error') errors++
|
|
221
|
-
else warnings++
|
|
222
|
-
}
|
|
223
|
-
try {
|
|
224
|
-
const c = window.__sootsimConsole
|
|
225
|
-
for (const e of (c?.getErrors?.(200) || [])) add('error', e?.timestamp ?? e?.ts, e?.args)
|
|
226
|
-
for (const e of (c?.getWarnings?.(200) || [])) add('warn', e?.timestamp ?? e?.ts, e?.args)
|
|
227
|
-
} catch {}
|
|
228
|
-
try {
|
|
229
|
-
const obs = window.__sootsimObservability
|
|
230
|
-
const snap = obs && obs.logs && typeof obs.logs.getSnapshot === 'function' ? obs.logs.getSnapshot() : []
|
|
231
|
-
for (const e of snap) if (e) add(e.level, e.ts, e.args)
|
|
232
|
-
} catch {}
|
|
233
|
-
return { errors, warnings, total: errors + warnings }
|
|
234
|
-
})()`;async function ge(t){await t.send({type:"evaluate",code:'window.__sootsimConsole?.clear(); window.__sootsimObservability?.logs?.clear?.(); "cleared"'})}async function be(t,e={}){let n=e.limit??20,r=e.failed===!1?"getRequests":"getFailedRequests",s=await t.send({type:"call",path:`__sootsimTest.${r}`,args:[n]});return Array.isArray(s)?s:[]}async function fe(t){await t.send({type:"call",path:"__sootsimTest.clearRequests",args:[]})}async function he(t){let e=await t.send({type:"evaluate",code:`(() => {
|
|
235
|
-
const obs = window.__sootsimObservability;
|
|
236
|
-
if (!obs) return { ok: false };
|
|
237
|
-
return { ok: true, entries: obs.logs.getSnapshot() };
|
|
238
|
-
})()`});return!e||!e.ok?[]:e.entries??[]}async function xe(t){await t.send({type:"evaluate",code:'window.__sootsimObservability?.logs.clear(); "cleared"'})}function H(t,e){if(t.source===e.source||t.level!==e.level||Math.abs(t.ts-e.ts)>1e3||t.args.length!==e.args.length)return!1;let n=new Set([t.source,e.source]);return!n.has("sootsim-worker")||!n.has("render-worker")&&!n.has("forwarded-render-worker")?!1:t.args.every((r,s)=>r===e.args[s])}function Se(t,e={}){let n=[];for(let r of t)n.some(s=>H(s,r))||n.push(r);if(e.showInternal||(n=n.filter(r=>{let s=r.args[0];return!(typeof s=="string"&&s.startsWith("[rnx]"))})),e.level&&(n=n.filter(r=>e.level.has(r.level))),e.filter){let r=e.filter.toLowerCase();n=n.filter(s=>s.args.join(" ").toLowerCase().includes(r))}return n}async function we(t,e){return await t.send({type:"call",path:"SootSim.bridges.timeline.summary",args:[e]})}async function j(t,e){return await t.send({type:"call",path:"SootSim.bridges.timeline.recent",args:[e]})}async function ve(t){let e;try{e=(await j(t,{kinds:["alert","actionsheet"],limit:80})).events}catch{return[]}let n=new Map;for(let o of e)n.set(o.kind,o);let r=[],s=(o,i)=>{let u=n.get(o);if(!u||!u.data||typeof u.data!="object")return;let a=u.data;a.phase==="show"&&r.push({label:i,title:typeof a.title=="string"?a.title:null})};return s("alert","Alert"),s("actionsheet","ActionSheet"),r}async function ke(t,e,n){await t.send({type:"call",path:"SootSim.bridges.timeline.cursorAdvance",args:[e,n]})}async function Ie(t){return await t.send({type:"evaluate",code:`(() => {
|
|
239
|
-
const kb = window.__sootsimKeyboard
|
|
240
|
-
if (!kb || typeof kb.getLayout !== 'function') {
|
|
241
|
-
return { error: 'keyboard bridge getLayout() not available' }
|
|
242
|
-
}
|
|
243
|
-
return kb.getLayout()
|
|
244
|
-
})()`})??{error:"keyboard bridge returned no result"}}function z(t){let e=t instanceof Error?t.message:String(t);return e.includes("call target not found: SootSim.bridges.mainShell")||e.includes("test bridge unavailable before app-in-worker boot")}async function q(t,e=0){let n=Date.now()+Math.max(0,e);for(;;)try{return await t.send({type:"call",path:"SootSim.bridges.mainShell.getState",args:[]})}catch(r){if(!z(r)||Date.now()>=n)throw r;await new Promise(s=>setTimeout(s,50))}}async function Re(t){let e=await t.send({type:"evaluate",code:`(async () => {
|
|
245
|
-
const test = window.__sootsimTest
|
|
246
|
-
const kb = window.__sootsimKeyboard
|
|
247
|
-
const navSnap =
|
|
248
|
-
test && typeof test.getNavigationSnapshot === 'function'
|
|
249
|
-
? await test.getNavigationSnapshot()
|
|
250
|
-
: null
|
|
251
|
-
const route =
|
|
252
|
-
test && typeof test.getRouteInfo === 'function'
|
|
253
|
-
? await test.getRouteInfo()
|
|
254
|
-
: null
|
|
255
|
-
const keyboard =
|
|
256
|
-
kb && typeof kb.getLayout === 'function'
|
|
257
|
-
? (() => {
|
|
258
|
-
const layout = kb.getLayout()
|
|
259
|
-
return layout ? {
|
|
260
|
-
visible: layout.visible,
|
|
261
|
-
mode: layout.mode,
|
|
262
|
-
spec: layout.spec
|
|
263
|
-
? {
|
|
264
|
-
keyboardType: layout.spec.keyboardType,
|
|
265
|
-
returnKeyType: layout.spec.returnKeyType,
|
|
266
|
-
}
|
|
267
|
-
: null,
|
|
268
|
-
} : null
|
|
269
|
-
})()
|
|
270
|
-
: null
|
|
271
|
-
return { nav: navSnap, route, keyboard }
|
|
272
|
-
})()`});return{shell:await q(t,500).catch(()=>null),nav:e?.nav??null,route:e?.route??null,keyboard:e?.keyboard??null}}async function $e(t){return t.send({type:"evaluate",code:"window.__sootsimDebug.status()"})}async function Ee(t){return t.send({type:"evaluate",code:"window.__sootsimDebug.flags()"})}async function Me(t,e){return t.send({type:"evaluate",code:`window.__sootsimTest.debugFind(${JSON.stringify(e)})`})}async function Ne(t,e,n=50){let r=e&&e!=="all"?`window.__sootsimDebug.recent(${JSON.stringify(e)}, ${n})`:`window.__sootsimDebug.recent(undefined, ${n})`;return t.send({type:"evaluate",code:r})}async function Te(t,e,n){let r=n.length>0?n.map(s=>JSON.stringify(s)).join(", "):e==="disable"?"'all'":"";return t.send({type:"evaluate",code:`window.__sootsimDebug.${e}(${r})`})}async function Le(t){return await t.send({type:"evaluate",code:`(async () => {
|
|
273
|
-
const host = window.__sootsimRenderHost
|
|
274
|
-
const stats = host?.queryStats ? await host.queryStats() : null
|
|
275
|
-
const shellRaw = window.__sootsimShellMemory
|
|
276
|
-
? await window.__sootsimShellMemory()
|
|
277
|
-
: null
|
|
278
|
-
const shell = shellRaw && !shellRaw.error ? shellRaw : null
|
|
279
|
-
// the compositor paints home + app:one + app:two, so every app-surface
|
|
280
|
-
// picture and raster image is counted here and nowhere else.
|
|
281
|
-
let compositor = null
|
|
282
|
-
try {
|
|
283
|
-
const cs = await window.__sootsimCompositor?.getStats?.(false, true)
|
|
284
|
-
compositor = cs?.memory ?? null
|
|
285
|
-
} catch {}
|
|
286
|
-
const normalize = (m) =>
|
|
287
|
-
m
|
|
288
|
-
? {
|
|
289
|
-
nodesRegistered: m.nodesRegistered ?? null,
|
|
290
|
-
nodesDetached: m.nodesDetached ?? null,
|
|
291
|
-
detachedTypes: m.detachedTypes ?? null,
|
|
292
|
-
objects: m.objects ?? null,
|
|
293
|
-
activeNativeAnimations: m.activeNativeAnimations ?? null,
|
|
294
|
-
imageLoader: m.imageLoader ?? null,
|
|
295
|
-
workerHeap: m.workerHeap ?? null,
|
|
296
|
-
wasmHeapBytes: m.wasmHeapBytes ?? null,
|
|
297
|
-
}
|
|
298
|
-
: null
|
|
299
|
-
const hostMem = performance.memory
|
|
300
|
-
? {
|
|
301
|
-
usedJSHeapSize: performance.memory.usedJSHeapSize,
|
|
302
|
-
totalJSHeapSize: performance.memory.totalJSHeapSize,
|
|
303
|
-
jsHeapSizeLimit: performance.memory.jsHeapSizeLimit,
|
|
304
|
-
}
|
|
305
|
-
: null
|
|
306
|
-
return {
|
|
307
|
-
tenant: normalize(stats?.memory),
|
|
308
|
-
shell: normalize(shell),
|
|
309
|
-
compositor: normalize(compositor),
|
|
310
|
-
hostHeap: hostMem,
|
|
311
|
-
}
|
|
312
|
-
})()`})??{tenant:null,shell:null,compositor:null,hostHeap:null}}function Oe(t){if(t.total===0)return"nothing recorded";let e=[],n=["error","warning","console","fetch","toast","alert","actionsheet","picker","notification","screen","route","keyboard","app-launch","shell","scroll","gesture","text-input","react-commit","animation","reanimated"],r=new Set;for(let s of n){let o=t.byKind[s];o&&(e.push(`${o} ${s}${o===1?"":"s"}`),r.add(s))}for(let[s,o]of Object.entries(t.byKind))!r.has(s)&&o&&e.push(`${o} ${s}${o===1?"":"s"}`);return e.join(" \xB7 ")}var De=new Set(["react-commit","layout","scroll"]);function K(t,e){if(e===null)return new Date(t).toLocaleTimeString();let n=(t-e)/1e3;return`${n>=0?"+":""}${n.toFixed(2)}s`}function Y(t,e){switch(t){case"app-launch":return e.phase==="launch"?`launch ${e.appName??e.toAppId??""}`:`dismiss ${e.appName??e.fromAppId??""} \u2192 ${e.toAppId??""}`;case"toast":return`"${e.text??""}"${e.durationMs?` (${e.durationMs}ms)`:""}`;case"keyboard":return`${e.phase??"?"}${e.heightPx?` h=${e.heightPx}`:""}${e.mode?` ${e.mode}`:""}`;case"screen":return`${e.phase??"?"} ${e.name??e.activeName??""}`;case"flow-step":return`${e.status??"?"} ${e.stepName??"step"}${e.durationMs?` ${e.durationMs}ms`:""}`;case"route":return`${e.phase??"?"} ${e.path??e.pathname??""}`;case"alert":case"actionsheet":case"picker":return`${e.phase??"?"} ${e.title??e.message??""}`;case"notification":return`${e.title??""}${e.body?` \u2014 ${e.body}`:""}`;case"fetch":return`${e.method??"GET"} ${e.url??""}${e.status?` -> ${e.status}`:""}`;case"console":case"console-log":return`${e.level??"log"}: ${(e.message??"").toString().slice(0,120)}`;case"shell":return`${e.event??e.type??e.phase??""}`;case"scroll":return`${e.phase??"?"} ${e.target??""}`;case"gesture":return`${e.phase??"?"} ${e.type??""}`;case"text-input":return`${e.phase??"?"}${e.value!==void 0?` "${String(e.value).slice(0,40)}"`:""}`;case"layout":return`${e.kind??"?"} ${e.testID??e.type??""}${e.skipped?` skipped:${e.reason??"unknown"}`:""}`;case"react-commit":{let n=e.slowest;return`${e.fiberCount??"?"} fibers ${e.durationMs??"?"}ms${n?.displayName?` \xB7 ${n.displayName} ${n.durationMs??"?"}ms`:""}`}case"frame":return`${e.totalMs??"?"}ms${e.renderMs?` \xB7 render ${e.renderMs}ms`:""}${e.layoutMs?` \xB7 layout ${e.layoutMs}ms`:""}${e.copyMs?` \xB7 copy ${e.copyMs}ms`:""}`;case"reanimated":case"animation":return`${e.kind??""} ${e.target??""}${e.durationMs?` ${e.durationMs}ms`:""}`}return""}function Pe(t,e){let n=K(t.t,e).padStart(8),r=t.context.padEnd(6),s=`[${t.kind}]`.padEnd(15),o=t.data,i=o&&typeof o=="object"?Y(t.kind,o):"";return` ${n} ${r} ${s} ${i}`}export{X as a,G as b,V as c,Z as d,ee as e,I as f,F as g,te as h,ne as i,oe as j,se as k,ie as l,ae as m,le as n,ue as o,ce as p,me as q,de as r,pe as s,ye as t,ge as u,be as v,fe as w,he as x,xe as y,Se as z,we as A,j as B,ve as C,ke as D,Ie as E,z as F,q as G,Re as H,$e as I,Ee as J,Me as K,Ne as L,Te as M,Le as N,Oe as O,De as P,Pe as Q};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*! rnx v0.1.375 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
-
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{a as w,b as E}from"./chunk-GEX7RVHY.js";import{P as _,Q as F,R as T,S as W,g as $}from"./chunk-HWDVC6YA.js";import ae from"node:fs";import S from"node:path";import{WebSocket as C}from"ws";var ye="http://localhost:7668/";function H(e){if(typeof e=="number")return Number.isInteger(e)&&e>0?e:null;if(typeof e!="string")return null;let r=e.trim();if(!r)return null;let t=Number(r);return Number.isInteger(t)&&t>0?t:null}function z(e){let r=H(e);return r===null?0:r}function V(e={}){let r=H(e.explicitPort);return r!==null?r:7668+z(e.portOffset)}var Q=5173;var Z=2e3;function _e(e){let r=e-7668;return r<0||r>Z?null:`http://localhost:${Q+r}/`}var Te=4001,Oe="sootsim close";var h="http://localhost:5173/";import{existsSync as ee,mkdirSync as re,readFileSync as te,rmSync as B,writeFileSync as ne}from"fs";import{tmpdir as ie}from"os";import{dirname as oe,join as se,resolve as le}from"path";var x=1,G="SOOTSIM_CLI_CURRENT_SIM_PATH",ce=["SOOTSIM_CLI_IDENTITY","TM_SESSION","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","TERM_SESSION_ID","ITERM_SESSION_ID","TMUX_PANE","STY","KITTY_WINDOW_ID","WEZTERM_PANE","ALACRITTY_WINDOW_ID","WINDOWID","VSCODE_INJECTION"],j=/^(?:tmux|screen)|^tm$/i;function q(e,r=20){let t=e,n=w(e);if(!n||n<=1){let i=E(e);return e>1&&i&&!j.test(i)?e:null}for(let i=0;i<r;i++){let s=E(n);if(s&&j.test(s))return t;let u=w(n);if(!u||u<=1)return s?n:t;t=n,n=u}return n}function v(){for(let r of ce){let t=process.env[r];if(t&&t.trim())return{key:`${r}:${t.trim()}`,source:r,stable:!0}}let e=q(process.ppid);return e&&e>1?{key:`gppid-${e}`,source:"grand-ppid",stable:!0}:{key:`pid-${process.ppid}`,source:"ppid",stable:!1}}function de(){return v().key}function Re(){return q(process.ppid)}function k(){if(process.env[G])return le(process.env[G]);let e=de();return se(ie(),`sootsim-current-sim-${e}.json`)}function ue(){let e=k();if(!ee(e))return null;try{let r=JSON.parse(te(e,"utf8"));return r.version!==x||typeof r.simId!="string"||!r.simId.trim()||typeof r.updatedAt!="string"?(B(e,{force:!0}),null):{version:x,simId:r.simId.trim(),updatedAt:r.updatedAt}}catch{return B(e,{force:!0}),null}}function R(){return ue()?.simId||null}function Ce(e){let r=e.trim();if(!r)return;let t=k();re(oe(t),{recursive:!0}),ne(t,JSON.stringify({version:x,simId:r,updatedAt:new Date().toISOString()},null,2)+`
|
|
5
|
-
`)}function J(){B(k(),{force:!0})}var me="RNX_PLACEMENT";function We(){return process.env[me]==="local-box"?"local-box":"host"}function Y(e){return`ws://localhost:${e}`}var L=null;function M(){return F().filter(e=>W(e))}function X(e){let r=S.resolve(e);for(;;){if(ae.existsSync(S.join(r,".git")))return r;let t=S.dirname(r);if(t===r)return null;r=t}}function K(e,r){let t=S.relative(e,r);return t===""||t!==".."&&!t.startsWith(`..${S.sep}`)&&!S.isAbsolute(t)}function fe(){let e=M();if(e.length===0)return null;if(process.env.SOOTSIM_BRIDGE_PORT!==void 0||process.env.PORT_OFFSET!==void 0){let t=V({explicitPort:process.env.SOOTSIM_BRIDGE_PORT,portOffset:process.env.PORT_OFFSET}),n=e.find(i=>i.bridgePort===t);if(n)return n}let r=null;try{r=process.cwd()}catch{}if(r){let t=X(r),n=e.filter(i=>{let s=X(i.cwd);return t&&s?t===s:K(r,i.cwd)||K(i.cwd,r)});if(n.length>0)return n.find(i=>i.bridgePort===7668)??n[0]}return e.find(t=>t.bridgePort===7668)??e[0]}function ge(){let e=$();if(L?.homeDir===e)return L.world;let r=pe();return L={homeDir:e,world:r},r}function pe(){let e=fe();if(e)return{source:"dev-bridge",bridgePort:e.bridgePort,shellBaseUrl:e.shellPort?`http://localhost:${e.shellPort}/`:h};let r=_();return r&&T(r)?{source:"daemon",bridgePort:r.bridgePort,shellBaseUrl:r.runtimePort>0?`http://localhost:${r.runtimePort}/`:h}:{source:"default",bridgePort:7668,shellBaseUrl:h}}function he(e){let r=M().find(n=>n.bridgePort===e);if(r)return{source:"dev-bridge",shellBaseUrl:r.shellPort?`http://localhost:${r.shellPort}/`:h};let t=_();return t&&T(t)&&t.bridgePort===e?{source:"daemon",shellBaseUrl:t.runtimePort>0?`http://localhost:${t.runtimePort}/`:h}:null}function He(e){let r;try{let i=new URL(e);r=i.port?Number(i.port):i.protocol==="https:"?443:80}catch{return null}if(!Number.isFinite(r)||r<=0)return null;let t=M().find(i=>i.shellPort===r||i.runtimePort===r||i.bridgePort===r);if(t)return t.bridgePort;let n=_();return n&&T(n)&&(n.runtimePort===r||n.bridgePort===r)?n.bridgePort:null}function Se(){return ge().bridgePort}function Ve(e,r){let t=he(e),n=t?.source==="dev-bridge"?"dev bridge":t?.source==="daemon"?"daemon bridge":"bridge",i=t?.source==="dev-bridge"?`dev-bridges/${e}.json`:t?.source==="daemon"?"daemon.json":"no lockfile",s=r??t?.shellBaseUrl;process.stderr.write(` \u2192 ${n} :${e} (${s?`shell ${s}, `:""}${i})
|
|
6
|
-
`)}var A=class extends Error{lock;constructor(r,t){super(r),this.name="BridgeSimLockedError",this.lock=t}};function be(e){return e==="flag"?"via --sim":e==="saved"?"saved via `rnx use`":"primary fallback \u2014 no sim pinned"}function Ge(e,r={}){let t=new Set,n=r.port??Se(),i=r.port!==void 0,s=r.commandTimeoutMs??15e3,u,a="none",I=new Set(r.stripBooleanFlags??[]),P=new Set(r.stripValueFlags??[]);for(let l=0;l<e.length;l++){let o=e[l];if(o==="--port"||o==="-p"){t.add(l),i=!0,l+1<e.length&&(t.add(l+1),n=Number(e[l+1])),l++;continue}if(o.startsWith("--port=")){t.add(l),i=!0,n=Number(o.slice(7));continue}if(o==="--timeout"){t.add(l),l+1<e.length&&(t.add(l+1),s=Number(e[l+1])),l++;continue}if(o==="--sim"||o==="--session"||o==="--tab"){t.add(l),l+1<e.length&&(t.add(l+1),u=e[l+1]?.trim()||void 0,a="flag"),l++;continue}let c=o.startsWith("--sim=")?o.slice(6):o.startsWith("--session=")?o.slice(10):o.startsWith("--tab=")?o.slice(6):void 0;if(c!==void 0){t.add(l),u=c.trim()||void 0,a="flag";continue}if(I.has(o)){t.add(l);continue}P.has(o)&&(t.add(l),l+1<e.length&&t.add(l+1),l++)}if(!u){let l=R();l&&(u=l.trim()||void 0,a="saved")}return{positional:e.filter((l,o)=>!t.has(o)),wsPort:n,explicitPort:i,simId:u,simIdSource:a,commandTimeoutMs:s}}function Ie(e,r={}){let t=1,n=r.commandTimeoutMs??15e3,i=new Map,s=new C(Y(e)),u=v(),a=new Promise((o,c)=>{s.on("open",()=>{try{s.send(JSON.stringify({type:"bridge:hello",id:0,cliIdentityKey:u.key,cliIdentitySource:u.source,cliLabel:r.cliLabel}))}catch{}o()}),s.on("error",d=>{let m=d.message?`: ${d.message}`:"";c(new Error(`could not connect to ${Y(e)}${m}`))})});a.catch(()=>{});let I=!1,P=!1;function l(o,c){if(P||process.env.SOOTSIM_QUIET_TARGET_NOTICE==="1"||o.startsWith("bridge:")||o==="focus"||o==="close")return;P=!0;let d=c??"primary",m=be(c?r.simIdSource:"none");process.stderr.write(` \u2192 ${d} (${m})
|
|
7
|
-
`)}return s.on("message",o=>{let c;try{c=JSON.parse(o.toString())}catch{return}if(c.id===0)return;let d=i.get(c.id);d&&(i.delete(c.id),c._otherCliCount>0&&!I&&(I=!0,process.stderr.write(`
|
|
8
|
-
\u26A0 ${c._otherCliCount} other CLI identity/identities are driving this sim
|
|
9
|
-
taps, scrolls, and keyboard input from multiple agents will collide on
|
|
10
|
-
the same screen state (this is not a bridge throughput limit).
|
|
11
|
-
use \`rnx open --new\` for an isolated sim per agent.
|
|
12
|
-
|
|
13
|
-
`)),c.error?c._locked?d.reject(new A(c.error,c._locked)):d.reject(new Error(c.error)):d.resolve(c.result))}),s.on("close",(o,c)=>{let d=c?.toString()||"connection closed";for(let[m,p]of i)i.delete(m),p.reject(new Error(`sim disconnected: ${d} (code ${o})`))}),{async send(o,c){let d=c?.timeoutMs??n,m=async f=>{await a;let g=t++;return new Promise((b,U)=>{let N=setTimeout(()=>{i.delete(g),U(new Error(`command timed out after ${Math.round(d/1e3)}s`))},d);i.set(g,{resolve:O=>{clearTimeout(N),b(O)},reject:O=>{clearTimeout(N),U(O)}});let y={...o,id:g};y.simId===void 0&&f&&(y.simId=f),l(o.type??"",y.simId),s.send(JSON.stringify(y))})},p=r.simIdSource==="flag"?r.simId:R()??r.simId;try{return await m(p)}catch(f){let g=f instanceof Error?f.message:String(f),b=`no sim connected with id ${p}`;throw r.simIdSource!=="flag"&&p&&o.simId===void 0&&(g===b||g.startsWith(`${b};`))?(J(),new Error(`saved sim ${p} is gone${g.slice(b.length)}; run \`rnx list\` and \`rnx use <sim>\`, or open a fresh sim`)):f}},async listSims(){let o=await this.send({type:"bridge:list-sims"});return Array.isArray(o)?o:[]},async focusSim(o){return this.send({type:"focus",simId:o})},async closeSim(o){return this.send({type:"close",simId:o})},async claim(o,c={}){return await this.send({type:"bridge:claim",simId:o,force:c.force===!0})},close(){try{s.readyState===C.OPEN&&s.send(JSON.stringify({type:"bridge:bye",id:0}))}catch{}s.close(),setTimeout(()=>{s.readyState!==C.CLOSED&&s.terminate()},250).unref()}}}function je(e){return Ie(e.wsPort,{commandTimeoutMs:e.commandTimeoutMs,simId:e.simId,simIdSource:e.simIdSource})}function Pe(e,r){let t=e.filter(s=>s.readyState==="open"&&s.id!==r),n=t.find(s=>s.userFocused)??t.find(s=>s.userVisible===!0&&s.isPrimary)??t.find(s=>s.userVisible===!0)??t.find(s=>s.isPrimary);if(!n)return null;let i=[n.isPrimary?"primary":null,n.userVisible===!1?"hidden":n.userVisible===!0?"visible":null,n.userFocused?"focused":null].filter(Boolean);return`${n.id}${i.length?` [${i.join(", ")}]`:""}`}async function qe(e){try{let r=await e.send({type:"evaluate",code:`(() => ({
|
|
14
|
-
hidden: document.hidden,
|
|
15
|
-
visibilityState: document.visibilityState,
|
|
16
|
-
hasFocus: typeof document.hasFocus === 'function' ? document.hasFocus() : null,
|
|
17
|
-
simId: window.__sootsimBridge?.id ?? window.SootSim?.state?.simId ?? null,
|
|
18
|
-
url: location.href
|
|
19
|
-
}))()`}),t=typeof r=="object"&&r!==null?r:{hidden:r===!0};if(t.hidden===!0===!0){let i=null;try{i=Pe(await e.listSims(),t.simId)}catch{}return process.stderr.write(`
|
|
20
|
-
\u26A0 target sim${t.simId?` ${t.simId}`:""} is hidden (document.hidden = true)
|
|
21
|
-
`+(t.visibilityState?` visibility: ${t.visibilityState}
|
|
22
|
-
`:"")+` animations and rAF callbacks are throttled \u2014 coordinates may be wrong
|
|
23
|
-
and launch/transition animations will not complete.
|
|
24
|
-
`+(i?` another open sim looks usable: ${i}; target it with --sim.
|
|
25
|
-
`:" run `rnx list` to find the visible sim and target it with --sim.\n")+` page-level window.focus() cannot unhide a browser tab.
|
|
26
|
-
|
|
27
|
-
`),{hidden:!0,warned:!0,simId:t.simId}}return{hidden:!1,warned:!1,simId:t.simId}}catch{return{hidden:!1,warned:!1}}}async function Je(e,r,t={}){let n={type:"evaluate",code:r};return t.acquireLock&&(n.acquireLock=!0),e.send(n)}async function Ye(e,r,...t){return e.send({type:"call",path:r,args:t})}async function Xe(e,r,...t){return e.send({type:"call",path:r,args:t,acquireLock:!0})}export{ye as a,_e as b,Te as c,Oe as d,de as e,Re as f,R as g,Ce as h,J as i,h as j,me as k,We as l,Y as m,ge as n,he as o,He as p,Se as q,Ve as r,A as s,Ge as t,Ie as u,je as v,qe as w,Je as x,Ye as y,Xe as z};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/*! rnx v0.1.375 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
-
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{t as j,v as A,y as U,z as v}from"./chunk-7NCPUZ52.js";import{c as P}from"./chunk-T4ISWS5H.js";import{createHash as Q}from"node:crypto";import{mkdirSync as W,readFileSync as q,readdirSync as X,unlinkSync as Z,writeFileSync as V}from"node:fs";import{dirname as G,extname as ee,resolve as B}from"node:path";function Y(t){let e=t[0]?.toLowerCase()??"toggle";return e!=="on"&&e!=="off"&&e!=="toggle"&&(console.error(` unknown argument: "${e}" (expected on | off | toggle)`),P(1)),e}async function L(t,e,n){let o=j(t,{port:e.port}),i=Y(o.positional),u=A({...o,commandTimeoutMs:5e3});try{let a=!!(await U(u,"SootSim.bridges.settings.get"))?.[n.modeKey],m=i==="on"?!0:i==="off"?!1:!a;if(a===m)return console.log(` ${n.displayName}: already ${m?"on":"off"}`),{current:a,target:m,changed:!1};if(!await u.send({type:"evaluate",acquireLock:!0,code:`(async () => {
|
|
5
|
-
const modeKey = ${JSON.stringify(n.modeKey)}
|
|
6
|
-
const target = ${JSON.stringify(m)}
|
|
7
|
-
window.dispatchEvent(new CustomEvent('sootsim:shell-command', {
|
|
8
|
-
detail: { type: 'fire-action', id: ${JSON.stringify(n.actionId)} },
|
|
9
|
-
}))
|
|
10
|
-
const deadline = Date.now() + 1200
|
|
11
|
-
while (Date.now() < deadline) {
|
|
12
|
-
if (Boolean(window.SootSim?.bridges?.settings?.get?.()?.[modeKey]) === target) {
|
|
13
|
-
return true
|
|
14
|
-
}
|
|
15
|
-
await new Promise((resolve) => setTimeout(resolve, 40))
|
|
16
|
-
}
|
|
17
|
-
return false
|
|
18
|
-
})()`}))throw new Error(`${n.displayName} did not change to ${m?"on":"off"}; the live shell may not support this mode`);return console.log(` ${n.displayName}: ${a?"on":"off"} -> ${m?"on":"off"}`),{current:a,target:m,changed:!0}}finally{u.close()}}var J=12e3,te=6e5,ne=new Set(["load","seek","play","pause","render","measure"]);async function ve(t,e){(t.includes("--help")||t.includes("-h"))&&(console.log(`
|
|
19
|
-
rnx mode three \u2014 toggle the 3d device stage
|
|
20
|
-
|
|
21
|
-
usage:
|
|
22
|
-
rnx mode three [on|off|toggle]
|
|
23
|
-
rnx mode three configure [options]
|
|
24
|
-
rnx mode three load <timeline.json>
|
|
25
|
-
rnx mode three seek <time-ms>
|
|
26
|
-
rnx mode three play|pause
|
|
27
|
-
rnx mode three render <timeline.json> --output <dir> [options]
|
|
28
|
-
rnx mode three measure <timeline.json> [options]
|
|
29
|
-
|
|
30
|
-
arguments:
|
|
31
|
-
on enable 3d mode
|
|
32
|
-
off disable 3d mode
|
|
33
|
-
toggle flip the current state (default)
|
|
34
|
-
|
|
35
|
-
configure options:
|
|
36
|
-
--device <id> set the phone body: iphone-17-air | iphone-17-pro |
|
|
37
|
-
pixel-10 (a film authors its own via initial.device)
|
|
38
|
-
--background <id> set the 3d background
|
|
39
|
-
--gradient <stops> custom gradient bg: comma-separated css hex stops,
|
|
40
|
-
e.g. "#0a0e1a,#16243f,#05080f" (overrides --background;
|
|
41
|
-
evenly spaced, or use "color@offset" for explicit %)
|
|
42
|
-
--gradient-angle <deg> custom gradient angle (default 180 = top\u2192bottom)
|
|
43
|
-
--colorway <id> set the phone colorway
|
|
44
|
-
--script <id> apply a camera preset pose
|
|
45
|
-
--progress <0..1> script progress to sample (default: 1)
|
|
46
|
-
--animate run the script instead of sampling one frame
|
|
47
|
-
--slow run the script slowly when --animate is set
|
|
48
|
-
--environment on|off enable or disable environment objects
|
|
49
|
-
--env-shape <id> orb | pill | diamond | pane
|
|
50
|
-
--env-spread <id> tight | medium | wide
|
|
51
|
-
--env-size <id> small | medium | large
|
|
52
|
-
--env-color <id> peach | gold | mint | sky | violet
|
|
53
|
-
--env-glow on|off enable or disable environment glow
|
|
54
|
-
--env-plastic on|off enable or disable environment plastic material
|
|
55
|
-
--setting <id> none | room | white-backdrop
|
|
56
|
-
--focus on|off enable or disable Focus depth of field
|
|
57
|
-
--focus-amount <id> subtle | medium | strong | intense | extreme
|
|
58
|
-
--focus-range <id> tight | balanced | wide
|
|
59
|
-
--reset-pose return to the default hero pose before other changes
|
|
60
|
-
|
|
61
|
-
render options:
|
|
62
|
-
--output <dir> write frame-%05d.png + timeline-render.json
|
|
63
|
-
--fps <number> frames per second (default: 30)
|
|
64
|
-
--width <px> exact output width (default: 1920)
|
|
65
|
-
--height <px> exact output height (default: 1080)
|
|
66
|
-
--from <ms> first timeline time (default: 0)
|
|
67
|
-
--to <ms> exclusive end time (default: timeline duration)
|
|
68
|
-
--overwrite replace this command's existing frames in the dir
|
|
69
|
-
|
|
70
|
-
measure options (projected bounds only \u2014 no pixels rendered):
|
|
71
|
-
--fps <number> sample rate (default: 30)
|
|
72
|
-
--width <px> output width the bounds project into (default: 1920)
|
|
73
|
-
--height <px> output height the bounds project into (default: 1080)
|
|
74
|
-
--from <ms> first timeline time (default: 0)
|
|
75
|
-
--to <ms> exclusive end time (default: timeline duration)
|
|
76
|
-
--count <n> sample n frames from --from at the --fps spacing
|
|
77
|
-
--at <ms[,ms...]> sample exact timeline times (overrides from/to/count)
|
|
78
|
-
--output <file.json> write the measurement JSON here instead of stdout
|
|
79
|
-
|
|
80
|
-
examples:
|
|
81
|
-
rnx mode three
|
|
82
|
-
rnx mode three on
|
|
83
|
-
rnx mode three configure --script hero-arc --background gradient-tide
|
|
84
|
-
rnx mode three configure --environment on --env-shape pane --setting room
|
|
85
|
-
rnx mode three render ./cinematic.json --output ./frames --fps 30
|
|
86
|
-
rnx mode three measure ./cinematic.json --width 450 --height 900 --at 0,1200
|
|
87
|
-
rnx mode three off
|
|
88
|
-
`),P(0));let n=se(t);if(n){await ue(n,t,e);return}if(oe(t)){await re(t,e);return}(await L(t,e,{modeKey:"threeMode",displayName:"three-mode",actionId:"toggle-three-mode"})).target&&await ie(t,e)}function oe(t){return t[0]==="configure"||t.some(e=>["--device","--background","--gradient","--gradient-angle","--colorway","--script","--progress","--animate","--slow","--environment","--env-shape","--env-spread","--env-size","--env-color","--env-glow","--env-plastic","--setting","--focus","--focus-amount","--focus-range","--reset-pose"].includes(e))}async function re(t,e){let n=j(t,{port:e.port,stripBooleanFlags:["--animate","--slow","--reset-pose"],stripValueFlags:["--device","--background","--gradient","--gradient-angle","--colorway","--script","--progress","--environment","--env-shape","--env-spread","--env-size","--env-color","--env-glow","--env-plastic","--setting","--focus","--focus-amount","--focus-range"]}),o=me(t),i=A({...n,commandTimeoutMs:J+1e3});try{await K(i);let u=await v(i,"SootSim.bridges.threeMode.configure",o);console.log(` three-mode: configured (${ce(u)})`)}finally{i.close()}}async function ie(t,e){let n=j(t,{port:e.port}),o=A({...n,commandTimeoutMs:J+1e3});try{await K(o)}finally{o.close()}}async function K(t){let e=await t.send({type:"evaluate",code:`(async () => {
|
|
89
|
-
const deadline = Date.now() + ${J}
|
|
90
|
-
while (Date.now() < deadline) {
|
|
91
|
-
const settings = window.SootSim?.bridges?.settings?.get?.()
|
|
92
|
-
if (settings && settings.threeMode !== true) {
|
|
93
|
-
return { ready: false, disabled: true }
|
|
94
|
-
}
|
|
95
|
-
const bridge = window.SootSim?.bridges?.threeMode
|
|
96
|
-
const state = typeof bridge?.getState === 'function' ? bridge.getState() : null
|
|
97
|
-
if (state?.ready === true) return state
|
|
98
|
-
await new Promise((resolve) => setTimeout(resolve, 50))
|
|
99
|
-
}
|
|
100
|
-
const bridge = window.SootSim?.bridges?.threeMode
|
|
101
|
-
const state = typeof bridge?.getState === 'function' ? bridge.getState() : null
|
|
102
|
-
return state || { ready: false }
|
|
103
|
-
})()`});if(e?.ready===!0)return e;throw e?.disabled?new Error("3d mode is off; run `rnx mode three on` before configure"):new Error("3d mode runtime did not become ready")}function se(t){for(let e=0;e<t.length;e+=1){let n=t[e];if(n==="--sim"||n==="--port"||n==="-p"){e+=1;continue}if(!n.startsWith("-"))return ne.has(n)?n:null}return null}function _(t,e){let n=t.indexOf(e);return n>=0?t[n+1]:void 0}function y(t,e,n,o=0){let i=_(t,e);if(i===void 0)return n;let u=Number.parseFloat(i);if(!Number.isFinite(u)||u<o)throw new Error(`${e} expects a number greater than or equal to ${o}`);return u}function H(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ae(t,e){let n=ee(t).toLowerCase();return e==="recording"?n===".mp4"||n===".m4v"?"video/mp4":"video/webm":n===".jpg"||n===".jpeg"?"image/jpeg":n===".webp"?"image/webp":"image/png"}function z(t,e){if(Array.isArray(t))return t.map(o=>z(o,e));if(!H(t))return t;let n={};for(let[o,i]of Object.entries(t))n[o]=z(i,e);if((n.type==="recording"||n.type==="screenshot"||n.kind==="screen")&&typeof n.src=="string"&&!/^(?:blob:|data:|https?:)/i.test(n.src)){let o=B(e,n.src),i=q(o);n.src=`data:${ae(o,n.type==="recording"?"recording":"screenshot")};base64,${i.toString("base64")}`}return n}function de(t){let e=B(t),n=JSON.parse(q(e,"utf8"));return{absolutePath:e,timeline:z(n,G(e))}}async function le(t){await v(t,"SootSim.bridges.settings.set","threeMode",!0),await K(t)}async function ue(t,e,n){let o=j(e,{port:n.port,commandTimeoutMs:te,stripBooleanFlags:["--overwrite"],stripValueFlags:["--output","--fps","--width","--height","--from","--to","--count","--at"]}),i=A(o);try{if(await le(i),t==="seek"){let r=o.positional[1],l=r===void 0?Number.NaN:Number.parseFloat(r);if(!Number.isFinite(l))throw new Error("three-mode seek expects time in ms");let f=await v(i,"SootSim.bridges.threeMode.seek",l);console.log(` three-mode: ${Math.round(f.timeMs)}ms / ${Math.round(f.durationMs)}ms (${f.shotId??"no shot"})`);return}if(t==="play"||t==="pause"){let r=await v(i,`SootSim.bridges.threeMode.${t}`),l=H(r.timeline)?r.timeline:{};console.log(` three-mode: ${t} (${Math.round(Number(l.timeMs??0))}ms)`);return}let u=o.positional[1];if(!u)throw new Error(`three-mode ${t} expects a timeline JSON path`);let T=de(u),a=await v(i,"SootSim.bridges.threeMode.loadTimeline",T.timeline);if(t==="load"){console.log(` three-mode: loaded ${T.absolutePath} (${Math.round(a.durationMs)}ms)`);return}if(t==="measure"){let r=y(e,"--fps",30,.001),l=Math.round(y(e,"--width",1920,1)),f=Math.round(y(e,"--height",1080,1)),h=_(e,"--at"),$;if(h!==void 0){let c=h.split(",").map(w=>{let S=Number.parseFloat(w);if(!Number.isFinite(S)||S<0)throw new Error(`--at expects comma-separated times in ms, got "${w}"`);return Math.min(S,a.durationMs)}),M=[];for(let w of c){let S=await v(i,"SootSim.bridges.threeMode.measure",{fps:r,width:l,height:f,from:w,count:1});M.push({...S.frames[0],index:M.length})}$={fps:r,from:c[0],to:c[c.length-1],width:l,height:f,frames:M}}else{let c=y(e,"--from",0,0),M=_(e,"--count"),w={fps:r,width:l,height:f,from:c};if(M===void 0){let S=y(e,"--to",a.durationMs,0);if(S<=c||S>a.durationMs)throw new Error(`--to must be greater than --from and at most ${a.durationMs}`);w.to=S}else w.count=Math.round(y(e,"--count",1,1));$=await v(i,"SootSim.bridges.threeMode.measure",w)}let b=`${JSON.stringify($,null,2)}
|
|
104
|
-
`,I=_(e,"--output");if(I){let c=B(I);W(G(c),{recursive:!0}),V(c,b),process.stderr.write(` three-mode: measured ${$.frames.length} frames \u2192 ${c}
|
|
105
|
-
`)}else process.stdout.write(b);return}let m=_(e,"--output");if(!m)throw new Error("three-mode render requires --output <dir>");let g=B(m),E=y(e,"--fps",30,.001),R=Math.round(y(e,"--width",1920,1)),k=Math.round(y(e,"--height",1080,1)),F=y(e,"--from",0,0),x=y(e,"--to",a.durationMs,0);if(x<=F||x>a.durationMs)throw new Error(`--to must be greater than --from and at most ${a.durationMs}`);let N=1e3/E,s=Math.ceil((x-F)/N);W(g,{recursive:!0});let p=X(g).filter(r=>/^frame-\d{5}\.png$/.test(r)||r==="timeline-render.json");if(p.length>0&&!e.includes("--overwrite"))throw new Error(`${g} already has timeline frames; pass --overwrite to replace them`);for(let r of p)Z(B(g,r));let d=[],O=4;for(let r=0;r<s;r+=O){let l=Math.min(O,s-r),f=F+r*N,h=Math.min(x,f+l*N),$=await v(i,"SootSim.bridges.threeMode.renderFrames",{fps:E,from:f,to:h,width:R,height:k,count:l});if($.frames.length!==l)throw new Error(`3d renderer returned ${$.frames.length} frames for a ${l}-frame batch`);for(let b of $.frames){let I=r+b.index,c=`frame-${String(I).padStart(5,"0")}.png`,M=b.dataUrl.indexOf(",");if(M<0||!b.dataUrl.slice(0,M).includes("image/png;base64"))throw new Error(`3d renderer returned a non-PNG frame at ${b.timeMs}ms`);let w=Buffer.from(b.dataUrl.slice(M+1),"base64");V(B(g,c),w),d.push({file:c,timeMs:b.timeMs,sha256:Q("sha256").update(w).digest("hex"),alpha:b.alpha,phoneCollision:b.phoneCollision})}process.stderr.write(`\r three-mode: rendered ${Math.min(r+l,s)}/${s}`)}process.stderr.write(`
|
|
106
|
-
`);let C={version:2,timeline:T.absolutePath,fps:E,from:F,to:x,width:R,height:k,frameCount:s,transparent:d.every(r=>r.alpha.transparentPixels>0),frames:d};V(B(g,"timeline-render.json"),`${JSON.stringify(C,null,2)}
|
|
107
|
-
`),console.log(` three-mode: wrote ${s} deterministic RGBA frames to ${g}`)}finally{i.close()}}function me(t){let e=s=>t.find((p,d)=>t[d-1]===s),n={},o=e("--device");if(o){if(o!=="iphone-17-air"&&o!=="iphone-17-pro"&&o!=="pixel-10")throw new Error(`--device expects iphone-17-air, iphone-17-pro, or pixel-10, got "${o}"`);n.device=o}let i=e("--colorway");i&&(n.colorway=i);let u=e("--background");u&&(n.background=u);let T=e("--gradient");if(T){let s=T.split(",").map(C=>C.trim()).filter(Boolean),p=s.map((C,r)=>{let[l,f]=C.split("@"),h=f!==void 0?Number.parseFloat(f):s.length>1?r/(s.length-1):0;return h>1&&(h=h/100),Number.isFinite(h)||(h=s.length>1?r/(s.length-1):0),{color:l.trim(),offset:h}}),d=e("--gradient-angle"),O=d===void 0?void 0:Number.parseFloat(d);if(d!==void 0&&!Number.isFinite(O))throw new Error(`--gradient-angle expects a number, got "${d}"`);n.customGradient={stops:p,...O!==void 0?{angleDeg:O}:{}}}let a=e("--setting");if(a){if(a!=="none"&&a!=="room"&&a!=="white-backdrop")throw new Error(`--setting expects none, room, or white-backdrop, got "${a}"`);n.setting=a}let m={},g=D(e("--focus"),"--focus");g!==void 0&&(m.enabled=g);for(let[s,p]of[["--focus-amount","amount"],["--focus-range","range"]]){let d=e(s);d&&(m[p]=d)}Object.keys(m).length>0&&(n.focus=m),t.includes("--reset-pose")&&(n.resetPose=!0);let E=D(e("--environment"),"--environment"),R={},k={};for(let[s,p]of[["--env-shape","shape"],["--env-spread","spread"],["--env-size","size"],["--env-color","color"]]){let d=e(s);d&&(R[p]=d)}let F=D(e("--env-glow"),"--env-glow");F!==void 0&&(k.glow=F);let x=D(e("--env-plastic"),"--env-plastic");x!==void 0&&(k.plastic=x),(E!==void 0||Object.keys(R).length>0||Object.keys(k).length>0)&&(n.environment=E===!1?!1:{pins:R,effects:k});let N=e("--script");if(N){let s=e("--progress"),p=s===void 0?1:Number.parseFloat(s);if(!Number.isFinite(p))throw new Error(`--progress expects a number from 0 to 1, got "${s}"`);n.script={id:N,progress:p,animate:t.includes("--animate"),slow:t.includes("--slow")}}return n}function D(t,e){if(t===void 0)return;let n=t.toLowerCase();if(["on","true","yes","1"].includes(n))return!0;if(["off","false","no","0"].includes(n))return!1;throw new Error(`${e} expects on or off, got "${t}"`)}function ce(t){return[`ready=${!!t.ready}`,`background=${String(t.background??"unknown")}`,`colorway=${String(t.colorway??"unknown")}`,`environment=${t.environmentActive?"on":"off"}`,`setting=${String(t.setting??"none")}`,`focus=${t.focus&&typeof t.focus=="object"&&t.focus.enabled?"on":"off"}`].join(", ")}export{L as a,ve as b,K as c,me as d};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*! rnx v0.1.375 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
-
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
var o=!0,e="public beta",t=e,n="we send anonymous error and dependency data while you use it";export{o as a,e as b,t as c,n as d};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*! rnx v0.1.375 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
-
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{execFileSync as S,execSync as x}from"node:child_process";var g=new WeakMap,l=new Set,b=!1;function f(){return{platform:process.platform,env:process.env}}function A(e){return S("/bin/ps",["-p",String(e),"-o","command="],{encoding:"utf8"}).trim()}function w(e=f()){return e.platform==="linux"&&e.env.GITHUB_ACTIONS==="true"&&e.env.RUNNER_OS==="Linux"}function L(e){let r=String(e);return/^--disable-gpu(?:=.*)?$/i.test(r)||/^--enable-unsafe-swiftshader(?:=.*)?$/i.test(r)||/^--use-angle=(?:swiftshader|swiftshader-webgl)$/i.test(r)||/^--use-gl=swiftshader$/i.test(r)}function I(e){return e.match(/(?:^|\s)(--disable-gpu(?:=[^\s]+)?|--enable-unsafe-swiftshader(?:=[^\s]+)?|--use-angle=(?:swiftshader|swiftshader-webgl)|--use-gl=swiftshader)(?=\s|$)/i)?.[1]??null}function k(e){return e==="darwin"?"metal":e==="linux"?"vulkan":"default"}function y(e,r=f()){if(w(r))return;let n=I(e);if(n)throw new Error(`[reap-browser] refused software-rendering Chrome process argument ${n}`);let o=k(r.platform),t=e.split(/\s+/);if(!t.includes(`--use-angle=${o}`)||!t.includes("--enable-gpu"))throw new Error(`[reap-browser] Chrome process did not retain the required ${o} GPU arguments`);if(r.platform==="darwin"&&e.includes("/Applications/Google Chrome.app/"))throw new Error("[reap-browser] refused the user's installed Google Chrome; use Playwright channel chromium")}function E(e){if(!e||typeof e!="object")return[];let n=e.gpu;if(!n||typeof n!="object")return[];let o=n,t=[],a=o.auxAttributes;if(a&&typeof a=="object")for(let s of Object.values(a))typeof s=="string"&&t.push(s);let i=o.devices;if(Array.isArray(i)){for(let s of i)if(!(!s||typeof s!="object"))for(let u of Object.values(s))typeof u=="string"&&t.push(u)}return t}function B(e){if(!e||typeof e!="object")return null;let r=e;if(!Array.isArray(r.processInfo))return null;for(let n of r.processInfo){if(!n||typeof n!="object")continue;let o=n;if(o.type==="browser"&&typeof o.id=="number"&&Number.isInteger(o.id)&&o.id>0)return o.id}return null}function G(e,r=f()){if(w(r))return;let o=E(e).join(" | ");if(!o||/swiftshader|llvmpipe|software rasterizer/i.test(o))throw new Error(`[reap-browser] Chrome reported a software renderer${o?`: ${o}`:""}`);if(r.platform==="darwin"&&!/metal/i.test(o))throw new Error(`[reap-browser] Chrome did not report an ANGLE Metal renderer: ${o}`)}function p(e){if(e&&typeof e=="object"){let n=g.get(e);if(n!==void 0)return n}let r=e;if(r&&typeof r.process=="function")try{let n=r.process();if(n&&typeof n.pid=="number"&&n.pid>0)return n.pid}catch{}if(r&&typeof r.browser=="function")try{let n=r.browser();if(n)return p(n)}catch{}return null}function h(e){let r=[];try{r=x(`pgrep -P ${e} || true`).toString().split(`
|
|
5
|
-
`).filter(Boolean)}catch{}for(let n of r)h(Number(n));try{process.kill(e,"SIGKILL")}catch{}}function d(e){let r=e;if(!r||typeof r!="object")return null;if(typeof r.newBrowserCDPSession=="function"||typeof r.process=="function")return r;if(typeof r.browser!="function")return null;try{let n=r.browser();return n?d(n):null}catch{return null}}function m(e,r,n){e&&typeof e=="object"&&g.set(e,n),g.set(r,n),l.add(n),C()}async function $(e){let r=p(e);if(r!==null)return r;let n=d(e);if(!n||typeof n.newBrowserCDPSession!="function")return null;let o=await n.newBrowserCDPSession();try{let t=B(await o.send("SystemInfo.getProcessInfo"));return t===null?null:(m(e,n,t),t)}finally{await o.detach?.()}}async function N(e){let r=p(e);if(r!==null){l.delete(r),h(r);return}let n=e;if(n&&typeof n.close=="function")try{await n.close()}catch{}}async function j(e,r,n,o=A){if(w(r))return;let t=p(e),a=d(e);t!==null&&a&&m(e,a,t),t!==null&&(r.platform==="darwin"||r.platform==="linux")&&y(o(t),r);let i=n?await n(e):e,s=d(i);if(s&&typeof s.newBrowserCDPSession=="function"){let u=await s.newBrowserCDPSession();try{let c=B(await u.send("SystemInfo.getProcessInfo"));if(c===null)throw new Error("[reap-browser] Chrome did not report its browser process id");m(e,s,c),i&&typeof i=="object"&&g.set(i,c),(r.platform==="darwin"||r.platform==="linux")&&y(o(c),r),G(await u.send("SystemInfo.getInfo"),r);return}finally{await u.detach?.()}}throw new Error("[reap-browser] could not validate the launched Chrome GPU renderer")}var D=!1;function C(){if(b)return;b=!0;let e=()=>{for(let r of l)h(r)};D||(process.on("SIGTERM",()=>{e(),process.exit(0)}),process.on("SIGINT",()=>{e(),process.exit(0)})),process.on("exit",e)}async function R(e){let r=await e(),n=p(r);if(n===null)try{n=await $(r)}catch{n=null}let o=new Set;n!=null&&(o.add(n),l.add(n),C());let t=d(r)??r;if(typeof t.on=="function"){let i=typeof t.newBrowserCDPSession=="function"?"disconnected":"close";t.on(i,()=>{for(let s of o)l.delete(s);o.clear()})}return{browser:r,reapNow:()=>{for(let i of o)h(i),l.delete(i);o.clear()}}}async function T(e){let{browser:r}=await R(e);return r}function W(e=process.platform){return["--enable-unsafe-webgpu",`--use-angle=${k(e)}`,"--enable-gpu","--enable-gpu-rasterization","--enable-zero-copy","--ignore-gpu-blocklist"]}function O(e={},r=f()){let n=Array.isArray(e.args)?e.args:[],o=n.find(L);if(o!==void 0)throw new Error(`[reap-browser] refused software-rendering Chrome launch argument ${String(o)}`);if(e.executablePath!==void 0)throw new Error("[reap-browser] executablePath bypasses Playwright Chrome for Testing and is not allowed");if(e.ignoreDefaultArgs===!0)throw new Error("[reap-browser] ignoreDefaultArgs=true bypasses required Chrome launch defaults");let t=new Set(["--enable-unsafe-webgpu","--enable-gpu","--enable-gpu-rasterization","--enable-zero-copy","--ignore-gpu-blocklist"]),a=n.filter(u=>{let c=String(u);return!t.has(c)&&!c.startsWith("--use-angle=")}),i=Array.isArray(e.ignoreDefaultArgs)?e.ignoreDefaultArgs:[],s=[...new Set([...i,"--disable-gpu","--enable-unsafe-swiftshader"])];return{...e,channel:"chromium",args:[...a,...W(r.platform)],ignoreDefaultArgs:s}}function v(e,r,n,o={}){return async()=>{let t=o.runtime??f();if(w(t))return e(P(r,t));let a=P(r,t),i;try{i=await e(a)}catch(s){let u=s instanceof Error?s.message:String(s);throw/not found at|not installed|Chromium distribution|Executable doesn't exist|No such file/i.test(u)?new Error("[reap-browser] Playwright Chrome for Testing is required for local GPU browser work. Run `bun scripts/ops/install-playwright-browsers.ts chromium`.",{cause:s}):s}try{await j(i,t,n,o.processCommand)}catch(s){throw await N(i),s}return i}}function z(e){if(e.ignoreDefaultArgs===!0)throw new Error("[reap-browser] ignoreDefaultArgs=true bypasses required Chrome launch defaults");let n=(Array.isArray(e.args)?e.args.map(String):[]).filter(t=>!t.startsWith("--use-angle=")&&t!=="--enable-gpu"&&t!=="--enable-gpu-rasterization"&&t!=="--enable-zero-copy"&&t!=="--ignore-gpu-blocklist"&&!/^--enable-unsafe-webgpu(?:=.*)?$/i.test(t)&&!/^--enable-features=(?:Vulkan|WebGPU)(?:,(?:Vulkan|WebGPU))*$/i.test(t)&&!/^--enable-unsafe-swiftshader(?:=.*)?$/i.test(t)),o={...e,args:[...n,"--use-angle=swiftshader","--enable-unsafe-swiftshader","--enable-unsafe-webgpu","--enable-features=Vulkan"]};return delete o.channel,delete o.executablePath,o}function P(e={},r=f()){return w(r)?z(e):O(e,r)}async function q(e,r={},n,o={}){return T(v(e,r,n,o))}async function J(e,r={},n,o={}){return R(v(e,r,n,o))}export{q as a,J as b};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*! rnx v0.1.375 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
-
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
var o=/^[A-Za-z][A-Za-z0-9+.-]*:/;function s(e){let t=e.trim();if(!t)throw new Error("expected <url-or-route>");return o.test(t)||t.startsWith("/")?t:`/${t}`}function p(e){let t=e.trim();return t?t.startsWith("/")?!0:o.test(t)?!/^https?:\/\//i.test(t):!1:!1}async function c(e,t){let n=s(t),r=await e.send({type:"call",path:"SootSim.bridges.test.openDeepLink",args:[n]});if(r!==null&&typeof r=="object"&&Reflect.get(r,"ok")===!1){let i=Reflect.get(r,"error");throw new Error(typeof i=="string"?i:"deep-link dispatch failed")}return n}export{p as a,c as b};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/*! rnx v0.1.375 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
-
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
function t(_){return`(async () => {
|
|
5
|
-
const __t = window.__sootsimTest
|
|
6
|
-
if (!__t) throw new Error('__sootsimTest not available')
|
|
7
|
-
const __id = ${JSON.stringify(_.id||"")}
|
|
8
|
-
const __text = ${JSON.stringify(_.text||"")}
|
|
9
|
-
let __node = null
|
|
10
|
-
if (__id) {
|
|
11
|
-
__node = (__t.findByTestId && await __t.findByTestId(__id)) ||
|
|
12
|
-
(__t.findById && await __t.findById(__id)) || null
|
|
13
|
-
} else if (__text) {
|
|
14
|
-
__node = __t.findByText ? await __t.findByText(__text) : null
|
|
15
|
-
}
|
|
16
|
-
if (!__node) return null
|
|
17
|
-
const __pos = __node.absolutePosition || { x: __node.layout?.x || 0, y: __node.layout?.y || 0 }
|
|
18
|
-
const __layout = __node.layout || {}
|
|
19
|
-
return {
|
|
20
|
-
x: __pos.x,
|
|
21
|
-
y: __pos.y,
|
|
22
|
-
w: __layout.width || 1,
|
|
23
|
-
h: __layout.height || 1,
|
|
24
|
-
}
|
|
25
|
-
})()`}function e(_){return`(async () => {
|
|
26
|
-
const __rect = ${JSON.stringify(_)}
|
|
27
|
-
const __screenshot = window.__sootsimScreenshot
|
|
28
|
-
if (typeof __screenshot !== 'function') {
|
|
29
|
-
throw new Error('screenshot bridge not installed')
|
|
30
|
-
}
|
|
31
|
-
const __dataUrl = await __screenshot({ crop: __rect })
|
|
32
|
-
const __img = await new Promise((res, rej) => {
|
|
33
|
-
const img = new Image()
|
|
34
|
-
img.onload = () => res(img)
|
|
35
|
-
img.onerror = () => rej(new Error('failed to decode cropped screenshot'))
|
|
36
|
-
img.src = __dataUrl
|
|
37
|
-
})
|
|
38
|
-
const __w = __img.naturalWidth
|
|
39
|
-
const __h = __img.naturalHeight
|
|
40
|
-
const __canvas = document.createElement('canvas')
|
|
41
|
-
__canvas.width = __w
|
|
42
|
-
__canvas.height = __h
|
|
43
|
-
const __ctx = __canvas.getContext('2d')
|
|
44
|
-
if (!__ctx) throw new Error('could not acquire 2d context')
|
|
45
|
-
__ctx.drawImage(__img, 0, 0)
|
|
46
|
-
const __data = __ctx.getImageData(0, 0, __w, __h).data
|
|
47
|
-
const __n = __data.length / 4
|
|
48
|
-
let __r = 0, __g = 0, __b = 0, __a = 0
|
|
49
|
-
for (let __i = 0; __i < __data.length; __i += 4) {
|
|
50
|
-
__r += __data[__i]
|
|
51
|
-
__g += __data[__i + 1]
|
|
52
|
-
__b += __data[__i + 2]
|
|
53
|
-
__a += __data[__i + 3]
|
|
54
|
-
}
|
|
55
|
-
const __round = (v) => Math.round(v / __n)
|
|
56
|
-
const __rr = __round(__r), __gg = __round(__g), __bb = __round(__b), __aa = __round(__a)
|
|
57
|
-
const __hex =
|
|
58
|
-
'#' +
|
|
59
|
-
[__rr, __gg, __bb]
|
|
60
|
-
.map((v) => v.toString(16).padStart(2, '0'))
|
|
61
|
-
.join('')
|
|
62
|
-
const __dpr = window.devicePixelRatio || 1
|
|
63
|
-
return {
|
|
64
|
-
r: __rr, g: __gg, b: __bb, a: __aa,
|
|
65
|
-
hex: __hex,
|
|
66
|
-
samples: __n,
|
|
67
|
-
rect: { x: __rect.x, y: __rect.y, w: __rect.w, h: __rect.h },
|
|
68
|
-
deviceWidth: __w / __dpr,
|
|
69
|
-
deviceHeight: __h / __dpr,
|
|
70
|
-
}
|
|
71
|
-
})()`}export{t as a,e as b};
|