rnxsim 0.1.365 → 0.1.366

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 (184) hide show
  1. package/README.md +2 -0
  2. package/cli/bridge-flow-runner.ts +2 -2
  3. package/cli/commands/control.ts +3 -44
  4. package/cli/commands/detox.ts +18 -1
  5. package/cli/commands/flow.ts +2 -1
  6. package/detox/index.ts +3 -1
  7. package/dist-cli/bin.js +5 -5
  8. package/dist-cli/chunks/{agent-BVMNQFKF.js → agent-SO6IOPRK.js} +2 -2
  9. package/dist-cli/chunks/{agent-wrapper-B6YFXGC3.js → agent-wrapper-PMYCB2KO.js} +2 -2
  10. package/dist-cli/chunks/{app-fonts-MEI6R6XR.js → app-fonts-LULQGFY7.js} +2 -2
  11. package/dist-cli/chunks/{assert-JGHI53HV.js → assert-WGNCD4ZU.js} +2 -2
  12. package/dist-cli/chunks/{auth-STEOXUS7.js → auth-G7CCHH3M.js} +2 -2
  13. package/dist-cli/chunks/{beta-HT3FLS5T.js → beta-N4LXL5TO.js} +2 -2
  14. package/dist-cli/chunks/{camera-ZCLFSLON.js → camera-4JHCYBQS.js} +2 -2
  15. package/dist-cli/chunks/{chunk-5AS7S6HY.js → chunk-2S7BKUP2.js} +2 -2
  16. package/dist-cli/chunks/{chunk-RI3NS77J.js → chunk-2UXU53MG.js} +1 -1
  17. package/dist-cli/chunks/{chunk-XPOTXF5Q.js → chunk-34IQM22N.js} +2 -2
  18. package/dist-cli/chunks/{chunk-52ES4API.js → chunk-3X6IBUBX.js} +2 -2
  19. package/dist-cli/chunks/{chunk-TULWPOAY.js → chunk-5DAIA77C.js} +2 -2
  20. package/dist-cli/chunks/{chunk-FIXRGPUT.js → chunk-5NMCF5VF.js} +1 -1
  21. package/dist-cli/chunks/{chunk-QIQL7Y5V.js → chunk-5OK3LCEJ.js} +2 -2
  22. package/dist-cli/chunks/{chunk-NEH4T67X.js → chunk-6PL2CCGP.js} +2 -2
  23. package/dist-cli/chunks/{chunk-MRNW4GVL.js → chunk-77ZHQJZR.js} +2 -2
  24. package/dist-cli/chunks/chunk-7B37IZBN.js +15 -0
  25. package/dist-cli/chunks/{chunk-CYIE65QN.js → chunk-A5FXX5PJ.js} +1 -1
  26. package/dist-cli/chunks/{chunk-JRPU5TFI.js → chunk-AFV32WZT.js} +3 -3
  27. package/dist-cli/chunks/{chunk-M5KJCLUW.js → chunk-CN6XYYEA.js} +12 -12
  28. package/dist-cli/chunks/{chunk-J66US2OZ.js → chunk-CTG7HBCA.js} +1 -1
  29. package/dist-cli/chunks/{chunk-ZGD7GZRI.js → chunk-DMPF2D24.js} +2 -2
  30. package/dist-cli/chunks/{chunk-622E4JET.js → chunk-DW37EVX5.js} +1 -1
  31. package/dist-cli/chunks/{chunk-XKRUNS7A.js → chunk-DWFIH7CB.js} +2 -2
  32. package/dist-cli/chunks/{chunk-WGNDJARS.js → chunk-EFR5DVNP.js} +1 -1
  33. package/dist-cli/chunks/{chunk-6BAF6GFS.js → chunk-EGAGZHO6.js} +1 -1
  34. package/dist-cli/chunks/{chunk-MACI34ST.js → chunk-EQK5MJCU.js} +2 -2
  35. package/dist-cli/chunks/{chunk-JAFF4RAU.js → chunk-GAJQSITE.js} +1 -1
  36. package/dist-cli/chunks/{chunk-ZGH5U4AJ.js → chunk-GUI3PDH2.js} +2 -2
  37. package/dist-cli/chunks/{chunk-DBJZUCFP.js → chunk-GXAB52K7.js} +2 -2
  38. package/dist-cli/chunks/{chunk-O6P4N2JD.js → chunk-H23KWIKA.js} +2 -2
  39. package/dist-cli/chunks/{chunk-2CXHDTQ5.js → chunk-HT6GFZOZ.js} +1 -1
  40. package/dist-cli/chunks/{chunk-BGRGP3QR.js → chunk-I6KIM6PN.js} +1 -1
  41. package/dist-cli/chunks/{chunk-XRO5WQXP.js → chunk-IZKHOM37.js} +1 -1
  42. package/dist-cli/chunks/{chunk-EVBQDQVY.js → chunk-JHXETDVC.js} +1 -1
  43. package/dist-cli/chunks/{chunk-2JFZ5Z7Q.js → chunk-KLF3K6ZZ.js} +1 -1
  44. package/dist-cli/chunks/{chunk-EFXNSJ55.js → chunk-LN3RNW6X.js} +2 -2
  45. package/dist-cli/chunks/{chunk-TKCGP3DD.js → chunk-M3BNCF7E.js} +2 -2
  46. package/dist-cli/chunks/{chunk-YE3M3YD4.js → chunk-M5QCGLXR.js} +3 -3
  47. package/dist-cli/chunks/{chunk-4WFN4DFR.js → chunk-M6SKQGAN.js} +2 -2
  48. package/dist-cli/chunks/{chunk-R4FQZXJC.js → chunk-MGDSJZ37.js} +2 -2
  49. package/dist-cli/chunks/{chunk-2SFMW5K6.js → chunk-N3UC7HIX.js} +1 -1
  50. package/dist-cli/chunks/{chunk-OSZ5HZSI.js → chunk-NAYLPOC5.js} +2 -2
  51. package/dist-cli/chunks/{chunk-XR4KID25.js → chunk-NM2L2QV4.js} +2 -2
  52. package/dist-cli/chunks/{chunk-67ATAITF.js → chunk-NQFJOCSF.js} +2 -2
  53. package/dist-cli/chunks/{chunk-HIDS3PYC.js → chunk-ONORMKWX.js} +2 -2
  54. package/dist-cli/chunks/{chunk-XXNPISER.js → chunk-ORWP2E7R.js} +2 -2
  55. package/dist-cli/chunks/{chunk-GK7PGYFH.js → chunk-OW5XHAA4.js} +1 -1
  56. package/dist-cli/chunks/{chunk-GZEUDDAW.js → chunk-RYIMSKDO.js} +2 -2
  57. package/dist-cli/chunks/{chunk-X5ZOZVHC.js → chunk-SA6XVI55.js} +1 -1
  58. package/dist-cli/chunks/{chunk-ZTWUNK45.js → chunk-TIAEYO6I.js} +2 -2
  59. package/dist-cli/chunks/{chunk-5VHWQGGF.js → chunk-TTASWLKM.js} +1 -1
  60. package/dist-cli/chunks/{chunk-O2ORLK6W.js → chunk-UCHW7ZHR.js} +2 -2
  61. package/dist-cli/chunks/{chunk-EFL2ASZO.js → chunk-VIND4SP3.js} +1 -1
  62. package/dist-cli/chunks/{chunk-UR345KM3.js → chunk-XJU2QIRY.js} +2 -2
  63. package/dist-cli/chunks/{chunk-W3UIDI3W.js → chunk-XXNLYR64.js} +3 -3
  64. package/dist-cli/chunks/{chunk-25BTVHK2.js → chunk-YCCCPFWT.js} +2 -2
  65. package/dist-cli/chunks/chunk-YGMEDJKJ.js +4 -0
  66. package/dist-cli/chunks/{chunk-FHWZPUGC.js → chunk-YXXKSL6R.js} +1 -1
  67. package/dist-cli/chunks/{chunk-ZCP4CRP6.js → chunk-ZFM24DOX.js} +2 -2
  68. package/dist-cli/chunks/{chunk-EAFKG5R3.js → chunk-ZJIS3CTW.js} +2 -2
  69. package/dist-cli/chunks/{chunk-DQFOHIRF.js → chunk-ZLVRYXZ7.js} +1 -1
  70. package/dist-cli/chunks/{chunk-MR3YPNUI.js → chunk-ZMJ75EDG.js} +2 -2
  71. package/dist-cli/chunks/{cleanup-G4TEYVKY.js → cleanup-KRIATKFH.js} +2 -2
  72. package/dist-cli/chunks/cli-version-SYGNHGFR.js +4 -0
  73. package/dist-cli/chunks/{compat-EZ5NP32J.js → compat-6PTQ3QEA.js} +2 -2
  74. package/dist-cli/chunks/{config-27M2DGCS.js → config-ETGDUANO.js} +2 -2
  75. package/dist-cli/chunks/control-RBTNOLQM.js +4 -0
  76. package/dist-cli/chunks/daemon-N3SC5DK6.js +4 -0
  77. package/dist-cli/chunks/{debug-EXU3D7PC.js → debug-WIIB6ZKC.js} +3 -3
  78. package/dist-cli/chunks/{desktop-SHHPZAWQ.js → desktop-TD7Q5LNB.js} +3 -3
  79. package/dist-cli/chunks/detox-7GNR33VM.js +52 -0
  80. package/dist-cli/chunks/{device-4NI26HG6.js → device-QOR3PGUF.js} +2 -2
  81. package/dist-cli/chunks/{diagnose-P4SFXH6J.js → diagnose-RRCBLP6E.js} +2 -2
  82. package/dist-cli/chunks/{disk-cleanup-BUAKWYMY.js → disk-cleanup-MJUGJPXT.js} +2 -2
  83. package/dist-cli/chunks/drivers-W6E3BZH4.js +4 -0
  84. package/dist-cli/chunks/{film-Y2BAQINB.js → film-D7Y64LID.js} +3 -3
  85. package/dist-cli/chunks/flow-7QAE2V5Y.js +4 -0
  86. package/dist-cli/chunks/help-NLD6KWVG.js +4 -0
  87. package/dist-cli/chunks/{hidden-runtime-alias-U2MAY2XV.js → hidden-runtime-alias-JGURVR2Z.js} +2 -2
  88. package/dist-cli/chunks/{home-paths-PAJMZCOS.js → home-paths-4ICFIGXO.js} +2 -2
  89. package/dist-cli/chunks/inspect-C347BG52.js +4 -0
  90. package/dist-cli/chunks/install-desktop-YR6TWZYK.js +4 -0
  91. package/dist-cli/chunks/{login-D53XKBEO.js → login-RU33QR2G.js} +2 -2
  92. package/dist-cli/chunks/{logout-HZQKLNUJ.js → logout-2IUG3Y5J.js} +2 -2
  93. package/dist-cli/chunks/{maestro-XSS2KX6L.js → maestro-2MXTGG7I.js} +3 -3
  94. package/dist-cli/chunks/{maestro-generate-DNDQX3JQ.js → maestro-generate-2PYIFGLR.js} +3 -3
  95. package/dist-cli/chunks/{mode-LEVGOKI3.js → mode-3DAPG3HF.js} +2 -2
  96. package/dist-cli/chunks/{optional-demo-registry-2XZIJNDG.js → optional-demo-registry-BWSDJF2Z.js} +2 -2
  97. package/dist-cli/chunks/{perf-OKMAXDLB.js → perf-2TKPWB4N.js} +2 -2
  98. package/dist-cli/chunks/{permissions-VG5TBUTN.js → permissions-5CSMHYNA.js} +2 -2
  99. package/dist-cli/chunks/privacy-PWWC2BXO.js +4 -0
  100. package/dist-cli/chunks/{record-BQYGZOMV.js → record-I2HJCFP3.js} +3 -3
  101. package/dist-cli/chunks/{report-issue-HCPZESWE.js → report-issue-A4FZWBOC.js} +2 -2
  102. package/dist-cli/chunks/reset-Y3PBPFYA.js +4 -0
  103. package/dist-cli/chunks/runtime-IC6NVVGA.js +4 -0
  104. package/dist-cli/chunks/{screenshot-command-DWEYPJE7.js → screenshot-command-UFW5BFHP.js} +3 -3
  105. package/dist-cli/chunks/{screenshot-layers-5GMBXLO7.js → screenshot-layers-5BIAL4YN.js} +2 -2
  106. package/dist-cli/chunks/{screenshots-capture-5KCI7IZD.js → screenshots-capture-EHYS3BV2.js} +2 -2
  107. package/dist-cli/chunks/{serve-QNKTA2HR.js → serve-O4FDM3AC.js} +2 -2
  108. package/dist-cli/chunks/setup-Y4QGSJBM.js +4 -0
  109. package/dist-cli/chunks/{skills-DOEALD3X.js → skills-ZK55SY32.js} +2 -2
  110. package/dist-cli/chunks/{state-3HH2IHIF.js → state-KFLAZNEY.js} +2 -2
  111. package/dist-cli/chunks/{storage-E7WUWN3E.js → storage-WP33ISEM.js} +2 -2
  112. package/dist-cli/chunks/store-VEE22CAY.js +4 -0
  113. package/dist-cli/chunks/telemetry-PZV4BISJ.js +4 -0
  114. package/dist-cli/chunks/{timeline-IKNUGQ2A.js → timeline-DKGW5S4I.js} +2 -2
  115. package/dist-cli/chunks/{upgrade-VS3OKXE2.js → upgrade-LL7G4B7G.js} +2 -2
  116. package/dist-cli/chunks/upload-Y4C3YZDK.js +4 -0
  117. package/dist-cli/chunks/{version-F4XHNTBZ.js → version-YLWR5G4F.js} +2 -2
  118. package/dist-cli/chunks/{web-F72724QL.js → web-QELZ4CP6.js} +2 -2
  119. package/dist-cli/chunks/welcome-ZPKA5PZJ.js +5 -0
  120. package/dist-cli/chunks/{what-happened-APK7YKOV.js → what-happened-MIOMZWM5.js} +2 -2
  121. package/dist-lib/agent-daemon-client.cjs +1 -1
  122. package/dist-lib/agent-events.cjs +1 -1
  123. package/dist-lib/agent-identity.cjs +1 -1
  124. package/dist-lib/agent-sessions.cjs +1 -1
  125. package/dist-lib/attached-projects.cjs +1 -1
  126. package/dist-lib/auth/shared-session.cjs +1 -1
  127. package/dist-lib/backend-origin.cjs +1 -1
  128. package/dist-lib/beta.cjs +1 -1
  129. package/dist-lib/beta.mjs +1 -1
  130. package/dist-lib/bridge-constants.cjs +1 -1
  131. package/dist-lib/bridge-contract.cjs +1 -1
  132. package/dist-lib/cli-constants.cjs +1 -1
  133. package/dist-lib/config.cjs +1 -1
  134. package/dist-lib/detox/index.cjs +4 -2
  135. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  136. package/dist-lib/home-paths.cjs +1 -1
  137. package/dist-lib/host/bridge-host.cjs +1 -1
  138. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  139. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  140. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  141. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  142. package/dist-lib/host/websocket-proxy.cjs +1 -1
  143. package/dist-lib/index.cjs +31 -1
  144. package/dist-lib/jump-to-source-babel.cjs +1 -1
  145. package/dist-lib/mcp.cjs +673 -0
  146. package/dist-lib/mcp.mjs +641 -0
  147. package/dist-lib/menu.cjs +1 -1
  148. package/dist-lib/menu.mjs +1 -1
  149. package/dist-lib/metro-production-bundle.cjs +1 -1
  150. package/dist-lib/metro-production-bundle.mjs +1 -1
  151. package/dist-lib/metro.cjs +1 -1
  152. package/dist-lib/profiles.cjs +1 -1
  153. package/dist-lib/public-brand.cjs +1 -1
  154. package/dist-lib/react-native-host-modules.cjs +1 -1
  155. package/dist-lib/react-native-host-modules.mjs +1 -1
  156. package/dist-lib/render-mode.cjs +1 -1
  157. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  158. package/dist-lib/sdk.cjs +31 -1
  159. package/dist-lib/sdk.mjs +31 -1
  160. package/dist-lib/skills.cjs +67 -53
  161. package/dist-lib/vite.cjs +1 -1
  162. package/package.json +7 -1
  163. package/src/app-url.ts +40 -0
  164. package/src/mcp.ts +791 -0
  165. package/src/sim-client.ts +12 -6
  166. package/dist-cli/chunks/chunk-IWPS3EKJ.js +0 -15
  167. package/dist-cli/chunks/chunk-MCHKBFUL.js +0 -4
  168. package/dist-cli/chunks/cli-version-ZM3PVKQ5.js +0 -4
  169. package/dist-cli/chunks/control-4QR43FXV.js +0 -4
  170. package/dist-cli/chunks/daemon-2U4CJ6AT.js +0 -4
  171. package/dist-cli/chunks/detox-RQ6FFSBS.js +0 -52
  172. package/dist-cli/chunks/drivers-OVCUPQTM.js +0 -4
  173. package/dist-cli/chunks/flow-ELTLKKZ3.js +0 -4
  174. package/dist-cli/chunks/help-CDEZAG2L.js +0 -4
  175. package/dist-cli/chunks/inspect-VVQRPJLS.js +0 -4
  176. package/dist-cli/chunks/install-desktop-YXSRKR35.js +0 -4
  177. package/dist-cli/chunks/privacy-MNRHREME.js +0 -4
  178. package/dist-cli/chunks/reset-R4E4W4YI.js +0 -4
  179. package/dist-cli/chunks/runtime-XRQZ7W34.js +0 -4
  180. package/dist-cli/chunks/setup-RNMM5GO5.js +0 -4
  181. package/dist-cli/chunks/store-HUPZUCFG.js +0 -4
  182. package/dist-cli/chunks/telemetry-IJ53XR2Y.js +0 -4
  183. package/dist-cli/chunks/upload-A57NAAHF.js +0 -4
  184. package/dist-cli/chunks/welcome-B72RRMBW.js +0 -5
@@ -0,0 +1,673 @@
1
+ /*! rnx v0.1.366 | (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/mcp.ts
23
+ var mcp_exports = {};
24
+ __export(mcp_exports, {
25
+ McpToolInputError: () => McpToolInputError,
26
+ PER_SIM_MCP_TOOL_DEFINITIONS: () => PER_SIM_MCP_TOOL_DEFINITIONS,
27
+ createPerSimMcpTools: () => createPerSimMcpTools,
28
+ parsePerformStep: () => parsePerformStep,
29
+ parseResetOptions: () => parseResetOptions,
30
+ parseScreenshotOptions: () => parseScreenshotOptions,
31
+ parseStateOptions: () => parseStateOptions,
32
+ registerPerSimMcpTools: () => registerPerSimMcpTools
33
+ });
34
+ module.exports = __toCommonJS(mcp_exports);
35
+ var McpToolInputError = class extends Error {
36
+ constructor(message) {
37
+ super(message);
38
+ this.name = "McpToolInputError";
39
+ }
40
+ };
41
+ function strictObject(properties, required = []) {
42
+ return {
43
+ type: "object",
44
+ properties,
45
+ required,
46
+ additionalProperties: false
47
+ };
48
+ }
49
+ function stepSchema(type, properties = {}, required = []) {
50
+ return strictObject(
51
+ {
52
+ type: { type: "string", const: type },
53
+ ...properties
54
+ },
55
+ ["type", ...required]
56
+ );
57
+ }
58
+ var coordinateSchema = { type: "number" };
59
+ var pointerIdSchema = { type: "integer", minimum: 0 };
60
+ var millisecondsSchema = { type: "integer", minimum: 0 };
61
+ var nonEmptyStringSchema = { type: "string", minLength: 1 };
62
+ var performStepSchema = {
63
+ oneOf: [
64
+ stepSchema(
65
+ "touchDown",
66
+ { x: coordinateSchema, y: coordinateSchema, pointerId: pointerIdSchema },
67
+ ["x", "y"]
68
+ ),
69
+ stepSchema(
70
+ "touchMove",
71
+ { x: coordinateSchema, y: coordinateSchema, pointerId: pointerIdSchema },
72
+ ["x", "y"]
73
+ ),
74
+ stepSchema(
75
+ "touchUp",
76
+ { x: coordinateSchema, y: coordinateSchema, pointerId: pointerIdSchema },
77
+ ["x", "y"]
78
+ ),
79
+ stepSchema("touchCancel", { pointerId: pointerIdSchema }),
80
+ stepSchema("tap", { x: coordinateSchema, y: coordinateSchema }, ["x", "y"]),
81
+ stepSchema("tapId", { id: nonEmptyStringSchema }, ["id"]),
82
+ stepSchema("tapText", { text: nonEmptyStringSchema }, ["text"]),
83
+ stepSchema(
84
+ "doubleTap",
85
+ { x: coordinateSchema, y: coordinateSchema, gapMs: millisecondsSchema },
86
+ ["x", "y"]
87
+ ),
88
+ stepSchema(
89
+ "longPress",
90
+ {
91
+ x: coordinateSchema,
92
+ y: coordinateSchema,
93
+ durationMs: millisecondsSchema
94
+ },
95
+ ["x", "y"]
96
+ ),
97
+ stepSchema(
98
+ "drag",
99
+ {
100
+ fromX: coordinateSchema,
101
+ fromY: coordinateSchema,
102
+ toX: coordinateSchema,
103
+ toY: coordinateSchema,
104
+ steps: { type: "integer", minimum: 1 },
105
+ stepMs: millisecondsSchema
106
+ },
107
+ ["fromX", "fromY", "toX", "toY"]
108
+ ),
109
+ stepSchema(
110
+ "pinch",
111
+ {
112
+ fromX1: coordinateSchema,
113
+ fromY1: coordinateSchema,
114
+ fromX2: coordinateSchema,
115
+ fromY2: coordinateSchema,
116
+ toX1: coordinateSchema,
117
+ toY1: coordinateSchema,
118
+ toX2: coordinateSchema,
119
+ toY2: coordinateSchema,
120
+ steps: { type: "integer", minimum: 1 },
121
+ stepMs: millisecondsSchema
122
+ },
123
+ ["fromX1", "fromY1", "fromX2", "fromY2", "toX1", "toY1", "toX2", "toY2"]
124
+ ),
125
+ stepSchema(
126
+ "scroll",
127
+ {
128
+ id: nonEmptyStringSchema,
129
+ x: coordinateSchema,
130
+ y: coordinateSchema,
131
+ animated: { type: "boolean" }
132
+ },
133
+ ["id"]
134
+ ),
135
+ stepSchema("type", { text: { type: "string" } }, ["text"]),
136
+ stepSchema("key", { key: nonEmptyStringSchema }, ["key"]),
137
+ stepSchema("dismissKeyboard"),
138
+ stepSchema("wait", { ms: millisecondsSchema }, ["ms"]),
139
+ stepSchema(
140
+ "waitFor",
141
+ { testID: nonEmptyStringSchema, timeoutMs: millisecondsSchema },
142
+ ["testID"]
143
+ ),
144
+ stepSchema("waitFor", { id: nonEmptyStringSchema, timeoutMs: millisecondsSchema }, [
145
+ "id"
146
+ ])
147
+ ]
148
+ };
149
+ var PER_SIM_MCP_TOOL_DEFINITIONS = {
150
+ state: {
151
+ name: "state",
152
+ description: "Capture the current app screenshot and UI tree in one call, with optional route, error, depth, and layer controls.",
153
+ inputSchema: strictObject({
154
+ screenshot: {
155
+ type: "boolean",
156
+ default: true,
157
+ description: "include the composed PNG screenshot"
158
+ },
159
+ tree: {
160
+ type: "boolean",
161
+ default: true,
162
+ description: "include the current UI tree"
163
+ },
164
+ route: { type: "boolean", description: "include route and navigation state" },
165
+ errors: { type: "boolean", description: "include recent runtime errors" },
166
+ depth: { type: "integer", minimum: 0, description: "maximum tree depth" },
167
+ layers: {
168
+ type: "string",
169
+ enum: ["full", "tenant", "shell"],
170
+ description: "screenshot layers to compose"
171
+ },
172
+ errorLimit: {
173
+ type: "integer",
174
+ minimum: 0,
175
+ description: "maximum recent error entries"
176
+ }
177
+ })
178
+ },
179
+ perform: {
180
+ name: "perform",
181
+ description: "Execute an ordered interaction batch inside the current app so gesture timing does not depend on MCP round trips.",
182
+ inputSchema: strictObject(
183
+ {
184
+ steps: { type: "array", items: performStepSchema, minItems: 1 },
185
+ stopOnError: {
186
+ type: "boolean",
187
+ description: "stop before starting the next step after a failure"
188
+ },
189
+ timeoutMs: {
190
+ type: "integer",
191
+ minimum: 1,
192
+ description: "batch progress deadline checked between steps"
193
+ }
194
+ },
195
+ ["steps"]
196
+ )
197
+ },
198
+ reset: {
199
+ name: "reset",
200
+ description: "Clear data or full simulated install state for the current app and optionally relaunch it.",
201
+ inputSchema: strictObject({
202
+ strategy: {
203
+ type: "string",
204
+ enum: ["data", "full"],
205
+ default: "data",
206
+ description: "data clears app storage; full also clears install-scoped state"
207
+ },
208
+ relaunch: {
209
+ type: "boolean",
210
+ default: true,
211
+ description: "relaunch the app after clearing state"
212
+ }
213
+ })
214
+ },
215
+ screenshot: {
216
+ name: "screenshot",
217
+ description: "Capture a PNG screenshot of the current app.",
218
+ inputSchema: strictObject({
219
+ layers: {
220
+ type: "string",
221
+ enum: ["full", "tenant", "shell"],
222
+ description: "screenshot layers to compose"
223
+ },
224
+ crop: strictObject(
225
+ {
226
+ x: coordinateSchema,
227
+ y: coordinateSchema,
228
+ w: { type: "number", minimum: 0 },
229
+ h: { type: "number", minimum: 0 }
230
+ },
231
+ ["x", "y", "w", "h"]
232
+ )
233
+ })
234
+ },
235
+ logs: {
236
+ name: "logs",
237
+ description: "Read filtered app console logs and the recent merged runtime error buffer from the current app.",
238
+ inputSchema: strictObject({
239
+ limit: {
240
+ type: "integer",
241
+ minimum: 1,
242
+ default: 50,
243
+ description: "maximum filtered log entries"
244
+ },
245
+ levels: {
246
+ type: "array",
247
+ items: { type: "string", enum: ["log", "info", "warn", "error", "debug"] },
248
+ minItems: 1,
249
+ uniqueItems: true,
250
+ description: "console levels to include"
251
+ },
252
+ filter: {
253
+ type: "string",
254
+ minLength: 1,
255
+ description: "case-insensitive message substring"
256
+ },
257
+ includeInternal: {
258
+ type: "boolean",
259
+ default: false,
260
+ description: "include RNX engine-internal log entries"
261
+ },
262
+ errorLimit: {
263
+ type: "integer",
264
+ minimum: 1,
265
+ default: 20,
266
+ description: "maximum merged runtime error entries"
267
+ }
268
+ })
269
+ }
270
+ };
271
+ var PER_SIM_MCP_TOOL_ORDER = [
272
+ "state",
273
+ "perform",
274
+ "reset",
275
+ "screenshot",
276
+ "logs"
277
+ ];
278
+ function validationFailure(path, expectation) {
279
+ throw new McpToolInputError(`${path} ${expectation}`);
280
+ }
281
+ function validateMcpInput(value, schema, path) {
282
+ if (schema.oneOf) {
283
+ let matches = 0;
284
+ for (const candidate of schema.oneOf) {
285
+ try {
286
+ validateMcpInput(value, candidate, path);
287
+ matches++;
288
+ } catch (error) {
289
+ if (!(error instanceof McpToolInputError)) throw error;
290
+ }
291
+ }
292
+ if (matches !== 1) validationFailure(path, "must match exactly one allowed shape");
293
+ return;
294
+ }
295
+ if (schema.const !== void 0 && value !== schema.const) {
296
+ validationFailure(path, `must equal ${JSON.stringify(schema.const)}`);
297
+ }
298
+ if (schema.enum && !schema.enum.some((candidate) => candidate === value)) {
299
+ validationFailure(path, `must be one of ${schema.enum.join(", ")}`);
300
+ }
301
+ if (schema.type === "object") {
302
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
303
+ validationFailure(path, "must be an object");
304
+ }
305
+ const properties = schema.properties ?? {};
306
+ for (const required of schema.required ?? []) {
307
+ if (!Object.prototype.hasOwnProperty.call(value, required)) {
308
+ validationFailure(`${path}.${required}`, "is required");
309
+ }
310
+ }
311
+ for (const [key, child] of Object.entries(value)) {
312
+ const propertySchema = properties[key];
313
+ if (!propertySchema) {
314
+ if (schema.additionalProperties === false) {
315
+ validationFailure(`${path}.${key}`, "is not allowed");
316
+ }
317
+ continue;
318
+ }
319
+ validateMcpInput(child, propertySchema, `${path}.${key}`);
320
+ }
321
+ return;
322
+ }
323
+ if (schema.type === "array") {
324
+ if (!Array.isArray(value)) validationFailure(path, "must be an array");
325
+ if (schema.minItems !== void 0 && value.length < schema.minItems) {
326
+ validationFailure(path, `must contain at least ${schema.minItems} item(s)`);
327
+ }
328
+ if (schema.maxItems !== void 0 && value.length > schema.maxItems) {
329
+ validationFailure(path, `must contain at most ${schema.maxItems} item(s)`);
330
+ }
331
+ if (schema.uniqueItems && new Set(value.map((entry) => JSON.stringify(entry))).size !== value.length) {
332
+ validationFailure(path, "must contain unique items");
333
+ }
334
+ const itemSchema = schema.items;
335
+ if (itemSchema) {
336
+ value.forEach(
337
+ (entry, index) => validateMcpInput(entry, itemSchema, `${path}[${index}]`)
338
+ );
339
+ }
340
+ return;
341
+ }
342
+ if (schema.type === "string") {
343
+ if (typeof value !== "string") validationFailure(path, "must be a string");
344
+ if (schema.minLength !== void 0 && value.length < schema.minLength) {
345
+ validationFailure(path, `must contain at least ${schema.minLength} character(s)`);
346
+ }
347
+ return;
348
+ }
349
+ if (schema.type === "number" || schema.type === "integer") {
350
+ if (typeof value !== "number" || !Number.isFinite(value)) {
351
+ validationFailure(path, "must be a finite number");
352
+ }
353
+ if (schema.type === "integer" && !Number.isInteger(value)) {
354
+ validationFailure(path, "must be an integer");
355
+ }
356
+ if (schema.minimum !== void 0 && value < schema.minimum) {
357
+ validationFailure(path, `must be at least ${schema.minimum}`);
358
+ }
359
+ if (schema.maximum !== void 0 && value > schema.maximum) {
360
+ validationFailure(path, `must be at most ${schema.maximum}`);
361
+ }
362
+ return;
363
+ }
364
+ if (schema.type === "boolean" && typeof value !== "boolean") {
365
+ validationFailure(path, "must be a boolean");
366
+ }
367
+ }
368
+ function isRecordValue(value) {
369
+ return value !== null && typeof value === "object" && !Array.isArray(value);
370
+ }
371
+ function recordValue(value, path) {
372
+ if (!isRecordValue(value)) {
373
+ validationFailure(path, "must be an object");
374
+ }
375
+ return value;
376
+ }
377
+ function stringValue(value, path) {
378
+ if (typeof value !== "string") validationFailure(path, "must be a string");
379
+ return value;
380
+ }
381
+ function numberValue(value, path) {
382
+ if (typeof value !== "number" || !Number.isFinite(value)) {
383
+ validationFailure(path, "must be a finite number");
384
+ }
385
+ return value;
386
+ }
387
+ function booleanValue(value, path) {
388
+ if (typeof value !== "boolean") validationFailure(path, "must be a boolean");
389
+ return value;
390
+ }
391
+ function optionalNumber(record, key, path) {
392
+ return record[key] === void 0 ? void 0 : numberValue(record[key], `${path}.${key}`);
393
+ }
394
+ function optionalBoolean(record, key, path) {
395
+ return record[key] === void 0 ? void 0 : booleanValue(record[key], `${path}.${key}`);
396
+ }
397
+ function parsePerformStep(value, index) {
398
+ const path = `perform.steps[${index}]`;
399
+ const step = recordValue(value, path);
400
+ const type = stringValue(step.type, `${path}.type`);
401
+ switch (type) {
402
+ case "touchDown":
403
+ case "touchMove":
404
+ case "touchUp": {
405
+ const pointerId = optionalNumber(step, "pointerId", path);
406
+ return {
407
+ type,
408
+ x: numberValue(step.x, `${path}.x`),
409
+ y: numberValue(step.y, `${path}.y`),
410
+ ...pointerId === void 0 ? {} : { pointerId }
411
+ };
412
+ }
413
+ case "touchCancel": {
414
+ const pointerId = optionalNumber(step, "pointerId", path);
415
+ return { type, ...pointerId === void 0 ? {} : { pointerId } };
416
+ }
417
+ case "tap":
418
+ return {
419
+ type,
420
+ x: numberValue(step.x, `${path}.x`),
421
+ y: numberValue(step.y, `${path}.y`)
422
+ };
423
+ case "tapId":
424
+ return { type, id: stringValue(step.id, `${path}.id`) };
425
+ case "tapText":
426
+ return { type, text: stringValue(step.text, `${path}.text`) };
427
+ case "doubleTap": {
428
+ const gapMs = optionalNumber(step, "gapMs", path);
429
+ return {
430
+ type,
431
+ x: numberValue(step.x, `${path}.x`),
432
+ y: numberValue(step.y, `${path}.y`),
433
+ ...gapMs === void 0 ? {} : { gapMs }
434
+ };
435
+ }
436
+ case "longPress": {
437
+ const durationMs = optionalNumber(step, "durationMs", path);
438
+ return {
439
+ type,
440
+ x: numberValue(step.x, `${path}.x`),
441
+ y: numberValue(step.y, `${path}.y`),
442
+ ...durationMs === void 0 ? {} : { durationMs }
443
+ };
444
+ }
445
+ case "drag": {
446
+ const steps = optionalNumber(step, "steps", path);
447
+ const stepMs = optionalNumber(step, "stepMs", path);
448
+ return {
449
+ type,
450
+ fromX: numberValue(step.fromX, `${path}.fromX`),
451
+ fromY: numberValue(step.fromY, `${path}.fromY`),
452
+ toX: numberValue(step.toX, `${path}.toX`),
453
+ toY: numberValue(step.toY, `${path}.toY`),
454
+ ...steps === void 0 ? {} : { steps },
455
+ ...stepMs === void 0 ? {} : { stepMs }
456
+ };
457
+ }
458
+ case "pinch": {
459
+ const steps = optionalNumber(step, "steps", path);
460
+ const stepMs = optionalNumber(step, "stepMs", path);
461
+ return {
462
+ type,
463
+ fromX1: numberValue(step.fromX1, `${path}.fromX1`),
464
+ fromY1: numberValue(step.fromY1, `${path}.fromY1`),
465
+ fromX2: numberValue(step.fromX2, `${path}.fromX2`),
466
+ fromY2: numberValue(step.fromY2, `${path}.fromY2`),
467
+ toX1: numberValue(step.toX1, `${path}.toX1`),
468
+ toY1: numberValue(step.toY1, `${path}.toY1`),
469
+ toX2: numberValue(step.toX2, `${path}.toX2`),
470
+ toY2: numberValue(step.toY2, `${path}.toY2`),
471
+ ...steps === void 0 ? {} : { steps },
472
+ ...stepMs === void 0 ? {} : { stepMs }
473
+ };
474
+ }
475
+ case "scroll": {
476
+ const x = optionalNumber(step, "x", path);
477
+ const y = optionalNumber(step, "y", path);
478
+ const animated = optionalBoolean(step, "animated", path);
479
+ return {
480
+ type,
481
+ id: stringValue(step.id, `${path}.id`),
482
+ ...x === void 0 ? {} : { x },
483
+ ...y === void 0 ? {} : { y },
484
+ ...animated === void 0 ? {} : { animated }
485
+ };
486
+ }
487
+ case "type":
488
+ return { type, text: stringValue(step.text, `${path}.text`) };
489
+ case "key":
490
+ return { type, key: stringValue(step.key, `${path}.key`) };
491
+ case "dismissKeyboard":
492
+ return { type };
493
+ case "wait":
494
+ return { type, ms: numberValue(step.ms, `${path}.ms`) };
495
+ case "waitFor": {
496
+ const timeoutMs = optionalNumber(step, "timeoutMs", path);
497
+ const selector = step.testID === void 0 ? { id: stringValue(step.id, `${path}.id`) } : { testID: stringValue(step.testID, `${path}.testID`) };
498
+ return {
499
+ type,
500
+ ...selector,
501
+ ...timeoutMs === void 0 ? {} : { timeoutMs }
502
+ };
503
+ }
504
+ default:
505
+ return validationFailure(`${path}.type`, "is not a supported perform step");
506
+ }
507
+ }
508
+ function parseStateOptions(value) {
509
+ const input = recordValue(value, "state");
510
+ const route = optionalBoolean(input, "route", "state");
511
+ const errors = optionalBoolean(input, "errors", "state");
512
+ const depth = optionalNumber(input, "depth", "state");
513
+ const errorLimit = optionalNumber(input, "errorLimit", "state");
514
+ const layers = input.layers === void 0 ? void 0 : stringValue(input.layers, "state.layers");
515
+ if (layers !== void 0 && layers !== "full" && layers !== "tenant" && layers !== "shell") {
516
+ return validationFailure("state.layers", "must be full, tenant, or shell");
517
+ }
518
+ return {
519
+ screenshot: optionalBoolean(input, "screenshot", "state") ?? true,
520
+ tree: optionalBoolean(input, "tree", "state") ?? true,
521
+ ...route === void 0 ? {} : { route },
522
+ ...errors === void 0 ? {} : { errors },
523
+ ...depth === void 0 ? {} : { depth },
524
+ ...layers === void 0 ? {} : { layers },
525
+ ...errorLimit === void 0 ? {} : { errorLimit }
526
+ };
527
+ }
528
+ function parsePerformInput(value) {
529
+ const input = recordValue(value, "perform");
530
+ if (!Array.isArray(input.steps)) validationFailure("perform.steps", "must be an array");
531
+ const stopOnError = optionalBoolean(input, "stopOnError", "perform");
532
+ const timeoutMs = optionalNumber(input, "timeoutMs", "perform");
533
+ const hasOptions = stopOnError !== void 0 || timeoutMs !== void 0;
534
+ return {
535
+ steps: input.steps.map(parsePerformStep),
536
+ ...hasOptions ? {
537
+ options: {
538
+ ...stopOnError === void 0 ? {} : { stopOnError },
539
+ ...timeoutMs === void 0 ? {} : { timeoutMs }
540
+ }
541
+ } : {}
542
+ };
543
+ }
544
+ function parseLogLevel(value, path) {
545
+ const level = stringValue(value, path);
546
+ if (level !== "log" && level !== "info" && level !== "warn" && level !== "error" && level !== "debug") {
547
+ return validationFailure(path, "must be log, info, warn, error, or debug");
548
+ }
549
+ return level;
550
+ }
551
+ function parseLogsInput(value) {
552
+ const input = recordValue(value, "logs");
553
+ const levels = input.levels;
554
+ if (levels !== void 0 && !Array.isArray(levels)) {
555
+ validationFailure("logs.levels", "must be an array");
556
+ }
557
+ const levelSet = levels ? new Set(levels.map((level, index) => parseLogLevel(level, `logs.levels[${index}]`))) : null;
558
+ const filter = input.filter === void 0 ? null : stringValue(input.filter, "logs.filter");
559
+ return {
560
+ filterOptions: {
561
+ level: levelSet,
562
+ filter,
563
+ showInternal: optionalBoolean(input, "includeInternal", "logs") ?? false
564
+ },
565
+ limit: optionalNumber(input, "limit", "logs") ?? 50,
566
+ errorLimit: optionalNumber(input, "errorLimit", "logs") ?? 20
567
+ };
568
+ }
569
+ function parseResetOptions(value) {
570
+ const input = recordValue(value, "reset");
571
+ const strategy = input.strategy === void 0 ? "data" : stringValue(input.strategy, "reset.strategy");
572
+ if (strategy !== "data" && strategy !== "full") {
573
+ return validationFailure("reset.strategy", "must be data or full");
574
+ }
575
+ return {
576
+ strategy,
577
+ relaunch: optionalBoolean(input, "relaunch", "reset") ?? true
578
+ };
579
+ }
580
+ function parseScreenshotOptions(value) {
581
+ const input = recordValue(value, "screenshot");
582
+ const layers = input.layers === void 0 ? void 0 : stringValue(input.layers, "screenshot.layers");
583
+ if (layers !== void 0 && layers !== "full" && layers !== "tenant" && layers !== "shell") {
584
+ return validationFailure("screenshot.layers", "must be full, tenant, or shell");
585
+ }
586
+ const crop = input.crop === void 0 ? void 0 : recordValue(input.crop, "screenshot.crop");
587
+ return {
588
+ ...layers === void 0 ? {} : { layers },
589
+ ...crop === void 0 ? {} : {
590
+ crop: {
591
+ x: numberValue(crop.x, "screenshot.crop.x"),
592
+ y: numberValue(crop.y, "screenshot.crop.y"),
593
+ w: numberValue(crop.w, "screenshot.crop.w"),
594
+ h: numberValue(crop.h, "screenshot.crop.h")
595
+ }
596
+ }
597
+ };
598
+ }
599
+ function stableJsonValue(value) {
600
+ if (value === null || typeof value === "string" || typeof value === "boolean") {
601
+ return value;
602
+ }
603
+ if (typeof value === "number") {
604
+ if (!Number.isFinite(value))
605
+ throw new Error("MCP result contains a non-finite number");
606
+ return value;
607
+ }
608
+ if (Array.isArray(value)) return value.map(stableJsonValue);
609
+ if (typeof value === "object") {
610
+ const sorted = {};
611
+ for (const key of Object.keys(value).sort()) {
612
+ sorted[key] = stableJsonValue(Reflect.get(value, key));
613
+ }
614
+ return sorted;
615
+ }
616
+ throw new Error(`MCP result contains unsupported ${typeof value} value`);
617
+ }
618
+ function textResult(value) {
619
+ const text = JSON.stringify(stableJsonValue(value));
620
+ if (text === void 0) throw new Error("MCP result did not serialize to JSON");
621
+ return { content: [{ type: "text", text }] };
622
+ }
623
+ function createPerSimMcpHandlers(sim) {
624
+ return {
625
+ state: async (input) => sim.state(parseStateOptions(input)),
626
+ perform: async (input) => {
627
+ const parsed = parsePerformInput(input);
628
+ return sim.perform(parsed.steps, parsed.options);
629
+ },
630
+ reset: async (input) => sim.reset(parseResetOptions(input)),
631
+ screenshot: async (input) => {
632
+ const result = await sim.screenshot(parseScreenshotOptions(input));
633
+ return { dataUrl: result.dataUrl };
634
+ },
635
+ logs: async (input) => {
636
+ const parsed = parseLogsInput(input);
637
+ const [logs, recentErrors] = await Promise.all([
638
+ sim.logs(parsed.filterOptions),
639
+ sim.errors(parsed.errorLimit)
640
+ ]);
641
+ return { logs: logs.slice(-parsed.limit), recentErrors };
642
+ }
643
+ };
644
+ }
645
+ function createPerSimMcpTools(sim) {
646
+ const handlers = createPerSimMcpHandlers(sim);
647
+ return PER_SIM_MCP_TOOL_ORDER.map((name) => {
648
+ const definition = PER_SIM_MCP_TOOL_DEFINITIONS[name];
649
+ return {
650
+ ...definition,
651
+ async execute(input) {
652
+ validateMcpInput(input, definition.inputSchema, name);
653
+ return textResult(await handlers[name](input));
654
+ }
655
+ };
656
+ });
657
+ }
658
+ function registerPerSimMcpTools(server, sim) {
659
+ const tools = createPerSimMcpTools(sim);
660
+ for (const tool of tools) server.registerTool(tool);
661
+ return tools;
662
+ }
663
+ // Annotate the CommonJS export names for ESM import in node:
664
+ 0 && (module.exports = {
665
+ McpToolInputError,
666
+ PER_SIM_MCP_TOOL_DEFINITIONS,
667
+ createPerSimMcpTools,
668
+ parsePerformStep,
669
+ parseResetOptions,
670
+ parseScreenshotOptions,
671
+ parseStateOptions,
672
+ registerPerSimMcpTools
673
+ });