rnxsim 0.1.369 → 0.1.371
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/auth.ts +2 -1
- package/cli/bin.ts +283 -273
- package/cli/commands/app-fonts.ts +3 -2
- package/cli/commands/assert.ts +8 -7
- package/cli/commands/auth.ts +2 -1
- package/cli/commands/box/checkout-plane.ts +109 -29
- package/cli/commands/box/cloud-box.ts +294 -0
- package/cli/commands/box/plane-share.ts +208 -0
- package/cli/commands/box/rnx-command.ts +2 -2
- package/cli/commands/box/search-command.ts +157 -0
- package/cli/commands/box.ts +269 -13
- package/cli/commands/config.ts +2 -1
- package/cli/commands/control.ts +43 -34
- package/cli/commands/daemon.ts +22 -21
- package/cli/commands/debug.ts +17 -15
- package/cli/commands/detox.ts +5 -4
- package/cli/commands/device.ts +6 -5
- package/cli/commands/electron.ts +6 -5
- package/cli/commands/flow.ts +12 -11
- package/cli/commands/inspect/find.ts +2 -1
- package/cli/commands/inspect/keyboard.ts +2 -1
- package/cli/commands/inspect/sleep.ts +2 -1
- package/cli/commands/inspect/wait-event.ts +4 -3
- package/cli/commands/inspect/wait-idle.ts +2 -1
- package/cli/commands/inspect/wait-ready.ts +3 -2
- package/cli/commands/inspect/wait-selector.ts +4 -3
- package/cli/commands/inspect/wait.ts +2 -1
- package/cli/commands/inspect.ts +82 -80
- package/cli/commands/install-desktop.ts +5 -4
- package/cli/commands/login.ts +3 -2
- package/cli/commands/mode.ts +2 -1
- package/cli/commands/record.ts +38 -37
- package/cli/commands/runtime.ts +9 -8
- package/cli/commands/screenshot-layers.ts +4 -3
- package/cli/commands/screenshot-mode.ts +2 -1
- package/cli/commands/screenshot.ts +8 -7
- package/cli/commands/screenshots-capture.ts +2 -1
- package/cli/commands/serve.ts +5 -4
- package/cli/commands/shell-boolean-mode.ts +2 -1
- package/cli/commands/skills.ts +11 -10
- package/cli/commands/telemetry.ts +2 -1
- package/cli/commands/three-mode.ts +2 -1
- package/cli/commands/timeline.ts +4 -3
- package/cli/commands/upload.ts +14 -13
- package/cli/commands/what-happened.ts +2 -1
- package/cli/outbound-endpoints.ts +37 -1
- package/cli/recording-access.ts +6 -5
- package/cli/run-rnx.ts +140 -0
- package/dist-cli/bin.js +6 -6
- package/dist-cli/chunks/{agent-OUUFWDLF.js → agent-W2D2V7WF.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-7BE7DR4R.js → agent-wrapper-GVNM2Z4S.js} +2 -2
- package/dist-cli/chunks/app-fonts-J6R4TTXD.js +4 -0
- package/dist-cli/chunks/{assert-I3CMRNS7.js → assert-YN6U4ZTB.js} +11 -11
- package/dist-cli/chunks/auth-XGYZAK2P.js +12 -0
- package/dist-cli/chunks/{beta-BHSKY4K4.js → beta-WRDMHHWJ.js} +2 -2
- package/dist-cli/chunks/{box-3CVWXVTT.js → box-ML5TFUQW.js} +617 -596
- package/dist-cli/chunks/{camera-MNK73TYV.js → camera-OBEI4FZA.js} +2 -2
- package/dist-cli/chunks/{chunk-JXARZBWS.js → chunk-2FIT64GR.js} +1 -1
- package/dist-cli/chunks/{chunk-RYGQ6LZN.js → chunk-2LH4DYPM.js} +2 -2
- package/dist-cli/chunks/chunk-2QW3JH6T.js +99 -0
- package/dist-cli/chunks/{chunk-2APXX4RN.js → chunk-2W4YBCPX.js} +2 -2
- package/dist-cli/chunks/{chunk-X3PEDNLV.js → chunk-42YOIDLR.js} +2 -2
- package/dist-cli/chunks/{chunk-6BMM6OCW.js → chunk-47MSXLWK.js} +2 -2
- package/dist-cli/chunks/chunk-4OLUFHEZ.js +74 -0
- package/dist-cli/chunks/{chunk-WUR4FXWT.js → chunk-5PPVVGLH.js} +25 -25
- package/dist-cli/chunks/{chunk-AKJYEX54.js → chunk-6AZKZ5AJ.js} +2 -2
- package/dist-cli/chunks/{chunk-2PVVIPQS.js → chunk-6FPXLSBJ.js} +1 -1
- package/dist-cli/chunks/{chunk-CCI3DZKE.js → chunk-763GBI7G.js} +2 -2
- package/dist-cli/chunks/{chunk-CZ2HCNRK.js → chunk-7ASCDKA3.js} +1 -1
- package/dist-cli/chunks/{chunk-ZNNE5MAV.js → chunk-7Q4WHJDH.js} +1 -1
- package/dist-cli/chunks/{chunk-IYPMULI7.js → chunk-7TWD4P6J.js} +2 -2
- package/dist-cli/chunks/{chunk-45X3D6CI.js → chunk-7YB46LGI.js} +1 -1
- package/dist-cli/chunks/{chunk-3454VMHD.js → chunk-ADJSGO55.js} +2 -2
- package/dist-cli/chunks/{chunk-F4OTMARL.js → chunk-AGZZWLEL.js} +2 -2
- package/dist-cli/chunks/{chunk-UDXQCEJU.js → chunk-AVIH3TAZ.js} +11 -11
- package/dist-cli/chunks/{chunk-DCPDMF27.js → chunk-B26ZJUQA.js} +2 -2
- package/dist-cli/chunks/{chunk-D6MGELKZ.js → chunk-BNS5LNEU.js} +1 -1
- package/dist-cli/chunks/{chunk-FHRG772G.js → chunk-CJQXP4XM.js} +1 -1
- package/dist-cli/chunks/{chunk-OROUEG22.js → chunk-DP6RGTNN.js} +2 -2
- package/dist-cli/chunks/{chunk-V7I4CTAX.js → chunk-DYFOLOYL.js} +2 -2
- package/dist-cli/chunks/chunk-ERBGQEJ5.js +4 -0
- package/dist-cli/chunks/{chunk-H2GB2PLY.js → chunk-ESWSXF55.js} +2 -2
- package/dist-cli/chunks/{chunk-FGGESBWD.js → chunk-FLNGSIBL.js} +2 -2
- package/dist-cli/chunks/{chunk-4SCVGBOX.js → chunk-GQGS7TRK.js} +1 -1
- package/dist-cli/chunks/{chunk-WGE2P25F.js → chunk-H4DU457S.js} +1 -1
- package/dist-cli/chunks/{chunk-TBK5UXW2.js → chunk-HFY35VAG.js} +2 -2
- package/dist-cli/chunks/{chunk-JLOOLA47.js → chunk-HV3WOWQM.js} +1 -1
- package/dist-cli/chunks/{chunk-RV76U3EI.js → chunk-HZ365EMS.js} +10 -10
- package/dist-cli/chunks/chunk-IPNDXGVA.js +11 -0
- package/dist-cli/chunks/{chunk-TAC4CEIX.js → chunk-IX7Z6ZVJ.js} +2 -2
- package/dist-cli/chunks/{chunk-UQJY6O72.js → chunk-IYU2EOIU.js} +1 -1
- package/dist-cli/chunks/chunk-J6A5W2DI.js +30 -0
- package/dist-cli/chunks/chunk-JKRMBNPO.js +28 -0
- package/dist-cli/chunks/{chunk-VGJLCFSC.js → chunk-JUTLQ3GX.js} +1 -1
- package/dist-cli/chunks/{chunk-5QFJFASW.js → chunk-KHGXEU4L.js} +1 -1
- package/dist-cli/chunks/{chunk-A56GQVNF.js → chunk-KL34TRNW.js} +1 -1
- package/dist-cli/chunks/chunk-LFANRLWK.js +7 -0
- package/dist-cli/chunks/{chunk-NPVEBXU3.js → chunk-MOIQZVRU.js} +2 -2
- package/dist-cli/chunks/chunk-MW4E5EED.js +497 -0
- package/dist-cli/chunks/{chunk-AJJCYLBC.js → chunk-N3LAMTGS.js} +2 -2
- package/dist-cli/chunks/{chunk-QE5MC4V3.js → chunk-NQ4CI2VI.js} +1 -1
- package/dist-cli/chunks/{chunk-6F3WOWFC.js → chunk-OF3U4SZO.js} +2 -2
- package/dist-cli/chunks/{chunk-DKSZZABN.js → chunk-OF5OBB67.js} +1 -1
- package/dist-cli/chunks/{chunk-MXWME7ET.js → chunk-OQPZOEEP.js} +1 -1
- package/dist-cli/chunks/{chunk-SSBZA5VZ.js → chunk-OWDJQWJ7.js} +1 -1
- package/dist-cli/chunks/{chunk-YLNSLMQM.js → chunk-PTWMX4AA.js} +2 -2
- package/dist-cli/chunks/{chunk-TTUZ5MCK.js → chunk-RYJTPZCX.js} +1 -1
- package/dist-cli/chunks/{chunk-A72MIIJI.js → chunk-S3AH2O67.js} +1 -1
- package/dist-cli/chunks/{chunk-ZW6JXEVX.js → chunk-SH2HXHR2.js} +2 -2
- package/dist-cli/chunks/{chunk-EKAEEWC2.js → chunk-SHLJYXIN.js} +1 -1
- package/dist-cli/chunks/{chunk-4G4VCT2M.js → chunk-TL22EBF5.js} +2 -2
- package/dist-cli/chunks/{chunk-LU3AHE6T.js → chunk-TWNLRDIH.js} +2 -2
- package/dist-cli/chunks/{chunk-B5NW4TT3.js → chunk-UHYAY3RU.js} +2 -2
- package/dist-cli/chunks/{chunk-N5KDDGV6.js → chunk-UPMR6Y5P.js} +2 -2
- package/dist-cli/chunks/chunk-VEFSHPSU.js +24 -0
- package/dist-cli/chunks/{chunk-YPBDPVLR.js → chunk-WCB5XPCH.js} +2 -2
- package/dist-cli/chunks/{chunk-USHV3QFZ.js → chunk-WHZE63R2.js} +2 -2
- package/dist-cli/chunks/{chunk-ZEF57HQO.js → chunk-WLRIPAGJ.js} +1 -1
- package/dist-cli/chunks/{chunk-FBMNYSSW.js → chunk-Y7SKGRAV.js} +1 -1
- package/dist-cli/chunks/chunk-Z6CQDU74.js +4 -0
- package/dist-cli/chunks/{cleanup-H4XFRMZV.js → cleanup-PTJBMC34.js} +2 -2
- package/dist-cli/chunks/cli-version-6ZBD6GKP.js +4 -0
- package/dist-cli/chunks/{compat-NKGYERLN.js → compat-FJ2HWRAG.js} +2 -2
- package/dist-cli/chunks/config-PYGH7JPN.js +13 -0
- package/dist-cli/chunks/{connect-WWWAVVCF.js → connect-AJV4PZA4.js} +2 -2
- package/dist-cli/chunks/control-667PAYX4.js +4 -0
- package/dist-cli/chunks/daemon-EIBOHZYQ.js +4 -0
- package/dist-cli/chunks/{debug-RO6GLDIM.js → debug-XF2XUDHN.js} +20 -20
- package/dist-cli/chunks/desktop-HEZYNFYW.js +31 -0
- package/dist-cli/chunks/detox-JCFZJRNE.js +52 -0
- package/dist-cli/chunks/device-KGUVZHFW.js +18 -0
- package/dist-cli/chunks/{diagnose-HDRTUPDO.js → diagnose-KVJQ3TOI.js} +2 -2
- package/dist-cli/chunks/{disk-cleanup-QP2NYN43.js → disk-cleanup-7HQXJFUX.js} +2 -2
- package/dist-cli/chunks/{do-chain-6LP6SV5J.js → do-chain-3FYJNA2N.js} +2 -2
- package/dist-cli/chunks/drivers-5S6M5TJB.js +4 -0
- package/dist-cli/chunks/{env-4XD5D2G6.js → env-BX6S2SOM.js} +2 -2
- package/dist-cli/chunks/{film-I5SIXLS5.js → film-2WZUVYFA.js} +3 -3
- package/dist-cli/chunks/flow-6BZSWNHG.js +4 -0
- package/dist-cli/chunks/help-OGJBD4NP.js +4 -0
- package/dist-cli/chunks/{hidden-runtime-alias-LJV2S4M2.js → hidden-runtime-alias-PGF55OFH.js} +2 -2
- package/dist-cli/chunks/{home-paths-RFI2QRC3.js → home-paths-EGRMTSGE.js} +2 -2
- package/dist-cli/chunks/inspect-MZVDGAN4.js +4 -0
- package/dist-cli/chunks/install-desktop-QB76DNZF.js +4 -0
- package/dist-cli/chunks/login-HRFPYPZ3.js +26 -0
- package/dist-cli/chunks/{logout-DKXZZ6HU.js → logout-LRH5HZGP.js} +2 -2
- package/dist-cli/chunks/{maestro-WKGVVWRA.js → maestro-S53T4PPE.js} +3 -3
- package/dist-cli/chunks/{maestro-generate-KCK6RK2C.js → maestro-generate-YKIVKOB3.js} +3 -3
- package/dist-cli/chunks/mode-47JKNUNS.js +26 -0
- package/dist-cli/chunks/{optional-demo-registry-EUSKBIPP.js → optional-demo-registry-ARZSPS5Y.js} +2 -2
- package/dist-cli/chunks/{perf-IMZMA5MT.js → perf-J73OKB4T.js} +2 -2
- package/dist-cli/chunks/{permissions-SLWXTLH6.js → permissions-L3FPI56H.js} +2 -2
- package/dist-cli/chunks/{platform-HQ735LAE.js → platform-YAROAHRM.js} +3 -3
- package/dist-cli/chunks/privacy-JZQCXHKN.js +4 -0
- package/dist-cli/chunks/record-QAQMGYOO.js +72 -0
- package/dist-cli/chunks/report-issue-4FVZCAFQ.js +29 -0
- package/dist-cli/chunks/reset-NYFUFZCG.js +4 -0
- package/dist-cli/chunks/resolve-target-SP22ZGFZ.js +4 -0
- package/dist-cli/chunks/runtime-WTS2QMXZ.js +4 -0
- package/dist-cli/chunks/{screenshot-command-HAJB5FHK.js → screenshot-command-Q5MGGEWY.js} +11 -11
- package/dist-cli/chunks/screenshot-layers-4JW7DRL7.js +20 -0
- package/dist-cli/chunks/screenshots-capture-X5PMO44E.js +42 -0
- package/dist-cli/chunks/{serve-TM46TKFW.js → serve-3JWJ45J3.js} +20 -20
- package/dist-cli/chunks/setup-USPDJESI.js +4 -0
- package/dist-cli/chunks/{sim-client-LQUZSO45.js → sim-client-RL6DGOJE.js} +2 -2
- package/dist-cli/chunks/skills-QNO6GDJB.js +50 -0
- package/dist-cli/chunks/{state-RUVM4Z4S.js → state-OGUCSUC3.js} +2 -2
- package/dist-cli/chunks/{storage-GQ33UTYN.js → storage-TG7KFQZ3.js} +2 -2
- package/dist-cli/chunks/store-ZYMQW2LN.js +4 -0
- package/dist-cli/chunks/telemetry-7CSLUUIW.js +4 -0
- package/dist-cli/chunks/timeline-R4G5P335.js +24 -0
- package/dist-cli/chunks/{upgrade-AZDZLUIT.js → upgrade-RDTXJ6O3.js} +2 -2
- package/dist-cli/chunks/upload-PLF2DPMS.js +4 -0
- package/dist-cli/chunks/{version-N3ALB75G.js → version-GU2NUZDS.js} +2 -2
- package/dist-cli/chunks/{web-XPHFZATA.js → web-7PUVG3GE.js} +2 -2
- package/dist-cli/chunks/welcome-4GGUV7FY.js +5 -0
- package/dist-cli/chunks/what-happened-OHAAX6F6.js +25 -0
- package/dist-cli/chunks/{ws-bridge-RUXOYOU6.js → ws-bridge-Z3O35MNF.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-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +69 -34
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +430 -106
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-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 +2 -1
- package/dist-lib/react-native-host-modules.mjs +2 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +149 -93
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +757 -353
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/scripts/dev-server-scanner.ts +275 -92
- package/src/dev-bundle-resolution.ts +123 -40
- package/src/host/bridge-host.ts +11 -0
- package/src/host/plane-host.ts +203 -0
- package/src/react-native-host-modules.ts +1 -0
- package/dist-cli/chunks/app-fonts-66V7TL26.js +0 -4
- package/dist-cli/chunks/auth-3FMWUVJH.js +0 -12
- package/dist-cli/chunks/chunk-3NLB5LCN.js +0 -28
- package/dist-cli/chunks/chunk-5RWUFIZW.js +0 -24
- package/dist-cli/chunks/chunk-COXCR6UU.js +0 -7
- package/dist-cli/chunks/chunk-JH5KE2OI.js +0 -4
- package/dist-cli/chunks/chunk-ROISJKH3.js +0 -99
- package/dist-cli/chunks/chunk-SUHAD6N2.js +0 -30
- package/dist-cli/chunks/chunk-TIB3CTRX.js +0 -497
- package/dist-cli/chunks/chunk-YFZLDFZK.js +0 -74
- package/dist-cli/chunks/cli-version-MJWLDXBW.js +0 -4
- package/dist-cli/chunks/config-WK7467KI.js +0 -13
- package/dist-cli/chunks/control-ESI7IZNN.js +0 -4
- package/dist-cli/chunks/daemon-UCLO27YP.js +0 -4
- package/dist-cli/chunks/desktop-FF34Z5X4.js +0 -31
- package/dist-cli/chunks/detox-Q3CWY5UX.js +0 -52
- package/dist-cli/chunks/device-WN4ZWLES.js +0 -18
- package/dist-cli/chunks/drivers-OR2JPAXD.js +0 -4
- package/dist-cli/chunks/flow-4GWW5DYT.js +0 -4
- package/dist-cli/chunks/help-MIIWOT3C.js +0 -4
- package/dist-cli/chunks/inspect-3ZGNJENJ.js +0 -4
- package/dist-cli/chunks/install-desktop-BYOJVTLS.js +0 -4
- package/dist-cli/chunks/login-GNIFSAFE.js +0 -26
- package/dist-cli/chunks/mode-YVMX7OJY.js +0 -26
- package/dist-cli/chunks/privacy-EDC7PF7G.js +0 -4
- package/dist-cli/chunks/record-N4KTTVDI.js +0 -72
- package/dist-cli/chunks/report-issue-PP752HAD.js +0 -29
- package/dist-cli/chunks/reset-DRMKGVP4.js +0 -4
- package/dist-cli/chunks/resolve-target-7WWI32R3.js +0 -4
- package/dist-cli/chunks/runtime-EKJV2ZVI.js +0 -4
- package/dist-cli/chunks/screenshot-layers-GOCJVM2G.js +0 -20
- package/dist-cli/chunks/screenshots-capture-YYJLYA3V.js +0 -42
- package/dist-cli/chunks/setup-FVPVIYE4.js +0 -4
- package/dist-cli/chunks/skills-V5TE57FN.js +0 -50
- package/dist-cli/chunks/store-IKNBDDKM.js +0 -4
- package/dist-cli/chunks/telemetry-2ZVU6WLK.js +0 -4
- package/dist-cli/chunks/timeline-LP7DMJYT.js +0 -24
- package/dist-cli/chunks/upload-DFQK2Q7X.js +0 -4
- package/dist-cli/chunks/welcome-2NFYLWLJ.js +0 -5
- package/dist-cli/chunks/what-happened-EJ5PHKT7.js +0 -25
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.371 | (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{L as m,o as P,q as a}from"./chunk-
|
|
4
|
+
import{L as m,o as P,q as a}from"./chunk-Y7SKGRAV.js";import l from"fs";import c from"path";var s="default",S="profiles.json",i=1;function o(e){let r=e.trim();if(!r)throw new Error("profile id is required");if(!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(r))throw new Error("profile ids must start with a letter or number and contain only letters, numbers, dot, dash, or underscore");if(r==="."||r==="..")throw new Error(`invalid profile id: ${r}`);return r}function d(){return c.join(a(),S)}function I(e){return`sootsim-profile-${o(e)}`}function h(e){return c.join(P(),"Partitions",I(e))}function A(e){return c.join(a(),"playwright",o(e))}function u(){try{let e=JSON.parse(l.readFileSync(d(),"utf8"));if(!e||e.version!==i)return{version:i,profiles:[]};let r=Array.isArray(e.profiles)?e.profiles.filter(t=>!!t&&typeof t.id=="string"&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string").map(t=>({id:o(t.id),createdAt:t.createdAt,updatedAt:t.updatedAt})):[];return{version:i,profiles:r}}catch{return{version:i,profiles:[]}}}function x(e){return[...e].sort((r,t)=>r.id===s?-1:t.id===s?1:r.id.localeCompare(t.id))}function p(e){if(e.profiles.some(t=>t.id===s))return{...e,profiles:x(e.profiles)};let r=new Date().toISOString();return{version:i,profiles:x([{id:s,createdAt:r,updatedAt:r},...e.profiles])}}function g(e){m();let r=p(e),t=`${d()}.tmp`;return l.writeFileSync(t,`${JSON.stringify(r,null,2)}
|
|
5
5
|
`,"utf8"),l.renameSync(t,d()),r}function y(){return g(u()).profiles}function E(e){let r=o(e);return y().find(t=>t.id===r)??null}function _(e=s){let r=o(e),t=E(r);return t||D(r)}function D(e){let r=o(e),t=p(u());if(t.profiles.some(w=>w.id===r))throw new Error(`profile already exists: ${r}`);let f=new Date().toISOString(),n={id:r,createdAt:f,updatedAt:f};return g({version:i,profiles:[...t.profiles,n]}),n}function F(e){let r=o(e);if(r===s)throw new Error("the default profile cannot be deleted; clear it instead");let t=p(u()),f=t.profiles.find(n=>n.id===r);if(!f)throw new Error(`profile not found: ${r}`);return g({version:i,profiles:t.profiles.filter(n=>n.id!==r)}),v(r),f}function v(e){let r=o(e);for(let t of[h(r),A(r)])try{l.rmSync(t,{recursive:!0,force:!0})}catch{}}export{A as a,y as b,_ as c,D as d,F as e,v as f};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/*! rnx v0.1.371 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{a as G,b as J,c as Fe}from"./chunk-IPNDXGVA.js";import{c as $e,d as Ne}from"./chunk-6AZKZ5AJ.js";import{p as _e}from"./chunk-AVIH3TAZ.js";import{t as Ue,v as Pe,x}from"./chunk-ESWSXF55.js";import{c as m}from"./chunk-ERBGQEJ5.js";import{a as Ae}from"./chunk-OQPZOEEP.js";import{createHash as Mt}from"crypto";import{readFileSync as w}from"fs";import He from"path";import{gzipSync as ge,gunzipSync as Tt}from"zlib";function Le(e){let t=(e||"").toLowerCase().split(";")[0].trim();return t?!(t.startsWith("image/")||t.startsWith("video/")||t.startsWith("audio/")||t==="font/woff2"||t==="application/font-woff2"||t==="application/zip"||t==="application/gzip"):!0}import{brotliCompressSync as at,constants as lt}from"node:zlib";var ut=9;function Ce(e){return at(e,{params:{[lt.BROTLI_PARAM_QUALITY]:ut}})}var ue={initMs:3e4,putMs:12e4,finalizeMs:18e4};function ce(e,t){let r=new AbortController,s=setTimeout(()=>r.abort(new Error(`${t} timed out after ${e/1e3}s`)),e);return{signal:r.signal,cancel:()=>clearTimeout(s)}}async function ct(e){let t=ce(ue.putMs,`PUT ${e.url}`),r;try{r=await fetch(e.url,{method:"PUT",headers:{"content-type":e.contentType},body:e.bytes,signal:t.signal})}finally{t.cancel()}if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`PUT ${e.url} failed ${r.status}: ${s.slice(0,200)}`)}}async function dt(e,t=8,r){let s=0,o=0,i=e.length;await Promise.all(Array.from({length:Math.min(t,i)},async()=>{for(;s<i;){let l=e[s++];await ct(l),o++,r?.(o,i)}}))}function pt(e,t,r,s){let o=[];o.push({url:e.bundle.putUrl,contentType:e.bundle.contentType,bytes:t});for(let i of e.files){let l=r.get(i.urlhash);l&&o.push({url:i.putUrl,contentType:i.contentType,bytes:l})}e.events&&s?.eventsBytes&&o.push({url:e.events.putUrl,contentType:e.events.contentType,bytes:s.eventsBytes}),e.timeline&&s?.timelineBytes&&o.push({url:e.timeline.putUrl,contentType:e.timeline.contentType,bytes:s.timelineBytes}),e.flowVideo&&s?.videoBytes&&o.push({url:e.flowVideo.putUrl,contentType:e.flowVideo.contentType,bytes:s.videoBytes}),e.storage&&s?.storageBytes&&o.push({url:e.storage.putUrl,contentType:e.storage.contentType,bytes:s.storageBytes}),e.failureBundle&&s?.failureBundleBytes&&o.push({url:e.failureBundle.putUrl,contentType:e.failureBundle.contentType,bytes:s.failureBundleBytes});for(let i of e.snapshots??[]){let l=s?.snapshotBytes?.get(i.id);l&&o.push({url:i.putUrl,contentType:i.contentType,bytes:l})}return o}function ft(e){return e.replace(/\/+$/,"")}var K=class extends Error{constructor(r,s,o,i=""){super(r);this.status=s;this.phase=o;this.responseText=i;this.name="PresignedUploadError"}};async function Oe(e){let t=ft(e.originBase),r={"content-type":"application/json"};e.authHeader&&(r.authorization=e.authHeader),e.adminBypassToken&&(r["x-contrast-admin-upload-bypass"]=e.adminBypassToken);let s=ce(ue.initMs,"init"),o;try{o=await fetch(`${t}/api/preview/upload/init`,{method:"POST",headers:r,body:JSON.stringify(e.initBody),signal:s.signal})}finally{s.cancel()}if(!o.ok){let M=await o.text().catch(()=>"");throw new K(`init failed: ${o.status} ${M.slice(0,200)}`,o.status,"init",M)}let i=await o.json(),l=pt(i,e.bundleBytes,e.filesByHash,e.extras);await dt(l,e.concurrency??8,e.onPutProgress);let f=ce(ue.finalizeMs,"finalize"),c;try{c=await fetch(`${t}/api/preview/upload/finalize`,{method:"POST",headers:r,body:JSON.stringify({token:i.token}),signal:f.signal})}finally{f.cancel()}if(!c.ok){let M=await c.text().catch(()=>"");throw new K(`finalize failed: ${c.status} ${M.slice(0,200)}`,c.status,"finalize",M)}let y=await c.json();return{init:i,finalize:y}}function mt(e){return e!==null&&typeof e=="object"?e:null}function ze(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function de(e){let t=mt(e);return t?t.schemaVersion===1&&ze(t.t)!==void 0&&ze(t.seq)!==void 0&&typeof t.context=="string"&&typeof t.kind=="string"&&"data"in t:!1}function gt(e,t){let r=[];for(let s of e.split(`
|
|
5
|
+
`)){let o=s.trim();if(o)try{let i=JSON.parse(o);t(i)&&r.push(i)}catch{}}return r}function De(e){return gt(e,de)}import{execSync as ht}from"child_process";function fe(e){try{return ht(e,{stdio:["ignore","pipe","ignore"],timeout:3e3,encoding:"utf8"}).trim()||null}catch{return null}}function pe(e){let t=e?.trim();return!t||!/^\d+$/.test(t)?null:Number(t)}function yt(){let e=fe("git remote get-url origin");if(!e)return null;let t=e.match(/github\.com[/:]([^/\s]+)\/([^/\s]+?)(?:\.git)?\/?$/i);return t?{owner:t[1],repo:t[2]}:null}function me(){let e=process.env.GITHUB_ACTIONS==="true",t=process.env.CONTRAST_BRANCH?.trim()||null,r=process.env.CONTRAST_SHA?.trim()||null,s=process.env.CONTRAST_PR_TITLE?.trim()||null,o=(process.env.CONTRAST_REPO||process.env.GITHUB_REPOSITORY||"").trim(),[i,l]=o.includes("/")?o.split("/",2):[null,null];if(e){let y=process.env.GITHUB_REF?.match(/^refs\/pull\/(\d+)\//)?.[1];return{owner:i,repo:l,branch:t||process.env.GITHUB_HEAD_REF?.trim()||process.env.GITHUB_REF_NAME?.trim()||null,commitSha:r||process.env.GITHUB_SHA?.trim()||null,githubUsername:process.env.GITHUB_ACTOR?.trim()||null,pullRequestNumber:pe(process.env.CONTRAST_PR_NUMBER)??pe(y),pullRequestTitle:s,githubRunId:process.env.GITHUB_RUN_ID?.trim()||null,source:"ci"}}let f=t??fe("git rev-parse --abbrev-ref HEAD"),c=i?null:yt();return{owner:i??c?.owner??null,repo:l??c?.repo??null,branch:f==="HEAD"?null:f,commitSha:r??fe("git rev-parse HEAD"),githubUsername:null,pullRequestNumber:pe(process.env.CONTRAST_PR_NUMBER),pullRequestTitle:s,githubRunId:null,source:"cli"}}function Kt(e){if(e.length===0)return{stepCount:null,failedStepIndex:null};let t=e.find(r=>r.status==="failure");return{stepCount:e.length,failedStepIndex:t?t.stepIndex:null}}function Vt(e){return e.auth?e.uploadedShare?!0:e.auth.kind==="github"||process.env.GITHUB_ACTIONS==="true":!1}async function Wt(e){let t=e.auth??G();if(!t)return null;let r=me(),s=e.owner??(t.kind==="github"?t.owner:null)??r.owner,o=e.repo??(t.kind==="github"?t.repo:null)??r.repo;try{let i=await fetch(`${e.origin.replace(/\/$/,"")}/api/sootsim/test-runs`,{method:"POST",headers:{"content-type":"application/json",authorization:J(t)},body:JSON.stringify({kind:e.kind,source:r.source,name:e.name??void 0,prompt:e.prompt??void 0,summary:e.summary??void 0,status:e.status,failureMessage:e.failureMessage??void 0,previewShareId:e.previewShareId??void 0,owner:s??void 0,repo:o??void 0,branch:r.branch??void 0,commitSha:r.commitSha??void 0,githubUsername:r.githubUsername??void 0,pullRequestNumber:r.pullRequestNumber??void 0,githubRunId:r.githubRunId??void 0,stepCount:e.stepCount??void 0,failedStepIndex:e.failedStepIndex??void 0,durationMs:e.durationMs??void 0,flowYamlSizeBytes:e.flowYamlSizeBytes??void 0})});if(!i.ok){let f=await i.text().catch(()=>"");return console.warn(` warn: run registration failed: /api/sootsim/test-runs ${i.status}${f?`: ${f.slice(0,200)}`:""}`),null}let l=await i.json();return l.run?.id?{id:l.run.id,previewUrl:l.run.previewUrl??null,traceUrl:l.run.traceUrl??null}:(console.warn(" warn: run registration returned no id"),null)}catch(i){return console.warn(` warn: run registration failed: ${i instanceof Error?i.message:String(i)}`),null}}function St(e){if(!e)return null;try{let t=JSON.parse(e);return typeof t.message=="string"&&t.message?t.message:null}catch{return null}}function vt(e){let t=JSON.parse(w(e,"utf8"));if(!Array.isArray(t))throw new Error("snapshot manifest must be an array");let r=new Set;return t.map((s,o)=>{if(s===null||typeof s!="object")throw new Error(`snapshot manifest entry ${o} must be an object`);let i=Reflect.get(s,"id"),l=Reflect.get(s,"label"),f=Reflect.get(s,"path"),c=Reflect.get(s,"t");if(typeof i!="string"||!i||r.has(i))throw new Error(`snapshot manifest entry ${o} has an invalid or duplicate id`);if(typeof f!="string"||!f)throw new Error(`snapshot manifest entry ${o} has no PNG path`);if(typeof c!="number"||!Number.isFinite(c)||c<0)throw new Error(`snapshot manifest entry ${o} has an invalid capture time`);r.add(i);let y=w(f);return{meta:{id:i,label:typeof l=="string"&&l?l:i,kind:"interaction",t:Math.round(c),contentType:"image/png",sizeBytes:y.byteLength},bytes:y}})}var Ke=process.env.SOOTSIM_UPLOAD_ORIGIN||"https://contrast.dev",Ve=process.env.SOOTSIM_PREVIEW_ORIGIN||Ae.origin;async function Rt(e){return e||(process.env.SOOTSIM_UPLOAD_ORIGIN?process.env.SOOTSIM_UPLOAD_ORIGIN:Ke)}function N(e){return e.replace(/\/$/,"")}function xt(e){try{let r=new URL(e).hostname.replace(/^\[|\]$/g,"").toLowerCase();return r==="localhost"||r.endsWith(".localhost")||r==="0.0.0.0"||r==="::1"||/^127(?:\.\d{1,3}){3}$/.test(r)}catch{return!1}}function kt(e){try{let t=new URL(e).hostname.toLowerCase();return t==="contrast.dev"||t.endsWith(".contrast.dev")}catch{return!1}}function Bt(e,t){return t?N(t):process.env.SOOTSIM_PREVIEW_ORIGIN?N(process.env.SOOTSIM_PREVIEW_ORIGIN):xt(e)?N(e):kt(e)?N(Ve):N(e)}function Et(){console.log(`
|
|
6
|
+
rnx record upload \u2014 publish the current recorded bundle as a /preview/<id> link
|
|
7
|
+
|
|
8
|
+
usage:
|
|
9
|
+
rnx record upload [--origin <url>] [--public-origin <url>] (--events <path> | --video <path>) [--screenshot <path>] [--owner <org> --repo <repo>] [--sim <sim>] [--open] [--assets-only]
|
|
10
|
+
|
|
11
|
+
options:
|
|
12
|
+
--origin <url> upload target (default: ${Ke})
|
|
13
|
+
override with SOOTSIM_UPLOAD_ORIGIN env var
|
|
14
|
+
--public-origin <url>
|
|
15
|
+
public /preview link origin (default: ${Ve}
|
|
16
|
+
for prod uploads, upload origin for localhost/custom origins).
|
|
17
|
+
override with SOOTSIM_PREVIEW_ORIGIN env var
|
|
18
|
+
--events <path> path to a gzipped events .jsonl.gz file to attach
|
|
19
|
+
required unless --video is present; previews must
|
|
20
|
+
have replay or recording playback data
|
|
21
|
+
--screenshot <path>
|
|
22
|
+
path to a PNG thumbnail to attach to the share
|
|
23
|
+
--snapshot-manifest <path>
|
|
24
|
+
JSON manifest of existing interaction PNGs to attach
|
|
25
|
+
--video <path> path to a mp4/gif flow recording. embedded inline
|
|
26
|
+
in the pr sticky comment served at
|
|
27
|
+
/api/preview/flow-video?id=<share-id>
|
|
28
|
+
--video-duration-ms <ms>
|
|
29
|
+
duration hint for attached flow video
|
|
30
|
+
--timeline-events <path>
|
|
31
|
+
extra trace timeline rows, JSONL or JSONL gz
|
|
32
|
+
--trace-frame-stats <path>
|
|
33
|
+
frame stats JSON returned by the recorder bridge
|
|
34
|
+
--failure-bundle <dir>
|
|
35
|
+
per-failure debug bundle dir written by the flow runner
|
|
36
|
+
(error.json, describe.json, a11y.txt, tree.txt,
|
|
37
|
+
console.json, screenshot.png). uploaded with the share
|
|
38
|
+
so failed CI runs are debuggable from the dashboard
|
|
39
|
+
--owner <org> associate a session upload with a linked org repo
|
|
40
|
+
--repo <repo> repo name for --owner; the signed-in user must belong
|
|
41
|
+
to the local/org team that owns the link
|
|
42
|
+
--billing-kind test_run
|
|
43
|
+
meter this upload as a natural-language test run
|
|
44
|
+
--sim <sim> target a specific sim (see: rnx list)
|
|
45
|
+
--open open the resulting /preview/<id> url in the browser
|
|
46
|
+
--assets-only drop API/JSON/HTML records before upload; keep images,
|
|
47
|
+
fonts, css, js, and binary blobs. live-data demos hit
|
|
48
|
+
the real network at replay time instead of serving
|
|
49
|
+
recorded API snapshots
|
|
50
|
+
-h, --help
|
|
51
|
+
|
|
52
|
+
examples:
|
|
53
|
+
rnx record upload --events ./my-session.jsonl.gz
|
|
54
|
+
rnx record upload --origin https://contrast.localhost:3000 --events ./my-session.jsonl.gz --open
|
|
55
|
+
rnx record upload --video /tmp/sootsim-flow.mp4 --video-duration-ms 12000
|
|
56
|
+
`)}function p(e,t){let r=e.findIndex(o=>o===t);if(r<0)return;let s=e[r+1];return e.splice(r,2),s}function je(e,t){let r=e.findIndex(s=>s===t);return r<0?!1:(e.splice(r,1),!0)}function qe(e,t){if(!e)return;let r=Number(e);return(!Number.isFinite(r)||r<=0)&&(console.error(` invalid ${t}: ${e}`),m(1)),Math.round(r)}function Ge(e){let t=(e||"").toLowerCase().split(";")[0].trim();return t?!!(t.startsWith("image/")||t.startsWith("font/")||t.startsWith("video/")||t.startsWith("audio/")||t.startsWith("model/")||t==="text/css"||t==="application/javascript"||t==="text/javascript"||t==="application/wasm"||t==="application/font-woff"||t==="application/font-woff2"||t==="application/octet-stream"):!1}async function Je(e){let t=await fetch(e);if(!t.ok)throw new Error(`fetch ${e} -> ${t.status} ${t.statusText}`);return new Uint8Array(await t.arrayBuffer())}function It(e){return/\.bundle($|\?)/.test(e)||/\.js($|\?)/.test(e)?"application/javascript":/\.zip($|\?)/.test(e)?"application/zip":"application/javascript"}function At(e){try{return new URL(e).searchParams.get("appFonts")||""}catch{return""}}function Ut(e){try{return new URL(e).searchParams.get("appSplash")||""}catch{return""}}function Pt(e){try{let t=new URL(e);return t.searchParams.get("lazy")==="true"?(t.searchParams.set("lazy","false"),t.toString()):e}catch{return e}}async function _t(e,t){let s=[];for(let o=0;o<t;o+=15e5){let i=Math.min(o+15e5,t),l=await x(e,`(window.__sootsimLastTransformedBundle?.text || "").slice(${o}, ${i})`);if(typeof l!="string")return null;s.push(l)}return s.join("")}function $t(e){return e.recordedDurationMs&&e.recordingStartedAtMs?{since:e.recordingStartedAtMs-1e4,until:e.recordingStartedAtMs+e.recordedDurationMs+5e3,limit:2e3}:{limit:2e3}}function Nt(e){let t=w(e),s=(t[0]===31&&t[1]===139?Tt(t):t).toString("utf8");return De(s)}function Ft(e){return JSON.parse(w(e,"utf8"))}function Lt(e){if(e===null||typeof e!="object")return[];let t=e,r=typeof t.startedAtEpochMs=="number"&&t.startedAtEpochMs>0?t.startedAtEpochMs:null;if(r===null||!Array.isArray(t.samples))return[];let s=[];for(let o of t.samples){if(!Array.isArray(o)||typeof o[0]!="number")continue;let i=l=>typeof l=="number"&&Number.isFinite(l)?Math.round(l*100)/100:0;s.push({schemaVersion:1,t:r+Math.round(o[0]),seq:s.length+1,context:"tenant",kind:"frame",data:{totalMs:i(o[1]),layoutMs:i(o[2]),renderMs:i(o[3]),copyMs:i(o[4])}})}return s}function Ct(e){if(e===null||typeof e!="object")return e;let{samples:t,...r}=e;return r}function he(e){let t=new Map;for(let r of e)t.set(r.urlhash||r.url,r);return Array.from(t.values())}async function mn(e,t){(e.includes("--help")||e.includes("-h"))&&(Et(),m(0));let r=[...e],s=await Rt(p(r,"--origin")),o=Bt(s,p(r,"--public-origin")),i=p(r,"--events"),l=p(r,"--screenshot"),f=p(r,"--snapshot-manifest"),c=p(r,"--video"),y=p(r,"--timeline-events"),M=p(r,"--trace-frame-stats"),V=p(r,"--failure-bundle"),W=p(r,"--video-duration-ms"),ye=qe(p(r,"--recorded-duration-ms"),"--recorded-duration-ms"),be=qe(p(r,"--recording-started-at-ms"),"--recording-started-at-ms"),Y=p(r,"--owner"),Q=p(r,"--repo"),O=p(r,"--billing-kind"),We=p(r,"--run-scope"),Ye=je(r,"--open");(Y&&!Q||!Y&&Q)&&(console.error(" --owner and --repo must be provided together"),m(1)),O&&O!=="test_run"&&(console.error(` invalid --billing-kind: ${O}`),m(1)),!i&&!c&&(console.error(" preview uploads require playback data: pass --events or --video.\n for a normal local preview, use `rnx record --mode combined --open`\n or `rnx maestro test --preview` instead of uploading a bundle-only snapshot."),m(1));let we=je(r,"--assets-only"),Qe=Ue(r,{stripBooleanFlags:[],stripValueFlags:[]}),T=Pe(Qe),d,Me=[],k=[],B=y?Nt(y):[],Te=M?Ft(M):null;B.push(...Lt(Te));let Se=B.length,X=null;try{if(d=await x(T,'(typeof window.__sootsimCaptureBundle === "function") ? window.__sootsimCaptureBundle() : null'),d?.bundleUrl){let u=new URL(d.bundleUrl).origin,[g,P]=await Promise.all([x(T,`(window.__sootsimPreviewRecorder?.list?.(${JSON.stringify(u)}) || [])`),x(T,`(async () => {
|
|
57
|
+
const list = window.__sootsimListWorkerFetchRecorder
|
|
58
|
+
return typeof list === 'function'
|
|
59
|
+
? await list(${JSON.stringify(u)})
|
|
60
|
+
: []
|
|
61
|
+
})()`)]);Me=he([...g,...P]).filter(h=>{try{return!new URL(h.url).pathname.startsWith("/api/")}catch{return!0}});let $=await x(T,`(async () => {
|
|
62
|
+
const rec = window.__sootsimPreviewRecorder
|
|
63
|
+
const workerList = window.__sootsimListWorkerFetchRecorder
|
|
64
|
+
return {
|
|
65
|
+
main: rec?.list ? rec.list() : [],
|
|
66
|
+
worker: typeof workerList === 'function' ? await workerList() : [],
|
|
67
|
+
}
|
|
68
|
+
})()`),C=($?he([...$.main,...$.worker]):[]).filter(h=>{try{return new URL(h.url).origin!==u}catch{return!1}}),R=C.length>0?{count:C.length,totalBytes:C.reduce((h,ae)=>h+(ae.size||0),0)}:null;if(R&&R.count>0){console.log(` ${R.count} recorded cross-origin responses (${(R.totalBytes/1024).toFixed(1)} KiB)`);let h=await x(T,`(async () => {
|
|
69
|
+
const rec = window.__sootsimPreviewRecorder
|
|
70
|
+
const workerDump = window.__sootsimDumpWorkerFetchRecorder
|
|
71
|
+
const bundleUrl = ${JSON.stringify(d.bundleUrl)}
|
|
72
|
+
const keep = (r) => {
|
|
73
|
+
try {
|
|
74
|
+
const u = new URL(r.url)
|
|
75
|
+
if (u.origin !== ${JSON.stringify(u)}) return true
|
|
76
|
+
// bundle-origin api responses came from the rewritten
|
|
77
|
+
// /__app-api proxy at record time (re-keyed by the
|
|
78
|
+
// recorder's unwrap step). they need bodies attached the
|
|
79
|
+
// same way as cross-origin records \u2014 direct re-fetch from
|
|
80
|
+
// the dev server lacks the bundle's session cookies.
|
|
81
|
+
if (r.url !== bundleUrl && u.pathname.startsWith('/api/')) return true
|
|
82
|
+
return false
|
|
83
|
+
} catch { return false }
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
main: rec?.dump ? rec.dump().filter(keep) : [],
|
|
87
|
+
worker: typeof workerDump === 'function'
|
|
88
|
+
? (await workerDump()).filter(keep)
|
|
89
|
+
: [],
|
|
90
|
+
}
|
|
91
|
+
})()`);if(k=he([...h.main,...h.worker]),we){let ae=k.length;k=k.filter(le=>Ge(le.contentType));let ot=R.totalBytes-k.reduce((le,it)=>le+(it.size||0),0);console.log(` --assets-only: kept ${k.length}/${ae} records (dropped ${(ot/1024).toFixed(1)} KiB of API responses)`)}}}d?.transformedBundle&&(X=await _t(T,d.transformedBundle.byteLength));let n=await x(T,`(() => {
|
|
92
|
+
const bridge = window.SootSim?.bridges?.timeline ?? window.__sootsimTimeline
|
|
93
|
+
if (!bridge || typeof bridge.recent !== 'function') return null
|
|
94
|
+
return bridge.recent(${JSON.stringify($t({recordedDurationMs:ye,recordingStartedAtMs:be}))})
|
|
95
|
+
})()`).catch(u=>(console.warn(` warning: failed to capture trace timeline: ${u instanceof Error?u.message:String(u)}`),null)),a=Array.isArray(n?.events)?n.events:[];B=[...B,...a.filter(de)].sort((u,g)=>u.t-g.t||u.seq-g.seq)}finally{T.close()}d||(console.error(" could not read bundle snapshot \u2014 is rnx running and is the bundle loaded?"),m(2)),d.bundleUrl||(console.error(` no ?bundle= URL on the current rnx tab.
|
|
96
|
+
open the app you want to share first (e.g. rnx open 8082), then run upload.`),m(2));let S,ve=!1;if(X!==null)S=new TextEncoder().encode(X),ve=!0,console.log(` using post-transform bundle: ${(S.byteLength/1024).toFixed(1)} KiB`);else{let n=Pt(d.bundleUrl);n!==d.bundleUrl&&console.log(" forcing lazy=false for self-contained bundle"),console.log(` capturing: ${n}`),S=await Je(n),console.log(` main bundle: ${(S.byteLength/1024).toFixed(1)} KiB`)}let z=Me.filter(n=>n.url!==d.bundleUrl);we&&(z=z.filter(n=>Ge(n.contentType))),console.log(` fetching ${z.length} extra files\u2026`);let Z=(await Promise.all(z.map(async n=>{try{let a=await Je(n.url);return{...n,bytes:a}}catch(a){return console.error(` warning: failed to re-fetch ${n.url}: ${a instanceof Error?a.message:a}`),null}}))).filter(n=>!!n),Xe=Z.reduce((n,a)=>n+a.bytes.byteLength,0);console.log(` ${Z.length} extra files: ${(Xe/1024).toFixed(1)} KiB`);let _;i&&(_=w(i)),B.sort((n,a)=>n.t-a.t||n.seq-a.seq);let Re=B.map(n=>JSON.stringify(n)).join(`
|
|
97
|
+
`),ee=ge(Re?`${Re}
|
|
98
|
+
`:"");console.log(` trace timeline: ${B.length} events${Se?` (${Se} from runner sidecars)`:""}`);let v;l&&(v=w(l),console.log(` attaching screenshot: ${(v.byteLength/1024).toFixed(1)} KiB`));let F=f?vt(f):[];F.length>0&&console.log(` attaching ${F.length} interaction snapshots`);let E,I;if(V){let n=g=>{try{return w(He.join(V,g),"utf8")}catch{return null}},a=g=>{let P=n(g);if(P===null)return null;try{return JSON.parse(P)}catch{return P}},u={error:a("error.json"),describe:a("describe.json"),console:a("console.json"),a11y:n("a11y.txt"),tree:n("tree.txt")};Object.values(u).some(g=>g!==null)&&(E=ge(JSON.stringify(u)),console.log(` attaching failure bundle: ${(E.byteLength/1024).toFixed(1)} KiB gz`));try{I=w(He.join(V,"screenshot.png"))}catch{}}let A,L,xe;if(c){if(A=w(c),L=c.endsWith(".mp4")?"video/mp4":c.endsWith(".gif")?"image/gif":void 0,L||(console.error(" preview flow videos must be mp4 or gif"),m(1)),W){let n=Number(W);(!Number.isFinite(n)||n<=0)&&(console.error(` invalid --video-duration-ms: ${W}`),m(1)),xe=Math.round(n)}console.log(` attaching flow video: ${(A.byteLength/1024).toFixed(1)} KiB (${L})`)}let te=G(),D=Fe(te),U=me();te||(console.error(" preview uploads need auth."),console.error(" set RNX_API_KEY=sk_rnx_..., run `rnx login`, or use the Contrast github runner."),m(1));let Ze=J(te),et=(()=>{try{return new URL(d.bundleUrl).origin}catch{return null}})(),H=(n,a,u,g,P,$,Ie,C)=>{let R=Le($),h=R?ge(n):n;return{url:a,urlhash:u,method:g,bodyHash:P,requestVaryHash:C,contentType:$,responseHeaders:Ie,bytes:h,encoding:R?"gzip":void 0}},ke=[],ne=At(d.pageHref)||"";if(ne){let n=await _e(ne,{onStaged:({url:a,byteLength:u})=>console.log(` staged app font: ${a} (${(u/1024).toFixed(1)} KiB)`),onError:(a,u)=>console.error(` warning: failed to fetch app font ${a}: ${u instanceof Error?u.message:u}`)});for(let a of n)ke.push(H(Buffer.from(a.bytes),a.url,a.urlhash,"GET","-",a.contentType))}let Be=[],re=Ut(d.pageHref)||"";if(re){let n=await $e(re,{onStaged:({url:a,byteLength:u})=>console.log(` staged splash image: ${a} (${(u/1024).toFixed(1)} KiB)`),onError:(a,u)=>console.error(` warning: failed to fetch splash image ${a}: ${u instanceof Error?u.message:u}`)});for(let a of n)Be.push(H(Buffer.from(a.bytes),a.url,a.urlhash,"GET","-",a.contentType))}let se=[...Z.map(n=>H(n.bytes,n.url,n.urlhash,"GET","-",n.contentType,n.responseHeaders,n.requestVaryHash)),...k.map(n=>H(Buffer.from(n.bodyBase64,"base64"),n.url,n.urlhash,n.method||"GET",n.bodyHash||"-",n.contentType,n.responseHeaders,n.requestVaryHash)),...ke,...Be],oe=Ce(S),tt=Mt("sha256").update(S).digest("hex");console.log(` bundle raw=${(S.byteLength/1024).toFixed(1)} KiB br=${(oe.byteLength/1024).toFixed(1)} KiB`);let nt={contentHash:tt,bundleSizeBytes:S.byteLength,bundleContentType:It(d.bundleUrl),bundleEncoding:"br",bundleMinified:!1,bundleOrigin:et,runtimeVersion:d.runtimeVersion??void 0,appFonts:ne||void 0,appSplash:re||void 0,entry:d.entry,isTransformed:ve,deviceSpec:d.deviceSpec,installationId:D?.installationId??void 0,repoId:D?.repoId,owner:Y??D?.owner??U.owner??void 0,repo:Q??D?.repo??U.repo??void 0,branch:U.branch??void 0,commitSha:U.commitSha??void 0,githubUsername:U.githubUsername??void 0,pullRequestNumber:U.pullRequestNumber??void 0,pullRequestTitle:U.pullRequestTitle??void 0,billingKind:O==="test_run"?"test_run":void 0,runScope:We||void 0,files:se.map(n=>({url:n.url,urlhash:n.urlhash,method:n.method,bodyHash:n.bodyHash,contentType:n.contentType,responseHeaders:n.responseHeaders,requestVaryHash:n.requestVaryHash,encoding:n.encoding,sizeBytes:n.bytes.byteLength})),events:_?{sizeBytes:_.byteLength}:void 0,timeline:{sizeBytes:ee.byteLength,encoding:"gzip"},traceFrameStats:Ct(Te),recordedDurationMs:ye,recordingStartedAtMs:be,failureBundle:E?{sizeBytes:E.byteLength,encoding:"gzip"}:void 0,snapshots:(()=>{let n=[];v&&n.push({id:"landing",label:"Landing",kind:"landing",t:0,contentType:"image/png",sizeBytes:v.byteLength}),I&&n.push({id:"failure",label:"Failure",kind:"failure",contentType:"image/png",sizeBytes:I.byteLength});for(let a of F)n.push(a.meta);return n.length>0?n:void 0})(),flowVideo:A&&L?{sizeBytes:A.byteLength,contentType:L,durationMs:xe}:void 0},Ee=new Map;for(let n of se)Ee.set(n.urlhash,n.bytes);let j=new Map;v&&j.set("landing",v),I&&j.set("failure",I);for(let n of F)j.set(n.meta.id,n.bytes);let rt=Date.now(),b=oe.byteLength;for(let n of se)b+=n.bytes.byteLength;_&&(b+=_.byteLength),b+=ee.byteLength,v&&(b+=v.byteLength),I&&(b+=I.byteLength);for(let n of F)b+=n.bytes.byteLength;E&&(b+=E.byteLength),A&&(b+=A.byteLength);let st=`${N(s)}/api/preview/upload/init`;console.log(` init: ${st}`);let q;try{let n=await Oe({originBase:s,initBody:nt,bundleBytes:oe,filesByHash:Ee,extras:{eventsBytes:_,timelineBytes:ee,videoBytes:A,failureBundleBytes:E,snapshotBytes:j},authHeader:Ze,concurrency:16});q=n.finalize;let a=1+n.init.files.length+(n.init.events?1:0)+(n.init.timeline?1:0)+n.init.snapshots.length+(n.init.flowVideo?1:0)+(n.init.failureBundle?1:0);console.log(` PUT ${a} objects in ${Date.now()-rt}ms (${(b/1024).toFixed(1)} KiB)`)}catch(n){let a=n;a.phase==="init"&&a.status===401&&(console.error(" preview upload requires a valid login."),console.error(" run `rnx login` and retry."),m(1)),a.status===402&&(console.error(` ${St(a.responseText)??"preview uploads require Personal, Team, or an active trial \u2014 upgrade from the billing dialog."}`),m(1)),console.error(` ${a.message??`${a.phase??"upload"} failed: ${String(n)}`}`),m(1)}let ie=`${o}${q.url}`;return console.log(`
|
|
99
|
+
stored ${q.filesStored??0} extra files`),console.log(` preview: ${ie}`),Ye&&await Ne(ie),{previewUrl:ie,shareId:q.id}}export{me as a,Kt as b,Vt as c,Wt as d,Rt as e,Bt as f,mn as g};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.371 | (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{F as b,p as h,r as y,t as S}from"./chunk-
|
|
4
|
+
import{F as b,p as h,r as y,t as S}from"./chunk-BNS5LNEU.js";import{u as m,y as w,z as p}from"./chunk-ESWSXF55.js";var C={timeoutMs:1800,settleMs:48,startWindowMs:64};function g(e){return new Promise(n=>setTimeout(n,e))}function P(e){return e.includes("--json")}function I(e){process.stdout.write(`${JSON.stringify(e??null,null,2)}
|
|
5
5
|
`)}function q(e){process.stderr.write(`${e}
|
|
6
6
|
`)}function f(e,n=Date.now()){let r=new Date(e),t=`${d(r.getHours())}:${d(r.getMinutes())}:${d(r.getSeconds())}`,s=n-e;if(s<0)return t;let o=Math.round(s/1e3);return o<60?`${t} +${o}s`:o<3600?`${t} +${Math.round(o/60)}m`:o<86400?`${t} +${Math.round(o/3600)}h`:`${t} +${Math.round(o/86400)}d`}function d(e){return e<10?`0${e}`:String(e)}async function T(e,n,...r){return w(e,`__sootsimTest.${n}`,...r)}async function x(e,n,...r){return p(e,`SootSim.bridges.mainShell.${n}`,...r)}async function N(e,n={}){try{let r=await T(e,"waitForScreenTransitions",C);if(!n.verbose||!r?.started)return;if(r.timedOut){console.log(` screen transition still active after ${r.waitedMs}ms; continuing`);return}r.waitedMs>0&&console.log(` waited ${r.waitedMs}ms for screen transition settle`)}catch{}}async function _(e,n,r,...t){let s=Date.now()+Math.max(0,r);for(;;)try{return await x(e,n,...t)}catch(o){if(!b(o)||Date.now()>=s)throw o;await g(50)}}async function k(e,n,r,t={}){let s=t.attempts??30,o=t.intervalMs??500,a=t.minNodeCount??10;for(let i=0;i<s;i++){let l=m(e,{commandTimeoutMs:n,simId:r,simIdSource:t.simIdSource});try{let u=await l.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof u=="number"&&u>a)return{bridge:l,count:u}}catch{}l.close(),await g(o)}return null}async function E(e,n,r,t={}){let s=t.timeoutMs??8e3,o=t.intervalMs??250,a=Date.now()+s;for(;Date.now()<a;){let i=m(e,{commandTimeoutMs:n,simId:r,simIdSource:t.simIdSource});try{return await i.send({type:"evaluate",code:"1"}),i}catch{i.close()}await g(o)}return null}async function O(e,n={}){let r=n.timeoutMs??1e4,t=await h(e,r),s=t.ready?t.flag===!0?"flag":"nodes-fallback":t.errors>0&&t.flag!==!0?"error-bail":"timeout";return{ready:t.ready,source:s,elapsedMs:t.elapsedMs,nodes:t.nodes,targets:t.targets,liveFrameActive:t.liveFrameActive,liveFrameChannels:t.liveFrameChannels,liveFramePublishes:t.liveFramePublishes,flag:t.flag,loadingText:t.loadingText,externalReady:t.externalReady,externalStatus:t.externalStatus,externalError:t.externalError,errors:t.errors}}function M(e){let n=e.displayUrl||e.url;return e.status!=null?`${e.method} ${n} -> ${e.status}${e.statusText?` ${e.statusText}`:""}`:e.error?`${e.method} ${n} -> ${e.error}`:`${e.method} ${n}`}async function $(e,n,...r){return e.send({type:"call",path:`__sootsimTest.${n}`,args:r})}async function v(e,n={}){let r=await e.send({type:"evaluate",code:S});if(!r||typeof r!="object")return;let t=Math.max(0,Number(r.errors)||0),s=Math.max(0,Number(r.warnings)||0);if(t===0&&s===0)return;let o=[];if(t>0&&o.push(`${t} console error${t===1?"":"s"}`),s>0&&o.push(`${s} console warning${s===1?"":"s"}`),console.log(`
|
|
7
7
|
console: ${o.join(", ")}`),n.errorsCommand&&console.log(` inspect: ${n.errorsCommand}`),s>0&&n.warningsCommand&&console.log(` inspect: ${n.warningsCommand}`),!n.includeTail||t===0)return;let a=await y(e,5);if(!(!Array.isArray(a)||a.length===0)){console.log(`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.371 | (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 y,c as P}from"./chunk-
|
|
4
|
+
import{a as y,c as P}from"./chunk-2LH4DYPM.js";import{a as f,b as S}from"./chunk-SHLJYXIN.js";import{b}from"./chunk-WLRIPAGJ.js";import{a as v}from"./chunk-CJQXP4XM.js";function M(){let e=f();return e?{available:!0,reason:null,detail:`${e.kind} @ ${e.path}`}:{available:!1,reason:"rnx desktop app not installed (run `rnx desktop install`)"}}async function A(e){let o=f();if(!o)return{launched:!1,message:"rnx desktop app not installed"};try{let r=await S(e.url,o,{device:e.device,profileId:e.profileId,ephemeralProfile:e.ephemeralProfile,ownerPid:e.ownerPid});return r.launched?{launched:!0,message:e.url?`electron launched via ${r.via} \u2192 ${e.url}`:`electron launched via ${r.via}`,target:r.target,attachUrl:e.url}:{launched:!1,message:"desktop companion failed to start"}}catch(r){return{launched:!1,message:`electron launch failed: ${r instanceof Error?r.message:String(r)}`}}}var k={id:"electron",name:"electron",description:"rnx desktop companion app (native window, menu bar)",kind:"native",availability:M,launch:A};import{spawn as B}from"child_process";import{closeSync as F,mkdtempSync as G,openSync as U,readFileSync as q}from"fs";import{tmpdir as T}from"os";import{join as I}from"path";import{spawnSync as O}from"node:child_process";import{existsSync as _,readFileSync as R}from"node:fs";import{createRequire as L}from"node:module";import{dirname as W,join as N}from"node:path";var $=`
|
|
5
5
|
const { existsSync } = require('node:fs');
|
|
6
6
|
const modulePath = process.env.SOOTSIM_PW_MODULE;
|
|
7
7
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.371 | (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 G,b as V,c as W,d as v}from"./chunk-
|
|
4
|
+
import{a as G,b as V,c as W,d as v}from"./chunk-TWNLRDIH.js";import{a as L}from"./chunk-VEFSHPSU.js";import{q as F}from"./chunk-LFANRLWK.js";import{a as M}from"./chunk-SHLJYXIN.js";import{b as Y,c as g}from"./chunk-4OLUFHEZ.js";import{f as c}from"./chunk-7TWD4P6J.js";import{c as B}from"./chunk-HFY35VAG.js";import{a as p,b as C,c as y,d as h,f as E,g as a,h as w,i as f,j as N}from"./chunk-H4DU457S.js";import{a as A}from"./chunk-S3AH2O67.js";import{D as O,E as j,F as $,G as T,M as I,l as P}from"./chunk-Y7SKGRAV.js";import{a as q}from"./chunk-IX7Z6ZVJ.js";import J from"node:os";import K from"node:path";async function Pe(e,n={}){if(e.includes("--help")||e.includes("-h")){ue();return}let r=ee(e),o=n.launchConnectRN??(!r.ci&&!r.yes&&!r.json&&!r.dryRun&&process.stdin.isTTY);try{ce(r);let t=G(r.appDir),i=Y(),z=$(),R=await te(r,i);!R&&!i.installed&&!r.json&&console.log(` ${y("Enable it later with")} ${p("rnx daemon install")}`);let u=await oe(r),Q=r.json?await c.fetchManifest():await w("Checking the rnx runtime",()=>c.fetchManifest()),l=c.resolveVersion(Q,{channel:"stable"}).version,b=q();if(b==="0.0.0")throw new Error("could not resolve the installed rnx CLI version");let S=!1;if(!r.dryRun){let d=I(),x=()=>c.install({version:l,channel:"stable",setActive:!0,protectVersions:d?[d]:[]});S=(r.json?await x():await w(`Preparing runtime ${l}`,x)).installed}let D=i.installed;R&&!i.installed&&!r.dryRun&&(r.json?await g({port:7668,force:!1}):(console.log(`
|
|
5
5
|
${p("\u25C6")} ${C("Enabling the background service")}`),await g({port:7668,force:!1})),D=!0),u==="electron"&&!r.dryRun&&!M()&&await L(["--yes"]),o&&(console.log(`
|
|
6
6
|
${p("\u25C6")} Opening ConnectRN`),await F(["ConnectRN","--driver",u,"--no-describe","--quiet"]));let X=await ie(r,z),Z=!1,s=t?V({appDir:t,cliVersion:b}):null,m=await se(r,s);if(m&&s){if(!r.json)for(let d of v(s))console.log(` ${y(r.dryRun?"Would run":"Running")} ${d}`);await W(s,{dryRun:r.dryRun,json:r.json})}r.dryRun||(T({productAnalytics:X,crashReports:Z}),j(u));let k={runtimeVersion:l,serviceInstalled:D,repositoryPrepared:m,simulatorDriver:u};return r.json?console.log(JSON.stringify({...k,runtimeInstalled:S,dryRun:r.dryRun,cache:ae(l),repositoryOperations:m&&s?v(s):[]},null,2)):console.log(`
|
|
7
7
|
${h("\u2713")} ${o?"ConnectRN is open. ":""}rnx is ready.`),k}catch(t){throw B(t),t}}function ee(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");return{appDir:K.resolve(r??process.cwd()),ci:e.includes("--ci")||A(),dryRun:e.includes("--dry-run"),json:e.includes("--json"),yes:e.includes("--yes")||e.includes("-y"),service:H(e,"--service","--no-service"),repository:H(e,"--repo","--no-repo"),productAnalytics:ne(e,"--analytics"),simulatorDriver:re(e)}}function re(e){let n=e.includes("--desktop"),r=e.includes("--browser");if(n&&r)throw new Error("--desktop and --browser cannot be used together");if(n)return"electron";if(r)return"playwright"}function H(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 ne(e,n){let r=e.find(i=>i.startsWith(`${n}=`)),o=e.indexOf(n),t=r?.slice(n.length+1)??(o>=0?e[o+1]:void 0);if(t!==void 0){if(t==="on"||t==="yes"||t==="true")return!0;if(t==="off"||t==="no"||t==="false")return!1;throw new Error(`${n} must be on or off`)}}async function te(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?(e.json||console.log(` ${h("\u2713")} Background service is ready`),!0):e.service!==void 0?e.service:e.yes?!0:(U(e,"--service or --no-service"),a("Background service",["Keeps the local bridge and runtime ready between commands.","Agent inspection, interaction, and test commands start much faster."]),f("Enable the background service?",!0)):(e.json||a("Background service",["The persistent service is currently available on macOS and Linux.","rnx will start the bridge when needed on this platform."]),!1)}async function oe(e){if(e.simulatorDriver)return e.simulatorDriver;let n=O();if(n)return n;if(e.ci||e.yes)return"playwright";U(e,"--desktop or --browser");let r=process.platform==="darwin"?"Desktop downloads a DMG and installs rnx.app.":process.platform==="win32"?"Desktop downloads and runs the rnx installer.":"Desktop downloads the matching rnx AppImage.",o=process.platform==="darwin"?"Desktop app Installs rnx.app from a DMG":process.platform==="win32"?"Desktop app Runs the rnx installer":"Desktop app Installs the matching AppImage";return a("Simulator window",["Browser opens immediately in an isolated Chrome window.",r,"The Desktop app opens in a dedicated native window."]),await N("Where should rnx open?",["Browser (recommended) No additional download",o])===0?"playwright":"electron"}async function ie(e,n){return e.productAnalytics!==void 0?e.productAnalytics:n.configured?n.productAnalytics:e.yes||e.ci||!process.stdin.isTTY?!1:(a("Private by default",["Diagnostics stay off unless you opt in.","Reports can contain package compatibility or an error class.","They never contain your code or app data."]),f("Share bounded diagnostics to improve rnx?",!1))}async function se(e,n){if(!n){if(e.repository===!0)throw new Error("--repo requires a package.json inside a Git repository");return!1}return n.operations.length===0?!0:e.repository!==void 0?e.repository:e.yes||e.ci||!process.stdin.isTTY?!1:(a("Share rnx with your team",["rnx already works here with no project setup.","This only adds an exact rnxsim dev dependency and an rnx script for teammates."]),f(`Add rnx to ${K.basename(n.appDir)}?`,!1))}function U(e,n){if(!(process.stdin.isTTY&&!e.ci))throw new Error(`non-interactive setup requires ${n}, or --yes to accept defaults`)}function ae(e){let n=J.platform(),r=J.arch();return{path:P(e),key:`sootsim-runtime-${n}-${r}-${e}`,inputs:{platform:n,arch:r,runtimeVersion:e}}}function ce(e){e.json||E("Run any React Native app in a local simulator. No project setup required.")}function ue(){console.log(`
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*! rnx v0.1.371 | (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 Y}from"./chunk-FLNGSIBL.js";import{c as u}from"./chunk-ERBGQEJ5.js";import{P as M,R as H,g as U,j as A,s as O,t as L,u as j}from"./chunk-Y7SKGRAV.js";import{a as V}from"./chunk-IX7Z6ZVJ.js";import{a as S}from"./chunk-OQPZOEEP.js";import{execFileSync as Z,spawnSync as a}from"child_process";import{existsSync as s,mkdirSync as E,readFileSync as le,realpathSync as ue,rmSync as y,writeFileSync as Q}from"fs";import{homedir as w}from"os";import{basename as de,dirname as B,resolve as d,sep as W}from"path";import{execFileSync as re}from"child_process";import{chmodSync as ne,mkdirSync as T,rmSync as oe,writeFileSync as _}from"fs";import{dirname as N}from"path";var se="dev.sootsim.daemon",G="SootSim Daemon",q="0.1.36";function X(e,t,r){let o=L(),n=j(),c=N(N(n)),l=N(n),p=`${c}/Resources`;oe(o,{recursive:!0,force:!0}),T(O(),{recursive:!0}),T(l,{recursive:!0}),T(p,{recursive:!0}),_(`${c}/Info.plist`,ie()),_(`${c}/PkgInfo`,"APPL????"),_(n,ae(e,t,r)),ne(n,493);try{re("codesign",["--force","--sign","-","--deep",o],{stdio:"pipe"})}catch(i){let h=i instanceof Error?i.message:String(i);console.warn(` warning: ad-hoc codesign of ${o} failed: ${h}
|
|
5
|
+
the daemon will still run, but Login Items may show a generic name.`)}return{bundlePath:o,launcherPath:n}}function ie(){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
6
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
7
|
+
<plist version="1.0">
|
|
8
|
+
<dict>
|
|
9
|
+
<key>CFBundleDevelopmentRegion</key><string>en</string>
|
|
10
|
+
<key>CFBundleDisplayName</key><string>${G}</string>
|
|
11
|
+
<key>CFBundleExecutable</key><string>sootsim-daemon</string>
|
|
12
|
+
<key>CFBundleIdentifier</key><string>${se}</string>
|
|
13
|
+
<key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
|
|
14
|
+
<key>CFBundleName</key><string>${G}</string>
|
|
15
|
+
<key>CFBundlePackageType</key><string>APPL</string>
|
|
16
|
+
<key>CFBundleShortVersionString</key><string>${q}</string>
|
|
17
|
+
<key>CFBundleSignature</key><string>????</string>
|
|
18
|
+
<key>CFBundleVersion</key><string>${q}</string>
|
|
19
|
+
<key>LSBackgroundOnly</key><true/>
|
|
20
|
+
<key>LSUIElement</key><true/>
|
|
21
|
+
<key>LSMinimumSystemVersion</key><string>13.0</string>
|
|
22
|
+
<key>NSHumanReadableCopyright</key><string>Tamagui LLC</string>
|
|
23
|
+
</dict>
|
|
24
|
+
</plist>
|
|
25
|
+
`}function ae(e,t,r){let n=[e.executable,...e.prefixArgs,"serve","--quiet","--port",String(t)].map(C).join(" "),c=C(r.stdout),l=C(r.stderr);return`#!/bin/sh
|
|
26
|
+
# sootsim daemon launcher generated by 'rnx daemon install'.
|
|
27
|
+
# launchd spawns this; we exec the real rnx invocation in place so
|
|
28
|
+
# launchd tracks the daemon process, not the shell wrapper.
|
|
29
|
+
#
|
|
30
|
+
# stdout: ${r.stdout}
|
|
31
|
+
# stderr: ${r.stderr}
|
|
32
|
+
# a missing or broken executable can make launchd retry forever. truncate a
|
|
33
|
+
# retry log before it passes 10 MiB so that failure stays bounded on disk.
|
|
34
|
+
for log_path in ${c} ${l}; do
|
|
35
|
+
if [ -f "$log_path" ]; then
|
|
36
|
+
log_bytes=$(wc -c < "$log_path" 2>/dev/null || echo 0)
|
|
37
|
+
if [ "$log_bytes" -gt 10485760 ]; then
|
|
38
|
+
: > "$log_path"
|
|
39
|
+
fi
|
|
40
|
+
fi
|
|
41
|
+
done
|
|
42
|
+
exec ${n}
|
|
43
|
+
`}function C(e){return`'${e.replace(/'/g,"'\\''")}'`}var ee=60,$="dev.sootsim.daemon",R="dev.sootsim.server",m="sootsim-daemon",f=d(w(),"Library/Logs/sootsim"),P=d(w(),".local/state/sootsim");async function Qe(e,t={}){let[r,...o]=e,n=t.port??7668;if(!r||r==="--help"||r==="-h"){K();return}switch(r){case"install":return Se({port:n,force:o.includes("--force")});case"uninstall":return De();case"status":return Le();case"restart":return Pe();case"start":return Ee();case"stop":return Ie();case"logs":return Ae(o);default:console.error(` unknown daemon subcommand: ${r}`),K(),u(1)}}function K(){Y("daemon")}function pe(){let e=ge();if(e)return e;let t=he();return{executable:process.execPath,prefixArgs:[t]}}function ge(){if(!me())return null;let e=fe();if(!e)return null;let t=V(),r=t==="0.0.0"?S.packageName:`${S.packageName}@${t}`;return{executable:process.execPath,prefixArgs:[e,"exec","--yes","--package",r,"--",S.commandName]}}function me(){let e=process.argv[1];return process.env.npm_command==="exec"?!0:e?I(e).includes(`${W}_npx${W}`):!1}function fe(){try{let t=Z("which",["npm"],{encoding:"utf8"}).trim();if(t&&s(t))return z(t)}catch{}let e=process.env.npm_execpath;return e&&s(e)?z(e):null}function z(e){let t=I(e);if(de(t)==="npx-cli.js"){let r=d(B(t),"npm-cli.js");if(s(r))return r}return t}function he(){try{let t=Z("which",[S.commandName],{encoding:"utf8"}).trim();if(t&&s(t))return I(t)}catch{}let e=process.argv[1];if(e&&s(e))return I(e);throw new Error(`could not locate the ${S.commandName} binary`)}function I(e){try{return ue(e)}catch{return e}}function ye(e,t){E(f,{recursive:!0});let r=d(f,"bridge.out.log"),o=d(f,"bridge.err.log"),{launcherPath:n}=X(e,t,{stdout:r,stderr:o}),c=` <string>${be(n)}</string>`;return`<?xml version="1.0" encoding="UTF-8"?>
|
|
44
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
45
|
+
<plist version="1.0">
|
|
46
|
+
<dict>
|
|
47
|
+
<key>Label</key><string>${$}</string>
|
|
48
|
+
<key>ProgramArguments</key>
|
|
49
|
+
<array>
|
|
50
|
+
${c}
|
|
51
|
+
</array>
|
|
52
|
+
<key>RunAtLoad</key><true/>
|
|
53
|
+
<key>KeepAlive</key><true/>
|
|
54
|
+
<key>ThrottleInterval</key><integer>${ee}</integer>
|
|
55
|
+
<key>ProcessType</key><string>Background</string>
|
|
56
|
+
<key>StandardOutPath</key><string>${r}</string>
|
|
57
|
+
<key>StandardErrorPath</key><string>${o}</string>
|
|
58
|
+
</dict>
|
|
59
|
+
</plist>
|
|
60
|
+
`}function $e(e,t){return E(P,{recursive:!0}),`[Unit]
|
|
61
|
+
Description=rnx bridge daemon
|
|
62
|
+
After=default.target
|
|
63
|
+
|
|
64
|
+
[Service]
|
|
65
|
+
Type=simple
|
|
66
|
+
ExecStart=${[e.executable,...e.prefixArgs].map(ke).join(" ")} serve --quiet --port ${t}
|
|
67
|
+
Restart=always
|
|
68
|
+
RestartSec=${ee}
|
|
69
|
+
|
|
70
|
+
[Install]
|
|
71
|
+
WantedBy=default.target
|
|
72
|
+
`}function be(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ke(e){return/[^\w@%+=:,./-]/.test(e)?`'${e.replace(/'/g,"'\\''")}'`:e}function b(){return d(w(),"Library/LaunchAgents",`${$}.plist`)}function ve(e=w()){return d(e,"Library/LaunchAgents",`${R}.plist`)}function k(){return d(w(),".config/systemd/user",`${m}.service`)}function We(){if(A())return{supported:!1,installed:!1};if(process.platform==="darwin"){let e=b();return{supported:!0,installed:s(e),path:e}}if(process.platform==="linux"){let e=k();return{supported:!0,installed:s(e),path:e}}return{supported:!1,installed:!1}}async function Se({port:e,force:t}){if(A())throw new Error("background daemon setup is unavailable in this environment");let r=pe();if(console.log(` binary: ${[r.executable,...r.prefixArgs].join(" ")}`),console.log(` port: ${e}`),process.platform==="darwin"){te().missing||console.log(` removed legacy ${R} service`);let n=b();if(s(n)&&!t){console.log(` already installed at ${n}`),console.log(" pass --force to overwrite, or use 'rnx daemon restart' to reload");return}E(B(n),{recursive:!0}),Q(n,ye(r,e)),console.log(` wrote ${n}`);let c=`gui/${process.getuid()}`,l=`${c}/${$}`,p=()=>{let g=a("launchctl",["bootstrap",c,n],{stdio:"pipe",encoding:"utf8"}),D=(g.stderr||g.stdout||"").trim();if(g.status!==0)return{ok:!1,reason:`bootstrap exit ${g.status}${D?`: ${D}`:""}`};let F=a("launchctl",["print",l],{encoding:"utf8"});return F.status!==0?{ok:!1,reason:`bootstrap returned 0 but service not registered (print exit ${F.status})`}:{ok:!0}},i=p();if(!i.ok){let g=i.reason;if(a("launchctl",["bootout",l],{stdio:"ignore"}),i=p(),!i.ok)throw new Error(`launchctl bootstrap failed: ${i.reason}`+(g!==i.reason?` (initial: ${g})`:"")+" \u2014 try `rnx daemon uninstall` then retry, or reboot if launchd state is stuck.")}let h=Date.now()+4e3,v,x;for(;Date.now()<h;){let g=a("launchctl",["print",l],{encoding:"utf8"});if(g.status===0&&(v=g.stdout?.match(/state\s*=\s*(\w+)/)?.[1],x=g.stdout?.match(/pid\s*=\s*(\d+)/)?.[1],v==="running"||x))break;await new Promise(D=>setTimeout(D,150))}if(v!=="running"&&!x)throw new Error(`daemon registered but did not reach running state within 4s (last state: ${v||"unknown"}). check ${d(f,"bridge.err.log")} \u2014 typically a stale runtime or a port already bound by another process.`);console.log(` registered (state: ${v||"unknown"}${x?`, pid ${x}`:""}, log: ${d(f,"bridge.err.log")})`);return}if(process.platform==="linux"){let o=k();if(s(o)&&!t){console.log(` already installed at ${o}`),console.log(" pass --force to overwrite, or use 'rnx daemon restart' to reload");return}E(B(o),{recursive:!0}),Q(o,$e(r,e)),console.log(` wrote ${o}`);let n=a("systemctl",["--user","daemon-reload"],{stdio:"pipe",encoding:"utf8"});if(n.status!==0){let i=(n.stderr||n.stdout||"").trim();throw new Error(`systemctl daemon-reload failed${i?`: ${i}`:""}`)}let c=a("systemctl",["--user","enable","--now",m],{stdio:"pipe",encoding:"utf8"});if(c.status!==0){let i=(c.stderr||c.stdout||"").trim();throw new Error(`systemctl enable --now failed${i?`: ${i}`:""} \u2014 try \`rnx daemon uninstall\` then retry.`)}let p=(a("systemctl",["--user","is-active",m],{encoding:"utf8"}).stdout||"").trim()||"unknown";console.log(` registered (state: ${p}, journalctl --user -u ${m} to tail logs)`);try{let i=process.env.USER||process.env.LOGNAME||"";if(i){let h=a("loginctl",["show-user",i,"--property=Linger","--value"],{encoding:"utf8"});!((h.stdout||"").trim().toLowerCase()==="yes")&&h.status===0&&console.log(` note: linger is not enabled for "${i}". the daemon will exit at logout.
|
|
73
|
+
enable persistence with: sudo loginctl enable-linger ${i}`)}}catch{}return}console.error(` background daemon is not supported on ${process.platform}`),console.error(" run 'rnx serve' in a persistent shell instead"),u(1)}function te(e={}){let t=e.userHome??w(),r=ve(t),o=d(t,"Library/Logs/sootsim"),n=[];if(s(r)){let c=`${e.launchTarget??`gui/${process.getuid?.()??0}`}/${R}`;(e.bootout??(p=>{a("launchctl",["bootout",p],{stdio:"ignore"})}))(c),y(r,{force:!0}),n.push(r)}for(let c of["server.err.log","server.out.log"]){let l=d(o,c);s(l)&&(y(l,{force:!0}),n.push(l))}return{removed:n,missing:n.length===0}}function we(){let e=[];if(process.platform==="darwin"){let t=te();e.push(...t.removed);let r=b();s(r)&&(a("launchctl",["bootout",`gui/${process.getuid()}/${$}`],{stdio:"ignore"}),y(r,{force:!0}),e.push(r));let o=L();return s(o)&&(y(o,{recursive:!0,force:!0}),e.push(o)),s(f)&&(y(f,{recursive:!0,force:!0}),e.push(f)),{removed:e,missing:e.length===0}}if(process.platform==="linux"){let t=k();return s(t)&&(a("systemctl",["--user","disable","--now",m],{stdio:"ignore"}),y(t,{force:!0}),a("systemctl",["--user","daemon-reload"],{stdio:"ignore"}),a("systemctl",["--user","reset-failed",m],{stdio:"ignore"}),e.push(t)),s(P)&&(y(P,{recursive:!0,force:!0}),e.push(P)),{removed:e,missing:e.length===0}}return{removed:e,missing:!0}}function xe(){let e=[],t=U();return s(t)&&(y(t,{recursive:!0,force:!0}),e.push(t)),{removed:e,missing:e.length===0}}async function De(){let e=we();for(let r of e.removed)console.log(` removed ${r}`);let t=xe();for(let r of t.removed)console.log(` removed ${r}`);e.missing&&t.missing&&console.log(" not installed")}function J(){let e=M();if(H(e)){console.log(` bridge: responding on port ${e.bridgePort} (pid ${e.pid})`);return}console.log(e?" bridge: NOT responding \u2014 stale lockfile; check `rnx daemon logs`":" bridge: NOT responding \u2014 no lockfile; check `rnx daemon logs`")}async function Le(){if(process.platform==="darwin"){let e=b();if(!s(e)){console.log(" installed: no");return}console.log(` installed: yes (${e})`);let t=Te(e);t&&console.log(` binary: ${t}`);let r=a("launchctl",["print",`gui/${process.getuid()}/${$}`],{encoding:"utf8"});if(r.status===0){let o=r.stdout.match(/state\s*=\s*(\w+)/)?.[1],n=r.stdout.match(/pid\s*=\s*(\d+)/)?.[1];console.log(` state: ${o||"unknown"}${n?` (pid ${n})`:""}`)}else console.log(" state: not running");J();return}if(process.platform==="linux"){let e=k();if(!s(e)){console.log(" installed: no");return}console.log(` installed: yes (${e})`);let t=a("systemctl",["--user","is-active",m],{encoding:"utf8"});console.log(` state: ${t.stdout.trim()||"unknown"}`),J();return}console.error(` unsupported platform: ${process.platform}`),u(1)}async function Pe(){if(process.platform==="darwin"){let e=b();s(e)||(console.error(" daemon not registered. run `rnx daemon install`"),u(1));let t=a("launchctl",["kickstart","-k",`gui/${process.getuid()}/${$}`],{stdio:"pipe",encoding:"utf8"});t.status!==0&&(console.error(` kickstart failed: ${t.stderr?.trim()}`),u(1)),console.log(" restarted");return}if(process.platform==="linux"){let e=k();s(e)||(console.error(" daemon not registered. run `rnx daemon install`"),u(1));let t=a("systemctl",["--user","restart",m],{stdio:"pipe",encoding:"utf8"});t.status!==0&&(console.error(` restart failed: ${t.stderr?.trim()}`),u(1)),console.log(" restarted");return}console.error(` unsupported platform: ${process.platform}`),u(1)}async function Ee(){if(process.platform==="darwin"){let e=b();s(e)||(console.error(" daemon not registered. run `rnx daemon install`"),u(1));let t=a("launchctl",["kickstart",`gui/${process.getuid()}/${$}`],{stdio:"pipe",encoding:"utf8"});t.status!==0&&(console.error(` start failed: ${t.stderr?.trim()}`),u(1)),console.log(" started");return}if(process.platform==="linux"){let e=k();s(e)||(console.error(" daemon not registered. run `rnx daemon install`"),u(1));let t=a("systemctl",["--user","start",m],{stdio:"pipe",encoding:"utf8"});t.status!==0&&(console.error(` start failed: ${t.stderr?.trim()}`),u(1)),console.log(" started");return}console.error(` unsupported platform: ${process.platform}`),u(1)}async function Ie(){if(process.platform==="darwin"){let e=b();s(e)||(console.error(" daemon not registered \u2014 nothing to stop"),u(1));let t=a("launchctl",["bootout",`gui/${process.getuid()}/${$}`],{stdio:"pipe",encoding:"utf8"});t.status!==0&&(console.error(` stop failed: ${t.stderr?.trim()}`),u(1)),console.log(" stopped");return}if(process.platform==="linux"){let e=k();s(e)||(console.error(" daemon not registered \u2014 nothing to stop"),u(1));let t=a("systemctl",["--user","stop",m],{stdio:"pipe",encoding:"utf8"});t.status!==0&&(console.error(` stop failed: ${t.stderr?.trim()}`),u(1)),console.log(" stopped");return}console.error(` unsupported platform: ${process.platform}`),u(1)}async function Ae(e){let t=e.find(n=>/^-n\d+$|^--lines=\d+$|^\d+$/.test(n)),r=t?Number(t.replace(/\D/g,"")):200,o=e.includes("-f")||e.includes("--follow");if(process.platform==="darwin"){let n=d(f,"bridge.out.log"),c=d(f,"bridge.err.log"),l=[n,c].filter(i=>s(i));l.length===0&&(console.error(` no daemon logs yet at ${f}. run \`rnx daemon install\``),u(1));let p=o?["-n",String(r),"-F",...l]:["-n",String(r),...l];a("tail",p,{stdio:"inherit"});return}if(process.platform==="linux"){let n=`${m}.service`,c=["--user","-u",n,"-n",String(r),"--no-pager"],l=a("journalctl",o?[...c,"-f"]:c,{encoding:"utf8",stdio:o?"inherit":"pipe"});if(o)return;let p=`${l.stdout||""}${l.stderr||""}`,i=/insufficient permissions|No journal files were opened/i.test(p);if(l.status===0&&!i){process.stdout.write(l.stdout||"");return}let h=a("journalctl",[`_SYSTEMD_USER_UNIT=${n}`,"-n",String(r),"--no-pager"],{encoding:"utf8"});if(h.status===0&&(h.stdout||"").trim()){process.stdout.write(h.stdout);return}console.error(` could not read --user journal for ${n} (this user isn't in the systemd-journal group yet).
|
|
74
|
+
run: sudo journalctl _SYSTEMD_USER_UNIT=${n} -n ${r} --no-pager`),u(1)}console.error(` unsupported platform: ${process.platform}`),u(1)}function Te(e){try{return le(e,"utf8").match(/<array>\s*<string>([^<]+)<\/string>/)?.[1]||null}catch{return null}}export{Qe as a,We as b,Se as c,te as d,we as e,xe as f};
|