rnxsim 0.1.375 → 0.1.377
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -25
- package/cli/app-config.ts +9 -12
- package/cli/app-fonts.ts +3 -3
- package/cli/app-project.ts +8 -8
- package/cli/auth.ts +7 -9
- package/cli/bin.ts +16 -31
- package/cli/bridge-flow-runner.ts +3 -3
- package/cli/browser-backend.ts +44 -0
- package/cli/command-contract.ts +221 -0
- package/cli/command-registry.ts +291 -0
- package/cli/commands/agent-wrapper.ts +2 -2
- package/cli/commands/app-fonts.ts +2 -2
- package/cli/commands/assert.ts +3 -3
- package/cli/commands/auth.ts +1 -1
- package/cli/commands/box/cloud-box.ts +1 -1
- package/cli/commands/box/plane-share.ts +2 -2
- package/cli/commands/box.ts +4 -6
- package/cli/commands/compat.ts +1 -1
- package/cli/commands/config.ts +2 -2
- package/cli/commands/control.ts +42 -28
- package/cli/commands/cpu-profile.ts +7 -7
- package/cli/commands/daemon-mac-app.ts +7 -7
- package/cli/commands/daemon.ts +10 -10
- package/cli/commands/debug.ts +11 -11
- package/cli/commands/detox.ts +13 -13
- package/cli/commands/diagnose.ts +6 -6
- package/cli/commands/do-chain.ts +1 -2
- package/cli/commands/electron.ts +1 -3
- package/cli/commands/film.ts +3 -3
- package/cli/commands/flow.ts +43 -43
- package/cli/commands/inspect/count.ts +1 -1
- package/cli/commands/inspect/describe.ts +1 -1
- package/cli/commands/inspect/env.ts +2 -2
- package/cli/commands/inspect/get-layout.ts +1 -1
- package/cli/commands/inspect/keyboard.ts +1 -1
- package/cli/commands/inspect/list.ts +1 -1
- package/cli/commands/inspect/memory.ts +1 -1
- package/cli/commands/inspect/resolve-target.ts +1 -1
- package/cli/commands/inspect/screens.ts +1 -1
- package/cli/commands/inspect/tree.ts +1 -1
- package/cli/commands/inspect/url.ts +1 -1
- package/cli/commands/inspect/wait-event.ts +5 -5
- package/cli/commands/inspect.ts +34 -34
- package/cli/commands/install-desktop.ts +3 -3
- package/cli/commands/login.ts +6 -6
- package/cli/commands/maestro-generate.ts +5 -5
- package/cli/commands/maestro.ts +5 -5
- package/cli/commands/profile.ts +1 -1
- package/cli/commands/record.ts +9 -9
- package/cli/commands/runtime.ts +18 -18
- package/cli/commands/screenshot-command.ts +1 -1
- package/cli/commands/screenshot-layers.ts +5 -5
- package/cli/commands/screenshot-mode.ts +1 -1
- package/cli/commands/screenshot.ts +8 -8
- package/cli/commands/screenshots-capture.ts +5 -5
- package/cli/commands/serve.ts +3 -3
- package/cli/commands/setup.ts +20 -12
- package/cli/commands/skills.ts +5 -5
- package/cli/commands/slides.ts +1 -1
- package/cli/commands/telemetry.ts +1 -1
- package/cli/commands/three-mode.ts +1 -1
- package/cli/commands/timeline.ts +8 -8
- package/cli/commands/upgrade.ts +116 -131
- package/cli/commands/upload.ts +12 -12
- package/cli/commands/version.ts +7 -7
- package/cli/commands/what-happened.ts +9 -9
- package/cli/current-sim.ts +3 -3
- package/cli/desktop-companion.ts +1 -1
- package/cli/drivers/playwright.ts +9 -9
- package/cli/drivers/registry.ts +1 -1
- package/cli/drivers/types.ts +1 -1
- package/cli/flow-file.ts +2 -2
- package/cli/flow-session.ts +1 -1
- package/cli/help-core.ts +136 -0
- package/cli/help.ts +17 -53
- package/cli/hints.ts +5 -5
- package/cli/inspect-notice-state.ts +1 -1
- package/cli/maestro-js.ts +1 -1
- package/cli/outbound-endpoints.ts +23 -5
- package/cli/parse-args.ts +19 -66
- package/cli/recording-access.ts +1 -1
- package/cli/registry.ts +1 -0
- package/cli/run-registry.ts +1 -1
- package/cli/run-rnx-core.ts +148 -0
- package/cli/run-rnx.ts +6 -9
- package/cli/runtime-notes.ts +3 -3
- package/cli/standalone.ts +4 -0
- package/cli/ws-bridge.ts +8 -8
- package/detox/config-loader.ts +2 -2
- package/detox/index.ts +8 -8
- package/detox/jest-preset.cjs +1 -1
- package/detox/navigation.ts +2 -2
- package/dist-lib/agent-daemon-client.cjs +5 -5
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +2 -2
- package/dist-lib/agent-sessions.cjs +10 -10
- package/dist-lib/attached-projects.cjs +6 -6
- package/dist-lib/auth/shared-session.cjs +6 -6
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/config.cjs +25 -25
- package/dist-lib/detox/index.cjs +9 -9
- package/dist-lib/detox/jest-preset.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +29 -29
- package/dist-lib/host/bridge-host.cjs +274 -181
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +14 -14
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +8 -8
- package/dist-lib/profiles.cjs +12 -12
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +25 -11
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +470 -322
- package/dist-lib/vite.cjs +9 -9
- package/package.json +4 -11
- package/scripts/dev-server-scanner.ts +25 -7
- package/scripts/optional-demo-registry.ts +1 -1
- package/skills/contrast/SKILL.md +3 -3
- package/skills/rnx-debug/SKILL.md +1 -1
- package/skills/rnx-test/SKILL.md +2 -2
- package/src/agent-identity.ts +1 -1
- package/src/agent-sessions.ts +7 -5
- package/src/cli-version.ts +12 -4
- package/src/config.ts +26 -28
- package/src/disk-cleanup.ts +11 -11
- package/src/home-paths.ts +28 -28
- package/src/host/bridge-host.ts +16 -16
- package/src/metro-plugin.ts +2 -2
- package/src/profiles.ts +2 -2
- package/src/runtime-assets.ts +7 -7
- package/src/runtime-delivery.ts +13 -13
- package/src/screenshots/orchestrate.ts +1 -1
- package/src/screenshots/schema.ts +2 -2
- package/src/skills/builtin/a11y-review.ts +2 -2
- package/src/skills/builtin/compat-check.ts +2 -2
- package/src/skills/builtin/maestro-test.ts +2 -2
- package/src/skills/builtin/perf-profile.ts +2 -2
- package/src/skills/builtin/screenshot-all.ts +2 -2
- package/src/skills/builtin/visual-diff.ts +2 -2
- package/src/skills/registry.ts +8 -8
- package/src/skills/types.ts +1 -1
- package/src/vite-plugin-one.ts +3 -3
- package/src/vite-plugin.ts +15 -2
- package/dist-cli/bin.js +0 -15
- package/dist-cli/chunks/agent-JJN7U6FR.js +0 -48
- package/dist-cli/chunks/agent-wrapper-AVVUJ3WF.js +0 -17
- package/dist-cli/chunks/app-fonts-QJ22CNAZ.js +0 -4
- package/dist-cli/chunks/assert-PZZKIY3K.js +0 -49
- package/dist-cli/chunks/auth-5AVDJO33.js +0 -12
- package/dist-cli/chunks/beta-PFRGP266.js +0 -4
- package/dist-cli/chunks/box-ILC2O7ZO.js +0 -1730
- package/dist-cli/chunks/camera-J3V62PP7.js +0 -33
- package/dist-cli/chunks/chunk-25KRGDZT.js +0 -4
- package/dist-cli/chunks/chunk-2BRBFLWA.js +0 -38
- package/dist-cli/chunks/chunk-2GXNAZHB.js +0 -74
- package/dist-cli/chunks/chunk-2IUMRRYV.js +0 -7
- package/dist-cli/chunks/chunk-4ALPWIMP.js +0 -10
- package/dist-cli/chunks/chunk-4CEZZKRY.js +0 -4
- package/dist-cli/chunks/chunk-4EUKOIAV.js +0 -4
- package/dist-cli/chunks/chunk-4IKE4YUS.js +0 -32
- package/dist-cli/chunks/chunk-4ZXR2M3D.js +0 -4
- package/dist-cli/chunks/chunk-5CGJFU27.js +0 -7
- package/dist-cli/chunks/chunk-5HHWECGT.js +0 -4
- package/dist-cli/chunks/chunk-5PZVYF42.js +0 -312
- package/dist-cli/chunks/chunk-7NCPUZ52.js +0 -27
- package/dist-cli/chunks/chunk-7OSIJCBR.js +0 -107
- package/dist-cli/chunks/chunk-AQ5TMOAI.js +0 -4
- package/dist-cli/chunks/chunk-BQCEI37V.js +0 -5
- package/dist-cli/chunks/chunk-C6B5FOP3.js +0 -4
- package/dist-cli/chunks/chunk-CCMZSHJB.js +0 -71
- package/dist-cli/chunks/chunk-CX7VCKAT.js +0 -14
- package/dist-cli/chunks/chunk-DQUPSAHE.js +0 -4
- package/dist-cli/chunks/chunk-DSD2UBZI.js +0 -4
- package/dist-cli/chunks/chunk-EWPAI4MO.js +0 -7
- package/dist-cli/chunks/chunk-EZXV6U2N.js +0 -497
- package/dist-cli/chunks/chunk-F5F7FIPM.js +0 -6
- package/dist-cli/chunks/chunk-FUTYK55H.js +0 -30
- package/dist-cli/chunks/chunk-FW6AN7I2.js +0 -3
- package/dist-cli/chunks/chunk-FZDRA7Z4.js +0 -4
- package/dist-cli/chunks/chunk-GDLE4NIV.js +0 -4
- package/dist-cli/chunks/chunk-GEX7RVHY.js +0 -5
- package/dist-cli/chunks/chunk-H4MYYOYJ.js +0 -5
- package/dist-cli/chunks/chunk-HEV7BAPE.js +0 -11
- package/dist-cli/chunks/chunk-HNDWYCND.js +0 -506
- package/dist-cli/chunks/chunk-HNPHODBD.js +0 -4
- package/dist-cli/chunks/chunk-HWDVC6YA.js +0 -11
- package/dist-cli/chunks/chunk-JOHJZUGG.js +0 -4
- package/dist-cli/chunks/chunk-JWUDT4QK.js +0 -5
- package/dist-cli/chunks/chunk-K7QQWKGE.js +0 -4
- package/dist-cli/chunks/chunk-LAOKTKT4.js +0 -4
- package/dist-cli/chunks/chunk-LD7I266X.js +0 -24
- package/dist-cli/chunks/chunk-LMHBU5LZ.js +0 -4
- package/dist-cli/chunks/chunk-LSOGXSDV.js +0 -535
- package/dist-cli/chunks/chunk-MP2GPO4T.js +0 -4
- package/dist-cli/chunks/chunk-MXJ2UWRV.js +0 -4
- package/dist-cli/chunks/chunk-OJNKRIZF.js +0 -15
- package/dist-cli/chunks/chunk-PBOWUNXO.js +0 -4
- package/dist-cli/chunks/chunk-PNRJFHX4.js +0 -4
- package/dist-cli/chunks/chunk-QJQOK34O.js +0 -28
- package/dist-cli/chunks/chunk-RLCQLMFF.js +0 -142
- package/dist-cli/chunks/chunk-S65CK3RI.js +0 -9
- package/dist-cli/chunks/chunk-SWBUNMQS.js +0 -4
- package/dist-cli/chunks/chunk-SXBFGGAM.js +0 -4
- package/dist-cli/chunks/chunk-T4ISWS5H.js +0 -4
- package/dist-cli/chunks/chunk-TPPVAA7Z.js +0 -5
- package/dist-cli/chunks/chunk-USM3P74H.js +0 -4
- package/dist-cli/chunks/chunk-V4EJJHF5.js +0 -4
- package/dist-cli/chunks/chunk-V7RGRZOL.js +0 -423
- package/dist-cli/chunks/chunk-XUBV77WH.js +0 -130
- package/dist-cli/chunks/chunk-XYSDYGKC.js +0 -4
- package/dist-cli/chunks/chunk-YNHRSDVG.js +0 -5
- package/dist-cli/chunks/chunk-YX52RJKO.js +0 -4
- package/dist-cli/chunks/chunk-Z5O5H4O7.js +0 -99
- package/dist-cli/chunks/chunk-Z6LOIW46.js +0 -7
- package/dist-cli/chunks/chunk-ZXFVBYJY.js +0 -5
- package/dist-cli/chunks/cleanup-KPUW4SFK.js +0 -25
- package/dist-cli/chunks/cli-version-APGT6GAT.js +0 -4
- package/dist-cli/chunks/compat-XXRFD2TW.js +0 -23
- package/dist-cli/chunks/config-DDMFDQ7F.js +0 -13
- package/dist-cli/chunks/connect-IPG47YXM.js +0 -4
- package/dist-cli/chunks/control-O22Z3UJ5.js +0 -4
- package/dist-cli/chunks/daemon-PADUIMJV.js +0 -4
- package/dist-cli/chunks/debug-MYIP46TM.js +0 -200
- package/dist-cli/chunks/desktop-ENFFBQAA.js +0 -31
- package/dist-cli/chunks/detox-J5WVK6OH.js +0 -52
- package/dist-cli/chunks/device-RAVQVL75.js +0 -18
- package/dist-cli/chunks/diagnose-PJMPXKJY.js +0 -43
- package/dist-cli/chunks/disk-cleanup-YLAY445J.js +0 -4
- package/dist-cli/chunks/do-chain-UBE7GIOU.js +0 -5
- package/dist-cli/chunks/drivers-ZFNX3T5Z.js +0 -4
- package/dist-cli/chunks/env-Y5XJSNRD.js +0 -4
- package/dist-cli/chunks/film-W3V6VURB.js +0 -74
- package/dist-cli/chunks/flow-VMLI7BYM.js +0 -4
- package/dist-cli/chunks/help-PKZCWHJJ.js +0 -4
- package/dist-cli/chunks/hidden-runtime-alias-S5DJ7EDF.js +0 -4
- package/dist-cli/chunks/home-paths-5O4IZPYV.js +0 -4
- package/dist-cli/chunks/inspect-LT4MXK37.js +0 -4
- package/dist-cli/chunks/install-desktop-EXCFMXFS.js +0 -4
- package/dist-cli/chunks/login-V6TZ54ZH.js +0 -26
- package/dist-cli/chunks/logout-SPMLFWYA.js +0 -4
- package/dist-cli/chunks/maestro-5ISTBAZE.js +0 -108
- package/dist-cli/chunks/maestro-generate-WUI64NHR.js +0 -36
- package/dist-cli/chunks/mode-QPNBYXUF.js +0 -26
- package/dist-cli/chunks/optional-demo-registry-CBSYF4CG.js +0 -4
- package/dist-cli/chunks/perf-T6N5PVYV.js +0 -48
- package/dist-cli/chunks/permissions-YZ7RRSZJ.js +0 -13
- package/dist-cli/chunks/platform-XDQAA72X.js +0 -6
- package/dist-cli/chunks/privacy-54FIGXLT.js +0 -4
- package/dist-cli/chunks/record-QGYXRUKP.js +0 -72
- package/dist-cli/chunks/report-issue-VUUTGX7V.js +0 -29
- package/dist-cli/chunks/reset-CGO52KBW.js +0 -4
- package/dist-cli/chunks/resolve-target-NNQCALDM.js +0 -4
- package/dist-cli/chunks/runtime-4EP6YJVL.js +0 -4
- package/dist-cli/chunks/screenshot-command-NZCMSJ4P.js +0 -159
- package/dist-cli/chunks/screenshot-layers-VMTQ6XIU.js +0 -20
- package/dist-cli/chunks/screenshots-capture-K3MWIDBK.js +0 -42
- package/dist-cli/chunks/serve-QJRIB2BV.js +0 -56
- package/dist-cli/chunks/setup-6XXEJQVF.js +0 -4
- package/dist-cli/chunks/sim-client-5YUVL45C.js +0 -4
- package/dist-cli/chunks/skills-T3CS7CXK.js +0 -50
- package/dist-cli/chunks/state-AJC3VK3G.js +0 -14
- package/dist-cli/chunks/storage-KVGZKC3Y.js +0 -37
- package/dist-cli/chunks/store-AWUMOQUH.js +0 -4
- package/dist-cli/chunks/telemetry-W5ZDGWK6.js +0 -4
- package/dist-cli/chunks/timeline-DXDCAZUA.js +0 -24
- package/dist-cli/chunks/upgrade-SRPTJACU.js +0 -7
- package/dist-cli/chunks/upload-ZDV4BFED.js +0 -4
- package/dist-cli/chunks/version-SOLPSBMG.js +0 -6
- package/dist-cli/chunks/web-RT75LD7A.js +0 -4
- package/dist-cli/chunks/welcome-IJ55EC7U.js +0 -5
- package/dist-cli/chunks/what-happened-CEIWJIWK.js +0 -25
- package/dist-cli/chunks/ws-bridge-YK5R3HOI.js +0 -4
- package/scripts/postinstall.cjs +0 -3
- package/scripts/preuninstall.cjs +0 -118
package/dist-lib/skills.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.377 | (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;
|
|
@@ -1688,14 +1688,6 @@ var init_unsupported_packages = __esm({
|
|
|
1688
1688
|
"react-native-in-app-purchase": {
|
|
1689
1689
|
note: "store billing runs entirely in StoreKit and Play Billing, which have no browser equivalent",
|
|
1690
1690
|
recovery: "Use react-native-purchases for a full sandbox catalog, or react-native-iap if you only need the connection lifecycle."
|
|
1691
|
-
},
|
|
1692
|
-
// not a package refusal at all — a routing framework refusal. expo-router
|
|
1693
|
-
// owns the entry point, the bundler config, the navigation tree and the app
|
|
1694
|
-
// shell, so it is not something a seam can back. a Contrast app is already
|
|
1695
|
-
// routed by One, which has the same file-based semantics.
|
|
1696
|
-
"expo-router": {
|
|
1697
|
-
note: "it is a whole routing framework that owns the app entry point, the bundler config and the navigation tree, so no native seam can back it",
|
|
1698
|
-
recovery: "Contrast apps route with One, which has the same file-based routing: put screens in app/, and use Link, Stack, Tabs and useRouter from one."
|
|
1699
1691
|
}
|
|
1700
1692
|
};
|
|
1701
1693
|
UNSUPPORTABLE = new Set(Object.keys(UNSUPPORTED_NATIVE_PACKAGES));
|
|
@@ -1791,9 +1783,9 @@ var init_registry = __esm({
|
|
|
1791
1783
|
coverage: 0.9,
|
|
1792
1784
|
coverageSource: "estimated",
|
|
1793
1785
|
capabilityCoverage: CAPABILITY_INVENTORY_PACKAGE_COVERAGE["react-native-gesture-handler"],
|
|
1794
|
-
note: "tap, pan, pinch, rotation, fling, long press, race, manual, simultaneous",
|
|
1795
|
-
working: "GestureDetector, Gesture.Tap/Pan/Pinch/Rotation/Fling/LongPress/Manual/Race/Simultaneous/Exclusive/Hover, simultaneousWithExternalGesture/requireExternalGestureToFail/blocksExternalGesture, ScrollView/FlatList, Switch/RefreshControl, Pressable/Text, Touchables, BaseButton/RawButton/RectButton/BorderlessButton/PureNativeButton, Swipeable, ReanimatedSwipeable, DrawerLayout (the upstream component running on this seam: renderNavigationView, drawerPosition/drawerType/drawerWidth/edgeWidth, openDrawer/closeDrawer, edge-swipe drag, onDrawerOpen/onDrawerClose/onDrawerStateChanged), GestureHandlerRootView, createNativeWrapper, gestureHandlerRootHOC, PointerType/MouseButton/HoverEffect exports, velocity tracking, activeOffsets, multi-tap",
|
|
1796
|
-
missing: "
|
|
1786
|
+
note: "tap, pan, pinch, rotation, fling, long press, race, manual, simultaneous, force touch unavailable-hardware parity",
|
|
1787
|
+
working: "GestureDetector, Gesture.Tap/Pan/Pinch/Rotation/Fling/LongPress/ForceTouch/Manual/Race/Simultaneous/Exclusive/Hover, ForceTouchGestureHandler unavailable-hardware fallback (children render, forceTouchAvailable false, no force events), simultaneousWithExternalGesture/requireExternalGestureToFail/blocksExternalGesture, ScrollView/FlatList, Switch/RefreshControl, Pressable/Text, Touchables, BaseButton/RawButton/RectButton/BorderlessButton/PureNativeButton, Swipeable, ReanimatedSwipeable, DrawerLayout (the upstream component running on this seam: renderNavigationView, drawerPosition/drawerType/drawerWidth/edgeWidth, openDrawer/closeDrawer, edge-swipe drag, onDrawerOpen/onDrawerClose/onDrawerStateChanged), GestureHandlerRootView, createNativeWrapper, gestureHandlerRootHOC, PointerType/MouseButton/HoverEffect exports, velocity tracking, activeOffsets, multi-tap",
|
|
1788
|
+
missing: "Force Touch recognition is unavailable because browser pointer input has no pressure signal; both public APIs expose the upstream unavailable-hardware behavior instead of inventing force events"
|
|
1797
1789
|
}
|
|
1798
1790
|
]
|
|
1799
1791
|
},
|
|
@@ -2683,7 +2675,7 @@ var init_registry = __esm({
|
|
|
2683
2675
|
coverage: 0.95,
|
|
2684
2676
|
note: "suite-scoped NSUserDefaults-style string storage backed by localStorage or in-memory storage",
|
|
2685
2677
|
working: "default export, get, set, clear, getMultiple, setMultiple, clearMultiple, getAll, clearAll, setName, getName",
|
|
2686
|
-
missing: "sharing values with real native UserDefaults/app groups outside the
|
|
2678
|
+
missing: "sharing values with real native UserDefaults/app groups outside the RNX runtime"
|
|
2687
2679
|
}
|
|
2688
2680
|
]
|
|
2689
2681
|
},
|
|
@@ -14447,14 +14439,14 @@ var init_backend_origin = __esm({
|
|
|
14447
14439
|
function hasOwnKeys(value) {
|
|
14448
14440
|
return !!value && Object.keys(value).length > 0;
|
|
14449
14441
|
}
|
|
14450
|
-
function
|
|
14442
|
+
function hasRNXConfig(config) {
|
|
14451
14443
|
if (!config) return false;
|
|
14452
14444
|
return typeof config.runtimeVersion === "string" && config.runtimeVersion.length > 0 || hasOwnKeys(config.modules) || hasOwnKeys(config.turboModules) || hasOwnKeys(config.nativeModules) || hasOwnKeys(config.env) || hasOwnKeys(config.network?.remap) || hasOwnKeys(config.settings) || hasOwnKeys(config.initialState);
|
|
14453
14445
|
}
|
|
14454
|
-
function
|
|
14455
|
-
if (!
|
|
14456
|
-
if (!
|
|
14457
|
-
if (!
|
|
14446
|
+
function mergeRNXConfig(base, override) {
|
|
14447
|
+
if (!hasRNXConfig(base) && !hasRNXConfig(override)) return void 0;
|
|
14448
|
+
if (!hasRNXConfig(base)) return override ? { ...override } : void 0;
|
|
14449
|
+
if (!hasRNXConfig(override)) return base ? { ...base } : void 0;
|
|
14458
14450
|
return {
|
|
14459
14451
|
runtimeVersion: override.runtimeVersion ?? base.runtimeVersion,
|
|
14460
14452
|
modules: { ...base.modules || {}, ...override.modules || {} },
|
|
@@ -14474,20 +14466,20 @@ function mergeSootSimConfig(base, override) {
|
|
|
14474
14466
|
initialState: { ...base.initialState || {}, ...override.initialState || {} }
|
|
14475
14467
|
};
|
|
14476
14468
|
}
|
|
14477
|
-
function
|
|
14469
|
+
function applyRNXConfigToUrl(url, config) {
|
|
14478
14470
|
const parsed = new URL(url);
|
|
14479
|
-
if (
|
|
14480
|
-
parsed.searchParams.set(
|
|
14471
|
+
if (hasRNXConfig(config)) {
|
|
14472
|
+
parsed.searchParams.set(RNX_CONFIG_QUERY_PARAM, JSON.stringify(config));
|
|
14481
14473
|
} else {
|
|
14482
|
-
parsed.searchParams.delete(
|
|
14474
|
+
parsed.searchParams.delete(RNX_CONFIG_QUERY_PARAM);
|
|
14483
14475
|
}
|
|
14484
14476
|
return parsed.toString();
|
|
14485
14477
|
}
|
|
14486
|
-
var
|
|
14478
|
+
var RNX_CONFIG_QUERY_PARAM;
|
|
14487
14479
|
var init_config = __esm({
|
|
14488
14480
|
"src/config.ts"() {
|
|
14489
14481
|
"use strict";
|
|
14490
|
-
|
|
14482
|
+
RNX_CONFIG_QUERY_PARAM = "rnxConfig";
|
|
14491
14483
|
}
|
|
14492
14484
|
});
|
|
14493
14485
|
|
|
@@ -15211,10 +15203,23 @@ function makeResult(hostname, port, framework, owner) {
|
|
|
15211
15203
|
};
|
|
15212
15204
|
}
|
|
15213
15205
|
function withRuntimeConfig(port, bundleUrl, projectCwd) {
|
|
15214
|
-
|
|
15215
|
-
|
|
15216
|
-
|
|
15217
|
-
|
|
15206
|
+
let physicalProjectCwd;
|
|
15207
|
+
if (projectCwd) {
|
|
15208
|
+
try {
|
|
15209
|
+
physicalProjectCwd = (0, import_node_fs2.realpathSync)((0, import_node_path3.resolve)(projectCwd));
|
|
15210
|
+
} catch {
|
|
15211
|
+
}
|
|
15212
|
+
}
|
|
15213
|
+
const knownApps = physicalProjectCwd ? optionalDemoAppsSync().filter((app) => {
|
|
15214
|
+
try {
|
|
15215
|
+
return (0, import_node_fs2.realpathSync)((0, import_node_path3.resolve)(app.dir)) === physicalProjectCwd;
|
|
15216
|
+
} catch {
|
|
15217
|
+
return false;
|
|
15218
|
+
}
|
|
15219
|
+
}) : [];
|
|
15220
|
+
const exactKnownApps = knownApps.filter((app) => app.preferredPort === port);
|
|
15221
|
+
const knownApp = exactKnownApps.length === 1 ? exactKnownApps[0] : exactKnownApps.length === 0 && knownApps.length === 1 ? knownApps[0] : void 0;
|
|
15222
|
+
const configured = knownApp?.runtimeConfig ? applyRNXConfigToUrl(bundleUrl, knownApp.runtimeConfig) : bundleUrl;
|
|
15218
15223
|
return normalizeNativeDevBundleUrl(configured);
|
|
15219
15224
|
}
|
|
15220
15225
|
function isDirectOneBundleUrl(bundleUrl) {
|
|
@@ -15533,7 +15538,7 @@ async function scanDevServers(opts = {}) {
|
|
|
15533
15538
|
}
|
|
15534
15539
|
return results.filter((r) => !isSootSimSelfServer(r));
|
|
15535
15540
|
}
|
|
15536
|
-
var import_child_process, import_promises2, import_http, import_net, import_node_path3, EXEC_EXIT_GRACE_MS, TIMEOUT_MS, MANIFEST_TIMEOUT_MS, TCP_GATE_MS, BODY_TIMEOUT_MS, FALLBACK_PORTS, SELF_PORT_RANGE_START, SELF_PORT_RANGE_END, DevServerScanUnavailableError, LISTING_TIMEOUT_MS, cwdByPid, ENRICH_TIMEOUT_MS, enrichmentCache, enrichmentInFlight, knownNonPatched, knownNonExpo, knownOne, portCache, NEGATIVE_CACHE_TTL_MS, WEAK_RESULT_CACHE_TTL_MS;
|
|
15541
|
+
var import_child_process, import_promises2, import_http, import_net, import_node_fs2, import_node_path3, EXEC_EXIT_GRACE_MS, TIMEOUT_MS, MANIFEST_TIMEOUT_MS, TCP_GATE_MS, BODY_TIMEOUT_MS, FALLBACK_PORTS, SELF_PORT_RANGE_START, SELF_PORT_RANGE_END, DevServerScanUnavailableError, LISTING_TIMEOUT_MS, cwdByPid, ENRICH_TIMEOUT_MS, enrichmentCache, enrichmentInFlight, knownNonPatched, knownNonExpo, knownOne, portCache, NEGATIVE_CACHE_TTL_MS, WEAK_RESULT_CACHE_TTL_MS;
|
|
15537
15542
|
var init_dev_server_scanner = __esm({
|
|
15538
15543
|
"scripts/dev-server-scanner.ts"() {
|
|
15539
15544
|
"use strict";
|
|
@@ -15541,6 +15546,7 @@ var init_dev_server_scanner = __esm({
|
|
|
15541
15546
|
import_promises2 = require("fs/promises");
|
|
15542
15547
|
import_http = __toESM(require("http"), 1);
|
|
15543
15548
|
import_net = __toESM(require("net"), 1);
|
|
15549
|
+
import_node_fs2 = require("node:fs");
|
|
15544
15550
|
import_node_path3 = require("node:path");
|
|
15545
15551
|
init_backend_origin();
|
|
15546
15552
|
init_config();
|
|
@@ -15604,13 +15610,17 @@ var init_public_brand = __esm({
|
|
|
15604
15610
|
// src/cli-version.ts
|
|
15605
15611
|
function getCliVersion() {
|
|
15606
15612
|
if (cached2 != null) return cached2;
|
|
15613
|
+
if (typeof __RNX_CLI_VERSION__ !== "undefined" && typeof __RNX_CLI_VERSION__ === "string" && __RNX_CLI_VERSION__) {
|
|
15614
|
+
cached2 = __RNX_CLI_VERSION__;
|
|
15615
|
+
return cached2;
|
|
15616
|
+
}
|
|
15607
15617
|
const candidates = [
|
|
15608
15618
|
() => (0, import_node_url2.fileURLToPath)(import_meta.resolve(`${rnxPublicBrand.packageName}/package.json`)),
|
|
15609
15619
|
() => (0, import_node_url2.fileURLToPath)(new URL("../package.json", __sootsim_import_meta_url))
|
|
15610
15620
|
];
|
|
15611
15621
|
for (const resolve7 of candidates) {
|
|
15612
15622
|
try {
|
|
15613
|
-
const version = JSON.parse((0,
|
|
15623
|
+
const version = JSON.parse((0, import_node_fs3.readFileSync)(resolve7(), "utf8")).version;
|
|
15614
15624
|
if (typeof version === "string" && version) {
|
|
15615
15625
|
cached2 = version;
|
|
15616
15626
|
return cached2;
|
|
@@ -15621,11 +15631,11 @@ function getCliVersion() {
|
|
|
15621
15631
|
cached2 = "0.0.0";
|
|
15622
15632
|
return cached2;
|
|
15623
15633
|
}
|
|
15624
|
-
var
|
|
15634
|
+
var import_node_fs3, import_node_url2, import_meta, cached2;
|
|
15625
15635
|
var init_cli_version = __esm({
|
|
15626
15636
|
"src/cli-version.ts"() {
|
|
15627
15637
|
"use strict";
|
|
15628
|
-
|
|
15638
|
+
import_node_fs3 = require("node:fs");
|
|
15629
15639
|
import_node_url2 = require("node:url");
|
|
15630
15640
|
init_public_brand();
|
|
15631
15641
|
import_meta = {};
|
|
@@ -15641,7 +15651,7 @@ __export(home_paths_exports, {
|
|
|
15641
15651
|
DAEMON_HEARTBEAT_STALE_MS: () => DAEMON_HEARTBEAT_STALE_MS,
|
|
15642
15652
|
DAEMON_LOCKFILE: () => DAEMON_LOCKFILE,
|
|
15643
15653
|
DEV_BRIDGES_DIR: () => DEV_BRIDGES_DIR,
|
|
15644
|
-
|
|
15654
|
+
RNX_HOME_ENV: () => RNX_HOME_ENV,
|
|
15645
15655
|
activeRuntimeDir: () => activeRuntimeDir,
|
|
15646
15656
|
activeRuntimeFile: () => activeRuntimeFile,
|
|
15647
15657
|
cacheDir: () => cacheDir,
|
|
@@ -15658,7 +15668,7 @@ __export(home_paths_exports, {
|
|
|
15658
15668
|
electronDir: () => electronDir,
|
|
15659
15669
|
electronUserDataDir: () => electronUserDataDir,
|
|
15660
15670
|
electronVersionDir: () => electronVersionDir,
|
|
15661
|
-
|
|
15671
|
+
ensureRnxHome: () => ensureRnxHome,
|
|
15662
15672
|
isDaemonLockfileFresh: () => isDaemonLockfileFresh,
|
|
15663
15673
|
isDevBridgeLockfileFresh: () => isDevBridgeLockfileFresh,
|
|
15664
15674
|
isDevWorkstation: () => isDevWorkstation,
|
|
@@ -15675,11 +15685,11 @@ __export(home_paths_exports, {
|
|
|
15675
15685
|
readSimulatorDriverPreference: () => readSimulatorDriverPreference,
|
|
15676
15686
|
removeDaemonLockfile: () => removeDaemonLockfile,
|
|
15677
15687
|
removeDevBridgeLockfile: () => removeDevBridgeLockfile,
|
|
15688
|
+
rnxHomeDir: () => rnxHomeDir,
|
|
15678
15689
|
runtimeDir: () => runtimeDir,
|
|
15679
15690
|
runtimeUpgradeNoticePath: () => runtimeUpgradeNoticePath,
|
|
15680
15691
|
runtimesDir: () => runtimesDir,
|
|
15681
15692
|
shouldSkipPersistentDaemon: () => shouldSkipPersistentDaemon,
|
|
15682
|
-
sootsimHomeDir: () => sootsimHomeDir,
|
|
15683
15693
|
writeActiveRuntime: () => writeActiveRuntime,
|
|
15684
15694
|
writeDaemonLockfile: () => writeDaemonLockfile,
|
|
15685
15695
|
writeDevBridgeLockfile: () => writeDevBridgeLockfile,
|
|
@@ -15688,10 +15698,10 @@ __export(home_paths_exports, {
|
|
|
15688
15698
|
writeRuntimeUpgradeNotice: () => writeRuntimeUpgradeNotice,
|
|
15689
15699
|
writeSharedConfig: () => writeSharedConfig
|
|
15690
15700
|
});
|
|
15691
|
-
function
|
|
15692
|
-
const override = process.env[
|
|
15701
|
+
function rnxHomeDir() {
|
|
15702
|
+
const override = process.env[RNX_HOME_ENV];
|
|
15693
15703
|
if (override && override.length > 0) return import_node_path4.default.resolve(override);
|
|
15694
|
-
return import_node_path4.default.join((0, import_node_os.homedir)(), ".
|
|
15704
|
+
return import_node_path4.default.join((0, import_node_os.homedir)(), ".rnx");
|
|
15695
15705
|
}
|
|
15696
15706
|
function isSootsimDevCheckout() {
|
|
15697
15707
|
if (process.env.SOOTSIM_FORCE_DAEMON_INSTALL === "1") return false;
|
|
@@ -15701,7 +15711,7 @@ function isSootsimDevCheckout() {
|
|
|
15701
15711
|
const argv1 = process.argv[1];
|
|
15702
15712
|
if (!argv1) return false;
|
|
15703
15713
|
try {
|
|
15704
|
-
const real =
|
|
15714
|
+
const real = import_node_fs4.default.realpathSync(argv1);
|
|
15705
15715
|
return real.includes(`${import_node_path4.default.sep}packages${import_node_path4.default.sep}sootsim${import_node_path4.default.sep}`);
|
|
15706
15716
|
} catch {
|
|
15707
15717
|
return false;
|
|
@@ -15715,7 +15725,7 @@ function shouldSkipPersistentDaemon() {
|
|
|
15715
15725
|
return isSootsimDevCheckout() || isDevWorkstation();
|
|
15716
15726
|
}
|
|
15717
15727
|
function runtimesDir() {
|
|
15718
|
-
return import_node_path4.default.join(
|
|
15728
|
+
return import_node_path4.default.join(rnxHomeDir(), "runtimes");
|
|
15719
15729
|
}
|
|
15720
15730
|
function runtimeDir(version) {
|
|
15721
15731
|
return import_node_path4.default.join(runtimesDir(), version);
|
|
@@ -15724,7 +15734,7 @@ function activeRuntimeFile() {
|
|
|
15724
15734
|
return import_node_path4.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
|
|
15725
15735
|
}
|
|
15726
15736
|
function electronDir() {
|
|
15727
|
-
return import_node_path4.default.join(
|
|
15737
|
+
return import_node_path4.default.join(rnxHomeDir(), "electron");
|
|
15728
15738
|
}
|
|
15729
15739
|
function electronUserDataDir() {
|
|
15730
15740
|
return import_node_path4.default.join(electronDir(), "userData");
|
|
@@ -15733,28 +15743,28 @@ function electronVersionDir(version) {
|
|
|
15733
15743
|
return import_node_path4.default.join(electronDir(), version);
|
|
15734
15744
|
}
|
|
15735
15745
|
function profilesDir() {
|
|
15736
|
-
return import_node_path4.default.join(
|
|
15746
|
+
return import_node_path4.default.join(rnxHomeDir(), "profiles");
|
|
15737
15747
|
}
|
|
15738
15748
|
function cameraFixturesDir() {
|
|
15739
|
-
return import_node_path4.default.join(
|
|
15749
|
+
return import_node_path4.default.join(rnxHomeDir(), "camera-fixtures");
|
|
15740
15750
|
}
|
|
15741
15751
|
function daemonAppDir() {
|
|
15742
|
-
return import_node_path4.default.join(
|
|
15752
|
+
return import_node_path4.default.join(rnxHomeDir(), "daemon-app");
|
|
15743
15753
|
}
|
|
15744
15754
|
function daemonAppBundlePath() {
|
|
15745
|
-
return import_node_path4.default.join(daemonAppDir(), "
|
|
15755
|
+
return import_node_path4.default.join(daemonAppDir(), "RNX Daemon.app");
|
|
15746
15756
|
}
|
|
15747
15757
|
function daemonAppLauncherPath() {
|
|
15748
|
-
return import_node_path4.default.join(daemonAppBundlePath(), "Contents", "MacOS", "
|
|
15758
|
+
return import_node_path4.default.join(daemonAppBundlePath(), "Contents", "MacOS", "rnx-daemon");
|
|
15749
15759
|
}
|
|
15750
15760
|
function cacheDir() {
|
|
15751
|
-
return import_node_path4.default.join(
|
|
15761
|
+
return import_node_path4.default.join(rnxHomeDir(), "cache");
|
|
15752
15762
|
}
|
|
15753
15763
|
function daemonLockfilePath() {
|
|
15754
|
-
return import_node_path4.default.join(
|
|
15764
|
+
return import_node_path4.default.join(rnxHomeDir(), DAEMON_LOCKFILE);
|
|
15755
15765
|
}
|
|
15756
15766
|
function devBridgesDir() {
|
|
15757
|
-
return import_node_path4.default.join(
|
|
15767
|
+
return import_node_path4.default.join(rnxHomeDir(), DEV_BRIDGES_DIR);
|
|
15758
15768
|
}
|
|
15759
15769
|
function devBridgeLockfilePath(bridgePort) {
|
|
15760
15770
|
if (!Number.isInteger(bridgePort) || bridgePort <= 0) {
|
|
@@ -15763,11 +15773,11 @@ function devBridgeLockfilePath(bridgePort) {
|
|
|
15763
15773
|
return import_node_path4.default.join(devBridgesDir(), `${bridgePort}.json`);
|
|
15764
15774
|
}
|
|
15765
15775
|
function configFilePath() {
|
|
15766
|
-
return import_node_path4.default.join(
|
|
15776
|
+
return import_node_path4.default.join(rnxHomeDir(), CONFIG_FILE);
|
|
15767
15777
|
}
|
|
15768
15778
|
function readSharedConfig() {
|
|
15769
15779
|
try {
|
|
15770
|
-
const raw =
|
|
15780
|
+
const raw = import_node_fs4.default.readFileSync(configFilePath(), "utf8");
|
|
15771
15781
|
const parsed = JSON.parse(raw);
|
|
15772
15782
|
return parsed && typeof parsed === "object" ? parsed : {};
|
|
15773
15783
|
} catch {
|
|
@@ -15775,7 +15785,7 @@ function readSharedConfig() {
|
|
|
15775
15785
|
}
|
|
15776
15786
|
}
|
|
15777
15787
|
function writeSharedConfig(patch) {
|
|
15778
|
-
|
|
15788
|
+
ensureRnxHome();
|
|
15779
15789
|
const current = readSharedConfig();
|
|
15780
15790
|
const next = { ...current, ...patch };
|
|
15781
15791
|
if (patch.settings && typeof patch.settings === "object") {
|
|
@@ -15785,9 +15795,9 @@ function writeSharedConfig(patch) {
|
|
|
15785
15795
|
};
|
|
15786
15796
|
}
|
|
15787
15797
|
const tmp = `${configFilePath()}.tmp`;
|
|
15788
|
-
|
|
15798
|
+
import_node_fs4.default.writeFileSync(tmp, `${JSON.stringify(next, null, 2)}
|
|
15789
15799
|
`, "utf8");
|
|
15790
|
-
|
|
15800
|
+
import_node_fs4.default.renameSync(tmp, configFilePath());
|
|
15791
15801
|
return next;
|
|
15792
15802
|
}
|
|
15793
15803
|
function isOnboardingComplete() {
|
|
@@ -15829,19 +15839,19 @@ function readOrCreateAnonymousId() {
|
|
|
15829
15839
|
return created;
|
|
15830
15840
|
}
|
|
15831
15841
|
function runtimeUpgradeNoticePath() {
|
|
15832
|
-
return import_node_path4.default.join(
|
|
15842
|
+
return import_node_path4.default.join(rnxHomeDir(), "runtime-upgraded.json");
|
|
15833
15843
|
}
|
|
15834
15844
|
function writeRuntimeUpgradeNotice(notice) {
|
|
15835
|
-
|
|
15845
|
+
ensureRnxHome();
|
|
15836
15846
|
const tmp = `${runtimeUpgradeNoticePath()}.tmp`;
|
|
15837
|
-
|
|
15847
|
+
import_node_fs4.default.writeFileSync(tmp, `${JSON.stringify(notice)}
|
|
15838
15848
|
`, "utf8");
|
|
15839
|
-
|
|
15849
|
+
import_node_fs4.default.renameSync(tmp, runtimeUpgradeNoticePath());
|
|
15840
15850
|
}
|
|
15841
15851
|
function consumeRuntimeUpgradeNotice() {
|
|
15842
15852
|
try {
|
|
15843
|
-
const raw =
|
|
15844
|
-
|
|
15853
|
+
const raw = import_node_fs4.default.readFileSync(runtimeUpgradeNoticePath(), "utf8");
|
|
15854
|
+
import_node_fs4.default.unlinkSync(runtimeUpgradeNoticePath());
|
|
15845
15855
|
const parsed = JSON.parse(raw);
|
|
15846
15856
|
if (typeof parsed?.to !== "string" || !parsed.to) return null;
|
|
15847
15857
|
return {
|
|
@@ -15853,24 +15863,24 @@ function consumeRuntimeUpgradeNotice() {
|
|
|
15853
15863
|
return null;
|
|
15854
15864
|
}
|
|
15855
15865
|
}
|
|
15856
|
-
function
|
|
15857
|
-
|
|
15858
|
-
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
15866
|
+
function ensureRnxHome() {
|
|
15867
|
+
import_node_fs4.default.mkdirSync(rnxHomeDir(), { recursive: true });
|
|
15868
|
+
import_node_fs4.default.mkdirSync(runtimesDir(), { recursive: true });
|
|
15869
|
+
import_node_fs4.default.mkdirSync(electronDir(), { recursive: true });
|
|
15870
|
+
import_node_fs4.default.mkdirSync(profilesDir(), { recursive: true });
|
|
15871
|
+
import_node_fs4.default.mkdirSync(cacheDir(), { recursive: true });
|
|
15862
15872
|
}
|
|
15863
15873
|
function readActiveRuntime() {
|
|
15864
15874
|
try {
|
|
15865
|
-
const value =
|
|
15875
|
+
const value = import_node_fs4.default.readFileSync(activeRuntimeFile(), "utf8").trim();
|
|
15866
15876
|
return value.length > 0 ? value : null;
|
|
15867
15877
|
} catch {
|
|
15868
15878
|
return null;
|
|
15869
15879
|
}
|
|
15870
15880
|
}
|
|
15871
15881
|
function writeActiveRuntime(version) {
|
|
15872
|
-
|
|
15873
|
-
|
|
15882
|
+
import_node_fs4.default.mkdirSync(runtimesDir(), { recursive: true });
|
|
15883
|
+
import_node_fs4.default.writeFileSync(activeRuntimeFile(), `${version}
|
|
15874
15884
|
`, "utf8");
|
|
15875
15885
|
}
|
|
15876
15886
|
function activeRuntimeDir() {
|
|
@@ -15878,17 +15888,17 @@ function activeRuntimeDir() {
|
|
|
15878
15888
|
if (!version) return null;
|
|
15879
15889
|
const dir = runtimeDir(version);
|
|
15880
15890
|
try {
|
|
15881
|
-
if (
|
|
15891
|
+
if (import_node_fs4.default.statSync(dir).isDirectory()) return dir;
|
|
15882
15892
|
} catch {
|
|
15883
15893
|
}
|
|
15884
15894
|
return null;
|
|
15885
15895
|
}
|
|
15886
15896
|
function readDaemonLockfile() {
|
|
15887
15897
|
try {
|
|
15888
|
-
const fd =
|
|
15898
|
+
const fd = import_node_fs4.default.openSync(daemonLockfilePath(), "r");
|
|
15889
15899
|
try {
|
|
15890
15900
|
const buf = Buffer.alloc(DAEMON_LOCKFILE_MAX_BYTES);
|
|
15891
|
-
const bytesRead =
|
|
15901
|
+
const bytesRead = import_node_fs4.default.readSync(fd, buf, 0, DAEMON_LOCKFILE_MAX_BYTES, 0);
|
|
15892
15902
|
const raw = buf.subarray(0, bytesRead).toString("utf8");
|
|
15893
15903
|
const parsed = JSON.parse(raw);
|
|
15894
15904
|
if (parsed && parsed.schema === 1 && typeof parsed.pid === "number" && typeof parsed.bridgePort === "number" && typeof parsed.runtimePort === "number" && typeof parsed.startedAt === "number" && typeof parsed.heartbeatAt === "number" && (parsed.servedRuntimes === void 0 || Array.isArray(parsed.servedRuntimes) && parsed.servedRuntimes.every((version) => typeof version === "string"))) {
|
|
@@ -15896,7 +15906,7 @@ function readDaemonLockfile() {
|
|
|
15896
15906
|
}
|
|
15897
15907
|
return null;
|
|
15898
15908
|
} finally {
|
|
15899
|
-
|
|
15909
|
+
import_node_fs4.default.closeSync(fd);
|
|
15900
15910
|
}
|
|
15901
15911
|
} catch {
|
|
15902
15912
|
return null;
|
|
@@ -15916,7 +15926,7 @@ function parseDevBridgeLockfile(raw) {
|
|
|
15916
15926
|
function readDevBridgeLockfiles() {
|
|
15917
15927
|
let entries;
|
|
15918
15928
|
try {
|
|
15919
|
-
entries =
|
|
15929
|
+
entries = import_node_fs4.default.readdirSync(devBridgesDir(), { withFileTypes: true });
|
|
15920
15930
|
} catch {
|
|
15921
15931
|
return [];
|
|
15922
15932
|
}
|
|
@@ -15925,10 +15935,10 @@ function readDevBridgeLockfiles() {
|
|
|
15925
15935
|
if (!entry.isFile() || !/^\d+\.json$/.test(entry.name)) continue;
|
|
15926
15936
|
try {
|
|
15927
15937
|
const filePath = import_node_path4.default.join(devBridgesDir(), entry.name);
|
|
15928
|
-
const fd =
|
|
15938
|
+
const fd = import_node_fs4.default.openSync(filePath, "r");
|
|
15929
15939
|
try {
|
|
15930
15940
|
const buf = Buffer.alloc(DAEMON_LOCKFILE_MAX_BYTES);
|
|
15931
|
-
const bytesRead =
|
|
15941
|
+
const bytesRead = import_node_fs4.default.readSync(fd, buf, 0, DAEMON_LOCKFILE_MAX_BYTES, 0);
|
|
15932
15942
|
const lockfile = parseDevBridgeLockfile(
|
|
15933
15943
|
buf.subarray(0, bytesRead).toString("utf8")
|
|
15934
15944
|
);
|
|
@@ -15936,7 +15946,7 @@ function readDevBridgeLockfiles() {
|
|
|
15936
15946
|
lockfiles.push(lockfile);
|
|
15937
15947
|
}
|
|
15938
15948
|
} finally {
|
|
15939
|
-
|
|
15949
|
+
import_node_fs4.default.closeSync(fd);
|
|
15940
15950
|
}
|
|
15941
15951
|
} catch {
|
|
15942
15952
|
}
|
|
@@ -15977,7 +15987,7 @@ function readLiveRuntimeVersions() {
|
|
|
15977
15987
|
return [...versions].sort();
|
|
15978
15988
|
}
|
|
15979
15989
|
function writeDaemonLockfile(data) {
|
|
15980
|
-
|
|
15990
|
+
ensureRnxHome();
|
|
15981
15991
|
const lockfilePath = daemonLockfilePath();
|
|
15982
15992
|
const existing = readDaemonLockfile();
|
|
15983
15993
|
if (!existing) {
|
|
@@ -15988,28 +15998,28 @@ function writeDaemonLockfile(data) {
|
|
|
15988
15998
|
throw new Error("refusing to overwrite another rnx daemon lockfile");
|
|
15989
15999
|
}
|
|
15990
16000
|
const tmp = `${lockfilePath}.${data.pid}.${(0, import_node_crypto.randomUUID)()}.tmp`;
|
|
15991
|
-
|
|
16001
|
+
import_node_fs4.default.writeFileSync(tmp, `${JSON.stringify(data, null, 2)}
|
|
15992
16002
|
`, "utf8");
|
|
15993
16003
|
try {
|
|
15994
16004
|
const current = readDaemonLockfile();
|
|
15995
16005
|
if (!current || !sameDaemonOwner(current, data)) {
|
|
15996
16006
|
throw new Error("rnx daemon lock ownership changed during heartbeat");
|
|
15997
16007
|
}
|
|
15998
|
-
|
|
16008
|
+
import_node_fs4.default.renameSync(tmp, lockfilePath);
|
|
15999
16009
|
} finally {
|
|
16000
16010
|
try {
|
|
16001
|
-
|
|
16011
|
+
import_node_fs4.default.unlinkSync(tmp);
|
|
16002
16012
|
} catch {
|
|
16003
16013
|
}
|
|
16004
16014
|
}
|
|
16005
16015
|
}
|
|
16006
16016
|
function writeDevBridgeLockfile(data) {
|
|
16007
|
-
|
|
16017
|
+
import_node_fs4.default.mkdirSync(devBridgesDir(), { recursive: true });
|
|
16008
16018
|
const lockfilePath = devBridgeLockfilePath(data.bridgePort);
|
|
16009
16019
|
const tmp = `${lockfilePath}.${data.pid}.tmp`;
|
|
16010
|
-
|
|
16020
|
+
import_node_fs4.default.writeFileSync(tmp, `${JSON.stringify(data, null, 2)}
|
|
16011
16021
|
`, "utf8");
|
|
16012
|
-
|
|
16022
|
+
import_node_fs4.default.renameSync(tmp, lockfilePath);
|
|
16013
16023
|
}
|
|
16014
16024
|
function sameDaemonOwner(left, right) {
|
|
16015
16025
|
return left.pid === right.pid && left.startedAt === right.startedAt;
|
|
@@ -16020,17 +16030,17 @@ function isAlreadyExists(error) {
|
|
|
16020
16030
|
function createDaemonLockfileExclusive(data) {
|
|
16021
16031
|
const lockfilePath = daemonLockfilePath();
|
|
16022
16032
|
const tmp = `${lockfilePath}.${data.pid}.${(0, import_node_crypto.randomUUID)()}.claim`;
|
|
16023
|
-
|
|
16033
|
+
import_node_fs4.default.writeFileSync(tmp, `${JSON.stringify(data, null, 2)}
|
|
16024
16034
|
`, "utf8");
|
|
16025
16035
|
try {
|
|
16026
|
-
|
|
16036
|
+
import_node_fs4.default.linkSync(tmp, lockfilePath);
|
|
16027
16037
|
return true;
|
|
16028
16038
|
} catch (error) {
|
|
16029
16039
|
if (isAlreadyExists(error)) return false;
|
|
16030
16040
|
throw error;
|
|
16031
16041
|
} finally {
|
|
16032
16042
|
try {
|
|
16033
|
-
|
|
16043
|
+
import_node_fs4.default.unlinkSync(tmp);
|
|
16034
16044
|
} catch {
|
|
16035
16045
|
}
|
|
16036
16046
|
}
|
|
@@ -16054,7 +16064,7 @@ function parseDaemonClaim(raw) {
|
|
|
16054
16064
|
}
|
|
16055
16065
|
function readDaemonClaim() {
|
|
16056
16066
|
try {
|
|
16057
|
-
return parseDaemonClaim(
|
|
16067
|
+
return parseDaemonClaim(import_node_fs4.default.readFileSync(daemonClaimPath(), "utf8"));
|
|
16058
16068
|
} catch {
|
|
16059
16069
|
return null;
|
|
16060
16070
|
}
|
|
@@ -16078,7 +16088,7 @@ function acquireDaemonClaim(data) {
|
|
|
16078
16088
|
`;
|
|
16079
16089
|
for (let attempt = 0; attempt < 8; attempt++) {
|
|
16080
16090
|
try {
|
|
16081
|
-
|
|
16091
|
+
import_node_fs4.default.writeFileSync(daemonClaimPath(), serialized, { encoding: "utf8", flag: "wx" });
|
|
16082
16092
|
return true;
|
|
16083
16093
|
} catch (error) {
|
|
16084
16094
|
if (!isAlreadyExists(error)) throw error;
|
|
@@ -16088,11 +16098,11 @@ function acquireDaemonClaim(data) {
|
|
|
16088
16098
|
if (existing && isDaemonClaimFresh(existing)) return false;
|
|
16089
16099
|
let before;
|
|
16090
16100
|
try {
|
|
16091
|
-
before =
|
|
16101
|
+
before = import_node_fs4.default.readFileSync(daemonClaimPath(), "utf8");
|
|
16092
16102
|
const latest = parseDaemonClaim(before);
|
|
16093
16103
|
if (latest && isDaemonClaimFresh(latest)) return false;
|
|
16094
|
-
if (
|
|
16095
|
-
|
|
16104
|
+
if (import_node_fs4.default.readFileSync(daemonClaimPath(), "utf8") !== before) continue;
|
|
16105
|
+
import_node_fs4.default.unlinkSync(daemonClaimPath());
|
|
16096
16106
|
} catch {
|
|
16097
16107
|
}
|
|
16098
16108
|
}
|
|
@@ -16102,12 +16112,12 @@ function releaseDaemonClaim(owner) {
|
|
|
16102
16112
|
try {
|
|
16103
16113
|
const claim = readDaemonClaim();
|
|
16104
16114
|
if (!claim || !sameDaemonOwner(claim, owner)) return;
|
|
16105
|
-
|
|
16115
|
+
import_node_fs4.default.unlinkSync(daemonClaimPath());
|
|
16106
16116
|
} catch {
|
|
16107
16117
|
}
|
|
16108
16118
|
}
|
|
16109
16119
|
function claimDaemonLockfile(data) {
|
|
16110
|
-
|
|
16120
|
+
ensureRnxHome();
|
|
16111
16121
|
if (!acquireDaemonClaim(data)) return false;
|
|
16112
16122
|
try {
|
|
16113
16123
|
const existing = readDaemonLockfile();
|
|
@@ -16121,7 +16131,7 @@ function claimDaemonLockfile(data) {
|
|
|
16121
16131
|
if (!latest || !sameDaemonOwner(latest, existing)) return false;
|
|
16122
16132
|
if (isDaemonLockfileFresh(latest)) return false;
|
|
16123
16133
|
try {
|
|
16124
|
-
|
|
16134
|
+
import_node_fs4.default.unlinkSync(daemonLockfilePath());
|
|
16125
16135
|
} catch {
|
|
16126
16136
|
return false;
|
|
16127
16137
|
}
|
|
@@ -16135,28 +16145,28 @@ function removeDaemonLockfile(owner) {
|
|
|
16135
16145
|
try {
|
|
16136
16146
|
const lockfile = readDaemonLockfile();
|
|
16137
16147
|
if (!lockfile || !sameDaemonOwner(lockfile, owner)) return;
|
|
16138
|
-
|
|
16148
|
+
import_node_fs4.default.unlinkSync(daemonLockfilePath());
|
|
16139
16149
|
} catch {
|
|
16140
16150
|
}
|
|
16141
16151
|
}
|
|
16142
16152
|
function removeDevBridgeLockfile(owner) {
|
|
16143
16153
|
try {
|
|
16144
16154
|
const lockfilePath = devBridgeLockfilePath(owner.bridgePort);
|
|
16145
|
-
const lockfile = parseDevBridgeLockfile(
|
|
16155
|
+
const lockfile = parseDevBridgeLockfile(import_node_fs4.default.readFileSync(lockfilePath, "utf8"));
|
|
16146
16156
|
if (lockfile?.pid !== owner.pid || lockfile.startedAt !== owner.startedAt) return;
|
|
16147
|
-
|
|
16157
|
+
import_node_fs4.default.unlinkSync(lockfilePath);
|
|
16148
16158
|
} catch {
|
|
16149
16159
|
}
|
|
16150
16160
|
}
|
|
16151
|
-
var import_node_crypto,
|
|
16161
|
+
var import_node_crypto, import_node_fs4, import_node_os, import_node_path4, RNX_HOME_ENV, ACTIVE_RUNTIME_FILE, DAEMON_LOCKFILE, DEV_BRIDGES_DIR, CONFIG_FILE, DAEMON_HEARTBEAT_STALE_MS, CURRENT_ONBOARDING_VERSION, DAEMON_LOCKFILE_MAX_BYTES, DAEMON_CLAIM_STALE_MS;
|
|
16152
16162
|
var init_home_paths = __esm({
|
|
16153
16163
|
"src/home-paths.ts"() {
|
|
16154
16164
|
"use strict";
|
|
16155
16165
|
import_node_crypto = require("node:crypto");
|
|
16156
|
-
|
|
16166
|
+
import_node_fs4 = __toESM(require("node:fs"), 1);
|
|
16157
16167
|
import_node_os = require("node:os");
|
|
16158
16168
|
import_node_path4 = __toESM(require("node:path"), 1);
|
|
16159
|
-
|
|
16169
|
+
RNX_HOME_ENV = "RNX_HOME";
|
|
16160
16170
|
ACTIVE_RUNTIME_FILE = "active";
|
|
16161
16171
|
DAEMON_LOCKFILE = "daemon.json";
|
|
16162
16172
|
DEV_BRIDGES_DIR = "dev-bridges";
|
|
@@ -16174,7 +16184,7 @@ function isValidRuntimeVersion(value) {
|
|
|
16174
16184
|
}
|
|
16175
16185
|
function listInstalledRuntimes(product) {
|
|
16176
16186
|
try {
|
|
16177
|
-
return
|
|
16187
|
+
return import_node_fs5.default.readdirSync(product.runtimesDir(), { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name).sort(compareSemver);
|
|
16178
16188
|
} catch {
|
|
16179
16189
|
return [];
|
|
16180
16190
|
}
|
|
@@ -16203,11 +16213,11 @@ function compareSemver(a, b) {
|
|
|
16203
16213
|
if (!bp) return -1;
|
|
16204
16214
|
return ap < bp ? -1 : 1;
|
|
16205
16215
|
}
|
|
16206
|
-
var
|
|
16216
|
+
var import_node_fs5, import_node_path5;
|
|
16207
16217
|
var init_product = __esm({
|
|
16208
16218
|
"../contrast-runtime-delivery/src/product.ts"() {
|
|
16209
16219
|
"use strict";
|
|
16210
|
-
|
|
16220
|
+
import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
16211
16221
|
import_node_path5 = __toESM(require("node:path"), 1);
|
|
16212
16222
|
}
|
|
16213
16223
|
});
|
|
@@ -16217,7 +16227,7 @@ function createRuntimeDelivery(product) {
|
|
|
16217
16227
|
function readConfig() {
|
|
16218
16228
|
try {
|
|
16219
16229
|
const parsed = JSON.parse(
|
|
16220
|
-
|
|
16230
|
+
import_node_fs6.default.readFileSync(product.configFile(), "utf8")
|
|
16221
16231
|
);
|
|
16222
16232
|
return parsed && typeof parsed === "object" ? parsed : {};
|
|
16223
16233
|
} catch {
|
|
@@ -16290,7 +16300,7 @@ function createRuntimeDelivery(product) {
|
|
|
16290
16300
|
const setActive = opts.setActive !== false;
|
|
16291
16301
|
const protectVersions = [version, ...opts.protectVersions ?? []];
|
|
16292
16302
|
pruneLocalRetention({ protectVersions });
|
|
16293
|
-
if (!opts.force &&
|
|
16303
|
+
if (!opts.force && import_node_fs6.default.existsSync(import_node_path6.default.join(destDir, product.installedMarker))) {
|
|
16294
16304
|
if (setActive) product.writeActiveRuntime(version);
|
|
16295
16305
|
pruneLocalRetention({ protectVersions });
|
|
16296
16306
|
return {
|
|
@@ -16304,7 +16314,7 @@ function createRuntimeDelivery(product) {
|
|
|
16304
16314
|
};
|
|
16305
16315
|
}
|
|
16306
16316
|
const tarUrl = entry.tarball || tarballUrl(version, cdnOrigin);
|
|
16307
|
-
const downloadDir =
|
|
16317
|
+
const downloadDir = import_node_fs6.default.mkdtempSync(
|
|
16308
16318
|
import_node_path6.default.join(import_node_os2.default.tmpdir(), `${product.id}-runtime-download-`)
|
|
16309
16319
|
);
|
|
16310
16320
|
const runtimeArchivePath = import_node_path6.default.join(
|
|
@@ -16315,7 +16325,7 @@ function createRuntimeDelivery(product) {
|
|
|
16315
16325
|
import_node_path6.default.dirname(destDir),
|
|
16316
16326
|
`.installing-${version}-${process.pid}`
|
|
16317
16327
|
);
|
|
16318
|
-
|
|
16328
|
+
import_node_fs6.default.rmSync(tmpDir, { recursive: true, force: true });
|
|
16319
16329
|
try {
|
|
16320
16330
|
process.stderr.write(`${product.id}: downloading runtime ${version}\u2026
|
|
16321
16331
|
`);
|
|
@@ -16328,20 +16338,20 @@ function createRuntimeDelivery(product) {
|
|
|
16328
16338
|
`sha256 mismatch for runtime ${version}: expected ${entry.sha256}, actual ${actualSha}`
|
|
16329
16339
|
);
|
|
16330
16340
|
}
|
|
16331
|
-
|
|
16341
|
+
import_node_fs6.default.mkdirSync(tmpDir, { recursive: true });
|
|
16332
16342
|
await extractTarball(runtimeArchivePath, tmpDir);
|
|
16333
|
-
if (!
|
|
16343
|
+
if (!import_node_fs6.default.existsSync(import_node_path6.default.join(tmpDir, product.installedMarker))) {
|
|
16334
16344
|
throw new Error(
|
|
16335
16345
|
`extracted tarball for runtime ${version} is missing ${product.installedMarker}`
|
|
16336
16346
|
);
|
|
16337
16347
|
}
|
|
16338
|
-
|
|
16339
|
-
|
|
16348
|
+
import_node_fs6.default.rmSync(destDir, { recursive: true, force: true });
|
|
16349
|
+
import_node_fs6.default.renameSync(tmpDir, destDir);
|
|
16340
16350
|
} catch (err) {
|
|
16341
|
-
|
|
16351
|
+
import_node_fs6.default.rmSync(tmpDir, { recursive: true, force: true });
|
|
16342
16352
|
throw err;
|
|
16343
16353
|
} finally {
|
|
16344
|
-
|
|
16354
|
+
import_node_fs6.default.rmSync(downloadDir, { recursive: true, force: true });
|
|
16345
16355
|
}
|
|
16346
16356
|
if (setActive) product.writeActiveRuntime(version);
|
|
16347
16357
|
pruneLocalRetention({ protectVersions });
|
|
@@ -16363,7 +16373,7 @@ function createRuntimeDelivery(product) {
|
|
|
16363
16373
|
const pin = resolvePin();
|
|
16364
16374
|
if (pin) {
|
|
16365
16375
|
const activeVersion2 = product.readActiveRuntime();
|
|
16366
|
-
const pinInstalled =
|
|
16376
|
+
const pinInstalled = import_node_fs6.default.existsSync(
|
|
16367
16377
|
import_node_path6.default.join(product.runtimeDir(pin), product.installedMarker)
|
|
16368
16378
|
);
|
|
16369
16379
|
if (activeVersion2 === pin && pinInstalled) {
|
|
@@ -16413,7 +16423,7 @@ function createRuntimeDelivery(product) {
|
|
|
16413
16423
|
}
|
|
16414
16424
|
const activeVersion = product.readActiveRuntime();
|
|
16415
16425
|
const activeDir = activeVersion ? product.runtimeDir(activeVersion) : null;
|
|
16416
|
-
const activeInstalled = activeDir ?
|
|
16426
|
+
const activeInstalled = activeDir ? import_node_fs6.default.existsSync(import_node_path6.default.join(activeDir, product.installedMarker)) : false;
|
|
16417
16427
|
const shouldInstall = !activeVersion || !activeInstalled || compareSemver(latestVersion, activeVersion) > 0;
|
|
16418
16428
|
if (!shouldInstall) {
|
|
16419
16429
|
return {
|
|
@@ -16488,7 +16498,7 @@ function createRuntimeDelivery(product) {
|
|
|
16488
16498
|
let removeCacheFiles = [];
|
|
16489
16499
|
if (markerOffset >= 0) {
|
|
16490
16500
|
try {
|
|
16491
|
-
removeCacheFiles =
|
|
16501
|
+
removeCacheFiles = import_node_fs6.default.readdirSync(product.cacheDir(), { withFileTypes: true }).filter((entry) => {
|
|
16492
16502
|
if (!entry.isFile()) return false;
|
|
16493
16503
|
const complete = entry.name.startsWith(cachePrefix) && entry.name.endsWith(cacheSuffix);
|
|
16494
16504
|
const partial = entry.name.startsWith(cachePrefix) && entry.name.endsWith(`${cacheSuffix}.partial`);
|
|
@@ -16508,10 +16518,10 @@ function createRuntimeDelivery(product) {
|
|
|
16508
16518
|
function pruneLocalRetention(opts = {}) {
|
|
16509
16519
|
const plan = planLocalRetention(opts);
|
|
16510
16520
|
for (const version of plan.removeVersions) {
|
|
16511
|
-
|
|
16521
|
+
import_node_fs6.default.rmSync(product.runtimeDir(version), { recursive: true, force: true });
|
|
16512
16522
|
}
|
|
16513
16523
|
for (const cacheFile of plan.removeCacheFiles) {
|
|
16514
|
-
|
|
16524
|
+
import_node_fs6.default.rmSync(cacheFile, { force: true });
|
|
16515
16525
|
}
|
|
16516
16526
|
return plan;
|
|
16517
16527
|
}
|
|
@@ -16537,17 +16547,17 @@ async function downloadToFile(url, destPath) {
|
|
|
16537
16547
|
if (!res.ok || !res.body) {
|
|
16538
16548
|
throw new Error(`download failed: ${res.status} ${res.statusText} (${url})`);
|
|
16539
16549
|
}
|
|
16540
|
-
|
|
16550
|
+
import_node_fs6.default.mkdirSync(import_node_path6.default.dirname(destPath), { recursive: true });
|
|
16541
16551
|
const tmp = `${destPath}.partial`;
|
|
16542
16552
|
try {
|
|
16543
16553
|
await (0, import_promises3.pipeline)(
|
|
16544
16554
|
import_node_stream.Readable.fromWeb(res.body),
|
|
16545
|
-
|
|
16555
|
+
import_node_fs6.default.createWriteStream(tmp)
|
|
16546
16556
|
);
|
|
16547
|
-
|
|
16557
|
+
import_node_fs6.default.renameSync(tmp, destPath);
|
|
16548
16558
|
} catch (err) {
|
|
16549
16559
|
try {
|
|
16550
|
-
|
|
16560
|
+
import_node_fs6.default.unlinkSync(tmp);
|
|
16551
16561
|
} catch {
|
|
16552
16562
|
}
|
|
16553
16563
|
throw err;
|
|
@@ -16556,7 +16566,7 @@ async function downloadToFile(url, destPath) {
|
|
|
16556
16566
|
function sha256File(filePath) {
|
|
16557
16567
|
return new Promise((resolve7, reject) => {
|
|
16558
16568
|
const hash = import_node_crypto2.default.createHash("sha256");
|
|
16559
|
-
const stream =
|
|
16569
|
+
const stream = import_node_fs6.default.createReadStream(filePath);
|
|
16560
16570
|
stream.on("data", (chunk) => hash.update(chunk));
|
|
16561
16571
|
stream.on("error", reject);
|
|
16562
16572
|
stream.on("end", () => resolve7(hash.digest("hex")));
|
|
@@ -16574,13 +16584,13 @@ function extractTarball(tarPath, destDir) {
|
|
|
16574
16584
|
});
|
|
16575
16585
|
});
|
|
16576
16586
|
}
|
|
16577
|
-
var import_node_child_process2, import_node_crypto2,
|
|
16587
|
+
var import_node_child_process2, import_node_crypto2, import_node_fs6, import_node_os2, import_node_path6, import_node_stream, import_promises3, DEFAULT_LOCAL_RUNTIME_RETENTION_COUNT;
|
|
16578
16588
|
var init_src = __esm({
|
|
16579
16589
|
"../contrast-runtime-delivery/src/index.ts"() {
|
|
16580
16590
|
"use strict";
|
|
16581
16591
|
import_node_child_process2 = require("node:child_process");
|
|
16582
16592
|
import_node_crypto2 = __toESM(require("node:crypto"), 1);
|
|
16583
|
-
|
|
16593
|
+
import_node_fs6 = __toESM(require("node:fs"), 1);
|
|
16584
16594
|
import_node_os2 = __toESM(require("node:os"), 1);
|
|
16585
16595
|
import_node_path6 = __toESM(require("node:path"), 1);
|
|
16586
16596
|
import_node_stream = require("node:stream");
|
|
@@ -16606,7 +16616,7 @@ function findMonorepoRoot() {
|
|
|
16606
16616
|
return null;
|
|
16607
16617
|
}
|
|
16608
16618
|
function resolveDevCheckoutRuntimeRoot() {
|
|
16609
|
-
if (process.env.
|
|
16619
|
+
if (process.env.RNX_HOME && readActiveRuntime()) return null;
|
|
16610
16620
|
const root = findMonorepoRoot();
|
|
16611
16621
|
if (!root) return null;
|
|
16612
16622
|
const devBuild = import_path.default.join(root, "public/sootsim");
|
|
@@ -16676,7 +16686,7 @@ var init_runtime_assets = __esm({
|
|
|
16676
16686
|
});
|
|
16677
16687
|
|
|
16678
16688
|
// src/runtime-delivery.ts
|
|
16679
|
-
var DEFAULT_RUNTIME_CDN_ORIGIN,
|
|
16689
|
+
var DEFAULT_RUNTIME_CDN_ORIGIN, RNX_CHANGELOG_URL, RNX_CHANGELOG_API_URL, RNX_RUNTIME_PRODUCT, rnxRuntime;
|
|
16680
16690
|
var init_runtime_delivery = __esm({
|
|
16681
16691
|
"src/runtime-delivery.ts"() {
|
|
16682
16692
|
"use strict";
|
|
@@ -16684,10 +16694,10 @@ var init_runtime_delivery = __esm({
|
|
|
16684
16694
|
init_home_paths();
|
|
16685
16695
|
init_public_brand();
|
|
16686
16696
|
DEFAULT_RUNTIME_CDN_ORIGIN = "https://contrast.dev";
|
|
16687
|
-
|
|
16688
|
-
|
|
16689
|
-
|
|
16690
|
-
id: "
|
|
16697
|
+
RNX_CHANGELOG_URL = `${rnxPublicBrand.origin}/changelog`;
|
|
16698
|
+
RNX_CHANGELOG_API_URL = "https://contrast.dev/api/changelog/sootsim";
|
|
16699
|
+
RNX_RUNTIME_PRODUCT = {
|
|
16700
|
+
id: "rnx",
|
|
16691
16701
|
defaultCdnOrigin: DEFAULT_RUNTIME_CDN_ORIGIN,
|
|
16692
16702
|
manifestPath: "/runtimes/manifest.json",
|
|
16693
16703
|
tarballPath: (version) => `/runtimes/sootsim-runtime-${version}.tar.gz`,
|
|
@@ -16696,10 +16706,10 @@ var init_runtime_delivery = __esm({
|
|
|
16696
16706
|
// vite/metro plugins serve, so its absence means the tarball is not one.
|
|
16697
16707
|
installedMarker: "index.html",
|
|
16698
16708
|
env: {
|
|
16699
|
-
cdnOrigin: "
|
|
16700
|
-
channel: "
|
|
16709
|
+
cdnOrigin: "RNX_CDN_ORIGIN",
|
|
16710
|
+
channel: "RNX_RUNTIME_CHANNEL"
|
|
16701
16711
|
},
|
|
16702
|
-
ensureHome:
|
|
16712
|
+
ensureHome: ensureRnxHome,
|
|
16703
16713
|
configFile: configFilePath,
|
|
16704
16714
|
runtimesDir,
|
|
16705
16715
|
runtimeDir,
|
|
@@ -16707,7 +16717,7 @@ var init_runtime_delivery = __esm({
|
|
|
16707
16717
|
readActiveRuntime,
|
|
16708
16718
|
writeActiveRuntime
|
|
16709
16719
|
};
|
|
16710
|
-
|
|
16720
|
+
rnxRuntime = createRuntimeDelivery(RNX_RUNTIME_PRODUCT);
|
|
16711
16721
|
}
|
|
16712
16722
|
});
|
|
16713
16723
|
|
|
@@ -16786,7 +16796,7 @@ function loadStore() {
|
|
|
16786
16796
|
const file = storeFile();
|
|
16787
16797
|
let raw;
|
|
16788
16798
|
try {
|
|
16789
|
-
raw =
|
|
16799
|
+
raw = import_node_fs7.default.readFileSync(file, "utf8");
|
|
16790
16800
|
} catch (err) {
|
|
16791
16801
|
if (err.code === "ENOENT") return cloneEmpty();
|
|
16792
16802
|
throw err;
|
|
@@ -16803,7 +16813,7 @@ function loadStore() {
|
|
|
16803
16813
|
} catch (err) {
|
|
16804
16814
|
const quarantine = `${file}.corrupt-${Date.now()}`;
|
|
16805
16815
|
try {
|
|
16806
|
-
|
|
16816
|
+
import_node_fs7.default.renameSync(file, quarantine);
|
|
16807
16817
|
console.warn(
|
|
16808
16818
|
`[sootsim] attached-projects.json was unparseable; quarantined to ${quarantine}. original error: ${err.message}`
|
|
16809
16819
|
);
|
|
@@ -16814,16 +16824,16 @@ function loadStore() {
|
|
|
16814
16824
|
}
|
|
16815
16825
|
function writeStore(store) {
|
|
16816
16826
|
const file = storeFile();
|
|
16817
|
-
|
|
16827
|
+
import_node_fs7.default.mkdirSync(import_node_path7.default.dirname(file), { recursive: true });
|
|
16818
16828
|
const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
|
|
16819
|
-
const fd =
|
|
16829
|
+
const fd = import_node_fs7.default.openSync(tmp, "w", 384);
|
|
16820
16830
|
try {
|
|
16821
|
-
|
|
16822
|
-
|
|
16831
|
+
import_node_fs7.default.writeFileSync(fd, JSON.stringify(store, null, 2));
|
|
16832
|
+
import_node_fs7.default.fsyncSync(fd);
|
|
16823
16833
|
} finally {
|
|
16824
|
-
|
|
16834
|
+
import_node_fs7.default.closeSync(fd);
|
|
16825
16835
|
}
|
|
16826
|
-
|
|
16836
|
+
import_node_fs7.default.renameSync(tmp, file);
|
|
16827
16837
|
}
|
|
16828
16838
|
function mutateStore(fn) {
|
|
16829
16839
|
const store = loadStore();
|
|
@@ -17009,7 +17019,7 @@ async function seedFromDemoAppRegistry() {
|
|
|
17009
17019
|
if (apps.length === 0) return;
|
|
17010
17020
|
mutateStore((store) => {
|
|
17011
17021
|
for (const app of apps) {
|
|
17012
|
-
if (!
|
|
17022
|
+
if (!import_node_fs7.default.existsSync(app.dir)) continue;
|
|
17013
17023
|
const cwd = import_node_path7.default.resolve(app.dir);
|
|
17014
17024
|
const id = projectIdForCwd(cwd);
|
|
17015
17025
|
if (store.attachedProjects.some((p) => p.id === id)) continue;
|
|
@@ -17031,12 +17041,12 @@ async function seedFromDemoAppRegistry() {
|
|
|
17031
17041
|
}
|
|
17032
17042
|
});
|
|
17033
17043
|
}
|
|
17034
|
-
var import_node_crypto3,
|
|
17044
|
+
var import_node_crypto3, import_node_fs7, import_node_path7, overrideDir, COST_HISTORY_MAX_AGE_MS;
|
|
17035
17045
|
var init_attached_projects = __esm({
|
|
17036
17046
|
"src/attached-projects.ts"() {
|
|
17037
17047
|
"use strict";
|
|
17038
17048
|
import_node_crypto3 = require("node:crypto");
|
|
17039
|
-
|
|
17049
|
+
import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
17040
17050
|
import_node_path7 = __toESM(require("node:path"), 1);
|
|
17041
17051
|
init_home_paths();
|
|
17042
17052
|
overrideDir = null;
|
|
@@ -17065,13 +17075,13 @@ function pidIsAlive(pid, sessionId) {
|
|
|
17065
17075
|
return false;
|
|
17066
17076
|
}
|
|
17067
17077
|
if (sessionId) {
|
|
17068
|
-
if (!
|
|
17078
|
+
if (!import_node_fs8.default.existsSync(sessionDir(sessionId))) return false;
|
|
17069
17079
|
}
|
|
17070
17080
|
return true;
|
|
17071
17081
|
}
|
|
17072
17082
|
function resolveSootsimInvocation() {
|
|
17073
|
-
if (process.env.
|
|
17074
|
-
return { cmd: process.env.
|
|
17083
|
+
if (process.env.RNX_BIN) {
|
|
17084
|
+
return { cmd: process.env.RNX_BIN, prefixArgs: [] };
|
|
17075
17085
|
}
|
|
17076
17086
|
if (process.versions.electron) {
|
|
17077
17087
|
const resourcesPath = process.resourcesPath;
|
|
@@ -17081,7 +17091,7 @@ function resolveSootsimInvocation() {
|
|
|
17081
17091
|
import_node_path8.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
|
|
17082
17092
|
];
|
|
17083
17093
|
for (const c of candidates) {
|
|
17084
|
-
if (
|
|
17094
|
+
if (import_node_fs8.default.existsSync(c)) return { cmd: c, prefixArgs: [] };
|
|
17085
17095
|
}
|
|
17086
17096
|
}
|
|
17087
17097
|
}
|
|
@@ -17094,7 +17104,7 @@ function resolveSootsimInvocation() {
|
|
|
17094
17104
|
}
|
|
17095
17105
|
if (!argv1 || argv1.includes("/.bin/")) {
|
|
17096
17106
|
throw new Error(
|
|
17097
|
-
"rnx CLI not found. set
|
|
17107
|
+
"rnx CLI not found. set RNX_BIN to the path of the rnx binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`."
|
|
17098
17108
|
);
|
|
17099
17109
|
}
|
|
17100
17110
|
return { cmd: argv0, prefixArgs: [] };
|
|
@@ -17103,16 +17113,16 @@ function tryWorkspaceSootsim() {
|
|
|
17103
17113
|
try {
|
|
17104
17114
|
const sootsimDir = resolveSootsimPackageDir();
|
|
17105
17115
|
if (!sootsimDir) return null;
|
|
17106
|
-
const binaryName = `
|
|
17116
|
+
const binaryName = `rnx-${process.platform === "win32" ? "windows" : process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`;
|
|
17107
17117
|
const distBinary = import_node_path8.default.join(sootsimDir, "dist-bin", binaryName);
|
|
17108
|
-
if (
|
|
17118
|
+
if (import_node_fs8.default.existsSync(distBinary)) return { cmd: distBinary, prefixArgs: [] };
|
|
17109
17119
|
const distBin = import_node_path8.default.join(sootsimDir, "dist-cli", "bin.js");
|
|
17110
|
-
if (
|
|
17120
|
+
if (import_node_fs8.default.existsSync(distBin)) {
|
|
17111
17121
|
try {
|
|
17112
17122
|
const src = import_node_path8.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
|
|
17113
|
-
if (
|
|
17114
|
-
const srcMtime =
|
|
17115
|
-
const buildMtime =
|
|
17123
|
+
if (import_node_fs8.default.existsSync(src)) {
|
|
17124
|
+
const srcMtime = import_node_fs8.default.statSync(src).mtimeMs;
|
|
17125
|
+
const buildMtime = import_node_fs8.default.statSync(distBin).mtimeMs;
|
|
17116
17126
|
if (buildMtime < srcMtime) {
|
|
17117
17127
|
console.warn(
|
|
17118
17128
|
`[rnx] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with \`bun run --cwd packages/sootsim build:cli\`.`
|
|
@@ -17140,8 +17150,8 @@ function resolveSootsimPackageDir() {
|
|
|
17140
17150
|
for (let i = 0; i < 8; i++) {
|
|
17141
17151
|
const pkg = import_node_path8.default.join(cur, "package.json");
|
|
17142
17152
|
try {
|
|
17143
|
-
if (
|
|
17144
|
-
const parsed = JSON.parse(
|
|
17153
|
+
if (import_node_fs8.default.existsSync(pkg)) {
|
|
17154
|
+
const parsed = JSON.parse(import_node_fs8.default.readFileSync(pkg, "utf8"));
|
|
17145
17155
|
if (parsed.name === rnxPublicBrand.packageName) return cur;
|
|
17146
17156
|
}
|
|
17147
17157
|
} catch {
|
|
@@ -17163,9 +17173,9 @@ function fileFromImportMeta() {
|
|
|
17163
17173
|
}
|
|
17164
17174
|
async function withStartLock(projectId, provider, fn) {
|
|
17165
17175
|
const lockDir = import_node_path8.default.join(getUserDataDir(), "locks");
|
|
17166
|
-
|
|
17176
|
+
import_node_fs8.default.mkdirSync(lockDir, { recursive: true });
|
|
17167
17177
|
try {
|
|
17168
|
-
|
|
17178
|
+
import_node_fs8.default.chmodSync(lockDir, 448);
|
|
17169
17179
|
} catch {
|
|
17170
17180
|
}
|
|
17171
17181
|
const lockPath = import_node_path8.default.join(lockDir, `start-${projectId}-${provider}.lock`);
|
|
@@ -17173,17 +17183,17 @@ async function withStartLock(projectId, provider, fn) {
|
|
|
17173
17183
|
let fd = null;
|
|
17174
17184
|
while (fd === null) {
|
|
17175
17185
|
try {
|
|
17176
|
-
fd =
|
|
17186
|
+
fd = import_node_fs8.default.openSync(
|
|
17177
17187
|
lockPath,
|
|
17178
|
-
|
|
17188
|
+
import_node_fs8.constants.O_WRONLY | import_node_fs8.constants.O_CREAT | import_node_fs8.constants.O_EXCL,
|
|
17179
17189
|
384
|
|
17180
17190
|
);
|
|
17181
17191
|
} catch (err) {
|
|
17182
17192
|
if (err.code !== "EEXIST") throw err;
|
|
17183
17193
|
try {
|
|
17184
|
-
const stale = Number(
|
|
17194
|
+
const stale = Number(import_node_fs8.default.readFileSync(lockPath, "utf8").trim());
|
|
17185
17195
|
if (stale && !isProcessAlive(stale)) {
|
|
17186
|
-
|
|
17196
|
+
import_node_fs8.default.unlinkSync(lockPath);
|
|
17187
17197
|
continue;
|
|
17188
17198
|
}
|
|
17189
17199
|
} catch {
|
|
@@ -17197,15 +17207,15 @@ async function withStartLock(projectId, provider, fn) {
|
|
|
17197
17207
|
}
|
|
17198
17208
|
}
|
|
17199
17209
|
try {
|
|
17200
|
-
|
|
17210
|
+
import_node_fs8.default.writeFileSync(fd, String(process.pid));
|
|
17201
17211
|
return await fn();
|
|
17202
17212
|
} finally {
|
|
17203
17213
|
try {
|
|
17204
|
-
|
|
17214
|
+
import_node_fs8.default.closeSync(fd);
|
|
17205
17215
|
} catch {
|
|
17206
17216
|
}
|
|
17207
17217
|
try {
|
|
17208
|
-
|
|
17218
|
+
import_node_fs8.default.unlinkSync(lockPath);
|
|
17209
17219
|
} catch {
|
|
17210
17220
|
}
|
|
17211
17221
|
}
|
|
@@ -17220,24 +17230,24 @@ function isProcessAlive(pid) {
|
|
|
17220
17230
|
}
|
|
17221
17231
|
function mkfifoSync(p) {
|
|
17222
17232
|
const parent = import_node_path8.default.dirname(p);
|
|
17223
|
-
|
|
17233
|
+
import_node_fs8.default.mkdirSync(parent, { recursive: true });
|
|
17224
17234
|
try {
|
|
17225
|
-
|
|
17235
|
+
import_node_fs8.default.chmodSync(parent, 448);
|
|
17226
17236
|
} catch {
|
|
17227
17237
|
}
|
|
17228
|
-
if (
|
|
17238
|
+
if (import_node_fs8.default.existsSync(p)) {
|
|
17229
17239
|
try {
|
|
17230
|
-
const stat2 =
|
|
17240
|
+
const stat2 = import_node_fs8.default.statSync(p);
|
|
17231
17241
|
if (stat2.isFIFO()) {
|
|
17232
17242
|
try {
|
|
17233
|
-
|
|
17243
|
+
import_node_fs8.default.chmodSync(p, 384);
|
|
17234
17244
|
} catch {
|
|
17235
17245
|
}
|
|
17236
17246
|
return;
|
|
17237
17247
|
}
|
|
17238
|
-
|
|
17248
|
+
import_node_fs8.default.unlinkSync(p);
|
|
17239
17249
|
} catch {
|
|
17240
|
-
|
|
17250
|
+
import_node_fs8.default.unlinkSync(p);
|
|
17241
17251
|
}
|
|
17242
17252
|
}
|
|
17243
17253
|
const result = (0, import_node_child_process3.spawnSync)("mkfifo", ["-m", "600", p]);
|
|
@@ -17278,9 +17288,9 @@ async function startSession(opts) {
|
|
|
17278
17288
|
mkfifoSync(promptIn);
|
|
17279
17289
|
mkfifoSync(eventsOut);
|
|
17280
17290
|
const transcriptDir = import_node_path8.default.dirname(transcript);
|
|
17281
|
-
|
|
17291
|
+
import_node_fs8.default.mkdirSync(transcriptDir, { recursive: true });
|
|
17282
17292
|
try {
|
|
17283
|
-
|
|
17293
|
+
import_node_fs8.default.chmodSync(transcriptDir, 448);
|
|
17284
17294
|
} catch {
|
|
17285
17295
|
}
|
|
17286
17296
|
const { cmd, prefixArgs } = resolveSootsimInvocation();
|
|
@@ -17331,7 +17341,7 @@ async function startSession(opts) {
|
|
|
17331
17341
|
}
|
|
17332
17342
|
}
|
|
17333
17343
|
try {
|
|
17334
|
-
|
|
17344
|
+
import_node_fs8.default.rmSync(sessionDir(session.id), { recursive: true, force: true });
|
|
17335
17345
|
} catch {
|
|
17336
17346
|
}
|
|
17337
17347
|
updateSessionStatus(session.id, { status: "ended" });
|
|
@@ -17359,18 +17369,18 @@ async function sendPrompt(sessionId, prompt) {
|
|
|
17359
17369
|
);
|
|
17360
17370
|
}
|
|
17361
17371
|
const fifo = promptFifoPath(sessionId);
|
|
17362
|
-
if (!
|
|
17372
|
+
if (!import_node_fs8.default.existsSync(fifo)) {
|
|
17363
17373
|
throw new AgentSessionError("NO_FIFO", `prompt FIFO missing: ${fifo}`);
|
|
17364
17374
|
}
|
|
17365
|
-
const fd =
|
|
17375
|
+
const fd = import_node_fs8.default.openSync(fifo, import_node_fs8.constants.O_WRONLY);
|
|
17366
17376
|
try {
|
|
17367
17377
|
const wireText = encodeAgentPromptEnvelope(prompt);
|
|
17368
17378
|
if (!wireText) {
|
|
17369
17379
|
throw new AgentSessionError("EMPTY_PROMPT", "prompt text is empty");
|
|
17370
17380
|
}
|
|
17371
|
-
|
|
17381
|
+
import_node_fs8.default.writeSync(fd, wireText + "\n");
|
|
17372
17382
|
} finally {
|
|
17373
|
-
|
|
17383
|
+
import_node_fs8.default.closeSync(fd);
|
|
17374
17384
|
}
|
|
17375
17385
|
updateSessionStatus(sessionId, {
|
|
17376
17386
|
lastPrompt: prompt.displayText ?? prompt.text,
|
|
@@ -17392,7 +17402,7 @@ async function endSession(sessionId) {
|
|
|
17392
17402
|
const base = getUserDataDir();
|
|
17393
17403
|
if (dir.startsWith(base)) {
|
|
17394
17404
|
try {
|
|
17395
|
-
|
|
17405
|
+
import_node_fs8.default.rmSync(dir, { recursive: true, force: true });
|
|
17396
17406
|
} catch {
|
|
17397
17407
|
}
|
|
17398
17408
|
}
|
|
@@ -17400,11 +17410,11 @@ async function endSession(sessionId) {
|
|
|
17400
17410
|
}
|
|
17401
17411
|
function subscribeEvents(sessionId, onEvent) {
|
|
17402
17412
|
const fifo = eventsFifoPath(sessionId);
|
|
17403
|
-
if (!
|
|
17413
|
+
if (!import_node_fs8.default.existsSync(fifo)) {
|
|
17404
17414
|
throw new AgentSessionError("NO_FIFO", `events FIFO missing: ${fifo}`);
|
|
17405
17415
|
}
|
|
17406
|
-
const fd =
|
|
17407
|
-
const stream =
|
|
17416
|
+
const fd = import_node_fs8.default.openSync(fifo, import_node_fs8.constants.O_RDWR);
|
|
17417
|
+
const stream = import_node_fs8.default.createReadStream("", { fd, autoClose: true });
|
|
17408
17418
|
const rl = import_node_readline.default.createInterface({ input: stream, crlfDelay: Infinity });
|
|
17409
17419
|
rl.on("line", (line) => {
|
|
17410
17420
|
const event = parseAgentEventLine(line);
|
|
@@ -17415,7 +17425,7 @@ function subscribeEvents(sessionId, onEvent) {
|
|
|
17415
17425
|
if (closed) return;
|
|
17416
17426
|
closed = true;
|
|
17417
17427
|
try {
|
|
17418
|
-
|
|
17428
|
+
import_node_fs8.default.writeSync(fd, "\n");
|
|
17419
17429
|
} catch {
|
|
17420
17430
|
}
|
|
17421
17431
|
try {
|
|
@@ -17429,7 +17439,7 @@ function subscribeEvents(sessionId, onEvent) {
|
|
|
17429
17439
|
};
|
|
17430
17440
|
}
|
|
17431
17441
|
async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
17432
|
-
const fd =
|
|
17442
|
+
const fd = import_node_fs8.default.openSync(fifo, import_node_fs8.constants.O_RDWR | import_node_fs8.constants.O_NONBLOCK);
|
|
17433
17443
|
const buf = Buffer.alloc(8192);
|
|
17434
17444
|
let leftover = "";
|
|
17435
17445
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -17437,7 +17447,7 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
|
17437
17447
|
while (Date.now() < deadline) {
|
|
17438
17448
|
let n = 0;
|
|
17439
17449
|
try {
|
|
17440
|
-
n =
|
|
17450
|
+
n = import_node_fs8.default.readSync(fd, buf, 0, buf.length, null);
|
|
17441
17451
|
} catch (err) {
|
|
17442
17452
|
if (err.code !== "EAGAIN") throw err;
|
|
17443
17453
|
n = 0;
|
|
@@ -17457,16 +17467,16 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
|
|
|
17457
17467
|
}
|
|
17458
17468
|
return null;
|
|
17459
17469
|
} finally {
|
|
17460
|
-
|
|
17470
|
+
import_node_fs8.default.closeSync(fd);
|
|
17461
17471
|
}
|
|
17462
17472
|
}
|
|
17463
|
-
var import_node_child_process3, import_node_crypto4,
|
|
17473
|
+
var import_node_child_process3, import_node_crypto4, import_node_fs8, import_node_path8, import_node_readline, AgentSessionError;
|
|
17464
17474
|
var init_agent_sessions = __esm({
|
|
17465
17475
|
"src/agent-sessions.ts"() {
|
|
17466
17476
|
"use strict";
|
|
17467
17477
|
import_node_child_process3 = require("node:child_process");
|
|
17468
17478
|
import_node_crypto4 = require("node:crypto");
|
|
17469
|
-
|
|
17479
|
+
import_node_fs8 = __toESM(require("node:fs"), 1);
|
|
17470
17480
|
import_node_path8 = __toESM(require("node:path"), 1);
|
|
17471
17481
|
import_node_readline = __toESM(require("node:readline"), 1);
|
|
17472
17482
|
init_agent_events();
|
|
@@ -17580,11 +17590,11 @@ function mapFrameworkToProjectFramework(fw) {
|
|
|
17580
17590
|
if (fw === "one" || fw === "vxrn") return "one";
|
|
17581
17591
|
return "unknown";
|
|
17582
17592
|
}
|
|
17583
|
-
var
|
|
17593
|
+
var import_node_fs9, import_node_path9, WS_OPEN, SESSION_STATUS_PERSIST_DELAY_MS, AgentHost;
|
|
17584
17594
|
var init_agent_host = __esm({
|
|
17585
17595
|
"src/host/agent-host.ts"() {
|
|
17586
17596
|
"use strict";
|
|
17587
|
-
|
|
17597
|
+
import_node_fs9 = __toESM(require("node:fs"), 1);
|
|
17588
17598
|
import_node_path9 = __toESM(require("node:path"), 1);
|
|
17589
17599
|
init_dev_server_scanner();
|
|
17590
17600
|
init_agent_sessions();
|
|
@@ -17795,10 +17805,10 @@ var init_agent_host = __esm({
|
|
|
17795
17805
|
}
|
|
17796
17806
|
getTranscript(sessionId) {
|
|
17797
17807
|
const p = transcriptPath(sessionId);
|
|
17798
|
-
if (!
|
|
17808
|
+
if (!import_node_fs9.default.existsSync(p)) {
|
|
17799
17809
|
return { error: "transcript not found", code: "NO_TRANSCRIPT" };
|
|
17800
17810
|
}
|
|
17801
|
-
return
|
|
17811
|
+
return import_node_fs9.default.readFileSync(p, "utf8");
|
|
17802
17812
|
}
|
|
17803
17813
|
getPaths() {
|
|
17804
17814
|
const dir = getUserDataDir();
|
|
@@ -18508,27 +18518,152 @@ var init_open_url = __esm({
|
|
|
18508
18518
|
}
|
|
18509
18519
|
});
|
|
18510
18520
|
|
|
18521
|
+
// ../contrast-harness/src/planeProtocol.ts
|
|
18522
|
+
function encodeBase64(bytes) {
|
|
18523
|
+
let binary = "";
|
|
18524
|
+
const CHUNK = 32768;
|
|
18525
|
+
for (let i = 0; i < bytes.length; i += CHUNK) {
|
|
18526
|
+
binary += String.fromCharCode(...bytes.subarray(i, i + CHUNK));
|
|
18527
|
+
}
|
|
18528
|
+
return btoa(binary);
|
|
18529
|
+
}
|
|
18530
|
+
function decodeBase64(value) {
|
|
18531
|
+
const binary = atob(value);
|
|
18532
|
+
const bytes = new Uint8Array(binary.length);
|
|
18533
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
18534
|
+
return bytes;
|
|
18535
|
+
}
|
|
18536
|
+
function indexVersion(index) {
|
|
18537
|
+
let a = 2166136261;
|
|
18538
|
+
let b = 16777619;
|
|
18539
|
+
for (const key of [...index.keys()].sort()) {
|
|
18540
|
+
const meta = index.get(key);
|
|
18541
|
+
if (!meta) continue;
|
|
18542
|
+
const line = `${key} ${meta.size} ${meta.readOnly ? 1 : 0}${meta.binary ? 1 : 0} ${meta.hash ?? ""}`;
|
|
18543
|
+
for (let i = 0; i < line.length; i++) {
|
|
18544
|
+
const c = line.charCodeAt(i);
|
|
18545
|
+
a = Math.imul(a ^ c, 16777619);
|
|
18546
|
+
b = Math.imul(b + c, 2246822507) ^ b >>> 13;
|
|
18547
|
+
}
|
|
18548
|
+
}
|
|
18549
|
+
return `${(a >>> 0).toString(36)}${(b >>> 0).toString(36)}-${index.size}`;
|
|
18550
|
+
}
|
|
18551
|
+
function serializeIndex(index) {
|
|
18552
|
+
const out = [];
|
|
18553
|
+
for (const [key, meta] of index) {
|
|
18554
|
+
const flags = (meta.readOnly ? PLANE_FLAG_READ_ONLY : 0) | (meta.binary ? PLANE_FLAG_BINARY : 0);
|
|
18555
|
+
out.push(meta.hash ? [key, meta.size, flags, meta.hash] : [key, meta.size, flags]);
|
|
18556
|
+
}
|
|
18557
|
+
return out;
|
|
18558
|
+
}
|
|
18559
|
+
async function dispatchPlaneCommand(plane, type, msg, mutationOptions) {
|
|
18560
|
+
switch (type) {
|
|
18561
|
+
case "plane:index":
|
|
18562
|
+
case "plane:refresh": {
|
|
18563
|
+
await plane.refresh();
|
|
18564
|
+
const version = indexVersion(plane.index());
|
|
18565
|
+
if (msg.sinceVersion && msg.sinceVersion === version) {
|
|
18566
|
+
return { result: { version, unchanged: true }, version };
|
|
18567
|
+
}
|
|
18568
|
+
return { result: { version, entries: serializeIndex(plane.index()) }, version };
|
|
18569
|
+
}
|
|
18570
|
+
case "plane:read":
|
|
18571
|
+
return { result: { content: await plane.read(String(msg.path)) } };
|
|
18572
|
+
case "plane:read-bytes":
|
|
18573
|
+
return { result: { base64: encodeBase64(await plane.readBytes(String(msg.path))) } };
|
|
18574
|
+
case "plane:write": {
|
|
18575
|
+
mutationOptions?.signal?.throwIfAborted();
|
|
18576
|
+
await plane.write(
|
|
18577
|
+
String(msg.path),
|
|
18578
|
+
decodeBase64(String(msg.base64 ?? "")),
|
|
18579
|
+
mutationOptions
|
|
18580
|
+
);
|
|
18581
|
+
const version = indexVersion(plane.index());
|
|
18582
|
+
return { result: { version }, version };
|
|
18583
|
+
}
|
|
18584
|
+
case "plane:delete": {
|
|
18585
|
+
mutationOptions?.signal?.throwIfAborted();
|
|
18586
|
+
await plane.delete(String(msg.path), mutationOptions);
|
|
18587
|
+
const version = indexVersion(plane.index());
|
|
18588
|
+
return { result: { version }, version };
|
|
18589
|
+
}
|
|
18590
|
+
default:
|
|
18591
|
+
return null;
|
|
18592
|
+
}
|
|
18593
|
+
}
|
|
18594
|
+
var PLANE_FLAG_READ_ONLY, PLANE_FLAG_BINARY;
|
|
18595
|
+
var init_planeProtocol = __esm({
|
|
18596
|
+
"../contrast-harness/src/planeProtocol.ts"() {
|
|
18597
|
+
"use strict";
|
|
18598
|
+
PLANE_FLAG_READ_ONLY = 1;
|
|
18599
|
+
PLANE_FLAG_BINARY = 2;
|
|
18600
|
+
}
|
|
18601
|
+
});
|
|
18602
|
+
|
|
18603
|
+
// ../contrast-harness/src/projectFileCache.ts
|
|
18604
|
+
var init_projectFileCache = __esm({
|
|
18605
|
+
"../contrast-harness/src/projectFileCache.ts"() {
|
|
18606
|
+
"use strict";
|
|
18607
|
+
}
|
|
18608
|
+
});
|
|
18609
|
+
|
|
18610
|
+
// ../contrast-harness/src/planeClient.ts
|
|
18611
|
+
var init_planeClient = __esm({
|
|
18612
|
+
"../contrast-harness/src/planeClient.ts"() {
|
|
18613
|
+
"use strict";
|
|
18614
|
+
init_planeProtocol();
|
|
18615
|
+
init_projectFileCache();
|
|
18616
|
+
}
|
|
18617
|
+
});
|
|
18618
|
+
|
|
18619
|
+
// ../contrast-harness/src/projectFilePlaneRpc.ts
|
|
18620
|
+
var init_projectFilePlaneRpc = __esm({
|
|
18621
|
+
"../contrast-harness/src/projectFilePlaneRpc.ts"() {
|
|
18622
|
+
"use strict";
|
|
18623
|
+
init_planeProtocol();
|
|
18624
|
+
}
|
|
18625
|
+
});
|
|
18626
|
+
|
|
18627
|
+
// ../contrast-harness/src/planeTransport.browser.ts
|
|
18628
|
+
var init_planeTransport_browser = __esm({
|
|
18629
|
+
"../contrast-harness/src/planeTransport.browser.ts"() {
|
|
18630
|
+
"use strict";
|
|
18631
|
+
}
|
|
18632
|
+
});
|
|
18633
|
+
|
|
18634
|
+
// ../contrast-harness/src/plane.ts
|
|
18635
|
+
var init_plane = __esm({
|
|
18636
|
+
"../contrast-harness/src/plane.ts"() {
|
|
18637
|
+
"use strict";
|
|
18638
|
+
init_planeProtocol();
|
|
18639
|
+
init_planeClient();
|
|
18640
|
+
init_projectFilePlaneRpc();
|
|
18641
|
+
init_planeTransport_browser();
|
|
18642
|
+
init_projectFileCache();
|
|
18643
|
+
}
|
|
18644
|
+
});
|
|
18645
|
+
|
|
18511
18646
|
// cli/commands/box/checkout-plane.ts
|
|
18512
18647
|
function looksBinary(filePath, size) {
|
|
18513
18648
|
if (size === 0) return false;
|
|
18514
18649
|
let fd;
|
|
18515
18650
|
try {
|
|
18516
|
-
fd =
|
|
18651
|
+
fd = import_node_fs10.default.openSync(filePath, "r");
|
|
18517
18652
|
const buffer = Buffer.alloc(Math.min(BINARY_SNIFF_BYTES, size));
|
|
18518
|
-
const read =
|
|
18653
|
+
const read = import_node_fs10.default.readSync(fd, buffer, 0, buffer.length, 0);
|
|
18519
18654
|
return buffer.subarray(0, read).includes(0);
|
|
18520
18655
|
} catch {
|
|
18521
18656
|
return false;
|
|
18522
18657
|
} finally {
|
|
18523
|
-
if (fd !== void 0)
|
|
18658
|
+
if (fd !== void 0) import_node_fs10.default.closeSync(fd);
|
|
18524
18659
|
}
|
|
18525
18660
|
}
|
|
18526
|
-
var import_node_child_process5,
|
|
18661
|
+
var import_node_child_process5, import_node_fs10, import_node_path10, CheckoutRequiresGitError, BINARY_SNIFF_BYTES, LIST_FILES_TIMEOUT_MS, CheckoutFilePlane;
|
|
18527
18662
|
var init_checkout_plane = __esm({
|
|
18528
18663
|
"cli/commands/box/checkout-plane.ts"() {
|
|
18529
18664
|
"use strict";
|
|
18530
18665
|
import_node_child_process5 = require("node:child_process");
|
|
18531
|
-
|
|
18666
|
+
import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
18532
18667
|
import_node_path10 = __toESM(require("node:path"), 1);
|
|
18533
18668
|
CheckoutRequiresGitError = class extends Error {
|
|
18534
18669
|
};
|
|
@@ -18581,7 +18716,7 @@ var init_checkout_plane = __esm({
|
|
|
18581
18716
|
if (!relative) continue;
|
|
18582
18717
|
let stat2;
|
|
18583
18718
|
try {
|
|
18584
|
-
stat2 =
|
|
18719
|
+
stat2 = import_node_fs10.default.statSync(import_node_path10.default.join(this.root, relative));
|
|
18585
18720
|
} catch {
|
|
18586
18721
|
continue;
|
|
18587
18722
|
}
|
|
@@ -18608,15 +18743,15 @@ var init_checkout_plane = __esm({
|
|
|
18608
18743
|
return resolved;
|
|
18609
18744
|
}
|
|
18610
18745
|
async read(planePath) {
|
|
18611
|
-
return
|
|
18746
|
+
return import_node_fs10.default.promises.readFile(this.absolute(planePath), "utf8");
|
|
18612
18747
|
}
|
|
18613
18748
|
async readBytes(planePath) {
|
|
18614
|
-
return
|
|
18749
|
+
return import_node_fs10.default.promises.readFile(this.absolute(planePath));
|
|
18615
18750
|
}
|
|
18616
18751
|
async write(planePath, content) {
|
|
18617
18752
|
const absolute = this.absolute(planePath);
|
|
18618
|
-
await
|
|
18619
|
-
await
|
|
18753
|
+
await import_node_fs10.default.promises.mkdir(import_node_path10.default.dirname(absolute), { recursive: true });
|
|
18754
|
+
await import_node_fs10.default.promises.writeFile(absolute, content);
|
|
18620
18755
|
this.entries.set(planePath, {
|
|
18621
18756
|
size: content.byteLength,
|
|
18622
18757
|
readOnly: false,
|
|
@@ -18625,7 +18760,7 @@ var init_checkout_plane = __esm({
|
|
|
18625
18760
|
});
|
|
18626
18761
|
}
|
|
18627
18762
|
async delete(planePath) {
|
|
18628
|
-
await
|
|
18763
|
+
await import_node_fs10.default.promises.rm(this.absolute(planePath), { force: true });
|
|
18629
18764
|
this.entries.delete(planePath);
|
|
18630
18765
|
}
|
|
18631
18766
|
};
|
|
@@ -18633,13 +18768,13 @@ var init_checkout_plane = __esm({
|
|
|
18633
18768
|
});
|
|
18634
18769
|
|
|
18635
18770
|
// src/host/plane-host.ts
|
|
18636
|
-
var
|
|
18771
|
+
var import_node_fs11, import_node_path11, WS_OPEN2, PlaneNotRegisteredError, PlaneHost;
|
|
18637
18772
|
var init_plane_host = __esm({
|
|
18638
18773
|
"src/host/plane-host.ts"() {
|
|
18639
18774
|
"use strict";
|
|
18640
|
-
|
|
18775
|
+
import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
18641
18776
|
import_node_path11 = __toESM(require("node:path"), 1);
|
|
18642
|
-
|
|
18777
|
+
init_plane();
|
|
18643
18778
|
init_checkout_plane();
|
|
18644
18779
|
WS_OPEN2 = 1;
|
|
18645
18780
|
PlaneNotRegisteredError = class extends Error {
|
|
@@ -18731,7 +18866,7 @@ var init_plane_host = __esm({
|
|
|
18731
18866
|
const entry = {
|
|
18732
18867
|
root,
|
|
18733
18868
|
plane,
|
|
18734
|
-
version:
|
|
18869
|
+
version: indexVersion(plane.index()),
|
|
18735
18870
|
sockets: /* @__PURE__ */ new Set([ws])
|
|
18736
18871
|
};
|
|
18737
18872
|
this.open.set(planeId, entry);
|
|
@@ -18745,7 +18880,7 @@ var init_plane_host = __esm({
|
|
|
18745
18880
|
}
|
|
18746
18881
|
default: {
|
|
18747
18882
|
const entry = this.entry(msg);
|
|
18748
|
-
const handled = await
|
|
18883
|
+
const handled = await dispatchPlaneCommand(entry.plane, type, msg);
|
|
18749
18884
|
if (!handled) throw new Error(`unknown plane command: ${type}`);
|
|
18750
18885
|
if (handled.version) entry.version = handled.version;
|
|
18751
18886
|
return handled.result;
|
|
@@ -18764,11 +18899,11 @@ var init_plane_host = __esm({
|
|
|
18764
18899
|
const resolved = import_node_path11.default.resolve(root);
|
|
18765
18900
|
let real;
|
|
18766
18901
|
try {
|
|
18767
|
-
real =
|
|
18902
|
+
real = import_node_fs11.default.realpathSync(resolved);
|
|
18768
18903
|
} catch {
|
|
18769
18904
|
throw new Error(`no such directory: ${resolved}`);
|
|
18770
18905
|
}
|
|
18771
|
-
if (!
|
|
18906
|
+
if (!import_node_fs11.default.statSync(real).isDirectory()) throw new Error(`not a directory: ${real}`);
|
|
18772
18907
|
return real;
|
|
18773
18908
|
}
|
|
18774
18909
|
respond(ws, id, result) {
|
|
@@ -19540,7 +19675,7 @@ var init_bridge_host = __esm({
|
|
|
19540
19675
|
return;
|
|
19541
19676
|
}
|
|
19542
19677
|
if (msg.type === "runtime:list") {
|
|
19543
|
-
const versions =
|
|
19678
|
+
const versions = rnxRuntime.listInstalled();
|
|
19544
19679
|
const active = this.getActiveRuntime();
|
|
19545
19680
|
const reply = {
|
|
19546
19681
|
type: "runtime:list:ok",
|
|
@@ -19557,7 +19692,7 @@ var init_bridge_host = __esm({
|
|
|
19557
19692
|
}
|
|
19558
19693
|
if (msg.type === "runtime:use") {
|
|
19559
19694
|
const version = typeof msg.version === "string" ? msg.version : "";
|
|
19560
|
-
const installed2 =
|
|
19695
|
+
const installed2 = rnxRuntime.listInstalled();
|
|
19561
19696
|
if (!installed2.includes(version)) {
|
|
19562
19697
|
try {
|
|
19563
19698
|
ws.send(
|
|
@@ -19920,7 +20055,7 @@ var init_bridge_host = __esm({
|
|
|
19920
20055
|
this.wsHeartbeatTimer.unref();
|
|
19921
20056
|
if (this.shouldWriteLockfile) {
|
|
19922
20057
|
try {
|
|
19923
|
-
|
|
20058
|
+
ensureRnxHome();
|
|
19924
20059
|
const claimed = claimDaemonLockfile(this.buildLockfileSnapshot());
|
|
19925
20060
|
if (!claimed) {
|
|
19926
20061
|
throw new Error(
|
|
@@ -20050,7 +20185,7 @@ var init_bridge_host = __esm({
|
|
|
20050
20185
|
return this.inflightScan;
|
|
20051
20186
|
}
|
|
20052
20187
|
// serves one staged camera fixture. addressed by basename inside
|
|
20053
|
-
// ~/.
|
|
20188
|
+
// ~/.rnx/camera-fixtures, never by a caller-supplied path, so there is
|
|
20054
20189
|
// no traversal surface to defend: a name that is not a plain basename is
|
|
20055
20190
|
// rejected outright. range support is not optional here — chrome asks for
|
|
20056
20191
|
// byte ranges on media and cannot seek or loop a fixture without it.
|
|
@@ -20160,8 +20295,8 @@ var init_bridge_host = __esm({
|
|
|
20160
20295
|
}
|
|
20161
20296
|
startRuntimeUpdater() {
|
|
20162
20297
|
if (!this.shouldWriteLockfile || this.runtimeUpdateTimer) return;
|
|
20163
|
-
if (import_fs2.default.existsSync(import_path2.default.join(
|
|
20164
|
-
if (process.env.
|
|
20298
|
+
if (import_fs2.default.existsSync(import_path2.default.join(rnxHomeDir(), "runtime-update-disabled"))) return;
|
|
20299
|
+
if (process.env.RNX_HOME && isSootsimDevCheckout() && !readActiveRuntime()) {
|
|
20165
20300
|
return;
|
|
20166
20301
|
}
|
|
20167
20302
|
void this.runRuntimeUpdate("startup");
|
|
@@ -20178,7 +20313,7 @@ var init_bridge_host = __esm({
|
|
|
20178
20313
|
if (reason === "startup") {
|
|
20179
20314
|
process.stderr.write("rnx: checking for runtime updates\u2026\n");
|
|
20180
20315
|
}
|
|
20181
|
-
const result = await
|
|
20316
|
+
const result = await rnxRuntime.updateToLatest({
|
|
20182
20317
|
protectVersions: this.connectedRuntimeVersions()
|
|
20183
20318
|
});
|
|
20184
20319
|
if (!result.updated || !result.latestVersion) {
|
|
@@ -21442,7 +21577,7 @@ function getCurrentSimPath() {
|
|
|
21442
21577
|
return (0, import_path3.resolve)(process.env[CURRENT_SIM_PATH_ENV]);
|
|
21443
21578
|
}
|
|
21444
21579
|
const key = getCliIdentityKey();
|
|
21445
|
-
return (0, import_path3.join)((0, import_os.tmpdir)(), `
|
|
21580
|
+
return (0, import_path3.join)((0, import_os.tmpdir)(), `rnx-current-sim-${key}.json`);
|
|
21446
21581
|
}
|
|
21447
21582
|
function readCurrentSim() {
|
|
21448
21583
|
const filepath = getCurrentSimPath();
|
|
@@ -21498,7 +21633,7 @@ var init_current_sim = __esm({
|
|
|
21498
21633
|
CURRENT_SIM_VERSION = 1;
|
|
21499
21634
|
CURRENT_SIM_PATH_ENV = "SOOTSIM_CLI_CURRENT_SIM_PATH";
|
|
21500
21635
|
IDENTITY_ENV_VARS = [
|
|
21501
|
-
"
|
|
21636
|
+
"RNX_CLI_IDENTITY",
|
|
21502
21637
|
// explicit override — fastest path, skips all pid lookups
|
|
21503
21638
|
"TM_SESSION",
|
|
21504
21639
|
// Team Machine session id; routes prompt-bar followups back to this agent
|
|
@@ -21561,7 +21696,7 @@ function liveDevBridgeLockfiles() {
|
|
|
21561
21696
|
function checkoutRoot(cwd) {
|
|
21562
21697
|
let current = import_node_path13.default.resolve(cwd);
|
|
21563
21698
|
while (true) {
|
|
21564
|
-
if (
|
|
21699
|
+
if (import_node_fs12.default.existsSync(import_node_path13.default.join(current, ".git"))) return current;
|
|
21565
21700
|
const parent = import_node_path13.default.dirname(current);
|
|
21566
21701
|
if (parent === current) return null;
|
|
21567
21702
|
current = parent;
|
|
@@ -21603,7 +21738,7 @@ function resolveDefaultDevBridgeLockfile() {
|
|
|
21603
21738
|
return lockfiles.find((lockfile) => lockfile.bridgePort === DEFAULT_SOOTSIM_BRIDGE_PORT) ?? lockfiles[0];
|
|
21604
21739
|
}
|
|
21605
21740
|
function resolveBridgeWorld() {
|
|
21606
|
-
const homeDir =
|
|
21741
|
+
const homeDir = rnxHomeDir();
|
|
21607
21742
|
if (resolvedWorld?.homeDir === homeDir) return resolvedWorld.world;
|
|
21608
21743
|
const world = resolveBridgeWorldFresh();
|
|
21609
21744
|
resolvedWorld = { homeDir, world };
|
|
@@ -21998,11 +22133,11 @@ async function callInBridge(bridge, path20, ...args) {
|
|
|
21998
22133
|
async function callInBridgeWrite(bridge, path20, ...args) {
|
|
21999
22134
|
return bridge.send({ type: "call", path: path20, args, acquireLock: true });
|
|
22000
22135
|
}
|
|
22001
|
-
var
|
|
22136
|
+
var import_node_fs12, import_node_path13, import_ws3, RNX_PLACEMENT_ENV, resolvedWorld, BridgeSimLockedError;
|
|
22002
22137
|
var init_ws_bridge = __esm({
|
|
22003
22138
|
"cli/ws-bridge.ts"() {
|
|
22004
22139
|
"use strict";
|
|
22005
|
-
|
|
22140
|
+
import_node_fs12 = __toESM(require("node:fs"), 1);
|
|
22006
22141
|
import_node_path13 = __toESM(require("node:path"), 1);
|
|
22007
22142
|
import_ws3 = require("ws");
|
|
22008
22143
|
init_bridge_constants();
|
|
@@ -22318,7 +22453,7 @@ function withDefault(index) {
|
|
|
22318
22453
|
};
|
|
22319
22454
|
}
|
|
22320
22455
|
function writeIndex(index) {
|
|
22321
|
-
|
|
22456
|
+
ensureRnxHome();
|
|
22322
22457
|
const next = withDefault(index);
|
|
22323
22458
|
const tmp = `${profileIndexPath()}.tmp`;
|
|
22324
22459
|
import_fs5.default.writeFileSync(tmp, `${JSON.stringify(next, null, 2)}
|
|
@@ -22368,7 +22503,7 @@ function firstNamedFile(dir, names) {
|
|
|
22368
22503
|
for (const name2 of names) {
|
|
22369
22504
|
const candidate = import_node_path14.default.join(dir, name2);
|
|
22370
22505
|
try {
|
|
22371
|
-
if (
|
|
22506
|
+
if (import_node_fs13.default.statSync(candidate).isFile()) return candidate;
|
|
22372
22507
|
} catch {
|
|
22373
22508
|
}
|
|
22374
22509
|
}
|
|
@@ -22377,27 +22512,27 @@ function firstNamedFile(dir, names) {
|
|
|
22377
22512
|
function findExpoAppConfig(dir) {
|
|
22378
22513
|
return firstNamedFile(dir, EXPO_APP_CONFIG_NAMES);
|
|
22379
22514
|
}
|
|
22380
|
-
function
|
|
22381
|
-
return firstNamedFile(dir,
|
|
22515
|
+
function findRNXAppConfig(dir) {
|
|
22516
|
+
return firstNamedFile(dir, RNX_APP_CONFIG_NAMES);
|
|
22382
22517
|
}
|
|
22383
22518
|
function resolveAppProject(projectRoot) {
|
|
22384
22519
|
const appDir = import_node_path14.default.resolve(projectRoot);
|
|
22385
22520
|
try {
|
|
22386
|
-
if (!
|
|
22521
|
+
if (!import_node_fs13.default.statSync(appDir).isDirectory()) return null;
|
|
22387
22522
|
} catch {
|
|
22388
22523
|
return null;
|
|
22389
22524
|
}
|
|
22390
|
-
const configPath =
|
|
22391
|
-
if (!configPath && !findExpoAppConfig(appDir) && !
|
|
22525
|
+
const configPath = findRNXAppConfig(appDir);
|
|
22526
|
+
if (!configPath && !findExpoAppConfig(appDir) && !import_node_fs13.default.existsSync(import_node_path14.default.join(appDir, "package.json"))) {
|
|
22392
22527
|
return null;
|
|
22393
22528
|
}
|
|
22394
22529
|
return { appDir, configPath };
|
|
22395
22530
|
}
|
|
22396
|
-
var
|
|
22531
|
+
var import_node_fs13, import_node_path14, EXPO_APP_CONFIG_NAMES, RNX_APP_CONFIG_NAMES;
|
|
22397
22532
|
var init_app_project = __esm({
|
|
22398
22533
|
"cli/app-project.ts"() {
|
|
22399
22534
|
"use strict";
|
|
22400
|
-
|
|
22535
|
+
import_node_fs13 = __toESM(require("node:fs"), 1);
|
|
22401
22536
|
import_node_path14 = __toESM(require("node:path"), 1);
|
|
22402
22537
|
EXPO_APP_CONFIG_NAMES = [
|
|
22403
22538
|
"app.config.js",
|
|
@@ -22406,11 +22541,11 @@ var init_app_project = __esm({
|
|
|
22406
22541
|
"app.config.mjs",
|
|
22407
22542
|
"app.json"
|
|
22408
22543
|
];
|
|
22409
|
-
|
|
22410
|
-
"
|
|
22411
|
-
"
|
|
22412
|
-
"
|
|
22413
|
-
"
|
|
22544
|
+
RNX_APP_CONFIG_NAMES = [
|
|
22545
|
+
"rnx.config.ts",
|
|
22546
|
+
"rnx.config.js",
|
|
22547
|
+
"rnx.config.mjs",
|
|
22548
|
+
"rnx.config.cjs"
|
|
22414
22549
|
];
|
|
22415
22550
|
}
|
|
22416
22551
|
});
|
|
@@ -22419,7 +22554,7 @@ var init_app_project = __esm({
|
|
|
22419
22554
|
function isOptionalRecord(value) {
|
|
22420
22555
|
return value === void 0 || value !== null && typeof value === "object" && !Array.isArray(value);
|
|
22421
22556
|
}
|
|
22422
|
-
function
|
|
22557
|
+
function isRNXConfig(value) {
|
|
22423
22558
|
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
22424
22559
|
const runtimeVersion = Reflect.get(value, "runtimeVersion");
|
|
22425
22560
|
const network = Reflect.get(value, "network");
|
|
@@ -22438,7 +22573,7 @@ function resolveConfigReplacementFiles(config, configPath) {
|
|
|
22438
22573
|
)
|
|
22439
22574
|
};
|
|
22440
22575
|
}
|
|
22441
|
-
async function
|
|
22576
|
+
async function loadRNXAppConfig(project) {
|
|
22442
22577
|
if (!project?.configPath) return void 0;
|
|
22443
22578
|
try {
|
|
22444
22579
|
const jiti = (0, import_jiti.createJiti)(__sootsim_import_meta_url, {
|
|
@@ -22450,7 +22585,7 @@ async function loadSootSimAppConfig(project) {
|
|
|
22450
22585
|
}
|
|
22451
22586
|
});
|
|
22452
22587
|
const loaded = await jiti.import(project.configPath, { default: true });
|
|
22453
|
-
if (!
|
|
22588
|
+
if (!isRNXConfig(loaded)) {
|
|
22454
22589
|
throw new Error("the default export must be an rnx config object");
|
|
22455
22590
|
}
|
|
22456
22591
|
return resolveConfigReplacementFiles(loaded, project.configPath);
|
|
@@ -22459,9 +22594,9 @@ async function loadSootSimAppConfig(project) {
|
|
|
22459
22594
|
throw new Error(`could not load ${project.configPath}: ${message}`);
|
|
22460
22595
|
}
|
|
22461
22596
|
}
|
|
22462
|
-
async function
|
|
22597
|
+
async function resolveRNXAppConfig(startDir = process.cwd()) {
|
|
22463
22598
|
const project = resolveAppProject(startDir);
|
|
22464
|
-
return { project, config: await
|
|
22599
|
+
return { project, config: await loadRNXAppConfig(project) };
|
|
22465
22600
|
}
|
|
22466
22601
|
var import_node_module, import_node_path15, import_jiti, require2;
|
|
22467
22602
|
var init_app_config = __esm({
|
|
@@ -22536,7 +22671,7 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
22536
22671
|
scannedFontDirectories++;
|
|
22537
22672
|
let entries;
|
|
22538
22673
|
try {
|
|
22539
|
-
entries =
|
|
22674
|
+
entries = import_node_fs14.default.readdirSync(current.dir, { withFileTypes: true });
|
|
22540
22675
|
} catch {
|
|
22541
22676
|
continue;
|
|
22542
22677
|
}
|
|
@@ -22558,7 +22693,7 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
22558
22693
|
};
|
|
22559
22694
|
try {
|
|
22560
22695
|
const packageJson = JSON.parse(
|
|
22561
|
-
|
|
22696
|
+
import_node_fs14.default.readFileSync(import_node_path16.default.join(selectedAppDir, "package.json"), "utf8")
|
|
22562
22697
|
);
|
|
22563
22698
|
const dependencyNames = /* @__PURE__ */ new Set();
|
|
22564
22699
|
for (const field of ["dependencies", "devDependencies", "optionalDependencies"]) {
|
|
@@ -22600,7 +22735,7 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
22600
22735
|
}
|
|
22601
22736
|
try {
|
|
22602
22737
|
const configPath = import_node_path16.default.join(selectedAppDir, "react-native.config.js");
|
|
22603
|
-
if (
|
|
22738
|
+
if (import_node_fs14.default.statSync(configPath).isFile()) {
|
|
22604
22739
|
const appConfigRequire = (0, import_node_module2.createRequire)(import_node_path16.default.join(selectedAppDir, "package.json"));
|
|
22605
22740
|
const rnConfig = appConfigRequire(configPath);
|
|
22606
22741
|
const assets = rnConfig && typeof rnConfig === "object" ? Reflect.get(rnConfig, "assets") : null;
|
|
@@ -22619,7 +22754,7 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
22619
22754
|
if (platform === "ios") {
|
|
22620
22755
|
const iosDir = import_node_path16.default.join(selectedAppDir, "ios");
|
|
22621
22756
|
try {
|
|
22622
|
-
const targetDirs =
|
|
22757
|
+
const targetDirs = import_node_fs14.default.readdirSync(iosDir, { withFileTypes: true }).filter(
|
|
22623
22758
|
(entry) => entry.isDirectory() && !entry.isSymbolicLink() && entry.name !== "Pods" && entry.name !== "build" && !entry.name.startsWith(".")
|
|
22624
22759
|
).slice(0, 64);
|
|
22625
22760
|
const plistPaths = [import_node_path16.default.join(iosDir, "Info.plist")];
|
|
@@ -22629,7 +22764,7 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
22629
22764
|
for (const plistPath of plistPaths) {
|
|
22630
22765
|
let parsed;
|
|
22631
22766
|
try {
|
|
22632
|
-
parsed = parsePlistSource(
|
|
22767
|
+
parsed = parsePlistSource(import_node_fs14.default.readFileSync(plistPath, "utf8"));
|
|
22633
22768
|
} catch {
|
|
22634
22769
|
continue;
|
|
22635
22770
|
}
|
|
@@ -22646,7 +22781,7 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
22646
22781
|
const relative = import_node_path16.default.relative(selectedAppDir, candidate);
|
|
22647
22782
|
if (relative.startsWith("..") || import_node_path16.default.isAbsolute(relative)) return false;
|
|
22648
22783
|
try {
|
|
22649
|
-
return
|
|
22784
|
+
return import_node_fs14.default.statSync(candidate).isFile();
|
|
22650
22785
|
} catch {
|
|
22651
22786
|
return false;
|
|
22652
22787
|
}
|
|
@@ -22692,11 +22827,11 @@ async function resolveMetroProjectRoot(bundleUrl, opts) {
|
|
|
22692
22827
|
function encodeAppFontsWire(specs) {
|
|
22693
22828
|
return specs.map((spec) => `${encodeURIComponent(spec.url)}::${encodeURIComponent(spec.family)}`).join(",");
|
|
22694
22829
|
}
|
|
22695
|
-
var
|
|
22830
|
+
var import_node_fs14, import_node_module2, import_node_path16, import_config_plugin_fonts, require3;
|
|
22696
22831
|
var init_app_fonts = __esm({
|
|
22697
22832
|
"cli/app-fonts.ts"() {
|
|
22698
22833
|
"use strict";
|
|
22699
|
-
|
|
22834
|
+
import_node_fs14 = __toESM(require("node:fs"), 1);
|
|
22700
22835
|
import_node_module2 = require("node:module");
|
|
22701
22836
|
import_node_path16 = __toESM(require("node:path"), 1);
|
|
22702
22837
|
import_config_plugin_fonts = require("sootsim-engine/engine/config-plugin-fonts");
|
|
@@ -23789,7 +23924,7 @@ function resolvePlaywright() {
|
|
|
23789
23924
|
try {
|
|
23790
23925
|
const modulePath = requireFromRoot.resolve(spec);
|
|
23791
23926
|
const packageJsonPath = requireFromRoot.resolve(`${spec}/package.json`);
|
|
23792
|
-
const parsed = JSON.parse((0,
|
|
23927
|
+
const parsed = JSON.parse((0, import_node_fs15.readFileSync)(packageJsonPath, "utf8"));
|
|
23793
23928
|
if (!isRecord3(parsed) || typeof parsed.version !== "string") continue;
|
|
23794
23929
|
const bin = parsed.bin;
|
|
23795
23930
|
let binPath = null;
|
|
@@ -23802,7 +23937,7 @@ function resolvePlaywright() {
|
|
|
23802
23937
|
}
|
|
23803
23938
|
if (!binPath) continue;
|
|
23804
23939
|
const cliPath = (0, import_node_path17.join)((0, import_node_path17.dirname)(packageJsonPath), binPath);
|
|
23805
|
-
if (!(0,
|
|
23940
|
+
if (!(0, import_node_fs15.existsSync)(cliPath)) continue;
|
|
23806
23941
|
return {
|
|
23807
23942
|
spec,
|
|
23808
23943
|
modulePath,
|
|
@@ -23841,7 +23976,7 @@ function probeBrowser(resolved, env) {
|
|
|
23841
23976
|
return {
|
|
23842
23977
|
ok: true,
|
|
23843
23978
|
executablePath: parsed.executablePath,
|
|
23844
|
-
exists: parsed.exists && (0,
|
|
23979
|
+
exists: parsed.exists && (0, import_node_fs15.existsSync)(parsed.executablePath)
|
|
23845
23980
|
};
|
|
23846
23981
|
} catch (error) {
|
|
23847
23982
|
return {
|
|
@@ -23880,12 +24015,12 @@ ${detail}` : ""}`
|
|
|
23880
24015
|
}
|
|
23881
24016
|
return { ok: true, executablePath: after.executablePath, installed: true };
|
|
23882
24017
|
}
|
|
23883
|
-
var import_node_child_process6,
|
|
24018
|
+
var import_node_child_process6, import_node_fs15, import_node_module4, import_node_path17, PLAYWRIGHT_BROWSER_PROBE;
|
|
23884
24019
|
var init_playwright_provisioning = __esm({
|
|
23885
24020
|
"cli/drivers/playwright-provisioning.ts"() {
|
|
23886
24021
|
"use strict";
|
|
23887
24022
|
import_node_child_process6 = require("node:child_process");
|
|
23888
|
-
|
|
24023
|
+
import_node_fs15 = require("node:fs");
|
|
23889
24024
|
import_node_module4 = require("node:module");
|
|
23890
24025
|
import_node_path17 = require("node:path");
|
|
23891
24026
|
PLAYWRIGHT_BROWSER_PROBE = `
|
|
@@ -23936,7 +24071,7 @@ function resolveUserDataDir(opts) {
|
|
|
23936
24071
|
return playwrightProfileUserDataDir(ensureProfile(opts.profileId).id);
|
|
23937
24072
|
}
|
|
23938
24073
|
if (opts.ephemeralProfile) {
|
|
23939
|
-
return (0, import_fs7.mkdtempSync)((0, import_path6.join)((0, import_os2.tmpdir)(), "
|
|
24074
|
+
return (0, import_fs7.mkdtempSync)((0, import_path6.join)((0, import_os2.tmpdir)(), "rnx-playwright-profile-"));
|
|
23940
24075
|
}
|
|
23941
24076
|
return "";
|
|
23942
24077
|
}
|
|
@@ -23968,7 +24103,7 @@ async function launch2(opts) {
|
|
|
23968
24103
|
}
|
|
23969
24104
|
const errLog = (0, import_path6.join)(
|
|
23970
24105
|
(0, import_os2.tmpdir)(),
|
|
23971
|
-
`
|
|
24106
|
+
`rnx-playwright-host-${Date.now().toString(36)}-${process.pid}.log`
|
|
23972
24107
|
);
|
|
23973
24108
|
const connectAckFile = `${errLog}.connected`;
|
|
23974
24109
|
const errFd = (0, import_fs7.openSync)(errLog, "a");
|
|
@@ -24060,7 +24195,7 @@ const callerUserDataDir = process.env.SOOTSIM_PW_USERDATADIR || '';
|
|
|
24060
24195
|
const ownerPid = Number(process.env.SOOTSIM_PW_OWNER_PID || 0);
|
|
24061
24196
|
const ownerPollMs = Number(process.env.SOOTSIM_PW_OWNER_POLL_MS || 5000);
|
|
24062
24197
|
// optional CDP port \u2014 exposes Chrome's remote-debugging endpoint so a
|
|
24063
|
-
// bridge-driven sim can also be cpu-profiled (
|
|
24198
|
+
// bridge-driven sim can also be cpu-profiled (rnx perf cpu --cdp-port).
|
|
24064
24199
|
// playwright keeps its own pipe connection; the port is an additional endpoint.
|
|
24065
24200
|
const cdpPort = process.env.SOOTSIM_PW_CDP_PORT || '';
|
|
24066
24201
|
// extra chromium launch args, space-separated. a linux GPU runner injects
|
|
@@ -24104,7 +24239,7 @@ const { join } = require('path');
|
|
|
24104
24239
|
//
|
|
24105
24240
|
// the prior approach was \`pgrep -f ms-playwright/[c]hromium\`. it never matched
|
|
24106
24241
|
// system Chrome, so the reaper was a no-op in the common case and every
|
|
24107
|
-
// aborted/closed \`
|
|
24242
|
+
// aborted/closed \`rnx open\` leaked a renderer + gpu helper burning 100%+
|
|
24108
24243
|
// CPU until manually killed (multiple incidents 2026-06).
|
|
24109
24244
|
//
|
|
24110
24245
|
// fix: identify our chrome tree by its UNIQUE user-data-dir. every helper a
|
|
@@ -24117,13 +24252,13 @@ const reapEnabled = process.platform !== 'win32';
|
|
|
24117
24252
|
let profileDir = callerUserDataDir;
|
|
24118
24253
|
let ephemeralProfile = false;
|
|
24119
24254
|
if (!profileDir) {
|
|
24120
|
-
profileDir = mkdtempSync(join(tmpdir(), '
|
|
24255
|
+
profileDir = mkdtempSync(join(tmpdir(), 'rnx-playwright-host-'));
|
|
24121
24256
|
ephemeralProfile = true;
|
|
24122
24257
|
}
|
|
24123
24258
|
// browser HTTP caches are acceleration data, not profile identity. give each
|
|
24124
24259
|
// host a bounded temporary cache so persistent named profiles retain cookies
|
|
24125
24260
|
// and storage without multiplying a private cache for every profile.
|
|
24126
|
-
const diskCacheDir = mkdtempSync(join(tmpdir(), '
|
|
24261
|
+
const diskCacheDir = mkdtempSync(join(tmpdir(), 'rnx-playwright-cache-'));
|
|
24127
24262
|
const chromePidsByProfile = () => {
|
|
24128
24263
|
if (!reapEnabled) return [];
|
|
24129
24264
|
try {
|
|
@@ -24294,7 +24429,7 @@ const cleanupProfile = () => {
|
|
|
24294
24429
|
// through shutdown(); the exit hook (sync sweep) still reaps the tree.
|
|
24295
24430
|
process.on('exit', () => { reapChrome(); cleanupProfile(); });
|
|
24296
24431
|
// owner-liveness watchdog \u2014 the load-bearing fix for leaked Chrome hosts.
|
|
24297
|
-
// we are spawned detached + unref'd so \`
|
|
24432
|
+
// we are spawned detached + unref'd so \`rnx open\` returns immediately,
|
|
24298
24433
|
// which means nothing in the OS process tree ties Chrome's lifetime to the
|
|
24299
24434
|
// session that asked for it. once the sim connects, the connect-timeout
|
|
24300
24435
|
// safety net is cleared, so absent an explicit \`sootsim close\` (or the
|
|
@@ -24323,7 +24458,7 @@ const cleanupProfile = () => {
|
|
|
24323
24458
|
// com.google.chrome.for.testing identity cannot intercept open/quit events for
|
|
24324
24459
|
// the user's com.google.Chrome browser. CI may use chromium_headless_shell;
|
|
24325
24460
|
// local rendering fails closed because that shell has no GPU and silently
|
|
24326
|
-
// chooses SwiftShader. NOTE: this is NOT enough to make \`
|
|
24461
|
+
// chooses SwiftShader. NOTE: this is NOT enough to make \`rnx perf cpu\`
|
|
24327
24462
|
// work \u2014 that profiles the tenant *worker*, and the JS Self-Profiler API
|
|
24328
24463
|
// cannot be constructed in a dedicated worker (see
|
|
24329
24464
|
// worker-handlers/cpu-profile.ts). cpu-profile needs a CDP-based profiler
|
|
@@ -24589,7 +24724,7 @@ var init_run_rnx = __esm({
|
|
|
24589
24724
|
|
|
24590
24725
|
// cli/commands/inspect/env.ts
|
|
24591
24726
|
function isAgentEnv() {
|
|
24592
|
-
if (process.env.
|
|
24727
|
+
if (process.env.RNX_AGENT === "0") return false;
|
|
24593
24728
|
for (const name2 of AGENT_ENV_VARS) {
|
|
24594
24729
|
const v = process.env[name2];
|
|
24595
24730
|
if (v && v.trim() && v !== "0") return true;
|
|
@@ -24601,7 +24736,7 @@ var init_env = __esm({
|
|
|
24601
24736
|
"cli/commands/inspect/env.ts"() {
|
|
24602
24737
|
"use strict";
|
|
24603
24738
|
AGENT_ENV_VARS = [
|
|
24604
|
-
"
|
|
24739
|
+
"RNX_AGENT",
|
|
24605
24740
|
"TM_SESSION",
|
|
24606
24741
|
"CLAUDECODE",
|
|
24607
24742
|
"CLAUDE_CODE_ENTRYPOINT",
|
|
@@ -24625,7 +24760,7 @@ function isChangelogEntry(value) {
|
|
|
24625
24760
|
}
|
|
24626
24761
|
async function fetchRuntimeReleaseNotes(version, fetchImpl = fetch) {
|
|
24627
24762
|
try {
|
|
24628
|
-
const url = new URL(
|
|
24763
|
+
const url = new URL(RNX_CHANGELOG_API_URL);
|
|
24629
24764
|
url.searchParams.set("version", version);
|
|
24630
24765
|
const response = await fetchImpl(url, {
|
|
24631
24766
|
headers: { accept: "application/json" },
|
|
@@ -24653,7 +24788,7 @@ function formatRuntimeReleaseNotes(version, entry) {
|
|
|
24653
24788
|
}
|
|
24654
24789
|
}
|
|
24655
24790
|
}
|
|
24656
|
-
lines.push(` full changelog: ${
|
|
24791
|
+
lines.push(` full changelog: ${RNX_CHANGELOG_URL}`);
|
|
24657
24792
|
return lines.join("\n");
|
|
24658
24793
|
}
|
|
24659
24794
|
var init_runtime_notes = __esm({
|
|
@@ -24695,7 +24830,7 @@ async function runRuntime(args, opts = {}) {
|
|
|
24695
24830
|
}
|
|
24696
24831
|
function printHelp() {
|
|
24697
24832
|
console.log(`
|
|
24698
|
-
rnx runtime \u2014 manage engine runtimes under ~/.
|
|
24833
|
+
rnx runtime \u2014 manage engine runtimes under ~/.rnx/runtimes/
|
|
24699
24834
|
|
|
24700
24835
|
usage:
|
|
24701
24836
|
rnx runtime install [version] install a version (default: channel latest)
|
|
@@ -24711,7 +24846,7 @@ flags:
|
|
|
24711
24846
|
--set-active=false do not switch active runtime after install
|
|
24712
24847
|
|
|
24713
24848
|
environment:
|
|
24714
|
-
|
|
24849
|
+
RNX_CDN_ORIGIN override the CDN base URL (default: ${DEFAULT_RUNTIME_CDN_ORIGIN})
|
|
24715
24850
|
|
|
24716
24851
|
examples:
|
|
24717
24852
|
rnx runtime install
|
|
@@ -24726,11 +24861,11 @@ async function runtimeInstall(args, opts) {
|
|
|
24726
24861
|
const channel = flags.channel ?? opts.channel ?? "stable";
|
|
24727
24862
|
const force = flags.force === true;
|
|
24728
24863
|
const setActive = flags.setActive !== false;
|
|
24729
|
-
|
|
24864
|
+
ensureRnxHome();
|
|
24730
24865
|
console.log(`rnx runtime install`);
|
|
24731
|
-
console.log(` cdn: ${
|
|
24866
|
+
console.log(` cdn: ${rnxRuntime.resolveCdnOrigin()}`);
|
|
24732
24867
|
try {
|
|
24733
|
-
const result = await
|
|
24868
|
+
const result = await rnxRuntime.install({
|
|
24734
24869
|
version: versionArg,
|
|
24735
24870
|
channel,
|
|
24736
24871
|
force,
|
|
@@ -24807,8 +24942,8 @@ async function tellDaemonRuntimeChanged(version) {
|
|
|
24807
24942
|
});
|
|
24808
24943
|
}
|
|
24809
24944
|
async function runtimeList(_args) {
|
|
24810
|
-
|
|
24811
|
-
const installed2 =
|
|
24945
|
+
ensureRnxHome();
|
|
24946
|
+
const installed2 = rnxRuntime.listInstalled();
|
|
24812
24947
|
const active = readActiveRuntime();
|
|
24813
24948
|
console.log(`installed:`);
|
|
24814
24949
|
if (installed2.length === 0) {
|
|
@@ -24820,7 +24955,7 @@ async function runtimeList(_args) {
|
|
|
24820
24955
|
}
|
|
24821
24956
|
}
|
|
24822
24957
|
try {
|
|
24823
|
-
const manifest = await
|
|
24958
|
+
const manifest = await rnxRuntime.fetchManifest();
|
|
24824
24959
|
console.log(`available (latest per channel):`);
|
|
24825
24960
|
for (const [name2, ch] of Object.entries(manifest.channels)) {
|
|
24826
24961
|
console.log(` ${name2.padEnd(8)} ${ch.latest}`);
|
|
@@ -24840,7 +24975,7 @@ async function runtimeUse(args) {
|
|
|
24840
24975
|
console.error(` usage: rnx runtime use <version>`);
|
|
24841
24976
|
rnxExit(1);
|
|
24842
24977
|
}
|
|
24843
|
-
const installed2 =
|
|
24978
|
+
const installed2 = rnxRuntime.listInstalled();
|
|
24844
24979
|
if (!installed2.includes(version)) {
|
|
24845
24980
|
console.error(` version ${version} is not installed`);
|
|
24846
24981
|
console.error(` installed: ${installed2.join(", ") || "(none)"}`);
|
|
@@ -24888,11 +25023,11 @@ async function runtimeNotes(args) {
|
|
|
24888
25023
|
console.error(` usage: rnx runtime notes`);
|
|
24889
25024
|
rnxExit(1);
|
|
24890
25025
|
}
|
|
24891
|
-
const { config } = await
|
|
25026
|
+
const { config } = await resolveRNXAppConfig();
|
|
24892
25027
|
const version = config?.runtimeVersion ?? readActiveRuntime();
|
|
24893
25028
|
if (!version) {
|
|
24894
25029
|
console.log(` no active runtime`);
|
|
24895
|
-
console.log(` release notes: ${
|
|
25030
|
+
console.log(` release notes: ${RNX_CHANGELOG_URL}`);
|
|
24896
25031
|
return;
|
|
24897
25032
|
}
|
|
24898
25033
|
console.log(formatRuntimeReleaseNotes(version, await fetchRuntimeReleaseNotes(version)));
|
|
@@ -24954,6 +25089,7 @@ __export(control_exports, {
|
|
|
24954
25089
|
planBulkCloseTargets: () => planBulkCloseTargets,
|
|
24955
25090
|
playwrightHostPidForSim: () => playwrightHostPidForSim,
|
|
24956
25091
|
printConnectedSims: () => printConnectedSims,
|
|
25092
|
+
printOpenedSim: () => printOpenedSim,
|
|
24957
25093
|
resolveBundleTarget: () => resolveBundleTarget,
|
|
24958
25094
|
resolveDefaultShellBaseUrl: () => resolveDefaultShellBaseUrl,
|
|
24959
25095
|
resolveDriverConnectWaitOptions: () => resolveDriverConnectWaitOptions,
|
|
@@ -25057,19 +25193,19 @@ function assertExplicitBridgeLock(preferredPort, explicitPort, lock) {
|
|
|
25057
25193
|
return;
|
|
25058
25194
|
}
|
|
25059
25195
|
throw new Error(
|
|
25060
|
-
`${rnxPublicBrand.commandName} open: requested bridge port ${preferredPort}, but the active daemon owns port ${lock.bridgePort}. explicit --port never selects another bridge; stop that daemon or use an isolated
|
|
25196
|
+
`${rnxPublicBrand.commandName} open: requested bridge port ${preferredPort}, but the active daemon owns port ${lock.bridgePort}. explicit --port never selects another bridge; stop that daemon or use an isolated RNX_HOME.`
|
|
25061
25197
|
);
|
|
25062
25198
|
}
|
|
25063
25199
|
async function ensureRuntimeForOpen() {
|
|
25064
25200
|
const active = readActiveRuntime();
|
|
25065
|
-
if (active &&
|
|
25201
|
+
if (active && import_node_fs16.default.existsSync(runtimeDir(active))) return;
|
|
25066
25202
|
console.error(" installing rnx engine runtime...");
|
|
25067
25203
|
const { runRuntime: runRuntime2 } = await Promise.resolve().then(() => (init_runtime(), runtime_exports));
|
|
25068
25204
|
await runRuntime2(["install"], {});
|
|
25069
25205
|
}
|
|
25070
25206
|
function spawnSootsim(args) {
|
|
25071
25207
|
const entry = process.argv[1];
|
|
25072
|
-
if (entry &&
|
|
25208
|
+
if (entry && import_node_fs16.default.existsSync(entry)) {
|
|
25073
25209
|
return (0, import_node_child_process7.spawn)(process.execPath, [entry, ...args], {
|
|
25074
25210
|
detached: true,
|
|
25075
25211
|
stdio: "ignore",
|
|
@@ -25238,7 +25374,7 @@ function parseOpenRuntimeConfig(args) {
|
|
|
25238
25374
|
}
|
|
25239
25375
|
const moduleName = raw.slice(0, eqIndex).trim();
|
|
25240
25376
|
const filePath = normalizeReplacementPath(raw.slice(eqIndex + 1).trim());
|
|
25241
|
-
if (!
|
|
25377
|
+
if (!import_node_fs16.default.existsSync(filePath)) {
|
|
25242
25378
|
console.error(` rnx open: replacement file not found: ${filePath}`);
|
|
25243
25379
|
rnxExit(1);
|
|
25244
25380
|
}
|
|
@@ -25269,9 +25405,9 @@ async function resolveOpenAppProject(resolvedBundle) {
|
|
|
25269
25405
|
return advertisedRoot ? resolveAppProject(advertisedRoot) : null;
|
|
25270
25406
|
}
|
|
25271
25407
|
async function ensureConfiguredRuntime(version) {
|
|
25272
|
-
if (
|
|
25408
|
+
if (import_node_fs16.default.existsSync(import_node_path18.default.join(runtimeDir(version), "index.html"))) return;
|
|
25273
25409
|
console.error(` installing configured engine runtime ${version}...`);
|
|
25274
|
-
const result = await
|
|
25410
|
+
const result = await rnxRuntime.install({
|
|
25275
25411
|
version,
|
|
25276
25412
|
setActive: false,
|
|
25277
25413
|
protectVersions: readLiveRuntimeVersions()
|
|
@@ -25629,7 +25765,7 @@ function playwrightHostPidForSim(sim) {
|
|
|
25629
25765
|
function signalDriverLaunchConnected(result) {
|
|
25630
25766
|
if (!result.connectAckFile) return false;
|
|
25631
25767
|
try {
|
|
25632
|
-
|
|
25768
|
+
import_node_fs16.default.writeFileSync(
|
|
25633
25769
|
result.connectAckFile,
|
|
25634
25770
|
`${JSON.stringify({ connectedAt: Date.now(), pid: result.pid ?? null })}
|
|
25635
25771
|
`,
|
|
@@ -25643,7 +25779,7 @@ function signalDriverLaunchConnected(result) {
|
|
|
25643
25779
|
function printDriverDiagnosticLogTail(result) {
|
|
25644
25780
|
if (!result.diagnosticLogPath) return;
|
|
25645
25781
|
try {
|
|
25646
|
-
const detail =
|
|
25782
|
+
const detail = import_node_fs16.default.readFileSync(result.diagnosticLogPath, "utf8").trim();
|
|
25647
25783
|
if (!detail) {
|
|
25648
25784
|
console.error(` ${import_node_path18.default.basename(result.diagnosticLogPath)} was empty`);
|
|
25649
25785
|
return;
|
|
@@ -25738,10 +25874,24 @@ function printOpenedSim(openUrl2, sim, mode, quiet = false) {
|
|
|
25738
25874
|
if (!value) return value;
|
|
25739
25875
|
try {
|
|
25740
25876
|
const parsed = new URL(value);
|
|
25741
|
-
|
|
25742
|
-
|
|
25743
|
-
|
|
25877
|
+
let changed = false;
|
|
25878
|
+
if (parsed.searchParams.has(RNX_CONFIG_QUERY_PARAM)) {
|
|
25879
|
+
parsed.searchParams.set(RNX_CONFIG_QUERY_PARAM, "[redacted]");
|
|
25880
|
+
changed = true;
|
|
25744
25881
|
}
|
|
25882
|
+
const bundle = parsed.searchParams.get("bundle");
|
|
25883
|
+
if (bundle) {
|
|
25884
|
+
try {
|
|
25885
|
+
const parsedBundle = new URL(bundle);
|
|
25886
|
+
if (parsedBundle.searchParams.has(RNX_CONFIG_QUERY_PARAM)) {
|
|
25887
|
+
parsedBundle.searchParams.set(RNX_CONFIG_QUERY_PARAM, "[redacted]");
|
|
25888
|
+
parsed.searchParams.set("bundle", parsedBundle.toString());
|
|
25889
|
+
changed = true;
|
|
25890
|
+
}
|
|
25891
|
+
} catch {
|
|
25892
|
+
}
|
|
25893
|
+
}
|
|
25894
|
+
if (changed) return parsed.toString();
|
|
25745
25895
|
} catch {
|
|
25746
25896
|
}
|
|
25747
25897
|
return value;
|
|
@@ -25950,10 +26100,10 @@ async function runOpenCommand(args, opts = {}) {
|
|
|
25950
26100
|
}
|
|
25951
26101
|
const resolvedBundle = shouldResolveBundleTargetInCli(target) ? await resolveConnectionInputForCli(target) : void 0;
|
|
25952
26102
|
const project = await resolveOpenAppProject(resolvedBundle);
|
|
25953
|
-
const appConfig = await
|
|
26103
|
+
const appConfig = await loadRNXAppConfig(project);
|
|
25954
26104
|
const configuredRuntimeVersion = appConfig?.runtimeVersion;
|
|
25955
|
-
const runtimeConfig =
|
|
25956
|
-
|
|
26105
|
+
const runtimeConfig = mergeRNXConfig(
|
|
26106
|
+
mergeRNXConfig(
|
|
25957
26107
|
appConfig ? { ...appConfig, runtimeVersion: void 0 } : void 0,
|
|
25958
26108
|
opts.runtimeConfig
|
|
25959
26109
|
),
|
|
@@ -26042,7 +26192,7 @@ async function runOpenCommand(args, opts = {}) {
|
|
|
26042
26192
|
if (!targetSim && parsed.simIdSource !== "flag") {
|
|
26043
26193
|
targetShellUrl = await buildShellUrl(
|
|
26044
26194
|
target,
|
|
26045
|
-
|
|
26195
|
+
applyRNXConfigToUrl(baseUrl, runtimeConfig),
|
|
26046
26196
|
buildShellUrlOpts
|
|
26047
26197
|
);
|
|
26048
26198
|
const normalizedTarget = new URL(targetShellUrl);
|
|
@@ -26071,7 +26221,7 @@ async function runOpenCommand(args, opts = {}) {
|
|
|
26071
26221
|
const resolvedBaseUrl = hasExplicitBaseUrl || looksLikeSootsimUrl(target) ? baseUrl : deriveCurrentSimBaseUrl(targetSim, baseUrl);
|
|
26072
26222
|
const shellUrl = targetShellUrl ?? await buildShellUrl(
|
|
26073
26223
|
target,
|
|
26074
|
-
|
|
26224
|
+
applyRNXConfigToUrl(resolvedBaseUrl, runtimeConfig),
|
|
26075
26225
|
buildShellUrlOpts
|
|
26076
26226
|
);
|
|
26077
26227
|
bridge.send({
|
|
@@ -26108,7 +26258,7 @@ async function runOpenCommand(args, opts = {}) {
|
|
|
26108
26258
|
const resolvedBaseUrl = hasExplicitBaseUrl || looksLikeSootsimUrl(target) ? baseUrl : deriveCurrentSimBaseUrl(targetSim, baseUrl);
|
|
26109
26259
|
const shellUrl = targetShellUrl ?? await buildShellUrl(
|
|
26110
26260
|
target,
|
|
26111
|
-
|
|
26261
|
+
applyRNXConfigToUrl(resolvedBaseUrl, runtimeConfig),
|
|
26112
26262
|
buildShellUrlOpts
|
|
26113
26263
|
);
|
|
26114
26264
|
printOpenedSim(shellUrl, { ...targetSim, url: shellUrl }, "current sim", quiet);
|
|
@@ -26119,7 +26269,7 @@ async function runOpenCommand(args, opts = {}) {
|
|
|
26119
26269
|
bridge.close();
|
|
26120
26270
|
}
|
|
26121
26271
|
}
|
|
26122
|
-
const configuredBaseUrl =
|
|
26272
|
+
const configuredBaseUrl = applyRNXConfigToUrl(baseUrl, runtimeConfig);
|
|
26123
26273
|
const token = `cli-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
26124
26274
|
const openUrl2 = await buildOpenUrl(target, configuredBaseUrl, token, buildShellUrlOpts);
|
|
26125
26275
|
const ownerPid = getStableOwnerPid();
|
|
@@ -26215,7 +26365,7 @@ async function runUseLikeCommand(args, opts = {}) {
|
|
|
26215
26365
|
` refused: ${target.id} is leased by ${target.lockedBy} (${secs}s)`
|
|
26216
26366
|
);
|
|
26217
26367
|
console.error(
|
|
26218
|
-
` \`
|
|
26368
|
+
` \`rnx use ${target.id} --force\` to take it, or \`rnx open --new\` for a fresh sim`
|
|
26219
26369
|
);
|
|
26220
26370
|
rnxExit(1);
|
|
26221
26371
|
}
|
|
@@ -26452,12 +26602,12 @@ async function runCloseCommand(args, opts = {}) {
|
|
|
26452
26602
|
bridge.close();
|
|
26453
26603
|
}
|
|
26454
26604
|
}
|
|
26455
|
-
var import_node_child_process7,
|
|
26605
|
+
var import_node_child_process7, import_node_fs16, import_node_os3, import_node_path18, import_settings, import_ws5, DEFAULT_DRIVER_CONNECT_TIMEOUT_MS, DRIVER_CONNECT_INTERVAL_MS, DRIVER_CONNECT_HOST_GRACE_MS, OPEN_BRIDGE_SPAWN_TIMEOUT_MS, SHELL_APPS;
|
|
26456
26606
|
var init_control = __esm({
|
|
26457
26607
|
"cli/commands/control.ts"() {
|
|
26458
26608
|
"use strict";
|
|
26459
26609
|
import_node_child_process7 = require("node:child_process");
|
|
26460
|
-
|
|
26610
|
+
import_node_fs16 = __toESM(require("node:fs"), 1);
|
|
26461
26611
|
import_node_os3 = __toESM(require("node:os"), 1);
|
|
26462
26612
|
import_node_path18 = __toESM(require("node:path"), 1);
|
|
26463
26613
|
import_settings = require("sootsim-engine/settings");
|
|
@@ -27377,25 +27527,25 @@ function normalizeSession(input) {
|
|
|
27377
27527
|
}
|
|
27378
27528
|
function readSharedDesktopAuthSession() {
|
|
27379
27529
|
const filepath = getSharedDesktopAuthFilePath();
|
|
27380
|
-
if (!(0,
|
|
27530
|
+
if (!(0, import_node_fs17.existsSync)(filepath)) return null;
|
|
27381
27531
|
try {
|
|
27382
|
-
const parsed = JSON.parse((0,
|
|
27532
|
+
const parsed = JSON.parse((0, import_node_fs17.readFileSync)(filepath, "utf8"));
|
|
27383
27533
|
const normalized = normalizeSession(parsed);
|
|
27384
27534
|
if (!normalized) {
|
|
27385
|
-
(0,
|
|
27535
|
+
(0, import_node_fs17.rmSync)(filepath, { force: true });
|
|
27386
27536
|
return null;
|
|
27387
27537
|
}
|
|
27388
27538
|
return normalized;
|
|
27389
27539
|
} catch {
|
|
27390
|
-
(0,
|
|
27540
|
+
(0, import_node_fs17.rmSync)(filepath, { force: true });
|
|
27391
27541
|
return null;
|
|
27392
27542
|
}
|
|
27393
27543
|
}
|
|
27394
|
-
var
|
|
27544
|
+
var import_node_fs17, import_node_path19, SESSION_VERSION, SESSION_FILE_ENV, DEFAULT_ORIGIN;
|
|
27395
27545
|
var init_shared_session = __esm({
|
|
27396
27546
|
"src/auth/shared-session.ts"() {
|
|
27397
27547
|
"use strict";
|
|
27398
|
-
|
|
27548
|
+
import_node_fs17 = require("node:fs");
|
|
27399
27549
|
import_node_path19 = require("node:path");
|
|
27400
27550
|
init_home_paths();
|
|
27401
27551
|
SESSION_VERSION = 1;
|
|
@@ -27432,14 +27582,12 @@ function resolveGitHubActionsAuth() {
|
|
|
27432
27582
|
};
|
|
27433
27583
|
}
|
|
27434
27584
|
function isCliApiKeySecret(secret) {
|
|
27435
|
-
return secret.startsWith("sk_rnx_")
|
|
27585
|
+
return secret.startsWith("sk_rnx_");
|
|
27436
27586
|
}
|
|
27437
27587
|
function readApiKeyFromEnv() {
|
|
27438
|
-
|
|
27439
|
-
|
|
27440
|
-
|
|
27441
|
-
}
|
|
27442
|
-
return null;
|
|
27588
|
+
const envName = "RNX_API_KEY";
|
|
27589
|
+
const secret = process.env[envName]?.trim();
|
|
27590
|
+
return secret && isCliApiKeySecret(secret) ? { secret, envName } : null;
|
|
27443
27591
|
}
|
|
27444
27592
|
function resolveCliAuth() {
|
|
27445
27593
|
const envKey = readApiKeyFromEnv();
|
|
@@ -27483,7 +27631,7 @@ var init_run_registry = __esm({
|
|
|
27483
27631
|
// cli/commands/upload.ts
|
|
27484
27632
|
async function resolveDefaultUploadOrigin(explicitOrigin) {
|
|
27485
27633
|
if (explicitOrigin) return explicitOrigin;
|
|
27486
|
-
if (process.env.
|
|
27634
|
+
if (process.env.RNX_UPLOAD_ORIGIN) return process.env.RNX_UPLOAD_ORIGIN;
|
|
27487
27635
|
return REMOTE_DEFAULT_ORIGIN;
|
|
27488
27636
|
}
|
|
27489
27637
|
var import_compress, import_compress_node, import_presigned_upload, import_trace, REMOTE_DEFAULT_ORIGIN, REMOTE_DEFAULT_PUBLIC_PREVIEW_ORIGIN;
|
|
@@ -27502,8 +27650,8 @@ var init_upload = __esm({
|
|
|
27502
27650
|
init_run_registry();
|
|
27503
27651
|
init_run_rnx();
|
|
27504
27652
|
init_ws_bridge();
|
|
27505
|
-
REMOTE_DEFAULT_ORIGIN = process.env.
|
|
27506
|
-
REMOTE_DEFAULT_PUBLIC_PREVIEW_ORIGIN = process.env.
|
|
27653
|
+
REMOTE_DEFAULT_ORIGIN = process.env.RNX_UPLOAD_ORIGIN || "https://contrast.dev";
|
|
27654
|
+
REMOTE_DEFAULT_PUBLIC_PREVIEW_ORIGIN = process.env.RNX_PREVIEW_ORIGIN || rnxPublicBrand.origin;
|
|
27507
27655
|
}
|
|
27508
27656
|
});
|
|
27509
27657
|
|
|
@@ -27921,7 +28069,7 @@ var init_bridge_flow_runner = __esm({
|
|
|
27921
28069
|
const extension = videoMime.includes("mp4") ? "mp4" : "webm";
|
|
27922
28070
|
const outputPath = path18.join(
|
|
27923
28071
|
this.opts.recordingOutputDir,
|
|
27924
|
-
`
|
|
28072
|
+
`rnx-${Date.now()}.${extension}`
|
|
27925
28073
|
);
|
|
27926
28074
|
fs18.writeFileSync(outputPath, Buffer.concat(chunks));
|
|
27927
28075
|
return outputPath;
|
|
@@ -29967,9 +30115,9 @@ var skillRegistry = {
|
|
|
29967
30115
|
this.register(skill7);
|
|
29968
30116
|
}
|
|
29969
30117
|
},
|
|
29970
|
-
// load skills from a project manifest (
|
|
30118
|
+
// load skills from a project manifest (rnx-skills.json)
|
|
29971
30119
|
async loadFromManifest(projectDir) {
|
|
29972
|
-
const manifestPath = path19.join(projectDir, "
|
|
30120
|
+
const manifestPath = path19.join(projectDir, "rnx-skills.json");
|
|
29973
30121
|
if (!fs19.existsSync(manifestPath)) return;
|
|
29974
30122
|
try {
|
|
29975
30123
|
const manifest = JSON.parse(fs19.readFileSync(manifestPath, "utf8"));
|