@ansight/react-native 1.0.2-preview.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.
@@ -0,0 +1,20 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "AnsightReactNative"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = "https://github.com/ansight-ai/ansight-sdk"
10
+ s.license = { :type => "Ansight SDK Source-Available License", :file => "LICENSE" }
11
+ s.authors = { "Ansight" => "dev@ansight.ai" }
12
+ s.source = { :path => "." }
13
+ s.platforms = { :ios => "15.0" }
14
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
15
+ s.dependency "React-Core"
16
+ s.dependency "React-jsi"
17
+ s.dependency "AnsightObjC", s.version.to_s
18
+ s.dependency "Ansight", s.version.to_s
19
+ s.swift_version = "5.0"
20
+ end
package/LICENSE ADDED
@@ -0,0 +1,200 @@
1
+ Ansight SDK Source-Available License
2
+ Version 1.0
3
+
4
+ Copyright (c) 2026 Ansight, Inc. All rights reserved.
5
+
6
+ This license governs the Ansight SDK and associated source code, documentation,
7
+ examples, build files, binaries, and other materials made available with it
8
+ (the "SDK").
9
+
10
+ The SDK is source-available software. It is not open-source software.
11
+
12
+ By downloading, installing, copying, modifying, distributing, or using the SDK,
13
+ you accept this license. If you do not accept this license, you may not use the
14
+ SDK.
15
+
16
+ 1. Purpose
17
+
18
+ Ansight makes the SDK source available so developers, customers, researchers,
19
+ and security reviewers can inspect how the SDK works, evaluate its security,
20
+ debug integrations, report issues, and propose improvements.
21
+
22
+ Except for the rights expressly granted below, Ansight reserves all rights.
23
+
24
+ 2. Definitions
25
+
26
+ "Ansight Services" means services, APIs, systems, products, accounts,
27
+ infrastructure, software, development tools, test endpoints, sandbox
28
+ environments, local tools, or other components operated by, provided by,
29
+ authorized by, or on behalf of Ansight, Inc. or its affiliates. This includes
30
+ Ansight-hosted services, Ansight Studio, Ansight APIs, Ansight-issued accounts
31
+ or API keys, and any service or component expressly authorized by Ansight in
32
+ writing.
33
+
34
+ "Non-Ansight Services" means any service, API, backend, product, infrastructure,
35
+ system, software, or component that is not an Ansight Service.
36
+
37
+ "Application" means software developed by you that incorporates, links to, or
38
+ uses the SDK.
39
+
40
+ 3. Permitted Uses
41
+
42
+ Subject to this license, you may:
43
+
44
+ (a) read, inspect, and analyze the SDK source code;
45
+
46
+ (b) copy and build the SDK for evaluation, testing, debugging, security review,
47
+ and development of Applications that use Ansight Services;
48
+
49
+ (c) modify the SDK for your own internal development, testing, debugging,
50
+ security review, or use with Ansight Services;
51
+
52
+ (d) use and distribute the SDK, including in source, compiled, or object-code
53
+ form, only as part of an Application that connects to or interoperates with
54
+ Ansight Services;
55
+
56
+ (e) distribute Applications containing the SDK through app stores, package
57
+ managers, enterprise distribution systems, mobile device management systems,
58
+ continuous integration systems, TestFlight, Google Play testing tracks, or
59
+ similar software distribution channels, provided the SDK is used only with
60
+ Ansight Services;
61
+
62
+ (f) share bug reports, vulnerability reports, patches, pull requests, and other
63
+ proposed improvements with Ansight; and
64
+
65
+ (g) make public forks or copies of the SDK solely for review, discussion,
66
+ security research, issue reporting, or contribution back to Ansight, provided
67
+ that this license and all copyright, trademark, attribution, and other notices
68
+ remain intact.
69
+
70
+ 4. Restrictions
71
+
72
+ You may not:
73
+
74
+ (a) use the SDK with, connect the SDK to, or adapt the SDK for any Non-Ansight
75
+ Services;
76
+
77
+ (b) use the SDK to develop, operate, enable, or support any service or product
78
+ that replaces, proxies, emulates, competes with, or avoids the need for Ansight
79
+ Services;
80
+
81
+ (c) sell, sublicense, rent, lease, host, or provide the SDK as a standalone
82
+ product, SDK-as-a-service, managed service, hosted service, or competing SDK
83
+ distribution;
84
+
85
+ (d) remove, obscure, or alter any copyright, license, trademark, attribution,
86
+ security, telemetry, pairing, provenance, or service-association notices in the
87
+ SDK;
88
+
89
+ (e) circumvent license checks, authentication, pairing, service association,
90
+ security controls, or technical measures in the SDK or Ansight Services;
91
+
92
+ (f) use Ansight names, logos, or trademarks except as necessary to accurately
93
+ identify the SDK or Ansight Services;
94
+
95
+ (g) use the SDK in violation of applicable law, regulation, sanctions,
96
+ export-control rules, privacy rules, app-store policies, or third-party rights;
97
+ or
98
+
99
+ (h) grant any rights in the SDK to others beyond the rights expressly permitted
100
+ by this license.
101
+
102
+ 5. Contributions
103
+
104
+ If you submit a patch, pull request, issue comment, vulnerability report, code,
105
+ documentation, suggestion, or other contribution to Ansight relating to the SDK,
106
+ you grant Ansight a perpetual, worldwide, irrevocable, sublicensable,
107
+ transferable, royalty-free license to use, reproduce, modify, distribute,
108
+ perform, display, commercialize, and otherwise exploit that contribution for any
109
+ purpose.
110
+
111
+ You represent that you have the right to grant this license for your
112
+ contribution.
113
+
114
+ To the extent permitted by law, you waive and agree not to assert moral rights
115
+ in your contribution against Ansight, its affiliates, its customers, or its
116
+ users.
117
+
118
+ 6. Security Research
119
+
120
+ Ansight welcomes good-faith security review of the SDK. You may inspect, test,
121
+ and analyze the SDK for security issues and disclose suspected vulnerabilities
122
+ to Ansight through the security reporting process published by Ansight.
123
+
124
+ This license does not authorize access to systems, services, accounts, devices,
125
+ networks, data, or infrastructure without permission. It does not authorize
126
+ disruption, degradation, data exfiltration, privacy violations, or activity that
127
+ would harm Ansight, its customers, or third parties.
128
+
129
+ 7. Separate Agreements
130
+
131
+ If you have a separate written agreement with Ansight governing your use of the
132
+ SDK, that agreement controls to the extent of any conflict with this license.
133
+
134
+ 8. Third-Party Software
135
+
136
+ The SDK may include or depend on third-party software, libraries, tools, or
137
+ materials. Those components are licensed under their own terms. This license
138
+ applies only to the SDK materials provided by Ansight.
139
+
140
+ 9. No Support Obligation
141
+
142
+ Ansight has no obligation under this license to provide support, maintenance,
143
+ updates, hosted services, compatibility fixes, security fixes, or other
144
+ assistance for the SDK.
145
+
146
+ 10. Trademarks
147
+
148
+ No trademark rights are granted under this license. You may use Ansight names
149
+ only as necessary to accurately identify the SDK or Ansight Services, and only
150
+ in a way that does not imply endorsement, sponsorship, or affiliation except as
151
+ expressly authorized by Ansight.
152
+
153
+ 11. Termination
154
+
155
+ If you violate this license, your rights under it terminate automatically. Upon
156
+ termination, you must stop using, copying, modifying, and distributing the SDK.
157
+
158
+ Sections 4 through 18 survive termination.
159
+
160
+ 12. No Warranty
161
+
162
+ The SDK is provided "as is" and "as available", without warranties or conditions
163
+ of any kind, whether express, implied, statutory, or otherwise, including
164
+ warranties of merchantability, fitness for a particular purpose, title,
165
+ non-infringement, security, accuracy, availability, or error-free operation.
166
+
167
+ 13. Limitation of Liability
168
+
169
+ To the maximum extent permitted by law, Ansight will not be liable for any
170
+ indirect, incidental, special, consequential, exemplary, or punitive damages, or
171
+ for lost profits, lost revenues, lost data, loss of goodwill, business
172
+ interruption, security incidents, or service interruption, arising out of or
173
+ relating to the SDK or this license.
174
+
175
+ 14. Assignment
176
+
177
+ You may not assign or transfer this license without Ansight's prior written
178
+ consent. Ansight may assign or transfer this license without restriction.
179
+
180
+ 15. Waiver
181
+
182
+ Failure by Ansight to enforce any provision of this license does not waive its
183
+ right to enforce that provision or any other provision later.
184
+
185
+ 16. Severability
186
+
187
+ If any provision of this license is found unenforceable, the remaining
188
+ provisions remain in effect, and the unenforceable provision will be interpreted
189
+ to the maximum extent permitted by law.
190
+
191
+ 17. Entire Agreement
192
+
193
+ This license is the entire agreement between you and Ansight regarding the SDK,
194
+ except to the extent you have a separate written agreement with Ansight that
195
+ controls under Section 7.
196
+
197
+ 18. No Other Rights
198
+
199
+ No rights are granted except as expressly stated in this license. All rights not
200
+ expressly granted are reserved by Ansight.
package/README.md ADDED
@@ -0,0 +1,436 @@
1
+ # @ansight/react-native
2
+
3
+ React Native bridge for the Ansight mobile SDK.
4
+
5
+ The package is intentionally thin: pairing, transport, telemetry, screen
6
+ capture, touch capture, native tool discovery, and native tool execution are
7
+ handled by the Ansight iOS and Android SDKs. The JavaScript layer normalizes
8
+ React Native inputs, forwards runtime calls to the native bridge, and registers
9
+ JavaScript-backed tools for React component-tree inspection.
10
+
11
+ ## Install
12
+
13
+ ```sh
14
+ npm install @ansight/react-native
15
+ ```
16
+
17
+ Rebuild the native app so React Native autolinking installs the iOS pod and
18
+ Android library module:
19
+
20
+ ```sh
21
+ npx pod-install
22
+ npx react-native run-ios
23
+ npx react-native run-android
24
+ ```
25
+
26
+ This package version expects matching native SDK packages:
27
+
28
+ - CocoaPods: `Ansight`, `AnsightObjC` version `1.0.2-preview.1`
29
+ - Maven: `ai.ansight:ansight-android:1.0.2-preview.1`
30
+
31
+ ## Quickstart
32
+
33
+ ```ts
34
+ import Ansight from "@ansight/react-native";
35
+
36
+ const isDevelopmentOnly = __DEV__;
37
+
38
+ await Ansight.initializeAndActivate({
39
+ useNativeAllInOneDefaults: isDevelopmentOnly,
40
+ clientName: "My React Native App",
41
+ hostConnection: isDevelopmentOnly ? {
42
+ bundledDeveloperConfigJson: process.env.EXPO_PUBLIC_ANSIGHT_PAIRING_CONFIG_JSON,
43
+ } : undefined,
44
+ toolGuard: isDevelopmentOnly ? "readOnly" : "disabled",
45
+ lifecycle: true,
46
+ });
47
+
48
+ await Ansight.connect(null, {
49
+ clientName: "My React Native App",
50
+ expectedAppId: "com.example.app",
51
+ });
52
+ ```
53
+
54
+ `useNativeAllInOneDefaults` defaults to `false`. It only applies the native
55
+ iOS/Android all-in-one defaults: 400 ms sampling, 120 second retention, FPS,
56
+ touch capture, 2000 ms JPEG capture at quality 60 and max width 480, host
57
+ auto-probe, and standard native tools. It is not a master SDK enable switch and
58
+ does not infer whether the app is a debug build. Gate it with the app's own
59
+ condition, such as React Native's `__DEV__`, and configure `toolGuard`, capture
60
+ options, host auto-probe, and host connection separately.
61
+
62
+ ## Options
63
+
64
+ The TypeScript `AnsightOptions` surface mirrors Android `AnsightOptions`, iOS
65
+ `AnsightOptions`, and the .NET SDK concepts.
66
+
67
+ | Option | Purpose |
68
+ | --- | --- |
69
+ | `useNativeAllInOneDefaults` | Applies native iOS/Android all-in-one defaults when true. Defaults to false. This is not a master enable switch; configure `toolGuard`, capture options, and `hostConnection` separately. |
70
+ | `pairingConfigJson` | Legacy top-level pairing JSON. Prefer `hostConnection.*`. |
71
+ | `clientName` | Default client name for host auto-probe and connections. |
72
+ | `sampleFrequencyMilliseconds` | Built-in telemetry sampling interval. |
73
+ | `retentionPeriodSeconds` | Local metric/event retention window. |
74
+ | `enableFramesPerSecond` | Enables native FPS sampling. |
75
+ | `enableBatteryLevel` | Enables battery sampling where available. |
76
+ | `defaultMemoryChannels` | Selects built-in memory channels. Prefer `managedHeap`, `nativeHeap`, `residentSetSize`, and `physicalFootprint`; `javaHeap` and `rss` are accepted as Android/RN compatibility aliases. |
77
+ | `reactNativeMemory` | Controls native React Native runtime memory channels. Enabled by default; set to `false` to disable, or use `{ jsHeapUsed, jsHeapTotal }`. |
78
+ | `additionalChannels` | Registers custom metric channels. |
79
+ | `sessionJpegCapture` | Object to enable/configure capture, or `false` to disable. |
80
+ | `touchCapture` | Object to enable/configure capture, or `false` to disable. |
81
+ | `lifecycleCapture` | Native lifecycle and screen-view capture options. |
82
+ | `toolGuard` | `"disabled"`, `"readOnly"`, `"readWrite"`, or `"fullAccess"`. |
83
+ | `customProperties` | Grouped string properties sent with `session.open`. |
84
+ | `hostAutoProbe` | Automatic host reconnect loop settings. |
85
+ | `hostConnection` | Saved, bundled, and developer pairing settings. |
86
+ | `secureStorage` | Compatibility alias for native secure-storage allow-list settings. |
87
+ | `remoteTools` | Native visual tree, file, database, preferences, reflection, and secure-storage tool options. |
88
+ | `lifecycle` | JS AppState tracking toggle. Defaults to true. |
89
+
90
+ Example:
91
+
92
+ ```ts
93
+ await Ansight.initializeAndActivate({
94
+ useNativeAllInOneDefaults: true,
95
+ toolGuard: "readOnly",
96
+ sessionJpegCapture: {
97
+ intervalMilliseconds: 2000,
98
+ quality: 60,
99
+ maxWidth: 480,
100
+ },
101
+ touchCapture: {
102
+ captureMoveEvents: true,
103
+ captureCancelEvents: true,
104
+ moveCaptureDistanceThreshold: 8,
105
+ moveCaptureFramesPerSecond: 20,
106
+ },
107
+ hostAutoProbe: {
108
+ enabled: true,
109
+ clientName: "My React Native App",
110
+ },
111
+ });
112
+ ```
113
+
114
+ ## Native Tool Options
115
+
116
+ `remoteTools` configures the native tool suites registered by the bridge. Visual tree tools are opt-in:
117
+
118
+ ```ts
119
+ await Ansight.initializeAndActivate(
120
+ Ansight.createOptionsBuilder()
121
+ .withReadOnlyToolAccess()
122
+ .withVisualTreeTools()
123
+ .withFileSystemTools({
124
+ additionalRoots: [{ alias: "exports", path: "/tmp/app-exports" }],
125
+ })
126
+ .withDatabaseTools({
127
+ includePlatformRoots: true,
128
+ additionalRoots: [{ alias: "fixtures", path: "/tmp/app-db" }],
129
+ })
130
+ .withPreferencesTools({
131
+ allowedStores: ["standard"],
132
+ allowedKeyPrefixes: ["debug."],
133
+ })
134
+ .withReflectionTools({
135
+ includeBuiltInRoots: true,
136
+ allowedTypePrefixes: ["App."],
137
+ })
138
+ .withRemoteTools({
139
+ secureStorage: {
140
+ appleService: "com.example.app",
141
+ preferencesName: "secure_debug",
142
+ allowedKeys: ["session_token"],
143
+ allowedKeyPrefixes: ["debug."],
144
+ },
145
+ })
146
+ .build(),
147
+ );
148
+ ```
149
+
150
+ `secureStorage.preferencesName` is Android-specific. `secureStorage.appleService`
151
+ is iOS-specific. The top-level `secureStorage` option is still accepted as a
152
+ compatibility alias for `remoteTools.secureStorage`.
153
+
154
+ ## Host Connection
155
+
156
+ Use `connect(null, options)` for the default automatic flow:
157
+
158
+ ```ts
159
+ await Ansight.connect(null, {
160
+ clientName: "My React Native App",
161
+ expectedAppId: "com.example.app",
162
+ });
163
+ ```
164
+
165
+ Automatic connection tries:
166
+
167
+ 1. `hostConnection.bundledDeveloperConfigJson`
168
+ 2. native cached host profiles where implemented
169
+ 3. saved pairing config
170
+ 4. `hostConnection.bundledConfigJson`
171
+
172
+ Use explicit payloads for QR, paste, or app-owned import flows:
173
+
174
+ ```ts
175
+ await Ansight.connect(pairingJson, {
176
+ clientName: "My React Native App",
177
+ expectedAppId: "com.example.app",
178
+ hostAddressOverride: "192.168.1.20",
179
+ });
180
+
181
+ await Ansight.savePairingConfig(pairingJson, {
182
+ expectedAppId: "com.example.app",
183
+ });
184
+
185
+ await Ansight.clearSavedPairing();
186
+ await Ansight.clearCachedSession();
187
+ await Ansight.disconnect();
188
+ ```
189
+
190
+ `openSession(pairingPayload, options)` is the low-level direct session path.
191
+ Prefer `connect(...)` for normal Studio sessions because it coordinates saved
192
+ config, host auto-probe, status, telemetry, and live tool handling.
193
+
194
+ ## Runtime API
195
+
196
+ The bridge exposes the native SDK runtime surface:
197
+
198
+ | API | Purpose |
199
+ | --- | --- |
200
+ | `initialize`, `initializeAndActivate`, `activate`, `deactivate`, `clear` | Runtime lifecycle. |
201
+ | `connect`, `disconnect`, `openSession`, `completeSession`, `closeSession` | Host and live-session control. |
202
+ | `savePairingConfig`, `clearSavedPairing`, `clearCachedSession` | Pairing persistence. |
203
+ | `status`, `snapshot`, `hostConnectionStatus`, `currentOptions` | Diagnostics and state. |
204
+ | `registerMetricChannel`, `metric`, `recordMetric` | Metric channels and samples. |
205
+ | `event`, `recordEvent`, `screenViewed`, `trackRoute` | App events and screen views. |
206
+ | `setAppLifecycleState`, `startAppStateTracking`, `stopAppStateTracking` | Lifecycle state capture. |
207
+ | `recordedMetrics`, `recordedEvents` | Local retained telemetry. |
208
+ | `sendClientLog`, `addLogListener` | App-provided live-session log lines and SDK-internal log events. |
209
+ | `captureBuiltInTelemetrySample`, `captureScreenFrame` | Manual sampling and JPEG frame capture. |
210
+ | `isFramesPerSecondEnabled`, `enableFramesPerSecond`, `disableFramesPerSecond` | Runtime FPS sampling status and toggles. |
211
+ | `enableTouchCapture`, `disableTouchCapture` | Runtime touch-capture toggle. |
212
+ | `updateSessionProperties`, `clearSessionProperties` | Grouped session property mutations. |
213
+ | `registerCustomProperty`, `removeCustomProperty`, `clearCustomProperties` | Convenience property mutations. |
214
+
215
+ Native methods resolve to plain objects. Operation-like methods return
216
+ `{ success, message }`. Host connection methods return a richer result with
217
+ `success`, `message`, `source`, optional `reasonCode`, and optional live-session
218
+ details.
219
+
220
+ ## Telemetry
221
+
222
+ ```ts
223
+ await Ansight.registerMetricChannel({
224
+ id: 42,
225
+ name: "Cache",
226
+ colorHex: "#FF9500",
227
+ unit: "items",
228
+ type: "cache",
229
+ });
230
+
231
+ await Ansight.metric(12, 42);
232
+ await Ansight.event({
233
+ label: "cache_hit",
234
+ type: "Info",
235
+ details: "warm=true",
236
+ channel: 42,
237
+ });
238
+
239
+ await Ansight.screenViewed("Orders", { route: "/orders" });
240
+ await Ansight.setAppLifecycleState("foreground");
241
+ ```
242
+
243
+ Read retained samples:
244
+
245
+ ```ts
246
+ const metrics = await Ansight.recordedMetrics(100);
247
+ const events = await Ansight.recordedEvents(100);
248
+ ```
249
+
250
+ ## Logs And Session Properties
251
+
252
+ `sendClientLog` sends an app-provided line over the active live session. It does
253
+ not automatically mirror console logs.
254
+
255
+ ```ts
256
+ await Ansight.sendClientLog("Checkout loaded cartId=debug-42");
257
+ ```
258
+
259
+ `addLogListener` observes SDK-internal logs emitted by the native bridge:
260
+
261
+ ```ts
262
+ const logs = Ansight.addLogListener((entry) => {
263
+ console.debug(`[Ansight:${entry.level}] ${entry.message}`);
264
+ });
265
+
266
+ logs.remove();
267
+ ```
268
+
269
+ Session/custom properties are grouped string values:
270
+
271
+ ```ts
272
+ await Ansight.updateSessionProperties({
273
+ app: {
274
+ region: "au",
275
+ tenant: "debug",
276
+ },
277
+ });
278
+
279
+ await Ansight.registerCustomProperty("app", "build", "debug");
280
+ await Ansight.removeCustomProperty("app", "tenant");
281
+ await Ansight.clearSessionProperties();
282
+ ```
283
+
284
+ When connected, property mutations are sent immediately. When disconnected, the
285
+ latest values are included in the next `session.open`.
286
+
287
+ ## Tool Guards
288
+
289
+ | Value | Allowed scopes |
290
+ | --- | --- |
291
+ | `"disabled"` | None |
292
+ | `"readOnly"` | Read |
293
+ | `"readWrite"` | Read, Write |
294
+ | `"fullAccess"` | Read, Write, Delete |
295
+
296
+ `"full"` is accepted as a compatibility alias for `"fullAccess"`.
297
+
298
+ ## JavaScript Tools
299
+
300
+ Custom JavaScript tools can be exposed to Ansight Studio:
301
+
302
+ ```ts
303
+ const registration = Ansight.registerTool(
304
+ {
305
+ id: "app.state.snapshot",
306
+ name: "State Snapshot",
307
+ description: "Returns current app state.",
308
+ category: "app",
309
+ scope: "Read",
310
+ keywords: "state snapshot",
311
+ argumentsSchema: { type: "object", additionalProperties: true },
312
+ resultSchema: { type: "object", additionalProperties: true },
313
+ },
314
+ async (args, context) => ({
315
+ success: true,
316
+ result: {
317
+ capturedAtUtc: new Date().toISOString(),
318
+ platform: context.platform,
319
+ requestId: context.requestId,
320
+ },
321
+ }),
322
+ );
323
+
324
+ await registration.ready;
325
+ await registration.unregister();
326
+ ```
327
+
328
+ The native bridge registers JavaScript tools with `replaceExisting` semantics so
329
+ reloads can refresh handlers.
330
+
331
+ ## React Tools
332
+
333
+ `installReactTools` registers React Native specific remote tools backed by the
334
+ current React Fiber runtime:
335
+
336
+ - `react.get_component_tree`
337
+ - `react.get_shadow_tree`
338
+ - `react.find_components`
339
+ - `react.get_component`
340
+ - `react.get_navigation_state`
341
+ - `react.invoke_component_action` when `enableActions` is true
342
+
343
+ ```ts
344
+ const reactTools = Ansight.installReactTools({
345
+ includeBounds: true,
346
+ includeProps: false,
347
+ includeState: false,
348
+ maxDepth: 60,
349
+ maxNodes: 5000,
350
+ navigationRef,
351
+ enableActions: true,
352
+ allowedActionProps: ["onPress"],
353
+ });
354
+
355
+ await reactTools.ready;
356
+ ```
357
+
358
+ The component tree payload redacts sensitive prop and state keys and includes
359
+ native view bounds when React Native exposes a measurable native tag. The shadow
360
+ tree payload flattens composite components and returns the committed React
361
+ Native host/text/root nodes for layout-oriented inspection.
362
+
363
+ Action invocation is intentionally opt-in. Only function props listed in
364
+ `allowedActionProps` can be invoked, and the tool remains subject to the native
365
+ tool guard.
366
+
367
+ ## React Navigation
368
+
369
+ Use the tracker to record route changes:
370
+
371
+ ```tsx
372
+ const navigationRef = createNavigationContainerRef();
373
+ const tracker = Ansight.createReactNavigationTracker(navigationRef);
374
+
375
+ <NavigationContainer
376
+ ref={navigationRef}
377
+ onReady={tracker.onReady}
378
+ onStateChange={tracker.onStateChange}
379
+ >
380
+ {/* routes */}
381
+ </NavigationContainer>
382
+ ```
383
+
384
+ Pass the same `navigationRef` to `installReactTools` to expose
385
+ `react.get_navigation_state`.
386
+
387
+ ## Error Handlers
388
+
389
+ `installErrorHandlers` records unhandled JavaScript errors and promise
390
+ rejections as Ansight exception events:
391
+
392
+ ```ts
393
+ const uninstall = Ansight.installErrorHandlers({ chain: true });
394
+
395
+ // Later, to restore the previous global ErrorUtils handler:
396
+ uninstall();
397
+ ```
398
+
399
+ `chain: false` prevents forwarding to the previous global handler.
400
+
401
+ ## Status And Debugging
402
+
403
+ ```ts
404
+ const status = await Ansight.hostConnectionStatus();
405
+ const snapshot = await Ansight.snapshot();
406
+ const options = await Ansight.currentOptions();
407
+
408
+ await Ansight.captureBuiltInTelemetrySample();
409
+ await Ansight.captureScreenFrame({ quality: 60, maxWidth: 480 });
410
+ await Ansight.enableTouchCapture();
411
+ await Ansight.disableTouchCapture();
412
+ ```
413
+
414
+ Process memory is sampled by the native runtime. On iOS, `physicalFootprint`
415
+ is the supported process-memory default and reflects the memory footprint used
416
+ by Jetsam, including the React Native runtime inside the app process. On
417
+ Android, `managedHeap`/`javaHeap`, `nativeHeap`, and `residentSetSize`/`rss`
418
+ map to the platform heap and process memory counters.
419
+
420
+ ## Validation
421
+
422
+ The package checks its JavaScript and TypeScript surfaces:
423
+
424
+ ```sh
425
+ npm run check
426
+ ```
427
+
428
+ The first-party validation app lives in:
429
+
430
+ ```text
431
+ /Users/matthewrobbins/Development/git/ansight-sdk-test-apps/react-native/ansight-react-native-harness
432
+ ```
433
+
434
+ It exercises the native runtime bridge, standard native remote tools,
435
+ JavaScript custom tools, React visual-tree tools, SQLite/file fixtures,
436
+ screenshot capture, and touch/session telemetry.