@swmansion/argent 0.34.1-next.3 → 0.34.1-next.5
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-server.cjs +151 -26
- package/package.json +1 -1
package/dist/cli-cmds.mjs
CHANGED
|
@@ -36085,7 +36085,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
36085
36085
|
var SESSION_ID2 = randomUUID5();
|
|
36086
36086
|
function readCliVersion() {
|
|
36087
36087
|
if (true) {
|
|
36088
|
-
return "0.34.1-next.
|
|
36088
|
+
return "0.34.1-next.5";
|
|
36089
36089
|
}
|
|
36090
36090
|
return "0.0.0";
|
|
36091
36091
|
}
|
package/dist/installer.mjs
CHANGED
|
@@ -16993,7 +16993,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
16993
16993
|
var SESSION_ID = randomUUID4();
|
|
16994
16994
|
function readCliVersion() {
|
|
16995
16995
|
if (true) {
|
|
16996
|
-
return "0.34.1-next.
|
|
16996
|
+
return "0.34.1-next.5";
|
|
16997
16997
|
}
|
|
16998
16998
|
return "0.0.0";
|
|
16999
16999
|
}
|
package/dist/tool-server.cjs
CHANGED
|
@@ -101285,7 +101285,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
101285
101285
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
101286
101286
|
function readCliVersion() {
|
|
101287
101287
|
if (true) {
|
|
101288
|
-
return "0.34.1-next.
|
|
101288
|
+
return "0.34.1-next.5";
|
|
101289
101289
|
}
|
|
101290
101290
|
return "0.0.0";
|
|
101291
101291
|
}
|
|
@@ -123338,6 +123338,9 @@ function registerCaptureOnDemandSender(deviceId, endpoint, send) {
|
|
|
123338
123338
|
if (entry.onDemand) entry.send(false);
|
|
123339
123339
|
};
|
|
123340
123340
|
}
|
|
123341
|
+
function simulatorServerDeviceIds() {
|
|
123342
|
+
return [...servers.keys()];
|
|
123343
|
+
}
|
|
123341
123344
|
function captureOnDemandDropped(deviceId, endpoint) {
|
|
123342
123345
|
const server = servers.get(deviceId);
|
|
123343
123346
|
if (server?.endpoint === endpoint) server.onDemand = false;
|
|
@@ -128553,8 +128556,8 @@ function parseVegaDeviceList(stdout) {
|
|
|
128553
128556
|
}
|
|
128554
128557
|
return devices;
|
|
128555
128558
|
}
|
|
128556
|
-
function filterVvdShadowsFromAndroid(
|
|
128557
|
-
return
|
|
128559
|
+
function filterVvdShadowsFromAndroid(androidDevices2, vvdAdbSerials) {
|
|
128560
|
+
return androidDevices2.filter((d) => !vvdAdbSerials.has(d.serial));
|
|
128558
128561
|
}
|
|
128559
128562
|
async function readVegaInfo() {
|
|
128560
128563
|
try {
|
|
@@ -128729,12 +128732,12 @@ function sortIosRemote(a, b) {
|
|
|
128729
128732
|
const bBooted = b.state === "Booted" ? 0 : 1;
|
|
128730
128733
|
return aBooted - bBooted;
|
|
128731
128734
|
}
|
|
128732
|
-
async function resolveVvdShadowAdbSerials(
|
|
128735
|
+
async function resolveVvdShadowAdbSerials(androidDevices2, vega) {
|
|
128733
128736
|
if (!vega.some((d) => d.kind === "vvd" && d.state === "running")) return /* @__PURE__ */ new Set();
|
|
128734
128737
|
const vvdPorts = await listRunningVvdConsolePorts();
|
|
128735
128738
|
if (vvdPorts.size === 0) return /* @__PURE__ */ new Set();
|
|
128736
128739
|
const shadows = /* @__PURE__ */ new Set();
|
|
128737
|
-
for (const d of
|
|
128740
|
+
for (const d of androidDevices2) {
|
|
128738
128741
|
const port = consolePortFromAdbSerial(d.serial);
|
|
128739
128742
|
if (port !== null && vvdPorts.has(port)) shadows.add(d.serial);
|
|
128740
128743
|
}
|
|
@@ -142964,7 +142967,8 @@ function includesWordsCI(haystack, needle) {
|
|
|
142964
142967
|
function flattenHoisting(node2, project, out, scrollClip = null) {
|
|
142965
142968
|
const view = project(node2);
|
|
142966
142969
|
if (view.skip) return "";
|
|
142967
|
-
if (scrollClip && view.rect && rectFullyOutside(view.rect, scrollClip))
|
|
142970
|
+
if (scrollClip && view.rect && view.rect.w > 0 && view.rect.h > 0 && rectFullyOutside(view.rect, scrollClip))
|
|
142971
|
+
return "";
|
|
142968
142972
|
const childClip = view.scrolls && view.rect ? intersectClip(view.rect, scrollClip) : scrollClip;
|
|
142969
142973
|
const childText = [];
|
|
142970
142974
|
for (const child of view.children) {
|
|
@@ -145614,8 +145618,14 @@ function findAndroidNativeRecord(id) {
|
|
|
145614
145618
|
function liveAndroidNetworkCaptures(deviceId) {
|
|
145615
145619
|
return [...liveInspectors.get(deviceKeyOf(deviceId)) ?? []].filter((handle) => handle.isLive()).map((handle) => handle.packageName).sort();
|
|
145616
145620
|
}
|
|
145621
|
+
function liveAndroidNetworkCaptureSerials() {
|
|
145622
|
+
return liveCaptureSerials(() => true);
|
|
145623
|
+
}
|
|
145617
145624
|
function liveAndroidNetworkCaptureDevices(packageName) {
|
|
145618
|
-
|
|
145625
|
+
return liveCaptureSerials((handle) => handle.packageName === packageName);
|
|
145626
|
+
}
|
|
145627
|
+
function liveCaptureSerials(matches2) {
|
|
145628
|
+
const serials = allHandles().filter((handle) => matches2(handle) && handle.isLive()).map((handle) => handle.serial);
|
|
145619
145629
|
return [...new Set(serials)].sort();
|
|
145620
145630
|
}
|
|
145621
145631
|
async function attachAndroidNetworkInspectorToLaunch(deviceId, packageName) {
|
|
@@ -162424,7 +162434,12 @@ init_adb();
|
|
|
162424
162434
|
var execFileAsync35 = (0, import_node_util35.promisify)(import_node_child_process46.execFile);
|
|
162425
162435
|
var LOG_READ_TIMEOUT_MS = 5e3;
|
|
162426
162436
|
var RETRY_DELAY_MS = 300;
|
|
162427
|
-
|
|
162437
|
+
var OTHER_TRANSPORTS_GRACE_MS = 500;
|
|
162438
|
+
var NOT_FOUND = { found: [], unresolved: [] };
|
|
162439
|
+
async function findRuntimeDevices(cdp, {
|
|
162440
|
+
awaitSerials = [],
|
|
162441
|
+
waitSerials = []
|
|
162442
|
+
} = {}) {
|
|
162428
162443
|
const marker = `argent-device-probe:${(0, import_node_crypto15.randomUUID)()}`;
|
|
162429
162444
|
const logged = await cdp.evaluate(
|
|
162430
162445
|
`(function () {
|
|
@@ -162433,30 +162448,88 @@ async function findRuntimeDevice(cdp) {
|
|
|
162433
162448
|
return true;
|
|
162434
162449
|
})()`
|
|
162435
162450
|
).catch(() => false);
|
|
162436
|
-
if (logged !== true) return
|
|
162451
|
+
if (logged !== true) return NOT_FOUND;
|
|
162437
162452
|
const checks = [
|
|
162438
|
-
async () =>
|
|
162439
|
-
async () =>
|
|
162453
|
+
async () => androidDevices(await androidSerials(), marker, awaitSerials, waitSerials),
|
|
162454
|
+
async () => {
|
|
162455
|
+
const udids = await bootedSimulators();
|
|
162456
|
+
const udid = await firstFound(udids.map((udid2) => () => simulatorLogHolds(udid2, marker)));
|
|
162457
|
+
return udid === void 0 ? void 0 : { found: [udid], unresolved: [] };
|
|
162458
|
+
}
|
|
162440
162459
|
];
|
|
162441
162460
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
162442
162461
|
if (attempt > 0) await new Promise((r) => setTimeout(r, RETRY_DELAY_MS));
|
|
162443
162462
|
const found = await firstFound(checks);
|
|
162444
162463
|
if (found !== void 0) return found;
|
|
162445
162464
|
}
|
|
162446
|
-
return
|
|
162465
|
+
return NOT_FOUND;
|
|
162447
162466
|
}
|
|
162448
162467
|
function firstFound(checks) {
|
|
162449
162468
|
return new Promise((resolve19) => {
|
|
162450
162469
|
let left = checks.length;
|
|
162451
162470
|
if (left === 0) resolve19(void 0);
|
|
162452
162471
|
for (const check3 of checks) {
|
|
162453
|
-
void check3().then((
|
|
162454
|
-
if (
|
|
162472
|
+
void check3().then((value) => {
|
|
162473
|
+
if (value !== void 0) resolve19(value);
|
|
162455
162474
|
else if (--left === 0) resolve19(void 0);
|
|
162456
162475
|
});
|
|
162457
162476
|
}
|
|
162458
162477
|
});
|
|
162459
162478
|
}
|
|
162479
|
+
async function androidDevices(serials, marker, awaitSerials, waitSerials) {
|
|
162480
|
+
const listed = [...new Set(serials)];
|
|
162481
|
+
const awaited = listed.filter(
|
|
162482
|
+
(serial) => awaitSerials.includes(serial) || waitSerials.includes(serial)
|
|
162483
|
+
);
|
|
162484
|
+
const answers = /* @__PURE__ */ new Map();
|
|
162485
|
+
await new Promise((resolve19) => {
|
|
162486
|
+
let graceOver = false;
|
|
162487
|
+
let grace;
|
|
162488
|
+
const settle3 = () => {
|
|
162489
|
+
const held = heldSerials(answers);
|
|
162490
|
+
const waitingOn = listed.filter(
|
|
162491
|
+
(serial) => !answers.has(serial) && (!graceOver || awaited.includes(serial)) && !held.some((found2) => anotherDevice(serial, found2))
|
|
162492
|
+
);
|
|
162493
|
+
if (waitingOn.length === 0) {
|
|
162494
|
+
clearTimeout(grace);
|
|
162495
|
+
resolve19();
|
|
162496
|
+
}
|
|
162497
|
+
};
|
|
162498
|
+
settle3();
|
|
162499
|
+
for (const serial of listed) {
|
|
162500
|
+
void logcatHolds(serial, marker).then((read) => {
|
|
162501
|
+
answers.set(serial, read);
|
|
162502
|
+
if (read === "held") {
|
|
162503
|
+
grace ??= setTimeout(() => {
|
|
162504
|
+
graceOver = true;
|
|
162505
|
+
settle3();
|
|
162506
|
+
}, OTHER_TRANSPORTS_GRACE_MS);
|
|
162507
|
+
}
|
|
162508
|
+
settle3();
|
|
162509
|
+
});
|
|
162510
|
+
}
|
|
162511
|
+
});
|
|
162512
|
+
const found = heldSerials(answers);
|
|
162513
|
+
if (found.length === 0) return void 0;
|
|
162514
|
+
const unresolved = [...new Set(awaitSerials)].filter(
|
|
162515
|
+
(serial) => (!listed.includes(serial) || answers.get(serial) === "failed") && !found.some((device) => anotherDevice(serial, device))
|
|
162516
|
+
);
|
|
162517
|
+
return { found, unresolved };
|
|
162518
|
+
}
|
|
162519
|
+
function heldSerials(answers) {
|
|
162520
|
+
return [...answers].filter(([, read]) => read === "held").map(([serial]) => serial);
|
|
162521
|
+
}
|
|
162522
|
+
function anotherDevice(a, b) {
|
|
162523
|
+
if (a === b) return false;
|
|
162524
|
+
const portA = consolePortFromAdbSerial(a);
|
|
162525
|
+
const portB = consolePortFromAdbSerial(b);
|
|
162526
|
+
if (portA !== null && portB !== null) return portA !== portB;
|
|
162527
|
+
if (isUsbSerial(a) && isUsbSerial(b)) return true;
|
|
162528
|
+
return portA !== null && isUsbSerial(b) || portB !== null && isUsbSerial(a);
|
|
162529
|
+
}
|
|
162530
|
+
function isUsbSerial(serial) {
|
|
162531
|
+
return !serial.startsWith("emulator-") && !serial.includes(":") && !serial.includes("._");
|
|
162532
|
+
}
|
|
162460
162533
|
async function androidSerials() {
|
|
162461
162534
|
try {
|
|
162462
162535
|
const { stdout } = await runAdb(["devices"], { timeoutMs: ADB_DEVICES_TIMEOUT_MS });
|
|
@@ -162475,9 +162548,9 @@ async function logcatHolds(serial, marker) {
|
|
|
162475
162548
|
["-s", serial, "logcat", "-d", "-s", "ReactNativeJS", "-e", marker],
|
|
162476
162549
|
{ timeoutMs: LOG_READ_TIMEOUT_MS }
|
|
162477
162550
|
);
|
|
162478
|
-
return stdout.includes(marker) ?
|
|
162551
|
+
return stdout.includes(marker) ? "held" : "absent";
|
|
162479
162552
|
} catch {
|
|
162480
|
-
return
|
|
162553
|
+
return "failed";
|
|
162481
162554
|
}
|
|
162482
162555
|
}
|
|
162483
162556
|
async function simulatorLogHolds(udid, marker) {
|
|
@@ -162506,6 +162579,9 @@ async function simulatorLogHolds(udid, marker) {
|
|
|
162506
162579
|
}
|
|
162507
162580
|
}
|
|
162508
162581
|
|
|
162582
|
+
// ../tool-server/src/tools/profiler/react/react-profiler-start.ts
|
|
162583
|
+
init_external_devices();
|
|
162584
|
+
|
|
162509
162585
|
// ../tool-server/src/utils/react-profiler/devtools-bootstrap.ts
|
|
162510
162586
|
function bootstrapFailureMessage(bootstrap) {
|
|
162511
162587
|
switch (bootstrap.reason) {
|
|
@@ -162527,17 +162603,47 @@ function bootstrapFailureMessage(bootstrap) {
|
|
|
162527
162603
|
|
|
162528
162604
|
// ../tool-server/src/utils/profiler-shared/network-capture-warning.ts
|
|
162529
162605
|
var CAPTURE_COST = "It can slow the app, so the timings in this profile can differ from a run without it.";
|
|
162530
|
-
function nativeNetworkCaptureWarning(deviceId, runtimeApp) {
|
|
162531
|
-
let packages;
|
|
162606
|
+
function nativeNetworkCaptureWarning(deviceId, runtimeApp, runtimeDevices = { found: [], unresolved: [] }) {
|
|
162532
162607
|
try {
|
|
162533
|
-
|
|
162608
|
+
if (runtimeDevices.found.length > 0) {
|
|
162609
|
+
return foundDeviceWarning(runtimeDevices, runtimeApp);
|
|
162610
|
+
}
|
|
162611
|
+
const packages = liveAndroidNetworkCaptures(deviceId);
|
|
162534
162612
|
if (packages.length === 0) return logicalDeviceWarning(deviceId, runtimeApp);
|
|
162613
|
+
const apps = packages.join(", ");
|
|
162614
|
+
const one = packages.length === 1;
|
|
162615
|
+
return `Native network capture is on for ${apps} on this device: Argent attaches its in-app agent to the processes of ${one ? "that app" : "these apps"}. ${CAPTURE_COST} To profile without it, stop this profile, call native-network-logs with stop: true for ${one ? "that app" : "each of these apps"}, then restart-app and profile again.`;
|
|
162535
162616
|
} catch {
|
|
162536
162617
|
return void 0;
|
|
162537
162618
|
}
|
|
162538
|
-
|
|
162539
|
-
|
|
162540
|
-
|
|
162619
|
+
}
|
|
162620
|
+
function foundDeviceWarning({ found, unresolved }, runtimeApp) {
|
|
162621
|
+
const captures = found.map((device) => ({ device, packages: liveAndroidNetworkCaptures(device) })).filter(({ packages }) => packages.length > 0);
|
|
162622
|
+
const appId = runtimeApp?.platform === "android" ? runtimeApp.appId : void 0;
|
|
162623
|
+
const maybe = appId ? unresolved.filter((serial) => liveAndroidNetworkCaptures(serial).includes(appId)) : [];
|
|
162624
|
+
const first = captures[0];
|
|
162625
|
+
if (!first && (!appId || maybe.length === 0)) return void 0;
|
|
162626
|
+
const sentences = [];
|
|
162627
|
+
if (first) {
|
|
162628
|
+
const apps = [...new Set(captures.flatMap(({ packages }) => packages))].sort();
|
|
162629
|
+
const where = captures.length === 1 ? `${first.device}, the device this profile runs on` : `${captures.map(({ device }) => device).join(" and ")}, adb serials of the device this profile runs on`;
|
|
162630
|
+
sentences.push(
|
|
162631
|
+
`Native network capture is on for ${apps.join(", ")} on ${where}: Argent attaches its in-app agent to the processes of ${apps.length === 1 ? "that app" : "these apps"}.`
|
|
162632
|
+
);
|
|
162633
|
+
}
|
|
162634
|
+
if (appId && maybe.length > 0) {
|
|
162635
|
+
const one = maybe.length === 1;
|
|
162636
|
+
sentences.push(
|
|
162637
|
+
`Native network capture is ${first ? "also " : ""}on for ${appId} on ${maybe.join(", ")}, ${one ? "which" : "each of which"} may also be the device this profile runs on: ${one ? "its logcat" : "their logcats"} could not be read to tell. Argent attaches its in-app agent to the processes of that app there.`
|
|
162638
|
+
);
|
|
162639
|
+
}
|
|
162640
|
+
const stops = [
|
|
162641
|
+
...captures.flatMap(({ device, packages }) => packages.map((app) => ({ app, device }))),
|
|
162642
|
+
...appId ? maybe.map((device) => ({ app: appId, device })) : []
|
|
162643
|
+
];
|
|
162644
|
+
const stop = first && captures.length === 1 && maybe.length === 0 ? `with udid ${first.device} and stop: true for ${first.packages.length === 1 ? "that app" : "each of these apps"}` : `with stop: true for ${stops.map(({ app, device }) => `${app} with udid ${device}`).join(", ")}`;
|
|
162645
|
+
const restart = first?.device ?? found[0];
|
|
162646
|
+
return `${sentences.join(" ")} ${CAPTURE_COST} To profile without it, stop this profile, call native-network-logs ${stop}, then restart-app on ${restart} and profile again.`;
|
|
162541
162647
|
}
|
|
162542
162648
|
function logicalDeviceWarning(deviceId, runtimeApp) {
|
|
162543
162649
|
const appId = runtimeApp?.appId;
|
|
@@ -162594,6 +162700,25 @@ function failedTakeoverText({ session_id, reason: reason2 }) {
|
|
|
162594
162700
|
const run2 = session_id ? `session ${session_id}` : "a recording with no owner record";
|
|
162595
162701
|
return `Before it failed, this start stopped ${run2} (reason: ${reason2}), and nothing is recording now.`;
|
|
162596
162702
|
}
|
|
162703
|
+
function findProfiledDevices(cdp) {
|
|
162704
|
+
return findRuntimeDevices(cdp, {
|
|
162705
|
+
awaitSerials: idsOf(liveAndroidNetworkCaptureSerials),
|
|
162706
|
+
waitSerials: idsOf(simulatorServerDeviceIds).map(externalNativeId)
|
|
162707
|
+
});
|
|
162708
|
+
}
|
|
162709
|
+
function trackedIds(found) {
|
|
162710
|
+
const driven = idsOf(simulatorServerDeviceIds).filter(
|
|
162711
|
+
(id) => found.includes(externalNativeId(id))
|
|
162712
|
+
);
|
|
162713
|
+
return [.../* @__PURE__ */ new Set([...found, ...driven])];
|
|
162714
|
+
}
|
|
162715
|
+
function idsOf(lookup) {
|
|
162716
|
+
try {
|
|
162717
|
+
return lookup();
|
|
162718
|
+
} catch {
|
|
162719
|
+
return [];
|
|
162720
|
+
}
|
|
162721
|
+
}
|
|
162597
162722
|
function safeGetState(registry2, urn) {
|
|
162598
162723
|
try {
|
|
162599
162724
|
return registry2.getServiceState(urn);
|
|
@@ -162794,7 +162919,7 @@ Fails if the Hermes runtime is not reachable or the Metro CDP connection cannot
|
|
|
162794
162919
|
}
|
|
162795
162920
|
await cdp.send("Profiler.stop").catch(ignore);
|
|
162796
162921
|
api.profilingActive = false;
|
|
162797
|
-
const
|
|
162922
|
+
const runtimeDevices = isLogicalKeyedDevice(api.deviceId) ? await findProfiledDevices(cdp) : { found: [], unresolved: [] };
|
|
162798
162923
|
const sessionId = crypto6.randomUUID();
|
|
162799
162924
|
const ownerPayload = {
|
|
162800
162925
|
sessionId,
|
|
@@ -162877,8 +163002,8 @@ Fails if the Hermes runtime is not reachable or the Metro CDP connection cannot
|
|
|
162877
163002
|
api.sessionId = sessionId;
|
|
162878
163003
|
api.ownerToolServerPid = process.pid;
|
|
162879
163004
|
trackProfilingRun(api.deviceId, api);
|
|
162880
|
-
|
|
162881
|
-
const warning = nativeNetworkCaptureWarning(deviceId
|
|
163005
|
+
for (const device of trackedIds(runtimeDevices.found)) trackProfilingRun(device, api);
|
|
163006
|
+
const warning = nativeNetworkCaptureWarning(api.deviceId, api.runtimeApp, runtimeDevices);
|
|
162882
163007
|
return {
|
|
162883
163008
|
started_at: new Date(startedAtEpochMs).toISOString(),
|
|
162884
163009
|
startedAtEpochMs,
|
|
@@ -162886,7 +163011,7 @@ Fails if the Hermes runtime is not reachable or the Metro CDP connection cannot
|
|
|
162886
163011
|
detected_architecture: api.detectedArchitecture,
|
|
162887
163012
|
...tookOver ? { took_over: tookOver } : {},
|
|
162888
163013
|
...warning ? { warning } : {},
|
|
162889
|
-
...isLogicalKeyedDevice(api.deviceId) &&
|
|
163014
|
+
...isLogicalKeyedDevice(api.deviceId) && runtimeDevices.found.length === 0 ? { [RESULT_NOTE_KEY]: UNKNOWN_DEVICE_NOTE } : {}
|
|
162890
163015
|
};
|
|
162891
163016
|
}
|
|
162892
163017
|
};
|
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.5",
|
|
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",
|