@swmansion/argent 0.34.1-next.66 → 0.34.1-next.68
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 +1 -1
- package/dist/installer.mjs +1 -1
- package/dist/tool-args.generated.d.ts +1 -1
- package/dist/tool-server.cjs +382 -279
- package/package.json +1 -1
- package/skills/argent-create-e2e/SKILL.md +3 -0
- package/skills/argent-create-e2e/references/e2e-yaml.md +18 -0
- package/skills/argent-qa-e2e/SKILL.md +1 -1
package/dist/cli-cmds.mjs
CHANGED
|
@@ -36294,7 +36294,7 @@ function isCi(env = process.env) {
|
|
|
36294
36294
|
var SESSION_ID2 = randomUUID5();
|
|
36295
36295
|
function readCliVersion() {
|
|
36296
36296
|
if (true) {
|
|
36297
|
-
return "0.34.1-next.
|
|
36297
|
+
return "0.34.1-next.68";
|
|
36298
36298
|
}
|
|
36299
36299
|
return "0.0.0";
|
|
36300
36300
|
}
|
package/dist/installer.mjs
CHANGED
|
@@ -16994,7 +16994,7 @@ function isCi(env = process.env) {
|
|
|
16994
16994
|
var SESSION_ID = randomUUID4();
|
|
16995
16995
|
function readCliVersion() {
|
|
16996
16996
|
if (true) {
|
|
16997
|
-
return "0.34.1-next.
|
|
16997
|
+
return "0.34.1-next.68";
|
|
16998
16998
|
}
|
|
16999
16999
|
return "0.0.0";
|
|
17000
17000
|
}
|
|
@@ -153,7 +153,7 @@ 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-...), Mac app id (macos-app-<bundle id>), or Chromium device id (chromium-cdp-<port>). */
|
|
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>). Pass this SAME id as device_id to every subsequent debugger-* call to pin them to this device. The returned logicalDeviceId is informational (Metro's own per-connection handle, absent on Vega); you do not switch to it. Forwarding it still resolves here, but the list-devices id is the stable one. On a Metro shared by several devices, a simulator UDID or Android serial is matched by the device's name (a simulator's name; an Android model, release and API level); the app's device log must then confirm it runs there. When another booted simulator or attached device shares that name, or the log does not confirm it, the error asks for the logicalDeviceId instead. */
|
|
157
157
|
device_id: string;
|
|
158
158
|
};
|
|
159
159
|
"debugger-evaluate": {
|
package/dist/tool-server.cjs
CHANGED
|
@@ -101462,7 +101462,7 @@ function isCi(env = process.env) {
|
|
|
101462
101462
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
101463
101463
|
function readCliVersion() {
|
|
101464
101464
|
if (true) {
|
|
101465
|
-
return "0.34.1-next.
|
|
101465
|
+
return "0.34.1-next.68";
|
|
101466
101466
|
}
|
|
101467
101467
|
return "0.0.0";
|
|
101468
101468
|
}
|
|
@@ -153167,7 +153167,6 @@ init_external_devices();
|
|
|
153167
153167
|
var import_node_crypto15 = require("node:crypto");
|
|
153168
153168
|
init_src2();
|
|
153169
153169
|
init_device_info();
|
|
153170
|
-
init_external_devices();
|
|
153171
153170
|
init_macos_app_kind();
|
|
153172
153171
|
function deviceKey2(target) {
|
|
153173
153172
|
const logicalId = target.reactNative?.logicalDeviceId;
|
|
@@ -153207,25 +153206,6 @@ function metroDevices(pool) {
|
|
|
153207
153206
|
}
|
|
153208
153207
|
return devices2;
|
|
153209
153208
|
}
|
|
153210
|
-
function targetsOfOnlyDeviceNamed(pool, name) {
|
|
153211
|
-
if (name === void 0) return void 0;
|
|
153212
|
-
const named = pool.filter((t) => t.deviceName === name);
|
|
153213
|
-
return new Set(named.map(deviceKey2)).size === 1 ? named : void 0;
|
|
153214
|
-
}
|
|
153215
|
-
function nameMetroLists(simulatorName) {
|
|
153216
|
-
return simulatorName.split("&")[0].replaceAll("+", " ");
|
|
153217
|
-
}
|
|
153218
|
-
async function simulatorNameOnSharedMetro(deviceId, targets) {
|
|
153219
|
-
if (isExternalId(deviceId)) return void 0;
|
|
153220
|
-
const device = resolveDevice(deviceId);
|
|
153221
|
-
if (device.platform !== "ios" || device.kind !== "simulator") return void 0;
|
|
153222
|
-
if (metroDevices(targets).size < 2) return void 0;
|
|
153223
|
-
const simulators = await listIosSimulators().catch(() => []);
|
|
153224
|
-
const booted = simulators.filter((sim) => sim.state === "Booted");
|
|
153225
|
-
const name = booted.find((sim) => sim.udid === deviceId)?.name;
|
|
153226
|
-
if (name === void 0 || nameMetroLists(name) !== name) return void 0;
|
|
153227
|
-
return booted.filter((sim) => nameMetroLists(sim.name) === name).length === 1 ? name : void 0;
|
|
153228
|
-
}
|
|
153229
153209
|
function macosAppTargets(pool, bundleId, port) {
|
|
153230
153210
|
const own2 = pool.filter((t) => macosAppBundleIdOf(t)?.toLowerCase() === bundleId.toLowerCase());
|
|
153231
153211
|
if (own2.length) return own2;
|
|
@@ -153242,6 +153222,12 @@ function macosAppTargets(pool, bundleId, port) {
|
|
|
153242
153222
|
}
|
|
153243
153223
|
);
|
|
153244
153224
|
}
|
|
153225
|
+
function targetsNamedFor(pool, matches2) {
|
|
153226
|
+
if (typeof matches2 !== "function") return void 0;
|
|
153227
|
+
const named = pool.filter((t) => typeof t.deviceName === "string" && matches2(t.deviceName));
|
|
153228
|
+
const devices2 = new Set(named.map(deviceKey2));
|
|
153229
|
+
return devices2.size === 1 && !devices2.has(void 0) ? named : void 0;
|
|
153230
|
+
}
|
|
153245
153231
|
var seenLogicalDeviceIds = /* @__PURE__ */ new Set();
|
|
153246
153232
|
var LOGICAL_DEVICE_ID_SHAPE = /^[0-9a-f]{40}$/;
|
|
153247
153233
|
function selectTarget(targets, port, options) {
|
|
@@ -153251,24 +153237,29 @@ function selectTarget(targets, port, options) {
|
|
|
153251
153237
|
if (id) seenLogicalDeviceIds.add(id);
|
|
153252
153238
|
}
|
|
153253
153239
|
let candidates = pool;
|
|
153240
|
+
let matchedByName = false;
|
|
153254
153241
|
const macosBundleId = typeof options?.deviceId === "string" && options.deviceId.startsWith(MACOS_APP_ID_PREFIX) ? options.deviceId.slice(MACOS_APP_ID_PREFIX.length) : null;
|
|
153255
153242
|
if (macosBundleId !== null) {
|
|
153256
153243
|
candidates = macosAppTargets(pool, macosBundleId, port);
|
|
153257
153244
|
} else if (typeof options?.deviceId === "string" && options.deviceId) {
|
|
153258
153245
|
const deviceId = options.deviceId;
|
|
153259
|
-
const
|
|
153260
|
-
const
|
|
153261
|
-
|
|
153246
|
+
const pinned = typeof options.pinnedLogicalDeviceId === "string" ? options.pinnedLogicalDeviceId : void 0;
|
|
153247
|
+
const filtered = candidates.filter((t) => {
|
|
153248
|
+
const id = t.reactNative?.logicalDeviceId;
|
|
153249
|
+
return id === deviceId || pinned !== void 0 && id === pinned;
|
|
153250
|
+
});
|
|
153262
153251
|
if (filtered.length) {
|
|
153263
153252
|
candidates = filtered;
|
|
153264
|
-
} else if (sameName) {
|
|
153265
|
-
candidates = sameName;
|
|
153266
153253
|
} else {
|
|
153267
153254
|
const distinctDevices = metroDevices(pool);
|
|
153268
|
-
|
|
153255
|
+
const named = distinctDevices.size > 1 || pinned !== void 0 ? targetsNamedFor(pool, options.deviceNameMatches) : void 0;
|
|
153256
|
+
if (named) {
|
|
153257
|
+
candidates = named;
|
|
153258
|
+
matchedByName = true;
|
|
153259
|
+
} else if (distinctDevices.size > 1) {
|
|
153269
153260
|
const listed = [...distinctDevices.values()].join(", ");
|
|
153270
153261
|
throw new FailureError(
|
|
153271
|
-
`No debugger target matches device_id "${deviceId}". ${distinctDevices.size} devices are connected to Metro on port ${port}: ${listed}. Re-target with the logicalDeviceId in parentheses \u2014
|
|
153262
|
+
`No debugger target matches device_id "${deviceId}". ${distinctDevices.size} devices are connected to Metro on port ${port}: ${listed}. ` + (typeof options.deviceNameMatches === "function" ? `More than one of them, or none, has this device's name, so it cannot be told apart by name. ` : "") + `Re-target with the logicalDeviceId in parentheses \u2014 debugger-connect returns it, and it is accepted by every debugger-* call. A legacy-inspector device (RN 0.72 / Vega) reports none and cannot be singled out of a shared Metro: give it its own Metro port.`,
|
|
153272
153263
|
{
|
|
153273
153264
|
error_code: FAILURE_CODES.DEBUGGER_TARGET_DEVICE_MISMATCH,
|
|
153274
153265
|
failure_stage: "debugger_select_target",
|
|
@@ -153277,11 +153268,12 @@ function selectTarget(targets, port, options) {
|
|
|
153277
153268
|
}
|
|
153278
153269
|
);
|
|
153279
153270
|
}
|
|
153280
|
-
const
|
|
153281
|
-
|
|
153271
|
+
const missingId = pinned ?? deviceId;
|
|
153272
|
+
const seen = seenLogicalDeviceIds.has(missingId);
|
|
153273
|
+
if (!named && (seen || LOGICAL_DEVICE_ID_SHAPE.test(missingId))) {
|
|
153282
153274
|
const state3 = seen ? `is no longer attached to Metro on port ${port} \u2014 its app likely exited or reloaded onto another Metro. ` : `is not attached to Metro on port ${port} \u2014 its app is not running, is still starting, or uses another Metro. `;
|
|
153283
153275
|
throw new FailureError(
|
|
153284
|
-
`Device with logicalDeviceId "${deviceId}" ${state3}Not falling back to the remaining device: ${[...distinctDevices.values()].join(", ")}. If the app exited, relaunch it on the target device (launch-app / restart-app), then retry with the same id: a relaunched app keeps its logicalDeviceId. If it was reinstalled (reinstall-app), iOS can give it a new logicalDeviceId: when the device listed above is your target, retry with the id shown for it.`,
|
|
153276
|
+
`Device with logicalDeviceId "${missingId}"` + (pinned !== void 0 ? `, which device_id "${deviceId}" was matched to by name,` : "") + ` ${state3}Not falling back to the remaining device: ${[...distinctDevices.values()].join(", ")}. If the app exited, relaunch it on the target device (launch-app / restart-app), then retry with the same id: a relaunched app keeps its logicalDeviceId. If it was reinstalled (reinstall-app), iOS can give it a new logicalDeviceId: when the device listed above is your target, retry with the id shown for it.`,
|
|
153285
153277
|
{
|
|
153286
153278
|
error_code: FAILURE_CODES.DEBUGGER_METRO_NO_TARGETS,
|
|
153287
153279
|
failure_stage: "debugger_select_target",
|
|
@@ -153299,29 +153291,30 @@ function selectTarget(targets, port, options) {
|
|
|
153299
153291
|
const fusebox = candidates.find(
|
|
153300
153292
|
(t) => t.reactNative?.capabilities?.prefersFuseboxFrontend === true
|
|
153301
153293
|
);
|
|
153302
|
-
if (fusebox) return makeResult(fusebox, port, true, false);
|
|
153294
|
+
if (fusebox) return makeResult(fusebox, port, true, false, matchedByName);
|
|
153303
153295
|
const cppConn = candidates.find((t) => t.description?.endsWith("[C++ connection]"));
|
|
153304
|
-
if (cppConn) return makeResult(cppConn, port, true, false);
|
|
153296
|
+
if (cppConn) return makeResult(cppConn, port, true, false, matchedByName);
|
|
153305
153297
|
const bridge = candidates.find((t) => t.title?.startsWith("React Native Bridge"));
|
|
153306
|
-
if (bridge) return makeResult(bridge, port, false, false);
|
|
153298
|
+
if (bridge) return makeResult(bridge, port, false, false, matchedByName);
|
|
153307
153299
|
const hermes = candidates.find(
|
|
153308
153300
|
(t) => LEGACY_APP_RUNTIME_TITLES.has(t.title?.replace(CXX_CONNECTION_SUFFIX, ""))
|
|
153309
153301
|
);
|
|
153310
|
-
if (hermes) return makeResult(hermes, port, false, true);
|
|
153311
|
-
return makeResult(candidates[0], port, false, true);
|
|
153302
|
+
if (hermes) return makeResult(hermes, port, false, true, matchedByName);
|
|
153303
|
+
return makeResult(candidates[0], port, false, true, matchedByName);
|
|
153312
153304
|
}
|
|
153313
153305
|
var LEGACY_APP_RUNTIME_TITLES = /* @__PURE__ */ new Set([
|
|
153314
153306
|
"Hermes React Native",
|
|
153315
153307
|
"Hermes Bridgeless React Native"
|
|
153316
153308
|
]);
|
|
153317
153309
|
var CXX_CONNECTION_SUFFIX = / \[C\+\+ connection\]$/;
|
|
153318
|
-
function makeResult(target, port, isNewDebugger, legacyInspector) {
|
|
153310
|
+
function makeResult(target, port, isNewDebugger, legacyInspector, matchedByName) {
|
|
153319
153311
|
return {
|
|
153320
153312
|
target,
|
|
153321
153313
|
webSocketUrl: normalizeWsUrl(target.webSocketDebuggerUrl, port),
|
|
153322
153314
|
isNewDebugger,
|
|
153323
153315
|
legacyInspector,
|
|
153324
|
-
deviceName: target.deviceName ?? target.title ?? "unknown"
|
|
153316
|
+
deviceName: target.deviceName ?? target.title ?? "unknown",
|
|
153317
|
+
matchedByName
|
|
153325
153318
|
};
|
|
153326
153319
|
}
|
|
153327
153320
|
function normalizeWsUrl(wsUrl, port) {
|
|
@@ -153331,6 +153324,232 @@ function normalizeWsUrl(wsUrl, port) {
|
|
|
153331
153324
|
return url2.toString();
|
|
153332
153325
|
}
|
|
153333
153326
|
|
|
153327
|
+
// ../tool-server/src/utils/debugger/device-name.ts
|
|
153328
|
+
init_adb();
|
|
153329
|
+
init_device_info();
|
|
153330
|
+
init_external_devices();
|
|
153331
|
+
|
|
153332
|
+
// ../tool-server/src/utils/debugger/runtime-device.ts
|
|
153333
|
+
var import_node_crypto16 = require("node:crypto");
|
|
153334
|
+
var import_node_child_process32 = require("node:child_process");
|
|
153335
|
+
var import_node_util23 = require("node:util");
|
|
153336
|
+
init_adb();
|
|
153337
|
+
var execFileAsync23 = (0, import_node_util23.promisify)(import_node_child_process32.execFile);
|
|
153338
|
+
var LOG_READ_TIMEOUT_MS = 5e3;
|
|
153339
|
+
var RETRY_DELAY_MS = 300;
|
|
153340
|
+
var OTHER_TRANSPORTS_GRACE_MS = 500;
|
|
153341
|
+
var NOT_FOUND = { found: [], unresolved: [] };
|
|
153342
|
+
async function findRuntimeDevices(cdp, {
|
|
153343
|
+
awaitSerials = [],
|
|
153344
|
+
waitSerials = []
|
|
153345
|
+
} = {}) {
|
|
153346
|
+
const marker = `argent-device-probe:${(0, import_node_crypto16.randomUUID)()}`;
|
|
153347
|
+
const logged = await cdp.evaluate(
|
|
153348
|
+
`(function () {
|
|
153349
|
+
if (typeof nativeLoggingHook !== "function") return false;
|
|
153350
|
+
nativeLoggingHook(${JSON.stringify(marker)}, 1);
|
|
153351
|
+
return true;
|
|
153352
|
+
})()`
|
|
153353
|
+
).catch(() => false);
|
|
153354
|
+
if (logged !== true) return NOT_FOUND;
|
|
153355
|
+
const checks = [
|
|
153356
|
+
async () => androidDevices(await androidSerials(), marker, awaitSerials, waitSerials),
|
|
153357
|
+
async () => {
|
|
153358
|
+
const udids = await bootedSimulators();
|
|
153359
|
+
const udid = await firstFound(udids.map((udid2) => () => simulatorLogHolds(udid2, marker)));
|
|
153360
|
+
return udid === void 0 ? void 0 : { found: [udid], unresolved: [] };
|
|
153361
|
+
}
|
|
153362
|
+
];
|
|
153363
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
153364
|
+
if (attempt > 0) await new Promise((r) => setTimeout(r, RETRY_DELAY_MS));
|
|
153365
|
+
const found = await firstFound(checks);
|
|
153366
|
+
if (found !== void 0) return found;
|
|
153367
|
+
}
|
|
153368
|
+
return NOT_FOUND;
|
|
153369
|
+
}
|
|
153370
|
+
function firstFound(checks) {
|
|
153371
|
+
return new Promise((resolve21) => {
|
|
153372
|
+
let left = checks.length;
|
|
153373
|
+
if (left === 0) resolve21(void 0);
|
|
153374
|
+
for (const check3 of checks) {
|
|
153375
|
+
void check3().then((value) => {
|
|
153376
|
+
if (value !== void 0) resolve21(value);
|
|
153377
|
+
else if (--left === 0) resolve21(void 0);
|
|
153378
|
+
});
|
|
153379
|
+
}
|
|
153380
|
+
});
|
|
153381
|
+
}
|
|
153382
|
+
async function androidDevices(serials, marker, awaitSerials, waitSerials) {
|
|
153383
|
+
const listed = [...new Set(serials)];
|
|
153384
|
+
const awaited = listed.filter(
|
|
153385
|
+
(serial) => awaitSerials.includes(serial) || waitSerials.includes(serial)
|
|
153386
|
+
);
|
|
153387
|
+
const answers = /* @__PURE__ */ new Map();
|
|
153388
|
+
await new Promise((resolve21) => {
|
|
153389
|
+
let graceOver = false;
|
|
153390
|
+
let grace;
|
|
153391
|
+
const settle3 = () => {
|
|
153392
|
+
const held = heldSerials(answers);
|
|
153393
|
+
const waitingOn = listed.filter(
|
|
153394
|
+
(serial) => !answers.has(serial) && (!graceOver || awaited.includes(serial)) && !held.some((found2) => anotherDevice(serial, found2))
|
|
153395
|
+
);
|
|
153396
|
+
if (waitingOn.length === 0) {
|
|
153397
|
+
clearTimeout(grace);
|
|
153398
|
+
resolve21();
|
|
153399
|
+
}
|
|
153400
|
+
};
|
|
153401
|
+
settle3();
|
|
153402
|
+
for (const serial of listed) {
|
|
153403
|
+
void logcatHolds(serial, marker).then((read) => {
|
|
153404
|
+
answers.set(serial, read);
|
|
153405
|
+
if (read === "held") {
|
|
153406
|
+
grace ??= setTimeout(() => {
|
|
153407
|
+
graceOver = true;
|
|
153408
|
+
settle3();
|
|
153409
|
+
}, OTHER_TRANSPORTS_GRACE_MS);
|
|
153410
|
+
}
|
|
153411
|
+
settle3();
|
|
153412
|
+
});
|
|
153413
|
+
}
|
|
153414
|
+
});
|
|
153415
|
+
const found = heldSerials(answers);
|
|
153416
|
+
if (found.length === 0) return void 0;
|
|
153417
|
+
const unresolved = [...new Set(awaitSerials)].filter(
|
|
153418
|
+
(serial) => (!listed.includes(serial) || answers.get(serial) === "failed") && !found.some((device) => anotherDevice(serial, device))
|
|
153419
|
+
);
|
|
153420
|
+
return { found, unresolved };
|
|
153421
|
+
}
|
|
153422
|
+
function heldSerials(answers) {
|
|
153423
|
+
return [...answers].filter(([, read]) => read === "held").map(([serial]) => serial);
|
|
153424
|
+
}
|
|
153425
|
+
function anotherDevice(a, b) {
|
|
153426
|
+
if (a === b) return false;
|
|
153427
|
+
const portA = consolePortFromAdbSerial(a);
|
|
153428
|
+
const portB = consolePortFromAdbSerial(b);
|
|
153429
|
+
if (portA !== null && portB !== null) return portA !== portB;
|
|
153430
|
+
if (isUsbSerial(a) && isUsbSerial(b)) return true;
|
|
153431
|
+
return portA !== null && isUsbSerial(b) || portB !== null && isUsbSerial(a);
|
|
153432
|
+
}
|
|
153433
|
+
function isUsbSerial(serial) {
|
|
153434
|
+
return !serial.startsWith("emulator-") && !serial.includes(":") && !serial.includes("._");
|
|
153435
|
+
}
|
|
153436
|
+
async function androidSerials() {
|
|
153437
|
+
try {
|
|
153438
|
+
const { stdout } = await runAdb(["devices"], { timeoutMs: ADB_DEVICES_TIMEOUT_MS });
|
|
153439
|
+
return parseAdbDevices(stdout).filter((d) => d.state === "device").map((d) => d.serial);
|
|
153440
|
+
} catch {
|
|
153441
|
+
return [];
|
|
153442
|
+
}
|
|
153443
|
+
}
|
|
153444
|
+
async function bootedSimulators() {
|
|
153445
|
+
const simulators = await listIosSimulators().catch(() => []);
|
|
153446
|
+
return simulators.filter((s) => s.state === "Booted").map((s) => s.udid);
|
|
153447
|
+
}
|
|
153448
|
+
async function logcatHolds(serial, marker) {
|
|
153449
|
+
try {
|
|
153450
|
+
const { stdout } = await runAdb(
|
|
153451
|
+
["-s", serial, "logcat", "-d", "-s", "ReactNativeJS", "-e", marker],
|
|
153452
|
+
{ timeoutMs: LOG_READ_TIMEOUT_MS }
|
|
153453
|
+
);
|
|
153454
|
+
return stdout.includes(marker) ? "held" : "absent";
|
|
153455
|
+
} catch {
|
|
153456
|
+
return "failed";
|
|
153457
|
+
}
|
|
153458
|
+
}
|
|
153459
|
+
async function simulatorLogHolds(udid, marker) {
|
|
153460
|
+
try {
|
|
153461
|
+
const args = await simctlArgsForUdid(udid, [
|
|
153462
|
+
"spawn",
|
|
153463
|
+
udid,
|
|
153464
|
+
"log",
|
|
153465
|
+
"show",
|
|
153466
|
+
"--info",
|
|
153467
|
+
"--last",
|
|
153468
|
+
"1m",
|
|
153469
|
+
"--style",
|
|
153470
|
+
"compact",
|
|
153471
|
+
"--predicate",
|
|
153472
|
+
`eventMessage CONTAINS ${JSON.stringify(marker)} AND process != "log"`
|
|
153473
|
+
]);
|
|
153474
|
+
const { stdout } = await execFileAsync23("xcrun", args, {
|
|
153475
|
+
timeout: LOG_READ_TIMEOUT_MS,
|
|
153476
|
+
killSignal: SIMCTL_KILL_SIGNAL,
|
|
153477
|
+
encoding: "utf-8"
|
|
153478
|
+
});
|
|
153479
|
+
return stdout.includes(marker) ? udid : void 0;
|
|
153480
|
+
} catch {
|
|
153481
|
+
return void 0;
|
|
153482
|
+
}
|
|
153483
|
+
}
|
|
153484
|
+
|
|
153485
|
+
// ../tool-server/src/utils/debugger/device-name.ts
|
|
153486
|
+
async function deviceNameMatcher(deviceId) {
|
|
153487
|
+
const device = resolveDevice(deviceId);
|
|
153488
|
+
try {
|
|
153489
|
+
if (device.platform === "ios" && device.kind === "simulator") {
|
|
153490
|
+
return await iosSimulatorMatcher(externalNativeId(deviceId));
|
|
153491
|
+
}
|
|
153492
|
+
if (device.platform === "android") {
|
|
153493
|
+
return await androidMatcher(externalNativeId(deviceId));
|
|
153494
|
+
}
|
|
153495
|
+
} catch {
|
|
153496
|
+
return void 0;
|
|
153497
|
+
}
|
|
153498
|
+
return void 0;
|
|
153499
|
+
}
|
|
153500
|
+
function nameMetroLists(simulatorName) {
|
|
153501
|
+
return simulatorName.split("&")[0].replaceAll("+", " ");
|
|
153502
|
+
}
|
|
153503
|
+
async function iosSimulatorMatcher(udid) {
|
|
153504
|
+
const booted = (await listIosSimulators()).filter((s) => s.state === "Booted");
|
|
153505
|
+
const own2 = booted.find((s) => s.udid === udid);
|
|
153506
|
+
if (!own2) return void 0;
|
|
153507
|
+
if (nameMetroLists(own2.name) !== own2.name) return void 0;
|
|
153508
|
+
if (booted.some((s) => s.udid !== udid && nameMetroLists(s.name) === own2.name)) return void 0;
|
|
153509
|
+
return (reported) => reported === own2.name;
|
|
153510
|
+
}
|
|
153511
|
+
async function androidNames(serial) {
|
|
153512
|
+
const out = await adbShell(
|
|
153513
|
+
serial,
|
|
153514
|
+
'echo "$(getprop ro.product.model)|$(getprop ro.build.version.release)|$(getprop ro.build.version.sdk)"',
|
|
153515
|
+
{ timeoutMs: ENRICH_TIMEOUT_MS }
|
|
153516
|
+
);
|
|
153517
|
+
const [model = "", release2 = "", sdk = ""] = out.trim().split("|");
|
|
153518
|
+
if (!model) return void 0;
|
|
153519
|
+
return { full: `${model} - ${release2} - API ${sdk}`, model };
|
|
153520
|
+
}
|
|
153521
|
+
async function androidMatcher(serial) {
|
|
153522
|
+
const { stdout } = await runAdb(["devices"], { timeoutMs: ADB_DEVICES_TIMEOUT_MS });
|
|
153523
|
+
const others = parseAdbDevices(stdout).filter((d) => d.state === "device" && d.serial !== serial);
|
|
153524
|
+
const [own2, ...rest] = await Promise.all([
|
|
153525
|
+
androidNames(serial),
|
|
153526
|
+
...others.map((d) => androidNames(d.serial).catch(() => null))
|
|
153527
|
+
]);
|
|
153528
|
+
if (!own2) return void 0;
|
|
153529
|
+
if (rest.some((names) => names === null)) return void 0;
|
|
153530
|
+
const fullTaken = rest.some((names) => names?.full === own2.full);
|
|
153531
|
+
const modelTaken = rest.some((names) => names?.model === own2.model);
|
|
153532
|
+
if (fullTaken) return void 0;
|
|
153533
|
+
return (reported) => reported === own2.full || !modelTaken && reported === own2.model;
|
|
153534
|
+
}
|
|
153535
|
+
var nameMatchedLogicalIds = /* @__PURE__ */ new Map();
|
|
153536
|
+
var pinKey = (deviceId, port) => `${port}|${deviceId}`;
|
|
153537
|
+
function nameMatchedLogicalDeviceId(deviceId, port) {
|
|
153538
|
+
return nameMatchedLogicalIds.get(pinKey(deviceId, port));
|
|
153539
|
+
}
|
|
153540
|
+
function rememberNameMatch(deviceId, port, logicalDeviceId) {
|
|
153541
|
+
if (logicalDeviceId) nameMatchedLogicalIds.set(pinKey(deviceId, port), logicalDeviceId);
|
|
153542
|
+
}
|
|
153543
|
+
function forgetNameMatch(deviceId, port) {
|
|
153544
|
+
nameMatchedLogicalIds.delete(pinKey(deviceId, port));
|
|
153545
|
+
}
|
|
153546
|
+
async function runtimeRunsOn(cdp, deviceId) {
|
|
153547
|
+
const native = externalNativeId(deviceId);
|
|
153548
|
+
const { found } = await findRuntimeDevices(cdp, { waitSerials: [native] });
|
|
153549
|
+
if (found.includes(native)) return { verdict: "yes" };
|
|
153550
|
+
return found.length ? { verdict: "elsewhere", found } : { verdict: "unknown" };
|
|
153551
|
+
}
|
|
153552
|
+
|
|
153334
153553
|
// ../tool-server/src/utils/debugger/source-resolver.ts
|
|
153335
153554
|
var fs42 = __toESM(require("node:fs/promises"));
|
|
153336
153555
|
var path36 = __toESM(require("node:path"));
|
|
@@ -153583,6 +153802,23 @@ var DISABLE_LOGBOX_SCRIPT = `(function() {
|
|
|
153583
153802
|
init_wrapper();
|
|
153584
153803
|
var http4 = __toESM(require("node:http"));
|
|
153585
153804
|
var JS_RUNTIME_DEBUGGER_NAMESPACE = "JsRuntimeDebugger";
|
|
153805
|
+
function unconfirmedMatchError(deviceId, port, deviceName, where, targets) {
|
|
153806
|
+
const listed = [
|
|
153807
|
+
...new Set(
|
|
153808
|
+
targets.filter((t) => t.reactNative?.logicalDeviceId).map((t) => `${t.deviceName ?? t.title ?? "unknown"} (${t.reactNative.logicalDeviceId})`)
|
|
153809
|
+
)
|
|
153810
|
+
].join(", ");
|
|
153811
|
+
const state3 = where.verdict === "elsewhere" ? `runs on ${where.found.join(", ")}, not on this device` : `could not be confirmed to run on this device: no device log argent can read holds the probe it wrote`;
|
|
153812
|
+
return new FailureError(
|
|
153813
|
+
`No debugger target matches device_id "${deviceId}". The app Metro on port ${port} lists under this device's name, "${deviceName}", ${state3}. A device on another adb server, on the network or in another simulator device set can report the same name. Metro lists: ${listed}. If this device's app does not run, start it (launch-app) and retry. Otherwise re-target with the logicalDeviceId in parentheses \u2014 debugger-connect returns it, and it is accepted by every debugger-* call.`,
|
|
153814
|
+
{
|
|
153815
|
+
error_code: FAILURE_CODES.DEBUGGER_TARGET_DEVICE_MISMATCH,
|
|
153816
|
+
failure_stage: "debugger_select_target",
|
|
153817
|
+
failure_area: "tool_server",
|
|
153818
|
+
error_kind: "not_found"
|
|
153819
|
+
}
|
|
153820
|
+
);
|
|
153821
|
+
}
|
|
153586
153822
|
function stringifyConsoleValue2(value) {
|
|
153587
153823
|
if (typeof value === "object" && value !== null) {
|
|
153588
153824
|
try {
|
|
@@ -153697,17 +153933,39 @@ var jsRuntimeDebuggerBlueprint = {
|
|
|
153697
153933
|
}
|
|
153698
153934
|
throw error63;
|
|
153699
153935
|
});
|
|
153700
|
-
const selected = selectTarget(metro.targets, port, {
|
|
153701
|
-
...options,
|
|
153702
|
-
deviceId,
|
|
153703
|
-
simulatorName: await simulatorNameOnSharedMetro(deviceId, metro.targets)
|
|
153704
|
-
});
|
|
153705
153936
|
const onPublishedBundler = publishedMetroPort(physicalDeviceId, port) === void 0;
|
|
153706
153937
|
const proxied = onPublishedBundler ? externalJsDebuggerUrl(physicalDeviceId) : void 0;
|
|
153707
|
-
const
|
|
153708
|
-
|
|
153709
|
-
|
|
153710
|
-
|
|
153938
|
+
const logicalIds = new Set(metro.targets.map((t) => t.reactNative?.logicalDeviceId));
|
|
153939
|
+
let selected;
|
|
153940
|
+
let cdp;
|
|
153941
|
+
for (let attempt = 0; ; attempt++) {
|
|
153942
|
+
const pinnedLogicalDeviceId = nameMatchedLogicalDeviceId(deviceId, port);
|
|
153943
|
+
const needsName = !logicalIds.has(deviceId) && (pinnedLogicalDeviceId !== void 0 ? !logicalIds.has(pinnedLogicalDeviceId) : logicalIds.size > 1);
|
|
153944
|
+
const deviceNameMatches = needsName ? await deviceNameMatcher(deviceId) : void 0;
|
|
153945
|
+
selected = selectTarget(metro.targets, port, {
|
|
153946
|
+
...options,
|
|
153947
|
+
deviceId,
|
|
153948
|
+
deviceNameMatches,
|
|
153949
|
+
pinnedLogicalDeviceId
|
|
153950
|
+
});
|
|
153951
|
+
const selectedId = selected.target.reactNative?.logicalDeviceId;
|
|
153952
|
+
const byPin = pinnedLogicalDeviceId !== void 0 && selectedId === pinnedLogicalDeviceId && selectedId !== deviceId;
|
|
153953
|
+
cdp = new CDPClient(proxied ?? selected.webSocketUrl, {
|
|
153954
|
+
awaitPromisesInApp: !selected.legacyInspector
|
|
153955
|
+
});
|
|
153956
|
+
await cdp.connect();
|
|
153957
|
+
if (!selected.matchedByName && !byPin) break;
|
|
153958
|
+
const client2 = cdp;
|
|
153959
|
+
const where = await client2.send("Runtime.enable").then(() => runtimeRunsOn(client2, deviceId)).catch(() => ({ verdict: "unknown" }));
|
|
153960
|
+
if (where.verdict === "yes") {
|
|
153961
|
+
rememberNameMatch(deviceId, port, selectedId);
|
|
153962
|
+
break;
|
|
153963
|
+
}
|
|
153964
|
+
forgetNameMatch(deviceId, port);
|
|
153965
|
+
await client2.disconnect();
|
|
153966
|
+
if (byPin && attempt === 0) continue;
|
|
153967
|
+
throw unconfirmedMatchError(deviceId, port, selected.deviceName, where, metro.targets);
|
|
153968
|
+
}
|
|
153711
153969
|
const sourceMaps = new SourceMapsRegistry();
|
|
153712
153970
|
cdp.events.on("scriptParsed", (script) => {
|
|
153713
153971
|
sourceMaps.registerFromScriptParsed(script.url, script.scriptId, script.sourceMapURL);
|
|
@@ -153838,7 +154096,7 @@ var jsRuntimeDebuggerBlueprint = {
|
|
|
153838
154096
|
init_src2();
|
|
153839
154097
|
|
|
153840
154098
|
// ../tool-server/src/utils/debugger/scripts/network-interceptor.ts
|
|
153841
|
-
var
|
|
154099
|
+
var import_node_crypto17 = require("node:crypto");
|
|
153842
154100
|
var import_node_os12 = require("node:os");
|
|
153843
154101
|
init_src3();
|
|
153844
154102
|
var BINARY_BODY_TYPES = /^(image\/(?!svg)|audio\/|video\/|font\/|application\/(octet-stream|pdf|zip|gzip|wasm|x-protobuf)$)/;
|
|
@@ -154907,7 +155165,7 @@ var NETWORK_CAPTURE_MARK_SCRIPT = `(function() {
|
|
|
154907
155165
|
var g = globalThis;
|
|
154908
155166
|
return typeof g.__argent_network_mark === 'function' ? g.__argent_network_mark() : JSON.stringify({ install: null });
|
|
154909
155167
|
})()`;
|
|
154910
|
-
var HOLDER = JSON.stringify((0,
|
|
155168
|
+
var HOLDER = JSON.stringify((0, import_node_crypto17.randomUUID)());
|
|
154911
155169
|
function holderRecord(capturing2) {
|
|
154912
155170
|
return JSON.stringify({ capturing: capturing2, pid: process.pid, host: (0, import_node_os12.hostname)() });
|
|
154913
155171
|
}
|
|
@@ -156106,21 +156364,21 @@ function clearLostProfilerRun(port, deviceId) {
|
|
|
156106
156364
|
}
|
|
156107
156365
|
|
|
156108
156366
|
// ../tool-server/src/tools/devices/boot-device.ts
|
|
156109
|
-
var
|
|
156367
|
+
var import_node_child_process36 = require("node:child_process");
|
|
156110
156368
|
var import_node_fs16 = require("node:fs");
|
|
156111
156369
|
var import_promises14 = require("node:fs/promises");
|
|
156112
156370
|
var import_node_os15 = require("node:os");
|
|
156113
156371
|
var import_node_path19 = require("node:path");
|
|
156114
|
-
var
|
|
156372
|
+
var import_node_util26 = require("node:util");
|
|
156115
156373
|
init_zod();
|
|
156116
156374
|
init_src();
|
|
156117
156375
|
init_src2();
|
|
156118
156376
|
init_adb();
|
|
156119
156377
|
|
|
156120
156378
|
// ../tool-server/src/utils/emulator-process.ts
|
|
156121
|
-
var
|
|
156122
|
-
var
|
|
156123
|
-
var
|
|
156379
|
+
var import_node_child_process33 = require("node:child_process");
|
|
156380
|
+
var import_node_util24 = require("node:util");
|
|
156381
|
+
var execFileAsync24 = (0, import_node_util24.promisify)(import_node_child_process33.execFile);
|
|
156124
156382
|
var EMULATOR_PROCESS_RE = /(?:^|\/)(?:qemu-system-[\w-]+|emulator|emulator64-[\w-]+)\s/;
|
|
156125
156383
|
function escapeRegExp(value) {
|
|
156126
156384
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -156140,7 +156398,7 @@ function parseEmulatorPidsForAvd(psOutput, avdName) {
|
|
|
156140
156398
|
async function listEmulatorPidsForAvd(avdName) {
|
|
156141
156399
|
if (process.platform === "win32") return [];
|
|
156142
156400
|
try {
|
|
156143
|
-
const { stdout } = await
|
|
156401
|
+
const { stdout } = await execFileAsync24(PS_BIN, [...PS_ARGS_WITH_PID], {
|
|
156144
156402
|
timeout: 5e3,
|
|
156145
156403
|
maxBuffer: 16 * 1024 * 1024
|
|
156146
156404
|
});
|
|
@@ -156219,12 +156477,12 @@ function readMb(config2, key2) {
|
|
|
156219
156477
|
}
|
|
156220
156478
|
|
|
156221
156479
|
// ../tool-server/src/utils/simulator-app-launch.ts
|
|
156222
|
-
var
|
|
156480
|
+
var import_node_child_process34 = require("node:child_process");
|
|
156223
156481
|
var import_node_fs15 = __toESM(require("node:fs"));
|
|
156224
156482
|
var import_node_os14 = __toESM(require("node:os"));
|
|
156225
156483
|
var import_node_path18 = __toESM(require("node:path"));
|
|
156226
|
-
var
|
|
156227
|
-
var
|
|
156484
|
+
var import_node_util25 = require("node:util");
|
|
156485
|
+
var execFileAsync25 = (0, import_node_util25.promisify)(import_node_child_process34.execFile);
|
|
156228
156486
|
var CORE_SIMULATOR_INFO_PLIST = "/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/Resources/Info.plist";
|
|
156229
156487
|
var LAUNCH_WATCH_MS = 1e4;
|
|
156230
156488
|
var LAUNCH_POLL_MS = 250;
|
|
@@ -156253,7 +156511,7 @@ function persistVerdict(key2, verdict) {
|
|
|
156253
156511
|
}
|
|
156254
156512
|
}
|
|
156255
156513
|
async function bundleVersion(infoPlist) {
|
|
156256
|
-
const { stdout } = await
|
|
156514
|
+
const { stdout } = await execFileAsync25(
|
|
156257
156515
|
"plutil",
|
|
156258
156516
|
["-extract", "CFBundleVersion", "raw", "-o", "-", infoPlist],
|
|
156259
156517
|
{ timeout: 5e3 }
|
|
@@ -156269,7 +156527,7 @@ async function launchKey(simulatorApp) {
|
|
|
156269
156527
|
}
|
|
156270
156528
|
var comparablePath = (p) => p.normalize("NFC").toLowerCase();
|
|
156271
156529
|
async function runningExecutables() {
|
|
156272
|
-
const { stdout } = await
|
|
156530
|
+
const { stdout } = await execFileAsync25(PS_BIN, ["-xo", "comm="], {
|
|
156273
156531
|
timeout: 5e3,
|
|
156274
156532
|
env: { ...process.env, LC_ALL: "en_US.UTF-8" }
|
|
156275
156533
|
});
|
|
@@ -156334,7 +156592,7 @@ init_capability();
|
|
|
156334
156592
|
init_harmony_flag();
|
|
156335
156593
|
|
|
156336
156594
|
// ../tool-server/src/tools/devices/boot-electron.ts
|
|
156337
|
-
var
|
|
156595
|
+
var import_node_child_process35 = require("node:child_process");
|
|
156338
156596
|
var fs45 = __toESM(require("node:fs"));
|
|
156339
156597
|
var path38 = __toESM(require("node:path"));
|
|
156340
156598
|
init_src2();
|
|
@@ -156530,7 +156788,7 @@ async function bootElectronApp(options) {
|
|
|
156530
156788
|
];
|
|
156531
156789
|
let child;
|
|
156532
156790
|
try {
|
|
156533
|
-
child = (0,
|
|
156791
|
+
child = (0, import_node_child_process35.spawn)(launcher.command, args, {
|
|
156534
156792
|
detached: true,
|
|
156535
156793
|
// stdout is discarded, not piped: nothing reads it, and an unread pipe
|
|
156536
156794
|
// blocks the child's writes once the OS buffer fills. The
|
|
@@ -156693,7 +156951,7 @@ async function bootMacosApp(registry2, opts) {
|
|
|
156693
156951
|
}
|
|
156694
156952
|
|
|
156695
156953
|
// ../tool-server/src/tools/devices/boot-device.ts
|
|
156696
|
-
var
|
|
156954
|
+
var execFileAsync26 = (0, import_node_util26.promisify)(import_node_child_process36.execFile);
|
|
156697
156955
|
function bootTarget(params) {
|
|
156698
156956
|
return params.udid ?? params.avdName ?? params.vvdImage ?? params.harmonyInstance ?? params.electronAppPath ?? params.macosAppPath ?? "device";
|
|
156699
156957
|
}
|
|
@@ -156915,7 +157173,7 @@ async function pickOwnSerial(avdName, newSerials) {
|
|
|
156915
157173
|
}
|
|
156916
157174
|
async function bootSimctl(prefix, [sub, udid, ...rest], timeoutMs) {
|
|
156917
157175
|
try {
|
|
156918
|
-
await
|
|
157176
|
+
await execFileAsync26("xcrun", [...prefix, sub, udid, ...rest], {
|
|
156919
157177
|
timeout: timeoutMs,
|
|
156920
157178
|
killSignal: SIMCTL_KILL_SIGNAL
|
|
156921
157179
|
});
|
|
@@ -157015,7 +157273,7 @@ async function bootIos(udid, registry2, force, headless) {
|
|
|
157015
157273
|
return buildInitFailedResult(udid, initFailure);
|
|
157016
157274
|
}
|
|
157017
157275
|
if (!deviceSet) {
|
|
157018
|
-
await
|
|
157276
|
+
await execFileAsync26("defaults", [
|
|
157019
157277
|
"write",
|
|
157020
157278
|
"com.apple.iphonesimulator",
|
|
157021
157279
|
"CurrentDeviceUDID",
|
|
@@ -157031,20 +157289,20 @@ async function bootIos(udid, registry2, force, headless) {
|
|
|
157031
157289
|
}
|
|
157032
157290
|
async function openSimulatorWindow(udid) {
|
|
157033
157291
|
const timeout = 5e3;
|
|
157034
|
-
const { stdout } = await
|
|
157292
|
+
const { stdout } = await execFileAsync26("xcode-select", ["-p"], { timeout });
|
|
157035
157293
|
const developerDir2 = (0, import_node_fs16.realpathSync)(stdout.trim());
|
|
157036
157294
|
const simulatorApp = (0, import_node_path19.join)(developerDir2, "Applications", "Simulator.app");
|
|
157037
157295
|
if ((0, import_node_fs16.existsSync)(simulatorApp)) {
|
|
157038
157296
|
const launched = await launchSimulatorApp(
|
|
157039
157297
|
simulatorApp,
|
|
157040
|
-
() =>
|
|
157298
|
+
() => execFileAsync26("open", ["-a", simulatorApp], { timeout })
|
|
157041
157299
|
);
|
|
157042
157300
|
return launched ? void 0 : `${simulatorApp} exits right after launch on this host, so Argent no longer opens it and the device runs without a window. Delete ~/.argent/simulator-app-launch.json to try opening it again.`;
|
|
157043
157301
|
}
|
|
157044
157302
|
const deviceHubApp = (0, import_node_path19.join)(developerDir2, "..", "Applications", "DeviceHub.app");
|
|
157045
157303
|
if ((0, import_node_fs16.existsSync)(deviceHubApp)) {
|
|
157046
157304
|
const url2 = `devices://device/open?id=${encodeURIComponent(udid)}`;
|
|
157047
|
-
await
|
|
157305
|
+
await execFileAsync26("open", ["-a", deviceHubApp, url2], { timeout });
|
|
157048
157306
|
}
|
|
157049
157307
|
}
|
|
157050
157308
|
async function bootIosRemote(id, registry2, force) {
|
|
@@ -157093,7 +157351,7 @@ async function attemptBoot(params) {
|
|
|
157093
157351
|
emulatorLogFd = (0, import_node_fs16.openSync)(logPath, "w");
|
|
157094
157352
|
stdio = ["ignore", emulatorLogFd, emulatorLogFd];
|
|
157095
157353
|
}
|
|
157096
|
-
const child = (0,
|
|
157354
|
+
const child = (0, import_node_child_process36.spawn)(params.emulatorBinary, params.emulatorArgs, {
|
|
157097
157355
|
detached: true,
|
|
157098
157356
|
stdio
|
|
157099
157357
|
});
|
|
@@ -157637,7 +157895,7 @@ async function startHarmonyEmulator(instanceName) {
|
|
|
157637
157895
|
} catch {
|
|
157638
157896
|
logFd = null;
|
|
157639
157897
|
}
|
|
157640
|
-
const child = (0,
|
|
157898
|
+
const child = (0, import_node_child_process36.spawn)(bin, ["-start", instanceName], {
|
|
157641
157899
|
detached: true,
|
|
157642
157900
|
stdio: logFd === null ? "ignore" : ["ignore", logFd, logFd]
|
|
157643
157901
|
});
|
|
@@ -158207,11 +158465,11 @@ function dispatchByPlatform(opts) {
|
|
|
158207
158465
|
}
|
|
158208
158466
|
|
|
158209
158467
|
// ../tool-server/src/tools/launch-app/platforms/ios.ts
|
|
158210
|
-
var
|
|
158211
|
-
var
|
|
158468
|
+
var import_node_child_process37 = require("node:child_process");
|
|
158469
|
+
var import_node_util27 = require("node:util");
|
|
158212
158470
|
init_src2();
|
|
158213
158471
|
init_external_devices();
|
|
158214
|
-
var
|
|
158472
|
+
var execFileAsync27 = (0, import_node_util27.promisify)(import_node_child_process37.execFile);
|
|
158215
158473
|
function makeIosImpl(registry2) {
|
|
158216
158474
|
return {
|
|
158217
158475
|
requires: ["xcrun"],
|
|
@@ -158225,7 +158483,7 @@ function makeIosImpl(registry2) {
|
|
|
158225
158483
|
}
|
|
158226
158484
|
if (params.launchArgs?.length) {
|
|
158227
158485
|
try {
|
|
158228
|
-
await
|
|
158486
|
+
await execFileAsync27(
|
|
158229
158487
|
"xcrun",
|
|
158230
158488
|
await simctlArgsForUdid(params.udid, ["terminate", params.udid, params.bundleId]),
|
|
158231
158489
|
{ timeout: 15e3, killSignal: SIMCTL_KILL_SIGNAL }
|
|
@@ -158247,7 +158505,7 @@ function makeIosImpl(registry2) {
|
|
|
158247
158505
|
}
|
|
158248
158506
|
}
|
|
158249
158507
|
try {
|
|
158250
|
-
await
|
|
158508
|
+
await execFileAsync27(
|
|
158251
158509
|
"xcrun",
|
|
158252
158510
|
await simctlArgsForUdid(params.udid, [
|
|
158253
158511
|
"launch",
|
|
@@ -158760,11 +159018,11 @@ init_zod();
|
|
|
158760
159018
|
init_device_info();
|
|
158761
159019
|
|
|
158762
159020
|
// ../tool-server/src/tools/restart-app/platforms/ios.ts
|
|
158763
|
-
var
|
|
158764
|
-
var
|
|
159021
|
+
var import_node_child_process38 = require("node:child_process");
|
|
159022
|
+
var import_node_util28 = require("node:util");
|
|
158765
159023
|
init_src2();
|
|
158766
159024
|
init_external_devices();
|
|
158767
|
-
var
|
|
159025
|
+
var execFileAsync28 = (0, import_node_util28.promisify)(import_node_child_process38.execFile);
|
|
158768
159026
|
function makeIosImpl2(registry2) {
|
|
158769
159027
|
return {
|
|
158770
159028
|
requires: ["xcrun"],
|
|
@@ -158778,7 +159036,7 @@ function makeIosImpl2(registry2) {
|
|
|
158778
159036
|
if (blocked) return blocked;
|
|
158779
159037
|
}
|
|
158780
159038
|
try {
|
|
158781
|
-
await
|
|
159039
|
+
await execFileAsync28("xcrun", await simctlArgsForUdid(udid, ["terminate", udid, bundleId]), {
|
|
158782
159040
|
timeout: 15e3,
|
|
158783
159041
|
killSignal: SIMCTL_KILL_SIGNAL
|
|
158784
159042
|
});
|
|
@@ -158798,7 +159056,7 @@ function makeIosImpl2(registry2) {
|
|
|
158798
159056
|
}
|
|
158799
159057
|
}
|
|
158800
159058
|
try {
|
|
158801
|
-
await
|
|
159059
|
+
await execFileAsync28(
|
|
158802
159060
|
"xcrun",
|
|
158803
159061
|
await simctlArgsForUdid(udid, ["launch", udid, bundleId, ...params.launchArgs ?? []]),
|
|
158804
159062
|
{ timeout: 3e4, killSignal: SIMCTL_KILL_SIGNAL }
|
|
@@ -159050,12 +159308,12 @@ For Mac apps, kind is 'catalyst' or 'app'. Check appPath and args to confirm the
|
|
|
159050
159308
|
}
|
|
159051
159309
|
|
|
159052
159310
|
// ../tool-server/src/tools/terminate-app/index.ts
|
|
159053
|
-
var
|
|
159054
|
-
var
|
|
159311
|
+
var import_node_child_process39 = require("node:child_process");
|
|
159312
|
+
var import_node_util29 = require("node:util");
|
|
159055
159313
|
init_zod();
|
|
159056
159314
|
init_src2();
|
|
159057
159315
|
init_adb();
|
|
159058
|
-
var
|
|
159316
|
+
var execFileAsync29 = (0, import_node_util29.promisify)(import_node_child_process39.execFile);
|
|
159059
159317
|
var capability5 = {
|
|
159060
159318
|
apple: { simulator: true },
|
|
159061
159319
|
appleRemote: { simulator: true },
|
|
@@ -159089,7 +159347,7 @@ Succeeds when the app is not running or not installed.`,
|
|
|
159089
159347
|
requires: ["xcrun"],
|
|
159090
159348
|
handler: async (_services, { udid, bundleId }) => {
|
|
159091
159349
|
const args = await simctlArgsForUdid(udid, ["terminate", udid, bundleId]);
|
|
159092
|
-
const terminate =
|
|
159350
|
+
const terminate = execFileAsync29("xcrun", args, {
|
|
159093
159351
|
timeout: 15e3,
|
|
159094
159352
|
killSignal: SIMCTL_KILL_SIGNAL
|
|
159095
159353
|
}).catch((err) => {
|
|
@@ -159144,16 +159402,16 @@ Succeeds when the app is not running or not installed.`,
|
|
|
159144
159402
|
init_zod();
|
|
159145
159403
|
|
|
159146
159404
|
// ../tool-server/src/tools/reinstall-app/platforms/ios.ts
|
|
159147
|
-
var
|
|
159148
|
-
var
|
|
159405
|
+
var import_node_child_process41 = require("node:child_process");
|
|
159406
|
+
var import_node_util31 = require("node:util");
|
|
159149
159407
|
var import_node_path21 = require("node:path");
|
|
159150
159408
|
init_src2();
|
|
159151
159409
|
|
|
159152
159410
|
// ../tool-server/src/tools/reinstall-app/validate-app.ts
|
|
159153
|
-
var
|
|
159411
|
+
var import_node_child_process40 = require("node:child_process");
|
|
159154
159412
|
var import_promises16 = require("node:fs/promises");
|
|
159155
159413
|
var import_node_path20 = require("node:path");
|
|
159156
|
-
var
|
|
159414
|
+
var import_node_util30 = require("node:util");
|
|
159157
159415
|
init_capability();
|
|
159158
159416
|
|
|
159159
159417
|
// ../tool-server/src/utils/apk-package.ts
|
|
@@ -159252,7 +159510,7 @@ function readStringPool(xml, chunk) {
|
|
|
159252
159510
|
}
|
|
159253
159511
|
|
|
159254
159512
|
// ../tool-server/src/tools/reinstall-app/validate-app.ts
|
|
159255
|
-
var
|
|
159513
|
+
var execFileAsync30 = (0, import_node_util30.promisify)(import_node_child_process40.execFile);
|
|
159256
159514
|
async function requirePath(absolute, kind, what) {
|
|
159257
159515
|
const info = await (0, import_promises16.stat)(absolute).catch(() => null);
|
|
159258
159516
|
if (!info) {
|
|
@@ -159276,7 +159534,7 @@ async function assertIosAppBundle(absolute, bundleId, { readBundleId = true } =
|
|
|
159276
159534
|
);
|
|
159277
159535
|
}
|
|
159278
159536
|
if (!readBundleId) return;
|
|
159279
|
-
const actual = await
|
|
159537
|
+
const actual = await execFileAsync30("plutil", [
|
|
159280
159538
|
"-extract",
|
|
159281
159539
|
"CFBundleIdentifier",
|
|
159282
159540
|
"raw",
|
|
@@ -159329,7 +159587,7 @@ async function assertHap(absolute, bundleName) {
|
|
|
159329
159587
|
}
|
|
159330
159588
|
|
|
159331
159589
|
// ../tool-server/src/tools/reinstall-app/platforms/ios.ts
|
|
159332
|
-
var
|
|
159590
|
+
var execFileAsync31 = (0, import_node_util31.promisify)(import_node_child_process41.execFile);
|
|
159333
159591
|
var iosImpl = {
|
|
159334
159592
|
requires: ["xcrun"],
|
|
159335
159593
|
handler: async (_services, params) => {
|
|
@@ -159338,7 +159596,7 @@ var iosImpl = {
|
|
|
159338
159596
|
await assertIosAppBundle(absolute, bundleId);
|
|
159339
159597
|
const { nativeId, prefix } = await simctlTargetForUdid(udid);
|
|
159340
159598
|
try {
|
|
159341
|
-
await
|
|
159599
|
+
await execFileAsync31("xcrun", [...prefix, "uninstall", nativeId, bundleId], {
|
|
159342
159600
|
timeout: 3e4,
|
|
159343
159601
|
killSignal: SIMCTL_KILL_SIGNAL
|
|
159344
159602
|
});
|
|
@@ -159358,7 +159616,7 @@ var iosImpl = {
|
|
|
159358
159616
|
}
|
|
159359
159617
|
}
|
|
159360
159618
|
try {
|
|
159361
|
-
await
|
|
159619
|
+
await execFileAsync31("xcrun", [...prefix, "install", nativeId, absolute], {
|
|
159362
159620
|
timeout: 18e4,
|
|
159363
159621
|
killSignal: SIMCTL_KILL_SIGNAL
|
|
159364
159622
|
});
|
|
@@ -159626,11 +159884,11 @@ var PERMISSION_NAMES = [
|
|
|
159626
159884
|
];
|
|
159627
159885
|
|
|
159628
159886
|
// ../tool-server/src/tools/settings-permissions/platforms/ios.ts
|
|
159629
|
-
var
|
|
159630
|
-
var
|
|
159887
|
+
var import_node_child_process42 = require("node:child_process");
|
|
159888
|
+
var import_node_util32 = require("node:util");
|
|
159631
159889
|
init_src2();
|
|
159632
159890
|
init_capability();
|
|
159633
|
-
var
|
|
159891
|
+
var execFileAsync32 = (0, import_node_util32.promisify)(import_node_child_process42.execFile);
|
|
159634
159892
|
var SIMCTL_ACTION = {
|
|
159635
159893
|
grant: "grant",
|
|
159636
159894
|
deny: "revoke",
|
|
@@ -159655,7 +159913,7 @@ var NON_TCC_GRANT_NEEDS_INSTALL = /* @__PURE__ */ new Set([
|
|
|
159655
159913
|
]);
|
|
159656
159914
|
var localBackend = {
|
|
159657
159915
|
async run(udid, simctlAction, service, bundleId) {
|
|
159658
|
-
await
|
|
159916
|
+
await execFileAsync32(
|
|
159659
159917
|
"xcrun",
|
|
159660
159918
|
await simctlArgsForUdid(udid, ["privacy", udid, simctlAction, service, bundleId]),
|
|
159661
159919
|
{ timeout: 3e4 }
|
|
@@ -159663,7 +159921,7 @@ var localBackend = {
|
|
|
159663
159921
|
},
|
|
159664
159922
|
async isInstalled(udid, bundleId) {
|
|
159665
159923
|
try {
|
|
159666
|
-
await
|
|
159924
|
+
await execFileAsync32(
|
|
159667
159925
|
"xcrun",
|
|
159668
159926
|
await simctlArgsForUdid(udid, ["get_app_container", udid, bundleId]),
|
|
159669
159927
|
{ timeout: 15e3 }
|
|
@@ -159947,8 +160205,8 @@ init_zod();
|
|
|
159947
160205
|
init_device_info();
|
|
159948
160206
|
|
|
159949
160207
|
// ../tool-server/src/tools/open-url/platforms/ios.ts
|
|
159950
|
-
var
|
|
159951
|
-
var
|
|
160208
|
+
var import_node_child_process43 = require("node:child_process");
|
|
160209
|
+
var import_node_util33 = require("node:util");
|
|
159952
160210
|
init_src2();
|
|
159953
160211
|
|
|
159954
160212
|
// ../tool-server/src/tools/open-url/deep-link-note.ts
|
|
@@ -159958,13 +160216,13 @@ function httpDeepLinkNote(url2) {
|
|
|
159958
160216
|
}
|
|
159959
160217
|
|
|
159960
160218
|
// ../tool-server/src/tools/open-url/platforms/ios.ts
|
|
159961
|
-
var
|
|
160219
|
+
var execFileAsync33 = (0, import_node_util33.promisify)(import_node_child_process43.execFile);
|
|
159962
160220
|
var iosImpl3 = {
|
|
159963
160221
|
requires: ["xcrun"],
|
|
159964
160222
|
handler: async (_services, params) => {
|
|
159965
160223
|
await firstSimulatorPoll();
|
|
159966
160224
|
try {
|
|
159967
|
-
await
|
|
160225
|
+
await execFileAsync33(
|
|
159968
160226
|
"xcrun",
|
|
159969
160227
|
await simctlArgsForUdid(params.udid, ["openurl", params.udid, params.url]),
|
|
159970
160228
|
{ timeout: 3e4, killSignal: SIMCTL_KILL_SIGNAL }
|
|
@@ -160086,16 +160344,16 @@ var chromiumImpl2 = {
|
|
|
160086
160344
|
};
|
|
160087
160345
|
|
|
160088
160346
|
// ../tool-server/src/tools/open-url/platforms/macos.ts
|
|
160089
|
-
var
|
|
160347
|
+
var import_node_child_process44 = require("node:child_process");
|
|
160090
160348
|
var path39 = __toESM(require("node:path"));
|
|
160091
|
-
var
|
|
160349
|
+
var import_node_util34 = require("node:util");
|
|
160092
160350
|
init_src2();
|
|
160093
160351
|
init_capability();
|
|
160094
|
-
var
|
|
160352
|
+
var execFileAsync34 = (0, import_node_util34.promisify)(import_node_child_process44.execFile);
|
|
160095
160353
|
var WEB_URL_NOTE = "The URL went to the app of the device, not to the default browser. The app shows it only if it handles that URL.";
|
|
160096
160354
|
async function declaredSchemes(appPath) {
|
|
160097
160355
|
try {
|
|
160098
|
-
const { stdout } = await
|
|
160356
|
+
const { stdout } = await execFileAsync34(
|
|
160099
160357
|
"plutil",
|
|
160100
160358
|
[
|
|
160101
160359
|
"-extract",
|
|
@@ -160141,7 +160399,7 @@ var macosImpl3 = {
|
|
|
160141
160399
|
);
|
|
160142
160400
|
}
|
|
160143
160401
|
try {
|
|
160144
|
-
await
|
|
160402
|
+
await execFileAsync34("open", ["-g", "-a", app.appPath, params.url], { timeout: 1e4 });
|
|
160145
160403
|
} catch (err) {
|
|
160146
160404
|
const stderr = err.stderr?.trim();
|
|
160147
160405
|
throw macosFailure(
|
|
@@ -160228,8 +160486,8 @@ Returns { opened, url, note? }. \`note\` explains the routing caveat when a web
|
|
|
160228
160486
|
};
|
|
160229
160487
|
|
|
160230
160488
|
// ../tool-server/src/tools/screenshot/index.ts
|
|
160231
|
-
var
|
|
160232
|
-
var
|
|
160489
|
+
var import_node_child_process45 = require("node:child_process");
|
|
160490
|
+
var import_node_util35 = require("node:util");
|
|
160233
160491
|
var os18 = __toESM(require("node:os"));
|
|
160234
160492
|
var path40 = __toESM(require("node:path"));
|
|
160235
160493
|
init_zod();
|
|
@@ -160489,7 +160747,7 @@ async function captureHarmonyScreenshotPng(opts) {
|
|
|
160489
160747
|
// ../tool-server/src/tools/screenshot/index.ts
|
|
160490
160748
|
init_capability();
|
|
160491
160749
|
var fs47 = __toESM(require("node:fs/promises"));
|
|
160492
|
-
var
|
|
160750
|
+
var execFileAsync35 = (0, import_node_util35.promisify)(import_node_child_process45.execFile);
|
|
160493
160751
|
var capability9 = {
|
|
160494
160752
|
apple: { simulator: true, device: true },
|
|
160495
160753
|
appleRemote: { simulator: true },
|
|
@@ -160527,11 +160785,11 @@ async function tvScreenshot(udid, scale, signal) {
|
|
|
160527
160785
|
os18.tmpdir(),
|
|
160528
160786
|
`argent-tv-screenshot-${udid.slice(0, 8)}-${process.hrtime.bigint()}.png`
|
|
160529
160787
|
);
|
|
160530
|
-
await
|
|
160788
|
+
await execFileAsync35("xcrun", await simctlArgsForUdid(udid, ["io", udid, "screenshot", file2]), {
|
|
160531
160789
|
signal
|
|
160532
160790
|
});
|
|
160533
160791
|
if (scale === void 0 || scale < 1) {
|
|
160534
|
-
await
|
|
160792
|
+
await execFileAsync35("sips", ["-Z", String(await tvTargetLongSide(file2, scale)), file2], {
|
|
160535
160793
|
signal
|
|
160536
160794
|
}).catch(() => {
|
|
160537
160795
|
});
|
|
@@ -160541,7 +160799,7 @@ async function tvScreenshot(udid, scale, signal) {
|
|
|
160541
160799
|
async function tvTargetLongSide(file2, scale) {
|
|
160542
160800
|
let longSide = 3840;
|
|
160543
160801
|
try {
|
|
160544
|
-
const { stdout } = await
|
|
160802
|
+
const { stdout } = await execFileAsync35("sips", ["-g", "pixelWidth", "-g", "pixelHeight", file2]);
|
|
160545
160803
|
const width = Number(/pixelWidth:\s*(\d+)/.exec(stdout)?.[1]);
|
|
160546
160804
|
const height = Number(/pixelHeight:\s*(\d+)/.exec(stdout)?.[1]);
|
|
160547
160805
|
if (Number.isFinite(width) && Number.isFinite(height) && width > 0 && height > 0) {
|
|
@@ -160576,7 +160834,7 @@ async function downscalePngInPlace(file2, scale, signal) {
|
|
|
160576
160834
|
if (scale >= 1) {
|
|
160577
160835
|
return;
|
|
160578
160836
|
}
|
|
160579
|
-
await
|
|
160837
|
+
await execFileAsync35("sips", ["-Z", String(await tvTargetLongSide(file2, scale)), file2], {
|
|
160580
160838
|
signal
|
|
160581
160839
|
}).catch(() => {
|
|
160582
160840
|
});
|
|
@@ -163090,13 +163348,13 @@ var shakeZodSchema = external_exports.object({
|
|
|
163090
163348
|
});
|
|
163091
163349
|
|
|
163092
163350
|
// ../tool-server/src/tools/shake/platforms/ios.ts
|
|
163093
|
-
var
|
|
163094
|
-
var
|
|
163351
|
+
var import_node_child_process47 = require("node:child_process");
|
|
163352
|
+
var import_node_util36 = require("node:util");
|
|
163095
163353
|
init_src2();
|
|
163096
163354
|
init_capability();
|
|
163097
163355
|
|
|
163098
163356
|
// ../tool-server/src/utils/window-shake.ts
|
|
163099
|
-
var
|
|
163357
|
+
var import_node_child_process46 = require("node:child_process");
|
|
163100
163358
|
init_src();
|
|
163101
163359
|
var MICROINTERACTIONS_FLAG = "microinteractions";
|
|
163102
163360
|
var AMPLITUDE = 22;
|
|
@@ -163203,7 +163461,7 @@ end run
|
|
|
163203
163461
|
}
|
|
163204
163462
|
function runOsascript(script) {
|
|
163205
163463
|
return new Promise((resolve21, reject) => {
|
|
163206
|
-
const child = (0,
|
|
163464
|
+
const child = (0, import_node_child_process46.execFile)(
|
|
163207
163465
|
"/usr/bin/osascript",
|
|
163208
163466
|
["-"],
|
|
163209
163467
|
{ timeout: OSASCRIPT_TIMEOUT_MS },
|
|
@@ -163296,7 +163554,7 @@ async function prepareHostWindowShake(target) {
|
|
|
163296
163554
|
}
|
|
163297
163555
|
|
|
163298
163556
|
// ../tool-server/src/tools/shake/platforms/ios.ts
|
|
163299
|
-
var
|
|
163557
|
+
var execFileAsync36 = (0, import_node_util36.promisify)(import_node_child_process47.execFile);
|
|
163300
163558
|
var SHAKE_NOTIFICATION = "com.apple.UIKit.SimulatorShake";
|
|
163301
163559
|
var SHAKE_INTERVAL_MS = 400;
|
|
163302
163560
|
var sleep13 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
@@ -163338,7 +163596,7 @@ var iosImpl4 = {
|
|
|
163338
163596
|
if (i > 0) await sleep13(SHAKE_INTERVAL_MS);
|
|
163339
163597
|
shaker.begin();
|
|
163340
163598
|
try {
|
|
163341
|
-
await
|
|
163599
|
+
await execFileAsync36("xcrun", args, { timeout: 15e3 });
|
|
163342
163600
|
} catch (err) {
|
|
163343
163601
|
const error63 = err instanceof Error ? err : new Error(String(err));
|
|
163344
163602
|
throw shakeFailure(udid, error63.message, error63);
|
|
@@ -164366,7 +164624,7 @@ init_device_info();
|
|
|
164366
164624
|
init_capability();
|
|
164367
164625
|
|
|
164368
164626
|
// ../tool-server/src/utils/sub-invoke.ts
|
|
164369
|
-
var
|
|
164627
|
+
var import_node_crypto18 = require("node:crypto");
|
|
164370
164628
|
init_src2();
|
|
164371
164629
|
async function invokeSubTool(registry2, ctx, toolId, args, extra) {
|
|
164372
164630
|
const signal = ctx?.signal;
|
|
@@ -164382,7 +164640,7 @@ async function invokeSubTool(registry2, ctx, toolId, args, extra) {
|
|
|
164382
164640
|
if (!recordChildInvocation) {
|
|
164383
164641
|
return signal || Object.keys(forwarded).length > 0 ? registry2.invokeTool(toolId, args, { ...signal ? { signal } : {}, ...forwarded }) : registry2.invokeTool(toolId, args);
|
|
164384
164642
|
}
|
|
164385
|
-
const toolInvocationId = (0,
|
|
164643
|
+
const toolInvocationId = (0, import_node_crypto18.randomUUID)();
|
|
164386
164644
|
const release2 = recordChildInvocation(toolInvocationId, args);
|
|
164387
164645
|
try {
|
|
164388
164646
|
return await registry2.invokeTool(toolId, args, {
|
|
@@ -164565,7 +164823,7 @@ init_zod();
|
|
|
164565
164823
|
var zodSchema31 = external_exports.object({
|
|
164566
164824
|
port: metroPortField,
|
|
164567
164825
|
device_id: external_exports.string().describe(
|
|
164568
|
-
"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>)."
|
|
164826
|
+
"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>). Pass this SAME id as device_id to every subsequent debugger-* call to pin them to this device. The returned logicalDeviceId is informational (Metro's own per-connection handle, absent on Vega); you do not switch to it. Forwarding it still resolves here, but the list-devices id is the stable one. On a Metro shared by several devices, a simulator UDID or Android serial is matched by the device's name (a simulator's name; an Android model, release and API level); the app's device log must then confirm it runs there. When another booted simulator or attached device shares that name, or the log does not confirm it, the error asks for the logicalDeviceId instead."
|
|
164569
164827
|
)
|
|
164570
164828
|
});
|
|
164571
164829
|
var debuggerConnectTool = {
|
|
@@ -169386,161 +169644,6 @@ Returns { settled, waitedMs, polls, note? }. If that is not seen before timeoutM
|
|
|
169386
169644
|
var crypto6 = __toESM(require("node:crypto"));
|
|
169387
169645
|
init_zod();
|
|
169388
169646
|
init_src2();
|
|
169389
|
-
|
|
169390
|
-
// ../tool-server/src/utils/debugger/runtime-device.ts
|
|
169391
|
-
var import_node_crypto18 = require("node:crypto");
|
|
169392
|
-
var import_node_child_process47 = require("node:child_process");
|
|
169393
|
-
var import_node_util36 = require("node:util");
|
|
169394
|
-
init_adb();
|
|
169395
|
-
var execFileAsync36 = (0, import_node_util36.promisify)(import_node_child_process47.execFile);
|
|
169396
|
-
var LOG_READ_TIMEOUT_MS = 5e3;
|
|
169397
|
-
var RETRY_DELAY_MS = 300;
|
|
169398
|
-
var OTHER_TRANSPORTS_GRACE_MS = 500;
|
|
169399
|
-
var NOT_FOUND = { found: [], unresolved: [] };
|
|
169400
|
-
async function findRuntimeDevices(cdp, {
|
|
169401
|
-
awaitSerials = [],
|
|
169402
|
-
waitSerials = []
|
|
169403
|
-
} = {}) {
|
|
169404
|
-
const marker = `argent-device-probe:${(0, import_node_crypto18.randomUUID)()}`;
|
|
169405
|
-
const logged = await cdp.evaluate(
|
|
169406
|
-
`(function () {
|
|
169407
|
-
if (typeof nativeLoggingHook !== "function") return false;
|
|
169408
|
-
nativeLoggingHook(${JSON.stringify(marker)}, 1);
|
|
169409
|
-
return true;
|
|
169410
|
-
})()`
|
|
169411
|
-
).catch(() => false);
|
|
169412
|
-
if (logged !== true) return NOT_FOUND;
|
|
169413
|
-
const checks = [
|
|
169414
|
-
async () => androidDevices(await androidSerials(), marker, awaitSerials, waitSerials),
|
|
169415
|
-
async () => {
|
|
169416
|
-
const udids = await bootedSimulators();
|
|
169417
|
-
const udid = await firstFound(udids.map((udid2) => () => simulatorLogHolds(udid2, marker)));
|
|
169418
|
-
return udid === void 0 ? void 0 : { found: [udid], unresolved: [] };
|
|
169419
|
-
}
|
|
169420
|
-
];
|
|
169421
|
-
for (let attempt = 0; attempt < 2; attempt++) {
|
|
169422
|
-
if (attempt > 0) await new Promise((r) => setTimeout(r, RETRY_DELAY_MS));
|
|
169423
|
-
const found = await firstFound(checks);
|
|
169424
|
-
if (found !== void 0) return found;
|
|
169425
|
-
}
|
|
169426
|
-
return NOT_FOUND;
|
|
169427
|
-
}
|
|
169428
|
-
function firstFound(checks) {
|
|
169429
|
-
return new Promise((resolve21) => {
|
|
169430
|
-
let left = checks.length;
|
|
169431
|
-
if (left === 0) resolve21(void 0);
|
|
169432
|
-
for (const check3 of checks) {
|
|
169433
|
-
void check3().then((value) => {
|
|
169434
|
-
if (value !== void 0) resolve21(value);
|
|
169435
|
-
else if (--left === 0) resolve21(void 0);
|
|
169436
|
-
});
|
|
169437
|
-
}
|
|
169438
|
-
});
|
|
169439
|
-
}
|
|
169440
|
-
async function androidDevices(serials, marker, awaitSerials, waitSerials) {
|
|
169441
|
-
const listed = [...new Set(serials)];
|
|
169442
|
-
const awaited = listed.filter(
|
|
169443
|
-
(serial) => awaitSerials.includes(serial) || waitSerials.includes(serial)
|
|
169444
|
-
);
|
|
169445
|
-
const answers = /* @__PURE__ */ new Map();
|
|
169446
|
-
await new Promise((resolve21) => {
|
|
169447
|
-
let graceOver = false;
|
|
169448
|
-
let grace;
|
|
169449
|
-
const settle3 = () => {
|
|
169450
|
-
const held = heldSerials(answers);
|
|
169451
|
-
const waitingOn = listed.filter(
|
|
169452
|
-
(serial) => !answers.has(serial) && (!graceOver || awaited.includes(serial)) && !held.some((found2) => anotherDevice(serial, found2))
|
|
169453
|
-
);
|
|
169454
|
-
if (waitingOn.length === 0) {
|
|
169455
|
-
clearTimeout(grace);
|
|
169456
|
-
resolve21();
|
|
169457
|
-
}
|
|
169458
|
-
};
|
|
169459
|
-
settle3();
|
|
169460
|
-
for (const serial of listed) {
|
|
169461
|
-
void logcatHolds(serial, marker).then((read) => {
|
|
169462
|
-
answers.set(serial, read);
|
|
169463
|
-
if (read === "held") {
|
|
169464
|
-
grace ??= setTimeout(() => {
|
|
169465
|
-
graceOver = true;
|
|
169466
|
-
settle3();
|
|
169467
|
-
}, OTHER_TRANSPORTS_GRACE_MS);
|
|
169468
|
-
}
|
|
169469
|
-
settle3();
|
|
169470
|
-
});
|
|
169471
|
-
}
|
|
169472
|
-
});
|
|
169473
|
-
const found = heldSerials(answers);
|
|
169474
|
-
if (found.length === 0) return void 0;
|
|
169475
|
-
const unresolved = [...new Set(awaitSerials)].filter(
|
|
169476
|
-
(serial) => (!listed.includes(serial) || answers.get(serial) === "failed") && !found.some((device) => anotherDevice(serial, device))
|
|
169477
|
-
);
|
|
169478
|
-
return { found, unresolved };
|
|
169479
|
-
}
|
|
169480
|
-
function heldSerials(answers) {
|
|
169481
|
-
return [...answers].filter(([, read]) => read === "held").map(([serial]) => serial);
|
|
169482
|
-
}
|
|
169483
|
-
function anotherDevice(a, b) {
|
|
169484
|
-
if (a === b) return false;
|
|
169485
|
-
const portA = consolePortFromAdbSerial(a);
|
|
169486
|
-
const portB = consolePortFromAdbSerial(b);
|
|
169487
|
-
if (portA !== null && portB !== null) return portA !== portB;
|
|
169488
|
-
if (isUsbSerial(a) && isUsbSerial(b)) return true;
|
|
169489
|
-
return portA !== null && isUsbSerial(b) || portB !== null && isUsbSerial(a);
|
|
169490
|
-
}
|
|
169491
|
-
function isUsbSerial(serial) {
|
|
169492
|
-
return !serial.startsWith("emulator-") && !serial.includes(":") && !serial.includes("._");
|
|
169493
|
-
}
|
|
169494
|
-
async function androidSerials() {
|
|
169495
|
-
try {
|
|
169496
|
-
const { stdout } = await runAdb(["devices"], { timeoutMs: ADB_DEVICES_TIMEOUT_MS });
|
|
169497
|
-
return parseAdbDevices(stdout).filter((d) => d.state === "device").map((d) => d.serial);
|
|
169498
|
-
} catch {
|
|
169499
|
-
return [];
|
|
169500
|
-
}
|
|
169501
|
-
}
|
|
169502
|
-
async function bootedSimulators() {
|
|
169503
|
-
const simulators = await listIosSimulators().catch(() => []);
|
|
169504
|
-
return simulators.filter((s) => s.state === "Booted").map((s) => s.udid);
|
|
169505
|
-
}
|
|
169506
|
-
async function logcatHolds(serial, marker) {
|
|
169507
|
-
try {
|
|
169508
|
-
const { stdout } = await runAdb(
|
|
169509
|
-
["-s", serial, "logcat", "-d", "-s", "ReactNativeJS", "-e", marker],
|
|
169510
|
-
{ timeoutMs: LOG_READ_TIMEOUT_MS }
|
|
169511
|
-
);
|
|
169512
|
-
return stdout.includes(marker) ? "held" : "absent";
|
|
169513
|
-
} catch {
|
|
169514
|
-
return "failed";
|
|
169515
|
-
}
|
|
169516
|
-
}
|
|
169517
|
-
async function simulatorLogHolds(udid, marker) {
|
|
169518
|
-
try {
|
|
169519
|
-
const args = await simctlArgsForUdid(udid, [
|
|
169520
|
-
"spawn",
|
|
169521
|
-
udid,
|
|
169522
|
-
"log",
|
|
169523
|
-
"show",
|
|
169524
|
-
"--info",
|
|
169525
|
-
"--last",
|
|
169526
|
-
"1m",
|
|
169527
|
-
"--style",
|
|
169528
|
-
"compact",
|
|
169529
|
-
"--predicate",
|
|
169530
|
-
`eventMessage CONTAINS ${JSON.stringify(marker)} AND process != "log"`
|
|
169531
|
-
]);
|
|
169532
|
-
const { stdout } = await execFileAsync36("xcrun", args, {
|
|
169533
|
-
timeout: LOG_READ_TIMEOUT_MS,
|
|
169534
|
-
killSignal: SIMCTL_KILL_SIGNAL,
|
|
169535
|
-
encoding: "utf-8"
|
|
169536
|
-
});
|
|
169537
|
-
return stdout.includes(marker) ? udid : void 0;
|
|
169538
|
-
} catch {
|
|
169539
|
-
return void 0;
|
|
169540
|
-
}
|
|
169541
|
-
}
|
|
169542
|
-
|
|
169543
|
-
// ../tool-server/src/tools/profiler/react/react-profiler-start.ts
|
|
169544
169647
|
init_external_devices();
|
|
169545
169648
|
|
|
169546
169649
|
// ../tool-server/src/utils/react-profiler/devtools-bootstrap.ts
|
|
@@ -184318,7 +184421,7 @@ function createStopAllSimulatorServersTool(registry2) {
|
|
|
184318
184421
|
id: "stop-all-simulator-servers",
|
|
184319
184422
|
description: `Stop the services a device owns - simulator-server processes (iOS + Android), native devtools, the iOS accessibility service, TV-control daemons, Chromium CDP sessions, screen recordings, native profiler sessions, native network capture with the requests it recorded, and JS-runtime debugger sessions along with the network inspectors and React profiler sessions that ride on them - freeing their spawned processes, sockets and ports. Network capture started by network-capture-start ends here too, with the requests it recorded, except in a JS runtime this call does not reach, for example after Metro restarted: this call does not connect to it again, so its JS capture keeps recording and keeps its requests, and the result does not say so. A later network-capture-stop that reaches that runtime stops the recording. Call this when the user asks to clean up or ends the session, or when a skill tells you to recycle a device's services mid-flow - not just because a task finished, since the next task reuses these services and would start cold again. To stop the network capture of one app and keep its requests, call network-capture-stop instead.
|
|
184320
184423
|
PASS \`devices\` with the device ids this session used: one tool-server serves every agent, subagent and CLI call using this argent install, and an unscoped call tears down THEIR devices too. Omit \`devices\` only when a machine-wide cleanup is what you actually want. An EMPTY array stops nothing; it does not ask for the machine-wide sweep.
|
|
184321
|
-
A JS-runtime debugger session is keyed by the id you called \`debugger-connect\` with. On a Metro serving two or more devices that id can be a \`logicalDeviceId\`: connect refuses a
|
|
184424
|
+
A JS-runtime debugger session is keyed by the id you called \`debugger-connect\` with. On a Metro serving two or more devices that id can be a \`logicalDeviceId\`: connect refuses a udid or serial it cannot match to one Metro device by name, and tells you to re-target with the \`logicalDeviceId\` it returns. A scope built from \`list-devices\` ids cannot reach that session. Pass any such \`logicalDeviceId\` in \`devices\` ALONGSIDE the device id.
|
|
184322
184425
|
Returns { stopped }: the URNs of the live services that were shut down; empty means nothing was still running. { unmatched }, present only when a supplied id owns no service here, lists those ids, so a typo or a device NAME passed instead of an id does not read as a clean machine. It is NOT proof the id is wrong: a Vega device you only booted and drove with the remote registers no service and lands here, as does any device this session never started anything on. { left_running } lists the URNs of live debugger sessions (and the network inspectors / React profiler sessions riding on them) whose id no device scope can name; re-call with the id after each URN's \`<namespace>:<port>:\` prefix to reap them. { aborted: true } means the request was cancelled part-way: the rest was left untouched and \`unmatched\` / \`left_running\` were not computed.
|
|
184323
184426
|
Fails if the input has an unknown key (e.g. \`udids\` instead of \`devices\`); otherwise it always succeeds, and reaping nothing is a result, not a failure.`,
|
|
184324
184427
|
zodSchema: zodSchema66,
|
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.68",
|
|
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",
|
|
@@ -39,6 +39,9 @@ During polish, use `within`, `after`, and `next` to disambiguate repeated elemen
|
|
|
39
39
|
1. Choose the e2e test type:
|
|
40
40
|
- **standalone:** the first step that is not `echo:` or `script:` is `launch:`. The test controls process start.
|
|
41
41
|
- **fragment:** there is no leading launch. Declare a precise `executionPrerequisite`.
|
|
42
|
+
|
|
43
|
+
When a test needs the state that an earlier test leaves, put both in a [suite](references/e2e-yaml.md#suites).
|
|
44
|
+
|
|
42
45
|
2. Follow [Live authoring](references/live-authoring.md): start, record one verified step at a time, finish, polish, audit, and replay.
|
|
43
46
|
3. Report the file, replay command, result, prerequisite or side effects, and every coordinate or raw-gesture exception.
|
|
44
47
|
|
|
@@ -16,6 +16,7 @@ Read this reference when polishing, composing, or manually reviewing an e2e test
|
|
|
16
16
|
- [Composition and platform limits](#composition-and-platform-limits)
|
|
17
17
|
- [Local scripts](#local-scripts)
|
|
18
18
|
- [Snapshots and CLI runs](#snapshots-and-cli-runs)
|
|
19
|
+
- [Suites](#suites)
|
|
19
20
|
- [YAML safety](#yaml-safety)
|
|
20
21
|
|
|
21
22
|
## File shape and test type
|
|
@@ -278,6 +279,23 @@ Baselines live beside the test, under `.argent/e2e/__baselines__/<name>/` and ar
|
|
|
278
279
|
|
|
279
280
|
Pin `--platform` and `--device` for iOS, Android, or Vega. For Chromium the device class is the window's own pixel size, which the app sets and no launch argument changes: pass `--platform chromium` and omit `--device` so the runner boots the declared app path instead of attaching to a running window of another size. A window sized from host or session state produces a key CI cannot reproduce, and the step fails for a missing baseline. For a Mac app, pass `--platform macos` and omit `--device`; the key holds the window size in points, so a new window size needs new baselines. The runner pins mobile status bars during visual runs. `--output <dir>` writes failed snapshots' images and failed steps' screenshots under `<dir>/<name>/` for CI artifact upload.
|
|
280
281
|
|
|
282
|
+
### Suites
|
|
283
|
+
|
|
284
|
+
`argent e2e run <dir> [--recursive]` runs the tests of a directory. They are independent, and their order is not guaranteed. When a test needs the state that an earlier test leaves, make the directory a suite: add `suite.config.yaml` beside the tests.
|
|
285
|
+
|
|
286
|
+
```yaml
|
|
287
|
+
continueOnFailure: false # optional; true runs the later tests after a failure
|
|
288
|
+
tests: # optional; default is file name order
|
|
289
|
+
- add-post
|
|
290
|
+
- delete-post
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
- A failed test skips the later tests of its suite (`skipped (earlier test failed)`). A `requires:` skip is not a failure.
|
|
294
|
+
- With `tests:`, a test file in the directory that the list does not name does not run, and the run warns.
|
|
295
|
+
- A suite holds only the test files directly in its directory. A subdirectory is a separate suite only with its own `suite.config.yaml`.
|
|
296
|
+
- Quote a test name that YAML reads as a number or boolean: `- "2024"`.
|
|
297
|
+
- An invalid file skips every test of its suite and the run exits 1. A run of one test ignores the file, so a test that needs the state of an earlier test fails alone: replay the suite directory.
|
|
298
|
+
|
|
281
299
|
## YAML safety
|
|
282
300
|
|
|
283
301
|
Quote strings containing `#`, `:`, or quotes. Quote numbers and `true` or `false` in text slots. Use single quotes for regexes with backslashes. Parsing rejects invalid directives, selectors, regexes, `else`, unsupported options, and standalone tests that also declare `executionPrerequisite`.
|
|
@@ -34,7 +34,7 @@ Before touching the app, write a compact table. Restate it in the final report.
|
|
|
34
34
|
- Stable executable evidence for each row.
|
|
35
35
|
- Required data and side effects.
|
|
36
36
|
|
|
37
|
-
Use structural checks for semantic state, snapshots for pixels, and both for mixed requirements. One behavioral scenario becomes one `qa-<area>-<behavior>` e2e test.
|
|
37
|
+
Use structural checks for semantic state, snapshots for pixels, and both for mixed requirements. One behavioral scenario becomes one `qa-<area>-<behavior>` e2e test. Do not make it depend on the state that another test leaves. A suite does not change this rule.
|
|
38
38
|
|
|
39
39
|
Do not invent a material value or weaken ambiguity. Choose the strongest UI-verifiable reading and report it. Ask when the choice changes test meaning.
|
|
40
40
|
|