react-native-ai-debugger 1.1.6 → 1.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +371 -42
- package/build/__tests__/helpers/tap-test-helpers.d.ts +36 -0
- package/build/__tests__/helpers/tap-test-helpers.d.ts.map +1 -0
- package/build/__tests__/helpers/tap-test-helpers.js +130 -0
- package/build/__tests__/helpers/tap-test-helpers.js.map +1 -0
- package/build/__tests__/integration/connection-health.test.js +12 -6
- package/build/__tests__/integration/connection-health.test.js.map +1 -1
- package/build/__tests__/integration/execute-in-app.test.js +2 -1
- package/build/__tests__/integration/execute-in-app.test.js.map +1 -1
- package/build/__tests__/integration/tap-strategies.test.d.ts +2 -0
- package/build/__tests__/integration/tap-strategies.test.d.ts.map +1 -0
- package/build/__tests__/integration/tap-strategies.test.js +329 -0
- package/build/__tests__/integration/tap-strategies.test.js.map +1 -0
- package/build/__tests__/integration/tools.test.js +9 -10
- package/build/__tests__/integration/tools.test.js.map +1 -1
- package/build/__tests__/unit/burst.test.d.ts +2 -0
- package/build/__tests__/unit/burst.test.d.ts.map +1 -0
- package/build/__tests__/unit/burst.test.js +50 -0
- package/build/__tests__/unit/burst.test.js.map +1 -0
- package/build/__tests__/unit/connection-health.test.js +26 -16
- package/build/__tests__/unit/connection-health.test.js.map +1 -1
- package/build/__tests__/unit/fingerprint.test.d.ts +2 -0
- package/build/__tests__/unit/fingerprint.test.d.ts.map +1 -0
- package/build/__tests__/unit/fingerprint.test.js +89 -0
- package/build/__tests__/unit/fingerprint.test.js.map +1 -0
- package/build/__tests__/unit/imageBuffer.test.d.ts +2 -0
- package/build/__tests__/unit/imageBuffer.test.d.ts.map +1 -0
- package/build/__tests__/unit/imageBuffer.test.js +128 -0
- package/build/__tests__/unit/imageBuffer.test.js.map +1 -0
- package/build/__tests__/unit/logs.test.js +9 -0
- package/build/__tests__/unit/logs.test.js.map +1 -1
- package/build/__tests__/unit/networkInterceptor.test.d.ts +2 -0
- package/build/__tests__/unit/networkInterceptor.test.d.ts.map +1 -0
- package/build/__tests__/unit/networkInterceptor.test.js +104 -0
- package/build/__tests__/unit/networkInterceptor.test.js.map +1 -0
- package/build/__tests__/unit/screenshot-diff.test.d.ts +2 -0
- package/build/__tests__/unit/screenshot-diff.test.d.ts.map +1 -0
- package/build/__tests__/unit/screenshot-diff.test.js +97 -0
- package/build/__tests__/unit/screenshot-diff.test.js.map +1 -0
- package/build/__tests__/unit/tap.test.js +430 -25
- package/build/__tests__/unit/tap.test.js.map +1 -1
- package/build/core/android.d.ts.map +1 -1
- package/build/core/android.js +64 -29
- package/build/core/android.js.map +1 -1
- package/build/core/appDetection.d.ts +8 -0
- package/build/core/appDetection.d.ts.map +1 -0
- package/build/core/appDetection.js +91 -0
- package/build/core/appDetection.js.map +1 -0
- package/build/core/bundle.d.ts.map +1 -1
- package/build/core/bundle.js +15 -23
- package/build/core/bundle.js.map +1 -1
- package/build/core/config.d.ts +8 -0
- package/build/core/config.d.ts.map +1 -0
- package/build/core/config.js +27 -0
- package/build/core/config.js.map +1 -0
- package/build/core/connection.d.ts +47 -3
- package/build/core/connection.d.ts.map +1 -1
- package/build/core/connection.js +519 -124
- package/build/core/connection.js.map +1 -1
- package/build/core/executor.d.ts +57 -14
- package/build/core/executor.d.ts.map +1 -1
- package/build/core/executor.js +936 -208
- package/build/core/executor.js.map +1 -1
- package/build/core/fingerprint.d.ts +4 -0
- package/build/core/fingerprint.d.ts.map +1 -0
- package/build/core/fingerprint.js +47 -0
- package/build/core/fingerprint.js.map +1 -0
- package/build/core/guides.d.ts.map +1 -1
- package/build/core/guides.js +27 -3
- package/build/core/guides.js.map +1 -1
- package/build/core/httpServer.js.map +1 -1
- package/build/core/imageBuffer.d.ts +37 -0
- package/build/core/imageBuffer.d.ts.map +1 -0
- package/build/core/imageBuffer.js +58 -0
- package/build/core/imageBuffer.js.map +1 -0
- package/build/core/index.d.ts +21 -17
- package/build/core/index.d.ts.map +1 -1
- package/build/core/index.js +21 -19
- package/build/core/index.js.map +1 -1
- package/build/core/ios.d.ts +36 -7
- package/build/core/ios.d.ts.map +1 -1
- package/build/core/ios.js +553 -323
- package/build/core/ios.js.map +1 -1
- package/build/core/license.d.ts +38 -0
- package/build/core/license.d.ts.map +1 -0
- package/build/core/license.js +265 -0
- package/build/core/license.js.map +1 -0
- package/build/core/logbox.d.ts +51 -0
- package/build/core/logbox.d.ts.map +1 -0
- package/build/core/logbox.js +258 -0
- package/build/core/logbox.js.map +1 -0
- package/build/core/logs.d.ts +1 -0
- package/build/core/logs.d.ts.map +1 -1
- package/build/core/logs.js +5 -0
- package/build/core/logs.js.map +1 -1
- package/build/core/metro.d.ts +8 -0
- package/build/core/metro.d.ts.map +1 -1
- package/build/core/metro.js +28 -0
- package/build/core/metro.js.map +1 -1
- package/build/core/networkInterceptor.d.ts +29 -2
- package/build/core/networkInterceptor.d.ts.map +1 -1
- package/build/core/networkInterceptor.js +195 -191
- package/build/core/networkInterceptor.js.map +1 -1
- package/build/core/ocr.d.ts +8 -3
- package/build/core/ocr.d.ts.map +1 -1
- package/build/core/ocr.js +116 -15
- package/build/core/ocr.js.map +1 -1
- package/build/core/posthog.d.ts +5 -0
- package/build/core/posthog.d.ts.map +1 -0
- package/build/core/posthog.js +46 -0
- package/build/core/posthog.js.map +1 -0
- package/build/core/sdkBridge.d.ts +67 -0
- package/build/core/sdkBridge.d.ts.map +1 -0
- package/build/core/sdkBridge.js +148 -0
- package/build/core/sdkBridge.js.map +1 -0
- package/build/core/state.d.ts +25 -5
- package/build/core/state.d.ts.map +1 -1
- package/build/core/state.js +79 -10
- package/build/core/state.js.map +1 -1
- package/build/core/telemetry.d.ts +19 -1
- package/build/core/telemetry.d.ts.map +1 -1
- package/build/core/telemetry.js +163 -8
- package/build/core/telemetry.js.map +1 -1
- package/build/core/types.d.ts +11 -0
- package/build/core/types.d.ts.map +1 -1
- package/build/index.js +1302 -302
- package/build/index.js.map +1 -1
- package/build/pro/screenshot-diff.d.ts +10 -0
- package/build/pro/screenshot-diff.d.ts.map +1 -0
- package/build/pro/screenshot-diff.js +38 -0
- package/build/pro/screenshot-diff.js.map +1 -0
- package/build/pro/tap.d.ts +71 -2
- package/build/pro/tap.d.ts.map +1 -1
- package/build/pro/tap.js +797 -124
- package/build/pro/tap.js.map +1 -1
- package/build/tools/accountTools.d.ts +44 -0
- package/build/tools/accountTools.d.ts.map +1 -0
- package/build/tools/accountTools.js +217 -0
- package/build/tools/accountTools.js.map +1 -0
- package/package.json +9 -7
- package/build/core/httpServer.js +0 -2459
- package/build/core/httpServerProcess.js +0 -153
- package/build/httpServerStandalone.js +0 -31
|
@@ -1,203 +1,207 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { getNextMessageId } from "./state.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns a JS IIFE string that patches XMLHttpRequest and fetch
|
|
4
|
+
* to capture network requests in React Native Bridgeless targets
|
|
5
|
+
* where CDP Network.enable is unsupported.
|
|
6
|
+
*/
|
|
7
|
+
export function getInterceptorScript() {
|
|
8
|
+
// Two-phase injection to capture both early and late requests:
|
|
9
|
+
// Phase 1 (sync): Set __RN_NET_INJECTED__ flag and define helper functions.
|
|
10
|
+
// Install defineProperty setter trap on fetch — may or may not work on Hermes.
|
|
11
|
+
// Phase 2 (setTimeout 0): After RN modules finish initializing, wrap fetch.
|
|
12
|
+
// This is the reliable path that always works.
|
|
13
|
+
return `(function() { try {
|
|
14
|
+
if (globalThis.__RN_NET_INJECTED__) return;
|
|
15
|
+
globalThis.__RN_NET_INJECTED__ = true;
|
|
16
|
+
|
|
17
|
+
var _counter = 0;
|
|
18
|
+
var _prefix = 'js-' + Math.random().toString(36).substring(2, 6) + '-';
|
|
19
|
+
|
|
20
|
+
function _genId() {
|
|
21
|
+
return _prefix + (++_counter);
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var url = typeof input === 'string' ? input : (input && input.url ? input.url : String(input));
|
|
26
|
-
var method = (init && init.method) ? init.method.toUpperCase() : 'GET';
|
|
27
|
-
var headers = {};
|
|
28
|
-
var postData;
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
if (init && init.headers) {
|
|
32
|
-
if (typeof init.headers.forEach === 'function') {
|
|
33
|
-
init.headers.forEach(function(v, k) { headers[k] = v; });
|
|
34
|
-
} else if (typeof init.headers === 'object') {
|
|
35
|
-
var h = init.headers;
|
|
36
|
-
for (var k in h) {
|
|
37
|
-
if (Object.prototype.hasOwnProperty.call(h, k)) {
|
|
38
|
-
headers[k] = h[k];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (init && init.body) {
|
|
44
|
-
postData = typeof init.body === 'string' ? init.body : undefined;
|
|
45
|
-
if (!postData) {
|
|
46
|
-
try { postData = JSON.stringify(init.body); } catch(e) {}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
} catch(e) {}
|
|
50
|
-
|
|
51
|
-
var startTime = Date.now();
|
|
52
|
-
report({
|
|
53
|
-
type: 'request',
|
|
54
|
-
requestId: reqId,
|
|
55
|
-
method: method,
|
|
56
|
-
url: url,
|
|
57
|
-
headers: headers,
|
|
58
|
-
postData: postData,
|
|
59
|
-
timestamp: startTime
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
return originalFetch.apply(globalThis, arguments).then(function(response) {
|
|
63
|
-
var respHeaders = {};
|
|
64
|
-
try {
|
|
65
|
-
if (response.headers && typeof response.headers.forEach === 'function') {
|
|
66
|
-
response.headers.forEach(function(v, k) { respHeaders[k] = v; });
|
|
67
|
-
}
|
|
68
|
-
} catch(e) {}
|
|
24
|
+
function _report(evt) {
|
|
25
|
+
try {
|
|
26
|
+
console.debug('__RN_NET__:' + JSON.stringify(evt));
|
|
27
|
+
} catch(e) {}
|
|
28
|
+
}
|
|
69
29
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
30
|
+
function _wrapFetch(origFetch) {
|
|
31
|
+
if (typeof origFetch !== 'function') return origFetch;
|
|
32
|
+
if (origFetch.__rn_net_wrapped__) return origFetch;
|
|
33
|
+
|
|
34
|
+
var wrapped = function(input, init) {
|
|
35
|
+
var id = _genId();
|
|
36
|
+
var method = (init && init.method) ? init.method : 'GET';
|
|
37
|
+
var url = '';
|
|
38
|
+
if (typeof input === 'string') {
|
|
39
|
+
url = input;
|
|
40
|
+
} else if (input && typeof input === 'object' && input.url) {
|
|
41
|
+
url = String(input.url);
|
|
42
|
+
} else {
|
|
43
|
+
url = String(input);
|
|
44
|
+
}
|
|
45
|
+
var startTime = Date.now();
|
|
46
|
+
|
|
47
|
+
_report({type: 'request', id: id, method: method, url: url, timestamp: startTime});
|
|
79
48
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
49
|
+
try {
|
|
50
|
+
return origFetch.apply(globalThis, arguments).then(
|
|
51
|
+
function(response) {
|
|
52
|
+
try {
|
|
53
|
+
var duration = Date.now() - startTime;
|
|
54
|
+
_report({type: 'response', id: id, status: response.status, statusText: response.statusText || '', duration: duration});
|
|
55
|
+
} catch(e) {}
|
|
56
|
+
return response;
|
|
57
|
+
},
|
|
58
|
+
function(err) {
|
|
59
|
+
try {
|
|
60
|
+
var duration = Date.now() - startTime;
|
|
61
|
+
_report({type: 'error', id: id, error: (err && err.message) ? err.message : 'Fetch failed', duration: duration});
|
|
62
|
+
} catch(e) {}
|
|
63
|
+
throw err;
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
} catch(e) {
|
|
67
|
+
try {
|
|
68
|
+
var duration = Date.now() - startTime;
|
|
69
|
+
_report({type: 'error', id: id, error: (e && e.message) ? e.message : 'Fetch failed', duration: duration});
|
|
70
|
+
} catch(e2) {}
|
|
71
|
+
throw e;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
wrapped.__rn_net_wrapped__ = true;
|
|
75
|
+
return wrapped;
|
|
91
76
|
}
|
|
92
77
|
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
78
|
+
// Phase 1: try to trap fetch assignment via defineProperty (best-effort)
|
|
79
|
+
try {
|
|
80
|
+
if (typeof globalThis.fetch === 'function') {
|
|
81
|
+
globalThis.fetch = _wrapFetch(globalThis.fetch);
|
|
82
|
+
}
|
|
83
|
+
var _storedFetch = globalThis.fetch;
|
|
84
|
+
Object.defineProperty(globalThis, 'fetch', {
|
|
85
|
+
configurable: true,
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function() { return _storedFetch; },
|
|
88
|
+
set: function(v) { _storedFetch = _wrapFetch(v); }
|
|
89
|
+
});
|
|
90
|
+
} catch(e) {}
|
|
91
|
+
|
|
92
|
+
// Phase 2: wrap fetch after module init completes (reliable fallback)
|
|
93
|
+
setTimeout(function() {
|
|
94
|
+
try {
|
|
95
|
+
if (typeof globalThis.fetch === 'function' && !globalThis.fetch.__rn_net_wrapped__) {
|
|
96
|
+
globalThis.fetch = _wrapFetch(globalThis.fetch);
|
|
97
|
+
}
|
|
98
|
+
} catch(e) {}
|
|
99
|
+
}, 0);
|
|
100
|
+
|
|
101
|
+
} catch(e) {} })();`;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Injects the network interceptor script into the app via Runtime.evaluate.
|
|
105
|
+
* Fire-and-forget — does not wait for a response.
|
|
106
|
+
*/
|
|
107
|
+
export function injectNetworkInterceptor(ws) {
|
|
108
|
+
const message = JSON.stringify({
|
|
109
|
+
id: getNextMessageId(),
|
|
110
|
+
method: "Runtime.evaluate",
|
|
111
|
+
params: {
|
|
112
|
+
expression: getInterceptorScript(),
|
|
113
|
+
silent: true,
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
ws.send(message);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Sends Network.enable CDP command. Returns the message ID used.
|
|
120
|
+
*/
|
|
121
|
+
export function sendNetworkEnable(ws) {
|
|
122
|
+
const id = getNextMessageId();
|
|
123
|
+
const message = JSON.stringify({
|
|
124
|
+
id,
|
|
125
|
+
method: "Network.enable",
|
|
126
|
+
});
|
|
127
|
+
ws.send(message);
|
|
128
|
+
return id;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Checks if console event args contain a __RN_NET__: prefixed message.
|
|
132
|
+
* Returns the JSON string after the prefix, or null.
|
|
133
|
+
*/
|
|
134
|
+
export function isInterceptorEvent(args) {
|
|
135
|
+
if (!args || args.length === 0)
|
|
136
|
+
return null;
|
|
137
|
+
const first = args[0];
|
|
138
|
+
if (first.type !== "string" || typeof first.value !== "string")
|
|
139
|
+
return null;
|
|
140
|
+
const prefix = "__RN_NET__:";
|
|
141
|
+
const val = first.value;
|
|
142
|
+
if (!val.startsWith(prefix))
|
|
143
|
+
return null;
|
|
144
|
+
return val.slice(prefix.length);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Parses an intercepted network event JSON string and routes it to the buffer.
|
|
148
|
+
*/
|
|
149
|
+
export function applyInterceptedEvent(jsonStr, networkBuffer) {
|
|
150
|
+
let event;
|
|
151
|
+
try {
|
|
152
|
+
event = JSON.parse(jsonStr);
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return; // Invalid JSON — silently ignore
|
|
156
|
+
}
|
|
157
|
+
if (!event || typeof event !== "object" || !event.type || !event.id) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const id = String(event.id);
|
|
161
|
+
const type = event.type;
|
|
162
|
+
if (type === "request") {
|
|
163
|
+
const request = {
|
|
164
|
+
requestId: id,
|
|
165
|
+
timestamp: event.timestamp
|
|
166
|
+
? new Date(event.timestamp)
|
|
167
|
+
: new Date(),
|
|
168
|
+
method: String(event.method || "GET"),
|
|
169
|
+
url: String(event.url || ""),
|
|
170
|
+
headers: {},
|
|
171
|
+
completed: false,
|
|
109
172
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return
|
|
173
|
+
networkBuffer.set(id, request);
|
|
174
|
+
}
|
|
175
|
+
else if (type === "response") {
|
|
176
|
+
const existing = networkBuffer.get(id);
|
|
177
|
+
if (!existing)
|
|
178
|
+
return; // No matching request — silently ignore
|
|
179
|
+
const duration = typeof event.duration === "number" ? event.duration : undefined;
|
|
180
|
+
existing.status = typeof event.status === "number" ? event.status : undefined;
|
|
181
|
+
existing.statusText =
|
|
182
|
+
typeof event.statusText === "string" ? event.statusText : undefined;
|
|
183
|
+
existing.completed = true;
|
|
184
|
+
existing.timing = {
|
|
185
|
+
...existing.timing,
|
|
186
|
+
responseTime: Date.now(),
|
|
187
|
+
duration,
|
|
116
188
|
};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
requestId: info.reqId,
|
|
132
|
-
method: info.method,
|
|
133
|
-
url: info.url,
|
|
134
|
-
headers: info.headers,
|
|
135
|
-
postData: postData,
|
|
136
|
-
timestamp: info.startTime
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
var xhr = this;
|
|
140
|
-
var onDone = function() {
|
|
141
|
-
var respHeaders = {};
|
|
142
|
-
try {
|
|
143
|
-
var raw = xhr.getAllResponseHeaders() || '';
|
|
144
|
-
raw.split('\\r\\n').forEach(function(line) {
|
|
145
|
-
var idx = line.indexOf(':');
|
|
146
|
-
if (idx > 0) {
|
|
147
|
-
respHeaders[line.slice(0, idx).trim().toLowerCase()] = line.slice(idx + 1).trim();
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
} catch(e) {}
|
|
151
|
-
|
|
152
|
-
if (xhr.status > 0) {
|
|
153
|
-
report({
|
|
154
|
-
type: 'response',
|
|
155
|
-
requestId: info.reqId,
|
|
156
|
-
status: xhr.status,
|
|
157
|
-
statusText: xhr.statusText,
|
|
158
|
-
headers: respHeaders,
|
|
159
|
-
mimeType: respHeaders['content-type'] || '',
|
|
160
|
-
contentLength: xhr.response ? xhr.response.length : undefined,
|
|
161
|
-
duration: Date.now() - info.startTime
|
|
162
|
-
});
|
|
163
|
-
} else {
|
|
164
|
-
report({
|
|
165
|
-
type: 'error',
|
|
166
|
-
requestId: info.reqId,
|
|
167
|
-
error: 'Request failed (status 0)',
|
|
168
|
-
duration: Date.now() - info.startTime
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
var onError = function() {
|
|
174
|
-
report({
|
|
175
|
-
type: 'error',
|
|
176
|
-
requestId: info.reqId,
|
|
177
|
-
error: 'XHR error',
|
|
178
|
-
duration: Date.now() - info.startTime
|
|
179
|
-
});
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
var onAbort = function() {
|
|
183
|
-
report({
|
|
184
|
-
type: 'error',
|
|
185
|
-
requestId: info.reqId,
|
|
186
|
-
error: 'Canceled',
|
|
187
|
-
canceled: true,
|
|
188
|
-
duration: Date.now() - info.startTime
|
|
189
|
-
});
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
xhr.addEventListener('load', onDone);
|
|
193
|
-
xhr.addEventListener('error', onError);
|
|
194
|
-
xhr.addEventListener('abort', onAbort);
|
|
195
|
-
}
|
|
196
|
-
return origSend.apply(this, arguments);
|
|
189
|
+
networkBuffer.set(id, existing);
|
|
190
|
+
}
|
|
191
|
+
else if (type === "error") {
|
|
192
|
+
const existing = networkBuffer.get(id);
|
|
193
|
+
if (!existing)
|
|
194
|
+
return; // No matching request — silently ignore
|
|
195
|
+
const duration = typeof event.duration === "number" ? event.duration : undefined;
|
|
196
|
+
existing.error =
|
|
197
|
+
typeof event.error === "string" ? event.error : "Unknown error";
|
|
198
|
+
existing.completed = true;
|
|
199
|
+
existing.timing = {
|
|
200
|
+
...existing.timing,
|
|
201
|
+
responseTime: Date.now(),
|
|
202
|
+
duration,
|
|
197
203
|
};
|
|
204
|
+
networkBuffer.set(id, existing);
|
|
198
205
|
}
|
|
199
|
-
|
|
200
|
-
return 'installed';
|
|
201
|
-
})()`;
|
|
202
206
|
}
|
|
203
207
|
//# sourceMappingURL=networkInterceptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networkInterceptor.js","sourceRoot":"","sources":["../../src/core/networkInterceptor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"networkInterceptor.js","sourceRoot":"","sources":["../../src/core/networkInterceptor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAChC,+DAA+D;IAC/D,4EAA4E;IAC5E,iFAAiF;IACjF,4EAA4E;IAC5E,iDAAiD;IACjD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAwFW,CAAC;AACvB,CAAC;AAED;;;GAGG;AAC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RWord[];
|
|
52
52
|
lines: OCRLine[];
|
|
53
53
|
processingTimeMs: number;
|
|
54
|
-
engine: "easyocr";
|
|
54
|
+
engine: "easyocr" | "cloud";
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* Infer iOS device pixel ratio from screenshot dimensions
|
|
@@ -61,8 +61,13 @@ export interface OCRResult {
|
|
|
61
61
|
*/
|
|
62
62
|
export declare function inferIOSDevicePixelRatio(width: number, height: number): number;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
64
|
+
* Convert OCR bounding box coordinate to screenshot-image-pixel space.
|
|
65
|
+
* OCR runs on the downscaled image, so coordinates are already in image-pixel space.
|
|
66
|
+
* We return them as-is — tap() handles un-downscaling and platform conversion.
|
|
67
|
+
*/
|
|
68
|
+
export declare function toTapCoord(ocrCoord: number, _scaleFactor: number): number;
|
|
69
|
+
/**
|
|
70
|
+
* Run OCR — tries cloud (Google Vision) first, falls back to local EasyOCR.
|
|
66
71
|
*/
|
|
67
72
|
export declare function recognizeText(imageBuffer: Buffer, options?: OCROptions): Promise<OCRResult>;
|
|
68
73
|
export declare function terminateOCRWorker(): Promise<void>;
|
package/build/core/ocr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ocr.d.ts","sourceRoot":"","sources":["../../src/core/ocr.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ocr.d.ts","sourceRoot":"","sources":["../../src/core/ocr.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE;QACF,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;KACd,CAAC;IACF,MAAM,EAAE;QACJ,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MA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EG;AACH,wBAAsB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CASjG;AAgFD,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAUxD"}
|
package/build/core/ocr.js
CHANGED
|
@@ -5,6 +5,13 @@ import { existsSync } from "fs";
|
|
|
5
5
|
import { randomUUID } from "crypto";
|
|
6
6
|
import { createRequire } from "module";
|
|
7
7
|
import { spawn } from "child_process";
|
|
8
|
+
import { getInstallationId } from "./telemetry.js";
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Cloud OCR Configuration
|
|
11
|
+
// ============================================================================
|
|
12
|
+
const OCR_ENDPOINT = "https://rn-debugger-ocr.500griven.workers.dev";
|
|
13
|
+
const OCR_API_KEY = "4adf74c1f1afa5c4dc5eddcfc17787aea3b21b4a518bad27df152515d71f3d54";
|
|
14
|
+
const OCR_TIMEOUT_MS = 5_000;
|
|
8
15
|
// EasyOCR instance
|
|
9
16
|
let easyOCRInstance = null;
|
|
10
17
|
let easyOCRInitPromise = null;
|
|
@@ -121,22 +128,116 @@ export function inferIOSDevicePixelRatio(width, height) {
|
|
|
121
128
|
return 2;
|
|
122
129
|
}
|
|
123
130
|
/**
|
|
124
|
-
* Convert OCR
|
|
125
|
-
*
|
|
126
|
-
*
|
|
131
|
+
* Convert OCR bounding box coordinate to screenshot-image-pixel space.
|
|
132
|
+
* OCR runs on the downscaled image, so coordinates are already in image-pixel space.
|
|
133
|
+
* We return them as-is — tap() handles un-downscaling and platform conversion.
|
|
127
134
|
*/
|
|
128
|
-
function toTapCoord(ocrCoord,
|
|
129
|
-
|
|
130
|
-
return platform === "ios" ? Math.round(pixelCoord / devicePixelRatio) : Math.round(pixelCoord);
|
|
135
|
+
export function toTapCoord(ocrCoord, _scaleFactor) {
|
|
136
|
+
return Math.round(ocrCoord);
|
|
131
137
|
}
|
|
132
138
|
/**
|
|
133
|
-
* Run OCR
|
|
134
|
-
*
|
|
139
|
+
* Run OCR via Cloudflare Worker → Google Cloud Vision.
|
|
140
|
+
* Returns null on failure (caller should fall back to local EasyOCR).
|
|
141
|
+
*/
|
|
142
|
+
async function recognizeTextCloud(imageBuffer, options) {
|
|
143
|
+
const scaleFactor = options?.scaleFactor ?? 1;
|
|
144
|
+
const startTime = Date.now();
|
|
145
|
+
const body = new Uint8Array(imageBuffer);
|
|
146
|
+
const fetchOptions = {
|
|
147
|
+
method: "POST",
|
|
148
|
+
headers: {
|
|
149
|
+
"X-API-Key": OCR_API_KEY,
|
|
150
|
+
"X-Installation-Id": getInstallationId(),
|
|
151
|
+
"Content-Type": "image/png",
|
|
152
|
+
},
|
|
153
|
+
body,
|
|
154
|
+
};
|
|
155
|
+
let response;
|
|
156
|
+
try {
|
|
157
|
+
const controller = new AbortController();
|
|
158
|
+
const timeout = setTimeout(() => controller.abort(), OCR_TIMEOUT_MS);
|
|
159
|
+
response = await fetch(`${OCR_ENDPOINT}/ocr`, {
|
|
160
|
+
...fetchOptions,
|
|
161
|
+
signal: controller.signal,
|
|
162
|
+
});
|
|
163
|
+
clearTimeout(timeout);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return null; // Network error or timeout — fall back to local
|
|
167
|
+
}
|
|
168
|
+
// On 502, retry once after 500ms
|
|
169
|
+
if (response.status === 502) {
|
|
170
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
171
|
+
try {
|
|
172
|
+
const controller = new AbortController();
|
|
173
|
+
const timeout = setTimeout(() => controller.abort(), OCR_TIMEOUT_MS);
|
|
174
|
+
response = await fetch(`${OCR_ENDPOINT}/ocr`, {
|
|
175
|
+
...fetchOptions,
|
|
176
|
+
signal: controller.signal,
|
|
177
|
+
});
|
|
178
|
+
clearTimeout(timeout);
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// Any non-200 → fall back to local
|
|
185
|
+
if (!response.ok) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
let data;
|
|
189
|
+
try {
|
|
190
|
+
data = (await response.json());
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
if (!data.success) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
// Map cloud response to OCRResult, computing center and tapCenter client-side
|
|
199
|
+
const words = data.words.map((w) => {
|
|
200
|
+
const centerX = Math.round((w.bbox.x0 + w.bbox.x1) / 2);
|
|
201
|
+
const centerY = Math.round((w.bbox.y0 + w.bbox.y1) / 2);
|
|
202
|
+
return {
|
|
203
|
+
text: w.text,
|
|
204
|
+
confidence: w.confidence,
|
|
205
|
+
bbox: w.bbox,
|
|
206
|
+
center: { x: centerX, y: centerY },
|
|
207
|
+
tapCenter: {
|
|
208
|
+
x: toTapCoord(centerX, scaleFactor),
|
|
209
|
+
y: toTapCoord(centerY, scaleFactor),
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
});
|
|
213
|
+
return {
|
|
214
|
+
success: true,
|
|
215
|
+
fullText: data.fullText,
|
|
216
|
+
confidence: data.confidence,
|
|
217
|
+
words,
|
|
218
|
+
lines: [],
|
|
219
|
+
processingTimeMs: Date.now() - startTime,
|
|
220
|
+
engine: "cloud",
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Run OCR — tries cloud (Google Vision) first, falls back to local EasyOCR.
|
|
135
225
|
*/
|
|
136
226
|
export async function recognizeText(imageBuffer, options) {
|
|
227
|
+
// Try cloud OCR first
|
|
228
|
+
const cloudResult = await recognizeTextCloud(imageBuffer, options);
|
|
229
|
+
if (cloudResult) {
|
|
230
|
+
return cloudResult;
|
|
231
|
+
}
|
|
232
|
+
// Fall back to local EasyOCR
|
|
233
|
+
return recognizeTextLocal(imageBuffer, options);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Run OCR using local EasyOCR (fallback).
|
|
237
|
+
* Requires Python 3.6+ on the system; easyocr is provided by node-easyocr's bundled venv.
|
|
238
|
+
*/
|
|
239
|
+
async function recognizeTextLocal(imageBuffer, options) {
|
|
137
240
|
const scaleFactor = options?.scaleFactor ?? 1;
|
|
138
|
-
const platform = options?.platform ?? "ios";
|
|
139
|
-
const devicePixelRatio = options?.devicePixelRatio ?? 3;
|
|
140
241
|
const startTime = Date.now();
|
|
141
242
|
let ocr;
|
|
142
243
|
try {
|
|
@@ -169,9 +270,9 @@ export async function recognizeText(imageBuffer, options) {
|
|
|
169
270
|
bbox: { x0, y0, x1, y1 },
|
|
170
271
|
center: { x: centerX, y: centerY },
|
|
171
272
|
tapCenter: {
|
|
172
|
-
x: toTapCoord(centerX, scaleFactor
|
|
173
|
-
y: toTapCoord(centerY, scaleFactor,
|
|
174
|
-
}
|
|
273
|
+
x: toTapCoord(centerX, scaleFactor),
|
|
274
|
+
y: toTapCoord(centerY, scaleFactor),
|
|
275
|
+
},
|
|
175
276
|
});
|
|
176
277
|
textParts.push(result.text.trim());
|
|
177
278
|
totalConfidence += result.confidence;
|
|
@@ -182,9 +283,9 @@ export async function recognizeText(imageBuffer, options) {
|
|
|
182
283
|
fullText: textParts.join(" "),
|
|
183
284
|
confidence: results.length > 0 ? (totalConfidence / results.length) * 100 : 0,
|
|
184
285
|
words,
|
|
185
|
-
lines: [],
|
|
286
|
+
lines: [],
|
|
186
287
|
processingTimeMs: Date.now() - startTime,
|
|
187
|
-
engine: "easyocr"
|
|
288
|
+
engine: "easyocr",
|
|
188
289
|
};
|
|
189
290
|
}
|
|
190
291
|
finally {
|
package/build/core/ocr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ocr.js","sourceRoot":"","sources":["../../src/core/ocr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAA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