react-native-ai-devtools-sdk 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -2
- package/dist/global.d.ts +2 -0
- package/dist/global.js +3 -1
- package/dist/index.js +5 -0
- package/dist/types.d.ts +6 -0
- package/package.json +13 -3
package/README.md
CHANGED
|
@@ -63,6 +63,40 @@ The AI assistant can then inspect store state directly:
|
|
|
63
63
|
execute_in_app with expression="globalThis.__RN_AI_DEVTOOLS__.stores.redux.getState()"
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
### With navigation
|
|
67
|
+
|
|
68
|
+
Pass your navigation reference for AI-powered navigation inspection:
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
import { init } from 'react-native-ai-devtools-sdk';
|
|
72
|
+
import { navigationRef } from './navigation';
|
|
73
|
+
|
|
74
|
+
if (__DEV__) {
|
|
75
|
+
init({
|
|
76
|
+
navigation: navigationRef,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### With custom references
|
|
82
|
+
|
|
83
|
+
Use `custom` to expose any additional tools, services, or objects that don't belong to stores or navigation (e.g. AsyncStorage, MMKV, analytics):
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
import { init } from 'react-native-ai-devtools-sdk';
|
|
87
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
88
|
+
import { storage } from './mmkv';
|
|
89
|
+
|
|
90
|
+
if (__DEV__) {
|
|
91
|
+
init({
|
|
92
|
+
custom: {
|
|
93
|
+
asyncStorage: AsyncStorage,
|
|
94
|
+
mmkv: storage,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
66
100
|
### Configuration options
|
|
67
101
|
|
|
68
102
|
```js
|
|
@@ -79,6 +113,15 @@ init({
|
|
|
79
113
|
queryClient: queryClient,
|
|
80
114
|
userStore: useUserStore,
|
|
81
115
|
},
|
|
116
|
+
|
|
117
|
+
// Navigation reference
|
|
118
|
+
navigation: navigationRef,
|
|
119
|
+
|
|
120
|
+
// Any additional references for AI access
|
|
121
|
+
custom: {
|
|
122
|
+
asyncStorage: AsyncStorage,
|
|
123
|
+
mmkv: storage,
|
|
124
|
+
},
|
|
82
125
|
});
|
|
83
126
|
```
|
|
84
127
|
|
|
@@ -161,13 +204,20 @@ globalThis.__RN_AI_DEVTOOLS__ = {
|
|
|
161
204
|
capabilities: {
|
|
162
205
|
network: true,
|
|
163
206
|
console: true,
|
|
164
|
-
stores: true,
|
|
165
|
-
|
|
207
|
+
stores: true, // true if stores were passed
|
|
208
|
+
navigation: true, // true if navigation was passed
|
|
209
|
+
render: false, // future: render profiling
|
|
166
210
|
},
|
|
167
211
|
|
|
168
212
|
// State store references
|
|
169
213
|
stores: { redux: store, queryClient: qc, ... },
|
|
170
214
|
|
|
215
|
+
// Navigation reference
|
|
216
|
+
navigation: navigationRef,
|
|
217
|
+
|
|
218
|
+
// Custom references (AsyncStorage, MMKV, etc.)
|
|
219
|
+
custom: { asyncStorage: AsyncStorage, mmkv: storage, ... },
|
|
220
|
+
|
|
171
221
|
// Network
|
|
172
222
|
getNetworkRequests(options?), // { count, method, urlPattern, status }
|
|
173
223
|
getNetworkRequest(id), // full details including bodies
|
package/dist/global.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface ExposeGlobalOptions {
|
|
|
8
8
|
networkBuffer: NetworkBuffer;
|
|
9
9
|
consoleBuffer: ConsoleBuffer;
|
|
10
10
|
stores: Record<string, unknown>;
|
|
11
|
+
navigation: unknown;
|
|
12
|
+
custom: Record<string, unknown>;
|
|
11
13
|
capabilities: Capabilities;
|
|
12
14
|
}
|
|
13
15
|
export declare function exposeGlobal(options: ExposeGlobalOptions): void;
|
package/dist/global.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.exposeGlobal = exposeGlobal;
|
|
4
4
|
function exposeGlobal(options) {
|
|
5
|
-
const { networkBuffer, consoleBuffer, stores, capabilities } = options;
|
|
5
|
+
const { networkBuffer, consoleBuffer, stores, navigation, custom, capabilities } = options;
|
|
6
6
|
const devtools = {
|
|
7
7
|
version: '0.2.0',
|
|
8
8
|
capabilities,
|
|
9
9
|
stores,
|
|
10
|
+
navigation,
|
|
11
|
+
custom,
|
|
10
12
|
getNetworkRequests: (opts) => networkBuffer.query(opts),
|
|
11
13
|
getNetworkRequest: (id) => networkBuffer.get(id),
|
|
12
14
|
getNetworkStats: () => networkBuffer.getStats(),
|
package/dist/index.js
CHANGED
|
@@ -19,16 +19,21 @@ function init(options) {
|
|
|
19
19
|
const networkBuffer = new networkBuffer_1.NetworkBuffer(options?.maxNetworkEntries ?? 500);
|
|
20
20
|
const consoleBuffer = new consoleBuffer_1.ConsoleBuffer(options?.maxConsoleEntries ?? 500);
|
|
21
21
|
const stores = options?.stores ?? {};
|
|
22
|
+
const navigation = options?.navigation ?? null;
|
|
23
|
+
const custom = options?.custom ?? {};
|
|
22
24
|
(0, networkInterceptor_1.patchFetch)(networkBuffer);
|
|
23
25
|
(0, consoleInterceptor_1.patchConsole)(consoleBuffer);
|
|
24
26
|
(0, global_1.exposeGlobal)({
|
|
25
27
|
networkBuffer,
|
|
26
28
|
consoleBuffer,
|
|
27
29
|
stores,
|
|
30
|
+
navigation,
|
|
31
|
+
custom,
|
|
28
32
|
capabilities: {
|
|
29
33
|
network: true,
|
|
30
34
|
console: true,
|
|
31
35
|
stores: Object.keys(stores).length > 0,
|
|
36
|
+
navigation: navigation != null,
|
|
32
37
|
render: false,
|
|
33
38
|
},
|
|
34
39
|
});
|
package/dist/types.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ export interface InitOptions {
|
|
|
2
2
|
maxNetworkEntries?: number;
|
|
3
3
|
maxConsoleEntries?: number;
|
|
4
4
|
stores?: Record<string, unknown>;
|
|
5
|
+
navigation?: unknown;
|
|
6
|
+
/** Named references to any additional tools, services, or objects (e.g. AsyncStorage, MMKV, analytics) that don't belong to stores or navigation. */
|
|
7
|
+
custom?: Record<string, unknown>;
|
|
5
8
|
}
|
|
6
9
|
export interface NetworkEntry {
|
|
7
10
|
id: string;
|
|
@@ -49,12 +52,15 @@ export interface Capabilities {
|
|
|
49
52
|
network: boolean;
|
|
50
53
|
console: boolean;
|
|
51
54
|
stores: boolean;
|
|
55
|
+
navigation: boolean;
|
|
52
56
|
render: boolean;
|
|
53
57
|
}
|
|
54
58
|
export interface DevToolsGlobal {
|
|
55
59
|
version: string;
|
|
56
60
|
capabilities: Capabilities;
|
|
57
61
|
stores: Record<string, unknown>;
|
|
62
|
+
navigation: unknown;
|
|
63
|
+
custom: Record<string, unknown>;
|
|
58
64
|
getNetworkRequests: (options?: NetworkQueryOptions) => NetworkEntry[];
|
|
59
65
|
getNetworkRequest: (id: string) => NetworkEntry | null;
|
|
60
66
|
getNetworkStats: () => NetworkStats;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-ai-devtools-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Lightweight SDK for react-native-ai-devtools — captures network requests for AI-powered debugging",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,7 +9,13 @@
|
|
|
9
9
|
"test": "jest --config jest.config.js",
|
|
10
10
|
"prepublishOnly": "npm run build"
|
|
11
11
|
},
|
|
12
|
-
"keywords": [
|
|
12
|
+
"keywords": [
|
|
13
|
+
"react-native",
|
|
14
|
+
"debugging",
|
|
15
|
+
"ai",
|
|
16
|
+
"network",
|
|
17
|
+
"mcp"
|
|
18
|
+
],
|
|
13
19
|
"author": "Ihor Zheludkov",
|
|
14
20
|
"license": "MIT",
|
|
15
21
|
"devDependencies": {
|
|
@@ -18,5 +24,9 @@
|
|
|
18
24
|
"ts-jest": "^29.0.0",
|
|
19
25
|
"typescript": "^5.0.0"
|
|
20
26
|
},
|
|
21
|
-
"files": [
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
31
|
+
]
|
|
22
32
|
}
|