@swmansion/argent 0.34.1-next.56 → 0.34.1-next.58
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/dist/cli-cmds.mjs
CHANGED
|
@@ -36289,7 +36289,7 @@ function isCi(env = process.env) {
|
|
|
36289
36289
|
var SESSION_ID2 = randomUUID5();
|
|
36290
36290
|
function readCliVersion() {
|
|
36291
36291
|
if (true) {
|
|
36292
|
-
return "0.34.1-next.
|
|
36292
|
+
return "0.34.1-next.58";
|
|
36293
36293
|
}
|
|
36294
36294
|
return "0.0.0";
|
|
36295
36295
|
}
|
package/dist/installer.mjs
CHANGED
|
@@ -16946,7 +16946,7 @@ function isCi(env = process.env) {
|
|
|
16946
16946
|
var SESSION_ID = randomUUID4();
|
|
16947
16947
|
function readCliVersion() {
|
|
16948
16948
|
if (true) {
|
|
16949
|
-
return "0.34.1-next.
|
|
16949
|
+
return "0.34.1-next.58";
|
|
16950
16950
|
}
|
|
16951
16951
|
return "0.0.0";
|
|
16952
16952
|
}
|
|
@@ -141,7 +141,7 @@ export interface ArgentToolArgs {
|
|
|
141
141
|
"debugger-component-tree": {
|
|
142
142
|
/** Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. */
|
|
143
143
|
port?: number;
|
|
144
|
-
/** Device id
|
|
144
|
+
/** Device id used with debugger-connect. For macOS, use the Mac app id. */
|
|
145
145
|
device_id: string;
|
|
146
146
|
/** When true, only components visible on screen are returned. Set to false to include all mounted components, including those scrolled off-screen, e.g. to understand the full page structure. */
|
|
147
147
|
onScreenOnly?: boolean;
|
|
@@ -153,13 +153,13 @@ export interface ArgentToolArgs {
|
|
|
153
153
|
"debugger-connect": {
|
|
154
154
|
/** Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. */
|
|
155
155
|
port?: number;
|
|
156
|
-
/** Device id from list-devices: iOS simulator UDID, Android serial, Vega serial (amazon-...),
|
|
156
|
+
/** Device id from list-devices: iOS simulator UDID, Android serial, Vega serial (amazon-...), Mac app id (macos-app-<bundle id>), or Chromium device id (chromium-cdp-<port>). */
|
|
157
157
|
device_id: string;
|
|
158
158
|
};
|
|
159
159
|
"debugger-evaluate": {
|
|
160
160
|
/** Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. */
|
|
161
161
|
port?: number;
|
|
162
|
-
/** Device id
|
|
162
|
+
/** Device id used with debugger-connect. For macOS, use the Mac app id. */
|
|
163
163
|
device_id: string;
|
|
164
164
|
/** JavaScript expression to evaluate in the app runtime */
|
|
165
165
|
expression: string;
|
|
@@ -167,11 +167,11 @@ export interface ArgentToolArgs {
|
|
|
167
167
|
"debugger-inspect-element": {
|
|
168
168
|
/** Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. */
|
|
169
169
|
port?: number;
|
|
170
|
-
/** Device id
|
|
170
|
+
/** Device id used with debugger-connect. For macOS, use the Mac app id. */
|
|
171
171
|
device_id: string;
|
|
172
|
-
/**
|
|
172
|
+
/** Horizontal position in logical pixels from the left edge of the screen, or in points from the left edge of the Mac app window, title bar included. */
|
|
173
173
|
x: number;
|
|
174
|
-
/**
|
|
174
|
+
/** Vertical position in logical pixels from the top edge of the screen, or in points from the top edge of the Mac app window, title bar included. */
|
|
175
175
|
y: number;
|
|
176
176
|
/** Lines of source context to include around the component definition */
|
|
177
177
|
contextLines?: number;
|
|
@@ -185,19 +185,19 @@ export interface ArgentToolArgs {
|
|
|
185
185
|
"debugger-log-registry": {
|
|
186
186
|
/** Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. */
|
|
187
187
|
port?: number;
|
|
188
|
-
/** Device id
|
|
188
|
+
/** Device id used with debugger-connect. For macOS, use the Mac app id. */
|
|
189
189
|
device_id: string;
|
|
190
190
|
};
|
|
191
191
|
"debugger-reload-metro": {
|
|
192
192
|
/** Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. */
|
|
193
193
|
port?: number;
|
|
194
|
-
/** Device id
|
|
194
|
+
/** Device id used with debugger-connect. For macOS, use the Mac app id. */
|
|
195
195
|
device_id: string;
|
|
196
196
|
};
|
|
197
197
|
"debugger-status": {
|
|
198
198
|
/** Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. */
|
|
199
199
|
port?: number;
|
|
200
|
-
/** Device id
|
|
200
|
+
/** Device id used with debugger-connect. For macOS, use the Mac app id. */
|
|
201
201
|
device_id: string;
|
|
202
202
|
};
|
|
203
203
|
describe: {
|
|
@@ -636,7 +636,7 @@ export interface ArgentToolArgs {
|
|
|
636
636
|
bundleId: string;
|
|
637
637
|
/** The app's Metro port: the JS layer is reached through it, and the native layers leave its requests out. Omit it to use this device's port, 8081 by default. */
|
|
638
638
|
port?: number;
|
|
639
|
-
/**
|
|
639
|
+
/** Use js for the app's JavaScript requests or native for requests captured by the native layer. Omit to control all supported layers. On Mac apps, this parameter supports only native. Read view-network-logs to start JavaScript capture in a React Native Mac app. */
|
|
640
640
|
layer?: "js" | "native";
|
|
641
641
|
/** Only when several devices share the Metro port: this device's logicalDeviceId, which the JS layer's reason lists. The JS layer connects to that runtime, and view-network-logs then takes it as device_id. The native layer always uses udid. */
|
|
642
642
|
logicalDeviceId?: string;
|
|
@@ -648,7 +648,7 @@ export interface ArgentToolArgs {
|
|
|
648
648
|
bundleId: string;
|
|
649
649
|
/** The app's Metro port: the JS layer is reached through it, and the native layers leave its requests out. Omit it to use this device's port, 8081 by default. */
|
|
650
650
|
port?: number;
|
|
651
|
-
/**
|
|
651
|
+
/** Use js for the app's JavaScript requests or native for requests captured by the native layer. Omit to control all supported layers. On Mac apps, this parameter supports only native. Read view-network-logs to start JavaScript capture in a React Native Mac app. */
|
|
652
652
|
layer?: "js" | "native";
|
|
653
653
|
/** Only when several devices share the Metro port: this device's logicalDeviceId, which the JS layer's reason lists. The JS layer connects to that runtime, and view-network-logs then takes it as device_id. The native layer always uses udid. */
|
|
654
654
|
logicalDeviceId?: string;
|
|
@@ -1005,7 +1005,7 @@ export interface ArgentToolArgs {
|
|
|
1005
1005
|
"view-network-logs": {
|
|
1006
1006
|
/** Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. */
|
|
1007
1007
|
port?: number;
|
|
1008
|
-
/** Device id from list-devices
|
|
1008
|
+
/** Device id from list-devices, or the logicalDeviceId used to start an iOS or Android capture on shared Metro. For macOS, use the Mac app id. */
|
|
1009
1009
|
device_id: string;
|
|
1010
1010
|
/** Page index (0-based) or "latest" for the most recent page. Each page contains up to 50 entries. */
|
|
1011
1011
|
pageIndex?: number | "latest" | null;
|
|
@@ -1013,7 +1013,7 @@ export interface ArgentToolArgs {
|
|
|
1013
1013
|
"view-network-request-details": {
|
|
1014
1014
|
/** Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. */
|
|
1015
1015
|
port?: number;
|
|
1016
|
-
/** Device id
|
|
1016
|
+
/** Device id used to list the request. For macOS, use the Mac app id. */
|
|
1017
1017
|
device_id: string;
|
|
1018
1018
|
/** The requestId from view-network-logs, or a native ID (ios-, android- or macos-) from native-network-logs. */
|
|
1019
1019
|
requestId: string;
|
package/dist/tool-server.cjs
CHANGED
|
@@ -101448,7 +101448,7 @@ function isCi(env = process.env) {
|
|
|
101448
101448
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
101449
101449
|
function readCliVersion() {
|
|
101450
101450
|
if (true) {
|
|
101451
|
-
return "0.34.1-next.
|
|
101451
|
+
return "0.34.1-next.58";
|
|
101452
101452
|
}
|
|
101453
101453
|
return "0.0.0";
|
|
101454
101454
|
}
|
|
@@ -126453,7 +126453,7 @@ function subcommandForDevice(device) {
|
|
|
126453
126453
|
}
|
|
126454
126454
|
return device.kind === "device" ? "android_device" : "android";
|
|
126455
126455
|
}
|
|
126456
|
-
var EMULATOR_NOT_DISCOVERED = /not found among running emulators|Failed to find any running emulator|transport error[\s\S]*tcp connect error: (?:Connection refused|[^\n]*actively refused)/;
|
|
126456
|
+
var EMULATOR_NOT_DISCOVERED = /not found among running emulators|did not answer on gRPC port|Failed to find any running emulator|transport error[\s\S]*tcp connect error: (?:Connection refused|[^\n]*actively refused)/;
|
|
126457
126457
|
var FIRST_FRAME_TIMEOUT_MS = 5e3;
|
|
126458
126458
|
async function waitForFirstFrame(streamUrl) {
|
|
126459
126459
|
if (!streamUrl) return;
|
|
@@ -149068,15 +149068,13 @@ var DEBUGGER_TOOL_CAPABILITY = {
|
|
|
149068
149068
|
appleRemote: { simulator: true },
|
|
149069
149069
|
android: { emulator: true, device: true, unknown: true },
|
|
149070
149070
|
chromium: { app: true },
|
|
149071
|
-
vega: { vvd: true }
|
|
149071
|
+
vega: { vvd: true },
|
|
149072
|
+
macos: { app: true, catalyst: true }
|
|
149072
149073
|
};
|
|
149073
149074
|
var RN_ONLY_TOOL_CAPABILITY = {
|
|
149074
149075
|
apple: { simulator: true },
|
|
149075
149076
|
appleRemote: { simulator: true },
|
|
149076
|
-
android: { emulator: true, device: true, unknown: true }
|
|
149077
|
-
};
|
|
149078
|
-
var REACT_PROFILER_TOOL_CAPABILITY = {
|
|
149079
|
-
...RN_ONLY_TOOL_CAPABILITY,
|
|
149077
|
+
android: { emulator: true, device: true, unknown: true },
|
|
149080
149078
|
macos: { app: true, catalyst: true }
|
|
149081
149079
|
};
|
|
149082
149080
|
function isChromiumDebuggerTarget(deviceId) {
|
|
@@ -149131,8 +149129,12 @@ var CHROMIUM_GUIDANCE = {
|
|
|
149131
149129
|
cdp_unreachable: "The app's CDP endpoint could not be reached (or did not answer like CDP \u2014 see detail). launch-app cannot start a Chromium app; make sure the app is running with --remote-debugging-port (for an Electron app, boot-device with electronAppPath relaunches it), then retry once.",
|
|
149132
149130
|
runtime_unresponsive: "The app accepted the debugger connection but did not answer within the timeout \u2014 it is likely frozen. Do not retry in a loop (each attempt waits out the full timeout). Restart the app (for an Electron app, boot-device with electronAppPath and force: true), then retry once."
|
|
149133
149131
|
};
|
|
149132
|
+
var MACOS_GUIDANCE = {
|
|
149133
|
+
device_mismatch: "No JavaScript runtime of this Mac app is connected to this Metro. Do not re-target with a logicalDeviceId from the detail message: it names another app or device. Start the app (launch-app) if it is not running, wait a few seconds for the bundle to load, then retry once. If the app loads its bundle from another Metro, pass that port."
|
|
149134
|
+
};
|
|
149134
149135
|
function buildNotConnected(reason2, err, params) {
|
|
149135
149136
|
const isChromium = params.device_id?.startsWith(CHROMIUM_ID_PREFIX) ?? false;
|
|
149137
|
+
const isMacApp = params.device_id?.startsWith(MACOS_APP_ID_PREFIX) ?? false;
|
|
149136
149138
|
return {
|
|
149137
149139
|
status: "not_connected",
|
|
149138
149140
|
connected: false,
|
|
@@ -149141,7 +149143,7 @@ function buildNotConnected(reason2, err, params) {
|
|
|
149141
149143
|
...isChromium ? {} : { port: metroPort(params) },
|
|
149142
149144
|
reason: reason2,
|
|
149143
149145
|
detail: err instanceof Error ? err.message : String(err),
|
|
149144
|
-
guidance: (isChromium ? CHROMIUM_GUIDANCE[reason2] : void 0) ?? GUIDANCE[reason2]
|
|
149146
|
+
guidance: (isChromium ? CHROMIUM_GUIDANCE[reason2] : void 0) ?? (isMacApp ? MACOS_GUIDANCE[reason2] : void 0) ?? GUIDANCE[reason2]
|
|
149145
149147
|
};
|
|
149146
149148
|
}
|
|
149147
149149
|
function trackDebuggerOutcome(tool, outcome, params, ctx) {
|
|
@@ -152192,7 +152194,7 @@ var captureSchema = external_exports.object({
|
|
|
152192
152194
|
"The app's Metro port: the JS layer is reached through it, and the native layers leave its requests out. Omit it to use this device's port, 8081 by default."
|
|
152193
152195
|
),
|
|
152194
152196
|
layer: external_exports.enum(["js", "native"]).optional().describe(
|
|
152195
|
-
"
|
|
152197
|
+
"Use js for the app's JavaScript requests or native for requests captured by the native layer. Omit to control all supported layers.<flag:macos-apps> On Mac apps, this parameter supports only native. Read view-network-logs to start JavaScript capture in a React Native Mac app.</flag:macos-apps>"
|
|
152196
152198
|
),
|
|
152197
152199
|
logicalDeviceId: external_exports.string().min(1).optional().describe(
|
|
152198
152200
|
"Only when several devices share the Metro port: this device's logicalDeviceId, which the JS layer's reason lists. The JS layer connects to that runtime, and view-network-logs then takes it as device_id. The native layer always uses udid."
|
|
@@ -152201,7 +152203,7 @@ var captureSchema = external_exports.object({
|
|
|
152201
152203
|
function requestedLayers(layer) {
|
|
152202
152204
|
return { js: layer !== "native", native: layer !== "js" };
|
|
152203
152205
|
}
|
|
152204
|
-
var MACOS_NO_JS =
|
|
152206
|
+
var MACOS_NO_JS = `on a Mac app these tools act only on the native layer (view-network-logs starts the capture of a React Native app's JS runtime when it reads), so omit layer or pass layer "native"`;
|
|
152205
152207
|
function captureName(layer) {
|
|
152206
152208
|
return layer === "js" ? "JS network capture" : layer === "native" ? "native network capture" : "network capture";
|
|
152207
152209
|
}
|
|
@@ -164516,15 +164518,14 @@ init_zod();
|
|
|
164516
164518
|
var zodSchema31 = external_exports.object({
|
|
164517
164519
|
port: metroPortField,
|
|
164518
164520
|
device_id: external_exports.string().describe(
|
|
164519
|
-
"Device id from list-devices: iOS simulator UDID, Android serial, Vega serial (amazon-...),
|
|
164521
|
+
"Device id from list-devices: iOS simulator UDID, Android serial, Vega serial (amazon-...), <flag:macos-apps>Mac app id (macos-app-<bundle id>), </flag:macos-apps>or Chromium device id (chromium-cdp-<port>)."
|
|
164520
164522
|
)
|
|
164521
164523
|
});
|
|
164522
164524
|
var debuggerConnectTool = {
|
|
164523
164525
|
id: "debugger-connect",
|
|
164524
|
-
description: `Connect to
|
|
164525
|
-
iOS
|
|
164526
|
-
Returns connection
|
|
164527
|
-
Use when starting a debug session or before calling other debugger-* tools. Fails if the runtime is unreachable (Metro down, or Chromium CDP terminated).`,
|
|
164526
|
+
description: `Connect to an app's JavaScript debugger and start collecting console logs. Reuses an existing connection. React Native apps connect through Metro. Chromium uses the page's existing CDP session.<flag:macos-apps> Mac apps need a Debug build that loads JavaScript from Metro (react-native-macos 0.76+ or React Native for Mac Catalyst). Launch Mac Catalyst through Argent so it can identify the runtime.</flag:macos-apps>
|
|
164527
|
+
Use when starting a debug session or before calling other debugger-* tools. Keep the same device_id for later debugger calls. If shared Metro reports an ambiguous iOS simulator or Android target, retry with the intended device's logicalDeviceId from the error.<flag:macos-apps> Keep the Mac app id on shared Metro. If its runtime is missing, check the build and Metro port. The listed IDs belong to other targets.</flag:macos-apps>
|
|
164528
|
+
Returns connection details and, after a crash, a note with the previous log path if available. On Chromium or legacy Metro (such as Vega), projectRoot is empty. Fails if the runtime is unreachable.`,
|
|
164528
164529
|
zodSchema: zodSchema31,
|
|
164529
164530
|
interaction: {
|
|
164530
164531
|
startedMsg: () => "Connecting JavaScript debugger",
|
|
@@ -164560,7 +164561,7 @@ init_device_info();
|
|
|
164560
164561
|
var zodSchema32 = external_exports.object({
|
|
164561
164562
|
port: metroPortField,
|
|
164562
164563
|
device_id: external_exports.string().describe(
|
|
164563
|
-
"Device id
|
|
164564
|
+
"Device id used with debugger-connect<flag:macos-apps>. For macOS, use the Mac app id</flag:macos-apps>."
|
|
164564
164565
|
)
|
|
164565
164566
|
});
|
|
164566
164567
|
function createDebuggerStatusTool(registry2) {
|
|
@@ -164666,13 +164667,13 @@ function guardModuleLoadErrors(expression) {
|
|
|
164666
164667
|
var zodSchema33 = external_exports.object({
|
|
164667
164668
|
port: metroPortField,
|
|
164668
164669
|
device_id: external_exports.string().describe(
|
|
164669
|
-
"Device id
|
|
164670
|
+
"Device id used with debugger-connect<flag:macos-apps>. For macOS, use the Mac app id</flag:macos-apps>."
|
|
164670
164671
|
),
|
|
164671
164672
|
expression: external_exports.string().describe("JavaScript expression to evaluate in the app runtime")
|
|
164672
164673
|
});
|
|
164673
164674
|
var debuggerEvaluateTool = {
|
|
164674
164675
|
id: "debugger-evaluate",
|
|
164675
|
-
description: `
|
|
164676
|
+
description: `Run JavaScript in the app's runtime. React Native uses Hermes, including on Vega<flag:macos-apps> and Mac apps</flag:macos-apps>. Chromium uses V8.
|
|
164676
164677
|
Returns the result serialized by value as JSON, with deviceName, appName, and logicalDeviceId. A returned Promise is awaited and its resolved value returned. Use when you need to read app state, including localStorage and sessionStorage on Chromium, call app functions, or test logic at runtime. Cyclic objects, which many RN runtime values are (fiber nodes, navigation refs, global), fail with a serialization error. Fails if the expression throws or the runtime is not connected. On React Native, a module that fails to load while the expression runs (e.g. a lazy react-native export whose native module the app lacks) fails the call with that module's error instead of opening the app's red box.`,
|
|
164677
164678
|
zodSchema: zodSchema33,
|
|
164678
164679
|
searchHint: "javascript js eval expression runtime app state localstorage sessionstorage web storage",
|
|
@@ -164717,17 +164718,18 @@ Returns the result serialized by value as JSON, with deviceName, appName, and lo
|
|
|
164717
164718
|
|
|
164718
164719
|
// ../tool-server/src/tools/debugger/debugger-reload-metro.ts
|
|
164719
164720
|
init_zod();
|
|
164721
|
+
init_device_info();
|
|
164720
164722
|
init_src2();
|
|
164721
164723
|
var zodSchema34 = external_exports.object({
|
|
164722
164724
|
port: metroPortField,
|
|
164723
164725
|
device_id: external_exports.string().describe(
|
|
164724
|
-
"Device id
|
|
164726
|
+
"Device id used with debugger-connect<flag:macos-apps>. For macOS, use the Mac app id</flag:macos-apps>."
|
|
164725
164727
|
)
|
|
164726
164728
|
});
|
|
164727
164729
|
var debuggerReloadMetroTool = {
|
|
164728
164730
|
id: "debugger-reload-metro",
|
|
164729
164731
|
description: `Restart the Metro JS bundle in the connected React Native app without restarting the native process.
|
|
164730
|
-
Use when you want to apply code changes or reset JS state. Returns { reloaded, port, method (cdp or http), deviceName, appName, logicalDeviceId }. Fails if Metro is not running on the given port
|
|
164732
|
+
Use when you want to apply code changes or reset JS state. Returns { reloaded, port, method (cdp or http), deviceName, appName, logicalDeviceId }. Fails if Metro is not running on the given port.<flag:macos-apps> A Mac app reload targets only that app. If it fails, restart the app. A shared Metro reload would also reload other apps.</flag:macos-apps>`,
|
|
164731
164733
|
zodSchema: zodSchema34,
|
|
164732
164734
|
interaction: {
|
|
164733
164735
|
startedMsg: () => "Reloading the app through Metro",
|
|
@@ -164740,7 +164742,7 @@ Use when you want to apply code changes or reset JS state. Returns { reloaded, p
|
|
|
164740
164742
|
services: (params) => ({
|
|
164741
164743
|
debugger: `JsRuntimeDebugger:${metroPort(params)}:${canonicalDeviceId(params.device_id)}`
|
|
164742
164744
|
}),
|
|
164743
|
-
async execute(services,
|
|
164745
|
+
async execute(services, params) {
|
|
164744
164746
|
const api = services.debugger;
|
|
164745
164747
|
const port = api.port;
|
|
164746
164748
|
const disableLogBox = () => new Promise((resolve21) => setTimeout(resolve21, 2e3)).then(
|
|
@@ -164756,7 +164758,18 @@ Use when you want to apply code changes or reset JS state. Returns { reloaded, p
|
|
|
164756
164758
|
await api.cdp.send("Page.reload");
|
|
164757
164759
|
void disableLogBox();
|
|
164758
164760
|
return { reloaded: true, port, method: "cdp", ...context2 };
|
|
164759
|
-
} catch {
|
|
164761
|
+
} catch (err) {
|
|
164762
|
+
if (canonicalDeviceId(params.device_id)?.startsWith(MACOS_APP_ID_PREFIX)) {
|
|
164763
|
+
throw new FailureError(
|
|
164764
|
+
`Failed to reload the Mac app: CDP Page.reload failed (${err instanceof Error ? err.message : String(err)}). argent does not fall back to Metro's HTTP /reload for a Mac app, because that reloads every app on this Metro. Restart the app (restart-app) instead.`,
|
|
164765
|
+
{
|
|
164766
|
+
error_code: FAILURE_CODES.DEBUGGER_RELOAD_FAILED,
|
|
164767
|
+
failure_stage: "debugger_reload_metro",
|
|
164768
|
+
failure_area: "tool_server",
|
|
164769
|
+
error_kind: "network"
|
|
164770
|
+
}
|
|
164771
|
+
);
|
|
164772
|
+
}
|
|
164760
164773
|
}
|
|
164761
164774
|
const res = await fetch(`http://127.0.0.1:${port}/reload`, {
|
|
164762
164775
|
method: "POST"
|
|
@@ -164784,10 +164797,12 @@ var crypto4 = __toESM(require("node:crypto"));
|
|
|
164784
164797
|
// ../tool-server/src/utils/debugger/scripts/component-tree.ts
|
|
164785
164798
|
function makeComponentTreeScript(opts) {
|
|
164786
164799
|
const trackSkipped = opts?.includeSkipped ? "true" : "false";
|
|
164800
|
+
const addRootOffset = opts?.addRootOffset ? "true" : "false";
|
|
164787
164801
|
const requestId = JSON.stringify(opts.requestId);
|
|
164788
164802
|
return `(async function() {
|
|
164789
164803
|
var REQUEST_ID = ${requestId};
|
|
164790
164804
|
var TRACK_SKIPPED = ${trackSkipped};
|
|
164805
|
+
var ADD_ROOT_OFFSET = ${addRootOffset};
|
|
164791
164806
|
// Deliver errors through the SAME binding channel as the success path. The
|
|
164792
164807
|
// consumer (evaluateWithBinding) runs Runtime.evaluate WITHOUT returnByValue/
|
|
164793
164808
|
// awaitPromise, so the IIFE's return value is discarded \u2014 a 'return' here never
|
|
@@ -164958,12 +164973,14 @@ function makeComponentTreeScript(opts) {
|
|
|
164958
164973
|
// a primitive id (numeric nativeTag, WeakMap-by-identity fallback) per above.
|
|
164959
164974
|
var _canon = fiber.stateNode.canonical;
|
|
164960
164975
|
var _sn = fiber.stateNode.node || null;
|
|
164976
|
+
var _pi = _canon.publicInstance || null;
|
|
164961
164977
|
return {
|
|
164962
164978
|
f: true,
|
|
164963
164979
|
n: typeof _canon.nativeTag === 'number' ? _canon.nativeTag : _sn,
|
|
164964
164980
|
key: fabricKey(_canon.nativeTag, _sn),
|
|
164965
|
-
pi:
|
|
164966
|
-
sn: _sn
|
|
164981
|
+
pi: _pi,
|
|
164982
|
+
sn: _sn,
|
|
164983
|
+
anchor: !ADD_ROOT_OFFSET || (_pi && typeof _pi.measureInWindow === 'function') ? null : findOffsetAnchor(fiber.return)
|
|
164967
164984
|
};
|
|
164968
164985
|
}
|
|
164969
164986
|
if (useFabric && fiber.stateNode.node) {
|
|
@@ -164981,6 +164998,20 @@ function makeComponentTreeScript(opts) {
|
|
|
164981
164998
|
return null;
|
|
164982
164999
|
}
|
|
164983
165000
|
|
|
165001
|
+
// The nearest ancestor Fabric host whose public instance has measureInWindow:
|
|
165002
|
+
// it is in the same root view as the host below it, so the difference between
|
|
165003
|
+
// its window and page coordinates is that root view's offset in the window.
|
|
165004
|
+
function findOffsetAnchor(fiber) {
|
|
165005
|
+
for (var _d = 0; fiber && _d < 5000; _d++, fiber = fiber.return) {
|
|
165006
|
+
if (typeof fiber.type !== 'string' || !fiber.stateNode || !fiber.stateNode.canonical) continue;
|
|
165007
|
+
var _apn = fiber.stateNode.canonical.publicInstance;
|
|
165008
|
+
if (_apn && typeof _apn.measureInWindow === 'function' && fiber.stateNode.node) {
|
|
165009
|
+
return { key: fabricKey(fiber.stateNode.canonical.nativeTag, fiber.stateNode.node), pi: _apn, sn: fiber.stateNode.node };
|
|
165010
|
+
}
|
|
165011
|
+
}
|
|
165012
|
+
return null;
|
|
165013
|
+
}
|
|
165014
|
+
|
|
164984
165015
|
function findHostNode(fiber, d) {
|
|
164985
165016
|
if (!fiber || d > 15) return null;
|
|
164986
165017
|
var info = getHostInfo(fiber);
|
|
@@ -165103,6 +165134,48 @@ function makeComponentTreeScript(opts) {
|
|
|
165103
165134
|
}
|
|
165104
165135
|
}
|
|
165105
165136
|
|
|
165137
|
+
// Window offset of an anchor's root view, cached per anchor. Zero when it
|
|
165138
|
+
// cannot be measured, which keeps the page coordinates as they were.
|
|
165139
|
+
var offsetCache = {};
|
|
165140
|
+
function anchorOffset(anchor) {
|
|
165141
|
+
if (!anchor) return Promise.resolve({ dx: 0, dy: 0 });
|
|
165142
|
+
if (offsetCache[anchor.key]) return offsetCache[anchor.key];
|
|
165143
|
+
offsetCache[anchor.key] = new Promise(function(_resolve) {
|
|
165144
|
+
var _done = false;
|
|
165145
|
+
function resolve(v) { if (_done) return; _done = true; _resolve(v); }
|
|
165146
|
+
setTimeout(function() { resolve({ dx: 0, dy: 0 }); }, 600);
|
|
165147
|
+
try {
|
|
165148
|
+
anchor.pi.measureInWindow(function(wx, wy) {
|
|
165149
|
+
nativeFabricUIManager.measure(anchor.sn, function(x, y, w, h, px, py) {
|
|
165150
|
+
resolve({ dx: wx - px, dy: wy - py });
|
|
165151
|
+
});
|
|
165152
|
+
});
|
|
165153
|
+
} catch (e) { resolve({ dx: 0, dy: 0 }); }
|
|
165154
|
+
});
|
|
165155
|
+
return offsetCache[anchor.key];
|
|
165156
|
+
}
|
|
165157
|
+
|
|
165158
|
+
// Paper on a Mac app: the title bar height above the content view, or 0.
|
|
165159
|
+
function paperTitleBar() {
|
|
165160
|
+
if (!ADD_ROOT_OFFSET || useFabric || !(screenW > 0)) return Promise.resolve(0);
|
|
165161
|
+
var _ci = root.current && root.current.stateNode && root.current.stateNode.containerInfo;
|
|
165162
|
+
var _tag = _ci && typeof _ci.containerTag === 'number' ? _ci.containerTag : (typeof _ci === 'number' ? _ci : null);
|
|
165163
|
+
if (_tag === null || typeof UIManagerMod.measureInWindow !== 'function') return Promise.resolve(0);
|
|
165164
|
+
return new Promise(function(_resolve) {
|
|
165165
|
+
var _done = false;
|
|
165166
|
+
function resolve(v) { if (_done) return; _done = true; _resolve(v); }
|
|
165167
|
+
setTimeout(function() { resolve(0); }, 600);
|
|
165168
|
+
try {
|
|
165169
|
+
UIManagerMod.measureInWindow(_tag, function(cx, cy, cw, ch) {
|
|
165170
|
+
var bar = screenH - ch;
|
|
165171
|
+
var fills = Math.abs(cx) < 1 && Math.abs(cy) < 1 && Math.abs(cw - screenW) <= 1;
|
|
165172
|
+
resolve(fills && bar > 0 && bar <= 120 ? bar : 0);
|
|
165173
|
+
});
|
|
165174
|
+
} catch (e) { resolve(0); }
|
|
165175
|
+
});
|
|
165176
|
+
}
|
|
165177
|
+
var paperDy = await paperTitleBar();
|
|
165178
|
+
|
|
165106
165179
|
function measureOne(info) {
|
|
165107
165180
|
return new Promise(function(_resolve) {
|
|
165108
165181
|
// Guard against measure callbacks that never fire (detached / off-screen
|
|
@@ -165121,15 +165194,17 @@ function makeComponentTreeScript(opts) {
|
|
|
165121
165194
|
});
|
|
165122
165195
|
} else if (typeof nativeFabricUIManager !== 'undefined' && typeof nativeFabricUIManager.measure === 'function') {
|
|
165123
165196
|
nativeFabricUIManager.measure(info.sn || info.n, function(x, y, w, h, px, py) {
|
|
165124
|
-
if (w > 0 && h > 0)
|
|
165125
|
-
|
|
165197
|
+
if (!(w > 0 && h > 0)) { resolve(null); return; }
|
|
165198
|
+
anchorOffset(info.anchor).then(function(o) {
|
|
165199
|
+
resolve({ x: Math.round(px + o.dx), y: Math.round(py + o.dy), w: Math.round(w), h: Math.round(h) });
|
|
165200
|
+
});
|
|
165126
165201
|
});
|
|
165127
165202
|
} else {
|
|
165128
165203
|
resolve(null);
|
|
165129
165204
|
}
|
|
165130
165205
|
} else {
|
|
165131
165206
|
UIManagerMod.measureInWindow(info.n, function(x, y, w, h) {
|
|
165132
|
-
if (w > 0 && h > 0) resolve({ x: Math.round(x), y: Math.round(y), w: Math.round(w), h: Math.round(h) });
|
|
165207
|
+
if (w > 0 && h > 0) resolve({ x: Math.round(x), y: Math.round(y + paperDy), w: Math.round(w), h: Math.round(h) });
|
|
165133
165208
|
else resolve(null);
|
|
165134
165209
|
});
|
|
165135
165210
|
}
|
|
@@ -165205,6 +165280,7 @@ function makeComponentTreeScript(opts) {
|
|
|
165205
165280
|
}
|
|
165206
165281
|
|
|
165207
165282
|
// ../tool-server/src/tools/debugger/debugger-component-tree.ts
|
|
165283
|
+
init_device_info();
|
|
165208
165284
|
function rectsOverlap(a, b) {
|
|
165209
165285
|
return Math.abs(a.x - b.x) < 8 && Math.abs(a.y - b.y) < 8 && Math.abs(a.w - b.w) < 8 && Math.abs(a.h - b.h) < 8;
|
|
165210
165286
|
}
|
|
@@ -165538,7 +165614,7 @@ function buildTextTree(data, opts) {
|
|
|
165538
165614
|
var zodSchema35 = external_exports.object({
|
|
165539
165615
|
port: metroPortField,
|
|
165540
165616
|
device_id: external_exports.string().describe(
|
|
165541
|
-
"Device id
|
|
165617
|
+
"Device id used with debugger-connect<flag:macos-apps>. For macOS, use the Mac app id</flag:macos-apps>."
|
|
165542
165618
|
),
|
|
165543
165619
|
onScreenOnly: external_exports.boolean().default(true).describe(
|
|
165544
165620
|
"When true, only components visible on screen are returned. Set to false to include all mounted components, including those scrolled off-screen, e.g. to understand the full page structure."
|
|
@@ -165555,7 +165631,7 @@ function createDebuggerComponentTreeTool() {
|
|
|
165555
165631
|
id: "debugger-component-tree",
|
|
165556
165632
|
description: `Fetch the current screen of a running React Native app as a compact tree of React components.
|
|
165557
165633
|
Each on-screen component is listed with its name, its text (or accessibilityLabel when it has no
|
|
165558
|
-
text), [testID=\u2026] and
|
|
165634
|
+
text), [testID=\u2026] and its center as (tap: x,y) fractions of the screen<flag:macos-apps> or Mac app window, including the title bar</flag:macos-apps>.
|
|
165559
165635
|
Full-screen transparent wrappers and implementation-detail components are pruned. Wrappers the size
|
|
165560
165636
|
of their parent are pruned too, so a missing name proves nothing: check with debugger-inspect-element.
|
|
165561
165637
|
|
|
@@ -165563,7 +165639,7 @@ Use when you need what describe does not show: a testID for a selector (on Andro
|
|
|
165563
165639
|
the testID of a view that has no label and is not tappable), or the component names and nesting
|
|
165564
165640
|
behind the screen before editing code. To find what to tap, use describe.
|
|
165565
165641
|
|
|
165566
|
-
Returns a compact text tree; call again after navigation. Fails if the Metro debugger is
|
|
165642
|
+
Returns a compact text tree; call again after navigation. Fails if the Metro debugger is disconnected.<flag:macos-apps> On Mac apps with several React Native windows, the tool uses the root with the most components. With the old architecture (Paper), native views around the React root can shift tap points. Use describe for tap targets.</flag:macos-apps>`,
|
|
165567
165643
|
zodSchema: zodSchema35,
|
|
165568
165644
|
searchHint: "react native component tree testID testIDs selector component names hierarchy",
|
|
165569
165645
|
readOnly: true,
|
|
@@ -165583,7 +165659,8 @@ Returns a compact text tree; call again after navigation. Fails if the Metro deb
|
|
|
165583
165659
|
const requestId = crypto4.randomUUID();
|
|
165584
165660
|
const script = makeComponentTreeScript({
|
|
165585
165661
|
includeSkipped: params.includeSkipped,
|
|
165586
|
-
requestId
|
|
165662
|
+
requestId,
|
|
165663
|
+
addRootOffset: !!canonicalDeviceId(params.device_id)?.startsWith(MACOS_APP_ID_PREFIX)
|
|
165587
165664
|
});
|
|
165588
165665
|
const response = await api.cdp.evaluateWithBinding(script, requestId, {
|
|
165589
165666
|
timeout: 15e3
|
|
@@ -165620,7 +165697,7 @@ var crypto5 = __toESM(require("node:crypto"));
|
|
|
165620
165697
|
var INSPECT_NO_DEVTOOLS_HOOK_ERROR = "React DevTools hook (__REACT_DEVTOOLS_GLOBAL_HOOK__) is not present in this app's JavaScript runtime. Component inspection requires a development build with React DevTools enabled. Likely causes: (1) the app is a release/production build \u2014 DevTools is stripped to reduce bundle size; (2) you connected to the wrong JS runtime; (3) this isn't a React (Native) app. Fix: rebuild in debug/dev mode (e.g. `npx react-native run-ios` without --configuration Release; for Expo, run a dev client).";
|
|
165621
165698
|
var INSPECT_NO_RENDERER_ERROR = "React DevTools hook is present but no renderer has registered yet. Component inspection requires the React renderer to be attached \u2014 wait for the app to render its first commit, then retry. If this persists, confirm the app is a React (Native) app running in development mode.";
|
|
165622
165699
|
var INSPECT_NO_FIBER_ROOT_ERROR = "React DevTools is attached but no fiber root has mounted yet. Wait for the app to render its first frame and retry.";
|
|
165623
|
-
function makeInspectScript(x, y, requestId) {
|
|
165700
|
+
function makeInspectScript(x, y, requestId, opts = {}) {
|
|
165624
165701
|
const noHookMsg = JSON.stringify(INSPECT_NO_DEVTOOLS_HOOK_ERROR);
|
|
165625
165702
|
const noRendererMsg = JSON.stringify(INSPECT_NO_RENDERER_ERROR);
|
|
165626
165703
|
const noRootMsg = JSON.stringify(INSPECT_NO_FIBER_ROOT_ERROR);
|
|
@@ -165780,18 +165857,75 @@ function makeInspectScript(x, y, requestId) {
|
|
|
165780
165857
|
// pre-container-anchor code did, rather than reporting no host fiber).
|
|
165781
165858
|
var inspectRef = null;
|
|
165782
165859
|
var foundAnchor = false;
|
|
165860
|
+
var hostFiberForOffset = null;
|
|
165783
165861
|
var containerInfo = root.current && root.current.stateNode && root.current.stateNode.containerInfo;
|
|
165784
165862
|
if (!useFabric && containerInfo && typeof containerInfo.containerTag === 'number') {
|
|
165785
165863
|
inspectRef = { _nativeTag: containerInfo.containerTag, _internalFiberInstanceHandleDEV: root.current };
|
|
165786
165864
|
foundAnchor = true;
|
|
165787
165865
|
} else {
|
|
165788
165866
|
var hostFiber = findHostFiber(root.current.child, 0);
|
|
165789
|
-
if (hostFiber) { inspectRef = getInspectRef(hostFiber); foundAnchor = true; }
|
|
165867
|
+
if (hostFiber) { inspectRef = getInspectRef(hostFiber); foundAnchor = true; hostFiberForOffset = hostFiber; }
|
|
165790
165868
|
}
|
|
165791
165869
|
if (!foundAnchor) { __argent_callback(JSON.stringify({requestId:${ridLiteral},type:'inspect_result',error:'no host fiber'})); return; }
|
|
165792
165870
|
|
|
165871
|
+
// A react-native export (UIManager, Dimensions) found among Metro's modules,
|
|
165872
|
+
// the way debugger-component-tree finds them.
|
|
165873
|
+
function findRNExport(name) {
|
|
165874
|
+
if (typeof __r !== 'function') return null;
|
|
165875
|
+
if (typeof __r.getModules === 'function') {
|
|
165876
|
+
var _mods = __r.getModules();
|
|
165877
|
+
for (var _entry of _mods) {
|
|
165878
|
+
if (!_entry[1].isInitialized) continue;
|
|
165879
|
+
try { var m = __r(_entry[0]); if (m && m[name]) return m[name]; } catch (e) {}
|
|
165880
|
+
}
|
|
165881
|
+
return null;
|
|
165882
|
+
}
|
|
165883
|
+
for (var i = 0; i < 300; i++) {
|
|
165884
|
+
try { var m2 = __r(i); if (m2 && m2[name]) return m2[name]; } catch (e) {}
|
|
165885
|
+
}
|
|
165886
|
+
return null;
|
|
165887
|
+
}
|
|
165888
|
+
|
|
165889
|
+
// Calls done(dx, dy) with the root view's offset in the window, or (0, 0)
|
|
165890
|
+
// when it is not wanted or cannot be measured (no measure API).
|
|
165891
|
+
function withRootOffset(done) {
|
|
165892
|
+
var _called = false;
|
|
165893
|
+
function finish(dx, dy) { if (_called) return; _called = true; done(dx, dy); }
|
|
165894
|
+
if (!${opts.subtractRootOffset ? "true" : "false"} || !inspectRef) { finish(0, 0); return; }
|
|
165895
|
+
if (!useFabric) {
|
|
165896
|
+
// Only the root container fills the content view, so a host-fiber anchor
|
|
165897
|
+
// (no containerTag) gives no title bar height.
|
|
165898
|
+
var _uim = containerInfo && typeof containerInfo.containerTag === 'number' ? findRNExport('UIManager') : null;
|
|
165899
|
+
var _dims = _uim ? findRNExport('Dimensions') : null;
|
|
165900
|
+
var _win = _dims && typeof _dims.get === 'function' ? _dims.get('window') : null;
|
|
165901
|
+
if (!_uim || typeof _uim.measureInWindow !== 'function' || !_win || !(_win.width > 0)) { finish(0, 0); return; }
|
|
165902
|
+
setTimeout(function() { finish(0, 0); }, 600);
|
|
165903
|
+
try {
|
|
165904
|
+
_uim.measureInWindow(containerInfo.containerTag, function(cx, cy, cw, ch) {
|
|
165905
|
+
var _bar = _win.height - ch;
|
|
165906
|
+
var _fills = Math.abs(cx) < 1 && Math.abs(cy) < 1 && Math.abs(cw - _win.width) <= 1;
|
|
165907
|
+
finish(0, _fills && _bar > 0 && _bar <= 120 ? _bar : 0);
|
|
165908
|
+
});
|
|
165909
|
+
} catch (e) { finish(0, 0); }
|
|
165910
|
+
return;
|
|
165911
|
+
}
|
|
165912
|
+
var anchorNode = hostFiberForOffset && hostFiberForOffset.stateNode && hostFiberForOffset.stateNode.node;
|
|
165913
|
+
if (typeof inspectRef.measureInWindow !== 'function' || !anchorNode ||
|
|
165914
|
+
typeof nativeFabricUIManager.measure !== 'function') { finish(0, 0); return; }
|
|
165915
|
+
setTimeout(function() { finish(0, 0); }, 600);
|
|
165916
|
+
try {
|
|
165917
|
+
inspectRef.measureInWindow(function(wx, wy) {
|
|
165918
|
+
nativeFabricUIManager.measure(anchorNode, function(_x, _y, _w, _h, px, py) {
|
|
165919
|
+
finish(wx - px, wy - py);
|
|
165920
|
+
});
|
|
165921
|
+
});
|
|
165922
|
+
} catch (e) { finish(0, 0); }
|
|
165923
|
+
}
|
|
165924
|
+
|
|
165925
|
+
withRootOffset(function(dx, dy) {
|
|
165926
|
+
try {
|
|
165793
165927
|
renderer.rendererConfig.getInspectorDataForViewAtPoint(
|
|
165794
|
-
inspectRef,
|
|
165928
|
+
inspectRef, Math.round(${x} - dx), Math.round(${y} - dy),
|
|
165795
165929
|
function(data) {
|
|
165796
165930
|
var items = [];
|
|
165797
165931
|
var fiber = data.closestInstance;
|
|
@@ -165819,6 +165953,10 @@ function makeInspectScript(x, y, requestId) {
|
|
|
165819
165953
|
__argent_callback(JSON.stringify({ requestId:${ridLiteral}, type:'inspect_result', x:${Math.round(x)}, y:${Math.round(y)}, items:items }));
|
|
165820
165954
|
}
|
|
165821
165955
|
);
|
|
165956
|
+
} catch (e) {
|
|
165957
|
+
__argent_fail('Inspect script crashed: ' + (e && e.message ? e.message : String(e)));
|
|
165958
|
+
}
|
|
165959
|
+
});
|
|
165822
165960
|
return 'ok';
|
|
165823
165961
|
} catch (e) {
|
|
165824
165962
|
__argent_fail('Inspect script crashed: ' + (e && e.message ? e.message : String(e)));
|
|
@@ -165971,6 +166109,7 @@ function shouldSkip(name) {
|
|
|
165971
166109
|
}
|
|
165972
166110
|
|
|
165973
166111
|
// ../tool-server/src/tools/debugger/debugger-inspect-element.ts
|
|
166112
|
+
init_device_info();
|
|
165974
166113
|
function hasRealSource(item) {
|
|
165975
166114
|
return item.source !== null && !/^https?:\/\//.test(item.source.file);
|
|
165976
166115
|
}
|
|
@@ -166044,10 +166183,14 @@ function filterInspectItems(items, includeSkipped = false) {
|
|
|
166044
166183
|
var zodSchema36 = external_exports.object({
|
|
166045
166184
|
port: metroPortField,
|
|
166046
166185
|
device_id: external_exports.string().describe(
|
|
166047
|
-
"Device id
|
|
166186
|
+
"Device id used with debugger-connect<flag:macos-apps>. For macOS, use the Mac app id</flag:macos-apps>."
|
|
166187
|
+
),
|
|
166188
|
+
x: external_exports.coerce.number().describe(
|
|
166189
|
+
"Horizontal position in logical pixels from the left edge of the screen<flag:macos-apps>, or in points from the left edge of the Mac app window, title bar included</flag:macos-apps>."
|
|
166190
|
+
),
|
|
166191
|
+
y: external_exports.coerce.number().describe(
|
|
166192
|
+
"Vertical position in logical pixels from the top edge of the screen<flag:macos-apps>, or in points from the top edge of the Mac app window, title bar included</flag:macos-apps>."
|
|
166048
166193
|
),
|
|
166049
|
-
x: external_exports.coerce.number().describe("X coordinate on device screen, in logical pixels (not normalized 0\u20131)"),
|
|
166050
|
-
y: external_exports.coerce.number().describe("Y coordinate on device screen, in logical pixels (not normalized 0\u20131)"),
|
|
166051
166194
|
contextLines: external_exports.coerce.number().default(3).describe("Lines of source context to include around the component definition"),
|
|
166052
166195
|
resolveSourceMaps: external_exports.boolean().default(true).describe(
|
|
166053
166196
|
"When true, resolves bundled frame locations to original source files via Metro symbolication and includes a code fragment. When false, returns the raw bundled frame info (file, line, column) without a code fragment."
|
|
@@ -166066,7 +166209,7 @@ Returns components from the tapped element upward through its parent hierarchy,
|
|
|
166066
166209
|
each with its source file:line and a code fragment.
|
|
166067
166210
|
The first items (lowest indices) are the most specific: the exact component under
|
|
166068
166211
|
the tap point and its direct parents. Higher indices are broader context (page, navigator).
|
|
166069
|
-
Use when you need the source file and line for a component at a
|
|
166212
|
+
Use when you need the source file and line for a component at a point. Convert fractions from debugger-component-tree using the width and height in its Screen line. Fails if the app is disconnected or the point is outside the screen.<flag:macos-apps> On Mac apps with several React Native windows, the tool uses the root with the most components. With the old architecture (Paper), native views around the React root can shift the result. Check the returned component against the intended control.</flag:macos-apps>`,
|
|
166070
166213
|
zodSchema: zodSchema36,
|
|
166071
166214
|
readOnly: true,
|
|
166072
166215
|
interaction: {
|
|
@@ -166083,7 +166226,9 @@ Use when you need the source file and line for a component at a tap coordinate.
|
|
|
166083
166226
|
async execute(services, params) {
|
|
166084
166227
|
const api = services.debugger;
|
|
166085
166228
|
const requestId = crypto5.randomUUID();
|
|
166086
|
-
const script = makeInspectScript(params.x, params.y, requestId
|
|
166229
|
+
const script = makeInspectScript(params.x, params.y, requestId, {
|
|
166230
|
+
subtractRootOffset: !!canonicalDeviceId(params.device_id)?.startsWith(MACOS_APP_ID_PREFIX)
|
|
166231
|
+
});
|
|
166087
166232
|
const raw = await api.cdp.evaluateWithBinding(script, requestId, {
|
|
166088
166233
|
timeout: 8e3
|
|
166089
166234
|
});
|
|
@@ -166175,14 +166320,14 @@ init_zod();
|
|
|
166175
166320
|
var zodSchema37 = external_exports.object({
|
|
166176
166321
|
port: metroPortField,
|
|
166177
166322
|
device_id: external_exports.string().describe(
|
|
166178
|
-
"Device id
|
|
166323
|
+
"Device id used with debugger-connect<flag:macos-apps>. For macOS, use the Mac app id</flag:macos-apps>."
|
|
166179
166324
|
)
|
|
166180
166325
|
});
|
|
166181
166326
|
function createDebuggerLogRegistryTool(registry2) {
|
|
166182
166327
|
return {
|
|
166183
166328
|
id: "debugger-log-registry",
|
|
166184
166329
|
description: `Get a summary of all console logs captured from the app's JS runtime.
|
|
166185
|
-
Returns the log file path, entry counts by level, and message clusters (grouped by similarity).
|
|
166330
|
+
Returns the log file path, entry counts by level, and message clusters (grouped by similarity). Supports React Native<flag:macos-apps> (including Mac apps)</flag:macos-apps> and Chromium.
|
|
166186
166331
|
Use when investigating warnings, errors, or unexpected output. Call this first for an overview, then Grep the returned file for details; never Read it whole, it can hold 50,000 lines. Returns empty stats if no log data has been captured yet, but check { note }, which is present only when { file } does not exist or holds fewer entries than totalEntries counts (failed writes, e.g. a full disk), or when the stats are empty BECAUSE the previous debugger session ended: torn down (its log file deleted) or cut off by an app crash (the note names its kept log file, if it had one). Without that note, empty means the app has logged nothing.
|
|
166187
166332
|
When the debugger cannot be reached, it returns { status: "not_connected", reason, detail, guidance } with NO log file. Follow the guidance (do not retry in a loop). Grep a log file in this state only when a { note } names one kept from before the app crashed. A "connected" result's stats may come from a session whose socket has since died. Use debugger-status, not this tool, to judge debugger health.`,
|
|
166188
166333
|
zodSchema: zodSchema37,
|
|
@@ -166388,7 +166533,7 @@ ${lines.join("\n")}`;
|
|
|
166388
166533
|
var zodSchema38 = external_exports.object({
|
|
166389
166534
|
port: metroPortField,
|
|
166390
166535
|
device_id: external_exports.string().describe(
|
|
166391
|
-
"Device id from list-devices
|
|
166536
|
+
"Device id from list-devices, or the logicalDeviceId used to start an iOS or Android capture on shared Metro<flag:macos-apps>. For macOS, use the Mac app id</flag:macos-apps>."
|
|
166392
166537
|
),
|
|
166393
166538
|
// `.default` covers only an omitted param, and `z.coerce.number()` reads null as 0, so
|
|
166394
166539
|
// null would return the oldest page. Agents send null for "not set": read it as "latest".
|
|
@@ -166402,7 +166547,9 @@ var networkLogsTool = {
|
|
|
166402
166547
|
Returns a paginated list of requests with method, URL, status, resource type, size, and duration.
|
|
166403
166548
|
A size with "~" is estimated from the body's length in characters; on React Native, "\u2192 <url>" is the final URL after a redirect.
|
|
166404
166549
|
Pass an entry's requestId to view-network-request-details for full details.
|
|
166405
|
-
On React Native
|
|
166550
|
+
On React Native, lists XMLHttpRequest (including axios), React Native fetch, Expo fetch, and requests from libraries such as react-native-fetch-api that call React Native's network module in a Metro development build.
|
|
166551
|
+
On iOS and Android, call network-capture-start before triggering requests and again after a reload. On Vega<flag:macos-apps> and React Native Mac apps</flag:macos-apps>, call this tool before triggering requests. The first read starts capture, and a read after a reload starts it again.<flag:macos-apps> Use native-network-logs for URLSession traffic on Mac apps. Both logs can contain the same fetch request.</flag:macos-apps>
|
|
166552
|
+
On Chromium, lists all request types for the active tab.
|
|
166406
166553
|
Use when inspecting outbound HTTP traffic or debugging API calls in the running app.
|
|
166407
166554
|
Fails if the app is not connected (RN) or the device is not reachable (Chromium).`,
|
|
166408
166555
|
zodSchema: zodSchema38,
|
|
@@ -166419,7 +166566,8 @@ Fails if the app is not connected (RN) or the device is not reachable (Chromium)
|
|
|
166419
166566
|
return { chromium: chromiumCdpRef(device) };
|
|
166420
166567
|
}
|
|
166421
166568
|
const payload = jsCapturePayload(jsReadPort(params), canonicalDeviceId(params.device_id));
|
|
166422
|
-
if (device.platform === "vega"
|
|
166569
|
+
if (device.platform === "vega" || device.platform === "macos")
|
|
166570
|
+
return { inspector: `NetworkInspector:${payload}` };
|
|
166423
166571
|
const capture = jsCapture(payload);
|
|
166424
166572
|
return capture ? { debugger: jsCaptureDebuggerRef(params, capture) } : {};
|
|
166425
166573
|
},
|
|
@@ -166430,7 +166578,7 @@ Fails if the app is not connected (RN) or the device is not reachable (Chromium)
|
|
|
166430
166578
|
return renderChromiumPage(chromium.server.network.requests(), params.pageIndex);
|
|
166431
166579
|
}
|
|
166432
166580
|
const port = jsReadPort(params);
|
|
166433
|
-
if (device.platform === "vega") {
|
|
166581
|
+
if (device.platform === "vega" || device.platform === "macos") {
|
|
166434
166582
|
const api = services.inspector;
|
|
166435
166583
|
const installError = await api.cdp.evaluate(NETWORK_INTERCEPTOR_SCRIPT).then(
|
|
166436
166584
|
() => void 0,
|
|
@@ -166555,7 +166703,7 @@ ${postData.slice(0, MAX_BODY_SIZE)}...`;
|
|
|
166555
166703
|
var zodSchema39 = external_exports.object({
|
|
166556
166704
|
port: metroPortField,
|
|
166557
166705
|
device_id: external_exports.string().describe(
|
|
166558
|
-
"Device id
|
|
166706
|
+
"Device id used to list the request<flag:macos-apps>. For macOS, use the Mac app id</flag:macos-apps>."
|
|
166559
166707
|
),
|
|
166560
166708
|
requestId: external_exports.string().describe(
|
|
166561
166709
|
"The requestId from view-network-logs, or a native ID (ios-, android-<flag:macos-apps> or macos-</flag:macos-apps>) from native-network-logs."
|
|
@@ -166564,10 +166712,11 @@ var zodSchema39 = external_exports.object({
|
|
|
166564
166712
|
});
|
|
166565
166713
|
var networkRequestTool = {
|
|
166566
166714
|
id: "view-network-request-details",
|
|
166567
|
-
description: `
|
|
166715
|
+
description: `Read the details of one request after listing captured traffic. Native requests can be read without a debugger connection.
|
|
166568
166716
|
Returns request/response headers (sensitive headers redacted), status, timing, the request body, and optionally the response body.
|
|
166569
166717
|
Request and response bodies over 1000 chars are cut to 1000 under a "[TRUNCATED: ...]" line that gives the full size; a binary response body is omitted, as is a binary request body of a native ID. For a native ID, a body that cannot be read shows "[unavailable: <reason>]"; when the reason says the app may still be sending the request body, call again once the request has ended. Use when you need headers, body, or timing for a specific request after listing logs.
|
|
166570
|
-
Returns an error message
|
|
166718
|
+
Returns an error message if the request is missing: list requests again. When the response says capture is off, start it and repeat the app action. On Vega<flag:macos-apps> and React Native Mac apps</flag:macos-apps>, a JS request lookup can start capture. Use view-network-logs to start capture before triggering a request.
|
|
166719
|
+
IDs from stopped capture still work. After a JavaScript reload, list requests again because an old JS ID may now refer to a different request.`,
|
|
166571
166720
|
zodSchema: zodSchema39,
|
|
166572
166721
|
readOnly: true,
|
|
166573
166722
|
interaction: {
|
|
@@ -166575,18 +166724,17 @@ Returns an error message string if the requestId is not found; on iOS<flag:macos
|
|
|
166575
166724
|
completedMsg: ({ params }) => `Read network request ${params.requestId}`,
|
|
166576
166725
|
failedMsg: ({ params, failureSignal: failureSignal2 }) => `Failed to read network request ${params.requestId}: ${failureSignal2.error_code}`
|
|
166577
166726
|
},
|
|
166578
|
-
// A Mac app has only native IDs, which need no debugger.
|
|
166579
166727
|
capability: { ...DEBUGGER_TOOL_CAPABILITY, macos: { app: true, catalyst: true } },
|
|
166580
166728
|
services: (params) => {
|
|
166581
166729
|
if (isNativeRequestId(params.requestId)) return {};
|
|
166582
166730
|
const device = resolveDevice(params.device_id);
|
|
166583
|
-
if (device.platform === "macos") return {};
|
|
166584
166731
|
if (device.platform === "chromium") {
|
|
166585
166732
|
return { chromium: chromiumCdpRef(device) };
|
|
166586
166733
|
}
|
|
166587
166734
|
if (nativeIdPlatform2(params.requestId)) return {};
|
|
166588
166735
|
const payload = jsCapturePayload(jsReadPort(params), canonicalDeviceId(params.device_id));
|
|
166589
|
-
if (device.platform === "vega"
|
|
166736
|
+
if (device.platform === "vega" || device.platform === "macos")
|
|
166737
|
+
return { inspector: `NetworkInspector:${payload}` };
|
|
166590
166738
|
const capture = jsCapture(payload);
|
|
166591
166739
|
return capture ? { debugger: jsCaptureDebuggerRef(params, capture) } : {};
|
|
166592
166740
|
},
|
|
@@ -166604,13 +166752,6 @@ Returns an error message string if the requestId is not found; on iOS<flag:macos
|
|
|
166604
166752
|
return found ? nativeRequestDetails(found.record, found.records, params.includeBody) : nativeNotFound(params.requestId, params.device_id, "macos");
|
|
166605
166753
|
}
|
|
166606
166754
|
const device = resolveDevice(params.device_id);
|
|
166607
|
-
if (device.platform === "macos") {
|
|
166608
|
-
return nativeNotFound(
|
|
166609
|
-
params.requestId,
|
|
166610
|
-
params.device_id,
|
|
166611
|
-
nativeIdPlatform2(params.requestId) ?? "macos"
|
|
166612
|
-
);
|
|
166613
|
-
}
|
|
166614
166755
|
if (device.platform === "chromium") {
|
|
166615
166756
|
const chromium = services.chromium;
|
|
166616
166757
|
const rec = chromium.server.network.get(params.requestId);
|
|
@@ -166665,7 +166806,7 @@ Returns an error message string if the requestId is not found; on iOS<flag:macos
|
|
|
166665
166806
|
if (nativePlatform) return nativeNotFound(params.requestId, params.device_id, nativePlatform);
|
|
166666
166807
|
let cdp;
|
|
166667
166808
|
let noLog;
|
|
166668
|
-
if (device.platform === "vega") {
|
|
166809
|
+
if (device.platform === "vega" || device.platform === "macos") {
|
|
166669
166810
|
const api = services.inspector;
|
|
166670
166811
|
await api.cdp.evaluate(NETWORK_INTERCEPTOR_SCRIPT).catch(() => {
|
|
166671
166812
|
});
|
|
@@ -166748,6 +166889,9 @@ function nativeNotFound(requestId, deviceId, layer) {
|
|
|
166748
166889
|
if (platform === "chromium" || platform === "vega") {
|
|
166749
166890
|
return `Request ${requestId} not found. ${layer === "macos" ? "A" : "An"} ${prefix} ID comes from ${source}. Use view-network-logs to list this device's requests.`;
|
|
166750
166891
|
}
|
|
166892
|
+
if (platform === "macos" && layer !== "macos") {
|
|
166893
|
+
return `Request ${requestId} not found. An ${prefix} ID comes from ${source}. Use native-network-logs or view-network-logs to list this Mac app's requests.`;
|
|
166894
|
+
}
|
|
166751
166895
|
const captured = layer === "android" ? hasAndroidNetworkCapture() : layer === "ios" ? hasIosNetworkCapture() : hasMacosNetworkCapture();
|
|
166752
166896
|
return captured ? `Request ${requestId} not found. Use native-network-logs to list the requests the ${name} native layer recorded.` : `Request ${requestId} not found. Native network capture is not started, so no requests are recorded. Call network-capture-start with udid and bundleId, repeat the action, then list the requests with native-network-logs.`;
|
|
166753
166897
|
}
|
|
@@ -169537,7 +169681,7 @@ Fails if the Hermes runtime is not reachable or the Metro CDP connection cannot
|
|
|
169537
169681
|
completedMsg: ({ result }) => result.already_running ? "React profiler was already running" : "Started React profiler",
|
|
169538
169682
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to start React profiler: ${failureSignal2.error_code}`
|
|
169539
169683
|
},
|
|
169540
|
-
capability:
|
|
169684
|
+
capability: RN_ONLY_TOOL_CAPABILITY,
|
|
169541
169685
|
services: () => ({}),
|
|
169542
169686
|
async execute(_services, params) {
|
|
169543
169687
|
const deviceId = canonicalDeviceId(params.device_id);
|
|
@@ -170622,7 +170766,7 @@ Fails if no active profiling session exists, another stop is running, the CDP co
|
|
|
170622
170766
|
completedMsg: () => "Stopped React profiler",
|
|
170623
170767
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to stop React profiler: ${failureSignal2.error_code}`
|
|
170624
170768
|
},
|
|
170625
|
-
capability:
|
|
170769
|
+
capability: RN_ONLY_TOOL_CAPABILITY,
|
|
170626
170770
|
services: () => ({}),
|
|
170627
170771
|
async execute(_services, params) {
|
|
170628
170772
|
const port = metroPort(params);
|
|
@@ -170934,7 +171078,7 @@ function createReactProfilerStatusTool(registry2) {
|
|
|
170934
171078
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to check React profiler: ${failureSignal2.error_code}`
|
|
170935
171079
|
},
|
|
170936
171080
|
// RN-only: companion to react-profiler-start.
|
|
170937
|
-
capability:
|
|
171081
|
+
capability: RN_ONLY_TOOL_CAPABILITY,
|
|
170938
171082
|
services: () => ({}),
|
|
170939
171083
|
async execute(_services, params) {
|
|
170940
171084
|
const port = metroPort(params);
|
|
@@ -172636,7 +172780,7 @@ Fails if react-profiler-stop has not been called or no profiling data is stored.
|
|
|
172636
172780
|
},
|
|
172637
172781
|
// RN-only: reads commit data captured via the React DevTools backend, which
|
|
172638
172782
|
// Chromium does not have.
|
|
172639
|
-
capability:
|
|
172783
|
+
capability: RN_ONLY_TOOL_CAPABILITY,
|
|
172640
172784
|
services: () => ({}),
|
|
172641
172785
|
async execute(_services, params, ctx) {
|
|
172642
172786
|
const sessionPaths = getCachedProfilerPaths(
|
|
@@ -172838,7 +172982,7 @@ When several files define a component with the same name (e.g. platform variants
|
|
|
172838
172982
|
// Declared so the tool catalogue groups this with the other react-profiler-*
|
|
172839
172983
|
// tools; the HTTP gate itself is a no-op here, as there is no device arg to
|
|
172840
172984
|
// inspect.
|
|
172841
|
-
capability:
|
|
172985
|
+
capability: RN_ONLY_TOOL_CAPABILITY,
|
|
172842
172986
|
fileInputs,
|
|
172843
172987
|
services: () => ({}),
|
|
172844
172988
|
async execute(_services, params) {
|
|
@@ -172978,7 +173122,7 @@ Fails if react-profiler-stop has not been called or no CPU profile is stored.`,
|
|
|
172978
173122
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to summarize React CPU profile: ${failureSignal2.error_code}`
|
|
172979
173123
|
},
|
|
172980
173124
|
// RN-only: reads a Hermes CPU profile; Chromium's V8 sample format differs.
|
|
172981
|
-
capability:
|
|
173125
|
+
capability: RN_ONLY_TOOL_CAPABILITY,
|
|
172982
173126
|
services: () => ({}),
|
|
172983
173127
|
async execute(_services, params) {
|
|
172984
173128
|
const sessionPaths = getCachedProfilerPaths(metroPort(params), params.device_id);
|
|
@@ -173099,7 +173243,7 @@ Fails if the React DevTools hook is not present in the runtime or the app is not
|
|
|
173099
173243
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to read React render activity: ${failureSignal2.error_code}`
|
|
173100
173244
|
},
|
|
173101
173245
|
// RN-only: queries the React DevTools backend hook on the live runtime.
|
|
173102
|
-
capability:
|
|
173246
|
+
capability: RN_ONLY_TOOL_CAPABILITY,
|
|
173103
173247
|
services: (params) => ({
|
|
173104
173248
|
// Same key as react-profiler-start, so a forwarded logicalDeviceId reads its run.
|
|
173105
173249
|
profilerSession: `${REACT_PROFILER_SESSION_NAMESPACE}:${metroPort(params)}:${canonicalDeviceId(params.device_id)}`
|
|
@@ -173277,7 +173421,7 @@ Fails if the React DevTools hook is not present or no fiber roots have been comm
|
|
|
173277
173421
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to read React fiber tree: ${failureSignal2.error_code}`
|
|
173278
173422
|
},
|
|
173279
173423
|
// RN-only: walks the fiber tree via the React DevTools backend hook.
|
|
173280
|
-
capability:
|
|
173424
|
+
capability: RN_ONLY_TOOL_CAPABILITY,
|
|
173281
173425
|
services: (params) => ({
|
|
173282
173426
|
// Same key as react-profiler-start, so a forwarded logicalDeviceId reads its run.
|
|
173283
173427
|
profilerSession: `${REACT_PROFILER_SESSION_NAMESPACE}:${metroPort(params)}:${canonicalDeviceId(params.device_id)}`
|
|
@@ -181902,7 +182046,7 @@ Fails if react-profiler-stop has not been called.`,
|
|
|
181902
182046
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to query React commits: ${failureSignal2.error_code}`
|
|
181903
182047
|
},
|
|
181904
182048
|
// Reads React commit data captured via the React DevTools backend.
|
|
181905
|
-
capability:
|
|
182049
|
+
capability: RN_ONLY_TOOL_CAPABILITY,
|
|
181906
182050
|
services: () => ({}),
|
|
181907
182051
|
async execute(_services, params) {
|
|
181908
182052
|
const commitTree = await getCommitData(metroPort(params), params.device_id);
|
|
@@ -182370,7 +182514,7 @@ Fails if no CPU profile is stored; run react-profiler-stop (and ideally react-pr
|
|
|
182370
182514
|
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to query CPU profile: ${failureSignal2.error_code}`
|
|
182371
182515
|
},
|
|
182372
182516
|
// RN-only: reads Hermes-format CPU profiles; Chromium's V8 sample format differs.
|
|
182373
|
-
capability:
|
|
182517
|
+
capability: RN_ONLY_TOOL_CAPABILITY,
|
|
182374
182518
|
services: () => ({}),
|
|
182375
182519
|
async execute(_services, params) {
|
|
182376
182520
|
const sessionPaths = getCachedProfilerPaths(metroPort(params), params.device_id);
|
|
@@ -183583,7 +183727,7 @@ Fails if the session_id is not found or the session's trace files are missing fr
|
|
|
183583
183727
|
// The Hermes, xctrace and perfetto formats this loads have no Chromium
|
|
183584
183728
|
// equivalent; the gate fails at the call site, not inside the trace parser.
|
|
183585
183729
|
// Physical iPhones load the xctrace sessions native-profiler-launch-analysis writes.
|
|
183586
|
-
capability: { ...
|
|
183730
|
+
capability: { ...RN_ONLY_TOOL_CAPABILITY, apple: { simulator: true, device: true } },
|
|
183587
183731
|
// load_native re-parses the whole export, which can outlast the 30s MCP fetch
|
|
183588
183732
|
// timeout; an aborted call is replayed, not cancelled.
|
|
183589
183733
|
longRunning: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swmansion/argent",
|
|
3
|
-
"version": "0.34.1-next.
|
|
3
|
+
"version": "0.34.1-next.58",
|
|
4
4
|
"mcpName": "io.github.software-mansion/argent",
|
|
5
5
|
"description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -55,4 +55,4 @@ Read `references/e2e.md` before recording or writing a test for a Mac app.
|
|
|
55
55
|
|
|
56
56
|
## React Native
|
|
57
57
|
|
|
58
|
-
For React Native Debug builds on macOS, including Mac Catalyst, start Metro before `boot-device` (see `argent-react-native-app-workflow`).
|
|
58
|
+
For React Native Debug builds on macOS, including Mac Catalyst, start Metro before `boot-device` (see `argent-react-native-app-workflow`). Use `describe` for UI targets. For JavaScript debugging and network capture, follow the Mac app workflow in `argent-metro-debugger`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: argent-metro-debugger
|
|
3
|
-
description: Debug
|
|
3
|
+
description: Debug JavaScript with Argent in React Native apps on iOS, Android, Vega, and macOS, or in Chromium and Electron over CDP. Use when connecting to a runtime, inspecting React components, reading console logs, or evaluating JavaScript.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## 1. Prerequisites
|
|
@@ -14,12 +14,14 @@ Physical iPhone: not supported; every `debugger-*` tool rejects `kind: "device"`
|
|
|
14
14
|
|
|
15
15
|
## 2. Tools
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Use the `device_id` from `list-devices` and keep the same ID and Metro port across calls. On shared Metro, if `debugger-connect` cannot match an iOS simulator UDID or Android serial, it lists logical IDs. Choose the requested device's `logicalDeviceId` for subsequent debugger calls. If you later tear down this session, include that ID in `stop-all-simulator-servers`'s `devices`.
|
|
18
|
+
|
|
19
|
+
On iOS and Android, use the `list-devices` ID as `udid` for `network-capture-start` and `network-capture-stop`. If shared Metro requires a logical ID, pass it as `logicalDeviceId`, then use it as `device_id` when reading the JS capture.
|
|
18
20
|
|
|
19
21
|
| Tool | Use for |
|
|
20
22
|
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
21
23
|
| `debugger-status` | Diagnosing the connection. Call it first when anything fails |
|
|
22
|
-
| `debugger-connect` |
|
|
24
|
+
| `debugger-connect` | Opening the session and starting console capture |
|
|
23
25
|
| `debugger-reload-metro` | Reloading the JS bundle of an attached app |
|
|
24
26
|
| `restart-app` | Relaunching the app when it lost its Metro connection |
|
|
25
27
|
| `debugger-component-tree` | Component names and testIDs on screen. Find tap targets with `describe` |
|
|
@@ -30,6 +32,16 @@ Pass the same `device_id`, the id from `list-devices`, to every call. With two o
|
|
|
30
32
|
|
|
31
33
|
A component missing from `debugger-component-tree`? `includeSkipped` only adds counts of what was pruned. Use `onScreenOnly: false` for one off screen, or `debugger-inspect-element` at its point for one on screen.
|
|
32
34
|
|
|
35
|
+
### React Native Mac apps
|
|
36
|
+
|
|
37
|
+
1. Start Metro before launching a Debug Hermes build of react-native-macos 0.76+ or React Native for Mac Catalyst. Launch Mac Catalyst through Argent so it can identify its runtime. If `boot-device` refuses a hardened react-native-macos build, have the user start it from Xcode. JavaScript tools still work. UI inspection and gestures require a build Argent can control.
|
|
38
|
+
2. Keep `macos-app-<bundle id>` as `device_id`, even on shared Metro. If a call returns `device_mismatch`, check that the Debug bundle loaded from the requested Metro port. The IDs in the error identify other targets.
|
|
39
|
+
3. Call `view-network-logs` before reproducing a JavaScript request and again after a reload. For native traffic, use `network-capture-start` and read with `native-network-logs`. The two logs can show the same `fetch()` request.
|
|
40
|
+
|
|
41
|
+
Use `describe` for tap targets. The React tools use the root with the most components, which can be in a different window. Before using a point, verify that both tools are looking at the same window. To inspect a tap point from the React tree, multiply its fractions by the width and height in `Screen: WxH`. The resulting points include the title bar. On the old architecture (Paper), native views around the React root can shift those points. Check the returned component against the intended control.
|
|
42
|
+
|
|
43
|
+
If `debugger-reload-metro` fails to reload the Mac app, use `restart-app` for an Argent-controlled build. For a build started from Xcode, restart it there.
|
|
44
|
+
|
|
33
45
|
## 3. Rules and recovery
|
|
34
46
|
|
|
35
47
|
1. **`debugger-status` first when something fails.** Only `debugger-status` and `debugger-log-registry` return `status: "not_connected"` with a `guidance`; the other tools throw. Follow the `guidance` once; do not retry in a loop.
|