rnxsim 0.1.339 → 0.1.341
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/app-config.ts +21 -1
- package/dist-cli/bin.js +5 -5
- package/dist-cli/chunks/{agent-HYXEA2DF.js → agent-2VZNJ5EK.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-XJKNKJGD.js → agent-wrapper-HUCI32H2.js} +2 -2
- package/dist-cli/chunks/{app-fonts-ECYIB477.js → app-fonts-X25CBLGM.js} +2 -2
- package/dist-cli/chunks/{assert-XVYWL4OL.js → assert-RC7CNDDD.js} +2 -2
- package/dist-cli/chunks/{auth-RP5LJWFS.js → auth-4P5ICOU7.js} +2 -2
- package/dist-cli/chunks/{beta-VBVPDQZD.js → beta-QHOS4FLY.js} +2 -2
- package/dist-cli/chunks/{camera-YVDG77OW.js → camera-XSDDJCA6.js} +2 -2
- package/dist-cli/chunks/{chunk-AVK2JHMK.js → chunk-233ZNBFD.js} +2 -2
- package/dist-cli/chunks/{chunk-KTL2LUE5.js → chunk-2X65F3HT.js} +1 -1
- package/dist-cli/chunks/{chunk-PTDAFVH5.js → chunk-2YG35MTR.js} +2 -2
- package/dist-cli/chunks/{chunk-WR3HAW34.js → chunk-4AXUIGKV.js} +2 -2
- package/dist-cli/chunks/{chunk-CIKEBWPF.js → chunk-4ECKZJFH.js} +1 -1
- package/dist-cli/chunks/{chunk-KAO5CST7.js → chunk-4GPFCG2O.js} +1 -1
- package/dist-cli/chunks/{chunk-7F3ZRIVD.js → chunk-4H6JNBY6.js} +2 -2
- package/dist-cli/chunks/{chunk-5TECC5CJ.js → chunk-4MLXHZHM.js} +2 -2
- package/dist-cli/chunks/{chunk-OGSAZBRR.js → chunk-4Q5BGK2P.js} +1 -1
- package/dist-cli/chunks/{chunk-QKMCPABX.js → chunk-52FRHDR5.js} +1 -1
- package/dist-cli/chunks/{chunk-7WQGK44R.js → chunk-53AW6GK5.js} +3 -3
- package/dist-cli/chunks/{chunk-3T22NM6B.js → chunk-5XINSS6Z.js} +2 -2
- package/dist-cli/chunks/{chunk-VCYL5IR3.js → chunk-6W2R675K.js} +1 -1
- package/dist-cli/chunks/{chunk-NG7EAN4Z.js → chunk-76IAWM7K.js} +2 -2
- package/dist-cli/chunks/{chunk-FN3MYVOI.js → chunk-7DDDFAWL.js} +2 -2
- package/dist-cli/chunks/{chunk-NZ4MVNIE.js → chunk-7HT77JWW.js} +1 -1
- package/dist-cli/chunks/{chunk-FPQ4EECQ.js → chunk-7NGLNCN6.js} +1 -1
- package/dist-cli/chunks/{chunk-HAPZCL5D.js → chunk-7WPJ6WLF.js} +2 -2
- package/dist-cli/chunks/{chunk-ST4IRWA6.js → chunk-7ZUYO4NL.js} +1 -1
- package/dist-cli/chunks/{chunk-BISFMRD6.js → chunk-AJ54R4E7.js} +2 -2
- package/dist-cli/chunks/{chunk-M3SKRWFU.js → chunk-BYYIT6KJ.js} +1 -1
- package/dist-cli/chunks/{chunk-Z2RU7GLW.js → chunk-DCDS3KAC.js} +2 -2
- package/dist-cli/chunks/{chunk-2AZOL3UF.js → chunk-EQFQ5HQO.js} +3 -3
- package/dist-cli/chunks/{chunk-GFHGRBLQ.js → chunk-F67L5MAP.js} +2 -2
- package/dist-cli/chunks/{chunk-76MUKN6C.js → chunk-FF2RR6C3.js} +1 -1
- package/dist-cli/chunks/{chunk-PRNSZ6B2.js → chunk-FKYMTZEX.js} +2 -2
- package/dist-cli/chunks/{chunk-GESUHR5O.js → chunk-G3PR7UQP.js} +2 -2
- package/dist-cli/chunks/{chunk-ROODJ6RF.js → chunk-I6A6OXPV.js} +1 -1
- package/dist-cli/chunks/{chunk-CNFXAL6Z.js → chunk-JHDSF45Z.js} +1 -1
- package/dist-cli/chunks/{chunk-SWW36H42.js → chunk-JQXE2VJ5.js} +2 -2
- package/dist-cli/chunks/{chunk-7H5BVBSN.js → chunk-K4WBNA57.js} +1 -1
- package/dist-cli/chunks/{chunk-QLIPEQVL.js → chunk-KDVRXHJ4.js} +2 -2
- package/dist-cli/chunks/{chunk-4NYMUV5O.js → chunk-KH2WSUUG.js} +2 -2
- package/dist-cli/chunks/{chunk-GGDZMFEK.js → chunk-L3PC6LFJ.js} +2 -2
- package/dist-cli/chunks/{chunk-XIEY6RUY.js → chunk-LD4Y4JIQ.js} +1 -1
- package/dist-cli/chunks/{chunk-76QEJTAT.js → chunk-LHG5TW5H.js} +3 -3
- package/dist-cli/chunks/{chunk-IWXDWYP4.js → chunk-LVVXPCZU.js} +2 -2
- package/dist-cli/chunks/{chunk-3R7KVPQ6.js → chunk-MMI4WQQV.js} +2 -2
- package/dist-cli/chunks/{chunk-ZE44MQ4K.js → chunk-NDUETWBJ.js} +2 -2
- package/dist-cli/chunks/{chunk-44PQEV6X.js → chunk-NKYFMLNX.js} +2 -2
- package/dist-cli/chunks/{chunk-42UB5N4I.js → chunk-QB3OJYP2.js} +1 -1
- package/dist-cli/chunks/{chunk-KPN5X2PV.js → chunk-QJSDXTPT.js} +1 -1
- package/dist-cli/chunks/{chunk-UMNOLET5.js → chunk-QSBX4L73.js} +2 -2
- package/dist-cli/chunks/{chunk-SS6FV24V.js → chunk-QWGOVJGL.js} +2 -2
- package/dist-cli/chunks/{chunk-ZVHDLFW6.js → chunk-RK3WWN2D.js} +3 -3
- package/dist-cli/chunks/{chunk-VYMD42C2.js → chunk-RQZ6VKLY.js} +2 -2
- package/dist-cli/chunks/{chunk-RBB3BPRM.js → chunk-SPNRKIFH.js} +2 -2
- package/dist-cli/chunks/{chunk-37CF2HGR.js → chunk-UFBBXUUZ.js} +1 -1
- package/dist-cli/chunks/{chunk-QCDZI56P.js → chunk-WCNBNVO4.js} +2 -2
- package/dist-cli/chunks/{chunk-IV4EVQFA.js → chunk-XPBSKCKS.js} +3 -3
- package/dist-cli/chunks/chunk-YZAD6XZI.js +4 -0
- package/dist-cli/chunks/{chunk-KW3TVLRH.js → chunk-ZDWXB3EA.js} +1 -1
- package/dist-cli/chunks/{chunk-VAR4NG7B.js → chunk-ZJSHTXBM.js} +1 -1
- package/dist-cli/chunks/{cleanup-4FUIYEXZ.js → cleanup-4KWMEI5G.js} +2 -2
- package/dist-cli/chunks/cli-version-Z4G2ESLX.js +4 -0
- package/dist-cli/chunks/{compat-N6MLQSAE.js → compat-INWNQKQV.js} +2 -2
- package/dist-cli/chunks/{config-VJQMQ2LP.js → config-F4DEDFMB.js} +2 -2
- package/dist-cli/chunks/{control-ONWYYQK6.js → control-SCM7VLMN.js} +2 -2
- package/dist-cli/chunks/daemon-DK4C6KYV.js +4 -0
- package/dist-cli/chunks/{debug-7WASIHHQ.js → debug-5WGWI2DL.js} +3 -3
- package/dist-cli/chunks/{desktop-TAX4UBZU.js → desktop-LWE4NVXH.js} +3 -3
- package/dist-cli/chunks/{detox-GUWYLR7G.js → detox-X67W4OC2.js} +2 -2
- package/dist-cli/chunks/{device-4CJWN2NQ.js → device-7WEEJ2U4.js} +2 -2
- package/dist-cli/chunks/{diagnose-PE6E6FIJ.js → diagnose-CCDNAIJT.js} +2 -2
- package/dist-cli/chunks/{disk-cleanup-NCNDW6UG.js → disk-cleanup-2O64YUCH.js} +2 -2
- package/dist-cli/chunks/drivers-V4T5FYDR.js +4 -0
- package/dist-cli/chunks/{film-3S5BWVCE.js → film-5WSW7OMT.js} +3 -3
- package/dist-cli/chunks/flow-ZYOGI4ND.js +4 -0
- package/dist-cli/chunks/help-67QX3FBL.js +4 -0
- package/dist-cli/chunks/{hidden-runtime-alias-5NJA6RDT.js → hidden-runtime-alias-TLECMPNB.js} +2 -2
- package/dist-cli/chunks/{home-paths-JEJ5BS23.js → home-paths-5T3CHQOF.js} +2 -2
- package/dist-cli/chunks/inspect-IUPBR46H.js +4 -0
- package/dist-cli/chunks/install-desktop-G27H2W2G.js +4 -0
- package/dist-cli/chunks/{login-WXWIBQ5C.js → login-XUMA7MZC.js} +4 -4
- package/dist-cli/chunks/{logout-WYOZ64JT.js → logout-JPZ4ELXD.js} +2 -2
- package/dist-cli/chunks/{maestro-VG64BSNR.js → maestro-SRSW7CGE.js} +3 -3
- package/dist-cli/chunks/{maestro-generate-7ILUVQKH.js → maestro-generate-7JB65LYP.js} +3 -3
- package/dist-cli/chunks/{mode-AWVXLR3D.js → mode-VEVCNMJ4.js} +2 -2
- package/dist-cli/chunks/{optional-demo-registry-RRH3SRSJ.js → optional-demo-registry-5ASZFFGW.js} +2 -2
- package/dist-cli/chunks/{perf-IDLWGRFE.js → perf-GNZYAEHH.js} +2 -2
- package/dist-cli/chunks/{permissions-YQOMEBOQ.js → permissions-2QOVZC5W.js} +2 -2
- package/dist-cli/chunks/{record-S76THKKB.js → record-UPBLVFFZ.js} +3 -3
- package/dist-cli/chunks/{report-issue-76TVGJYX.js → report-issue-5JLQSMQN.js} +2 -2
- package/dist-cli/chunks/reset-2OGMTXJO.js +4 -0
- package/dist-cli/chunks/runtime-FWJ7IWON.js +4 -0
- package/dist-cli/chunks/{screenshot-command-LLEQWW3R.js → screenshot-command-RWP5QECD.js} +3 -3
- package/dist-cli/chunks/{screenshot-layers-327WK2L3.js → screenshot-layers-KKQNFC2A.js} +2 -2
- package/dist-cli/chunks/{screenshots-capture-LHIBYR3R.js → screenshots-capture-P32K3R3A.js} +2 -2
- package/dist-cli/chunks/serve-YPY5Q7LF.js +118 -0
- package/dist-cli/chunks/{setup-H5EUUEOX.js → setup-OG6CDHRZ.js} +2 -2
- package/dist-cli/chunks/{skills-3KH5KUN4.js → skills-2W62A4VB.js} +2 -2
- package/dist-cli/chunks/{state-RZCVH5FJ.js → state-KPG5DSNA.js} +2 -2
- package/dist-cli/chunks/{storage-RRCXZVON.js → storage-SRRG2Q73.js} +2 -2
- package/dist-cli/chunks/store-NIZZF3ZI.js +4 -0
- package/dist-cli/chunks/telemetry-BANF55KR.js +4 -0
- package/dist-cli/chunks/{timeline-KE7BJKM5.js → timeline-RPN7Z4QD.js} +2 -2
- package/dist-cli/chunks/{upgrade-AE5U2CWH.js → upgrade-UKESJCPD.js} +2 -2
- package/dist-cli/chunks/upload-JM2R6DKU.js +4 -0
- package/dist-cli/chunks/{version-C5QGOCDN.js → version-SSQACF5S.js} +2 -2
- package/dist-cli/chunks/{web-GV7JJUAJ.js → web-YOEHGW6Z.js} +2 -2
- package/dist-cli/chunks/{what-happened-D6WMLM2M.js → what-happened-FJRIYKWS.js} +2 -2
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +203 -8
- 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 +236 -0
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +195 -8
- 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 +1 -1
- package/dist-lib/profiles.cjs +1 -1
- 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 +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +371 -155
- package/dist-lib/vite.cjs +188 -1
- package/package.json +6 -2
- package/skills/rnx-visual/SKILL.md +9 -3
- package/src/host/bridge-host.ts +9 -0
- package/src/host/replacement-module-handler.ts +220 -0
- package/src/vite-plugin-one.ts +7 -0
- package/dist-cli/chunks/chunk-K3JRFYYJ.js +0 -4
- package/dist-cli/chunks/cli-version-KVDXKEHT.js +0 -4
- package/dist-cli/chunks/daemon-XG3O4723.js +0 -4
- package/dist-cli/chunks/drivers-F73P7O5K.js +0 -4
- package/dist-cli/chunks/flow-7EO3TWAY.js +0 -4
- package/dist-cli/chunks/help-3GA4GYV6.js +0 -4
- package/dist-cli/chunks/inspect-VUH3UOVP.js +0 -4
- package/dist-cli/chunks/install-desktop-YFWELRMN.js +0 -4
- package/dist-cli/chunks/reset-TTWH3EGL.js +0 -4
- package/dist-cli/chunks/runtime-R6XCSUO7.js +0 -4
- package/dist-cli/chunks/serve-AI6WHUKJ.js +0 -44
- package/dist-cli/chunks/store-N6YWP4XP.js +0 -4
- package/dist-cli/chunks/telemetry-MI5XEML5.js +0 -4
- package/dist-cli/chunks/upload-THUL2TQZ.js +0 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{a as m,b as f}from"./chunk-
|
|
4
|
+
import{a as m,b as f}from"./chunk-G3PR7UQP.js";import{a as d}from"./chunk-QB3OJYP2.js";import"./chunk-KH2WSUUG.js";import{J as p}from"./chunk-JHDSF45Z.js";import{a as l}from"./chunk-4MLXHZHM.js";import"./chunk-4ECKZJFH.js";import"./chunk-4GPFCG2O.js";import{existsSync as h,readFileSync as w}from"node:fs";import{resolve as b}from"node:path";var R="https://contrast.dev",g=8e3;function v(){return{request:(t,e)=>fetch(t,e),confirmSubmission:d,isInteractive:process.stdin.isTTY===!0,now:()=>new Date,stdout:t=>process.stdout.write(t),stderr:t=>process.stderr.write(t)}}function I(t,e){let n=t.indexOf(e);if(n===-1)return null;let r=t[n+1];if(!r||r.startsWith("-"))throw new Error(`${e} requires a value`);return r}function D(t,e=process.cwd()){let n=I(t,"--app"),r=new Set,s=t.indexOf("--app");s!==-1&&(r.add(s),r.add(s+1));let a=[];for(let c=0;c<t.length;c+=1){if(r.has(c))continue;let u=t[c];if(!(u==="--yes"||u==="-y"||u==="--dry-run")){if(u.startsWith("-"))throw new Error(`unknown flag: ${u}`);a.push(u)}}let i=a.join(" ").trim();if(!i)throw new Error("describe the missing or broken compatibility behavior");if(i.length>g)throw new Error(`description is too long (maximum ${g} characters)`);return{appDir:b(e,n??"."),description:i,dryRun:t.includes("--dry-run"),yes:t.includes("--yes")||t.includes("-y")}}function y(t){if(!t||typeof t!="object")return;let e={};for(let n of Object.keys(t)){let r=Object.getOwnPropertyDescriptor(t,n)?.value;typeof r=="string"&&(e[n]=r)}return e}function O(t){let e=b(t,"package.json");if(!h(e))return null;let n;try{n=JSON.parse(w(e,"utf8"))}catch{throw new Error(`could not parse ${e}`)}if(!n||typeof n!="object")throw new Error(`${e} must contain a JSON object`);let r=Object.getOwnPropertyDescriptor(n,"name")?.value,s=Object.getOwnPropertyDescriptor(n,"dependencies")?.value,a=Object.getOwnPropertyDescriptor(n,"devDependencies")?.value,i=y(s),c=y(a);return{...typeof r=="string"?{name:r}:{},...i?{dependencies:i}:{},...c?{devDependencies:c}:{}}}async function S(t,e=new Date){let n=O(t.appDir),r=n?(await import("./web-YOEHGW6Z.js")).scanDeps(n):null,s=l(),a=p();return{note:t.description,timestamp:e.toISOString(),sootsim_version:a,cli_version:s,bundle:{activeApp:r&&r.projectName!=="unknown"?{appName:r.projectName}:null,reportSource:"cli",runtimeVersion:a,cliVersion:s,platform:process.platform,arch:process.arch,compatibility:r}}}function $(){let t=m(),e=t?.kind==="session"?t.origin.replace(/\/+$/,""):R,n=t&&t.kind!=="github"?f(t):null;return{url:`${e}/api/sootsim/report-issue`,authorization:n}}function k(t){if(!t)return"no package.json found; no compatibility scan attached";let e=t.packages.filter(n=>n.status!=="full"&&n.status!=="not-relevant").length;return`${t.packages.length} React Native ecosystem packages, ${e} needing attention`}function P(t){if(!t||typeof t!="object")return null;let e=Object.getOwnPropertyDescriptor(t,"id")?.value;return typeof e=="string"&&e?e:null}async function V(t,e=v()){let n;try{n=D(t)}catch(o){return e.stderr(` ${o instanceof Error?o.message:String(o)}
|
|
5
5
|
usage: rnx report-issue [--app <dir>] [--dry-run] [--yes] "<description>"
|
|
6
6
|
`),1}if(!h(n.appDir))return e.stderr(` directory not found: ${n.appDir}
|
|
7
7
|
`),1;let r;try{r=await S(n,e.now())}catch(o){return e.stderr(` could not prepare the issue report: ${o instanceof Error?o.message:String(o)}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! rnx v0.1.341 | (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}from"./chunk-QWGOVJGL.js";import"./chunk-4AXUIGKV.js";import"./chunk-FF2RR6C3.js";import"./chunk-233ZNBFD.js";import"./chunk-BYYIT6KJ.js";import"./chunk-JHDSF45Z.js";import"./chunk-4GPFCG2O.js";export{a as runReset};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{c as a}from"./chunk-XPBSKCKS.js";import"./chunk-YZAD6XZI.js";import"./chunk-LD4Y4JIQ.js";import"./chunk-L3PC6LFJ.js";import"./chunk-233ZNBFD.js";import"./chunk-BYYIT6KJ.js";import"./chunk-JHDSF45Z.js";import"./chunk-4ECKZJFH.js";import"./chunk-4GPFCG2O.js";export{a as runRuntime};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{a as ne,b as se,g as ie}from"./chunk-
|
|
4
|
+
import{a as ne,b as se,g as ie}from"./chunk-EQFQ5HQO.js";import{a as v}from"./chunk-K4WBNA57.js";import"./chunk-DCDS3KAC.js";import"./chunk-LHG5TW5H.js";import"./chunk-7NGLNCN6.js";import{a as ee}from"./chunk-I6A6OXPV.js";import{a as te}from"./chunk-NKYFMLNX.js";import"./chunk-7DDDFAWL.js";import"./chunk-2YG35MTR.js";import"./chunk-6W2R675K.js";import"./chunk-YZAD6XZI.js";import"./chunk-SPNRKIFH.js";import"./chunk-ZJSHTXBM.js";import"./chunk-JQXE2VJ5.js";import"./chunk-4H6JNBY6.js";import{a as re,b as oe}from"./chunk-G3PR7UQP.js";import"./chunk-QSBX4L73.js";import"./chunk-76IAWM7K.js";import"./chunk-LD4Y4JIQ.js";import"./chunk-FKYMTZEX.js";import"./chunk-4AXUIGKV.js";import{r as Z,s as Q}from"./chunk-FF2RR6C3.js";import"./chunk-2X65F3HT.js";import"./chunk-UFBBXUUZ.js";import"./chunk-NDUETWBJ.js";import"./chunk-LVVXPCZU.js";import"./chunk-KH2WSUUG.js";import"./chunk-4Q5BGK2P.js";import"./chunk-L3PC6LFJ.js";import"./chunk-5XINSS6Z.js";import"./chunk-KDVRXHJ4.js";import{b as F,e as P,f as j,g as I,h as L,i as U,j as R}from"./chunk-RK3WWN2D.js";import{q as A,r as K,s as B,t as X,u as J,v as M,w as $}from"./chunk-233ZNBFD.js";import"./chunk-BYYIT6KJ.js";import"./chunk-QJSDXTPT.js";import"./chunk-JHDSF45Z.js";import"./chunk-4ECKZJFH.js";import"./chunk-4GPFCG2O.js";import{mkdirSync as ce,writeFileSync as ae}from"fs";import{dirname as ue,resolve as de}from"path";async function pe(e,t){let r=Le(e);(r.includes("--help")||r.includes("-h"))&&(console.log(`
|
|
5
5
|
rnx screenshot \u2014 capture the canvas as a PNG
|
|
6
6
|
|
|
7
7
|
usage:
|
|
@@ -156,4 +156,4 @@ examples:
|
|
|
156
156
|
await new Promise((r) => setTimeout(r, 40))
|
|
157
157
|
}
|
|
158
158
|
return false
|
|
159
|
-
})()`,{acquireLock:!0}))throw new Error("could not enable screenshot mode \u2014 is this a browser sim with the screenshot plugin? (electron has no screenshot mode)")}function yt(e){console.log(` ${e.projectName} \u2014 canvas ${e.canvas} (${e.exportSize.width}\xD7${e.exportSize.height}), device ${e.deviceModel}`);for(let t of e.slides){let r=[t.focused?"focused":t.active?"active":null,t.captured?`captured${t.captureMode==="3d"?" 3d":""}`:"no capture"].filter(Boolean).join(", "),i=t.title?`"${t.title}"`:"(no title)",o=[`bg ${t.bgTop}\u2192${t.bgBottom}`,t.titleColor?`color ${t.titleColor}`:null,t.titleSize?`size ${t.titleSize}`:null,t.titleUnderlay?`underlay ${t.titleUnderlay}`:null,t.titleShadow?`shadow ${t.titleShadow}`:null].filter(Boolean).join(", ");console.log(` ${t.index}. ${i} \u2014 ${o} [${r}]`),t.subtitle&&console.log(` ${t.subtitle}`)}}function bt(e){let t=e.match(/^data:[^;]+;base64,(.+)$/);if(!t)throw new Error("export returned an unexpected payload");return Buffer.from(t[1],"base64")}async function Fe(e,t){if(e.includes("--help")||e.includes("-h")){console.log(mt);return}let{rest:r,values:i,json:o}=ft(e),s=A(r,{port:t.port,commandTimeoutMs:45e3}),n=s.positional[0]??"list",a=gt(s.positional[1]),l=Number(s.positional[2]),c=B(s),u=d=>{o?console.log(JSON.stringify(d,null,2)):yt(d)};try{switch(await wt(c),n){case"list":{u(await M(c,"SootSim.bridges.screenshotControl.getState"));break}case"set":{if(a==null)throw new Error("usage: rnx screenshot slides set <n> --title \u2026 (see --help)");let d={};for(let m of["title","subtitle","bgTop","bgBottom","titleColor","titleSize","titleUnderlay","titleShadow"])i[m]!=null&&(d[m]=i[m]);if(Object.keys(d).length===0)throw new Error("nothing to set \u2014 pass at least one field (see --help)");u(await $(c,"SootSim.bridges.screenshotControl.setSlide",a,d));break}case"add":{u(await $(c,"SootSim.bridges.screenshotControl.addSlide"));break}case"remove":{if(a==null)throw new Error("usage: rnx screenshot slides remove <n>");u(await $(c,"SootSim.bridges.screenshotControl.removeSlide",a));break}case"move":{if(a==null||!Number.isInteger(l)||l<1)throw new Error("usage: rnx screenshot slides move <n> <position>");u(await $(c,"SootSim.bridges.screenshotControl.moveSlide",a,l));break}case"focus":{if(a==null)throw new Error("usage: rnx screenshot slides focus <n>");u(await $(c,"SootSim.bridges.screenshotControl.focusSlide",a));break}case"overview":{u(await $(c,"SootSim.bridges.screenshotControl.overview"));break}case"capture":{let d=await $(c,"SootSim.bridges.screenshotControl.capture",...a!=null?[a]:[]);u(d);break}case"export":{let d=i.out?dt(i.out)?i.out:pt(process.cwd(),i.out):Ee(process.cwd(),"screenshots"),m=await M(c,"SootSim.bridges.screenshotControl.getState"),h=a!=null?m.slides.filter(p=>p.index===a||p.id===a):m.slides.filter(p=>p.captured);if(h.length===0)throw new Error(a!=null?`no slide ${a}`:"no captured slides to export \u2014 capture first");let w=[];for(let p of h){let y=await M(c,"SootSim.bridges.screenshotControl.exportSlide",p.index),f=Ee(d,y.name);lt(ut(f),{recursive:!0}),ct(f,bt(y.dataUrl)),w.push(f),console.log(` saved: ${f} (${y.width}\xD7${y.height})`)}o&&console.log(JSON.stringify({written:w},null,2));break}default:throw new Error(`unknown subcommand "${n}" \u2014 see rnx screenshot slides --help`)}}finally{c.close()}}var St=new Set(["--sim","--port","-p","--output","-o","--out","--plan","--app","--device","--org","--repo","--api-origin","--branch","--platform","--slides","--shell-origin","--timeout","--ids","--out-dir"]),xt=new Set(["capture","slides","appstore","layers"]);function Re(e){for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("-")){St.has(r)&&t++;continue}return xt.has(r)?{name:r,index:t}:null}return null}function E(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function Pt(e){let t=[];for(let r=0;r<e.length;r++){if(e[r]==="--sim"){r++;continue}t.push(e[r])}return t}async function xr(e,t){let r=Re(e);if(!r||r.name==="capture"){await pe(r?E(e,r.index):e,t);return}if(r.name==="slides"){await Fe(E(e,r.index),t);return}if(r.name==="layers"){let{runScreenshotLayers:s}=await import("./screenshot-layers-
|
|
159
|
+
})()`,{acquireLock:!0}))throw new Error("could not enable screenshot mode \u2014 is this a browser sim with the screenshot plugin? (electron has no screenshot mode)")}function yt(e){console.log(` ${e.projectName} \u2014 canvas ${e.canvas} (${e.exportSize.width}\xD7${e.exportSize.height}), device ${e.deviceModel}`);for(let t of e.slides){let r=[t.focused?"focused":t.active?"active":null,t.captured?`captured${t.captureMode==="3d"?" 3d":""}`:"no capture"].filter(Boolean).join(", "),i=t.title?`"${t.title}"`:"(no title)",o=[`bg ${t.bgTop}\u2192${t.bgBottom}`,t.titleColor?`color ${t.titleColor}`:null,t.titleSize?`size ${t.titleSize}`:null,t.titleUnderlay?`underlay ${t.titleUnderlay}`:null,t.titleShadow?`shadow ${t.titleShadow}`:null].filter(Boolean).join(", ");console.log(` ${t.index}. ${i} \u2014 ${o} [${r}]`),t.subtitle&&console.log(` ${t.subtitle}`)}}function bt(e){let t=e.match(/^data:[^;]+;base64,(.+)$/);if(!t)throw new Error("export returned an unexpected payload");return Buffer.from(t[1],"base64")}async function Fe(e,t){if(e.includes("--help")||e.includes("-h")){console.log(mt);return}let{rest:r,values:i,json:o}=ft(e),s=A(r,{port:t.port,commandTimeoutMs:45e3}),n=s.positional[0]??"list",a=gt(s.positional[1]),l=Number(s.positional[2]),c=B(s),u=d=>{o?console.log(JSON.stringify(d,null,2)):yt(d)};try{switch(await wt(c),n){case"list":{u(await M(c,"SootSim.bridges.screenshotControl.getState"));break}case"set":{if(a==null)throw new Error("usage: rnx screenshot slides set <n> --title \u2026 (see --help)");let d={};for(let m of["title","subtitle","bgTop","bgBottom","titleColor","titleSize","titleUnderlay","titleShadow"])i[m]!=null&&(d[m]=i[m]);if(Object.keys(d).length===0)throw new Error("nothing to set \u2014 pass at least one field (see --help)");u(await $(c,"SootSim.bridges.screenshotControl.setSlide",a,d));break}case"add":{u(await $(c,"SootSim.bridges.screenshotControl.addSlide"));break}case"remove":{if(a==null)throw new Error("usage: rnx screenshot slides remove <n>");u(await $(c,"SootSim.bridges.screenshotControl.removeSlide",a));break}case"move":{if(a==null||!Number.isInteger(l)||l<1)throw new Error("usage: rnx screenshot slides move <n> <position>");u(await $(c,"SootSim.bridges.screenshotControl.moveSlide",a,l));break}case"focus":{if(a==null)throw new Error("usage: rnx screenshot slides focus <n>");u(await $(c,"SootSim.bridges.screenshotControl.focusSlide",a));break}case"overview":{u(await $(c,"SootSim.bridges.screenshotControl.overview"));break}case"capture":{let d=await $(c,"SootSim.bridges.screenshotControl.capture",...a!=null?[a]:[]);u(d);break}case"export":{let d=i.out?dt(i.out)?i.out:pt(process.cwd(),i.out):Ee(process.cwd(),"screenshots"),m=await M(c,"SootSim.bridges.screenshotControl.getState"),h=a!=null?m.slides.filter(p=>p.index===a||p.id===a):m.slides.filter(p=>p.captured);if(h.length===0)throw new Error(a!=null?`no slide ${a}`:"no captured slides to export \u2014 capture first");let w=[];for(let p of h){let y=await M(c,"SootSim.bridges.screenshotControl.exportSlide",p.index),f=Ee(d,y.name);lt(ut(f),{recursive:!0}),ct(f,bt(y.dataUrl)),w.push(f),console.log(` saved: ${f} (${y.width}\xD7${y.height})`)}o&&console.log(JSON.stringify({written:w},null,2));break}default:throw new Error(`unknown subcommand "${n}" \u2014 see rnx screenshot slides --help`)}}finally{c.close()}}var St=new Set(["--sim","--port","-p","--output","-o","--out","--plan","--app","--device","--org","--repo","--api-origin","--branch","--platform","--slides","--shell-origin","--timeout","--ids","--out-dir"]),xt=new Set(["capture","slides","appstore","layers"]);function Re(e){for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("-")){St.has(r)&&t++;continue}return xt.has(r)?{name:r,index:t}:null}return null}function E(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function Pt(e){let t=[];for(let r=0;r<e.length;r++){if(e[r]==="--sim"){r++;continue}t.push(e[r])}return t}async function xr(e,t){let r=Re(e);if(!r||r.name==="capture"){await pe(r?E(e,r.index):e,t);return}if(r.name==="slides"){await Fe(E(e,r.index),t);return}if(r.name==="layers"){let{runScreenshotLayers:s}=await import("./screenshot-layers-KKQNFC2A.js");await s(E(e,r.index),t);return}let i=E(e,r.index),o=Re(i);if(o?.name==="capture")try{let{runScreenshotsCapture:s}=await import("./screenshots-capture-P32K3R3A.js");return await s(Pt(E(i,o.index)))}catch(s){if(s instanceof Error&&"code"in s&&s.code==="ERR_MODULE_NOT_FOUND")return console.error("screenshot appstore capture is repo-only tooling \u2014 it needs the rnx workspace (playwright is not shipped with the published CLI)."),1;throw s}return De(i,t)}export{xr as runScreenshotCommand};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{a as S}from"./chunk-
|
|
4
|
+
import{a as S}from"./chunk-I6A6OXPV.js";import"./chunk-6W2R675K.js";import"./chunk-FKYMTZEX.js";import{r as b,s as I}from"./chunk-FF2RR6C3.js";import"./chunk-KDVRXHJ4.js";import{b as m}from"./chunk-RK3WWN2D.js";import{q as y,s as v,v as w}from"./chunk-233ZNBFD.js";import"./chunk-BYYIT6KJ.js";import"./chunk-JHDSF45Z.js";import"./chunk-4GPFCG2O.js";import{mkdirSync as B,writeFileSync as R}from"fs";import{resolve as f}from"path";async function L(s,$){(s.includes("--help")||s.includes("-h"))&&(console.log(`
|
|
5
5
|
sootsim screenshot layers \u2014 export a screen as engine-isolated layers
|
|
6
6
|
|
|
7
7
|
usage:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{b as U}from"./chunk-
|
|
4
|
+
import{b as U}from"./chunk-K4WBNA57.js";import{a as M}from"./chunk-G3PR7UQP.js";import"./chunk-KH2WSUUG.js";import"./chunk-JHDSF45Z.js";import{a as F}from"./chunk-4ECKZJFH.js";import"./chunk-4GPFCG2O.js";import{execSync as N}from"node:child_process";import{mkdirSync as O,mkdtempSync as E,rmSync as j,writeFileSync as G}from"node:fs";import{tmpdir as q}from"node:os";import{dirname as B,isAbsolute as L,join as I,resolve as z}from"node:path";import{chromium as W}from"playwright-core";var H=`
|
|
5
5
|
rnx screenshot appstore capture \u2014 headlessly capture + upload App Store slides
|
|
6
6
|
|
|
7
7
|
usage:
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{b as ve,c as J,d as we,e as K,f as Ae,h as Te,i as R,j as Ce,k as Ee,l as xe,m as ke,q as Ie,t as C,u as Re,v as Pe,w as _e,x as Oe}from"./chunk-AJ54R4E7.js";import"./chunk-7HT77JWW.js";import{a as he,b as fe,d as ge,e as M,f as Se}from"./chunk-2YG35MTR.js";import{e as be}from"./chunk-4H6JNBY6.js";import"./chunk-G3PR7UQP.js";import{d as ye}from"./chunk-QSBX4L73.js";import{g as L}from"./chunk-76IAWM7K.js";import"./chunk-LD4Y4JIQ.js";import"./chunk-2X65F3HT.js";import{a as W,b as q,c as de,d as le}from"./chunk-LVVXPCZU.js";import"./chunk-KH2WSUUG.js";import{f as O}from"./chunk-L3PC6LFJ.js";import{c as pe,d as me}from"./chunk-233ZNBFD.js";import"./chunk-BYYIT6KJ.js";import{A as $,B as Q,G as ee,I as _,J as j,K as te,L as ie,M as re,O as ne,R as se,S as oe,T as ae,U as V,V as ce,g as Y,h as X,r as Z}from"./chunk-JHDSF45Z.js";import{a as ue}from"./chunk-4MLXHZHM.js";import"./chunk-4ECKZJFH.js";import"./chunk-4GPFCG2O.js";import{spawn as Ot}from"child_process";import T from"fs";import{createServer as Lt}from"http";import v from"path";import{WebSocket as S,WebSocketServer as Mt}from"ws";import Me from"node:fs";import D from"node:path";import{spawn as et}from"node:child_process";function tt(o){return typeof o.text=="string"?o.text.trim():""}function it(o){let e=o?.trim();return e||"tm"}async function Le(o){let e=o.sessionId.trim();if(!q(e))throw new Error(`invalid Team Machine session id: ${e||"<empty>"}`);let t=tt(o.prompt);if(!t)throw new Error("prompt text is empty");let i=it(o.command),s=o.timeoutMs??15e3;await new Promise((n,c)=>{let r=et(i,["send",e,t],{stdio:["ignore","ignore","pipe"],env:process.env}),a="",l=setTimeout(()=>{try{r.kill("SIGTERM")}catch{}c(new Error(`tm send timed out after ${Math.round(s/1e3)}s`))},s);r.stderr?.setEncoding("utf8"),r.stderr?.on("data",d=>{a.length<4e3&&(a+=String(d))}),r.on("error",d=>{clearTimeout(l),c(d)}),r.on("exit",(d,u)=>{if(clearTimeout(l),d===0){n();return}let p=a.trim();c(new Error(p||`tm send exited with ${u?`signal ${u}`:`code ${d??"unknown"}`}`))})})}var N=1,rt=25;function nt(){return[Number(process.env.VITE_PORT_WEB||process.env.PORT||3e3),Number(process.env.VITE_PORT_ZERO||7849),Number(process.env.VITE_PORT_R2||9500)].filter(o=>Number.isFinite(o)&&o>0)}var B=class{subscriptions=new Map;sessionsBySocket=new Map;allSockets=new Set;pendingPromptEchoes=new Map;pendingTurns=new Map;pendingSessionStates=new Map;pendingSessionPatches=new Map;sessionStatusPersistTimer=null;opts;constructor(e={}){this.opts=e}registerSocket(e){this.allSockets.add(e)}unregisterSocket(e){let t=this.sessionsBySocket.get(e);if(t){for(let i of t)this.decrementSubscription(i);this.sessionsBySocket.delete(e)}this.allSockets.delete(e)}async handleMessage(e,t){let i=t?.type;if(typeof i!="string"||!i.startsWith("agent:"))return!1;let s=t.id;try{let n=await this.dispatch(e,i,t);this.respond(e,s,n)}catch(n){n instanceof C?this.respondError(e,s,n.message,n.code):this.respondError(e,s,n instanceof Error?n.message:String(n))}return!0}async seedOnBoot(){try{await ke()}catch(e){process.stderr.write(`[sootsim-agent] seedFromDemoAppRegistry failed: ${e instanceof Error?e.message:String(e)}
|
|
5
|
+
`)}}close(){this.sessionStatusPersistTimer&&(clearTimeout(this.sessionStatusPersistTimer),this.sessionStatusPersistTimer=null),this.flushSessionStatuses();for(let e of this.subscriptions.values())try{e.unsubscribe()}catch{}this.subscriptions.clear(),this.sessionsBySocket.clear(),this.allSockets.clear()}async dispatch(e,t,i){switch(t){case"agent:list-projects":return K();case"agent:upsert-project":return J(i.input??{});case"agent:delete-project":return Te(String(i.projectId)),{ok:!0};case"agent:auto-attach-for-url":return this.autoAttachForUrl(i.input??{});case"agent:list-sessions":return Ce(i.projectId?String(i.projectId):void 0);case"agent:start-session":return this.doStartSession(i.input??{});case"agent:send-claimed-prompt":return this.sendClaimedPrompt(i);case"agent:send-prompt":{let n=String(i.sessionId),c=R(n);if(!c)throw new C("NO_SESSION",`no session: ${n}`);let r=this.normalizePromptEnvelope(i);return await Pe(n,r),this.notePromptAccepted(n,r,c.status==="working")}case"agent:end-session":this.dropSessionFanout(String(i.sessionId)),await _e(String(i.sessionId));let s=R(String(i.sessionId));return s&&this.broadcastSessionStatus(s),{ok:!0};case"agent:get-transcript":return this.getTranscript(String(i.sessionId));case"agent:get-paths":return this.getPaths();case"agent:subscribe-events":return this.subscribeSocket(e,String(i.sessionId));case"agent:unsubscribe-events":return this.unsubscribeSocket(e,String(i.sessionId));default:throw new C("UNKNOWN_AGENT_MSG",`unknown agent message: ${t}`)}}async sendClaimedPrompt(e){let t=typeof e.simId=="string"?e.simId.trim():"";if(!t)throw new C("NO_SIM","agent:send-claimed-prompt requires simId");let i=this.opts.resolveCliLease?.(t)??null;if(!i||i.kind!=="cli"||i.expiresAt<=Date.now())throw new C("NO_CLAIM",`sim ${t} has no active CLI claim`);let s=W(i.cliIdentityKey);if(!s)throw new C("UNSUPPORTED_CLAIM",`sim ${t} is claimed by a CLI identity that is not promptable`);return await Le({sessionId:s,prompt:this.normalizePromptEnvelope(e)}),{ok:!0,routed:"team-machine",sessionId:s}}async doStartSession(e){if(!we(e.projectId))throw new C("NO_PROJECT",`no project: ${e.projectId}`);let i=await Re(e);return this.broadcastSessionStatus(i.session),i}async autoAttachForUrl(e){let t=e.bundleUrl??"",i=(()=>{try{return new URL(t).port||null}catch{return null}})();if(!i)return{project:null};let s=this.opts.getExcludePorts?.()??nt(),c=(await L({excludePorts:s})).find(d=>String(d.port)===i);if(!c||!c.cwd)return{project:null};let r=K().find(d=>d.cwd===c.cwd)??null,a=Array.from(new Set([...r?.knownBundleUrls??[],c.bundleUrl,t]));return{project:J({cwd:c.cwd,name:c.projectName??D.basename(c.cwd),preferredProvider:e.provider??r?.preferredProvider,sourceRoots:r?.sourceRoots??[c.cwd],knownBundleUrls:a,framework:r?.framework??st(c.framework),bundleId:c.bundleId??r?.bundleId})}}getTranscript(e){let t=Ie(e);return Me.existsSync(t)?Me.readFileSync(t,"utf8"):{error:"transcript not found",code:"NO_TRANSCRIPT"}}getPaths(){let e=ve();return{userDataDir:e,storeFile:D.join(e,"attached-projects.json"),sessionsDir:D.join(e,"sessions"),transcriptsDir:D.join(e,"transcripts")}}subscribeSocket(e,t){let i=this.sessionsBySocket.get(e);if(i||(i=new Set,this.sessionsBySocket.set(e,i)),i.has(t))return{ok:!0,refCount:this.subscriptions.get(t)?.refCount??1};i.add(t);let s=this.subscriptions.get(t);if(s)return s.refCount++,{ok:!0,refCount:s.refCount};let n=Oe(t,c=>{let r=this.coalescePromptEcho(t,c);if(r&&(this.applySessionEvent(t,r),this.fanOutEvent(t,r)),c.type==="turn-completed"){let a=R(t);if(a)try{Ae(a.projectId,{usd:c.costUsd,ts:c.ts})}catch(l){process.stderr.write(`[sootsim-agent] recordTurnTelemetry failed: ${l instanceof Error?l.message:String(l)}
|
|
6
|
+
`)}}});return this.subscriptions.set(t,{unsubscribe:n,refCount:1}),{ok:!0,refCount:1}}unsubscribeSocket(e,t){let i=this.sessionsBySocket.get(e);return!i||!i.has(t)?{ok:!0,refCount:0}:(i.delete(t),this.decrementSubscription(t))}decrementSubscription(e){let t=this.subscriptions.get(e);if(!t)return{ok:!0,refCount:0};if(t.refCount--,t.refCount<=0){try{t.unsubscribe()}catch{}return this.subscriptions.delete(e),{ok:!0,refCount:0}}return{ok:!0,refCount:t.refCount}}dropSessionFanout(e){let t=this.subscriptions.get(e);if(t){try{t.unsubscribe()}catch{}this.subscriptions.delete(e)}for(let i of this.sessionsBySocket.values())i.delete(e);this.clearPromptTracking(e)}normalizePromptEnvelope(e){if(e?.prompt&&typeof e.prompt=="object"){let t=e.prompt;return{text:String(t.text??""),...typeof t.displayText=="string"?{displayText:t.displayText}:{},...typeof t.inspectSummary=="string"?{inspectSummary:t.inspectSummary}:{},...typeof t.inspectTrace=="string"?{inspectTrace:t.inspectTrace}:{}}}return{text:String(e?.text??""),...typeof e?.displayText=="string"?{displayText:e.displayText}:{},...typeof e?.inspectSummary=="string"?{inspectSummary:e.inspectSummary}:{},...typeof e?.inspectTrace=="string"?{inspectTrace:e.inspectTrace}:{}}}notePromptAccepted(e,t,i){let s=Date.now(),n=this.pendingPromptEchoes.get(e)??[];n.push({sentAt:s}),this.pendingPromptEchoes.set(e,n);let c=Math.max(this.pendingTurns.get(e)??0,i?1:0)+1;this.pendingTurns.set(e,c);let r=t.displayText??t.text;return this.patchSession(e,{lastPrompt:r,status:"working",needsAttention:!1}),this.fanOutEvent(e,{type:"prompt-received",text:r,...t.inspectSummary?{inspectSummary:t.inspectSummary}:{},...t.inspectTrace?{inspectTrace:t.inspectTrace}:{},ts:s}),{ok:!0,queued:c>1,pendingTurns:c,queueDepth:Math.max(0,c-1)}}applySessionEvent(e,t){switch(t.type){case"prompt-received":case"turn-started":this.patchSession(e,{status:"working",needsAttention:!1});return;case"turn-completed":{let i=this.consumeSettledTurn(e);this.patchSession(e,{status:i>0?"working":"idle",needsAttention:!1,lastTurnFiles:t.filesTouched,currentlyEditing:void 0});return}case"approval-needed":this.patchSession(e,{status:"needs-attention",needsAttention:!0});return;case"error":{let i=this.consumeSettledTurn(e);this.patchSession(e,{status:i>0?"working":"needs-attention",needsAttention:i<=0,currentlyEditing:void 0});return}case"exited":this.clearPromptTracking(e),this.patchSession(e,{status:"ended",needsAttention:!1,wrapperPid:void 0,currentlyEditing:void 0});return;case"ready":case"turn-reasoning":case"turn-message":case"turn-plan":case"tool-call":case"file-edited":case"file-diff-delta":return}}patchSession(e,t){let i=this.pendingSessionStates.get(e)??R(e);if(!i)return;let s=Ee(i,t);this.pendingSessionStates.set(e,s),this.pendingSessionPatches.set(e,{...this.pendingSessionPatches.get(e),...t}),this.broadcastSessionStatus(s),!this.sessionStatusPersistTimer&&(this.sessionStatusPersistTimer=setTimeout(()=>{this.sessionStatusPersistTimer=null,this.flushSessionStatuses()},rt))}flushSessionStatuses(){if(this.pendingSessionPatches.size===0)return;let e=this.pendingSessionStates,t=this.pendingSessionPatches;this.pendingSessionStates=new Map,this.pendingSessionPatches=new Map;try{xe([...t].map(([i,s])=>({id:i,patch:s})))}catch(i){for(let[s,n]of e)this.pendingSessionStates.has(s)||this.pendingSessionStates.set(s,n);for(let[s,n]of t)this.pendingSessionPatches.set(s,{...n,...this.pendingSessionPatches.get(s)});process.stderr.write(`[sootsim-agent] session status persistence failed: ${i instanceof Error?i.message:String(i)}
|
|
7
|
+
`)}}coalescePromptEcho(e,t){if(t.type!=="prompt-received")return t;let i=this.pendingPromptEchoes.get(e);if(!i||i.length===0)return t;for(;i.length>0&&Date.now()-i[0].sentAt>15e3;)i.shift();return i.length===0?(this.pendingPromptEchoes.delete(e),t):(i.shift(),i.length===0?this.pendingPromptEchoes.delete(e):this.pendingPromptEchoes.set(e,i),null)}consumeSettledTurn(e){let t=Math.max(0,(this.pendingTurns.get(e)??1)-1);return t>0?this.pendingTurns.set(e,t):this.pendingTurns.delete(e),t}clearPromptTracking(e){this.pendingPromptEchoes.delete(e),this.pendingTurns.delete(e)}fanOutEvent(e,t){let i=JSON.stringify({type:"agent:event",sessionId:e,event:t});for(let[s,n]of this.sessionsBySocket)if(n.has(e)&&s.readyState===N)try{s.send(i)}catch{}}broadcastSessionStatus(e){let t=JSON.stringify({type:"agent:session-status",session:e});for(let i of this.allSockets)if(i.readyState===N)try{i.send(t)}catch{}}respond(e,t,i){if(e.readyState===N)try{e.send(JSON.stringify({id:t,result:i}))}catch{}}respondError(e,t,i,s){if(e.readyState===N)try{e.send(JSON.stringify({id:t,error:i,...s?{code:s}:{}}))}catch{}}};function st(o){return o==="expo"?"expo":o==="one"||o==="vxrn"?"one":"unknown"}import Ne from"http";import Be from"https";import{finished as ct,pipeline as dt}from"stream/promises";var G="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36",ot=[{hostSuffix:"uniswap.org",headers:{origin:"https://app.uniswap.org",referer:"https://app.uniswap.org/"},suppressBrowserUserAgent:!0}];function at(o){let e=o.toLowerCase();for(let t of ot)if(e===t.hostSuffix||e.endsWith(`.${t.hostSuffix}`))return t}function De(o){let e=at(o.hostname);return{"accept-encoding":"identity",...e?.suppressBrowserUserAgent?{}:{"user-agent":G},...e?.headers}}var lt=new Set(["host","origin","referer","user-agent","accept-encoding","cookie","connection","keep-alive","transfer-encoding","upgrade","content-length","sec-fetch-site","sec-fetch-mode","sec-fetch-dest","sec-ch-ua","sec-ch-ua-mobile","sec-ch-ua-platform"]),ut={"access-control-allow-origin":"*","access-control-allow-methods":"GET,POST,PUT,DELETE,PATCH,OPTIONS","access-control-allow-headers":"*","access-control-expose-headers":"*","access-control-max-age":"3600"},pt=new Set(["host","origin","referer","sec-fetch-site","sec-fetch-mode","sec-fetch-dest"]);function He(o){return o.protocol!=="https:"?{}:he(o.hostname)?{rejectUnauthorized:!1}:{}}function P(o){for(let[e,t]of Object.entries(ut))o.setHeader(e,t)}function mt(o,e){let t=[],i=e;i?.code&&t.push(i.code),i?.message&&t.push(i.message),i?.cause?.code&&t.push(i.cause.code),i?.cause?.message&&t.push(i.cause.message);let n=[...new Set(t.filter(Boolean))].join(" | ")||String(e);return o.includes("stored-in-.env.local")?`${n} | upstream url still contains placeholder env values`:n}function ht(o,e){let t={};for(let[i,s]of Object.entries(o))s&&(lt.has(i.toLowerCase())||(t[i]=Array.isArray(s)?s.join(", "):s));return Object.assign(t,e?De(e):{"user-agent":G}),t}function ft(o,e){let t={};for(let[i,s]of Object.entries(o))s&&(pt.has(i.toLowerCase())||(t[i]=s));return t.host=e.host,t.origin=e.origin,t.referer=`${e.origin}/`,t}function Ue(o){return o?.startsWith("/__fetch-proxy?")||o?.startsWith("/__proxy?")||!1}function Fe(o){return o?!!(o.startsWith("/__app-api?")||o.startsWith("/__app-api/")):!1}async function We(o,e){if(o.method==="OPTIONS"){P(e),e.writeHead(204),e.end();return}let i=new URLSearchParams((o.url||"").split("?")[1]||"").get("url");if(!i){P(e),e.writeHead(400,{"Content-Type":"text/plain"}),e.end("missing url param");return}let s;try{s=new URL(i)}catch{P(e),e.writeHead(400,{"Content-Type":"text/plain"}),e.end("invalid url param");return}let n;if(o.method!=="GET"&&o.method!=="HEAD"){let a=[];for await(let l of o)a.push(Buffer.isBuffer(l)?l:Buffer.from(l));a.length>0&&(n=Buffer.concat(a))}let c=o.method||"GET",r=async(a,l,d,u)=>{let p=a.protocol==="https:"?Be:Ne,m=ht(o.headers,a);a.origin!==s.origin&&(delete m.authorization,delete m["proxy-authorization"]),l==="GET"||l==="HEAD"?(delete m["content-length"],delete m["content-type"]):d&&(m["content-length"]=String(d.byteLength));let f=await new Promise((w,A)=>{let y=p.request({hostname:a.hostname,port:a.port||(a.protocol==="https:"?443:80),path:a.pathname+a.search,method:l,headers:m,...He(a)},w),x=()=>y.destroy(new Error("fetch proxy client disconnected"));o.once("aborted",x),y.once("close",()=>o.off("aborted",x)),y.once("error",A),d===void 0?y.end():y.end(d)}),h=f.statusCode??502,g=f.headers.location;if(g&&(h===301||h===302||h===303||h===307||h===308)){if(u>=10)throw f.destroy(),new Error("too many redirects");let w=(h===301||h===302)&&l==="POST"||h===303&&l!=="GET"&&l!=="HEAD",A=new URL(g,a);f.resume(),await ct(f),await r(A,w?"GET":l,w?void 0:d,u+1);return}for(let[w,A]of Object.entries(f.headers)){let y=w.toLowerCase();A===void 0||y==="set-cookie"||y==="connection"||y==="keep-alive"||y==="proxy-authenticate"||y==="proxy-authorization"||y==="te"||y==="trailer"||y==="transfer-encoding"||y==="upgrade"||y.startsWith("access-control-")||e.setHeader(w,A)}P(e);let b=f.headers["set-cookie"]??[];b.length>0&&e.setHeader("x-sootsim-set-cookie",(Array.isArray(b)?b:[b]).join(", ")),e.statusCode=h,await dt(f,e)};try{await r(s,c,n,0)}catch(a){if(e.headersSent){e.destroy(a instanceof Error?a:new Error(String(a)));return}P(e),e.writeHead(502,{"Content-Type":"text/plain"}),e.end(`fetch proxy error: ${mt(s.href,a)}`)}}function $e(o,e){let t=o.url||"",i="",s="";if(t.startsWith("/__app-api?")){let l=new URL(t,"http://sootsim.local");i=l.searchParams.get("path")||"",s=l.searchParams.get("origin")?.trim()||""}else if(t.startsWith("/__app-api/"))i=t.slice(10);else return!1;if(!s)return e.writeHead(400,{"Content-Type":"text/plain"}),e.end("app-api: missing origin query param"),!0;if(o.method==="OPTIONS")return e.writeHead(204,{"Access-Control-Allow-Origin":o.headers.origin||"*","Access-Control-Allow-Methods":"GET,POST,PUT,PATCH,DELETE,OPTIONS","Access-Control-Allow-Headers":o.headers["access-control-request-headers"]||"*","Access-Control-Allow-Credentials":"true","Access-Control-Max-Age":"86400"}),e.end(),!0;let n;try{n=new URL(i,s)}catch{return e.writeHead(400,{"Content-Type":"text/plain"}),e.end("app-api: invalid origin or path"),!0}let c=n.protocol==="https:"?Be:Ne,r=ft(o.headers,n),a=c.request({hostname:n.hostname,port:n.port||(n.protocol==="https:"?443:80),path:n.pathname+n.search,method:o.method,headers:r,...He(n)},l=>{let d=Object.keys(l.headers).filter(u=>{let p=u.toLowerCase();return!p.startsWith("access-control-")&&p!=="set-cookie"}).join(", ");e.writeHead(l.statusCode??502,{...l.headers,"access-control-allow-origin":o.headers.origin||"*","access-control-allow-credentials":"true","access-control-expose-headers":d}),l.pipe(e)});return a.on("error",l=>{e.statusCode=502,e.end(`app proxy error: ${l.message}`)}),o.pipe(a),!0}import gt from"node:fs/promises";import St from"node:path";import{build as yt}from"esbuild";var je="/__sootsim-replacement-module",k="/__sootsim-replacement-runtime";function bt(o){switch(St.extname(o).toLowerCase()){case".js":return"js";case".jsx":return"jsx";case".ts":return"ts";case".tsx":return"tsx";default:return null}}function vt(o){return o?`export * from ${JSON.stringify(o)};
|
|
8
|
+
import React from ${JSON.stringify(o)};
|
|
9
|
+
export default React;
|
|
10
|
+
`:`const bridge = globalThis.__sootsim_react_bridge
|
|
11
|
+
if (!bridge) throw new Error('[rnx] replacement React bridge is not ready')
|
|
12
|
+
export default bridge.default
|
|
13
|
+
export const Activity = bridge.Activity
|
|
14
|
+
export const Children = bridge.Children
|
|
15
|
+
export const Component = bridge.Component
|
|
16
|
+
export const Fragment = bridge.Fragment
|
|
17
|
+
export const Profiler = bridge.Profiler
|
|
18
|
+
export const PureComponent = bridge.PureComponent
|
|
19
|
+
export const StrictMode = bridge.StrictMode
|
|
20
|
+
export const Suspense = bridge.Suspense
|
|
21
|
+
export const __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = bridge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE
|
|
22
|
+
export const __COMPILER_RUNTIME = bridge.__COMPILER_RUNTIME
|
|
23
|
+
export const __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = bridge.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
|
24
|
+
export const act = bridge.act
|
|
25
|
+
export const cache = bridge.cache
|
|
26
|
+
export const cacheSignal = bridge.cacheSignal
|
|
27
|
+
export const captureOwnerStack = bridge.captureOwnerStack
|
|
28
|
+
export const cloneElement = bridge.cloneElement
|
|
29
|
+
export const createContext = bridge.createContext
|
|
30
|
+
export const createElement = bridge.createElement
|
|
31
|
+
export const createRef = bridge.createRef
|
|
32
|
+
export const forwardRef = bridge.forwardRef
|
|
33
|
+
export const isValidElement = bridge.isValidElement
|
|
34
|
+
export const lazy = bridge.lazy
|
|
35
|
+
export const memo = bridge.memo
|
|
36
|
+
export const startTransition = bridge.startTransition
|
|
37
|
+
export const unstable_useCacheRefresh = bridge.unstable_useCacheRefresh
|
|
38
|
+
export const use = bridge.use
|
|
39
|
+
export const useActionState = bridge.useActionState
|
|
40
|
+
export const useCallback = bridge.useCallback
|
|
41
|
+
export const useContext = bridge.useContext
|
|
42
|
+
export const useDebugValue = bridge.useDebugValue
|
|
43
|
+
export const useDeferredValue = bridge.useDeferredValue
|
|
44
|
+
export const useEffect = bridge.useEffect
|
|
45
|
+
export const useEffectEvent = bridge.useEffectEvent
|
|
46
|
+
export const useId = bridge.useId
|
|
47
|
+
export const useImperativeHandle = bridge.useImperativeHandle
|
|
48
|
+
export const useInsertionEffect = bridge.useInsertionEffect
|
|
49
|
+
export const useLayoutEffect = bridge.useLayoutEffect
|
|
50
|
+
export const useMemo = bridge.useMemo
|
|
51
|
+
export const useOptimistic = bridge.useOptimistic
|
|
52
|
+
export const useReducer = bridge.useReducer
|
|
53
|
+
export const useRef = bridge.useRef
|
|
54
|
+
export const useState = bridge.useState
|
|
55
|
+
export const useSyncExternalStore = bridge.useSyncExternalStore
|
|
56
|
+
export const useTransition = bridge.useTransition
|
|
57
|
+
export const version = bridge.version
|
|
58
|
+
`}function wt(){return`const rn = globalThis.__sootsim_components__ || {}
|
|
59
|
+
export default rn
|
|
60
|
+
export const View = rn.View
|
|
61
|
+
export const Text = rn.Text
|
|
62
|
+
export const Image = rn.Image
|
|
63
|
+
export const ScrollView = rn.ScrollView
|
|
64
|
+
export const FlatList = rn.FlatList
|
|
65
|
+
export const Pressable = rn.Pressable
|
|
66
|
+
export const TouchableOpacity = rn.TouchableOpacity
|
|
67
|
+
export const TouchableWithoutFeedback = rn.TouchableWithoutFeedback
|
|
68
|
+
export const TouchableHighlight = rn.TouchableHighlight
|
|
69
|
+
export const TextInput = rn.TextInput
|
|
70
|
+
export const ActivityIndicator = rn.ActivityIndicator
|
|
71
|
+
export const KeyboardAvoidingView = rn.KeyboardAvoidingView
|
|
72
|
+
export const Button = rn.Button
|
|
73
|
+
export const Modal = rn.Modal
|
|
74
|
+
export const Switch = rn.Switch
|
|
75
|
+
export const StyleSheet = rn.StyleSheet
|
|
76
|
+
export const Platform = rn.Platform
|
|
77
|
+
export const Keyboard = rn.Keyboard
|
|
78
|
+
export const Dimensions = rn.Dimensions
|
|
79
|
+
export const Appearance = rn.Appearance
|
|
80
|
+
`}function z(o,e,t){e.writeHead(200,{"Content-Type":"application/javascript; charset=utf-8","Cache-Control":"no-cache"}),e.end(o.method==="HEAD"?void 0:t)}function Ve(o){if(!o)return!1;try{let e=new URL(o,"http://rnx.local").pathname;return e===je||e.startsWith(`${k}/`)}catch{return!1}}async function Je(o,e,t={}){let i=o.url||"",s;try{s=new URL(i,"http://rnx.local")}catch{return!1}if(s.pathname===`${k}/react`)return z(o,e,vt(t.reactBridgeUrl)),!0;if(s.pathname===`${k}/react-native`)return z(o,e,wt()),!0;if(s.pathname!==je)return!1;let n=s.searchParams.get("path");if(!n)return e.writeHead(400,{"Content-Type":"text/plain; charset=utf-8"}),e.end("missing path param"),!0;if(!bt(n))return e.writeHead(400,{"Content-Type":"text/plain; charset=utf-8"}),e.end("replacement files must be .js, .jsx, .ts, or .tsx"),!0;try{await gt.access(n)}catch(r){let a=r instanceof Error?r.message:String(r);return e.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),e.end(`replacement file not found: ${a}`),!0}try{let a=(await yt({entryPoints:[n],bundle:!0,write:!1,format:"esm",platform:"browser",target:"es2022",jsx:"transform",jsxFactory:"React.createElement",jsxFragment:"React.Fragment",tsconfigRaw:{compilerOptions:{jsx:"react"}},sourcemap:"inline",logLevel:"silent",external:["react","react-native"]})).outputFiles[0]?.text??"",l=/\bimport\s+(?:\*\s+as\s+React|React(?:\s*,|\s+from)|\{[^}]*\bdefault\s+as\s+React\b)/.test(a),u=((/\bReact\.(?:createElement|Fragment)\b/.test(a)&&!l?`import * as React from '${k}/react';
|
|
81
|
+
`:"")+a).replace(/from\s*["']react-native["']/g,`from '${k}/react-native'`).replace(/from\s*["']react["']/g,`from '${k}/react'`);z(o,e,u)}catch(r){let a=r instanceof Error?r.message:String(r);e.writeHead(500,{"Content-Type":"text/plain; charset=utf-8"}),e.end(`replacement bundle failed: ${a}`)}return!0}import{WebSocket as E,WebSocketServer as At}from"ws";var Tt="/__websocket-proxy",Ct=new Set(["host","connection","upgrade","transfer-encoding","content-length","sec-websocket-accept","sec-websocket-extensions","sec-websocket-key","sec-websocket-protocol","sec-websocket-version"]);function I(o,e,t){try{o.write(`HTTP/1.1 ${e} ${t}\r
|
|
82
|
+
Connection: close\r
|
|
83
|
+
Content-Type: text/plain\r
|
|
84
|
+
Content-Length: ${t.length}\r
|
|
85
|
+
\r
|
|
86
|
+
${t}`)}catch{}o.destroy()}function Et(o){let e=o.headers.origin,t=o.headers.host;if(!e||!t)return!1;try{return new URL(e).host===t}catch{return!1}}function xt(o){if(!o)return{};let e=o.replace(/-/g,"+").replace(/_/g,"/"),t=e+"=".repeat((4-e.length%4)%4),i=JSON.parse(Buffer.from(t,"base64").toString("utf8"));if(!i||typeof i!="object"||Array.isArray(i))return{};let s={};for(let[n,c]of Object.entries(i))c!=null&&(Ct.has(n.toLowerCase())||(s[n]=Array.isArray(c)?c.join(", "):String(c)));return s}function kt(o){let e=new URL(o.href);return e.protocol=o.protocol==="wss:"?"https:":"http:",e.origin}function It(o){let e=o.headers["sec-websocket-protocol"];return(Array.isArray(e)?e.join(","):e||"").split(",").map(i=>i.trim()).filter(Boolean)}function H(o,e,t){if(!(o.readyState===E.CLOSED||o.readyState===E.CLOSING))try{o.close(e,t)}catch{o.terminate()}}function Rt(o,e){let t=!1,i=(s,n,c,r)=>{t||(t=!0,H(n,c,r.toString()),s.readyState===E.OPEN&&H(s,c,r.toString()))};o.on("message",(s,n)=>{e.readyState===E.OPEN&&e.send(s,{binary:n})}),e.on("message",(s,n)=>{o.readyState===E.OPEN&&o.send(s,{binary:n})}),o.on("close",(s,n)=>i(o,e,s,n)),e.on("close",(s,n)=>i(e,o,s,n)),o.on("error",()=>H(e,1011,"proxy client error")),e.on("error",()=>H(o,1011,"upstream websocket error"))}function Pt(o,e,t,i){let s={...t},n=Object.keys(s).filter(c=>c.toLowerCase()==="origin");if(i&&n.length===0)s.origin=kt(o);else if(!i)for(let c of n)delete s[c];return Object.keys(s).length===0?new E(o.href,e):new E(o.href,e,{headers:s})}function _t(o){if(!o)return!1;try{return new URL(o,"http://localhost").pathname===Tt}catch{return!1}}function Ke(o,e,t,i=!0){if(!_t(o.url))return!1;if(!Et(o))return I(e,403,"forbidden websocket proxy origin"),!0;let s,n;try{let l=new URL(o.url||"/","http://localhost"),d=l.searchParams.get("url");if(!d)return I(e,400,"missing websocket proxy url"),!0;if(s=new URL(d),s.protocol!=="ws:"&&s.protocol!=="wss:")return I(e,400,"invalid websocket proxy protocol"),!0;n=xt(l.searchParams.get("headers"))}catch{return I(e,400,"invalid websocket proxy request"),!0}let c=It(o),r=Pt(s,c,n,i),a=!1;return e.once("close",()=>{a||r.terminate()}),r.once("open",()=>{if(a)return;a=!0;let l=r.protocol;new At({noServer:!0,clientTracking:!1,handleProtocols(u){return l||u.values().next().value||!1}}).handleUpgrade(o,e,t,u=>{Rt(u,r)})}),r.once("error",()=>{a||(a=!0,I(e,502,"upstream websocket error"))}),r.once("close",()=>{a||(a=!0,I(e,502,"upstream websocket closed"))}),!0}var Dt="require-corp",Nt=new Set(["tap","keyboard","longPress","perform","reset","camera"]),Bt=2e3,Ht=1e3;function Ut(o){return!o||typeof o.type!="string"?!1:o.acquireLock===!0?!0:o.readOnly===!0?!1:Nt.has(o.type)}var Ge=5e3,Ft=3600*1e3,Wt="SOOTSIM_RUNTIME_UPDATE_INTERVAL_MS",ze={".html":"text/html; charset=utf-8",".js":"application/javascript",".cjs":"application/javascript",".mjs":"application/javascript",".css":"text/css; charset=utf-8",".json":"application/json; charset=utf-8",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".webp":"image/webp",".avif":"image/avif",".ico":"image/x-icon",".wasm":"application/wasm",".ttf":"font/ttf",".otf":"font/otf",".woff":"font/woff",".woff2":"font/woff2",".map":"application/json",".txt":"text/plain; charset=utf-8",".mp4":"video/mp4",".m4v":"video/mp4",".webm":"video/webm",".mov":"video/quicktime"},qe="/__camera-fixtures/",$t=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;function Ye(o,e,t){let i;try{let a=$();i=JSON.stringify(a)}catch{i="{}"}let s=e>0?`window.__sootsimBridgePort=${e};`:"",n=t?`window.__sootsimContrastOrigin=${JSON.stringify(t)};`:"",c=`<script>window.__sootsimSharedConfig=${i};`+s+n+`window.__sootsimCliVersion=${JSON.stringify(ue())};</script>`,r=o.toString("utf8");return r.includes("<head>")?r.replace("<head>",`<head>${c}`):r.includes("</head>")?r.replace("</head>",c+"</head>"):r.includes("</body>")?r.replace("</body>",c+"</body>"):c+r}function Xe(o){typeof o=="object"&&o!==null&&"unref"in o&&o.unref()}var U=class o{port;openUrlHandler;httpServer=null;wss=null;nextCommandId=1;nextSimNumber=161;sims=new Map;primarySimId=null;pendingCommands=new Map;cliBySentId=new Map;cliSimBySocket=new Map;cliLastCommandAt=new Map;cliIdentityKeyBySocket=new Map;cliLabelBySocket=new Map;restorableSims=new Map;nextCliFallbackId=1;cliIdleTimer=null;agentHost;static CLI_IDLE_TIMEOUT_MS=6e4;static CLI_LEASE_TTL_MS=6e5;static USER_ACTIVE_LEASE_TTL_MS=8e3;static USER_BOOT_LEASE_TTL_MS=6e4;static SIM_RECONNECT_TTL_MS=3e4;static SIM_IDLE_REAP_TTL_MS=30*6e4;static AUTOMATION_SIM_IDLE_REAP_TTL_MS=10*6e4;static MAX_CONCURRENT_AUTOMATION_SIMS=6;static AUTOMATION_SIM_ACTIVE_GRACE_MS=6e4;preferredPort;portFallbackCount;simIdleReapTtlMs;automationSimIdleReapTtlMs;maxConcurrentAutomationSims;automationSimActiveGraceMs;shouldWriteLockfile;shouldWriteDevLockfile;getShellPort;contrastOrigin=null;effectivePort=0;startedAt=0;heartbeatTimer=null;devHeartbeatTimer=null;wsHeartbeatTimer=null;wsIsAlive=new WeakMap;static WS_HEARTBEAT_INTERVAL_MS=3e4;runtimeUpdateTimer=null;runtimeUpdateInFlight=null;activeRuntimeVersion=null;activeRuntimeDirPath=null;scanCache=null;scanCacheAt=0;inflightScan=null;static SCAN_FRESH_MS=2e3;constructor(e={}){this.preferredPort=e.port||7668,this.port=this.preferredPort,this.shouldWriteLockfile=e.writeLockfile===!0,this.shouldWriteDevLockfile=e.writeDevLockfile===!0,this.getShellPort=e.getShellPort??null,this.portFallbackCount=Math.max(1,e.portFallbackCount??10),this.openUrlHandler=e.openUrl,this.agentHost=new B({getExcludePorts:e.agentScanExcludes,resolveCliLease:t=>{let i=this.sims.get(t),s=i?this.getActiveLease(i):null;return s?{kind:s.kind,cliIdentityKey:s.cliIdentityKey,expiresAt:s.expiresAt}:null}}),this.contrastOrigin=e.contrastOrigin?.replace(/\/$/,"")||null,this.simIdleReapTtlMs=e.simIdleReapTtlMs??o.SIM_IDLE_REAP_TTL_MS,this.automationSimIdleReapTtlMs=e.automationSimIdleReapTtlMs??o.AUTOMATION_SIM_IDLE_REAP_TTL_MS,this.maxConcurrentAutomationSims=e.maxConcurrentAutomationSims??o.MAX_CONCURRENT_AUTOMATION_SIMS,this.automationSimActiveGraceMs=e.automationSimActiveGraceMs??o.AUTOMATION_SIM_ACTIVE_GRACE_MS}getAgentHost(){return this.agentHost}reapIdleSimsForTest(e=Date.now()){this.reapIdleSims(e)}start(e){this.startAsync(e)}async startAsync(e){if(this.httpServer||this.wss)return this.effectivePort;this.refreshActiveRuntime();for(let t=0;t<this.portFallbackCount;t++){let i=this.preferredPort+t;try{return await this.bindOnce(i,e?.silent===!0),this.effectivePort=i,this.port=i,this.startedAt=Date.now(),t>0&&!e?.silent&&process.stderr.write(`ws bridge bound to port ${i} (preferred ${this.preferredPort} was taken)
|
|
87
|
+
`),this.afterBind(),i}catch(s){if(s?.code!=="EADDRINUSE")throw s;e?.silent||process.stderr.write(`ws bridge port ${i} already in use, trying ${i+1}
|
|
88
|
+
`)}}throw new Error(`could not bind ws bridge after ${this.portFallbackCount} attempts starting at ${this.preferredPort}`)}bindOnce(e,t){return new Promise((i,s)=>{let n=Lt((a,l)=>this.handleHttpRequest(a,l)),c=!1,r=a=>{if(!c){c=!0;try{n.close()}catch{}this.httpServer=null,this.wss=null,s(a)}};n.once("error",r),n.listen(e,"127.0.0.1",()=>{c||(c=!0,n.removeListener("error",r),n.on("error",a=>{process.stderr.write(`ws bridge http error: ${String(a)}
|
|
89
|
+
`)}),this.httpServer=n,this.wss=new Mt({noServer:!0}),this.wireWebSocketServer(),n.on("upgrade",(a,l,d)=>{Ke(a,l,d)||this.wss?.handleUpgrade(a,l,d,u=>{this.wss?.emit("connection",u,a)})}),i())})})}wireWebSocketServer(){this.wss&&this.wss.on("connection",(e,t)=>{let i=t.headers.origin,s=i?"sim":"cli",n=null;if(e.on("error",()=>{}),this.wsIsAlive.set(e,!0),e.on("pong",()=>{this.wsIsAlive.set(e,!0)}),this.agentHost.registerSocket(e),s==="sim")n={id:this.allocateSimId(),ws:e,origin:i,connectedAt:Date.now(),lastSeenAt:Date.now(),lastActiveAt:0,recentActions:[]},this.sims.set(n.id,n),this.writeConnectedRuntimeSnapshot(),this.shouldPromoteSim(n)&&(this.primarySimId=n.id),this.broadcastSimAssignments(),this.broadcastSimClientStates();else{let c=`ws-${this.nextCliFallbackId++}`;this.cliIdentityKeyBySocket.set(e,c)}e.on("message",c=>{let r;try{r=JSON.parse(c.toString())}catch{return}if(!(!r||typeof r!="object")){if(typeof r.type=="string"&&r.type.startsWith("agent:")){this.agentHost.handleMessage(e,r);return}if(r.type==="runtime:list"){let a=O.listInstalled(),l=this.getActiveRuntime(),d={type:"runtime:list:ok",id:r.id,installed:a,active:l.version,activeRuntimeDir:l.runtimeDir};try{e.send(JSON.stringify(d))}catch{}return}if(r.type==="runtime:use"){let a=typeof r.version=="string"?r.version:"";if(!O.listInstalled().includes(a)){try{e.send(JSON.stringify({type:"runtime:use:error",id:r.id,error:`runtime ${a||"(missing)"} is not installed`}))}catch{}return}let d=this.setActiveRuntime(a);try{e.send(JSON.stringify({type:"runtime:use:ok",id:r.id,version:d.version,runtimeDir:d.runtimeDir}))}catch{}return}if(r.type==="runtime:get"){let a=this.getActiveRuntime();try{e.send(JSON.stringify({type:"runtime:get:ok",id:r.id,active:a.version,activeRuntimeDir:a.runtimeDir}))}catch{}return}if(s==="sim"&&r.type==="bridge:hello"&&n&&!n.url){let a=n.id;this.sims.delete(a),this.primarySimId===a&&(this.primarySimId=this.getOpenSim()?.id??null),n=null,s="cli",this.cliIdentityKeyBySocket.set(e,`ws-${this.nextCliFallbackId++}`),this.writeConnectedRuntimeSnapshot(),this.broadcastSimAssignments(),this.broadcastSimClientStates()}if(s==="sim"){if(n&&(n.lastSeenAt=Date.now()),r.type==="bridge:register"&&n){let d=r,u=this.tryRestoreSimId(n,d.simId);n.url=d.url,n.title=d.title,n.userAgent=d.userAgent,this.writeConnectedRuntimeSnapshot(),typeof d.kind=="string"&&d.kind.trim()&&(n.kind=d.kind.trim()),d.meta&&typeof d.meta=="object"&&(n.meta=d.meta);let p=this.primarySimId!==n.id&&this.shouldPromoteSim(n);p&&(this.primarySimId=n.id),(u||p)&&(this.broadcastSimAssignments(),this.broadcastSimClientStates());return}if(r.type==="bridge:user-focus-state"&&n){let d=r;this.updateUserFocusLease(n,d);return}if(r.type==="bridge:user-interact"&&n){this.updateUserActivity(n);return}if(r.type==="bridge:write-shared-config"){if(!r.patch||typeof r.patch!="object"||Array.isArray(r.patch))return;let d=Object.fromEntries(Object.entries(r.patch));try{this.writeAndBroadcastSharedConfig(d)}catch(u){process.stderr.write(`sootsim: bridge:write-shared-config failed: ${u instanceof Error?u.message:String(u)}
|
|
90
|
+
`);return}return}if(r.type==="bridge:open-path"){let d=typeof r.path=="string"?r.path:"",u=typeof r.line=="number"&&Number.isFinite(r.line)?r.line:void 0,p=typeof r.column=="number"&&Number.isFinite(r.column)?r.column:void 0;d&&this.openPathInEditor(d,u,p);return}if(r.type==="bridge:boot-clients"&&n){let d=[];for(let[p,m]of this.cliSimBySocket)m===n.id&&d.push(p);for(let p of d){this.cliSimBySocket.delete(p);try{p.close(1e3,"booted by sim")}catch{}}let u=!!n.cliLease;n.cliLease={kind:"user-active",cliIdentityKey:"__user-active__",cliLabel:"active user",expiresAt:Date.now()+o.USER_BOOT_LEASE_TTL_MS},process.stderr.write(`rnx booted ${d.length} cli client(s)${u?" (overrode prior lease)":""}; held sim for user [${n.id}]
|
|
91
|
+
`),this.recordSimAction(n.id,"sim booted cli clients"),this.broadcastSimClientStates();return}let a=this.pendingCommands.get(r.id);if(a){this.pendingCommands.delete(r.id),r.error?a.reject(new Error(r.error)):a.resolve(r.result);return}let l=this.cliBySentId.get(r.id);if(l&&(this.cliBySentId.delete(r.id),l.ws.readyState===S.OPEN)){let d=this.getOtherCliIdentityCount(l.ws,l.simId),u=d>0?{...r,id:l.originalId,_otherCliCount:d}:{...r,id:l.originalId};l.ws.send(JSON.stringify(u))}return}(async()=>{this.cliLastCommandAt.set(e,Date.now());try{if(r.type==="bridge:bye"){let p=this.cliSimBySocket.delete(e);this.cliLastCommandAt.delete(e),this.cliIdentityKeyBySocket.delete(e),this.cliLabelBySocket.delete(e);for(let[m,f]of this.cliBySentId)f.ws===e&&this.cliBySentId.delete(m);p&&this.broadcastSimClientStates();return}if(r.type==="bridge:hello"){let p=typeof r.cliIdentityKey=="string"&&r.cliIdentityKey.trim()?r.cliIdentityKey.trim():this.cliIdentityKeyBySocket.get(e)||`ws-${this.nextCliFallbackId++}`;this.cliIdentityKeyBySocket.set(e,p),typeof r.cliLabel=="string"&&r.cliLabel.trim()&&this.cliLabelBySocket.set(e,r.cliLabel.trim()),e.readyState===S.OPEN&&e.send(JSON.stringify({id:r.id,result:{cliIdentityKey:p,leaseTtlMs:o.CLI_LEASE_TTL_MS,leasing:!0}}));return}if(r.type==="bridge:list-sims"){e.readyState===S.OPEN&&e.send(JSON.stringify({id:r.id,result:this.listSims()}));return}if(r.type==="bridge:claim"){let p=await this.waitForSim(r.simId),m=this.tryAcquireLease(e,p,{force:r.force===!0});if(!m.granted){e.readyState===S.OPEN&&e.send(JSON.stringify({id:r.id,error:`sim ${p.id} is locked by another cli`,_locked:m.lock}));return}this.setCliSimTarget(e,p.id),this.recordSimAction(p.id,m.bootedCount>0?`cli force-claimed sim (booted ${m.bootedCount})`:"cli claimed sim"),e.readyState===S.OPEN&&e.send(JSON.stringify({id:r.id,result:{simId:p.id,lockedBy:m.lease.cliIdentityKey,lockExpiresAt:m.lease.expiresAt,bootedCount:m.bootedCount}}));return}let a=await this.waitForSim(r.simId);if(Ut(r)){let p=this.tryAcquireLease(e,a);if(!p.granted){e.readyState===S.OPEN&&e.send(JSON.stringify({id:r.id,error:`sim ${a.id} is locked by another cli \u2014 use \`rnx claim ${a.id} --force\` or \`rnx open --new\``,_locked:p.lock}));return}}else this.ensureCliIdentityKey(e);this.setCliSimTarget(e,a.id),this.recordSimAction(a.id,this.describeForwardedCommand(r));let l=this.nextCommandId++;this.cliBySentId.set(l,{simId:a.id,ws:e,originalId:r.id});let{simId:d,...u}=r;if(a.ws.send(JSON.stringify({...u,id:l})),u.type==="close"){this.cliBySentId.delete(l),e.readyState===S.OPEN&&e.send(JSON.stringify({id:r.id,result:{requested:!0,simId:a.id}}));let p=a.ws,m=setTimeout(()=>{this.closeSimSocketFromHost(p)},Bt);Xe(m)}}catch(a){e.readyState===S.OPEN&&e.send(JSON.stringify({id:r.id,error:a instanceof Error?a.message:String(a)}))}})()}}),e.on("close",()=>{if(this.agentHost.unregisterSocket(e),s==="sim"&&n){this.rememberDisconnectedSim(n),this.primarySimId===n.id&&(this.primarySimId=this.getOpenSim()?.id??null);for(let[c,r]of this.pendingCommands)r.simId===n.id&&(r.reject(new Error("sim disconnected")),this.pendingCommands.delete(c));for(let[c,r]of this.cliBySentId)r.simId===n.id&&(r.ws.readyState===S.OPEN&&r.ws.send(JSON.stringify({id:r.originalId,error:"sim disconnected before responding"})),this.cliBySentId.delete(c));this.broadcastSimAssignments(),this.broadcastSimClientStates()}else if(s==="cli"){let c=this.cliSimBySocket.delete(e);this.cliLastCommandAt.delete(e),this.cliIdentityKeyBySocket.delete(e),this.cliLabelBySocket.delete(e);for(let[r,a]of this.cliBySentId)a.ws===e&&this.cliBySentId.delete(r);c&&this.broadcastSimClientStates()}})})}afterBind(){if(process.stderr.write(`ws bridge listening on port ${this.port}
|
|
92
|
+
`),this.cliIdleTimer=setInterval(()=>this.sweepIdleCliClients(),3e4),this.cliIdleTimer.unref(),this.wsHeartbeatTimer=setInterval(()=>this.sweepDeadWebSockets(),o.WS_HEARTBEAT_INTERVAL_MS),this.wsHeartbeatTimer.unref(),this.shouldWriteLockfile){try{if(_(),!ae(this.buildLockfileSnapshot()))throw new Error("another rnx daemon wrote the lockfile during startup \u2014 aborting")}catch(e){throw process.stderr.write(`ws bridge failed to claim daemon lockfile: ${String(e)}
|
|
93
|
+
`),e}this.heartbeatTimer=setInterval(()=>{try{this.writeLockfileSnapshot()}catch{}},Ge),this.heartbeatTimer.unref(),this.startRuntimeUpdater()}if(this.shouldWriteDevLockfile){try{this.writeDevLockfileSnapshot()}catch(e){process.stderr.write(`ws bridge failed to write dev bridge lockfile: ${String(e)}
|
|
94
|
+
`)}this.devHeartbeatTimer=setInterval(()=>{try{this.writeDevLockfileSnapshot()}catch{}},Ge),this.devHeartbeatTimer.unref()}this.agentHost.seedOnBoot()}bootstrapping=!0;connectedRuntimeVersions(){let e=new Set;for(let t of this.sims.values())try{let i=new URL(t.url||t.origin||"http://localhost"),s=M(i.hostname);s&&e.add(s)}catch{}return[...e].sort()}buildLockfileSnapshot(){return{schema:1,pid:process.pid,platform:process.platform,bridgePort:this.effectivePort,runtimePort:this.effectivePort,activeRuntime:this.activeRuntimeVersion,activeRuntimeDir:this.activeRuntimeDirPath,servedRuntimes:this.connectedRuntimeVersions(),startedAt:this.startedAt,heartbeatAt:Date.now(),bootstrapping:this.bootstrapping}}buildDevLockfileSnapshot(){let e=this.getShellPort?.()??null;return{schema:1,pid:process.pid,platform:process.platform,bridgePort:this.effectivePort,runtimePort:this.effectivePort,...e&&e>0?{shellPort:e}:{},cwd:process.cwd(),startedAt:this.startedAt,heartbeatAt:Date.now(),source:"vite-dev",servedRuntimes:this.connectedRuntimeVersions()}}writeLockfileSnapshot(){se(this.buildLockfileSnapshot())}writeDevLockfileSnapshot(){oe(this.buildDevLockfileSnapshot())}writeConnectedRuntimeSnapshot(){if(this.shouldWriteLockfile&&this.httpServer)try{this.writeLockfileSnapshot()}catch{}if(this.shouldWriteDevLockfile&&this.httpServer)try{this.writeDevLockfileSnapshot()}catch{}}refreshActiveRuntime(){this.activeRuntimeVersion=j(),this.activeRuntimeDirPath=fe()??ie()}runServerScan(){if(this.inflightScan)return this.inflightScan;let e=this.effectivePort>0?[this.effectivePort]:[];return this.inflightScan=L({excludePorts:e,buildIconProxyUrl:t=>`/__bundle-proxy?url=${encodeURIComponent(t)}`}).then(t=>(this.scanCache=t,this.scanCacheAt=Date.now(),t)).catch(t=>{let i=t instanceof Error?t.message:String(t);return console.error("[rnx] /__server-scan failed:",i),this.scanCache??[]}).finally(()=>{this.inflightScan=null}),this.inflightScan}handleCameraFixture(e,t,i){let s=(t.method||"GET").toUpperCase(),n={"Access-Control-Allow-Origin":"*","Cache-Control":"no-store"};if(s==="OPTIONS"){i.writeHead(204,{...n,"Access-Control-Allow-Methods":"GET, HEAD, OPTIONS","Access-Control-Allow-Headers":"range"}),i.end();return}if(s!=="GET"&&s!=="HEAD"){i.writeHead(405,n),i.end();return}if(!$t.test(e)){i.writeHead(400,{...n,"Content-Type":"text/plain; charset=utf-8"}),i.end("bad fixture name");return}let c=Z(),r=v.join(c,e),a;try{a=T.lstatSync(r)}catch{i.writeHead(404,{...n,"Content-Type":"text/plain; charset=utf-8"}),i.end("not found");return}if(!a.isFile()){i.writeHead(403,{...n,"Content-Type":"text/plain; charset=utf-8"}),i.end("forbidden");return}let l=ze[v.extname(r).toLowerCase()]||"application/octet-stream",d=a.size,u=/^bytes=(\d*)-(\d*)$/.exec(t.headers.range||"");if(u){let[,p,m]=u,f=p?Number(p):0,h=m?Math.min(Number(m),d-1):d-1;if(!Number.isFinite(f)||f>h||f>=d){i.writeHead(416,{...n,"Content-Range":`bytes */${d}`}),i.end();return}if(i.writeHead(206,{...n,"Content-Type":l,"Content-Range":`bytes ${f}-${h}/${d}`,"Accept-Ranges":"bytes","Content-Length":String(h-f+1)}),s==="HEAD"){i.end();return}T.createReadStream(r,{start:f,end:h}).pipe(i);return}if(i.writeHead(200,{...n,"Content-Type":l,"Accept-Ranges":"bytes","Content-Length":String(d)}),s==="HEAD"){i.end();return}T.createReadStream(r).pipe(i)}handleServerScan(e){let t=s=>{e.writeHead(200,{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),e.end(JSON.stringify(s))},i=Date.now()-this.scanCacheAt;if(this.scanCache&&i<o.SCAN_FRESH_MS){t(this.scanCache);return}if(this.scanCache){t(this.scanCache),this.runServerScan().catch(()=>{});return}this.runServerScan().then(s=>t(s))}resolveRuntimeUpdateIntervalMs(){let e=Number(process.env[Wt]);return Number.isFinite(e)&&e>0?Math.max(100,Math.round(e)):Ft}startRuntimeUpdater(){if(!this.shouldWriteLockfile||this.runtimeUpdateTimer||T.existsSync(v.join(Y(),"runtime-update-disabled"))||process.env.SOOTSIM_HOME&&X()&&!j())return;this.runRuntimeUpdate("startup");let e=this.resolveRuntimeUpdateIntervalMs();this.runtimeUpdateTimer=setInterval(()=>{this.runRuntimeUpdate("periodic")},e),this.runtimeUpdateTimer.unref()}runRuntimeUpdate(e){return this.runtimeUpdateInFlight?this.runtimeUpdateInFlight:(this.runtimeUpdateInFlight=(async()=>{try{e==="startup"&&process.stderr.write(`rnx: checking for runtime updates\u2026
|
|
95
|
+
`);let t=await O.updateToLatest({protectVersions:this.connectedRuntimeVersions()});if(!t.updated||!t.latestVersion){e==="startup"&&process.stderr.write(`rnx: runtime ${this.activeRuntimeVersion??"(none)"} is current
|
|
96
|
+
`);return}let i=this.activeRuntimeVersion,s=this.setActiveRuntime(t.latestVersion);process.stderr.write(`rnx runtime updated to ${s.version} (${e})
|
|
97
|
+
`);try{ee({from:i,to:s.version,at:Date.now()})}catch{}}catch(t){process.stderr.write(`rnx runtime update failed (${e}): ${t instanceof Error?t.message:String(t)}
|
|
98
|
+
`)}finally{if(this.runtimeUpdateInFlight=null,e==="startup"&&this.bootstrapping){if(this.bootstrapping=!1,this.shouldWriteLockfile&&this.httpServer)try{this.writeLockfileSnapshot()}catch{}process.stderr.write(`rnx: ready
|
|
99
|
+
`)}}})(),this.runtimeUpdateInFlight)}setActiveRuntime(e){if(te(e),this.refreshActiveRuntime(),this.shouldWriteLockfile&&this.httpServer)try{this.writeLockfileSnapshot()}catch{}let t=JSON.stringify({type:"runtime:changed",version:e,runtimeDir:this.activeRuntimeDirPath});for(let i of this.sims.values()){try{let s=new URL(i.url||i.origin||"http://localhost");if(M(s.hostname))continue}catch{}if(i.ws.readyState===S.OPEN)try{i.ws.send(t)}catch{}}return{version:e,runtimeDir:this.activeRuntimeDirPath}}getActiveRuntime(){return{version:this.activeRuntimeVersion,runtimeDir:this.activeRuntimeDirPath}}removeLockfile(){if(this.shouldWriteLockfile)try{V()}catch{}}handleHttpRequest(e,t){if(t.setHeader("Cross-Origin-Opener-Policy","same-origin"),t.setHeader("Cross-Origin-Embedder-Policy",Dt),t.setHeader("Cross-Origin-Resource-Policy","cross-origin"),t.setHeader("Document-Policy","js-profiling"),Ue(e.url)){We(e,t);return}if(Fe(e.url)&&$e(e,t))return;if(Ve(e.url)){Je(e,t);return}let i=(e.method||"GET").toUpperCase(),s;try{s=new URL(e.url||"/",`http://${e.headers.host||"localhost"}`)}catch{t.writeHead(400,{"Content-Type":"text/plain; charset=utf-8"}),t.end("invalid request URL or host");return}if(s.pathname==="/__sootsim/shared-config"){if(t.setHeader("Access-Control-Allow-Origin","*"),t.setHeader("Access-Control-Allow-Headers","Content-Type"),t.setHeader("Cache-Control","no-store"),i==="OPTIONS"){t.writeHead(204,{Allow:"GET, HEAD, POST, OPTIONS"}),t.end();return}if(i==="GET"||i==="HEAD"){let u="{}";try{u=JSON.stringify($())}catch{}t.writeHead(200,{"Content-Type":"application/json"}),i==="HEAD"?t.end():t.end(u);return}if(i==="POST"){(async()=>{try{let u=[],p=0;for await(let g of e){let b=Buffer.isBuffer(g)?g:Buffer.from(g);if(p+=b.byteLength,p>8*1024*1024){t.writeHead(413,{"Content-Type":"text/plain; charset=utf-8"}),t.end("shared config patch is too large");return}u.push(b)}let m=JSON.parse(Buffer.concat(u).toString("utf8"));if(!m||typeof m!="object"||Array.isArray(m))throw new Error("shared config patch must be an object");let f=Object.fromEntries(Object.entries(m)),h=this.writeAndBroadcastSharedConfig(f);t.writeHead(200,{"Content-Type":"application/json"}),t.end(JSON.stringify(h))}catch(u){t.writeHead(400,{"Content-Type":"text/plain; charset=utf-8"}),t.end(`invalid shared config patch: ${u instanceof Error?u.message:String(u)}`)}})();return}t.writeHead(405,{Allow:"GET, HEAD, POST, OPTIONS"}),t.end("method not allowed");return}if(s.pathname.startsWith(qe)){this.handleCameraFixture(s.pathname.slice(qe.length),e,t);return}if(i!=="GET"&&i!=="HEAD"){t.writeHead(405,{Allow:"GET, HEAD"}),t.end("method not allowed");return}if(s.pathname==="/__bundle-proxy"){let u=s.searchParams.get("url");if(!u){t.writeHead(400,{"Content-Type":"text/plain"}),t.end("bundle-proxy: missing url query param");return}let p;try{p=new URL(u)}catch{t.writeHead(400,{"Content-Type":"text/plain"}),t.end("bundle-proxy: invalid url");return}let m=p.hostname;if(!(m==="localhost"||m==="127.0.0.1"||m==="::1"||m.endsWith(".localhost"))){t.writeHead(403,{"Content-Type":"text/plain"}),t.end("bundle-proxy: only loopback targets allowed");return}(async()=>{try{let h=await fetch(p.toString(),{redirect:"follow"}),g={},b=h.headers.get("content-type");if(b&&(g["Content-Type"]=b),g["Cache-Control"]="no-store",t.writeHead(h.status,g),!h.body){t.end();return}let w=h.body.getReader();for(;;){let{done:A,value:y}=await w.read();if(A)break;t.write(Buffer.from(y))}t.end()}catch(h){t.writeHead(502,{"Content-Type":"text/plain"}),t.end(`bundle-proxy: upstream fetch failed: ${h instanceof Error?h.message:String(h)}`)}})();return}if(s.pathname==="/__server-scan"){this.handleServerScan(t);return}if(s.pathname==="/healthz"){t.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),t.end(JSON.stringify({ok:!0,pid:process.pid,platform:process.platform,bridgePort:this.effectivePort,runtimePort:this.effectivePort,activeRuntime:this.activeRuntimeVersion,bridgeSource:this.shouldWriteDevLockfile?"vite-dev":this.shouldWriteLockfile?"daemon":"embedded",startedAt:this.startedAt,uptimeMs:this.startedAt>0?Date.now()-this.startedAt:0}));return}let n=ge(s.hostname),c=M(s.hostname);n||this.refreshActiveRuntime();let r=n?Se(s.hostname):this.activeRuntimeDirPath;if(!r){t.writeHead(503,{"Content-Type":"text/plain; charset=utf-8"}),t.end(n?`rnx: runtime ${c??"(invalid version origin)"} is not installed. run \`rnx open\` from that app again.`:"rnx: no active runtime installed. run `rnx runtime install` to fetch one.");return}let a=s.pathname;if(a==="/runtime"||a==="/runtime/"?a="/":a.startsWith("/runtime/")?a=a.slice(8):a==="/sootsim"||a==="/sootsim/"?a="/":a.startsWith("/sootsim/")&&(a=a.slice(8)),(a===""||a==="/")&&(a="/index.html"),a.includes("\0")){t.writeHead(400),t.end("bad request");return}if(process.platform!=="win32"&&a.includes("\\")){t.writeHead(400),t.end("bad request");return}for(let u of a.split("/"))if(u===".."){t.writeHead(403),t.end("forbidden");return}let l=v.resolve(r,"."+a),d=r.endsWith(v.sep)?r:r+v.sep;if(!l.startsWith(d)&&l!==r){t.writeHead(403),t.end("forbidden");return}T.realpath(l,(u,p)=>{let m=u?l:p,f=m.endsWith(v.sep)?m:m+v.sep;if(!u){let h=(()=>{try{let g=T.realpathSync(r);return g.endsWith(v.sep)?g:g+v.sep}catch{return d}})();if(!f.startsWith(h)&&m+v.sep!==h){t.writeHead(403),t.end("forbidden");return}}T.stat(m,(h,g)=>{if(h||!g?.isFile()){let y=v.extname(a).toLowerCase();if(y&&y!==".html"){t.writeHead(404),t.end("not found");return}if(a.startsWith("/__")||a.startsWith("/api/")||a==="/api"){t.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),t.end("not found");return}let x=v.join(r,"index.html");T.readFile(x,(Ze,Qe)=>{if(Ze){t.writeHead(404),t.end("not found");return}if(t.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),i==="HEAD"){t.end();return}t.end(Ye(Qe,this.effectivePort,this.contrastOrigin))});return}let b=v.extname(m).toLowerCase(),w=ze[b]||"application/octet-stream";if(t.writeHead(200,{"Content-Type":w,"Cache-Control":"no-store"}),i==="HEAD"){t.end();return}if(b===".html"){T.readFile(m,(y,x)=>{if(y){try{t.end()}catch{}return}t.end(Ye(x,this.effectivePort,this.contrastOrigin))});return}let A=T.createReadStream(m);A.pipe(t),A.on("error",()=>{try{t.end()}catch{}})})})}sweepIdleCliClients(){let e=Date.now(),t=!1;for(let[i,s]of this.cliSimBySocket){let n=this.cliLastCommandAt.get(i)??0;if(e-n<o.CLI_IDLE_TIMEOUT_MS)continue;let c=!1;for(let r of this.cliBySentId.values())if(r.ws===i){c=!0;break}if(!c){this.cliSimBySocket.delete(i),this.cliLastCommandAt.delete(i);for(let[r,a]of this.cliBySentId)a.ws===i&&this.cliBySentId.delete(r);try{i.close(1e3,"idle timeout")}catch{}t=!0}}t&&this.broadcastSimClientStates(),this.sweepRestorableSims(e),this.reapIdleSims(e)}isAutomationSim(e){return e.meta?.sootsimHostDriver==="playwright"}automationSimOwnerAlive(e){let t=Number(e.meta?.sootsimHostPid);if(!Number.isInteger(t)||t<=1||t===process.pid)return!1;try{return process.kill(t,0),!0}catch(i){return i.code==="EPERM"}}reapIdleSims(e=Date.now()){let t=new Set(this.cliSimBySocket.values()),i=[];for(let n of this.sims.values()){if(n.id===this.primarySimId||t.has(n.id)||this.getActiveLease(n))continue;let c=Math.max(n.lastActiveAt,n.connectedAt),r=e-c,a=this.isAutomationSim(n);if(a&&this.automationSimOwnerAlive(n))continue;let l=a?this.automationSimIdleReapTtlMs:this.simIdleReapTtlMs;if(r>=l){this.closeSimSocketFromHost(n.ws);continue}a&&i.push({sim:n,idleMs:r})}let s=this.maxConcurrentAutomationSims;if(i.length>s){i.sort((n,c)=>c.idleMs-n.idleMs);for(let{sim:n,idleMs:c}of i.slice(0,i.length-s))c<this.automationSimActiveGraceMs||this.closeSimSocketFromHost(n.ws)}}sweepDeadWebSockets(){if(this.wss)for(let e of this.wss.clients){if(e.readyState!==S.OPEN)continue;if(this.wsIsAlive.get(e)===!1){try{e.terminate()}catch{}continue}this.wsIsAlive.set(e,!1);try{e.ping()}catch{try{e.terminate()}catch{}}}}closeSimSocketFromHost(e){if(e.readyState!==S.OPEN)return;try{e.close(pe,me)}catch{try{e.terminate()}catch{}return}let t=setTimeout(()=>{if(e.readyState!==S.CLOSED)try{e.terminate()}catch{}},Ht);Xe(t)}listSims(){return Array.from(this.sims.values()).sort((e,t)=>e.id===this.primarySimId?-1:t.id===this.primarySimId?1:e.connectedAt-t.connectedAt).map(e=>this.describeSim(e))}async sendCommand(e){let t=await this.waitForSim(e.simId),i=this.nextCommandId++;return new Promise((s,n)=>{let c=setTimeout(()=>{this.pendingCommands.delete(i),this.broadcastSimClientStates(),n(new Error("command timed out after 30s"))},3e4);this.pendingCommands.set(i,{simId:t.id,resolve:l=>{clearTimeout(c),this.pendingCommands.delete(i),this.broadcastSimClientStates(),s(l)},reject:l=>{clearTimeout(c),this.pendingCommands.delete(i),this.broadcastSimClientStates(),n(l)}}),this.broadcastSimClientStates();let{simId:r,...a}=e;t.ws.send(JSON.stringify({...a,id:i}))})}async evaluate(e,t){return this.sendCommand({type:"evaluate",code:e,simId:t})}async focusSim(e){return this.sendCommand({type:"focus",simId:e})}async closeSim(e){return this.sendCommand({type:"close",simId:e})}async openPathInEditor(e,t,i){let s=t!=null?`:${t}${i!=null?`:${i}`:""}`:"",n=`${e}${s}`,c=(a,l)=>new Promise(d=>{try{let u=Ot(a,l,{detached:!0,stdio:"ignore"}),p=!1;u.on("error",()=>{p||(p=!0,d(!1))}),u.on("spawn",()=>{p||(p=!0,u.unref(),d(!0))})}catch{d(!1)}}),r=process.env.REACT_EDITOR||process.env.EDITOR;if(r){let a=r.split(" ").filter(Boolean);if(a.length&&await c(a[0],[...a.slice(1),"-g",n]))return}await c("cursor",["-g",n])||await c("code",["-g",n])||await this.openUrl(e)}async openUrl(e,t={}){if(this.openUrlHandler){await this.openUrlHandler(e,t);return}await ye(e,t)}async close(){if(this.cliIdleTimer&&(clearInterval(this.cliIdleTimer),this.cliIdleTimer=null),this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null),this.devHeartbeatTimer&&(clearInterval(this.devHeartbeatTimer),this.devHeartbeatTimer=null),this.wsHeartbeatTimer&&(clearInterval(this.wsHeartbeatTimer),this.wsHeartbeatTimer=null),this.runtimeUpdateTimer&&(clearInterval(this.runtimeUpdateTimer),this.runtimeUpdateTimer=null),this.shouldWriteLockfile)try{V()}catch{}if(this.shouldWriteDevLockfile)try{ce({bridgePort:this.effectivePort,pid:process.pid,startedAt:this.startedAt})}catch{}this.effectivePort=0,this.startedAt=0,this.agentHost.close();for(let[i,s]of this.pendingCommands)s.reject(new Error("server closing")),this.pendingCommands.delete(i);for(let i of this.sims.values())i.ws.close();this.sims.clear(),this.primarySimId=null;let e=this.wss,t=this.httpServer;if(this.wss=null,this.httpServer=null,e)try{e.close()}catch{}if(t)try{t.close()}catch{}}describeSim(e){let t;try{t=e.ws.readyState}catch{t=S.CLOSED}let i=this.getActiveLease(e);return{id:e.id,origin:e.origin,url:e.url,title:e.title,userAgent:e.userAgent,connectedAt:e.connectedAt,lastSeenAt:e.lastSeenAt,lastActiveAt:e.lastActiveAt||void 0,isPrimary:e.id===this.primarySimId,readyState:t===S.OPEN?"open":t===S.CLOSING?"closing":"closed",attachedCliCount:this.getAttachedCliCount(e.id),lockedBy:i?i.cliLabel||i.cliIdentityKey:void 0,lockedByKind:i?i.kind:void 0,lockExpiresAt:i?i.expiresAt:void 0,userFocused:e.userFocused||void 0,userVisible:e.userVisible,visibilityState:e.visibilityState,documentFocused:e.documentFocused,kind:e.kind,meta:e.meta}}getActiveLease(e){let t=e.cliLease;return t?Date.now()>=t.expiresAt?(e.cliLease=void 0,null):t:null}tryAcquireLease(e,t,i={}){let s=this.cliIdentityKeyBySocket.get(e)??(()=>{let u=`ws-${this.nextCliFallbackId++}`;return this.cliIdentityKeyBySocket.set(e,u),u})(),n=this.cliLabelBySocket.get(e),c=Date.now(),r=this.getActiveLease(t),a=r&&r.cliIdentityKey===s,l=0;if(r&&!a&&!i.force)return{granted:!1,lease:r,lock:{by:r.cliLabel||r.cliIdentityKey,expiresInMs:Math.max(0,r.expiresAt-c)},bootedCount:0};if(r&&!a&&i.force)for(let[u,p]of this.cliSimBySocket){if(p!==t.id)continue;let m=this.cliIdentityKeyBySocket.get(u);if(m&&m!==s){this.cliSimBySocket.delete(u);try{u.close(1e3,"lease claimed by another cli")}catch{}l++}}let d={kind:"cli",cliIdentityKey:s,cliLabel:n,expiresAt:c+o.CLI_LEASE_TTL_MS};return t.cliLease=d,{granted:!0,lease:d,bootedCount:l}}updateUserFocusLease(e,t){let i=t.focused===!0,s=typeof t.visible=="boolean"?t.visible:void 0,n=typeof t.visibilityState=="string"?t.visibilityState:void 0,c=typeof t.documentFocused=="boolean"?t.documentFocused:void 0;e.userFocused===i&&e.userVisible===s&&e.visibilityState===n&&e.documentFocused===c||(e.userFocused=i,e.userVisible=s,e.visibilityState=n,e.documentFocused=c,this.broadcastSimClientStates())}updateUserActivity(e){let t=this.getActiveLease(e);if(t&&t.kind==="cli")return;let s=Date.now()+o.USER_ACTIVE_LEASE_TTL_MS,n=t&&t.kind==="user-active"?Math.max(t.expiresAt,s):s;e.cliLease={kind:"user-active",cliIdentityKey:"__user-active__",cliLabel:"active user",expiresAt:n},this.broadcastSimClientStates()}ensureCliIdentityKey(e){let t=this.cliIdentityKeyBySocket.get(e);if(t)return t;let i=`ws-${this.nextCliFallbackId++}`;return this.cliIdentityKeyBySocket.set(e,i),i}getOpenSim(e){if(e){let i=this.sims.get(e);return i?.ws.readyState===S.OPEN?i:null}let t=this.getDefaultSimCandidates();return t.find(i=>i.id===this.primarySimId)??t[0]??null}getDefaultSimCandidates(){let e=Array.from(this.sims.values()).filter(i=>i.ws.readyState===S.OPEN),t=e.filter(i=>i.url);return t.length>0?t:e}async waitForSim(e,t={}){let i=t.attempts??10,s=t.intervalMs??200;for(let c=0;c<i;c++){if(e){let r=this.getOpenSim(e);if(r)return r}else{let r=this.getDefaultSimCandidates();if(r.length>1)throw new Error(`multiple sims are connected: ${r.map(l=>l.id).join(", ")}; run \`rnx use <sim>\` or pass \`--sim <sim>\``);let a=r[0];if(a)return a}await new Promise(r=>setTimeout(r,s))}if(!e)throw new Error("no sim connected");let n=this.getDefaultSimCandidates().map(c=>c.id);throw new Error(`no sim connected with id ${e}`+(n.length>0?`; connected sims: ${n.join(", ")}`:""))}shouldPromoteSim(e){let t=this.primarySimId?this.sims.get(this.primarySimId):null;if(!e.url)return!t;let i=t?.ws.readyState===S.OPEN;if(!t||!i||!t.url)return!0;let s=e.origin?.includes(":5173"),n=t.origin?.includes(":5173");return!!s||!n}broadcastSimAssignments(){for(let e of this.sims.values())e.ws.readyState===S.OPEN&&e.ws.send(JSON.stringify({type:"bridge:welcome",simId:e.id,isPrimary:e.id===this.primarySimId}))}writeAndBroadcastSharedConfig(e){let t=Q(e),i=JSON.stringify({type:"bridge:shared-config-changed",config:t});for(let s of this.sims.values())if(s.ws.readyState===S.OPEN)try{s.ws.send(i)}catch{}return t}broadcastSimClientStates(){for(let e of this.sims.values()){if(e.ws.readyState!==S.OPEN)continue;let t=this.getActiveLease(e),i={type:"bridge:client-state",attachedCliCount:this.getAttachedCliCount(e.id),activeAgentCommandCount:this.getActiveAgentCommandCount(e.id),recentActions:e.recentActions,lockedBy:t?t.cliLabel||t.cliIdentityKey:void 0,lockedByKind:t?t.kind:void 0,lockExpiresAt:t?t.expiresAt:void 0,userFocused:e.userFocused||void 0,userVisible:e.userVisible,visibilityState:e.visibilityState,documentFocused:e.documentFocused};e.ws.send(JSON.stringify(i))}}setCliSimTarget(e,t){let i=this.cliSimBySocket.get(e);i!==t&&(this.cliSimBySocket.set(e,t),this.recordSimAction(t,i?"cli switched sims":"cli connected",!1),this.broadcastSimClientStates())}recordSimAction(e,t,i=!0){let s=t?.trim();if(!s)return;let n=this.sims.get(e);if(!n)return;let c=Date.now();n.lastActiveAt=c,n.recentActions=[{label:s,at:c},...n.recentActions.filter(r=>r.label!==s)].slice(0,4),i&&this.broadcastSimClientStates()}describeForwardedCommand(e){switch(e?.type){case"evaluate":return"evaluated page state";case"screenshot":return"captured screenshot";case"tap":return"sent tap event";case"keyboard":return e?.action==="type"?"typed text":"used keyboard";case"tree":return"dumped tree";case"focus":return"focused sim";case"close":return"requested close";default:return typeof e?.type=="string"?e.type:null}}getAttachedCliCount(e){let t=new Set;for(let[i,s]of this.cliSimBySocket){if(s!==e||i.readyState!==S.OPEN)continue;let n=this.cliIdentityKeyBySocket.get(i);t.add(n??`ws-unknown-${t.size}`)}return t.size}getOtherCliIdentityCount(e,t){let i=this.cliIdentityKeyBySocket.get(e),s=new Set;for(let[n,c]of this.cliSimBySocket){if(c!==t||n.readyState!==S.OPEN)continue;let r=this.cliIdentityKeyBySocket.get(n);r&&r===i||s.add(r??`ws-unknown-${s.size}`)}return s.size}getActiveAgentCommandCount(e){let t=0;for(let i of this.pendingCommands.values())i.simId===e&&t++;return t}allocateSimId(){for(;;){let e=this.nextSimNumber.toString(16);if(this.nextSimNumber++,!this.sims.has(e)&&!this.restorableSims.has(e))return e}}tryRestoreSimId(e,t){let i=t?.trim();if(!i||i===e.id)return!1;let s=this.sims.get(i);if(s&&s!==e&&s.ws.readyState===S.OPEN)return!1;let n=this.getRestorableSimState(i),c=e.id;this.sims.delete(c),e.id=i,n&&(e.recentActions=n.recentActions.map(r=>({...r})),e.lastActiveAt=n.lastActiveAt,e.cliLease=n.cliLease?{...n.cliLease}:void 0,this.restorableSims.delete(i)),this.sims.set(e.id,e),this.primarySimId===c&&(this.primarySimId=e.id);for(let[r,a]of this.cliSimBySocket)a===c&&this.cliSimBySocket.set(r,e.id);return!0}rememberDisconnectedSim(e){let t=this.getActiveLease(e);this.restorableSims.set(e.id,{recentActions:e.recentActions.map(i=>({...i})),lastActiveAt:e.lastActiveAt,cliLease:t&&t.kind==="cli"?{...t}:void 0,expiresAt:Date.now()+o.SIM_RECONNECT_TTL_MS}),this.sims.delete(e.id),this.writeConnectedRuntimeSnapshot()}getRestorableSimState(e){let t=this.restorableSims.get(e);return t?t.expiresAt<=Date.now()?(this.restorableSims.delete(e),null):(t.cliLease&&t.cliLease.expiresAt<=Date.now()&&(t.cliLease=void 0),t):null}sweepRestorableSims(e=Date.now()){for(let[t,i]of this.restorableSims)if(!(i.expiresAt>e)){this.restorableSims.delete(t);for(let[s,n]of this.cliSimBySocket)n===t&&this.cliSimBySocket.delete(s)}}resetServerState(){this.cliIdleTimer&&(clearInterval(this.cliIdleTimer),this.cliIdleTimer=null),this.wsHeartbeatTimer&&(clearInterval(this.wsHeartbeatTimer),this.wsHeartbeatTimer=null),this.runtimeUpdateTimer&&(clearInterval(this.runtimeUpdateTimer),this.runtimeUpdateTimer=null);let e=this.wss,t=this.httpServer;if(this.wss=null,this.httpServer=null,e)try{e.close()}catch{}if(t)try{t.close()}catch{}}};function jt(){return!!((process.env.XPC_SERVICE_NAME||"").includes("dev.sootsim.daemon")||process.env.INVOCATION_ID)}async function Bi(o,e={}){(o.includes("--help")||o.includes("-h"))&&(console.log(`
|
|
100
|
+
rnx serve \u2014 run the rnx bridge in the foreground
|
|
101
|
+
|
|
102
|
+
hosts the WS bridge that CLI commands talk to. once running, any rnx
|
|
103
|
+
renderer (browser, electron, headless playwright) that connects to port 7668
|
|
104
|
+
becomes drivable from 'rnx describe', 'rnx do tap', etc.
|
|
105
|
+
|
|
106
|
+
usage:
|
|
107
|
+
rnx serve [options]
|
|
108
|
+
|
|
109
|
+
options:
|
|
110
|
+
--port <n> bridge port (defaults to ${7668})
|
|
111
|
+
--quiet suppress per-connection logging
|
|
112
|
+
|
|
113
|
+
examples:
|
|
114
|
+
rnx serve
|
|
115
|
+
rnx serve --port 7668 --quiet
|
|
116
|
+
`),process.exit(0));let t=o.indexOf("--port"),i=t>=0&&o[t+1]?Number(o[t+1]):e.port??7668;Number.isNaN(i)&&(console.error(` invalid --port value: ${o[t+1]}`),process.exit(1));let s=o.includes("--quiet")||o.includes("-q"),n=re();n&&ne(n)&&(console.error(` an rnx bridge is already running (pid ${n.pid}, port ${n.bridgePort})`),console.error(" stop it with 'rnx daemon stop' first"),process.exit(1)),_();let c=await be(),r=new U({port:i,writeLockfile:!0,contrastOrigin:c}),a=await r.startAsync({silent:s}),l=Date.now(),d=f=>{s||process.stdout.write(`${f}
|
|
117
|
+
`)},u=new Set,p=setInterval(()=>{let f=r.listSims(),h=new Set(f.map(g=>g.id));for(let g of f)if(!u.has(g.id)){let b=g.title||g.url||g.origin||"(unknown)";d(` + ${g.id} ${b}`)}for(let g of u)h.has(g)||d(` - ${g}`);u.clear();for(let g of h)u.add(g)},500);de({event:"daemon_heartbeat",properties:{bridge_port:a,under_daemon:jt(),platform:process.platform,subsource:"daemon"}}),le(),d(`rnx bridge listening on ws://localhost:${a} (runtime http on same port)`),a!==i&&d(` (preferred port ${i} was taken \u2014 fell back to ${a})`),d(" ready for browser, electron, or headless playwright sims to connect"),d(" (ctrl-c to stop)");let m=async f=>{clearInterval(p),d(`
|
|
118
|
+
${f} received \u2014 shutting down after ${Math.round((Date.now()-l)/1e3)}s`);try{await r.close()}catch{}process.exit(0)};process.on("SIGINT",()=>m("SIGINT")),process.on("SIGTERM",()=>m("SIGTERM")),process.on("SIGHUP",()=>m("SIGHUP")),process.on("exit",()=>{try{r.removeLockfile()}catch{}}),await new Promise(()=>{})}export{Bi as runServe};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{a as d}from"./chunk-
|
|
4
|
+
import{a as d}from"./chunk-QB3OJYP2.js";import{d as V,f as q,g as J,i as F,j as B}from"./chunk-ZDWXB3EA.js";import{b as x,c as L}from"./chunk-RQZ6VKLY.js";import{c as k}from"./chunk-LVVXPCZU.js";import"./chunk-KH2WSUUG.js";import{f as y}from"./chunk-L3PC6LFJ.js";import"./chunk-WCNBNVO4.js";import"./chunk-F67L5MAP.js";import"./chunk-5XINSS6Z.js";import"./chunk-KDVRXHJ4.js";import"./chunk-RK3WWN2D.js";import"./chunk-233ZNBFD.js";import"./chunk-BYYIT6KJ.js";import"./chunk-QJSDXTPT.js";import{C as R,D as C,J as w,M as N,O as I,l as v}from"./chunk-JHDSF45Z.js";import{a as T}from"./chunk-4MLXHZHM.js";import{a as s}from"./chunk-4ECKZJFH.js";import"./chunk-7ZUYO4NL.js";import"./chunk-4GPFCG2O.js";import $ from"node:fs";import z from"node:os";import P from"node:path";import{spawn as re}from"node:child_process";import l from"node:fs";import a from"node:path";function Y(e){let n=a.resolve(e);for(;;){if(l.existsSync(a.join(n,"package.json")))return n;let r=a.dirname(n);if(r===n)return null;n=r}}function j(e){let n=a.resolve(e);for(;;){if(l.existsSync(a.join(n,"bun.lock"))||l.existsSync(a.join(n,"bun.lockb")))return"bun";if(l.existsSync(a.join(n,"pnpm-lock.yaml")))return"pnpm";if(l.existsSync(a.join(n,"package-lock.json")))return"npm";let r=a.dirname(n);if(r===n)return"npm";n=r}}function H(e){let n=a.resolve(e.appDir),r=te(a.join(n,"package.json")),t=`${s.commandName} open`,o=r.scripts?.[s.commandName];if(o&&o!==t)throw new Error(`package.json already defines scripts.${s.commandName} as ${JSON.stringify(o)}; resolve that conflict before setup`);let i=j(n),c=[];return r.devDependencies?.[s.packageName]!==e.cliVersion&&c.push(oe(i,e.cliVersion)),o!==t&&c.push(ae(i)),{appDir:n,packageManager:i,operations:c}}async function U(e,n){for(let r of e.operations)n.dryRun||await se(r,e.appDir,n.json)}function O(e){return e.operations.map(n=>`${n.command} ${n.args.map(ie).join(" ")}`)}function te(e){let n;try{n=JSON.parse(l.readFileSync(e,"utf8"))}catch(o){let i=o instanceof Error?o.message:String(o);throw new Error(`could not read ${e}: ${i}`)}if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`${e} must contain a JSON object`);let r=W(Reflect.get(n,"scripts")),t=W(Reflect.get(n,"devDependencies"));return{...r?{scripts:r}:{},...t?{devDependencies:t}:{}}}function W(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let n=Object.entries(e).filter(r=>typeof r[1]=="string");return Object.fromEntries(n)}function oe(e,n){let r=`${s.packageName}@${n}`;switch(e){case"bun":return{command:"bun",args:["add","--dev","--exact",r],description:`install ${r} as an exact dev dependency`};case"pnpm":return{command:"pnpm",args:["add","--save-dev","--save-exact",r],description:`install ${r} as an exact dev dependency`};case"npm":return{command:"npm",args:["install","--save-dev","--save-exact",r],description:`install ${r} as an exact dev dependency`}}}function ie(e){return/^[a-zA-Z0-9_./@=-]+$/.test(e)?e:JSON.stringify(e)}function se(e,n,r){return new Promise((t,o)=>{let i=re(e.command,e.args,{cwd:n,stdio:r?["ignore",2,"inherit"]:"inherit"});i.once("error",o),i.once("exit",c=>{c===0?t():o(new Error(`${e.command} exited with code ${c??"unknown"}`))})})}function ae(e){return{command:e,args:e==="bun"?["pm","pkg","set",`scripts.${s.commandName}=${s.commandName} open`]:["pkg","set",`scripts.${s.commandName}=${s.commandName} open`],description:`add the \`${s.commandName}\` package script`}}async function Ye(e){if(e.includes("--help")||e.includes("-h")){je();return}let n=ue(e),r="decisions";try{let t=Y(n.appDir),o=x(),i=R(),c=await le(n,o),X=await de(n,t),g=await K(n,"productAnalytics",i.productAnalytics,i.configured),S=await K(n,"crashReports",i.crashReports,i.configured),ee=await y.fetchManifest(),f=y.resolveVersion(ee,{channel:"stable"}).version,A=T();if(A==="0.0.0")throw new Error("could not resolve the installed rnx CLI version");let p=null;X&&t&&(p=H({appDir:t,cliVersion:A})),he(n),be(n,o,c,f),ve(n,t,p),Re(n,g,S),r="runtime";let M=!1;if(!n.dryRun){let E=w();M=(await y.install({version:f,channel:"stable",setActive:!0,protectVersions:E?[E]:[]})).installed}r="repository",p&&await U(p,{dryRun:n.dryRun,json:n.json}),r="service";let h=o.installed;c&&!o.installed&&!n.dryRun&&(await L({port:7668,force:!1}),h=!0),r="privacy",n.dryRun||C({productAnalytics:g,crashReports:S}),r="compatibility";let u=t?me(t):null,b=await fe(n,u);b&&u&&t&&!n.dryRun&&await ye(t,u),we(n,u,b);let _={runtimeVersion:f,serviceInstalled:h,repositoryPrepared:p!==null,compatibilityShared:b&&!n.dryRun},ne=Se(f);n.json?console.log(JSON.stringify({..._,runtimeInstalled:n.dryRun?!1:M,dryRun:n.dryRun,cache:ne,repositoryOperations:p?O(p):[]},null,2)):ke(p);let m=u?q(u):null;return k({event:"cli_setup_completed",properties:{service_installed:h,repository_prepared:p!==null,product_analytics:g,crash_reports:S,compat_supported:m?.supported??0,compat_partial:m?.partial??0,compat_unsupported:m?.unsupported??0,compat_not_yet_verified:m?.notYetVerified??0,from_welcome:n.fromWelcome,ci:n.ci,dry_run:n.dryRun}}),_}catch(t){let o=xe(t);throw k({event:"cli_setup_failed",properties:{stage:r,message:o}}),t}}function pe(){let e=x(),n=N(),r=w();return{daemonSupported:e.supported,daemonInstalled:e.installed,daemonRunning:!!(n&&I(n)),runtimeInstalled:!!(r&&$.existsSync(v(r))),privacyConfigured:R().configured}}function He(e=pe()){return!e.runtimeInstalled||!e.privacyConfigured}function ue(e){let n=e.indexOf("--app"),r=n>=0?e[n+1]:void 0;if(n>=0&&(!r||r.startsWith("-")))throw new Error("--app requires a directory");let t=G(e,"--service","--no-service"),o=G(e,"--repo","--no-repo");return{appDir:P.resolve(r??process.cwd()),ci:e.includes("--ci"),dryRun:e.includes("--dry-run"),fromWelcome:e.includes("--from-welcome"),json:e.includes("--json"),yes:e.includes("--yes")||e.includes("-y"),service:t,repository:o,productAnalytics:Z(e,"--analytics"),crashReports:Z(e,"--crash-reports"),shareCompatibility:e.includes("--share-compat")}}function G(e,n,r){if(e.includes(n)&&e.includes(r))throw new Error(`${n} and ${r} cannot be used together`);if(e.includes(n))return!0;if(e.includes(r))return!1}function Z(e,n){let r=e.find(i=>i.startsWith(`${n}=`)),t=e.indexOf(n),o=r?.slice(n.length+1)??(t>=0?e[t+1]:void 0);if(o!==void 0){if(o==="on"||o==="yes"||o==="true")return!0;if(o==="off"||o==="no"||o==="false")return!1;throw new Error(`${n} must be on or off`)}}async function le(e,n){if(e.ci){if(e.service===!0)throw new Error("--ci cannot install a machine service");return!1}return n.supported?n.installed&&e.service===void 0?!0:e.service!==void 0?e.service:e.yes?!0:(D(e,"--service or --no-service"),d("Install the background service and shared managed runtime?",!0)):!1}async function de(e,n){if(!n){if(e.repository===!0)throw new Error("--repo requires a package.json");return!1}return e.repository!==void 0?e.repository:e.yes?!0:(D(e,"--repo or --no-repo"),d(`Prepare ${n} for reproducible rnx runs?`,!0))}async function K(e,n,r,t){let o=n==="productAnalytics"?e.productAnalytics:e.crashReports;return o!==void 0?o:t?r:e.yes?!0:(D(e,n==="productAnalytics"?"--analytics on|off":"--crash-reports on|off"),d(n==="productAnalytics"?"Share bounded product analytics?":"Send bounded crash reports?",!0))}async function fe(e,n){return n?e.shareCompatibility?!0:e.yes||!process.stdin.isTTY?!1:d("Share dependency names, requested versions, framework, and this compatibility result?",!1):!1}function D(e,n){if(!(process.stdin.isTTY&&!e.ci))throw new Error(`non-interactive setup requires ${n}, or --yes to accept defaults`)}function me(e){let n=JSON.parse($.readFileSync(P.join(e,"package.json"),"utf8"));if(!n||typeof n!="object")throw new Error("package.json must contain an object");return V(n)}async function ye(e,n){let r=JSON.parse($.readFileSync(P.join(e,"package.json"),"utf8"));if(!r||typeof r!="object")throw new Error("package.json must be an object");let t=await fetch("https://contrast.dev/api/scan",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(ge(r,n)),signal:AbortSignal.timeout(1e4)});if(!t.ok)throw new Error(`compatibility sharing failed with HTTP ${t.status}`)}function ge(e,n){return{dependencies:Q(Reflect.get(e,"dependencies")),devDependencies:Q(Reflect.get(e,"devDependencies")),framework:n.framework,result:{framework:n.framework,rnVersion:n.rnVersion,packages:n.packages.slice(0,200)},source:"desktop",shared:!0}}function Q(e){if(!e||typeof e!="object")return{};let n={};for(let[r,t]of Object.entries(e).slice(0,200))typeof t=="string"&&(n[r.slice(0,160)]=t.slice(0,80));return n}function Se(e){let n=z.platform(),r=z.arch();return{path:v(e),key:`sootsim-runtime-${n}-${r}-${e}`,inputs:{platform:n,arch:r,runtimeVersion:e}}}function he(e){e.json||console.log(`
|
|
5
5
|
${e.fromWelcome?"welcome to rnx":"rnx setup"}`)}function be(e,n,r,t){e.json||(console.log(`
|
|
6
6
|
1. machine`),console.log(` stable runtime: ${t}`),console.log(` background service: ${n.supported?r?"install":"skip":"unsupported on this platform"}`))}function ve(e,n,r){if(!e.json){if(console.log(`
|
|
7
7
|
2. repository`),!n){console.log(" no package.json found; repository preparation skipped");return}if(!r){console.log(` skipped for ${n}`);return}console.log(` package manager: ${j(n)}`);for(let t of O(r))console.log(` ${e.dryRun?"would run":"run"}: ${t}`)}}function Re(e,n,r){e.json||(console.log(`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{a as h}from"./chunk-
|
|
4
|
+
import{a as h}from"./chunk-4ECKZJFH.js";import"./chunk-4GPFCG2O.js";import*as l from"fs";import*as L from"os";import*as a from"path";import{fileURLToPath as x}from"url";function D(){try{let e=x(import.meta.resolve(`${h.packageName}/package.json`));return a.join(a.dirname(e),"skills")}catch{let e=a.dirname(x(import.meta.url));return a.resolve(e,"../../skills")}}var d=D(),j=new Set(["all","codex","claude"]);function S(){console.log(`rnx skill
|
|
5
5
|
|
|
6
6
|
install and inspect bundled rnx agent skills.
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{m as a}from"./chunk-
|
|
4
|
+
import{m as a}from"./chunk-4AXUIGKV.js";import"./chunk-FF2RR6C3.js";import{q as c,s as l}from"./chunk-233ZNBFD.js";import"./chunk-BYYIT6KJ.js";import"./chunk-JHDSF45Z.js";import"./chunk-4GPFCG2O.js";function g(t){return!!t&&typeof t=="object"&&typeof Reflect.get(t,"capturedAt")=="number"}function p(){console.log(`
|
|
5
5
|
rnx state - capture the current app state in one call
|
|
6
6
|
|
|
7
7
|
usage:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{b as s,c as l,d as c,e as a,f}from"./chunk-
|
|
4
|
+
import{b as s,c as l,d as c,e as a,f}from"./chunk-JQXE2VJ5.js";import{a as t}from"./chunk-QWGOVJGL.js";import"./chunk-4AXUIGKV.js";import"./chunk-FF2RR6C3.js";import"./chunk-233ZNBFD.js";import"./chunk-BYYIT6KJ.js";import"./chunk-JHDSF45Z.js";import"./chunk-4GPFCG2O.js";function p(){console.log(`
|
|
5
5
|
rnx storage profile \u2014 manage isolated storage profiles
|
|
6
6
|
|
|
7
7
|
usage:
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! rnx v0.1.341 | (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}from"./chunk-FKYMTZEX.js";import"./chunk-RK3WWN2D.js";import"./chunk-4GPFCG2O.js";export{a as settingsStore};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{c as a,d as b}from"./chunk-LVVXPCZU.js";import"./chunk-KH2WSUUG.js";import"./chunk-JHDSF45Z.js";import"./chunk-4GPFCG2O.js";export{b as flushCliTelemetry,a as trackCliEvent};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{q as m,s as d,v as i}from"./chunk-
|
|
4
|
+
import{q as m,s as d,v as i}from"./chunk-233ZNBFD.js";import"./chunk-BYYIT6KJ.js";import"./chunk-JHDSF45Z.js";import"./chunk-4GPFCG2O.js";import{writeFileSync as g}from"fs";function u(){console.log(`
|
|
5
5
|
rnx timeline \u2014 control the semantic event timeline
|
|
6
6
|
|
|
7
7
|
usage:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{a as h,b as v,c as $}from"./chunk-
|
|
4
|
+
import{a as h,b as v,c as $}from"./chunk-XPBSKCKS.js";import{b as p}from"./chunk-YZAD6XZI.js";import"./chunk-LD4Y4JIQ.js";import{b as g}from"./chunk-L3PC6LFJ.js";import"./chunk-233ZNBFD.js";import"./chunk-BYYIT6KJ.js";import{J as a,g as m,h as u,l as d}from"./chunk-JHDSF45Z.js";import{a as f}from"./chunk-4MLXHZHM.js";import"./chunk-4ECKZJFH.js";import"./chunk-4GPFCG2O.js";import{spawn as y}from"node:child_process";import x from"node:fs";import R from"node:os";import s from"node:path";var b="https://registry.npmjs.org/rnxsim/latest";async function W(t){let n=t.indexOf("--channel"),e=n>=0&&t[n+1]?t[n+1]:void 0;console.log(`rnx upgrade
|
|
5
5
|
`),console.log("runtime:");let o=a(),{config:l}=await p(),r=l?.runtimeVersion,c=r?x.existsSync(s.join(d(r),"index.html")):!1;r&&console.log(` project config: v${r}`);let i=(r&&c?null:await $(["install",...r?[r,"--set-active=false"]:[],...e?["--channel",e]:[]],{}))?.version??r??a();i&&console.log(r?c?` result: v${i} already installed for this project`:` result: not installed \u2192 v${i} for this project`:o&&o!==i?` result: v${o} \u2192 v${i}`:o?` result: v${i} already current`:` result: not installed \u2192 v${i}`);let k=i?await h(i):null;console.log(`
|
|
6
6
|
cli:`),await j(),i&&console.log(`
|
|
7
7
|
${v(i,k)}`)}function w(){if(u())return{kind:"dev"};let t=process.argv[1]??"";try{t=x.realpathSync(t)}catch{}let n=s.sep;if(t.includes(`${n}_npx${n}`)||t.includes(`${n}.bunx${n}`))return{kind:"npx"};if(t.includes(`${n}.bun${n}`))return{kind:"global",command:"bun",args:["add","-g","rnxsim@latest"]};if(t.includes(`${n}pnpm${n}`))return{kind:"global",command:"pnpm",args:["add","-g","rnxsim@latest"]};let e=s.join(m(),"cli");if(t.startsWith(`${e}${n}`))return{kind:"global",command:"npm",args:["i","-g","--prefix",e,"rnxsim@latest"]};let o=s.resolve(process.env.SOOTSIM_CLI_PREFIX||s.join(R.homedir(),".local"));return t.startsWith(`${o}${n}`)?{kind:"global",command:"npm",args:["i","-g","--prefix",o,"rnxsim@latest"]}:{kind:"global",command:"npm",args:["i","-g","rnxsim@latest"]}}async function j(){let t=f(),n=await C();if(!n){console.log(` v${t} \u2014 couldn't reach the npm registry, skipped`);return}if(g(n,t)<=0){console.log(` v${t} (latest)`);return}let e=w();if(console.log(` v${t} \u2192 v${n}`),e.kind==="dev"){console.log(" running from the Contrast dev checkout \u2014 pull instead of upgrading");return}if(e.kind==="npx"){console.log(" running from the npx cache \u2014 get the latest with:"),console.log(" npx rnxsim@latest");return}let o=`${e.command} ${e.args.join(" ")}`;console.log(` updating global install (${o})\u2026`),await S(e.command,e.args)?console.log(` updated to v${n}`):(console.log(" update failed \u2014 run it yourself:"),console.log(` ${o}`))}function S(t,n){return new Promise(e=>{let o=y(t,n,{stdio:"inherit"});o.on("error",()=>e(!1)),o.on("exit",l=>e(l===0))})}async function C(){try{let t=await fetch(b,{headers:{accept:"application/json"},signal:AbortSignal.timeout(8e3)});if(!t.ok)return null;let n=await t.json();return typeof n.version=="string"&&n.version?n.version:null}catch{return null}}export{W as runUpgrade};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{e as a,f as b,g as c}from"./chunk-4H6JNBY6.js";import"./chunk-G3PR7UQP.js";import"./chunk-QSBX4L73.js";import"./chunk-76IAWM7K.js";import"./chunk-LD4Y4JIQ.js";import"./chunk-2X65F3HT.js";import"./chunk-LVVXPCZU.js";import"./chunk-KH2WSUUG.js";import"./chunk-233ZNBFD.js";import"./chunk-BYYIT6KJ.js";import"./chunk-JHDSF45Z.js";import"./chunk-4ECKZJFH.js";import"./chunk-4GPFCG2O.js";export{a as resolveDefaultUploadOrigin,b as resolvePublicPreviewOrigin,c as runUpload};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{b as a}from"./chunk-
|
|
4
|
+
import{b as a}from"./chunk-YZAD6XZI.js";import"./chunk-LD4Y4JIQ.js";import{d as s,f as t}from"./chunk-L3PC6LFJ.js";import{a as m}from"./chunk-F67L5MAP.js";import"./chunk-233ZNBFD.js";import"./chunk-BYYIT6KJ.js";import{l as r}from"./chunk-JHDSF45Z.js";import{a as l}from"./chunk-4MLXHZHM.js";import"./chunk-4ECKZJFH.js";import"./chunk-4GPFCG2O.js";import g from"node:fs";import d from"node:path";async function R($){let{IS_BETA:c,BETA_LABEL:u}=await import("./beta-QHOS4FLY.js"),f=c?` \xB7 ${u}`:"";console.log(`rnx v${l()}${f}`);let o=m(),n=t.resolveChannel();o.isDevBridge?(console.log(o.primary),o.installedRuntime&&console.log(`${o.installedRuntime} \xB7 ${n}`)):o.primary==="runtime not installed"?console.log("runtime not installed \u2014 run `rnx runtime install`"):console.log(`${o.primary} \xB7 ${n}`);let{config:e}=await a();if(e?.runtimeVersion){let p=g.existsSync(d.join(r(e.runtimeVersion),"index.html"));console.log(`project runtime v${e.runtimeVersion} \xB7 configured \xB7 ${p?"installed":"installs on open"}`)}let i=await t.checkUpToDate({channel:n});i.outdated&&i.latest&&console.log(`
|
|
5
5
|
\u2191 default runtime v${i.latest} available; run \`rnx upgrade\``),console.log(`
|
|
6
6
|
what's new: ${s}`)}export{R as runVersion};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{a,b,c,d,e,f,g,h,i,j}from"./chunk-
|
|
4
|
+
import{a,b,c,d,e,f,g,h,i,j}from"./chunk-ZDWXB3EA.js";import"./chunk-4GPFCG2O.js";export{b as COMPAT_CATEGORIES,j as COMPAT_RESULT_CAVEAT,c as POLYFILL_REGISTRY,a as UNSUPPORTABLE,f as countScanResults,i as formatDetailedScanLines,h as formatPackageStatus,g as formatScanCounts,d as scanDeps,e as scanDepsWithData};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{D as F,E as T,G as y,R as A,S as b,T as S}from"./chunk-
|
|
4
|
+
import{D as F,E as T,G as y,R as A,S as b,T as S}from"./chunk-FF2RR6C3.js";import{e as k,q as x,s as N}from"./chunk-233ZNBFD.js";import"./chunk-BYYIT6KJ.js";import"./chunk-JHDSF45Z.js";import"./chunk-4GPFCG2O.js";function O(n){let t=[];for(let e=0;e<n.length;e++)if(n[e]==="--since"&&e+1<n.length){t.push(e,e+1);let s=n[e+1].trim(),l=/^(\d+(?:\.\d+)?)(ms|s|m)?$/.exec(s);if(l){let c=Number(l[1]),u=l[2]??"ms",v=u==="s"?c*1e3:u==="m"?c*6e4:c;return{since:Date.now()-v,consumed:t}}let i=Number(s);if(Number.isFinite(i)&&i>1e12)return{since:i,consumed:t}}return{consumed:t}}function B(n){let t=[];for(let e=0;e<n.length;e++)if(n[e]==="--kinds"&&e+1<n.length)return t.push(e,e+1),{kinds:n[e+1].split(",").map(s=>s.trim()).filter(Boolean),consumed:t};return{consumed:t}}function D(n){let t=[];for(let e=0;e<n.length;e++)if(n[e]==="--limit"&&e+1<n.length){t.push(e,e+1);let s=Number(n[e+1]);if(Number.isFinite(s)&&s>0)return{limit:s,consumed:t}}return{consumed:t}}function _(n){let t=[],e={label:"initial state",events:[],startedAt:n[0]?.t??null};t.push(e);for(let s of n)if(e.events.push(s),s.kind==="screen"||s.kind==="route"){let l=s.data,i=l?.phase;if(!i||i==="enter"||i==="appear"||i==="active"){let c=l?.name||l?.activeName||l?.path||l?.pathname||s.kind;t.length===1&&e.events.length===1?e.label=`${s.kind}: ${c}`:(e={label:`${s.kind}: ${c}`,events:[],startedAt:s.t},t.push(e))}}return t}async function J(n,t){let e=x(n,{port:t.port,stripBooleanFlags:["--summary","--all","--json","--no-advance","--help","-h","--flow","--noisy"],stripValueFlags:["--since","--kinds","--limit"]});(n.includes("--help")||n.includes("-h"))&&(console.log(`
|
|
5
5
|
rnx what-happened \u2014 show recent events from the semantic timeline
|
|
6
6
|
|
|
7
7
|
usage:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.341 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|