react-native-ai-debugger 1.6.10 → 1.6.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -11,6 +11,7 @@ import { API_BASE_URL } from "./core/config.js";
11
11
  import { getPostHogClient, identifyIfDevMode, shutdownPostHog } from "./core/posthog.js";
12
12
  import { getInstallationId, getServerVersion, getPackageName, isDevMode, TELEMETRY_JSONL_PATH, categorizeError } from "./core/telemetry.js";
13
13
  import { isSDKInstalled, querySDKNetwork, getSDKNetworkEntry, getSDKNetworkStats, clearSDKNetwork, querySDKConsole, getSDKConsoleStats, clearSDKConsole } from "./core/sdkBridge.js";
14
+ import { reduxDispatch, reduxGetState } from "./core/redux.js";
14
15
  import { tap } from "./pro/tap.js";
15
16
  import { getActivateLicenseConfig, handleActivateLicense, getDeleteAccountConfig, handleDeleteAccount, } from "./tools/accountTools.js";
16
17
  import { logBuffers, networkBuffers, getLogBuffer, getNetworkBuffer, getTotalLogCount, getConnectedAppByDevice, getConnectedAppBySimulatorUdid, getConnectedAppByAndroidDeviceId, LogBuffer, NetworkBuffer, bundleErrorBuffer, imageBuffer, connectedApps, getActiveOrBootedSimulatorUdid, scanMetroPorts, fetchDevices, filterDebuggableDevices, connectToDevice, getConnectedApps, executeInApp, listDebugGlobals, inspectGlobal, reloadApp,
@@ -536,9 +537,8 @@ registerToolWithTelemetry("scan_metro", {
536
537
  if (!uiDriverOk) {
537
538
  results.push("");
538
539
  results.push("⚠️ WARNING: iOS UI driver is NOT installed. The `tap` tool and other UI-interaction tools will fail.");
539
- results.push(" Install the recommended driver: brew install cameroncooke/axe/axe");
540
- results.push(" Then set IOS_DRIVER=axe in your MCP server environment.");
541
- results.push(" Alternative: brew install idb-companion (used by default)");
540
+ results.push(" Install the default driver: brew install cameroncooke/axe/axe");
541
+ results.push(" Alternative: brew install idb-companion (set IOS_DRIVER=idb to use it)");
542
542
  }
543
543
  }
544
544
  return {
@@ -802,7 +802,7 @@ registerToolWithTelemetry("tap", {
802
802
  _meaningful: result.verification?.meaningful,
803
803
  _changeRate: result.verification?.changeRate,
804
804
  _tapStrategy: result.method,
805
- _iosDriver: result.platform === "ios" ? (process.env.IOS_DRIVER?.toLowerCase() || "idb") : undefined,
805
+ _iosDriver: result.platform === "ios" ? (process.env.IOS_DRIVER?.toLowerCase() || "axe") : undefined,
806
806
  _artifactKey: result.artifactKey,
807
807
  _ocrClosestMatch: result.ocrClosestMatch,
808
808
  _fiberPressableCount: result.fiberPressableCount,
@@ -2105,6 +2105,86 @@ registerToolWithTelemetry("inspect_global", {
2105
2105
  };
2106
2106
  });
2107
2107
  // ============================================================================
2108
+ // Redux Tools
2109
+ // ============================================================================
2110
+ registerToolWithTelemetry("redux_dispatch", {
2111
+ description: "Dispatch a Redux action to the store bound to the app's <Provider>, triggering useSelector subscribers and React re-renders. Resolves the live store by walking the React fiber tree on each call (no SDK setup needed; works even if no store was registered with init()).\n" +
2112
+ "PURPOSE: Drive state-controlled UI (loaders, modals, toasts, error overlays) without exercising the real flow (network, OTP, etc.).\n" +
2113
+ "WHY THIS EXISTS: __RN_AI_DEVTOOLS__.stores.redux often holds a different store reference than the one passed to <Provider>, so dispatching through it updates state but does NOT notify react-redux subscribers. This tool dispatches through the actual Provider store, so views re-render.\n" +
2114
+ "WHEN TO USE: Verify state-driven UI by seeding redux state directly. Example: dispatch app/setIsLoading: true, then ios_screenshot to confirm the loader rendered.\n" +
2115
+ "WORKFLOW: redux_dispatch({ action: { type: 'app/setIsLoading', payload: true } }) -> ios_screenshot -> redux_dispatch({ action: { type: 'app/setIsLoading', payload: false } }).\n" +
2116
+ "LIMITATIONS: Requires React DevTools hook (dev mode). Action must be plain JSON-serializable (no thunks/functions). If the app has multiple <Provider> roots, pass storeIndex (default 0).\n" +
2117
+ "GOOD: redux_dispatch({ action: { type: 'app/setIsLoading', payload: true } })\n" +
2118
+ "BAD: redux_dispatch({ action: () => ... }) — actions must be plain objects; for thunks use execute_in_app to call your action creator.",
2119
+ inputSchema: {
2120
+ action: z
2121
+ .record(z.unknown())
2122
+ .describe("Plain JSON-serializable Redux action object, e.g. { type: 'app/setIsLoading', payload: true }."),
2123
+ storeIndex: z
2124
+ .number()
2125
+ .int()
2126
+ .min(0)
2127
+ .optional()
2128
+ .describe("Index of the Provider store to dispatch to when the app has multiple <Provider> roots (default: 0)."),
2129
+ returnPath: z
2130
+ .string()
2131
+ .optional()
2132
+ .describe("Optional dotted path into the post-dispatch state to return for verification (e.g. 'app' or 'auth.user'). Omit to skip returning state — keeps the response small. Use redux_get_state for ad-hoc reads."),
2133
+ device: z
2134
+ .string()
2135
+ .optional()
2136
+ .describe("Target device name (substring match). Omit for default device. Run get_apps to see connected devices.")
2137
+ }
2138
+ }, async ({ action, storeIndex, returnPath, device }) => {
2139
+ const result = await reduxDispatch({ action: action, storeIndex, returnPath, device });
2140
+ if (!result.success) {
2141
+ return {
2142
+ content: [{ type: "text", text: `Error: ${result.error ?? "Unknown error"}` }],
2143
+ isError: true
2144
+ };
2145
+ }
2146
+ const ack = `Dispatched to store ${result.storeIndex} of ${result.storeCount}: ${JSON.stringify(result.previousAction)}`;
2147
+ const stateLine = returnPath
2148
+ ? `\n\nState at '${returnPath}':\n${JSON.stringify(result.state, null, 2)}`
2149
+ : "";
2150
+ return { content: [{ type: "text", text: ack + stateLine }] };
2151
+ });
2152
+ registerToolWithTelemetry("redux_get_state", {
2153
+ description: "Read state from the Redux store bound to the app's <Provider>, resolved live via the fiber tree (same store redux_dispatch targets).\n" +
2154
+ "PURPOSE: Inspect the current app state without relying on __RN_AI_DEVTOOLS__.stores.redux (which may point at a different store instance than the Provider).\n" +
2155
+ "WHEN TO USE: Verify state shape before/after redux_dispatch, or check what slice keys exist before crafting an action.\n" +
2156
+ "WORKFLOW: redux_get_state() -> craft action -> redux_dispatch -> redux_get_state({ path: 'app' }) to confirm.\n" +
2157
+ "LIMITATIONS: Requires React DevTools hook (dev mode). State must be JSON-serializable; non-serializable values are replaced with an error marker.\n" +
2158
+ "GOOD: redux_get_state({ path: 'app' })\n" +
2159
+ "BAD: redux_get_state({ path: 'app.isLoading.0' }) when isLoading is a boolean — path traversal returns undefined.",
2160
+ inputSchema: {
2161
+ storeIndex: z
2162
+ .number()
2163
+ .int()
2164
+ .min(0)
2165
+ .optional()
2166
+ .describe("Index of the Provider store to read from when the app has multiple <Provider> roots (default: 0)."),
2167
+ path: z
2168
+ .string()
2169
+ .optional()
2170
+ .describe("Optional dotted path into state (e.g. 'app' or 'auth.user'). Omit for the full state."),
2171
+ device: z
2172
+ .string()
2173
+ .optional()
2174
+ .describe("Target device name (substring match). Omit for default device.")
2175
+ }
2176
+ }, async ({ storeIndex, path, device }) => {
2177
+ const result = await reduxGetState({ storeIndex, path, device });
2178
+ if (!result.success) {
2179
+ return {
2180
+ content: [{ type: "text", text: `Error: ${result.error ?? "Unknown error"}` }],
2181
+ isError: true
2182
+ };
2183
+ }
2184
+ const header = `Store ${result.storeIndex} of ${result.storeCount}${path ? ` at path '${path}'` : ""}:`;
2185
+ return { content: [{ type: "text", text: `${header}\n\n${JSON.stringify(result.state, null, 2)}` }] };
2186
+ });
2187
+ // ============================================================================
2108
2188
  // React Component Inspection Tools
2109
2189
  // ============================================================================
2110
2190
  // Tool: Get the React component tree
@@ -4144,8 +4224,8 @@ registerToolWithTelemetry("ios_boot_simulator", {
4144
4224
  });
4145
4225
  // ============================================================================
4146
4226
  // iOS UI Interaction Tools (require an iOS UI driver)
4147
- // Recommended: AXe — brew install cameroncooke/axe/axe (set IOS_DRIVER=axe)
4148
- // Alternative: IDB — brew install idb-companion (default)
4227
+ // Default: AXe — brew install cameroncooke/axe/axe
4228
+ // Alternative: IDB — brew install idb-companion (set IOS_DRIVER=idb)
4149
4229
  // ============================================================================
4150
4230
  // Tool: iOS button
4151
4231
  server.registerTool("ios_button", {