rnxsim 0.0.0 → 0.1.312
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/LICENSE +21 -0
- package/README.md +512 -0
- package/detox/colors.ts +54 -0
- package/detox/config-loader.ts +135 -0
- package/detox/element-types.ts +39 -0
- package/detox/expectations.ts +537 -0
- package/detox/gestures.ts +480 -0
- package/detox/index.ts +2118 -0
- package/detox/jest-preset.cjs +51 -0
- package/detox/jest-setup-after-env.cjs +18 -0
- package/detox/matchers.ts +30 -0
- package/detox/motion-change.cjs +109 -0
- package/detox/motion-change.d.cts +35 -0
- package/detox/navigation.ts +43 -0
- package/detox/screenshots/animated-color-test-rest-norngh.png +0 -0
- package/detox/screenshots/color-test-after-drag-norngh.png +0 -0
- package/detox/screenshots/color-test-rest-norngh.png +0 -0
- package/detox/screenshots/theme-blue-toggle.png +0 -0
- package/detox/screenshots/theme-blue.png +0 -0
- package/detox/screenshots/theme-red-toggle.png +0 -0
- package/detox/screenshots/theme-red.png +0 -0
- package/dist-cli/bin.js +15 -0
- package/dist-cli/chunks/agent-NXVDDCFG.js +48 -0
- package/dist-cli/chunks/agent-wrapper-DXJCFKL3.js +17 -0
- package/dist-cli/chunks/app-fonts-W5AJZQJF.js +4 -0
- package/dist-cli/chunks/assert-3LOJEUDT.js +49 -0
- package/dist-cli/chunks/auth-MFTYYPNX.js +12 -0
- package/dist-cli/chunks/beta-GT3NN67B.js +4 -0
- package/dist-cli/chunks/camera-6EAK7CUL.js +22 -0
- package/dist-cli/chunks/chunk-274UD5FD.js +4 -0
- package/dist-cli/chunks/chunk-2SA2VTGP.js +5 -0
- package/dist-cli/chunks/chunk-33FKQH54.js +5 -0
- package/dist-cli/chunks/chunk-37I5AIS7.js +3 -0
- package/dist-cli/chunks/chunk-3D57IBPC.js +4 -0
- package/dist-cli/chunks/chunk-4BXCZHAU.js +4 -0
- package/dist-cli/chunks/chunk-5OX7ANRA.js +5 -0
- package/dist-cli/chunks/chunk-66NF2KNG.js +9 -0
- package/dist-cli/chunks/chunk-6UKJB2VC.js +125 -0
- package/dist-cli/chunks/chunk-7INBNA3U.js +26 -0
- package/dist-cli/chunks/chunk-7VWOSTD5.js +5 -0
- package/dist-cli/chunks/chunk-AY47WKS5.js +23 -0
- package/dist-cli/chunks/chunk-B7KMNHX7.js +4 -0
- package/dist-cli/chunks/chunk-BKNOLP3J.js +4 -0
- package/dist-cli/chunks/chunk-BRIZOR4K.js +28 -0
- package/dist-cli/chunks/chunk-DM6KUAOZ.js +4 -0
- package/dist-cli/chunks/chunk-EUAVBTKU.js +4 -0
- package/dist-cli/chunks/chunk-FTC4M26Q.js +4 -0
- package/dist-cli/chunks/chunk-FWYYCUAZ.js +4 -0
- package/dist-cli/chunks/chunk-G74YIEVS.js +7 -0
- package/dist-cli/chunks/chunk-GZDHEONW.js +507 -0
- package/dist-cli/chunks/chunk-HG7ORJMT.js +5 -0
- package/dist-cli/chunks/chunk-HMDOLCKG.js +15 -0
- package/dist-cli/chunks/chunk-JG6S4RSH.js +4 -0
- package/dist-cli/chunks/chunk-KR5BGMBZ.js +4 -0
- package/dist-cli/chunks/chunk-KZW5WBGU.js +983 -0
- package/dist-cli/chunks/chunk-L24Z3CRS.js +30 -0
- package/dist-cli/chunks/chunk-LDQ7HVCW.js +4 -0
- package/dist-cli/chunks/chunk-MENV7VLD.js +4 -0
- package/dist-cli/chunks/chunk-MNGQ42QE.js +568 -0
- package/dist-cli/chunks/chunk-N6A3SXMR.js +4 -0
- package/dist-cli/chunks/chunk-NLEMQ4PY.js +6 -0
- package/dist-cli/chunks/chunk-NPVGMH2N.js +101 -0
- package/dist-cli/chunks/chunk-OR3XTXEB.js +107 -0
- package/dist-cli/chunks/chunk-PEPUGJVI.js +4 -0
- package/dist-cli/chunks/chunk-Q3RGLERJ.js +142 -0
- package/dist-cli/chunks/chunk-SI3BUTQR.js +4 -0
- package/dist-cli/chunks/chunk-T4FT6CM7.js +4 -0
- package/dist-cli/chunks/chunk-TBMVBI26.js +7 -0
- package/dist-cli/chunks/chunk-TCWQJILS.js +5 -0
- package/dist-cli/chunks/chunk-TGQNQ6XT.js +766 -0
- package/dist-cli/chunks/chunk-TYE3WBSR.js +5 -0
- package/dist-cli/chunks/chunk-U4PN6JOT.js +6 -0
- package/dist-cli/chunks/chunk-VUFRB347.js +4 -0
- package/dist-cli/chunks/chunk-VZBLFMYC.js +10 -0
- package/dist-cli/chunks/chunk-WBT32R6N.js +25 -0
- package/dist-cli/chunks/chunk-XRGEEPJ5.js +38 -0
- package/dist-cli/chunks/chunk-Y2FSZSO7.js +71 -0
- package/dist-cli/chunks/chunk-YRV7HR3P.js +74 -0
- package/dist-cli/chunks/chunk-YZRFF4YA.js +14 -0
- package/dist-cli/chunks/chunk-ZMZTHU7V.js +4 -0
- package/dist-cli/chunks/cleanup-H3GWQB63.js +25 -0
- package/dist-cli/chunks/cli-version-3QPAJ3LC.js +4 -0
- package/dist-cli/chunks/compat-5WG2XJV7.js +20 -0
- package/dist-cli/chunks/config-ANMBVVLL.js +13 -0
- package/dist-cli/chunks/control-NSGNQFJG.js +4 -0
- package/dist-cli/chunks/daemon-JHF4BJ3U.js +4 -0
- package/dist-cli/chunks/debug-CHV2O2KF.js +200 -0
- package/dist-cli/chunks/desktop-FIPIK4CH.js +31 -0
- package/dist-cli/chunks/detox-CVUJP7K6.js +52 -0
- package/dist-cli/chunks/device-6WCUM4W6.js +18 -0
- package/dist-cli/chunks/diagnose-I6EMWEII.js +43 -0
- package/dist-cli/chunks/disk-cleanup-P27CYFTN.js +4 -0
- package/dist-cli/chunks/drivers-HQ6AKZT6.js +4 -0
- package/dist-cli/chunks/film-UOQFFYNF.js +74 -0
- package/dist-cli/chunks/flow-N27MRRNL.js +4 -0
- package/dist-cli/chunks/help-SF6FEGEE.js +4 -0
- package/dist-cli/chunks/hidden-runtime-alias-NJYFSJKZ.js +4 -0
- package/dist-cli/chunks/home-paths-XOV44JEF.js +4 -0
- package/dist-cli/chunks/inspect-CWFRFQTY.js +4 -0
- package/dist-cli/chunks/install-desktop-KLQDNXZQ.js +4 -0
- package/dist-cli/chunks/login-BPFQENCX.js +28 -0
- package/dist-cli/chunks/logout-5A45ZGY7.js +4 -0
- package/dist-cli/chunks/maestro-E4CSDMLM.js +104 -0
- package/dist-cli/chunks/maestro-generate-CKMOJQX2.js +36 -0
- package/dist-cli/chunks/mode-SZYNMIQF.js +26 -0
- package/dist-cli/chunks/optional-demo-registry-FRH4SFVG.js +4 -0
- package/dist-cli/chunks/perf-VXU2XJAX.js +48 -0
- package/dist-cli/chunks/permissions-IRIAOVND.js +13 -0
- package/dist-cli/chunks/record-RY7FPLLH.js +72 -0
- package/dist-cli/chunks/report-issue-KNWXOE53.js +29 -0
- package/dist-cli/chunks/runtime-AR3GJTGK.js +4 -0
- package/dist-cli/chunks/screenshot-command-QLALR6GY.js +159 -0
- package/dist-cli/chunks/screenshot-layers-OQFMFVRL.js +20 -0
- package/dist-cli/chunks/screenshots-capture-6TSRJFGB.js +42 -0
- package/dist-cli/chunks/serve-F54J2NQO.js +44 -0
- package/dist-cli/chunks/setup-7V6UKX4U.js +32 -0
- package/dist-cli/chunks/skills-QQBOSETH.js +50 -0
- package/dist-cli/chunks/storage-TAPMKK5O.js +37 -0
- package/dist-cli/chunks/store-7NX3S43H.js +4 -0
- package/dist-cli/chunks/telemetry-E7BUK6RA.js +4 -0
- package/dist-cli/chunks/timeline-IAM564NA.js +24 -0
- package/dist-cli/chunks/upgrade-CD55QXIX.js +7 -0
- package/dist-cli/chunks/upload-GZ6LIMYM.js +4 -0
- package/dist-cli/chunks/version-3DYJ5AS3.js +6 -0
- package/dist-cli/chunks/web-6NW6YLPI.js +4 -0
- package/dist-cli/chunks/what-happened-CZZDOOVG.js +25 -0
- package/dist-lib/agent-daemon-client.cjs +468 -0
- package/dist-lib/agent-events.cjs +48 -0
- package/dist-lib/agent-identity.cjs +53 -0
- package/dist-lib/agent-sessions.cjs +725 -0
- package/dist-lib/attached-projects.cjs +526 -0
- package/dist-lib/auth/shared-session.cjs +195 -0
- package/dist-lib/backend-origin.cjs +70 -0
- package/dist-lib/beta.cjs +41 -0
- package/dist-lib/beta.mjs +13 -0
- package/dist-lib/bridge-constants.cjs +161 -0
- package/dist-lib/cli-constants.cjs +32 -0
- package/dist-lib/config.cjs +96 -0
- package/dist-lib/detox/index.cjs +2863 -0
- package/dist-lib/detox/jest-preset.cjs +51 -0
- package/dist-lib/dev-bundle-resolution.cjs +223 -0
- package/dist-lib/home-paths.cjs +421 -0
- package/dist-lib/host/bridge-host.cjs +5600 -0
- package/dist-lib/host/fetch-proxy-handler.cjs +373 -0
- package/dist-lib/host/fetch-proxy-overrides.cjs +63 -0
- package/dist-lib/host/fetch-proxy-overrides.mjs +37 -0
- package/dist-lib/host/websocket-proxy.cjs +214 -0
- package/dist-lib/index.cjs +513 -0
- package/dist-lib/jump-to-source-babel.cjs +93 -0
- package/dist-lib/menu.cjs +620 -0
- package/dist-lib/menu.mjs +581 -0
- package/dist-lib/metro.cjs +297 -0
- package/dist-lib/profiles.cjs +246 -0
- package/dist-lib/public-brand.cjs +39 -0
- package/dist-lib/render-mode.cjs +54 -0
- package/dist-lib/scripts/dev-server-scanner.cjs +1034 -0
- package/dist-lib/sdk.cjs +2333 -0
- package/dist-lib/sdk.mjs +2240 -0
- package/dist-lib/skills.cjs +23911 -0
- package/dist-lib/vite.cjs +358 -0
- package/package.json +189 -18
- package/scripts/dev-server-scanner.ts +941 -0
- package/scripts/optional-demo-registry.ts +113 -0
- package/scripts/postinstall.cjs +3 -0
- package/scripts/preuninstall.cjs +118 -0
- package/skills/contrast/SKILL.md +171 -0
- package/skills/rnx-debug/SKILL.md +425 -0
- package/skills/rnx-perf/SKILL.md +295 -0
- package/skills/rnx-setup/SKILL.md +160 -0
- package/skills/rnx-test/SKILL.md +292 -0
- package/skills/rnx-visual/SKILL.md +122 -0
- package/src/agent-daemon-client.ts +410 -0
- package/src/agent-events.ts +71 -0
- package/src/agent-identity.ts +23 -0
- package/src/agent-prompt.ts +71 -0
- package/src/agent-sessions.ts +573 -0
- package/src/attached-projects.ts +539 -0
- package/src/auth/shared-session.ts +204 -0
- package/src/backend-origin.ts +49 -0
- package/src/beta.ts +19 -0
- package/src/bridge-constants.ts +171 -0
- package/src/browser-cache.ts +16 -0
- package/src/cli-constants.ts +1 -0
- package/src/cli-version.ts +32 -0
- package/src/codex-client.ts +215 -0
- package/src/config.ts +134 -0
- package/src/dev-bundle-resolution.ts +236 -0
- package/src/disk-cleanup.ts +466 -0
- package/src/home-paths.ts +552 -0
- package/src/host/agent-host.ts +666 -0
- package/src/host/bridge-host.ts +2626 -0
- package/src/host/fetch-proxy-handler.ts +397 -0
- package/src/host/fetch-proxy-overrides.ts +51 -0
- package/src/host/open-url.ts +89 -0
- package/src/host/websocket-proxy.ts +210 -0
- package/src/index.ts +12 -705
- package/src/jump-to-source-babel.ts +135 -0
- package/src/menu.ts +734 -0
- package/src/metro-plugin.ts +139 -0
- package/src/native-dev-bundle-url.ts +96 -0
- package/src/native-seam-manifest.ts +341 -0
- package/src/plist.ts +27 -0
- package/src/poll-until.ts +92 -0
- package/src/profiles.ts +179 -0
- package/src/public-brand.ts +9 -0
- package/src/render-mode.ts +27 -0
- package/src/runtime-assets.ts +228 -0
- package/src/runtime-delivery.ts +54 -0
- package/src/screenshots/compose.ts +422 -0
- package/src/screenshots/frame-compose.ts +454 -0
- package/src/screenshots/orchestrate.ts +256 -0
- package/src/screenshots/org-deck.ts +91 -0
- package/src/screenshots/registry.ts +58 -0
- package/src/screenshots/schema.ts +364 -0
- package/src/sdk.ts +7 -0
- package/src/settings-bundle.ts +418 -0
- package/src/skills/builtin/a11y-review.ts +132 -0
- package/src/skills/builtin/compat-check.ts +71 -0
- package/src/skills/builtin/maestro-test.ts +121 -0
- package/src/skills/builtin/perf-profile.ts +90 -0
- package/src/skills/builtin/screenshot-all.ts +52 -0
- package/src/skills/builtin/visual-diff.ts +100 -0
- package/src/skills/registry.ts +107 -0
- package/src/skills/types.ts +41 -0
- package/src/team-machine-prompt.ts +73 -0
- package/src/vite-plugin-one.ts +190 -0
- package/src/vite-plugin.ts +1750 -0
- package/src/worklets-babel.ts +134 -0
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
|
+
"use strict";
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name2 in all)
|
|
12
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
+
|
|
32
|
+
// src/agent-daemon-client.ts
|
|
33
|
+
var agent_daemon_client_exports = {};
|
|
34
|
+
__export(agent_daemon_client_exports, {
|
|
35
|
+
AgentDaemonClient: () => AgentDaemonClient,
|
|
36
|
+
AgentDaemonError: () => AgentDaemonError,
|
|
37
|
+
connectToDaemon: () => connectToDaemon,
|
|
38
|
+
ensureDaemonRunning: () => ensureDaemonRunning,
|
|
39
|
+
isBridgeUp: () => isBridgeUp
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(agent_daemon_client_exports);
|
|
42
|
+
var import_node_child_process = require("node:child_process");
|
|
43
|
+
var import_node_net = __toESM(require("node:net"), 1);
|
|
44
|
+
var import_ws = require("ws");
|
|
45
|
+
|
|
46
|
+
// src/agent-sessions.ts
|
|
47
|
+
var import_node_fs2 = __toESM(require("node:fs"), 1);
|
|
48
|
+
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
49
|
+
|
|
50
|
+
// src/home-paths.ts
|
|
51
|
+
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
52
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
53
|
+
function isSootsimDevCheckout() {
|
|
54
|
+
if (process.env.SOOTSIM_FORCE_DAEMON_INSTALL === "1") return false;
|
|
55
|
+
const env = process.env.SOOTSIM_DEV;
|
|
56
|
+
if (env === "1" || env === "true") return true;
|
|
57
|
+
if (env === "0" || env === "false") return false;
|
|
58
|
+
const argv1 = process.argv[1];
|
|
59
|
+
if (!argv1) return false;
|
|
60
|
+
try {
|
|
61
|
+
const real = import_node_fs.default.realpathSync(argv1);
|
|
62
|
+
return real.includes(`${import_node_path.default.sep}packages${import_node_path.default.sep}sootsim${import_node_path.default.sep}`);
|
|
63
|
+
} catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function isDevWorkstation() {
|
|
68
|
+
if (process.env.SOOTSIM_FORCE_DAEMON_INSTALL === "1") return false;
|
|
69
|
+
return process.env.IS_TAMAGUI_DEV === "1";
|
|
70
|
+
}
|
|
71
|
+
function shouldSkipPersistentDaemon() {
|
|
72
|
+
return isSootsimDevCheckout() || isDevWorkstation();
|
|
73
|
+
}
|
|
74
|
+
var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
75
|
+
|
|
76
|
+
// src/attached-projects.ts
|
|
77
|
+
var COST_HISTORY_MAX_AGE_MS = 14 * 24 * 60 * 60 * 1e3;
|
|
78
|
+
|
|
79
|
+
// src/public-brand.ts
|
|
80
|
+
var name = "rnx";
|
|
81
|
+
var rnxPublicBrand = Object.freeze({
|
|
82
|
+
name,
|
|
83
|
+
packageName: "rnxsim",
|
|
84
|
+
commandName: "rnxsim",
|
|
85
|
+
domain: "rnxsim.com",
|
|
86
|
+
origin: "https://rnxsim.com"
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// src/agent-sessions.ts
|
|
90
|
+
function resolveSootsimInvocation() {
|
|
91
|
+
if (process.env.SOOTSIM_BIN) {
|
|
92
|
+
return { cmd: process.env.SOOTSIM_BIN, prefixArgs: [] };
|
|
93
|
+
}
|
|
94
|
+
if (process.versions.electron) {
|
|
95
|
+
const resourcesPath = process.resourcesPath;
|
|
96
|
+
if (resourcesPath) {
|
|
97
|
+
const candidates = [
|
|
98
|
+
import_node_path2.default.join(resourcesPath, "bin", "sootsim"),
|
|
99
|
+
import_node_path2.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
|
|
100
|
+
];
|
|
101
|
+
for (const c of candidates) {
|
|
102
|
+
if (import_node_fs2.default.existsSync(c)) return { cmd: c, prefixArgs: [] };
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const workspace = tryWorkspaceSootsim();
|
|
107
|
+
if (workspace) return workspace;
|
|
108
|
+
const argv0 = process.argv[0];
|
|
109
|
+
const argv1 = process.argv[1];
|
|
110
|
+
if (argv1 && /\.(ts|tsx|mjs|cjs|js)$/.test(argv1)) {
|
|
111
|
+
return { cmd: argv0, prefixArgs: [argv1] };
|
|
112
|
+
}
|
|
113
|
+
if (!argv1 || argv1.includes("/.bin/")) {
|
|
114
|
+
throw new Error(
|
|
115
|
+
"rnxsim CLI not found. set SOOTSIM_BIN to the path of the rnxsim binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`."
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
return { cmd: argv0, prefixArgs: [] };
|
|
119
|
+
}
|
|
120
|
+
function tryWorkspaceSootsim() {
|
|
121
|
+
try {
|
|
122
|
+
const sootsimDir = resolveSootsimPackageDir();
|
|
123
|
+
if (!sootsimDir) return null;
|
|
124
|
+
const binaryName = `sootsim-${process.platform}-${process.arch}`;
|
|
125
|
+
const distBinary = import_node_path2.default.join(sootsimDir, "dist-bin", binaryName);
|
|
126
|
+
if (import_node_fs2.default.existsSync(distBinary)) return { cmd: distBinary, prefixArgs: [] };
|
|
127
|
+
const distBin = import_node_path2.default.join(sootsimDir, "dist-cli", "bin.js");
|
|
128
|
+
if (import_node_fs2.default.existsSync(distBin)) {
|
|
129
|
+
try {
|
|
130
|
+
const src = import_node_path2.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
|
|
131
|
+
if (import_node_fs2.default.existsSync(src)) {
|
|
132
|
+
const srcMtime = import_node_fs2.default.statSync(src).mtimeMs;
|
|
133
|
+
const buildMtime = import_node_fs2.default.statSync(distBin).mtimeMs;
|
|
134
|
+
if (buildMtime < srcMtime) {
|
|
135
|
+
console.warn(
|
|
136
|
+
`[rnx] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with \`bun run --cwd packages/sootsim build:cli\`.`
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
} catch {
|
|
141
|
+
}
|
|
142
|
+
return { cmd: process.execPath, prefixArgs: [distBin] };
|
|
143
|
+
}
|
|
144
|
+
return null;
|
|
145
|
+
} catch {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function resolveSootsimPackageDir() {
|
|
150
|
+
try {
|
|
151
|
+
const resolved = require.resolve(`${rnxPublicBrand.packageName}/package.json`);
|
|
152
|
+
return import_node_path2.default.dirname(resolved);
|
|
153
|
+
} catch {
|
|
154
|
+
}
|
|
155
|
+
const here = fileFromImportMeta();
|
|
156
|
+
if (!here) return null;
|
|
157
|
+
let cur = import_node_path2.default.dirname(here);
|
|
158
|
+
for (let i = 0; i < 8; i++) {
|
|
159
|
+
const pkg = import_node_path2.default.join(cur, "package.json");
|
|
160
|
+
try {
|
|
161
|
+
if (import_node_fs2.default.existsSync(pkg)) {
|
|
162
|
+
const parsed = JSON.parse(import_node_fs2.default.readFileSync(pkg, "utf8"));
|
|
163
|
+
if (parsed.name === rnxPublicBrand.packageName) return cur;
|
|
164
|
+
}
|
|
165
|
+
} catch {
|
|
166
|
+
}
|
|
167
|
+
const parent = import_node_path2.default.dirname(cur);
|
|
168
|
+
if (parent === cur) break;
|
|
169
|
+
cur = parent;
|
|
170
|
+
}
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
function fileFromImportMeta() {
|
|
174
|
+
try {
|
|
175
|
+
const url = __sootsim_import_meta_url;
|
|
176
|
+
if (!url || !url.startsWith("file://")) return null;
|
|
177
|
+
return decodeURIComponent(url.slice("file://".length));
|
|
178
|
+
} catch {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// src/bridge-constants.ts
|
|
184
|
+
var DEFAULT_SOOTSIM_BRIDGE_PORT = 7668;
|
|
185
|
+
var DEFAULT_SOOTSIM_BRIDGE_URL = `http://localhost:${DEFAULT_SOOTSIM_BRIDGE_PORT}/`;
|
|
186
|
+
|
|
187
|
+
// src/agent-daemon-client.ts
|
|
188
|
+
var AgentDaemonError = class extends Error {
|
|
189
|
+
code;
|
|
190
|
+
constructor(message, code) {
|
|
191
|
+
super(message);
|
|
192
|
+
this.name = "AgentDaemonError";
|
|
193
|
+
this.code = code;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
var AgentDaemonClient = class {
|
|
197
|
+
ws;
|
|
198
|
+
port;
|
|
199
|
+
commandTimeoutMs;
|
|
200
|
+
ready;
|
|
201
|
+
closed = false;
|
|
202
|
+
nextId = 1;
|
|
203
|
+
pending = /* @__PURE__ */ new Map();
|
|
204
|
+
eventListeners = /* @__PURE__ */ new Set();
|
|
205
|
+
statusListeners = /* @__PURE__ */ new Set();
|
|
206
|
+
disconnectListeners = /* @__PURE__ */ new Set();
|
|
207
|
+
constructor(opts = {}) {
|
|
208
|
+
this.port = opts.port ?? DEFAULT_SOOTSIM_BRIDGE_PORT;
|
|
209
|
+
this.commandTimeoutMs = opts.commandTimeoutMs ?? 15e3;
|
|
210
|
+
this.ws = new import_ws.WebSocket(`ws://localhost:${this.port}`);
|
|
211
|
+
this.ready = new Promise((resolve, reject) => {
|
|
212
|
+
const onOpen = () => {
|
|
213
|
+
this.ws.off("error", onError);
|
|
214
|
+
resolve();
|
|
215
|
+
};
|
|
216
|
+
const onError = (err) => {
|
|
217
|
+
this.ws.off("open", onOpen);
|
|
218
|
+
reject(
|
|
219
|
+
new AgentDaemonError(
|
|
220
|
+
`could not connect to rnx daemon on port ${this.port}: ${err.message}`,
|
|
221
|
+
"NO_DAEMON"
|
|
222
|
+
)
|
|
223
|
+
);
|
|
224
|
+
};
|
|
225
|
+
this.ws.once("open", onOpen);
|
|
226
|
+
this.ws.once("error", onError);
|
|
227
|
+
});
|
|
228
|
+
this.ws.on("message", (data) => this.handleMessage(data));
|
|
229
|
+
this.ws.on("close", () => this.handleClose());
|
|
230
|
+
this.ws.on("error", () => {
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
async waitReady() {
|
|
234
|
+
return this.ready;
|
|
235
|
+
}
|
|
236
|
+
// --- public api ---
|
|
237
|
+
async listProjects() {
|
|
238
|
+
return this.send("agent:list-projects");
|
|
239
|
+
}
|
|
240
|
+
async upsertProject(input) {
|
|
241
|
+
return this.send("agent:upsert-project", { input });
|
|
242
|
+
}
|
|
243
|
+
async deleteProject(projectId) {
|
|
244
|
+
return this.send("agent:delete-project", { projectId });
|
|
245
|
+
}
|
|
246
|
+
async autoAttachForUrl(input) {
|
|
247
|
+
return this.send("agent:auto-attach-for-url", {
|
|
248
|
+
input
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
async listSessions(projectId) {
|
|
252
|
+
return this.send("agent:list-sessions", { projectId });
|
|
253
|
+
}
|
|
254
|
+
async startSession(input) {
|
|
255
|
+
return this.send("agent:start-session", { input });
|
|
256
|
+
}
|
|
257
|
+
async sendPrompt(sessionId, prompt) {
|
|
258
|
+
return this.send("agent:send-prompt", {
|
|
259
|
+
sessionId,
|
|
260
|
+
prompt
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
async sendClaimedPrompt(simId, prompt) {
|
|
264
|
+
return this.send(
|
|
265
|
+
"agent:send-claimed-prompt",
|
|
266
|
+
{
|
|
267
|
+
simId,
|
|
268
|
+
prompt
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
async endSession(sessionId) {
|
|
273
|
+
return this.send("agent:end-session", { sessionId });
|
|
274
|
+
}
|
|
275
|
+
async getTranscript(sessionId) {
|
|
276
|
+
return this.send("agent:get-transcript", {
|
|
277
|
+
sessionId
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
async getPaths() {
|
|
281
|
+
return this.send("agent:get-paths");
|
|
282
|
+
}
|
|
283
|
+
async subscribeEvents(sessionId) {
|
|
284
|
+
return this.send("agent:subscribe-events", {
|
|
285
|
+
sessionId
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
async unsubscribeEvents(sessionId) {
|
|
289
|
+
return this.send("agent:unsubscribe-events", {
|
|
290
|
+
sessionId
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
onAgentEvent(cb) {
|
|
294
|
+
this.eventListeners.add(cb);
|
|
295
|
+
return () => this.eventListeners.delete(cb);
|
|
296
|
+
}
|
|
297
|
+
onSessionStatusChange(cb) {
|
|
298
|
+
this.statusListeners.add(cb);
|
|
299
|
+
return () => this.statusListeners.delete(cb);
|
|
300
|
+
}
|
|
301
|
+
onDisconnect(cb) {
|
|
302
|
+
this.disconnectListeners.add(cb);
|
|
303
|
+
return () => this.disconnectListeners.delete(cb);
|
|
304
|
+
}
|
|
305
|
+
close() {
|
|
306
|
+
if (this.closed) return;
|
|
307
|
+
this.closed = true;
|
|
308
|
+
try {
|
|
309
|
+
this.ws.close();
|
|
310
|
+
} catch {
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
// --- internals ---
|
|
314
|
+
async send(type, payload = {}) {
|
|
315
|
+
await this.ready;
|
|
316
|
+
if (this.closed || this.ws.readyState !== import_ws.WebSocket.OPEN) {
|
|
317
|
+
throw new AgentDaemonError("daemon connection is closed", "NO_DAEMON");
|
|
318
|
+
}
|
|
319
|
+
const id = this.nextId++;
|
|
320
|
+
return new Promise((resolve, reject) => {
|
|
321
|
+
const timer = setTimeout(() => {
|
|
322
|
+
this.pending.delete(id);
|
|
323
|
+
reject(
|
|
324
|
+
new AgentDaemonError(
|
|
325
|
+
`${type} timed out after ${Math.round(this.commandTimeoutMs / 1e3)}s`,
|
|
326
|
+
"TIMEOUT"
|
|
327
|
+
)
|
|
328
|
+
);
|
|
329
|
+
}, this.commandTimeoutMs);
|
|
330
|
+
this.pending.set(id, {
|
|
331
|
+
resolve,
|
|
332
|
+
reject,
|
|
333
|
+
timer
|
|
334
|
+
});
|
|
335
|
+
try {
|
|
336
|
+
this.ws.send(JSON.stringify({ id, type, ...payload }));
|
|
337
|
+
} catch (err) {
|
|
338
|
+
clearTimeout(timer);
|
|
339
|
+
this.pending.delete(id);
|
|
340
|
+
reject(err instanceof Error ? err : new Error(String(err)));
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
handleMessage(data) {
|
|
345
|
+
let msg;
|
|
346
|
+
try {
|
|
347
|
+
msg = JSON.parse(String(data));
|
|
348
|
+
} catch {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (!msg || typeof msg !== "object") return;
|
|
352
|
+
if (msg.type === "agent:event") {
|
|
353
|
+
for (const cb of this.eventListeners) {
|
|
354
|
+
try {
|
|
355
|
+
cb({ sessionId: msg.sessionId, event: msg.event });
|
|
356
|
+
} catch {
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
if (msg.type === "agent:session-status") {
|
|
362
|
+
for (const cb of this.statusListeners) {
|
|
363
|
+
try {
|
|
364
|
+
cb(msg.session);
|
|
365
|
+
} catch {
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
if (typeof msg.id !== "number") return;
|
|
371
|
+
const entry = this.pending.get(msg.id);
|
|
372
|
+
if (!entry) return;
|
|
373
|
+
this.pending.delete(msg.id);
|
|
374
|
+
clearTimeout(entry.timer);
|
|
375
|
+
if (msg.error) {
|
|
376
|
+
entry.reject(new AgentDaemonError(msg.error, msg.code));
|
|
377
|
+
} else {
|
|
378
|
+
entry.resolve(msg.result);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
handleClose() {
|
|
382
|
+
if (this.closed) return;
|
|
383
|
+
this.closed = true;
|
|
384
|
+
for (const [, entry] of this.pending) {
|
|
385
|
+
clearTimeout(entry.timer);
|
|
386
|
+
entry.reject(new AgentDaemonError("daemon disconnected", "DISCONNECT"));
|
|
387
|
+
}
|
|
388
|
+
this.pending.clear();
|
|
389
|
+
for (const cb of this.disconnectListeners) {
|
|
390
|
+
try {
|
|
391
|
+
cb();
|
|
392
|
+
} catch {
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
function isBridgeUp(port = DEFAULT_SOOTSIM_BRIDGE_PORT, timeoutMs = 400) {
|
|
398
|
+
return new Promise((resolve) => {
|
|
399
|
+
const socket = new import_node_net.default.Socket();
|
|
400
|
+
let settled = false;
|
|
401
|
+
const done = (ok) => {
|
|
402
|
+
if (settled) return;
|
|
403
|
+
settled = true;
|
|
404
|
+
socket.destroy();
|
|
405
|
+
resolve(ok);
|
|
406
|
+
};
|
|
407
|
+
socket.setTimeout(timeoutMs);
|
|
408
|
+
socket.once("connect", () => done(true));
|
|
409
|
+
socket.once("timeout", () => done(false));
|
|
410
|
+
socket.once("error", () => done(false));
|
|
411
|
+
socket.connect(port, "127.0.0.1");
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
async function ensureDaemonRunning(opts = {}) {
|
|
415
|
+
const port = opts.port ?? DEFAULT_SOOTSIM_BRIDGE_PORT;
|
|
416
|
+
if (await isBridgeUp(port)) {
|
|
417
|
+
return { alreadyRunning: true };
|
|
418
|
+
}
|
|
419
|
+
if (shouldSkipPersistentDaemon()) {
|
|
420
|
+
throw new AgentDaemonError(
|
|
421
|
+
`no rnx bridge on port ${port}. run \`rnxsim setup\` to install the background daemon, or \`rnxsim serve\` in another shell.`,
|
|
422
|
+
"DEV_HOST_REFUSED"
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
const { cmd, prefixArgs } = resolveSootsimInvocation();
|
|
426
|
+
const args = [...prefixArgs, "serve", "--quiet"];
|
|
427
|
+
if (port !== DEFAULT_SOOTSIM_BRIDGE_PORT) {
|
|
428
|
+
args.push("--port", String(port));
|
|
429
|
+
}
|
|
430
|
+
const child = (0, import_node_child_process.spawn)(cmd, args, {
|
|
431
|
+
detached: true,
|
|
432
|
+
stdio: "ignore",
|
|
433
|
+
env: process.env,
|
|
434
|
+
cwd: process.cwd()
|
|
435
|
+
});
|
|
436
|
+
child.unref();
|
|
437
|
+
const deadline = Date.now() + (opts.startupTimeoutMs ?? 5e3);
|
|
438
|
+
while (Date.now() < deadline) {
|
|
439
|
+
if (await isBridgeUp(port)) return { alreadyRunning: false, pid: child.pid };
|
|
440
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
441
|
+
}
|
|
442
|
+
throw new AgentDaemonError(
|
|
443
|
+
`spawned rnx daemon on port ${port} but it did not come up in time. run \`rnxsim serve\` manually to diagnose.`,
|
|
444
|
+
"SPAWN_TIMEOUT"
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
async function connectToDaemon(opts = {}) {
|
|
448
|
+
await ensureDaemonRunning({
|
|
449
|
+
port: opts.port,
|
|
450
|
+
startupTimeoutMs: opts.startupTimeoutMs
|
|
451
|
+
});
|
|
452
|
+
const client = new AgentDaemonClient(opts);
|
|
453
|
+
try {
|
|
454
|
+
await client.waitReady();
|
|
455
|
+
} catch (err) {
|
|
456
|
+
client.close();
|
|
457
|
+
throw err;
|
|
458
|
+
}
|
|
459
|
+
return client;
|
|
460
|
+
}
|
|
461
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
462
|
+
0 && (module.exports = {
|
|
463
|
+
AgentDaemonClient,
|
|
464
|
+
AgentDaemonError,
|
|
465
|
+
connectToDaemon,
|
|
466
|
+
ensureDaemonRunning,
|
|
467
|
+
isBridgeUp
|
|
468
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
|
+
"use strict";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/agent-events.ts
|
|
23
|
+
var agent_events_exports = {};
|
|
24
|
+
__export(agent_events_exports, {
|
|
25
|
+
isAgentEvent: () => isAgentEvent,
|
|
26
|
+
parseAgentEventLine: () => parseAgentEventLine
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(agent_events_exports);
|
|
29
|
+
function isAgentEvent(value) {
|
|
30
|
+
if (!value || typeof value !== "object") return false;
|
|
31
|
+
const v = value;
|
|
32
|
+
return typeof v.type === "string" && typeof v.ts === "number";
|
|
33
|
+
}
|
|
34
|
+
function parseAgentEventLine(line) {
|
|
35
|
+
const trimmed = line.trim();
|
|
36
|
+
if (!trimmed) return null;
|
|
37
|
+
try {
|
|
38
|
+
const parsed = JSON.parse(trimmed);
|
|
39
|
+
return isAgentEvent(parsed) ? parsed : null;
|
|
40
|
+
} catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
isAgentEvent,
|
|
47
|
+
parseAgentEventLine
|
|
48
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
|
+
"use strict";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/agent-identity.ts
|
|
23
|
+
var agent_identity_exports = {};
|
|
24
|
+
__export(agent_identity_exports, {
|
|
25
|
+
agentSessionIdFromCliIdentity: () => agentSessionIdFromCliIdentity,
|
|
26
|
+
isValidTeamMachineSessionId: () => isValidTeamMachineSessionId,
|
|
27
|
+
teamMachineSessionIdFromCliIdentity: () => teamMachineSessionIdFromCliIdentity
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(agent_identity_exports);
|
|
30
|
+
var TEAM_MACHINE_SESSION_RE = /^[A-Za-z0-9._:-]{1,160}$/;
|
|
31
|
+
function agentSessionIdFromCliIdentity(identity) {
|
|
32
|
+
if (!identity) return null;
|
|
33
|
+
const colon = identity.indexOf(":");
|
|
34
|
+
if (colon < 0) return identity.trim() || null;
|
|
35
|
+
const source = identity.slice(0, colon);
|
|
36
|
+
const value = identity.slice(colon + 1).trim();
|
|
37
|
+
return source === "SOOTSIM_CLI_IDENTITY" && value ? value : null;
|
|
38
|
+
}
|
|
39
|
+
function teamMachineSessionIdFromCliIdentity(identity) {
|
|
40
|
+
if (!identity?.startsWith("TM_SESSION:")) return null;
|
|
41
|
+
const sessionId = identity.slice("TM_SESSION:".length).trim();
|
|
42
|
+
if (!TEAM_MACHINE_SESSION_RE.test(sessionId)) return null;
|
|
43
|
+
return sessionId;
|
|
44
|
+
}
|
|
45
|
+
function isValidTeamMachineSessionId(sessionId) {
|
|
46
|
+
return TEAM_MACHINE_SESSION_RE.test(sessionId);
|
|
47
|
+
}
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
agentSessionIdFromCliIdentity,
|
|
51
|
+
isValidTeamMachineSessionId,
|
|
52
|
+
teamMachineSessionIdFromCliIdentity
|
|
53
|
+
});
|