rnxsim 0.0.0 → 0.1.313

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.
Files changed (228) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +512 -0
  3. package/detox/colors.ts +54 -0
  4. package/detox/config-loader.ts +135 -0
  5. package/detox/element-types.ts +39 -0
  6. package/detox/expectations.ts +537 -0
  7. package/detox/gestures.ts +480 -0
  8. package/detox/index.ts +2118 -0
  9. package/detox/jest-preset.cjs +51 -0
  10. package/detox/jest-setup-after-env.cjs +18 -0
  11. package/detox/matchers.ts +30 -0
  12. package/detox/motion-change.cjs +109 -0
  13. package/detox/motion-change.d.cts +35 -0
  14. package/detox/navigation.ts +43 -0
  15. package/detox/screenshots/animated-color-test-rest-norngh.png +0 -0
  16. package/detox/screenshots/color-test-after-drag-norngh.png +0 -0
  17. package/detox/screenshots/color-test-rest-norngh.png +0 -0
  18. package/detox/screenshots/theme-blue-toggle.png +0 -0
  19. package/detox/screenshots/theme-blue.png +0 -0
  20. package/detox/screenshots/theme-red-toggle.png +0 -0
  21. package/detox/screenshots/theme-red.png +0 -0
  22. package/dist-cli/bin.js +15 -0
  23. package/dist-cli/chunks/agent-XZ2KTPCU.js +48 -0
  24. package/dist-cli/chunks/agent-wrapper-JJYYW2WH.js +17 -0
  25. package/dist-cli/chunks/app-fonts-IXRNQG6B.js +4 -0
  26. package/dist-cli/chunks/assert-54T5SK5F.js +49 -0
  27. package/dist-cli/chunks/auth-FI5UDI45.js +12 -0
  28. package/dist-cli/chunks/beta-JV6UKADW.js +4 -0
  29. package/dist-cli/chunks/camera-VL73YIKP.js +22 -0
  30. package/dist-cli/chunks/chunk-2D2UPBBR.js +4 -0
  31. package/dist-cli/chunks/chunk-2YR5BGA5.js +5 -0
  32. package/dist-cli/chunks/chunk-3NV2NCNX.js +4 -0
  33. package/dist-cli/chunks/chunk-46EUUFJ5.js +4 -0
  34. package/dist-cli/chunks/chunk-4NPPOV2N.js +5 -0
  35. package/dist-cli/chunks/chunk-5DHC6KHQ.js +7 -0
  36. package/dist-cli/chunks/chunk-5TEF3ET3.js +74 -0
  37. package/dist-cli/chunks/chunk-5TPRP5QT.js +4 -0
  38. package/dist-cli/chunks/chunk-5YJCOWCH.js +4 -0
  39. package/dist-cli/chunks/chunk-7GN3LVWB.js +4 -0
  40. package/dist-cli/chunks/chunk-BBULZ7CG.js +568 -0
  41. package/dist-cli/chunks/chunk-BTWORNNG.js +71 -0
  42. package/dist-cli/chunks/chunk-D4FFVGI5.js +5 -0
  43. package/dist-cli/chunks/chunk-DCEMHR2Y.js +4 -0
  44. package/dist-cli/chunks/chunk-DZS6WPUI.js +4 -0
  45. package/dist-cli/chunks/chunk-F5ZRSS3C.js +3 -0
  46. package/dist-cli/chunks/chunk-FSUYIVJ6.js +9 -0
  47. package/dist-cli/chunks/chunk-G2WW6L2C.js +23 -0
  48. package/dist-cli/chunks/chunk-GASE6UBA.js +4 -0
  49. package/dist-cli/chunks/chunk-GGRX24GF.js +142 -0
  50. package/dist-cli/chunks/chunk-HI5TFJWN.js +5 -0
  51. package/dist-cli/chunks/chunk-IJ5CAZZC.js +5 -0
  52. package/dist-cli/chunks/chunk-IJO63TDP.js +4 -0
  53. package/dist-cli/chunks/chunk-KTHV3RUS.js +26 -0
  54. package/dist-cli/chunks/chunk-LF2ZVT7O.js +6 -0
  55. package/dist-cli/chunks/chunk-MJRLLB4R.js +38 -0
  56. package/dist-cli/chunks/chunk-NFK7T35W.js +4 -0
  57. package/dist-cli/chunks/chunk-NMF2ZMZQ.js +15 -0
  58. package/dist-cli/chunks/chunk-OHAZNXLK.js +4 -0
  59. package/dist-cli/chunks/chunk-OVFJFXUD.js +101 -0
  60. package/dist-cli/chunks/chunk-OZSSI4WN.js +28 -0
  61. package/dist-cli/chunks/chunk-QKDWYITG.js +25 -0
  62. package/dist-cli/chunks/chunk-RSZWCKNT.js +30 -0
  63. package/dist-cli/chunks/chunk-RTN5C5RL.js +4 -0
  64. package/dist-cli/chunks/chunk-TIVZIMMW.js +4 -0
  65. package/dist-cli/chunks/chunk-TZFFR3SD.js +7 -0
  66. package/dist-cli/chunks/chunk-UC6U3MML.js +5 -0
  67. package/dist-cli/chunks/chunk-VFCMSYZK.js +6 -0
  68. package/dist-cli/chunks/chunk-VNQEB4L7.js +5 -0
  69. package/dist-cli/chunks/chunk-VZXWHRUZ.js +983 -0
  70. package/dist-cli/chunks/chunk-W6K4EFPH.js +107 -0
  71. package/dist-cli/chunks/chunk-WEXDAC74.js +4 -0
  72. package/dist-cli/chunks/chunk-WF3T4SVI.js +14 -0
  73. package/dist-cli/chunks/chunk-WINYQ44O.js +4 -0
  74. package/dist-cli/chunks/chunk-WMIIKMGK.js +10 -0
  75. package/dist-cli/chunks/chunk-WUSWBCWA.js +507 -0
  76. package/dist-cli/chunks/chunk-WWZIXIRD.js +4 -0
  77. package/dist-cli/chunks/chunk-XEVZYVIW.js +766 -0
  78. package/dist-cli/chunks/chunk-YDGQTMQL.js +4 -0
  79. package/dist-cli/chunks/chunk-YIFT42WN.js +4 -0
  80. package/dist-cli/chunks/chunk-ZMJD5GEC.js +125 -0
  81. package/dist-cli/chunks/cleanup-P27PA6JI.js +25 -0
  82. package/dist-cli/chunks/cli-version-WWLPBDQ7.js +4 -0
  83. package/dist-cli/chunks/compat-ZD65FED3.js +20 -0
  84. package/dist-cli/chunks/config-XMJRNM2A.js +13 -0
  85. package/dist-cli/chunks/control-KMIQT3QP.js +4 -0
  86. package/dist-cli/chunks/daemon-G2ME7NLB.js +4 -0
  87. package/dist-cli/chunks/debug-PT4HOP7N.js +200 -0
  88. package/dist-cli/chunks/desktop-S3FG72AK.js +31 -0
  89. package/dist-cli/chunks/detox-B3D4IFCN.js +52 -0
  90. package/dist-cli/chunks/device-XBNDSB2R.js +18 -0
  91. package/dist-cli/chunks/diagnose-HMQXJE5N.js +43 -0
  92. package/dist-cli/chunks/disk-cleanup-BLCZ5BSZ.js +4 -0
  93. package/dist-cli/chunks/drivers-LDECZGP2.js +4 -0
  94. package/dist-cli/chunks/film-BJGTBYZB.js +74 -0
  95. package/dist-cli/chunks/flow-UEQNVTU7.js +4 -0
  96. package/dist-cli/chunks/help-T5FYSVGB.js +4 -0
  97. package/dist-cli/chunks/hidden-runtime-alias-ANOYADHM.js +4 -0
  98. package/dist-cli/chunks/home-paths-GT3LFNOR.js +4 -0
  99. package/dist-cli/chunks/inspect-ZA6XF5LD.js +4 -0
  100. package/dist-cli/chunks/install-desktop-TIMUDHPL.js +4 -0
  101. package/dist-cli/chunks/login-FJ737MWG.js +28 -0
  102. package/dist-cli/chunks/logout-ZCNMMHMY.js +4 -0
  103. package/dist-cli/chunks/maestro-SZTNKLDF.js +104 -0
  104. package/dist-cli/chunks/maestro-generate-DCFAIZ4H.js +36 -0
  105. package/dist-cli/chunks/mode-GRMQCRXR.js +26 -0
  106. package/dist-cli/chunks/optional-demo-registry-W36EWFFB.js +4 -0
  107. package/dist-cli/chunks/perf-QYBAAUZG.js +48 -0
  108. package/dist-cli/chunks/permissions-3QCQ6VF4.js +13 -0
  109. package/dist-cli/chunks/record-QPPC2S4E.js +72 -0
  110. package/dist-cli/chunks/report-issue-7NMFP4HK.js +29 -0
  111. package/dist-cli/chunks/runtime-XOAXMSTU.js +4 -0
  112. package/dist-cli/chunks/screenshot-command-67AECJFB.js +159 -0
  113. package/dist-cli/chunks/screenshot-layers-ASWBYPJL.js +20 -0
  114. package/dist-cli/chunks/screenshots-capture-PXA3HFQK.js +42 -0
  115. package/dist-cli/chunks/serve-BI2NBAXG.js +44 -0
  116. package/dist-cli/chunks/setup-7DWPMRSB.js +32 -0
  117. package/dist-cli/chunks/skills-S3Y22TUA.js +50 -0
  118. package/dist-cli/chunks/storage-XUIMJWAJ.js +37 -0
  119. package/dist-cli/chunks/store-JTHEJLAZ.js +4 -0
  120. package/dist-cli/chunks/telemetry-ZYJGD2DB.js +4 -0
  121. package/dist-cli/chunks/timeline-TMPLQPSP.js +24 -0
  122. package/dist-cli/chunks/upgrade-7HDSIM7K.js +7 -0
  123. package/dist-cli/chunks/upload-GMSZPWM6.js +4 -0
  124. package/dist-cli/chunks/version-HOCHZ37L.js +6 -0
  125. package/dist-cli/chunks/web-DG3WBYD3.js +4 -0
  126. package/dist-cli/chunks/what-happened-XFVUTZR7.js +25 -0
  127. package/dist-lib/agent-daemon-client.cjs +468 -0
  128. package/dist-lib/agent-events.cjs +48 -0
  129. package/dist-lib/agent-identity.cjs +53 -0
  130. package/dist-lib/agent-sessions.cjs +725 -0
  131. package/dist-lib/attached-projects.cjs +526 -0
  132. package/dist-lib/auth/shared-session.cjs +195 -0
  133. package/dist-lib/backend-origin.cjs +70 -0
  134. package/dist-lib/beta.cjs +41 -0
  135. package/dist-lib/beta.mjs +13 -0
  136. package/dist-lib/bridge-constants.cjs +161 -0
  137. package/dist-lib/cli-constants.cjs +32 -0
  138. package/dist-lib/config.cjs +96 -0
  139. package/dist-lib/detox/index.cjs +2863 -0
  140. package/dist-lib/detox/jest-preset.cjs +51 -0
  141. package/dist-lib/dev-bundle-resolution.cjs +223 -0
  142. package/dist-lib/home-paths.cjs +421 -0
  143. package/dist-lib/host/bridge-host.cjs +5600 -0
  144. package/dist-lib/host/fetch-proxy-handler.cjs +373 -0
  145. package/dist-lib/host/fetch-proxy-overrides.cjs +63 -0
  146. package/dist-lib/host/fetch-proxy-overrides.mjs +37 -0
  147. package/dist-lib/host/websocket-proxy.cjs +214 -0
  148. package/dist-lib/index.cjs +513 -0
  149. package/dist-lib/jump-to-source-babel.cjs +93 -0
  150. package/dist-lib/menu.cjs +620 -0
  151. package/dist-lib/menu.mjs +581 -0
  152. package/dist-lib/metro.cjs +297 -0
  153. package/dist-lib/profiles.cjs +246 -0
  154. package/dist-lib/public-brand.cjs +39 -0
  155. package/dist-lib/render-mode.cjs +54 -0
  156. package/dist-lib/scripts/dev-server-scanner.cjs +1034 -0
  157. package/dist-lib/sdk.cjs +2333 -0
  158. package/dist-lib/sdk.mjs +2240 -0
  159. package/dist-lib/skills.cjs +23922 -0
  160. package/dist-lib/vite.cjs +358 -0
  161. package/package.json +189 -18
  162. package/scripts/dev-server-scanner.ts +941 -0
  163. package/scripts/optional-demo-registry.ts +113 -0
  164. package/scripts/postinstall.cjs +3 -0
  165. package/scripts/preuninstall.cjs +118 -0
  166. package/skills/contrast/SKILL.md +171 -0
  167. package/skills/rnx-debug/SKILL.md +425 -0
  168. package/skills/rnx-perf/SKILL.md +295 -0
  169. package/skills/rnx-setup/SKILL.md +160 -0
  170. package/skills/rnx-test/SKILL.md +292 -0
  171. package/skills/rnx-visual/SKILL.md +122 -0
  172. package/src/agent-daemon-client.ts +410 -0
  173. package/src/agent-events.ts +71 -0
  174. package/src/agent-identity.ts +23 -0
  175. package/src/agent-prompt.ts +71 -0
  176. package/src/agent-sessions.ts +573 -0
  177. package/src/attached-projects.ts +539 -0
  178. package/src/auth/shared-session.ts +204 -0
  179. package/src/backend-origin.ts +49 -0
  180. package/src/beta.ts +19 -0
  181. package/src/bridge-constants.ts +171 -0
  182. package/src/browser-cache.ts +16 -0
  183. package/src/cli-constants.ts +1 -0
  184. package/src/cli-version.ts +32 -0
  185. package/src/codex-client.ts +215 -0
  186. package/src/config.ts +134 -0
  187. package/src/dev-bundle-resolution.ts +236 -0
  188. package/src/disk-cleanup.ts +466 -0
  189. package/src/home-paths.ts +552 -0
  190. package/src/host/agent-host.ts +666 -0
  191. package/src/host/bridge-host.ts +2626 -0
  192. package/src/host/fetch-proxy-handler.ts +397 -0
  193. package/src/host/fetch-proxy-overrides.ts +51 -0
  194. package/src/host/open-url.ts +89 -0
  195. package/src/host/websocket-proxy.ts +210 -0
  196. package/src/index.ts +12 -705
  197. package/src/jump-to-source-babel.ts +135 -0
  198. package/src/menu.ts +734 -0
  199. package/src/metro-plugin.ts +139 -0
  200. package/src/native-dev-bundle-url.ts +96 -0
  201. package/src/native-seam-manifest.ts +341 -0
  202. package/src/plist.ts +27 -0
  203. package/src/poll-until.ts +92 -0
  204. package/src/profiles.ts +179 -0
  205. package/src/public-brand.ts +9 -0
  206. package/src/render-mode.ts +27 -0
  207. package/src/runtime-assets.ts +228 -0
  208. package/src/runtime-delivery.ts +54 -0
  209. package/src/screenshots/compose.ts +422 -0
  210. package/src/screenshots/frame-compose.ts +454 -0
  211. package/src/screenshots/orchestrate.ts +256 -0
  212. package/src/screenshots/org-deck.ts +91 -0
  213. package/src/screenshots/registry.ts +58 -0
  214. package/src/screenshots/schema.ts +364 -0
  215. package/src/sdk.ts +7 -0
  216. package/src/settings-bundle.ts +418 -0
  217. package/src/skills/builtin/a11y-review.ts +132 -0
  218. package/src/skills/builtin/compat-check.ts +71 -0
  219. package/src/skills/builtin/maestro-test.ts +121 -0
  220. package/src/skills/builtin/perf-profile.ts +90 -0
  221. package/src/skills/builtin/screenshot-all.ts +52 -0
  222. package/src/skills/builtin/visual-diff.ts +100 -0
  223. package/src/skills/registry.ts +107 -0
  224. package/src/skills/types.ts +41 -0
  225. package/src/team-machine-prompt.ts +73 -0
  226. package/src/vite-plugin-one.ts +190 -0
  227. package/src/vite-plugin.ts +1750 -0
  228. package/src/worklets-babel.ts +134 -0
@@ -0,0 +1,51 @@
1
+ // jest preset for running existing detox suites against sootsim.
2
+ //
3
+ // users drop `preset: 'sootsim/detox/jest-preset'` into their jest config
4
+ // (or `sootsim-detox.config.cjs`) and their `import { by, device, element,
5
+ // expect, waitFor } from 'detox'` calls resolve to the sootsim driver.
6
+
7
+ const path = require('path')
8
+
9
+ // resolve the published driver entry so the mapping works from any cwd.
10
+ // `require.resolve('sootsim/detox')` honours the subpath export in the
11
+ // sootsim package.json.
12
+ const DRIVER_ENTRY = require.resolve('rnxsim/detox')
13
+ const PACKAGE_ROOT = path.dirname(require.resolve('rnxsim/package.json'))
14
+
15
+ /** @type {import('@jest/types').Config.InitialOptions} */
16
+ module.exports = {
17
+ testTimeout: 180000,
18
+ maxWorkers: 1,
19
+ watchman: false,
20
+ forceExit: true,
21
+ verbose: true,
22
+ testEnvironment: 'node',
23
+ setupFilesAfterEnv: [path.join(PACKAGE_ROOT, 'detox', 'jest-setup-after-env.cjs')],
24
+ transform: {
25
+ '^.+\\.tsx?$': [
26
+ 'ts-jest',
27
+ {
28
+ isolatedModules: true,
29
+ tsconfig: {
30
+ module: 'commonjs',
31
+ target: 'es2020',
32
+ esModuleInterop: true,
33
+ jsx: 'react-jsx',
34
+ strict: false,
35
+ skipLibCheck: true,
36
+ moduleResolution: 'node',
37
+ allowJs: true,
38
+ resolveJsonModule: true,
39
+ },
40
+ },
41
+ ],
42
+ },
43
+ moduleNameMapper: {
44
+ '^detox$': DRIVER_ENTRY,
45
+ // shared utils some external detox suites import relatively.
46
+ '^\\.\\./utils/navigation$': path.join(PACKAGE_ROOT, 'detox', 'navigation.ts'),
47
+ '^\\.\\./utils/colors$': path.join(PACKAGE_ROOT, 'detox', 'colors.ts'),
48
+ '^\\./(utils/navigation)$': path.join(PACKAGE_ROOT, 'detox', 'navigation.ts'),
49
+ '^\\./(utils/colors)$': path.join(PACKAGE_ROOT, 'detox', 'colors.ts'),
50
+ },
51
+ }
@@ -0,0 +1,18 @@
1
+ // closes the driver's browser when a test file finishes.
2
+ //
3
+ // the driver launches chrome lazily on first use and tracks it with the shared
4
+ // reaper, but that reaper's safety net is a `process.on('exit')` hook and jest
5
+ // hands every test file a sandboxed COPY of `process`. a handler registered
6
+ // from inside a test therefore never fires on real termination, so under jest
7
+ // the reaper is a no-op and every suite that launched a browser strands its
8
+ // whole chrome tree. one orphan per test file adds up fast on a full run.
9
+ //
10
+ // `cleanup()` is the teardown that does run, and it both closes the browser and
11
+ // force-reaps its tree. registering it here means no suite has to remember an
12
+ // afterAll of its own.
13
+
14
+ const { cleanup } = require('rnxsim/detox')
15
+
16
+ afterAll(async () => {
17
+ await cleanup()
18
+ })
@@ -0,0 +1,30 @@
1
+ // detox-compatible matchers: by.id(), by.text(), by.label(), by.type()
2
+ // these produce matcher descriptors consumed by element() and expect()
3
+
4
+ export interface Matcher {
5
+ type: 'id' | 'text' | 'label' | 'type' | 'role'
6
+ value: string
7
+ index?: number
8
+ }
9
+
10
+ export const by = {
11
+ id(testID: string): Matcher {
12
+ return { type: 'id', value: testID }
13
+ },
14
+
15
+ text(text: string): Matcher {
16
+ return { type: 'text', value: text }
17
+ },
18
+
19
+ label(accessibilityLabel: string): Matcher {
20
+ return { type: 'label', value: accessibilityLabel }
21
+ },
22
+
23
+ type(nativeType: string): Matcher {
24
+ return { type: 'type', value: nativeType }
25
+ },
26
+
27
+ role(accessibilityRole: string): Matcher {
28
+ return { type: 'role', value: accessibilityRole }
29
+ },
30
+ }
@@ -0,0 +1,109 @@
1
+ // native recordings and SootSim live frames must use this exact definition.
2
+ // retained static Android crops measured as high as 0.0331% after the channel
3
+ // filter. the smallest corrected component transition with visible motion was
4
+ // 0.1748%, so a 0.1% floor separates every measured static and moving frame.
5
+ const MOTION_CHANGE_DEFINITION = Object.freeze({
6
+ channelThreshold: 24,
7
+ minimumChangePercent: 0.1,
8
+ })
9
+
10
+ function measureMotionChange(input) {
11
+ if (!input || typeof input !== 'object' || Array.isArray(input)) {
12
+ throw new Error('motion change measurement requires an input object')
13
+ }
14
+ if (input.installGlobal === true) {
15
+ globalThis.__sootsimMeasureMotionChange = measureMotionChange
16
+ return null
17
+ }
18
+
19
+ const definition = input.definition
20
+ if (
21
+ !definition ||
22
+ typeof definition !== 'object' ||
23
+ !Number.isInteger(definition.channelThreshold) ||
24
+ definition.channelThreshold < 0 ||
25
+ definition.channelThreshold > 255 ||
26
+ !Number.isFinite(definition.minimumChangePercent) ||
27
+ definition.minimumChangePercent <= 0 ||
28
+ definition.minimumChangePercent >= 100
29
+ ) {
30
+ throw new Error(
31
+ 'motion change definition needs a channel threshold from 0 to 255 and a minimum greater than 0% and less than 100%',
32
+ )
33
+ }
34
+
35
+ const label =
36
+ typeof input.label === 'string' && input.label.length > 0
37
+ ? input.label
38
+ : 'motion change'
39
+ let changePixels = input.changePixels
40
+ let totalPixels = input.totalPixels
41
+ if (input.baseline !== undefined || input.candidate !== undefined) {
42
+ const baseline = input.baseline
43
+ const candidate = input.candidate
44
+ const width = input.width
45
+ const height = input.height
46
+ if (
47
+ !baseline ||
48
+ !candidate ||
49
+ typeof baseline.length !== 'number' ||
50
+ typeof candidate.length !== 'number' ||
51
+ !Number.isInteger(width) ||
52
+ !Number.isInteger(height) ||
53
+ width <= 0 ||
54
+ height <= 0
55
+ ) {
56
+ throw new Error(`${label} needs two RGBA pixel arrays and positive dimensions`)
57
+ }
58
+ totalPixels = width * height
59
+ const expectedBytes = totalPixels * 4
60
+ if (baseline.length !== expectedBytes || candidate.length !== expectedBytes) {
61
+ throw new Error(
62
+ `${label} pixel data has ${baseline.length}/${candidate.length} bytes; expected ${expectedBytes}`,
63
+ )
64
+ }
65
+ changePixels = 0
66
+ for (let offset = 0; offset < expectedBytes; offset += 4) {
67
+ if (
68
+ Math.abs(baseline[offset] - candidate[offset]) > definition.channelThreshold ||
69
+ Math.abs(baseline[offset + 1] - candidate[offset + 1]) >
70
+ definition.channelThreshold ||
71
+ Math.abs(baseline[offset + 2] - candidate[offset + 2]) >
72
+ definition.channelThreshold ||
73
+ Math.abs(baseline[offset + 3] - candidate[offset + 3]) >
74
+ definition.channelThreshold
75
+ ) {
76
+ changePixels++
77
+ }
78
+ }
79
+ }
80
+
81
+ if (!Number.isInteger(totalPixels) || totalPixels <= 0) {
82
+ throw new Error(`${label} has no positive measured region area`)
83
+ }
84
+ if (!Number.isInteger(changePixels) || changePixels < 0 || changePixels > totalPixels) {
85
+ throw new Error(
86
+ `${label} changed pixel count ${changePixels} is outside its ${totalPixels}px measured region`,
87
+ )
88
+ }
89
+ const changePercent = (changePixels / totalPixels) * 100
90
+ return {
91
+ changePercent,
92
+ changePixels,
93
+ passedMinimum: changePercent >= definition.minimumChangePercent,
94
+ totalPixels,
95
+ }
96
+ }
97
+
98
+ function measureProofMotionChange(input) {
99
+ return measureMotionChange({
100
+ ...input,
101
+ definition: MOTION_CHANGE_DEFINITION,
102
+ })
103
+ }
104
+
105
+ module.exports = {
106
+ MOTION_CHANGE_DEFINITION,
107
+ measureMotionChange,
108
+ measureProofMotionChange,
109
+ }
@@ -0,0 +1,35 @@
1
+ export type MotionChangeDefinition = {
2
+ channelThreshold: number
3
+ minimumChangePercent: number
4
+ }
5
+
6
+ type MotionChangePixels = ArrayLike<number>
7
+
8
+ export type MotionChangeInput = {
9
+ baseline?: MotionChangePixels
10
+ candidate?: MotionChangePixels
11
+ changePixels?: number
12
+ definition: MotionChangeDefinition
13
+ height?: number
14
+ installGlobal?: boolean
15
+ label?: string
16
+ totalPixels?: number
17
+ width?: number
18
+ }
19
+
20
+ export type MotionChangeMeasurement = {
21
+ changePercent: number
22
+ changePixels: number
23
+ passedMinimum: boolean
24
+ totalPixels: number
25
+ }
26
+
27
+ export const MOTION_CHANGE_DEFINITION: Readonly<MotionChangeDefinition>
28
+
29
+ export function measureMotionChange(
30
+ input: MotionChangeInput,
31
+ ): MotionChangeMeasurement | null
32
+
33
+ export function measureProofMotionChange(
34
+ input: Omit<MotionChangeInput, 'definition' | 'installGlobal'>,
35
+ ): MotionChangeMeasurement
@@ -0,0 +1,43 @@
1
+ // sootsim-compatible replacement for kitchen-sink's e2e/utils/navigation.ts
2
+ // instead of navigating through the UI, we load the test case via URL query param
3
+
4
+ import { by, device, element, waitFor } from './index'
5
+
6
+ const BASE_URL = process.env.SOOTSIM_URL || 'http://localhost:5173'
7
+
8
+ /**
9
+ * navigate to a kitchen-sink test case in sootsim
10
+ * loads via URL query param instead of tapping through the UI
11
+ */
12
+ export async function navigateToTestCase(
13
+ testCaseName: string,
14
+ waitForElementId?: string,
15
+ ) {
16
+ const page = device.getPage()
17
+
18
+ // navigate to the test case directly via URL, preserving any params
19
+ // already on BASE_URL (device=, colorScheme=, etc.) — the conformance
20
+ // runner sets these via SOOTSIM_URL and dropping them silently rendered
21
+ // pro max at iphone 16 dimensions.
22
+ const target = new URL(BASE_URL)
23
+ target.searchParams.set('test', testCaseName)
24
+ if (target.pathname === '' || target.pathname === '/') target.pathname = '/'
25
+ const url = target.toString()
26
+ await page.goto(url, { waitUntil: 'load', timeout: 30000 })
27
+
28
+ // wait for sootsim engine to initialize
29
+ await page.waitForFunction(
30
+ 'window.__sootsimTest && window.__sootsimRoot && window.__sootsimRoot.children.length > 0',
31
+ { timeout: 30000 },
32
+ )
33
+
34
+ // let rendering settle
35
+ await page.waitForTimeout(500)
36
+
37
+ // wait for the target element if specified
38
+ if (waitForElementId) {
39
+ await waitFor(element(by.id(waitForElementId)))
40
+ .toExist()
41
+ .withTimeout(10000)
42
+ }
43
+ }
Binary file
Binary file
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
3
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
4
+ var require = __sootsimCreateRequire(import.meta.url)
5
+ import{a as g,b as f}from"./chunks/chunk-NFK7T35W.js";import{a as m}from"./chunks/chunk-2D2UPBBR.js";import"./chunks/chunk-WINYQ44O.js";function A(a){let t=a instanceof Error?a.message:String(a);(/^command timed out after \d+s$/.test(t)||t.startsWith("sim disconnected:")||t.startsWith("bridge never reconnected")||t.startsWith("multiple sims are connected:")||t.startsWith("saved sim ")||t.startsWith("no sim connected with id ")||t.startsWith("could not connect to ws://")||t.startsWith("rnx bridge daemon is not running")||t.startsWith("rnx bridge lockfile is fresh")||t.startsWith("rnx bridge exited before becoming ready")||t.startsWith(`${m.commandName} open: requested bridge port`)||t.startsWith("background daemon setup is unavailable")||t.startsWith("rnx bridge did not start within"))&&!process.env.SOOTSIM_VERBOSE&&(process.stderr.write(` ${t}
6
+ `),process.exit(1)),a instanceof Error&&a.stack?process.stderr.write(`${a.stack}
7
+ `):process.stderr.write(`${t}
8
+ `),process.exit(1)}process.on("unhandledRejection",A);process.on("uncaughtException",A);var v=typeof __SOOTSIM_STANDALONE__<"u"&&__SOOTSIM_STANDALONE__,S=new Set(["desktop"]);function _(a){!v||!S.has(a)||(process.stderr.write(` ${m.commandName} ${a} isn't available in the standalone binary \u2014
9
+ it needs vite / electron / playwright from a project's node_modules.
10
+ run the npm package instead:
11
+ ${m.commandName} ${a}
12
+ `),process.exit(1))}var e=f(process.argv);if(!e.command&&e.commandArgs.length>0){let{resolveHiddenRuntimeAlias:a}=await import("./chunks/hidden-runtime-alias-ANOYADHM.js");e=a(e)}var C=e.command==="cleanup"&&e.commandArgs.length===1&&e.commandArgs[0]==="--automatic-worker";if(!C){let{trackCliEvent:a}=await import("./chunks/telemetry-ZYJGD2DB.js");a({event:"cli_command_invoked",properties:{command:e.command||(e.version?"version":e.help?"help":"none"),arg_count:e.commandArgs.length,platform:process.platform,arch:process.arch,node_version:process.versions.node}})}if(e.command!=="serve"&&e.command!=="daemon"){let{consumeRuntimeUpgradeNotice:a}=await import("./chunks/home-paths-GT3LFNOR.js"),t=a();t&&process.stderr.write(` ${m.name} engine upgraded to v${t.to}`+(t.from?` (from v${t.from})`:"")+` \xB7 what's new: ${m.origin}/changelog
13
+ `)}var h=!1;async function k(){if(!h&&(h=!0,!(e.command==="cleanup"||e.command==="serve"||e.command==="agent-wrapper"||e.command==="daemon"&&e.commandArgs[0]==="uninstall")))try{let{isAutomaticSootsimCleanupComplete:a}=await import("./chunks/disk-cleanup-BLCZ5BSZ.js");if(a())return;let{spawn:t}=await import("node:child_process"),r=["cleanup","--automatic-worker"],d=process.argv[1],p=v?t(process.execPath,r,{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env}):d?t(process.execPath,[d,...r],{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env}):t(m.commandName,r,{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env});p.once("error",u=>{process.stderr.write(` ${m.name} automatic cleanup will retry on the next run: ${u.message}
14
+ `)}),p.unref()}catch(a){process.stderr.write(` ${m.name} automatic cleanup will retry on the next run: ${a instanceof Error?a.message:String(a)}
15
+ `)}}async function o(a){let{flushCliTelemetry:t}=await import("./chunks/telemetry-ZYJGD2DB.js");await t(),await k(),process.exit(a)}if(e.version){let{getCliVersion:a}=await import("./chunks/cli-version-WWLPBDQ7.js"),{IS_BETA:t,BETA_LABEL:r}=await import("./chunks/beta-JV6UKADW.js"),d=t?` \xB7 ${r}`:"";console.log(`rnxsim v${a()}${d}`);let{readActiveRuntime:p}=await import("./chunks/home-paths-GT3LFNOR.js"),u=p();console.log(u?`runtime v${u}`:"runtime not installed"),await o(0)}if(e.help&&!e.command){let{printHelp:a}=await import("./chunks/help-T5FYSVGB.js");a(),await o(0)}var n=e.globalFlags.port,c=e.verbose,l=e.globalFlags.device,w=e.globalFlags.theme,E=e.globalFlags.driver,N=e.globalFlags.headless===!0,b=e.globalFlags.sim??e.globalFlags.session??e.globalFlags.tab,s=b?["--sim",b,...e.commandArgs]:e.commandArgs;if(l||w){let{settingsStore:a}=await import("./chunks/store-JTHEJLAZ.js"),t={};l&&(t.deviceModel=l),w&&(t.colorScheme=w),a.apply(t)}if(!e.command&&e.commandArgs.length===0){let{runSetup:a,shouldRunSetupForBareCommand:t}=await import("./chunks/setup-7DWPMRSB.js");t()&&(await a(["--from-welcome"]),await o(0));let{printHelp:r}=await import("./chunks/help-T5FYSVGB.js");r(),await o(0)}var i=e.command??"";if(!i){if(e.commandArgs.length>0){let t=e.commandArgs.find(r=>!r.startsWith("-"))??e.commandArgs[0];console.error(` unknown command: ${t}`),console.error(" run `rnxsim --help` to see the full surface."),await o(1)}let{printHelp:a}=await import("./chunks/help-T5FYSVGB.js");a(),await o(0)}if(e.help||e.commandArgs.includes("--help")||e.commandArgs.includes("-h")){if(i==="skill"){let{runSkill:r}=await import("./chunks/skills-S3Y22TUA.js");await r(e.commandArgs),await o(0)}let a=i==="do"||i==="get"||i==="debug"||i==="shell"||i==="perf"||i==="wait",t=e.commandArgs.find(r=>!r.startsWith("-"));if(!(i==="shell"||i==="perf"))if(a&&!t){let{printGroupHelp:r}=await import("./chunks/help-T5FYSVGB.js");r(i)&&await o(0)}else{let{printCommandHelp:r}=await import("./chunks/help-T5FYSVGB.js");r(a&&t?t:i,{prefer:a&&t?"verb":"command",group:a&&t?i:void 0}),await o(0)}}_(i);if(g.has(i)){let{runInspect:a}=await import("./chunks/inspect-ZA6XF5LD.js");await a([i,...s],{port:n,verbose:c})}else switch(i){case"assert":{let{runAssert:a}=await import("./chunks/assert-54T5SK5F.js");await a(e.commandArgs);break}case"detox":{let{runDetox:a}=await import("./chunks/detox-B3D4IFCN.js");await a(e.commandArgs,{port:n,verbose:c});break}case"maestro":{let{runMaestro:a}=await import("./chunks/maestro-SZTNKLDF.js"),t=await a(s,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"record":{let{runRecord:a}=await import("./chunks/record-QPPC2S4E.js");await a(s,{port:n,verbose:c});break}case"film":{let{runFilm:a}=await import("./chunks/film-BJGTBYZB.js"),t=await a(s,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"storage":{let{runStorage:a}=await import("./chunks/storage-XUIMJWAJ.js"),t=await a(s,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"perf":{let{runPerf:a}=await import("./chunks/perf-QYBAAUZG.js"),t=await a(s,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"screenshot":{let{runScreenshotCommand:a}=await import("./chunks/screenshot-command-67AECJFB.js"),t=await a(s,{port:n,verbose:c});await o(typeof t=="number"?t:0)}case"mode":{let{runMode:a}=await import("./chunks/mode-GRMQCRXR.js");await a(s,{port:n,verbose:c});break}case"permissions":{let{runPermissions:a}=await import("./chunks/permissions-3QCQ6VF4.js"),t=await a(s,{port:n,verbose:c});await o(t)}case"inspect":{let{runInspect:a}=await import("./chunks/inspect-ZA6XF5LD.js");await a(s,{port:n,verbose:c});break}case"debug":{let{runDebug:a}=await import("./chunks/debug-PT4HOP7N.js");await a(s,{port:n,verbose:c});break}case"timeline":{let{runTimeline:a}=await import("./chunks/timeline-TMPLQPSP.js");await a(s,{port:n,verbose:c});break}case"what-happened":{let{runWhatHappened:a}=await import("./chunks/what-happened-XFVUTZR7.js");await a(s,{port:n,verbose:c});break}case"open":{let{runOpenCommand:a}=await import("./chunks/control-KMIQT3QP.js");await a(s,{port:n});break}case"use":{let{runUseCommand:a}=await import("./chunks/control-KMIQT3QP.js");await a(s,{port:n});break}case"claim":{let{runClaimCommand:a}=await import("./chunks/control-KMIQT3QP.js");await a(s,{port:n});break}case"close":{let{runCloseCommand:a}=await import("./chunks/control-KMIQT3QP.js");await a(s,{port:n});break}case"device":{let{runDeviceCommand:a}=await import("./chunks/device-XBNDSB2R.js");await a(s,{port:n});break}case"compat":{let{runCompat:a}=await import("./chunks/compat-ZD65FED3.js");await a(e.commandArgs);break}case"report-issue":{let{runReportIssue:a}=await import("./chunks/report-issue-7NMFP4HK.js"),t=await a(e.commandArgs);await o(t)}case"desktop":{let{runDesktop:a}=await import("./chunks/desktop-S3FG72AK.js");await a(e.commandArgs,{port:n,device:l});break}case"login":{let{runLogin:a}=await import("./chunks/login-FJ737MWG.js");await a(e.commandArgs);break}case"logout":{let{runLogout:a}=await import("./chunks/logout-ZCNMMHMY.js");await a();break}case"auth":{let{runAuth:a}=await import("./chunks/auth-FI5UDI45.js");await a(e.commandArgs);break}case"setup":{let{runSetup:a}=await import("./chunks/setup-7DWPMRSB.js");await a(e.commandArgs);break}case"serve":{let{runServe:a}=await import("./chunks/serve-BI2NBAXG.js");await a(e.commandArgs,{port:n});break}case"daemon":{let{runDaemon:a}=await import("./chunks/daemon-G2ME7NLB.js");await a(e.commandArgs,{port:n});break}case"runtime":{let{runRuntime:a}=await import("./chunks/runtime-XOAXMSTU.js");await a(e.commandArgs);break}case"upgrade":case"update":{let{runUpgrade:a}=await import("./chunks/upgrade-7HDSIM7K.js");await a(e.commandArgs);break}case"version":{let{runVersion:a}=await import("./chunks/version-HOCHZ37L.js");await a(e.commandArgs);break}case"agent":{let{runAgentCommand:a}=await import("./chunks/agent-XZ2KTPCU.js"),t=await a(e.commandArgs);await o(t)}case"agent-wrapper":{let{runAgentWrapper:a}=await import("./chunks/agent-wrapper-JJYYW2WH.js"),t=await a(e.commandArgs);await o(t)}case"skill":{let{runSkill:a}=await import("./chunks/skills-S3Y22TUA.js");await a(e.commandArgs);break}case"app-fonts":{let{runAppFonts:a}=await import("./chunks/app-fonts-IXRNQG6B.js");await a(e.commandArgs);break}case"config":{let{runConfig:a}=await import("./chunks/config-XMJRNM2A.js");await a(e.commandArgs);break}case"cleanup":{let{runCleanup:a}=await import("./chunks/cleanup-P27PA6JI.js"),t=await a(e.commandArgs);await o(t)}default:console.error(` unknown command: ${i}`),console.error(" run `rnxsim --help` to see the full surface."),await o(1)}await k();
@@ -0,0 +1,48 @@
1
+ /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import{a as b,b as E,c as A,d as l,e as S,g as x,h as j,j as T,n as I,o as k,p as D,q as g,r as O,s as C}from"./chunk-TZFFR3SD.js";import"./chunk-5YJCOWCH.js";import{c as $}from"./chunk-WMIIKMGK.js";import"./chunk-TIVZIMMW.js";import"./chunk-VNQEB4L7.js";import"./chunk-UC6U3MML.js";import"./chunk-2YR5BGA5.js";import"./chunk-4NPPOV2N.js";import"./chunk-IJ5CAZZC.js";import"./chunk-ZMJD5GEC.js";import{j as y}from"./chunk-FSUYIVJ6.js";import"./chunk-3NV2NCNX.js";import"./chunk-2D2UPBBR.js";import"./chunk-46EUUFJ5.js";import"./chunk-WINYQ44O.js";import w from"node:fs";import d from"node:path";import{spawn as _}from"node:child_process";import F from"node:net";import{WebSocket as R}from"ws";var c=class extends Error{code;constructor(e,t){super(e),this.name="AgentDaemonError",this.code=t}},f=class{ws;port;commandTimeoutMs;ready;closed=!1;nextId=1;pending=new Map;eventListeners=new Set;statusListeners=new Set;disconnectListeners=new Set;constructor(e={}){this.port=e.port??7668,this.commandTimeoutMs=e.commandTimeoutMs??15e3,this.ws=new R(`ws://localhost:${this.port}`),this.ready=new Promise((t,r)=>{let s=()=>{this.ws.off("error",o),t()},o=i=>{this.ws.off("open",s),r(new c(`could not connect to rnx daemon on port ${this.port}: ${i.message}`,"NO_DAEMON"))};this.ws.once("open",s),this.ws.once("error",o)}),this.ws.on("message",t=>this.handleMessage(t)),this.ws.on("close",()=>this.handleClose()),this.ws.on("error",()=>{})}async waitReady(){return this.ready}async listProjects(){return this.send("agent:list-projects")}async upsertProject(e){return this.send("agent:upsert-project",{input:e})}async deleteProject(e){return this.send("agent:delete-project",{projectId:e})}async autoAttachForUrl(e){return this.send("agent:auto-attach-for-url",{input:e})}async listSessions(e){return this.send("agent:list-sessions",{projectId:e})}async startSession(e){return this.send("agent:start-session",{input:e})}async sendPrompt(e,t){return this.send("agent:send-prompt",{sessionId:e,prompt:t})}async sendClaimedPrompt(e,t){return this.send("agent:send-claimed-prompt",{simId:e,prompt:t})}async endSession(e){return this.send("agent:end-session",{sessionId:e})}async getTranscript(e){return this.send("agent:get-transcript",{sessionId:e})}async getPaths(){return this.send("agent:get-paths")}async subscribeEvents(e){return this.send("agent:subscribe-events",{sessionId:e})}async unsubscribeEvents(e){return this.send("agent:unsubscribe-events",{sessionId:e})}onAgentEvent(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}onSessionStatusChange(e){return this.statusListeners.add(e),()=>this.statusListeners.delete(e)}onDisconnect(e){return this.disconnectListeners.add(e),()=>this.disconnectListeners.delete(e)}close(){if(!this.closed){this.closed=!0;try{this.ws.close()}catch{}}}async send(e,t={}){if(await this.ready,this.closed||this.ws.readyState!==R.OPEN)throw new c("daemon connection is closed","NO_DAEMON");let r=this.nextId++;return new Promise((s,o)=>{let i=setTimeout(()=>{this.pending.delete(r),o(new c(`${e} timed out after ${Math.round(this.commandTimeoutMs/1e3)}s`,"TIMEOUT"))},this.commandTimeoutMs);this.pending.set(r,{resolve:s,reject:o,timer:i});try{this.ws.send(JSON.stringify({id:r,type:e,...t}))}catch(a){clearTimeout(i),this.pending.delete(r),o(a instanceof Error?a:new Error(String(a)))}})}handleMessage(e){let t;try{t=JSON.parse(String(e))}catch{return}if(!t||typeof t!="object")return;if(t.type==="agent:event"){for(let s of this.eventListeners)try{s({sessionId:t.sessionId,event:t.event})}catch{}return}if(t.type==="agent:session-status"){for(let s of this.statusListeners)try{s(t.session)}catch{}return}if(typeof t.id!="number")return;let r=this.pending.get(t.id);r&&(this.pending.delete(t.id),clearTimeout(r.timer),t.error?r.reject(new c(t.error,t.code)):r.resolve(t.result))}handleClose(){if(!this.closed){this.closed=!0;for(let[,e]of this.pending)clearTimeout(e.timer),e.reject(new c("daemon disconnected","DISCONNECT"));this.pending.clear();for(let e of this.disconnectListeners)try{e()}catch{}}}};function M(n=7668,e=400){return new Promise(t=>{let r=new F.Socket,s=!1,o=i=>{s||(s=!0,r.destroy(),t(i))};r.setTimeout(e),r.once("connect",()=>o(!0)),r.once("timeout",()=>o(!1)),r.once("error",()=>o(!1)),r.connect(n,"127.0.0.1")})}async function B(n={}){let e=n.port??7668;if(await M(e))return{alreadyRunning:!0};if(y())throw new c(`no rnx bridge on port ${e}. run \`rnxsim setup\` to install the background daemon, or \`rnxsim serve\` in another shell.`,"DEV_HOST_REFUSED");let{cmd:t,prefixArgs:r}=C(),s=[...r,"serve","--quiet"];e!==7668&&s.push("--port",String(e));let o=_(t,s,{detached:!0,stdio:"ignore",env:process.env,cwd:process.cwd()});o.unref();let i=Date.now()+(n.startupTimeoutMs??5e3);for(;Date.now()<i;){if(await M(e))return{alreadyRunning:!1,pid:o.pid};await new Promise(a=>setTimeout(a,100))}throw new c(`spawned rnx daemon on port ${e} but it did not come up in time. run \`rnxsim serve\` manually to diagnose.`,"SPAWN_TIMEOUT")}async function h(n={}){await B({port:n.port,startupTimeoutMs:n.startupTimeoutMs});let e=new f(n);try{await e.waitReady()}catch(t){throw e.close(),t}return e}async function ge(n){let[e,...t]=n;try{switch(e){case void 0:case"--help":case"-h":case"help":return L(),0;case"attach":return await W(t);case"projects":return await J();case"project":return await V(t);case"sessions":return await H(t);case"start":return await G(t);case"prompt":return await q(t);case"watch":return await K(t);case"transcript":return await z(t);case"end":return await Q(t);case"paths":return await Y();default:return process.stderr.write(`unknown agent subcommand: ${e}
5
+ `),L(),2}}catch(r){if(r instanceof c)return process.stderr.write(`${r.message}
6
+ `),1;throw r}}async function v(n){let e=await h({clientLabel:"sootsim-agent-cli"});try{return await n(e)}finally{e.close()}}function L(){$("agent")}function P(n,e){let t={},r=[];for(let s=0;s<n.length;s++){let o=n[s],i=e[o];i==="value"?(t[o]=n[s+1]??"",s++):i==="bool"?t[o]=!0:r.push(o)}return{flags:t,positional:r}}function U(n,e="codex"){return n==="codex"||n==="claude"?n:e}async function W(n){let{flags:e,positional:t}=P(n,{"--name":"value","--provider":"value"}),r=t[0];if(!r)return process.stderr.write(`usage: rnxsim agent attach <dir> [--name X] [--provider codex|claude]
7
+ `),2;let s=d.resolve(r);if(!w.existsSync(s))return process.stderr.write(`directory does not exist: ${s}
8
+ `),1;let o=A({cwd:s,name:e["--name"]||d.basename(s),preferredProvider:U(e["--provider"]),sourceRoots:[s]});return process.stdout.write(`\u2713 attached "${o.name}" (id: ${o.id})
9
+ cwd: ${o.cwd}
10
+ framework: ${o.framework}
11
+ preferred provider: ${o.preferredProvider}
12
+ `),0}async function J(){let n=[...S()].sort((t,r)=>r.updatedAt-t.updatedAt);if(n.length===0)return process.stdout.write("no attached projects yet. try `rnxsim agent attach <dir>`.\n"),0;let e=`${"ID".padEnd(18)} ${"NAME".padEnd(20)} ${"FRAMEWORK".padEnd(10)} ${"PROVIDER".padEnd(8)} ${"7D COST".padEnd(10)} CWD
13
+ `;process.stdout.write(e);for(let t of n){let r=x(t),s=r>0?`$${r.toFixed(2)}`:"\u2014";process.stdout.write(`${t.id.padEnd(18)} ${p(t.name,20).padEnd(20)} ${t.framework.padEnd(10)} ${t.preferredProvider.padEnd(8)} ${s.padEnd(10)} ${t.cwd}
14
+ `)}return 0}async function V(n){let[e,t]=n;if(e==="show"){if(!t)return process.stderr.write(`usage: rnxsim agent project show <id>
15
+ `),2;let r=l(t);return r?(process.stdout.write(JSON.stringify(r,null,2)+`
16
+ `),0):(process.stderr.write(`no project with id=${t}
17
+ `),1)}return e==="remove"?t?(j(t),process.stdout.write(`\u2713 removed project ${t}
18
+ `),0):(process.stderr.write(`usage: rnxsim agent project remove <id>
19
+ `),2):(process.stderr.write(`usage: rnxsim agent project [show|remove] <id>
20
+ `),2)}async function H(n){let{flags:e}=P(n,{"--project":"value","--all":"bool"}),t=e["--project"]||void 0,r=e["--all"]===!0,s=T(t);if(r||(s=s.filter(i=>i.status!=="ended")),s=s.sort((i,a)=>a.lastSeenAt-i.lastSeenAt),s.length===0)return process.stdout.write(r?`no sessions.
21
+ `:`no active sessions. pass --all to include ended.
22
+ `),0;let o=`${"SESSION".padEnd(26)} ${"PROJECT".padEnd(18)} ${"PROVIDER".padEnd(8)} ${"STATUS".padEnd(16)} ${"ALIVE".padEnd(5)} LAST PROMPT
23
+ `;process.stdout.write(o);for(let i of s){let a=O(i.wrapperPid,i.id)?"yes":"no",m=i.lastPrompt?p(i.lastPrompt,40):"";process.stdout.write(`${N(i.id).padEnd(26)} ${N(i.projectId).padEnd(18)} ${i.provider.padEnd(8)} ${i.status.padEnd(16)} ${a.padEnd(5)} ${m}
24
+ `)}return 0}async function G(n){let{flags:e,positional:t}=P(n,{"--provider":"value","--codex-bin":"value","--claude-bin":"value","--fresh-thread":"bool"}),r=t[0];if(!r)return process.stderr.write(`usage: rnxsim agent start <projectId> [--provider codex|claude] [--fresh-thread]
25
+ `),2;let s=await v(i=>i.startSession({projectId:r,provider:U(e["--provider"],void 0)||void 0,codexBin:e["--codex-bin"]||void 0,claudeBin:e["--claude-bin"]||void 0,freshThread:e["--fresh-thread"]===!0})),o=l(s.session.projectId);return process.stdout.write(`\u2713 session ${s.session.id} started
26
+ project: ${o.name} (${o.id})
27
+ provider: ${s.session.provider}
28
+ pid: ${s.wrapperPid}
29
+ prompt with: rnxsim agent prompt ${s.session.id} "<text>"
30
+ watch events: rnxsim agent watch ${s.session.id}
31
+ `),0}async function q(n){let[e,...t]=n,r=t.join(" ");return!e||!r?(process.stderr.write(`usage: rnxsim agent prompt <sessionId> "<text>"
32
+ `),2):(await v(s=>s.sendPrompt(e,{text:r})),process.stdout.write(`\u2713 prompt sent to ${e}
33
+ `),0)}async function K(n){let e=n[0];if(!e)return process.stderr.write(`usage: rnxsim agent watch <sessionId>
34
+ `),2;process.stdout.write(`watching ${e}
35
+ ---
36
+ `);let t=await h({clientLabel:"sootsim-agent-watch"}),r,s=new Promise(a=>{r=a}),o=t.onAgentEvent(({sessionId:a,event:m})=>{a===e&&process.stdout.write(X(m)+`
37
+ `)}),i=t.onDisconnect(()=>{process.stderr.write(`
38
+ [rnx] daemon disconnected; exiting watch.
39
+ `),r(1)});try{await t.subscribeEvents(e)}catch(a){throw o(),i(),t.close(),a}return process.on("SIGINT",()=>{o(),i(),t.unsubscribeEvents(e).catch(()=>{}),t.close(),r(130)}),s}function X(n){let e=Z(n.ts);switch(n.type){case"ready":return`[${e}] ready ${n.provider} @ ${n.cwd}`;case"prompt-received":return`[${e}] prompt "${p(n.text,120)}"`;case"turn-started":return`[${e}] turn-started ${n.turnId??""}`;case"turn-message":return`[${e}] turn-message ${n.delta.replace(/\s+$/,"")}`;case"turn-reasoning":return`[${e}] turn-reasoning ${p(n.delta,200)}`;case"tool-call":return`[${e}] tool-call ${n.name}`;case"file-edited":return`[${e}] file-edited ${n.kind.padEnd(6)} ${n.path}`;case"turn-completed":return`[${e}] turn-completed ${n.durationMs}ms files=${n.filesTouched.length}`;case"approval-needed":return`[${e}] approval ${n.kind}`;case"error":return`[${e}] error ${n.message}`;case"exited":return`[${e}] exited code=${n.code}`;case"file-diff-delta":return`[${e}] file-diff-delta ${n.path}`;case"turn-plan":return`[${e}] turn-plan steps=${n.steps.length}`;default:return`[${e}] ${n.type}`}}async function z(n){let e=n[0];if(!e)return process.stderr.write(`usage: rnxsim agent transcript <sessionId>
40
+ `),2;let t=g(e);return w.existsSync(t)?(process.stdout.write(w.readFileSync(t,"utf8")),0):(process.stderr.write(`transcript not found: ${t}
41
+ `),1)}async function Q(n){let e=n[0];return e?(await v(t=>t.endSession(e)),process.stdout.write(`\u2713 ended session ${e}
42
+ `),0):(process.stderr.write(`usage: rnxsim agent end <sessionId>
43
+ `),2)}async function Y(){let n=E();return process.stdout.write(`userData: ${n}
44
+ state: ${d.join(n,"attached-projects.json")}
45
+ sessions: ${d.join(n,"sessions")}
46
+ transcripts: ${d.join(n,"transcripts")}
47
+ locks: ${d.join(n,"locks")}
48
+ `),0}function p(n,e){return n.length<=e?n:n.slice(0,e-1)+"\u2026"}function N(n){return n.length>14?`${n.slice(0,14)}\u2026`:n}function Z(n){return new Date(n).toISOString().replace("T"," ").slice(0,19)}var fe={sessionDir:I,promptFifoPath:k,eventsFifoPath:D,transcriptPath:g,parseAgentEventLine:b};export{fe as __internals,ge as runAgentCommand};
@@ -0,0 +1,17 @@
1
+ /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import{b as M}from"./chunk-5YJCOWCH.js";import"./chunk-WINYQ44O.js";import{execFile as G,spawn as q}from"node:child_process";import{randomUUID as X}from"node:crypto";import{constants as R,createReadStream as Y,createWriteStream as j,existsSync as C,openSync as J}from"node:fs";import V from"node:fs/promises";import z from"node:path";import K from"node:readline";import{promisify as Q}from"node:util";import{spawn as H}from"node:child_process";import L from"node:readline";var b=class extends Error{code;data;constructor(t,r,m){super(t),this.name="CodexRpcError",this.code=r,this.data=m}};function W(d){let t=H(d.bin,["app-server"],{cwd:d.cwd,env:{...process.env,...d.env},stdio:["pipe","pipe","pipe"]}),r=new Map,m=new Map,u=1,f=!1,a=new Promise(s=>{t.on("exit",(o,e)=>{f=!0;let p=new Error(`codex app-server exited (code=${o}, signal=${e??""})`);for(let{reject:y}of r.values())y(p);r.clear(),s({code:o,signal:e})})});L.createInterface({input:t.stdout,crlfDelay:1/0}).on("line",s=>{let o=s.trim();if(!o)return;let e;try{e=JSON.parse(o)}catch{return}if(e.id!=null&&(e.result!==void 0||e.error!==void 0)){let p=typeof e.id=="string"?Number(e.id):e.id,y=p!=null?r.get(p):void 0;if(!y)return;r.delete(p),e.error?y.reject(new b(e.error.message,e.error.code,e.error.data)):y.resolve(e.result);return}if(e.method){let p=m.get(e.method);if(!p)return;for(let y of p)try{y(e.params)}catch(l){console.error(`[codex-client] handler for "${e.method}" threw:`,l instanceof Error?l.stack??l.message:l)}}}),t.stderr.setEncoding("utf8"),t.stderr.on("data",s=>{let o=m.get("__stderr__");if(o)for(let e of o)try{e({text:s})}catch{}});function n(s){if(!f)try{t.stdin.write(JSON.stringify(s)+`
5
+ `)}catch{}}return{exited:a,on(s,o){let e=m.get(s);return e||(e=new Set,m.set(s,e)),e.add(o),()=>{e?.delete(o)}},request(s,o){if(f)return Promise.reject(new Error(`codex app-server closed; cannot call ${s}`));let e=u++;return new Promise((p,y)=>{r.set(e,{resolve:l=>p(l),reject:y,method:s}),n({jsonrpc:"2.0",id:e,method:s,params:o})})},notify(s,o){n({jsonrpc:"2.0",method:s,params:o})},async shutdown(s=1500){if(f)return;try{t.stdin.end()}catch{}let o=setTimeout(()=>{if(!f)try{t.kill("SIGTERM")}catch{}},s);try{await a}finally{clearTimeout(o)}},kill(s="SIGTERM"){if(!f)try{t.kill(s)}catch{}}}}var O="never",F="danger-full-access",Z={type:"dangerFullAccess"},D="fast",ee="medium",te=Q(G);async function ne(d,t){let r=t||d;if(r.includes("/")||r.includes("\\"))return C(r)?{ok:!0,path:r}:{ok:!1,message:`agent binary not found at path: ${r}`};try{let{stdout:m}=await te("which",[r],{timeout:1500}),u=m.trim();return u?{ok:!0,path:u}:{ok:!1,message:`${r} not found on PATH`}}catch{return{ok:!1,message:`${r} not found on PATH. install the ${d} CLI and retry, or pass --${d}-bin /path/to/${d} to agent start.`}}}function re(d){let t={"--session-id":"sessionId","--project-id":"projectId","--provider":"provider","--cwd":"cwd","--prompt-in":"promptIn","--events-out":"eventsOut","--transcript":"transcript","--codex-bin":"codexBin","--claude-bin":"claudeBin","--claude-session-uuid":"claudeSessionUuid"},r={};for(let m=0;m<d.length;m++){let u=d[m];if(u==="--fresh-thread"){r.freshThread=!0;continue}let f=t[u];f&&(r[f]=d[m+1],m++)}return r}async function Ie(d){let t=re(d);if(!t.sessionId||!t.projectId||!t.provider||!t.cwd||!t.promptIn||!t.eventsOut)return process.stderr.write(`usage: rnxsim agent-wrapper --session-id <id> --project-id <id>
6
+ --provider codex|claude --cwd <path>
7
+ --prompt-in <fifo> --events-out <fifo>
8
+ [--transcript <file>]
9
+ [--codex-bin <path>] [--claude-bin <path>]
10
+ `),2;if(t.provider!=="codex"&&t.provider!=="claude")return process.stderr.write(`unknown provider: ${t.provider}
11
+ `),2;let{sessionId:r,projectId:m,cwd:u,promptIn:f,eventsOut:a}=t,c=t.provider;if(!C(a))return process.stderr.write(`events-out FIFO missing: ${a}
12
+ `),3;if(!C(f))return process.stderr.write(`prompt-in FIFO missing: ${f}
13
+ `),3;let n=J(a,R.O_RDWR|R.O_APPEND),s=j(a,{fd:n,flags:"a"});function o(i){let g=JSON.stringify({ts:Date.now(),...i})+`
14
+ `;s.write(g)}let e=null;if(t.transcript)try{await V.mkdir(z.dirname(t.transcript),{recursive:!0}),e=j(t.transcript,{flags:"a"})}catch(i){o({type:"error",message:`transcript open failed: ${i.message}`})}s.on("error",i=>{let g=`[events-out] stream error: ${i.message}
15
+ `;try{e?e.write(g):process.stderr.write(g)}catch{}});let p=await ne(c,c==="codex"?t.codexBin:t.claudeBin);if(!p.ok)return o({type:"error",message:p.message}),await new Promise(i=>setTimeout(i,50)),s.end(),4;let y=p.path,l=null,x=null;if(c==="codex")try{l=W({bin:y,cwd:u,env:{SOOTSIM_CLI_IDENTITY:r,SOOTSIM_PROJECT_ID:m}}),l.on("__stderr__",i=>{let g=i?.text;g&&e?.write(`[codex-stderr] ${g}`)}),l.exited.then(({code:i,signal:g})=>{v||(o({type:"error",message:`codex app-server exited (code=${i}, signal=${g??""})`}),w(5))}),await ce((async()=>{await l.request("initialize",{clientInfo:{name:"sootsim",title:null,version:"0.1.0"},capabilities:null}),x=await ie(l,u,{fresh:t.freshThread===!0})})(),3e4,"codex app-server boot timed out after 30s")}catch(i){let g=i instanceof Error?i.message:String(i);o({type:"error",message:`codex app-server init failed: ${g}`});try{l?.kill()}catch{}return s.end(),4}o({type:"ready",sessionId:r,projectId:m,provider:c,cwd:u});let T=!1,I=null,S=[],{promise:h,resolve:E}=$(),v=!1;function w(i,g=!0){if(!v){v=!0,clearInterval(P);try{I?.kill("SIGTERM")}catch{}try{l?.shutdown(800)}catch{}g&&o({type:"exited",code:i}),s.end(()=>{try{e?.end()}catch{}E(i)}),setTimeout(()=>E(i),1500).unref()}}let _=(()=>{let i=Number(process.env.SOOTSIM_WRAPPER_WATCHDOG_MS);return Number.isFinite(i)&&i>0?i:1e4})(),P=setInterval(()=>{if(v)return;let i=C(a),g=C(f);(!i||!g)&&(process.stderr.write(`[wrapper] session fifos gone (eventsOut=${i} promptIn=${g}), exiting
16
+ `),w(0,i))},_);P.unref(),process.on("SIGTERM",()=>w(143)),process.on("SIGINT",()=>w(130)),process.on("SIGHUP",()=>w(129)),process.on("uncaughtException",i=>{o({type:"error",message:`uncaught: ${i.message}`}),w(1)});let B=c==="codex"&&l?oe({client:l,getThreadId:()=>x,setThreadId:i=>x=i,emit:o,transcript:e,onTurnSettled:()=>{T=!1;let i=S.shift();i&&k(i)}}):de({resolvedBin:y,sessionId:r,projectId:m,claudeSessionUuid:t.claudeSessionUuid??X(),cwd:u,emit:o,transcript:e,setChild:i=>I=i,onTurnSettled:()=>{T=!1;let i=S.shift();i&&k(i)}});async function k(i){T=!0;try{await B(i)}catch(g){o({type:"error",message:`turn failed: ${g.message}`}),T=!1;let A=S.shift();A&&k(A)}}let U=J(f,R.O_RDWR),N=Y("",{fd:U,autoClose:!1});return K.createInterface({input:N,crlfDelay:1/0}).on("line",i=>{let g=M(i);if(!g)return;let A=g.text;if(o({type:"prompt-received",text:g.displayText??A,...g.inspectSummary?{inspectSummary:g.inspectSummary}:{},...g.inspectTrace?{inspectTrace:g.inspectTrace}:{}}),T){S.push(A);return}k(A)}),N.on("error",i=>{o({type:"error",message:`prompt-in read failed: ${i.message}`})}),h}function se(d){return d?.threadId??d?.thread?.id??null}async function ie(d,t,r={}){if(!r.fresh)try{let a=(await d.request("thread/list",{cwd:t,limit:1,archived:!1}))?.threads?.[0]?.id;if(a)try{return await d.request("thread/resume",{threadId:a,persistExtendedHistory:!1,approvalPolicy:O,sandbox:F,serviceTier:D}),a}catch{}}catch{}let m=await d.request("thread/start",{cwd:t,experimentalRawEvents:!1,persistExtendedHistory:!1,approvalPolicy:O,sandbox:F,serviceTier:D}),u=se(m);if(!u)throw new Error("thread/start returned no threadId");return u}function oe(d){let{client:t,emit:r,transcript:m}=d,u=new Map,f=null;return t.on("turn/started",a=>{let n=a?.turn?.id;if(!n)return;f=n;let s=u.get(n)??{started:Date.now(),resolve:()=>{},filesTouched:new Set,pendingEmit:""};u.has(n)||u.set(n,s),r({type:"turn-started",turnId:n})}),t.on("item/agentMessage/delta",a=>{let c=a;c?.delta&&(m?.write(c.delta),r({type:"turn-message",delta:c.delta}))}),t.on("item/reasoning/textDelta",a=>{let c=a;c?.delta&&r({type:"turn-reasoning",delta:c.delta})}),t.on("item/reasoning/summaryTextDelta",a=>{let c=a;c?.delta&&r({type:"turn-reasoning",delta:c.delta})}),t.on("turn/plan/updated",a=>{let c=a;Array.isArray(c?.plan)&&r({type:"turn-plan",steps:c.plan.map((n,s)=>({id:String(s),title:n.step,status:n.status}))})}),t.on("item/started",a=>{let n=a?.item;n&&(n.type==="commandExecution"&&n.command?r({type:"tool-call",name:"commandExecution",args:{command:n.command}}):(n.type==="mcpToolCall"||n.type==="dynamicToolCall")&&r({type:"tool-call",name:n.tool??n.type,args:{}}))}),t.on("item/completed",a=>{let c=a,n=c?.item;if(!n||n.type!=="fileChange"||n.status!=="completed"||!Array.isArray(n.changes))return;let s=c?.turnId,o=s?u.get(s):null;for(let e of n.changes){let p=e.kind?.type,y=p==="add"?"add":p==="delete"?"delete":"modify";r({type:"file-edited",path:e.path,kind:y,diff:e.diff}),o?.filesTouched.add(e.path);let l=e.kind?.move_path;l&&l!==e.path&&o?.filesTouched.add(l)}}),t.on("turn/completed",a=>{let c=a,n=c?.turn?.id;if(!n)return;let s=u.get(n),o=s?Array.from(s.filesTouched):[],e=c.turn?.durationMs??(s?Date.now()-s.started:0);r({type:"turn-completed",turnId:n,filesTouched:o,durationMs:e}),s?.resolve(),u.delete(n)}),t.on("error",a=>{let c=a,n=c?.error?.message??"codex reported an error";r({type:"error",message:n}),c.turnId&&(u.get(c.turnId)?.resolve(),u.delete(c.turnId))}),async function(c){let n=d.getThreadId();if(!n){r({type:"error",message:"no active codex thread"}),d.onTurnSettled();return}let{promise:s,resolve:o}=$(),e=`pending-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;u.set(e,{started:Date.now(),resolve:o,filesTouched:new Set,pendingEmit:""});try{let l=(await t.request("turn/start",{threadId:n,input:[{type:"text",text:c,text_elements:[]}],approvalPolicy:O,sandboxPolicy:Z,serviceTier:D,effort:ee}))?.turn?.id??f;if(l&&l!==e){let x=u.get(e);if(x){u.delete(e);let T=u.get(l);if(T){for(let I of x.filesTouched)T.filesTouched.add(I);T.resolve=x.resolve}else u.set(l,x)}}}catch(y){u.delete(e);let l=y instanceof Error?y.message:String(y);r({type:"error",message:`turn/start failed: ${l}`}),r({type:"turn-completed",filesTouched:[],durationMs:0}),d.onTurnSettled();return}let p=setTimeout(()=>o(),600*1e3).unref();try{await s}finally{clearTimeout(p),d.onTurnSettled()}}}var ae=new Set(["Edit","Write","MultiEdit","NotebookEdit"]);function de(d){return async function(r){let{resolvedBin:m,sessionId:u,projectId:f,claudeSessionUuid:a,cwd:c,emit:n,transcript:s,setChild:o}=d,e=Date.now();n({type:"turn-started"});let p=q(m,["--print","--output-format","stream-json","--verbose","--permission-mode","bypassPermissions","--session-id",a,r],{cwd:c,stdio:["ignore","pipe","pipe"],env:{...process.env,SOOTSIM_CLI_IDENTITY:u,SOOTSIM_PROJECT_ID:f}});o(p);let y=new Set,l=!1;function x(h){let E=h.type;if(E){if(E==="assistant"&&Array.isArray(h.message?.content)){for(let v of h.message.content)if(v.type==="text"&&v.text)s?.write(v.text),n({type:"turn-message",delta:v.text});else if(v.type==="tool_use"&&v.name){n({type:"tool-call",name:v.name,args:v.input??{}});let w=v.input?.file_path??v.input?.path;typeof w=="string"&&ae.has(v.name)&&(y.add(w),n({type:"file-edited",path:w,kind:"modify"}))}}else if(E==="result"){if(l=!0,Array.isArray(h.permission_denials))for(let v of h.permission_denials)n({type:"approval-needed",kind:v.tool_name??"unknown",detail:v.tool_input??null});h.is_error&&typeof h.result=="string"&&n({type:"error",message:h.result}),n({type:"turn-completed",filesTouched:Array.from(y),durationMs:h.duration_ms??Date.now()-e,costUsd:h.is_error?void 0:h.total_cost_usd})}}}let T="";p.stdout?.setEncoding("utf8"),p.stdout?.on("data",h=>{T+=h;let E;for(;(E=T.indexOf(`
17
+ `))>=0;){let v=T.slice(0,E);T=T.slice(E+1);let w=v.trim();if(!w)continue;let _;try{_=JSON.parse(w)}catch{continue}try{x(_)}catch(P){n({type:"error",message:`claude event handler failed: ${P.message}`})}}}),p.stderr?.setEncoding("utf8"),p.stderr?.on("data",h=>{s?.write(`[claude-stderr] ${h}`)}),p.on("error",h=>{n({type:"error",message:`spawn failed: ${h.message}`})});let{promise:I,resolve:S}=$();p.on("exit",h=>{l||(n({type:"turn-completed",filesTouched:Array.from(y),durationMs:Date.now()-e}),h!==0&&h!==null&&n({type:"error",message:`claude exited with code ${h}`})),o(null),S()});try{await I}finally{d.onTurnSettled()}}}function $(){let d;return{promise:new Promise(r=>{d=r}),resolve:d}}function ce(d,t,r){return new Promise((m,u)=>{let f=setTimeout(()=>u(new Error(r)),t);d.then(a=>{clearTimeout(f),m(a)},a=>{clearTimeout(f),u(a instanceof Error?a:new Error(String(a)))})})}export{se as extractCodexThreadId,Ie as runAgentWrapper};
@@ -0,0 +1,4 @@
1
+ /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import{k as p}from"./chunk-WF3T4SVI.js";import"./chunk-DZS6WPUI.js";import"./chunk-YDGQTMQL.js";import"./chunk-WINYQ44O.js";import{existsSync as h,mkdirSync as d,readFileSync as y,writeFileSync as g}from"node:fs";import{join as m}from"node:path";import{gzipSync as w}from"node:zlib";function f(t,e){let o=t.indexOf(`--${e}`);if(o!==-1&&o+1<t.length)return t[o+1];let i=t.find(r=>r.startsWith(`--${e}=`));return i?i.slice(e.length+3):void 0}async function x(t){let e=f(t,"wire")||"",o=f(t,"out-dir"),i=f(t,"manifest");if((!o||!i)&&(console.error(" usage: rnxsim app-fonts stage --wire <wire> --out-dir <dir> --manifest <path>"),process.exit(1)),!e.trim()){console.log("no app fonts declared \u2014 nothing to stage");return}d(o,{recursive:!0});let r=await p(e,{onStaged:({url:n,byteLength:s})=>console.log(` staged app font: ${n} (${(s/1024).toFixed(1)} KiB)`),onError:(n,s)=>console.error(` warning: failed to fetch app font ${n}: ${s instanceof Error?s.message:s}`)}),a=[];for(let n of r){let s=w(n.bytes);g(m(o,n.urlhash),s),a.push({url:n.url,urlhash:n.urlhash,contentType:n.contentType,encoding:"gzip",sizeBytes:s.length,rawBytes:n.bytes.byteLength})}let c=[];if(h(i))try{let n=JSON.parse(y(i,"utf8"));Array.isArray(n)&&(c=n)}catch{}let u=new Set(c.map(n=>n.urlhash)),l=[...c,...a.filter(n=>!u.has(n.urlhash))];g(i,JSON.stringify(l)),console.log(`staged ${a.length} app font(s); manifest now has ${l.length} file(s)`)}async function E(t){let e=t[0];if(e==="stage"){await x(t.slice(1));return}console.error(` unknown app-fonts subcommand: ${e??"(none)"}`),console.error(" available: stage"),process.exit(1)}export{E as runAppFonts};
@@ -0,0 +1,49 @@
1
+ /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import"./chunk-WINYQ44O.js";import{spawn as v}from"child_process";var w=new Set(["describe","find","list","network","logs","count","tree","url","a11y","node","layout","keyboard","errors","warnings","requests","animations","animation","state","sample-color"]),S=new Set(["--exists","--empty","--negate","--quiet","--allow-timeout","!"]),q=new Set(["--count","--count-at-least","--count-at-most","--contains","--not-contains","--matches","--not-matches","--equals","--jq","--has-path","--within"]),P=new Set(["--path-equals"]);function j(s){let r=[],u=[],n=0,e=!1,t=!1,i=!1;for(let o=0;o<s.length;o++){let a=s[o];if(a==="--within"){let c=Number(s[o+1]);if(!Number.isFinite(c)||c<0)return{error:`--within requires a non-negative number, got: ${s[o+1]}`};n=c,o++;continue}if(a==="--negate"||a==="!"){e=!0;continue}if(a==="--quiet"){t=!0;continue}if(a==="--allow-timeout"){i=!0;continue}if(S.has(a)){u.push({kind:a,args:[]});continue}if(q.has(a)){let c=s[o+1];if(c==null)return{error:`${a} requires a value`};u.push({kind:a,args:[c]}),o++;continue}if(P.has(a)){let c=s[o+1],f=s[o+2];if(c==null||f==null)return{error:`${a} requires <path> <value>`};u.push({kind:a,args:[c,f]}),o+=2;continue}r.push(a)}return r.length===0?{error:"assert requires a verb (e.g. find, describe, get errors)"}:{verbArgs:r,predicates:u,withinMs:n,negate:e,quiet:t,allowTimeout:i}}function N(s){return s[0]==="get"||s[0]==="debug"?w.has(s[1])?s[1]:null:s[0]==="do"||s[0]==="wait"?null:w.has(s[0])?s[0]:null}async function R(s){let u=[process.argv[1],...s,"--json"];return new Promise(n=>{let e=v(process.execPath,u,{stdio:["ignore","pipe","pipe"],env:process.env}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",o=>{n({ok:!1,payload:null,reason:`spawn failed: ${o.message}`})}),e.on("close",o=>{if(o!==0){let a=i.trim().split(`
5
+ `).slice(-2).join(" | ").slice(0,200);n({ok:!1,payload:null,reason:`verb exited ${o}${a?`: ${a}`:""}`});return}if(!t.trim()){n({ok:!1,payload:null,reason:"verb produced no output"});return}try{let a=JSON.parse(t);n({ok:!0,payload:a})}catch{n({ok:!1,payload:null,reason:`verb output was not valid json: ${t.slice(0,120)}`})}})})}function y(s,r){let u=r.split(".").filter(e=>e.length>0),n=s;for(let e of u){if(n==null)return{found:!1};if(Array.isArray(n)){let t=Number(e);if(!Number.isInteger(t)||t<0||t>=n.length)return{found:!1};n=n[t];continue}if(typeof n=="object"){let t=n;if(!(e in t))return{found:!1};n=t[e];continue}return{found:!1}}return{found:!0,value:n}}function d(s){return Array.isArray(s)?s.length:s&&typeof s=="object"?Object.keys(s).length:null}async function A(s,r){let{kind:u,args:n}=s;switch(u){case"--exists":return r==null?{ok:!1,reason:"payload is null"}:d(r)===0?{ok:!1,reason:"payload is empty"}:{ok:!0,reason:"exists"};case"--empty":{if(r==null)return{ok:!0,reason:"payload is null"};let e=d(r);return e===0?{ok:!0,reason:"payload is empty"}:{ok:!1,reason:`payload has ${e} item(s)`}}case"--count":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:`payload not countable (${typeof r})`}:{ok:t===e,reason:`count=${t}, want=${e}`}}case"--count-at-least":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:"payload not countable"}:{ok:t>=e,reason:`count=${t}, want>=${e}`}}case"--count-at-most":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:"payload not countable"}:{ok:t<=e,reason:`count=${t}, want<=${e}`}}case"--contains":{let e=n[0],t=JSON.stringify(r);return{ok:t.includes(e),reason:t.includes(e)?`contains "${e}"`:`missing "${e}"`}}case"--not-contains":{let e=n[0],t=JSON.stringify(r);return{ok:!t.includes(e),reason:t.includes(e)?`unexpected "${e}"`:`not contains "${e}"`}}case"--matches":{let e=new RegExp(n[0]),t=JSON.stringify(r),i=e.test(t);return{ok:i,reason:i?`matches /${n[0]}/`:`no match for /${n[0]}/`}}case"--not-matches":{let e=new RegExp(n[0]),t=JSON.stringify(r),i=!e.test(t);return{ok:i,reason:i?`not matches /${n[0]}/`:`unexpected /${n[0]}/`}}case"--equals":{let e=n[0],t=typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(r):JSON.stringify(r);return{ok:t===e,reason:`got=${JSON.stringify(t)}, want=${JSON.stringify(e)}`}}case"--has-path":{let e=y(r,n[0]);return{ok:e.found,reason:e.found?`path ${n[0]} present`:`path ${n[0]} missing`}}case"--path-equals":{let[e,t]=n,i=y(r,e);if(!i.found)return{ok:!1,reason:`path ${e} missing`};let o=typeof i.value=="string"||typeof i.value=="number"||typeof i.value=="boolean"?String(i.value):JSON.stringify(i.value);return{ok:o===t,reason:`${e}=${o}, want=${t}`}}case"--jq":{let e=n[0];try{let i=(await O(e,r)).trim();return{ok:i.length>0&&i!=="null"&&i!=="false"&&i!=='""',reason:`jq: ${i.slice(0,120)}`}}catch(t){throw new Error(`jq evaluation failed: ${t.message}`)}}default:return{ok:!1,reason:`unknown predicate ${u}`}}}function O(s,r){return new Promise((u,n)=>{let e=v("jq",[s],{stdio:["pipe","pipe","pipe"]}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",n),e.on("close",o=>{if(o!==0){n(new Error(i.trim()||`jq exited ${o}`));return}u(t)}),e.stdin.end(JSON.stringify(r))})}async function T(s){(s[0]==="--help"||s[0]==="-h"||s.length===0)&&(J(),process.exit(s.length===0?2:0));let r=j(s);"error"in r&&(process.stderr.write(` assert: ${r.error}
6
+ `),process.exit(2));let{verbArgs:u,predicates:n,withinMs:e,negate:t,quiet:i,allowTimeout:o}=r;N(u)||(process.stderr.write(` assert: unknown or non-read verb: ${u.join(" ")}
7
+ supported: ${Array.from(w).sort().join(", ")}
8
+ `),process.exit(2));let c=n.length>0?n:[{kind:"--exists",args:[]}],f=e>0?Date.now()+e:0,p=0,k="",$="";for(;;){p++;let m=await R(u);if(!m.ok){if($=m.reason||"verb failed",Date.now()<f){await x(150);continue}let l=o?1:125;if(!i){let g=l===1?"fail":"skip";process.stderr.write(` assert: ${g} \u2014 ${$}
9
+ `)}process.exit(l)}let h=!0,b=[];try{for(let l of c){let g=await A(l,m.payload);if(b.push(`${l.kind}: ${g.reason}`),!g.ok){h=!1;break}}}catch(l){i||process.stderr.write(` assert: skip \u2014 ${l.message}
10
+ `),process.exit(125)}if((t?!h:h)&&(i||process.stderr.write(` assert: pass${p>1?` (attempt ${p})`:""} \u2014 ${b.join("; ")}
11
+ `),process.exit(0)),k=b.join("; "),Date.now()<f){await x(150);continue}i||process.stderr.write(` assert: fail${p>1?` after ${p} attempt(s)`:""} \u2014 ${k}
12
+ `),process.exit(1)}}function x(s){return new Promise(r=>setTimeout(r,s))}function J(){process.stdout.write(`
13
+ rnxsim assert \u2014 run any read verb and convert its output into a bisect-friendly exit code.
14
+
15
+ usage:
16
+ rnxsim assert <verb> <verb-args...> <assertion-flags...>
17
+
18
+ exit codes:
19
+ 0 assertion passed (git bisect: good)
20
+ 1 assertion failed (git bisect: bad)
21
+ 125 could not evaluate (git bisect: skip \u2014 app not loaded, verb crashed)
22
+ 2 misuse (bad flags/verb)
23
+
24
+ assertion flags (AND'd when multiple are given):
25
+ --count <n> result array has exactly n items
26
+ --count-at-least <n> length >= n
27
+ --count-at-most <n> length <= n
28
+ --exists non-null, non-empty (default if no flag given)
29
+ --empty null or zero length
30
+ --contains <str> JSON.stringify(result) contains str (repeatable)
31
+ --not-contains <str> opposite
32
+ --matches <regex> result (stringified) matches regex
33
+ --not-matches <regex> opposite
34
+ --equals <literal> scalar equality
35
+ --has-path <dotted.path> nested path exists
36
+ --path-equals <path> <value> nested path equals value
37
+ --jq <expr> jq expression is truthy (requires jq on PATH)
38
+ --within <ms> retry verb + predicates until pass or deadline
39
+ --allow-timeout treat verb auto-wait timeout as a fail, not a skip
40
+ --negate, ! flip pass/fail (does not flip skip)
41
+ --quiet suppress the one-line pass/fail summary
42
+
43
+ examples:
44
+ rnxsim assert find --testid set-max-input --count 4
45
+ rnxsim assert describe --contains "swap-form-header"
46
+ rnxsim assert get errors --count 0
47
+ rnxsim assert find --testid submit --exists --within 3000
48
+ rnxsim assert describe --jq '.shell.state == "app"'
49
+ `)}export{T as runAssert};
@@ -0,0 +1,12 @@
1
+ /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import{a as s}from"./chunk-WEXDAC74.js";import{d as i}from"./chunk-HI5TFJWN.js";import"./chunk-FSUYIVJ6.js";import"./chunk-WINYQ44O.js";function t(){console.log(`
5
+ rnxsim auth \u2014 inspect CLI auth
6
+
7
+ usage:
8
+ rnxsim auth
9
+
10
+ API keys are read from RNX_API_KEY, or SOOTSIM_API_KEY if that is unset.
11
+ Use \`rnxsim login\` to sign in and \`rnxsim logout\` to clear the desktop session.
12
+ `)}async function r(){let o=s();if(!o)return console.log(" not signed in"),console.log(" set RNX_API_KEY=sk_rnx_... or run `rnxsim login`"),1;if(o.kind==="api-key")return console.log(` api key ${o.secret.slice(0,14)}...`),console.log(` source: ${o.envName} env var`),0;if(o.kind==="github")return console.log(` github token (${o.source})`),console.log(` repo: ${o.repoId}`),0;let e=await i(o.origin),n=e?.user;return console.log(` ${n?.email||n?.name||n?.id||"signed in"}`),console.log(` origin: ${e?.origin??o.origin}`),e?.updatedAt&&console.log(` updated: ${e.updatedAt}`),0}async function c(o){if(o.includes("--help")||o.includes("-h")){t();return}let e=o.find(n=>!n.startsWith("-"));if(!e||e==="status"){process.exitCode=await r();return}console.error(` unknown auth command: ${e}`),t(),process.exit(1)}export{c as runAuth};
@@ -0,0 +1,4 @@
1
+ /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import{a,b,c,d}from"./chunk-46EUUFJ5.js";import"./chunk-WINYQ44O.js";export{d as BETA_ASK_HEADLINE,b as BETA_LABEL,c as BETA_TAGLINE,a as IS_BETA};
@@ -0,0 +1,22 @@
1
+ /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import{m as d}from"./chunk-MJRLLB4R.js";import"./chunk-XEVZYVIW.js";import{h as l,j as m,l as p}from"./chunk-KTHV3RUS.js";import"./chunk-4NPPOV2N.js";import"./chunk-IJ5CAZZC.js";import"./chunk-FSUYIVJ6.js";import"./chunk-WINYQ44O.js";function f(){console.log(`
5
+ rnxsim do scan \u2014 inject a barcode scan
6
+
7
+ usage:
8
+ rnxsim do scan <text> [--format <web-format>]
9
+
10
+ subcommands:
11
+ scan <text> inject a synthetic barcode result into the active scan
12
+ session. fails when no guest CameraView is scanning.
13
+
14
+ options:
15
+ --format <f> BarcodeDetector format string (default: qr_code)
16
+ --sim <id> target a specific sim
17
+ --port <p> WS bridge port (default: 7668)
18
+
19
+ examples:
20
+ rnxsim do scan "tm://connect?url=http://10.0.0.5:7777&token=abc"
21
+ rnxsim do scan "https://example.com" --format qr_code
22
+ `)}async function b(e,g={}){let r=l(e,{port:g.port,stripBooleanFlags:["--help","-h"],stripValueFlags:["--format"]}),a=r.positional,o=a[0];(!o||o==="help"||e.includes("--help")||e.includes("-h"))&&(f(),process.exit(o?0:1)),o!=="scan"&&(console.error(` unknown scan subcommand: ${o}`),f(),process.exit(1));let n=a[1];n||(console.error(" usage: rnxsim do scan <text>"),process.exit(1));let i=e.indexOf("--format"),c=i>=0?e[i+1]:"qr_code",t=m(r);try{await p(t,`globalThis.__sootsimCameraInjectScan?.(${JSON.stringify(n)}, ${JSON.stringify(c)}) ?? false`)?console.log(` injected ${c} scan: ${n}`):(console.error(" no active barcode scan session \u2014 open a screen with a scanning <CameraView> first"),process.exit(1))}catch(s){console.error(` scan failed: ${s instanceof Error?s.message:s}`),await d(t),process.exit(1)}finally{t.close()}}export{b as runCamera};
@@ -0,0 +1,4 @@
1
+ /*! rnx v0.1.313 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ var n=Object.freeze({name:"rnx",packageName:"rnxsim",commandName:"rnxsim",domain:"rnxsim.com",origin:"https://rnxsim.com"});export{n as a};